]> rtime.felk.cvut.cz Git - rtems-devel.git/blob - rtems-patches/rtems-clone-mrm332-to-mo376.patch
RTEMS UART code modification which switches UART1 to UART3 if IrDA dongle is present.
[rtems-devel.git] / rtems-patches / rtems-clone-mrm332-to-mo376.patch
1 Index: rtems-051009/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-051009/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-051009/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.3 2004/11/26 01:54:51 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 .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-051009/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-051009/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-051009/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-051009/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-051009/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-051009/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-051009/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-051009/c/src/lib/libbsp/m68k/mo376/ChangeLog
1438 ===================================================================
1439 --- /dev/null
1440 +++ rtems/c/src/lib/libbsp/m68k/mo376/ChangeLog
1441 @@ -0,0 +1,428 @@
1442 +2005-05-26     Ralf Corsepius <ralf.corsepius@rtems.org>
1443 +
1444 +       * include/bsp.h: New header guard.
1445 +
1446 +2005-01-07     Ralf Corsepius <ralf.corsepius@rtems.org>
1447 +
1448 +       * Makefile.am: Eliminate CFLAGS_OPTIMIZE_V.
1449 +
1450 +2005-01-05     Ralf Corsepius <ralf.corsepius@rtems.org>
1451 +
1452 +       * console/sci.c: Remove CVS Log.
1453 +
1454 +2005-01-04     Joel Sherrill <joel@OARcorp.com>
1455 +
1456 +       * console/sci.c: Remove warnings.
1457 +
1458 +2005-01-02     Ralf Corsepius <ralf.corsepius@rtems.org>
1459 +
1460 +       * Makefile.am: Remove build-variant support.
1461 +
1462 +2004-11-25     Joel Sherrill <joel@OARcorp.com>
1463 +
1464 +       * startup/linkcmds, startup/linkcmds_ROM: Add new bss sections .bss.*
1465 +       and .gnu.linkonce.b*.
1466 +
1467 +2004-09-24     Ralf Corsepius <ralf_corsepius@rtems.org>
1468 +
1469 +       * configure.ac: Require automake > 1.9.
1470 +
1471 +2004-04-23     Ralf Corsepius <ralf_corsepius@rtems.org>
1472 +
1473 +       PR 610/bsps
1474 +       * Makefile.am: Add include/tm27.h, Cosmetics.
1475 +       * include/tm27.h: Final cosmetics.
1476 +
1477 +2004-04-22     Ralf Corsepius <ralf_corsepius@rtems.org>
1478 +
1479 +       * include/bsp.h: Split out tmtest27 support.
1480 +       * include/tm27.h: New.
1481 +
1482 +2004-04-21     Ralf Corsepius <ralf_corsepius@rtems.org>
1483 +
1484 +       PR 613/bsps
1485 +       * include/bsp.h: Remove MAX_LONG_TEST_DURATION.
1486 +
1487 +2004-04-21     Ralf Corsepius <ralf_corsepius@rtems.org>
1488 +
1489 +       PR 614/bsps
1490 +       * include/bsp.h: Remove MAX_SHORT_TEST_DURATION (Unused).
1491 +
1492 +2004-04-03     Ralf Corsepiu <ralf_corsepiu@rtems.org>
1493 +
1494 +       * c/src/lib/libbsp/m68k/mrm332/include/bsp.h,
1495 +       c/src/lib/libbsp/m68k/mrm332/start/start.S,
1496 +       c/src/lib/libbsp/m68k/mrm332/startup/start_c.c: Include
1497 +       <rtems/m68k/sim.h> instead of <sim.h>.
1498 +       * c/src/lib/libbsp/m68k/mrm332/include/bsp.h: Include
1499 +       <rtems/m68k/qsm.h> instead of <qsm.h>.
1500 +
1501 +2004-04-02     Ralf Corsepius <ralf_corsepius@rtems.org>
1502 +
1503 +       * start/start.S: Include <rtems/asm.h> instead of <asm.h>.
1504 +
1505 +2004-04-01     Ralf Corsepius <ralf_corsepius@rtems.org>
1506 +
1507 +       * include/bsp.h: Include <rtems/clockdrv.h> instead of <clockdrv.h>.
1508 +       * include/bsp.h: Include <rtems/console.h> instead of <console.h>.
1509 +       * include/bsp.h: Include <rtems/iosupp.h> instead of <iosupp.h>.
1510 +
1511 +2004-03-31     Ralf Corsepius <ralf_corsepius@rtems.org>
1512 +
1513 +       * clock/ckinit.c, console/sci.c, console/sci.h, include/bsp.h,
1514 +       misc/interr.c, startup/bspstart.c, timer/timer.c: Convert to using
1515 +       c99 fixed size types.
1516 +
1517 +2004-02-19     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1518 +
1519 +       * Makefile.am: Reflect changes to bsp.am. 
1520 +       Preinstall dist_project_lib*.
1521 +
1522 +2004-02-14     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1523 +
1524 +       * Makefile.am: Reflect changes to bsp.am.
1525 +
1526 +2004-02-12     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1527 +
1528 +       * Makefile.am: Use CPPASCOMPILE instead of CCASCOMPILE.
1529 +
1530 +2004-02-06     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1531 +
1532 +       * Makefile.am: Pickup files from ../../m68k/shared instead of
1533 +       ../shared. Reformat.
1534 +
1535 +2004-01-28     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1536 +
1537 +       * configure.ac: Add nostdinc to AUTOMAKE_OPTIONS.
1538 +
1539 +2004-01-28     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1540 +
1541 +       * Makefile.am: Don't include subdirs.am.
1542 +
1543 +2004-01-28     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1544 +
1545 +       * Makefile.am: Fix typo.
1546 +
1547 +2004-01-28     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1548 +
1549 +       * Makefile.am: Merge-in clock/Makefile.am, console/Makefile.am,
1550 +       spurious/Makefile.am, startup/Makefile.am, timer/Makefile.am,
1551 +       wrapup/Makefile.am.
1552 +       Use automake compilation rules.
1553 +       * clock/Makefile.am, console/Makefile.am, spurious/Makefile.am,
1554 +       startup/Makefile.am, timer/Makefile.am, wrapup/Makefile.am:
1555 +       Remove.
1556 +       * configure.ac: Reflect changes above.
1557 +
1558 +2004-01-21     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1559 +
1560 +       * Makefile.am: Add PREINSTALL_DIRS.
1561 +       * wrapup/Makefile.am: Reflect changes to libcpu.
1562 +
1563 +2004-01-20     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1564 +
1565 +       * wrapup/Makefile.am: Reflect changes to libcpu.
1566 +
1567 +2004-01-14     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1568 +
1569 +       * Makefile.am: Re-add dirstamps to PRE/TMPINSTALL_FILES.
1570 +       Add PRE/TMPINSTALL_FILES to CLEANFILES.
1571 +       * startup/Makefile.am: Ditto.
1572 +
1573 +2004-01-07     Joel Sherrill <joel@OARcorp.com>
1574 +
1575 +       * times, console/sci.c: Remove efi68k and efi332 references as they are
1576 +       no longer in the tree.
1577 +
1578 +2004-01-07     Joel Sherrill <joel@OARcorp.com>
1579 +
1580 +       * timer/timer.c: Remove efi68k and efi332 references as they are no
1581 +       longer in the tree.
1582 +
1583 +2004-01-07     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1584 +
1585 +       * start/Makefile.am: Remove.
1586 +       * Makefile.am: Merge-in start/Makefile.am.
1587 +       * configure.ac: Reflect changes above.
1588 +
1589 +2004-01-05     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1590 +
1591 +       * wrapup/Makefile.am: Eliminate $(LIB). 
1592 +       Use noinst_DATA to trigger building libbsp.a.
1593 +
1594 +2003-12-13     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1595 +
1596 +       * start/Makefile.am: s,${PROJECT_RELEASE}/lib,$(PROJECT_LIB),g.
1597 +       * startup/Makefile.am: s,${PROJECT_RELEASE}/lib,$(PROJECT_LIB),g.
1598 +
1599 +2003-12-12     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1600 +
1601 +       * start/Makefile.am: Use mkdir_p. Remove dirs from PRE/TMPINSTALL_FILES.
1602 +       * startup/Makefile.am: Use mkdir_p. Remove dirs from PRE/TMPINSTALL_FILES.
1603 +
1604 +2003-12-12     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1605 +
1606 +       * configure.ac: Require automake >= 1.8, autoconf >= 2.59.
1607 +
1608 +2003-12-10     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1609 +
1610 +       * start/Makefile.am: Misc cleanups and fixes.
1611 +       * startup/Makefile.am: Misc cleanups and fixes.
1612 +       * wrapup/Makefile.am: Misc cleanups and fixes.
1613 +
1614 +2003-12-03     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1615 +
1616 +       * Makefile.am: Add preinstallation dirstamp support.
1617 +       * clock/Makefile.am: Cosmetics.
1618 +       * console/Makefile.am: Cosmetics.
1619 +       * spurious/Makefile.am: Cosmetics.
1620 +       * startup/Makefile.am: Cosmetics.
1621 +       * timer/Makefile.am: Cosmetics.
1622 +       * wrapup/Makefile.am: Cosmetics.
1623 +
1624 +2003-12-02     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1625 +
1626 +       * clock/Makefile.am: Remove all-local: $(ARCH).
1627 +       * console/Makefile.am: Remove all-local: $(ARCH).
1628 +       * spurious/Makefile.am: Remove all-local: $(ARCH).
1629 +       * start/Makefile.am: Remove all-local: $(ARCH).
1630 +       * startup/Makefile.am: Remove all-local: $(ARCH).
1631 +       * timer/Makefile.am: Remove all-local: $(ARCH).
1632 +       * wrapup/Makefile.am: Remove all-local: $(ARCH).
1633 +
1634 +2003-09-29     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1635 +
1636 +       * Makefile.am: Merge-in include/Makefile.am.
1637 +       Reflect changes to bsp.am.
1638 +       * include/Makefile.am: Remove.
1639 +       * configure.ac: Reflect changes above.
1640 +
1641 +2003-09-19     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1642 +
1643 +       * bsp_specs: Remove *lib:.
1644 +
1645 +2003-09-15     Joel Sherrill <joel@OARcorp.com>
1646 +
1647 +       PR 483/bsps
1648 +       * startup/bspstart.c, startup/start_c.c: Spurious interrupt handlers
1649 +       cannot be installed until RTEMS has initialized the vector table.
1650 +
1651 +2003-09-04     Joel Sherrill <joel@OARcorp.com>
1652 +
1653 +       * clock/ckinit.c, console/console.c, include/bsp.h, misc/interr.c,
1654 +       spurious/spinit.c, startup/bspclean.c, startup/bspstart.c,
1655 +       timer/timer.c: URL for license changed.
1656 +
1657 +2003-08-20     Joel Sherrill <joel@OARcorp.com>
1658 +
1659 +       * console/console.c: Correct copyright statements.
1660 +
1661 +2003-08-18     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1662 +
1663 +       * Makefile.am: Reflect having moved aclocal/.
1664 +
1665 +2003-08-16     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1666 +
1667 +       * Makefile.am: Reflect having moved automake/.
1668 +       * clock/Makefile.am: Reflect having moved automake/.
1669 +       * console/Makefile.am: Reflect having moved automake/.
1670 +       * include/Makefile.am: Reflect having moved automake/.
1671 +       * spurious/Makefile.am: Reflect having moved automake/.
1672 +       * start/Makefile.am: Reflect having moved automake/.
1673 +       * startup/Makefile.am: Reflect having moved automake/.
1674 +       * timer/Makefile.am: Reflect having moved automake/.
1675 +       * wrapup/Makefile.am: Reflect having moved automake/.
1676 +
1677 +2003-08-11     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1678 +
1679 +       PR 452/bsps
1680 +       * startup/Makefile.am: Remove USE_INIT_FINI.
1681 +
1682 +2003-08-11     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1683 +
1684 +       * configure.ac: Use rtems-bugs@rtems.com as bug report email address.
1685 +
1686 +2003-08-06     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1687 +
1688 +       PR 445/bsps
1689 +       * bsp_specs: Remove -D__embedded__ -Asystem(embedded) from cpp.
1690 +       Remove cpp, old_cpp (now unused).
1691 +
1692 +2003-03-06     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1693 +
1694 +       * configure.ac: Remove AC_CONFIG_AUX_DIR.
1695 +
1696 +2003-02-11     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1697 +
1698 +       * configure.ac: AM_INIT_AUTOMAKE([1.7.2]).
1699 +
1700 +2003-02-11     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1701 +
1702 +       * configure.ac: AC_PREREQ(2.57).
1703 +
1704 +2003-01-20     Duane Gustavus <duane@unt.edu>
1705 +
1706 +       * console/sci.c, include/mrm332.h, startup/linkcmds,
1707 +       startup/linkcmds_ROM: Various updates to make this run properly
1708 +       from ROM.
1709 +
1710 +2002-12-20     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1711 +
1712 +       * clock/Makefile.am: Don't include @RTEMS_BSP@.cfg.
1713 +       * console/Makefile.am: Don't include @RTEMS_BSP@.cfg.
1714 +       * spurious/Makefile.am: Don't include @RTEMS_BSP@.cfg.
1715 +       * start/Makefile.am: Don't include @RTEMS_BSP@.cfg.
1716 +       * startup/Makefile.am: Don't include @RTEMS_BSP@.cfg.
1717 +       * timer/Makefile.am: Don't include @RTEMS_BSP@.cfg.
1718 +
1719 +2002-12-12     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1720 +
1721 +       * start/Makefile.am: Use install-data-local to install startfile.
1722 +
1723 +2002-12-10     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1724 +
1725 +       * wrapup/Makefile.am: Don't include @RTEMS_BSP@.cfg.
1726 +
1727 +2002-11-04     Joel Sherrill <joel@OARcorp.com>
1728 +
1729 +       * console/sci.c, spurious/spinit.c: Removed warnings.
1730 +
1731 +2002-10-21     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1732 +
1733 +       * .cvsignore: Reformat.
1734 +       Add autom4te*cache.
1735 +       Remove autom4te.cache.
1736 +
1737 +2002-09-08     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1738 +
1739 +       * Makefile.am: ACLOCAL_AMFLAGS = -I ../../../../../../aclocal.
1740 +
1741 +2002-08-21     Joel Sherrill <joel@OARcorp.com>
1742 +
1743 +       * wrapup/Makefile.am: PR217 required that the idle task be moved to
1744 +       libcpu so it could be more acutely aware of the CPU model.  This
1745 +       file was modified to pick up the idle task from there.
1746 +
1747 +2002-08-21     Joel Sherrill <joel@OARcorp.com>
1748 +
1749 +       * bsp_specs: Added support for -nostdlibs.
1750 +
1751 +2002-08-11     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1752 +
1753 +       * clock/Makefile.am: Use .$(OBJEXT) instead of .o.
1754 +       * console/Makefile.am: Use .$(OBJEXT) instead of .o.
1755 +       * spurious/Makefile.am: Use .$(OBJEXT) instead of .o.
1756 +       * start/Makefile.am: Use .$(OBJEXT) instead of .o.
1757 +       * startup/Makefile.am: Use .$(OBJEXT) instead of .o.
1758 +       * timer/Makefile.am: Use .$(OBJEXT) instead of .o.
1759 +       * wrapup/Makefile.am: Use .$(OBJEXT) instead of .o.
1760 +
1761 +2002-08-05     Joel Sherrill <joel@OARcorp.com>
1762 +
1763 +       * Per PR260 eliminate use of make-target-options.  This impacted
1764 +       RTEMS allowing a distinction between the CPU32 and CPU32+ in the
1765 +       SuperCore and required that the m68k optimized memcpy be moved
1766 +       to libcpu.
1767 +       * wrapup/Makefile.am: Pick up memcpy.o from libcpu.
1768 +
1769 +2002-07-21     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1770 +
1771 +       * start/Makefile.am: Eliminate PGM.
1772 +       Add bsplib_DATA = $(PROJECT_RELEASE)/lib/start$(LIB_VARIANT).o.
1773 +
1774 +2002-07-19     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1775 +
1776 +       * startup/Makefile.am: Add bsplib_DATA = linkcmds linkcmds_ROM.
1777 +
1778 +2002-07-04     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1779 +
1780 +       * wrapup/Makefile.am: Eliminate TMPINSTALL_FILES.
1781 +       Remove $(OBJS) from all-local.
1782 +
1783 +2002-06-29     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1784 +
1785 +       * wrapup/Makefile.am: Remove preinstallation of libbsp.a,
1786 +
1787 +2001-05-09     Joel Sherrill <joel@OARcorp.com>
1788 +
1789 +       * startup/linkcmds: In support of gcc 3.1, added one of more
1790 +       of the sections .jcr, .rodata*, .data.*, .gnu.linkonce.s2.*,
1791 +       .gnu.linkonce.sb2.*, and .gnu.linkonce.s.*.  Spacing corrections
1792 +       and direction of segments to memory regions may also have been
1793 +       addressed.  This was a sweep across all BSPs.
1794
1795 +2002-03-27     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1796 +
1797 +       * configure.ac:
1798 +       AC_INIT(package,_RTEMS_VERSION,_RTEMS_BUGS).
1799 +       AM_INIT_AUTOMAKE([no-define foreign 1.6]).
1800 +       * clock/Makefile.am: Remove AUTOMAKE_OPTIONS.
1801 +       * Makefile.am: Remove AUTOMAKE_OPTIONS.
1802 +       * console/Makefile.am: Remove AUTOMAKE_OPTIONS.
1803 +       * include/Makefile.am: Remove AUTOMAKE_OPTIONS.
1804 +       * spurious/Makefile.am: Remove AUTOMAKE_OPTIONS.
1805 +       * start/Makefile.am: Remove AUTOMAKE_OPTIONS.
1806 +       * startup/Makefile.am: Remove AUTOMAKE_OPTIONS.
1807 +       * timer/Makefile.am: Remove AUTOMAKE_OPTIONS.
1808 +       * wrapup/Makefile.am: Remove AUTOMAKE_OPTIONS.
1809 +
1810 +2002-02-28     Mike Panetta <ahuitzot@mindspring.com>
1811 +
1812 +       * console/sci.c, console/sci.h, 
1813 +       console/console.c: Added new SCI driver.
1814 +       * start/start.c: Removed file.
1815 +       * start/start.S: New file, the asm portion of the updated start code.
1816 +       * start/configure.am: Added start.S, removed start.c
1817 +       * 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. 
1818 +       * startup/configure.am: Added start_c.c to C_FILES.
1819 +       * include/bsp.h: Added include <rtems/bspIo.h>
1820 +
1821 +2001-11-30     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1822 +
1823 +       * configure.ac: Introduce RTEMS_BSP_CONFIGURE.
1824 +
1825 +2001-10-11     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1826 +
1827 +       * .cvsignore: Add autom4te.cache for autoconf > 2.52.
1828 +       * configure.in: Remove.
1829 +       * configure.ac: New file, generated from configure.in by autoupdate.
1830 +
1831 +2001-09-27     Joel Sherrill <joel@OARcorp.com>
1832 +
1833 +       * include/bsp.h: Renamed delay() to rtems_bsp_delay().
1834 +
1835 +2001-09-27     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1836 +
1837 +       * include/Makefile.am: Use 'TMPINSTALL_FILES ='.
1838 +
1839 +2001-05-26     Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1840 +
1841 +       * configure.in: Add bspopts.h.
1842 +       * include/.cvsignore: Add bspopts.h*, stamp-h*.
1843 +       * include/Makefile.am: Use *_HEADERS instead of *H_FILES.
1844 +       * include/bsp.h: Include bspopts.h.
1845 +
1846 +2001-05-25     Joel Sherrill <joel@OARcorp.com>
1847 +
1848 +       * clock/Makefile.am, console/Makefile.am, spurious/Makefile.am,
1849 +       start/Makefile.am, startup/Makefile.am, timer/Makefile.am,
1850 +       wrapup/Makefile.am: Modified to include compile.am.
1851 +       * startup/bspstart.c: Removed include of <libcsupport.h>
1852 +
1853 +2000-05-25     Matt Cross <profesor@gweep.net>
1854 +
1855 +       * New MRM332 BSP for the Mini RoboMind board based
1856 +       on the 68332 microcontroller designed and build by Mark
1857 +       Castelluccio.  For details on the MRM see http://www.robominds.com.
1858 +       * .cvsignore, ChangeLog Makefile.am, README, bsp_specs,
1859 +       clock/.cvsignore, clock/Makefile.am, clock/ckinit.c, configure.in,
1860 +       console/.cvsignore, console/Makefile.am, console/console.c,
1861 +       include/.cvsignore, include/Makefile.am, include/bsp.h,
1862 +       include/mrm332.h, misc/dotests, misc/gdbinit68, misc/interr.c,
1863 +       spurious/.cvsignore, spurious/Makefile.am, spurious/spinit.c,
1864 +       start/.cvsignore, start/Makefile.am, start/start.c, startup/.cvsignore,
1865 +       startup/Makefile.am, startup/bspclean.c, startup/bspstart.c,
1866 +       startup/except_vect_332_ROM.S, startup/linkcmds, startup/linkcmds_ROM,
1867 +       timer/.cvsignore, timer/Makefile.am, timer/timer.c, times,
1868 +       wrapup/.cvsignore, wrapup/Makefile.am: Initial files.
1869 +
1870 Index: rtems-051009/c/src/lib/libbsp/m68k/mo376/startup/bspclean.c
1871 ===================================================================
1872 --- /dev/null
1873 +++ rtems/c/src/lib/libbsp/m68k/mo376/startup/bspclean.c
1874 @@ -0,0 +1,27 @@
1875 +/*  bsp_cleanup()
1876 + *
1877 + *  This routine cleans up in the sense that it places the board
1878 + *  in a safe state and flushes the I/O buffers before exiting.
1879 + *
1880 + *  INPUT:  NONE
1881 + *
1882 + *  OUTPUT: NONE
1883 + *
1884 + *  COPYRIGHT (c) 1989-1999.
1885 + *  On-Line Applications Research Corporation (OAR).
1886 + *
1887 + *  The license and distribution terms for this file may be
1888 + *  found in the file LICENSE in this distribution or at
1889 + *  http://www.rtems.com/license/LICENSE.
1890 + *
1891 + *  $Id: bspclean.c,v 1.4 2004/04/21 10:42:52 ralf Exp $
1892 + */
1893 +
1894 +#include <bsp.h>
1895 +
1896 +void bsp_cleanup(void)
1897 +{
1898 +    /* interrupt driven stdio must be flushed */
1899 +    _CPU_ISR_Set_level( 7 );
1900 +    //_UART_flush();
1901 +}
1902 Index: rtems-051009/c/src/lib/libbsp/m68k/mo376/timer/timer.c
1903 ===================================================================
1904 --- /dev/null
1905 +++ rtems/c/src/lib/libbsp/m68k/mo376/timer/timer.c
1906 @@ -0,0 +1,81 @@
1907 +/*  Timer_init()
1908 + *
1909 + *  This routine is not implemented for this BSP.
1910 + *
1911 + *  Input parameters:  NONE
1912 + *
1913 + *  Output parameters:  NONE
1914 + *
1915 + *  NOTE: It is important that the timer start/stop overhead be
1916 + *        determined when porting or modifying this code.
1917 + *
1918 + *  COPYRIGHT (c) 1989-1999.
1919 + *  On-Line Applications Research Corporation (OAR).
1920 + *
1921 + *  The license and distribution terms for this file may be
1922 + *  found in the file LICENSE in this distribution or at
1923 + *  http://www.rtems.com/license/LICENSE.
1924 + *
1925 + *  $Id: timer.c,v 1.6 2004/04/21 16:01:35 ralf Exp $
1926 + */
1927 +
1928 +#include <bsp.h>
1929 +
1930 +rtems_boolean Timer_driver_Find_average_overhead;
1931 +
1932 +extern rtems_isr Clock_isr();
1933 +
1934 +void Timer_initialize( void )
1935 +{
1936 +}
1937 +
1938 +/*
1939 + *  The following controls the behavior of Read_timer().
1940 + *
1941 + *  FIND_AVG_OVERHEAD *  instructs the routine to return the "raw" count.
1942 + *
1943 + *  AVG_OVEREHAD is the overhead for starting and stopping the timer.  It
1944 + *  is usually deducted from the number returned.
1945 + *
1946 + *  LEAST_VALID is the lowest number this routine should trust.  Numbers
1947 + *  below this are "noise" and zero is returned.
1948 + */
1949 +
1950 +#define AVG_OVERHEAD      0  /* It typically takes X.X microseconds */
1951 +                             /* (Y countdowns) to start/stop the timer. */
1952 +                             /* This value is in microseconds. */
1953 +#define LEAST_VALID       1  /* Don't trust a clicks value lower than this */
1954 +
1955 +/*
1956 + * Return timer value in 1/2-microsecond units
1957 + */
1958 +int Read_timer( void )
1959 +{
1960 +  uint32_t         total;
1961 +  total = 0;
1962 +
1963 +  if ( Timer_driver_Find_average_overhead == 1 )
1964 +    return total;          /* in XXX microsecond units */
1965 +
1966 +  if ( total < LEAST_VALID )
1967 +    return 0;            /* below timer resolution */
1968 +
1969 +  return (total - AVG_OVERHEAD);
1970 +}
1971 +
1972 +/*
1973 + *  Empty function call used in loops to measure basic cost of looping
1974 + *  in Timing Test Suite.
1975 + */
1976 +
1977 +rtems_status_code Empty_function(void)
1978 +{
1979 +    return RTEMS_SUCCESSFUL;
1980 +}
1981 +
1982 +void Set_find_average_overhead(
1983 +  rtems_boolean find_flag
1984 +)
1985 +{
1986 +  Timer_driver_Find_average_overhead = find_flag;
1987 +}
1988 Index: rtems-051009/c/src/lib/libbsp/m68k/mo376/clock/ckinit.c
1989 ===================================================================
1990 --- /dev/null
1991 +++ rtems/c/src/lib/libbsp/m68k/mo376/clock/ckinit.c
1992 @@ -0,0 +1,128 @@
1993 +/*  Clock_init()
1994 + *
1995 + *  This routine initailizes the periodic interrupt timer on
1996 + *  the Motorola 68332.
1997 + *
1998 + *  Input parameters:  NONE
1999 + *
2000 + *  Output parameters:  NONE
2001 + *
2002 + *  COPYRIGHT (c) 1989-1999.
2003 + *  On-Line Applications Research Corporation (OAR).
2004 + *
2005 + *  The license and distribution terms for this file may be
2006 + *  found in the file LICENSE in this distribution or at
2007 + *  http://www.rtems.com/license/LICENSE.
2008 + *
2009 + *  $Id: ckinit.c,v 1.5 2004/04/21 10:42:52 ralf Exp $
2010 + */
2011 +
2012 +#include <stdlib.h>
2013 +#include <bsp.h>
2014 +#include <rtems/libio.h>
2015 +#include <mrm332.h>
2016 +
2017 +#define CLOCK_VECTOR   MRM_PIV
2018 +
2019 +uint32_t         Clock_isrs;        /* ISRs until next tick */
2020 +volatile uint32_t         Clock_driver_ticks;
2021 +                                    /* ticks since initialization */
2022 +rtems_isr_entry  Old_ticker;
2023 +
2024 +void Clock_exit( void );
2025 +
2026 +/*
2027 + * These are set by clock driver during its init
2028 + */
2029 +
2030 +rtems_device_major_number rtems_clock_major = ~0;
2031 +rtems_device_minor_number rtems_clock_minor;
2032 +
2033 +rtems_isr Clock_isr(rtems_vector_number vector)
2034 +{
2035 +  Clock_driver_ticks += 1;
2036 +
2037 +  if ( Clock_isrs == 1 ) {
2038 +    rtems_clock_tick();
2039 +    Clock_isrs = BSP_Configuration.microseconds_per_tick / 1000;
2040 +  }
2041 +  else
2042 +    Clock_isrs -= 1;
2043 +}
2044 +
2045 +void Install_clock(
2046 +  rtems_isr_entry clock_isr
2047 +)
2048 +{
2049 +  Clock_driver_ticks = 0;
2050 +  Clock_isrs = BSP_Configuration.microseconds_per_tick / 1000;
2051 +
2052 +  Old_ticker = (rtems_isr_entry) set_vector( clock_isr, CLOCK_VECTOR, 1 );
2053 +
2054 +  /* enable 1mS interrupts */
2055 +  *PITR = (unsigned short int)( SAM(0x09,0,PITM) );/* load counter */
2056 +  *PICR = (unsigned short int)                     /* enable interrupt */
2057 +    ( SAM(ISRL_PIT,8,PIRQL) | SAM(CLOCK_VECTOR,0,PIV) );
2058 +
2059 +  atexit( Clock_exit );
2060 +}
2061 +
2062 +void Clock_exit( void )
2063 +{
2064 +  /* shutdown the periodic interrupt */
2065 +  *PICR = (unsigned short int)
2066 +    ( SAM(0,8,PIRQL) | SAM(CLOCK_VECTOR,0,PIV) );
2067 +  /*     ^^ zero disables interrupt */
2068 +
2069 +  /* do not restore old vector */
2070 +}
2071 +
2072 +rtems_device_driver Clock_initialize(
2073 +  rtems_device_major_number major,
2074 +  rtems_device_minor_number minor,
2075 +  void *pargp
2076 +)
2077 +{
2078 +  Install_clock( Clock_isr );
2079 +
2080 +  /*
2081 +   * make major/minor avail to others such as shared memory driver
2082 +   */
2083 +
2084 +  rtems_clock_major = major;
2085 +  rtems_clock_minor = minor;
2086 +
2087 +  return RTEMS_SUCCESSFUL;
2088 +}
2089 +
2090 +rtems_device_driver Clock_control(
2091 +  rtems_device_major_number major,
2092 +  rtems_device_minor_number minor,
2093 +  void *pargp
2094 +)
2095 +{
2096 +    uint32_t         isrlevel;
2097 +    rtems_libio_ioctl_args_t *args = pargp;
2098 +
2099 +    if (args == 0)
2100 +        goto done;
2101 +
2102 +    /*
2103 +     * This is hokey, but until we get a defined interface
2104 +     * to do this, it will just be this simple...
2105 +     */
2106 +
2107 +    if (args->command == rtems_build_name('I', 'S', 'R', ' '))
2108 +    {
2109 +        Clock_isr(CLOCK_VECTOR);
2110 +    }
2111 +    else if (args->command == rtems_build_name('N', 'E', 'W', ' '))
2112 +    {
2113 +      rtems_interrupt_disable( isrlevel );
2114 +       (void) set_vector( args->buffer, CLOCK_VECTOR, 1 );
2115 +      rtems_interrupt_enable( isrlevel );
2116 +    }
2117 +
2118 +done:
2119 +    return RTEMS_SUCCESSFUL;
2120 +}
2121 Index: rtems-051009/c/src/lib/libbsp/m68k/mo376/misc/gdbinit68
2122 ===================================================================
2123 --- /dev/null
2124 +++ rtems/c/src/lib/libbsp/m68k/mo376/misc/gdbinit68
2125 @@ -0,0 +1,16 @@
2126 +#
2127 +#  $Id: gdbinit68,v 1.1 2001/05/25 16:28:46 joel Exp $
2128 +#
2129 +echo Setting up the environment for mrm debuging.\n
2130 +
2131 +target bdm /dev/bdmcpu320
2132 +bdm_setdelay 1000
2133 +bdm_autoreset on
2134 +set remotecache off
2135 +bdm_timetocomeup 0
2136 +bdm_init
2137 +bdm_reset
2138 +set $sfc=5
2139 +set $dfc=5
2140 +r
2141 +q
2142 Index: rtems-051009/c/src/lib/libbsp/m68k/mo376/configure.ac
2143 ===================================================================
2144 --- /dev/null
2145 +++ rtems/c/src/lib/libbsp/m68k/mo376/configure.ac
2146 @@ -0,0 +1,20 @@
2147 +## Process this file with autoconf to produce a configure script.
2148 +## 
2149 +## $Id: configure.ac,v 1.14 2004/09/24 06:32:09 ralf Exp $
2150 +
2151 +AC_PREREQ(2.59)
2152 +AC_INIT([rtems-c-src-lib-libbsp-m68k-mrm332],[_RTEMS_VERSION],[rtems-bugs@rtems.com])
2153 +AC_CONFIG_SRCDIR([bsp_specs])
2154 +RTEMS_TOP(../../../../../..)
2155 +
2156 +RTEMS_CANONICAL_TARGET_CPU
2157 +AM_INIT_AUTOMAKE([no-define nostdinc foreign 1.9])
2158 +RTEMS_BSP_CONFIGURE
2159 +
2160 +RTEMS_PROG_CC_FOR_TARGET
2161 +RTEMS_CANONICALIZE_TOOLS
2162 +RTEMS_PROG_CCAS
2163 +
2164 +# Explicitly list all Makefiles here
2165 +AC_CONFIG_FILES([Makefile])
2166 +AC_OUTPUT
2167 Index: rtems-051009/c/src/lib/libbsp/m68k/mo376/README
2168 ===================================================================
2169 --- /dev/null
2170 +++ rtems/c/src/lib/libbsp/m68k/mo376/README
2171 @@ -0,0 +1,24 @@
2172 +#
2173 +#  $Id: README,v 1.1 2001/05/25 16:28:46 joel Exp $
2174 +#
2175 +
2176 +Description: mrm332
2177 +============
2178 +CPU: MC68332 @16 or 25MHz
2179 +RAM: 32k or 512k
2180 +ROM: 512k flash
2181 +
2182 +   The Mini RoboMind is a small board based on the 68332 microcontroller
2183 +designed and build by Mark Castelluccio.  For details, see:
2184 +
2185 +        http://www.robominds.com
2186 +
2187 +   This BSP was ported from the efi332 BSP by Matt Cross (profesor@gweep.net),
2188 +the efi332 BSP was written by John S Gwynne.
2189 +
2190 +TODO:
2191 +=====
2192 +- integrate the interrupt driven stdin/stdout into RTEMS to (a) reduce
2193 +  the interrupt priority and (2) to prevent it from blocking.
2194 +- add a timer driver for the tmtest set.
2195 +
2196 Index: rtems-051009/c/src/lib/libbsp/m68k/mo376/Makefile.am
2197 ===================================================================
2198 --- /dev/null
2199 +++ rtems/c/src/lib/libbsp/m68k/mo376/Makefile.am
2200 @@ -0,0 +1,124 @@
2201 +##
2202 +## $Id: Makefile.am,v 1.21 2005/01/07 06:54:44 ralf Exp $
2203 +##
2204 +
2205 +ACLOCAL_AMFLAGS = -I ../../../../aclocal
2206 +
2207 +include $(top_srcdir)/../../../../automake/compile.am
2208 +include $(top_srcdir)/../../bsp.am
2209 +
2210 +dist_project_lib_DATA = bsp_specs
2211 +
2212 +include_HEADERS = include/bsp.h
2213 +include_HEADERS += include/tm27.h
2214 +
2215 +nodist_include_HEADERS = include/bspopts.h
2216 +DISTCLEANFILES = include/bspopts.h
2217 +
2218 +noinst_PROGRAMS =
2219 +
2220 +include_HEADERS += include/mrm332.h
2221 +nodist_include_HEADERS += ../../shared/include/coverhd.h
2222 +
2223 +EXTRA_DIST = times
2224 +
2225 +EXTRA_DIST += start/start.S
2226 +start.$(OBJEXT): start/start.S
2227 +       $(CPPASCOMPILE) -DASM -o $@ -c $<
2228 +
2229 +project_lib_DATA = start.$(OBJEXT)
2230 +
2231 +dist_project_lib_DATA += startup/linkcmds startup/linkcmds_ROM
2232 +
2233 +noinst_PROGRAMS += startup.rel
2234 +startup_rel_SOURCES = startup/start_c.c ../../shared/bsplibc.c \
2235 +    ../../shared/bsppost.c startup/bspstart.c startup/bspclean.c \
2236 +    ../../shared/bootcard.c ../../m68k/shared/m68kpretaskinghook.c \
2237 +    ../../shared/main.c ../../shared/sbrk.c ../../m68k/shared/setvec.c \
2238 +    ../../shared/gnatinstallhandler.c startup/except_vect_332_ROM.S
2239 +startup_rel_CPPFLAGS = $(AM_CPPFLAGS)
2240 +startup_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
2241 +
2242 +noinst_PROGRAMS += clock.rel
2243 +clock_rel_SOURCES = clock/ckinit.c
2244 +clock_rel_CPPFLAGS = $(AM_CPPFLAGS)
2245 +clock_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
2246 +
2247 +noinst_PROGRAMS += console.rel
2248 +console_rel_SOURCES = console/console.c console/sci.c console/sci.h
2249 +console_rel_CPPFLAGS = $(AM_CPPFLAGS)
2250 +console_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
2251 +
2252 +noinst_PROGRAMS += spurious.rel
2253 +spurious_rel_SOURCES = spurious/spinit.c
2254 +spurious_rel_CPPFLAGS = $(AM_CPPFLAGS)
2255 +spurious_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
2256 +
2257 +noinst_PROGRAMS += timer.rel
2258 +timer_rel_SOURCES = timer/timer.c
2259 +timer_rel_CPPFLAGS = $(AM_CPPFLAGS)
2260 +timer_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
2261 +
2262 +noinst_LIBRARIES = libbsp.a
2263 +libbsp_a_SOURCES =
2264 +libbsp_a_LIBADD = startup.rel clock.rel console.rel spurious.rel timer.rel
2265 +libbsp_a_LIBADD += ../../../libcpu/@RTEMS_CPU@/shared/cache.rel \
2266 +    ../../../libcpu/@RTEMS_CPU@/shared/misc.rel
2267 +
2268 +all-local: $(PREINSTALL_FILES) $(TMPINSTALL_FILES)
2269 +
2270 +PREINSTALL_DIRS =
2271 +PREINSTALL_FILES =
2272 +TMPINSTALL_FILES =
2273 +
2274 +$(PROJECT_INCLUDE)/$(dirstamp):
2275 +       @$(mkdir_p) $(PROJECT_INCLUDE)
2276 +       @: > $(PROJECT_INCLUDE)/$(dirstamp)
2277 +PREINSTALL_DIRS += $(PROJECT_INCLUDE)/$(dirstamp)
2278 +
2279 +$(PROJECT_LIB)/$(dirstamp):
2280 +       @$(mkdir_p) $(PROJECT_LIB)
2281 +       @: > $(PROJECT_LIB)/$(dirstamp)
2282 +PREINSTALL_DIRS += $(PROJECT_LIB)/$(dirstamp)
2283 +
2284 +$(PROJECT_LIB)/bsp_specs: bsp_specs $(PROJECT_LIB)/$(dirstamp)
2285 +       $(INSTALL_DATA) $< $(PROJECT_LIB)/bsp_specs
2286 +PREINSTALL_FILES += $(PROJECT_LIB)/bsp_specs
2287 +
2288 +$(PROJECT_INCLUDE)/bsp.h: include/bsp.h $(PROJECT_INCLUDE)/$(dirstamp)
2289 +       $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp.h
2290 +PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp.h
2291 +
2292 +$(PROJECT_INCLUDE)/tm27.h: include/tm27.h $(PROJECT_INCLUDE)/$(dirstamp)
2293 +       $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/tm27.h
2294 +PREINSTALL_FILES += $(PROJECT_INCLUDE)/tm27.h
2295 +
2296 +$(PROJECT_INCLUDE)/bspopts.h: include/bspopts.h $(PROJECT_INCLUDE)/$(dirstamp)
2297 +       $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bspopts.h
2298 +PREINSTALL_FILES += $(PROJECT_INCLUDE)/bspopts.h
2299 +
2300 +$(PROJECT_INCLUDE)/mrm332.h: include/mrm332.h $(PROJECT_INCLUDE)/$(dirstamp)
2301 +       $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/mrm332.h
2302 +PREINSTALL_FILES += $(PROJECT_INCLUDE)/mrm332.h
2303 +
2304 +$(PROJECT_INCLUDE)/coverhd.h: ../../shared/include/coverhd.h $(PROJECT_INCLUDE)/$(dirstamp)
2305 +       $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/coverhd.h
2306 +PREINSTALL_FILES += $(PROJECT_INCLUDE)/coverhd.h
2307 +
2308 +$(PROJECT_LIB)/start.$(OBJEXT): start.$(OBJEXT) $(PROJECT_LIB)/$(dirstamp)
2309 +       $(INSTALL_DATA) $< $(PROJECT_LIB)/start.$(OBJEXT)
2310 +TMPINSTALL_FILES += $(PROJECT_LIB)/start.$(OBJEXT)
2311 +
2312 +$(PROJECT_LIB)/linkcmds: startup/linkcmds $(PROJECT_LIB)/$(dirstamp)
2313 +       $(INSTALL_DATA) $< $(PROJECT_LIB)/linkcmds
2314 +PREINSTALL_FILES += $(PROJECT_LIB)/linkcmds
2315 +
2316 +$(PROJECT_LIB)/linkcmds_ROM: startup/linkcmds_ROM $(PROJECT_LIB)/$(dirstamp)
2317 +       $(INSTALL_DATA) $< $(PROJECT_LIB)/linkcmds_ROM
2318 +PREINSTALL_FILES += $(PROJECT_LIB)/linkcmds_ROM
2319 +
2320 +CLEANFILES = $(PREINSTALL_FILES)
2321 +DISTCLEANFILES += $(PREINSTALL_DIRS)
2322 +CLEANFILES += $(TMPINSTALL_FILES)
2323 +
2324 +include $(top_srcdir)/../../../../automake/local.am
2325 Index: rtems-051009/c/src/lib/libbsp/m68k/mo376/console/sci.c
2326 ===================================================================
2327 --- /dev/null
2328 +++ rtems/c/src/lib/libbsp/m68k/mo376/console/sci.c
2329 @@ -0,0 +1,1620 @@
2330 +/*****************************************************************************
2331 +* File:     sci.c
2332 +*
2333 +* Desc:     This file contains the console IO routines for the SCI port.
2334 +*           There are two interfaces in this module. One is for the rtems
2335 +*           termios/console code and the other is a device driver interface.
2336 +*           This module works together with the termio module which is
2337 +*           sometimes referred to as the "line disciplines" which implements
2338 +*           terminal i/o processing like tabs, backspaces, and newlines.
2339 +*           The rtems printf uses interrupt io and the rtems printk routine
2340 +*           uses polled io which is better for debugging.
2341 +*
2342 +* Index:    Documentation
2343 +*           Section A  - Include Files
2344 +*           Section B  - Manifest Constants
2345 +*           Section C  - External Data
2346 +*           Section D  - External Functions
2347 +*           Section E  - Local Functions
2348 +*           Section F  - Local Variables
2349 +*           Section G  - A circular data buffer for rcv chars
2350 +*           Section H  - RTEMS termios callbacks for the interrupt api
2351 +*           Section I  - RTEMS termios callbacks for the polled api
2352 +
2353 +*           Section 0  - Miscellaneous routines
2354 +*           Section 1  - Routines to manipulate the circular buffer
2355 +*           Section 2  - Interrupt based entry points for the termios module
2356 +*           Section 3  - Polling based entry points for the termios module
2357 +*           Section 4  - Device driver public api entry points
2358 +*           Section 5  - Hardware level routines
2359 +*           Section 6  - Testing and debugging code
2360 +*
2361 +* Refer:    Motorola QSM Reference Manual - Chapter 5 - SCI sub-module
2362 +*
2363 +* Note:     See bsp.h,confdefs.h,system.h for installing drivers into RTEMS.
2364 +*
2365 +* $Id: sci.c,v 1.10 2005/01/05 18:12:35 ralf Exp $
2366 +*
2367 +*****************************************************************************/
2368 +\f
2369 +
2370 +/*****************************************************************************
2371 +  Compiler Options for the incurably curious
2372 +*****************************************************************************/
2373 +
2374 +/*
2375 +/opt/rtems/bin/m68k-rtems-gcc
2376 +    --pipe                                      # use pipes, not tmp files
2377 +    -B../../../../../../../../opti/lib/         # where the library is
2378 +    -specs bsp_specs                            # ???
2379 +    -qrtems                                     # ???
2380 +    -g                                          # add debugging info
2381 +    -Wall                                       # issue all warnings
2382 +    -fasm                                       # allow inline asm???
2383 +    -DCONSOLE_SCI                               # for opti-r box/rev b proto
2384 +    -mcpu32                                     # machine = motorola cpu 32
2385 +    -c                                          # compile, don't link
2386 +    -O4                                         # max optimization
2387 +    -fomit-frame-pointer                        # stack frames are optional
2388 +    -o o-optimize/sci.o                         # the object file
2389 +    ../../../../../../../../../rtems/c/src/lib/libbsp/m68k/opti/console/sci.c
2390 +*/
2391 +\f
2392 +
2393 +/*****************************************************************************
2394 +  Overview of serial port console terminal input/output
2395 +*****************************************************************************/
2396 +
2397 +/*
2398 +   +-----------+                               +---------+
2399 +   |    app    |                               |   app   |
2400 +   +-----------+                               +---------+
2401 +         |                                          |
2402 +         | (printf,scanf,etc.)                      |
2403 +         v                                          |
2404 +   +-----------+                                    |
2405 +   |    libc   |                                    |
2406 +   +-----------+                                    |
2407 +         |                                          |
2408 +         |                                          |
2409 +         |     (open,close,read,write,ioctl)        |
2410 +   ======|==========================================|========================
2411 +         | /dev/console                             | /dev/sci
2412 +         | (stdin,stdout,stderr)                    |
2413 +   ======|==========================================|========================
2414 +         |                                          |
2415 +         |                                          |
2416 +         v                                          v
2417 +   +-----------+         +-----------+         +---------+
2418 +   |  console  |  <--->  |  termios  |  <--->  |   sci   |
2419 +   |  driver   |         |  module   |         |  driver |
2420 +   +-----------+         +-----------+         +---------+
2421 +                                                    |
2422 +                                                    |
2423 +                                                    v
2424 +                                               +---------+
2425 +                                               |         |
2426 +                                               |  uart   |
2427 +                                               |         |
2428 +                                               +---------+
2429 +*/
2430 +\f
2431 +
2432 +/*****************************************************************************
2433 +  Section A - Include Files
2434 +*****************************************************************************/
2435 +
2436 +#include <rtems.h>
2437 +#include <bsp.h>
2438 +#include <rtems/bspIo.h>
2439 +#include <stdio.h>
2440 +#include <rtems/libio.h>
2441 +#include <libchip/serial.h>
2442 +#include <libchip/sersupp.h>
2443 +#include "sci.h"
2444 +//#include "../misc/include/cpu332.h"
2445 +\f
2446 +
2447 +/*****************************************************************************
2448 +  Section B - Manifest Constants
2449 +*****************************************************************************/
2450 +
2451 +#define SCI_MINOR       0                   // minor device number
2452 +
2453 +// IMPORTANT - if the device driver api is opened, it means the sci is being
2454 +// used for direct hardware access, so other users (like termios) get ignored
2455 +
2456 +#define DRIVER_CLOSED   0                   // the device driver api is closed
2457 +#define DRIVER_OPENED   1                   // the device driver api is opened
2458 +
2459 +// system clock definitions, i dont have documentation on this...
2460 +
2461 +#if 0 // Not needed, this is provided in mrm332.h
2462 +#define XTAL            32768.0                        // crystal frequency in Hz
2463 +#define NUMB_W          0                              // system clock parameters
2464 +#define NUMB_X          1
2465 +//efine NUMB_Y          0x38                   // for 14.942 Mhz
2466 +#define NUMB_Y          0x3F                       // for 16.777 Mhz
2467 +
2468 +#define SYS_CLOCK       (XTAL * 4.0 * (NUMB_Y+1) * (1 << (2 * NUMB_W + NUMB_X)))
2469 +
2470 +#endif
2471 +\f
2472 +
2473 +/*****************************************************************************
2474 +  Section C - External Data
2475 +*****************************************************************************/
2476 +
2477 +\f
2478 +
2479 +/*****************************************************************************
2480 +  Section D - External Functions
2481 +*****************************************************************************/
2482 +
2483 +\f
2484 +
2485 +/*****************************************************************************
2486 +  Section E - Local Functions
2487 +*****************************************************************************/
2488 +
2489 +void SCI_output_char(char c);
2490 +
2491 +rtems_isr SciIsr( rtems_vector_number vector );         // interrupt handler
2492 +
2493 +const rtems_termios_callbacks * SciGetTermiosHandlers( int32_t   polled );
2494 +
2495 +rtems_device_driver SciInitialize ();                   // device driver api
2496 +rtems_device_driver SciOpen ();                         // device driver api
2497 +rtems_device_driver SciClose ();                        // device driver api
2498 +rtems_device_driver SciRead ();                         // device driver api
2499 +rtems_device_driver SciWrite ();                        // device driver api
2500 +rtems_device_driver SciControl ();                      // device driver api
2501 +
2502 +int32_t   SciInterruptOpen();                            // termios api
2503 +int32_t   SciInterruptClose();                           // termios api
2504 +int32_t   SciInterruptWrite();                           // termios api
2505 +
2506 +int32_t   SciSetAttributes();                            // termios api
2507 +
2508 +int32_t   SciPolledOpen();                               // termios api
2509 +int32_t   SciPolledClose();                              // termios api
2510 +int32_t   SciPolledRead();                               // termios api
2511 +int32_t   SciPolledWrite();                              // termios api
2512 +
2513 +static void SciSetBaud(uint32_t   rate);                // hardware routine
2514 +static void SciSetDataBits(uint16_t   bits);            // hardware routine
2515 +static void SciSetParity(uint16_t   parity);            // hardware routine
2516 +
2517 +static void inline SciDisableAllInterrupts( void );     // hardware routine
2518 +static void inline SciDisableTransmitInterrupts( void );// hardware routine
2519 +static void inline SciDisableReceiveInterrupts( void ); // hardware routine
2520 +
2521 +static void inline SciEnableTransmitInterrupts( void ); // hardware routine
2522 +static void inline SciEnableReceiveInterrupts( void );  // hardware routine
2523 +
2524 +static void inline SciDisableReceiver( void );          // hardware routine
2525 +static void inline SciDisableTransmitter( void );       // hardware routine
2526 +
2527 +static void inline SciEnableReceiver( void );           // hardware routine
2528 +static void inline SciEnableTransmitter( void );        // hardware routine
2529 +
2530 +void SciWriteCharWait  ( uint8_t);                   // hardware routine
2531 +void SciWriteCharNoWait( uint8_t);                   // hardware routine
2532 +
2533 +uint8_t   inline SciCharAvailable( void );              // hardware routine
2534 +
2535 +uint8_t   inline SciReadCharWait( void );               // hardware routine
2536 +uint8_t   inline SciReadCharNoWait( void );             // hardware routine
2537 +
2538 +void SciSendBreak( void );                              // test routine
2539 +
2540 +static int8_t   SciRcvBufGetChar();                      // circular rcv buf
2541 +static void    SciRcvBufPutChar( uint8_t);           // circular rcv buf
2542 +//atic void    SciRcvBufFlush( void );                  // circular rcv buf
2543 +
2544 +void SciUnitTest();                                     // test routine
2545 +void SciPrintStats();                                   // test routine
2546 +\f
2547 +
2548 +/*****************************************************************************
2549 +  Section F - Local Variables
2550 +*****************************************************************************/
2551 +
2552 +static struct rtems_termios_tty *SciTermioTty;
2553 +
2554 +static uint8_t   SciInited = 0;             // has the driver been inited
2555 +
2556 +static uint8_t   SciOpened;                 // has the driver been opened
2557 +
2558 +static uint8_t   SciMajor;                  // major device number
2559 +
2560 +static uint16_t   SciBaud;                  // current value in baud register
2561 +
2562 +static uint32_t   SciBytesIn  = 0;          // bytes received
2563 +static uint32_t   SciBytesOut = 0;          // bytes transmitted
2564 +
2565 +static uint32_t   SciErrorsParity  = 0;     // error counter
2566 +static uint32_t   SciErrorsNoise   = 0;     // error counter
2567 +static uint32_t   SciErrorsFraming = 0;     // error counter
2568 +static uint32_t   SciErrorsOverrun = 0;     // error counter
2569 +
2570 +#if defined(CONSOLE_SCI)
2571 +
2572 +// this is what rtems printk uses to do polling based output
2573 +
2574 +BSP_output_char_function_type      BSP_output_char = SCI_output_char;
2575 +BSP_polling_getchar_function_type  BSP_poll_char   = NULL;
2576 +
2577 +#endif
2578 +
2579 +// cvs id string so you can use the unix ident command on the object
2580 +
2581 +#ifdef ID_STRINGS
2582 +static const char SciIdent[]="$Id: sci.c,v 1.10 2005/01/05 18:12:35 ralf Exp $";
2583 +#endif
2584 +\f
2585 +
2586 +/*****************************************************************************
2587 +  Section G - A circular buffer for rcv chars when the driver interface is used.
2588 +*****************************************************************************/
2589 +
2590 +// it is trivial to wrap your buffer pointers when size is a power of two
2591 +
2592 +#define SCI_RCV_BUF_SIZE        256         // must be a power of 2 !!!
2593 +
2594 +// if someone opens the sci device using the device driver interface,
2595 +// then the receive data interrupt handler will put characters in this buffer
2596 +// instead of sending them up to the termios module for the console
2597 +
2598 +static uint8_t   SciRcvBuffer[SCI_RCV_BUF_SIZE];
2599 +
2600 +static uint8_t   SciRcvBufPutIndex = 0;     // array index to put in next char
2601 +
2602 +static uint8_t   SciRcvBufGetIndex = 0;     // array index to take out next char
2603 +
2604 +static uint16_t  SciRcvBufCount = 0;        // how many bytes are in the buffer
2605 +
2606 +\f
2607 +
2608 +/*****************************************************************************
2609 +  Section H - RTEMS termios callbacks for the interrupt version of the driver
2610 +*****************************************************************************/
2611 +
2612 +static const rtems_termios_callbacks SciInterruptCallbacks =
2613 +{
2614 +    SciInterruptOpen,                       // first open
2615 +    SciInterruptClose,                      // last close
2616 +    NULL,                                   // polled read (not required)
2617 +    SciInterruptWrite,                      // write
2618 +    SciSetAttributes,                       // set attributes
2619 +    NULL,                                   // stop remote xmit
2620 +    NULL,                                   // start remote xmit
2621 +    TRUE                                    // output uses interrupts
2622 +};
2623 +
2624 +/*****************************************************************************
2625 +  Section I - RTEMS termios callbacks for the polled version of the driver
2626 +*****************************************************************************/
2627 +
2628 +static const rtems_termios_callbacks SciPolledCallbacks =
2629 +{
2630 +    SciPolledOpen,                          // first open
2631 +    SciPolledClose,                         // last close
2632 +    SciPolledRead,                          // polled read
2633 +    SciPolledWrite,                         // write
2634 +    SciSetAttributes,                       // set attributes
2635 +    NULL,                                   // stop remote xmit
2636 +    NULL,                                   // start remote xmit
2637 +    FALSE                                   // output uses interrupts
2638 +};
2639 +\f
2640 +
2641 +/////////////////////////////////////////////////////////////////////////////
2642 +//
2643 +//                              SECTION 0
2644 +//                        MISCELLANEOUS ROUTINES
2645 +//
2646 +/////////////////////////////////////////////////////////////////////////////
2647 +
2648 +/****************************************************************************
2649 +* Func:     SCI_output_char
2650 +* Desc:     used by rtems printk function to send a char to the uart
2651 +* Inputs:   the character to transmit
2652 +* Outputs:  none
2653 +* Errors:   none
2654 +* Scope:    public
2655 +****************************************************************************/
2656 +
2657 +void SCI_output_char(char c)
2658 +{
2659 +//  ( minor device number, pointer to the character, length )
2660 +
2661 +    SciPolledWrite( SCI_MINOR, &c, 1);
2662 +
2663 +    return;
2664 +}
2665 +\f
2666 +
2667 +/****************************************************************************
2668 +* Func:     SciGetTermiosHandlers
2669 +* Desc:     returns a pointer to the table of serial io functions
2670 +*           this is called from console_open with polled set to false
2671 +* Inputs:   flag indicating whether we want polled or interrupt driven io
2672 +* Outputs:  pointer to function table
2673 +* Errors:   none
2674 +* Scope:    public
2675 +****************************************************************************/
2676 +
2677 +const rtems_termios_callbacks * SciGetTermiosHandlers( int32_t   polled )
2678 +{
2679 +    if ( polled )
2680 +    {
2681 +        return &SciPolledCallbacks;             // polling based
2682 +    }
2683 +    else
2684 +    {
2685 +        return &SciInterruptCallbacks;          // interrupt driven
2686 +    }
2687 +}
2688 +\f
2689 +
2690 +/****************************************************************************
2691 +* Func:     SciIsr
2692 +* Desc:     interrupt handler for serial communications interface
2693 +* Inputs:   vector number - unused
2694 +* Outputs:  none
2695 +* Errors:   none
2696 +* Scope:    public API
2697 +****************************************************************************/
2698 +
2699 +rtems_isr SciIsr( rtems_vector_number vector )
2700 +{
2701 +    uint8_t   ch;
2702 +
2703 +    if ( (*SCSR) & SCI_ERROR_PARITY  )   SciErrorsParity  ++;
2704 +    if ( (*SCSR) & SCI_ERROR_FRAMING )   SciErrorsFraming ++;
2705 +    if ( (*SCSR) & SCI_ERROR_NOISE   )   SciErrorsNoise   ++;
2706 +    if ( (*SCSR) & SCI_ERROR_OVERRUN )   SciErrorsOverrun ++;
2707 +
2708 +    // see if it was a transmit interrupt
2709 +
2710 +    if ( (*SCSR) & SCI_XMTR_AVAILABLE )         // data reg empty, xmt complete
2711 +    {
2712 +        SciDisableTransmitInterrupts();
2713 +
2714 +        // tell termios module that the charcter was sent
2715 +        // he will call us later to transmit more if there are any
2716 +
2717 +        if (rtems_termios_dequeue_characters( SciTermioTty, 1 ))
2718 +        {
2719 +            // there are more bytes to transmit so enable TX interrupt
2720 +
2721 +            SciEnableTransmitInterrupts();
2722 +        }
2723 +    }
2724 +
2725 +    // see if it was a receive interrupt
2726 +    // on the sci uart we just get one character per interrupt
2727 +
2728 +    while (  SciCharAvailable() )               // char in data register?
2729 +    {
2730 +        ch = SciReadCharNoWait();               // get the char from the uart
2731 +
2732 +        // IMPORTANT!!!
2733 +        // either send it to the termios module or keep it locally
2734 +
2735 +        if ( SciOpened == DRIVER_OPENED )       // the driver is open
2736 +        {
2737 +            SciRcvBufPutChar(ch);               // keep it locally
2738 +        }
2739 +        else                                    // put in termios buffer
2740 +        {
2741 +            rtems_termios_enqueue_raw_characters( SciTermioTty, &ch, 1 );
2742 +        }
2743 +
2744 +        *SCSR &= SCI_CLEAR_RX_INT;              // clear the interrupt
2745 +    }
2746 +}
2747 +\f
2748 +
2749 +/////////////////////////////////////////////////////////////////////////////
2750 +//
2751 +//                              SECTION 1
2752 +//                ROUTINES TO MANIPULATE THE CIRCULAR BUFFER
2753 +//
2754 +/////////////////////////////////////////////////////////////////////////////
2755 +
2756 +/****************************************************************************
2757 +* Func:     SciRcvBufGetChar
2758 +* Desc:     read a character from the circular buffer
2759 +*           make sure there is data before you call this!
2760 +* Inputs:   none
2761 +* Outputs:  the character or -1
2762 +* Errors:   none
2763 +* Scope:    private
2764 +****************************************************************************/
2765 +
2766 +static int8_t   SciRcvBufGetChar()
2767 +{
2768 +    rtems_interrupt_level level;
2769 +    uint8_t   ch;
2770 +
2771 +    if ( SciRcvBufCount == 0 )
2772 +    {
2773 +        rtems_fatal_error_occurred(0xDEAD);     // check the count first!
2774 +    }
2775 +
2776 +    rtems_interrupt_disable( level );           // disable interrupts
2777 +
2778 +    ch = SciRcvBuffer[SciRcvBufGetIndex];       // get next byte
2779 +
2780 +    SciRcvBufGetIndex++;                        // bump the index
2781 +
2782 +    SciRcvBufGetIndex &= SCI_RCV_BUF_SIZE - 1;  // and wrap it
2783 +
2784 +    SciRcvBufCount--;                           // decrement counter
2785 +
2786 +    rtems_interrupt_enable( level );            // restore interrupts
2787 +
2788 +    return ch;                                  // return the char
2789 +}
2790 +\f
2791 +
2792 +/****************************************************************************
2793 +* Func:     SciRcvBufPutChar
2794 +* Desc:     put a character into the rcv data circular buffer
2795 +* Inputs:   the character
2796 +* Outputs:  none
2797 +* Errors:   none
2798 +* Scope:    private
2799 +****************************************************************************/
2800 +
2801 +static void SciRcvBufPutChar( uint8_t   ch )
2802 +{
2803 +    rtems_interrupt_level level;
2804 +
2805 +    if ( SciRcvBufCount == SCI_RCV_BUF_SIZE )   // is there room?
2806 +    {
2807 +        return;                                 // no, throw it away
2808 +    }
2809 +
2810 +    rtems_interrupt_disable( level );           // disable interrupts
2811 +
2812 +    SciRcvBuffer[SciRcvBufPutIndex] = ch;       // put it in the buf
2813 +
2814 +    SciRcvBufPutIndex++;                        // bump the index
2815 +
2816 +    SciRcvBufPutIndex &= SCI_RCV_BUF_SIZE - 1;  // and wrap it
2817 +
2818 +    SciRcvBufCount++;                           // increment counter
2819 +
2820 +    rtems_interrupt_enable( level );            // restore interrupts
2821 +
2822 +    return;                                     // return
2823 +}
2824 +\f
2825 +
2826 +/****************************************************************************
2827 +* Func:     SciRcvBufFlush
2828 +* Desc:     completely reset and clear the rcv buffer
2829 +* Inputs:   none
2830 +* Outputs:  none
2831 +* Errors:   none
2832 +* Scope:    private
2833 +****************************************************************************/
2834 +
2835 +#if 0                                           // prevents compiler warning
2836 +static void SciRcvBufFlush( void )
2837 +{
2838 +    rtems_interrupt_level level;
2839 +
2840 +    rtems_interrupt_disable( level );           // disable interrupts
2841 +
2842 +    memset( SciRcvBuffer, 0, sizeof(SciRcvBuffer) );
2843 +
2844 +    SciRcvBufPutIndex = 0;                      // clear
2845 +
2846 +    SciRcvBufGetIndex = 0;                      // clear
2847 +
2848 +    SciRcvBufCount = 0;                         // clear
2849 +
2850 +    rtems_interrupt_enable( level );            // restore interrupts
2851 +
2852 +    return;                                     // return
2853 +}
2854 +#endif
2855 +\f
2856 +
2857 +/////////////////////////////////////////////////////////////////////////////
2858 +//
2859 +//                              SECTION 2
2860 +//            INTERRUPT BASED ENTRY POINTS FOR THE TERMIOS MODULE
2861 +//
2862 +/////////////////////////////////////////////////////////////////////////////
2863 +
2864 +/****************************************************************************
2865 +* Func:     SciInterruptOpen
2866 +* Desc:     open routine for the interrupt based device driver
2867 +*           Default state is 9600 baud, 8 bits, No parity, and 1 stop bit. ??
2868 +**CHANGED** Default baud rate is now 19200, 8N1
2869 +*           called from rtems_termios_open which is called from console_open
2870 +* Inputs:   major - device number
2871 +*           minor - device number
2872 +*           args - points to terminal info
2873 +* Outputs:  success/fail
2874 +* Errors:   none
2875 +* Scope:    public API
2876 +****************************************************************************/
2877 +
2878 +int32_t   SciInterruptOpen(
2879 +    int32_t    major,
2880 +    int32_t    minor,
2881 +    void     *arg
2882 +)
2883 +{
2884 +    rtems_libio_open_close_args_t * args = arg;
2885 +    rtems_isr_entry old_vector;
2886 +
2887 +    if ( minor != SCI_MINOR )                   // check minor device num
2888 +    {
2889 +        return -1;
2890 +    }
2891 +
2892 +    if ( !args )                                // must have args
2893 +    {
2894 +        return -1;
2895 +    }
2896 +
2897 +    SciTermioTty = args->iop->data1;            // save address of struct
2898 +
2899 +    SciDisableAllInterrupts();                  // turn off sci interrupts
2900 +
2901 +    // THIS IS ACTUALLY A BAD THING - SETTING LINE PARAMETERS HERE
2902 +    // IT SHOULD BE DONE THROUGH TCSETATTR() WHEN THE CONSOLE IS OPENED!!!
2903 +
2904 +//  SciSetBaud(115200);                         // set the baud rate
2905 +//  SciSetBaud( 57600);                         // set the baud rate
2906 +//  SciSetBaud( 38400);                         // set the baud rate
2907 +SciSetBaud( 19200);                         // set the baud rate
2908 +//    SciSetBaud(  9600);                         // set the baud rate
2909 +
2910 +    SciSetParity(SCI_PARITY_NONE);              // set parity to none
2911 +
2912 +    SciSetDataBits(SCI_8_DATA_BITS);            // set data bits to 8
2913 +
2914 +    // Install our interrupt handler into RTEMS, where does 66 come from?
2915 +
2916 +    rtems_interrupt_catch( SciIsr, 66, &old_vector );
2917 +
2918 +    *QIVR  = 66;
2919 +    *QIVR &= 0xf8;
2920 +    *QILR |= 0x06 & 0x07;
2921 +
2922 +    SciEnableTransmitter();                     // enable the transmitter
2923 +
2924 +    SciEnableReceiver();                        // enable the receiver
2925 +
2926 +    SciEnableReceiveInterrupts();               // enable rcv interrupts
2927 +
2928 +    return RTEMS_SUCCESSFUL;
2929 +}
2930 +\f
2931 +
2932 +/****************************************************************************
2933 +* Func:     SciInterruptClose
2934 +* Desc:     close routine called by the termios module
2935 +* Inputs:   major - device number
2936 +*           minor - device number
2937 +*           args - unused
2938 +* Outputs:  success/fail
2939 +* Errors:   none
2940 +* Scope:    public - termio entry point
2941 +****************************************************************************/
2942 +
2943 +int32_t   SciInterruptClose(
2944 +    int32_t    major,
2945 +    int32_t    minor,
2946 +    void     *arg
2947 +)
2948 +{
2949 +    SciDisableAllInterrupts();
2950 +
2951 +    return RTEMS_SUCCESSFUL;
2952 +}
2953 +\f
2954 +
2955 +/****************************************************************************
2956 +* Func:     SciInterruptWrite
2957 +* Desc:     writes data to the uart using transmit interrupts
2958 +* Inputs:   minor - device number
2959 +*           buf - points to the data
2960 +*           len - number of bytes to send
2961 +* Outputs:  success/fail
2962 +* Errors:   none
2963 +* Scope:    public API
2964 +****************************************************************************/
2965 +
2966 +int32_t   SciInterruptWrite(
2967 +    int32_t      minor,
2968 +    const char *buf,
2969 +    int32_t      len
2970 +)
2971 +{
2972 +    // We are using interrupt driven output so termios only sends us
2973 +    // one character at a time. The sci does not have a fifo.
2974 +
2975 +    if ( !len )                                 // no data?
2976 +    {
2977 +        return 0;                               // return error
2978 +    }
2979 +
2980 +    if ( minor != SCI_MINOR )                   // check the minor dev num
2981 +    {
2982 +        return 0;                               // return error
2983 +    }
2984 +
2985 +    if ( SciOpened == DRIVER_OPENED )           // is the driver api open?
2986 +    {
2987 +        return 1;                               // yep, throw this away
2988 +    }
2989 +
2990 +    SciWriteCharNoWait(*buf);                   // try to send a char
2991 +
2992 +    *SCSR &= SCI_CLEAR_TDRE;                    // clear tx data reg empty flag
2993 +
2994 +    SciEnableTransmitInterrupts();              // enable the tx interrupt
2995 +
2996 +    return 1;                                   // return success
2997 +}
2998 +\f
2999 +
3000 +/****************************************************************************
3001 +* Func:     SciSetAttributes
3002 +* Desc:     setup the uart based on the termios modules requests
3003 +* Inputs:   minor - device number
3004 +*           t - pointer to the termios info struct
3005 +* Outputs:  none
3006 +* Errors:   none
3007 +* Scope:    public API
3008 +****************************************************************************/
3009 +
3010 +int32_t   SciSetAttributes(
3011 +    int32_t   minor,
3012 +    const struct termios *t
3013 +)
3014 +{
3015 +    uint32_t    baud_requested;
3016 +    uint32_t    sci_rate = 0;
3017 +    uint16_t    sci_parity = 0;
3018 +    uint16_t    sci_databits = 0;
3019 +
3020 +    if ( minor != SCI_MINOR )                   // check the minor dev num
3021 +    {
3022 +        return -1;                              // return error
3023 +    }
3024 +
3025 +    // if you look closely you will see this is the only thing we use
3026 +    // set the baud rate
3027 +
3028 +    baud_requested = t->c_cflag & CBAUD;        // baud rate
3029 +
3030 +    if (!baud_requested)
3031 +    {
3032 +//        baud_requested = B9600;                 // default to 9600 baud
3033 +        baud_requested = B19200;                 // default to 19200 baud
3034 +    }
3035 +
3036 +    sci_rate = termios_baud_to_number( baud_requested );
3037 +
3038 +    // parity error detection
3039 +
3040 +    if (t->c_cflag & PARENB)                    // enable parity detection?
3041 +    {
3042 +        if (t->c_cflag & PARODD)
3043 +        {
3044 +            sci_parity = SCI_PARITY_ODD;        // select odd parity
3045 +        }
3046 +        else
3047 +        {
3048 +            sci_parity = SCI_PARITY_EVEN;       // select even parity
3049 +        }
3050 +    }
3051 +    else
3052 +    {
3053 +        sci_parity = SCI_PARITY_NONE;           // no parity, most common
3054 +    }
3055 +
3056 +    //  set the number of data bits, 8 is most common
3057 +
3058 +    if (t->c_cflag & CSIZE)                     // was it specified?
3059 +    {
3060 +        switch (t->c_cflag & CSIZE)
3061 +        {
3062 +            case CS8:   sci_databits = SCI_8_DATA_BITS;   break;
3063 +            default :   sci_databits = SCI_9_DATA_BITS;   break;
3064 +        }
3065 +    }
3066 +    else
3067 +    {
3068 +        sci_databits = SCI_8_DATA_BITS;         // default to 8 data bits
3069 +    }
3070 +
3071 +    //  the number of stop bits; always 1 for SCI
3072 +
3073 +    if (t->c_cflag & CSTOPB)
3074 +    {
3075 +        // do nothing
3076 +    }
3077 +
3078 +    // setup the hardware with these serial port parameters
3079 +
3080 +    SciSetBaud(sci_rate);                       // set the baud rate
3081 +
3082 +    SciSetParity(sci_parity);                   // set the parity type
3083 +
3084 +    SciSetDataBits(sci_databits);               // set the data bits
3085 +
3086 +    return RTEMS_SUCCESSFUL;
3087 +}
3088 +\f
3089 +
3090 +/////////////////////////////////////////////////////////////////////////////
3091 +//
3092 +//                              SECTION 3
3093 +//            POLLING BASED ENTRY POINTS FOR THE TERMIOS MODULE
3094 +//
3095 +/////////////////////////////////////////////////////////////////////////////
3096 +
3097 +/****************************************************************************
3098 +* Func:     SciPolledOpen
3099 +* Desc:     open routine for the polled i/o version of the driver
3100 +*           called from rtems_termios_open which is called from console_open
3101 +* Inputs:   major - device number
3102 +*           minor - device number
3103 +*           args - points to terminal info struct
3104 +* Outputs:  success/fail
3105 +* Errors:   none
3106 +* Scope:    public - termios entry point
3107 +****************************************************************************/
3108 +
3109 +int32_t   SciPolledOpen(
3110 +    int32_t   major,
3111 +    int32_t   minor,
3112 +    void    *arg
3113 +)
3114 +{
3115 +    rtems_libio_open_close_args_t * args = arg;
3116 +
3117 +    if ( minor != SCI_MINOR )                   // check minor device num
3118 +    {
3119 +        return -1;
3120 +    }
3121 +
3122 +    if ( !args )                                // must have args
3123 +    {
3124 +        return -1;
3125 +    }
3126 +
3127 +    SciTermioTty = args->iop->data1;            // Store tty pointer
3128 +
3129 +    SciDisableAllInterrupts();                  // don't generate interrupts
3130 +
3131 +    // THIS IS ACTUALLY A BAD THING - SETTING LINE PARAMETERS HERE
3132 +    // IT SHOULD BE DONE THROUGH TCSETATTR() WHEN THE CONSOLE IS OPENED!!!
3133 +
3134 +//  SciSetBaud(115200);                         // set the baud rate
3135 +//  SciSetBaud( 57600);                         // set the baud rate
3136 +//  SciSetBaud( 38400);                         // set the baud rate
3137 +  SciSetBaud( 19200);                         // set the baud rate
3138 +//  SciSetBaud(  9600);                         // set the baud rate
3139 +
3140 +    SciSetParity(SCI_PARITY_NONE);              // set no parity
3141 +
3142 +    SciSetDataBits(SCI_8_DATA_BITS);            // set 8 data bits
3143 +
3144 +    SciEnableTransmitter();                     // enable the xmitter
3145 +
3146 +    SciEnableReceiver();                        // enable the rcvr
3147 +
3148 +    return RTEMS_SUCCESSFUL;
3149 +}
3150 +\f
3151 +
3152 +/****************************************************************************
3153 +* Func:     SciPolledClose
3154 +* Desc:     close routine for the device driver, same for both
3155 +* Inputs:   major - device number
3156 +*           minor - device number
3157 +*           args - unused
3158 +* Outputs:  success/fail
3159 +* Errors:   none
3160 +* Scope:    public termios API
3161 +****************************************************************************/
3162 +
3163 +int32_t   SciPolledClose(
3164 +    int32_t    major,
3165 +    int32_t    minor,
3166 +    void     *arg
3167 +)
3168 +{
3169 +    SciDisableAllInterrupts();
3170 +
3171 +    return RTEMS_SUCCESSFUL;
3172 +}
3173 +\f
3174 +
3175 +/****************************************************************************
3176 +* Func:     SciPolledRead
3177 +* Desc:     polling based read routine for the uart
3178 +* Inputs:   minor - device number
3179 +* Outputs:  error or the character read
3180 +* Errors:   none
3181 +* Scope:    public API
3182 +****************************************************************************/
3183 +
3184 +int32_t   SciPolledRead(
3185 +    int32_t   minor
3186 +)
3187 +{
3188 +    if ( minor != SCI_MINOR )               // check the minor dev num
3189 +    {
3190 +        return -1;                          // return error
3191 +    }
3192 +
3193 +    if ( SciCharAvailable() )               // if a char is available
3194 +    {
3195 +        return SciReadCharNoWait();         // read the rx data register
3196 +    }
3197 +
3198 +    return -1;                              // return error
3199 +}
3200 +\f
3201 +
3202 +/****************************************************************************
3203 +* Func:     SciPolledWrite
3204 +* Desc:     writes out characters in polled mode, waiting for the uart
3205 +*           check in console_open, but we only seem to use interrupt mode
3206 +* Inputs:   minor - device number
3207 +*           buf - points to the data
3208 +*           len - how many bytes
3209 +* Outputs:  error or number of bytes written
3210 +* Errors:   none
3211 +* Scope:    public termios API
3212 +****************************************************************************/
3213 +
3214 +int32_t   SciPolledWrite(
3215 +    int32_t        minor,
3216 +    const char   *buf,
3217 +    int32_t        len
3218 +)
3219 +{
3220 +    int32_t   written = 0;
3221 +
3222 +    if ( minor != SCI_MINOR )                   // check minor device num
3223 +    {
3224 +        return -1;
3225 +    }
3226 +
3227 +    if ( SciOpened == DRIVER_OPENED )           // is the driver api open?
3228 +    {
3229 +        return -1;                              // toss the data
3230 +    }
3231 +
3232 +    // send each byte in the string out the port
3233 +
3234 +    while ( written < len )
3235 +    {
3236 +        SciWriteCharWait(*buf++);               // send a byte
3237 +
3238 +        written++;                              // increment counter
3239 +    }
3240 +
3241 +    return written;                             // return count
3242 +}
3243 +\f
3244 +
3245 +/////////////////////////////////////////////////////////////////////////////
3246 +//
3247 +//                              SECTION 4
3248 +//                 DEVICE DRIVER PUBLIC API ENTRY POINTS
3249 +//
3250 +/////////////////////////////////////////////////////////////////////////////
3251 +
3252 +/****************************************************************************
3253 +* Func:     SciInit
3254 +* Desc:     Initialize the lasers device driver and hardware
3255 +* Inputs:   major - the major device number which is assigned by rtems
3256 +*           minor - the minor device number which is undefined at this point
3257 +*           arg - ?????
3258 +* Outputs:  RTEMS_SUCCESSFUL
3259 +* Errors:   None.
3260 +* Scope:    public API
3261 +****************************************************************************/
3262 +
3263 +rtems_device_driver SciInitialize (
3264 +    rtems_device_major_number major,
3265 +    rtems_device_minor_number minor,
3266 +    void * arg
3267 +)
3268 +{
3269 +//     rtems_status_code status;
3270 +
3271 +//printk("%s\r\n", __FUNCTION__);
3272 +
3273 +    // register the SCI device name for termios console i/o
3274 +    // this is done over in console.c which doesn't seem exactly right
3275 +    // but there were problems doing it here...
3276 +
3277 +//  status = rtems_io_register_name( "/dev/sci", major, 0 );
3278 +
3279 +//  if (status != RTEMS_SUCCESSFUL)
3280 +//      rtems_fatal_error_occurred(status);
3281 +
3282 +    SciMajor = major;                           // save the rtems major number
3283 +
3284 +    SciOpened = DRIVER_CLOSED;                  // initial state is closed
3285 +
3286 +    // if you have an interrupt handler, install it here
3287 +
3288 +    SciInited = 1;                              // set the inited flag
3289 +
3290 +    return RTEMS_SUCCESSFUL;
3291 +}
3292 +\f
3293 +
3294 +/****************************************************************************
3295 +* Func:     SciOpen
3296 +* Desc:     device driver open routine
3297 +*           you must open a device before you can anything else
3298 +*           only one process can have the device opened at a time
3299 +*           you could look at the task id to restrict access if you want
3300 +* Inputs:   major - the major device number assigned by rtems
3301 +*           minor - the minor device number assigned by us
3302 +*           arg - ?????
3303 +* Outputs:  see below
3304 +* Errors:   none
3305 +* Scope:    public API
3306 +****************************************************************************/
3307 +
3308 +rtems_device_driver SciOpen (
3309 +    rtems_device_major_number major,
3310 +    rtems_device_minor_number minor,
3311 +    void * arg
3312 +)
3313 +{
3314 +//printk("%s major=%d minor=%d\r\n", __FUNCTION__,major,minor);
3315 +
3316 +    if (SciInited == 0)                         // must be initialized first!
3317 +    {
3318 +        return RTEMS_NOT_CONFIGURED;
3319 +    }
3320 +
3321 +    if (minor != SCI_MINOR)
3322 +    {
3323 +        return RTEMS_INVALID_NAME;              // verify minor number
3324 +    }
3325 +
3326 +    if (SciOpened == DRIVER_OPENED)
3327 +    {
3328 +        return RTEMS_RESOURCE_IN_USE;           // already opened!
3329 +    }
3330 +
3331 +    SciOpened = DRIVER_OPENED;                  // set the opened flag
3332 +
3333 +    return RTEMS_SUCCESSFUL;
3334 +}
3335 +\f
3336 +
3337 +/****************************************************************************
3338 +* Func:     SciClose
3339 +* Desc:     device driver close routine
3340 +*           the device must be opened before you can close it
3341 +*           the device must be closed before someone (else) can open it
3342 +* Inputs:   major - the major device number
3343 +*           minor - the minor device number
3344 +*           arg - ?????
3345 +* Outputs:  see below
3346 +* Errors:   none
3347 +* Scope:    public API
3348 +****************************************************************************/
3349 +
3350 +rtems_device_driver SciClose (
3351 +    rtems_device_major_number major,
3352 +    rtems_device_minor_number minor,
3353 +    void * arg
3354 +)
3355 +{
3356 +//printk("%s major=%d minor=%d\r\n", __FUNCTION__,major,minor);
3357 +
3358 +    if (minor != SCI_MINOR)
3359 +    {
3360 +        return RTEMS_INVALID_NAME;              // check the minor number
3361 +    }
3362 +
3363 +    if (SciOpened != DRIVER_OPENED)
3364 +    {
3365 +        return RTEMS_INCORRECT_STATE;           // must be opened first
3366 +    }
3367 +
3368 +    SciOpened = DRIVER_CLOSED;                  // set the flag
3369 +
3370 +    return RTEMS_SUCCESSFUL;
3371 +}
3372 +\f
3373 +
3374 +/****************************************************************************
3375 +* Func:     SciRead
3376 +* Desc:     device driver read routine
3377 +*           this function is not meaningful for the laser devices
3378 +* Inputs:   major - the major device number
3379 +*           minor - the minor device number
3380 +*           arg - read/write arguments
3381 +* Outputs:  see below
3382 +* Errors:   none
3383 +* Scope:    public API
3384 +****************************************************************************/
3385 +
3386 +rtems_device_driver SciRead (
3387 +    rtems_device_major_number major,
3388 +    rtems_device_minor_number minor,
3389 +    void *arg
3390 +)
3391 +{
3392 +    rtems_libio_rw_args_t *rw_args;             // ptr to argument struct
3393 +    uint8_t   *buffer;
3394 +    uint16_t   length;
3395 +
3396 +    rw_args = (rtems_libio_rw_args_t *) arg;    // arguments to read()
3397 +
3398 +    if (minor != SCI_MINOR)
3399 +    {
3400 +        return RTEMS_INVALID_NAME;              // check the minor number
3401 +    }
3402 +
3403 +    if (SciOpened == DRIVER_CLOSED)
3404 +    {
3405 +        return RTEMS_INCORRECT_STATE;           // must be opened first
3406 +    }
3407 +
3408 +    buffer = rw_args->buffer;                   // points to user's buffer
3409 +
3410 +    length = rw_args->count;                    // how many bytes they want
3411 +
3412 +//  *buffer = SciReadCharWait();                // wait for a character
3413 +
3414 +    // if there isn't a character available, wait until one shows up
3415 +    // or the timeout period expires, which ever happens first
3416 +
3417 +    if ( SciRcvBufCount == 0 )                  // no chars
3418 +    {
3419 +        // wait for someone to wake me up...
3420 +        //rtems_task_wake_after(SciReadTimeout);
3421 +    }
3422 +
3423 +    if ( SciRcvBufCount )                       // any characters locally?
3424 +    {
3425 +        *buffer = SciRcvBufGetChar();           // get the character
3426 +
3427 +        rw_args->bytes_moved = 1;               // how many we actually read
3428 +    }
3429 +
3430 +    return RTEMS_SUCCESSFUL;
3431 +}
3432 +\f
3433 +
3434 +/****************************************************************************
3435 +* Func:     SciWrite
3436 +* Desc:     device driver write routine
3437 +*           this function is not meaningful for the laser devices
3438 +* Inputs:   major - the major device number
3439 +*           minor - the minor device number
3440 +*           arg - read/write arguments
3441 +* Outputs:  see below
3442 +* Errors:   non3
3443 +* Scope:    public API
3444 +****************************************************************************/
3445 +
3446 +rtems_device_driver SciWrite (
3447 +    rtems_device_major_number major,
3448 +    rtems_device_minor_number minor,
3449 +    void * arg
3450 +)
3451 +{
3452 +    rtems_libio_rw_args_t *rw_args;             // ptr to argument struct
3453 +    uint8_t   *buffer;
3454 +    uint16_t   length;
3455 +
3456 +    rw_args = (rtems_libio_rw_args_t *) arg;
3457 +
3458 +    if (minor != SCI_MINOR)
3459 +    {
3460 +        return RTEMS_INVALID_NAME;              // check the minor number
3461 +    }
3462 +
3463 +    if (SciOpened == DRIVER_CLOSED)
3464 +    {
3465 +        return RTEMS_INCORRECT_STATE;           // must be opened first
3466 +    }
3467 +
3468 +    buffer = (uint8_t*)rw_args->buffer;       // points to data
3469 +
3470 +    length = rw_args->count;                    // how many bytes
3471 +
3472 +    while (length--)
3473 +    {
3474 +        SciWriteCharWait(*buffer++);            // send the bytes out
3475 +    }
3476 +
3477 +    rw_args->bytes_moved = rw_args->count;      // how many we wrote
3478 +
3479 +    return RTEMS_SUCCESSFUL;
3480 +}
3481 +\f
3482 +
3483 +/****************************************************************************
3484 +* Func:     SciControl
3485 +* Desc:     device driver control routine
3486 +*           see below for an example of how to use the ioctl interface
3487 +* Inputs:   major - the major device number
3488 +*           minor - the minor device number
3489 +*           arg - io control args
3490 +* Outputs:  see below
3491 +* Errors:   none
3492 +* Scope:    public API
3493 +****************************************************************************/
3494 +
3495 +rtems_device_driver SciControl (
3496 +    rtems_device_major_number major,
3497 +    rtems_device_minor_number minor,
3498 +    void * arg
3499 +)
3500 +{
3501 +    rtems_libio_ioctl_args_t *args = arg;       // rtems arg struct
3502 +    uint16_t   command;                         // the cmd to execute
3503 +    uint16_t   unused;                          // maybe later
3504 +    uint16_t   *ptr;                            // ptr to user data
3505 +
3506 +//printk("%s major=%d minor=%d\r\n", __FUNCTION__,major,minor);
3507 +
3508 +    // do some sanity checking
3509 +
3510 +    if (minor != SCI_MINOR)
3511 +    {
3512 +        return RTEMS_INVALID_NAME;              // check the minor number
3513 +    }
3514 +
3515 +    if (SciOpened == DRIVER_CLOSED)
3516 +    {
3517 +        return RTEMS_INCORRECT_STATE;           // must be open first
3518 +    }
3519 +
3520 +    if (args == 0)
3521 +    {
3522 +        return RTEMS_INVALID_ADDRESS;           // must have args
3523 +    }
3524 +
3525 +    args->ioctl_return = -1;                    // assume an error
3526 +
3527 +    command = args->command;                    // get the command
3528 +    ptr     = args->buffer;                     // this is an address
3529 +    unused  = *ptr;                             // brightness
3530 +
3531 +    if (command == SCI_SEND_BREAK)              // process the command
3532 +    {
3533 +        SciSendBreak();                         // send break char
3534 +    }
3535 +
3536 +    args->ioctl_return = 0;                     // return status
3537 +
3538 +    return RTEMS_SUCCESSFUL;
3539 +}
3540 +\f
3541 +
3542 +/////////////////////////////////////////////////////////////////////////////
3543 +//
3544 +//                              SECTION 5
3545 +//                       HARDWARE LEVEL ROUTINES
3546 +//
3547 +/////////////////////////////////////////////////////////////////////////////
3548 +
3549 +/****************************************************************************
3550 +* Func:     SciSetBaud
3551 +* Desc:     setup the uart based on the termios modules requests
3552 +* Inputs:   baud rate
3553 +* Outputs:  none
3554 +* Errors:   none
3555 +* Scope:    private
3556 +****************************************************************************/
3557 +
3558 +static void SciSetBaud(uint32_t   rate)
3559 +{
3560 +    uint16_t   value;
3561 +    uint16_t   save_sccr1;
3562 +
3563 +// when you open the console you need to set the termio struct baud rate
3564 +// it has a default value of 9600, when someone calls tcsetattr it reverts!
3565 +
3566 +    SciBaud = rate;                             // save the rate
3567 +
3568 +    // calculate the register value as a float and convert to an int
3569 +    // set baud rate - you must define the system clock constant
3570 +    // see mrm332.h for an example
3571 +
3572 +    value = ( (uint16_t) ( SYS_CLOCK / rate / 32.0 + 0.5 ) & 0x1fff );
3573 +
3574 +    save_sccr1 = *SCCR1;                        // save register
3575 +
3576 +    // also turns off the xmtr and rcvr
3577 +
3578 +    *SCCR1 &= SCI_DISABLE_INT_ALL;              // disable interrupts
3579 +
3580 +    *SCCR0 = value;                             // write the register
3581 +
3582 +    *SCCR1 = save_sccr1;                        // restore register
3583 +
3584 +    return;
3585 +}
3586 +\f
3587 +
3588 +/****************************************************************************
3589 +* Func:     SciSetParity
3590 +* Desc:     setup the uart based on the termios modules requests
3591 +* Inputs:   parity
3592 +* Outputs:  none
3593 +* Errors:   none
3594 +* Scope:    private
3595 +****************************************************************************/
3596 +
3597 +static void SciSetParity(uint16_t   parity)
3598 +{
3599 +    uint16_t   value;
3600 +
3601 +    value = *SCCR1;                             // get the register
3602 +
3603 +    if (parity == SCI_PARITY_ODD)
3604 +    {
3605 +        value |= SCI_PARITY_ENABLE;             // parity enabled
3606 +        value |= SCI_PARITY_ODD;                // parity odd
3607 +    }
3608 +
3609 +    else if (parity == SCI_PARITY_EVEN)
3610 +    {
3611 +        value |= SCI_PARITY_ENABLE;             // parity enabled
3612 +        value &= ~SCI_PARITY_ODD;               // parity even
3613 +    }
3614 +
3615 +    else if (parity == SCI_PARITY_NONE)
3616 +    {
3617 +        value &= ~SCI_PARITY_ENABLE;            // disabled, most common
3618 +    }
3619 +
3620 +    /* else no changes */
3621 +
3622 +    *SCCR1 = value;                             // write the register
3623 +
3624 +    return;
3625 +}
3626 +\f
3627 +
3628 +/****************************************************************************
3629 +* Func:     SciSetDataBits
3630 +* Desc:     setup the uart based on the termios modules requests
3631 +* Inputs:   data bits
3632 +* Outputs:  none
3633 +* Errors:   none
3634 +* Scope:    private
3635 +****************************************************************************/
3636 +
3637 +static void SciSetDataBits(uint16_t   bits)
3638 +{
3639 +    uint16_t   value;
3640 +
3641 +    value = *SCCR1;                             // get the register
3642 +
3643 +    /* note - the parity setting affects the number of data bits */
3644 +
3645 +    if (bits == SCI_9_DATA_BITS)
3646 +    {
3647 +        value |= SCI_9_DATA_BITS;               // 9 data bits
3648 +    }
3649 +
3650 +    else if (bits == SCI_8_DATA_BITS)
3651 +    {
3652 +        value &= SCI_8_DATA_BITS;               // 8 data bits
3653 +    }
3654 +
3655 +    /* else no changes */
3656 +
3657 +    *SCCR1 = value;                             // write the register
3658 +
3659 +    return;
3660 +}
3661 +\f
3662 +
3663 +/****************************************************************************
3664 +* Func:     SciDisableAllInterrupts
3665 +* Func:     SciEnableTransmitInterrupts
3666 +* Func:     SciEnableReceiveInterrupts
3667 +* Desc:     handles generation of interrupts by the sci module
3668 +* Inputs:   none
3669 +* Outputs:  none
3670 +* Errors:   none
3671 +* Scope:    private
3672 +****************************************************************************/
3673 +
3674 +static void inline SciDisableAllInterrupts( void )
3675 +{
3676 +    // this also turns off the xmtr and rcvr
3677 +
3678 +    *SCCR1 &= SCI_DISABLE_INT_ALL;
3679 +}
3680 +
3681 +static void inline SciEnableReceiveInterrupts( void )
3682 +{
3683 +    *SCCR1 |= SCI_ENABLE_INT_RX;
3684 +}
3685 +
3686 +static void inline SciDisableReceiveInterrupts( void )
3687 +{
3688 +    *SCCR1 &= SCI_DISABLE_INT_RX;
3689 +}
3690 +
3691 +static void inline SciEnableTransmitInterrupts( void )
3692 +{
3693 +    *SCCR1 |= SCI_ENABLE_INT_TX;
3694 +}
3695 +
3696 +static void inline SciDisableTransmitInterrupts( void )
3697 +{
3698 +    *SCCR1 &= SCI_DISABLE_INT_TX;
3699 +}
3700 +\f
3701 +
3702 +/****************************************************************************
3703 +* Func:     SciEnableTransmitter, SciDisableTransmitter
3704 +* Func:     SciEnableReceiver,    SciDisableReceiver
3705 +* Desc:     turns the transmitter and receiver on and off
3706 +* Inputs:   none
3707 +* Outputs:  none
3708 +* Errors:   none
3709 +* Scope:    private
3710 +****************************************************************************/
3711 +
3712 +static void inline SciEnableTransmitter( void )
3713 +{
3714 +    *SCCR1 |= SCI_ENABLE_XMTR;
3715 +}
3716 +
3717 +static void inline SciDisableTransmitter( void )
3718 +{
3719 +    *SCCR1 &= SCI_DISABLE_XMTR;
3720 +}
3721 +
3722 +static void inline SciEnableReceiver( void )
3723 +{
3724 +    *SCCR1 |= SCI_ENABLE_RCVR;
3725 +}
3726 +
3727 +static void inline SciDisableReceiver( void )
3728 +{
3729 +    *SCCR1 &= SCI_DISABLE_RCVR;
3730 +}
3731 +\f
3732 +
3733 +/****************************************************************************
3734 +* Func:     SciWriteCharWait
3735 +* Desc:     wait for room in the fifo and then put a char in
3736 +* Inputs:   a byte to send
3737 +* Outputs:  none
3738 +* Errors:   none
3739 +* Scope:    public
3740 +****************************************************************************/
3741 +
3742 +void SciWriteCharWait(uint8_t   c)
3743 +{
3744 +    // poll the fifo, waiting for room for another character
3745 +
3746 +    while ( ( *SCSR & SCI_XMTR_AVAILABLE ) == 0 )
3747 +    {
3748 +        /* Either we are writing to the fifo faster than
3749 +         * the uart can clock bytes out onto the cable,
3750 +         * or we are in flow control (actually no, we
3751 +         * are ignoring flow control from the other end).
3752 +         * In the first case, higher baud rates will help.
3753 +         */
3754 +      /* relinquish processor while waiting */
3755 +      rtems_task_wake_after(RTEMS_YIELD_PROCESSOR);
3756 +    }
3757 +
3758 +    *SCDR = c;                                  // send the charcter
3759 +
3760 +    SciBytesOut++;                              // increment the counter
3761 +
3762 +    return;
3763 +}
3764 +
3765 +/****************************************************************************
3766 +* Func:     SciWriteCharNoWait
3767 +* Desc:     if no room in the fifo throw the char on the floor
3768 +* Inputs:   a byte to send
3769 +* Outputs:  none
3770 +* Errors:   none
3771 +* Scope:    public
3772 +****************************************************************************/
3773 +
3774 +void SciWriteCharNoWait(uint8_t   c)
3775 +{
3776 +    if ( ( *SCSR & SCI_XMTR_AVAILABLE ) == 0 )
3777 +    {
3778 +        return;                                 // no room, throw it away
3779 +    }
3780 +
3781 +    *SCDR = c;                                  // put the char in the fifo
3782 +
3783 +    SciBytesOut++;                              // increment the counter
3784 +
3785 +    return;
3786 +}
3787 +\f
3788 +
3789 +/****************************************************************************
3790 +* Func:     SciReadCharWait
3791 +* Desc:     read a character, waiting for one to show up, if need be
3792 +* Inputs:   none
3793 +* Outputs:  a character
3794 +* Errors:   none
3795 +* Scope:    public
3796 +****************************************************************************/
3797 +
3798 +uint8_t   inline SciReadCharWait( void )
3799 +{
3800 +    uint8_t   ch;
3801 +
3802 +    while ( SciCharAvailable() == 0 )           // anything there?
3803 +    {
3804 +      /* relinquish processor while waiting */
3805 +      rtems_task_wake_after(RTEMS_YIELD_PROCESSOR);
3806 +    }
3807 +
3808 +    // if you have rcv ints enabled, then the isr will probably
3809 +    // get the character before you will unless you turn off ints
3810 +    // ie polling and ints don't mix that well
3811 +
3812 +    ch = *SCDR;                                 // get the charcter
3813 +
3814 +    SciBytesIn++;                               // increment the counter
3815 +
3816 +    return ch;                                  // return the char
3817 +}
3818 +
3819 +/****************************************************************************
3820 +* Func:     SciReadCharNoWait
3821 +* Desc:     try to get a char but dont wait for one
3822 +* Inputs:   none
3823 +* Outputs:  a character or -1 if none
3824 +* Errors:   none
3825 +* Scope:    public
3826 +****************************************************************************/
3827 +
3828 +uint8_t   inline SciReadCharNoWait( void )
3829 +{
3830 +    uint8_t   ch;
3831 +
3832 +    if ( SciCharAvailable() == 0 )              // anything there?
3833 +        return -1;
3834 +
3835 +    ch = *SCDR;                                 // get the character
3836 +
3837 +    SciBytesIn++;                               // increment the count
3838 +
3839 +    return ch;                                  // return the char
3840 +}
3841 +\f
3842 +
3843 +/****************************************************************************
3844 +* Func:     SciCharAvailable
3845 +* Desc:     is there a receive character in the data register
3846 +* Inputs:   none
3847 +* Outputs:  false if no char available, else true
3848 +* Errors:   none
3849 +* Scope:    public
3850 +****************************************************************************/
3851 +
3852 +uint8_t   inline SciCharAvailable( void )
3853 +{
3854 +    return ( *SCSR & SCI_RCVR_READY );          // char in data register?
3855 +}
3856 +\f
3857 +
3858 +/****************************************************************************
3859 +* Func:     SciSendBreak
3860 +* Desc:     send 1 or tow breaks (all zero bits)
3861 +* Inputs:   none
3862 +* Outputs:  none
3863 +* Errors:   none
3864 +* Scope:    public
3865 +****************************************************************************/
3866 +
3867 +void SciSendBreak( void )
3868 +{
3869 +    // From the Motorola QSM reference manual -
3870 +
3871 +    // "if SBK is toggled by writing it first to a one and then immediately
3872 +    // to a zero (in less than one serial frame interval), the transmitter
3873 +    // sends only one or two break frames before reverting to mark (idle)
3874 +    // or before commencing to send more data"
3875 +
3876 +    *SCCR1 |=  SCI_SEND_BREAK;                  // set the bit
3877 +
3878 +    *SCCR1 &= ~SCI_SEND_BREAK;                  // clear the bit
3879 +
3880 +    return;
3881 +}
3882 +\f
3883 +
3884 +/////////////////////////////////////////////////////////////////////////////
3885 +//
3886 +//                             SECTION 6
3887 +//                             TEST CODE
3888 +//
3889 +/////////////////////////////////////////////////////////////////////////////
3890 +
3891 +/****************************************************************************
3892 +* Func:     SciUnitTest
3893 +* Desc:     test the device driver
3894 +* Inputs:   nothing
3895 +* Outputs:  nothing
3896 +* Scope:    public
3897 +****************************************************************************/
3898 +
3899 +#if 0
3900 +#define O_RDWR LIBIO_FLAGS_READ_WRITE           // dont like this but...
3901 +
3902 +void SciUnitTest()
3903 +{
3904 +    uint8_t   byte;                             // a character
3905 +    uint16_t   fd;                              // file descriptor for device
3906 +    uint16_t   result;                          // result of ioctl
3907 +
3908 +    fd = open("/dev/sci",O_RDWR);               // open the device
3909 +
3910 +printk("SCI open fd=%d\r\n",fd);
3911 +
3912 +    result = write(fd, "abcd\r\n", 6);          // send a string
3913 +
3914 +printk("SCI write result=%d\r\n",result);
3915 +
3916 +    result = read(fd, &byte, 1);                // read a byte
3917 +
3918 +printk("SCI read result=%d,byte=%x\r\n",result,byte);
3919 +
3920 +    return;
3921 +}
3922 +#endif
3923 +\f
3924 +
3925 +/****************************************************************************
3926 +* Func:     SciPrintStats
3927 +* Desc:     print out some driver information
3928 +* Inputs:   nothing
3929 +* Outputs:  nothing
3930 +* Scope:    public
3931 +****************************************************************************/
3932 +
3933 +void SciPrintStats ( void )
3934 +{
3935 +    printk("\r\n");
3936 +
3937 +    printk( "SYS_CLOCK is %2.6f Mhz\r\n\n", SYS_CLOCK / 1000000.0 );
3938 +
3939 +    printk( "Current baud rate is %d bps or %d cps\r\n\n", SciBaud, SciBaud / 10 );
3940 +
3941 +    printk( "SCI Uart chars in       %8d\r\n", SciBytesIn       );
3942 +    printk( "SCI Uart chars out      %8d\r\n", SciBytesOut      );
3943 +    printk( "SCI Uart framing errors %8d\r\n", SciErrorsFraming );
3944 +    printk( "SCI Uart parity  errors %8d\r\n", SciErrorsParity  );
3945 +    printk( "SCI Uart overrun errors %8d\r\n", SciErrorsOverrun );
3946 +    printk( "SCI Uart noise   errors %8d\r\n", SciErrorsNoise   );
3947 +
3948 +    return;
3949 +}
3950 Index: rtems-051009/c/src/lib/libbsp/m68k/mo376/startup/bspstart.c
3951 ===================================================================
3952 --- /dev/null
3953 +++ rtems/c/src/lib/libbsp/m68k/mo376/startup/bspstart.c
3954 @@ -0,0 +1,82 @@
3955 +/*
3956 + *  This routine starts the application.  It includes application,
3957 + *  board, and monitor specific initialization and configuration.
3958 + *  The generic CPU dependent initialization has been performed
3959 + *  before this routine is invoked.
3960 + *
3961 + *  COPYRIGHT (c) 1989-1999.
3962 + *  On-Line Applications Research Corporation (OAR).
3963 + *
3964 + *  The license and distribution terms for this file may be
3965 + *  found in the file LICENSE in this distribution or at
3966 + *  http://www.rtems.com/license/LICENSE.
3967 + *
3968 + *  $Id: bspstart.c,v 1.7 2004/04/21 10:42:52 ralf Exp $
3969 + */
3970 +
3971 +#include <bsp.h>
3972 +#include <rtems/libio.h>
3973 +
3974 +#include <string.h>
3975 +
3976 +/*
3977 + *  The original table from the application and our copy of it with
3978 + *  some changes.
3979 + */
3980 +
3981 +extern rtems_configuration_table  Configuration;
3982 +rtems_configuration_table         BSP_Configuration;
3983 +
3984 +rtems_cpu_table Cpu_table;
3985 +
3986 +char *rtems_progname;
3987 +
3988 +/*
3989 + *  Use the shared implementations of the following routines
3990 + */
3991 +
3992 +void bsp_postdriver_hook(void);
3993 +void bsp_libc_init( void *, uint32_t, int );
3994 +void bsp_pretasking_hook(void);               /* m68k version */
3995 +
3996 +/*
3997 + *  Call Spurious_Initialize in bsp_predriver_hook because
3998 + *  bsp_predriver_hook is call after the _ISR_Vector_Table allocation
3999 + */
4000 +
4001 +void bsp_predriver_hook(void)
4002 +{
4003 +  void Spurious_Initialize();
4004 +  Spurious_Initialize();
4005 +}
4006 +
4007 +/*
4008 + *  bsp_start
4009 + *
4010 + *  This routine does the bulk of the system initialization.
4011 + */
4012 +
4013 +void bsp_start( void )
4014 +{
4015 +  void           *vbr;
4016 +  extern void    *_WorkspaceBase;
4017 +  extern void    *_RamSize;
4018 +  extern unsigned long _M68k_Ramsize;
4019 +
4020 +  _M68k_Ramsize = (unsigned long)&_RamSize;            /* RAM size set in linker script */
4021 +
4022 +  /*
4023 +   *  we only use a hook to get the C library initialized.
4024 +   */
4025 +
4026 +  Cpu_table.pretasking_hook = bsp_pretasking_hook;
4027 +  Cpu_table.predriver_hook  = bsp_predriver_hook;
4028 +  Cpu_table.postdriver_hook = bsp_postdriver_hook;
4029 +
4030 +  m68k_get_vbr( vbr );
4031 +  Cpu_table.interrupt_vector_table = vbr;
4032 +
4033 +  BSP_Configuration.work_space_start = (void *) &_WorkspaceBase;
4034 +
4035 +  /* Clock_exit is done as an atexit() function */
4036 +}
4037 Index: rtems-051009/c/src/lib/libbsp/m68k/mo376/startup/start_c.c
4038 ===================================================================
4039 --- /dev/null
4040 +++ rtems/c/src/lib/libbsp/m68k/mo376/startup/start_c.c
4041 @@ -0,0 +1,125 @@
4042 +/*
4043 + *  $Id
4044 + */
4045 +
4046 +#include <mrm332.h>
4047 +#include <rtems/m68k/sim.h>
4048 +#define __START_C__
4049 +#include "bsp.h"
4050 +
4051 +m68k_isr_entry M68Kvec[256];
4052 +m68k_isr_entry vectors[256];
4053 +char * const __argv[]= {"main", ""};
4054 +
4055 +void  boot_card(int argc, char * const argv[]);
4056 +
4057 +/*
4058 + *  This prototype really should have the noreturn attribute but
4059 + *  that causes a warning. Not sure how to fix that.
4060 + */
4061 +/* void dumby_start ()  __attribute__ ((noreturn)); */
4062 +void start_c ();
4063 +
4064 +void  start_c() {
4065 +
4066 +  /* Synthesizer Control Register */
4067 +  /*    see section(s) 4.8 */
4068 +  /* end include in ram_init.S */
4069 +  *SYNCR = (unsigned short int)
4070 +    ( SAM(MRM_W,15,VCO) | SAM(0x0,14,PRESCALE) | SAM(MRM_Y,8,COUNTER) );
4071 +  while (! (*SYNCR & SLOCK));  /* protect from clock overshoot */
4072 +  /* include in ram_init.S */
4073 +  *SYNCR = (unsigned short int)
4074 +    ( SAM(MRM_W,15,VCO) | SAM(MRM_X,14,PRESCALE) | SAM(MRM_Y,8,COUNTER) );
4075 +
4076 +  /* System Protection Control Register */
4077 +  /*    !!! can only write to once after reset !!! */
4078 +  /*    see section 3.8.4 of the SIM Reference Manual */
4079 +  *SYPCR = (unsigned char)( HME | BME );
4080 +
4081 +  /* Periodic Interrupr Control Register */
4082 +  /*    see section 3.8.2 of the SIM Reference Manual */
4083 +  *PICR = (unsigned short int)
4084 +    ( SAM(0,8,PIRQL) | SAM(MRM_PIV,0,PIV) );
4085 +  /*     ^^^ zero disables interrupt, don't enable here or ram_init will
4086 +        be wrong. It's enabled below. */
4087 +
4088 +  /* Periodic Interrupt Timer Register */
4089 +  /*    see section 3.8.3 of the SIM Reference Manual */
4090 +  *PITR = (unsigned short int)( SAM(0x09,0,PITM) );
4091 +  /*    1.098mS interrupt, assuming 32.768 KHz input clock */
4092 +
4093 +  /* Port C Data */
4094 +  /*    load values before enabled */
4095 +  *PORTC = (unsigned char) 0x0;
4096 +
4097 +  /* Port E and F Data Register */
4098 +  /*    see section 9 of the SIM Reference Manual */
4099 +  *PORTE0 = (unsigned char) 0;
4100 +  *PORTF0 = (unsigned char) 0;
4101 +
4102 +  /* Port E and F Data Direction Register */
4103 +  /*    see section 9 of the SIM Reference Manual */
4104 +  *DDRE = (unsigned char) 0xff;
4105 +  *DDRF = (unsigned char) 0xfd;
4106 +
4107 +  /* Port E and F Pin Assignment Register */
4108 +  /*    see section 9 of the SIM Reference Manual */
4109 +  *PEPAR = (unsigned char) 0;
4110 +  *PFPAR = (unsigned char) 0;
4111 +
4112 +  /* end of SIM initalization code */
4113 +  /* end include in ram_init.S */
4114 +
4115 +  /*
4116 +   * Initialize RAM by copying the .data section out of ROM (if
4117 +   * needed) and "zero-ing" the .bss section.
4118 +   */
4119 +  {
4120 +    register char *src = _etext;
4121 +    register char *dst = _copy_start;
4122 +
4123 +    if (_copy_data_from_rom)
4124 +      /* ROM has data at end of text; copy it. */
4125 +      while (dst < _edata)
4126 +       *dst++ = *src++;
4127 +
4128 +    /* Zero bss */
4129 +    for (dst = _clear_start; dst< end; dst++)
4130 +      {
4131 +       *dst = 0;
4132 +      }
4133 +  }
4134 +
4135 +  /*
4136 +   * Initialize vector table.
4137 +   */
4138 +  {
4139 +    m68k_isr_entry *monitors_vector_table;
4140 +
4141 +    m68k_get_vbr(monitors_vector_table);
4142 +
4143 +    M68Kvec[  4 ] = monitors_vector_table[  4 ];   /* breakpoints vector */
4144 +    M68Kvec[  9 ] = monitors_vector_table[  9 ];   /* trace vector */
4145 +    M68Kvec[ 31 ] = monitors_vector_table[ 31 ];   /* level 7 interrupt */
4146 +    M68Kvec[ 47 ] = monitors_vector_table[ 47 ];   /* system call vector */
4147 +    M68Kvec[ 66 ] = monitors_vector_table[ 66 ];   /* user defined */
4148 +
4149 +    m68k_set_vbr(&M68Kvec);
4150 +  }
4151 +
4152 +  /*
4153 +   * Initalize the board.
4154 +   */
4155 +
4156 +  /* Spurious should be called in the predriver hook */
4157 +  /* Spurious_Initialize(); */
4158 +  //console_init();
4159 +
4160 +  /*
4161 +   * Execute main with arguments argc and agrv.
4162 +   */
4163 +  boot_card(1,__argv);
4164 +  reboot();
4165 +
4166 +}
4167 Index: rtems-051009/c/src/lib/libbsp/m68k/mo376/include/tm27.h
4168 ===================================================================
4169 --- /dev/null
4170 +++ rtems/c/src/lib/libbsp/m68k/mo376/include/tm27.h
4171 @@ -0,0 +1,34 @@
4172 +/*
4173 + *  tm27.h
4174 + *
4175 + *  The license and distribution terms for this file may be
4176 + *  found in the file LICENSE in this distribution or at
4177 + *  http://www.rtems.com/license/LICENSE.
4178 + *
4179 + *  $Id: tm27.h,v 1.2 2004/04/23 04:47:36 ralf Exp $
4180 + */
4181 +
4182 +#ifndef _RTEMS_TMTEST27
4183 +#error "This is an RTEMS internal file you must not include directly."
4184 +#endif
4185 +
4186 +#ifndef __tm27_h
4187 +#define __tm27_h
4188 +
4189 +/*
4190 + *  Define the interrupt mechanism for Time Test 27
4191 + */
4192 +
4193 +/* XXX - JRS - I want to compile the tmtests */
4194 +
4195 +#define MUST_WAIT_FOR_INTERRUPT 1
4196 +
4197 +#define Install_tm27_vector( handler ) /* empty */
4198 +
4199 +#define Cause_tm27_intr() /* empty */
4200 +
4201 +#define Clear_tm27_intr() /* empty */
4202 +
4203 +#define Lower_tm27_intr() /* empty */
4204 +
4205 +#endif
4206 Index: rtems-051009/c/src/lib/libbsp/m68k/mo376/times
4207 ===================================================================
4208 --- /dev/null
4209 +++ rtems/c/src/lib/libbsp/m68k/mo376/times
4210 @@ -0,0 +1,195 @@
4211 +#
4212 +#  Timing Test Suite Results for the MRM332 BSP
4213 +#
4214 +#  $Id: times,v 1.2 2004/01/07 21:13:50 joel Exp $
4215 +#
4216 +
4217 +NOTE:  This BSP is user submitted and no information is currently available. 
4218 +
4219 +TBD: MATT - update this with real times!
4220 +
4221 +Board:                MRM332 
4222 +CPU:                  68332
4223 +Clock Speed:          20 Mhz
4224 +Memory Configuration: SRAM, DRAM, cache, etc
4225 +Wait States:          
4226 +
4227 +Times Reported in:    cycles, microseconds, etc
4228 +Timer Source:         Count Down Timer, on-CPU cycle counter, etc
4229 +
4230 +Column A:             unused
4231 +Column B:             unused
4232 +
4233 +#                          DESCRIPTION                                 A    B
4234 +== =================================================================  ==== ====
4235 + 1 rtems_semaphore_create                                               20
4236 +   rtems_semaphore_delete                                               21
4237 +   rtems_semaphore_obtain: available                                    15
4238 +   rtems_semaphore_obtain: not available -- NO_WAIT                     15
4239 +   rtems_semaphore_release: no waiting tasks                            16
4240 +
4241 + 2 rtems_semaphore_obtain: not available -- caller blocks               62
4242 +
4243 + 3 rtems_semaphore_release: task readied -- preempts caller             55
4244 +
4245 + 4 rtems_task_restart: blocked task -- preempts caller                  77
4246 +   rtems_task_restart: ready task -- preempts caller                    70
4247 +   rtems_semaphore_release: task readied -- returns to caller           25
4248 +   rtems_task_create                                                    57
4249 +   rtems_task_start                                                     31
4250 +   rtems_task_restart: suspended task -- returns to caller              36
4251 +   rtems_task_delete: suspended task                                    47
4252 +   rtems_task_restart: ready task -- returns to caller                  37
4253 +   rtems_task_restart: blocked task -- returns to caller                46
4254 +   rtems_task_delete: blocked task                                      50
4255 +
4256 + 5 rtems_task_suspend: calling task                                     51
4257 +   rtems_task_resume: task readied -- preempts caller                   49
4258 +
4259 + 6 rtems_task_restart: calling task                                     59
4260 +   rtems_task_suspend: returns to caller                                18
4261 +   rtems_task_resume: task readied -- returns to caller                 19
4262 +   rtems_task_delete: ready task                                        50
4263 +
4264 + 7 rtems_task_restart: suspended task -- preempts caller                70
4265 +
4266 + 8 rtems_task_set_priority: obtain current priority                     12
4267 +   rtems_task_set_priority: returns to caller                           27
4268 +   rtems_task_mode: obtain current mode                                  5
4269 +   rtems_task_mode: no reschedule                                        5
4270 +   rtems_task_mode: reschedule -- returns to caller                      8
4271 +   rtems_task_mode: reschedule -- preempts caller                       39
4272 +   rtems_task_set_note                                                  13
4273 +   rtems_task_get_note                                                  13
4274 +   rtems_clock_set                                                      33
4275 +   rtems_clock_get                                                       3
4276 +
4277 + 9 rtems_message_queue_create                                          110
4278 +   rtems_message_queue_send: no waiting tasks                           37
4279 +   rtems_message_queue_urgent: no waiting tasks                         37
4280 +   rtems_message_queue_receive: available                               31
4281 +   rtems_message_queue_flush: no messages flushed                       12
4282 +   rtems_message_queue_flush: messages flushed                          16
4283 +   rtems_message_queue_delete                                           26
4284 +
4285 +10 rtems_message_queue_receive: not available -- NO_WAIT                15
4286 +   rtems_message_queue_receive: not available -- caller blocks          62
4287 +
4288 +11 rtems_message_queue_send: task readied -- preempts caller            72
4289 +
4290 +12 rtems_message_queue_send: task readied -- returns to caller          39
4291 +
4292 +13 rtems_message_queue_urgent: task readied -- preempts caller          72
4293 +
4294 +14 rtems_message_queue_urgent: task readied -- returns to caller        39
4295 +
4296 +15 rtems_event_receive: obtain current events                            1
4297 +   rtems_event_receive: not available -- NO_WAIT                        12
4298 +   rtems_event_receive: not available -- caller blocks                  56
4299 +   rtems_event_send: no task readied                                    12
4300 +   rtems_event_receive: available                                       12
4301 +   rtems_event_send: task readied -- returns to caller                  24
4302 +
4303 +16 rtems_event_send: task readied -- preempts caller                    55
4304 +
4305 +17 rtems_task_set_priority: preempts caller                             62
4306 +
4307 +18 rtems_task_delete: calling task                                      83
4308 +
4309 +19 rtems_signal_catch                                                    9
4310 +   rtems_signal_send: returns to caller                                 15
4311 +   rtems_signal_send: signal to self                                    18
4312 +   exit ASR overhead: returns to calling task                           22
4313 +   exit ASR overhead: returns to preempting task                        49
4314 +
4315 +20 rtems_partition_create                                               35
4316 +   rtems_region_create                                                  23
4317 +   rtems_partition_get_buffer: available                                15
4318 +   rtems_partition_get_buffer: not available                            13
4319 +   rtems_partition_return_buffer                                        18
4320 +   rtems_partition_delete                                               16
4321 +   rtems_region_get_segment: available                                  22
4322 +   rtems_region_get_segment: not available -- NO_WAIT                   21
4323 +   rtems_region_return_segment: no waiting tasks                        19
4324 +   rtems_region_get_segment: not available -- caller blocks             64
4325 +   rtems_region_return_segment: task readied -- preempts caller         74
4326 +   rtems_region_return_segment: task readied -- returns to caller       44
4327 +   rtems_region_delete                                                  16
4328 +   rtems_io_initialize                                                   2
4329 +   rtems_io_open                                                         1
4330 +   rtems_io_close                                                        1
4331 +   rtems_io_read                                                         1
4332 +   rtems_io_write                                                        1
4333 +   rtems_io_control                                                      1
4334 +
4335 +21 rtems_task_ident                                                    149
4336 +   rtems_message_queue_ident                                           145
4337 +   rtems_semaphore_ident                                               156
4338 +   rtems_partition_ident                                               145
4339 +   rtems_region_ident                                                  148
4340 +   rtems_port_ident                                                    145
4341 +   rtems_timer_ident                                                   145
4342 +   rtems_rate_monotonic_ident                                          145
4343 +
4344 +22 rtems_message_queue_broadcast: task readied -- returns to caller     42
4345 +   rtems_message_queue_broadcast: no waiting tasks                      17
4346 +   rtems_message_queue_broadcast: task readied -- preempts caller       78
4347 +
4348 +23 rtems_timer_create                                                   14
4349 +   rtems_timer_fire_after: inactive                                     22
4350 +   rtems_timer_fire_after: active                                       24
4351 +   rtems_timer_cancel: active                                           15
4352 +   rtems_timer_cancel: inactive                                         13
4353 +   rtems_timer_reset: inactive                                          21
4354 +   rtems_timer_reset: active                                            23
4355 +   rtems_timer_fire_when: inactive                                      34
4356 +   rtems_timer_fire_when: active                                        34
4357 +   rtems_timer_delete: active                                           19
4358 +   rtems_timer_delete: inactive                                         17
4359 +   rtems_task_wake_when                                                 69
4360 +
4361 +24 rtems_task_wake_after: yield -- returns to caller                     9
4362 +   rtems_task_wake_after: yields -- preempts caller                     45
4363 +
4364 +25 rtems_clock_tick                                                      4
4365 +
4366 +26 _ISR_Disable                                                          0
4367 +   _ISR_Flash                                                            1
4368 +   _ISR_Enable                                                           1
4369 +   _Thread_Disable_dispatch                                              0
4370 +   _Thread_Enable_dispatch                                               7
4371 +   _Thread_Set_state                                                    11
4372 +   _Thread_Disptach (NO FP)                                             31
4373 +   context switch: no floating point contexts                           21
4374 +   context switch: self                                                 10
4375 +   context switch: to another task                                      10
4376 +   context switch: restore 1st FP task                                  25
4377 +   fp context switch: save idle, restore idle                           31
4378 +   fp context switch: save idle, restore initialized                    19
4379 +   fp context switch: save initialized, restore initialized             20
4380 +   _Thread_Resume                                                        7
4381 +   _Thread_Unblock                                                       7
4382 +   _Thread_Ready                                                         9
4383 +   _Thread_Get                                                           4
4384 +   _Semaphore_Get                                                        2
4385 +   _Thread_Get: invalid id                                               0
4386 +
4387 +27 interrupt entry overhead: returns to interrupted task                 6
4388 +   interrupt exit overhead: returns to interrupted task                  6
4389 +   interrupt entry overhead: returns to nested interrupt                 6
4390 +   interrupt exit overhead: returns to nested interrupt                  5
4391 +   interrupt entry overhead: returns to preempting task                  7
4392 +   interrupt exit overhead: returns to preempting task                  36
4393 +
4394 +28 rtems_port_create                                                    16
4395 +   rtems_port_external_to_internal                                      11
4396 +   rtems_port_internal_to_external                                      11
4397 +   rtems_port_delete                                                    16
4398 +
4399 +29 rtems_rate_monotonic_create                                          15
4400 +   rtems_rate_monotonic_period: initiate period -- returns to caller    21
4401 +   rtems_rate_monotonic_period: obtain status                           13
4402 +   rtems_rate_monotonic_cancel                                          16
4403 +   rtems_rate_monotonic_delete: inactive                                18
4404 +   rtems_rate_monotonic_delete: active                                  20
4405 +   rtems_rate_monotonic_period: conclude periods -- caller blocks       53
4406 Index: rtems-051009/c/src/lib/libbsp/m68k/mo376/include/mrm332.h
4407 ===================================================================
4408 --- /dev/null
4409 +++ rtems/c/src/lib/libbsp/m68k/mo376/include/mrm332.h
4410 @@ -0,0 +1,70 @@
4411 +/*  mrm332.h
4412 + *
4413 + *  $Id: mrm332.h,v 1.5 2004/04/21 16:01:35 ralf Exp $
4414 + */
4415 +
4416 +#ifndef _MRM332_H_
4417 +#define _MRM332_H_
4418 +
4419 +/* SIM_MM (SIM Module Mapping) determines the location of the control
4420 +   register block. When MM=0, register addresses range fom 0x7ff000 to
4421 +   0x7FFFFF. When MM=1, register addresses range from 0xfff000 to
4422 +   0xffffff. */
4423 +#define SIM_MM 1
4424 +
4425 +/* Interrupt related definitions */
4426 +#define SIM_IARB 15
4427 +#define QSM_IARB 10
4428 +
4429 +#define MRM_PIV 64
4430 +#define ISRL_PIT 4             /* zero disables PIT */
4431 +
4432 +#define EFI_QIVR 66            /* 66=>SCI and 67=>QSPI interrupt */
4433 +#define ISRL_QSPI 0
4434 +
4435 +#define EFI_SPINT 24           /* spurious interrupt */
4436 +#define EFI_INT1 25            /* CTS interrupt */
4437 +#define ISRL_SCI 6
4438 +
4439 +/* System Clock definitions */
4440 +#define XTAL 32768.0           /* crystal frequency in Hz */
4441 +
4442 +#if 0
4443 +/* Default MRM clock rate (8.388688 MHz) set by CPU32: */
4444 +#define MRM_W 0                        /* system clock parameters */
4445 +#define MRM_X 0
4446 +#define MRM_Y 0x3f
4447 +#endif
4448 +
4449 +#if 1
4450 +/* 16.77722 MHz: */
4451 +#define MRM_W 1                        /* system clock parameters */
4452 +#define MRM_X 1
4453 +#define MRM_Y 0x0f
4454 +#endif
4455 +
4456 +#if 0
4457 +/* 25.16582 MHz: */
4458 +#define MRM_W 1                        /* system clock parameters */
4459 +#define MRM_X 1
4460 +#define MRM_Y 0x17
4461 +#endif
4462 +
4463 +#define SYS_CLOCK (XTAL*4.0*(MRM_Y+1)*(1 << (2*MRM_W+MRM_X)))
4464 +#define SCI_BAUD 19200         /* RS232 Baud Rate */
4465 +
4466 +/* macros/functions */
4467 +
4468 +#ifndef ASM
4469 +
4470 +/*
4471 + *  This prototype really should have the noreturn attribute but
4472 + *  that causes a warning. Not sure how to fix that.
4473 + */
4474 +/*   static void reboot(void) __attribute__ ((noreturn)); */
4475 +static void reboot(void);
4476 +__inline__ static void reboot() {asm("trap #15; .word 0x0063");}
4477 +
4478 +#endif /* ASM */
4479 +
4480 +#endif /* _MRM_H_ */
4481 Index: rtems-051009/c/src/lib/libbsp/m68k/mo376/include/bspopts.h.in
4482 ===================================================================
4483 --- /dev/null
4484 +++ rtems/c/src/lib/libbsp/m68k/mo376/include/bspopts.h.in
4485 @@ -0,0 +1,16 @@
4486 +/* include/bspopts.h.in.  Generated from configure.ac by autoheader.  */
4487 +
4488 +/* Define to the address where bug reports for this package should be sent. */
4489 +#undef PACKAGE_BUGREPORT
4490 +
4491 +/* Define to the full name of this package. */
4492 +#undef PACKAGE_NAME
4493 +
4494 +/* Define to the full name and version of this package. */
4495 +#undef PACKAGE_STRING
4496 +
4497 +/* Define to the one symbol short name of this package. */
4498 +#undef PACKAGE_TARNAME
4499 +
4500 +/* Define to the version of this package. */
4501 +#undef PACKAGE_VERSION
4502 Index: rtems-051009/c/src/lib/libbsp/m68k/mo376/spurious/spinit.c
4503 ===================================================================
4504 --- /dev/null
4505 +++ rtems/c/src/lib/libbsp/m68k/mo376/spurious/spinit.c
4506 @@ -0,0 +1,105 @@
4507 +/*  Spurious_driver
4508 + *
4509 + *  This routine installs spurious interrupt handlers for the mrm.
4510 + *
4511 + *  Input parameters:  NONE
4512 + *
4513 + *  Output parameters:  NONE
4514 + *
4515 + *  COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993.
4516 + *  On-Line Applications Research Corporation (OAR).
4517 + *
4518 + *  The license and distribution terms for this file may be
4519 + *  found in the file LICENSE in this distribution or at
4520 + *  http://www.rtems.com/license/LICENSE.
4521 + *
4522 + *  $Id: spinit.c,v 1.5 2004/04/21 10:42:52 ralf Exp $
4523 + */
4524 +
4525 +#include <bsp.h>
4526 +#include <stdio.h>
4527 +
4528 +const char * const _Spurious_Error_[] = {"Reset","Bus Error","Address Error",
4529 +   "Illegal Instruction","Zero Division","CHK, CHK2 Instruction",
4530 +   "TRAPcc, TRAPV Instruction","Privilege Violation","Trace",
4531 +   "Line 1010 Emulation","Line 1111 Emulation","Hardware Breakpoint",
4532 +   "Coprocessor Protocal Violation",
4533 +   "Format Error ans Uninitialized Interrupt","Unassigned",
4534 +   "Spurious Interrupt","AVec1","AVec2","AVec3","AVec4","AVec5","AVec6",
4535 +   "AVec7","Trap Instruction","Debug","Reboot","Reserved Coprocessor",
4536 +   "Reserved Unassigned","User Defined"};
4537 +
4538 +rtems_isr Spurious_Isr(
4539 +  rtems_vector_number vector
4540 +)
4541 +{
4542 +  //int sp = 0;
4543 +#if 0
4544 +  const char * const VectDescrip[] = {
4545 +    _Spurious_Error_[0],   _Spurious_Error_[0],  _Spurious_Error_[1],
4546 +    _Spurious_Error_[2],   _Spurious_Error_[3],  _Spurious_Error_[4],
4547 +    _Spurious_Error_[5],   _Spurious_Error_[6],  _Spurious_Error_[7],
4548 +    _Spurious_Error_[8],   _Spurious_Error_[9], _Spurious_Error_[10],
4549 +    _Spurious_Error_[11], _Spurious_Error_[12], _Spurious_Error_[13],
4550 +    _Spurious_Error_[13], _Spurious_Error_[14], _Spurious_Error_[14],
4551 +    _Spurious_Error_[14], _Spurious_Error_[14], _Spurious_Error_[14],
4552 +    _Spurious_Error_[14], _Spurious_Error_[14], _Spurious_Error_[14],
4553 +    _Spurious_Error_[15], _Spurious_Error_[16], _Spurious_Error_[17],
4554 +    _Spurious_Error_[18], _Spurious_Error_[19], _Spurious_Error_[20],
4555 +    _Spurious_Error_[21], _Spurious_Error_[22], _Spurious_Error_[23],
4556 +    _Spurious_Error_[24], _Spurious_Error_[23], _Spurious_Error_[23],
4557 +    _Spurious_Error_[23], _Spurious_Error_[23], _Spurious_Error_[23],
4558 +    _Spurious_Error_[23], _Spurious_Error_[23], _Spurious_Error_[23],
4559 +    _Spurious_Error_[23], _Spurious_Error_[23], _Spurious_Error_[23],
4560 +    _Spurious_Error_[23], _Spurious_Error_[23], _Spurious_Error_[25],
4561 +    _Spurious_Error_[26], _Spurious_Error_[26], _Spurious_Error_[26],
4562 +    _Spurious_Error_[26], _Spurious_Error_[26], _Spurious_Error_[26],
4563 +    _Spurious_Error_[26], _Spurious_Error_[26], _Spurious_Error_[26],
4564 +    _Spurious_Error_[26], _Spurious_Error_[26], _Spurious_Error_[27],
4565 +    _Spurious_Error_[27], _Spurious_Error_[27], _Spurious_Error_[27],
4566 +    _Spurious_Error_[27], _Spurious_Error_[28]};
4567 +#endif
4568 +
4569 +  //asm volatile ( "movea.l   %%sp,%0 " : "=a" (sp) : "0" (sp) );
4570 +
4571 +  _CPU_ISR_Set_level( 7 );
4572 +  //_UART_flush();
4573 +#if 0
4574 +  RAW_PUTS("\n\rRTEMS: Spurious interrupt: ");
4575 +  RAW_PUTS((char *)VectDescrip[( (vector>64) ? 64 : vector )]);
4576 +  RAW_PUTS("\n\rRTEMS:    Vector: ");
4577 +  RAW_PUTI(vector);
4578 +  RAW_PUTS(" sp: ");
4579 +  RAW_PUTI(sp);
4580 +  RAW_PUTS("\n\r");
4581 +#endif
4582 +  bsp_cleanup();
4583 +
4584 +  /* BDM SIGEMT */
4585 +  asm("  .word  0x4afa");
4586 +
4587 +  for(;;);
4588 +}
4589 +
4590 +void Spurious_Initialize(void)
4591 +{
4592 +  rtems_vector_number vector;
4593 +
4594 +  for ( vector = 0x0 ; vector <= 0xFF ; vector++ )
4595 +    {
4596 +      switch (vector)
4597 +       {
4598 +       case 4:
4599 +       case 9:
4600 +       case 31:
4601 +       case 47:
4602 +       case 66:
4603 +         /* These vectors used by CPU32bug - don't overwrite them. */
4604 +         break;
4605 +
4606 +       default:
4607 +         (void) set_vector( Spurious_Isr, vector, 1 );
4608 +         break;
4609 +       }
4610 +    }
4611 +}
4612 Index: rtems-051009/c/src/lib/libbsp/m68k/mo376/startup/linkcmds
4613 ===================================================================
4614 --- /dev/null
4615 +++ rtems/c/src/lib/libbsp/m68k/mo376/startup/linkcmds
4616 @@ -0,0 +1,164 @@
4617 +/*  linkcmds
4618 + *
4619 + *  $Id: linkcmds,v 1.5 2004/11/26 01:54:51 joel Exp $
4620 + */
4621 +
4622 +OUTPUT_ARCH(m68k)
4623 +__DYNAMIC  =  0;
4624 +
4625 +/*
4626 + * The memory map looks like this:
4627 + * +--------------------+ <- low memory
4628 + * | .text              |
4629 + * |        etext       |
4630 + * |        ctor list   | the ctor and dtor lists are for
4631 + * |        dtor list   | C++ support
4632 + * |        _endtext    |
4633 + * +--------------------+
4634 + * | .data              | initialized data goes here
4635 + * |        _sdata      |
4636 + * |        _edata      |
4637 + * +--------------------+
4638 + * | .bss               |
4639 + * |        _clear_start| start of bss, cleared by crt0
4640 + * |        _end        | start of heap, used by sbrk()
4641 + * +--------------------+
4642 + * |    heap space      |
4643 + * |        _ENDHEAP    |
4644 + * |    stack space     | 
4645 + * |        __stack     | top of stack
4646 + * +--------------------+ <- high memory
4647 + */
4648 +
4649 +/*
4650 + * Declare some sizes.
4651 + */
4652 +_RamBase = DEFINED(_RamBase) ? _RamBase : 0x10000;
4653 +_RamSize = DEFINED(_RamSize) ? _RamSize : 0x70000;
4654 +_RamEnd = _RamBase + _RamSize;
4655 +_HeapSize = DEFINED(_HeapSize) ? _HeapSize : 0x10000;
4656 +_StackSize = DEFINED(_StackSize) ? _StackSize : 0x2000;
4657 +
4658 +MEMORY
4659 +{
4660 +  ram     : ORIGIN = 0x10000, LENGTH = 0x70000
4661 +}
4662 +
4663 +_copy_data_from_rom = 0;
4664 +
4665 +/*
4666 + * stick everything in ram (of course)
4667 + */
4668 +SECTIONS
4669 +{
4670 +       ram : {
4671 +               . = .;
4672 +       } >ram
4673 +
4674 +        /*
4675 +         * Text, data and bss segments
4676 +         */
4677 +        .text : {
4678 +                *(.text)
4679 +
4680 +               /*
4681 +                * C++ constructors/destructors
4682 +                */
4683 +               *(.gnu.linkonce.t.*)
4684 +
4685 +               /*
4686 +                * Initialization and finalization code.
4687 +                *
4688 +                * Various files can provide initialization and finalization
4689 +                * functions.  crtbegin.o and crtend.o are two instances. The
4690 +                * body of these functions are in .init and .fini sections. We
4691 +                * accumulate the bodies here, and prepend function prologues
4692 +                * from crti.o and function epilogues from crtn.o. crti.o must
4693 +                * be linked first; crtn.o must be linked last.  Because these
4694 +                * are wildcards, it doesn't matter if the user does not
4695 +                * actually link against crti.o and crtn.o; the linker won't
4696 +                * look for a file to match a wildcard.  The wildcard also
4697 +                * means that it doesn't matter which directory crti.o and
4698 +                * crtn.o are in. 
4699 +                */
4700 +               PROVIDE (_init = .);
4701 +               *crti.o(.init)
4702 +               *(.init)
4703 +               *crtn.o(.init)
4704 +               PROVIDE (_fini = .);
4705 +               *crti.o(.fini)
4706 +               *(.fini)
4707 +               *crtn.o(.fini)
4708 +
4709 +               /*
4710 +                * Special FreeBSD sysctl sections.
4711 +                */
4712 +               . = ALIGN (16);
4713 +               __start_set_sysctl_set = .;
4714 +               *(set_sysctl_*);
4715 +               __stop_set_sysctl_set = ABSOLUTE(.);
4716 +               *(set_domain_*);
4717 +               *(set_pseudo_*);
4718 +
4719 +               /*
4720 +                * C++ constructors/destructors
4721 +                *
4722 +                * gcc uses crtbegin.o to find the start of the constructors
4723 +                * and destructors so we make sure it is first.  Because this
4724 +                * is a wildcard, it doesn't matter if the user does not
4725 +                * actually link against crtbegin.o; the linker won't look for
4726 +                * a file to match a wildcard.  The wildcard also means that
4727 +                * it doesn't matter which directory crtbegin.o is in. The
4728 +                * constructor and destructor list are terminated in
4729 +                * crtend.o.  The same comments apply to it.
4730 +                */
4731 +               . = ALIGN (16);
4732 +               *crtbegin.o(.ctors)
4733 +               *(.ctors)
4734 +               *crtend.o(.ctors)
4735 +               *crtbegin.o(.dtors)
4736 +               *(.dtors)
4737 +               *crtend.o(.dtors)
4738 +
4739 +               /*
4740 +                * Exception frame info
4741 +                */
4742 +               . = ALIGN (16);
4743 +               *(.eh_frame)
4744 +
4745 +               /*
4746 +                * Read-only data
4747 +                */
4748 +               . = ALIGN (16);
4749 +               _rodata_start = .;
4750 +               *(.rodata*)
4751 +               *(.gnu.linkonce.r*)
4752 +
4753 +                 . = ALIGN (16);
4754 +                PROVIDE (_etext = .);
4755 +        } >ram
4756 +        .data : {
4757 +                PROVIDE (_copy_start = .);
4758 +                *(.data)
4759 +               *(.gnu.linkonce.d*)
4760 +               *(.gcc_except_table)
4761 +               *(.jcr)
4762 +                . = ALIGN (16);
4763 +                PROVIDE (_edata = .);
4764 +                PROVIDE (_copy_end = .);
4765 +        } >ram
4766 +        .bss : {
4767 +                _clear_start = .;
4768 +                *(.dynbss)
4769 +                *(.bss .bss.* .gnu.linkonce.b.*)
4770 +                *(COMMON)
4771 +                . = ALIGN (16);
4772 +                PROVIDE (end = .);
4773 +                . += _StackSize;
4774 +                . = ALIGN (16);
4775 +                _stack_init = .;
4776 +                _clear_end = .;
4777 +
4778 +                _WorkspaceBase = .;
4779 +        } >ram
4780 +}
4781 Index: rtems-051009/c/src/lib/libbsp/m68k/mo376/bsp_specs
4782 ===================================================================
4783 --- /dev/null
4784 +++ rtems/c/src/lib/libbsp/m68k/mo376/bsp_specs
4785 @@ -0,0 +1,16 @@
4786 +%rename endfile old_endfile
4787 +%rename startfile old_startfile
4788 +%rename link old_link
4789 +
4790 +*startfile:
4791 +%{!qrtems: %(old_startfile)} %{!nostdlib: %{qrtems: \
4792 +%{!qrtems_debug: start.o%s} \
4793 +%{qrtems_debug: start_g.o%s} \
4794 +crti.o%s crtbegin.o%s}}
4795 +
4796 +*link:
4797 +%{!qrtems: %(old_link)} %{qrtems: -dc -dp -N -e start}
4798 +
4799 +*endfile:
4800 +%{!qrtems: %(old_endfile)} %{qrtems: crtend.o%s crtn.o%s}
4801 +
4802 Index: rtems-051009/c/src/lib/libbsp/m68k/mo376/include/.cvsignore
4803 ===================================================================
4804 --- /dev/null
4805 +++ rtems/c/src/lib/libbsp/m68k/mo376/include/.cvsignore
4806 @@ -0,0 +1,5 @@
4807 +bspopts.h
4808 +bspopts.h.in
4809 +coverhd.h
4810 +stamp-h
4811 +stamp-h.in
4812 Index: rtems-051009/c/src/lib/libbsp/m68k/mo376/aclocal.m4
4813 ===================================================================
4814 --- /dev/null
4815 +++ rtems/c/src/lib/libbsp/m68k/mo376/aclocal.m4
4816 @@ -0,0 +1,896 @@
4817 +# generated automatically by aclocal 1.9.5 -*- Autoconf -*-
4818 +
4819 +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4820 +# 2005  Free Software Foundation, Inc.
4821 +# This file is free software; the Free Software Foundation
4822 +# gives unlimited permission to copy and/or distribute it,
4823 +# with or without modifications, as long as this notice is preserved.
4824 +
4825 +# This program is distributed in the hope that it will be useful,
4826 +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
4827 +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
4828 +# PARTICULAR PURPOSE.
4829 +
4830 +# Copyright (C) 2002, 2003, 2005  Free Software Foundation, Inc.
4831 +#
4832 +# This file is free software; the Free Software Foundation
4833 +# gives unlimited permission to copy and/or distribute it,
4834 +# with or without modifications, as long as this notice is preserved.
4835 +
4836 +# AM_AUTOMAKE_VERSION(VERSION)
4837 +# ----------------------------
4838 +# Automake X.Y traces this macro to ensure aclocal.m4 has been
4839 +# generated from the m4 files accompanying Automake X.Y.
4840 +AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"])
4841 +
4842 +# AM_SET_CURRENT_AUTOMAKE_VERSION
4843 +# -------------------------------
4844 +# Call AM_AUTOMAKE_VERSION so it can be traced.
4845 +# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
4846 +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
4847 +        [AM_AUTOMAKE_VERSION([1.9.5])])
4848 +
4849 +# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
4850 +
4851 +# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
4852 +#
4853 +# This file is free software; the Free Software Foundation
4854 +# gives unlimited permission to copy and/or distribute it,
4855 +# with or without modifications, as long as this notice is preserved.
4856 +
4857 +# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
4858 +# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
4859 +# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
4860 +#
4861 +# Of course, Automake must honor this variable whenever it calls a
4862 +# tool from the auxiliary directory.  The problem is that $srcdir (and
4863 +# therefore $ac_aux_dir as well) can be either absolute or relative,
4864 +# depending on how configure is run.  This is pretty annoying, since
4865 +# it makes $ac_aux_dir quite unusable in subdirectories: in the top
4866 +# source directory, any form will work fine, but in subdirectories a
4867 +# relative path needs to be adjusted first.
4868 +#
4869 +# $ac_aux_dir/missing
4870 +#    fails when called from a subdirectory if $ac_aux_dir is relative
4871 +# $top_srcdir/$ac_aux_dir/missing
4872 +#    fails if $ac_aux_dir is absolute,
4873 +#    fails when called from a subdirectory in a VPATH build with
4874 +#          a relative $ac_aux_dir
4875 +#
4876 +# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
4877 +# are both prefixed by $srcdir.  In an in-source build this is usually
4878 +# harmless because $srcdir is `.', but things will broke when you
4879 +# start a VPATH build or use an absolute $srcdir.
4880 +#
4881 +# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
4882 +# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
4883 +#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
4884 +# and then we would define $MISSING as
4885 +#   MISSING="\${SHELL} $am_aux_dir/missing"
4886 +# This will work as long as MISSING is not called from configure, because
4887 +# unfortunately $(top_srcdir) has no meaning in configure.
4888 +# However there are other variables, like CC, which are often used in
4889 +# configure, and could therefore not use this "fixed" $ac_aux_dir.
4890 +#
4891 +# Another solution, used here, is to always expand $ac_aux_dir to an
4892 +# absolute PATH.  The drawback is that using absolute paths prevent a
4893 +# configured tree to be moved without reconfiguration.
4894 +
4895 +AC_DEFUN([AM_AUX_DIR_EXPAND],
4896 +[dnl Rely on autoconf to set up CDPATH properly.
4897 +AC_PREREQ([2.50])dnl
4898 +# expand $ac_aux_dir to an absolute path
4899 +am_aux_dir=`cd $ac_aux_dir && pwd`
4900 +])
4901 +
4902 +# AM_CONDITIONAL                                            -*- Autoconf -*-
4903 +
4904 +# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005
4905 +# Free Software Foundation, Inc.
4906 +#
4907 +# This file is free software; the Free Software Foundation
4908 +# gives unlimited permission to copy and/or distribute it,
4909 +# with or without modifications, as long as this notice is preserved.
4910 +
4911 +# serial 7
4912 +
4913 +# AM_CONDITIONAL(NAME, SHELL-CONDITION)
4914 +# -------------------------------------
4915 +# Define a conditional.
4916 +AC_DEFUN([AM_CONDITIONAL],
4917 +[AC_PREREQ(2.52)dnl
4918 + ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
4919 +       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
4920 +AC_SUBST([$1_TRUE])
4921 +AC_SUBST([$1_FALSE])
4922 +if $2; then
4923 +  $1_TRUE=
4924 +  $1_FALSE='#'
4925 +else
4926 +  $1_TRUE='#'
4927 +  $1_FALSE=
4928 +fi
4929 +AC_CONFIG_COMMANDS_PRE(
4930 +[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
4931 +  AC_MSG_ERROR([[conditional "$1" was never defined.
4932 +Usually this means the macro was only invoked conditionally.]])
4933 +fi])])
4934 +
4935 +
4936 +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
4937 +# Free Software Foundation, Inc.
4938 +#
4939 +# This file is free software; the Free Software Foundation
4940 +# gives unlimited permission to copy and/or distribute it,
4941 +# with or without modifications, as long as this notice is preserved.
4942 +
4943 +# serial 8
4944 +
4945 +# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
4946 +# written in clear, in which case automake, when reading aclocal.m4,
4947 +# will think it sees a *use*, and therefore will trigger all it's
4948 +# C support machinery.  Also note that it means that autoscan, seeing
4949 +# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
4950 +
4951 +
4952 +# _AM_DEPENDENCIES(NAME)
4953 +# ----------------------
4954 +# See how the compiler implements dependency checking.
4955 +# NAME is "CC", "CXX", "GCJ", or "OBJC".
4956 +# We try a few techniques and use that to set a single cache variable.
4957 +#
4958 +# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
4959 +# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
4960 +# dependency, and given that the user is not expected to run this macro,
4961 +# just rely on AC_PROG_CC.
4962 +AC_DEFUN([_AM_DEPENDENCIES],
4963 +[AC_REQUIRE([AM_SET_DEPDIR])dnl
4964 +AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
4965 +AC_REQUIRE([AM_MAKE_INCLUDE])dnl
4966 +AC_REQUIRE([AM_DEP_TRACK])dnl
4967 +
4968 +ifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
4969 +       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
4970 +       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
4971 +       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
4972 +                   [depcc="$$1"   am_compiler_list=])
4973 +
4974 +AC_CACHE_CHECK([dependency style of $depcc],
4975 +               [am_cv_$1_dependencies_compiler_type],
4976 +[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
4977 +  # We make a subdir and do the tests there.  Otherwise we can end up
4978 +  # making bogus files that we don't know about and never remove.  For
4979 +  # instance it was reported that on HP-UX the gcc test will end up
4980 +  # making a dummy file named `D' -- because `-MD' means `put the output
4981 +  # in D'.
4982 +  mkdir conftest.dir
4983 +  # Copy depcomp to subdir because otherwise we won't find it if we're
4984 +  # using a relative directory.
4985 +  cp "$am_depcomp" conftest.dir
4986 +  cd conftest.dir
4987 +  # We will build objects and dependencies in a subdirectory because
4988 +  # it helps to detect inapplicable dependency modes.  For instance
4989 +  # both Tru64's cc and ICC support -MD to output dependencies as a
4990 +  # side effect of compilation, but ICC will put the dependencies in
4991 +  # the current directory while Tru64 will put them in the object
4992 +  # directory.
4993 +  mkdir sub
4994 +
4995 +  am_cv_$1_dependencies_compiler_type=none
4996 +  if test "$am_compiler_list" = ""; then
4997 +     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
4998 +  fi
4999 +  for depmode in $am_compiler_list; do
5000 +    # Setup a source with many dependencies, because some compilers
5001 +    # like to wrap large dependency lists on column 80 (with \), and
5002 +    # we should not choose a depcomp mode which is confused by this.
5003 +    #
5004 +    # We need to recreate these files for each test, as the compiler may
5005 +    # overwrite some of them when testing with obscure command lines.
5006 +    # This happens at least with the AIX C compiler.
5007 +    : > sub/conftest.c
5008 +    for i in 1 2 3 4 5 6; do
5009 +      echo '#include "conftst'$i'.h"' >> sub/conftest.c
5010 +      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
5011 +      # Solaris 8's {/usr,}/bin/sh.
5012 +      touch sub/conftst$i.h
5013 +    done
5014 +    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
5015 +
5016 +    case $depmode in
5017 +    nosideeffect)
5018 +      # after this tag, mechanisms are not by side-effect, so they'll
5019 +      # only be used when explicitly requested
5020 +      if test "x$enable_dependency_tracking" = xyes; then
5021 +       continue
5022 +      else
5023 +       break
5024 +      fi
5025 +      ;;
5026 +    none) break ;;
5027 +    esac
5028 +    # We check with `-c' and `-o' for the sake of the "dashmstdout"
5029 +    # mode.  It turns out that the SunPro C++ compiler does not properly
5030 +    # handle `-M -o', and we need to detect this.
5031 +    if depmode=$depmode \
5032 +       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
5033 +       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
5034 +       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
5035 +         >/dev/null 2>conftest.err &&
5036 +       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
5037 +       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
5038 +       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
5039 +      # icc doesn't choke on unknown options, it will just issue warnings
5040 +      # or remarks (even with -Werror).  So we grep stderr for any message
5041 +      # that says an option was ignored or not supported.
5042 +      # When given -MP, icc 7.0 and 7.1 complain thusly:
5043 +      #   icc: Command line warning: ignoring option '-M'; no argument required
5044 +      # The diagnosis changed in icc 8.0:
5045 +      #   icc: Command line remark: option '-MP' not supported
5046 +      if (grep 'ignoring option' conftest.err ||
5047 +          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
5048 +        am_cv_$1_dependencies_compiler_type=$depmode
5049 +        break
5050 +      fi
5051 +    fi
5052 +  done
5053 +
5054 +  cd ..
5055 +  rm -rf conftest.dir
5056 +else
5057 +  am_cv_$1_dependencies_compiler_type=none
5058 +fi
5059 +])
5060 +AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
5061 +AM_CONDITIONAL([am__fastdep$1], [
5062 +  test "x$enable_dependency_tracking" != xno \
5063 +  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
5064 +])
5065 +
5066 +
5067 +# AM_SET_DEPDIR
5068 +# -------------
5069 +# Choose a directory name for dependency files.
5070 +# This macro is AC_REQUIREd in _AM_DEPENDENCIES
5071 +AC_DEFUN([AM_SET_DEPDIR],
5072 +[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
5073 +AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
5074 +])
5075 +
5076 +
5077 +# AM_DEP_TRACK
5078 +# ------------
5079 +AC_DEFUN([AM_DEP_TRACK],
5080 +[AC_ARG_ENABLE(dependency-tracking,
5081 +[  --disable-dependency-tracking  speeds up one-time build
5082 +  --enable-dependency-tracking   do not reject slow dependency extractors])
5083 +if test "x$enable_dependency_tracking" != xno; then
5084 +  am_depcomp="$ac_aux_dir/depcomp"
5085 +  AMDEPBACKSLASH='\'
5086 +fi
5087 +AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
5088 +AC_SUBST([AMDEPBACKSLASH])
5089 +])
5090 +
5091 +# Generate code to set up dependency tracking.              -*- Autoconf -*-
5092 +
5093 +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
5094 +# Free Software Foundation, Inc.
5095 +#
5096 +# This file is free software; the Free Software Foundation
5097 +# gives unlimited permission to copy and/or distribute it,
5098 +# with or without modifications, as long as this notice is preserved.
5099 +
5100 +#serial 3
5101 +
5102 +# _AM_OUTPUT_DEPENDENCY_COMMANDS
5103 +# ------------------------------
5104 +AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
5105 +[for mf in $CONFIG_FILES; do
5106 +  # Strip MF so we end up with the name of the file.
5107 +  mf=`echo "$mf" | sed -e 's/:.*$//'`
5108 +  # Check whether this is an Automake generated Makefile or not.
5109 +  # We used to match only the files named `Makefile.in', but
5110 +  # some people rename them; so instead we look at the file content.
5111 +  # Grep'ing the first line is not enough: some people post-process
5112 +  # each Makefile.in and add a new line on top of each file to say so.
5113 +  # So let's grep whole file.
5114 +  if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
5115 +    dirpart=`AS_DIRNAME("$mf")`
5116 +  else
5117 +    continue
5118 +  fi
5119 +  # Extract the definition of DEPDIR, am__include, and am__quote
5120 +  # from the Makefile without running `make'.
5121 +  DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
5122 +  test -z "$DEPDIR" && continue
5123 +  am__include=`sed -n 's/^am__include = //p' < "$mf"`
5124 +  test -z "am__include" && continue
5125 +  am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
5126 +  # When using ansi2knr, U may be empty or an underscore; expand it
5127 +  U=`sed -n 's/^U = //p' < "$mf"`
5128 +  # Find all dependency output files, they are included files with
5129 +  # $(DEPDIR) in their names.  We invoke sed twice because it is the
5130 +  # simplest approach to changing $(DEPDIR) to its actual value in the
5131 +  # expansion.
5132 +  for file in `sed -n "
5133 +    s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
5134 +       sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
5135 +    # Make sure the directory exists.
5136 +    test -f "$dirpart/$file" && continue
5137 +    fdir=`AS_DIRNAME(["$file"])`
5138 +    AS_MKDIR_P([$dirpart/$fdir])
5139 +    # echo "creating $dirpart/$file"
5140 +    echo '# dummy' > "$dirpart/$file"
5141 +  done
5142 +done
5143 +])# _AM_OUTPUT_DEPENDENCY_COMMANDS
5144 +
5145 +
5146 +# AM_OUTPUT_DEPENDENCY_COMMANDS
5147 +# -----------------------------
5148 +# This macro should only be invoked once -- use via AC_REQUIRE.
5149 +#
5150 +# This code is only required when automatic dependency tracking
5151 +# is enabled.  FIXME.  This creates each `.P' file that we will
5152 +# need in order to bootstrap the dependency handling code.
5153 +AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
5154 +[AC_CONFIG_COMMANDS([depfiles],
5155 +     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
5156 +     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
5157 +])
5158 +
5159 +# Do all the work for Automake.                             -*- Autoconf -*-
5160 +
5161 +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
5162 +# Free Software Foundation, Inc.
5163 +#
5164 +# This file is free software; the Free Software Foundation
5165 +# gives unlimited permission to copy and/or distribute it,
5166 +# with or without modifications, as long as this notice is preserved.
5167 +
5168 +# serial 12
5169 +
5170 +# This macro actually does too much.  Some checks are only needed if
5171 +# your package does certain things.  But this isn't really a big deal.
5172 +
5173 +# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
5174 +# AM_INIT_AUTOMAKE([OPTIONS])
5175 +# -----------------------------------------------
5176 +# The call with PACKAGE and VERSION arguments is the old style
5177 +# call (pre autoconf-2.50), which is being phased out.  PACKAGE
5178 +# and VERSION should now be passed to AC_INIT and removed from
5179 +# the call to AM_INIT_AUTOMAKE.
5180 +# We support both call styles for the transition.  After
5181 +# the next Automake release, Autoconf can make the AC_INIT
5182 +# arguments mandatory, and then we can depend on a new Autoconf
5183 +# release and drop the old call support.
5184 +AC_DEFUN([AM_INIT_AUTOMAKE],
5185 +[AC_PREREQ([2.58])dnl
5186 +dnl Autoconf wants to disallow AM_ names.  We explicitly allow
5187 +dnl the ones we care about.
5188 +m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
5189 +AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
5190 +AC_REQUIRE([AC_PROG_INSTALL])dnl
5191 +# test to see if srcdir already configured
5192 +if test "`cd $srcdir && pwd`" != "`pwd`" &&
5193 +   test -f $srcdir/config.status; then
5194 +  AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
5195 +fi
5196 +
5197 +# test whether we have cygpath
5198 +if test -z "$CYGPATH_W"; then
5199 +  if (cygpath --version) >/dev/null 2>/dev/null; then
5200 +    CYGPATH_W='cygpath -w'
5201 +  else
5202 +    CYGPATH_W=echo
5203 +  fi
5204 +fi
5205 +AC_SUBST([CYGPATH_W])
5206 +
5207 +# Define the identity of the package.
5208 +dnl Distinguish between old-style and new-style calls.
5209 +m4_ifval([$2],
5210 +[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
5211 + AC_SUBST([PACKAGE], [$1])dnl
5212 + AC_SUBST([VERSION], [$2])],
5213 +[_AM_SET_OPTIONS([$1])dnl
5214 + AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
5215 + AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
5216 +
5217 +_AM_IF_OPTION([no-define],,
5218 +[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
5219 + AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
5220 +
5221 +# Some tools Automake needs.
5222 +AC_REQUIRE([AM_SANITY_CHECK])dnl
5223 +AC_REQUIRE([AC_ARG_PROGRAM])dnl
5224 +AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
5225 +AM_MISSING_PROG(AUTOCONF, autoconf)
5226 +AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
5227 +AM_MISSING_PROG(AUTOHEADER, autoheader)
5228 +AM_MISSING_PROG(MAKEINFO, makeinfo)
5229 +AM_PROG_INSTALL_SH
5230 +AM_PROG_INSTALL_STRIP
5231 +AC_REQUIRE([AM_PROG_MKDIR_P])dnl
5232 +# We need awk for the "check" target.  The system "awk" is bad on
5233 +# some platforms.
5234 +AC_REQUIRE([AC_PROG_AWK])dnl
5235 +AC_REQUIRE([AC_PROG_MAKE_SET])dnl
5236 +AC_REQUIRE([AM_SET_LEADING_DOT])dnl
5237 +_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
5238 +              [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
5239 +                            [_AM_PROG_TAR([v7])])])
5240 +_AM_IF_OPTION([no-dependencies],,
5241 +[AC_PROVIDE_IFELSE([AC_PROG_CC],
5242 +                  [_AM_DEPENDENCIES(CC)],
5243 +                  [define([AC_PROG_CC],
5244 +                          defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
5245 +AC_PROVIDE_IFELSE([AC_PROG_CXX],
5246 +                  [_AM_DEPENDENCIES(CXX)],
5247 +                  [define([AC_PROG_CXX],
5248 +                          defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
5249 +])
5250 +])
5251 +
5252 +
5253 +# When config.status generates a header, we must update the stamp-h file.
5254 +# This file resides in the same directory as the config header
5255 +# that is generated.  The stamp files are numbered to have different names.
5256 +
5257 +# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
5258 +# loop where config.status creates the headers, so we can generate
5259 +# our stamp files there.
5260 +AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
5261 +[# Compute $1's index in $config_headers.
5262 +_am_stamp_count=1
5263 +for _am_header in $config_headers :; do
5264 +  case $_am_header in
5265 +    $1 | $1:* )
5266 +      break ;;
5267 +    * )
5268 +      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
5269 +  esac
5270 +done
5271 +echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
5272 +
5273 +# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
5274 +#
5275 +# This file is free software; the Free Software Foundation
5276 +# gives unlimited permission to copy and/or distribute it,
5277 +# with or without modifications, as long as this notice is preserved.
5278 +
5279 +# AM_PROG_INSTALL_SH
5280 +# ------------------
5281 +# Define $install_sh.
5282 +AC_DEFUN([AM_PROG_INSTALL_SH],
5283 +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
5284 +install_sh=${install_sh-"$am_aux_dir/install-sh"}
5285 +AC_SUBST(install_sh)])
5286 +
5287 +# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
5288 +#
5289 +# This file is free software; the Free Software Foundation
5290 +# gives unlimited permission to copy and/or distribute it,
5291 +# with or without modifications, as long as this notice is preserved.
5292 +
5293 +# serial 2
5294 +
5295 +# Check whether the underlying file-system supports filenames
5296 +# with a leading dot.  For instance MS-DOS doesn't.
5297 +AC_DEFUN([AM_SET_LEADING_DOT],
5298 +[rm -rf .tst 2>/dev/null
5299 +mkdir .tst 2>/dev/null
5300 +if test -d .tst; then
5301 +  am__leading_dot=.
5302 +else
5303 +  am__leading_dot=_
5304 +fi
5305 +rmdir .tst 2>/dev/null
5306 +AC_SUBST([am__leading_dot])])
5307 +
5308 +# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
5309 +# From Jim Meyering
5310 +
5311 +# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005
5312 +# Free Software Foundation, Inc.
5313 +#
5314 +# This file is free software; the Free Software Foundation
5315 +# gives unlimited permission to copy and/or distribute it,
5316 +# with or without modifications, as long as this notice is preserved.
5317 +
5318 +# serial 4
5319 +
5320 +AC_DEFUN([AM_MAINTAINER_MODE],
5321 +[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
5322 +  dnl maintainer-mode is disabled by default
5323 +  AC_ARG_ENABLE(maintainer-mode,
5324 +[  --enable-maintainer-mode  enable make rules and dependencies not useful
5325 +                         (and sometimes confusing) to the casual installer],
5326 +      USE_MAINTAINER_MODE=$enableval,
5327 +      USE_MAINTAINER_MODE=no)
5328 +  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
5329 +  AM_CONDITIONAL(MAINTAINER_MODE, [test $USE_MAINTAINER_MODE = yes])
5330 +  MAINT=$MAINTAINER_MODE_TRUE
5331 +  AC_SUBST(MAINT)dnl
5332 +]
5333 +)
5334 +
5335 +AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
5336 +
5337 +# Check to see how 'make' treats includes.                 -*- Autoconf -*-
5338 +
5339 +# Copyright (C) 2001, 2002, 2003, 2005  Free Software Foundation, Inc.
5340 +#
5341 +# This file is free software; the Free Software Foundation
5342 +# gives unlimited permission to copy and/or distribute it,
5343 +# with or without modifications, as long as this notice is preserved.
5344 +
5345 +# serial 3
5346 +
5347 +# AM_MAKE_INCLUDE()
5348 +# -----------------
5349 +# Check to see how make treats includes.
5350 +AC_DEFUN([AM_MAKE_INCLUDE],
5351 +[am_make=${MAKE-make}
5352 +cat > confinc << 'END'
5353 +am__doit:
5354 +       @echo done
5355 +.PHONY: am__doit
5356 +END
5357 +# If we don't find an include directive, just comment out the code.
5358 +AC_MSG_CHECKING([for style of include used by $am_make])
5359 +am__include="#"
5360 +am__quote=
5361 +_am_result=none
5362 +# First try GNU make style include.
5363 +echo "include confinc" > confmf
5364 +# We grep out `Entering directory' and `Leaving directory'
5365 +# messages which can occur if `w' ends up in MAKEFLAGS.
5366 +# In particular we don't look at `^make:' because GNU make might
5367 +# be invoked under some other name (usually "gmake"), in which
5368 +# case it prints its new name instead of `make'.
5369 +if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
5370 +   am__include=include
5371 +   am__quote=
5372 +   _am_result=GNU
5373 +fi
5374 +# Now try BSD make style include.
5375 +if test "$am__include" = "#"; then
5376 +   echo '.include "confinc"' > confmf
5377 +   if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
5378 +      am__include=.include
5379 +      am__quote="\""
5380 +      _am_result=BSD
5381 +   fi
5382 +fi
5383 +AC_SUBST([am__include])
5384 +AC_SUBST([am__quote])
5385 +AC_MSG_RESULT([$_am_result])
5386 +rm -f confinc confmf
5387 +])
5388 +
5389 +# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
5390 +
5391 +# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005
5392 +# Free Software Foundation, Inc.
5393 +#
5394 +# This file is free software; the Free Software Foundation
5395 +# gives unlimited permission to copy and/or distribute it,
5396 +# with or without modifications, as long as this notice is preserved.
5397 +
5398 +# serial 4
5399 +
5400 +# AM_MISSING_PROG(NAME, PROGRAM)
5401 +# ------------------------------
5402 +AC_DEFUN([AM_MISSING_PROG],
5403 +[AC_REQUIRE([AM_MISSING_HAS_RUN])
5404 +$1=${$1-"${am_missing_run}$2"}
5405 +AC_SUBST($1)])
5406 +
5407 +
5408 +# AM_MISSING_HAS_RUN
5409 +# ------------------
5410 +# Define MISSING if not defined so far and test if it supports --run.
5411 +# If it does, set am_missing_run to use it, otherwise, to nothing.
5412 +AC_DEFUN([AM_MISSING_HAS_RUN],
5413 +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
5414 +test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
5415 +# Use eval to expand $SHELL
5416 +if eval "$MISSING --run true"; then
5417 +  am_missing_run="$MISSING --run "
5418 +else
5419 +  am_missing_run=
5420 +  AC_MSG_WARN([`missing' script is too old or missing])
5421 +fi
5422 +])
5423 +
5424 +# Copyright (C) 2003, 2004, 2005  Free Software Foundation, Inc.
5425 +#
5426 +# This file is free software; the Free Software Foundation
5427 +# gives unlimited permission to copy and/or distribute it,
5428 +# with or without modifications, as long as this notice is preserved.
5429 +
5430 +# AM_PROG_MKDIR_P
5431 +# ---------------
5432 +# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise.
5433 +#
5434 +# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories
5435 +# created by `make install' are always world readable, even if the
5436 +# installer happens to have an overly restrictive umask (e.g. 077).
5437 +# This was a mistake.  There are at least two reasons why we must not
5438 +# use `-m 0755':
5439 +#   - it causes special bits like SGID to be ignored,
5440 +#   - it may be too restrictive (some setups expect 775 directories).
5441 +#
5442 +# Do not use -m 0755 and let people choose whatever they expect by
5443 +# setting umask.
5444 +#
5445 +# We cannot accept any implementation of `mkdir' that recognizes `-p'.
5446 +# Some implementations (such as Solaris 8's) are not thread-safe: if a
5447 +# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c'
5448 +# concurrently, both version can detect that a/ is missing, but only
5449 +# one can create it and the other will error out.  Consequently we
5450 +# restrict ourselves to GNU make (using the --version option ensures
5451 +# this.)
5452 +AC_DEFUN([AM_PROG_MKDIR_P],
5453 +[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
5454 +  # We used to keeping the `.' as first argument, in order to
5455 +  # allow $(mkdir_p) to be used without argument.  As in
5456 +  #   $(mkdir_p) $(somedir)
5457 +  # where $(somedir) is conditionally defined.  However this is wrong
5458 +  # for two reasons:
5459 +  #  1. if the package is installed by a user who cannot write `.'
5460 +  #     make install will fail,
5461 +  #  2. the above comment should most certainly read
5462 +  #     $(mkdir_p) $(DESTDIR)$(somedir)
5463 +  #     so it does not work when $(somedir) is undefined and
5464 +  #     $(DESTDIR) is not.
5465 +  #  To support the latter case, we have to write
5466 +  #     test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
5467 +  #  so the `.' trick is pointless.
5468 +  mkdir_p='mkdir -p --'
5469 +else
5470 +  # On NextStep and OpenStep, the `mkdir' command does not
5471 +  # recognize any option.  It will interpret all options as
5472 +  # directories to create, and then abort because `.' already
5473 +  # exists.
5474 +  for d in ./-p ./--version;
5475 +  do
5476 +    test -d $d && rmdir $d
5477 +  done
5478 +  # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
5479 +  if test -f "$ac_aux_dir/mkinstalldirs"; then
5480 +    mkdir_p='$(mkinstalldirs)'
5481 +  else
5482 +    mkdir_p='$(install_sh) -d'
5483 +  fi
5484 +fi
5485 +AC_SUBST([mkdir_p])])
5486 +
5487 +# Helper functions for option handling.                     -*- Autoconf -*-
5488 +
5489 +# Copyright (C) 2001, 2002, 2003, 2005  Free Software Foundation, Inc.
5490 +#
5491 +# This file is free software; the Free Software Foundation
5492 +# gives unlimited permission to copy and/or distribute it,
5493 +# with or without modifications, as long as this notice is preserved.
5494 +
5495 +# serial 3
5496 +
5497 +# _AM_MANGLE_OPTION(NAME)
5498 +# -----------------------
5499 +AC_DEFUN([_AM_MANGLE_OPTION],
5500 +[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
5501 +
5502 +# _AM_SET_OPTION(NAME)
5503 +# ------------------------------
5504 +# Set option NAME.  Presently that only means defining a flag for this option.
5505 +AC_DEFUN([_AM_SET_OPTION],
5506 +[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
5507 +
5508 +# _AM_SET_OPTIONS(OPTIONS)
5509 +# ----------------------------------
5510 +# OPTIONS is a space-separated list of Automake options.
5511 +AC_DEFUN([_AM_SET_OPTIONS],
5512 +[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
5513 +
5514 +# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
5515 +# -------------------------------------------
5516 +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
5517 +AC_DEFUN([_AM_IF_OPTION],
5518 +[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
5519 +
5520 +# Check to make sure that the build environment is sane.    -*- Autoconf -*-
5521 +
5522 +# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
5523 +# Free Software Foundation, Inc.
5524 +#
5525 +# This file is free software; the Free Software Foundation
5526 +# gives unlimited permission to copy and/or distribute it,
5527 +# with or without modifications, as long as this notice is preserved.
5528 +
5529 +# serial 4
5530 +
5531 +# AM_SANITY_CHECK
5532 +# ---------------
5533 +AC_DEFUN([AM_SANITY_CHECK],
5534 +[AC_MSG_CHECKING([whether build environment is sane])
5535 +# Just in case
5536 +sleep 1
5537 +echo timestamp > conftest.file
5538 +# Do `set' in a subshell so we don't clobber the current shell's
5539 +# arguments.  Must try -L first in case configure is actually a
5540 +# symlink; some systems play weird games with the mod time of symlinks
5541 +# (eg FreeBSD returns the mod time of the symlink's containing
5542 +# directory).
5543 +if (
5544 +   set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
5545 +   if test "$[*]" = "X"; then
5546 +      # -L didn't work.
5547 +      set X `ls -t $srcdir/configure conftest.file`
5548 +   fi
5549 +   rm -f conftest.file
5550 +   if test "$[*]" != "X $srcdir/configure conftest.file" \
5551 +      && test "$[*]" != "X conftest.file $srcdir/configure"; then
5552 +
5553 +      # If neither matched, then we have a broken ls.  This can happen
5554 +      # if, for instance, CONFIG_SHELL is bash and it inherits a
5555 +      # broken ls alias from the environment.  This has actually
5556 +      # happened.  Such a system could not be considered "sane".
5557 +      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
5558 +alias in your environment])
5559 +   fi
5560 +
5561 +   test "$[2]" = conftest.file
5562 +   )
5563 +then
5564 +   # Ok.
5565 +   :
5566 +else
5567 +   AC_MSG_ERROR([newly created file is older than distributed files!
5568 +Check your system clock])
5569 +fi
5570 +AC_MSG_RESULT(yes)])
5571 +
5572 +# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
5573 +#
5574 +# This file is free software; the Free Software Foundation
5575 +# gives unlimited permission to copy and/or distribute it,
5576 +# with or without modifications, as long as this notice is preserved.
5577 +
5578 +# AM_PROG_INSTALL_STRIP
5579 +# ---------------------
5580 +# One issue with vendor `install' (even GNU) is that you can't
5581 +# specify the program used to strip binaries.  This is especially
5582 +# annoying in cross-compiling environments, where the build's strip
5583 +# is unlikely to handle the host's binaries.
5584 +# Fortunately install-sh will honor a STRIPPROG variable, so we
5585 +# always use install-sh in `make install-strip', and initialize
5586 +# STRIPPROG with the value of the STRIP variable (set by the user).
5587 +AC_DEFUN([AM_PROG_INSTALL_STRIP],
5588 +[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
5589 +# Installed binaries are usually stripped using `strip' when the user
5590 +# run `make install-strip'.  However `strip' might not be the right
5591 +# tool to use in cross-compilation environments, therefore Automake
5592 +# will honor the `STRIP' environment variable to overrule this program.
5593 +dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
5594 +if test "$cross_compiling" != no; then
5595 +  AC_CHECK_TOOL([STRIP], [strip], :)
5596 +fi
5597 +INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
5598 +AC_SUBST([INSTALL_STRIP_PROGRAM])])
5599 +
5600 +# Check how to create a tarball.                            -*- Autoconf -*-
5601 +
5602 +# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
5603 +#
5604 +# This file is free software; the Free Software Foundation
5605 +# gives unlimited permission to copy and/or distribute it,
5606 +# with or without modifications, as long as this notice is preserved.
5607 +
5608 +# serial 2
5609 +
5610 +# _AM_PROG_TAR(FORMAT)
5611 +# --------------------
5612 +# Check how to create a tarball in format FORMAT.
5613 +# FORMAT should be one of `v7', `ustar', or `pax'.
5614 +#
5615 +# Substitute a variable $(am__tar) that is a command
5616 +# writing to stdout a FORMAT-tarball containing the directory
5617 +# $tardir.
5618 +#     tardir=directory && $(am__tar) > result.tar
5619 +#
5620 +# Substitute a variable $(am__untar) that extract such
5621 +# a tarball read from stdin.
5622 +#     $(am__untar) < result.tar
5623 +AC_DEFUN([_AM_PROG_TAR],
5624 +[# Always define AMTAR for backward compatibility.
5625 +AM_MISSING_PROG([AMTAR], [tar])
5626 +m4_if([$1], [v7],
5627 +     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
5628 +     [m4_case([$1], [ustar],, [pax],,
5629 +              [m4_fatal([Unknown tar format])])
5630 +AC_MSG_CHECKING([how to create a $1 tar archive])
5631 +# Loop over all known methods to create a tar archive until one works.
5632 +_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
5633 +_am_tools=${am_cv_prog_tar_$1-$_am_tools}
5634 +# Do not fold the above two line into one, because Tru64 sh and
5635 +# Solaris sh will not grok spaces in the rhs of `-'.
5636 +for _am_tool in $_am_tools
5637 +do
5638 +  case $_am_tool in
5639 +  gnutar)
5640 +    for _am_tar in tar gnutar gtar;
5641 +    do
5642 +      AM_RUN_LOG([$_am_tar --version]) && break
5643 +    done
5644 +    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
5645 +    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
5646 +    am__untar="$_am_tar -xf -"
5647 +    ;;
5648 +  plaintar)
5649 +    # Must skip GNU tar: if it does not support --format= it doesn't create
5650 +    # ustar tarball either.
5651 +    (tar --version) >/dev/null 2>&1 && continue
5652 +    am__tar='tar chf - "$$tardir"'
5653 +    am__tar_='tar chf - "$tardir"'
5654 +    am__untar='tar xf -'
5655 +    ;;
5656 +  pax)
5657 +    am__tar='pax -L -x $1 -w "$$tardir"'
5658 +    am__tar_='pax -L -x $1 -w "$tardir"'
5659 +    am__untar='pax -r'
5660 +    ;;
5661 +  cpio)
5662 +    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
5663 +    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
5664 +    am__untar='cpio -i -H $1 -d'
5665 +    ;;
5666 +  none)
5667 +    am__tar=false
5668 +    am__tar_=false
5669 +    am__untar=false
5670 +    ;;
5671 +  esac
5672 +
5673 +  # If the value was cached, stop now.  We just wanted to have am__tar
5674 +  # and am__untar set.
5675 +  test -n "${am_cv_prog_tar_$1}" && break
5676 +
5677 +  # tar/untar a dummy directory, and stop if the command works
5678 +  rm -rf conftest.dir
5679 +  mkdir conftest.dir
5680 +  echo GrepMe > conftest.dir/file
5681 +  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
5682 +  rm -rf conftest.dir
5683 +  if test -s conftest.tar; then
5684 +    AM_RUN_LOG([$am__untar <conftest.tar])
5685 +    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
5686 +  fi
5687 +done
5688 +rm -rf conftest.dir
5689 +
5690 +AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
5691 +AC_MSG_RESULT([$am_cv_prog_tar_$1])])
5692 +AC_SUBST([am__tar])
5693 +AC_SUBST([am__untar])
5694 +]) # _AM_PROG_TAR
5695 +
5696 +m4_include([../../../../aclocal/bsp-configure.m4])
5697 +m4_include([../../../../aclocal/canonical-target-name.m4])
5698 +m4_include([../../../../aclocal/canonicalize-tools.m4])
5699 +m4_include([../../../../aclocal/check-custom-bsp.m4])
5700 +m4_include([../../../../aclocal/check-multiprocessing.m4])
5701 +m4_include([../../../../aclocal/check-tool.m4])
5702 +m4_include([../../../../aclocal/enable-multiprocessing.m4])
5703 +m4_include([../../../../aclocal/env-rtemsbsp.m4])
5704 +m4_include([../../../../aclocal/gcc-isystem.m4])
5705 +m4_include([../../../../aclocal/gcc-pipe.m4])
5706 +m4_include([../../../../aclocal/gcc-specs.m4])
5707 +m4_include([../../../../aclocal/multilib.m4])
5708 +m4_include([../../../../aclocal/prog-cc.m4])
5709 +m4_include([../../../../aclocal/prog-ccas.m4])
5710 +m4_include([../../../../aclocal/project-root.m4])
5711 +m4_include([../../../../aclocal/rtems-top.m4])
5712 +m4_include([../../../../aclocal/version.m4])
5713 Index: rtems-051009/c/src/lib/libbsp/m68k/mo376/wrapup/.keep
5714 ===================================================================
5715 --- /dev/null
5716 +++ rtems/c/src/lib/libbsp/m68k/mo376/wrapup/.keep
5717 @@ -0,0 +1 @@
5718 +