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