source: rtems/c/src/libchip/serial/ns16550_p.h @ 064b9be

4.104.114.84.95
Last change on this file since 064b9be was 27045a82, checked in by Joel Sherrill <joel.sherrill@…>, on 07/09/98 at 18:38:18

Changed static to NS16550_STATIC to make all routines and data global
to ease debugging.

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