![]() |
ACwing FC firmware
STM32WB55: attitude IEKF, altitude Kalman filter, flight core, protocol v2
|
Flight-log store (see log_store.h). More...
Go to the source code of this file.
Functions | |
| uint8_t | log_crc8 (const uint8_t *p, uint32_t n) |
| uint16_t | log_crc16 (const uint8_t *p, uint32_t n) |
| static uint32_t | addr (uint16_t sect) |
| static uint16_t | next (uint16_t s) |
| static void | set_used (uint16_t s, uint8_t on) |
| static uint8_t | is_used (uint16_t s) |
| static int | hdr_ok (const log_sector_hdr_t *h) |
| static int | read_hdr (uint16_t s, log_sector_hdr_t *h) |
| static void | forget_sector (uint16_t sect) |
| int | log_mount (const log_flash_t *f) |
| 0 = ok (empty flash is ok) | |
| uint8_t | log_count (void) |
| const log_entry_t * | log_entry (uint8_t i) |
| oldest first | |
| uint8_t | log_is_open (void) |
| const log_entry_t * | log_find (uint16_t id) |
| uint8_t | log_used_pct (void) |
| static int | flush_page (void) |
| static int | start_sector (void) |
| int | log_open (uint32_t t0) |
| 0 = ok | |
| int | log_append (uint8_t type, const void *payload, uint8_t len) |
| int | log_close (void) |
| uint32_t | log_size (uint16_t id) |
| nsect × LOG_SECTOR, 0 unknown | |
| int | log_read (uint16_t id, uint32_t off, void *buf, uint32_t n) |
| bytes of a closed log 'id' from 'offset' (sectors concatenated, headers included) | |
| int | log_erase_all (void) |
| erases every sector that holds data; logs restart from id 1 | |
Variables | |
| static const log_flash_t * | F |
| static uint16_t | s_nsect |
| static uint16_t | s_wp |
| static uint32_t | s_serial |
| static uint16_t | s_last_id |
| static uint8_t | s_used [4096/8] |
| static log_entry_t | s_list [LOG_LIST_MAX] |
| static uint8_t | s_n |
| static uint8_t | s_open |
| static uint16_t | s_cur |
| static uint16_t | s_seq |
| static uint32_t | s_t0 |
| static uint32_t | s_pos |
| static uint8_t | s_page [LOG_PAGE] |
| static uint32_t | s_page_base |
Flight-log store (see log_store.h).
Definition in file log_store.c.
| uint8_t log_crc8 | ( | const uint8_t * | p, |
| uint32_t | n | ||
| ) |
Definition at line 28 of file log_store.c.
References n.
Referenced by log_append().
| uint16_t log_crc16 | ( | const uint8_t * | p, |
| uint32_t | n | ||
| ) |
Definition at line 38 of file log_store.c.
References n.
Referenced by hdr_ok(), and start_sector().
|
static |
Definition at line 49 of file log_store.c.
References LOG_SECTOR.
Referenced by baro_setup(), flush_page(), log_erase_all(), log_read(), read_hdr(), single_op(), start_sector(), USBD_LL_SetUSBAddress(), w25q_erase_sector(), w25q_prog(), and w25q_read().
|
static |
Definition at line 50 of file log_store.c.
Referenced by BattTask(), forget_sector(), log_mount(), and start_sector().
|
static |
Definition at line 51 of file log_store.c.
Referenced by forget_sector(), log_erase_all(), log_mount(), and start_sector().
|
static |
Definition at line 55 of file log_store.c.
Referenced by forget_sector(), log_erase_all(), log_mount(), and log_used_pct().
|
static |
Definition at line 57 of file log_store.c.
References log_sector_hdr_t::crc, log_sector_hdr_t::format, log_crc16(), LOG_FORMAT, LOG_HDR_SIZE, LOG_MAGIC, and log_sector_hdr_t::magic.
Referenced by read_hdr().
|
static |
Definition at line 63 of file log_store.c.
References addr(), log_flash_t::ctx, F, hdr_ok(), log_flash_t::read, and s.
Referenced by log_mount().
|
static |
Definition at line 70 of file log_store.c.
References log_entry_t::first, is_used(), next(), s_list, s_n, set_used(), and log_entry_t::truncated.
Referenced by start_sector().
| int log_mount | ( | const log_flash_t * | f | ) |
0 = ok (empty flash is ok)
Definition at line 82 of file log_store.c.
References F, log_entry_t::first, log_entry_t::id, is_used(), log_sector_hdr_t::log_id, LOG_LIST_MAX, LOG_SECTOR, next(), log_entry_t::nsect, read_hdr(), s, s_last_id, s_list, s_n, s_nsect, s_open, s_serial, s_used, s_wp, log_sector_hdr_t::seq, log_sector_hdr_t::serial, set_used(), log_flash_t::size, log_sector_hdr_t::t0_ms, log_entry_t::t0_ms, and log_entry_t::truncated.
Referenced by cmd(), and log_task_init().
| uint8_t log_count | ( | void | ) |
Definition at line 120 of file log_store.c.
References s_n.
Referenced by cmd(), cmd_list(), and last_log().
| const log_entry_t * log_entry | ( | uint8_t | i | ) |
oldest first
Definition at line 121 of file log_store.c.
Referenced by cmd_list(), and last_log().
| uint8_t log_is_open | ( | void | ) |
Definition at line 122 of file log_store.c.
References s_open.
Referenced by append_time(), close_log(), drain(), and recording().
| const log_entry_t * log_find | ( | uint16_t | id | ) |
Definition at line 124 of file log_store.c.
Referenced by log_read(), and log_size().
| uint8_t log_used_pct | ( | void | ) |
Definition at line 130 of file log_store.c.
References is_used(), n, s, and s_nsect.
Referenced by log_task_init(), and log_task_step().
|
static |
Definition at line 139 of file log_store.c.
References addr(), log_flash_t::ctx, F, log_flash_t::prog, s_cur, s_page, s_page_base, s_pos, and used.
Referenced by log_append(), and log_close().
|
static |
Definition at line 150 of file log_store.c.
References log_entry_t::active, addr(), log_sector_hdr_t::crc, log_flash_t::ctx, log_flash_t::erase, F, log_entry_t::first, forget_sector(), log_sector_hdr_t::format, log_entry_t::id, log_crc16(), LOG_FORMAT, LOG_HDR_SIZE, log_sector_hdr_t::log_id, LOG_LIST_MAX, LOG_MAGIC, log_sector_hdr_t::magic, next(), log_entry_t::nsect, s_cur, s_last_id, s_list, s_n, s_nsect, s_page, s_page_base, s_pos, s_seq, s_serial, s_t0, s_wp, log_sector_hdr_t::seq, log_sector_hdr_t::serial, set_used(), log_sector_hdr_t::t0_ms, and log_entry_t::t0_ms.
Referenced by log_append(), and log_open().
| int log_open | ( | uint32_t | t0 | ) |
0 = ok
Definition at line 182 of file log_store.c.
References F, s_last_id, s_open, s_seq, s_t0, and start_sector().
Referenced by open_log().
| int log_append | ( | uint8_t | type, |
| const void * | payload, | ||
| uint8_t | len | ||
| ) |
Definition at line 193 of file log_store.c.
References log_entry_t::active, flush_page(), log_crc8(), LOG_PAGE, LOG_REC_MAX, LOG_REC_OVERHEAD, LOG_SECTOR, n, s_list, s_n, s_open, s_page, s_page_base, s_pos, and start_sector().
Referenced by append_time(), drain(), and open_log().
| int log_close | ( | void | ) |
Definition at line 214 of file log_store.c.
References log_entry_t::active, flush_page(), s_list, s_n, and s_open.
Referenced by close_log().
| uint32_t log_size | ( | uint16_t | id | ) |
nsect × LOG_SECTOR, 0 unknown
Definition at line 224 of file log_store.c.
References log_find(), LOG_SECTOR, and log_entry_t::nsect.
Referenced by cmd().
| int log_read | ( | uint16_t | id, |
| uint32_t | off, | ||
| void * | buf, | ||
| uint32_t | n | ||
| ) |
bytes of a closed log 'id' from 'offset' (sectors concatenated, headers included)
Definition at line 230 of file log_store.c.
References log_entry_t::active, addr(), b, log_flash_t::ctx, F, log_entry_t::first, log_find(), LOG_SECTOR, n, log_entry_t::nsect, off, log_flash_t::read, and s_nsect.
Referenced by read_stream().
| int log_erase_all | ( | void | ) |
erases every sector that holds data; logs restart from id 1
Definition at line 246 of file log_store.c.
References addr(), log_flash_t::ctx, log_flash_t::erase, F, is_used(), s, s_last_id, s_n, s_nsect, s_open, s_wp, and set_used().
Referenced by cmd().
|
static |
Definition at line 8 of file log_store.c.
Referenced by alt_est_predict(), flush_page(), log_erase_all(), log_mount(), log_open(), log_read(), read_hdr(), and start_sector().
|
static |
Definition at line 9 of file log_store.c.
Referenced by log_erase_all(), log_mount(), log_read(), log_used_pct(), next(), and start_sector().
|
static |
Definition at line 10 of file log_store.c.
Referenced by log_erase_all(), log_mount(), and start_sector().
|
static |
Definition at line 11 of file log_store.c.
Referenced by log_mount(), and start_sector().
|
static |
Definition at line 12 of file log_store.c.
Referenced by log_erase_all(), log_mount(), log_open(), and start_sector().
|
static |
Definition at line 13 of file log_store.c.
Referenced by is_used(), log_mount(), and set_used().
|
static |
Definition at line 15 of file log_store.c.
Referenced by forget_sector(), log_append(), log_close(), log_entry(), log_find(), log_mount(), and start_sector().
|
static |
Definition at line 16 of file log_store.c.
Referenced by forget_sector(), log_append(), log_close(), log_count(), log_entry(), log_erase_all(), log_find(), log_mount(), and start_sector().
|
static |
Definition at line 19 of file log_store.c.
Referenced by log_append(), log_close(), log_erase_all(), log_is_open(), log_mount(), and log_open().
|
static |
Definition at line 20 of file log_store.c.
Referenced by flush_page(), and start_sector().
|
static |
Definition at line 21 of file log_store.c.
Referenced by log_open(), and start_sector().
|
static |
Definition at line 22 of file log_store.c.
Referenced by log_open(), and start_sector().
|
static |
Definition at line 23 of file log_store.c.
Referenced by flush_page(), log_append(), and start_sector().
|
static |
Definition at line 24 of file log_store.c.
Referenced by flush_page(), log_append(), and start_sector().
|
static |
Definition at line 25 of file log_store.c.
Referenced by flush_page(), log_append(), and start_sector().