|
|
1.1 root 1: /*
2: * UART.h
3: *
4: * Definitions for the NS8250 & compatible UARTs
5: *
6: * copyright 1990 by Insignia Solutions Ltd. Used by permission.
7: *
8: * revision history:
9: * 24-Dec-1992 John Morgan: written based on UART.h written by Paul Huckle
10: *
11: */
12:
13: #ifndef _UART_H
14: #define _UART_H
15:
16: /*
17: * ============================================================================
18: * Structure/Data definitions
19: * ============================================================================
20: */
21:
22: /* register type definitions follow: */
23: #ifndef WORD_BIT_FIELD
24: #define WORD_BIT_FIELD WORD
25: #endif
26:
27: #ifndef BYTE_BIT_FIELD
28: #define BYTE_BIT_FIELD BYTE
29: #endif
30:
31: typedef BYTE BUFFER_REG;
32:
33: typedef union {
34: WORD all;
35: struct {
36: WORD_BIT_FIELD LSB:8;
37: WORD_BIT_FIELD MSB:8;
38: } byte;
39: } DIVISOR_LATCH;
40:
41: typedef union {
42: struct {
43: BYTE_BIT_FIELD data_available:1;
44: BYTE_BIT_FIELD tx_holding:1;
45: BYTE_BIT_FIELD rx_line:1;
46: BYTE_BIT_FIELD modem_status:1;
47: BYTE_BIT_FIELD pad:4;
48: } bits;
49: BYTE all;
50: } INT_ENABLE_REG;
51:
52: // define the meaning of IIR values instead of defining its structure
53: #define UART_RLS_INT 6
54: #define UART_RDA_INT 4
55: #define UART_THRE_INT 2
56: #define UART_MS_INT 0
57: #define UART_NO_INT 1
58:
59: typedef union {
60: struct {
61: BYTE_BIT_FIELD word_length:2;
62: BYTE_BIT_FIELD no_of_stop_bits:1;
63: BYTE_BIT_FIELD parity_enabled:1;
64: BYTE_BIT_FIELD even_parity:1;
65: BYTE_BIT_FIELD stick_parity:1;
66: BYTE_BIT_FIELD set_break:1;
67: BYTE_BIT_FIELD DLAB:1;
68: } bits;
69: BYTE all;
70: } LINE_CONTROL_REG;
71:
72: typedef union {
73: struct {
74: BYTE_BIT_FIELD DTR:1;
75: BYTE_BIT_FIELD RTS:1;
76: BYTE_BIT_FIELD OUT1:1;
77: BYTE_BIT_FIELD OUT2:1;
78: BYTE_BIT_FIELD loop:1;
79: BYTE_BIT_FIELD pad:3;
80: } bits;
81: BYTE all;
82: } MODEM_CONTROL_REG;
83:
84: typedef union {
85: struct {
86: BYTE_BIT_FIELD data_ready:1;
87: BYTE_BIT_FIELD overrun_error:1;
88: BYTE_BIT_FIELD parity_error:1;
89: BYTE_BIT_FIELD framing_error:1;
90: BYTE_BIT_FIELD break_interrupt:1;
91: BYTE_BIT_FIELD tx_holding_empty:1;
92: BYTE_BIT_FIELD tx_shift_empty:1;
93: BYTE_BIT_FIELD pad:1;
94: } bits;
95: BYTE all;
96: } LINE_STATUS_REG;
97:
98: typedef union {
99: struct {
100: BYTE_BIT_FIELD delta_CTS:1;
101: BYTE_BIT_FIELD delta_DSR:1;
102: BYTE_BIT_FIELD TERI:1;
103: BYTE_BIT_FIELD delta_RLSD:1;
104: BYTE_BIT_FIELD CTS:1;
105: BYTE_BIT_FIELD DSR:1;
106: BYTE_BIT_FIELD RI:1;
107: BYTE_BIT_FIELD RLSD:1;
108: } bits;
109: BYTE all;
110: } MODEM_STATUS_REG;
111:
112: /* register select code definitions follow: */
113:
114: #define UART_TX_RX 0
115: #define UART_THR 0
116: #define UART_RBR 0
117: #define UART_IER 1
118: #define UART_IIR 2
119: #define UART_LCR 3
120: #define UART_MCR 4
121: #define UART_LSR 5
122: #define UART_MSR 6
123: #define UART_SCRATCH 7
124:
125: #define UART_PARITY_ON 1 /* line control setting for parity enabled */
126: #define UART_PARITY_OFF 0 /* line control setting for parity disabled */
127:
128: #define UART_PARITY_ODD 0 /* line control setting for odd parity */
129: #define UART_PARITY_EVEN 1 /* line control setting for even parity */
130:
131: #define UART_PARITY_STICK 1 /* line control setting for stick(y) parity */
132:
133: #endif /* _UART_H */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.