From 9cdbec3769040022124300021f1741a2f9094bfc Mon Sep 17 00:00:00 2001 From: Lucas Saavedra Vaz Date: Mon, 5 Dec 2022 17:42:11 -0300 Subject: [PATCH] arch/xtensa/esp32: Modify REG_[GET/SET]_FIELD to use [get/set]reg32 --- arch/xtensa/src/esp32/hardware/esp32_soc.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/xtensa/src/esp32/hardware/esp32_soc.h b/arch/xtensa/src/esp32/hardware/esp32_soc.h index f80691cc83..a784dacf34 100644 --- a/arch/xtensa/src/esp32/hardware/esp32_soc.h +++ b/arch/xtensa/src/esp32/hardware/esp32_soc.h @@ -107,13 +107,13 @@ * used when _f is not left shifted by _f##_S */ -#define REG_GET_FIELD(_r, _f) ((REG_READ(_r) >> (_f##_S)) & (_f##_V)) +#define REG_GET_FIELD(addr, field) ((getreg32(addr) >> field##_S) & field##_V) /* Set field to register, * used when _f is not left shifted by _f##_S */ -#define REG_SET_FIELD(_r, _f, _v) (REG_WRITE((_r),((REG_READ(_r) & ~((_f##_V) << (_f##_S)))|(((_v) & (_f##_V))<<(_f##_S))))) +#define REG_SET_FIELD(addr, field, val) (modifyreg32(addr, (((~((uint32_t) val)) & field##_V) << field##_S), (((uint32_t) val) << field##_S))) /* Set field value from a variable, * used when _f is not left shifted by _f##_S