|
STAR
Cal STAR — firmware, DAQ server, and engine design
|
#include "emmc_stm32.h"#include <string.h>#include "board.h"#include "cmsis_os2.h"#include "main.h"Go to the source code of this file.
Macros | |
| #define | LEGACY_MAX_HZ 26000000UL |
| #define | AXI_SRAM_START 0x24000000UL |
| #define | AXI_SRAM_END 0x24050000UL /* 320 KB with the default TCM split */ |
| #define | LOG_CHUNKS 4U /* 64 KB: ~1 s of card stall at ~60 kB/s */ |
Functions | |
| static bool | dma_reachable (const void *p, uint32_t bytes) |
| static bool | dcache_on (void) |
| static uint32_t | divider_for (uint32_t kernel_hz, uint32_t max_hz) |
| static void | clamp_clock (void) |
| static emmc_status_t | wait_transfer_state (uint32_t deadline) |
| static emmc_status_t | finish (uint32_t budget_ms) |
| static emmc_status_t | port_start (void *context, uint32_t *block_count) |
| static emmc_status_t | port_read (void *context, uint32_t lba, void *buffer, uint32_t count, uint32_t budget_ms) |
| static emmc_status_t | port_write (void *context, uint32_t lba, const void *buffer, uint32_t count, uint32_t budget_ms) |
| static void | port_lock (void *context) |
| static void | port_unlock (void *context) |
| void | HAL_MMC_TxCpltCallback (MMC_HandleTypeDef *hmmc) |
| void | HAL_MMC_RxCpltCallback (MMC_HandleTypeDef *hmmc) |
| void | HAL_MMC_ErrorCallback (MMC_HandleTypeDef *hmmc) |
| emmc_status_t | emmc_stm32_init (void) |
| emmc_log_t * | emmc_stm32_log (void) |
| const emmc_card_info_t * | emmc_stm32_card (uint32_t *issues) |
| void | emmc_stm32_writer_task (void *argument) |
Variables | |
| MMC_HandleTypeDef | hmmc1 |
| static emmc_log_chunk_t chunks[LOG_CHUNKS] | BOARD_DMA_BUFFER |
| static emmc_log_t | flight_log |
| static osMutexId_t | queue_mutex |
| static osSemaphoreId_t | transfer_done |
| static volatile bool | transfer_ok |
| static emmc_card_info_t | card |
| static uint32_t | card_issues |
| static bool | card_known |
| static const emmc_port_t | port |
| #define AXI_SRAM_END 0x24050000UL /* 320 KB with the default TCM split */ |
Definition at line 39 of file emmc_stm32.c.
Referenced by dma_reachable().
| #define AXI_SRAM_START 0x24000000UL |
Definition at line 38 of file emmc_stm32.c.
Referenced by dma_reachable().
| #define LEGACY_MAX_HZ 26000000UL |
Definition at line 37 of file emmc_stm32.c.
Referenced by clamp_clock(), and port_start().
Definition at line 40 of file emmc_stm32.c.
Referenced by emmc_stm32_init().
|
static |
Definition at line 80 of file emmc_stm32.c.
References divider_for(), HAL_RCCEx_GetPeriphCLKFreq(), hmmc1, LEGACY_MAX_HZ, MODIFY_REG, RCC_PERIPHCLK_SDMMC, READ_REG, and SDMMC_CLKCR_CLKDIV.
Referenced by port_start().
|
static |
Definition at line 69 of file emmc_stm32.c.
References SCB, and SCB_CCR_DC_Msk.
Referenced by port_read(), and port_write().
|
static |
Definition at line 73 of file emmc_stm32.c.
Referenced by clamp_clock(), and port_start().
|
static |
Definition at line 61 of file emmc_stm32.c.
References a, AXI_SRAM_END, AXI_SRAM_START, and p.
Referenced by port_read(), port_start(), and port_write().
| const emmc_card_info_t * emmc_stm32_card | ( | uint32_t * | issues | ) |
Definition at line 250 of file emmc_stm32.c.
References card, card_issues, card_known, and NULL.
| emmc_status_t emmc_stm32_init | ( | void | ) |
Definition at line 235 of file emmc_stm32.c.
References chunks, config, EMMC_ERR_NOT_READY, emmc_log_default_config(), emmc_log_init(), flight_log, LOG_CHUNKS, NULL, osMutexNew(), osSemaphoreNew(), port, queue_mutex, scratch, and transfer_done.
Referenced by start_emmc().
| emmc_log_t * emmc_stm32_log | ( | void | ) |
Definition at line 246 of file emmc_stm32.c.
References flight_log.
Referenced by app_set_state(), to_emmc(), and to_emmc().
| void emmc_stm32_writer_task | ( | void * | argument | ) |
Definition at line 260 of file emmc_stm32.c.
References emmc_log_backlog(), emmc_log_service(), flight_log, osDelay(), and osKernelGetTickCount().
Referenced by start_emmc().
|
static |
Definition at line 100 of file emmc_stm32.c.
References EMMC_ERR_IO, EMMC_ERR_TIMEOUT, hmmc1, osKernelGetTickCount(), osOK, osSemaphoreAcquire(), transfer_done, transfer_ok, and wait_transfer_state().
Referenced by port_read(), port_write(), and test_layerx_optimize_modes::test_setpoint_and_hardware_routes_start_their_jobs().
| void HAL_MMC_ErrorCallback | ( | MMC_HandleTypeDef * | hmmc | ) |
Definition at line 226 of file emmc_stm32.c.
References hmmc1, osSemaphoreRelease(), transfer_done, and transfer_ok.
| void HAL_MMC_RxCpltCallback | ( | MMC_HandleTypeDef * | hmmc | ) |
Definition at line 222 of file emmc_stm32.c.
References HAL_MMC_TxCpltCallback().
| void HAL_MMC_TxCpltCallback | ( | MMC_HandleTypeDef * | hmmc | ) |
Definition at line 215 of file emmc_stm32.c.
References hmmc1, osSemaphoreRelease(), transfer_done, and transfer_ok.
Referenced by HAL_MMC_RxCpltCallback().
|
static |
Definition at line 200 of file emmc_stm32.c.
References osMutexAcquire(), osWaitForever, and queue_mutex.
|
static |
Definition at line 164 of file emmc_stm32.c.
References count(), dcache_on(), dma_reachable(), EMMC_BLOCK_SIZE, EMMC_ERR_IO, EMMC_ERR_PARAM, finish(), HAL_OK, hmmc1, osSemaphoreAcquire(), SCB_InvalidateDCache_by_Addr(), and transfer_done.
|
static |
Definition at line 115 of file emmc_stm32.c.
References card, card_issues, card_known, chunks, clamp_clock(), divider_for(), dma_reachable(), EMMC_BLOCK_SIZE, emmc_card_check(), emmc_card_parse(), EMMC_ERR_IO, EMMC_ERR_NOT_READY, EMMC_ERR_PARAM, EMMC_OK, EMMC_RST_GPIO_Port, EMMC_RST_Pin, GPIO_PIN_SET, HAL_GPIO_WritePin(), HAL_OK, HAL_RCCEx_GetPeriphCLKFreq(), hmmc1, info, LEGACY_MAX_HZ, osDelay(), RCC_PERIPHCLK_SDMMC, scratch, SDMMC1, SDMMC_CLKCR_HWFC_EN, and SET_BIT.
|
static |
Definition at line 205 of file emmc_stm32.c.
References osMutexRelease(), and queue_mutex.
|
static |
Definition at line 182 of file emmc_stm32.c.
References count(), dcache_on(), dma_reachable(), EMMC_BLOCK_SIZE, EMMC_ERR_IO, EMMC_ERR_PARAM, finish(), HAL_OK, hmmc1, osSemaphoreAcquire(), SCB_CleanDCache_by_Addr(), and transfer_done.
|
static |
Definition at line 90 of file emmc_stm32.c.
References EMMC_ERR_TIMEOUT, EMMC_OK, hmmc1, osDelay(), and osKernelGetTickCount().
Referenced by finish().
|
static |
Definition at line 47 of file emmc_stm32.c.
|
static |
Definition at line 55 of file emmc_stm32.c.
Referenced by emmc_stm32_card(), port_start(), and read_image().
|
static |
Definition at line 56 of file emmc_stm32.c.
Referenced by emmc_stm32_card(), and port_start().
|
static |
Definition at line 57 of file emmc_stm32.c.
Referenced by emmc_stm32_card(), and port_start().
|
static |
Definition at line 51 of file emmc_stm32.c.
Referenced by emmc_stm32_init(), emmc_stm32_log(), and emmc_stm32_writer_task().
|
extern |
Definition at line 54 of file main.c.
Referenced by clamp_clock(), emmc_identify(), finish(), HAL_MMC_ErrorCallback(), HAL_MMC_TxCpltCallback(), MX_SDMMC1_MMC_Init(), port_read(), port_start(), port_write(), SDMMC1_IRQHandler(), and wait_transfer_state().
|
static |
Definition at line 210 of file emmc_stm32.c.
Referenced by sequencer::AbortBroadcaster::AbortBroadcaster(), anonymous_namespace{daq_bridge_main.cpp}::BackendLogForwarder::BackendLogForwarder(), StarOTA::PortableServer::begin(), daqtest::BoardListener::BoardListener(), bringup_task(), sequencer::AbortBroadcaster::configure(), daq_comms::transport::TCPClient::connect(), fsw::elodin::ElodinClient::connect(), fsw::elodin::ElodinClient::connect_locked(), anonymous_namespace{heartbeat_service_main.cpp}::elodinThread(), anonymous_namespace{stacklight_service_main.cpp}::elodinThread(), emmc_log_init(), emmc_stm32_init(), idle_init(), idle_task(), led(), log_new(), main(), main(), main(), sequencer::PressureFeed::operator=(), StarOTA::PortableServer::PortableServer(), runControlServer(), sequencer::PressureFeed::runLoop(), self_test_init(), StarOTA::Server::Server(), setup(), setup(), sequencer::PressureFeed::start(), test_init_rejects_bad_input(), test_invalid_init(), test_invalid_inputs(), test_request_id_is_on_the_wire(), test_reset_and_copied_dependencies(), test_injector_layout.TestIgniter::test_the_section_says_why_the_port_is_red(), test_wake_before_enter_is_error(), anonymous_namespace{idle_e2e.cpp}::world_init(), world_init(), writeFixture(), writeFixture(), and writeFixture().
|
static |
Definition at line 52 of file emmc_stm32.c.
Referenced by emmc_stm32_init(), port_lock(), and port_unlock().
|
static |
Definition at line 53 of file emmc_stm32.c.
Referenced by emmc_stm32_init(), finish(), HAL_MMC_ErrorCallback(), HAL_MMC_TxCpltCallback(), port_read(), and port_write().
|
static |
Definition at line 54 of file emmc_stm32.c.
Referenced by finish(), HAL_MMC_ErrorCallback(), and HAL_MMC_TxCpltCallback().