diff --git a/stm-firmware/safety/safety-controller.c b/stm-firmware/safety/safety-controller.c index af0a02e..9ae8904 100644 --- a/stm-firmware/safety/safety-controller.c +++ b/stm-firmware/safety/safety-controller.c @@ -248,6 +248,9 @@ static void init_safety_flag_persistencies_from_default(void) flag_persistencies_crc = crc_unit_get_crc(); } +/** + * @brief Apply the config overrrides stored in the safety memory. + */ static void apply_config_overrides(void) { uint32_t count; @@ -293,6 +296,15 @@ static void apply_config_overrides(void) flag_weight_crc = crc_unit_get_crc(); } +/** + * @brief Get the error state of a flag. + * + * This function takes inbto account that the error_flag::error_state and + * error_flag::error_state_inv fileds must never be the same value. In case they are, + * the flag is treated as errorneous. + * @param flag Flag to check + * @return The error state + */ static bool error_flag_get_status(const volatile struct error_flag *flag) { if (!flag) @@ -305,6 +317,11 @@ static bool error_flag_get_status(const volatile struct error_flag *flag) } } +/** + * @brief Find a analog value monitor structure by its enum number + * @param mon Enum representing the analog monitor + * @return NULL incase nothing is found, else pointer to structure. + */ static volatile struct analog_mon *find_analog_mon(enum analog_value_monitor mon) { uint32_t i; @@ -318,6 +335,11 @@ static volatile struct analog_mon *find_analog_mon(enum analog_value_monitor mon return ret; } +/** + * @brief Find a timing monitor structure by its enum number + * @param mon Enum representing the timing monitor + * @return NULL incase nothing is found, else pointer to structure. + */ static volatile struct timing_mon *find_timing_mon(enum timing_monitor mon) { uint32_t i; @@ -331,6 +353,9 @@ static volatile struct timing_mon *find_timing_mon(enum timing_monitor mon) return ret; } +/** + * @brief Check the active timing monitors and set the appropriate flags in case of an error. + */ static void safety_controller_process_active_timing_mons() { uint32_t i;