Skip to content

Commit 69a720b

Browse files
committed
hal: add redefine check for BIT macro
Zephyr have BIT macro defined in sys/util_macro.h, add a redefine check for gd32 BIT MACRO. Signed-off-by: HaiLong Yang <[email protected]>
1 parent e09600c commit 69a720b

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

GD32E10X/CMSIS/GD/GD32E10X/Include/gd32e10x.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,9 @@ typedef enum {ERROR = 0, SUCCESS = !ERROR} ErrStatus;
193193
#define REG32(addr) (*(volatile uint32_t *)(uint32_t)(addr))
194194
#define REG16(addr) (*(volatile uint16_t *)(uint32_t)(addr))
195195
#define REG8(addr) (*(volatile uint8_t *)(uint32_t)(addr))
196+
#ifndef BIT
196197
#define BIT(x) ((uint32_t)((uint32_t)0x01U<<(x)))
198+
#endif
197199
#define BITS(start, end) ((0xFFFFFFFFUL << (start)) & (0xFFFFFFFFUL >> (31U - (uint32_t)(end))))
198200
#define GET_BITS(regval, start, end) (((regval) & BITS((start),(end))) >> (start))
199201

GD32F4XX/CMSIS/GD/GD32F4XX/Include/gd32f4xx.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,9 @@ typedef enum {ERROR = 0, SUCCESS = !ERROR} ErrStatus;
292292
#define REG32(addr) (*(volatile uint32_t *)(uint32_t)(addr))
293293
#define REG16(addr) (*(volatile uint16_t *)(uint32_t)(addr))
294294
#define REG8(addr) (*(volatile uint8_t *)(uint32_t)(addr))
295+
#ifndef BIT
295296
#define BIT(x) ((uint32_t)((uint32_t)0x01U<<(x)))
297+
#endif
296298
#define BITS(start, end) ((0xFFFFFFFFUL << (start)) & (0xFFFFFFFFUL >> (31U - (uint32_t)(end))))
297299
#define GET_BITS(regval, start, end) (((regval) & BITS((start),(end))) >> (start))
298300

0 commit comments

Comments
 (0)