Skip to content
Snippets Groups Projects
Select Git revision
  • 075d597464be619475535930de2f36abe69176f8
  • wip-bootstrap default
  • dualcore
  • ch3/leds
  • ch3/time
  • master
6 results

uart.h

Blame
  • uart.h 2.19 KiB
    #ifndef _INCLUDED_UART_H_
    #define _INCLUDED_UART_H_
    
    #define UART0 (0)
    #define UART1 (1)
    
    typedef enum {
        UART_FIVE_BITS = 0x0,
        UART_SIX_BITS = 0x1,
        UART_SEVEN_BITS = 0x2,
        UART_EIGHT_BITS = 0x3
    } UartBitsNum4Char;
    
    typedef enum {
        UART_ONE_STOP_BIT             = 0,
        UART_ONE_HALF_STOP_BIT        = BIT2,
        UART_TWO_STOP_BIT             = BIT2
    } UartStopBitsNum;
    
    typedef enum {
        UART_NONE_BITS = 0,
        UART_ODD_BITS   = 0,
        UART_EVEN_BITS = BIT4
    } UartParityMode;
    
    typedef enum {
        UART_STICK_PARITY_DIS   = 0,
        UART_STICK_PARITY_EN    = BIT3 | BIT5
    } UartExistParity;
    
    typedef enum {
        UART_BIT_RATE_9600     = 9600,
        UART_BIT_RATE_19200   = 19200,
        UART_BIT_RATE_38400   = 38400,
        UART_BIT_RATE_57600   = 57600,
        UART_BIT_RATE_74880   = 74880,
        UART_BIT_RATE_115200 = 115200,
        UART_BIT_RATE_230400 = 230400,
        UART_BIT_RATE_256000 = 256000,
        UART_BIT_RATE_460800 = 460800,
        UART_BIT_RATE_921600 = 921600
    } UartBautRate;
    
    typedef enum {
        UART_NONE_CTRL,
        UART_HARDWARE_CTRL,
        UART_XON_XOFF_CTRL
    } UartFlowCtrl;
    
    typedef enum {
        UART_EMPTY,
        UART_UNDER_WRITE,
        UART_WRITE_OVER
    } RcvMsgBuffState;
    
    typedef struct {
        uint32     RcvBuffSize;
        uint8     *pRcvMsgBuff;
        uint8     *pWritePos;
        uint8     *pReadPos;
        uint8      TrigLvl; //JLU: may need to pad
        RcvMsgBuffState  BuffState;
    } RcvMsgBuff;
    
    typedef struct {
        uint32   TrxBuffSize;
        uint8   *pTrxBuff;
    } TrxMsgBuff;
    
    typedef enum {