The logger: the runlog task, which makes every card call of a run, a servo test and the fault log. A run is written to AUTO LOG FOLDER, a test to USER LOG FOLDER (SETUP > SD CARD; CARD_AUTO_LOGS and CARD_USER_LOGS by default, card_tree.h), each under its folder's next number (log_take.h). The control task's side, which numbers the runs and posts the rows, is in main.c.
More...
|
|
void | log_set_folder (log_folder_t kind, const char *dir) |
|
static void | folder_take (log_folder_t kind, char *dir) |
|
void | log_open_marks (log_marks_t *marks, char *run_dir, char *test_dir) |
|
static bool | take_mounted (void *ctx) |
|
static void | take_path (const char *dir, const char *name, char *path, size_t n) |
|
card_dir_t | panel_card_make_dir (void *ctx, const char *level) |
|
static bool | take_make_dir (void *ctx, const char *dir) |
|
static void | take_walk_entry (const storage_entry_t *entry, void *ctx) |
|
static bool | take_walk (void *ctx, const char *dir, log_take_visit_fn visit, void *visit_ctx) |
|
static bool | take_exists (void *ctx, const char *dir, const char *name) |
|
static bool | take_create (void *ctx, const char *dir, const char *name, int number) |
|
static log_take_t | take (const char *dir, log_prefix_t prefix, bool report, FILE **fp, atomic_uint *mark, int tab, int *number) |
|
static void | take_alert (log_take_t r, const char *dir, const char *other) |
|
static int | file_write (void *ctx, const void *data, size_t len) |
|
static bool | file_flush (void *ctx) |
|
static log_prefix_t | run_prefix (log_run_kind_t kind) |
|
static void | log_open (uint32_t run, log_run_kind_t kind) |
|
static void | log_close (void) |
|
static void | log_drop (void) |
| static void | test_path (log_prefix_t prefix, int number, bool txt, char *path, size_t n) |
| | Run number's file in the test folder as a path on the card: ATESTnnn.CSV, ATESTnnn.TXT or LIMITnnn.TXT.
|
|
static void | test_close (void) |
| | Close the open test file, if any, and say so on the console with the lines it holds: "closed" when every write and the close went through, "closed short" otherwise.
|
| static void | test_open (bool txt) |
| | A run's OPEN: the folder's next number, as log_open() takes one.
|
| static void | test_write (const test_line_t *l) |
| | One line from the render loop: an OPEN, an END, or a line of the open run's CSV or report.
|
| bool | log_fault_busy (void) |
| | Whether the logger may write a fault log line now: one queued in s_note_q, or under way. The file manager's bench reads it (fm_bench_t.fault_busy).
|
|
void | log_fault_lock (void) |
| | Take the fault log's lock, which the logger holds across each line's open, write and close. The file manager holds it across an unlink and a rename: FatFs runs without its file lock (CONFIG_FATFS_FS_LOCK 0) and removes a file open for append. Neither holder takes another lock under it.
|
|
void | log_fault_unlock (void) |
| | Give the fault log's lock back.
|
|
static bool | note_mounted (void *ctx) |
|
static int32_t | note_size (void *ctx, const char *path) |
|
static bool | note_remove (void *ctx, const char *path) |
|
static bool | note_rename (void *ctx, const char *from, const char *to) |
|
static bool | note_append (void *ctx, const char *path, const char *line) |
|
static void | log_note (const char *line) |
| void | log_task (void *arg) |
| | Everything that touches the card.
|
|
|
static const char * | TAG = "rcbench" |
| QueueHandle_t | s_log_q |
| QueueHandle_t | s_note_q |
|
SemaphoreHandle_t | s_note_mx |
| | The fault log's lock (log_fault_lock()).
|
|
atomic_uint | s_log_run_now |
|
static FILE * | s_log_file |
|
static uint32_t | s_log_run_id |
|
static log_series_set_t | s_series |
|
static unsigned | s_series_mount |
|
static portMUX_TYPE | s_dir_mux = portMUX_INITIALIZER_UNLOCKED |
| static char | s_dir_want [LOG_FOLDERS][CARD_DIR_MAX] |
| static char | s_dir_open [LOG_FOLDERS][CARD_DIR_MAX] |
| static char | s_dir_took [LOG_FOLDERS][CARD_DIR_MAX] |
|
atomic_uint | s_card_written |
|
atomic_int | s_card_written_tab = LOG_TAB_BENCH |
|
static log_writer_t | s_log |
|
static uint32_t | s_log_last_row_ms |
| QueueHandle_t | s_test_q |
|
atomic_uint | s_test_opens_sent |
|
atomic_uint | s_test_opens_done |
|
unsigned | s_test_ends_sent |
|
atomic_uint | s_test_ends_done |
|
atomic_int | s_test_file |
|
atomic_bool | s_test_report |
|
static FILE * | s_test_fp |
|
static int | s_test_num |
|
static bool | s_test_txt |
|
static unsigned | s_test_lines |
|
static bool | s_test_failed |
|
static bool | s_test_txt_bad |
|
static char | s_test_dir [CARD_DIR_MAX] |
|
static char | s_test_path [64] |
| | The open test file's path, for the console lines.
|
|
static unsigned | s_test_count |
| | The lines written to the open test file.
|
|
static bool | s_test_file_bad |
| | A write to the open test file failed.
|
|
static bool | s_note_held |
|
static atomic_bool | s_note_writing |
| | Set from before the logger takes a queued line until the last one is written (log_fault_busy()).
|
The logger: the runlog task, which makes every card call of a run, a servo test and the fault log. A run is written to AUTO LOG FOLDER, a test to USER LOG FOLDER (SETUP > SD CARD; CARD_AUTO_LOGS and CARD_USER_LOGS by default, card_tree.h), each under its folder's next number (log_take.h). The control task's side, which numbers the runs and posts the rows, is in main.c.
SPDX-License-Identifier: MIT