MAX_CARLINK_A270S/MXC_A27-PCB4.5-270S/ArkmicroFiles/libcpu-amt630hv100/include/uart.h

45 lines
859 B
C
Raw Permalink Normal View History

2025-01-21 16:49:37 +08:00
#ifndef _UART_H
#define _UART_H
#ifdef __cplusplus
extern "C" {
#endif
#include "FreeRTOS.h"
#include "semphr.h"
#include "circ_buf.h"
typedef enum {
UART_ID0 = 0,
UART_ID1,
UART_ID2,
UART_ID3,
UART_NUM,
} eUartID;
typedef struct {
uint32_t id;
uint32_t regbase;
int fifosize;
struct circ_buf rxbuf;
struct circ_buf txbuf;
SemaphoreHandle_t xMutex;
SemaphoreHandle_t xRev;
SemaphoreHandle_t xSend;
}UartPort_t;
extern void vDebugConsoleInitialise(void);
extern UartPort_t *xUartOpen(uint32_t id);
extern void vUartInit(UartPort_t *uap, uint32_t baud, uint32_t flags);
extern void vUartClose(UartPort_t *uap);
extern int iUartWrite(UartPort_t *uap, uint8_t *buf, size_t len, TickType_t xBlockTime);
int iUartRead(UartPort_t *uap, uint8_t *buf, size_t len, TickType_t xBlockTime);
int uart_rx_demo(void);
#ifdef __cplusplus
}
#endif
#endif