[bsp][gd32][drivers] add serial v2 and dma driver support

This commit is contained in:
Evlers 2024-03-21 09:19:26 +08:00 committed by GitHub
parent 9e6ca17259
commit e25f287ff3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
39 changed files with 2087 additions and 127 deletions

View File

@ -1,17 +1,25 @@
/*
* Copyright (c) 2006-2022, RT-Thread Development Team
* Copyright (c) 2006-2024, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-12-18 BruceOu first implementation
*/
* 2024-03-19 Evlers add serial supports
*/
#include <stdint.h>
#include <rthw.h>
#include <rtthread.h>
#include <board.h>
#ifdef RT_USING_SERIAL_V2
#include "drv_usart_v2.h"
#else
#include "drv_usart.h"
#endif
/**
* @brief This function is executed in case of error occurrence.
* @param None
@ -67,12 +75,8 @@ void rt_hw_board_init()
SystemClock_Config();
#ifdef RT_USING_COMPONENTS_INIT
rt_components_board_init();
#endif
#ifdef RT_USING_CONSOLE
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
#ifdef RT_USING_SERIAL
rt_hw_usart_init();
#endif
#ifdef BSP_USING_SDRAM
@ -80,6 +84,14 @@ void rt_hw_board_init()
#else
rt_system_heap_init((void *)HEAP_BEGIN, (void *)HEAP_END);
#endif
#ifdef RT_USING_CONSOLE
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
#endif
#ifdef RT_USING_COMPONENTS_INIT
rt_components_board_init();
#endif
}
/*@}*/

View File

@ -1,17 +1,17 @@
/*
* Copyright (c) 2006-2022, RT-Thread Development Team
* Copyright (c) 2006-2024, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-12-18 BruceOu first implementation
* 2024-03-19 Evlers remove the include of drv_usart.h
*/
#ifndef __BOARD_H__
#define __BOARD_H__
#include "gd32f10x.h"
#include "drv_usart.h"
#include "drv_gpio.h"
#include "gd32f10x_exti.h"

View File

@ -1,17 +1,25 @@
/*
* Copyright (c) 2006-2022, RT-Thread Development Team
* Copyright (c) 2006-2024, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-12-18 BruceOu first implementation
* 2024-03-19 Evlers add serial supports
*/
#include <stdint.h>
#include <rthw.h>
#include <rtthread.h>
#include <board.h>
#ifdef RT_USING_SERIAL_V2
#include "drv_usart_v2.h"
#else
#include "drv_usart.h"
#endif
/**
* @brief This function is executed in case of error occurrence.
* @param None
@ -67,12 +75,8 @@ void rt_hw_board_init()
SystemClock_Config();
#ifdef RT_USING_COMPONENTS_INIT
rt_components_board_init();
#endif
#ifdef RT_USING_CONSOLE
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
#ifdef RT_USING_SERIAL
rt_hw_usart_init();
#endif
#ifdef BSP_USING_SDRAM
@ -80,6 +84,14 @@ void rt_hw_board_init()
#else
rt_system_heap_init((void *)HEAP_BEGIN, (void *)HEAP_END);
#endif
#ifdef RT_USING_CONSOLE
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
#endif
#ifdef RT_USING_COMPONENTS_INIT
rt_components_board_init();
#endif
}
/*@}*/

View File

@ -1,17 +1,17 @@
/*
* Copyright (c) 2006-2022, RT-Thread Development Team
* Copyright (c) 2006-2024, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-12-18 BruceOu first implementation
* 2024-03-19 Evlers remove the include of drv_usart.h
*/
#ifndef __BOARD_H__
#define __BOARD_H__
#include "gd32f10x.h"
#include "drv_usart.h"
#include "drv_gpio.h"
#include "gd32f10x_exti.h"

View File

@ -1,17 +1,25 @@
/*
* Copyright (c) 2006-2022, RT-Thread Development Team
* Copyright (c) 2006-2024, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-12-18 BruceOu first implementation
* 2024-03-19 Evlers add serial supports
*/
#include <stdint.h>
#include <rthw.h>
#include <rtthread.h>
#include <board.h>
#ifdef RT_USING_SERIAL_V2
#include "drv_usart_v2.h"
#else
#include "drv_usart.h"
#endif
/**
* @brief This function is executed in case of error occurrence.
* @param None
@ -67,12 +75,8 @@ void rt_hw_board_init()
SystemClock_Config();
#ifdef RT_USING_COMPONENTS_INIT
rt_components_board_init();
#endif
#ifdef RT_USING_CONSOLE
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
#ifdef RT_USING_SERIAL
rt_hw_usart_init();
#endif
#ifdef BSP_USING_SDRAM
@ -80,6 +84,14 @@ void rt_hw_board_init()
#else
rt_system_heap_init((void *)HEAP_BEGIN, (void *)HEAP_END);
#endif
#ifdef RT_USING_CONSOLE
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
#endif
#ifdef RT_USING_COMPONENTS_INIT
rt_components_board_init();
#endif
}
/*@}*/

View File

@ -1,17 +1,17 @@
/*
* Copyright (c) 2006-2022, RT-Thread Development Team
* Copyright (c) 2006-2024, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-12-18 BruceOu first implementation
* 2024-03-19 Evlers remove the include of drv_usart.h
*/
#ifndef __BOARD_H__
#define __BOARD_H__
#include "gd32f10x.h"
#include "drv_usart.h"
#include "drv_gpio.h"
#include "gd32f10x_exti.h"

View File

@ -1,17 +1,25 @@
/*
* Copyright (c) 2006-2022, RT-Thread Development Team
* Copyright (c) 2006-2024, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-12-18 BruceOu first implementation
* 2024-03-19 Evlers add serial supports
*/
#include <stdint.h>
#include <rthw.h>
#include <rtthread.h>
#include <board.h>
#ifdef RT_USING_SERIAL_V2
#include "drv_usart_v2.h"
#else
#include "drv_usart.h"
#endif
/**
* @brief This function is executed in case of error occurrence.
* @param None
@ -67,12 +75,8 @@ void rt_hw_board_init()
SystemClock_Config();
#ifdef RT_USING_COMPONENTS_INIT
rt_components_board_init();
#endif
#ifdef RT_USING_CONSOLE
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
#ifdef RT_USING_SERIAL
rt_hw_usart_init();
#endif
#ifdef BSP_USING_SDRAM
@ -80,6 +84,14 @@ void rt_hw_board_init()
#else
rt_system_heap_init((void *)HEAP_BEGIN, (void *)HEAP_END);
#endif
#ifdef RT_USING_CONSOLE
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
#endif
#ifdef RT_USING_COMPONENTS_INIT
rt_components_board_init();
#endif
}
/*@}*/

