source: rtems/c/src/libchip/serial/ns16550_p.h @ 0f4ad570

4.104.115
Last change on this file since 0f4ad570 was 0f4ad570, checked in by Joel Sherrill <joel.sherrill@…>, on 12/18/08 at 21:10:04

2008-12-18 Joel Sherrill <joel.sherrill@…>

  • libchip/serial/ns16550_p.h: Remove prototype with no implementation.
  • Property mode set to 100644
File size: 5.1 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 *  $Id$
16 */
17
18#ifndef _NS16550_P_H_
19#define _NS16550_P_H_
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25/*
26 *  Define NS16550_STATIC to nothing while debugging so the entry points
27 *  will show up in the symbol table.
28 */
29
30#define NS16550_STATIC static
31
32/*
33 * Define serial port read registers structure.
34 */
35
36typedef volatile struct _SP_READ_REGISTERS {
37    unsigned char ReceiveBuffer;
38    unsigned char InterruptEnable;
39    unsigned char InterruptId;
40    unsigned char LineControl;
41    unsigned char ModemControl;
42    unsigned char LineStatus;
43    unsigned char ModemStatus;
44    unsigned char ScratchPad;
45} SP_READ_REGISTERS, *PSP_READ_REGISTERS;
46
47#define NS16550_RECEIVE_BUFFER   0
48#define NS16550_INTERRUPT_ENABLE 1
49#define NS16550_INTERRUPT_ID     2
50#define NS16550_LINE_CONTROL     3
51#define NS16550_MODEM_CONTROL    4
52#define NS16550_LINE_STATUS      5
53#define NS16550_MODEM_STATUS     6
54#define NS16550_SCRATCH_PAD      7
55
56/*
57 * Define serial port write registers structure.
58 */
59
60typedef volatile struct _SP_WRITE_REGISTERS {
61    unsigned char TransmitBuffer;
62    unsigned char InterruptEnable;
63    unsigned char FifoControl;
64    unsigned char LineControl;
65    unsigned char ModemControl;
66    unsigned char Reserved1;
67    unsigned char ModemStatus;
68    unsigned char ScratchPad;
69} SP_WRITE_REGISTERS, *PSP_WRITE_REGISTERS;
70
71#define NS16550_TRANSMIT_BUFFER  0
72#define NS16550_FIFO_CONTROL     2
73
74/*
75 * Define serial port interrupt enable register structure.
76 */
77
78#define SP_INT_RX_ENABLE  0x01
79#define SP_INT_TX_ENABLE  0x02
80#define SP_INT_LS_ENABLE  0x04
81#define SP_INT_MS_ENABLE  0x08
82
83#define NS16550_ENABLE_ALL_INTR           (SP_INT_RX_ENABLE | SP_INT_TX_ENABLE)
84#define NS16550_DISABLE_ALL_INTR          0x00
85#define NS16550_ENABLE_ALL_INTR_EXCEPT_TX (SP_INT_RX_ENABLE)
86
87/*
88 * Define serial port interrupt id register structure.
89 */
90
91typedef struct _SP_INTERRUPT_ID {
92    unsigned char InterruptPending : 1;
93    unsigned char Identification : 3;
94    unsigned char Reserved1 : 2;
95    unsigned char FifoEnabled : 2;
96} SP_INTERRUPT_ID, *PSP_INTERRUPT_ID;
97
98/*
99 * Define serial port fifo control register structure.
100 */
101
102#define SP_FIFO_ENABLE  0x01
103#define SP_FIFO_RXRST 0x02
104#define SP_FIFO_TXRST 0x04
105#define SP_FIFO_DMA   0x08
106#define SP_FIFO_RXLEVEL 0xc0
107
108/*
109 * Define serial port line control register structure.
110 */
111
112#define SP_LINE_SIZE  0x03
113#define SP_LINE_STOP  0x04
114#define SP_LINE_PAR   0x08
115#define SP_LINE_ODD   0x10
116#define SP_LINE_STICK 0x20
117#define SP_LINE_BREAK 0x40
118#define SP_LINE_DLAB  0x80
119
120/*
121 * Line status register character size definitions.
122 */
123
124#define FIVE_BITS 0x0                   /* five bits per character */
125#define SIX_BITS 0x1                    /* six bits per character */
126#define SEVEN_BITS 0x2                  /* seven bits per character */
127#define EIGHT_BITS 0x3                  /* eight bits per character */
128
129/*
130 * Line speed divisor definition.
131 */
132
133#define NS16550_Baud(_clock, _baud_rate) \
134  ((((_clock) == 0) ? 115200 : (_clock))/(_baud_rate*16))
135
136/*
137 * Define serial port modem control register structure.
138 */
139
140#define SP_MODEM_DTR  0x01
141#define SP_MODEM_RTS  0x02
142#define SP_MODEM_IRQ  0x08
143#define SP_MODEM_LOOP 0x10
144#define SP_MODEM_DIV4 0x80
145
146/*
147 * Define serial port line status register structure.
148 */
149
150#define SP_LSR_RDY    0x01
151#define SP_LSR_EOVRUN 0x02
152#define SP_LSR_EPAR   0x04
153#define SP_LSR_EFRAME 0x08
154#define SP_LSR_BREAK  0x10
155#define SP_LSR_THOLD  0x20
156#define SP_LSR_TX   0x40
157#define SP_LSR_EFIFO  0x80
158
159typedef struct _ns16550_context
160{
161        uint8_t         ucModemCtrl;
162} ns16550_context;
163
164/*
165 * Driver functions
166 */
167
168NS16550_STATIC void ns16550_init(int minor);
169
170NS16550_STATIC int ns16550_open(
171  int major,
172  int minor,
173  void  * arg
174);
175
176NS16550_STATIC int ns16550_close(
177  int major,
178  int minor,
179  void  * arg
180);
181
182NS16550_STATIC void ns16550_write_polled(
183  int   minor,
184  char  cChar
185);
186
187NS16550_STATIC int ns16550_assert_RTS(
188  int minor
189);
190
191NS16550_STATIC int ns16550_negate_RTS(
192  int minor
193);
194
195NS16550_STATIC int ns16550_assert_DTR(
196  int minor
197);
198
199NS16550_STATIC int ns16550_negate_DTR(
200  int minor
201);
202
203NS16550_STATIC void ns16550_initialize_interrupts(int minor);
204
205NS16550_STATIC int ns16550_write_support_int(
206  int   minor,
207  const char *buf,
208  int   len
209);
210
211NS16550_STATIC int ns16550_write_support_polled(
212  int   minor,
213  const char *buf,
214  int   len
215  );
216
217NS16550_STATIC int ns16550_inbyte_nonblocking_polled(
218  int minor
219);
220
221NS16550_STATIC void ns16550_enable_interrupts(
222  int minor,
223  int mask
224);
225
226NS16550_STATIC int ns16550_set_attributes(
227  int                   minor,
228  const struct termios *t
229);
230
231#ifdef __cplusplus
232}
233#endif
234
235#endif /* _NS16550_P_H_ */
Note: See TracBrowser for help on using the repository browser.