Merge branch 'dev' into feature/28-profile-parser

This commit is contained in:
Mario Hüttel 2021-03-18 22:50:28 +01:00
commit e3e4a6d926
3 changed files with 13 additions and 13 deletions

View File

@ -144,8 +144,8 @@ struct config_override {
} weight_override; } weight_override;
struct { struct {
uint8_t flag; uint8_t flag;
bool persistance; bool persistence;
} persistance_override; } persistence_override;
} entry; } entry;
}; };

View File

@ -345,7 +345,7 @@ static int flag_weight_table_crc_check(void)
* @brief Check the CRC chacksum of the flag persistence table * @brief Check the CRC chacksum of the flag persistence table
* @return 0 if CRC is valid, else -1. * @return 0 if CRC is valid, else -1.
*/ */
static int flag_persistency_table_crc_check(void) static int flag_persistence_table_crc_check(void)
{ {
crc_unit_reset(); crc_unit_reset();
crc_unit_input_array((uint32_t*)flag_persistencies, wordsize_of(flag_persistencies)); crc_unit_input_array((uint32_t*)flag_persistencies, wordsize_of(flag_persistencies));
@ -463,10 +463,10 @@ static void apply_config_overrides(void)
} }
break; break;
case SAFETY_MEMORY_CONFIG_OVERRIDE_PERSISTENCE: case SAFETY_MEMORY_CONFIG_OVERRIDE_PERSISTENCE:
flag_enum = flag_no_to_flag_enum(override.entry.persistance_override.flag); flag_enum = flag_no_to_flag_enum(override.entry.persistence_override.flag);
flag = find_error_flag(flag_enum); flag = find_error_flag(flag_enum);
if (flag && flag->persistence) { if (flag && flag->persistence) {
flag->persistence->persistence = override.entry.persistance_override.persistance; flag->persistence->persistence = override.entry.persistence_override.persistence;
} }
break; break;
default: default:
@ -898,7 +898,7 @@ static void safety_controller_handle_safety_adc()
* flag is set. * flag is set.
* 2) The flag weight table is CRC checked. In case of an error, the @ref ERR_FLAG_SAFETY_TAB_CORRUPT flag is set. * 2) The flag weight table is CRC checked. In case of an error, the @ref ERR_FLAG_SAFETY_TAB_CORRUPT flag is set.
* Aditionally, the default flag weights are restored from Flash. * Aditionally, the default flag weights are restored from Flash.
* 3) The flag persistency table is CRC checked. In case of an error, the @ref ERR_FLAG_SAFETY_TAB_CORRUPT flag is set. * 3) The flag persistence table is CRC checked. In case of an error, the @ref ERR_FLAG_SAFETY_TAB_CORRUPT flag is set.
* Aditionally, the default values of the flag persistence is restored from Flash. * Aditionally, the default values of the flag persistence is restored from Flash.
* 4) Check the Overtemperature flag configuration structure * 4) Check the Overtemperature flag configuration structure
*/ */
@ -924,8 +924,8 @@ static void safety_controller_handle_memory_checks(void)
init_safety_flag_weight_table_from_default(); init_safety_flag_weight_table_from_default();
} }
/* If persistency table is broken, reinit to default and set flag */ /* If persistence table is broken, reinit to default and set flag */
if(flag_persistency_table_crc_check()) { if(flag_persistence_table_crc_check()) {
safety_controller_report_error(ERR_FLAG_SAFETY_TAB_CORRUPT); safety_controller_report_error(ERR_FLAG_SAFETY_TAB_CORRUPT);
init_safety_flag_persistencies_from_default(); init_safety_flag_persistencies_from_default();
} }

View File

@ -488,8 +488,8 @@ static uint32_t convert_config_override_to_word(const struct config_override *co
data |= ((uint32_t)conf_override->entry.weight_override.weight) << 8; data |= ((uint32_t)conf_override->entry.weight_override.weight) << 8;
} else if (conf_override->type == SAFETY_MEMORY_CONFIG_OVERRIDE_PERSISTENCE) { } else if (conf_override->type == SAFETY_MEMORY_CONFIG_OVERRIDE_PERSISTENCE) {
data |= 0xBB00008EUL; data |= 0xBB00008EUL;
data |= ((uint32_t)conf_override->entry.persistance_override.flag) << 16; data |= ((uint32_t)conf_override->entry.persistence_override.flag) << 16;
data |= ((uint32_t)(conf_override->entry.persistance_override.persistance ? 1UL : 0UL)) << 8; data |= ((uint32_t)(conf_override->entry.persistence_override.persistence ? 1UL : 0UL)) << 8;
} }
return data; return data;
@ -596,10 +596,10 @@ int safety_memory_get_config_override(uint32_t idx, struct config_override *conf
config_override->entry.weight_override.weight = (data & 0xFF00UL) >> 8; config_override->entry.weight_override.weight = (data & 0xFF00UL) >> 8;
break; break;
case 0x8E: case 0x8E:
/* persistance override */ /* persistence override */
config_override->type = SAFETY_MEMORY_CONFIG_OVERRIDE_PERSISTENCE; config_override->type = SAFETY_MEMORY_CONFIG_OVERRIDE_PERSISTENCE;
config_override->entry.persistance_override.flag = (data & 0xFF0000UL) >> 16; config_override->entry.persistence_override.flag = (data & 0xFF0000UL) >> 16;
config_override->entry.persistance_override.persistance = ((data & 0xFF00UL) >> 8) ? true : false; config_override->entry.persistence_override.persistence = ((data & 0xFF00UL) >> 8) ? true : false;
break; break;
default: default:
return -2; return -2;