32 #ifndef P33C_UART_DRIVER_INTERFACE_H 33 #define P33C_UART_DRIVER_INTERFACE_H 40 #include "p33c_mpuart.h" 43 #include "p33c_gpio.h" 50 enum UART_DATA_BITS_e {
54 typedef enum UART_DATA_BITS_e UART_DATA_BITS_t;
61 typedef enum UART_PARITY_e UART_PARITY_t;
63 enum UART_STOP_BITS_e {
68 typedef enum UART_STOP_BITS_e UART_STOP_BITS_t;
70 enum UART_FLOWCONRTOL_e {
71 UART_FLOWCONRTOL_NONE = 0,
72 UART_FLOWCONRTOL_HARDWARE = 1,
73 UART_FLOWCONRTOL_XON_XOFF = 2
75 typedef enum UART_FLOWCONRTOL_e UART_FLOWCONRTOL_t;
77 enum UART_BAUDRATE_e {
78 UART_BAUDRATE_75 = 75,
79 UART_BAUDRATE_150 = 150,
80 UART_BAUDRATE_300 = 300,
81 UART_BAUDRATE_600 = 600,
82 UART_BAUDRATE_1200 = 1200,
83 UART_BAUDRATE_2400 = 2400,
84 UART_BAUDRATE_4800 = 4800,
85 UART_BAUDRATE_7200 = 7200,
86 UART_BAUDRATE_9600 = 9600,
87 UART_BAUDRATE_14400 = 14400,
88 UART_BAUDRATE_19200 = 19200,
89 UART_BAUDRATE_38400 = 38400,
90 UART_BAUDRATE_56000 = 56000,
91 UART_BAUDRATE_57600 = 57600,
92 UART_BAUDRATE_115200 = 115200,
93 UART_BAUDRATE_128000 = 128000
95 typedef enum UART_BAUDRATE_e UART_BAUDRATE_t;
143 } __attribute__((packed)) bits;
177 extern volatile uint16_t p33c_UartPort_Initialize(
volatile struct UART_INTERFACE_s* port);
180 extern volatile uint16_t p33c_UartPort_OpenPort(
181 volatile uint16_t port_no,
volatile enum UART_BAUDRATE_e baud,
182 volatile enum UART_DATA_BITS_e data_bits,
volatile enum UART_PARITY_e parity,
183 volatile enum UART_STOP_BITS_e stop_bits,
volatile enum UART_FLOWCONRTOL_e flow_control);
185 extern volatile uint16_t p33c_UartPort_Open(
volatile uint16_t port_no);
186 extern volatile uint16_t p33c_UartPort_Close(
volatile uint16_t port_no);
188 extern volatile uint16_t p33c_UartPort_SetBaudrate(
189 volatile uint16_t port_no,
190 volatile uint32_t baud
192 extern volatile uint32_t p33c_UartPort_GetBaudrate(
volatile uint16_t port_no);
194 extern volatile char p33c_UartPort_ReadByte(
volatile uint16_t port_no);
195 extern volatile uint16_t p33c_UartPort_WriteByte(
volatile uint16_t port_no,
volatile char byte);
196 extern volatile uint16_t p33c_UartPort_ClearDMAFlags(
volatile struct UART_INTERFACE_s* port);
201 extern volatile uint16_t p33c_UartPort_SendBufferDma(
203 volatile uint16_t length
206 extern volatile uint16_t p33c_UartPort_RecieveBufferDma(
208 volatile uint16_t length
volatile struct UART_INSTANCE_STATUS_s status
Status word of the UART object.
volatile struct UART_DATA_BUFFER_s tx_buffer
volatile bool msg_complete
volatile uint16_t pointer
volatile bool buffer_overun
volatile struct UART_DATA_BUFFER_s rx_buffer
volatile uint16_t uart
UART instance of interface.
volatile bool buffer_empty
volatile struct UART_INTERFACE_CHANNEL_s TxD
UART Receive Channel Configuration.
volatile uint16_t dma
DMA instance of interface.
volatile struct UART_DATBUF_STATUS_s status
volatile uint8_t * buffer
volatile uint16_t package_size
volatile struct GPIO_PORT_PIN_s io
GPIO configuration.
volatile uint16_t data_size
volatile struct UART_INTERFACE_CHANNEL_s RxD
UART Receive Channel Configuration.
volatile bool buffer_full