|
rcbench
Servo and ESC test bench: panel, IOmcu and shared C
|
The card as the file manager's core sees it: a table of functions the caller supplies, and the answers every part of the core gives. More...
Go to the source code of this file.
Data Structures | |
| struct | fm_dirent_t |
| One directory entry as a walk hands it over, borrowed for the call. More... | |
| struct | fm_stat_t |
| What stat() reads of one name. More... | |
| struct | fm_io_t |
The card: every function set, each answering FM_OK or the reason it failed. ctx is passed to each of them. More... | |
Macros | |
| #define | FM_NAME_BUF (FM_LIST_NAME_MAX + 1u) |
| Room for a listed name and its terminator: FM_LIST_NAME_MAX (63) bytes, as the panel's directory walk keeps them (STORAGE_NAME_MAX). A longer name is not listed and is counted as unlisted. The limits of names and paths are fm_name.h's; a path buffer is FM_PATH_SIZE. | |
Typedefs | |
| typedef void(*) | fm_visit_fn(const fm_dirent_t *entry, void *vctx) |
| Called once per entry of a walk. | |
Enumerations | |
| enum | fm_err_t { FM_OK = 0 , FM_ERR_NO_CARD , FM_ERR_CARD_GONE , FM_ERR_NOT_FOUND , FM_ERR_EXISTS , FM_ERR_FULL , FM_ERR_DENIED , FM_ERR_BUSY , FM_ERR_FIXED , FM_ERR_LOCKED , FM_ERR_NAME , FM_ERR_ARG , FM_ERR_IO , FM_ERR_NOT_EMPTY , FM_ERR_SAME , FM_ERR_TOO_BIG , FM_ERR_ARMED , FM_ERR_LOGGING , FM_ERR_CANCELLED , FM_ERR_COUNT } |
| What a call of the core or of the card came to. FM_OK is 0; every other value is a refusal or a failure, and the first one found is the answer. More... | |
| enum | fm_mode_t { FM_OPEN_READ = 0 , FM_OPEN_NEW } |
| How open() opens a file. More... | |
The card as the file manager's core sees it: a table of functions the caller supplies, and the answers every part of the core gives.
The core (fm_tree.h, fm_ops.h) holds no file system. The panel points fm_io_t at its SD (Secure Digital) card through the storage component; the host suite points it at a card in memory that fails on request.
Every path is from the card's root: folders separated by "/", no "/" at either end, "" the root itself (card_tree.h). A name is one level of a path. Names compare with case folded, as FAT (File Allocation Table) compares them: "report.txt" and "REPORT.TXT" are one file.
A volume is named by its mount number (mounts()): another number after a card is taken out and one is put in. A page of a folder is read from one mount, and a job on its names runs on that mount or not at all, so a card swapped since the listing is never written under a stale name.
Pure C, no ESP-IDF (Espressif Internet-of-Things Development Framework).
SPDX-License-Identifier: MIT
| typedef void(*) fm_visit_fn(const fm_dirent_t *entry, void *vctx) |
Called once per entry of a walk.
| entry | the entry, borrowed for the call |
| vctx | the walk's context, passed through untouched |
| enum fm_err_t |
What a call of the core or of the card came to. FM_OK is 0; every other value is a refusal or a failure, and the first one found is the answer.
| Enumerator | |
|---|---|
| FM_ERR_NO_CARD | nothing is mounted |
| FM_ERR_CARD_GONE | the card read from is gone or swapped |
| FM_ERR_NOT_FOUND | no such name, or a folder not made yet |
| FM_ERR_EXISTS | the target name is taken: no overwrite |
| FM_ERR_FULL | the card or the folder takes no more |
| FM_ERR_DENIED | the card refuses the write: write-protected |
| FM_ERR_BUSY | the logger writes the file |
| FM_ERR_FIXED | a place the bench keeps (fm_rules.h) |
| FM_ERR_LOCKED | the servo programmer's journal |
| FM_ERR_NAME | a name or path the card or a .NEW cannot take |
| FM_ERR_ARG | a NULL, or an operation on the wrong kind |
| FM_ERR_IO | any other failure of the card |
| FM_ERR_NOT_EMPTY | a folder that holds entries |
| FM_ERR_SAME | the target folder is the source's, or in it |
| FM_ERR_TOO_BIG | larger than the buffer it is loaded into |
| FM_ERR_ARMED | the bench is ARMED: the card is read-only |
| FM_ERR_LOGGING | a run is being logged: the card is read-only |
| FM_ERR_CANCELLED | stopped by CANCEL |
| enum fm_mode_t |