|
ChibiOS 21.11.5
|
HAL Safety Module. More...
HAL Safety Module.

Function variants | |
| #define | halRegSet8X(p, s, v) |
| Sets bits into an 8 bits register. | |
| #define | halRegSet16X(p, s, v) |
| Sets bits into a 16 bits register. | |
| #define | halRegSet32X(p, s, v) |
| Sets bits into a 32 bits register. | |
| #define | halRegClear8X(p, c, v) |
| Clears bits into an 8 bits register. | |
| #define | halRegClear16X(p, c, v) |
| Clears bits into a 16 bits register. | |
| #define | halRegClear32X(p, c, v) |
| Clears bits into a 32 bits register. | |
Macros | |
| #define | HAL_US2RTC(freq, usec) |
| #define | HAL_USE_SAFETY FALSE |
| Enables the safety-related features in HAL. | |
Typedefs | |
| typedef unsigned | halcnt_t |
Functions | |
| static uint32_t | get_frequency (void) |
| static halcnt_t | get_counter (void) |
| static bool | is_counter_within (halcnt_t start, halcnt_t end) |
| CC_NO_RETURN void | halSftFail (const char *message) |
| Common safety fault handler. | |
| bool | halRegWaitMatch8X (volatile uint8_t *p, uint8_t mask, uint8_t match, uint32_t tmo, uint8_t *valp) |
| Waits for masked bits to match or a timeout. | |
| bool | halRegWaitMatch16X (volatile uint16_t *p, uint16_t mask, uint16_t match, uint32_t tmo, uint16_t *valp) |
| Waits for masked bits to match or a timeout. | |
| bool | halRegWaitMatch32X (volatile uint32_t *p, uint32_t mask, uint32_t match, uint32_t tmo, uint32_t *valp) |
| Waits for masked bits to match or a timeout. | |
| bool | halRegWaitAllSet8X (volatile uint8_t *p, uint8_t mask, uint32_t tmo, uint8_t *valp) |
| Waits for all specified bits to be set or a timeout. | |
| bool | halRegWaitAllSet16X (volatile uint16_t *p, uint16_t mask, uint32_t tmo, uint16_t *valp) |
| Waits for all specified bits to be set or a timeout. | |
| bool | halRegWaitAllSet32X (volatile uint32_t *p, uint32_t mask, uint32_t tmo, uint32_t *valp) |
| Waits for all specified bits to be set or a timeout. | |
| bool | halRegWaitAnySet8X (volatile uint8_t *p, uint8_t mask, uint32_t tmo, uint8_t *valp) |
| Waits for any of specified bits to be set or a timeout. | |
| bool | halRegWaitAnySet16X (volatile uint16_t *p, uint16_t mask, uint32_t tmo, uint16_t *valp) |
| Waits for any of specified bits to be set or a timeout. | |
| bool | halRegWaitAnySet32X (volatile uint32_t *p, uint32_t mask, uint32_t tmo, uint32_t *valp) |
| Waits for any of specified bits to be set or a timeout. | |
| bool | halRegWaitAllClear8X (volatile uint8_t *p, uint8_t mask, uint32_t tmo, uint8_t *valp) |
| Waits for all specified bits to be cleared or a timeout. | |
| bool | halRegWaitAllClear16X (volatile uint16_t *p, uint16_t mask, uint32_t tmo, uint16_t *valp) |
| Waits for all specified bits to be cleared or a timeout. | |
| bool | halRegWaitAllClear32X (volatile uint32_t *p, uint32_t mask, uint32_t tmo, uint32_t *valp) |
| Waits for all specified bits to be cleared or a timeout. | |
| bool | halRegWaitAnyClear8X (volatile uint8_t *p, uint8_t mask, uint32_t tmo, uint8_t *valp) |
| Waits for any of specified bits to be cleared or a timeout. | |
| bool | halRegWaitAnyClear16X (volatile uint16_t *p, uint16_t mask, uint32_t tmo, uint16_t *valp) |
| Waits for any of specified bits to be cleared or a timeout. | |
| bool | halRegWaitAnyClear32X (volatile uint32_t *p, uint32_t mask, uint32_t tmo, uint32_t *valp) |
| Waits for any of specified bits to be cleared or a timeout. | |
| static void | halSftFailOnError (bool result, const char *message) |
| Enters a common safety fault handler on error. | |
| static void | halRegWrite8X (volatile uint8_t *p, uint8_t value, bool verify) |
| Writes an 8 bits register. | |
| static void | halRegWrite16X (volatile uint16_t *p, uint16_t value, bool verify) |
| Writes a 16 bits register. | |
| static void | halRegWrite32X (volatile uint32_t *p, uint32_t value, bool verify) |
| Writes a 32 bits register. | |
| static void | halRegModify8X (volatile uint8_t *p, uint8_t setmask, uint8_t clrmask, bool verify) |
| Modifies a 8 bits register. | |
| static void | halRegModify16X (volatile uint16_t *p, uint16_t setmask, uint16_t clrmask, bool verify) |
| Modifies a 16 bits register. | |
| static void | halRegModify32X (volatile uint32_t *p, uint32_t setmask, uint32_t clrmask, bool verify) |
| Modifies a 32 bits register. | |
| static void | halRegMaskedWrite8X (volatile uint8_t *p, uint8_t mask, uint8_t value, bool verify) |
| Writes a field into an 8 bits register. | |
| static void | halRegMaskedWrite16X (volatile uint16_t *p, uint16_t mask, uint16_t value, bool verify) |
| Writes a field into a 16 bits register. | |
| static void | halRegMaskedWrite32X (volatile uint32_t *p, uint32_t mask, uint32_t value, bool verify) |
| Writes a field into a 32 bits register. | |
| #define HAL_US2RTC | ( | freq, | |
| usec ) |
Definition at line 31 of file hal_safety.c.
Referenced by halRegWaitAllClear16X(), halRegWaitAllClear32X(), halRegWaitAllClear8X(), halRegWaitAllSet16X(), halRegWaitAllSet32X(), halRegWaitAllSet8X(), halRegWaitAnyClear16X(), halRegWaitAnyClear32X(), halRegWaitAnyClear8X(), halRegWaitAnySet16X(), halRegWaitAnySet32X(), halRegWaitAnySet8X(), halRegWaitMatch16X(), halRegWaitMatch32X(), and halRegWaitMatch8X().
| #define HAL_USE_SAFETY FALSE |
Enables the safety-related features in HAL.
Definition at line 41 of file hal_safety.h.
| #define halRegSet8X | ( | p, | |
| s, | |||
| v ) |
Sets bits into an 8 bits register.
| [in] | p | pointer to the register |
| [in] | s | mask of bits to be set |
| [in] | v | verification flag, register is read back if true, this flag only has effect if HAL_USE_SAFETY is set to TRUE |
Definition at line 74 of file hal_safety.h.
| #define halRegSet16X | ( | p, | |
| s, | |||
| v ) |
Sets bits into a 16 bits register.
| [in] | p | pointer to the register |
| [in] | s | mask of bits to be set |
| [in] | v | verification flag, register is read back if true, this flag only has effect if HAL_USE_SAFETY is set to TRUE |
Definition at line 90 of file hal_safety.h.
| #define halRegSet32X | ( | p, | |
| s, | |||
| v ) |
Sets bits into a 32 bits register.
| [in] | p | pointer to the register |
| [in] | s | mask of bits to be set |
| [in] | v | verification flag, register is read back if true, this flag only has effect if HAL_USE_SAFETY is set to TRUE |
Definition at line 106 of file hal_safety.h.
| #define halRegClear8X | ( | p, | |
| c, | |||
| v ) |
Clears bits into an 8 bits register.
| [in] | p | pointer to the register |
| [in] | c | mask of bits to be cleared |
| [in] | v | verification flag, register is read back if true, this flag only has effect if HAL_USE_SAFETY is set to TRUE |
Definition at line 122 of file hal_safety.h.
| #define halRegClear16X | ( | p, | |
| c, | |||
| v ) |
Clears bits into a 16 bits register.
| [in] | p | pointer to the register |
| [in] | c | mask of bits to be cleared |
| [in] | v | verification flag, register is read back if true, this flag only has effect if HAL_USE_SAFETY is set to TRUE |
Definition at line 138 of file hal_safety.h.
| #define halRegClear32X | ( | p, | |
| c, | |||
| v ) |
Clears bits into a 32 bits register.
| [in] | p | pointer to the register |
| [in] | c | mask of bits to be cleared |
| [in] | v | verification flag, register is read back if true, this flag only has effect if HAL_USE_SAFETY is set to TRUE |
Definition at line 154 of file hal_safety.h.
| typedef unsigned halcnt_t |
Definition at line 47 of file hal_safety.c.
|
inlinestatic |
Definition at line 50 of file hal_safety.c.
Referenced by halRegWaitAllClear16X(), halRegWaitAllClear32X(), halRegWaitAllClear8X(), halRegWaitAllSet16X(), halRegWaitAllSet32X(), halRegWaitAllSet8X(), halRegWaitAnyClear16X(), halRegWaitAnyClear32X(), halRegWaitAnyClear8X(), halRegWaitAnySet16X(), halRegWaitAnySet32X(), halRegWaitAnySet8X(), halRegWaitMatch16X(), halRegWaitMatch32X(), and halRegWaitMatch8X().
|
inlinestatic |
Definition at line 59 of file hal_safety.c.
Referenced by halRegWaitAllClear16X(), halRegWaitAllClear32X(), halRegWaitAllClear8X(), halRegWaitAllSet16X(), halRegWaitAllSet32X(), halRegWaitAllSet8X(), halRegWaitAnyClear16X(), halRegWaitAnyClear32X(), halRegWaitAnyClear8X(), halRegWaitAnySet16X(), halRegWaitAnySet32X(), halRegWaitAnySet8X(), halRegWaitMatch16X(), halRegWaitMatch32X(), halRegWaitMatch8X(), and is_counter_within().
Definition at line 68 of file hal_safety.c.
References get_counter().
Referenced by halRegWaitAllClear16X(), halRegWaitAllClear32X(), halRegWaitAllClear8X(), halRegWaitAllSet16X(), halRegWaitAllSet32X(), halRegWaitAllSet8X(), halRegWaitAnyClear16X(), halRegWaitAnyClear32X(), halRegWaitAnyClear8X(), halRegWaitAnySet16X(), halRegWaitAnySet32X(), halRegWaitAnySet8X(), halRegWaitMatch16X(), halRegWaitMatch32X(), and halRegWaitMatch8X().

