You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
879 B
42 lines
879 B
|
3 days ago
|
#ifndef BSP_UART_H
|
||
|
|
|
||
|
|
#define BSP_UART_H
|
||
|
|
|
||
|
|
#include "bsp_config.h"
|
||
|
|
#ifdef USE_UART
|
||
|
|
#include "com.h"
|
||
|
|
#include "usart.h"
|
||
|
|
#include "main.h"
|
||
|
|
#ifdef CONFIG_UART_IT_IDLEDMA
|
||
|
|
#include "dma.h"
|
||
|
|
#endif
|
||
|
|
|
||
|
|
#define CONFIG_UART_BUFFER_SIZE 128
|
||
|
|
|
||
|
|
typedef struct
|
||
|
|
{
|
||
|
|
UART_HandleTypeDef *m_uart;
|
||
|
|
DMA_HandleTypeDef *m_hdma_rx;
|
||
|
|
}TUartTab;
|
||
|
|
|
||
|
|
typedef struct
|
||
|
|
{
|
||
|
|
uint32_t m_buf_size;
|
||
|
|
UART_HandleTypeDef *m_uart;
|
||
|
|
#ifdef CONFIG_UART_IT_IDLEDMA
|
||
|
|
DMA_HandleTypeDef *m_hdma_rx;
|
||
|
|
uint8_t *m_dma_rx_buf;
|
||
|
|
uint16_t m_last_dma_pos;
|
||
|
|
#else
|
||
|
|
uint8_t m_temp;
|
||
|
|
#endif
|
||
|
|
}TUartUserData;
|
||
|
|
|
||
|
|
extern TUartUserData *UART_userdata_init(int _iID, uint32_t _uiBaudRate, uint32_t _uiSize);
|
||
|
|
extern void UART_IT_init(TComCtrl *_ptComCtrl);
|
||
|
|
extern void UART_DMA_RX_IRQHandler(TComCtrl *_ptComCtrl);
|
||
|
|
extern void UART_RX_IRQHandler(TComCtrl *_ptComCtrl);
|
||
|
|
#endif
|
||
|
|
|
||
|
|
#endif /* end of include guard: BSP_UART_H */
|