diff --git a/bsp/cvitek/cv18xx_risc-v/applications/main.c b/bsp/cvitek/cv18xx_risc-v/applications/main.c index 16417b5d08..4da2afdf63 100755 --- a/bsp/cvitek/cv18xx_risc-v/applications/main.c +++ b/bsp/cvitek/cv18xx_risc-v/applications/main.c @@ -10,6 +10,13 @@ #include #include +#include + +#if defined(BOARD_TYPE_MILKV_DUO256M) || defined(BOARD_TYPE_MILKV_DUO256M_SPINOR) +#define LED_PIN "E02" /* Onboard LED pins */ +#elif defined(BOARD_TYPE_MILKV_DUO) || defined(BOARD_TYPE_MILKV_DUO_SPINOR) +#define LED_PIN "C24" /* Onboard LED pins */ +#endif int main(void) { @@ -18,5 +25,23 @@ int main(void) #else rt_kprintf("Hello RISC-V!\n"); #endif + + /* LED pin: C24 */ + rt_uint16_t led = rt_pin_get(LED_PIN); + + /* set LED pin mode to output */ + rt_pin_mode(led, PIN_MODE_OUTPUT); + + while (1) + { + rt_pin_write(led, PIN_HIGH); + + rt_thread_mdelay(500); + + rt_pin_write(led, PIN_LOW); + + rt_thread_mdelay(500); + } + return 0; } diff --git a/bsp/cvitek/drivers/SConscript b/bsp/cvitek/drivers/SConscript index e5257202a2..96be9b9aa9 100755 --- a/bsp/cvitek/drivers/SConscript +++ b/bsp/cvitek/drivers/SConscript @@ -4,6 +4,7 @@ cwd = GetCurrentDir() src = Split(''' drv_uart.c drv_por.c + drv_gpio.c ''') CPPDEFINES = [] @@ -18,9 +19,6 @@ elif GetDepend('BOARD_TYPE_MILKV_DUO') or GetDepend('BOARD_TYPE_MILKV_DUO_SPINOR CPPPATH += [cwd + r'/libraries'] CPPPATH += [cwd + r'/libraries/' + CHIP_TYPE] -if GetDepend('BSP_USING_CV18XX'): - src += ['drv_gpio.c'] - if GetDepend('BSP_USING_I2C'): src += ['drv_hw_i2c.c'] diff --git a/bsp/cvitek/drivers/drv_gpio.c b/bsp/cvitek/drivers/drv_gpio.c old mode 100755 new mode 100644 index f6e6752e98..2d8d5acc2d --- a/bsp/cvitek/drivers/drv_gpio.c +++ b/bsp/cvitek/drivers/drv_gpio.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006-2023, RT-Thread Development Team + * Copyright (c) 2006-2024, RT-Thread Development Team * * SPDX-License-Identifier: Apache-2.0 * @@ -29,8 +29,6 @@ #define GPIO_EXT_PORTA 0x50 -#define DWAPB_DRIVER_NAME "gpio-dwapb" - #define DWAPB_GPIOA_BASE 0x03020000 #define DWAPB_GPIOE_BASE 0x05021000 @@ -307,17 +305,6 @@ static void rt_hw_gpio_isr(int irqno, void *param) int rt_hw_gpio_init(void) { -#ifdef RT_USING_SMART -#define BSP_IOREMAP_GPIO_DEVICE(no) \ - rt_ioremap((void *)(DWAPB_GPIOA_BASE + (no) * DWAPB_GPIO_SIZE), DWAPB_GPIO_SIZE); - - dwapb_gpio_base = (rt_size_t)BSP_IOREMAP_GPIO_DEVICE(0); - BSP_IOREMAP_GPIO_DEVICE(1); - BSP_IOREMAP_GPIO_DEVICE(2); - BSP_IOREMAP_GPIO_DEVICE(3); - dwapb_gpio_base_e = (rt_size_t)rt_ioremap((void *)DWAPB_GPIOE_BASE, DWAPB_GPIO_SIZE); -#endif - rt_device_pin_register("gpio", &_dwapb_ops, RT_NULL); #define INT_INSTALL_GPIO_DEVICE(no) \