#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)
}
//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))))
#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))
//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