View File

@ -1,17 +1,17 @@
/*
* Copyright (c) 2006-2022, RT-Thread Development Team
* Copyright (c) 2006-2024, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-12-18 BruceOu first implementation
* 2024-03-19 Evlers remove the include of drv_usart.h
*/
#ifndef __BOARD_H__
#define __BOARD_H__
#include "gd32f10x.h"
#include "drv_usart.h"
#include "drv_gpio.h"
#include "gd32f10x_exti.h"

View File

@ -1,17 +1,25 @@
/*
* Copyright (c) 2006-2022, RT-Thread Development Team
* Copyright (c) 2006-2024, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-08-20 BruceOu first implementation
* 2024-03-19 Evlers add serial supports
*/
#include <stdint.h>
#include <rthw.h>
#include <rtthread.h>
#include <board.h>
#ifdef RT_USING_SERIAL_V2
#include "drv_usart_v2.h"
#else
#include "drv_usart.h"
#endif
/**
* @brief This function is executed in case of error occurrence.
* @param None
@ -67,12 +75,8 @@ void rt_hw_board_init()
SystemClock_Config();
#ifdef RT_USING_COMPONENTS_INIT
rt_components_board_init();
#endif
#ifdef RT_USING_CONSOLE
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
#ifdef RT_USING_SERIAL
rt_hw_usart_init();
#endif
#ifdef BSP_USING_SDRAM
@ -80,6 +84,14 @@ void rt_hw_board_init()
#else
rt_system_heap_init((void *)HEAP_BEGIN, (void *)HEAP_END);
#endif
#ifdef RT_USING_CONSOLE
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
#endif
#ifdef RT_USING_COMPONENTS_INIT
rt_components_board_init();
#endif
}
/*@}*/

View File

@ -1,17 +1,17 @@
/*
* Copyright (c) 2006-2022, RT-Thread Development Team
* Copyright (c) 2006-2024, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-12-18 BruceOu first implementation
* 2024-03-19 Evlers remove the include of drv_usart.h
*/
#ifndef __BOARD_H__
#define __BOARD_H__
#include "gd32f20x.h"
#include "drv_usart.h"
#include "drv_gpio.h"
#include "gd32f20x_exti.h"

View File

@ -1,17 +1,25 @@
/*
* Copyright (c) 2006-2022, RT-Thread Development Team
* Copyright (c) 2006-2024, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-08-20 BruceOu first implementation
* 2024-03-19 Evlers add serial supports
*/
#include <stdint.h>
#include <rthw.h>
#include <rtthread.h>
#include <board.h>
#ifdef RT_USING_SERIAL_V2
#include "drv_usart_v2.h"
#else
#include "drv_usart.h"
#endif
/**
* @brief This function is executed in case of error occurrence.
* @param None
@ -67,12 +75,8 @@ void rt_hw_board_init()
SystemClock_Config();
#ifdef RT_USING_COMPONENTS_INIT
rt_components_board_init();
#endif
#ifdef RT_USING_CONSOLE
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
#ifdef RT_USING_SERIAL
rt_hw_usart_init();
#endif
#ifdef BSP_USING_SDRAM
@ -80,6 +84,14 @@ void rt_hw_board_init()
#else
rt_system_heap_init((void *)HEAP_BEGIN, (void *)HEAP_END);
#endif
#ifdef RT_USING_CONSOLE
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
#endif
#ifdef RT_USING_COMPONENTS_INIT
rt_components_board_init();
#endif
}
/*@}*/

View File

@ -1,17 +1,17 @@
/*
* Copyright (c) 2006-2022, RT-Thread Development Team
* Copyright (c) 2006-2024, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-12-18 BruceOu first implementation
* 2024-03-19 Evlers remove the include of drv_usart.h
*/
#ifndef __BOARD_H__
#define __BOARD_H__
#include "gd32f20x.h"
#include "drv_usart.h"
#include "drv_gpio.h"
#include "gd32f20x_exti.h"

View File

@ -1,17 +1,25 @@
/*
* Copyright (c) 2006-2022, RT-Thread Development Team
* Copyright (c) 2006-2024, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-12-18 BruceOu first implementation
* 2024-03-19 Evlers add serial supports
*/
#include <stdint.h>
#include <rthw.h>
#include <rtthread.h>
#include <board.h>
#ifdef RT_USING_SERIAL_V2
#include "drv_usart_v2.h"
#else
#include "drv_usart.h"
#endif
/**
* @brief This function is executed in case of error occurrence.
* @param None
@ -67,12 +75,8 @@ void rt_hw_board_init()
SystemClock_Config();
#ifdef RT_USING_COMPONENTS_INIT
rt_components_board_init();
#endif
#ifdef RT_USING_CONSOLE
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
#ifdef RT_USING_SERIAL
rt_hw_usart_init();
#endif
#ifdef BSP_USING_SDRAM
@ -80,6 +84,14 @@ void rt_hw_board_init()
#else
rt_system_heap_init((void *)HEAP_BEGIN, (void *)HEAP_END);
#endif
#ifdef RT_USING_CONSOLE
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
#endif
#ifdef RT_USING_COMPONENTS_INIT
rt_components_board_init();
#endif
}
/*@}*/

View File

@ -1,17 +1,17 @@
/*
* Copyright (c) 2006-2022, RT-Thread Development Team
* Copyright (c) 2006-2024, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-12-18 BruceOu first implementation
* 2024-03-19 Evlers remove the include of drv_usart.h
*/
#ifndef __BOARD_H__
#define __BOARD_H__
#include "gd32f30x.h"
#include "drv_usart.h"
#include "drv_gpio.h"
#include "gd32f30x_exti.h"

