RTEMS  5.1
uart.h
Go to the documentation of this file.
1 
7 /*
8  * This software is Copyright (C) 1998 by T.sqware - all rights limited
9  * It is provided in to the public domain "as is", can be freely modified
10  * as far as this copyight notice is kept unchanged, but does not imply
11  * an endorsement by T.sqware of the product in which it is included.
12  */
13 
21 #ifndef _BSPUART_H
22 #define _BSPUART_H
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 void BSP_uart_init(int uart, unsigned long baud, unsigned long databits, unsigned long parity, unsigned long stopbits, int hwFlow);
29 void BSP_uart_set_attributes(int uart, unsigned long baud, unsigned long databits, unsigned long parity, unsigned long stopbits);
30 void BSP_uart_set_baud(int uart, unsigned long baud);
31 void BSP_uart_intr_ctrl(int uart, int cmd);
32 void BSP_uart_throttle(int uart);
33 void BSP_uart_unthrottle(int uart);
34 int BSP_uart_polled_status(int uart);
35 void BSP_uart_polled_write(int uart, int val);
36 int BSP_uart_polled_read(int uart);
37 void BSP_uart_termios_set(int uart, void *ttyp);
38 int BSP_uart_termios_read_com1(int uart);
39 int BSP_uart_termios_read_com2(int uart);
40 ssize_t BSP_uart_termios_write_com1(int minor, const char *buf, size_t len);
41 ssize_t BSP_uart_termios_write_com2(int minor, const char *buf, size_t len);
42 void BSP_uart_termios_isr_com1(void *);
43 void BSP_uart_termios_isr_com2(void *);
44 void BSP_uart_dbgisr_com1(void);
45 void BSP_uart_dbgisr_com2(void);
46 extern int BSP_poll_char_via_serial(void);
47 extern void BSP_output_char_via_serial(char val);
48 extern int BSPConsolePort;
49 extern int BSPBaseBaud;
50 
56 #define BSP_UART_INTR_CTRL_DISABLE (0)
57 #define BSP_UART_INTR_CTRL_GDB (0xaa)
58 #define BSP_UART_INTR_CTRL_ENABLE (0xbb)
59 #define BSP_UART_INTR_CTRL_TERMIOS (0xcc)
60 
61 
62 #define BSP_UART_STATUS_ERROR (-1)
63 #define BSP_UART_STATUS_NOCHAR (0)
64 #define BSP_UART_STATUS_CHAR (1)
65 #define BSP_UART_STATUS_BREAK (2)
66 
67 
68 #define BSP_UART_COM1 (0)
69 #define BSP_UART_COM2 (1)
70 
75 #define COM1_BASE_IO 0x3F8
76 #define COM2_BASE_IO 0x2F8
77 
83 #define RBR (0)
84 #define THR (0)
85 #define IER (1)
86 
87 
88 #define IIR (2)
89 #define FCR (2)
90 #define LCR (3)
91 #define MCR (4)
92 #define LSR (5)
93 #define MSR (6)
94 #define SCR (7)
95 
96 
97 #define DLL (0)
98 #define DLM (1)
99 #define AFR (2)
100 
101 
104 #define MODEM_STATUS 0
105 #define NO_MORE_INTR 1
106 #define TRANSMITTER_HODING_REGISTER_EMPTY 2
107 #define RECEIVER_DATA_AVAIL 4
108 #define RECEIVER_ERROR 6
109 #define CHARACTER_TIMEOUT_INDICATION 12
110 
114 #define RECEIVE_ENABLE 0x1
115 #define TRANSMIT_ENABLE 0x2
116 #define RECEIVER_LINE_ST_ENABLE 0x4
117 #define MODEM_ENABLE 0x8
118 #define INTERRUPT_DISABLE 0x0
119 
123 #define DR 0x01
124 #define OE 0x02
125 #define PE 0x04
126 #define FE 0x08
127 #define BI 0x10
128 #define THRE 0x20
129 #define TEMT 0x40
130 #define ERFIFO 0x80
131 
132 
135 #define DTR 0x01
136 #define RTS 0x02
137 #define OUT_1 0x04
138 #define OUT_2 0x08
139 #define LB 0x10
140 
141 
144 #define CHR_5_BITS 0
145 #define CHR_6_BITS 1
146 #define CHR_7_BITS 2
147 #define CHR_8_BITS 3
148 
149 #define WL 0x03
150 #define STB 0x04
151 #define PEN 0x08
152 #define EPS 0x10
153 #define SP 0x20
154 #define BCB 0x40
155 #define DLAB 0x80
156 
157 
160 #define DCTS 0x01
161 #define DDSR 0x02
162 #define TERI 0x04
163 #define DDCD 0x08
164 #define CTS 0x10
165 #define DSR 0x20
166 #define RI 0x40
167 #define DCD 0x80
168 
169 
173 #define FIFO_CTRL 0x01
174 #define FIFO_EN 0x01
175 #define XMIT_RESET 0x02
176 #define RCV_RESET 0x04
177 #define FCR3 0x08
178 
179 #define RECEIVE_FIFO_TRIGGER1 0x0
180 #define RECEIVE_FIFO_TRIGGER4 0x40
181 #define RECEIVE_FIFO_TRIGGER8 0x80
182 #define RECEIVE_FIFO_TRIGGER12 0xc0
183 #define TRIG_LEVEL 0xc0
184 
185 
187 #ifdef __cplusplus
188 }
189 #endif
190 
191 #endif /* _BSPUART_H */