1 |
1327 |
jcastillo |
//////////////////////////////////////////////////////////////////////
|
2 |
|
|
//// ////
|
3 |
|
|
//// uart_defines.v ////
|
4 |
|
|
//// ////
|
5 |
|
|
//// ////
|
6 |
|
|
//// This file is part of the "UART 16550 compatible" project ////
|
7 |
|
|
//// http://www.opencores.org/cores/uart16550/ ////
|
8 |
|
|
//// ////
|
9 |
|
|
//// Documentation related to this project: ////
|
10 |
|
|
//// - http://www.opencores.org/cores/uart16550/ ////
|
11 |
|
|
//// ////
|
12 |
|
|
//// Projects compatibility: ////
|
13 |
|
|
//// - WISHBONE ////
|
14 |
|
|
//// RS232 Protocol ////
|
15 |
|
|
//// 16550D uart (mostly supported) ////
|
16 |
|
|
//// ////
|
17 |
|
|
//// Overview (main Features): ////
|
18 |
|
|
//// Defines of the Core ////
|
19 |
|
|
//// ////
|
20 |
|
|
//// Known problems (limits): ////
|
21 |
|
|
//// None ////
|
22 |
|
|
//// ////
|
23 |
|
|
//// To Do: ////
|
24 |
|
|
//// Nothing. ////
|
25 |
|
|
//// ////
|
26 |
|
|
//// Author(s): ////
|
27 |
|
|
//// - gorban@opencores.org ////
|
28 |
|
|
//// - Jacob Gorban ////
|
29 |
|
|
//// ////
|
30 |
|
|
//// Created: 2001/05/12 ////
|
31 |
|
|
//// Last Updated: 2001/05/17 ////
|
32 |
|
|
//// (See log for the revision history) ////
|
33 |
|
|
//// ////
|
34 |
|
|
//// ////
|
35 |
|
|
//////////////////////////////////////////////////////////////////////
|
36 |
|
|
//// ////
|
37 |
|
|
//// Copyright (C) 2000 Jacob Gorban, gorban@opencores.org ////
|
38 |
|
|
//// ////
|
39 |
|
|
//// This source file may be used and distributed without ////
|
40 |
|
|
//// restriction provided that this copyright statement is not ////
|
41 |
|
|
//// removed from the file and that any derivative work contains ////
|
42 |
|
|
//// the original copyright notice and the associated disclaimer. ////
|
43 |
|
|
//// ////
|
44 |
|
|
//// This source file is free software; you can redistribute it ////
|
45 |
|
|
//// and/or modify it under the terms of the GNU Lesser General ////
|
46 |
|
|
//// Public License as published by the Free Software Foundation; ////
|
47 |
|
|
//// either version 2.1 of the License, or (at your option) any ////
|
48 |
|
|
//// later version. ////
|
49 |
|
|
//// ////
|
50 |
|
|
//// This source is distributed in the hope that it will be ////
|
51 |
|
|
//// useful, but WITHOUT ANY WARRANTY; without even the implied ////
|
52 |
|
|
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ////
|
53 |
|
|
//// PURPOSE. See the GNU Lesser General Public License for more ////
|
54 |
|
|
//// details. ////
|
55 |
|
|
//// ////
|
56 |
|
|
//// You should have received a copy of the GNU Lesser General ////
|
57 |
|
|
//// Public License along with this source; if not, download it ////
|
58 |
|
|
//// from http://www.opencores.org/lgpl.shtml ////
|
59 |
|
|
//// ////
|
60 |
|
|
//////////////////////////////////////////////////////////////////////
|
61 |
|
|
//
|
62 |
|
|
// CVS Revision History
|
63 |
|
|
//
|
64 |
|
|
// $Log: not supported by cvs2svn $
|
65 |
|
|
// Revision 1.5 2001/05/31 20:08:01 gorban
|
66 |
|
|
// FIFO changes and other corrections.
|
67 |
|
|
//
|
68 |
|
|
// Revision 1.4 2001/05/21 19:12:02 gorban
|
69 |
|
|
// Corrected some Linter messages.
|
70 |
|
|
//
|
71 |
|
|
// Revision 1.3 2001/05/17 18:34:18 gorban
|
72 |
|
|
// First 'stable' release. Should be sythesizable now. Also added new header.
|
73 |
|
|
//
|
74 |
|
|
// Revision 1.0 2001-05-17 21:27:11+02 jacob
|
75 |
|
|
// Initial revision
|
76 |
|
|
//
|
77 |
|
|
//
|
78 |
|
|
|
79 |
|
|
`define UART_ADDR_WIDTH 3
|
80 |
|
|
|
81 |
|
|
// Register addresses
|
82 |
|
|
`define UART_REG_RB 3'd0 // receiver buffer
|
83 |
|
|
`define UART_REG_TR 3'd0 // transmitter
|
84 |
|
|
`define UART_REG_IE 3'd1 // Interrupt enable
|
85 |
|
|
`define UART_REG_II 3'd2 // Interrupt identification
|
86 |
|
|
`define UART_REG_FC 3'd2 // FIFO control
|
87 |
|
|
`define UART_REG_LC 3'd3 // Line Control
|
88 |
|
|
`define UART_REG_MC 3'd4 // Modem control
|
89 |
|
|
`define UART_REG_LS 3'd5 // Line status
|
90 |
|
|
`define UART_REG_MS 3'd6 // Modem status
|
91 |
|
|
`define UART_REG_DL1 3'd0 // Divisor latch bytes (1-4)
|
92 |
|
|
`define UART_REG_DL2 3'd1
|
93 |
|
|
`define UART_REG_DL3 3'd4
|
94 |
|
|
`define UART_REG_DL4 3'd5
|
95 |
|
|
|
96 |
|
|
// Interrupt Enable register bits
|
97 |
|
|
`define UART_IE_RDA 0 // Received Data available interrupt
|
98 |
|
|
`define UART_IE_THRE 1 // Transmitter Holding Register empty interrupt
|
99 |
|
|
`define UART_IE_RLS 2 // Receiver Line Status Interrupt
|
100 |
|
|
`define UART_IE_MS 3 // Modem Status Interrupt
|
101 |
|
|
|
102 |
|
|
// Interrupt Identification register bits
|
103 |
|
|
`define UART_II_IP 0 // Interrupt pending when 0
|
104 |
|
|
`define UART_II_II 3:1 // Interrupt identification
|
105 |
|
|
|
106 |
|
|
// Interrupt identification values for bits 3:1
|
107 |
|
|
`define UART_II_RLS 3'b011 // Receiver Line Status
|
108 |
|
|
`define UART_II_RDA 3'b010 // Receiver Data available
|
109 |
|
|
`define UART_II_TI 3'b110 // Timeout Indication
|
110 |
|
|
`define UART_II_THRE 3'b001 // Transmitter Holding Register empty
|
111 |
|
|
`define UART_II_MS 3'b000 // Modem Status
|
112 |
|
|
|
113 |
|
|
// FIFO Control Register bits
|
114 |
|
|
`define UART_FC_TL 1:0 // Trigger level
|
115 |
|
|
|
116 |
|
|
// FIFO trigger level values
|
117 |
|
|
`define UART_FC_1 2'b00
|
118 |
|
|
`define UART_FC_4 2'b01
|
119 |
|
|
`define UART_FC_8 2'b10
|
120 |
|
|
`define UART_FC_14 2'b11
|
121 |
|
|
|
122 |
|
|
// Line Control register bits
|
123 |
|
|
`define UART_LC_BITS 1:0 // bits in character
|
124 |
|
|
`define UART_LC_SB 2 // stop bits
|
125 |
|
|
`define UART_LC_PE 3 // parity enable
|
126 |
|
|
`define UART_LC_EP 4 // even parity
|
127 |
|
|
`define UART_LC_SP 5 // stick parity
|
128 |
|
|
`define UART_LC_BC 6 // Break control
|
129 |
|
|
`define UART_LC_DL 7 // Divisor Latch access bit
|
130 |
|
|
|
131 |
|
|
// Modem Control register bits
|
132 |
|
|
`define UART_MC_DTR 0
|
133 |
|
|
`define UART_MC_RTS 1
|
134 |
|
|
`define UART_MC_OUT1 2
|
135 |
|
|
`define UART_MC_OUT2 3
|
136 |
|
|
`define UART_MC_LB 4 // Loopback mode
|
137 |
|
|
|
138 |
|
|
// Line Status Register bits
|
139 |
|
|
`define UART_LS_DR 0 // Data ready
|
140 |
|
|
`define UART_LS_OE 1 // Overrun Error
|
141 |
|
|
`define UART_LS_PE 2 // Parity Error
|
142 |
|
|
`define UART_LS_FE 3 // Framing Error
|
143 |
|
|
`define UART_LS_BI 4 // Break interrupt
|
144 |
|
|
`define UART_LS_TFE 5 // Transmit FIFO is empty
|
145 |
|
|
`define UART_LS_TE 6 // Transmitter Empty indicator
|
146 |
|
|
`define UART_LS_EI 7 // Error indicator
|
147 |
|
|
|
148 |
|
|
// Modem Status Register bits
|
149 |
|
|
`define UART_MS_DCTS 0 // Delta signals
|
150 |
|
|
`define UART_MS_DDSR 1
|
151 |
|
|
`define UART_MS_TERI 2
|
152 |
|
|
`define UART_MS_DDCD 3
|
153 |
|
|
`define UART_MS_CCTS 4 // Complement signals
|
154 |
|
|
`define UART_MS_CDSR 5
|
155 |
|
|
`define UART_MS_CRI 6
|
156 |
|
|
`define UART_MS_CDCD 7
|
157 |
|
|
|
158 |
|
|
|
159 |
|
|
// FIFO parameter defines
|
160 |
|
|
|
161 |
|
|
`define UART_FIFO_WIDTH 8
|
162 |
|
|
`define UART_FIFO_DEPTH 16
|
163 |
|
|
`define UART_FIFO_POINTER_W 4
|
164 |
|
|
`define UART_FIFO_COUNTER_W 5
|
165 |
|
|
// receiver fifo has width 10 because it has parity and framing error bits
|
166 |
|
|
`define UART_FIFO_REC_WIDTH 10
|
167 |
|
|
|
168 |
|
|
|
169 |
|
|
|
170 |
|
|
|
171 |
|
|
|
172 |
|
|
|
173 |
|
|
|
174 |
|
|
`define VERBOSE_WB 0 // All activity on the WISHBONE is recorded
|
175 |
|
|
`define VERBOSE_LINE_STATUS 0 // Details about the lsr (line status register)
|
176 |
|
|
`define FAST_TEST 1 // 64/1024 packets are sent
|
177 |
|
|
|