View File

@ -1,17 +1,25 @@
/*
* Copyright (c) 2006-2022, RT-Thread Development Team
* Copyright (c) 2006-2024, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-12-18 BruceOu first implementation
* 2024-03-19 Evlers add serial supports
*/
#include <stdint.h>
#include <rthw.h>
#include <rtthread.h>
#include <board.h>
#ifdef RT_USING_SERIAL_V2
#include "drv_usart_v2.h"
#else
#include "drv_usart.h"
#endif
/**
* @brief This function is executed in case of error occurrence.
* @param None
@ -67,12 +75,8 @@ void rt_hw_board_init()
SystemClock_Config();
#ifdef RT_USING_COMPONENTS_INIT
rt_components_board_init();
#endif
#ifdef RT_USING_CONSOLE
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
#ifdef RT_USING_SERIAL
rt_hw_usart_init();
#endif
#ifdef BSP_USING_SDRAM
@ -80,6 +84,14 @@ void rt_hw_board_init()
#else
rt_system_heap_init((void *)HEAP_BEGIN, (void *)HEAP_END);
#endif
#ifdef RT_USING_CONSOLE
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
#endif
#ifdef RT_USING_COMPONENTS_INIT
rt_components_board_init();
#endif
}
/*@}*/

View File

@ -1,17 +1,17 @@
/*
* Copyright (c) 2006-2022, RT-Thread Development Team
* Copyright (c) 2006-2024, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-12-18 BruceOu first implementation
* 2024-03-19 Evlers remove the include of drv_usart.h
*/
#ifndef __BOARD_H__
#define __BOARD_H__
#include "gd32f30x.h"
#include "drv_usart.h"
#include "drv_gpio.h"
#include "gd32f30x_exti.h"

View File

@ -1,17 +1,25 @@
/*
* Copyright (c) 2006-2022, RT-Thread Development Team
* Copyright (c) 2006-2024, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-12-18 BruceOu first implementation
* 2024-03-19 Evlers add serial supports
*/
#include <stdint.h>
#include <rthw.h>
#include <rtthread.h>
#include <board.h>
#ifdef RT_USING_SERIAL_V2
#include "drv_usart_v2.h"
#else
#include "drv_usart.h"
#endif
/**
* @brief This function is executed in case of error occurrence.
* @param None
@ -67,12 +75,8 @@ void rt_hw_board_init()
SystemClock_Config();
#ifdef RT_USING_COMPONENTS_INIT
rt_components_board_init();
#endif
#ifdef RT_USING_CONSOLE
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
#ifdef RT_USING_SERIAL
rt_hw_usart_init();
#endif
#ifdef BSP_USING_SDRAM
@ -80,6 +84,14 @@ void rt_hw_board_init()
#else
rt_system_heap_init((void *)HEAP_BEGIN, (void *)HEAP_END);
#endif
#ifdef RT_USING_CONSOLE
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
#endif
#ifdef RT_USING_COMPONENTS_INIT
rt_components_board_init();
#endif
}
/*@}*/

View File

@ -1,17 +1,17 @@
/*
* Copyright (c) 2006-2022, RT-Thread Development Team
* Copyright (c) 2006-2024, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-12-18 BruceOu first implementation
* 2024-03-19 Evlers remove the include of drv_usart.h
*/
#ifndef __BOARD_H__
#define __BOARD_H__
#include "gd32f30x.h"
#include "drv_usart.h"
#include "drv_gpio.h"
#include "gd32f30x_exti.h"

View File

@ -1,17 +1,25 @@
/*
* Copyright (c) 2006-2022, RT-Thread Development Team
* Copyright (c) 2006-2024, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-12-18 BruceOu first implementation
* 2021-08-20 BruceOu first implementation
* 2024-03-19 Evlers add serial supports
*/
#include <stdint.h>
#include <rthw.h>
#include <rtthread.h>
#include <board.h>
#ifdef RT_USING_SERIAL_V2
#include "drv_usart_v2.h"
#else
#include "drv_usart.h"
#endif
/**
* @brief This function is executed in case of error occurrence.
* @param None
@ -67,12 +75,8 @@ void rt_hw_board_init()
SystemClock_Config();
#ifdef RT_USING_COMPONENTS_INIT
rt_components_board_init();
#endif
#ifdef RT_USING_CONSOLE
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
#ifdef RT_USING_SERIAL
rt_hw_usart_init();
#endif
#ifdef BSP_USING_SDRAM
@ -80,6 +84,14 @@ void rt_hw_board_init()
#else
rt_system_heap_init((void *)HEAP_BEGIN, (void *)HEAP_END);
#endif
#ifdef RT_USING_CONSOLE
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
#endif
#ifdef RT_USING_COMPONENTS_INIT
rt_components_board_init();
#endif
}
/*@}*/

View File

@ -1,17 +1,17 @@
/*
* Copyright (c) 2006-2022, RT-Thread Development Team
* Copyright (c) 2006-2024, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-12-18 BruceOu first implementation
* 2024-03-19 Evlers remove the include of drv_usart.h
*/
#ifndef __BOARD_H__
#define __BOARD_H__
#include "gd32f30x.h"
#include "drv_usart.h"
#include "drv_gpio.h"
#include "gd32f30x_exti.h"

View File

