]> rtime.felk.cvut.cz Git - rtems-devel.git/blob - rtems-patches/current/rtems-clone-mrm332-to-mo376.patch
Update of the build and patches to rtems-4.7.1
[rtems-devel.git] / rtems-patches / current / rtems-clone-mrm332-to-mo376.patch
1 ---
2  c/src/lib/libbsp/m68k/mo376/ChangeLog                     |  455 +++
3  c/src/lib/libbsp/m68k/mo376/Makefile.am                   |   68 
4  c/src/lib/libbsp/m68k/mo376/README                        |   24 
5  c/src/lib/libbsp/m68k/mo376/bsp_specs                     |   16 
6  c/src/lib/libbsp/m68k/mo376/clock/ckinit.c                |  128 +
7  c/src/lib/libbsp/m68k/mo376/configure.ac                  |   20 
8  c/src/lib/libbsp/m68k/mo376/console/console.c             |  174 +
9  c/src/lib/libbsp/m68k/mo376/console/sci.c                 | 1596 ++++++++++++++
10  c/src/lib/libbsp/m68k/mo376/console/sci.h                 |  234 ++
11  c/src/lib/libbsp/m68k/mo376/include/bsp.h                 |  139 +
12  c/src/lib/libbsp/m68k/mo376/include/bspopts.h.in          |   16 
13  c/src/lib/libbsp/m68k/mo376/include/mrm332.h              |   70 
14  c/src/lib/libbsp/m68k/mo376/include/tm27.h                |   34 
15  c/src/lib/libbsp/m68k/mo376/misc/dotests                  |   15 
16  c/src/lib/libbsp/m68k/mo376/misc/gdbinit68                |   16 
17  c/src/lib/libbsp/m68k/mo376/misc/interr.c                 |   99 
18  c/src/lib/libbsp/m68k/mo376/preinstall.am                 |   66 
19  c/src/lib/libbsp/m68k/mo376/spurious/spinit.c             |  105 
20  c/src/lib/libbsp/m68k/mo376/start/start.S                 |  150 +
21  c/src/lib/libbsp/m68k/mo376/startup/bspclean.c            |   27 
22  c/src/lib/libbsp/m68k/mo376/startup/bspstart.c            |   82 
23  c/src/lib/libbsp/m68k/mo376/startup/except_vect_332_ROM.S |  293 ++
24  c/src/lib/libbsp/m68k/mo376/startup/linkcmds              |  164 +
25  c/src/lib/libbsp/m68k/mo376/startup/linkcmds_ROM          |  200 +
26  c/src/lib/libbsp/m68k/mo376/startup/start_c.c             |  125 +
27  c/src/lib/libbsp/m68k/mo376/timer/timer.c                 |   81 
28  c/src/lib/libbsp/m68k/mo376/times                         |  195 +
29  make/custom/mo376.cfg                                     |   67 
30  28 files changed, 4659 insertions(+)
31
32 Index: rtems/make/custom/mo376.cfg
33 ===================================================================
34 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
35 +++ rtems/make/custom/mo376.cfg 2007-08-14 17:20:30.000000000 +0200
36 @@ -0,0 +1,67 @@
37 +#
38 +#  Config file for the mrm332 BSP
39 +#
40 +#  $Id: mrm332.cfg,v 1.9.2.3 2007/01/18 11:27:07 ralf Exp $
41 +#
42 +
43 +include $(RTEMS_ROOT)/make/custom/default.cfg
44 +
45 +RTEMS_CPU=m68k
46 +RTEMS_CPU_MODEL=m68332
47 +
48 +# This is the actual bsp directory used during the build process.
49 +RTEMS_BSP_FAMILY=mrm332
50 +
51 +#  This contains the compiler options necessary to select the CPU model
52 +#  and (hopefully) optimize for it. 
53 +CPU_CFLAGS = -mcpu32
54 +
55 +# optimize flag: typically -O2
56 +CFLAGS_OPTIMIZE_V = -O2 -g -fomit-frame-pointer
57 +
58 +# The following are definitions of make-exe which will work using ld as
59 +# is currently required.
60 +
61 +ifeq ($(MRM_IN_ROM),yes)
62 +# Build a rommable image - move the .data section after the .text section
63 +# in the image.
64 +CPU_CFLAGS += -qnolinkcmds -T $(exec_prefix)/mrm332/lib/linkcmds_ROM
65 +
66 +#  This is a good way to get debug information.  The output file is large
67 +#  though and greatly slows the build process so only do this if needed.
68 +#      $(OBJDUMP) -dxC $(basename $@).nxe > $(basename $@).dump
69 +
70 +define make-exe
71 +       $(LINK.c) $(AM_CFLAGS) $(AM_LDFLAGS) -o $(basename $@).pxe \
72 +           $(LINK_OBJS) $(LINK_LIBS)
73 +       $(OBJCOPY) --adjust-section-vma \
74 +         .data=`m68k-rtems-objdump --section-headers $(basename $@).pxe | \
75 +         awk 'function h2d(x) { x=toupper(x); digits=length(x); s=0 ; \
76 +              for (p=digits; p>0; p--) \
77 +              s += (16^(p-1)) * ( index("0123456789ABCDEF",\
78 +               substr(x,1+digits-p,1)) -1 );\
79 +               return s } ;\
80 +               /\.text/ { base = $$4 ; size = $$3 };\
81 +               END { printf("0x%x", h2d(base) + h2d(size)) }'\
82 +              ` $(basename $@).pxe $(basename $@).nxe
83 +       $(OBJCOPY) -O srec $(basename $@).nxe $(basename $@).srec
84 +       sed -e 's/.$$//' -e '/^S0/d' $(basename $@).srec | \
85 +           $(PACKHEX) > $(basename $@).exe
86 +       $(NM) -g -n $(basename $@).pxe > $(basename $@).pnum
87 +       $(NM) -g -n $(basename $@).nxe > $(basename $@).num
88 +       $(SIZE) $(basename $@).nxe
89 +endef
90 +else
91 +define make-exe
92 +       $(LINK.c) $(AM_CFLAGS) $(AM_LDFLAGS) -o $(basename $@).nxe \
93 +           $(LINK_OBJS) $(LINK_LIBS)
94 +       $(OBJCOPY) -O srec $(basename $@).nxe $(basename $@).srec
95 +#      m68k-rtems-objdump -dxC $(basename $@).nxe > $(basename $@).dump
96 +       sed -e 's/.$$//' -e '/^S0/d' $(basename $@).srec | \
97 +           $(PACKHEX) > $(basename $@).exe
98 +       $(NM) -g -n $(basename $@).nxe > $(basename $@).num
99 +       $(SIZE) $(basename $@).nxe
100 +endef
101 +endif
102 +
103 +# Miscellaneous additions go here
104 Index: rtems/c/src/lib/libbsp/m68k/mo376/console/sci.h
105 ===================================================================
106 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
107 +++ rtems/c/src/lib/libbsp/m68k/mo376/console/sci.h     2007-08-14 17:20:30.000000000 +0200
108 @@ -0,0 +1,234 @@
109 +/****************************************************************************
110 +* File:     sci.h
111 +*
112 +* Desc:     This is the include file for the serial communications interface.
113 +*
114 +* Note:     See bsp.h,confdefs.h,system.h for installing drivers into RTEMS.
115 +*
116 +* $Id: sci.h,v 1.5 2006/09/11 21:43:55 joel Exp $
117 +****************************************************************************/
118 +
119 +#ifndef _sci_h_
120 +#define _sci_h_
121 +
122 +/*******************************************************************************
123 +  IOCTL commands for the sci driver.
124 +  I'm still working on these...
125 +*******************************************************************************/
126 +
127 +#define SCI_IOCTL_PARITY_NONE           0x00    /* no parity bit after the data bits */
128 +#define SCI_IOCTL_PARITY_ODD            0x01    /* parity bit added after data bits */
129 +#define SCI_IOCTL_PARITY_EVEN           0x02    /* parity bit added after data bits */
130 +#define SCI_IOCTL_PARITY_MARK           0x03    /* parity bit is lo, -12 volts, logical 1 */
131 +#define SCI_IOCTL_PARITY_SPACE          0x04    /* parity bit is hi, +12 volts, logical 0 */
132 +#define SCI_IOCTL_PARITY_FORCED_ON      0x03    /* parity bit is forced hi or lo */
133 +#define SCI_IOCTL_PARITY_FORCED_OFF     0x04    /* parity bit is forced hi or lo */
134 +
135 +#define SCI_IOCTL_BAUD_RATE             0x20    /* set the baud rate, arg is baud */
136 +
137 +#define SCI_IOCTL_DATA_BITS             0x30    /* set the data bits, arg is # bits */
138 +
139 +#define SCI_IOCTL_STOP_BITS_1           0x40    /* 1 stop bit after char frame */
140 +#define SCI_IOCTL_STOP_BITS_2           0x41    /* 2 stop bit after char frame */
141 +
142 +#define SCI_IOCTL_MODE_NORMAL           0x50    /* normal operating mode */
143 +#define SCI_IOCTL_MODE_LOOP             0x51    /* internal loopback mode */
144 +
145 +#define SCI_IOCTL_FLOW_NONE             0x60    /* no flow control */
146 +#define SCI_IOCTL_FLOW_RTS_CTS          0x61    /* hardware flow control */
147 +
148 +#define SCI_IOCTL_SEND_BREAK            0x70    /* send an rs-232 break */
149 +
150 +#define SCI_IOCTL_MODE_1200             0x80    /* 1200,n,8,1 download mode */
151 +#define SCI_IOCTL_MODE_9600             0x81    /* 9600,n,8,1 download mode */
152 +#define SCI_IOCTL_MODE_9_BIT            0x82    /* 9600,forced,8,1 command mode */
153 +\f
154 +
155 +/*******************************************************************************
156 +  SCI Registers
157 +*******************************************************************************/
158 +
159 +/* SCI Control Register 0  (SCCR0)  $FFFC08
160 +
161 +    8 4 2 1 - 8 4 2 1 - 8 4 2 1 - 8 4 2 1
162 +    ^ ^ ^ ^   ^ ^ ^ ^   ^ ^ ^ ^   ^ ^ ^ ^
163 +    | | | |   | | | |   | | | |   | | | |
164 +    | | | |   | | | |   | | | |   | | | +-----   0 baud rate divisor
165 +    | | | |   | | | |   | | | |   | | +-------   1 baud rate divisor
166 +    | | | |   | | | |   | | | |   | +---------   2 baud rate divisor
167 +    | | | |   | | | |   | | | |   +-----------   3 baud rate divisor
168 +    | | | |   | | | |   | | | |
169 +    | | | |   | | | |   | | | +---------------   4 baud rate divisor
170 +    | | | |   | | | |   | | +-----------------   5 baud rate divisor
171 +    | | | |   | | | |   | +-------------------   6 baud rate divisor
172 +    | | | |   | | | |   +---------------------   7 baud rate divisor
173 +    | | | |   | | | |
174 +    | | | |   | | | +-------------------------   8 baud rate divisor
175 +    | | | |   | | +---------------------------   9 baud rate divisor
176 +    | | | |   | +-----------------------------  10 baud rate divisor
177 +    | | | |   +-------------------------------  11 baud rate divisor
178 +    | | | |
179 +    | | | +-----------------------------------  12 baud rate divisor
180 +    | | +-------------------------------------  13 unused
181 +    | +---------------------------------------  14 unused
182 +    +-----------------------------------------  15 unused
183 +
184 +    0 0 0 0 - 0 0 0 0 - 0 0 0 0 - 0 1 0 0       reset value - (64k baud?)
185 + */
186 +
187 +#define SCI_BAUD_57_6K            9
188 +#define SCI_BAUD_38_4K           14
189 +#define SCI_BAUD_19_2K           27
190 +#define SCI_BAUD_9600            55
191 +#define SCI_BAUD_4800           109
192 +#define SCI_BAUD_2400           218
193 +#define SCI_BAUD_1200           437
194 +\f
195 +
196 +/*  SCI Control Register 1  (SCCR1)  $FFFC0A
197 +
198 +    8 4 2 1 - 8 4 2 1 - 8 4 2 1 - 8 4 2 1
199 +    ^ ^ ^ ^   ^ ^ ^ ^   ^ ^ ^ ^   ^ ^ ^ ^
200 +    | | | |   | | | |   | | | |   | | | |
201 +    | | | |   | | | |   | | | |   | | | +-----   0 send a break
202 +    | | | |   | | | |   | | | |   | | +-------   1 rcvr wakeup mode
203 +    | | | |   | | | |   | | | |   | +---------   2 rcvr enable
204 +    | | | |   | | | |   | | | |   +-----------   3 xmtr enable
205 +    | | | |   | | | |   | | | |
206 +    | | | |   | | | |   | | | +---------------   4 idle line intr enable
207 +    | | | |   | | | |   | | +-----------------   5 rcvr intr enable
208 +    | | | |   | | | |   | +-------------------   6 xmit complete intr enable
209 +    | | | |   | | | |   +---------------------   7 xmtr intr enable
210 +    | | | |   | | | |
211 +    | | | |   | | | +-------------------------   8 wakeup on address mark
212 +    | | | |   | | +---------------------------   9 mode 1=9 bits, 0=8 bits
213 +    | | | |   | +-----------------------------  10 parity enable 1=on, 0=off
214 +    | | | |   +-------------------------------  11 parity type 1=odd, 0=even
215 +    | | | |
216 +    | | | +-----------------------------------  12 idle line select
217 +    | | +-------------------------------------  13 wired-or mode
218 +    | +---------------------------------------  14 loop mode
219 +    +-----------------------------------------  15 unused
220 +  
221 +    0 0 0 0 - 0 0 0 0 - 0 0 0 0 - 0 0 0 0       reset value
222 +*/
223 +
224 +#define SCI_SEND_BREAK          0x0001          /* 0000-0000-0000-0001 */
225 +#define SCI_RCVR_WAKEUP         0x0002          /* 0000-0000-0000-0010 */
226 +#define SCI_ENABLE_RCVR         0x0004          /* 0000-0000-0000-0100 */
227 +#define SCI_ENABLE_XMTR         0x0008          /* 0000-0000-0000-1000 */
228 +
229 +#define SCI_DISABLE_RCVR        0xFFFB          /* 1111-1111-1111-1011 */
230 +#define SCI_DISABLE_XMTR        0xFFF7          /* 1111-1111-1111-0111 */
231 +
232 +#define SCI_ENABLE_INT_IDLE     0x0010          /* 0000-0000-0001-0000 */
233 +#define SCI_ENABLE_INT_RX       0x0020          /* 0000-0000-0010-0000 */
234 +#define SCI_ENABLE_INT_TX_DONE  0x0040          /* 0000-0000-0100-0000 */
235 +#define SCI_ENABLE_INT_TX       0x0080          /* 0000-0000-1000-0000 */
236 +
237 +#define SCI_DISABLE_INT_ALL     0xFF00          /* 1111-1111-0000-0000 ??? */
238 +
239 +#define SCI_DISABLE_INT_RX      0xFFDF          /* 1111-1111-1101-1111 */
240 +#define SCI_CLEAR_RX_INT        0xFFBF          /* 1111-1111-1011-1111 */
241 +#define SCI_DISABLE_INT_TX      0xFF7F          /* 1111-1111-0111-1111 */
242 +#define SCI_CLEAR_TDRE          0xFEFF          /* 1111-1110-1111-1111 */
243 +
244 +#define SCI_RCVR_WAKE_ON_MARK   0x0100          /* 0000-0001-0000-0000 */
245 +#define SCI_9_DATA_BITS         0x0200          /* 0000-0010-0000-0000 */
246 +#define SCI_PARITY_ENABLE       0x0400          /* 0000-0100-0000-0000 */
247 +#define SCI_PARITY_ODD          0x0800          /* 0000-1000-0000-0000 */
248 +
249 +#define SCI_RCVR_WAKE_ON_IDLE   0xFEFF          /* 1111-1110-1111-1111 */
250 +#define SCI_8_DATA_BITS         0xFDFF          /* 1111-1101-1111-1111 */
251 +#define SCI_PARITY_DISABLE      0xFBFF          /* 1111-1011-1111-1111 */
252 +#define SCI_PARITY_EVEN         0xF7FF          /* 1111-0111-1111-1111 */
253 +
254 +#define SCI_PARITY_NONE         0xF3FF          /* 1111-0011-1111-1111 */
255 +
256 +#define SCI_IDLE_LINE_LONG      0x1000          /* 0001-0000-0000-0000 */
257 +#define SCI_TXD_OPEN_DRAIN      0x2000          /* 0010-0000-0000-0000 */
258 +#define SCI_LOOPBACK_MODE       0x4000          /* 0100-0000-0000-0000 */
259 +#define SCI_SCCR1_UNUSED        0x8000          /* 1000-0000-0000-0000 */
260 +\f
261 +
262 +/*  SCI Status Register  (SCSR)  $FFFC0C
263 +
264 +    8 4 2 1 - 8 4 2 1 - 8 4 2 1 - 8 4 2 1
265 +    ^ ^ ^ ^   ^ ^ ^ ^   ^ ^ ^ ^   ^ ^ ^ ^
266 +    | | | |   | | | |   | | | |   | | | |
267 +    | | | |   | | | |   | | | |   | | | +-----   0 PF - parity error
268 +    | | | |   | | | |   | | | |   | | +-------   1 FE - framing error
269 +    | | | |   | | | |   | | | |   | +---------   2 NF - noise flag
270 +    | | | |   | | | |   | | | |   +-----------   3 OR - overrun flag
271 +    | | | |   | | | |   | | | |
272 +    | | | |   | | | |   | | | +---------------   4 IDLE - idle line detected
273 +    | | | |   | | | |   | | +-----------------   5 RAF  - rcvr active flag
274 +    | | | |   | | | |   | +-------------------   6 RDRF - rcv data reg full
275 +    | | | |   | | | |   +---------------------   7 TC   - xmt complete flag
276 +    | | | |   | | | |
277 +    | | | |   | | | +-------------------------   8 TDRE - xmt data reg empty
278 +    | | | |   | | +---------------------------   9 always zero
279 +    | | | |   | +-----------------------------  10 always zero
280 +    | | | |   +-------------------------------  11 always zero
281 +    | | | |
282 +    | | | +-----------------------------------  12 always zero
283 +    | | +-------------------------------------  13 always zero
284 +    | +---------------------------------------  14 always zero
285 +    +-----------------------------------------  15 always zero
286 +  
287 +    0 0 0 0 - 0 0 0 1 - 1 0 0 0 - 0 0 0 0       reset value
288 +*/
289 +
290 +#define SCI_ERROR_PARITY        0x0001          /* 0000-0000-0000-0001 */
291 +#define SCI_ERROR_FRAMING       0x0002          /* 0000-0000-0000-0010 */
292 +#define SCI_ERROR_NOISE         0x0004          /* 0000-0000-0000-0100 */
293 +#define SCI_ERROR_OVERRUN       0x0008          /* 0000-0000-0000-1000 */
294 +
295 +#define SCI_IDLE_LINE           0x0010          /* 0000-0000-0001-0000 */
296 +#define SCI_RCVR_ACTIVE         0x0020          /* 0000-0000-0010-0000 */
297 +#define SCI_RCVR_READY          0x0040          /* 0000-0000-0100-0000 */
298 +#define SCI_XMTR_IDLE           0x0080          /* 0000-0000-1000-0000 */
299 +
300 +#define SCI_CLEAR_RX_INT        0xFFBF          /* 1111-1111-1011-1111 */
301 +
302 +#define SCI_XMTR_READY          0x0100          /* 0000-0001-0000-0000 */
303 +
304 +#define SCI_CLEAR_TDRE          0xFEFF          /* 1111-1110-1111-1111 */
305 +
306 +#define SCI_XMTR_AVAILABLE      0x0180          /* 0000-0001-1000-0000 */
307 +
308 +\f
309 +
310 +/*******************************************************************************
311 +  Function prototypes
312 +*******************************************************************************/
313 +
314 +#ifdef __cplusplus
315 +extern "C" {
316 +#endif
317 +
318 +/* look at console_open to see how this is called */
319 +
320 +const rtems_termios_callbacks * SciGetTermiosHandlers( int32_t   polled );
321 +
322 +/* SCI interrupt */
323 +
324 +/*rtems_isr SciIsr( rtems_vector_number vector ); */
325 +
326 +/*int32_t   SciOpenPolled    ( int32_t   major, int32_t   minor, void *arg ); */
327 +/*int32_t   SciOpenInterrupt ( int32_t   major, int32_t   minor, void *arg ); */
328 +
329 +/*int32_t   SciClose         ( int32_t   major, int32_t   minor, void *arg ); */
330 +
331 +/*int32_t   SciWritePolled   ( int32_t   minor, const char *buf, int32_t   len ); */
332 +/*int32_t   SciWriteInterrupt( int32_t   minor, const char *buf, int32_t   len ); */
333 +
334 +/*int32_t   SciReadPolled    ( int32_t   minor ); */
335 +
336 +/*int32_t   SciSetAttributes ( int32_t   minor, const struct termios *t ); */
337 +
338 +#ifdef __cplusplus
339 +}
340 +#endif
341 +
342 +#endif  /* _sci_h_ */
343 Index: rtems/c/src/lib/libbsp/m68k/mo376/startup/linkcmds_ROM
344 ===================================================================
345 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
346 +++ rtems/c/src/lib/libbsp/m68k/mo376/startup/linkcmds_ROM      2007-08-14 17:20:30.000000000 +0200
347 @@ -0,0 +1,200 @@
348 +/*  linkcmds
349 + *
350 + *  $Id: linkcmds_ROM,v 1.4 2006/02/08 12:25:24 joel Exp $
351 + */
352 +
353 +OUTPUT_ARCH(m68k)
354 +STARTUP(except_vect_332_ROM.o)
355 +__DYNAMIC  =  0;
356 +
357 +/*
358 + * ROM:
359 + * +--------------------+ <- low memory
360 + * | .text              |
361 + * |        etext       |
362 + * |        ctor list   | the ctor and dtor lists are for
363 + * |        dtor list   | C++ support
364 + * |        _endtext    |
365 + * | temporary .data    | .data is moved to RAM by crt0
366 + * |                    |
367 + * +--------------------+ <- high memory
368 + *
369 + *
370 + * RAM:
371 + * +--------------------+ <- low memory
372 + * | .data              | initialized data goes here
373 + * |        _sdata      |
374 + * |        _edata      |
375 + * +--------------------+
376 + * | .bss               |
377 + * |        __bss_start | start of bss, cleared by crt0
378 + * |        _end        | start of heap, used by sbrk()
379 + * +--------------------+
380 + * |    heap space      |
381 + * |        _ENDHEAP    |
382 + * |    stack space     | 
383 + * |        __stack     | top of stack
384 + * +--------------------+ <- high memory
385 + */
386 +
387 +MEMORY
388 +{
389 +  rom     : ORIGIN = 0x90000, LENGTH = 0x70000
390 +  ram     : ORIGIN = 0x03000, LENGTH = 0x7d000
391 +}
392 +
393 +_RamBase = DEFINED(_RamBase) ? _RamBase : 0x003000;
394 +_RamSize = DEFINED(_RamSize) ? _RamSize : 0x7d000;
395 +_RamEnd = _RamBase + _RamSize;
396 +
397 +__end_of_ram = 0x080000;
398 +_copy_data_from_rom = 1;
399 +_HeapSize = DEFINED(_HeapSize) ? _HeapSize : 0x10000;
400 +_StackSize = DEFINED(_StackSize) ? _StackSize : 0x2000;
401 +
402 +/*
403 + * 
404 + */
405 +SECTIONS
406 +{
407 +  .text :
408 +  {
409 +    . = .;
410 +    CREATE_OBJECT_SYMBOLS
411 +    text_start = .;
412 +    _text_start = .;
413 +    *(.text*)
414 +    . = ALIGN (16);
415 +
416 +
417 +    /*
418 +     * Initialization and finalization code.
419 +     *
420 +     * Various files can provide initialization and finalization
421 +     * functions.  crtbegin.o and crtend.o are two instances. The
422 +     * body of these functions are in .init and .fini sections. We
423 +     * accumulate the bodies here, and prepend function prologues
424 +     * from crti.o and function epilogues from crtn.o. crti.o must
425 +     * be linked first; crtn.o must be linked last.  Because these
426 +     * are wildcards, it doesn't matter if the user does not
427 +     * actually link against crti.o and crtn.o; the linker won't
428 +     * look for a file to match a wildcard.  The wildcard also
429 +     * means that it doesn't matter which directory crti.o and
430 +     * crtn.o are in. 
431 +     */
432 +    PROVIDE (_init = .);
433 +    *crti.o(.init)
434 +    *(.init)
435 +    *crtn.o(.init)
436 +    PROVIDE (_fini = .);
437 +    *crti.o(.fini)
438 +    *(.fini)
439 +    *crtn.o(.fini)
440 +
441 +    /*
442 +     * Special FreeBSD sysctl sections.
443 +     */
444 +    . = ALIGN (16);
445 +    __start_set_sysctl_set = .;
446 +    *(set_sysctl_*);
447 +    __stop_set_sysctl_set = ABSOLUTE(.);
448 +    *(set_domain_*);
449 +    *(set_pseudo_*);
450 +
451 +    /*
452 +     * C++ constructors/destructors
453 +     *
454 +     * gcc uses crtbegin.o to find the start of the constructors
455 +     * and destructors so we make sure it is first.  Because this
456 +     * is a wildcard, it doesn't matter if the user does not
457 +     * actually link against crtbegin.o; the linker won't look for
458 +     * a file to match a wildcard.  The wildcard also means that
459 +     * it doesn't matter which directory crtbegin.o is in. The
460 +     * constructor and destructor list are terminated in
461 +     * crtend.o.  The same comments apply to it.
462 +     */
463 +    . = ALIGN (16);
464 +    *crtbegin.o(.ctors)
465 +    *(.ctors)
466 +    *crtend.o(.ctors)
467 +    *crtbegin.o(.dtors)
468 +    *(.dtors)
469 +    *crtend.o(.dtors)
470 +
471 +    *(.eh_frame)
472 +    . = ALIGN (16);
473 +
474 +    /*
475 +     * Read-only data
476 +     */
477 +    . = ALIGN (16);
478 +    _rodata_start = . ;
479 +    *(.rodata*)
480 +    *(.gnu.linkonce.r*)
481 +
482 +    etext = ALIGN(0x10);
483 +    __CTOR_LIST__ = .;
484 +    LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2)
485 +    *(.ctors)
486 +    LONG(0)
487 +    __CTOR_END__ = .;
488 +    __DTOR_LIST__ = .;
489 +    LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2)
490 +    *(.dtors)
491 +    LONG(0)
492 +    __DTOR_END__ = .;
493 +    *(.lit)
494 +    *(.shdata)
495 +    _etext = .;
496 +    _endtext = .;
497 +  } > rom
498 +  .gcc_exc :
499 +  AT ( ADDR(.text) + SIZEOF( .text ) )
500 +  {
501 +    *(.gcc_exc)
502 +  } > ram
503 +  .data :
504 +  {
505 +    data_start = .;
506 +    _data_start = .;
507 +    _copy_start = .;
508 +    _sdata = . ;
509 +    *(.data)
510 +    *(.gnu.linkonce.d*)
511 +    *(.gcc_except_table)
512 +    *(.jcr)
513 +
514 +    CONSTRUCTORS
515 +    edata = ALIGN(0x10);
516 +    _edata = .;
517 +  } > ram
518 +  .shbss :
519 +  {
520 +    *(.shbss)
521 +  } > ram
522 +  .bss :
523 +  {
524 +    __bss_start = ALIGN(0x8);
525 +    bss_start = .;
526 +    _bss_start = .;
527 +    _clear_start = .;
528 +    *(.shbss)
529 +    *(.dynbss)
530 +    *(.bss* .gnu.linkonce.b.*)
531 +    *(COMMON)
532 +    . = ALIGN (16);
533 +    end = .;
534 +    _end = ALIGN(0x8);
535 +    __end = ALIGN(0x8);
536 +
537 +    _WorkspaceBase = . + _StackSize;
538 +  } > ram
539 +  .stab . (NOLOAD) :
540 +  {
541 +    [ .stab ]
542 +  }
543 +  .stabstr . (NOLOAD) :
544 +  {
545 +    [ .stabstr ]
546 +  }
547 +}
548 Index: rtems/c/src/lib/libbsp/m68k/mo376/startup/except_vect_332_ROM.S
549 ===================================================================
550 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
551 +++ rtems/c/src/lib/libbsp/m68k/mo376/startup/except_vect_332_ROM.S     2007-08-14 17:20:30.000000000 +0200
552 @@ -0,0 +1,293 @@
553 +/*
554 + *  $Id: except_vect_332_ROM.S,v 1.3 2004/04/21 16:01:35 ralf Exp $
555 + */
556 +
557 +/* Exception Vector definitions follow */
558 +
559 +       /* !!! Warning !!! This table is not tested, and
560 +          the user must make sure it is complete. */
561 +
562 +       /* If we use TRAP #15 for reboot, note that group 0 and 1 exceptions
563 +          will have priority. */
564 +
565 +       /* This is the "magic word" that CPU32bug uses to indicate that
566 +          there is a bootable image here. */
567 +       .long   0xBEEFBEEF
568 +
569 +       /* Vector 0:    RESET:  Initial SSP */
570 +       .long   _RamEnd
571 +       /* Vector 1:    RESET:  Initial PC */
572 +       .long   start
573 +
574 +       /* default action for undefined vectors is to re-boot */
575 +
576 +       /* Note group 0 and 1 exception (like trace) have priority
577 +          over other exceptions (like trap #15) that may call this. */
578 +
579 +       /* Vectors 2-255 */
580 +       .long reboot   /* exception vector:   2 */
581 +       .long reboot   /* exception vector:   3 */
582 +       .long reboot   /* exception vector:   4 */
583 +       .long reboot   /* exception vector:   5 */
584 +       .long reboot   /* exception vector:   6 */
585 +       .long reboot   /* exception vector:   7 */
586 +       .long reboot   /* exception vector:   8 */
587 +       .long reboot   /* exception vector:   9 */
588 +       .long reboot   /* exception vector:  10 */
589 +       .long reboot   /* exception vector:  11 */
590 +       .long reboot   /* exception vector:  12 */
591 +       .long reboot   /* exception vector:  13 */
592 +       .long reboot   /* exception vector:  14 */
593 +       .long reboot   /* exception vector:  15 */
594 +       .long reboot   /* exception vector:  16 */
595 +       .long reboot   /* exception vector:  17 */
596 +       .long reboot   /* exception vector:  18 */
597 +       .long reboot   /* exception vector:  19 */
598 +       .long reboot   /* exception vector:  20 */
599 +       .long reboot   /* exception vector:  21 */
600 +       .long reboot   /* exception vector:  22 */
601 +       .long reboot   /* exception vector:  23 */
602 +       .long reboot   /* exception vector:  24 */
603 +       .long reboot   /* exception vector:  25 */
604 +       .long reboot   /* exception vector:  26 */
605 +       .long reboot   /* exception vector:  27 */
606 +       .long reboot   /* exception vector:  28 */
607 +       .long reboot   /* exception vector:  29 */
608 +       .long reboot   /* exception vector:  30 */
609 +       .long reboot   /* exception vector:  31 */
610 +       .long reboot   /* exception vector:  32 */
611 +       .long reboot   /* exception vector:  33 */
612 +       .long reboot   /* exception vector:  34 */
613 +       .long reboot   /* exception vector:  35 */
614 +       .long reboot   /* exception vector:  36 */
615 +       .long reboot   /* exception vector:  37 */
616 +       .long reboot   /* exception vector:  38 */
617 +       .long reboot   /* exception vector:  39 */
618 +       .long reboot   /* exception vector:  40 */
619 +       .long reboot   /* exception vector:  41 */
620 +       .long reboot   /* exception vector:  42 */
621 +       .long reboot   /* exception vector:  43 */
622 +       .long reboot   /* exception vector:  44 */
623 +       .long reboot   /* exception vector:  45 */
624 +       .long reboot   /* exception vector:  46 */
625 +       .long _reboot  /* the reboot trap:   47 */
626 +       .long reboot   /* exception vector:  48 */
627 +       .long reboot   /* exception vector:  49 */
628 +       .long reboot   /* exception vector:  50 */
629 +       .long reboot   /* exception vector:  51 */
630 +       .long reboot   /* exception vector:  52 */
631 +       .long reboot   /* exception vector:  53 */
632 +       .long reboot   /* exception vector:  54 */
633 +       .long reboot   /* exception vector:  55 */
634 +       .long reboot   /* exception vector:  56 */
635 +       .long reboot   /* exception vector:  57 */
636 +       .long reboot   /* exception vector:  58 */
637 +       .long reboot   /* exception vector:  59 */
638 +       .long reboot   /* exception vector:  60 */
639 +       .long reboot   /* exception vector:  61 */
640 +       .long reboot   /* exception vector:  62 */
641 +       .long reboot   /* exception vector:  63 */
642 +       .long reboot   /* exception vector:  64 */
643 +       .long reboot   /* exception vector:  65 */
644 +       .long reboot   /* exception vector:  66 */
645 +       .long reboot   /* exception vector:  67 */
646 +       .long reboot   /* exception vector:  68 */
647 +       .long reboot   /* exception vector:  69 */
648 +       .long reboot   /* exception vector:  70 */
649 +       .long reboot   /* exception vector:  71 */
650 +       .long reboot   /* exception vector:  72 */
651 +       .long reboot   /* exception vector:  73 */
652 +       .long reboot   /* exception vector:  74 */
653 +       .long reboot   /* exception vector:  75 */
654 +       .long reboot   /* exception vector:  76 */
655 +       .long reboot   /* exception vector:  77 */
656 +       .long reboot   /* exception vector:  78 */
657 +       .long reboot   /* exception vector:  79 */
658 +       .long reboot   /* exception vector:  80 */
659 +       .long reboot   /* exception vector:  81 */
660 +       .long reboot   /* exception vector:  82 */
661 +       .long reboot   /* exception vector:  83 */
662 +       .long reboot   /* exception vector:  84 */
663 +       .long reboot   /* exception vector:  85 */
664 +       .long reboot   /* exception vector:  86 */
665 +       .long reboot   /* exception vector:  87 */
666 +       .long reboot   /* exception vector:  88 */
667 +       .long reboot   /* exception vector:  89 */
668 +       .long reboot   /* exception vector:  90 */
669 +       .long reboot   /* exception vector:  91 */
670 +       .long reboot   /* exception vector:  92 */
671 +       .long reboot   /* exception vector:  93 */
672 +       .long reboot   /* exception vector:  94 */
673 +       .long reboot   /* exception vector:  95 */
674 +       .long reboot   /* exception vector:  96 */
675 +       .long reboot   /* exception vector:  97 */
676 +       .long reboot   /* exception vector:  98 */
677 +       .long reboot   /* exception vector:  99 */
678 +       .long reboot   /* exception vector: 100 */
679 +       .long reboot   /* exception vector: 101 */
680 +       .long reboot   /* exception vector: 102 */
681 +       .long reboot   /* exception vector: 103 */
682 +       .long reboot   /* exception vector: 104 */
683 +       .long reboot   /* exception vector: 105 */
684 +       .long reboot   /* exception vector: 106 */
685 +       .long reboot   /* exception vector: 107 */
686 +       .long reboot   /* exception vector: 108 */
687 +       .long reboot   /* exception vector: 109 */
688 +       .long reboot   /* exception vector: 110 */
689 +       .long reboot   /* exception vector: 111 */
690 +       .long reboot   /* exception vector: 112 */
691 +       .long reboot   /* exception vector: 113 */
692 +       .long reboot   /* exception vector: 114 */
693 +       .long reboot   /* exception vector: 115 */
694 +       .long reboot   /* exception vector: 116 */
695 +       .long reboot   /* exception vector: 117 */
696 +       .long reboot   /* exception vector: 118 */
697 +       .long reboot   /* exception vector: 119 */
698 +       .long reboot   /* exception vector: 120 */
699 +       .long reboot   /* exception vector: 121 */
700 +       .long reboot   /* exception vector: 122 */
701 +       .long reboot   /* exception vector: 123 */
702 +       .long reboot   /* exception vector: 124 */
703 +       .long reboot   /* exception vector: 125 */
704 +       .long reboot   /* exception vector: 126 */
705 +       .long reboot   /* exception vector: 127 */
706 +       .long reboot   /* exception vector: 128 */
707 +       .long reboot   /* exception vector: 129 */
708 +       .long reboot   /* exception vector: 130 */
709 +       .long reboot   /* exception vector: 131 */
710 +       .long reboot   /* exception vector: 132 */
711 +       .long reboot   /* exception vector: 133 */
712 +       .long reboot   /* exception vector: 134 */
713 +       .long reboot   /* exception vector: 135 */
714 +       .long reboot   /* exception vector: 136 */
715 +       .long reboot   /* exception vector: 137 */
716 +       .long reboot   /* exception vector: 138 */
717 +       .long reboot   /* exception vector: 139 */
718 +       .long reboot   /* exception vector: 140 */
719 +       .long reboot   /* exception vector: 141 */
720 +       .long reboot   /* exception vector: 142 */
721 +       .long reboot   /* exception vector: 143 */
722 +       .long reboot   /* exception vector: 144 */
723 +       .long reboot   /* exception vector: 145 */
724 +       .long reboot   /* exception vector: 146 */
725 +       .long reboot   /* exception vector: 147 */
726 +       .long reboot   /* exception vector: 148 */
727 +       .long reboot   /* exception vector: 149 */
728 +       .long reboot   /* exception vector: 150 */
729 +       .long reboot   /* exception vector: 151 */
730 +       .long reboot   /* exception vector: 152 */
731 +       .long reboot   /* exception vector: 153 */
732 +       .long reboot   /* exception vector: 154 */
733 +       .long reboot   /* exception vector: 155 */
734 +       .long reboot   /* exception vector: 156 */
735 +       .long reboot   /* exception vector: 157 */
736 +       .long reboot   /* exception vector: 158 */
737 +       .long reboot   /* exception vector: 159 */
738 +       .long reboot   /* exception vector: 160 */
739 +       .long reboot   /* exception vector: 161 */
740 +       .long reboot   /* exception vector: 162 */
741 +       .long reboot   /* exception vector: 163 */
742 +       .long reboot   /* exception vector: 164 */
743 +       .long reboot   /* exception vector: 165 */
744 +       .long reboot   /* exception vector: 166 */
745 +       .long reboot   /* exception vector: 167 */
746 +       .long reboot   /* exception vector: 168 */
747 +       .long reboot   /* exception vector: 169 */
748 +       .long reboot   /* exception vector: 170 */
749 +       .long reboot   /* exception vector: 171 */
750 +       .long reboot   /* exception vector: 172 */
751 +       .long reboot   /* exception vector: 173 */
752 +       .long reboot   /* exception vector: 174 */
753 +       .long reboot   /* exception vector: 175 */
754 +       .long reboot   /* exception vector: 176 */
755 +       .long reboot   /* exception vector: 177 */
756 +       .long reboot   /* exception vector: 178 */
757 +       .long reboot   /* exception vector: 179 */
758 +       .long reboot   /* exception vector: 180 */
759 +       .long reboot   /* exception vector: 181 */
760 +       .long reboot   /* exception vector: 182 */
761 +       .long reboot   /* exception vector: 183 */
762 +       .long reboot   /* exception vector: 184 */
763 +       .long reboot   /* exception vector: 185 */
764 +       .long reboot   /* exception vector: 186 */
765 +       .long reboot   /* exception vector: 187 */
766 +       .long reboot   /* exception vector: 188 */
767 +       .long reboot   /* exception vector: 189 */
768 +       .long reboot   /* exception vector: 190 */
769 +       .long reboot   /* exception vector: 191 */
770 +       .long reboot   /* exception vector: 192 */
771 +       .long reboot   /* exception vector: 193 */
772 +       .long reboot   /* exception vector: 194 */
773 +       .long reboot   /* exception vector: 195 */
774 +       .long reboot   /* exception vector: 196 */
775 +       .long reboot   /* exception vector: 197 */
776 +       .long reboot   /* exception vector: 198 */
777 +       .long reboot   /* exception vector: 199 */
778 +       .long reboot   /* exception vector: 200 */
779 +       .long reboot   /* exception vector: 201 */
780 +       .long reboot   /* exception vector: 202 */
781 +       .long reboot   /* exception vector: 203 */
782 +       .long reboot   /* exception vector: 204 */
783 +       .long reboot   /* exception vector: 205 */
784 +       .long reboot   /* exception vector: 206 */
785 +       .long reboot   /* exception vector: 207 */
786 +       .long reboot   /* exception vector: 208 */
787 +       .long reboot   /* exception vector: 209 */
788 +       .long reboot   /* exception vector: 210 */
789 +       .long reboot   /* exception vector: 211 */
790 +       .long reboot   /* exception vector: 212 */
791 +       .long reboot   /* exception vector: 213 */
792 +       .long reboot   /* exception vector: 214 */
793 +       .long reboot   /* exception vector: 215 */
794 +       .long reboot   /* exception vector: 216 */
795 +       .long reboot   /* exception vector: 217 */
796 +       .long reboot   /* exception vector: 218 */
797 +       .long reboot   /* exception vector: 219 */
798 +       .long reboot   /* exception vector: 220 */
799 +       .long reboot   /* exception vector: 221 */
800 +       .long reboot   /* exception vector: 222 */
801 +       .long reboot   /* exception vector: 223 */
802 +       .long reboot   /* exception vector: 224 */
803 +       .long reboot   /* exception vector: 225 */
804 +       .long reboot   /* exception vector: 226 */
805 +       .long reboot   /* exception vector: 227 */
806 +       .long reboot   /* exception vector: 228 */
807 +       .long reboot   /* exception vector: 229 */
808 +       .long reboot   /* exception vector: 230 */
809 +       .long reboot   /* exception vector: 231 */
810 +       .long reboot   /* exception vector: 232 */
811 +       .long reboot   /* exception vector: 233 */
812 +       .long reboot   /* exception vector: 234 */
813 +       .long reboot   /* exception vector: 235 */
814 +       .long reboot   /* exception vector: 236 */
815 +       .long reboot   /* exception vector: 237 */
816 +       .long reboot   /* exception vector: 238 */
817 +       .long reboot   /* exception vector: 239 */
818 +       .long reboot   /* exception vector: 240 */
819 +       .long reboot   /* exception vector: 241 */
820 +       .long reboot   /* exception vector: 242 */
821 +       .long reboot   /* exception vector: 243 */
822 +       .long reboot   /* exception vector: 244 */
823 +       .long reboot   /* exception vector: 245 */
824 +       .long reboot   /* exception vector: 246 */
825 +       .long reboot   /* exception vector: 247 */
826 +       .long reboot   /* exception vector: 248 */
827 +       .long reboot   /* exception vector: 249 */
828 +       .long reboot   /* exception vector: 250 */
829 +       .long reboot   /* exception vector: 251 */
830 +       .long reboot   /* exception vector: 252 */
831 +       .long reboot   /* exception vector: 253 */
832 +       .long reboot   /* exception vector: 254 */
833 +       .long reboot   /* exception vector: 255 */
834 +
835 +_reboot:
836 +       move    #0x2700,%sr     /* mask interrupts */
837 +       movea.l (0x0).w,%a7     /* load stack */
838 +       movea.l (0x4).w,%a0     /* jmp to location of reset vector */
839 +       jmp     (%a0)
840 +
841 +reboot:
842 +       trap    #15             /* use trap exception to enter supervisor
843 +                                  state. Trace mode ( and other group 0
844 +                                  and 1 exceptions) *could* screw this up if
845 +                                  not vectored to reboot or did not return. */
846 Index: rtems/c/src/lib/libbsp/m68k/mo376/console/console.c
847 ===================================================================
848 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
849 +++ rtems/c/src/lib/libbsp/m68k/mo376/console/console.c 2007-08-14 17:20:30.000000000 +0200
850 @@ -0,0 +1,174 @@
851 +/*
852 + *  This file contains the generic console driver shell used
853 + *  by all console drivers using libchip.
854 + *
855 + *  This driver uses the termios pseudo driver.
856 + *
857 + *  COPYRIGHT (c) 1989-1997.
858 + *  On-Line Applications Research Corporation (OAR).
859 + *
860 + *  The license and distribution terms for this file may be
861 + *  found in the file LICENSE in this distribution or at
862 + *  http://www.rtems.com/license/LICENSE.
863 + *
864 + *  $Id: console.c,v 1.8 2006/09/11 21:43:53 joel Exp $
865 + */
866 +
867 +#include <bsp.h>
868 +#include <rtems/libio.h>
869 +#include <termios.h>
870 +#include "sci.h"
871 +
872 +/*PAGE
873 + *
874 + *  console_open
875 + *
876 + *  open a port as a termios console.
877 + *
878 + *  the console is opened in bsp_postdriver_hook() in bsppost.c
879 + *
880 + */
881 +
882 +rtems_device_driver console_open(
883 +  rtems_device_major_number major,
884 +  rtems_device_minor_number minor,
885 +  void                    * arg
886 +)
887 +{
888 +    rtems_status_code status;
889 +
890 +    /* the console is opened three times at startup */
891 +    /* for standard input, output, and error */
892 +
893 +    /* Get correct callback structure for the device */
894 +
895 +    /* argument of FALSE gives us interrupt driven serial io */
896 +    /* argument of TRUE  gives us polling   based  serial io */
897 +
898 +    /* SCI internal uart */
899 +
900 +    status = rtems_termios_open( major, minor, arg, SciGetTermiosHandlers( TRUE ) );
901 +
902 +    return status;
903 +}
904 +
905 +/*PAGE
906 + *
907 + *  console_close
908 + *
909 + *  This routine closes a port that has been opened as console.
910 + */
911 +
912 +rtems_device_driver console_close(
913 +  rtems_device_major_number major,
914 +  rtems_device_minor_number minor,
915 +  void                    * arg
916 +)
917 +{
918 +  return rtems_termios_close (arg);
919 +}
920 +
921 +/*PAGE
922 + *
923 + *  console_read
924 + *
925 + *  This routine uses the termios driver to read a character.
926 + */
927 +
928 +rtems_device_driver console_read(
929 +  rtems_device_major_number major,
930 +  rtems_device_minor_number minor,
931 +  void                    * arg
932 +)
933 +{
934 +  return rtems_termios_read (arg);
935 +}
936 +
937 +/*PAGE
938 + *
939 + *  console_write
940 + *
941 + *  this routine uses the termios driver to write a character.
942 + */
943 +
944 +rtems_device_driver console_write(
945 +  rtems_device_major_number major,
946 +  rtems_device_minor_number minor,
947 +  void                    * arg
948 +)
949 +{
950 +  return rtems_termios_write (arg);
951 +}
952 +
953 +/*PAGE
954 + *
955 + *  console_control
956 + *
957 + *  this routine uses the termios driver to process io
958 + */
959 +
960 +rtems_device_driver console_control(
961 +  rtems_device_major_number major,
962 +  rtems_device_minor_number minor,
963 +  void                    * arg
964 +)
965 +{
966 +  return rtems_termios_ioctl (arg);
967 +}
968 +
969 +/*PAGE
970 + *
971 + *  console_initialize
972 + *
973 + *  Routine called to initialize the console device driver.
974 + */
975 +
976 +rtems_device_driver console_initialize(
977 +  rtems_device_major_number  major,
978 +  rtems_device_minor_number  minor_arg,
979 +  void                      *arg
980 +)
981 +{
982 +  rtems_status_code          status;
983 +
984 +  /*
985 +   * initialize the termio interface.
986 +   */
987 +  rtems_termios_initialize();
988 +
989 +  /*
990 +   * register the SCI device name for termios
991 +   * do this over in the sci driver init routine?
992 +   */
993 +
994 +  status = rtems_io_register_name( "/dev/sci", major, 0 );
995 +
996 +  if (status != RTEMS_SUCCESSFUL)
997 +  {
998 +    rtems_fatal_error_occurred(status);
999 +  }
1000 +
1001 +  /*
1002 +   * Link the uart device to the console device
1003 +   */
1004 +
1005 +#if 1
1006 +  status = rtems_io_register_name( "/dev/console", major, 0 );
1007 +
1008 +  if (status != RTEMS_SUCCESSFUL)
1009 +  {
1010 +    rtems_fatal_error_occurred(status);
1011 +  }
1012 +#else
1013 +  if ( link( "/dev/sci", "/dev/console") < 0 )
1014 +  {
1015 +    rtems_fatal_error_occurred( RTEMS_IO_ERROR );
1016 +  }
1017 +#endif
1018 +
1019 +  /*
1020 +   * Console Initialize Succesful
1021 +   */
1022 +
1023 +  return RTEMS_SUCCESSFUL;
1024 +}
1025 Index: rtems/c/src/lib/libbsp/m68k/mo376/start/start.S
1026 ===================================================================
1027 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
1028 +++ rtems/c/src/lib/libbsp/m68k/mo376/start/start.S     2007-08-14 17:20:30.000000000 +0200
1029 @@ -0,0 +1,150 @@
1030 +/*
1031 + *  $Id
1032 + */
1033 +
1034 +#include "mrm332.h"
1035 +#include <rtems/asm.h>
1036 +#include <rtems/m68k/sim.h>
1037 +
1038 +BEGIN_CODE
1039 +
1040 +  /* Put the header necessary for the modified CPU32bug to automatically
1041 +     start up rtems: */
1042 +#if 0
1043 +.long 0xbeefbeef ;
1044 +#endif
1045 +.long 0 ;
1046 +.long start ;
1047 +
1048 +.global start
1049 +       start:
1050 +
1051 +       oriw   #0x0700,sr
1052 +       movel  #end, d0
1053 +       addl   #_StackSize,d0
1054 +       movel  d0,sp
1055 +       movel  d0,a6
1056 +
1057 +  /* include in ram_init.S */
1058 +  /*
1059 +   * Initalize the SIM module.
1060 +   * The stack pointer is not usable until the RAM chip select lines
1061 +   * are configured. The following code must remain inline.
1062 +   */
1063 +
1064 +  /* Module Configuration Register */
1065 +  /*    see section(s) 3.1.3-3.1.6 of the SIM Reference Manual */
1066 +       lea     SIMCR, a0
1067 +       movew   #FRZSW,d0
1068 +       oriw    #SAM(0,8,SHEN),d0
1069 +       oriw    #(MM*SIM_MM),d0
1070 +       oriw    #SAM(SIM_IARB,0,IARB),d0
1071 +       movew   d0, a0@
1072 +
1073 +       jsr     start_c /* Jump to the C startup code */
1074 +
1075 +END_CODE
1076 +
1077 +#if 0
1078 +
1079 +  /* Synthesizer Control Register */
1080 +  /*    see section(s) 4.8 */
1081 +  /* end include in ram_init.S */
1082 +  *SYNCR = (unsigned short int)
1083 +    ( SAM(MRM_W,15,VCO) | SAM(0x0,14,PRESCALE) | SAM(MRM_Y,8,COUNTER) );
1084 +  while (! (*SYNCR & SLOCK));  /* protect from clock overshoot */
1085 +  /* include in ram_init.S */
1086 +  *SYNCR = (unsigned short int)
1087 +    ( SAM(MRM_W,15,VCO) | SAM(MRM_X,14,PRESCALE) | SAM(MRM_Y,8,COUNTER) );
1088 +
1089 +  /* System Protection Control Register */
1090 +  /*    !!! can only write to once after reset !!! */
1091 +  /*    see section 3.8.4 of the SIM Reference Manual */
1092 +  *SYPCR = (unsigned char)( HME | BME );
1093 +
1094 +  /* Periodic Interrupr Control Register */
1095 +  /*    see section 3.8.2 of the SIM Reference Manual */
1096 +  *PICR = (unsigned short int)
1097 +    ( SAM(0,8,PIRQL) | SAM(MRM_PIV,0,PIV) );
1098 +  /*     ^^^ zero disables interrupt, don't enable here or ram_init will
1099 +        be wrong. It's enabled below. */
1100 +
1101 +  /* Periodic Interrupt Timer Register */
1102 +  /*    see section 3.8.3 of the SIM Reference Manual */
1103 +  *PITR = (unsigned short int)( SAM(0x09,0,PITM) );
1104 +  /*    1.098mS interrupt, assuming 32.768 KHz input clock */
1105 +
1106 +  /* Port C Data */
1107 +  /*    load values before enabled */
1108 +  *PORTC = (unsigned char) 0x0;
1109 +
1110 +  /* Port E and F Data Register */
1111 +  /*    see section 9 of the SIM Reference Manual */
1112 +  *PORTE0 = (unsigned char) 0;
1113 +  *PORTF0 = (unsigned char) 0;
1114 +
1115 +  /* Port E and F Data Direction Register */
1116 +  /*    see section 9 of the SIM Reference Manual */
1117 +  *DDRE = (unsigned char) 0xff;
1118 +  *DDRF = (unsigned char) 0xfd;
1119 +
1120 +  /* Port E and F Pin Assignment Register */
1121 +  /*    see section 9 of the SIM Reference Manual */
1122 +  *PEPAR = (unsigned char) 0;
1123 +  *PFPAR = (unsigned char) 0;
1124 +
1125 +  /* end of SIM initalization code */
1126 +  /* end include in ram_init.S */
1127 +
1128 +  /*
1129 +   * Initialize RAM by copying the .data section out of ROM (if
1130 +   * needed) and "zero-ing" the .bss section.
1131 +   */
1132 +  {
1133 +    register char *src = _etext;
1134 +    register char *dst = _copy_start;
1135 +
1136 +    if (_copy_data_from_rom)
1137 +      /* ROM has data at end of text; copy it. */
1138 +      while (dst < _edata)
1139 +       *dst++ = *src++;
1140 +
1141 +    /* Zero bss */
1142 +    for (dst = _clear_start; dst< end; dst++)
1143 +      {
1144 +       *dst = 0;
1145 +      }
1146 +  }
1147 +
1148 +  /*
1149 +   * Initialize vector table.
1150 +   */
1151 +  {
1152 +    m68k_isr_entry *monitors_vector_table;
1153 +
1154 +    m68k_get_vbr(monitors_vector_table);
1155 +
1156 +    M68Kvec[  4 ] = monitors_vector_table[  4 ];   /* breakpoints vector */
1157 +    M68Kvec[  9 ] = monitors_vector_table[  9 ];   /* trace vector */
1158 +    M68Kvec[ 31 ] = monitors_vector_table[ 31 ];   /* level 7 interrupt */
1159 +    M68Kvec[ 47 ] = monitors_vector_table[ 47 ];   /* system call vector */
1160 +    M68Kvec[ 66 ] = monitors_vector_table[ 66 ];   /* user defined */
1161 +
1162 +    m68k_set_vbr(&M68Kvec);
1163 +  }
1164 +
1165 +  /*
1166 +   * Initalize the board.
1167 +   */
1168 +  Spurious_Initialize();
1169 +  console_init();
1170 +
1171 +  /*
1172 +   * Execute main with arguments argc and agrv.
1173 +   */
1174 +  boot_card(1,__argv);
1175 +  reboot();
1176 +
1177 +}
1178 +
1179 +#endif
1180 Index: rtems/c/src/lib/libbsp/m68k/mo376/misc/dotests
1181 ===================================================================
1182 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
1183 +++ rtems/c/src/lib/libbsp/m68k/mo376/misc/dotests      2007-08-14 17:20:30.000000000 +0200
1184 @@ -0,0 +1,15 @@
1185 +#! /bin/bash
1186 +#
1187 +#  $Id: dotests,v 1.1 2001/05/25 16:28:46 joel Exp $
1188 +#
1189 +
1190 +mkdir MyTests
1191 +find -name MyTests -prune -or -name "*.nxe" -exec cp {} MyTests \;
1192 +
1193 +stty 1:0:80001cb2:0:3:1c:7f:15:4:5:1:0:11:13:1a:0:12:f:17:16:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0 </dev/ttyS1
1194 +/bin/cp /dev/ttyS1 screen &
1195 +cpJob=$!
1196 +
1197 +( cd MyTests; for f in *nxe; do m68k-elf-gdb ${f} </dev/null; done )
1198 +
1199 +kill -9 $cpJob
1200 Index: rtems/c/src/lib/libbsp/m68k/mo376/include/bsp.h
1201 ===================================================================
1202 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
1203 +++ rtems/c/src/lib/libbsp/m68k/mo376/include/bsp.h     2007-08-14 17:20:30.000000000 +0200
1204 @@ -0,0 +1,139 @@
1205 +/*  bsp.h
1206 + *
1207 + *  This include file contains all mrm board IO definitions.
1208 + *
1209 + *  COPYRIGHT (c) 1989-1999.
1210 + *  On-Line Applications Research Corporation (OAR).
1211 + *
1212 + *  The license and distribution terms for this file may be
1213 + *  found in the file LICENSE in this distribution or at
1214 + *  http://www.rtems.com/license/LICENSE.
1215 + *
1216 + *  $Id: bsp.h,v 1.14 2006/03/17 10:11:36 ralf Exp $
1217 + */
1218 +
1219 +#ifndef _BSP_H
1220 +#define _BSP_H
1221 +
1222 +#ifdef __cplusplus
1223 +extern "C" {
1224 +#endif
1225 +
1226 +#include <bspopts.h>
1227 +
1228 +#include <rtems.h>
1229 +#include <rtems/bspIo.h>
1230 +#include <rtems/clockdrv.h>
1231 +#include <rtems/console.h>
1232 +#include <rtems/iosupp.h>
1233 +#include <mrm332.h>
1234 +#include <rtems/m68k/sim.h>
1235 +#include <rtems/m68k/qsm.h>
1236 +
1237 +/*
1238 + *  confdefs.h overrides for this BSP:
1239 + *   - number of termios serial ports (defaults to 1)
1240 + *   - Interrupt stack space is not minimum if defined.
1241 + */
1242 +
1243 +#define CONSOLE_SCI
1244 +/* #define CONFIGURE_NUMBER_OF_TERMIOS_PORTS 2 */
1245 +/* #define CONFIGURE_INTERRUPT_STACK_MEMORY  (TBD * 1024) */
1246 +
1247 +/*
1248 + *  Simple spin delay in microsecond units for device drivers.
1249 + *  This is very dependent on the clock speed of the target.
1250 + */
1251 +
1252 +#define rtems_bsp_delay( microseconds ) \
1253 +  { register uint32_t         _delay=(microseconds); \
1254 +    register uint32_t         _tmp=123; \
1255 +    asm volatile( "0: \
1256 +                     nbcd      %0 ; \
1257 +                     nbcd      %0 ; \
1258 +                     dbf       %1,0b" \
1259 +                  : "=d" (_tmp), "=d" (_delay) \
1260 +                  : "0"  (_tmp), "1"  (_delay) ); \
1261 +  }
1262 +
1263 +/* externals */
1264 +
1265 +extern char _etext[];
1266 +extern char _copy_start[];
1267 +extern char _edata[];
1268 +extern char _clear_start[];
1269 +extern char end[];
1270 +extern char _copy_data_from_rom[];
1271 +
1272 +/* constants */
1273 +
1274 +#ifdef __START_C__
1275 +#define STACK_SIZE "#0x800"
1276 +#else
1277 +#define STACK_SIZE 0x800
1278 +#endif
1279 +
1280 +/* macros */
1281 +
1282 +#define RAW_PUTS(str) \
1283 +  { register char *ptr = str; \
1284 +    while (*ptr) SCI_output_char(*ptr++); \
1285 +  }
1286 +
1287 +#define RAW_PUTI(n) { \
1288 +    register int i, j; \
1289 +    \
1290 +    RAW_PUTS("0x"); \
1291 +    for (i=28;i>=0;i -= 4) { \
1292 +      j = (n>>i) & 0xf; \
1293 +      SCI_output_char( (j>9 ? j-10+'a' : j+'0') ); \
1294 +    } \
1295 +  }
1296 +
1297 +/* miscellaneous stuff assumed to exist */
1298 +
1299 +extern rtems_configuration_table BSP_Configuration;
1300 +
1301 +extern m68k_isr_entry M68Kvec[];   /* vector table address */
1302 +
1303 +extern int stack_size;
1304 +
1305 +extern int stack_start;
1306 +
1307 +/*
1308 + *  Device Driver Table Entries
1309 + */
1310 +
1311 +/*
1312 + * NOTE: Use the standard Console driver entry
1313 + */
1314 +
1315 +/*
1316 + * NOTE: Use the standard Clock driver entry
1317 + */
1318 +
1319 +/* functions */
1320 +
1321 +void bsp_cleanup( void );
1322 +
1323 +m68k_isr_entry set_vector(
1324 +  rtems_isr_entry     handler,
1325 +  rtems_vector_number vector,
1326 +  int                 type
1327 +);
1328 +
1329 +void console_init(void);
1330 +
1331 +void Spurious_Initialize(void);
1332 +
1333 +void _UART_flush(void);
1334 +
1335 +void Clock_exit(void);
1336 +
1337 +void outbyte(char);
1338 +
1339 +#ifdef __cplusplus
1340 +}
1341 +#endif
1342 +
1343 +#endif
1344 Index: rtems/c/src/lib/libbsp/m68k/mo376/misc/interr.c
1345 ===================================================================
1346 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
1347 +++ rtems/c/src/lib/libbsp/m68k/mo376/misc/interr.c     2007-08-14 17:20:30.000000000 +0200
1348 @@ -0,0 +1,99 @@
1349 +/*
1350 + *  Internal Error Handler
1351 + *
1352 + *  COPYRIGHT (c) 1989-1999.
1353 + *  On-Line Applications Research Corporation (OAR).
1354 + *
1355 + *  The license and distribution terms for this file may be
1356 + *  found in the file LICENSE in this distribution or at
1357 + *  http://www.rtems.com/license/LICENSE.
1358 + *
1359 + *  $Id: interr.c,v 1.3 2004/03/31 04:37:05 ralf Exp $
1360 + */
1361 +
1362 +#include <rtems/system.h>
1363 +#include <rtems/score/interr.h>
1364 +#include <rtems/score/sysstate.h>
1365 +#include <rtems/score/userext.h>
1366 +
1367 +/*PAGE
1368 + *
1369 + *  _Internal_error_Occurred
1370 + *
1371 + *  This routine will invoke the fatal error handler supplied by the user
1372 + *  followed by the the default one provided by the executive.  The default
1373 + *  error handler assumes no hardware is present to help inform the user
1374 + *  of the problem.  Halt stores the error code in a known register,
1375 + *  disables interrupts, and halts the CPU.  If the CPU does not have a
1376 + *  halt instruction, it will loop to itself.
1377 + *
1378 + *  Input parameters:
1379 + *    the_source  - what subsystem the error originated in
1380 + *    is_internal - if the error was internally generated
1381 + *    the_error   - fatal error status code
1382 + *
1383 + *  Output parameters:
1384 + *    As much information as possible is stored in a CPU dependent fashion.
1385 + *    See the CPU dependent code for more information.
1386 + *
1387 + *  NOTE: The the_error is not necessarily a directive status code.
1388 + */
1389 +
1390 +/*
1391 + * Ugly hack.... _CPU_Fatal_halt() disonnects the bdm. Without this
1392 + * change, the_error is only known only to the cpu :).
1393 + *
1394 + * From "bsp.h" which is not yet available in the arch tree during
1395 + * this phase of install. jsg
1396 + */
1397 +void outbyte(char);
1398 +void bsp_cleanup( void );
1399 +
1400 +#define RAW_PUTS(str) \
1401 +  { register char *ptr = str; \
1402 +    while (*ptr) outbyte(*ptr++); \
1403 +  }
1404 +
1405 +#define RAW_PUTI(n) { \
1406 +    register int i, j; \
1407 +    \
1408 +    RAW_PUTS("0x"); \
1409 +    for (i=28;i>=0;i -= 4) { \
1410 +      j = (n>>i) & 0xf; \
1411 +      outbyte( (j>9 ? j-10+'a' : j+'0') ); \
1412 +    } \
1413 +  }
1414 +
1415 +void volatile _Internal_error_Occurred(
1416 +  Internal_errors_Source  the_source,
1417 +  boolean                 is_internal,
1418 +  uint32_t                the_error
1419 +)
1420 +{
1421 +
1422 +  Internal_errors_What_happened.the_source  = the_source;
1423 +  Internal_errors_What_happened.is_internal = is_internal;
1424 +  Internal_errors_What_happened.the_error   = the_error;
1425 +
1426 +  _User_extensions_Fatal( the_source, is_internal, the_error );
1427 +
1428 +  _System_state_Set( SYSTEM_STATE_FAILED );
1429 +
1430 +  /* try to print error message to outbyte */
1431 +  RAW_PUTS("\r\nRTEMS: A fatal error has occured.\r\n");
1432 +  RAW_PUTS("RTEMS:    fatal error ");
1433 +  RAW_PUTI( the_error );
1434 +  RAW_PUTS(" (");
1435 +  outbyte( (char)((the_error>>24) & 0xff) );
1436 +  outbyte( (char)((the_error>>16) & 0xff) );
1437 +  outbyte( (char)((the_error>>8) & 0xff) );
1438 +  outbyte( (char)(the_error & 0xff) );
1439 +  RAW_PUTS(").\r\n");
1440 +
1441 +  /* configure peripherals for a safe exit */
1442 +  bsp_cleanup();
1443 +
1444 +  _CPU_Fatal_halt( the_error );
1445 +
1446 +  /* will not return from this routine */
1447 +}
1448 Index: rtems/c/src/lib/libbsp/m68k/mo376/ChangeLog
1449 ===================================================================
1450 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
1451 +++ rtems/c/src/lib/libbsp/m68k/mo376/ChangeLog 2007-08-14 17:20:30.000000000 +0200
1452 @@ -0,0 +1,455 @@
1453 +2006-12-02     Ralf Corsépius <ralf.corsepius@rtems.org>
1454 +
1455 +       * configure.ac: New BUG-REPORT address.
1456 +
1457 +2006-10-20     Ralf Corsépius <ralf.corsepius@rtems.org>
1458 +
1459 +       * Makefile.am: Remove superfluous -DASM.
1460 +
1461 +2006-10-19     Ralf Corsépius <ralf.corsepius@rtems.org>
1462 +
1463 +       * configure.ac: Require automake-1.10. Require autoconf-2.60.
1464 +
1465 +2006-09-11     Joel Sherrill <joel@OARcorp.com>
1466 +
1467 +       * console/console.c, console/sci.c, console/sci.h, spurious/spinit.c,
1468 +       startup/bspclean.c, startup/start_c.c: Convert C++ style comments to
1469 +       C style.
1470 +
1471 +2006-02-08     Joel Sherrill <joel@OARcorp.com>
1472 +
1473 +       * startup/linkcmds, startup/linkcmds_ROM: Add sections required by
1474 +       newer gcc versions.
1475 +
1476 +2006-01-11     Ralf Corsepius <ralf.corsepius@rtems.org>
1477 +
1478 +       * Makefile.am: Add preinstall.am.
1479 +
1480 +2005-05-26     Ralf Corsepius <ralf.corsepius@rtems.org>
1481 +
1482 +       * include/bsp.h: New header guard.
1483 +
1484 +2005-01-07     Ralf Corsepius <ralf.corsepius@rtems.org>
1485 +
1486 +       * Makefile.am: Eliminate CFLAGS_OPTIMIZE_V.
1487 +
1488 +2005-01-05     Ralf Corsepius <ralf.corsepius@rtems.org>
1489 +
1490 +       * console/sci.c: Remove CVS Log.
1491 +
1492 +2005-01-04     Joel Sherrill <joel@OARcorp.com>
1493 +
1494 +       * console/sci.c: Remove warnings.
1495 +
1496 +2005-01-02     Ralf Corsepius <ralf.corsepius@rtems.org>
1497 +
1498 +       * Makefile.am: Remove build-variant support.
1499 +
1500 +2004-11-25     Joel Sherrill <joel@OARcorp.com>
1501 +
1502 +       * startup/linkcmds, startup/linkcmds_ROM: Add new bss sections .bss.*
1503 +       and .gnu.linkonce.b*.
1504 +
1505 +2004-09-24     Ralf Corsepius <ralf_corsepius@rtems.org>
1506 +
1507 +       * configure.ac: Require automake > 1.9.
1508 +
1509 +2004-04-23     Ralf Corsepius <ralf_corsepius@rtems.org>
1510 +
1511 +       PR 610/bsps
1512 +       * Makefile.am: Add include/tm27.h, Cosmetics.
1513 +       * include/tm27.h: Final cosmetics.
1514 +
1515 +2004-04-22     Ralf Corsepius <ralf_corsepius@rtems.org>
1516 +
1517 +       * include/bsp.h: Split out tmtest27 support.
1518 +       * include/tm27.h: New.
1519 +
1520 +2004-04-21     Ralf Corsepius <ralf_corsepius@rtems.org>
1521 +
1522 +       PR 613/bsps
1523 +       * include/bsp.h: Remove MAX_LONG_TEST_DURATION.
1524 +
1525 +2004-04-21     Ralf Corsepius <ralf_corsepius@rtems.org>
1526 +
1527 +       PR 614/bsps
1528 +       * include/bsp.h: Remove MAX_SHORT_TEST_DURATION (Unused).
1529 +
1530 +2004-04-03     Ralf Corsepiu <ralf_corsepiu@rtems.org>
1531 +
1532 +       * c/src/lib/libbsp/m68k/mrm332/include/bsp.h,
1533 +       c/src/lib/libbsp/m68k/mrm332/start/start.S,
1534 +       c/src/lib/libbsp/m68k/mrm332/startup/start_c.c: Include
1535 +       <rtems/m68k/sim.h> instead of <sim.h>.
1536 +       * c/src/lib/libbsp/m68k/mrm332/include/bsp.h: Include
1537 +       <rtems/m68k/qsm.h> instead of <qsm.h>.
1538 +
1539 +2004-04-02     Ralf Corsepius <ralf_corsepius@rtems.org>
1540 +
1541 +       * start/start.S: Include <rtems/asm.h> instead of <asm.h>.
1542 +
1543 +2004-04-01     Ralf Corsepius <ralf_corsepius@rtems.org>
1544 +
1545 +       * include/bsp.h: Include <rtems/clockdrv.h> instead of <clockdrv.h>.
1546 +       * include/bsp.h: Include <rtems/console.h> instead of <console.h>.
1547 +       * include/bsp.h: Include <rtems/iosupp.h> instead of <iosupp.h>.
1548 +
1549 +2004-03-31     Ralf Corsepius <ralf_corsepius@rtems.org>
1550 +
1551 +       * clock/ckinit.c, console/sci.c, console/sci.h, include/bsp.h,
1552 +       misc/interr.c, startup/bspstart.c, timer/timer.c: Convert to using
1553 +       c99 fixed size types.
1554 +
1555 +2004-02-19     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1556 +
1557 +       * Makefile.am: Reflect changes to bsp.am. 
1558 +       Preinstall dist_project_lib*.
1559 +
1560 +2004-02-14     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1561 +
1562 +       * Makefile.am: Reflect changes to bsp.am.
1563 +
1564 +2004-02-12     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1565 +
1566 +       * Makefile.am: Use CPPASCOMPILE instead of CCASCOMPILE.
1567 +
1568 +2004-02-06     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1569 +
1570 +       * Makefile.am: Pickup files from ../../m68k/shared instead of
1571 +       ../shared. Reformat.
1572 +
1573 +2004-01-28     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1574 +
1575 +       * configure.ac: Add nostdinc to AUTOMAKE_OPTIONS.
1576 +
1577 +2004-01-28     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1578 +
1579 +       * Makefile.am: Don't include subdirs.am.
1580 +
1581 +2004-01-28     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1582 +
1583 +       * Makefile.am: Fix typo.
1584 +
1585 +2004-01-28     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1586 +
1587 +       * Makefile.am: Merge-in clock/Makefile.am, console/Makefile.am,
1588 +       spurious/Makefile.am, startup/Makefile.am, timer/Makefile.am,
1589 +       wrapup/Makefile.am.
1590 +       Use automake compilation rules.
1591 +       * clock/Makefile.am, console/Makefile.am, spurious/Makefile.am,
1592 +       startup/Makefile.am, timer/Makefile.am, wrapup/Makefile.am:
1593 +       Remove.
1594 +       * configure.ac: Reflect changes above.
1595 +
1596 +2004-01-21     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1597 +
1598 +       * Makefile.am: Add PREINSTALL_DIRS.
1599 +       * wrapup/Makefile.am: Reflect changes to libcpu.
1600 +
1601 +2004-01-20     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1602 +
1603 +       * wrapup/Makefile.am: Reflect changes to libcpu.
1604 +
1605 +2004-01-14     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1606 +
1607 +       * Makefile.am: Re-add dirstamps to PRE/TMPINSTALL_FILES.
1608 +       Add PRE/TMPINSTALL_FILES to CLEANFILES.
1609 +       * startup/Makefile.am: Ditto.
1610 +
1611 +2004-01-07     Joel Sherrill <joel@OARcorp.com>
1612 +
1613 +       * times, console/sci.c: Remove efi68k and efi332 references as they are
1614 +       no longer in the tree.
1615 +
1616 +2004-01-07     Joel Sherrill <joel@OARcorp.com>
1617 +
1618 +       * timer/timer.c: Remove efi68k and efi332 references as they are no
1619 +       longer in the tree.
1620 +
1621 +2004-01-07     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1622 +
1623 +       * start/Makefile.am: Remove.
1624 +       * Makefile.am: Merge-in start/Makefile.am.
1625 +       * configure.ac: Reflect changes above.
1626 +
1627 +2004-01-05     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1628 +
1629 +       * wrapup/Makefile.am: Eliminate $(LIB). 
1630 +       Use noinst_DATA to trigger building libbsp.a.
1631 +
1632 +2003-12-13     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1633 +
1634 +       * start/Makefile.am: s,${PROJECT_RELEASE}/lib,$(PROJECT_LIB),g.
1635 +       * startup/Makefile.am: s,${PROJECT_RELEASE}/lib,$(PROJECT_LIB),g.
1636 +
1637 +2003-12-12     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1638 +
1639 +       * start/Makefile.am: Use mkdir_p. Remove dirs from PRE/TMPINSTALL_FILES.
1640 +       * startup/Makefile.am: Use mkdir_p. Remove dirs from PRE/TMPINSTALL_FILES.
1641 +
1642 +2003-12-12     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1643 +
1644 +       * configure.ac: Require automake >= 1.8, autoconf >= 2.59.
1645 +
1646 +2003-12-10     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1647 +
1648 +       * start/Makefile.am: Misc cleanups and fixes.
1649 +       * startup/Makefile.am: Misc cleanups and fixes.
1650 +       * wrapup/Makefile.am: Misc cleanups and fixes.
1651 +
1652 +2003-12-03     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1653 +
1654 +       * Makefile.am: Add preinstallation dirstamp support.
1655 +       * clock/Makefile.am: Cosmetics.
1656 +       * console/Makefile.am: Cosmetics.
1657 +       * spurious/Makefile.am: Cosmetics.
1658 +       * startup/Makefile.am: Cosmetics.
1659 +       * timer/Makefile.am: Cosmetics.
1660 +       * wrapup/Makefile.am: Cosmetics.
1661 +
1662 +2003-12-02     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1663 +
1664 +       * clock/Makefile.am: Remove all-local: $(ARCH).
1665 +       * console/Makefile.am: Remove all-local: $(ARCH).
1666 +       * spurious/Makefile.am: Remove all-local: $(ARCH).
1667 +       * start/Makefile.am: Remove all-local: $(ARCH).
1668 +       * startup/Makefile.am: Remove all-local: $(ARCH).
1669 +       * timer/Makefile.am: Remove all-local: $(ARCH).
1670 +       * wrapup/Makefile.am: Remove all-local: $(ARCH).
1671 +
1672 +2003-09-29     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1673 +
1674 +       * Makefile.am: Merge-in include/Makefile.am.
1675 +       Reflect changes to bsp.am.
1676 +       * include/Makefile.am: Remove.
1677 +       * configure.ac: Reflect changes above.
1678 +
1679 +2003-09-19     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1680 +
1681 +       * bsp_specs: Remove *lib:.
1682 +
1683 +2003-09-15     Joel Sherrill <joel@OARcorp.com>
1684 +
1685 +       PR 483/bsps
1686 +       * startup/bspstart.c, startup/start_c.c: Spurious interrupt handlers
1687 +       cannot be installed until RTEMS has initialized the vector table.
1688 +
1689 +2003-09-04     Joel Sherrill <joel@OARcorp.com>
1690 +
1691 +       * clock/ckinit.c, console/console.c, include/bsp.h, misc/interr.c,
1692 +       spurious/spinit.c, startup/bspclean.c, startup/bspstart.c,
1693 +       timer/timer.c: URL for license changed.
1694 +
1695 +2003-08-20     Joel Sherrill <joel@OARcorp.com>
1696 +
1697 +       * console/console.c: Correct copyright statements.
1698 +
1699 +2003-08-18     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1700 +
1701 +       * Makefile.am: Reflect having moved aclocal/.
1702 +
1703 +2003-08-16     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1704 +
1705 +       * Makefile.am: Reflect having moved automake/.
1706 +       * clock/Makefile.am: Reflect having moved automake/.
1707 +       * console/Makefile.am: Reflect having moved automake/.
1708 +       * include/Makefile.am: Reflect having moved automake/.
1709 +       * spurious/Makefile.am: Reflect having moved automake/.
1710 +       * start/Makefile.am: Reflect having moved automake/.
1711 +       * startup/Makefile.am: Reflect having moved automake/.
1712 +       * timer/Makefile.am: Reflect having moved automake/.
1713 +       * wrapup/Makefile.am: Reflect having moved automake/.
1714 +
1715 +2003-08-11     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1716 +
1717 +       PR 452/bsps
1718 +       * startup/Makefile.am: Remove USE_INIT_FINI.
1719 +
1720 +2003-08-11     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1721 +
1722 +       * configure.ac: Use rtems-bugs@rtems.com as bug report email address.
1723 +
1724 +2003-08-06     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1725 +
1726 +       PR 445/bsps
1727 +       * bsp_specs: Remove -D__embedded__ -Asystem(embedded) from cpp.
1728 +       Remove cpp, old_cpp (now unused).
1729 +
1730 +2003-03-06     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1731 +
1732 +       * configure.ac: Remove AC_CONFIG_AUX_DIR.
1733 +
1734 +2003-02-11     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1735 +
1736 +       * configure.ac: AM_INIT_AUTOMAKE([1.7.2]).
1737 +
1738 +2003-02-11     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1739 +
1740 +       * configure.ac: AC_PREREQ(2.57).
1741 +
1742 +2003-01-20     Duane Gustavus <duane@unt.edu>
1743 +
1744 +       * console/sci.c, include/mrm332.h, startup/linkcmds,
1745 +       startup/linkcmds_ROM: Various updates to make this run properly
1746 +       from ROM.
1747 +
1748 +2002-12-20     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1749 +
1750 +       * clock/Makefile.am: Don't include @RTEMS_BSP@.cfg.
1751 +       * console/Makefile.am: Don't include @RTEMS_BSP@.cfg.
1752 +       * spurious/Makefile.am: Don't include @RTEMS_BSP@.cfg.
1753 +       * start/Makefile.am: Don't include @RTEMS_BSP@.cfg.
1754 +       * startup/Makefile.am: Don't include @RTEMS_BSP@.cfg.
1755 +       * timer/Makefile.am: Don't include @RTEMS_BSP@.cfg.
1756 +
1757 +2002-12-12     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1758 +
1759 +       * start/Makefile.am: Use install-data-local to install startfile.
1760 +
1761 +2002-12-10     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1762 +
1763 +       * wrapup/Makefile.am: Don't include @RTEMS_BSP@.cfg.
1764 +
1765 +2002-11-04     Joel Sherrill <joel@OARcorp.com>
1766 +
1767 +       * console/sci.c, spurious/spinit.c: Removed warnings.
1768 +
1769 +2002-10-21     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1770 +
1771 +       * .cvsignore: Reformat.
1772 +       Add autom4te*cache.
1773 +       Remove autom4te.cache.
1774 +
1775 +2002-09-08     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1776 +
1777 +       * Makefile.am: ACLOCAL_AMFLAGS = -I ../../../../../../aclocal.
1778 +
1779 +2002-08-21     Joel Sherrill <joel@OARcorp.com>
1780 +
1781 +       * wrapup/Makefile.am: PR217 required that the idle task be moved to
1782 +       libcpu so it could be more acutely aware of the CPU model.  This
1783 +       file was modified to pick up the idle task from there.
1784 +
1785 +2002-08-21     Joel Sherrill <joel@OARcorp.com>
1786 +
1787 +       * bsp_specs: Added support for -nostdlibs.
1788 +
1789 +2002-08-11     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1790 +
1791 +       * clock/Makefile.am: Use .$(OBJEXT) instead of .o.
1792 +       * console/Makefile.am: Use .$(OBJEXT) instead of .o.
1793 +       * spurious/Makefile.am: Use .$(OBJEXT) instead of .o.
1794 +       * start/Makefile.am: Use .$(OBJEXT) instead of .o.
1795 +       * startup/Makefile.am: Use .$(OBJEXT) instead of .o.
1796 +       * timer/Makefile.am: Use .$(OBJEXT) instead of .o.
1797 +       * wrapup/Makefile.am: Use .$(OBJEXT) instead of .o.
1798 +
1799 +2002-08-05     Joel Sherrill <joel@OARcorp.com>
1800 +
1801 +       * Per PR260 eliminate use of make-target-options.  This impacted
1802 +       RTEMS allowing a distinction between the CPU32 and CPU32+ in the
1803 +       SuperCore and required that the m68k optimized memcpy be moved
1804 +       to libcpu.
1805 +       * wrapup/Makefile.am: Pick up memcpy.o from libcpu.
1806 +
1807 +2002-07-21     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1808 +
1809 +       * start/Makefile.am: Eliminate PGM.
1810 +       Add bsplib_DATA = $(PROJECT_RELEASE)/lib/start$(LIB_VARIANT).o.
1811 +
1812 +2002-07-19     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1813 +
1814 +       * startup/Makefile.am: Add bsplib_DATA = linkcmds linkcmds_ROM.
1815 +
1816 +2002-07-04     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1817 +
1818 +       * wrapup/Makefile.am: Eliminate TMPINSTALL_FILES.
1819 +       Remove $(OBJS) from all-local.
1820 +
1821 +2002-06-29     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1822 +
1823 +       * wrapup/Makefile.am: Remove preinstallation of libbsp.a,
1824 +
1825 +2001-05-09     Joel Sherrill <joel@OARcorp.com>
1826 +
1827 +       * startup/linkcmds: In support of gcc 3.1, added one of more
1828 +       of the sections .jcr, .rodata*, .data.*, .gnu.linkonce.s2.*,
1829 +       .gnu.linkonce.sb2.*, and .gnu.linkonce.s.*.  Spacing corrections
1830 +       and direction of segments to memory regions may also have been
1831 +       addressed.  This was a sweep across all BSPs.
1832
1833 +2002-03-27     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1834 +
1835 +       * configure.ac:
1836 +       AC_INIT(package,_RTEMS_VERSION,_RTEMS_BUGS).
1837 +       AM_INIT_AUTOMAKE([no-define foreign 1.6]).
1838 +       * clock/Makefile.am: Remove AUTOMAKE_OPTIONS.
1839 +       * Makefile.am: Remove AUTOMAKE_OPTIONS.
1840 +       * console/Makefile.am: Remove AUTOMAKE_OPTIONS.
1841 +       * include/Makefile.am: Remove AUTOMAKE_OPTIONS.
1842 +       * spurious/Makefile.am: Remove AUTOMAKE_OPTIONS.
1843 +       * start/Makefile.am: Remove AUTOMAKE_OPTIONS.
1844 +       * startup/Makefile.am: Remove AUTOMAKE_OPTIONS.
1845 +       * timer/Makefile.am: Remove AUTOMAKE_OPTIONS.
1846 +       * wrapup/Makefile.am: Remove AUTOMAKE_OPTIONS.
1847 +
1848 +2002-02-28     Mike Panetta <ahuitzot@mindspring.com>
1849 +
1850 +       * console/sci.c, console/sci.h, 
1851 +       console/console.c: Added new SCI driver.
1852 +       * start/start.c: Removed file.
1853 +       * start/start.S: New file, the asm portion of the updated start code.
1854 +       * start/configure.am: Added start.S, removed start.c
1855 +       * startup/start_c.c: New file, the C portion of the updated start code.         Contains most of the code that was in the old start.c. 
1856 +       * startup/configure.am: Added start_c.c to C_FILES.
1857 +       * include/bsp.h: Added include <rtems/bspIo.h>
1858 +
1859 +2001-11-30     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1860 +
1861 +       * configure.ac: Introduce RTEMS_BSP_CONFIGURE.
1862 +
1863 +2001-10-11     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1864 +
1865 +       * .cvsignore: Add autom4te.cache for autoconf > 2.52.
1866 +       * configure.in: Remove.
1867 +       * configure.ac: New file, generated from configure.in by autoupdate.
1868 +
1869 +2001-09-27     Joel Sherrill <joel@OARcorp.com>
1870 +
1871 +       * include/bsp.h: Renamed delay() to rtems_bsp_delay().
1872 +
1873 +2001-09-27     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1874 +
1875 +       * include/Makefile.am: Use 'TMPINSTALL_FILES ='.
1876 +
1877 +2001-05-26     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1878 +
1879 +       * configure.in: Add bspopts.h.
1880 +       * include/.cvsignore: Add bspopts.h*, stamp-h*.
1881 +       * include/Makefile.am: Use *_HEADERS instead of *H_FILES.
1882 +       * include/bsp.h: Include bspopts.h.
1883 +
1884 +2001-05-25     Joel Sherrill <joel@OARcorp.com>
1885 +
1886 +       * clock/Makefile.am, console/Makefile.am, spurious/Makefile.am,
1887 +       start/Makefile.am, startup/Makefile.am, timer/Makefile.am,
1888 +       wrapup/Makefile.am: Modified to include compile.am.
1889 +       * startup/bspstart.c: Removed include of <libcsupport.h>
1890 +
1891 +2000-05-25     Matt Cross <profesor@gweep.net>
1892 +
1893 +       * New MRM332 BSP for the Mini RoboMind board based
1894 +       on the 68332 microcontroller designed and build by Mark
1895 +       Castelluccio.  For details on the MRM see http://www.robominds.com.
1896 +       * .cvsignore, ChangeLog Makefile.am, README, bsp_specs,
1897 +       clock/.cvsignore, clock/Makefile.am, clock/ckinit.c, configure.in,
1898 +       console/.cvsignore, console/Makefile.am, console/console.c,
1899 +       include/.cvsignore, include/Makefile.am, include/bsp.h,
1900 +       include/mrm332.h, misc/dotests, misc/gdbinit68, misc/interr.c,
1901 +       spurious/.cvsignore, spurious/Makefile.am, spurious/spinit.c,
1902 +       start/.cvsignore, start/Makefile.am, start/start.c, startup/.cvsignore,
1903 +       startup/Makefile.am, startup/bspclean.c, startup/bspstart.c,
1904 +       startup/except_vect_332_ROM.S, startup/linkcmds, startup/linkcmds_ROM,
1905 +       timer/.cvsignore, timer/Makefile.am, timer/timer.c, times,
1906 +       wrapup/.cvsignore, wrapup/Makefile.am: Initial files.
1907 +
1908 Index: rtems/c/src/lib/libbsp/m68k/mo376/startup/bspclean.c
1909 ===================================================================
1910 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
1911 +++ rtems/c/src/lib/libbsp/m68k/mo376/startup/bspclean.c        2007-08-14 17:20:30.000000000 +0200
1912 @@ -0,0 +1,27 @@
1913 +/*  bsp_cleanup()
1914 + *
1915 + *  This routine cleans up in the sense that it places the board
1916 + *  in a safe state and flushes the I/O buffers before exiting.
1917 + *
1918 + *  INPUT:  NONE
1919 + *
1920 + *  OUTPUT: NONE
1921 + *
1922 + *  COPYRIGHT (c) 1989-1999.
1923 + *  On-Line Applications Research Corporation (OAR).
1924 + *
1925 + *  The license and distribution terms for this file may be
1926 + *  found in the file LICENSE in this distribution or at
1927 + *  http://www.rtems.com/license/LICENSE.
1928 + *
1929 + *  $Id: bspclean.c,v 1.5 2006/09/11 21:43:56 joel Exp $
1930 + */
1931 +
1932 +#include <bsp.h>
1933 +
1934 +void bsp_cleanup(void)
1935 +{
1936 +    /* interrupt driven stdio must be flushed */
1937 +    _CPU_ISR_Set_level( 7 );
1938 +    /*_UART_flush(); */
1939 +}
1940 Index: rtems/c/src/lib/libbsp/m68k/mo376/timer/timer.c
1941 ===================================================================
1942 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
1943 +++ rtems/c/src/lib/libbsp/m68k/mo376/timer/timer.c     2007-08-14 17:20:30.000000000 +0200
1944 @@ -0,0 +1,81 @@
1945 +/*  Timer_init()
1946 + *
1947 + *  This routine is not implemented for this BSP.
1948 + *
1949 + *  Input parameters:  NONE
1950 + *
1951 + *  Output parameters:  NONE
1952 + *
1953 + *  NOTE: It is important that the timer start/stop overhead be
1954 + *        determined when porting or modifying this code.
1955 + *
1956 + *  COPYRIGHT (c) 1989-1999.
1957 + *  On-Line Applications Research Corporation (OAR).
1958 + *
1959 + *  The license and distribution terms for this file may be
1960 + *  found in the file LICENSE in this distribution or at
1961 + *  http://www.rtems.com/license/LICENSE.
1962 + *
1963 + *  $Id: timer.c,v 1.6 2004/04/21 16:01:35 ralf Exp $
1964 + */
1965 +
1966 +#include <bsp.h>
1967 +
1968 +rtems_boolean Timer_driver_Find_average_overhead;
1969 +
1970 +extern rtems_isr Clock_isr();
1971 +
1972 +void Timer_initialize( void )
1973 +{
1974 +}
1975 +
1976 +/*
1977 + *  The following controls the behavior of Read_timer().
1978 + *
1979 + *  FIND_AVG_OVERHEAD *  instructs the routine to return the "raw" count.
1980 + *
1981 + *  AVG_OVEREHAD is the overhead for starting and stopping the timer.  It
1982 + *  is usually deducted from the number returned.
1983 + *
1984 + *  LEAST_VALID is the lowest number this routine should trust.  Numbers
1985 + *  below this are "noise" and zero is returned.
1986 + */
1987 +
1988 +#define AVG_OVERHEAD      0  /* It typically takes X.X microseconds */
1989 +                             /* (Y countdowns) to start/stop the timer. */
1990 +                             /* This value is in microseconds. */
1991 +#define LEAST_VALID       1  /* Don't trust a clicks value lower than this */
1992 +
1993 +/*
1994 + * Return timer value in 1/2-microsecond units
1995 + */
1996 +int Read_timer( void )
1997 +{
1998 +  uint32_t         total;
1999 +  total = 0;
2000 +
2001 +  if ( Timer_driver_Find_average_overhead == 1 )
2002 +    return total;          /* in XXX microsecond units */
2003 +
2004 +  if ( total < LEAST_VALID )
2005 +    return 0;            /* below timer resolution */
2006 +
2007 +  return (total - AVG_OVERHEAD);
2008 +}
2009 +
2010 +/*
2011 + *  Empty function call used in loops to measure basic cost of looping
2012 + *  in Timing Test Suite.
2013 + */
2014 +
2015 +rtems_status_code Empty_function(void)
2016 +{
2017 +    return RTEMS_SUCCESSFUL;
2018 +}
2019 +
2020 +void Set_find_average_overhead(
2021 +  rtems_boolean find_flag
2022 +)
2023 +{
2024 +  Timer_driver_Find_average_overhead = find_flag;
2025 +}
2026 Index: rtems/c/src/lib/libbsp/m68k/mo376/clock/ckinit.c
2027 ===================================================================
2028 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
2029 +++ rtems/c/src/lib/libbsp/m68k/mo376/clock/ckinit.c    2007-08-14 17:20:30.000000000 +0200
2030 @@ -0,0 +1,128 @@
2031 +/*  Clock_init()
2032 + *
2033 + *  This routine initailizes the periodic interrupt timer on
2034 + *  the Motorola 68332.
2035 + *
2036 + *  Input parameters:  NONE
2037 + *
2038 + *  Output parameters:  NONE
2039 + *
2040 + *  COPYRIGHT (c) 1989-1999.
2041 + *  On-Line Applications Research Corporation (OAR).
2042 + *
2043 + *  The license and distribution terms for this file may be
2044 + *  found in the file LICENSE in this distribution or at
2045 + *  http://www.rtems.com/license/LICENSE.
2046 + *
2047 + *  $Id: ckinit.c,v 1.5 2004/04/21 10:42:52 ralf Exp $
2048 + */
2049 +
2050 +#include <stdlib.h>
2051 +#include <bsp.h>
2052 +#include <rtems/libio.h>
2053 +#include <mrm332.h>
2054 +
2055 +#define CLOCK_VECTOR   MRM_PIV
2056 +
2057 +uint32_t         Clock_isrs;        /* ISRs until next tick */
2058 +volatile uint32_t         Clock_driver_ticks;
2059 +                                    /* ticks since initialization */
2060 +rtems_isr_entry  Old_ticker;
2061 +
2062 +void Clock_exit( void );
2063 +
2064 +/*
2065 + * These are set by clock driver during its init
2066 + */
2067 +
2068 +rtems_device_major_number rtems_clock_major = ~0;
2069 +rtems_device_minor_number rtems_clock_minor;
2070 +
2071 +rtems_isr Clock_isr(rtems_vector_number vector)
2072 +{
2073 +  Clock_driver_ticks += 1;
2074 +
2075 +  if ( Clock_isrs == 1 ) {
2076 +    rtems_clock_tick();
2077 +    Clock_isrs = BSP_Configuration.microseconds_per_tick / 1000;
2078 +  }
2079 +  else
2080 +    Clock_isrs -= 1;
2081 +}
2082 +
2083 +void Install_clock(
2084 +  rtems_isr_entry clock_isr
2085 +)
2086 +{
2087 +  Clock_driver_ticks = 0;
2088 +  Clock_isrs = BSP_Configuration.microseconds_per_tick / 1000;
2089 +
2090 +  Old_ticker = (rtems_isr_entry) set_vector( clock_isr, CLOCK_VECTOR, 1 );
2091 +
2092 +  /* enable 1mS interrupts */
2093 +  *PITR = (unsigned short int)( SAM(0x09,0,PITM) );/* load counter */
2094 +  *PICR = (unsigned short int)                     /* enable interrupt */
2095 +    ( SAM(ISRL_PIT,8,PIRQL) | SAM(CLOCK_VECTOR,0,PIV) );
2096 +
2097 +  atexit( Clock_exit );
2098 +}
2099 +
2100 +void Clock_exit( void )
2101 +{
2102 +  /* shutdown the periodic interrupt */
2103 +  *PICR = (unsigned short int)
2104 +    ( SAM(0,8,PIRQL) | SAM(CLOCK_VECTOR,0,PIV) );
2105 +  /*     ^^ zero disables interrupt */
2106 +
2107 +  /* do not restore old vector */
2108 +}
2109 +
2110 +rtems_device_driver Clock_initialize(
2111 +  rtems_device_major_number major,
2112 +  rtems_device_minor_number minor,
2113 +  void *pargp
2114 +)
2115 +{
2116 +  Install_clock( Clock_isr );
2117 +
2118 +  /*
2119 +   * make major/minor avail to others such as shared memory driver
2120 +   */
2121 +
2122 +  rtems_clock_major = major;
2123 +  rtems_clock_minor = minor;
2124 +
2125 +  return RTEMS_SUCCESSFUL;
2126 +}
2127 +
2128 +rtems_device_driver Clock_control(
2129 +  rtems_device_major_number major,
2130 +  rtems_device_minor_number minor,
2131 +  void *pargp
2132 +)
2133 +{
2134 +    uint32_t         isrlevel;
2135 +    rtems_libio_ioctl_args_t *args = pargp;
2136 +
2137 +    if (args == 0)
2138 +        goto done;
2139 +
2140 +    /*
2141 +     * This is hokey, but until we get a defined interface
2142 +     * to do this, it will just be this simple...
2143 +     */
2144 +
2145 +    if (args->command == rtems_build_name('I', 'S', 'R', ' '))
2146 +    {
2147 +        Clock_isr(CLOCK_VECTOR);
2148 +    }
2149 +    else if (args->command == rtems_build_name('N', 'E', 'W', ' '))
2150 +    {
2151 +      rtems_interrupt_disable( isrlevel );
2152 +       (void) set_vector( args->buffer, CLOCK_VECTOR, 1 );
2153 +      rtems_interrupt_enable( isrlevel );
2154 +    }
2155 +
2156 +done:
2157 +    return RTEMS_SUCCESSFUL;
2158 +}
2159 Index: rtems/c/src/lib/libbsp/m68k/mo376/misc/gdbinit68
2160 ===================================================================
2161 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
2162 +++ rtems/c/src/lib/libbsp/m68k/mo376/misc/gdbinit68    2007-08-14 17:20:30.000000000 +0200
2163 @@ -0,0 +1,16 @@
2164 +#
2165 +#  $Id: gdbinit68,v 1.1 2001/05/25 16:28:46 joel Exp $
2166 +#
2167 +echo Setting up the environment for mrm debuging.\n
2168 +
2169 +target bdm /dev/bdmcpu320
2170 +bdm_setdelay 1000
2171 +bdm_autoreset on
2172 +set remotecache off
2173 +bdm_timetocomeup 0
2174 +bdm_init
2175 +bdm_reset
2176 +set $sfc=5
2177 +set $dfc=5
2178 +r
2179 +q
2180 Index: rtems/c/src/lib/libbsp/m68k/mo376/configure.ac
2181 ===================================================================
2182 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
2183 +++ rtems/c/src/lib/libbsp/m68k/mo376/configure.ac      2007-08-14 17:20:30.000000000 +0200
2184 @@ -0,0 +1,20 @@
2185 +## Process this file with autoconf to produce a configure script.
2186 +## 
2187 +## $Id: configure.ac,v 1.14.2.2 2006/12/02 06:04:46 ralf Exp $
2188 +
2189 +AC_PREREQ(2.60)
2190 +AC_INIT([rtems-c-src-lib-libbsp-m68k-mrm332],[_RTEMS_VERSION],[http://www.rtems.org/bugzilla])
2191 +AC_CONFIG_SRCDIR([bsp_specs])
2192 +RTEMS_TOP(../../../../../..)
2193 +
2194 +RTEMS_CANONICAL_TARGET_CPU
2195 +AM_INIT_AUTOMAKE([no-define nostdinc foreign 1.10])
2196 +RTEMS_BSP_CONFIGURE
2197 +
2198 +RTEMS_PROG_CC_FOR_TARGET
2199 +RTEMS_CANONICALIZE_TOOLS
2200 +RTEMS_PROG_CCAS
2201 +
2202 +# Explicitly list all Makefiles here
2203 +AC_CONFIG_FILES([Makefile])
2204 +AC_OUTPUT
2205 Index: rtems/c/src/lib/libbsp/m68k/mo376/README
2206 ===================================================================
2207 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
2208 +++ rtems/c/src/lib/libbsp/m68k/mo376/README    2007-08-14 17:20:30.000000000 +0200
2209 @@ -0,0 +1,24 @@
2210 +#
2211 +#  $Id: README,v 1.1 2001/05/25 16:28:46 joel Exp $
2212 +#
2213 +
2214 +Description: mrm332
2215 +============
2216 +CPU: MC68332 @16 or 25MHz
2217 +RAM: 32k or 512k
2218 +ROM: 512k flash
2219 +
2220 +   The Mini RoboMind is a small board based on the 68332 microcontroller
2221 +designed and build by Mark Castelluccio.  For details, see:
2222 +
2223 +        http://www.robominds.com
2224 +
2225 +   This BSP was ported from the efi332 BSP by Matt Cross (profesor@gweep.net),
2226 +the efi332 BSP was written by John S Gwynne.
2227 +
2228 +TODO:
2229 +=====
2230 +- integrate the interrupt driven stdin/stdout into RTEMS to (a) reduce
2231 +  the interrupt priority and (2) to prevent it from blocking.
2232 +- add a timer driver for the tmtest set.
2233 +
2234 Index: rtems/c/src/lib/libbsp/m68k/mo376/Makefile.am
2235 ===================================================================
2236 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
2237 +++ rtems/c/src/lib/libbsp/m68k/mo376/Makefile.am       2007-08-14 17:20:30.000000000 +0200
2238 @@ -0,0 +1,68 @@
2239 +##
2240 +## $Id: Makefile.am,v 1.24.2.1 2006/10/20 11:54:57 ralf Exp $
2241 +##
2242 +
2243 +ACLOCAL_AMFLAGS = -I ../../../../aclocal
2244 +
2245 +include $(top_srcdir)/../../../../automake/compile.am
2246 +include $(top_srcdir)/../../bsp.am
2247 +
2248 +dist_project_lib_DATA = bsp_specs
2249 +
2250 +include_HEADERS = include/bsp.h
2251 +include_HEADERS += include/tm27.h
2252 +
2253 +nodist_include_HEADERS = include/bspopts.h
2254 +DISTCLEANFILES = include/bspopts.h
2255 +noinst_PROGRAMS =
2256 +
2257 +include_HEADERS += include/mrm332.h
2258 +nodist_include_HEADERS += ../../shared/include/coverhd.h
2259 +
2260 +EXTRA_DIST = times
2261 +
2262 +EXTRA_DIST += start/start.S
2263 +start.$(OBJEXT): start/start.S
2264 +       $(CPPASCOMPILE) -o $@ -c $<
2265 +
2266 +project_lib_DATA = start.$(OBJEXT)
2267 +
2268 +dist_project_lib_DATA += startup/linkcmds startup/linkcmds_ROM
2269 +
2270 +noinst_PROGRAMS += startup.rel
2271 +startup_rel_SOURCES = startup/start_c.c ../../shared/bsplibc.c \
2272 +    ../../shared/bsppost.c startup/bspstart.c startup/bspclean.c \
2273 +    ../../shared/bootcard.c ../../m68k/shared/m68kpretaskinghook.c \
2274 +    ../../shared/main.c ../../shared/sbrk.c ../../m68k/shared/setvec.c \
2275 +    ../../shared/gnatinstallhandler.c startup/except_vect_332_ROM.S
2276 +startup_rel_CPPFLAGS = $(AM_CPPFLAGS)
2277 +startup_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
2278 +
2279 +noinst_PROGRAMS += clock.rel
2280 +clock_rel_SOURCES = clock/ckinit.c
2281 +clock_rel_CPPFLAGS = $(AM_CPPFLAGS)
2282 +clock_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
2283 +
2284 +noinst_PROGRAMS += console.rel
2285 +console_rel_SOURCES = console/console.c console/sci.c console/sci.h
2286 +console_rel_CPPFLAGS = $(AM_CPPFLAGS)
2287 +console_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
2288 +
2289 +noinst_PROGRAMS += spurious.rel
2290 +spurious_rel_SOURCES = spurious/spinit.c
2291 +spurious_rel_CPPFLAGS = $(AM_CPPFLAGS)
2292 +spurious_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
2293 +
2294 +noinst_PROGRAMS += timer.rel
2295 +timer_rel_SOURCES = timer/timer.c
2296 +timer_rel_CPPFLAGS = $(AM_CPPFLAGS)
2297 +timer_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
2298 +
2299 +noinst_LIBRARIES = libbsp.a
2300 +libbsp_a_SOURCES =
2301 +libbsp_a_LIBADD = startup.rel clock.rel console.rel spurious.rel timer.rel
2302 +libbsp_a_LIBADD += ../../../libcpu/@RTEMS_CPU@/shared/cache.rel \
2303 +    ../../../libcpu/@RTEMS_CPU@/shared/misc.rel
2304 +
2305 +include $(srcdir)/preinstall.am
2306 +include $(top_srcdir)/../../../../automake/local.am
2307 Index: rtems/c/src/lib/libbsp/m68k/mo376/console/sci.c
2308 ===================================================================
2309 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
2310 +++ rtems/c/src/lib/libbsp/m68k/mo376/console/sci.c     2007-08-14 17:20:30.000000000 +0200
2311 @@ -0,0 +1,1596 @@
2312 +/*****************************************************************************
2313 +* File:     sci.c
2314 +*
2315 +* Desc:     This file contains the console IO routines for the SCI port.
2316 +*           There are two interfaces in this module. One is for the rtems
2317 +*           termios/console code and the other is a device driver interface.
2318 +*           This module works together with the termio module which is
2319 +*           sometimes referred to as the "line disciplines" which implements
2320 +*           terminal i/o processing like tabs, backspaces, and newlines.
2321 +*           The rtems printf uses interrupt io and the rtems printk routine
2322 +*           uses polled io which is better for debugging.
2323 +*
2324 +* Index:    Documentation
2325 +*           Section A  - Include Files
2326 +*           Section B  - Manifest Constants
2327 +*           Section C  - External Data
2328 +*           Section D  - External Functions
2329 +*           Section E  - Local Functions
2330 +*           Section F  - Local Variables
2331 +*           Section G  - A circular data buffer for rcv chars
2332 +*           Section H  - RTEMS termios callbacks for the interrupt api
2333 +*           Section I  - RTEMS termios callbacks for the polled api
2334 +
2335 +*           Section 0  - Miscellaneous routines
2336 +*           Section 1  - Routines to manipulate the circular buffer
2337 +*           Section 2  - Interrupt based entry points for the termios module
2338 +*           Section 3  - Polling based entry points for the termios module
2339 +*           Section 4  - Device driver public api entry points
2340 +*           Section 5  - Hardware level routines
2341 +*           Section 6  - Testing and debugging code
2342 +*
2343 +* Refer:    Motorola QSM Reference Manual - Chapter 5 - SCI sub-module
2344 +*
2345 +* Note:     See bsp.h,confdefs.h,system.h for installing drivers into RTEMS.
2346 +*
2347 +* $Id: sci.c,v 1.11 2006/09/11 21:43:53 joel Exp $
2348 +*
2349 +*****************************************************************************/
2350 +\f
2351 +/*****************************************************************************
2352 +  Overview of serial port console terminal input/output
2353 +*****************************************************************************/
2354 +
2355 +/*
2356 +   +-----------+                               +---------+
2357 +   |    app    |                               |   app   |
2358 +   +-----------+                               +---------+
2359 +         |                                          |
2360 +         | (printf,scanf,etc.)                      |
2361 +         v                                          |
2362 +   +-----------+                                    |
2363 +   |    libc   |                                    |
2364 +   +-----------+                                    |
2365 +         |                                          |
2366 +         |                                          |
2367 +         |     (open,close,read,write,ioctl)        |
2368 +   ======|==========================================|========================
2369 +         | /dev/console                             | /dev/sci
2370 +         | (stdin,stdout,stderr)                    |
2371 +   ======|==========================================|========================
2372 +         |                                          |
2373 +         |                                          |
2374 +         v                                          v
2375 +   +-----------+         +-----------+         +---------+
2376 +   |  console  |  <--->  |  termios  |  <--->  |   sci   |
2377 +   |  driver   |         |  module   |         |  driver |
2378 +   +-----------+         +-----------+         +---------+
2379 +                                                    |
2380 +                                                    |
2381 +                                                    v
2382 +                                               +---------+
2383 +                                               |         |
2384 +                                               |  uart   |
2385 +                                               |         |
2386 +                                               +---------+
2387 +*/
2388 +\f
2389 +
2390 +/*****************************************************************************
2391 +  Section A - Include Files
2392 +*****************************************************************************/
2393 +
2394 +#include <rtems.h>
2395 +#include <bsp.h>
2396 +#include <rtems/bspIo.h>
2397 +#include <stdio.h>
2398 +#include <rtems/libio.h>
2399 +#include <libchip/serial.h>
2400 +#include <libchip/sersupp.h>
2401 +#include "sci.h"
2402 +/*#include "../misc/include/cpu332.h" */
2403 +\f
2404 +
2405 +/*****************************************************************************
2406 +  Section B - Manifest Constants
2407 +*****************************************************************************/
2408 +
2409 +#define SCI_MINOR       0                   /* minor device number */
2410 +
2411 +/* IMPORTANT - if the device driver api is opened, it means the sci is being
2412 + * used for direct hardware access, so other users (like termios) get ignored
2413 + */
2414 +#define DRIVER_CLOSED   0                   /* the device driver api is closed */
2415 +#define DRIVER_OPENED   1                   /* the device driver api is opened */
2416 +
2417 +/* system clock definitions, i dont have documentation on this... */
2418 +
2419 +#if 0 /* Not needed, this is provided in mrm332.h */
2420 +#define XTAL            32768.0    /* crystal frequency in Hz */
2421 +#define NUMB_W          0          /* system clock parameters */
2422 +#define NUMB_X          1
2423 +#define NUMB_Y          0x38       /* for 14.942 Mhz */
2424 +#define NUMB_Y          0x3F       /* for 16.777 Mhz */
2425 +
2426 +#define SYS_CLOCK       (XTAL * 4.0 * (NUMB_Y+1) * (1 << (2 * NUMB_W + NUMB_X)))
2427 +
2428 +#endif
2429 +\f
2430 +
2431 +/*****************************************************************************
2432 +  Section C - External Data
2433 +*****************************************************************************/
2434 +
2435 +\f
2436 +
2437 +/*****************************************************************************
2438 +  Section D - External Functions
2439 +*****************************************************************************/
2440 +
2441 +\f
2442 +
2443 +/*****************************************************************************
2444 +  Section E - Local Functions
2445 +*****************************************************************************/
2446 +
2447 +void SCI_output_char(char c);
2448 +
2449 +/*rtems_isr SciIsr( rtems_vector_number vector );   interrupt handler */
2450 +
2451 +const rtems_termios_callbacks * SciGetTermiosHandlers( int32_t   polled );
2452 +
2453 +rtems_device_driver SciInitialize(                     /* device driver api */
2454 +    rtems_device_major_number, rtems_device_minor_number, void *);
2455 +rtems_device_driver SciOpen(                           /* device driver api */
2456 +    rtems_device_major_number, rtems_device_minor_number, void *);
2457 +rtems_device_driver SciClose(                          /* device driver api */
2458 +    rtems_device_major_number, rtems_device_minor_number, void *);
2459 +rtems_device_driver SciRead(                           /* device driver api */
2460 +    rtems_device_major_number, rtems_device_minor_number, void *);
2461 +rtems_device_driver SciWrite(                          /* device driver api */
2462 +    rtems_device_major_number, rtems_device_minor_number, void *);
2463 +rtems_device_driver SciControl(                        /* device driver api */
2464 +    rtems_device_major_number, rtems_device_minor_number, void *);
2465 +rtems_device_driver SciRead (
2466 +    rtems_device_major_number, rtems_device_minor_number, void *);
2467 +
2468 +int   SciInterruptOpen(int, int, void *);               /* termios api */
2469 +int   SciInterruptClose(int, int, void *);              /* termios api */
2470 +int   SciInterruptWrite(int, const char *, int);        /* termios api */
2471 +
2472 +int   SciSetAttributes(int, const struct termios*);     /* termios api */
2473 +int   SciPolledOpen(int, int, void *);                  /* termios api */
2474 +int   SciPolledClose(int, int, void *);                 /* termios api */
2475 +int   SciPolledRead(int);                               /* termios api */
2476 +int   SciPolledWrite(int, const char *, int);           /* termios api */
2477 +
2478 +static void SciSetBaud(uint32_t   rate);                /* hardware routine */
2479 +static void SciSetDataBits(uint16_t   bits);            /* hardware routine */
2480 +static void SciSetParity(uint16_t   parity);            /* hardware routine */
2481 +
2482 +static void inline SciDisableAllInterrupts( void );     /* hardware routine */
2483 +static void inline SciDisableTransmitInterrupts( void );/* hardware routine */
2484 +static void inline SciDisableReceiveInterrupts( void ); /* hardware routine */
2485 +
2486 +static void inline SciEnableTransmitInterrupts( void ); /* hardware routine */
2487 +static void inline SciEnableReceiveInterrupts( void );  /* hardware routine */
2488 +
2489 +static void inline SciDisableReceiver( void );          /* hardware routine */
2490 +static void inline SciDisableTransmitter( void );       /* hardware routine */
2491 +
2492 +static void inline SciEnableReceiver( void );           /* hardware routine */
2493 +static void inline SciEnableTransmitter( void );        /* hardware routine */
2494 +
2495 +void SciWriteCharWait  ( uint8_t );                     /* hardware routine */
2496 +void SciWriteCharNoWait( uint8_t );                     /* hardware routine */
2497 +
2498 +uint8_t   inline SciCharAvailable( void );              /* hardware routine */
2499 +
2500 +uint8_t   inline SciReadCharWait( void );               /* hardware routine */
2501 +uint8_t   inline SciReadCharNoWait( void );             /* hardware routine */
2502 +
2503 +void SciSendBreak( void );                              /* test routine */
2504 +
2505 +static int8_t   SciRcvBufGetChar();                     /* circular rcv buf */
2506 +static void    SciRcvBufPutChar( uint8_t);              /* circular rcv buf */
2507 +#if 0
2508 +static void    SciRcvBufFlush( void );                  /* unused routine */
2509 +#endif
2510 +
2511 +void SciUnitTest();                                     /* test routine */
2512 +void SciPrintStats();                                   /* test routine */
2513 +\f
2514 +
2515 +/*****************************************************************************
2516 +  Section F - Local Variables
2517 +*****************************************************************************/
2518 +
2519 +static struct rtems_termios_tty *SciTermioTty;
2520 +
2521 +static uint8_t   SciInited = 0;             /* has the driver been inited */
2522 +
2523 +static uint8_t   SciOpened;                 /* has the driver been opened */
2524 +
2525 +static uint8_t   SciMajor;                  /* major device number */
2526 +
2527 +static uint16_t   SciBaud;                  /* current value in baud register */
2528 +
2529 +static uint32_t   SciBytesIn  = 0;          /* bytes received */
2530 +static uint32_t   SciBytesOut = 0;          /* bytes transmitted */
2531 +
2532 +static uint32_t   SciErrorsParity  = 0;     /* error counter */
2533 +static uint32_t   SciErrorsNoise   = 0;     /* error counter */
2534 +static uint32_t   SciErrorsFraming = 0;     /* error counter */
2535 +static uint32_t   SciErrorsOverrun = 0;     /* error counter */
2536 +
2537 +#if defined(CONSOLE_SCI)
2538 +
2539 +/* this is what rtems printk uses to do polling based output */
2540 +
2541 +BSP_output_char_function_type      BSP_output_char = SCI_output_char;
2542 +BSP_polling_getchar_function_type  BSP_poll_char   = NULL;
2543 +
2544 +#endif
2545 +
2546 +/* cvs id string so you can use the unix ident command on the object */
2547 +
2548 +#ifdef ID_STRINGS
2549 +static const char SciIdent[]="$Id: sci.c,v 1.11 2006/09/11 21:43:53 joel Exp $";
2550 +#endif
2551 +\f
2552 +
2553 +/*****************************************************************************
2554 +  Section G - A circular buffer for rcv chars when the driver interface is used.
2555 +*****************************************************************************/
2556 +
2557 +/* it is trivial to wrap your buffer pointers when size is a power of two */
2558 +
2559 +#define SCI_RCV_BUF_SIZE        256         /* must be a power of 2 !!! */
2560 +
2561 +/* if someone opens the sci device using the device driver interface,
2562 + * then the receive data interrupt handler will put characters in this buffer
2563 + * instead of sending them up to the termios module for the console
2564 + */
2565 +static uint8_t   SciRcvBuffer[SCI_RCV_BUF_SIZE];
2566 +
2567 +static uint8_t   SciRcvBufPutIndex = 0; /* array index to put in next char */
2568 +
2569 +static uint8_t   SciRcvBufGetIndex = 0; /* array index to take out next char */
2570 +
2571 +static uint16_t  SciRcvBufCount = 0;   /* how many bytes are in the buffer */
2572 +
2573 +\f
2574 +
2575 +/*****************************************************************************
2576 +  Section H - RTEMS termios callbacks for the interrupt version of the driver
2577 +*****************************************************************************/
2578 +
2579 +static const rtems_termios_callbacks SciInterruptCallbacks =
2580 +{
2581 +    SciInterruptOpen,                       /* first open */
2582 +    SciInterruptClose,                      /* last close */
2583 +    NULL,                                   /* polled read (not required) */
2584 +    SciInterruptWrite,                      /* write */
2585 +    SciSetAttributes,                       /* set attributes */
2586 +    NULL,                                   /* stop remote xmit */
2587 +    NULL,                                   /* start remote xmit */
2588 +    TRUE                                    /* output uses interrupts */
2589 +};
2590 +
2591 +/*****************************************************************************
2592 +  Section I - RTEMS termios callbacks for the polled version of the driver
2593 +*****************************************************************************/
2594 +
2595 +static const rtems_termios_callbacks SciPolledCallbacks =
2596 +{
2597 +    SciPolledOpen,                          /* first open */
2598 +    SciPolledClose,                         /* last close */
2599 +    SciPolledRead,                          /* polled read */
2600 +    SciPolledWrite,                         /* write */
2601 +    SciSetAttributes,                       /* set attributes */
2602 +    NULL,                                   /* stop remote xmit */
2603 +    NULL,                                   /* start remote xmit */
2604 +    FALSE                                   /* output uses interrupts */
2605 +};
2606 +\f
2607 +
2608 +/*
2609 + *                              SECTION 0
2610 + *                        MISCELLANEOUS ROUTINES
2611 + */
2612 +
2613 +/****************************************************************************
2614 + * Func:     SCI_output_char
2615 + * Desc:     used by rtems printk function to send a char to the uart
2616 + * Inputs:   the character to transmit
2617 + * Outputs:  none
2618 + * Errors:   none
2619 + * Scope:    public
2620 + ****************************************************************************/
2621 +
2622 +void SCI_output_char(char c)
2623 +{
2624 +/*  ( minor device number, pointer to the character, length ) */
2625 +
2626 +    SciPolledWrite( SCI_MINOR, &c, 1);
2627 +
2628 +    return;
2629 +}
2630 +\f
2631 +
2632 +/****************************************************************************
2633 +* Func:     SciGetTermiosHandlers
2634 +* Desc:     returns a pointer to the table of serial io functions
2635 +*           this is called from console_open with polled set to false
2636 +* Inputs:   flag indicating whether we want polled or interrupt driven io
2637 +* Outputs:  pointer to function table
2638 +* Errors:   none
2639 +* Scope:    public
2640 +****************************************************************************/
2641 +
2642 +const rtems_termios_callbacks * SciGetTermiosHandlers( int32_t   polled )
2643 +{
2644 +    if ( polled )
2645 +    {
2646 +        return &SciPolledCallbacks;             /* polling based */
2647 +    }
2648 +    else
2649 +    {
2650 +        return &SciInterruptCallbacks;          /* interrupt driven */
2651 +    }
2652 +}
2653 +\f
2654 +
2655 +/****************************************************************************
2656 +* Func:     SciIsr
2657 +* Desc:     interrupt handler for serial communications interface
2658 +* Inputs:   vector number - unused
2659 +* Outputs:  none
2660 +* Errors:   none
2661 +* Scope:    public API
2662 +****************************************************************************/
2663 +
2664 +rtems_isr SciIsr( rtems_vector_number vector )
2665 +{
2666 +    uint8_t   ch;
2667 +
2668 +    if ( (*SCSR) & SCI_ERROR_PARITY  )   SciErrorsParity  ++;
2669 +    if ( (*SCSR) & SCI_ERROR_FRAMING )   SciErrorsFraming ++;
2670 +    if ( (*SCSR) & SCI_ERROR_NOISE   )   SciErrorsNoise   ++;
2671 +    if ( (*SCSR) & SCI_ERROR_OVERRUN )   SciErrorsOverrun ++;
2672 +
2673 +    /* see if it was a transmit interrupt */
2674 +
2675 +    if ( (*SCSR) & SCI_XMTR_AVAILABLE )         /* data reg empty, xmt complete */
2676 +    {
2677 +        SciDisableTransmitInterrupts();
2678 +
2679 +        /* tell termios module that the charcter was sent */
2680 +        /* he will call us later to transmit more if there are any */
2681 +
2682 +        if (rtems_termios_dequeue_characters( SciTermioTty, 1 ))
2683 +        {
2684 +            /* there are more bytes to transmit so enable TX interrupt */
2685 +
2686 +            SciEnableTransmitInterrupts();
2687 +        }
2688 +    }
2689 +
2690 +    /* see if it was a receive interrupt */
2691 +    /* on the sci uart we just get one character per interrupt */
2692 +
2693 +    while (  SciCharAvailable() )               /* char in data register? */
2694 +    {
2695 +        ch = SciReadCharNoWait();               /* get the char from the uart */
2696 +
2697 +        /* IMPORTANT!!! */
2698 +        /* either send it to the termios module or keep it locally */
2699 +
2700 +        if ( SciOpened == DRIVER_OPENED )       /* the driver is open */
2701 +        {
2702 +            SciRcvBufPutChar(ch);               /* keep it locally */
2703 +        }
2704 +        else                                    /* put in termios buffer */
2705 +        {
2706 +            char c = (char) ch;
2707 +            rtems_termios_enqueue_raw_characters( SciTermioTty, &c, 1 );
2708 +        }
2709 +
2710 +        *SCSR &= SCI_CLEAR_RX_INT;              /* clear the interrupt */
2711 +    }
2712 +}
2713 +\f
2714 +
2715 +/*
2716 + *                              SECTION 1
2717 + *                ROUTINES TO MANIPULATE THE CIRCULAR BUFFER
2718 + */
2719 +
2720 +/****************************************************************************
2721 +* Func:     SciRcvBufGetChar
2722 +* Desc:     read a character from the circular buffer
2723 +*           make sure there is data before you call this!
2724 +* Inputs:   none
2725 +* Outputs:  the character or -1
2726 +* Errors:   none
2727 +* Scope:    private
2728 +****************************************************************************/
2729 +
2730 +static int8_t   SciRcvBufGetChar()
2731 +{
2732 +    rtems_interrupt_level level;
2733 +    uint8_t   ch;
2734 +
2735 +    if ( SciRcvBufCount == 0 )
2736 +    {
2737 +        rtems_fatal_error_occurred(0xDEAD);     /* check the count first! */
2738 +    }
2739 +
2740 +    rtems_interrupt_disable( level );           /* disable interrupts */
2741 +
2742 +    ch = SciRcvBuffer[SciRcvBufGetIndex];       /* get next byte */
2743 +
2744 +    SciRcvBufGetIndex++;                        /* bump the index */
2745 +
2746 +    SciRcvBufGetIndex &= SCI_RCV_BUF_SIZE - 1;  /* and wrap it */
2747 +
2748 +    SciRcvBufCount--;                           /* decrement counter */
2749 +
2750 +    rtems_interrupt_enable( level );            /* restore interrupts */
2751 +
2752 +    return ch;                                  /* return the char */
2753 +}
2754 +\f
2755 +
2756 +/****************************************************************************
2757 +* Func:     SciRcvBufPutChar
2758 +* Desc:     put a character into the rcv data circular buffer
2759 +* Inputs:   the character
2760 +* Outputs:  none
2761 +* Errors:   none
2762 +* Scope:    private
2763 +****************************************************************************/
2764 +
2765 +static void SciRcvBufPutChar( uint8_t   ch )
2766 +{
2767 +    rtems_interrupt_level level;
2768 +
2769 +    if ( SciRcvBufCount == SCI_RCV_BUF_SIZE )   /* is there room? */
2770 +    {
2771 +        return;                                 /* no, throw it away */
2772 +    }
2773 +
2774 +    rtems_interrupt_disable( level );           /* disable interrupts */
2775 +
2776 +    SciRcvBuffer[SciRcvBufPutIndex] = ch;       /* put it in the buf */
2777 +
2778 +    SciRcvBufPutIndex++;                        /* bump the index */
2779 +
2780 +    SciRcvBufPutIndex &= SCI_RCV_BUF_SIZE - 1;  /* and wrap it */
2781 +
2782 +    SciRcvBufCount++;                           /* increment counter */
2783 +
2784 +    rtems_interrupt_enable( level );            /* restore interrupts */
2785 +
2786 +    return;                                     /* return */
2787 +}
2788 +\f
2789 +
2790 +/****************************************************************************
2791 +* Func:     SciRcvBufFlush
2792 +* Desc:     completely reset and clear the rcv buffer
2793 +* Inputs:   none
2794 +* Outputs:  none
2795 +* Errors:   none
2796 +* Scope:    private
2797 +****************************************************************************/
2798 +
2799 +#if 0                                           /* prevents compiler warning */
2800 +static void SciRcvBufFlush( void )
2801 +{
2802 +    rtems_interrupt_level level;
2803 +
2804 +    rtems_interrupt_disable( level );           /* disable interrupts */
2805 +
2806 +    memset( SciRcvBuffer, 0, sizeof(SciRcvBuffer) );
2807 +
2808 +    SciRcvBufPutIndex = 0;                      /* clear */
2809 +
2810 +    SciRcvBufGetIndex = 0;                      /* clear */
2811 +
2812 +    SciRcvBufCount = 0;                         /* clear */
2813 +
2814 +    rtems_interrupt_enable( level );            /* restore interrupts */
2815 +
2816 +    return;                                     /* return */
2817 +}
2818 +#endif
2819 +\f
2820 +
2821 +/*
2822 + *
2823 + *                              SECTION 2
2824 + *            INTERRUPT BASED ENTRY POINTS FOR THE TERMIOS MODULE
2825 + */
2826 +
2827 +/****************************************************************************
2828 +* Func:     SciInterruptOpen
2829 +* Desc:     open routine for the interrupt based device driver
2830 +*           Default state is 9600 baud, 8 bits, No parity, and 1 stop bit. ??
2831 +**CHANGED** Default baud rate is now 19200, 8N1
2832 +*           called from rtems_termios_open which is called from console_open
2833 +* Inputs:   major - device number
2834 +*           minor - device number
2835 +*           args - points to terminal info
2836 +* Outputs:  success/fail
2837 +* Errors:   none
2838 +* Scope:    public API
2839 +****************************************************************************/
2840 +
2841 +int   SciInterruptOpen(
2842 +    int    major,
2843 +    int    minor,
2844 +    void  *arg
2845 +)
2846 +{
2847 +    rtems_libio_open_close_args_t * args = arg;
2848 +    rtems_isr_entry old_vector;
2849 +
2850 +    if ( minor != SCI_MINOR )                   /* check minor device num */
2851 +    {
2852 +        return -1;
2853 +    }
2854 +
2855 +    if ( !args )                                /* must have args */
2856 +    {
2857 +        return -1;
2858 +    }
2859 +
2860 +    SciTermioTty = args->iop->data1;            /* save address of struct */
2861 +
2862 +    SciDisableAllInterrupts();                  /* turn off sci interrupts */
2863 +
2864 +    /* THIS IS ACTUALLY A BAD THING - SETTING LINE PARAMETERS HERE */
2865 +    /* IT SHOULD BE DONE THROUGH TCSETATTR() WHEN THE CONSOLE IS OPENED!!! */
2866 +
2867 +/*  SciSetBaud(115200);                         set the baud rate */
2868 +/*  SciSetBaud( 57600);                         set the baud rate */
2869 +/*  SciSetBaud( 38400);                         set the baud rate */
2870 +    SciSetBaud( 19200);                      /* set the baud rate */
2871 +/*  SciSetBaud(  9600);                         set the baud rate */
2872 +
2873 +    SciSetParity(SCI_PARITY_NONE);              /* set parity to none */
2874 +
2875 +    SciSetDataBits(SCI_8_DATA_BITS);            /* set data bits to 8 */
2876 +
2877 +    /* Install our interrupt handler into RTEMS, where does 66 come from? */
2878 +
2879 +    rtems_interrupt_catch( SciIsr, 66, &old_vector );
2880 +
2881 +    *QIVR  = 66;
2882 +    *QIVR &= 0xf8;
2883 +    *QILR |= 0x06 & 0x07;
2884 +
2885 +    SciEnableTransmitter();                     /* enable the transmitter */
2886 +
2887 +    SciEnableReceiver();                        /* enable the receiver */
2888 +
2889 +    SciEnableReceiveInterrupts();               /* enable rcv interrupts */
2890 +
2891 +    return RTEMS_SUCCESSFUL;
2892 +}
2893 +\f
2894 +
2895 +/****************************************************************************
2896 +* Func:     SciInterruptClose
2897 +* Desc:     close routine called by the termios module
2898 +* Inputs:   major - device number
2899 +*           minor - device number
2900 +*           args - unused
2901 +* Outputs:  success/fail
2902 +* Errors:   none
2903 +* Scope:    public - termio entry point
2904 +****************************************************************************/
2905 +
2906 +int   SciInterruptClose(
2907 +    int    major,
2908 +    int    minor,
2909 +    void  *arg
2910 +)
2911 +{
2912 +    SciDisableAllInterrupts();
2913 +
2914 +    return RTEMS_SUCCESSFUL;
2915 +}
2916 +\f
2917 +
2918 +/****************************************************************************
2919 +* Func:     SciInterruptWrite
2920 +* Desc:     writes data to the uart using transmit interrupts
2921 +* Inputs:   minor - device number
2922 +*           buf - points to the data
2923 +*           len - number of bytes to send
2924 +* Outputs:  success/fail
2925 +* Errors:   none
2926 +* Scope:    public API
2927 +****************************************************************************/
2928 +
2929 +int   SciInterruptWrite(
2930 +    int         minor,
2931 +    const char *buf,
2932 +    int         len
2933 +)
2934 +{
2935 +    /* We are using interrupt driven output so termios only sends us */
2936 +    /* one character at a time. The sci does not have a fifo. */
2937 +
2938 +    if ( !len )                                 /* no data? */
2939 +    {
2940 +        return 0;                               /* return error */
2941 +    }
2942 +
2943 +    if ( minor != SCI_MINOR )                   /* check the minor dev num */
2944 +    {
2945 +        return 0;                               /* return error */
2946 +    }
2947 +
2948 +    if ( SciOpened == DRIVER_OPENED )           /* is the driver api open? */
2949 +    {
2950 +        return 1;                               /* yep, throw this away */
2951 +    }
2952 +
2953 +    SciWriteCharNoWait(*buf);                   /* try to send a char */
2954 +
2955 +    *SCSR &= SCI_CLEAR_TDRE;                    /* clear tx data reg empty flag */
2956 +
2957 +    SciEnableTransmitInterrupts();              /* enable the tx interrupt */
2958 +
2959 +    return 1;                                   /* return success */
2960 +}
2961 +\f
2962 +
2963 +/****************************************************************************
2964 +* Func:     SciSetAttributes
2965 +* Desc:     setup the uart based on the termios modules requests
2966 +* Inputs:   minor - device number
2967 +*           t - pointer to the termios info struct
2968 +* Outputs:  none
2969 +* Errors:   none
2970 +* Scope:    public API
2971 +****************************************************************************/
2972 +
2973 +int   SciSetAttributes(
2974 +    int                   minor,
2975 +    const struct termios *t
2976 +)
2977 +{
2978 +    uint32_t    baud_requested;
2979 +    uint32_t    sci_rate = 0;
2980 +    uint16_t    sci_parity = 0;
2981 +    uint16_t    sci_databits = 0;
2982 +
2983 +    if ( minor != SCI_MINOR )                   /* check the minor dev num */
2984 +    {
2985 +        return -1;                              /* return error */
2986 +    }
2987 +
2988 +    /* if you look closely you will see this is the only thing we use */
2989 +    /* set the baud rate */
2990 +
2991 +    baud_requested = t->c_cflag & CBAUD;        /* baud rate */
2992 +
2993 +    if (!baud_requested)
2994 +    {
2995 +/*        baud_requested = B9600;                   default to 9600 baud */
2996 +        baud_requested = B19200;                 /* default to 19200 baud */
2997 +    }
2998 +
2999 +    sci_rate = termios_baud_to_number( baud_requested );
3000 +
3001 +    /* parity error detection */
3002 +
3003 +    if (t->c_cflag & PARENB)                    /* enable parity detection? */
3004 +    {
3005 +        if (t->c_cflag & PARODD)
3006 +        {
3007 +            sci_parity = SCI_PARITY_ODD;        /* select odd parity */
3008 +        }
3009 +        else
3010 +        {
3011 +            sci_parity = SCI_PARITY_EVEN;       /* select even parity */
3012 +        }
3013 +    }
3014 +    else
3015 +    {
3016 +        sci_parity = SCI_PARITY_NONE;           /* no parity, most common */
3017 +    }
3018 +
3019 +    /*  set the number of data bits, 8 is most common */
3020 +
3021 +    if (t->c_cflag & CSIZE)                     /* was it specified? */
3022 +    {
3023 +        switch (t->c_cflag & CSIZE)
3024 +        {
3025 +            case CS8:   sci_databits = SCI_8_DATA_BITS;   break;
3026 +            default :   sci_databits = SCI_9_DATA_BITS;   break;
3027 +        }
3028 +    }
3029 +    else
3030 +    {
3031 +        sci_databits = SCI_8_DATA_BITS;         /* default to 8 data bits */
3032 +    }
3033 +
3034 +    /*  the number of stop bits; always 1 for SCI */
3035 +
3036 +    if (t->c_cflag & CSTOPB)
3037 +    {
3038 +        /* do nothing */
3039 +    }
3040 +
3041 +    /* setup the hardware with these serial port parameters */
3042 +
3043 +    SciSetBaud(sci_rate);                       /* set the baud rate */
3044 +    SciSetParity(sci_parity);                   /* set the parity type */
3045 +    SciSetDataBits(sci_databits);               /* set the data bits */
3046 +
3047 +    return RTEMS_SUCCESSFUL;
3048 +}
3049 +\f
3050 +
3051 +/*
3052 + *
3053 + *                              SECTION 3
3054 + *            POLLING BASED ENTRY POINTS FOR THE TERMIOS MODULE
3055 + */
3056 +
3057 +/****************************************************************************
3058 +* Func:     SciPolledOpen
3059 +* Desc:     open routine for the polled i/o version of the driver
3060 +*           called from rtems_termios_open which is called from console_open
3061 +* Inputs:   major - device number
3062 +*           minor - device number
3063 +*           args - points to terminal info struct
3064 +* Outputs:  success/fail
3065 +* Errors:   none
3066 +* Scope:    public - termios entry point
3067 +****************************************************************************/
3068 +
3069 +int   SciPolledOpen(
3070 +    int   major,
3071 +    int   minor,
3072 +    void *arg
3073 +)
3074 +{
3075 +    rtems_libio_open_close_args_t * args = arg;
3076 +
3077 +    if ( minor != SCI_MINOR )                   /* check minor device num */
3078 +    {
3079 +        return -1;
3080 +    }
3081 +
3082 +    if ( !args )                                /* must have args */
3083 +    {
3084 +        return -1;
3085 +    }
3086 +
3087 +    SciTermioTty = args->iop->data1;            /* Store tty pointer */
3088 +
3089 +    SciDisableAllInterrupts();                  /* don't generate interrupts */
3090 +
3091 +    /* THIS IS ACTUALLY A BAD THING - SETTING LINE PARAMETERS HERE */
3092 +    /* IT SHOULD BE DONE THROUGH TCSETATTR() WHEN THE CONSOLE IS OPENED!!! */
3093 +
3094 +/*  SciSetBaud(115200);                            set the baud rate */
3095 +/*  SciSetBaud( 57600);                            set the baud rate */
3096 +/*  SciSetBaud( 38400);                            set the baud rate */
3097 +  SciSetBaud( 19200);                         /* set the baud rate */
3098 +/*  SciSetBaud(  9600);                            set the baud rate */
3099 +
3100 +    SciSetParity(SCI_PARITY_NONE);              /* set no parity */
3101 +
3102 +    SciSetDataBits(SCI_8_DATA_BITS);            /* set 8 data bits */
3103 +
3104 +    SciEnableTransmitter();                     /* enable the xmitter */
3105 +
3106 +    SciEnableReceiver();                        /* enable the rcvr */
3107 +
3108 +    return RTEMS_SUCCESSFUL;
3109 +}
3110 +\f
3111 +
3112 +/****************************************************************************
3113 +* Func:     SciPolledClose
3114 +* Desc:     close routine for the device driver, same for both
3115 +* Inputs:   major - device number
3116 +*           minor - device number
3117 +*           args - unused
3118 +* Outputs:  success/fail
3119 +* Errors:   none
3120 +* Scope:    public termios API
3121 +****************************************************************************/
3122 +
3123 +int   SciPolledClose(
3124 +    int    major,
3125 +    int    minor,
3126 +    void  *arg
3127 +)
3128 +{
3129 +    SciDisableAllInterrupts();
3130 +
3131 +    return RTEMS_SUCCESSFUL;
3132 +}
3133 +\f
3134 +
3135 +/****************************************************************************
3136 +* Func:     SciPolledRead
3137 +* Desc:     polling based read routine for the uart
3138 +* Inputs:   minor - device number
3139 +* Outputs:  error or the character read
3140 +* Errors:   none
3141 +* Scope:    public API
3142 +****************************************************************************/
3143 +
3144 +int   SciPolledRead(
3145 +    int   minor
3146 +)
3147 +{
3148 +    if ( minor != SCI_MINOR )               /* check the type-punned dev num */
3149 +    {
3150 +        return -1;                          /* return error */
3151 +    }
3152 +
3153 +    if ( SciCharAvailable() )               /* if a char is available */
3154 +    {
3155 +        return SciReadCharNoWait();         /* read the rx data register */
3156 +    }
3157 +
3158 +    return -1;                              /* return error */
3159 +}
3160 +\f
3161 +
3162 +/****************************************************************************
3163 +* Func:     SciPolledWrite
3164 +* Desc:     writes out characters in polled mode, waiting for the uart
3165 +*           check in console_open, but we only seem to use interrupt mode
3166 +* Inputs:   minor - device number
3167 +*           buf - points to the data
3168 +*           len - how many bytes
3169 +* Outputs:  error or number of bytes written
3170 +* Errors:   none
3171 +* Scope:    public termios API
3172 +****************************************************************************/
3173 +
3174 +int   SciPolledWrite(
3175 +    int         minor,
3176 +    const char *buf,
3177 +    int         len
3178 +)
3179 +{
3180 +    int32_t   written = 0;
3181 +
3182 +    if ( minor != SCI_MINOR )                   /* check minor device num */
3183 +    {
3184 +        return -1;
3185 +    }
3186 +
3187 +    if ( SciOpened == DRIVER_OPENED )           /* is the driver api open? */
3188 +    {
3189 +        return -1;                              /* toss the data */
3190 +    }
3191 +
3192 +    /* send each byte in the string out the port */
3193 +
3194 +    while ( written < len )
3195 +    {
3196 +        SciWriteCharWait(*buf++);               /* send a byte */
3197 +
3198 +        written++;                              /* increment counter */
3199 +    }
3200 +
3201 +    return written;                             /* return count */
3202 +}
3203 +\f
3204 +
3205 +/*
3206 + *
3207 + *                              SECTION 4
3208 + *                 DEVICE DRIVER PUBLIC API ENTRY POINTS
3209 + */
3210 +
3211 +/****************************************************************************
3212 +* Func:     SciInit
3213 +* Desc:     Initialize the lasers device driver and hardware
3214 +* Inputs:   major - the major device number which is assigned by rtems
3215 +*           minor - the minor device number which is undefined at this point
3216 +*           arg - ?????
3217 +* Outputs:  RTEMS_SUCCESSFUL
3218 +* Errors:   None.
3219 +* Scope:    public API
3220 +****************************************************************************/
3221 +
3222 +rtems_device_driver SciInitialize (
3223 +    rtems_device_major_number major,
3224 +    rtems_device_minor_number minor,
3225 +    void * arg
3226 +)
3227 +{
3228 +/*     rtems_status_code status; */
3229 +
3230 +/*printk("%s\r\n", __FUNCTION__); */
3231 +
3232 +    /* register the SCI device name for termios console i/o
3233 +     * this is done over in console.c which doesn't seem exactly right
3234 +     * but there were problems doing it here...
3235 +     */
3236 +
3237 +/*  status = rtems_io_register_name( "/dev/sci", major, 0 ); */
3238 +
3239 +/*  if (status != RTEMS_SUCCESSFUL) */
3240 +/*      rtems_fatal_error_occurred(status); */
3241 +
3242 +    SciMajor = major;                           /* save the rtems major number */
3243 +
3244 +    SciOpened = DRIVER_CLOSED;                  /* initial state is closed */
3245 +
3246 +    /* if you have an interrupt handler, install it here */
3247 +
3248 +    SciInited = 1;                              /* set the inited flag */
3249 +
3250 +    return RTEMS_SUCCESSFUL;
3251 +}
3252 +\f
3253 +
3254 +/****************************************************************************
3255 +* Func:     SciOpen
3256 +* Desc:     device driver open routine
3257 +*           you must open a device before you can anything else
3258 +*           only one process can have the device opened at a time
3259 +*           you could look at the task id to restrict access if you want
3260 +* Inputs:   major - the major device number assigned by rtems
3261 +*           minor - the minor device number assigned by us
3262 +*           arg - ?????
3263 +* Outputs:  see below
3264 +* Errors:   none
3265 +* Scope:    public API
3266 +****************************************************************************/
3267 +
3268 +rtems_device_driver SciOpen (
3269 +    rtems_device_major_number major,
3270 +    rtems_device_minor_number minor,
3271 +    void * arg
3272 +)
3273 +{
3274 +/*printk("%s major=%d minor=%d\r\n", __FUNCTION__,major,minor); */
3275 +
3276 +    if (SciInited == 0)                         /* must be initialized first! */
3277 +    {
3278 +        return RTEMS_NOT_CONFIGURED;
3279 +    }
3280 +
3281 +    if (minor != SCI_MINOR)
3282 +    {
3283 +        return RTEMS_INVALID_NAME;              /* verify minor number */
3284 +    }
3285 +
3286 +    if (SciOpened == DRIVER_OPENED)
3287 +    {
3288 +        return RTEMS_RESOURCE_IN_USE;           /* already opened! */
3289 +    }
3290 +
3291 +    SciOpened = DRIVER_OPENED;                  /* set the opened flag */
3292 +
3293 +    return RTEMS_SUCCESSFUL;
3294 +}
3295 +\f
3296 +
3297 +/****************************************************************************
3298 +* Func:     SciClose
3299 +* Desc:     device driver close routine
3300 +*           the device must be opened before you can close it
3301 +*           the device must be closed before someone (else) can open it
3302 +* Inputs:   major - the major device number
3303 +*           minor - the minor device number
3304 +*           arg - ?????
3305 +* Outputs:  see below
3306 +* Errors:   none
3307 +* Scope:    public API
3308 +****************************************************************************/
3309 +
3310 +rtems_device_driver SciClose (
3311 +    rtems_device_major_number major,
3312 +    rtems_device_minor_number minor,
3313 +    void * arg
3314 +)
3315 +{
3316 +/*printk("%s major=%d minor=%d\r\n", __FUNCTION__,major,minor); */
3317 +
3318 +    if (minor != SCI_MINOR)
3319 +    {
3320 +        return RTEMS_INVALID_NAME;              /* check the minor number */
3321 +    }
3322 +
3323 +    if (SciOpened != DRIVER_OPENED)
3324 +    {
3325 +        return RTEMS_INCORRECT_STATE;           /* must be opened first */
3326 +    }
3327 +
3328 +    SciOpened = DRIVER_CLOSED;                  /* set the flag */
3329 +
3330 +    return RTEMS_SUCCESSFUL;
3331 +}
3332 +\f
3333 +
3334 +/****************************************************************************
3335 +* Func:     SciRead
3336 +* Desc:     device driver read routine
3337 +*           this function is not meaningful for the laser devices
3338 +* Inputs:   major - the major device number
3339 +*           minor - the minor device number
3340 +*           arg - read/write arguments
3341 +* Outputs:  see below
3342 +* Errors:   none
3343 +* Scope:    public API
3344 +****************************************************************************/
3345 +
3346 +rtems_device_driver SciRead (
3347 +    rtems_device_major_number major,
3348 +    rtems_device_minor_number minor,
3349 +    void *arg
3350 +)
3351 +{
3352 +    rtems_libio_rw_args_t *rw_args;             /* ptr to argument struct */
3353 +    char      *buffer;
3354 +    uint16_t   length;
3355 +
3356 +    rw_args = (rtems_libio_rw_args_t *) arg;    /* arguments to read() */
3357 +
3358 +    if (minor != SCI_MINOR)
3359 +    {
3360 +        return RTEMS_INVALID_NAME;              /* check the minor number */
3361 +    }
3362 +
3363 +    if (SciOpened == DRIVER_CLOSED)
3364 +    {
3365 +        return RTEMS_INCORRECT_STATE;           /* must be opened first */
3366 +    }
3367 +
3368 +    buffer = rw_args->buffer;                   /* points to user's buffer */
3369 +
3370 +    length = rw_args->count;                    /* how many bytes they want */
3371 +
3372 +/*  *buffer = SciReadCharWait();                   wait for a character */
3373 +
3374 +    /* if there isn't a character available, wait until one shows up */
3375 +    /* or the timeout period expires, which ever happens first */
3376 +
3377 +    if ( SciRcvBufCount == 0 )                  /* no chars */
3378 +    {
3379 +        /* wait for someone to wake me up... */
3380 +        /*rtems_task_wake_after(SciReadTimeout); */
3381 +    }
3382 +
3383 +    if ( SciRcvBufCount )                       /* any characters locally? */
3384 +    {
3385 +        *buffer = SciRcvBufGetChar();           /* get the character */
3386 +
3387 +        rw_args->bytes_moved = 1;               /* how many we actually read */
3388 +    }
3389 +
3390 +    return RTEMS_SUCCESSFUL;
3391 +}
3392 +\f
3393 +
3394 +/****************************************************************************
3395 +* Func:     SciWrite
3396 +* Desc:     device driver write routine
3397 +*           this function is not meaningful for the laser devices
3398 +* Inputs:   major - the major device number
3399 +*           minor - the minor device number
3400 +*           arg - read/write arguments
3401 +* Outputs:  see below
3402 +* Errors:   non3
3403 +* Scope:    public API
3404 +****************************************************************************/
3405 +
3406 +rtems_device_driver SciWrite (
3407 +    rtems_device_major_number major,
3408 +    rtems_device_minor_number minor,
3409 +    void * arg
3410 +)
3411 +{
3412 +    rtems_libio_rw_args_t *rw_args;             /* ptr to argument struct */
3413 +    uint8_t   *buffer;
3414 +    uint16_t   length;
3415 +
3416 +    rw_args = (rtems_libio_rw_args_t *) arg;
3417 +
3418 +    if (minor != SCI_MINOR)
3419 +    {
3420 +        return RTEMS_INVALID_NAME;              /* check the minor number */
3421 +    }
3422 +
3423 +    if (SciOpened == DRIVER_CLOSED)
3424 +    {
3425 +        return RTEMS_INCORRECT_STATE;           /* must be opened first */
3426 +    }
3427 +
3428 +    buffer = (uint8_t*)rw_args->buffer;       /* points to data */
3429 +
3430 +    length = rw_args->count;                    /* how many bytes */
3431 +
3432 +    while (length--)
3433 +    {
3434 +        SciWriteCharWait(*buffer++);            /* send the bytes out */
3435 +    }
3436 +
3437 +    rw_args->bytes_moved = rw_args->count;      /* how many we wrote */
3438 +
3439 +    return RTEMS_SUCCESSFUL;
3440 +}
3441 +\f
3442 +
3443 +/****************************************************************************
3444 +* Func:     SciControl
3445 +* Desc:     device driver control routine
3446 +*           see below for an example of how to use the ioctl interface
3447 +* Inputs:   major - the major device number
3448 +*           minor - the minor device number
3449 +*           arg - io control args
3450 +* Outputs:  see below
3451 +* Errors:   none
3452 +* Scope:    public API
3453 +****************************************************************************/
3454 +
3455 +rtems_device_driver SciControl (
3456 +    rtems_device_major_number major,
3457 +    rtems_device_minor_number minor,
3458 +    void * arg
3459 +)
3460 +{
3461 +    rtems_libio_ioctl_args_t *args = arg;       /* rtems arg struct */
3462 +    uint16_t   command;                         /* the cmd to execute */
3463 +    uint16_t   unused;                          /* maybe later */
3464 +    uint16_t   *ptr;                            /* ptr to user data */
3465 +
3466 +/*printk("%s major=%d minor=%d\r\n", __FUNCTION__,major,minor); */
3467 +
3468 +    /* do some sanity checking */
3469 +
3470 +    if (minor != SCI_MINOR)
3471 +    {
3472 +        return RTEMS_INVALID_NAME;              /* check the minor number */
3473 +    }
3474 +
3475 +    if (SciOpened == DRIVER_CLOSED)
3476 +    {
3477 +        return RTEMS_INCORRECT_STATE;           /* must be open first */
3478 +    }
3479 +
3480 +    if (args == 0)
3481 +    {
3482 +        return RTEMS_INVALID_ADDRESS;           /* must have args */
3483 +    }
3484 +
3485 +    args->ioctl_return = -1;                    /* assume an error */
3486 +
3487 +    command = args->command;                    /* get the command */
3488 +    ptr     = args->buffer;                     /* this is an address */
3489 +    unused  = *ptr;                             /* brightness */
3490 +
3491 +    if (command == SCI_SEND_BREAK)              /* process the command */
3492 +    {
3493 +        SciSendBreak();                         /* send break char */
3494 +    }
3495 +
3496 +    args->ioctl_return = 0;                     /* return status */
3497 +
3498 +    return RTEMS_SUCCESSFUL;
3499 +}
3500 +\f
3501 +
3502 +/*
3503 + *
3504 + *                              SECTION 5
3505 + *                       HARDWARE LEVEL ROUTINES
3506 + */
3507 +
3508 +/****************************************************************************
3509 +* Func:     SciSetBaud
3510 +* Desc:     setup the uart based on the termios modules requests
3511 +* Inputs:   baud rate
3512 +* Outputs:  none
3513 +* Errors:   none
3514 +* Scope:    private
3515 +****************************************************************************/
3516 +
3517 +static void SciSetBaud(uint32_t   rate)
3518 +{
3519 +    uint16_t   value;
3520 +    uint16_t   save_sccr1;
3521 +
3522 +/* when you open the console you need to set the termio struct baud rate */
3523 +/* it has a default value of 9600, when someone calls tcsetattr it reverts! */
3524 +
3525 +    SciBaud = rate;                             /* save the rate */
3526 +
3527 +    /* calculate the register value as a float and convert to an int */
3528 +    /* set baud rate - you must define the system clock constant */
3529 +    /* see mrm332.h for an example */
3530 +
3531 +    value = ( (uint16_t) ( SYS_CLOCK / rate / 32.0 + 0.5 ) & 0x1fff );
3532 +
3533 +    save_sccr1 = *SCCR1;                        /* save register */
3534 +
3535 +    /* also turns off the xmtr and rcvr */
3536 +
3537 +    *SCCR1 &= SCI_DISABLE_INT_ALL;              /* disable interrupts */
3538 +
3539 +    *SCCR0 = value;                             /* write the register */
3540 +
3541 +    *SCCR1 = save_sccr1;                        /* restore register */
3542 +
3543 +    return;
3544 +}
3545 +\f
3546 +
3547 +/****************************************************************************
3548 +* Func:     SciSetParity
3549 +* Desc:     setup the uart based on the termios modules requests
3550 +* Inputs:   parity
3551 +* Outputs:  none
3552 +* Errors:   none
3553 +* Scope:    private
3554 +****************************************************************************/
3555 +
3556 +static void SciSetParity(uint16_t   parity)
3557 +{
3558 +    uint16_t   value;
3559 +
3560 +    value = *SCCR1;                             /* get the register */
3561 +
3562 +    if (parity == SCI_PARITY_ODD)
3563 +    {
3564 +        value |= SCI_PARITY_ENABLE;             /* parity enabled */
3565 +        value |= SCI_PARITY_ODD;                /* parity odd */
3566 +    }
3567 +
3568 +    else if (parity == SCI_PARITY_EVEN)
3569 +    {
3570 +        value |= SCI_PARITY_ENABLE;             /* parity enabled */
3571 +        value &= ~SCI_PARITY_ODD;               /* parity even */
3572 +    }
3573 +
3574 +    else if (parity == SCI_PARITY_NONE)
3575 +    {
3576 +        value &= ~SCI_PARITY_ENABLE;            /* disabled, most common */
3577 +    }
3578 +
3579 +    /* else no changes */
3580 +
3581 +    *SCCR1 = value;                             /* write the register */
3582 +
3583 +    return;
3584 +}
3585 +\f
3586 +
3587 +/****************************************************************************
3588 +* Func:     SciSetDataBits
3589 +* Desc:     setup the uart based on the termios modules requests
3590 +* Inputs:   data bits
3591 +* Outputs:  none
3592 +* Errors:   none
3593 +* Scope:    private
3594 +****************************************************************************/
3595 +
3596 +static void SciSetDataBits(uint16_t   bits)
3597 +{
3598 +    uint16_t   value;
3599 +
3600 +    value = *SCCR1;                             /* get the register */
3601 +
3602 +    /* note - the parity setting affects the number of data bits */
3603 +
3604 +    if (bits == SCI_9_DATA_BITS)
3605 +    {
3606 +        value |= SCI_9_DATA_BITS;               /* 9 data bits */
3607 +    }
3608 +
3609 +    else if (bits == SCI_8_DATA_BITS)
3610 +    {
3611 +        value &= SCI_8_DATA_BITS;               /* 8 data bits */
3612 +    }
3613 +
3614 +    /* else no changes */
3615 +
3616 +    *SCCR1 = value;                             /* write the register */
3617 +
3618 +    return;
3619 +}
3620 +\f
3621 +
3622 +/****************************************************************************
3623 +* Func:     SciDisableAllInterrupts
3624 +* Func:     SciEnableTransmitInterrupts
3625 +* Func:     SciEnableReceiveInterrupts
3626 +* Desc:     handles generation of interrupts by the sci module
3627 +* Inputs:   none
3628 +* Outputs:  none
3629 +* Errors:   none
3630 +* Scope:    private
3631 +****************************************************************************/
3632 +
3633 +static void inline SciDisableAllInterrupts( void )
3634 +{
3635 +    /* this also turns off the xmtr and rcvr */
3636 +
3637 +    *SCCR1 &= SCI_DISABLE_INT_ALL;
3638 +}
3639 +
3640 +static void inline SciEnableReceiveInterrupts( void )
3641 +{
3642 +    *SCCR1 |= SCI_ENABLE_INT_RX;
3643 +}
3644 +
3645 +static void inline SciDisableReceiveInterrupts( void )
3646 +{
3647 +    *SCCR1 &= SCI_DISABLE_INT_RX;
3648 +}
3649 +
3650 +static void inline SciEnableTransmitInterrupts( void )
3651 +{
3652 +    *SCCR1 |= SCI_ENABLE_INT_TX;
3653 +}
3654 +
3655 +static void inline SciDisableTransmitInterrupts( void )
3656 +{
3657 +    *SCCR1 &= SCI_DISABLE_INT_TX;
3658 +}
3659 +\f
3660 +
3661 +/****************************************************************************
3662 +* Func:     SciEnableTransmitter, SciDisableTransmitter
3663 +* Func:     SciEnableReceiver,    SciDisableReceiver
3664 +* Desc:     turns the transmitter and receiver on and off
3665 +* Inputs:   none
3666 +* Outputs:  none
3667 +* Errors:   none
3668 +* Scope:    private
3669 +****************************************************************************/
3670 +
3671 +static void inline SciEnableTransmitter( void )
3672 +{
3673 +    *SCCR1 |= SCI_ENABLE_XMTR;
3674 +}
3675 +
3676 +static void inline SciDisableTransmitter( void )
3677 +{
3678 +    *SCCR1 &= SCI_DISABLE_XMTR;
3679 +}
3680 +
3681 +static void inline SciEnableReceiver( void )
3682 +{
3683 +    *SCCR1 |= SCI_ENABLE_RCVR;
3684 +}
3685 +
3686 +static void inline SciDisableReceiver( void )
3687 +{
3688 +    *SCCR1 &= SCI_DISABLE_RCVR;
3689 +}
3690 +\f
3691 +
3692 +/****************************************************************************
3693 +* Func:     SciWriteCharWait
3694 +* Desc:     wait for room in the fifo and then put a char in
3695 +* Inputs:   a byte to send
3696 +* Outputs:  none
3697 +* Errors:   none
3698 +* Scope:    public
3699 +****************************************************************************/
3700 +
3701 +void SciWriteCharWait(uint8_t   c)
3702 +{
3703 +    /* poll the fifo, waiting for room for another character */
3704 +
3705 +    while ( ( *SCSR & SCI_XMTR_AVAILABLE ) == 0 )
3706 +    {
3707 +        /* Either we are writing to the fifo faster than
3708 +         * the uart can clock bytes out onto the cable,
3709 +         * or we are in flow control (actually no, we
3710 +         * are ignoring flow control from the other end).
3711 +         * In the first case, higher baud rates will help.
3712 +         */
3713 +      /* relinquish processor while waiting */
3714 +      rtems_task_wake_after(RTEMS_YIELD_PROCESSOR);
3715 +    }
3716 +
3717 +    *SCDR = c;                                  /* send the charcter */
3718 +
3719 +    SciBytesOut++;                              /* increment the counter */
3720 +
3721 +    return;
3722 +}
3723 +
3724 +/****************************************************************************
3725 +* Func:     SciWriteCharNoWait
3726 +* Desc:     if no room in the fifo throw the char on the floor
3727 +* Inputs:   a byte to send
3728 +* Outputs:  none
3729 +* Errors:   none
3730 +* Scope:    public
3731 +****************************************************************************/
3732 +
3733 +void SciWriteCharNoWait(uint8_t   c)
3734 +{
3735 +    if ( ( *SCSR & SCI_XMTR_AVAILABLE ) == 0 )
3736 +    {
3737 +        return;                                 /* no room, throw it away */
3738 +    }
3739 +
3740 +    *SCDR = c;                                  /* put the char in the fifo */
3741 +
3742 +    SciBytesOut++;                              /* increment the counter */
3743 +
3744 +    return;
3745 +}
3746 +\f
3747 +
3748 +/****************************************************************************
3749 +* Func:     SciReadCharWait
3750 +* Desc:     read a character, waiting for one to show up, if need be
3751 +* Inputs:   none
3752 +* Outputs:  a character
3753 +* Errors:   none
3754 +* Scope:    public
3755 +****************************************************************************/
3756 +
3757 +uint8_t   inline SciReadCharWait( void )
3758 +{
3759 +    uint8_t   ch;
3760 +
3761 +    while ( SciCharAvailable() == 0 )           /* anything there? */
3762 +    {
3763 +      /* relinquish processor while waiting */
3764 +      rtems_task_wake_after(RTEMS_YIELD_PROCESSOR);
3765 +    }
3766 +
3767 +    /* if you have rcv ints enabled, then the isr will probably */
3768 +    /* get the character before you will unless you turn off ints */
3769 +    /* ie polling and ints don't mix that well */
3770 +
3771 +    ch = *SCDR;                                 /* get the charcter */
3772 +
3773 +    SciBytesIn++;                               /* increment the counter */
3774 +
3775 +    return ch;                                  /* return the char */
3776 +}
3777 +
3778 +/****************************************************************************
3779 +* Func:     SciReadCharNoWait
3780 +* Desc:     try to get a char but dont wait for one
3781 +* Inputs:   none
3782 +* Outputs:  a character or -1 if none
3783 +* Errors:   none
3784 +* Scope:    public
3785 +****************************************************************************/
3786 +
3787 +uint8_t   inline SciReadCharNoWait( void )
3788 +{
3789 +    uint8_t   ch;
3790 +
3791 +    if ( SciCharAvailable() == 0 )              /* anything there? */
3792 +        return -1;
3793 +
3794 +    ch = *SCDR;                                 /* get the character */
3795 +
3796 +    SciBytesIn++;                               /* increment the count */
3797 +
3798 +    return ch;                                  /* return the char */
3799 +}
3800 +\f
3801 +
3802 +/****************************************************************************
3803 +* Func:     SciCharAvailable
3804 +* Desc:     is there a receive character in the data register
3805 +* Inputs:   none
3806 +* Outputs:  false if no char available, else true
3807 +* Errors:   none
3808 +* Scope:    public
3809 +****************************************************************************/
3810 +
3811 +uint8_t   inline SciCharAvailable( void )
3812 +{
3813 +    return ( *SCSR & SCI_RCVR_READY );          /* char in data register? */
3814 +}
3815 +\f
3816 +
3817 +/****************************************************************************
3818 +* Func:     SciSendBreak
3819 +* Desc:     send 1 or tow breaks (all zero bits)
3820 +* Inputs:   none
3821 +* Outputs:  none
3822 +* Errors:   none
3823 +* Scope:    public
3824 +****************************************************************************/
3825 +
3826 +void SciSendBreak( void )
3827 +{
3828 +    /* From the Motorola QSM reference manual - */
3829 +
3830 +    /* "if SBK is toggled by writing it first to a one and then immediately */
3831 +    /* to a zero (in less than one serial frame interval), the transmitter */
3832 +    /* sends only one or two break frames before reverting to mark (idle) */
3833 +    /* or before commencing to send more data" */
3834 +
3835 +    *SCCR1 |=  SCI_SEND_BREAK;                  /* set the bit */
3836 +
3837 +    *SCCR1 &= ~SCI_SEND_BREAK;                  /* clear the bit */
3838 +
3839 +    return;
3840 +}
3841 +\f
3842 +
3843 +/*
3844 + *
3845 + *                             SECTION 6
3846 + *                             TEST CODE
3847 + */
3848 +
3849 +/****************************************************************************
3850 +* Func:     SciUnitTest
3851 +* Desc:     test the device driver
3852 +* Inputs:   nothing
3853 +* Outputs:  nothing
3854 +* Scope:    public
3855 +****************************************************************************/
3856 +
3857 +#if 0
3858 +#define O_RDWR LIBIO_FLAGS_READ_WRITE           /* dont like this but... */
3859 +
3860 +void SciUnitTest()
3861 +{
3862 +    uint8_t   byte;                             /* a character */
3863 +    uint16_t   fd;                              /* file descriptor for device */
3864 +    uint16_t   result;                          /* result of ioctl */
3865 +
3866 +    fd = open("/dev/sci",O_RDWR);               /* open the device */
3867 +
3868 +printk("SCI open fd=%d\r\n",fd);
3869 +
3870 +    result = write(fd, "abcd\r\n", 6);          /* send a string */
3871 +
3872 +printk("SCI write result=%d\r\n",result);
3873 +
3874 +    result = read(fd, &byte, 1);                /* read a byte */
3875 +
3876 +printk("SCI read result=%d,byte=%x\r\n",result,byte);
3877 +
3878 +    return;
3879 +}
3880 +#endif
3881 +\f
3882 +
3883 +/****************************************************************************
3884 +* Func:     SciPrintStats
3885 +* Desc:     print out some driver information
3886 +* Inputs:   nothing
3887 +* Outputs:  nothing
3888 +* Scope:    public
3889 +****************************************************************************/
3890 +
3891 +void SciPrintStats ( void )
3892 +{
3893 +    printk("\r\n");
3894 +
3895 +    printk( "SYS_CLOCK is %2.6f Mhz\r\n\n", SYS_CLOCK / 1000000.0 );
3896 +
3897 +    printk( "Current baud rate is %d bps or %d cps\r\n\n", SciBaud, SciBaud / 10 );
3898 +
3899 +    printk( "SCI Uart chars in       %8d\r\n", SciBytesIn       );
3900 +    printk( "SCI Uart chars out      %8d\r\n", SciBytesOut      );
3901 +    printk( "SCI Uart framing errors %8d\r\n", SciErrorsFraming );
3902 +    printk( "SCI Uart parity  errors %8d\r\n", SciErrorsParity  );
3903 +    printk( "SCI Uart overrun errors %8d\r\n", SciErrorsOverrun );
3904 +    printk( "SCI Uart noise   errors %8d\r\n", SciErrorsNoise   );
3905 +
3906 +    return;
3907 +}
3908 Index: rtems/c/src/lib/libbsp/m68k/mo376/startup/bspstart.c
3909 ===================================================================
3910 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
3911 +++ rtems/c/src/lib/libbsp/m68k/mo376/startup/bspstart.c        2007-08-14 17:20:30.000000000 +0200
3912 @@ -0,0 +1,82 @@
3913 +/*
3914 + *  This routine starts the application.  It includes application,
3915 + *  board, and monitor specific initialization and configuration.
3916 + *  The generic CPU dependent initialization has been performed
3917 + *  before this routine is invoked.
3918 + *
3919 + *  COPYRIGHT (c) 1989-1999.
3920 + *  On-Line Applications Research Corporation (OAR).
3921 + *
3922 + *  The license and distribution terms for this file may be
3923 + *  found in the file LICENSE in this distribution or at
3924 + *  http://www.rtems.com/license/LICENSE.
3925 + *
3926 + *  $Id: bspstart.c,v 1.7 2004/04/21 10:42:52 ralf Exp $
3927 + */
3928 +
3929 +#include <bsp.h>
3930 +#include <rtems/libio.h>
3931 +
3932 +#include <string.h>
3933 +
3934 +/*
3935 + *  The original table from the application and our copy of it with
3936 + *  some changes.
3937 + */
3938 +
3939 +extern rtems_configuration_table  Configuration;
3940 +rtems_configuration_table         BSP_Configuration;
3941 +
3942 +rtems_cpu_table Cpu_table;
3943 +
3944 +char *rtems_progname;
3945 +
3946 +/*
3947 + *  Use the shared implementations of the following routines
3948 + */
3949 +
3950 +void bsp_postdriver_hook(void);
3951 +void bsp_libc_init( void *, uint32_t, int );
3952 +void bsp_pretasking_hook(void);               /* m68k version */
3953 +
3954 +/*
3955 + *  Call Spurious_Initialize in bsp_predriver_hook because
3956 + *  bsp_predriver_hook is call after the _ISR_Vector_Table allocation
3957 + */
3958 +
3959 +void bsp_predriver_hook(void)
3960 +{
3961 +  void Spurious_Initialize();
3962 +  Spurious_Initialize();
3963 +}
3964 +
3965 +/*
3966 + *  bsp_start
3967 + *
3968 + *  This routine does the bulk of the system initialization.
3969 + */
3970 +
3971 +void bsp_start( void )
3972 +{
3973 +  void           *vbr;
3974 +  extern void    *_WorkspaceBase;
3975 +  extern void    *_RamSize;
3976 +  extern unsigned long _M68k_Ramsize;
3977 +
3978 +  _M68k_Ramsize = (unsigned long)&_RamSize;            /* RAM size set in linker script */
3979 +
3980 +  /*
3981 +   *  we only use a hook to get the C library initialized.
3982 +   */
3983 +
3984 +  Cpu_table.pretasking_hook = bsp_pretasking_hook;
3985 +  Cpu_table.predriver_hook  = bsp_predriver_hook;
3986 +  Cpu_table.postdriver_hook = bsp_postdriver_hook;
3987 +
3988 +  m68k_get_vbr( vbr );
3989 +  Cpu_table.interrupt_vector_table = vbr;
3990 +
3991 +  BSP_Configuration.work_space_start = (void *) &_WorkspaceBase;
3992 +
3993 +  /* Clock_exit is done as an atexit() function */
3994 +}
3995 Index: rtems/c/src/lib/libbsp/m68k/mo376/startup/start_c.c
3996 ===================================================================
3997 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
3998 +++ rtems/c/src/lib/libbsp/m68k/mo376/startup/start_c.c 2007-08-14 17:20:30.000000000 +0200
3999 @@ -0,0 +1,125 @@
4000 +/*
4001 + *  $Id
4002 + */
4003 +
4004 +#include <mrm332.h>
4005 +#include <rtems/m68k/sim.h>
4006 +#define __START_C__
4007 +#include "bsp.h"
4008 +
4009 +m68k_isr_entry M68Kvec[256];
4010 +m68k_isr_entry vectors[256];
4011 +char * const __argv[]= {"main", ""};
4012 +
4013 +void  boot_card(int argc, char * const argv[]);
4014 +
4015 +/*
4016 + *  This prototype really should have the noreturn attribute but
4017 + *  that causes a warning. Not sure how to fix that.
4018 + */
4019 +/* void dumby_start ()  __attribute__ ((noreturn)); */
4020 +void start_c ();
4021 +
4022 +void  start_c() {
4023 +
4024 +  /* Synthesizer Control Register */
4025 +  /*    see section(s) 4.8 */
4026 +  /* end include in ram_init.S */
4027 +  *SYNCR = (unsigned short int)
4028 +    ( SAM(MRM_W,15,VCO) | SAM(0x0,14,PRESCALE) | SAM(MRM_Y,8,COUNTER) );
4029 +  while (! (*SYNCR & SLOCK));  /* protect from clock overshoot */
4030 +  /* include in ram_init.S */
4031 +  *SYNCR = (unsigned short int)
4032 +    ( SAM(MRM_W,15,VCO) | SAM(MRM_X,14,PRESCALE) | SAM(MRM_Y,8,COUNTER) );
4033 +
4034 +  /* System Protection Control Register */
4035 +  /*    !!! can only write to once after reset !!! */
4036 +  /*    see section 3.8.4 of the SIM Reference Manual */
4037 +  *SYPCR = (unsigned char)( HME | BME );
4038 +
4039 +  /* Periodic Interrupr Control Register */
4040 +  /*    see section 3.8.2 of the SIM Reference Manual */
4041 +  *PICR = (unsigned short int)
4042 +    ( SAM(0,8,PIRQL) | SAM(MRM_PIV,0,PIV) );
4043 +  /*     ^^^ zero disables interrupt, don't enable here or ram_init will
4044 +        be wrong. It's enabled below. */
4045 +
4046 +  /* Periodic Interrupt Timer Register */
4047 +  /*    see section 3.8.3 of the SIM Reference Manual */
4048 +  *PITR = (unsigned short int)( SAM(0x09,0,PITM) );
4049 +  /*    1.098mS interrupt, assuming 32.768 KHz input clock */
4050 +
4051 +  /* Port C Data */
4052 +  /*    load values before enabled */
4053 +  *PORTC = (unsigned char) 0x0;
4054 +
4055 +  /* Port E and F Data Register */
4056 +  /*    see section 9 of the SIM Reference Manual */
4057 +  *PORTE0 = (unsigned char) 0;
4058 +  *PORTF0 = (unsigned char) 0;
4059 +
4060 +  /* Port E and F Data Direction Register */
4061 +  /*    see section 9 of the SIM Reference Manual */
4062 +  *DDRE = (unsigned char) 0xff;
4063 +  *DDRF = (unsigned char) 0xfd;
4064 +
4065 +  /* Port E and F Pin Assignment Register */
4066 +  /*    see section 9 of the SIM Reference Manual */
4067 +  *PEPAR = (unsigned char) 0;
4068 +  *PFPAR = (unsigned char) 0;
4069 +
4070 +  /* end of SIM initalization code */
4071 +  /* end include in ram_init.S */
4072 +
4073 +  /*
4074 +   * Initialize RAM by copying the .data section out of ROM (if
4075 +   * needed) and "zero-ing" the .bss section.
4076 +   */
4077 +  {
4078 +    register char *src = _etext;
4079 +    register char *dst = _copy_start;
4080 +
4081 +    if (_copy_data_from_rom)
4082 +      /* ROM has data at end of text; copy it. */
4083 +      while (dst < _edata)
4084 +       *dst++ = *src++;
4085 +
4086 +    /* Zero bss */
4087 +    for (dst = _clear_start; dst< end; dst++)
4088 +      {
4089 +       *dst = 0;
4090 +      }
4091 +  }
4092 +
4093 +  /*
4094 +   * Initialize vector table.
4095 +   */
4096 +  {
4097 +    m68k_isr_entry *monitors_vector_table;
4098 +
4099 +    m68k_get_vbr(monitors_vector_table);
4100 +
4101 +    M68Kvec[  4 ] = monitors_vector_table[  4 ];   /* breakpoints vector */
4102 +    M68Kvec[  9 ] = monitors_vector_table[  9 ];   /* trace vector */
4103 +    M68Kvec[ 31 ] = monitors_vector_table[ 31 ];   /* level 7 interrupt */
4104 +    M68Kvec[ 47 ] = monitors_vector_table[ 47 ];   /* system call vector */
4105 +    M68Kvec[ 66 ] = monitors_vector_table[ 66 ];   /* user defined */
4106 +
4107 +    m68k_set_vbr(&M68Kvec);
4108 +  }
4109 +
4110 +  /*
4111 +   * Initalize the board.
4112 +   */
4113 +
4114 +  /* Spurious should be called in the predriver hook */
4115 +  /* Spurious_Initialize(); */
4116 +  /*console_init(); */
4117 +
4118 +  /*
4119 +   * Execute main with arguments argc and agrv.
4120 +   */
4121 +  boot_card(1,__argv);
4122 +  reboot();
4123 +
4124 +}
4125 Index: rtems/c/src/lib/libbsp/m68k/mo376/include/tm27.h
4126 ===================================================================
4127 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
4128 +++ rtems/c/src/lib/libbsp/m68k/mo376/include/tm27.h    2007-08-14 17:20:30.000000000 +0200
4129 @@ -0,0 +1,34 @@
4130 +/*
4131 + *  tm27.h
4132 + *
4133 + *  The license and distribution terms for this file may be
4134 + *  found in the file LICENSE in this distribution or at
4135 + *  http://www.rtems.com/license/LICENSE.
4136 + *
4137 + *  $Id: tm27.h,v 1.2 2004/04/23 04:47:36 ralf Exp $
4138 + */
4139 +
4140 +#ifndef _RTEMS_TMTEST27
4141 +#error "This is an RTEMS internal file you must not include directly."
4142 +#endif
4143 +
4144 +#ifndef __tm27_h
4145 +#define __tm27_h
4146 +
4147 +/*
4148 + *  Define the interrupt mechanism for Time Test 27
4149 + */
4150 +
4151 +/* XXX - JRS - I want to compile the tmtests */
4152 +
4153 +#define MUST_WAIT_FOR_INTERRUPT 1
4154 +
4155 +#define Install_tm27_vector( handler ) /* empty */
4156 +
4157 +#define Cause_tm27_intr() /* empty */
4158 +
4159 +#define Clear_tm27_intr() /* empty */
4160 +
4161 +#define Lower_tm27_intr() /* empty */
4162 +
4163 +#endif
4164 Index: rtems/c/src/lib/libbsp/m68k/mo376/times
4165 ===================================================================
4166 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
4167 +++ rtems/c/src/lib/libbsp/m68k/mo376/times     2007-08-14 17:20:30.000000000 +0200
4168 @@ -0,0 +1,195 @@
4169 +#
4170 +#  Timing Test Suite Results for the MRM332 BSP
4171 +#
4172 +#  $Id: times,v 1.2 2004/01/07 21:13:50 joel Exp $
4173 +#
4174 +
4175 +NOTE:  This BSP is user submitted and no information is currently available. 
4176 +
4177 +TBD: MATT - update this with real times!
4178 +
4179 +Board:                MRM332 
4180 +CPU:                  68332
4181 +Clock Speed:          20 Mhz
4182 +Memory Configuration: SRAM, DRAM, cache, etc
4183 +Wait States:          
4184 +
4185 +Times Reported in:    cycles, microseconds, etc
4186 +Timer Source:         Count Down Timer, on-CPU cycle counter, etc
4187 +
4188 +Column A:             unused
4189 +Column B:             unused
4190 +
4191 +#                          DESCRIPTION                                 A    B
4192 +== =================================================================  ==== ====
4193 + 1 rtems_semaphore_create                                               20
4194 +   rtems_semaphore_delete                                               21
4195 +   rtems_semaphore_obtain: available                                    15
4196 +   rtems_semaphore_obtain: not available -- NO_WAIT                     15
4197 +   rtems_semaphore_release: no waiting tasks                            16
4198 +
4199 + 2 rtems_semaphore_obtain: not available -- caller blocks               62
4200 +
4201 + 3 rtems_semaphore_release: task readied -- preempts caller             55
4202 +
4203 + 4 rtems_task_restart: blocked task -- preempts caller                  77
4204 +   rtems_task_restart: ready task -- preempts caller                    70
4205 +   rtems_semaphore_release: task readied -- returns to caller           25
4206 +   rtems_task_create                                                    57
4207 +   rtems_task_start                                                     31
4208 +   rtems_task_restart: suspended task -- returns to caller              36
4209 +   rtems_task_delete: suspended task                                    47
4210 +   rtems_task_restart: ready task -- returns to caller                  37
4211 +   rtems_task_restart: blocked task -- returns to caller                46
4212 +   rtems_task_delete: blocked task                                      50
4213 +
4214 + 5 rtems_task_suspend: calling task                                     51
4215 +   rtems_task_resume: task readied -- preempts caller                   49
4216 +
4217 + 6 rtems_task_restart: calling task                                     59
4218 +   rtems_task_suspend: returns to caller                                18
4219 +   rtems_task_resume: task readied -- returns to caller                 19
4220 +   rtems_task_delete: ready task                                        50
4221 +
4222 + 7 rtems_task_restart: suspended task -- preempts caller                70
4223 +
4224 + 8 rtems_task_set_priority: obtain current priority                     12
4225 +   rtems_task_set_priority: returns to caller                           27
4226 +   rtems_task_mode: obtain current mode                                  5
4227 +   rtems_task_mode: no reschedule                                        5
4228 +   rtems_task_mode: reschedule -- returns to caller                      8
4229 +   rtems_task_mode: reschedule -- preempts caller                       39
4230 +   rtems_task_set_note                                                  13
4231 +   rtems_task_get_note                                                  13
4232 +   rtems_clock_set                                                      33
4233 +   rtems_clock_get                                                       3
4234 +
4235 + 9 rtems_message_queue_create                                          110
4236 +   rtems_message_queue_send: no waiting tasks                           37
4237 +   rtems_message_queue_urgent: no waiting tasks                         37
4238 +   rtems_message_queue_receive: available                               31
4239 +   rtems_message_queue_flush: no messages flushed                       12
4240 +   rtems_message_queue_flush: messages flushed                          16
4241 +   rtems_message_queue_delete                                           26
4242 +
4243 +10 rtems_message_queue_receive: not available -- NO_WAIT                15
4244 +   rtems_message_queue_receive: not available -- caller blocks          62
4245 +
4246 +11 rtems_message_queue_send: task readied -- preempts caller            72
4247 +
4248 +12 rtems_message_queue_send: task readied -- returns to caller          39
4249 +
4250 +13 rtems_message_queue_urgent: task readied -- preempts caller          72
4251 +
4252 +14 rtems_message_queue_urgent: task readied -- returns to caller        39
4253 +
4254 +15 rtems_event_receive: obtain current events                            1
4255 +   rtems_event_receive: not available -- NO_WAIT                        12
4256 +   rtems_event_receive: not available -- caller blocks                  56
4257 +   rtems_event_send: no task readied                                    12
4258 +   rtems_event_receive: available                                       12
4259 +   rtems_event_send: task readied -- returns to caller                  24
4260 +
4261 +16 rtems_event_send: task readied -- preempts caller                    55
4262 +
4263 +17 rtems_task_set_priority: preempts caller                             62
4264 +
4265 +18 rtems_task_delete: calling task                                      83
4266 +
4267 +19 rtems_signal_catch                                                    9
4268 +   rtems_signal_send: returns to caller                                 15
4269 +   rtems_signal_send: signal to self                                    18
4270 +   exit ASR overhead: returns to calling task                           22
4271 +   exit ASR overhead: returns to preempting task                        49
4272 +
4273 +20 rtems_partition_create                                               35
4274 +   rtems_region_create                                                  23
4275 +   rtems_partition_get_buffer: available                                15
4276 +   rtems_partition_get_buffer: not available                            13
4277 +   rtems_partition_return_buffer                                        18
4278 +   rtems_partition_delete                                               16
4279 +   rtems_region_get_segment: available                                  22
4280 +   rtems_region_get_segment: not available -- NO_WAIT                   21
4281 +   rtems_region_return_segment: no waiting tasks                        19
4282 +   rtems_region_get_segment: not available -- caller blocks             64
4283 +   rtems_region_return_segment: task readied -- preempts caller         74
4284 +   rtems_region_return_segment: task readied -- returns to caller       44
4285 +   rtems_region_delete                                                  16
4286 +   rtems_io_initialize                                                   2
4287 +   rtems_io_open                                                         1
4288 +   rtems_io_close                                                        1
4289 +   rtems_io_read                                                         1
4290 +   rtems_io_write                                                        1
4291 +   rtems_io_control                                                      1
4292 +
4293 +21 rtems_task_ident                                                    149
4294 +   rtems_message_queue_ident                                           145
4295 +   rtems_semaphore_ident                                               156
4296 +   rtems_partition_ident                                               145
4297 +   rtems_region_ident                                                  148
4298 +   rtems_port_ident                                                    145
4299 +   rtems_timer_ident                                                   145
4300 +   rtems_rate_monotonic_ident                                          145
4301 +
4302 +22 rtems_message_queue_broadcast: task readied -- returns to caller     42
4303 +   rtems_message_queue_broadcast: no waiting tasks                      17
4304 +   rtems_message_queue_broadcast: task readied -- preempts caller       78
4305 +
4306 +23 rtems_timer_create                                                   14
4307 +   rtems_timer_fire_after: inactive                                     22
4308 +   rtems_timer_fire_after: active                                       24
4309 +   rtems_timer_cancel: active                                           15
4310 +   rtems_timer_cancel: inactive                                         13
4311 +   rtems_timer_reset: inactive                                          21
4312 +   rtems_timer_reset: active                                            23
4313 +   rtems_timer_fire_when: inactive                                      34
4314 +   rtems_timer_fire_when: active                                        34
4315 +   rtems_timer_delete: active                                           19
4316 +   rtems_timer_delete: inactive                                         17
4317 +   rtems_task_wake_when                                                 69
4318 +
4319 +24 rtems_task_wake_after: yield -- returns to caller                     9
4320 +   rtems_task_wake_after: yields -- preempts caller                     45
4321 +
4322 +25 rtems_clock_tick                                                      4
4323 +
4324 +26 _ISR_Disable                                                          0
4325 +   _ISR_Flash                                                            1
4326 +   _ISR_Enable                                                           1
4327 +   _Thread_Disable_dispatch                                              0
4328 +   _Thread_Enable_dispatch                                               7
4329 +   _Thread_Set_state                                                    11
4330 +   _Thread_Disptach (NO FP)                                             31
4331 +   context switch: no floating point contexts                           21
4332 +   context switch: self                                                 10
4333 +   context switch: to another task                                      10
4334 +   context switch: restore 1st FP task                                  25
4335 +   fp context switch: save idle, restore idle                           31
4336 +   fp context switch: save idle, restore initialized                    19
4337 +   fp context switch: save initialized, restore initialized             20
4338 +   _Thread_Resume                                                        7
4339 +   _Thread_Unblock                                                       7
4340 +   _Thread_Ready                                                         9
4341 +   _Thread_Get                                                           4
4342 +   _Semaphore_Get                                                        2
4343 +   _Thread_Get: invalid id                                               0
4344 +
4345 +27 interrupt entry overhead: returns to interrupted task                 6
4346 +   interrupt exit overhead: returns to interrupted task                  6
4347 +   interrupt entry overhead: returns to nested interrupt                 6
4348 +   interrupt exit overhead: returns to nested interrupt                  5
4349 +   interrupt entry overhead: returns to preempting task                  7
4350 +   interrupt exit overhead: returns to preempting task                  36
4351 +
4352 +28 rtems_port_create                                                    16
4353 +   rtems_port_external_to_internal                                      11
4354 +   rtems_port_internal_to_external                                      11
4355 +   rtems_port_delete                                                    16
4356 +
4357 +29 rtems_rate_monotonic_create                                          15
4358 +   rtems_rate_monotonic_period: initiate period -- returns to caller    21
4359 +   rtems_rate_monotonic_period: obtain status                           13
4360 +   rtems_rate_monotonic_cancel                                          16
4361 +   rtems_rate_monotonic_delete: inactive                                18
4362 +   rtems_rate_monotonic_delete: active                                  20
4363 +   rtems_rate_monotonic_period: conclude periods -- caller blocks       53
4364 Index: rtems/c/src/lib/libbsp/m68k/mo376/include/mrm332.h
4365 ===================================================================
4366 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
4367 +++ rtems/c/src/lib/libbsp/m68k/mo376/include/mrm332.h  2007-08-14 17:20:30.000000000 +0200
4368 @@ -0,0 +1,70 @@
4369 +/*  mrm332.h
4370 + *
4371 + *  $Id: mrm332.h,v 1.5 2004/04/21 16:01:35 ralf Exp $
4372 + */
4373 +
4374 +#ifndef _MRM332_H_
4375 +#define _MRM332_H_
4376 +
4377 +/* SIM_MM (SIM Module Mapping) determines the location of the control
4378 +   register block. When MM=0, register addresses range fom 0x7ff000 to
4379 +   0x7FFFFF. When MM=1, register addresses range from 0xfff000 to
4380 +   0xffffff. */
4381 +#define SIM_MM 1
4382 +
4383 +/* Interrupt related definitions */
4384 +#define SIM_IARB 15
4385 +#define QSM_IARB 10
4386 +
4387 +#define MRM_PIV 64
4388 +#define ISRL_PIT 4             /* zero disables PIT */
4389 +
4390 +#define EFI_QIVR 66            /* 66=>SCI and 67=>QSPI interrupt */
4391 +#define ISRL_QSPI 0
4392 +
4393 +#define EFI_SPINT 24           /* spurious interrupt */
4394 +#define EFI_INT1 25            /* CTS interrupt */
4395 +#define ISRL_SCI 6
4396 +
4397 +/* System Clock definitions */
4398 +#define XTAL 32768.0           /* crystal frequency in Hz */
4399 +
4400 +#if 0
4401 +/* Default MRM clock rate (8.388688 MHz) set by CPU32: */
4402 +#define MRM_W 0                        /* system clock parameters */
4403 +#define MRM_X 0
4404 +#define MRM_Y 0x3f
4405 +#endif
4406 +
4407 +#if 1
4408 +/* 16.77722 MHz: */
4409 +#define MRM_W 1                        /* system clock parameters */
4410 +#define MRM_X 1
4411 +#define MRM_Y 0x0f
4412 +#endif
4413 +
4414 +#if 0
4415 +/* 25.16582 MHz: */
4416 +#define MRM_W 1                        /* system clock parameters */
4417 +#define MRM_X 1
4418 +#define MRM_Y 0x17
4419 +#endif
4420 +
4421 +#define SYS_CLOCK (XTAL*4.0*(MRM_Y+1)*(1 << (2*MRM_W+MRM_X)))
4422 +#define SCI_BAUD 19200         /* RS232 Baud Rate */
4423 +
4424 +/* macros/functions */
4425 +
4426 +#ifndef ASM
4427 +
4428 +/*
4429 + *  This prototype really should have the noreturn attribute but
4430 + *  that causes a warning. Not sure how to fix that.
4431 + */
4432 +/*   static void reboot(void) __attribute__ ((noreturn)); */
4433 +static void reboot(void);
4434 +__inline__ static void reboot() {asm("trap #15; .word 0x0063");}
4435 +
4436 +#endif /* ASM */
4437 +
4438 +#endif /* _MRM_H_ */
4439 Index: rtems/c/src/lib/libbsp/m68k/mo376/include/bspopts.h.in
4440 ===================================================================
4441 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
4442 +++ rtems/c/src/lib/libbsp/m68k/mo376/include/bspopts.h.in      2007-08-14 17:20:30.000000000 +0200
4443 @@ -0,0 +1,16 @@
4444 +/* include/bspopts.h.in.  Generated from configure.ac by autoheader.  */
4445 +
4446 +/* Define to the address where bug reports for this package should be sent. */
4447 +#undef PACKAGE_BUGREPORT
4448 +
4449 +/* Define to the full name of this package. */
4450 +#undef PACKAGE_NAME
4451 +
4452 +/* Define to the full name and version of this package. */
4453 +#undef PACKAGE_STRING
4454 +
4455 +/* Define to the one symbol short name of this package. */
4456 +#undef PACKAGE_TARNAME
4457 +
4458 +/* Define to the version of this package. */
4459 +#undef PACKAGE_VERSION
4460 Index: rtems/c/src/lib/libbsp/m68k/mo376/spurious/spinit.c
4461 ===================================================================
4462 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
4463 +++ rtems/c/src/lib/libbsp/m68k/mo376/spurious/spinit.c 2007-08-14 17:20:30.000000000 +0200
4464 @@ -0,0 +1,105 @@
4465 +/*  Spurious_driver
4466 + *
4467 + *  This routine installs spurious interrupt handlers for the mrm.
4468 + *
4469 + *  Input parameters:  NONE
4470 + *
4471 + *  Output parameters:  NONE
4472 + *
4473 + *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993.
4474 + *  On-Line Applications Research Corporation (OAR).
4475 + *
4476 + *  The license and distribution terms for this file may be
4477 + *  found in the file LICENSE in this distribution or at
4478 + *  http://www.rtems.com/license/LICENSE.
4479 + *
4480 + *  $Id: spinit.c,v 1.6 2006/09/11 21:43:55 joel Exp $
4481 + */
4482 +
4483 +#include <bsp.h>
4484 +#include <stdio.h>
4485 +
4486 +const char * const _Spurious_Error_[] = {"Reset","Bus Error","Address Error",
4487 +   "Illegal Instruction","Zero Division","CHK, CHK2 Instruction",
4488 +   "TRAPcc, TRAPV Instruction","Privilege Violation","Trace",
4489 +   "Line 1010 Emulation","Line 1111 Emulation","Hardware Breakpoint",
4490 +   "Coprocessor Protocal Violation",
4491 +   "Format Error ans Uninitialized Interrupt","Unassigned",
4492 +   "Spurious Interrupt","AVec1","AVec2","AVec3","AVec4","AVec5","AVec6",
4493 +   "AVec7","Trap Instruction","Debug","Reboot","Reserved Coprocessor",
4494 +   "Reserved Unassigned","User Defined"};
4495 +
4496 +rtems_isr Spurious_Isr(
4497 +  rtems_vector_number vector
4498 +)
4499 +{
4500 +  /*int sp = 0; */
4501 +#if 0
4502 +  const char * const VectDescrip[] = {
4503 +    _Spurious_Error_[0],   _Spurious_Error_[0],  _Spurious_Error_[1],
4504 +    _Spurious_Error_[2],   _Spurious_Error_[3],  _Spurious_Error_[4],
4505 +    _Spurious_Error_[5],   _Spurious_Error_[6],  _Spurious_Error_[7],
4506 +    _Spurious_Error_[8],   _Spurious_Error_[9], _Spurious_Error_[10],
4507 +    _Spurious_Error_[11], _Spurious_Error_[12], _Spurious_Error_[13],
4508 +    _Spurious_Error_[13], _Spurious_Error_[14], _Spurious_Error_[14],
4509 +    _Spurious_Error_[14], _Spurious_Error_[14], _Spurious_Error_[14],
4510 +    _Spurious_Error_[14], _Spurious_Error_[14], _Spurious_Error_[14],
4511 +    _Spurious_Error_[15], _Spurious_Error_[16], _Spurious_Error_[17],
4512 +    _Spurious_Error_[18], _Spurious_Error_[19], _Spurious_Error_[20],
4513 +    _Spurious_Error_[21], _Spurious_Error_[22], _Spurious_Error_[23],
4514 +    _Spurious_Error_[24], _Spurious_Error_[23], _Spurious_Error_[23],
4515 +    _Spurious_Error_[23], _Spurious_Error_[23], _Spurious_Error_[23],
4516 +    _Spurious_Error_[23], _Spurious_Error_[23], _Spurious_Error_[23],
4517 +    _Spurious_Error_[23], _Spurious_Error_[23], _Spurious_Error_[23],
4518 +    _Spurious_Error_[23], _Spurious_Error_[23], _Spurious_Error_[25],
4519 +    _Spurious_Error_[26], _Spurious_Error_[26], _Spurious_Error_[26],
4520 +    _Spurious_Error_[26], _Spurious_Error_[26], _Spurious_Error_[26],
4521 +    _Spurious_Error_[26], _Spurious_Error_[26], _Spurious_Error_[26],
4522 +    _Spurious_Error_[26], _Spurious_Error_[26], _Spurious_Error_[27],
4523 +    _Spurious_Error_[27], _Spurious_Error_[27], _Spurious_Error_[27],
4524 +    _Spurious_Error_[27], _Spurious_Error_[28]};
4525 +#endif
4526 +
4527 +  /*asm volatile ( "movea.l   %%sp,%0 " : "=a" (sp) : "0" (sp) ); */
4528 +
4529 +  _CPU_ISR_Set_level( 7 );
4530 +  /*_UART_flush(); */
4531 +#if 0
4532 +  RAW_PUTS("\n\rRTEMS: Spurious interrupt: ");
4533 +  RAW_PUTS((char *)VectDescrip[( (vector>64) ? 64 : vector )]);
4534 +  RAW_PUTS("\n\rRTEMS:    Vector: ");
4535 +  RAW_PUTI(vector);
4536 +  RAW_PUTS(" sp: ");
4537 +  RAW_PUTI(sp);
4538 +  RAW_PUTS("\n\r");
4539 +#endif
4540 +  bsp_cleanup();
4541 +
4542 +  /* BDM SIGEMT */
4543 +  asm("  .word  0x4afa");
4544 +
4545 +  for(;;);
4546 +}
4547 +
4548 +void Spurious_Initialize(void)
4549 +{
4550 +  rtems_vector_number vector;
4551 +
4552 +  for ( vector = 0x0 ; vector <= 0xFF ; vector++ )
4553 +    {
4554 +      switch (vector)
4555 +       {
4556 +       case 4:
4557 +       case 9:
4558 +       case 31:
4559 +       case 47:
4560 +       case 66:
4561 +         /* These vectors used by CPU32bug - don't overwrite them. */
4562 +         break;
4563 +
4564 +       default:
4565 +         (void) set_vector( Spurious_Isr, vector, 1 );
4566 +         break;
4567 +       }
4568 +    }
4569 +}
4570 Index: rtems/c/src/lib/libbsp/m68k/mo376/startup/linkcmds
4571 ===================================================================
4572 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
4573 +++ rtems/c/src/lib/libbsp/m68k/mo376/startup/linkcmds  2007-08-14 17:20:30.000000000 +0200
4574 @@ -0,0 +1,164 @@
4575 +/*  linkcmds
4576 + *
4577 + *  $Id: linkcmds,v 1.6 2006/02/08 12:25:24 joel Exp $
4578 + */
4579 +
4580 +OUTPUT_ARCH(m68k)
4581 +__DYNAMIC  =  0;
4582 +
4583 +/*
4584 + * The memory map looks like this:
4585 + * +--------------------+ <- low memory
4586 + * | .text              |
4587 + * |        etext       |
4588 + * |        ctor list   | the ctor and dtor lists are for
4589 + * |        dtor list   | C++ support
4590 + * |        _endtext    |
4591 + * +--------------------+
4592 + * | .data              | initialized data goes here
4593 + * |        _sdata      |
4594 + * |        _edata      |
4595 + * +--------------------+
4596 + * | .bss               |
4597 + * |        _clear_start| start of bss, cleared by crt0
4598 + * |        _end        | start of heap, used by sbrk()
4599 + * +--------------------+
4600 + * |    heap space      |
4601 + * |        _ENDHEAP    |
4602 + * |    stack space     | 
4603 + * |        __stack     | top of stack
4604 + * +--------------------+ <- high memory
4605 + */
4606 +
4607 +/*
4608 + * Declare some sizes.
4609 + */
4610 +_RamBase = DEFINED(_RamBase) ? _RamBase : 0x10000;
4611 +_RamSize = DEFINED(_RamSize) ? _RamSize : 0x70000;
4612 +_RamEnd = _RamBase + _RamSize;
4613 +_HeapSize = DEFINED(_HeapSize) ? _HeapSize : 0x10000;
4614 +_StackSize = DEFINED(_StackSize) ? _StackSize : 0x2000;
4615 +
4616 +MEMORY
4617 +{
4618 +  ram     : ORIGIN = 0x10000, LENGTH = 0x70000
4619 +}
4620 +
4621 +_copy_data_from_rom = 0;
4622 +
4623 +/*
4624 + * stick everything in ram (of course)
4625 + */
4626 +SECTIONS
4627 +{
4628 +       ram : {
4629 +               . = .;
4630 +       } >ram
4631 +
4632 +        /*
4633 +         * Text, data and bss segments
4634 +         */
4635 +        .text : {
4636 +                *(.text*)
4637 +
4638 +               /*
4639 +                * C++ constructors/destructors
4640 +                */
4641 +               *(.gnu.linkonce.t.*)
4642 +
4643 +               /*
4644 +                * Initialization and finalization code.
4645 +                *
4646 +                * Various files can provide initialization and finalization
4647 +                * functions.  crtbegin.o and crtend.o are two instances. The
4648 +                * body of these functions are in .init and .fini sections. We
4649 +                * accumulate the bodies here, and prepend function prologues
4650 +                * from crti.o and function epilogues from crtn.o. crti.o must
4651 +                * be linked first; crtn.o must be linked last.  Because these
4652 +                * are wildcards, it doesn't matter if the user does not
4653 +                * actually link against crti.o and crtn.o; the linker won't
4654 +                * look for a file to match a wildcard.  The wildcard also
4655 +                * means that it doesn't matter which directory crti.o and
4656 +                * crtn.o are in. 
4657 +                */
4658 +               PROVIDE (_init = .);
4659 +               *crti.o(.init)
4660 +               *(.init)
4661 +               *crtn.o(.init)
4662 +               PROVIDE (_fini = .);
4663 +               *crti.o(.fini)
4664 +               *(.fini)
4665 +               *crtn.o(.fini)
4666 +
4667 +               /*
4668 +                * Special FreeBSD sysctl sections.
4669 +                */
4670 +               . = ALIGN (16);
4671 +               __start_set_sysctl_set = .;
4672 +               *(set_sysctl_*);
4673 +               __stop_set_sysctl_set = ABSOLUTE(.);
4674 +               *(set_domain_*);
4675 +               *(set_pseudo_*);
4676 +
4677 +               /*
4678 +                * C++ constructors/destructors
4679 +                *
4680 +                * gcc uses crtbegin.o to find the start of the constructors
4681 +                * and destructors so we make sure it is first.  Because this
4682 +                * is a wildcard, it doesn't matter if the user does not
4683 +                * actually link against crtbegin.o; the linker won't look for
4684 +                * a file to match a wildcard.  The wildcard also means that
4685 +                * it doesn't matter which directory crtbegin.o is in. The
4686 +                * constructor and destructor list are terminated in
4687 +                * crtend.o.  The same comments apply to it.
4688 +                */
4689 +               . = ALIGN (16);
4690 +               *crtbegin.o(.ctors)
4691 +               *(.ctors)
4692 +               *crtend.o(.ctors)
4693 +               *crtbegin.o(.dtors)
4694 +               *(.dtors)
4695 +               *crtend.o(.dtors)
4696 +
4697 +               /*
4698 +                * Exception frame info
4699 +                */
4700 +               . = ALIGN (16);
4701 +               *(.eh_frame)
4702 +
4703 +               /*
4704 +                * Read-only data
4705 +                */
4706 +               . = ALIGN (16);
4707 +               _rodata_start = .;
4708 +               *(.rodata*)
4709 +               *(.gnu.linkonce.r*)
4710 +
4711 +                 . = ALIGN (16);
4712 +                PROVIDE (_etext = .);
4713 +        } >ram
4714 +        .data : {
4715 +                PROVIDE (_copy_start = .);
4716 +                *(.data)
4717 +               *(.gnu.linkonce.d*)
4718 +               *(.gcc_except_table)
4719 +               *(.jcr)
4720 +                . = ALIGN (16);
4721 +                PROVIDE (_edata = .);
4722 +                PROVIDE (_copy_end = .);
4723 +        } >ram
4724 +        .bss : {
4725 +                _clear_start = .;
4726 +                *(.dynbss)
4727 +                *(.bss* .gnu.linkonce.b.*)
4728 +                *(COMMON)
4729 +                . = ALIGN (16);
4730 +                PROVIDE (end = .);
4731 +                . += _StackSize;
4732 +                . = ALIGN (16);
4733 +                _stack_init = .;
4734 +                _clear_end = .;
4735 +
4736 +                _WorkspaceBase = .;
4737 +        } >ram
4738 +}
4739 Index: rtems/c/src/lib/libbsp/m68k/mo376/bsp_specs
4740 ===================================================================
4741 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
4742 +++ rtems/c/src/lib/libbsp/m68k/mo376/bsp_specs 2007-08-14 17:20:30.000000000 +0200
4743 @@ -0,0 +1,16 @@
4744 +%rename endfile old_endfile
4745 +%rename startfile old_startfile
4746 +%rename link old_link
4747 +
4748 +*startfile:
4749 +%{!qrtems: %(old_startfile)} %{!nostdlib: %{qrtems: \
4750 +%{!qrtems_debug: start.o%s} \
4751 +%{qrtems_debug: start_g.o%s} \
4752 +crti.o%s crtbegin.o%s}}
4753 +
4754 +*link:
4755 +%{!qrtems: %(old_link)} %{qrtems: -dc -dp -N -e start}
4756 +
4757 +*endfile:
4758 +%{!qrtems: %(old_endfile)} %{qrtems: crtend.o%s crtn.o%s}
4759 +
4760 Index: rtems/c/src/lib/libbsp/m68k/mo376/preinstall.am
4761 ===================================================================
4762 --- /dev/null   1970-01-01 00:00:00.000000000 +0000
4763 +++ rtems/c/src/lib/libbsp/m68k/mo376/preinstall.am     2007-08-14 17:20:30.000000000 +0200
4764 @@ -0,0 +1,66 @@
4765 +## Automatically generated by ampolish3 - Do not edit
4766 +
4767 +if AMPOLISH3
4768 +$(srcdir)/preinstall.am: Makefile.am
4769 +       $(AMPOLISH3) $(srcdir)/Makefile.am > $(srcdir)/preinstall.am
4770 +endif
4771 +
4772 +PREINSTALL_DIRS =
4773 +DISTCLEANFILES += $(PREINSTALL_DIRS)
4774 +
4775 +all-local: $(TMPINSTALL_FILES)
4776 +
4777 +TMPINSTALL_FILES =
4778 +CLEANFILES = $(TMPINSTALL_FILES)
4779 +
4780 +all-am: $(PREINSTALL_FILES)
4781 +
4782 +PREINSTALL_FILES =
4783 +CLEANFILES += $(PREINSTALL_FILES)
4784 +
4785 +$(PROJECT_LIB)/$(dirstamp):
4786 +       @$(MKDIR_P) $(PROJECT_LIB)
4787 +       @: > $(PROJECT_LIB)/$(dirstamp)
4788 +PREINSTALL_DIRS += $(PROJECT_LIB)/$(dirstamp)
4789 +
4790 +$(PROJECT_INCLUDE)/$(dirstamp):
4791 +       @$(MKDIR_P) $(PROJECT_INCLUDE)
4792 +       @: > $(PROJECT_INCLUDE)/$(dirstamp)
4793 +PREINSTALL_DIRS += $(PROJECT_INCLUDE)/$(dirstamp)
4794 +
4795 +$(PROJECT_LIB)/bsp_specs: bsp_specs $(PROJECT_LIB)/$(dirstamp)
4796 +       $(INSTALL_DATA) $< $(PROJECT_LIB)/bsp_specs
4797 +PREINSTALL_FILES += $(PROJECT_LIB)/bsp_specs
4798 +
4799 +$(PROJECT_INCLUDE)/bsp.h: include/bsp.h $(PROJECT_INCLUDE)/$(dirstamp)
4800 +       $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp.h
4801 +PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp.h
4802 +
4803 +$(PROJECT_INCLUDE)/tm27.h: include/tm27.h $(PROJECT_INCLUDE)/$(dirstamp)
4804 +       $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/tm27.h
4805 +PREINSTALL_FILES += $(PROJECT_INCLUDE)/tm27.h
4806 +
4807 +$(PROJECT_INCLUDE)/bspopts.h: include/bspopts.h $(PROJECT_INCLUDE)/$(dirstamp)
4808 +       $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bspopts.h
4809 +PREINSTALL_FILES += $(PROJECT_INCLUDE)/bspopts.h
4810 +
4811 +$(PROJECT_INCLUDE)/mrm332.h: include/mrm332.h $(PROJECT_INCLUDE)/$(dirstamp)
4812 +       $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/mrm332.h
4813 +PREINSTALL_FILES += $(PROJECT_INCLUDE)/mrm332.h
4814 +
4815 +$(PROJECT_INCLUDE)/coverhd.h: ../../shared/include/coverhd.h $(PROJECT_INCLUDE)/$(dirstamp)
4816 +       $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/coverhd.h
4817 +PREINSTALL_FILES += $(PROJECT_INCLUDE)/coverhd.h
4818 +
4819 +$(PROJECT_LIB)/start.$(OBJEXT): start.$(OBJEXT) $(PROJECT_LIB)/$(dirstamp)
4820 +       $(INSTALL_DATA) $< $(PROJECT_LIB)/start.$(OBJEXT)
4821 +TMPINSTALL_FILES += $(PROJECT_LIB)/start.$(OBJEXT)
4822 +
4823 +$(PROJECT_LIB)/linkcmds: startup/linkcmds $(PROJECT_LIB)/$(dirstamp)
4824 +       $(INSTALL_DATA) $< $(PROJECT_LIB)/linkcmds
4825 +PREINSTALL_FILES += $(PROJECT_LIB)/linkcmds
4826 +
4827 +$(PROJECT_LIB)/linkcmds_ROM: startup/linkcmds_ROM $(PROJECT_LIB)/$(dirstamp)
4828 +       $(INSTALL_DATA) $< $(PROJECT_LIB)/linkcmds_ROM
4829 +PREINSTALL_FILES += $(PROJECT_LIB)/linkcmds_ROM
4830 +