Test program done

This commit is contained in:
Luca Lizaranzu
2026-03-20 11:41:44 -07:00
parent 303a554595
commit 1b29371fff
20 changed files with 1037 additions and 114 deletions

View File

@@ -76,12 +76,22 @@ bool SHAL_wait_for_condition_ms(Condition cond, uint32_t timeout_ms) {
return false; // timeout
}
bool SHAL_check_bit(const volatile uint32_t* reg, uint32_t mask);
bool SHAL_wait_for_bit_set_us(const volatile uint32_t* reg, uint32_t mask, uint16_t timeout);
bool SHAL_wait_for_bit_clear_us(const volatile uint32_t* reg, uint32_t mask, uint16_t timeout);
bool SHAL_wait_for_bit_set_ms(const volatile uint32_t* reg, uint32_t mask, uint16_t timeout);
bool SHAL_wait_for_bit_clear_ms(const volatile uint32_t* reg, uint32_t mask, uint16_t timeout);
#define SHAL_set_bits(reg, size, bits, offset) \
do { \
if ((reg) != NULL) { \
uint32_t _mask = ((1U << (size)) - 1U); \
uint32_t _mask = (size == 32) ? 0xFFFFFFFFU : ((1U << (size)) - 1U); \
*(reg) &= ~((uint32_t)(_mask) << (offset)); \
*(reg) |= ((uint32_t)(bits) << (offset)); \
} \
@@ -115,6 +125,13 @@ bool SHAL_wait_for_condition_ms(Condition cond, uint32_t timeout_ms) {
*(reg) |= (mask); \
} while (0)
#define SHAL_clear_register_value(reg) \
do { \
if ((reg) != NULL) { \
*(reg) = 0; \
} \
} while (0)
#define SHAL_set_register_value(reg, value) \
do { \
if ((reg) != NULL) { \