| void halSftFail | ( | const char * | message | ) |
Common safety fault handler.
This function does not return, any recovery strategy, at this level, is meant to be destructive.
| [in] | message | fault reason string |
Definition at line 89 of file hal_safety.c.
References osalSysHalt().
Referenced by halRegMaskedWrite16X(), halRegMaskedWrite32X(), halRegMaskedWrite8X(), halRegModify16X(), halRegModify32X(), halRegModify8X(), halRegWrite16X(), halRegWrite32X(), halRegWrite8X(), and halSftFailOnError().

| bool halRegWaitMatch8X | ( | volatile uint8_t * | p, |
| uint8_t | mask, | ||
| uint8_t | match, | ||
| uint32_t | tmo, | ||
| uint8_t * | valp ) |
Waits for masked bits to match or a timeout.
| [in] | p | address of the register |
| [in] | mask | mask of bits to be checked |
| [in] | match | value to be matched |
| [in] | tmo | timeout in microseconds |
| [in] | valp | pointer to where to store the last read value or NULL |
| false | if the condition has been verified. |
| true | if a timeout occurred. |
Definition at line 116 of file hal_safety.c.
References get_counter(), get_frequency(), HAL_US2RTC, and is_counter_within().

| bool halRegWaitMatch16X | ( | volatile uint16_t * | p, |
| uint16_t | mask, | ||
| uint16_t | match, | ||
| uint32_t | tmo, | ||
| uint16_t * | valp ) |
Waits for masked bits to match or a timeout.
| [in] | p | address of the register |
| [in] | mask | mask of bits to be checked |
| [in] | match | value to be matched |
| [in] | tmo | timeout in microseconds |
| [in] | valp | pointer to where to store the last read value or NULL |
| false | if the condition has been verified. |
| true | if a timeout occurred. |
Definition at line 159 of file hal_safety.c.
References get_counter(), get_frequency(), HAL_US2RTC, and is_counter_within().

