85 lines
1.4 KiB
C
85 lines
1.4 KiB
C
#ifndef __DRV_UART_H__
|
|
#define __DRV_UART_H__
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#include "global.h"
|
|
#include "usart.h"
|
|
#include "uart/uart_fifo.h"
|
|
|
|
//定义UART FIFO大小
|
|
#define UART1_RX_ENABLE 256
|
|
#define UART1_TX_ENABLE 256
|
|
#define UART2_RX_ENABLE 256
|
|
#define UART2_TX_ENABLE 256
|
|
#define UART3_RX_ENABLE 256
|
|
#define UART3_TX_ENABLE 256
|
|
#define UART5_RX_ENABLE 256
|
|
#define UART5_TX_ENABLE 256
|
|
#define LPUART1_RX_ENABLE 256
|
|
#define LPUART1_TX_ENABLE 256
|
|
|
|
|
|
//LPUSART1
|
|
extern UART_RX_FIFO_t TTL_1_rx;
|
|
extern UART_TX_FIFO_t TTL_1_tx;
|
|
|
|
//USART2
|
|
extern UART_RX_FIFO_t RS232_1_rx;
|
|
extern UART_TX_FIFO_t RS232_1_tx;
|
|
|
|
//USART1
|
|
extern UART_RX_FIFO_t RS232_2_rx;
|
|
extern UART_TX_FIFO_t RS232_2_tx;
|
|
|
|
//USART3
|
|
extern UART_RX_FIFO_t RS422_1_rx;
|
|
extern UART_TX_FIFO_t RS422_1_tx;
|
|
|
|
//USART5
|
|
extern UART_RX_FIFO_t RS485_1_rx;
|
|
extern UART_TX_FIFO_t RS485_1_tx;
|
|
|
|
|
|
//定义通讯的各种通用接口
|
|
|
|
#define debug_rx TTL_1_rx
|
|
#define debug_tx TTL_1_tx
|
|
|
|
#define pwr_rx RS485_1_rx
|
|
#define pwr_tx RS485_1_tx
|
|
|
|
#define hub_rx RS232_1_rx
|
|
#define hub_tx RS232_1_tx
|
|
|
|
#define ui_rx RS232_2_rx
|
|
#define ui_tx RS232_2_tx
|
|
|
|
|
|
//#define ui_rx TTL_1_rx
|
|
//#define ui_tx TTL_1_tx
|
|
|
|
|
|
void init_uart_fifos(void);
|
|
|
|
|
|
|
|
void UART_FIFO_init(int uart_id, uint32_t baudrate, uint8_t stopbit, uint8_t parity, uint8_t rx_dma_ch, uint8_t tx_dma_ch);
|
|
|
|
uint8_t UART_FIFO_read(int id, uint8_t *buff, uint8_t len);
|
|
|
|
void UART_FIFO_write(int id, const uint8_t *buff, uint8_t len);
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|
|
|