@ -57,6 +57,24 @@ menu "On-chip Peripheral Drivers"
select RT_SERIAL_USING_DMA
default n
config BSP_UART0_TX_USING_DMA
bool "Enable UART0 TX DMA"
depends on BSP_USING_UART0
select RT_SERIAL_USING_DMA
default n
config BSP_UART0_RX_BUFSIZE
int "Set UART0 RX buffer size"
range 64 65535
depends on BSP_USING_UART0 && RT_USING_SERIAL_V2
default 64
config BSP_UART0_TX_BUFSIZE
int "Set UART0 TX buffer size"
range 0 65535
depends on BSP_USING_UART0 && RT_USING_SERIAL_V2
default 0
config BSP_USING_UART1
bool "Enable UART1"
default y
@ -67,6 +85,24 @@ menu "On-chip Peripheral Drivers"
select RT_SERIAL_USING_DMA
default n
config BSP_UART1_TX_USING_DMA
bool "Enable UART1 TX DMA"
depends on BSP_USING_UART1
select RT_SERIAL_USING_DMA
default n
config BSP_UART1_RX_BUFSIZE
int "Set UART1 RX buffer size"
range 64 65535
depends on BSP_USING_UART1 && RT_USING_SERIAL_V2
default 64
config BSP_UART1_TX_BUFSIZE
int "Set UART1 TX buffer size"
range 0 65535
depends on BSP_USING_UART1 && RT_USING_SERIAL_V2
default 0
config BSP_USING_UART2
bool "Enable UART2"
default n
@ -77,6 +113,24 @@ menu "On-chip Peripheral Drivers"
select RT_SERIAL_USING_DMA
default n
config BSP_UART2_TX_USING_DMA
bool "Enable UART2 TX DMA"
depends on BSP_USING_UART2
select RT_SERIAL_USING_DMA
default n
config BSP_UART2_RX_BUFSIZE
int "Set UART2 RX buffer size"
range 64 65535
depends on BSP_USING_UART2 && RT_USING_SERIAL_V2
default 64
config BSP_UART2_TX_BUFSIZE
int "Set UART2 TX buffer size"
range 0 65535
depends on BSP_USING_UART2 && RT_USING_SERIAL_V2
default 0
config BSP_USING_UART3
bool "Enable UART3"
default n
@ -87,6 +141,24 @@ menu "On-chip Peripheral Drivers"
select RT_SERIAL_USING_DMA
default n
config BSP_UART3_TX_USING_DMA
bool "Enable UART3 TX DMA"
depends on BSP_USING_UART3
select RT_SERIAL_USING_DMA
default n
config BSP_UART3_RX_BUFSIZE
int "Set UART3 RX buffer size"
range 64 65535
depends on BSP_USING_UART3 && RT_USING_SERIAL_V2
default 64
config BSP_UART3_TX_BUFSIZE
int "Set UART3 TX buffer size"
range 0 65535
depends on BSP_USING_UART3 && RT_USING_SERIAL_V2
default 0
config BSP_USING_UART4
bool "Enable UART4"
default n
@ -97,6 +169,24 @@ menu "On-chip Peripheral Drivers"
select RT_SERIAL_USING_DMA
default n
config BSP_UART4_TX_USING_DMA
bool "Enable UART4 TX DMA"
depends on BSP_USING_UART4
select RT_SERIAL_USING_DMA
default n
config BSP_UART4_RX_BUFSIZE
int "Set UART4 RX buffer size"
range 64 65535
depends on BSP_USING_UART4 && RT_USING_SERIAL_V2
default 64
config BSP_UART4_TX_BUFSIZE
int "Set UART4 TX buffer size"
range 0 65535
depends on BSP_USING_UART4 && RT_USING_SERIAL_V2
default 0
config BSP_USING_UART5
bool "Enable UART5"
default n
@ -106,6 +196,24 @@ menu "On-chip Peripheral Drivers"
depends on BSP_USING_UART5
select RT_SERIAL_USING_DMA
default n
config BSP_UART5_TX_USING_DMA
bool "Enable UART5 TX DMA"
depends on BSP_USING_UART5
select RT_SERIAL_USING_DMA
default n
config BSP_UART5_RX_BUFSIZE
int "Set UART5 RX buffer size"
range 64 65535
depends on BSP_USING_UART5 && RT_USING_SERIAL_V2
default 64
config BSP_UART5_TX_BUFSIZE
int "Set UART5 TX buffer size"
range 0 65535
depends on BSP_USING_UART5 && RT_USING_SERIAL_V2
default 0
endif
menuconfig BSP_USING_SPI

View File

@ -6,12 +6,20 @@
* Change Logs:
* Date Author Notes
* 2021-08-20 BruceOu first implementation
* 2024-03-19 Evlers add serial supports
*/
#include <stdint.h>
#include <rthw.h>
#include <rtthread.h>
#include <board.h>
#ifdef RT_USING_SERIAL_V2
#include "drv_usart_v2.h"
#else
#include "drv_usart.h"
#endif
/**
* @brief This function is executed in case of error occurrence.
* @param None
@ -67,12 +75,8 @@ void rt_hw_board_init()
SystemClock_Config();
#ifdef RT_USING_COMPONENTS_INIT
rt_components_board_init();
#endif
#if defined(RT_USING_CONSOLE) && defined(RT_USING_DEVICE)
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
#ifdef RT_USING_SERIAL
rt_hw_usart_init();
#endif
#ifdef BSP_USING_SDRAM
@ -80,6 +84,14 @@ void rt_hw_board_init()
#else
rt_system_heap_init((void *)HEAP_BEGIN, (void *)HEAP_END);
#endif
#ifdef RT_USING_CONSOLE
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
#endif
#ifdef RT_USING_COMPONENTS_INIT
rt_components_board_init();
#endif
}
/*@}*/

View File

@ -6,12 +6,12 @@
* Change Logs:
* Date Author Notes
* 2021-08-20 BruceOu first implementation
* 2024-03-19 Evlers remove the include of drv_usart.h
*/
#ifndef __BOARD_H__
#define __BOARD_H__
#include "gd32f4xx.h"
#include "drv_usart.h"
#include "drv_gpio.h"
#include "gd32f4xx_exti.h"

View File

