Skip to content

Commit f515677

Browse files
Solonix-ChuRbb666
authored andcommitted
bsp: cvitek: Canonically rename some macro definitions
Analysis: Some macro definition names are not standardized and lack prefixes. Solution: Add BSP_ prefix to GPIO_IRQ_BASE SYS_GPIO_IRQ_BASE PLIC_PHY_ADDR TIMER_CLK_FREQ UART_IRQ_BASE I2C_IRQ_BASE. Signed-off-by: Shicheng Chu <[email protected]>
1 parent fea2314 commit f515677

File tree

17 files changed

+56
-62
lines changed

17 files changed

+56
-62
lines changed

bsp/cvitek/c906_little/.config

+5-5
Original file line numberDiff line numberDiff line change
@@ -1170,7 +1170,7 @@ CONFIG_BSP_UART1_TX_PINNAME="IIC0_SCL"
11701170
# CONFIG_BSP_USING_UART2 is not set
11711171
# CONFIG_BSP_USING_UART3 is not set
11721172
# CONFIG_BSP_USING_UART4 is not set
1173-
CONFIG_UART_IRQ_BASE=30
1173+
CONFIG_BSP_UART_IRQ_BASE=30
11741174
# CONFIG_BSP_USING_I2C is not set
11751175
# CONFIG_BSP_USING_ADC is not set
11761176
# CONFIG_BSP_USING_SPI is not set
@@ -1180,11 +1180,11 @@ CONFIG_UART_IRQ_BASE=30
11801180
# end of General Drivers Configuration
11811181

11821182
CONFIG_BSP_USING_C906_LITTLE=y
1183-
CONFIG_PLIC_PHY_ADDR=0x70000000
1183+
CONFIG_BSP_PLIC_PHY_ADDR=0x70000000
11841184
CONFIG_IRQ_MAX_NR=61
1185-
CONFIG_TIMER_CLK_FREQ=25000000
1186-
CONFIG_GPIO_IRQ_BASE=41
1187-
CONFIG_SYS_GPIO_IRQ_BASE=47
1185+
CONFIG_BSP_TIMER_CLK_FREQ=25000000
1186+
CONFIG_BSP_GPIO_IRQ_BASE=41
1187+
CONFIG_BSP_SYS_GPIO_IRQ_BASE=47
11881188
CONFIG_SOC_TYPE_SG2002=y
11891189
# CONFIG_BOARD_TYPE_MILKV_DUO is not set
11901190
# CONFIG_BOARD_TYPE_MILKV_DUO_SPINOR is not set

bsp/cvitek/c906_little/Kconfig

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,23 @@ config BSP_USING_C906_LITTLE
1818
select RT_USING_USER_MAIN
1919
default y
2020

21-
config PLIC_PHY_ADDR
21+
config BSP_PLIC_PHY_ADDR
2222
hex
2323
default 0x70000000
2424

2525
config IRQ_MAX_NR
2626
int
2727
default 61
2828

29-
config TIMER_CLK_FREQ
29+
config BSP_TIMER_CLK_FREQ
3030
int
3131
default 25000000
3232

33-
config GPIO_IRQ_BASE
33+
config BSP_GPIO_IRQ_BASE
3434
int
3535
default 41
3636

37-
config SYS_GPIO_IRQ_BASE
37+
config BSP_SYS_GPIO_IRQ_BASE
3838
int
3939
default 47
4040

bsp/cvitek/c906_little/board/Kconfig

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ menu "General Drivers Configuration"
7171
default ""
7272
endif
7373

74-
config UART_IRQ_BASE
74+
config BSP_UART_IRQ_BASE
7575
int
7676
default 30
7777
endif
@@ -149,7 +149,7 @@ menu "General Drivers Configuration"
149149
default ""
150150
endif
151151

152-
config I2C_IRQ_BASE
152+
config BSP_I2C_IRQ_BASE
153153
int
154154
default 32
155155
endif

