12345678910111213141516171819202122232425262728293031323334353637 |
- #ifndef __HW_UART_H__
- #define __HW_UART_H__
- #define HW_DMA_UART_NUMBER 2
- typedef struct
- {
- int speed; //速度
- int databits; //数据位
- int stopbits; //停止位
- int parity; //奇偶校验位,0表示无,1表示奇,2表示偶
- } hw_uart_config;
- #define UART_CTRL_RECONFIG 0x0A //设置串口速度
- #define UART_CTRL_SET_SPEED 0x01 //设置串口速度
- #define UART_CTRL_SET_RDFIN_TIME 0x02 //设置串口接收完成判断时间
- #define UART_CTRL_SET_WRFIN_TIME 0x03 //设置串口发送完成判断时间
- #define UART_CTRL_GET_SPEED 0x81 //获取当前速度
- #define UART_CTRL_GET_RDFIN_TIME 0x82 //获取当前串口接收完成时间
- #define UART_CTRL_GET_WRFIN_TIME 0x83 //获取当前串口写入完成时间
- #define UART_CTRL_GET_RDFIN 0x84 //串口接收是否完成,如果完成会返回接收长度
- #define UART_CTRL_GET_WRFIN 0x85 //串口发送是否完成
- #define hw_dma_uart_read(a,b,c) hw_dma_uart_begin_read(a,b,c)
- #define hw_dma_uart_write(a,b,c) hw_dma_uart_begin_write(a,b,c)
- void hw_dma_uart_init(int clk);
- int hw_dma_uart_control(unsigned char uart_index, char cmd, void *value);
- int hw_dma_uart_begin_write(unsigned char uart_index, const char *buffer, int size);
- int hw_dma_uart_write_finish(unsigned char uart_index);
- int hw_dma_uart_begin_read(unsigned char uart_index,unsigned char *buffer, int size);
- int hw_dma_uart_read_finish(unsigned char uart_index);
- #endif
|