| bool halRegWaitMatch32X | ( | volatile uint32_t * | p, |
| uint32_t | mask, | ||
| uint32_t | match, | ||
| uint32_t | tmo, | ||
| uint32_t * | valp ) |
Waits for masked bits to match or a timeout.
| [in] | p | address of the register |
| [in] | mask | mask of bits to be checked |
| [in] | match | value to be matched |
| [in] | tmo | timeout in microseconds |
| [in] | valp | pointer to where to store the last read value or NULL |
| false | if the condition has been verified. |
| true | if a timeout occurred. |
Definition at line 202 of file hal_safety.c.
References get_counter(), get_frequency(), HAL_US2RTC, and is_counter_within().

| bool halRegWaitAllSet8X | ( | volatile uint8_t * | p, |
| uint8_t | mask, | ||
| uint32_t | tmo, | ||
| uint8_t * | valp ) |
Waits for all specified bits to be set or a timeout.
| [in] | p | address of the register |
| [in] | mask | mask of bits to be checked |
| [in] | tmo | timeout in microseconds |
| [in] | valp | pointer to where to store the last read value or NULL |
| false | if the condition has been verified. |
| true | if a timeout occurred. |
Definition at line 244 of file hal_safety.c.
References get_counter(), get_frequency(), HAL_US2RTC, and is_counter_within().