bsp/cvitek/c906_little/board/interrupt.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@
4545
#define PLIC_ENABLE_STRIDE 0x80
4646
#define PLIC_CONTEXT_STRIDE 0x1000
4747

48-
#define PLIC_PRIORITY(id) (PLIC_PHY_ADDR + PLIC_PRIORITY_OFFSET + (id) * 4)
49-
#define PLIC_PENDING(id) (PLIC_PHY_ADDR + PLIC_PENDING_OFFSET + ((id) / 32))
50-
#define PLIC_ENABLE(id) (PLIC_PHY_ADDR + PLIC_ENABLE_OFFSET + ((id) / 32))
48+
#define PLIC_PRIORITY(id) (BSP_PLIC_PHY_ADDR + PLIC_PRIORITY_OFFSET + (id) * 4)
49+
#define PLIC_PENDING(id) (BSP_PLIC_PHY_ADDR + PLIC_PENDING_OFFSET + ((id) / 32))
50+
#define PLIC_ENABLE(id) (BSP_PLIC_PHY_ADDR + PLIC_ENABLE_OFFSET + ((id) / 32))
5151

5252
void rt_hw_interrupt_init(void);
5353
void rt_hw_interrupt_mask(int vector);

bsp/cvitek/c906_little/board/tick.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
static volatile rt_uint64_t time_elapsed = 0;
1818
static volatile unsigned long tick_cycles = 0;
1919

20-
#define CLINT_BASE (PLIC_PHY_ADDR + 0x4000000UL)
20+
#define CLINT_BASE (BSP_PLIC_PHY_ADDR + 0x4000000UL)
2121

2222
static volatile rt_uint32_t *mtimecmp_l = (volatile rt_uint32_t *)(CLINT_BASE + 0x4000UL);
2323
static volatile rt_uint32_t *mtimecmp_h = (volatile rt_uint32_t *)(CLINT_BASE + 0x4004UL);
@@ -50,7 +50,7 @@ int rt_hw_tick_init(void)
5050
/* Clear the Machine-Timer bit in MIE */
5151
clear_csr(mie, MIP_MTIP);
5252

53-
tick_cycles = TIMER_CLK_FREQ / RT_TICK_PER_SECOND;
53+
tick_cycles = BSP_TIMER_CLK_FREQ / RT_TICK_PER_SECOND;
5454

5555
set_ticks(get_ticks() + tick_cycles);
5656

@@ -74,7 +74,7 @@ void rt_hw_us_delay(rt_uint32_t us)
7474
unsigned long run_time;
7575

7676
start_time = get_ticks();
77-
end_time = start_time + us * (TIMER_CLK_FREQ / 1000000);
77+
end_time = start_time + us * (BSP_TIMER_CLK_FREQ / 1000000);
7878
do{
7979
run_time = get_ticks();
8080
} while(run_time < end_time);

bsp/cvitek/c906_little/rtconfig.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -326,14 +326,14 @@
326326
#define BSP_USING_UART1
327327
#define BSP_UART1_RX_PINNAME "IIC0_SDA"
328328
#define BSP_UART1_TX_PINNAME "IIC0_SCL"
329-
#define UART_IRQ_BASE 30
329+
#define BSP_UART_IRQ_BASE 30
330330
/* end of General Drivers Configuration */
331331
#define BSP_USING_C906_LITTLE
332-
#define PLIC_PHY_ADDR 0x70000000
332+
#define BSP_PLIC_PHY_ADDR 0x70000000
333333
#define IRQ_MAX_NR 61
334-
#define TIMER_CLK_FREQ 25000000
335-
#define GPIO_IRQ_BASE 41
336-
#define SYS_GPIO_IRQ_BASE 47
334+
#define BSP_TIMER_CLK_FREQ 25000000
335+
#define BSP_GPIO_IRQ_BASE 41
336+
#define BSP_SYS_GPIO_IRQ_BASE 47
337337
#define SOC_TYPE_SG2002
338338
#define BOARD_TYPE_MILKV_DUO256M
339339

