rcbench
Servo and ESC test bench: panel, IOmcu and shared C
Loading...
Searching...
No Matches
fault_log.h
Go to the documentation of this file.
1
34
35#pragma once
36
37#include <stdbool.h>
38#include <stdint.h>
39
40#include "card_tree.h"
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
49#define FAULT_SIZE_NONE (-1)
51#define FAULT_SIZE_UNREAD (-2)
52
56#define FAULT_LOG_CAP 1048576u /* 1MiB */
57
63typedef struct {
64 void *ctx;
68 bool (*mounted)(void *ctx);
72 card_dir_t (*make_dir)(void *ctx, const char *level);
78 int32_t (*size)(void *ctx, const char *path);
84 bool (*remove)(void *ctx, const char *path);
88 bool (*rename)(void *ctx, const char *from, const char *to);
92 bool (*append)(void *ctx, const char *path, const char *line);
94
108
119fault_log_t fault_log_note(const fault_log_io_t *io, const char *line,
120 bool *rotated);
121
122#ifdef __cplusplus
123}
124#endif
The folders of the panel's SD (Secure Digital) card, and the files in them with a fixed name.
card_dir_t
What making a folder came to.
Definition card_tree.h:118
fault_log_t fault_log_note(const fault_log_io_t *io, const char *line, bool *rotated)
Append line to the fault log, renamed to RCBENCH.OLD first when the line and its line feed would take...
Definition fault_log.c:93
fault_log_t
What a line came to.
Definition fault_log.h:98
@ FAULT_LOG_WRITE
Definition fault_log.h:106
@ FAULT_LOG_NO_ROOM
Definition fault_log.h:103
@ FAULT_LOG_NO_CARD
Definition fault_log.h:101
@ FAULT_LOG_ARG
Definition fault_log.h:100
@ FAULT_LOG_UNREAD
Definition fault_log.h:105
@ FAULT_LOG_NO_FOLDER
Definition fault_log.h:102
The card.
Definition fault_log.h:63
bool(*) remove(void *ctx, const char *path)
Remove file path.
Definition fault_log.h:84
card_dir_t(*) make_dir(void *ctx, const char *level)
Make one folder level (card_make_fn).
Definition fault_log.h:72
void * ctx
Definition fault_log.h:64
bool(*) mounted(void *ctx)
Whether a card is mounted.
Definition fault_log.h:68
bool(*) rename(void *ctx, const char *from, const char *to)
Give file from the name to, which no file has.
Definition fault_log.h:88
int32_t(*) size(void *ctx, const char *path)
The size of file path in bytes, INT32_MAX for a larger one; FAULT_SIZE_NONE when nothing has the name...
Definition fault_log.h:78
bool(*) append(void *ctx, const char *path, const char *line)
Append line and a line feed to path, creating the file.
Definition fault_log.h:92