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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [devs/] [serial/] [m68k/] [mcf52xx/] [current/] [doc/] [mcf52xx_ser.sgml] - Blame information for rev 786

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 786 skrzyp
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
Freescale MCFxxxx Serial Driver
38
 
39
40
  
41
    MCFxxxx Serial Driver
42
  
43
  
44
    CYGPKG_DEVS_SERIAL_MCFxxxx
45
    eCos Support for the MCFxxxx On-chip Serial Devices
46
  
47
 
48
  Description
49
    
50
All members of the Freescale MCFxxxx ColdFire family of processors
51
contain a number of on-chip UARTs for serial communication. They all
52
use very similar hardware. There are some variations such as different
53
fifo sizes, and some processors contain extra functionality such as
54
autobaud detection, but a single eCos device driver can cope with most
55
of these differences. The
56
CYGPKG_DEVS_SERIAL_MCFxxxx package provides this
57
driver. It will use definitions provided by the variant HAL
58
CYGPKG_HAL_M68K_MCFxxxx, the processor HAL and the
59
platform HAL.
60
    
61
    
62
The driver provides partial support for hardware flow control and for
63
serial line status. Only CTS/RTS hardware flow control is supported
64
since the UART does not provide DTR/DSR lines. Similarly only line
65
breaks, and certain communication errors are supported for line status
66
since the UART does not provide other lines such as DCD or RI. On some
67
platforms it should be possible to emulate these lines using GPIO
68
pins, but currently there is no support for this.
69
    
70
    
71
Once application code accesses a UART through the serial driver, for
72
example by opening a device /dev/ser0, the driver
73
assumes that it has sole access to the hardware. This means that the
74
UART should not be used for any other purpose, for example HAL
75
diagnostics or gdb debug traffic. Instead such traffic has to go via
76
another communication channel such as ethernet.
77
    
78
  
79
 
80
  Configuration Options
81
    
82
    The MCFxxxx serial driver should be loaded automatically when
83
selecting a platform containing a suitable processor, and it should
84
never be necessary to load it explicitly. The driver as a whole is
85
inactive unless the generic serial support,
86
CYGPKG_IO_SERIAL_DEVICES, is enabled. Exactly which
87
UART or UARTs are accessible on a given platform is determined by the
88
platform because even if the processor contains a UART the platform
89
may not provide a connector. Support for a given UART, say uart0, is
90
controlled by a configuration option
91
CYGPKG_DEVS_SERIAL_MCFxxxx_SERIAL0. The device
92
driver configuration option in turn depends on a HAL configuration
93
option CYGHWR_HAL_M68K_MCFxxxx_UART0 to indicate
94
that the UART is actually present and connected on the target
95
hardware. If a given UART is of no interest to an application
96
developer then it is possible to save some memory by disabling this
97
option.
98
    
99
    
100
For every enabled UART there are a further four configuration options:
101
    
102
    
103
      
104
        CYGDAT_DEVS_SERIAL_MCFxxxx_SERIAL0_NAME
105
        
106
Each serial device should have a unique name so that application code
107
can open it. The default device names are /dev/ser0,
108
/dev/ser1, and so on. It is only necessary to change
109
these if the platform contains additional off-chip UARTs with clashing
110
names.
111
        
112
      
113
      
114
        CYGNUM_DEVS_SERIAL_MCFxxxx_SERIAL0_ISR_PRIORITY
115
        
116
By default the driver arranges for the UARTs to interrupt at a low
117
interrupt priority. Usually there will be no need to change this
118
because the driver does not actually do very much processing at ISR
119
level, and anyway UARTs are not especially fast devices so do not
120
require immediate attention. On some Coldfires with MCF5282-compatible
121
interrupt controllers care has to be taken that all interrupt
122
priorities are unique.
123
        
124
      
125
      
126
        CYGNUM_DEVS_SERIAL_MCFxxxx_SERIAL0_BAUD
127
        
128
Each UART will be initialized to a given baud rate. The default baud
129
rate is 38400 because in most scenarios this is fast enough yet
130
does not suffer from excess data corruption. Lower baud rates can be
131
used if the application will operate in an electrically noisy
132
environment, or higher baud rates up to 230400 can be used if
133
38400 does not provide sufficient throughput.
134
        
135
      
136
      
137
        CYGNUM_DEVS_SERIAL_MCFxxxx_SERIAL0_BUFSIZE
138
        
139
The serial driver will maintain software buffers for incoming and
140
outgoing data. The former allows data to continue to arrive even if
141
the application is still busy processing the previous transfer, and
142
thus potentially improves throughput. The latter allows the
143
application to transmit data without immediately blocking until the
144
transfer is complete, often eliminating the need for a separate
145
thread. The size of these buffers can be controlled via this
146
configuration option, or alternatively these buffers can be disabled
147
completely to save memory.
148
        
149
      
150
    
151
    
152
There are additional options in the generic serial I/O package
153
CYGPKG_IO_SERIAL which will affect this driver. For
154
example CYGPKG_IO_SERIAL_FLOW_CONTROL and its
155
sub-options determine what flow control mechanism (if any) should be
156
used.
157
    
158
    
159
This package also defines some configuration options related to
160
testing. Usually these options are of no interest to application
161
developers and can be ignored.
162
    
163
  
164
 
165
  Porting
166
    
167
The generic driver needs some information from other packages about
168
the exact hardware, for example how many UARTs are available and where
169
in memory they can be accessed.
170
    
171
    
172
      
173
Another package, usually the processor HAL, should provide one or more
174
options CYGHWR_HAL_M68K_MCFxxxx_UART0,
175
CYGHWR_HAL_M68K_MCFxxxx_UART1 or
176
CYGHWR_HAL_M68K_MCFxxxx_UART2. These may be
177
calculated or user-configurable depending on the processor.
178
      
179
      
180
The device driver will also look for symbol definitions
181
CYGHWR_HAL_M68K_MCFxxxx_UART0_RTS and
182
CYGHWR_HAL_M68K_MCFxxxx_UART0_CTS, and the
183
equivalents for the other UARTs, to determine whether or not these
184
handshake lines are connected. These may be configuration options or
185
they may be statically defined in a HAL I/O header file. The platform
186
HAL should also implement the generic serial package's interface
187
CYGINT_IO_SERIAL_FLOW_CONTROL_HW if appropriate.
188
      
189
      
190
If RTS is connected then the driver will also look for a symbol
191
CYGHWR_HAL_M68K_MCFxxxx_UART0_RS485_RTS. This
192
enables partial support for RS485 communication in that the device
193
driver will arrange for the RTS line to be asserted during a transmit.
194
The driver has no support for more advanced RS485 functionality such
195
as multidrop.
196
      
197
    
198
    
199
In addition the driver assumes the standard MCFxxxx HAL macros are
200
defined for the UART base addresses and the registers. The driver
201
primarily targets MCF5282-compatible UARTs but there is also some
202
support for functionality available on other members of the Coldfire
203
range, for example the MCF5272's fractional baud rate support.
204
    
205
  
206
 
207
208

powered by: WebSVN 2.1.0

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