| bool halRegWaitAllSet16X | ( | volatile uint16_t * | p, |
| uint16_t | mask, | ||
| uint32_t | tmo, | ||
| uint16_t * | valp ) |
Waits for all specified bits to be set or a timeout.
| [in] | p | address of the register |
| [in] | mask | mask of bits to be checked |
| [in] | tmo | timeout in microseconds |
| [in] | valp | pointer to where to store the last read value or NULL |
| false | if the condition has been verified. |
| true | if a timeout occurred. |
Definition at line 286 of file hal_safety.c.
References get_counter(), get_frequency(), HAL_US2RTC, and is_counter_within().

| bool halRegWaitAllSet32X | ( | volatile uint32_t * | p, |
| uint32_t | mask, | ||
| uint32_t | tmo, | ||
| uint32_t * | valp ) |
Waits for all specified bits to be set or a timeout.
| [in] | p | address of the register |
| [in] | mask | mask of bits to be checked |
| [in] | tmo | timeout in microseconds |
| [in] | valp | pointer to where to store the last read value or NULL |
| false | if the condition has been verified. |
| true | if a timeout occurred. |
Definition at line 328 of file hal_safety.c.
References get_counter(), get_frequency(), HAL_US2RTC, and is_counter_within().

| bool halRegWaitAnySet8X | ( | volatile uint8_t * | p, |
| uint8_t | mask, | ||
| uint32_t | tmo, | ||
| uint8_t * | valp ) |
Waits for any of specified bits to be set or a timeout.
| [in] | p | address of the register |
| [in] | mask | mask of bits to be checked |
| [in] | tmo | timeout in microseconds |
| [in] | valp | pointer to where to store the last read value or NULL |
| false | if the condition has been verified. |
| true | if a timeout occurred. |
Definition at line 370 of file hal_safety.c.
References get_counter(), get_frequency(), HAL_US2RTC, and is_counter_within().

| bool halRegWaitAnySet16X | ( | volatile uint16_t * | p, |
| uint16_t | mask, | ||
| uint32_t | tmo, | ||
| uint16_t * | valp ) |
Waits for any of specified bits to be set or a timeout.
| [in] | p | address of the register |
| [in] | mask | mask of bits to be checked |
| [in] | tmo | timeout in microseconds |
| [in] | valp | pointer to where to store the last read value or NULL |
| false | if the condition has been verified. |
| true | if a timeout occurred. |
Definition at line 412 of file hal_safety.c.
References get_counter(), get_frequency(), HAL_US2RTC, and is_counter_within().