@ -37,6 +37,24 @@ menu "On-chip Peripheral Drivers"
select RT_SERIAL_USING_DMA
default n
config BSP_UART0_TX_USING_DMA
bool "Enable UART0 TX DMA"
depends on BSP_USING_UART0
select RT_SERIAL_USING_DMA
default n
config BSP_UART0_RX_BUFSIZE
int "Set UART0 RX buffer size"
range 64 65535
depends on BSP_USING_UART0 && RT_USING_SERIAL_V2
default 64
config BSP_UART0_TX_BUFSIZE
int "Set UART0 TX buffer size"
range 0 65535
depends on BSP_USING_UART0 && RT_USING_SERIAL_V2
default 0
config BSP_USING_UART1
bool "Enable UART1"
default y
@ -47,6 +65,24 @@ menu "On-chip Peripheral Drivers"
select RT_SERIAL_USING_DMA
default n
config BSP_UART1_TX_USING_DMA
bool "Enable UART1 TX DMA"
depends on BSP_USING_UART1
select RT_SERIAL_USING_DMA
default n
config BSP_UART1_RX_BUFSIZE
int "Set UART1 RX buffer size"
range 64 65535
depends on BSP_USING_UART1 && RT_USING_SERIAL_V2
default 64
config BSP_UART1_TX_BUFSIZE
int "Set UART1 TX buffer size"
range 0 65535
depends on BSP_USING_UART1 && RT_USING_SERIAL_V2
default 0
config BSP_USING_UART2
bool "Enable UART2"
default n
@ -57,6 +93,24 @@ menu "On-chip Peripheral Drivers"
select RT_SERIAL_USING_DMA
default n
config BSP_UART2_TX_USING_DMA
bool "Enable UART2 TX DMA"
depends on BSP_USING_UART2
select RT_SERIAL_USING_DMA
default n
config BSP_UART2_RX_BUFSIZE
int "Set UART2 RX buffer size"
range 64 65535
depends on BSP_USING_UART2 && RT_USING_SERIAL_V2
default 64
config BSP_UART2_TX_BUFSIZE
int "Set UART2 TX buffer size"
range 0 65535
depends on BSP_USING_UART2 && RT_USING_SERIAL_V2
default 0
config BSP_USING_UART3
bool "Enable UART3"
default n
@ -67,6 +121,24 @@ menu "On-chip Peripheral Drivers"
select RT_SERIAL_USING_DMA
default n
config BSP_UART3_TX_USING_DMA
bool "Enable UART3 TX DMA"
depends on BSP_USING_UART3
select RT_SERIAL_USING_DMA
default n
config BSP_UART3_RX_BUFSIZE
int "Set UART3 RX buffer size"
range 64 65535
depends on BSP_USING_UART3 && RT_USING_SERIAL_V2
default 64
config BSP_UART3_TX_BUFSIZE
int "Set UART3 TX buffer size"
range 0 65535
depends on BSP_USING_UART3 && RT_USING_SERIAL_V2
default 0
config BSP_USING_UART4
bool "Enable UART4"
default n
@ -77,6 +149,24 @@ menu "On-chip Peripheral Drivers"
select RT_SERIAL_USING_DMA
default n
config BSP_UART4_TX_USING_DMA
bool "Enable UART4 TX DMA"
depends on BSP_USING_UART4
select RT_SERIAL_USING_DMA
default n
config BSP_UART4_RX_BUFSIZE
int "Set UART4 RX buffer size"
range 64 65535
depends on BSP_USING_UART4 && RT_USING_SERIAL_V2
default 64
config BSP_UART4_TX_BUFSIZE
int "Set UART4 TX buffer size"
range 0 65535
depends on BSP_USING_UART4 && RT_USING_SERIAL_V2
default 0
config BSP_USING_UART5
bool "Enable UART5"
default n
@ -86,6 +176,24 @@ menu "On-chip Peripheral Drivers"
depends on BSP_USING_UART5
select RT_SERIAL_USING_DMA
default n
config BSP_UART5_TX_USING_DMA
bool "Enable UART5 TX DMA"
depends on BSP_USING_UART5
select RT_SERIAL_USING_DMA
default n
config BSP_UART5_RX_BUFSIZE
int "Set UART5 RX buffer size"
range 64 65535
depends on BSP_USING_UART5 && RT_USING_SERIAL_V2
default 64
config BSP_UART5_TX_BUFSIZE
int "Set UART5 TX buffer size"
range 0 65535
depends on BSP_USING_UART5 && RT_USING_SERIAL_V2
default 0
endif
menuconfig BSP_USING_SPI

View File

@ -1,17 +1,25 @@
/*
* Copyright (c) 2006-2022, RT-Thread Development Team
* Copyright (c) 2006-2024, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-08-20 BruceOu first implementation
* 2024-03-19 Evlers add serial supports
*/
#include <stdint.h>
#include <rthw.h>
#include <rtthread.h>
#include <board.h>
#ifdef RT_USING_SERIAL_V2
#include "drv_usart_v2.h"
#else
#include "drv_usart.h"
#endif
/**
* @brief This function is executed in case of error occurrence.
* @param None
@ -67,12 +75,8 @@ void rt_hw_board_init()
SystemClock_Config();
#ifdef RT_USING_COMPONENTS_INIT
rt_components_board_init();
#endif
#if defined(RT_USING_CONSOLE) && defined(RT_USING_DEVICE)
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
#ifdef RT_USING_SERIAL
rt_hw_usart_init();
#endif
#ifdef BSP_USING_SDRAM
@ -80,6 +84,14 @@ void rt_hw_board_init()
#else
rt_system_heap_init((void *)HEAP_BEGIN, (void *)HEAP_END);
#endif
#ifdef RT_USING_CONSOLE
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
#endif
#ifdef RT_USING_COMPONENTS_INIT
rt_components_board_init();
#endif
}
/*@}*/

View File

@ -1,17 +1,17 @@
/*
* Copyright (c) 2006-2022, RT-Thread Development Team
* Copyright (c) 2006-2024, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-08-20 BruceOu first implementation
* 2024-03-19 Evlers remove the include of drv_usart.h
*/
#ifndef __BOARD_H__
#define __BOARD_H__
#include "gd32f4xx.h"
#include "drv_usart.h"
#include "drv_gpio.h"
#include "gd32f4xx_exti.h"

View File

