source:
rtems/c/src/lib/libbsp/powerpc/ppcn_60x/console/ns16550_p.h
@
0c04c377
Last change on this file since 0c04c377 was 0c04c377, checked in by Joel Sherrill <joel.sherrill@…>, on 02/18/99 at 16:48:14 | |
---|---|
|
|
File size: 4.2 KB |
Line | |
---|---|
1 | /* |
2 | * COPYRIGHT (c) 1998 by Radstone Technology |
3 | * |
4 | * |
5 | * THIS FILE IS PROVIDED TO YOU, THE USER, "AS IS", WITHOUT WARRANTY OF ANY |
6 | * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE |
7 | * IMPLIED WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK |
8 | * AS TO THE QUALITY AND PERFORMANCE OF ALL CODE IN THIS FILE IS WITH YOU. |
9 | * |
10 | * You are hereby granted permission to use, copy, modify, and distribute |
11 | * this file, provided that this notice, plus the above copyright notice |
12 | * and disclaimer, appears in all copies. Radstone Technology will provide |
13 | * no support for this code. |
14 | * |
15 | */ |
16 | |
17 | #ifndef _NS16550_P_H_ |
18 | #define _NS16550_P_H_ |
19 | |
20 | #ifdef __cplusplus |
21 | extern "C" { |
22 | #endif |
23 | /* |
24 | * Define serial port read registers structure. |
25 | */ |
26 | |
27 | typedef volatile struct _SP_READ_REGISTERS { |
28 | unsigned char ReceiveBuffer; |
29 | unsigned char InterruptEnable; |
30 | unsigned char InterruptId; |
31 | unsigned char LineControl; |
32 | unsigned char ModemControl; |
33 | unsigned char LineStatus; |
34 | unsigned char ModemStatus; |
35 | unsigned char ScratchPad; |
36 | } SP_READ_REGISTERS, *PSP_READ_REGISTERS; |
37 | |
38 | /* |
39 | * Define serial port write registers structure. |
40 | */ |
41 | |
42 | typedef volatile struct _SP_WRITE_REGISTERS { |
43 | unsigned char TransmitBuffer; |
44 | unsigned char InterruptEnable; |
45 | unsigned char FifoControl; |
46 | unsigned char LineControl; |
47 | unsigned char ModemControl; |
48 | unsigned char Reserved1; |
49 | unsigned char ModemStatus; |
50 | unsigned char ScratchPad; |
51 | } SP_WRITE_REGISTERS, *PSP_WRITE_REGISTERS; |
52 | |
53 | /* |
54 | * Define serial port interrupt enable register structure. |
55 | */ |
56 | |
57 | #define SP_INT_RX_ENABLE 0x01 |
58 | #define SP_INT_TX_ENABLE 0x02 |
59 | #define SP_INT_LS_ENABLE 0x04 |
60 | #define SP_INT_MS_ENABLE 0x08 |
61 | |
62 | /* |
63 | * Define serial port interrupt id register structure. |
64 | */ |
65 | |
66 | typedef struct _SP_INTERRUPT_ID { |
67 | unsigned char InterruptPending : 1; |
68 | unsigned char Identification : 3; |
69 | unsigned char Reserved1 : 2; |
70 | unsigned char FifoEnabled : 2; |
71 | } SP_INTERRUPT_ID, *PSP_INTERRUPT_ID; |
72 | |
73 | /* |
74 | * Define serial port fifo control register structure. |
75 | */ |
76 | #define SP_FIFO_ENABLE 0x01 |
77 | #define SP_FIFO_RXRST 0x02 |
78 | #define SP_FIFO_TXRST 0x04 |
79 | #define SP_FIFO_DMA 0x08 |
80 | #define SP_FIFO_RXLEVEL 0xc0 |
81 | |
82 | /* |
83 | * Define serial port line control register structure. |
84 | */ |
85 | #define SP_LINE_SIZE 0x03 |
86 | #define SP_LINE_STOP 0x04 |
87 | #define SP_LINE_PAR 0x08 |
88 | #define SP_LINE_ODD 0x10 |
89 | #define SP_LINE_STICK 0x20 |
90 | #define SP_LINE_BREAK 0x40 |
91 | #define SP_LINE_DLAB 0x80 |
92 | |
93 | /* |
94 | * Line status register character size definitions. |
95 | */ |
96 | #define FIVE_BITS 0x0 /* five bits per character */ |
97 | #define SIX_BITS 0x1 /* six bits per character */ |
98 | #define SEVEN_BITS 0x2 /* seven bits per character */ |
99 | #define EIGHT_BITS 0x3 /* eight bits per character */ |
100 | |
101 | /* |
102 | * Line speed divisor definition. |
103 | */ |
104 | #define NS16550_Baud(baud_rate) (115200/baud_rate) |
105 | |
106 | /* |
107 | * Define serial port modem control register structure. |
108 | */ |
109 | #define SP_MODEM_DTR 0x01 |
110 | #define SP_MODEM_RTS 0x02 |
111 | #define SP_MODEM_IRQ 0x08 |
112 | #define SP_MODEM_LOOP 0x10 |
113 | #define SP_MODEM_DIV4 0x80 |
114 | |
115 | /* |
116 | * Define serial port line status register structure. |
117 | */ |
118 | #define SP_LSR_RDY 0x01 |
119 | #define SP_LSR_EOVRUN 0x02 |
120 | #define SP_LSR_EPAR 0x04 |
121 | #define SP_LSR_EFRAME 0x08 |
122 | #define SP_LSR_BREAK 0x10 |
123 | #define SP_LSR_THOLD 0x20 |
124 | #define SP_LSR_TX 0x40 |
125 | #define SP_LSR_EFIFO 0x80 |
126 | |
127 | typedef struct _ns16550_context |
128 | { |
129 | unsigned8 ucModemCtrl; |
130 | } ns16550_context; |
131 | |
132 | /* |
133 | * Driver functions |
134 | */ |
135 | static boolean ns16550_probe(int minor); |
136 | |
137 | static void ns16550_init(int minor); |
138 | |
139 | static int ns16550_open( |
140 | int major, |
141 | int minor, |
142 | void * arg |
143 | ); |
144 | |
145 | static int ns16550_close( |
146 | int major, |
147 | int minor, |
148 | void * arg |
149 | ); |
150 | |
151 | static void ns16550_write_polled( |
152 | int minor, |
153 | char cChar |
154 | ); |
155 | |
156 | static void ns16550_assert_RTS( |
157 | int minor |
158 | ); |
159 | |
160 | static void ns16550_negate_RTS( |
161 | int minor |
162 | ); |
163 | |
164 | static void ns16550_assert_DTR( |
165 | int minor |
166 | ); |
167 | |
168 | static void ns16550_negate_DTR( |
169 | int minor |
170 | ); |
171 | |
172 | static void ns16550_initialize_interrupts(int minor); |
173 | |
174 | static int ns16550_flush(int major, int minor, void *arg); |
175 | |
176 | static int ns16550_write_support_int( |
177 | int minor, |
178 | const char *buf, |
179 | int len |
180 | ); |
181 | |
182 | static int ns16550_write_support_polled( |
183 | int minor, |
184 | const char *buf, |
185 | int len |
186 | ); |
187 | |
188 | static int ns16550_inbyte_nonblocking_polled( |
189 | int minor |
190 | ); |
191 | |
192 | #ifdef __cplusplus |
193 | } |
194 | #endif |
195 | |
196 | #endif /* _NS16550_P_H_ */ |
Note: See TracBrowser
for help on using the repository browser.