OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [hal/] [sh/] [sh2/] [v2_0/] [include/] [mod_regs_ser.h] - Blame information for rev 174

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 unneback
//=============================================================================
2
//
3
//      mod_regs_ser.h
4
//
5
//      SCI, SCIF, and IRDA (serial) Module register definitions
6
//
7
//=============================================================================
8
//####ECOSGPLCOPYRIGHTBEGIN####
9
// -------------------------------------------
10
// This file is part of eCos, the Embedded Configurable Operating System.
11
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
12
//
13
// eCos is free software; you can redistribute it and/or modify it under
14
// the terms of the GNU General Public License as published by the Free
15
// Software Foundation; either version 2 or (at your option) any later version.
16
//
17
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
18
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
19
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
20
// for more details.
21
//
22
// You should have received a copy of the GNU General Public License along
23
// with eCos; if not, write to the Free Software Foundation, Inc.,
24
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
25
//
26
// As a special exception, if other files instantiate templates or use macros
27
// or inline functions from this file, or you compile this file and link it
28
// with other works to produce a work based on this file, this file does not
29
// by itself cause the resulting work to be covered by the GNU General Public
30
// License. However the source code for this file must still be made available
31
// in accordance with section (3) of the GNU General Public License.
32
//
33
// This exception does not invalidate any other reasons why a work based on
34
// this file might be covered by the GNU General Public License.
35
//
36
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
37
// at http://sources.redhat.com/ecos/ecos-license/
38
// -------------------------------------------
39
//####ECOSGPLCOPYRIGHTEND####
40
//=============================================================================
41
//#####DESCRIPTIONBEGIN####
42
//
43
// Author(s):   jskov
44
// Contributors:jskov
45
// Date:        2000-10-30
46
// Note:        All three serial module definitions kept in the same file
47
//              since they share some of the information.
48
//####DESCRIPTIONEND####
49
//
50
//=============================================================================
51
 
52
#ifdef CYGARC_SH_MOD_SCI
53
//++++++ Module SCI ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
54
//--------------------------------------------------------------------------
55
// Serial registers. All 8 bit registers.
56
#define CYGARC_REG_SCI_SCSMR0                0xffff81a0 // serial mode register
57
#define CYGARC_REG_SCI_SCBRR0                0xffff81a1 // bit rate register
58
#define CYGARC_REG_SCI_SCSCR0                0xffff81a2 // serial control register
59
#define CYGARC_REG_SCI_SCTDR0                0xffff81a3 // transmit data register
60
#define CYGARC_REG_SCI_SCSSR0                0xffff81a4 // serial status register
61
#define CYGARC_REG_SCI_SCRDR0                0xffff81a5 // receive data register
62
 
63
#define CYGARC_REG_SCI_SCSMR1                0xffff81b0 // serial mode register
64
 
65
// Serial Mode Register
66
#define CYGARC_REG_SCI_SCSMR_CA             0x80 // communication mode
67
#define CYGARC_REG_SCI_SCSMR_CHR            0x40 // character length (7 if set)
68
#define CYGARC_REG_SCI_SCSMR_PE             0x20 // parity enable
69
#define CYGARC_REG_SCI_SCSMR_OE             0x10 // parity mode
70
#define CYGARC_REG_SCI_SCSMR_STOP           0x08 // stop bit length
71
#define CYGARC_REG_SCI_SCSMR_MP             0x04 // multiprocessor mode
72
#define CYGARC_REG_SCI_SCSMR_CKS1           0x02 // clock select 1
73
#define CYGARC_REG_SCI_SCSMR_CKS0           0x01 // clock select 0
74
#define CYGARC_REG_SCI_SCSMR_CKSx_MASK      0x03 // mask
75
 
76
// Serial Control Register
77
#define CYGARC_REG_SCI_SCSCR_TIE            0x80 // transmit interrupt enable
78
#define CYGARC_REG_SCI_SCSCR_RIE            0x40 // receive interrupt enable
79
#define CYGARC_REG_SCI_SCSCR_TE             0x20 // transmit enable
80
#define CYGARC_REG_SCI_SCSCR_RE             0x10 // receive enable
81
#define CYGARC_REG_SCI_SCSCR_MPIE           0x08 // multiprocessor interrupt enable
82
#define CYGARC_REG_SCI_SCSCR_TEIE           0x04 // transmit-end interrupt enable
83
#define CYGARC_REG_SCI_SCSCR_CKE1           0x02 // clock enable 1
84
#define CYGARC_REG_SCI_SCSCR_CKE0           0x01 // clock enable 0
85
 