| bool halRegWaitAnySet32X | ( | volatile uint32_t * | p, |
| uint32_t | mask, | ||
| uint32_t | tmo, | ||
| uint32_t * | valp ) |
Waits for any of specified bits to be set or a timeout.
| [in] | p | address of the register |
| [in] | mask | mask of bits to be checked |
| [in] | tmo | timeout in microseconds |
| [in] | valp | pointer to where to store the last read value or NULL |
| false | if the condition has been verified. |
| true | if a timeout occurred. |
Definition at line 454 of file hal_safety.c.
References get_counter(), get_frequency(), HAL_US2RTC, and is_counter_within().

| bool halRegWaitAllClear8X | ( | volatile uint8_t * | p, |
| uint8_t | mask, | ||
| uint32_t | tmo, | ||
| uint8_t * | valp ) |
Waits for all specified bits to be cleared or a timeout.
| [in] | p | address of the register |
| [in] | mask | mask of bits to be checked |
| [in] | tmo | timeout in microseconds |
| [in] | valp | pointer to where to store the last read value or NULL |
| false | if the condition has been verified. |
| true | if a timeout occurred. |
Definition at line 496 of file hal_safety.c.
References get_counter(), get_frequency(), HAL_US2RTC, and is_counter_within().

| bool halRegWaitAllClear16X | ( | volatile uint16_t * | p, |
| uint16_t | mask, | ||
| uint32_t | tmo, | ||
| uint16_t * | valp ) |
Waits for all specified bits to be cleared or a timeout.
| [in] | p | address of the register |
| [in] | mask | mask of bits to be checked |
| [in] | tmo | timeout in microseconds |
| [in] | valp | pointer to where to store the last read value or NULL |
| false | if the condition has been verified. |
| true | if a timeout occurred. |
Definition at line 538 of file hal_safety.c.
References get_counter(), get_frequency(), HAL_US2RTC, and is_counter_within().

| bool halRegWaitAllClear32X | ( | volatile uint32_t * | p, |
| uint32_t | mask, | ||
| uint32_t | tmo, | ||
| uint32_t * | valp ) |
Waits for all specified bits to be cleared or a timeout.
| [in] | p | address of the register |
| [in] | mask | mask of bits to be checked |
| [in] | tmo | timeout in microseconds |
| [in] | valp | pointer to where to store the last read value or NULL |
| false | if the condition has been verified. |
| true | if a timeout occurred. |
Definition at line 580 of file hal_safety.c.
References get_counter(), get_frequency(), HAL_US2RTC, and is_counter_within().

| bool halRegWaitAnyClear8X | ( | volatile uint8_t * | p, |
| uint8_t | mask, | ||
| uint32_t | tmo, | ||
| uint8_t * | valp ) |
Waits for any of specified bits to be cleared or a timeout.
| [in] | p | address of the register |
| [in] | mask | mask of bits to be checked |
| [in] | tmo | timeout in microseconds |
| [in] | valp | pointer to where to store the last read value or NULL |
| false | if the condition has been verified. |
| true | if a timeout occurred. |
Definition at line 622 of file hal_safety.c.
References get_counter(), get_frequency(), HAL_US2RTC, and is_counter_within().

| bool halRegWaitAnyClear16X | ( | volatile uint16_t * | p, |
| uint16_t | mask, | ||
| uint32_t | tmo, | ||
| uint16_t * | valp ) |
Waits for any of specified bits to be cleared or a timeout.
| [in] | p | address of the register |
| [in] | mask | mask of bits to be checked |
| [in] | tmo | timeout in microseconds |
| [in] | valp | pointer to where to store the last read value or NULL |
| false | if the condition has been verified. |
| true | if a timeout occurred. |
Definition at line 664 of file hal_safety.c.
References get_counter(), get_frequency(), HAL_US2RTC, and is_counter_within().

