fixed usb/usart drivers

This commit is contained in:
sheltonyu 2023-11-17 17:02:18 +08:00 committed by Meco Man
parent 241e7ff083
commit 41ab3f7535
5 changed files with 14 additions and 12 deletions

View File

@ -186,7 +186,7 @@ extern "C" {
#define UART7_RX_DMA_CHANNEL DMA2_CHANNEL6
#define UART7_RX_DMA_IRQ DMA2_Channel6_IRQn
#define UART7_RX_DMA_MUX_CHANNEL DMA2MUX_CHANNEL6
#define UART7_RX_DMA_REQ_ID DMAMUX_DMAREQ_ID_USART7_RX
#define UART7_RX_DMA_REQ_ID DMAMUX_DMAREQ_ID_UART7_RX
#endif
/* DMA2 channel7 */
@ -196,7 +196,7 @@ extern "C" {
#define UART7_TX_DMA_CHANNEL DMA2_CHANNEL7
#define UART7_TX_DMA_IRQ DMA2_Channel7_IRQn
#define UART7_TX_DMA_MUX_CHANNEL DMA2MUX_CHANNEL7
#define UART7_TX_DMA_REQ_ID DMAMUX_DMAREQ_ID_USART7_TX
#define UART7_TX_DMA_REQ_ID DMAMUX_DMAREQ_ID_UART7_TX
#endif
#ifdef __cplusplus

View File

@ -24,8 +24,8 @@ extern "C" {
#define UART4_IRQHandler USART4_IRQHandler
#define UART5_IRQHandler USART5_IRQHandler
#define UART6_IRQHandler USART6_IRQHandler
#define UART7_IRQHandler USART7_IRQHandler
#define UART8_IRQHandler USART8_IRQHandler
#define UART7_IRQHandler UART7_IRQHandler
#define UART8_IRQHandler UART8_IRQHandler
#if defined(BSP_USING_UART1)
#define UART1_CONFIG \
@ -217,8 +217,8 @@ extern "C" {
#define UART7_CONFIG \
{ \
.name = "uart7", \
.uart_x = USART7, \
.irqn = USART7_IRQn, \
.uart_x = UART7, \
.irqn = UART7_IRQn, \
}
#if defined(BSP_UART7_RX_USING_DMA)
@ -248,8 +248,8 @@ extern "C" {
#define UART8_CONFIG \
{ \
.name = "uart8", \
.uart_x = USART8, \
.irqn = USART8_IRQn, \
.uart_x = UART8, \
.irqn = UART8_IRQn, \
}
#endif /* BSP_USING_UART8 */

View File

@ -7,6 +7,7 @@
* Date Author Notes
* 2023-02-23 Jonas first version
* 2023-04-16 shelton update for perfection of drv_usart_v2
* 2023-11-16 shelton add support at32f402/405 series
*/
#include "drv_common.h"
@ -365,7 +366,8 @@ static void at32_dma_config(struct rt_serial_device *serial, rt_ubase_t flag)
(dma_flexible_request_type)dma_config->request_id);
#endif
#if defined (SOC_SERIES_AT32F435) || defined (SOC_SERIES_AT32F437) || \
defined (SOC_SERIES_AT32F423)
defined (SOC_SERIES_AT32F423) || defined (SOC_SERIES_AT32F402) || \
defined (SOC_SERIES_AT32F405)
dmamux_enable(dma_config->dma_x, TRUE);
dmamux_init(dma_config->dmamux_channel, (dmamux_requst_id_sel_type)dma_config->request_id);
#endif

View File

@ -350,7 +350,7 @@ static rt_err_t at32_hcd_init(rt_device_t device)
/* init usb */
usbh_init(p_usbotg_instance->p_otg_core,
USB_FULL_SPEED_CORE_ID,
p_usbotg_instance->dev_spd,
p_usbotg_instance->id);
return RT_EOK;
}

View File

@ -52,9 +52,9 @@ extern "C" {
*/
typedef enum
{
USB_LOW_SPEED_CORE_ID, /*!< usb low speed core id */
USB_HIGH_SPEED_CORE_ID, /*!< usb low speed core id */
USB_FULL_SPEED_CORE_ID, /*!< usb full speed core id */
USB_HIGH_SPEED_CORE_ID, /*!< usb high speed core id */
USB_LOW_SPEED_CORE_ID /*!< usb high speed core id */
} usb_speed_type;
/**