86
// Serial Status Register
87
#define CYGARC_REG_SCI_SCSSR_TDRE           0x80 // transmit data register empty
88
#define CYGARC_REG_SCI_SCSSR_RDRF           0x40 // receive data register full
89
#define CYGARC_REG_SCI_SCSSR_ORER           0x20 // overrun error
90
#define CYGARC_REG_SCI_SCSSR_FER            0x10 // framing error
91
#define CYGARC_REG_SCI_SCSSR_PER            0x08 // parity error
92
#define CYGARC_REG_SCI_SCSSR_TEND           0x04 // transmit end
93
#define CYGARC_REG_SCI_SCSSR_MPB            0x02 // multiprocessor bit
94
#define CYGARC_REG_SCI_SCSSR_MPBT           0x01 // multiprocessor bit transfer
95
 
96
// When clearing the status register, always write the value:
97
// CYGARC_REG_SCSSR_CLEARMASK & ~bit
98
// to prevent other bits than the one of interest to be cleared.
99
#define CYGARC_REG_SCI_SCSSR_CLEARMASK      0xf8
100
 
101
 
102
#if (CYGARC_SH_MOD_SCI >= 2)
103
# define CYGARC_REG_SCI_SCSPTR               0xfffffe7c // serial port register
104
#endif
105
 
106
#endif // CYGARC_SH_MOD_SCI
107
 
108
// Baud rate values calculation, depending on peripheral clock (Pf)
109
// n is CKS setting (0-3)
110
// N = (Pf/(64*2^(2n-1)*B))-1
111
// With CYGARC_SCBRR_CKSx providing the values 1, 4, 16, 64 we get
112
//       N = (Pf/(32*_CKS*B))-1
113
//
114
// The CYGARC_SCBRR_OPTIMAL_CKS macro should compute the minimal CKS
115
// setting for the given baud rate and peripheral clock.
116
//
117
// The error of the CKS+count value can be computed by:
118
//  E(%) = ((Pf/((N+1)*B*(64^(n-1)))-1)*100 
119
//
120
#define CYGARC_SCBRR_PRESCALE(_b_) \
121
((((CYGHWR_HAL_SH_ONCHIP_PERIPHERAL_SPEED/32/1/(_b_))-1)<256) ? 1 : \
122
 (((CYGHWR_HAL_SH_ONCHIP_PERIPHERAL_SPEED/32/4/(_b_))-1)<256) ? 4 : \
123
 (((CYGHWR_HAL_SH_ONCHIP_PERIPHERAL_SPEED/32/16/(_b_))-1)<256) ? 16 : 64)
124
 
125
// Add half the divisor to reduce rounding errors to .5
126
#define CYGARC_SCBRR_ROUNDING(_b_) \
127
  16*CYGARC_SCBRR_PRESCALE(_b_)*(_b_)
128
 
129
// These two macros provide the static values we need to stuff into the
130
// registers.
131
#define CYGARC_SCBRR_CKSx(_b_) \
132
    ((1 == CYGARC_SCBRR_PRESCALE(_b_)) ? 0 : \
133
     (4 == CYGARC_SCBRR_PRESCALE(_b_)) ? 1 : \
134
     (16 == CYGARC_SCBRR_PRESCALE(_b_)) ? 2 : 3)
135
#define CYGARC_SCBRR_N(_b_)     \
136
    (((_b_) < 4800) ? 0 :       \
137
      ((_b_) > 115200) ? 0 :    \
138
       (((CYGHWR_HAL_SH_ONCHIP_PERIPHERAL_SPEED+CYGARC_SCBRR_ROUNDING(_b_))/32/CYGARC_SCBRR_PRESCALE(_b_)/(_b_))-1))
139
 
140
 
141
//++++++ Module SCIF +++++++++++++++++++++++++++++++++++++++++++++++++++++++
142
#ifdef CYGARC_SH_MOD_SCIF
143
 
144
//--------------------------------------------------------------------------
145
// Serial w FIFO registers (and IRDA)
146
 