bsp/cvitek/cv18xx_aarch64/.config

+3-3
Original file line numberDiff line numberDiff line change
@@ -1255,8 +1255,8 @@ CONFIG_RT_USING_MEMBLOCK=y
12551255
# end of RT-Thread online packages
12561256

12571257
CONFIG_SOC_CV18XX_AARCH64=y
1258-
CONFIG_GPIO_IRQ_BASE=76
1259-
CONFIG_SYS_GPIO_IRQ_BASE=86
1258+
CONFIG_BSP_GPIO_IRQ_BASE=76
1259+
CONFIG_BSP_SYS_GPIO_IRQ_BASE=86
12601260
CONFIG_SOC_TYPE_SG2002=y
12611261
CONFIG_BOARD_TYPE_MILKV_DUO256M=y
12621262
# CONFIG_BOARD_TYPE_MILKV_DUO256M_SPINOR is not set
@@ -1276,7 +1276,7 @@ CONFIG_BSP_UART0_TX_PINNAME="UART0_TX"
12761276
# CONFIG_BSP_USING_UART2 is not set
12771277
# CONFIG_BSP_USING_UART3 is not set
12781278
# CONFIG_BSP_USING_UART4 is not set
1279-
CONFIG_UART_IRQ_BASE=60
1279+
CONFIG_BSP_UART_IRQ_BASE=60
12801280
# CONFIG_BSP_USING_ADC is not set
12811281
# CONFIG_BSP_USING_SPI is not set
12821282
# CONFIG_BSP_USING_PWM is not set

bsp/cvitek/cv18xx_aarch64/Kconfig

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ config SOC_CV18XX_AARCH64
2222
select ARCH_MM_MMU
2323
default y
2424

25-
config GPIO_IRQ_BASE
25+
config BSP_GPIO_IRQ_BASE
2626
int
2727
default 76
2828

29-
config SYS_GPIO_IRQ_BASE
29+
config BSP_SYS_GPIO_IRQ_BASE
3030
int
3131
default 86
3232

bsp/cvitek/cv18xx_aarch64/board/Kconfig

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ menu "General Drivers Configuration"
8989
default ""
9090
endif
9191

92-
config UART_IRQ_BASE
92+
config BSP_UART_IRQ_BASE
9393
int
9494
default 60
9595
endif

bsp/cvitek/cv18xx_aarch64/rtconfig.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -407,8 +407,8 @@
407407
/* end of Arduino libraries */
408408
/* end of RT-Thread online packages */
409409
#define SOC_CV18XX_AARCH64
410-
#define GPIO_IRQ_BASE 76
411-
#define SYS_GPIO_IRQ_BASE 86
410+
#define BSP_GPIO_IRQ_BASE 76
411+
#define BSP_SYS_GPIO_IRQ_BASE 86
412412
#define SOC_TYPE_SG2002
413413
#define BOARD_TYPE_MILKV_DUO256M
414414

@@ -421,7 +421,7 @@
421421
#define BSP_USING_UART0
422422
#define BSP_UART0_RX_PINNAME "UART0_RX"
423423
#define BSP_UART0_TX_PINNAME "UART0_TX"
424-
#define UART_IRQ_BASE 60
424+
#define BSP_UART_IRQ_BASE 60
425425
/* end of General Drivers Configuration */
426426

427427
#endif

bsp/cvitek/cv18xx_risc-v/.config