| bool halRegWaitAnyClear32X | ( | volatile uint32_t * | p, |
| uint32_t | mask, | ||
| uint32_t | tmo, | ||
| uint32_t * | valp ) |
Waits for any of specified bits to be cleared or a timeout.
| [in] | p | address of the register |
| [in] | mask | mask of bits to be checked |
| [in] | tmo | timeout in microseconds |
| [in] | valp | pointer to where to store the last read value or NULL |
| false | if the condition has been verified. |
| true | if a timeout occurred. |
Definition at line 706 of file hal_safety.c.
References get_counter(), get_frequency(), HAL_US2RTC, and is_counter_within().

|
inlinestatic |
Enters a common safety fault handler on error.
osalSysHalt(). | [in] | result | the error status, true if an error occurred |
| [in] | message | an optional descriptive message |
Definition at line 214 of file hal_safety.h.
References halSftFail().

|
inlinestatic |
Writes an 8 bits register.
| [in] | p | pointer to the register |
| [in] | value | value to be written |
| [in] | verify | verification flag, register is read back if true, this flag only has effect if HAL_USE_SAFETY is set to TRUE |
Definition at line 238 of file hal_safety.h.
References halSftFail().

|
inlinestatic |
Writes a 16 bits register.
| [in] | p | pointer to the register |
| [in] | value | value to be written |
| [in] | verify | verification flag, register is read back if true, this flag only has effect if HAL_USE_SAFETY is set to TRUE |
Definition at line 272 of file hal_safety.h.
References halSftFail().

|
inlinestatic |
Writes a 32 bits register.
| [in] | p | pointer to the register |
| [in] | value | value to be written |
| [in] | verify | verification flag, register is read back if true, this flag only has effect if HAL_USE_SAFETY is set to TRUE |
Definition at line 306 of file hal_safety.h.
References halSftFail().

|
inlinestatic |
Modifies a 8 bits register.
| [in] | p | pointer to the register |
| [in] | setmask | mask of bits to be set |
| [in] | clrmask | mask of bits to be cleared |
| [in] | verify | verification flag, register is read back if true, this flag only has effect if HAL_USE_SAFETY is set to TRUE |
Definition at line 341 of file hal_safety.h.
References halSftFail().

|
inlinestatic |
Modifies a 16 bits register.
| [in] | p | pointer to the register |
| [in] | setmask | mask of bits to be set |
| [in] | clrmask | mask of bits to be cleared |
| [in] | verify | verification flag, register is read back if true, this flag only has effect if HAL_USE_SAFETY is set to TRUE |
Definition at line 381 of file hal_safety.h.
References halSftFail().

|
inlinestatic |
Modifies a 32 bits register.
| [in] | p | pointer to the register |
| [in] | setmask | mask of bits to be set |
| [in] | clrmask | mask of bits to be cleared |
| [in] | verify | verification flag, register is read back if true, this flag only has effect if HAL_USE_SAFETY is set to TRUE |
Definition at line 421 of file hal_safety.h.
References halSftFail().

|
inlinestatic |
Writes a field into an 8 bits register.
| [in] | p | pointer to the register |
| [in] | mask | mask of bits field to be written |
| [in] | value | value to be written, must be pre-shifted to match the mask |
| [in] | verify | verification flag, register is read back if true, this flag only has effect if HAL_USE_SAFETY is set to TRUE |
Definition at line 462 of file hal_safety.h.
References halSftFail(), and osalDbgCheck.

|
inlinestatic |
Writes a field into a 16 bits register.
| [in] | p | pointer to the register |
| [in] | mask | mask of bits field to be written |
| [in] | value | value to be written, must be pre-shifted to match the mask |
| [in] | verify | verification flag, register is read back if true, this flag only has effect if HAL_USE_SAFETY is set to TRUE |
Definition at line 507 of file hal_safety.h.
References halSftFail(), and osalDbgCheck.

|
inlinestatic |
Writes a field into a 32 bits register.
| [in] | p | pointer to the register |
| [in] | mask | mask of bits field to be written |
| [in] | value | value to be written, must be pre-shifted to match the mask |
| [in] | verify | verification flag, register is read back if true, this flag only has effect if HAL_USE_SAFETY is set to TRUE |
Definition at line 552 of file hal_safety.h.
References halSftFail(), and osalDbgCheck.