147
#define CYGARC_REG_SCIF_SCSMR1               0xfffffcc0 // 8
148
#define CYGARC_REG_SCIF_SCBRR1               0xfffffcc2 // 8
149
#define CYGARC_REG_SCIF_SCSCR1               0xfffffcc4 // 8
150
#define CYGARC_REG_SCIF_SCFTDR1              0xfffffcc6 // 8
151
#define CYGARC_REG_SCIF_SC1SSR1              0xfffffcc8 // 16
152
#define CYGARC_REG_SCIF_SC2SSR1              0xfffffcca // 8
153
#define CYGARC_REG_SCIF_SCFRDR1              0xfffffccc // 8
154
#define CYGARC_REG_SCIF_SCFCR1               0xfffffcce // 8
155
#define CYGARC_REG_SCIF_SCFDR1               0xfffffcd0 // 16
156
#define CYGARC_REG_SCIF_SCFER1               0xfffffcd2 // 16
157
#define CYGARC_REG_SCIF_SCIFMR1              0xfffffcd4 // 8
158
 
159
#define CYGARC_REG_SCIF_SCSMR2               0xfffffce0 // 8
160
#define CYGARC_REG_SCIF_SCBRR2               0xfffffce2 // 8
161
#define CYGARC_REG_SCIF_SCSCR2               0xfffffce4 // 8
162
#define CYGARC_REG_SCIF_SCFTDR2              0xfffffce6 // 8
163
#define CYGARC_REG_SCIF_SC1SSR2              0xfffffce8 // 16
164
#define CYGARC_REG_SCIF_SC2SSR2              0xfffffcea // 8
165
#define CYGARC_REG_SCIF_SCFRDR2              0xfffffcec // 8
166
#define CYGARC_REG_SCIF_SCFCR2               0xfffffcee // 8
167
#define CYGARC_REG_SCIF_SCFDR2               0xfffffcf0 // 16
168
#define CYGARC_REG_SCIF_SCFER2               0xfffffcf2 // 16
169
#define CYGARC_REG_SCIF_SCIFMR2              0xfffffcf4 // 8
170
 
171
// Serial Mode Register
172
#define CYGARC_REG_SCIF_SCSMR_CA             0x80 // async(0)/sync(1)
173
#define CYGARC_REG_SCIF_SCSMR_CHR            0x40 // character length (7 if set)
174
#define CYGARC_REG_SCIF_SCSMR_PE             0x20 // parity enable
175
#define CYGARC_REG_SCIF_SCSMR_OE             0x10 // parity mode (odd if set)
176
#define CYGARC_REG_SCIF_SCSMR_STOP           0x08 // stop bit length
177
#define CYGARC_REG_SCIF_SCSMR_MP             0x04 // MP mode
178
#define CYGARC_REG_SCIF_SCSMR_CKS1           0x02 // clock select 1
179
#define CYGARC_REG_SCIF_SCSMR_CKS0           0x01 // clock select 0
180
#define CYGARC_REG_SCIF_SCSMR_CKSx_MASK      0x03 // mask
181
 
182
// Serial Control Register
183
#define CYGARC_REG_SCIF_SCSCR_TIE            0x80 // transmit interrupt enable
184
#define CYGARC_REG_SCIF_SCSCR_RIE            0x40 // receive interrupt enable
185
#define CYGARC_REG_SCIF_SCSCR_TE             0x20 // transmit enable
186
#define CYGARC_REG_SCIF_SCSCR_RE             0x10 // receive enable
187
#define CYGARC_REG_SCIF_SCSCR_MPIE           0x08 // MP interrupt enable
188
#define CYGARC_REG_SCIF_SCSCR_CKE1           0x02 // clock enable 1
189
#define CYGARC_REG_SCIF_SCSCR_CKE0           0x01 // clock enable 0
190
 
191
// Serial Status Register 1
192
#define CYGARC_REG_SCIF_SCSSR_PER_MASK       0xf000 // number of parity errors
193
#define CYGARC_REG_SCIF_SCSSR_PER_shift      12
194
#define CYGARC_REG_SCIF_SCSSR_FER_MASK       0x0f00 // number of framing errors
195
#define CYGARC_REG_SCIF_SCSSR_FER_shift      8
196
#define CYGARC_REG_SCIF_SCSSR_ER             0x0080 // receive error
197
#define CYGARC_REG_SCIF_SCSSR_TEND           0x0040 // transmit end
198
#define CYGARC_REG_SCIF_SCSSR_TDFE           0x0020 // transmit fifo data empty
199
#define CYGARC_REG_SCIF_SCSSR_BRK            0x0010 // break detection
200
#define CYGARC_REG_SCIF_SCSSR_FER            0x0008 // framing error
201
#define CYGARC_REG_SCIF_SCSSR_PER            0x0004 // parity error
202
#define CYGARC_REG_SCIF_SCSSR_RDF            0x0002 // receive fifo data full
203
#define CYGARC_REG_SCIF_SCSSR_DR             0x0001 // receive data ready
204
 
