esp32/esp32-c3: Adds two helpers to extract and include a field value
This commit is contained in:
parent
cce42d5f74
commit
50daf24242
@ -257,4 +257,12 @@
|
||||
|
||||
#define BIT(nr) (1UL << (nr))
|
||||
|
||||
/* Extract the field from the register and shift it to avoid wrong reading */
|
||||
|
||||
#define REG_MASK(_reg, _field) (((_reg) & (_field##_M)) >> (_field##_S))
|
||||
|
||||
/* Helper to place a value in a field */
|
||||
|
||||
#define VALUE_TO_FIELD(_value, _field) (((_value) << (_field##_S)) & (_field##_M))
|
||||
|
||||
#endif /* __ARCH_RISCV_SRC_ESP32C3_HARDWARE_ESP32C3_SOC_H */
|
||||
|
@ -183,6 +183,14 @@
|
||||
|
||||
#define GET_PERI_REG_BITS2(reg, mask,shift) ((READ_PERI_REG(reg)>>(shift))&(mask))
|
||||
|
||||
/* Extract the field from the register and shift it to avoid wrong reading */
|
||||
|
||||
#define REG_MASK(_reg, _field) (((_reg) & (_field##_M)) >> (_field##_S))
|
||||
|
||||
/* Helper to place a value in a field */
|
||||
|
||||
#define VALUE_TO_FIELD(_value, _field) (((_value) << (_field##_S)) & (_field##_M))
|
||||
|
||||
/* Periheral Clock */
|
||||
|
||||
#define APB_CLK_FREQ_ROM 26 * 1000000
|
||||
|
Loading…
Reference in New Issue
Block a user