@ -37,6 +37,24 @@ menu "On-chip Peripheral Drivers"
select RT_SERIAL_USING_DMA
default n
config BSP_UART0_TX_USING_DMA
bool "Enable UART0 TX DMA"
depends on BSP_USING_UART0
select RT_SERIAL_USING_DMA
default n
config BSP_UART0_RX_BUFSIZE
int "Set UART0 RX buffer size"
range 64 65535
depends on BSP_USING_UART0 && RT_USING_SERIAL_V2
default 64
config BSP_UART0_TX_BUFSIZE
int "Set UART0 TX buffer size"
range 0 65535
depends on BSP_USING_UART0 && RT_USING_SERIAL_V2
default 0
config BSP_USING_UART1
bool "Enable UART1"
default n
@ -47,6 +65,24 @@ menu "On-chip Peripheral Drivers"
select RT_SERIAL_USING_DMA
default n
config BSP_UART1_TX_USING_DMA
bool "Enable UART1 TX DMA"
depends on BSP_USING_UART1
select RT_SERIAL_USING_DMA
default n
config BSP_UART1_RX_BUFSIZE
int "Set UART1 RX buffer size"
range 64 65535
depends on BSP_USING_UART1 && RT_USING_SERIAL_V2
default 64
config BSP_UART1_TX_BUFSIZE
int "Set UART1 TX buffer size"
range 0 65535
depends on BSP_USING_UART1 && RT_USING_SERIAL_V2
default 0
config BSP_USING_UART2
bool "Enable UART2"
default n
@ -57,6 +93,24 @@ menu "On-chip Peripheral Drivers"
select RT_SERIAL_USING_DMA
default n
config BSP_UART2_TX_USING_DMA
bool "Enable UART2 TX DMA"
depends on BSP_USING_UART2
select RT_SERIAL_USING_DMA
default n
config BSP_UART2_RX_BUFSIZE
int "Set UART2 RX buffer size"
range 64 65535
depends on BSP_USING_UART2 && RT_USING_SERIAL_V2
default 64
config BSP_UART2_TX_BUFSIZE
int "Set UART2 TX buffer size"
range 0 65535
depends on BSP_USING_UART2 && RT_USING_SERIAL_V2
default 0
config BSP_USING_UART3
bool "Enable UART3"
default n
@ -67,6 +121,24 @@ menu "On-chip Peripheral Drivers"
select RT_SERIAL_USING_DMA
default n
config BSP_UART3_TX_USING_DMA
bool "Enable UART3 TX DMA"
depends on BSP_USING_UART3
select RT_SERIAL_USING_DMA
default n
config BSP_UART3_RX_BUFSIZE
int "Set UART3 RX buffer size"
range 64 65535
depends on BSP_USING_UART3 && RT_USING_SERIAL_V2
default 64
config BSP_UART3_TX_BUFSIZE
int "Set UART3 TX buffer size"
range 0 65535
depends on BSP_USING_UART3 && RT_USING_SERIAL_V2
default 0
config BSP_USING_UART4
bool "Enable UART4"
default n
@ -77,6 +149,24 @@ menu "On-chip Peripheral Drivers"
select RT_SERIAL_USING_DMA
default n
config BSP_UART4_TX_USING_DMA
bool "Enable UART4 TX DMA"
depends on BSP_USING_UART4
select RT_SERIAL_USING_DMA
default n
config BSP_UART4_RX_BUFSIZE
int "Set UART4 RX buffer size"
range 64 65535
depends on BSP_USING_UART4 && RT_USING_SERIAL_V2
default 64
config BSP_UART4_TX_BUFSIZE
int "Set UART4 TX buffer size"
range 0 65535
depends on BSP_USING_UART4 && RT_USING_SERIAL_V2
default 0
config BSP_USING_UART5
bool "Enable UART5"
default n
@ -87,6 +177,24 @@ menu "On-chip Peripheral Drivers"
select RT_SERIAL_USING_DMA
default n
config BSP_UART5_TX_USING_DMA
bool "Enable UART5 TX DMA"
depends on BSP_USING_UART5
select RT_SERIAL_USING_DMA
default n
config BSP_UART5_RX_BUFSIZE
int "Set UART5 RX buffer size"
range 64 65535
depends on BSP_USING_UART5 && RT_USING_SERIAL_V2
default 64
config BSP_UART5_TX_BUFSIZE
int "Set UART5 TX buffer size"
range 0 65535
depends on BSP_USING_UART5 && RT_USING_SERIAL_V2
default 0
config BSP_USING_UART6
bool "Enable UART6"
default n
@ -97,6 +205,24 @@ menu "On-chip Peripheral Drivers"
select RT_SERIAL_USING_DMA
default n
config BSP_UART6_TX_USING_DMA
bool "Enable UART6 TX DMA"
depends on BSP_USING_UART6
select RT_SERIAL_USING_DMA
default n
config BSP_UART6_RX_BUFSIZE
int "Set UART6 RX buffer size"
range 64 65535
depends on BSP_USING_UART6 && RT_USING_SERIAL_V2
default 64
config BSP_UART6_TX_BUFSIZE
int "Set UART6 TX buffer size"
range 0 65535
depends on BSP_USING_UART6 && RT_USING_SERIAL_V2
default 0
config BSP_USING_UART7
bool "Enable UART7"
default n
@ -106,6 +232,24 @@ menu "On-chip Peripheral Drivers"
depends on BSP_USING_UART7
select RT_SERIAL_USING_DMA
default n
config BSP_UART7_TX_USING_DMA
bool "Enable UART7 TX DMA"
depends on BSP_USING_UART7
select RT_SERIAL_USING_DMA
default n
config BSP_UART7_RX_BUFSIZE
int "Set UART7 RX buffer size"
range 64 65535
depends on BSP_USING_UART7 && RT_USING_SERIAL_V2
default 64
config BSP_UART7_TX_BUFSIZE
int "Set UART7 TX buffer size"
range 0 65535
depends on BSP_USING_UART7 && RT_USING_SERIAL_V2
default 0
endif
menuconfig BSP_USING_SPI

View File

@ -1,17 +1,25 @@
/*
* Copyright (c) 2006-2022, RT-Thread Development Team
* Copyright (c) 2006-2024, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-08-20 BruceOu first implementation
* 2024-03-19 Evlers add serial supports
*/
#include <stdint.h>
#include <rthw.h>
#include <rtthread.h>
#include <board.h>
#ifdef RT_USING_SERIAL_V2
#include "drv_usart_v2.h"
#else
#include "drv_usart.h"
#endif
/**
* @brief This function is executed in case of error occurrence.
* @param None
@ -67,12 +75,8 @@ void rt_hw_board_init()
SystemClock_Config();
#ifdef RT_USING_COMPONENTS_INIT
rt_components_board_init();
#endif
#ifdef RT_USING_CONSOLE
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
#ifdef RT_USING_SERIAL
rt_hw_usart_init();
#endif
#ifdef BSP_USING_SDRAM
@ -80,6 +84,14 @@ void rt_hw_board_init()
#else
rt_system_heap_init((void *)HEAP_BEGIN, (void *)HEAP_END);
#endif
#ifdef RT_USING_CONSOLE
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
#endif
#ifdef RT_USING_COMPONENTS_INIT
rt_components_board_init();
#endif
}
/*@}*/