+3-4
Original file line numberDiff line numberDiff line change
@@ -1315,7 +1315,7 @@ CONFIG_BSP_UART0_TX_PINNAME="UART0_TX"
13151315
# CONFIG_BSP_USING_UART2 is not set
13161316
# CONFIG_BSP_USING_UART3 is not set
13171317
# CONFIG_BSP_USING_UART4 is not set
1318-
CONFIG_UART_IRQ_BASE=44
1318+
CONFIG_BSP_UART_IRQ_BASE=44
13191319
# CONFIG_BSP_USING_I2C is not set
13201320
# CONFIG_BSP_USING_ADC is not set
13211321
# CONFIG_BSP_USING_SPI is not set
@@ -1329,9 +1329,8 @@ CONFIG_UART_IRQ_BASE=44
13291329
CONFIG_BSP_USING_CV18XX=y
13301330
CONFIG_C906_PLIC_PHY_ADDR=0x70000000
13311331
CONFIG_IRQ_MAX_NR=101
1332-
CONFIG_TIMER_CLK_FREQ=25000000
1333-
CONFIG_GPIO_IRQ_BASE=60
1334-
CONFIG_SYS_GPIO_IRQ_BASE=70
1332+
CONFIG_BSP_GPIO_IRQ_BASE=60
1333+
CONFIG_BSP_SYS_GPIO_IRQ_BASE=70
13351334
CONFIG___STACKSIZE__=8192
13361335
CONFIG_SOC_TYPE_SG2002=y
13371336
# CONFIG_BOARD_TYPE_MILKV_DUO is not set

bsp/cvitek/cv18xx_risc-v/Kconfig

+2-6
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,11 @@ config IRQ_MAX_NR
3131
int
3232
default 101
3333

34-
config TIMER_CLK_FREQ
35-
int
36-
default 25000000
37-
38-
config GPIO_IRQ_BASE
34+
config BSP_GPIO_IRQ_BASE
3935
int
4036
default 60
4137

42-
config SYS_GPIO_IRQ_BASE
38+
config BSP_SYS_GPIO_IRQ_BASE
4339
int
4440
default 70
4541

bsp/cvitek/cv18xx_risc-v/board/Kconfig

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ menu "General Drivers Configuration"
7171
default ""
7272
endif
7373

74-
config UART_IRQ_BASE
74+
config BSP_UART_IRQ_BASE
7575
int
7676
default 44
7777
endif
@@ -149,7 +149,7 @@ menu "General Drivers Configuration"
149149
default ""
150150
endif
151151

152-
config I2C_IRQ_BASE
152+
config BSP_I2C_IRQ_BASE
153153
int
154154
default 49
155155
endif

bsp/cvitek/cv18xx_risc-v/rtconfig.h

+3-4
Original file line numberDiff line numberDiff line change
@@ -448,14 +448,13 @@
448448
#define BSP_USING_UART0
449449
#define BSP_UART0_RX_PINNAME "UART0_RX"
450450
#define BSP_UART0_TX_PINNAME "UART0_TX"
451-
#define UART_IRQ_BASE 44
451+
#define BSP_UART_IRQ_BASE 44
452452
/* end of General Drivers Configuration */
453453
#define BSP_USING_CV18XX
454454
#define C906_PLIC_PHY_ADDR 0x70000000
455455
#define IRQ_MAX_NR 101
456-
#define TIMER_CLK_FREQ 25000000
457-
#define GPIO_IRQ_BASE 60
458-
#define SYS_GPIO_IRQ_BASE 70
456+
#define BSP_GPIO_IRQ_BASE 60
457+
#define BSP_SYS_GPIO_IRQ_BASE 70
459458
#define __STACKSIZE__ 8192
460459
#define SOC_TYPE_SG2002
461460
#define BOARD_TYPE_MILKV_DUO256M

bsp/cvitek/drivers/drv_gpio.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ static void rt_hw_gpio_isr(int irqno, void *param)
271271
rt_uint32_t pending, mask;
272272

273273
mask = 0;
274-
port = (irqno == SYS_GPIO_IRQ_BASE ? 4 : (irqno - GPIO_IRQ_BASE));
274+
port = (irqno == BSP_SYS_GPIO_IRQ_BASE ? 4 : (irqno - BSP_GPIO_IRQ_BASE));
275275

