CD2231

Manufacturer Part NumberCD2231
DescriptionCD2231 Intelligent Two-channel Lan And Wan Communications Controller
ManufacturerIntel Corporation
CD2231 datasheet
 


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
Page 81
82
Page 82
83
Page 83
84
Page 84
85
Page 85
86
Page 86
87
Page 87
88
Page 88
89
Page 89
90
Page 90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
Page 86/178

Download datasheet (3Mb)Embed
PrevNext
CD2231 — Intelligent Two-Channel LAN and WAN Communications Controller
outportb( CMR, ASYNC );// Async Mode, interrupt
outportb( COR1, PARIGN | CHAR8 );// 8 bit chars, no parity
outportb( COR2, IXM | TXIBE );// in-band flow,implied XON
outportb( COR3, STOP1 | FCT );// 1 stop, flow control
outportb( COR4, thresh );// FIFO threshold
outportb( COR5, 0 );
7.3
HDLC DMA Channel Setup Example
This per-channel initialization code example is for the HDLC protocol at 64 kbps (with CLK = 33
MHz) with NRZI encoding. The setup specifies two extra opening flags before frames, no address
matching, and that DMA transfers should be used.
outportb( LIVR, 0x30 );// Set interrupt vector
outportb( RCOR, DPLL_NRZI );// Receive clock option
outportb( RBPR, x’3F );// Baud rate divisor
outportb( TCOR, 0 );
outportb( TBPR, x’3F );// Baud rate divisor
outportb( CMR, RX_DMA | TX_DMA | HDLC );// Mode register
outportb( CPSR, CPSR_CRC_V41 );// CRC polynomial select
outportb( COR1, NO_ADDR | FLAG_2 );// No address matching,
outportb( COR2, CRC_V41 );// 2 opening flags
outportb( COR3, 0 );
outportb( COR4, thresh );// FIFO threshold
outportb( COR5, 0);
7.4
Receive DMA Interrupt Service Routine
The following code example shows an interrupt service routine for the CD2231 in DMA mode.
The buffer class array ib[ ] is used for notational convenience, and its exact implementation is user-
defined. The upper ( ) and lower ( ) functions should return the upper and lower 16 bits of the
DMA address for the current buffer segment. The ‘nxt_buf()’ accesses the next segment.
If the system uses separate interrupt handlers for receive, transmit, and modem interrupts, the
channel number can be obtained from the least-significant bit of the Interrupt register (RIR, TIR,
MIR). Otherwise, first use the LIVR to determine the type of interrupt. Receive Good Data
interrupts should not occur during DMA transfers. The normal exception is when end-of-frame is
received.
The DMABSTS register shows which buffer the CD2231 expects to use next. Fill the descriptor
registers for that buffer, including the 2231own bit and return. The last access to the CD2231
during the service routine is the REOIR.
int risrl = inportb( RISRL ); // low status
int ch = inportb( RIR ) & 0x01;// channel number
switch( inport(LIVR) & 0x03 ) {
case LIVR_GOODDATA:
break;
case LIVR_EXCEPTION:
if( risrl & RISR_EOF ) {
if( inportb(DMABSTS) & DMABS_NRBUF ) {// buffer B next
86
// Transmit clock option
// shouldn’t happen in DMA
// EOF is ’normal’ exception
outport( BRBADRU, ib[ch].upper() );
Datasheet