annotate target-utils/include/ns16550.h @ 393:d7591faa1258

target-utils serial I/O made consistent with other projects
author Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
date Wed, 11 Jun 2014 17:22:55 +0000
parents 40f607bb0a2c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
1 #ifndef __NS16550_H
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
2 #define __NS16550_H
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
3
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
4 /* NS16550 registers */
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
5 #define NS16550_RBR 0
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
6 #define NS16550_THR 0
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
7 #define NS16550_IER 1
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
8 #define NS16550_IIR 2
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
9 #define NS16550_FCR 2
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
10 #define NS16550_LCR 3
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
11 #define NS16550_MCR 4
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
12 #define NS16550_LSR 5
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
13 #define NS16550_MSR 6
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
14 #define NS16550_SCR 7
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
15 #define NS16550_DLL 0
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
16 #define NS16550_DLM 1
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
17
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
18 #ifndef __ASSEMBLER__
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
19 #include "types.h"
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
20
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
21 struct ns16550_regs {
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
22 u8 datareg;
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
23 u8 ier;
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
24 u8 iir_fcr;
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
25 u8 lcr;
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
26 u8 mcr;
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
27 u8 lsr;
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
28 u8 msr;
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
29 u8 scr;
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
30 };
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
31 #endif
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
32
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
33 /* IER bits */
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
34 #define NS16550_IER_EDSSI 0x08
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
35 #define NS16550_IER_ELSI 0x04
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
36 #define NS16550_IER_ETBEI 0x02
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
37 #define NS16550_IER_ERBFI 0x01
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
38
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
39 /* IIR bits */
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
40 #define NS16550_IIR_FIFOEN 0xC0
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
41 #define NS16550_IIR_INTID 0x0E
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
42 #define NS16550_IIR_INT_RLS 0x06
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
43 #define NS16550_IIR_INT_RDA 0x04
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
44 #define NS16550_IIR_INT_CTO 0x0C
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
45 #define NS16550_IIR_INT_THRE 0x02
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
46 #define NS16550_IIR_INT_MODEM 0x00
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
47 #define NS16550_IIR_INTPEND 0x01
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
48
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
49 /* FCR bits */
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
50
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
51 #define NS16550_FCR_RXTR 0xC0
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
52 #define NS16550_FCR_RXTR_1 0x00
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
53 #define NS16550_FCR_RXTR_4 0x40
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
54 #define NS16550_FCR_RXTR_8 0x80
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
55 #define NS16550_FCR_RXTR_14 0xC0
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
56 #define NS16550_FCR_DMAMODE 0x08
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
57 #define NS16550_FCR_TXRST 0x04
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
58 #define NS16550_FCR_RXRST 0x02
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
59 #define NS16550_FCR_FIFOEN 0x01
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
60
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
61 /* LCR bits */
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
62 #define NS16550_LCR_DLAB 0x80
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
63 #define NS16550_LCR_BREAK 0x40
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
64 #define NS16550_LCR_STICK 0x20
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
65 #define NS16550_LCR_EPS 0x10
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
66 #define NS16550_LCR_PEN 0x08
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
67 #define NS16550_LCR_STB 0x04
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
68 #define NS16550_LCR_WLS 0x03
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
69 #define NS16550_LCR_WLS_5 0x00
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
70 #define NS16550_LCR_WLS_6 0x01
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
71 #define NS16550_LCR_WLS_7 0x02
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
72 #define NS16550_LCR_WLS_8 0x03
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
73
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
74 /* MCR bits */
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
75 #define NS16550_MCR_LOOP 0x10
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
76 #define NS16550_MCR_OUT2 0x08
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
77 #define NS16550_MCR_OUT1 0x04
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
78 #define NS16550_MCR_RTS 0x02
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
79 #define NS16550_MCR_DTR 0x01
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
80
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
81 /* LSR bits */
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
82 #define NS16550_LSR_ERR 0x80
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
83 #define NS16550_LSR_TEMP 0x40
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
84 #define NS16550_LSR_THRE 0x20
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
85 #define NS16550_LSR_BI 0x10
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
86 #define NS16550_LSR_FE 0x08
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
87 #define NS16550_LSR_PE 0x04
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
88 #define NS16550_LSR_OE 0x02
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
89 #define NS16550_LSR_DR 0x01
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
90
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
91 /* MSR bits */
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
92 #define NS16550_MSR_DCD 0x80
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
93 #define NS16550_MSR_RI 0x40
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
94 #define NS16550_MSR_DSR 0x20
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
95 #define NS16550_MSR_CTS 0x10
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
96 #define NS16550_MSR_DDCD 0x08
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
97 #define NS16550_MSR_TERI 0x04
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
98 #define NS16550_MSR_DDSR 0x02
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
99 #define NS16550_MSR_DCTS 0x01
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
100
da98dc08f575 loadagent: beginning to lay the foundation
Michael Spacefalcon <msokolov@ivan.Harhan.ORG>
parents:
diff changeset
101 #endif /* __NS16550_H */