205
// When clearing the status register, always write the value:
206
// CYGARC_REG_SCSSR_CLEARMASK & ~bit
207
// to prevent other bits than the one of interest to be cleared.
208
#define CYGARC_REG_SCIF_SCSSR_CLEARMASK      0x00f3
209
 
210
// Serial Status Register 2
211
#define CYGARC_REG_SCIF_SC2SSR_TLM            0x80 // Transmit LSB(0)/MSB(1)
212
#define CYGARC_REG_SCIF_SC2SSR_RLM            0x40 // Receive LSB(0)/MSB(1)
213
#define CYGARC_REG_SCIF_SC2SSR_BITRATE_4      0x00 // Bitrate
214
#define CYGARC_REG_SCIF_SC2SSR_BITRATE_8      0x10
215
#define CYGARC_REG_SCIF_SC2SSR_BITRATE_16     0x20
216
#define CYGARC_REG_SCIF_SC2SSR_MPB            0x08 // MP data received
217
#define CYGARC_REG_SCIF_SC2SSR_MPBT           0x04 // MP data transmited
218
#define CYGARC_REG_SCIF_SC2SSR_EI             0x02 // Ignore RX errors
219
#define CYGARC_REG_SCIF_SC2SSR_ORER           0x01 // overrun error
220
 
221
// Serial FIFO Control Register
222
#define CYGARC_REG_SCIF_SCFCR_RTRG_MASK      0xc0   // receive fifo data trigger
223
#define CYGARC_REG_SCIF_SCFCR_RTRG_1         0x00   // trigger on 1 char 
224
#define CYGARC_REG_SCIF_SCFCR_RTRG_4         0x40   // trigger on 4 chars
225
#define CYGARC_REG_SCIF_SCFCR_RTRG_8         0x80   // trigger on 8 chars
226
#define CYGARC_REG_SCIF_SCFCR_RTRG_14        0xc0   // trigger on 14 chars 
227
 
228
#define CYGARC_REG_SCIF_SCFCR_TTRG_MASK      0x30   // transmit fifo data trigger
229
#define CYGARC_REG_SCIF_SCFCR_TTRG_8         0x00   // trigger on 8 chars 
230
#define CYGARC_REG_SCIF_SCFCR_TTRG_4         0x10   // trigger on 4 chars
231
#define CYGARC_REG_SCIF_SCFCR_TTRG_2         0x20   // trigger on 2 chars
232
#define CYGARC_REG_SCIF_SCFCR_TTRG_1         0x30   // trigger on 1 char
233
 
234
#define CYGARC_REG_SCIF_SCFCR_MCE            0x08   // modem control enable
235
#define CYGARC_REG_SCIF_SCFCR_TFRST          0x04   // transmit fifo reset
236
#define CYGARC_REG_SCIF_SCFCR_RFRST          0x02   // receive fifo reset
237
#define CYGARC_REG_SCIF_SCFCR_LOOP           0x01   // loop back test
238
 
239
 
240
// Serial FIFO Data Count Set Register
241
#define CYGARC_REG_SCIF_SCFDR_RCOUNT_MASK    0x001f // number of chars in r fifo
242
#define CYGARC_REG_SCIF_SCFDR_RCOUNT_shift   0
243
#define CYGARC_REG_SCIF_SCFDR_TCOUNT_MASK    0x1f00 // number of chars in t fifo
244
#define CYGARC_REG_SCIF_SCFDR_TCOUNT_shift   8
245
 
246
// Serial IrDA Mode Register
247
#define CYGARC_REG_SCIF_SCIMR_IRMOD          0x80
248
#define CYGARC_REG_SCIF_SCIMR_PSEL           0x40
249
#define CYGARC_REG_SCIF_SCIMR_RIVS           0x20
250
 
251
 
252
#endif // CYGARC_SH_MOD_SCIF

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.