NetBurner 3.1
serinternal.h
1 /*NB_REVISION*/
2 
3 /*NB_COPYRIGHT*/
4 
5 #ifndef _NB_SER_INTERNAL
6 #define _NB_SER_INTERNAL
7 #include <buffers.h>
8 
12 #define UART_INIT (0x0001) /* UART is initialized */
13 
14 #define UART_TX_EMPTY (0x0002) /* UART Tx buffer is empty */
15 
16 #define UART_SENT_STOP (0x0004) /* UART has sent XOFF */
17 
18 #define UART_RX_STOP (0x0008) /* UART has received XOFF */
19 
20 #define UART_FLOW_TX \
21  (0x0010) /* UART must respond to received \
22  flow control */
23 
24 #define UART_FLOW_RX \
25  (0x0020) /* UART is allowed to send flow \
26  control */
27 
28 #define UART_FLOW_NEED_TOSTOP (0x0040) /* UART needs to send XOFF */
29 
30 #define UART_FLOW_NEED_TOSTART (0x0080) /* UART needs to send XON */
31 
32 #define UART_RS485_TX_MODE \
33  (0x0100) /* UART is in RS-485 HD/FD mode \
34  (not used) */
35 
36 #define UART_MULTI_MODE (0x0200) /* UART is in multi-drop mode */
37 
38 #define UART_FLOW_TXRTSCTS \
39  (0x0400) /* UART has TxCTS hardware flow \
40  control enabled */
41 
42 #define UART_FLOW_TX485FD \
43  (0x0800) /* UART is in RS-485 full-duplex \
44  mode */
45 
46 #define UART_FLOW_TX485HD \
47  (0x1000) /* UART is in RS-485 half-duplex \
48  mode */
49 
50 #define UART_FLOW_RXRTSCTS \
51  (0x2000) /* UART has RxRTS hardware flow \
52  control enabled */
53 
54 #define UART_RS422_MODE (0x4000) /* UART is in RS-422 mode */
55 
56 #define UART_TX_LAST_BIT \
57  (0x8000) /* UART has transmitted the last \
58  stop bit of the last byte */
59 
63 #define XON (0x11)
64 #define XOFF (0x13)
65 
71 #define UART_XOFF_LIMIT (100)
72 #define UART_XON_LIMIT (200)
73 
74 typedef int(GetNextCharFunc)(int uartnum);
75 typedef void(PutNextCharFunc)(int uartnum, uint8_t c);
76 
77 int BaseGetChar(int num);
78 void BasePutChar(int num, uint8_t c);
79 
80 struct UartDataRec
81 {
82  fifo_buffer_storage m_FifoRead;
83  fifo_buffer_storage m_FifoWrite;
84  GetNextCharFunc *m_pGetCharFunc;
85  PutNextCharFunc *m_pPutCharFunc;
86  int m_UartState;
87  uint8_t m_Errors;
88 };
89 
90 extern UartDataRec UartData[];
91 
92 void WakeTx(int x);
93 
94 #endif /* _NB_SER_INTERNAL */
NetBurner Buffers API.