107 lines
3.0 KiB
C
107 lines
3.0 KiB
C
#ifndef CORE_INCLUDE_IVEC_MCAL_UART_H_
|
|
#define CORE_INCLUDE_IVEC_MCAL_UART_H_
|
|
//#include "ivec_mcal_uart.h"
|
|
|
|
#include "ti_msp_dl_config.h"
|
|
#include "../utils/utils.h"
|
|
#include <stdint.h>
|
|
//#ifndef IVEC_MCAL_UART_H
|
|
//#define IVEC_MCAL_UART_H
|
|
#include "ivec_mcal_common.h"
|
|
//#include "ql_uart.h"
|
|
|
|
|
|
typedef enum
|
|
{
|
|
mcalUART_BAUD_AUTO = 0,
|
|
mcalUART_BAUD_2400 = 2400,
|
|
mcalUART_BAUD_4800 = 4800,
|
|
mcalUART_BAUD_9600 = 9600,
|
|
mcalUART_BAUD_14400 = 14400,
|
|
mcalUART_BAUD_19200 = 19200,
|
|
mcalUART_BAUD_28800 = 28800,
|
|
mcalUART_BAUD_33600 = 33600,
|
|
mcalUART_BAUD_38400 = 38400,
|
|
mcalUART_BAUD_57600 = 57600,
|
|
mcalUART_BAUD_115200 = 115200,
|
|
mcalUART_BAUD_230400 = 230400,
|
|
mcalUART_BAUD_460800 = 460800,
|
|
mcalUART_BAUD_921600 = 921600,
|
|
mcalUART_BAUD_1000000 = 1000000,
|
|
mcalUART_BAUD_1843200 = 1843200,
|
|
mcalUART_BAUD_2000000 = 2000000, //only support uart2/3
|
|
mcalUART_BAUD_2100000 = 2100000,
|
|
mcalUART_BAUD_3686400 = 3686400, //only support uart2/3
|
|
mcalUART_BAUD_4000000 = 4000000, //only support uart2/3
|
|
mcalUART_BAUD_4468750 = 4468750 //only support uart2/3
|
|
}McalUartBaudRate_e;
|
|
|
|
typedef enum
|
|
{
|
|
mcalUART_DATABIT_7 = 7,
|
|
mcalUART_DATABIT_8 = 8, //8910 ARM UART hardware only support 8bit Data
|
|
}McalUartDataBit_e;
|
|
|
|
typedef enum
|
|
{
|
|
mcalUART_STOP_1 = 1,
|
|
mcalUART_STOP_2 = 2,
|
|
}McalUartStopBit_e;
|
|
|
|
typedef enum
|
|
{
|
|
mcalUART_PARITY_NONE,
|
|
mcalUART_PARITY_ODD,
|
|
mcalUART_PARITY_EVEN,
|
|
}McalUartParityBit_e;
|
|
|
|
typedef enum
|
|
{
|
|
mcalUART_FC_NONE = 0,
|
|
mcalUARTFC_HW,
|
|
}McalUartFlowCtrl_e;
|
|
|
|
typedef struct
|
|
{
|
|
McalUartBaudRate_e eUartBaudrate;
|
|
McalUartDataBit_e eUartDataBit;
|
|
McalUartStopBit_e eUartStopBit;
|
|
McalUartParityBit_e eUartParityBit;
|
|
McalUartFlowCtrl_e eUartFlowCtrl;
|
|
}McalUartConfig_s;
|
|
|
|
typedef enum
|
|
{
|
|
mcalUART_PORT1 = 0,
|
|
mcalUART_PORT2,
|
|
mcalUART_PORT3,
|
|
mcalUART_PORT_MAX
|
|
}McalUartPortNumber_e;
|
|
#define IVEC_MCAL_GNSS_UART mcalUART_PORT3
|
|
typedef enum
|
|
{
|
|
IVEC_MCAL_UART_EVENT_RX_ARRIVED = 1,//(1 << 0), ///< Received new data
|
|
IVEC_MCAL_UART_EVENT_RX_OVERFLOW =2 ,//(1 << 1), ///< Rx fifo overflowed
|
|
IVEC_MCAL_UART_EVENT_TX_COMPLETE = 3//(1 << 2) ///< All data had been sent
|
|
}IVEC_McalUartEvents_e;
|
|
|
|
typedef struct
|
|
{
|
|
McalUartPortNumber_e eUartPortNumber;
|
|
McalUartConfig_s xUartConfig;
|
|
char* buffer;
|
|
uint16_t u16len;
|
|
void (*pvUartRecvCallback)(McalUartPortNumber_e, IVEC_McalUartEvents_e , char *,uint32_t);
|
|
}McalUartHandle_s;
|
|
|
|
#define IVEC_MCAL_UART_MAX_PORT 3
|
|
|
|
IVEC_McalCommonErr_e xMCAL_UartDeInit(McalUartHandle_s* pxHandleUart);
|
|
IVEC_McalCommonErr_e xMCAL_UartRead(McalUartHandle_s* pxHandleUart, unsigned char* pucData, unsigned int u32DataLength);
|
|
IVEC_McalCommonErr_e xMCAL_UartWrite(McalUartHandle_s* pxHandleUart, unsigned char* pucData, unsigned int u32DataLength);
|
|
IVEC_McalCommonErr_e __prvMCAL_UartPinInit(McalUartHandle_s* pxHandleUart);
|
|
IVEC_McalCommonErr_e xMCAL_UartInit(McalUartHandle_s* pxHandleUart);
|
|
|
|
|
|
#endif /* IVEC_MCAL_UART_H */
|