From 6bceb41bf75bfd3cce6c4361064038fa0f1c6d4c Mon Sep 17 00:00:00 2001 From: Tian Hao Date: Fri, 7 Jul 2017 19:10:02 +0800 Subject: [PATCH] fix reg operation missing --- components/bt/lib | 2 +- components/soc/esp32/include/soc/dport_access.h | 6 +++--- components/soc/esp32/include/soc/soc.h | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/components/bt/lib b/components/bt/lib index 0f68ece75..30a3ab11c 160000 --- a/components/bt/lib +++ b/components/bt/lib @@ -1 +1 @@ -Subproject commit 0f68ece75cd27b71def68b735e6a03db312a46c5 +Subproject commit 30a3ab11c441630e3e76fbf30212e546db377e8e diff --git a/components/soc/esp32/include/soc/dport_access.h b/components/soc/esp32/include/soc/dport_access.h index 3fc196349..d1d264cbc 100644 --- a/components/soc/esp32/include/soc/dport_access.h +++ b/components/soc/esp32/include/soc/dport_access.h @@ -30,7 +30,7 @@ extern "C" { #define _DPORT_REG_WRITE(_r, _v) (*(volatile uint32_t *)(_r)) = (_v) //write value to register -#define DPORT_REG_WRITE(_r, _v) _DPORT_REG_WRITE(_r, _v) +#define DPORT_REG_WRITE(_r, _v) _DPORT_REG_WRITE((_r), (_v)) //read value from register static inline uint32_t IRAM_ATTR DPORT_REG_READ(uint32_t reg) @@ -97,7 +97,7 @@ static inline uint32_t IRAM_ATTR DPORT_READ_PERI_REG(uint32_t addr) } //write value to register -#define DPORT_WRITE_PERI_REG(addr, val) _DPORT_WRITE_PERI_REG(addr, val) +#define DPORT_WRITE_PERI_REG(addr, val) _DPORT_WRITE_PERI_REG((addr), (val)) //clear bits of register controlled by mask #define DPORT_CLEAR_PERI_REG_MASK(reg, mask) DPORT_WRITE_PERI_REG((reg), (DPORT_READ_PERI_REG(reg)&(~(mask)))) @@ -112,7 +112,7 @@ static inline uint32_t IRAM_ATTR DPORT_READ_PERI_REG(uint32_t addr) #define DPORT_GET_PERI_REG_BITS(reg, hipos,lowpos) ((DPORT_READ_PERI_REG(reg)>>(lowpos))&((1<<((hipos)-(lowpos)+1))-1)) //set bits of register controlled by mask and shift -#define DPORT_SET_PERI_REG_BITS(reg,bit_map,value,shift) DPORT_WRITE_PERI_REG((reg),(DPORT_READ_PERI_REG(reg)&(~((bit_map)<<(shift))))|(((value) & bit_map)<<(shift))) +#define DPORT_SET_PERI_REG_BITS(reg,bit_map,value,shift) DPORT_WRITE_PERI_REG((reg), ((DPORT_READ_PERI_REG(reg)&(~((bit_map)<<(shift))))|(((value) & bit_map)<<(shift)))) //get field of register #define DPORT_GET_PERI_REG_BITS2(reg, mask,shift) ((DPORT_READ_PERI_REG(reg)>>(shift))&(mask)) diff --git a/components/soc/esp32/include/soc/soc.h b/components/soc/esp32/include/soc/soc.h index 60a930a8d..70e54ded2 100644 --- a/components/soc/esp32/include/soc/soc.h +++ b/components/soc/esp32/include/soc/soc.h @@ -142,14 +142,14 @@ //write value to register #define REG_WRITE(_r, _v) ({ \ - ASSERT_IF_DPORT_REG(_r, REG_WRITE); \ + ASSERT_IF_DPORT_REG((_r), REG_WRITE); \ (*(volatile uint32_t *)(_r)) = (_v); \ }) //read value from register #define REG_READ(_r) ({ \ ASSERT_IF_DPORT_REG((_r), REG_READ); \ - (*(volatile uint32_t *)_r); \ + (*(volatile uint32_t *)(_r)); \ }) //get bit or get bits from register