View File

@ -1,17 +1,17 @@
/*
* Copyright (c) 2006-2022, RT-Thread Development Team
* Copyright (c) 2006-2024, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-08-20 BruceOu first implementation
* 2024-03-19 Evlers remove the include of drv_usart.h
*/
#ifndef __BOARD_H__
#define __BOARD_H__
#include "gd32f4xx.h"
#include "drv_usart.h"
#include "drv_gpio.h"
#include "gd32f4xx_exti.h"

View File

@ -37,6 +37,24 @@ menu "On-chip Peripheral Drivers"
select RT_SERIAL_USING_DMA
default n
config BSP_UART0_TX_USING_DMA
bool "Enable UART0 TX DMA"
depends on BSP_USING_UART0
select RT_SERIAL_USING_DMA
default n
config BSP_UART0_RX_BUFSIZE
int "Set UART0 RX buffer size"
range 64 65535
depends on BSP_USING_UART0 && RT_USING_SERIAL_V2
default 64
config BSP_UART0_TX_BUFSIZE
int "Set UART0 TX buffer size"
range 0 65535
depends on BSP_USING_UART0 && RT_USING_SERIAL_V2
default 0
config BSP_USING_UART1
bool "Enable UART1"
default n
@ -47,6 +65,24 @@ menu "On-chip Peripheral Drivers"
select RT_SERIAL_USING_DMA
default n
config BSP_UART1_TX_USING_DMA
bool "Enable UART1 TX DMA"
depends on BSP_USING_UART1
select RT_SERIAL_USING_DMA
default n
config BSP_UART1_RX_BUFSIZE
int "Set UART1 RX buffer size"
range 64 65535
depends on BSP_USING_UART1 && RT_USING_SERIAL_V2
default 64
config BSP_UART1_TX_BUFSIZE
int "Set UART1 TX buffer size"
range 0 65535
depends on BSP_USING_UART1 && RT_USING_SERIAL_V2
default 0
config BSP_USING_UART2
bool "Enable UART2"
default n
@ -57,6 +93,24 @@ menu "On-chip Peripheral Drivers"
select RT_SERIAL_USING_DMA
default n
config BSP_UART2_TX_USING_DMA
bool "Enable UART2 TX DMA"
depends on BSP_USING_UART2
select RT_SERIAL_USING_DMA
default n
config BSP_UART2_RX_BUFSIZE
int "Set UART2 RX buffer size"
range 64 65535
depends on BSP_USING_UART2 && RT_USING_SERIAL_V2
default 64
config BSP_UART2_TX_BUFSIZE
int "Set UART2 TX buffer size"
range 0 65535
depends on BSP_USING_UART2 && RT_USING_SERIAL_V2
default 0
config BSP_USING_UART3
bool "Enable UART3"
default n
@ -67,6 +121,24 @@ menu "On-chip Peripheral Drivers"
select RT_SERIAL_USING_DMA
default n
config BSP_UART3_TX_USING_DMA
bool "Enable UART3 TX DMA"
depends on BSP_USING_UART3
select RT_SERIAL_USING_DMA
default n
config BSP_UART3_RX_BUFSIZE
int "Set UART3 RX buffer size"
range 64 65535
depends on BSP_USING_UART3 && RT_USING_SERIAL_V2
default 64
config BSP_UART3_TX_BUFSIZE
int "Set UART3 TX buffer size"
range 0 65535
depends on BSP_USING_UART3 && RT_USING_SERIAL_V2
default 0
config BSP_USING_UART4
bool "Enable UART4"
default n
@ -77,6 +149,24 @@ menu "On-chip Peripheral Drivers"
select RT_SERIAL_USING_DMA
default n
config BSP_UART4_TX_USING_DMA
bool "Enable UART4 TX DMA"
depends on BSP_USING_UART4
select RT_SERIAL_USING_DMA
default n
config BSP_UART4_RX_BUFSIZE
int "Set UART4 RX buffer size"
range 64 65535
depends on BSP_USING_UART4 && RT_USING_SERIAL_V2
default 64
config BSP_UART4_TX_BUFSIZE
int "Set UART4 TX buffer size"
range 0 65535
depends on BSP_USING_UART4 && RT_USING_SERIAL_V2
default 0
config BSP_USING_UART5
bool "Enable UART5"
default n
@ -87,6 +177,24 @@ menu "On-chip Peripheral Drivers"
select RT_SERIAL_USING_DMA
default n
config BSP_UART5_TX_USING_DMA
bool "Enable UART5 TX DMA"
depends on BSP_USING_UART5
select RT_SERIAL_USING_DMA
default n
config BSP_UART5_RX_BUFSIZE
int "Set UART5 RX buffer size"
range 64 65535
depends on BSP_USING_UART5 && RT_USING_SERIAL_V2
default 64
config BSP_UART5_TX_BUFSIZE
int "Set UART5 TX buffer size"
range 0 65535
depends on BSP_USING_UART5 && RT_USING_SERIAL_V2
default 0
config BSP_USING_UART6
bool "Enable UART6"
default n
@ -97,6 +205,24 @@ menu "On-chip Peripheral Drivers"
select RT_SERIAL_USING_DMA
default n
config BSP_UART6_TX_USING_DMA
bool "Enable UART6 TX DMA"
depends on BSP_USING_UART6
select RT_SERIAL_USING_DMA
default n
config BSP_UART6_RX_BUFSIZE
int "Set UART6 RX buffer size"
range 64 65535
depends on BSP_USING_UART6 && RT_USING_SERIAL_V2
default 64
config BSP_UART6_TX_BUFSIZE
int "Set UART6 TX buffer size"
range 0 65535
depends on BSP_USING_UART6 && RT_USING_SERIAL_V2
default 0
config BSP_USING_UART7
bool "Enable UART7"
default n
@ -106,6 +232,24 @@ menu "On-chip Peripheral Drivers"
depends on BSP_USING_UART7
select RT_SERIAL_USING_DMA
default n
config BSP_UART7_TX_USING_DMA
bool "Enable UART7 TX DMA"
depends on BSP_USING_UART7
select RT_SERIAL_USING_DMA
default n
config BSP_UART7_RX_BUFSIZE
int "Set UART7 RX buffer size"
range 64 65535
depends on BSP_USING_UART7 && RT_USING_SERIAL_V2
default 64
config BSP_UART7_TX_BUFSIZE
int "Set UART7 TX buffer size"
range 0 65535
depends on BSP_USING_UART7 && RT_USING_SERIAL_V2
default 0
endif
menuconfig BSP_USING_SPI

