diff --git a/arch/risc-v/src/esp32c6/hardware/esp32c6_soc.h b/arch/risc-v/src/esp32c6/hardware/esp32c6_soc.h index c16768d81e..6b0bd3d76d 100644 --- a/arch/risc-v/src/esp32c6/hardware/esp32c6_soc.h +++ b/arch/risc-v/src/esp32c6/hardware/esp32c6_soc.h @@ -148,6 +148,10 @@ #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))