276276
base_addr = (port == 4 ? dwapb_gpio_base_e : (dwapb_gpio_base + DWAPB_GPIO_SIZE * port));
277277
pending = dwapb_read32(base_addr + GPIO_INTSTATUS);
@@ -306,16 +306,16 @@ int rt_hw_gpio_init(void)
306306
rt_device_pin_register("gpio", &_dwapb_ops, RT_NULL);
307307

308308
#define INT_INSTALL_GPIO_DEVICE(no) \
309-
rt_hw_interrupt_install(GPIO_IRQ_BASE + (no), rt_hw_gpio_isr, RT_NULL, "gpio"); \
310-
rt_hw_interrupt_umask(GPIO_IRQ_BASE + (no));
309+
rt_hw_interrupt_install(BSP_GPIO_IRQ_BASE + (no), rt_hw_gpio_isr, RT_NULL, "gpio"); \
310+
rt_hw_interrupt_umask(BSP_GPIO_IRQ_BASE + (no));
311311

312312
INT_INSTALL_GPIO_DEVICE(0);
313313
INT_INSTALL_GPIO_DEVICE(1);
314314
INT_INSTALL_GPIO_DEVICE(2);
315315
INT_INSTALL_GPIO_DEVICE(3);
316316

317-
rt_hw_interrupt_install(SYS_GPIO_IRQ_BASE, rt_hw_gpio_isr, RT_NULL, "gpio");
318-
rt_hw_interrupt_umask(SYS_GPIO_IRQ_BASE);
317+
rt_hw_interrupt_install(BSP_SYS_GPIO_IRQ_BASE, rt_hw_gpio_isr, RT_NULL, "gpio");
318+
rt_hw_interrupt_umask(BSP_SYS_GPIO_IRQ_BASE);
319319
return 0;
320320
}
321321
INIT_DEVICE_EXPORT(rt_hw_gpio_init);

bsp/cvitek/drivers/drv_hw_i2c.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@
2929
#define I2C3_BASE 0x4030000
3030
#define I2C4_BASE 0x4040000
3131

32-
#define I2C0_IRQ (I2C_IRQ_BASE + 0)
33-
#define I2C1_IRQ (I2C_IRQ_BASE + 1)
34-
#define I2C2_IRQ (I2C_IRQ_BASE + 2)
35-
#define I2C3_IRQ (I2C_IRQ_BASE + 3)
36-
#define I2C4_IRQ (I2C_IRQ_BASE + 4)
32+
#define I2C0_IRQ (BSP_I2C_IRQ_BASE + 0)
33+
#define I2C1_IRQ (BSP_I2C_IRQ_BASE + 1)
34+
#define I2C2_IRQ (BSP_I2C_IRQ_BASE + 2)
35+
#define I2C3_IRQ (BSP_I2C_IRQ_BASE + 3)
36+
#define I2C4_IRQ (BSP_I2C_IRQ_BASE + 4)
3737

3838

3939
#if !defined(IC_CLK)

bsp/cvitek/drivers/drv_uart.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@
2626
#define UART3_BASE 0x04170000
2727
#define UART4_BASE 0x041C0000
2828

29-
#define UART0_IRQ (UART_IRQ_BASE + 0)
30-
#define UART1_IRQ (UART_IRQ_BASE + 1)
31-
#define UART2_IRQ (UART_IRQ_BASE + 2)
32-
#define UART3_IRQ (UART_IRQ_BASE + 3)
33-
#define UART4_IRQ (UART_IRQ_BASE + 4)
29+
#define UART0_IRQ (BSP_UART_IRQ_BASE + 0)
30+
#define UART1_IRQ (BSP_UART_IRQ_BASE + 1)
31+
#define UART2_IRQ (BSP_UART_IRQ_BASE + 2)
32+
#define UART3_IRQ (BSP_UART_IRQ_BASE + 3)
33+
#define UART4_IRQ (BSP_UART_IRQ_BASE + 4)
3434

3535
/*
3636
* The Synopsys DesignWare 8250 has an extra feature whereby it detects if the

0 commit comments

Comments
 (0)