View File

@ -1,17 +1,25 @@
/*
* Copyright (c) 2006-2023, RT-Thread Development Team
* Copyright (c) 2006-2024, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-08-20 BruceOu first implementation
* 2024-03-19 Evlers add serial supports
*/
#include <stdint.h>
#include <rthw.h>
#include <rtthread.h>
#include <board.h>
#ifdef RT_USING_SERIAL_V2
#include "drv_usart_v2.h"
#else
#include "drv_usart.h"
#endif
/**
* @brief This function is executed in case of error occurrence.
* @param None
@ -67,16 +75,20 @@ void rt_hw_board_init()
SystemClock_Config();
#ifdef RT_USING_COMPONENTS_INIT
rt_components_board_init();
#ifdef RT_USING_SERIAL
rt_hw_usart_init();
#endif
#ifdef RT_USING_HEAP
rt_system_heap_init((void *)HEAP_BEGIN, (void *)HEAP_END);
#endif
#ifdef RT_USING_CONSOLE
rt_console_set_device(RT_CONSOLE_DEVICE_NAME);
#endif
#ifdef RT_USING_HEAP
rt_system_heap_init((void *)HEAP_BEGIN, (void *)HEAP_END);
#ifdef RT_USING_COMPONENTS_INIT
rt_components_board_init();
#endif
}

View File

@ -1,17 +1,17 @@
/*
* Copyright (c) 2006-2023, RT-Thread Development Team
* Copyright (c) 2006-2024, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-08-20 BruceOu first implementation
* 2024-03-19 Evlers remove the include of drv_usart.h
*/
#ifndef __BOARD_H__
#define __BOARD_H__
#include "gd32f4xx.h"
#include "drv_usart.h"
#include "drv_gpio.h"
#include "gd32f4xx_exti.h"

View File

@ -10,6 +10,7 @@ src = Split('''
CMSIS/GD/GD32F4xx/Source/system_gd32f4xx.c
GD32F4xx_standard_peripheral/Source/gd32f4xx_gpio.c
GD32F4xx_standard_peripheral/Source/gd32f4xx_rcu.c
GD32F4xx_standard_peripheral/Source/gd32f4xx_dma.c
GD32F4xx_standard_peripheral/Source/gd32f4xx_exti.c
GD32F4xx_standard_peripheral/Source/gd32f4xx_misc.c
GD32F4xx_standard_peripheral/Source/gd32f4xx_syscfg.c

View File

@ -14,7 +14,10 @@ if GetDepend('RT_USING_PIN'):
# add usart drivers.
if GetDepend(['RT_USING_SERIAL']):
src += ['drv_usart.c']
if GetDepend(['RT_USING_SERIAL_V2']):
src += ['drv_usart_v2.c']
else:
src += ['drv_usart.c']
# add i2c drivers.
if GetDepend(['RT_USING_I2C', 'RT_USING_I2C_BITOPS']):

View File

@ -0,0 +1,32 @@
/*
* Copyright (c) 2006-2024, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2024-03-19 Evlers first implementation
*/
#ifndef _DRV_DMA_H_
#define _DRV_DMA_H_
#define DRV_DMA_CONFIG(dmax, chx, subx) { \
.periph = DMA##dmax, \
.channel = DMA_CH##chx, \
.rcu = RCU_DMA##dmax, \
.subperiph = DMA_SUBPERI##subx, \
.irq = DMA##dmax##_Channel##chx##_IRQn, \
}
struct dma_config
{
uint32_t periph;
rcu_periph_enum rcu;
dma_channel_enum channel;
dma_subperipheral_enum subperiph;
IRQn_Type irq;
};
#endif /* _DRV_DMA_H_ */

View File

@ -519,6 +519,4 @@ int rt_hw_usart_init(void)
return result;
}
INIT_BOARD_EXPORT(rt_hw_usart_init);
#endif

View File

@ -47,6 +47,8 @@ struct gd32_uart
char *device_name;
};
int rt_hw_usart_init(void);
#ifdef __cplusplus
}
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,65 @@
/*
* Copyright (c) 2006-2024, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2024-03-19 Evlers first implementation
*/
#ifndef __DRV_USART_V2_H__
#define __DRV_USART_V2_H__
#include <rthw.h>
#include <rtthread.h>
#include <rtdevice.h>
#include <board.h>
#include "drv_dma.h"
#ifdef __cplusplus
extern "C" {
#endif
/* GD32 uart driver */
struct gd32_uart
{
char *device_name;
uint32_t periph;
IRQn_Type irqn;
rcu_periph_enum per_clk;
rcu_periph_enum tx_gpio_clk;
rcu_periph_enum rx_gpio_clk;
uint32_t tx_port;
#if defined SOC_SERIES_GD32F4xx
uint16_t tx_af;
#endif
uint16_t tx_pin;
uint32_t rx_port;
#if defined SOC_SERIES_GD32F4xx
uint16_t rx_af;
#endif
uint16_t rx_pin;
struct rt_serial_device serial;
#ifdef RT_SERIAL_USING_DMA
struct
{
struct dma_config rx;
struct dma_config tx;
rt_size_t last_index;
rt_sem_t sem_ftf;
} dma;
rt_uint16_t uart_dma_flag;
#endif
};
int rt_hw_usart_init(void);
#ifdef __cplusplus
}
#endif
#endif /* __DRV_USART_V2_H__ */