|
STAR
Cal STAR — firmware, DAQ server, and engine design
|
Go to the source code of this file.
Classes | |
| struct | emmc_log_chunk_t |
| struct | emmc_log_config_t |
| struct | emmc_log_stats_t |
| struct | emmc_log_t |
Macros | |
| #define | EMMC_LOG_CHUNK_BLOCKS 32U |
| #define | EMMC_LOG_CHUNK_BYTES (EMMC_LOG_CHUNK_BLOCKS * EMMC_BLOCK_SIZE) |
| #define | EMMC_LOG_MAX_CHUNKS 16U |
| #define | EMMC_LOG_HEADER_BYTES 20U |
| #define | EMMC_LOG_PAYLOAD_BYTES (EMMC_BLOCK_SIZE - EMMC_LOG_HEADER_BYTES - 4U) |
| #define | EMMC_LOG_RECORD_HEADER_BYTES 6U |
| #define | EMMC_LOG_SUPER_MAGIC 0x31425353UL /* "SSB1" */ |
| #define | EMMC_LOG_BLOCK_MAGIC 0x31474C53UL /* "SLG1" */ |
| #define | EMMC_LOG_LAYOUT_VERSION 1U |
| #define | EMMC_LOG_KIND_DATA 1U |
| #define | EMMC_LOG_KIND_PAD 2U |
| #define | EMMC_REC_SESSION_START 0x01U /* data: u8 state entered */ |
| #define | EMMC_REC_STATE 0x02U /* data: u8 from, u8 to */ |
| #define | EMMC_REC_SESSION_END 0x03U /* data: u8 state entered */ |
| #define | EMMC_REC_DROPPED 0x04U /* data: u32 records lost before this */ |
| #define | EMMC_REC_USER_FIRST 0x10U |
| #define | EMMC_LOG_DEFAULT_DATA_START 8192UL |
Enumerations | |
| enum | emmc_disk_state_t { EMMC_DISK_UNMOUNTED = 0 , EMMC_DISK_MOUNTED , EMMC_DISK_FULL , EMMC_DISK_FAULT } |
| enum | emmc_chunk_state_t { EMMC_CHUNK_FREE = 0 , EMMC_CHUNK_FILLING , EMMC_CHUNK_READY } |
Functions | |
| emmc_log_config_t | emmc_log_default_config (void) |
| emmc_status_t | emmc_log_init (emmc_log_t *log, const emmc_port_t *port, void *context, const emmc_log_config_t *config, emmc_log_chunk_t *chunks, uint8_t chunk_count, uint8_t *scratch) |
| bool | emmc_log_on_state (emmc_log_t *log, flight_state_t from, flight_state_t to, uint32_t now_ms) |
| bool | emmc_log_append (emmc_log_t *log, uint8_t type, uint32_t t_ms, const void *data, uint8_t len) |
| void | emmc_log_flush (emmc_log_t *log) |
| emmc_status_t | emmc_log_service (emmc_log_t *log, uint32_t now_ms) |
| uint8_t | emmc_log_backlog (const emmc_log_t *log) |
| uint32_t | emmc_log_crc32 (const void *data, uint32_t len) |
| #define EMMC_LOG_BLOCK_MAGIC 0x31474C53UL /* "SLG1" */ |
Definition at line 64 of file emmc_log.h.
Referenced by emmc_log_service(), format(), and probe().
| #define EMMC_LOG_CHUNK_BLOCKS 32U |
Definition at line 55 of file emmc_log.h.
Referenced by close_block(), emmc_log_service(), mount(), and seal().
| #define EMMC_LOG_CHUNK_BYTES (EMMC_LOG_CHUNK_BLOCKS * EMMC_BLOCK_SIZE) |
Definition at line 56 of file emmc_log.h.
Referenced by acquire().
| #define EMMC_LOG_DEFAULT_DATA_START 8192UL |
Definition at line 78 of file emmc_log.h.
Referenced by emmc_log_default_config().
| #define EMMC_LOG_HEADER_BYTES 20U |
Definition at line 59 of file emmc_log.h.
Referenced by put_record().
| #define EMMC_LOG_KIND_DATA 1U |
Definition at line 67 of file emmc_log.h.
Referenced by close_block(), and probe().
| #define EMMC_LOG_KIND_PAD 2U |
Definition at line 68 of file emmc_log.h.
| #define EMMC_LOG_LAYOUT_VERSION 1U |
Definition at line 65 of file emmc_log.h.
| #define EMMC_LOG_MAX_CHUNKS 16U |
Definition at line 57 of file emmc_log.h.
Referenced by emmc_log_init(), and test_invalid_init().
| #define EMMC_LOG_PAYLOAD_BYTES (EMMC_BLOCK_SIZE - EMMC_LOG_HEADER_BYTES - 4U) |
Definition at line 60 of file emmc_log.h.
Referenced by probe(), and put_record().
| #define EMMC_LOG_RECORD_HEADER_BYTES 6U |
Definition at line 61 of file emmc_log.h.
Referenced by put_record().
| #define EMMC_LOG_SUPER_MAGIC 0x31425353UL /* "SSB1" */ |
Definition at line 63 of file emmc_log.h.
Definition at line 74 of file emmc_log.h.
Referenced by keep(), and test_backpressure().
| #define EMMC_REC_SESSION_END 0x03U /* data: u8 state entered */ |
Definition at line 73 of file emmc_log.h.
Referenced by check_emmc_roundtrip(), emmc_log_on_state(), and test_session_roundtrip().
| #define EMMC_REC_SESSION_START 0x01U /* data: u8 state entered */ |
Definition at line 71 of file emmc_log.h.
Referenced by check_emmc_roundtrip(), emmc_log_on_state(), and test_session_roundtrip().
| #define EMMC_REC_STATE 0x02U /* data: u8 from, u8 to */ |
Definition at line 72 of file emmc_log.h.
Referenced by check_emmc_roundtrip(), emmc_log_on_state(), and test_flight_keeps_recording().
| #define EMMC_REC_USER_FIRST 0x10U |
Definition at line 75 of file emmc_log.h.
Referenced by check_conservation(), and check_emmc_stall().
| enum emmc_chunk_state_t |
| Enumerator | |
|---|---|
| EMMC_CHUNK_FREE | |
| EMMC_CHUNK_FILLING | |
| EMMC_CHUNK_READY | |
Definition at line 108 of file emmc_log.h.
| enum emmc_disk_state_t |
| Enumerator | |
|---|---|
| EMMC_DISK_UNMOUNTED | |
| EMMC_DISK_MOUNTED | |
| EMMC_DISK_FULL | |
| EMMC_DISK_FAULT | |
Definition at line 92 of file emmc_log.h.
| bool emmc_log_append | ( | emmc_log_t * | log, |
| uint8_t | type, | ||
| uint32_t | t_ms, | ||
| const void * | data, | ||
| uint8_t | len ) |
Definition at line 235 of file emmc_log.c.
References keep(), lock, ok, emmc_log_t::recording, and unlock().
Referenced by sink(), test_backpressure(), test_flight_keeps_recording(), test_full(), test_no_io_before_arm(), test_session_roundtrip(), test_sessions_and_remount(), test_start_failure(), test_torn_write(), test_write_retry(), to_emmc(), and to_emmc().
| uint8_t emmc_log_backlog | ( | const emmc_log_t * | log | ) |
Definition at line 252 of file emmc_log.c.
References emmc_log_t::chunk_count, emmc_log_t::chunk_state, and EMMC_CHUNK_READY.
Referenced by drain(), emmc_stm32_writer_task(), fly(), service_card(), and test_backpressure().
| uint32_t emmc_log_crc32 | ( | const void * | data, |
| uint32_t | len ) |
Definition at line 31 of file emmc_log.c.
References p.
Referenced by emmc_log_service(), format(), mount(), probe(), and test_crc().
| emmc_log_config_t emmc_log_default_config | ( | void | ) |
Definition at line 167 of file emmc_log.c.
References emmc_log_config_t::data_start_lba, EMMC_LOG_DEFAULT_DATA_START, emmc_log_config_t::flush_interval_ms, emmc_log_config_t::read_budget_ms, emmc_log_config_t::write_attempts, and emmc_log_config_t::write_budget_ms.
Referenced by config(), emmc_stm32_init(), anonymous_namespace{idle_e2e.cpp}::world_init(), and world_init().
| void emmc_log_flush | ( | emmc_log_t * | log | ) |
Definition at line 246 of file emmc_log.c.
References lock, seal(), and unlock().
Referenced by test_backpressure(), test_flight_keeps_recording(), test_full(), test_sessions_and_remount(), test_stale_epoch(), test_start_failure(), test_torn_write(), test_torn_write_hole(), and test_write_retry().
| emmc_status_t emmc_log_init | ( | emmc_log_t * | log, |
| const emmc_port_t * | port, | ||
| void * | context, | ||
| const emmc_log_config_t * | config, | ||
| emmc_log_chunk_t * | chunks, | ||
| uint8_t | chunk_count, | ||
| uint8_t * | scratch ) |
Definition at line 177 of file emmc_log.c.
References emmc_log_t::chunk_count, chunks, emmc_log_t::chunks, config, emmc_log_t::config, emmc_log_t::context, emmc_log_t::disk, EMMC_DISK_UNMOUNTED, EMMC_ERR_PARAM, EMMC_LOG_MAX_CHUNKS, EMMC_OK, NULL, emmc_log_t::port, port, emmc_log_t::scratch, and scratch.
Referenced by emmc_stm32_init(), log_new(), test_invalid_init(), anonymous_namespace{idle_e2e.cpp}::world_init(), and world_init().
| bool emmc_log_on_state | ( | emmc_log_t * | log, |
| flight_state_t | from, | ||
| flight_state_t | to, | ||
| uint32_t | now_ms ) |
Definition at line 200 of file emmc_log.c.
References emmc_log_t::arm_index, emmc_log_t::disk, EMMC_DISK_FAULT, EMMC_DISK_FULL, EMMC_REC_SESSION_END, EMMC_REC_SESSION_START, EMMC_REC_STATE, flight_state_logs_to_emmc(), keep(), lock, ok, emmc_log_t::recording, seal(), unlock(), and emmc_log_t::unreported_drops.
Referenced by app_set_state(), change_state(), anonymous_namespace{idle_e2e.cpp}::set_state(), test_backpressure(), test_flight_keeps_recording(), test_flush_interval(), test_full(), test_no_io_before_arm(), test_session_roundtrip(), test_sessions_and_remount(), test_stale_epoch(), test_start_failure(), test_torn_write(), test_torn_write_hole(), and test_write_retry().
| emmc_status_t emmc_log_service | ( | emmc_log_t * | log, |
| uint32_t | now_ms ) |
Definition at line 424 of file emmc_log.c.
References arm(), b, emmc_log_t::base_session, block_at(), emmc_log_chunk_t::bytes, emmc_log_t::capacity, emmc_log_t::chunk_arm, emmc_log_t::chunk_state, emmc_log_t::chunks, emmc_log_t::config, emmc_log_t::context, emmc_log_config_t::data_start_lba, emmc_log_t::disk, EMMC_CHUNK_READY, EMMC_DISK_FAULT, EMMC_DISK_FULL, EMMC_DISK_MOUNTED, EMMC_DISK_UNMOUNTED, EMMC_ERR_NOT_READY, EMMC_LOG_BLOCK_MAGIC, EMMC_LOG_CHUNK_BLOCKS, emmc_log_crc32(), EMMC_OK, emmc_log_t::epoch, emmc_log_t::fill_aged, emmc_log_t::fill_started_ms, emmc_log_config_t::flush_interval_ms, emmc_log_t::has_fill, emmc_log_t::head, lock, mount(), emmc_log_t::port, put32(), release_write_chunk(), seal(), emmc_log_t::stats, stop(), unlock(), emmc_port_t::write, emmc_log_config_t::write_attempts, emmc_log_config_t::write_budget_ms, emmc_log_t::write_chunk, emmc_log_stats_t::write_errors, and emmc_log_t::write_tries.
Referenced by drain(), emmc_stm32_writer_task(), service_card(), test_flush_interval(), test_full(), test_no_io_before_arm(), test_start_failure(), test_torn_write(), test_torn_write_hole(), and test_write_retry().