소스 검색

Merge branch 'contrib/github_pr_11652' into 'master'

Fix ULP FSM register macros with addr[9:0] > 0xFF (GitHub PR)

Closes IDFGH-10397

See merge request espressif/esp-idf!24251
Sudeep Mohanty 2 년 전
부모
커밋
98bc3d7e01
3개의 변경된 파일6개의 추가작업 그리고 6개의 파일을 삭제
  1. 2 2
      components/ulp/ulp_fsm/include/esp32/ulp.h
  2. 2 2
      components/ulp/ulp_fsm/include/esp32s2/ulp.h
  3. 2 2
      components/ulp/ulp_fsm/include/esp32s3/ulp.h

+ 2 - 2
components/ulp/ulp_fsm/include/esp32/ulp.h

@@ -331,7 +331,7 @@ static inline uint32_t SOC_REG_TO_ULP_PERIPH_SEL(uint32_t reg) {
  * This instruction can access RTC_CNTL_, RTC_IO_, SENS_, and RTC_I2C peripheral registers.
  */
 #define I_WR_REG(reg, low_bit, high_bit, val) {.wr_reg = {\
-    .addr = (reg & 0xff) / sizeof(uint32_t), \
+    .addr = ((reg) / sizeof(uint32_t)) & 0xff, \
     .periph_sel = SOC_REG_TO_ULP_PERIPH_SEL(reg), \
     .data = val, \
     .low = low_bit, \
@@ -345,7 +345,7 @@ static inline uint32_t SOC_REG_TO_ULP_PERIPH_SEL(uint32_t reg) {
  * This instruction can access RTC_CNTL_, RTC_IO_, SENS_, and RTC_I2C peripheral registers.
  */
 #define I_RD_REG(reg, low_bit, high_bit) {.rd_reg = {\
-    .addr = (reg & 0xff) / sizeof(uint32_t), \
+    .addr = ((reg) / sizeof(uint32_t)) & 0xff, \
     .periph_sel = SOC_REG_TO_ULP_PERIPH_SEL(reg), \
     .unused = 0, \
     .low = low_bit, \

+ 2 - 2
components/ulp/ulp_fsm/include/esp32s2/ulp.h

@@ -319,7 +319,7 @@ static inline uint32_t SOC_REG_TO_ULP_PERIPH_SEL(uint32_t reg)
  * This instruction can access RTC_CNTL_, RTC_IO_, SENS_, and RTC_I2C peripheral registers.
  */
 #define I_WR_REG(reg, low_bit, high_bit, val) {.wr_reg = {\
-    .addr = (reg & 0xff) / sizeof(uint32_t), \
+    .addr = ((reg) / sizeof(uint32_t)) & 0xff, \
     .periph_sel = SOC_REG_TO_ULP_PERIPH_SEL(reg), \
     .data = val, \
     .low = low_bit, \
@@ -333,7 +333,7 @@ static inline uint32_t SOC_REG_TO_ULP_PERIPH_SEL(uint32_t reg)
  * This instruction can access RTC_CNTL_, RTC_IO_, SENS_, and RTC_I2C peripheral registers.
  */
 #define I_RD_REG(reg, low_bit, high_bit) {.rd_reg = {\
-    .addr = (reg & 0xff) / sizeof(uint32_t), \
+    .addr = ((reg) / sizeof(uint32_t)) & 0xff, \
     .periph_sel = SOC_REG_TO_ULP_PERIPH_SEL(reg), \
     .unused = 0, \
     .low = low_bit, \

+ 2 - 2
components/ulp/ulp_fsm/include/esp32s3/ulp.h

@@ -319,7 +319,7 @@ static inline uint32_t SOC_REG_TO_ULP_PERIPH_SEL(uint32_t reg)
  * This instruction can access RTC_CNTL_, RTC_IO_, SENS_, and RTC_I2C peripheral registers.
  */
 #define I_WR_REG(reg, low_bit, high_bit, val) {.wr_reg = {\
-    .addr = (reg & 0xff) / sizeof(uint32_t), \
+    .addr = ((reg) / sizeof(uint32_t)) & 0xff, \
     .periph_sel = SOC_REG_TO_ULP_PERIPH_SEL(reg), \
     .data = val, \
     .low = low_bit, \
@@ -333,7 +333,7 @@ static inline uint32_t SOC_REG_TO_ULP_PERIPH_SEL(uint32_t reg)
  * This instruction can access RTC_CNTL_, RTC_IO_, SENS_, and RTC_I2C peripheral registers.
  */
 #define I_RD_REG(reg, low_bit, high_bit) {.rd_reg = {\
-    .addr = (reg & 0xff) / sizeof(uint32_t), \
+    .addr = ((reg) / sizeof(uint32_t)) & 0xff, \
     .periph_sel = SOC_REG_TO_ULP_PERIPH_SEL(reg), \
     .unused = 0, \
     .low = low_bit, \