105 lines
2.6 KiB
C
105 lines
2.6 KiB
C
#ifndef CORE_INCLUDE_IVEC_MCAL_UART_H_
|
|
#define CORE_INCLUDE_IVEC_MCAL_UART_H_
|
|
|
|
#include "ti_msp_dl_config.h"
|
|
#include "../utils/utils.h"
|
|
#include <stdint.h>
|
|
#include "ivec_mcal_common.h"
|
|
|
|
|
|
typedef enum
|
|
{
|
|
eMcalUartBaudAuto = 0,
|
|
eMcalUartBaud2400 = 2400,
|
|
eMcalUartBaud4800 = 4800,
|
|
eMcalUartBaud9600 = 9600,
|
|
eMcalUartBaud14400 = 14400,
|
|
eMcalUartBaud19200 = 19200,
|
|
eMcalUartBaud28800 = 28800,
|
|
eMcalUartBaud33600 = 33600,
|
|
eMcalUartBaud38400 = 38400,
|
|
eMcalUartBaud57600 = 57600,
|
|
eMcalUartBaud115200 = 115200,
|
|
eMcalUartBaud230400 = 230400,
|
|
eMcalUartBaud460800 = 460800,
|
|
eMcalUartBaud921600 = 921600,
|
|
eMcalUartBaud1000000 = 1000000,
|
|
eMcalUartBaud1843200 = 1843200,
|
|
eMcalUartBaud2000000 = 2000000,
|
|
eMcalUartBaud2100000 = 2100000,
|
|
eMcalUartBaud3686400 = 3686400,
|
|
eMcalUartBaud4000000 = 4000000,
|
|
eMcalUartBaud4468750 = 4468750
|
|
} eMcalUartBaudRate;
|
|
|
|
typedef enum
|
|
{
|
|
eMcalUartDataBit7 = 7,
|
|
eMcalUartDataBit8 = 8
|
|
} eMcalUartDataBit;
|
|
|
|
typedef enum
|
|
{
|
|
eMcalUartStopBit1 = 1,
|
|
eMcalUartStopBit2 = 2
|
|
} eMcalUartStopBit;
|
|
|
|
typedef enum
|
|
{
|
|
eMcalUartParityNone,
|
|
eMcalUartParityOdd,
|
|
eMcalUartParityEven
|
|
} eMcalUartParityBit;
|
|
|
|
typedef enum
|
|
{
|
|
eMcalUartFcNone = 0,
|
|
eMcalUartFcHw
|
|
} eMcalUartFlowCtrl;
|
|
|
|
typedef struct
|
|
{
|
|
eMcalUartBaudRate eUartBaudrate;
|
|
eMcalUartDataBit eUartDataBit;
|
|
eMcalUartStopBit eUartStopBit;
|
|
eMcalUartParityBit eUartParityBit;
|
|
eMcalUartFlowCtrl eUartFlowCtrl;
|
|
} xMcalUartConfig;
|
|
|
|
typedef enum
|
|
{
|
|
eMcalUartPort1 = 0,
|
|
eMcalUartPort2,
|
|
eMcalUartPort3,
|
|
eMcalUartPortMax
|
|
} eMcalUartPortNumber;
|
|
|
|
#define IVEC_MCAL_GNSS_UART eMcalUartPort3
|
|
|
|
typedef enum
|
|
{
|
|
eIvecMcalUartEventRxArrived = 1, ///< Received new data
|
|
eIvecMcalUartEventRxOverflow = 2, ///< Rx FIFO overflowed
|
|
eIvecMcalUartEventTxComplete = 3 ///< All data had been sent
|
|
} eIvecMcalUartEvents;
|
|
|
|
typedef struct
|
|
{
|
|
eMcalUartPortNumber eUartPortNumber;
|
|
xMcalUartConfig xUartConfig;
|
|
char* pcBuffer;
|
|
uint16_t u16Length;
|
|
void (*pvUartRecvCallback)(eMcalUartPortNumber, eIvecMcalUartEvents, char*, uint32_t);
|
|
} xMcalUartHandle;
|
|
|
|
#define IVEC_MCAL_UART_MAX_PORT 3
|
|
|
|
/* Function Prototypes */
|
|
IVEC_McalCommonErr_e xMCAL_UartInit(xMcalUartHandle* pxUartHandle);
|
|
IVEC_McalCommonErr_e xMCAL_UartDeInit(xMcalUartHandle* pxUartHandle);
|
|
IVEC_McalCommonErr_e xMCAL_UartRead(xMcalUartHandle* pxUartHandle, uint8_t* pu8Data, uint32_t u32DataLength);
|
|
IVEC_McalCommonErr_e xMCAL_UartWrite(xMcalUartHandle* pxUartHandle, uint8_t* pu8Data, uint32_t u32DataLength);
|
|
IVEC_McalCommonErr_e _prvMCAL_UartPinInit(xMcalUartHandle* pxUartHandle);
|
|
|
|
#endif /* CORE_INCLUDE_IVEC_MCAL_UART_H_ */
|