1 Index: rtems/make/custom/mo376.cfg
2 ===================================================================
4 +++ rtems/make/custom/mo376.cfg
7 +# Config file for the mrm332 BSP
9 +# $Id: mrm332.cfg,v 1.8 2004/02/04 16:50:30 ralf Exp $
12 +include $(RTEMS_ROOT)/make/custom/default.cfg
15 +RTEMS_CPU_MODEL=m68332
17 +# This is the actual bsp directory used during the build process.
18 +RTEMS_BSP_FAMILY=mrm332
20 +# This contains the compiler options necessary to select the CPU model
21 +# and (hopefully) optimize for it.
24 +# optimize flag: typically -0, could use -O4 or -fast, -O4 is ok for RTEMS
25 +CFLAGS_OPTIMIZE_V=-O4 -fomit-frame-pointer
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.
31 +ifeq ($(MRM_IN_ROM),yes)
32 +# Build a rommable image - move the .data section after the .text section
34 +CPU_CFLAGS += -qnolinkcmds -T $(exec_prefix)/mrm332/lib/linkcmds_ROM
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
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 );\
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
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
73 +# Miscellaneous additions go here
74 Index: rtems/c/src/lib/libbsp/m68k/mo376/console/sci.h
75 ===================================================================
77 +++ rtems/c/src/lib/libbsp/m68k/mo376/console/sci.h
79 +/****************************************************************************
82 +* Desc: This is the include file for the serial communications interface.
84 +* Note: See bsp.h,confdefs.h,system.h for installing drivers into RTEMS.
86 +* $Id: sci.h,v 1.4 2004/04/21 16:01:35 ralf Exp $
87 +****************************************************************************/
92 +/*******************************************************************************
93 + IOCTL commands for the sci driver.
94 + I'm still working on these...
95 +*******************************************************************************/
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
105 +#define SCI_IOCTL_BAUD_RATE 0x20 // set the baud rate, arg is baud
107 +#define SCI_IOCTL_DATA_BITS 0x30 // set the data bits, arg is # bits
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
112 +#define SCI_IOCTL_MODE_NORMAL 0x50 // normal operating mode
113 +#define SCI_IOCTL_MODE_LOOP 0x51 // internal loopback mode
115 +#define SCI_IOCTL_FLOW_NONE 0x60 // no flow control
116 +#define SCI_IOCTL_FLOW_RTS_CTS 0x61 // hardware flow control
118 +#define SCI_IOCTL_SEND_BREAK 0x70 // send an rs-232 break
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
125 +/*******************************************************************************
127 +*******************************************************************************/
129 +// SCI Control Register 0 (SCCR0) $FFFC08
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
144 +// | | | | | | | +------------------------- 8 baud rate divisor
145 +// | | | | | | +--------------------------- 9 baud rate divisor
146 +// | | | | | +----------------------------- 10 baud rate divisor
147 +// | | | | +------------------------------- 11 baud rate divisor
149 +// | | | +----------------------------------- 12 baud rate divisor
150 +// | | +------------------------------------- 13 unused
151 +// | +--------------------------------------- 14 unused
152 +// +----------------------------------------- 15 unused
154 +// 0 0 0 0 - 0 0 0 0 - 0 0 0 0 - 0 1 0 0 reset value - (64k baud?)
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
165 +// SCI Control Register 1 (SCCR1) $FFFC0A
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
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
185 +// | | | +----------------------------------- 12 idle line select
186 +// | | +------------------------------------- 13 wired-or mode
187 +// | +--------------------------------------- 14 loop mode
188 +// +----------------------------------------- 15 unused
190 +// 0 0 0 0 - 0 0 0 0 - 0 0 0 0 - 0 0 0 0 reset value
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
197 +#define SCI_DISABLE_RCVR 0xFFFB // 1111-1111-1111-1011
198 +#define SCI_DISABLE_XMTR 0xFFF7 // 1111-1111-1111-0111
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
205 +#define SCI_DISABLE_INT_ALL 0xFF00 // 1111-1111-0000-0000 ???
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
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
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
222 +#define SCI_PARITY_NONE 0xF3FF // 1111-0011-1111-1111
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
230 +// SCI Status Register (SCSR) $FFFC0C
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
245 +// | | | | | | | +------------------------- 8 TDRE - xmt data reg empty
246 +// | | | | | | +--------------------------- 9 always zero
247 +// | | | | | +----------------------------- 10 always zero
248 +// | | | | +------------------------------- 11 always zero
250 +// | | | +----------------------------------- 12 always zero
251 +// | | +------------------------------------- 13 always zero
252 +// | +--------------------------------------- 14 always zero
253 +// +----------------------------------------- 15 always zero
255 +// 0 0 0 0 - 0 0 0 1 - 1 0 0 0 - 0 0 0 0 reset value
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
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
267 +#define SCI_CLEAR_RX_INT 0xFFBF // 1111-1111-1011-1111
269 +#define SCI_XMTR_READY 0x0100 // 0000-0001-0000-0000
271 +#define SCI_CLEAR_TDRE 0xFEFF // 1111-1110-1111-1111
273 +#define SCI_XMTR_AVAILABLE 0x0180 // 0000-0001-1000-0000
277 +/*******************************************************************************
278 + Function prototypes
279 +*******************************************************************************/
285 +// look at console_open to see how this is called
287 +const rtems_termios_callbacks * SciGetTermiosHandlers( int32_t polled );
291 +//rtems_isr SciIsr( rtems_vector_number vector );
293 +//int32_t SciOpenPolled ( int32_t major, int32_t minor, void *arg );
294 +//int32_t SciOpenInterrupt ( int32_t major, int32_t minor, void *arg );
296 +//int32_t SciClose ( int32_t major, int32_t minor, void *arg );
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 );
301 +//int32_t SciReadPolled ( int32_t minor );
303 +//int32_t SciSetAttributes ( int32_t minor, const struct termios *t );
310 Index: rtems/c/src/lib/libbsp/m68k/mo376/startup/linkcmds_ROM
311 ===================================================================
313 +++ rtems/c/src/lib/libbsp/m68k/mo376/startup/linkcmds_ROM
317 + * $Id: linkcmds_ROM,v 1.4 2006/02/08 12:25:24 joel Exp $
321 +STARTUP(except_vect_332_ROM.o)
326 + * +--------------------+ <- low memory
329 + * | ctor list | the ctor and dtor lists are for
330 + * | dtor list | C++ support
332 + * | temporary .data | .data is moved to RAM by crt0
334 + * +--------------------+ <- high memory
338 + * +--------------------+ <- low memory
339 + * | .data | initialized data goes here
342 + * +--------------------+
344 + * | __bss_start | start of bss, cleared by crt0
345 + * | _end | start of heap, used by sbrk()
346 + * +--------------------+
350 + * | __stack | top of stack
351 + * +--------------------+ <- high memory
356 + rom : ORIGIN = 0x90000, LENGTH = 0x70000
357 + ram : ORIGIN = 0x03000, LENGTH = 0x7d000
360 +_RamBase = DEFINED(_RamBase) ? _RamBase : 0x003000;
361 +_RamSize = DEFINED(_RamSize) ? _RamSize : 0x7d000;
362 +_RamEnd = _RamBase + _RamSize;
364 +__end_of_ram = 0x080000;
365 +_copy_data_from_rom = 1;
366 +_HeapSize = DEFINED(_HeapSize) ? _HeapSize : 0x10000;
367 +_StackSize = DEFINED(_StackSize) ? _StackSize : 0x2000;
377 + CREATE_OBJECT_SYMBOLS
385 + * Initialization and finalization code.
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
399 + PROVIDE (_init = .);
403 + PROVIDE (_fini = .);
409 + * Special FreeBSD sysctl sections.
412 + __start_set_sysctl_set = .;
414 + __stop_set_sysctl_set = ABSOLUTE(.);
419 + * C++ constructors/destructors
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.
431 + *crtbegin.o(.ctors)
434 + *crtbegin.o(.dtors)
445 + _rodata_start = . ;
447 + *(.gnu.linkonce.r*)
449 + etext = ALIGN(0x10);
451 + LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2)
456 + LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2)
466 + AT ( ADDR(.text) + SIZEOF( .text ) )
477 + *(.gnu.linkonce.d*)
478 + *(.gcc_except_table)
482 + edata = ALIGN(0x10);
491 + __bss_start = ALIGN(0x8);
497 + *(.bss* .gnu.linkonce.b.*)
502 + __end = ALIGN(0x8);
504 + _WorkspaceBase = . + _StackSize;
510 + .stabstr . (NOLOAD) :
515 Index: rtems/c/src/lib/libbsp/m68k/mo376/startup/except_vect_332_ROM.S
516 ===================================================================
518 +++ rtems/c/src/lib/libbsp/m68k/mo376/startup/except_vect_332_ROM.S
521 + * $Id: except_vect_332_ROM.S,v 1.3 2004/04/21 16:01:35 ralf Exp $
524 +/* Exception Vector definitions follow */
526 + /* !!! Warning !!! This table is not tested, and
527 + the user must make sure it is complete. */
529 + /* If we use TRAP #15 for reboot, note that group 0 and 1 exceptions
530 + will have priority. */
532 + /* This is the "magic word" that CPU32bug uses to indicate that
533 + there is a bootable image here. */
536 + /* Vector 0: RESET: Initial SSP */
538 + /* Vector 1: RESET: Initial PC */
541 + /* default action for undefined vectors is to re-boot */
543 + /* Note group 0 and 1 exception (like trace) have priority
544 + over other exceptions (like trap #15) that may call this. */
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 */
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 */
809 + trap #15 /* use trap exception to enter supervisor
810 + state. Trace mode ( and other group 0
811 + and 1 exceptions) *could* screw this up if
812 + not vectored to reboot or did not return. */
813 Index: rtems/c/src/lib/libbsp/m68k/mo376/console/console.c
814 ===================================================================
816 +++ rtems/c/src/lib/libbsp/m68k/mo376/console/console.c
819 + * This file contains the generic console driver shell used
820 + * by all console drivers using libchip.
822 + * This driver uses the termios pseudo driver.
824 + * COPYRIGHT (c) 1989-1997.
825 + * On-Line Applications Research Corporation (OAR).
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.
831 + * $Id: console.c,v 1.7 2004/04/21 16:01:35 ralf Exp $
835 +#include <rtems/libio.h>
836 +#include <termios.h>
838 +//#include "../../../../../../rtems/c/src/lib/libbsp/m68k/opti/console/duart.h"
839 +//#include "../../../../../../rtems/c/src/lib/libc/libio_.h"
845 + * open a port as a termios console.
847 + * the console is opened in bsp_postdriver_hook() in bsppost.c
851 +rtems_device_driver console_open(
852 + rtems_device_major_number major,
853 + rtems_device_minor_number minor,
857 + rtems_status_code status;
859 + /* the console is opened three times at startup */
860 + /* for standard input, output, and error */
862 + /* Get correct callback structure for the device */
864 + /* argument of FALSE gives us interrupt driven serial io */
865 + /* argument of TRUE gives us polling based serial io */
867 + /* SCI internal uart */
869 + status = rtems_termios_open( major, minor, arg, SciGetTermiosHandlers( TRUE ) );
878 + * This routine closes a port that has been opened as console.
881 +rtems_device_driver console_close(
882 + rtems_device_major_number major,
883 + rtems_device_minor_number minor,
887 + return rtems_termios_close (arg);
894 + * This routine uses the termios driver to read a character.
897 +rtems_device_driver console_read(
898 + rtems_device_major_number major,
899 + rtems_device_minor_number minor,
903 + return rtems_termios_read (arg);
910 + * this routine uses the termios driver to write a character.
913 +rtems_device_driver console_write(
914 + rtems_device_major_number major,
915 + rtems_device_minor_number minor,
919 + return rtems_termios_write (arg);
926 + * this routine uses the termios driver to process io
929 +rtems_device_driver console_control(
930 + rtems_device_major_number major,
931 + rtems_device_minor_number minor,
935 + return rtems_termios_ioctl (arg);
940 + * console_initialize
942 + * Routine called to initialize the console device driver.
945 +rtems_device_driver console_initialize(
946 + rtems_device_major_number major,
947 + rtems_device_minor_number minor_arg,
951 + rtems_status_code status;
954 + * initialize the termio interface.
956 + rtems_termios_initialize();
959 + * register the SCI device name for termios
960 + * do this over in the sci driver init routine?
963 + status = rtems_io_register_name( "/dev/sci", major, 0 );
965 + if (status != RTEMS_SUCCESSFUL)
967 + rtems_fatal_error_occurred(status);
971 + * Link the uart device to the console device
975 + status = rtems_io_register_name( "/dev/console", major, 0 );
977 + if (status != RTEMS_SUCCESSFUL)
979 + rtems_fatal_error_occurred(status);
982 + if ( link( "/dev/sci", "/dev/console") < 0 )
984 + rtems_fatal_error_occurred( RTEMS_IO_ERROR );
989 + * Console Initialize Succesful
992 + return RTEMS_SUCCESSFUL;
994 Index: rtems/c/src/lib/libbsp/m68k/mo376/.cvsignore
995 ===================================================================
997 +++ rtems/c/src/lib/libbsp/m68k/mo376/.cvsignore
1013 Index: rtems/c/src/lib/libbsp/m68k/mo376/start/start.S
1014 ===================================================================
1016 +++ rtems/c/src/lib/libbsp/m68k/mo376/start/start.S
1022 +#include "mrm332.h"
1023 +#include <rtems/asm.h>
1024 +#include <rtems/m68k/sim.h>
1028 + /* Put the header necessary for the modified CPU32bug to automatically
1029 + start up rtems: */
1041 + addl #_StackSize,d0
1045 + /* include in ram_init.S */
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.
1052 + /* Module Configuration Register */
1053 + /* see section(s) 3.1.3-3.1.6 of the SIM Reference Manual */
1056 + oriw #SAM(0,8,SHEN),d0
1057 + oriw #(MM*SIM_MM),d0
1058 + oriw #SAM(SIM_IARB,0,IARB),d0
1061 + jsr start_c /* Jump to the C startup code */
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) );
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 );
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. */
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 */
1095 + /* load values before enabled */
1096 + *PORTC = (unsigned char) 0x0;
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;
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;
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;
1113 + /* end of SIM initalization code */
1114 + /* end include in ram_init.S */
1117 + * Initialize RAM by copying the .data section out of ROM (if
1118 + * needed) and "zero-ing" the .bss section.
1121 + register char *src = _etext;
1122 + register char *dst = _copy_start;
1124 + if (_copy_data_from_rom)
1125 + /* ROM has data at end of text; copy it. */
1126 + while (dst < _edata)
1130 + for (dst = _clear_start; dst< end; dst++)
1137 + * Initialize vector table.
1140 + m68k_isr_entry *monitors_vector_table;
1142 + m68k_get_vbr(monitors_vector_table);
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 */
1150 + m68k_set_vbr(&M68Kvec);
1154 + * Initalize the board.
1156 + Spurious_Initialize();
1160 + * Execute main with arguments argc and agrv.
1162 + boot_card(1,__argv);
1168 Index: rtems/c/src/lib/libbsp/m68k/mo376/misc/dotests
1169 ===================================================================
1171 +++ rtems/c/src/lib/libbsp/m68k/mo376/misc/dotests
1175 +# $Id: dotests,v 1.1 2001/05/25 16:28:46 joel Exp $
1179 +find -name MyTests -prune -or -name "*.nxe" -exec cp {} MyTests \;
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 &
1185 +( cd MyTests; for f in *nxe; do m68k-elf-gdb ${f} </dev/null; done )
1188 Index: rtems/c/src/lib/libbsp/m68k/mo376/include/bsp.h
1189 ===================================================================
1191 +++ rtems/c/src/lib/libbsp/m68k/mo376/include/bsp.h
1195 + * This include file contains all mrm board IO definitions.
1197 + * COPYRIGHT (c) 1989-1999.
1198 + * On-Line Applications Research Corporation (OAR).
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.
1204 + * $Id: bsp.h,v 1.13 2005/05/26 05:31:17 ralf Exp $
1214 +#include <bspopts.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>
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.
1231 +#define CONSOLE_SCI
1232 +/* #define CONFIGURE_NUMBER_OF_TERMIOS_PORTS 2 */
1233 +/* #define CONFIGURE_INTERRUPT_STACK_MEMORY (TBD * 1024) */
1236 + * Simple spin delay in microsecond units for device drivers.
1237 + * This is very dependent on the clock speed of the target.
1240 +#define rtems_bsp_delay( microseconds ) \
1241 + { register uint32_t _delay=(microseconds); \
1242 + register uint32_t _tmp=123; \
1243 + asm volatile( "0: \
1247 + : "=d" (_tmp), "=d" (_delay) \
1248 + : "0" (_tmp), "1" (_delay) ); \
1253 +extern char _etext[];
1254 +extern char _copy_start[];
1255 +extern char _edata[];
1256 +extern char _clear_start[];
1258 +extern char _copy_data_from_rom[];
1263 +#define STACK_SIZE "#0x800"
1265 +#define STACK_SIZE 0x800
1270 +#define RAW_PUTS(str) \
1271 + { register char *ptr = str; \
1272 + while (*ptr) SCI_output_char(*ptr++); \
1275 +#define RAW_PUTI(n) { \
1276 + register int i, j; \
1279 + for (i=28;i>=0;i -= 4) { \
1280 + j = (n>>i) & 0xf; \
1281 + SCI_output_char( (j>9 ? j-10+'a' : j+'0') ); \
1285 +/* miscellaneous stuff assumed to exist */
1287 +extern rtems_configuration_table BSP_Configuration;
1289 +extern m68k_isr_entry M68Kvec[]; /* vector table address */
1291 +extern int stack_size;
1293 +extern int stack_start;
1296 + * Device Driver Table Entries
1300 + * NOTE: Use the standard Console driver entry
1304 + * NOTE: Use the standard Clock driver entry
1309 +void bsp_cleanup( void );
1311 +m68k_isr_entry set_vector(
1312 + rtems_isr_entry handler,
1313 + rtems_vector_number vector,
1317 +void console_init(void);
1319 +void Spurious_Initialize(void);
1321 +void _UART_flush(void);
1323 +void Clock_exit(void);
1325 +void outbyte(char);
1332 +/* end of include file */
1333 Index: rtems/c/src/lib/libbsp/m68k/mo376/misc/interr.c
1334 ===================================================================
1336 +++ rtems/c/src/lib/libbsp/m68k/mo376/misc/interr.c
1339 + * Internal Error Handler
1341 + * COPYRIGHT (c) 1989-1999.
1342 + * On-Line Applications Research Corporation (OAR).
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.
1348 + * $Id: interr.c,v 1.3 2004/03/31 04:37:05 ralf Exp $
1351 +#include <rtems/system.h>
1352 +#include <rtems/score/interr.h>
1353 +#include <rtems/score/sysstate.h>
1354 +#include <rtems/score/userext.h>
1358 + * _Internal_error_Occurred
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.
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
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.
1376 + * NOTE: The the_error is not necessarily a directive status code.
1380 + * Ugly hack.... _CPU_Fatal_halt() disonnects the bdm. Without this
1381 + * change, the_error is only known only to the cpu :).
1383 + * From "bsp.h" which is not yet available in the arch tree during
1384 + * this phase of install. jsg
1386 +void outbyte(char);
1387 +void bsp_cleanup( void );
1389 +#define RAW_PUTS(str) \
1390 + { register char *ptr = str; \
1391 + while (*ptr) outbyte(*ptr++); \
1394 +#define RAW_PUTI(n) { \
1395 + register int i, j; \
1398 + for (i=28;i>=0;i -= 4) { \
1399 + j = (n>>i) & 0xf; \
1400 + outbyte( (j>9 ? j-10+'a' : j+'0') ); \
1404 +void volatile _Internal_error_Occurred(
1405 + Internal_errors_Source the_source,
1406 + boolean is_internal,
1407 + uint32_t the_error
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;
1415 + _User_extensions_Fatal( the_source, is_internal, the_error );
1417 + _System_state_Set( SYSTEM_STATE_FAILED );
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 );
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");
1430 + /* configure peripherals for a safe exit */
1433 + _CPU_Fatal_halt( the_error );
1435 + /* will not return from this routine */
1437 Index: rtems/c/src/lib/libbsp/m68k/mo376/ChangeLog
1438 ===================================================================
1440 +++ rtems/c/src/lib/libbsp/m68k/mo376/ChangeLog
1442 +2006-02-08 Joel Sherrill <joel@OARcorp.com>
1444 + * startup/linkcmds, startup/linkcmds_ROM: Add sections required by
1445 + newer gcc versions.
1447 +2006-01-11 Ralf Corsepius <ralf.corsepius@rtems.org>
1449 + * Makefile.am: Add preinstall.am.
1451 +2005-05-26 Ralf Corsepius <ralf.corsepius@rtems.org>
1453 + * include/bsp.h: New header guard.
1455 +2005-01-07 Ralf Corsepius <ralf.corsepius@rtems.org>
1457 + * Makefile.am: Eliminate CFLAGS_OPTIMIZE_V.
1459 +2005-01-05 Ralf Corsepius <ralf.corsepius@rtems.org>
1461 + * console/sci.c: Remove CVS Log.
1463 +2005-01-04 Joel Sherrill <joel@OARcorp.com>
1465 + * console/sci.c: Remove warnings.
1467 +2005-01-02 Ralf Corsepius <ralf.corsepius@rtems.org>
1469 + * Makefile.am: Remove build-variant support.
1471 +2004-11-25 Joel Sherrill <joel@OARcorp.com>
1473 + * startup/linkcmds, startup/linkcmds_ROM: Add new bss sections .bss.*
1474 + and .gnu.linkonce.b*.
1476 +2004-09-24 Ralf Corsepius <ralf_corsepius@rtems.org>
1478 + * configure.ac: Require automake > 1.9.
1480 +2004-04-23 Ralf Corsepius <ralf_corsepius@rtems.org>
1483 + * Makefile.am: Add include/tm27.h, Cosmetics.
1484 + * include/tm27.h: Final cosmetics.
1486 +2004-04-22 Ralf Corsepius <ralf_corsepius@rtems.org>
1488 + * include/bsp.h: Split out tmtest27 support.
1489 + * include/tm27.h: New.
1491 +2004-04-21 Ralf Corsepius <ralf_corsepius@rtems.org>
1494 + * include/bsp.h: Remove MAX_LONG_TEST_DURATION.
1496 +2004-04-21 Ralf Corsepius <ralf_corsepius@rtems.org>
1499 + * include/bsp.h: Remove MAX_SHORT_TEST_DURATION (Unused).
1501 +2004-04-03 Ralf Corsepiu <ralf_corsepiu@rtems.org>
1503 + * c/src/lib/libbsp/m68k/mrm332/include/bsp.h,
1504 + c/src/lib/libbsp/m68k/mrm332/start/start.S,
1505 + c/src/lib/libbsp/m68k/mrm332/startup/start_c.c: Include
1506 + <rtems/m68k/sim.h> instead of <sim.h>.
1507 + * c/src/lib/libbsp/m68k/mrm332/include/bsp.h: Include
1508 + <rtems/m68k/qsm.h> instead of <qsm.h>.
1510 +2004-04-02 Ralf Corsepius <ralf_corsepius@rtems.org>
1512 + * start/start.S: Include <rtems/asm.h> instead of <asm.h>.
1514 +2004-04-01 Ralf Corsepius <ralf_corsepius@rtems.org>
1516 + * include/bsp.h: Include <rtems/clockdrv.h> instead of <clockdrv.h>.
1517 + * include/bsp.h: Include <rtems/console.h> instead of <console.h>.
1518 + * include/bsp.h: Include <rtems/iosupp.h> instead of <iosupp.h>.
1520 +2004-03-31 Ralf Corsepius <ralf_corsepius@rtems.org>
1522 + * clock/ckinit.c, console/sci.c, console/sci.h, include/bsp.h,
1523 + misc/interr.c, startup/bspstart.c, timer/timer.c: Convert to using
1524 + c99 fixed size types.
1526 +2004-02-19 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1528 + * Makefile.am: Reflect changes to bsp.am.
1529 + Preinstall dist_project_lib*.
1531 +2004-02-14 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1533 + * Makefile.am: Reflect changes to bsp.am.
1535 +2004-02-12 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1537 + * Makefile.am: Use CPPASCOMPILE instead of CCASCOMPILE.
1539 +2004-02-06 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1541 + * Makefile.am: Pickup files from ../../m68k/shared instead of
1542 + ../shared. Reformat.
1544 +2004-01-28 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1546 + * configure.ac: Add nostdinc to AUTOMAKE_OPTIONS.
1548 +2004-01-28 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1550 + * Makefile.am: Don't include subdirs.am.
1552 +2004-01-28 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1554 + * Makefile.am: Fix typo.
1556 +2004-01-28 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1558 + * Makefile.am: Merge-in clock/Makefile.am, console/Makefile.am,
1559 + spurious/Makefile.am, startup/Makefile.am, timer/Makefile.am,
1560 + wrapup/Makefile.am.
1561 + Use automake compilation rules.
1562 + * clock/Makefile.am, console/Makefile.am, spurious/Makefile.am,
1563 + startup/Makefile.am, timer/Makefile.am, wrapup/Makefile.am:
1565 + * configure.ac: Reflect changes above.
1567 +2004-01-21 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1569 + * Makefile.am: Add PREINSTALL_DIRS.
1570 + * wrapup/Makefile.am: Reflect changes to libcpu.
1572 +2004-01-20 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1574 + * wrapup/Makefile.am: Reflect changes to libcpu.
1576 +2004-01-14 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1578 + * Makefile.am: Re-add dirstamps to PRE/TMPINSTALL_FILES.
1579 + Add PRE/TMPINSTALL_FILES to CLEANFILES.
1580 + * startup/Makefile.am: Ditto.
1582 +2004-01-07 Joel Sherrill <joel@OARcorp.com>
1584 + * times, console/sci.c: Remove efi68k and efi332 references as they are
1585 + no longer in the tree.
1587 +2004-01-07 Joel Sherrill <joel@OARcorp.com>
1589 + * timer/timer.c: Remove efi68k and efi332 references as they are no
1590 + longer in the tree.
1592 +2004-01-07 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1594 + * start/Makefile.am: Remove.
1595 + * Makefile.am: Merge-in start/Makefile.am.
1596 + * configure.ac: Reflect changes above.
1598 +2004-01-05 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1600 + * wrapup/Makefile.am: Eliminate $(LIB).
1601 + Use noinst_DATA to trigger building libbsp.a.
1603 +2003-12-13 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1605 + * start/Makefile.am: s,${PROJECT_RELEASE}/lib,$(PROJECT_LIB),g.
1606 + * startup/Makefile.am: s,${PROJECT_RELEASE}/lib,$(PROJECT_LIB),g.
1608 +2003-12-12 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1610 + * start/Makefile.am: Use mkdir_p. Remove dirs from PRE/TMPINSTALL_FILES.
1611 + * startup/Makefile.am: Use mkdir_p. Remove dirs from PRE/TMPINSTALL_FILES.
1613 +2003-12-12 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1615 + * configure.ac: Require automake >= 1.8, autoconf >= 2.59.
1617 +2003-12-10 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1619 + * start/Makefile.am: Misc cleanups and fixes.
1620 + * startup/Makefile.am: Misc cleanups and fixes.
1621 + * wrapup/Makefile.am: Misc cleanups and fixes.
1623 +2003-12-03 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1625 + * Makefile.am: Add preinstallation dirstamp support.
1626 + * clock/Makefile.am: Cosmetics.
1627 + * console/Makefile.am: Cosmetics.
1628 + * spurious/Makefile.am: Cosmetics.
1629 + * startup/Makefile.am: Cosmetics.
1630 + * timer/Makefile.am: Cosmetics.
1631 + * wrapup/Makefile.am: Cosmetics.
1633 +2003-12-02 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1635 + * clock/Makefile.am: Remove all-local: $(ARCH).
1636 + * console/Makefile.am: Remove all-local: $(ARCH).
1637 + * spurious/Makefile.am: Remove all-local: $(ARCH).
1638 + * start/Makefile.am: Remove all-local: $(ARCH).
1639 + * startup/Makefile.am: Remove all-local: $(ARCH).
1640 + * timer/Makefile.am: Remove all-local: $(ARCH).
1641 + * wrapup/Makefile.am: Remove all-local: $(ARCH).
1643 +2003-09-29 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1645 + * Makefile.am: Merge-in include/Makefile.am.
1646 + Reflect changes to bsp.am.
1647 + * include/Makefile.am: Remove.
1648 + * configure.ac: Reflect changes above.
1650 +2003-09-19 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1652 + * bsp_specs: Remove *lib:.
1654 +2003-09-15 Joel Sherrill <joel@OARcorp.com>
1657 + * startup/bspstart.c, startup/start_c.c: Spurious interrupt handlers
1658 + cannot be installed until RTEMS has initialized the vector table.
1660 +2003-09-04 Joel Sherrill <joel@OARcorp.com>
1662 + * clock/ckinit.c, console/console.c, include/bsp.h, misc/interr.c,
1663 + spurious/spinit.c, startup/bspclean.c, startup/bspstart.c,
1664 + timer/timer.c: URL for license changed.
1666 +2003-08-20 Joel Sherrill <joel@OARcorp.com>
1668 + * console/console.c: Correct copyright statements.
1670 +2003-08-18 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1672 + * Makefile.am: Reflect having moved aclocal/.
1674 +2003-08-16 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1676 + * Makefile.am: Reflect having moved automake/.
1677 + * clock/Makefile.am: Reflect having moved automake/.
1678 + * console/Makefile.am: Reflect having moved automake/.
1679 + * include/Makefile.am: Reflect having moved automake/.
1680 + * spurious/Makefile.am: Reflect having moved automake/.
1681 + * start/Makefile.am: Reflect having moved automake/.
1682 + * startup/Makefile.am: Reflect having moved automake/.
1683 + * timer/Makefile.am: Reflect having moved automake/.
1684 + * wrapup/Makefile.am: Reflect having moved automake/.
1686 +2003-08-11 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1689 + * startup/Makefile.am: Remove USE_INIT_FINI.
1691 +2003-08-11 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1693 + * configure.ac: Use rtems-bugs@rtems.com as bug report email address.
1695 +2003-08-06 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1698 + * bsp_specs: Remove -D__embedded__ -Asystem(embedded) from cpp.
1699 + Remove cpp, old_cpp (now unused).
1701 +2003-03-06 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1703 + * configure.ac: Remove AC_CONFIG_AUX_DIR.
1705 +2003-02-11 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1707 + * configure.ac: AM_INIT_AUTOMAKE([1.7.2]).
1709 +2003-02-11 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1711 + * configure.ac: AC_PREREQ(2.57).
1713 +2003-01-20 Duane Gustavus <duane@unt.edu>
1715 + * console/sci.c, include/mrm332.h, startup/linkcmds,
1716 + startup/linkcmds_ROM: Various updates to make this run properly
1719 +2002-12-20 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1721 + * clock/Makefile.am: Don't include @RTEMS_BSP@.cfg.
1722 + * console/Makefile.am: Don't include @RTEMS_BSP@.cfg.
1723 + * spurious/Makefile.am: Don't include @RTEMS_BSP@.cfg.
1724 + * start/Makefile.am: Don't include @RTEMS_BSP@.cfg.
1725 + * startup/Makefile.am: Don't include @RTEMS_BSP@.cfg.
1726 + * timer/Makefile.am: Don't include @RTEMS_BSP@.cfg.
1728 +2002-12-12 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1730 + * start/Makefile.am: Use install-data-local to install startfile.
1732 +2002-12-10 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1734 + * wrapup/Makefile.am: Don't include @RTEMS_BSP@.cfg.
1736 +2002-11-04 Joel Sherrill <joel@OARcorp.com>
1738 + * console/sci.c, spurious/spinit.c: Removed warnings.
1740 +2002-10-21 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1742 + * .cvsignore: Reformat.
1743 + Add autom4te*cache.
1744 + Remove autom4te.cache.
1746 +2002-09-08 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1748 + * Makefile.am: ACLOCAL_AMFLAGS = -I ../../../../../../aclocal.
1750 +2002-08-21 Joel Sherrill <joel@OARcorp.com>
1752 + * wrapup/Makefile.am: PR217 required that the idle task be moved to
1753 + libcpu so it could be more acutely aware of the CPU model. This
1754 + file was modified to pick up the idle task from there.
1756 +2002-08-21 Joel Sherrill <joel@OARcorp.com>
1758 + * bsp_specs: Added support for -nostdlibs.
1760 +2002-08-11 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1762 + * clock/Makefile.am: Use .$(OBJEXT) instead of .o.
1763 + * console/Makefile.am: Use .$(OBJEXT) instead of .o.
1764 + * spurious/Makefile.am: Use .$(OBJEXT) instead of .o.
1765 + * start/Makefile.am: Use .$(OBJEXT) instead of .o.
1766 + * startup/Makefile.am: Use .$(OBJEXT) instead of .o.
1767 + * timer/Makefile.am: Use .$(OBJEXT) instead of .o.
1768 + * wrapup/Makefile.am: Use .$(OBJEXT) instead of .o.
1770 +2002-08-05 Joel Sherrill <joel@OARcorp.com>
1772 + * Per PR260 eliminate use of make-target-options. This impacted
1773 + RTEMS allowing a distinction between the CPU32 and CPU32+ in the
1774 + SuperCore and required that the m68k optimized memcpy be moved
1776 + * wrapup/Makefile.am: Pick up memcpy.o from libcpu.
1778 +2002-07-21 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1780 + * start/Makefile.am: Eliminate PGM.
1781 + Add bsplib_DATA = $(PROJECT_RELEASE)/lib/start$(LIB_VARIANT).o.
1783 +2002-07-19 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1785 + * startup/Makefile.am: Add bsplib_DATA = linkcmds linkcmds_ROM.
1787 +2002-07-04 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1789 + * wrapup/Makefile.am: Eliminate TMPINSTALL_FILES.
1790 + Remove $(OBJS) from all-local.
1792 +2002-06-29 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1794 + * wrapup/Makefile.am: Remove preinstallation of libbsp.a,
1796 +2001-05-09 Joel Sherrill <joel@OARcorp.com>
1798 + * startup/linkcmds: In support of gcc 3.1, added one of more
1799 + of the sections .jcr, .rodata*, .data.*, .gnu.linkonce.s2.*,
1800 + .gnu.linkonce.sb2.*, and .gnu.linkonce.s.*. Spacing corrections
1801 + and direction of segments to memory regions may also have been
1802 + addressed. This was a sweep across all BSPs.
1804 +2002-03-27 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1807 + AC_INIT(package,_RTEMS_VERSION,_RTEMS_BUGS).
1808 + AM_INIT_AUTOMAKE([no-define foreign 1.6]).
1809 + * clock/Makefile.am: Remove AUTOMAKE_OPTIONS.
1810 + * Makefile.am: Remove AUTOMAKE_OPTIONS.
1811 + * console/Makefile.am: Remove AUTOMAKE_OPTIONS.
1812 + * include/Makefile.am: Remove AUTOMAKE_OPTIONS.
1813 + * spurious/Makefile.am: Remove AUTOMAKE_OPTIONS.
1814 + * start/Makefile.am: Remove AUTOMAKE_OPTIONS.
1815 + * startup/Makefile.am: Remove AUTOMAKE_OPTIONS.
1816 + * timer/Makefile.am: Remove AUTOMAKE_OPTIONS.
1817 + * wrapup/Makefile.am: Remove AUTOMAKE_OPTIONS.
1819 +2002-02-28 Mike Panetta <ahuitzot@mindspring.com>
1821 + * console/sci.c, console/sci.h,
1822 + console/console.c: Added new SCI driver.
1823 + * start/start.c: Removed file.
1824 + * start/start.S: New file, the asm portion of the updated start code.
1825 + * start/configure.am: Added start.S, removed start.c
1826 + * startup/start_c.c: New file, the C portion of the updated start code. Contains most of the code that was in the old start.c.
1827 + * startup/configure.am: Added start_c.c to C_FILES.
1828 + * include/bsp.h: Added include <rtems/bspIo.h>
1830 +2001-11-30 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1832 + * configure.ac: Introduce RTEMS_BSP_CONFIGURE.
1834 +2001-10-11 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1836 + * .cvsignore: Add autom4te.cache for autoconf > 2.52.
1837 + * configure.in: Remove.
1838 + * configure.ac: New file, generated from configure.in by autoupdate.
1840 +2001-09-27 Joel Sherrill <joel@OARcorp.com>
1842 + * include/bsp.h: Renamed delay() to rtems_bsp_delay().
1844 +2001-09-27 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1846 + * include/Makefile.am: Use 'TMPINSTALL_FILES ='.
1848 +2001-05-26 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1850 + * configure.in: Add bspopts.h.
1851 + * include/.cvsignore: Add bspopts.h*, stamp-h*.
1852 + * include/Makefile.am: Use *_HEADERS instead of *H_FILES.
1853 + * include/bsp.h: Include bspopts.h.
1855 +2001-05-25 Joel Sherrill <joel@OARcorp.com>
1857 + * clock/Makefile.am, console/Makefile.am, spurious/Makefile.am,
1858 + start/Makefile.am, startup/Makefile.am, timer/Makefile.am,
1859 + wrapup/Makefile.am: Modified to include compile.am.
1860 + * startup/bspstart.c: Removed include of <libcsupport.h>
1862 +2000-05-25 Matt Cross <profesor@gweep.net>
1864 + * New MRM332 BSP for the Mini RoboMind board based
1865 + on the 68332 microcontroller designed and build by Mark
1866 + Castelluccio. For details on the MRM see http://www.robominds.com.
1867 + * .cvsignore, ChangeLog Makefile.am, README, bsp_specs,
1868 + clock/.cvsignore, clock/Makefile.am, clock/ckinit.c, configure.in,
1869 + console/.cvsignore, console/Makefile.am, console/console.c,
1870 + include/.cvsignore, include/Makefile.am, include/bsp.h,
1871 + include/mrm332.h, misc/dotests, misc/gdbinit68, misc/interr.c,
1872 + spurious/.cvsignore, spurious/Makefile.am, spurious/spinit.c,
1873 + start/.cvsignore, start/Makefile.am, start/start.c, startup/.cvsignore,
1874 + startup/Makefile.am, startup/bspclean.c, startup/bspstart.c,
1875 + startup/except_vect_332_ROM.S, startup/linkcmds, startup/linkcmds_ROM,
1876 + timer/.cvsignore, timer/Makefile.am, timer/timer.c, times,
1877 + wrapup/.cvsignore, wrapup/Makefile.am: Initial files.
1879 Index: rtems/c/src/lib/libbsp/m68k/mo376/startup/bspclean.c
1880 ===================================================================
1882 +++ rtems/c/src/lib/libbsp/m68k/mo376/startup/bspclean.c
1886 + * This routine cleans up in the sense that it places the board
1887 + * in a safe state and flushes the I/O buffers before exiting.
1893 + * COPYRIGHT (c) 1989-1999.
1894 + * On-Line Applications Research Corporation (OAR).
1896 + * The license and distribution terms for this file may be
1897 + * found in the file LICENSE in this distribution or at
1898 + * http://www.rtems.com/license/LICENSE.
1900 + * $Id: bspclean.c,v 1.4 2004/04/21 10:42:52 ralf Exp $
1905 +void bsp_cleanup(void)
1907 + /* interrupt driven stdio must be flushed */
1908 + _CPU_ISR_Set_level( 7 );
1911 Index: rtems/c/src/lib/libbsp/m68k/mo376/timer/timer.c
1912 ===================================================================
1914 +++ rtems/c/src/lib/libbsp/m68k/mo376/timer/timer.c
1918 + * This routine is not implemented for this BSP.
1920 + * Input parameters: NONE
1922 + * Output parameters: NONE
1924 + * NOTE: It is important that the timer start/stop overhead be
1925 + * determined when porting or modifying this code.
1927 + * COPYRIGHT (c) 1989-1999.
1928 + * On-Line Applications Research Corporation (OAR).
1930 + * The license and distribution terms for this file may be
1931 + * found in the file LICENSE in this distribution or at
1932 + * http://www.rtems.com/license/LICENSE.
1934 + * $Id: timer.c,v 1.6 2004/04/21 16:01:35 ralf Exp $
1939 +rtems_boolean Timer_driver_Find_average_overhead;
1941 +extern rtems_isr Clock_isr();
1943 +void Timer_initialize( void )
1948 + * The following controls the behavior of Read_timer().
1950 + * FIND_AVG_OVERHEAD * instructs the routine to return the "raw" count.
1952 + * AVG_OVEREHAD is the overhead for starting and stopping the timer. It
1953 + * is usually deducted from the number returned.
1955 + * LEAST_VALID is the lowest number this routine should trust. Numbers
1956 + * below this are "noise" and zero is returned.
1959 +#define AVG_OVERHEAD 0 /* It typically takes X.X microseconds */
1960 + /* (Y countdowns) to start/stop the timer. */
1961 + /* This value is in microseconds. */
1962 +#define LEAST_VALID 1 /* Don't trust a clicks value lower than this */
1965 + * Return timer value in 1/2-microsecond units
1967 +int Read_timer( void )
1972 + if ( Timer_driver_Find_average_overhead == 1 )
1973 + return total; /* in XXX microsecond units */
1975 + if ( total < LEAST_VALID )
1976 + return 0; /* below timer resolution */
1978 + return (total - AVG_OVERHEAD);
1982 + * Empty function call used in loops to measure basic cost of looping
1983 + * in Timing Test Suite.
1986 +rtems_status_code Empty_function(void)
1988 + return RTEMS_SUCCESSFUL;
1991 +void Set_find_average_overhead(
1992 + rtems_boolean find_flag
1995 + Timer_driver_Find_average_overhead = find_flag;
1997 Index: rtems/c/src/lib/libbsp/m68k/mo376/clock/ckinit.c
1998 ===================================================================
2000 +++ rtems/c/src/lib/libbsp/m68k/mo376/clock/ckinit.c
2004 + * This routine initailizes the periodic interrupt timer on
2005 + * the Motorola 68332.
2007 + * Input parameters: NONE
2009 + * Output parameters: NONE
2011 + * COPYRIGHT (c) 1989-1999.
2012 + * On-Line Applications Research Corporation (OAR).
2014 + * The license and distribution terms for this file may be
2015 + * found in the file LICENSE in this distribution or at
2016 + * http://www.rtems.com/license/LICENSE.
2018 + * $Id: ckinit.c,v 1.5 2004/04/21 10:42:52 ralf Exp $
2021 +#include <stdlib.h>
2023 +#include <rtems/libio.h>
2024 +#include <mrm332.h>
2026 +#define CLOCK_VECTOR MRM_PIV
2028 +uint32_t Clock_isrs; /* ISRs until next tick */
2029 +volatile uint32_t Clock_driver_ticks;
2030 + /* ticks since initialization */
2031 +rtems_isr_entry Old_ticker;
2033 +void Clock_exit( void );
2036 + * These are set by clock driver during its init
2039 +rtems_device_major_number rtems_clock_major = ~0;
2040 +rtems_device_minor_number rtems_clock_minor;
2042 +rtems_isr Clock_isr(rtems_vector_number vector)
2044 + Clock_driver_ticks += 1;
2046 + if ( Clock_isrs == 1 ) {
2047 + rtems_clock_tick();
2048 + Clock_isrs = BSP_Configuration.microseconds_per_tick / 1000;
2054 +void Install_clock(
2055 + rtems_isr_entry clock_isr
2058 + Clock_driver_ticks = 0;
2059 + Clock_isrs = BSP_Configuration.microseconds_per_tick / 1000;
2061 + Old_ticker = (rtems_isr_entry) set_vector( clock_isr, CLOCK_VECTOR, 1 );
2063 + /* enable 1mS interrupts */
2064 + *PITR = (unsigned short int)( SAM(0x09,0,PITM) );/* load counter */
2065 + *PICR = (unsigned short int) /* enable interrupt */
2066 + ( SAM(ISRL_PIT,8,PIRQL) | SAM(CLOCK_VECTOR,0,PIV) );
2068 + atexit( Clock_exit );
2071 +void Clock_exit( void )
2073 + /* shutdown the periodic interrupt */
2074 + *PICR = (unsigned short int)
2075 + ( SAM(0,8,PIRQL) | SAM(CLOCK_VECTOR,0,PIV) );
2076 + /* ^^ zero disables interrupt */
2078 + /* do not restore old vector */
2081 +rtems_device_driver Clock_initialize(
2082 + rtems_device_major_number major,
2083 + rtems_device_minor_number minor,
2087 + Install_clock( Clock_isr );
2090 + * make major/minor avail to others such as shared memory driver
2093 + rtems_clock_major = major;
2094 + rtems_clock_minor = minor;
2096 + return RTEMS_SUCCESSFUL;
2099 +rtems_device_driver Clock_control(
2100 + rtems_device_major_number major,
2101 + rtems_device_minor_number minor,
2105 + uint32_t isrlevel;
2106 + rtems_libio_ioctl_args_t *args = pargp;
2112 + * This is hokey, but until we get a defined interface
2113 + * to do this, it will just be this simple...
2116 + if (args->command == rtems_build_name('I', 'S', 'R', ' '))
2118 + Clock_isr(CLOCK_VECTOR);
2120 + else if (args->command == rtems_build_name('N', 'E', 'W', ' '))
2122 + rtems_interrupt_disable( isrlevel );
2123 + (void) set_vector( args->buffer, CLOCK_VECTOR, 1 );
2124 + rtems_interrupt_enable( isrlevel );
2128 + return RTEMS_SUCCESSFUL;
2130 Index: rtems/c/src/lib/libbsp/m68k/mo376/misc/gdbinit68
2131 ===================================================================
2133 +++ rtems/c/src/lib/libbsp/m68k/mo376/misc/gdbinit68
2136 +# $Id: gdbinit68,v 1.1 2001/05/25 16:28:46 joel Exp $
2138 +echo Setting up the environment for mrm debuging.\n
2140 +target bdm /dev/bdmcpu320
2143 +set remotecache off
2151 Index: rtems/c/src/lib/libbsp/m68k/mo376/configure.ac
2152 ===================================================================
2154 +++ rtems/c/src/lib/libbsp/m68k/mo376/configure.ac
2156 +## Process this file with autoconf to produce a configure script.
2158 +## $Id: configure.ac,v 1.14 2004/09/24 06:32:09 ralf Exp $
2161 +AC_INIT([rtems-c-src-lib-libbsp-m68k-mrm332],[_RTEMS_VERSION],[rtems-bugs@rtems.com])
2162 +AC_CONFIG_SRCDIR([bsp_specs])
2163 +RTEMS_TOP(../../../../../..)
2165 +RTEMS_CANONICAL_TARGET_CPU
2166 +AM_INIT_AUTOMAKE([no-define nostdinc foreign 1.9])
2167 +RTEMS_BSP_CONFIGURE
2169 +RTEMS_PROG_CC_FOR_TARGET
2170 +RTEMS_CANONICALIZE_TOOLS
2173 +# Explicitly list all Makefiles here
2174 +AC_CONFIG_FILES([Makefile])
2176 Index: rtems/c/src/lib/libbsp/m68k/mo376/README
2177 ===================================================================
2179 +++ rtems/c/src/lib/libbsp/m68k/mo376/README
2182 +# $Id: README,v 1.1 2001/05/25 16:28:46 joel Exp $
2185 +Description: mrm332
2187 +CPU: MC68332 @16 or 25MHz
2191 + The Mini RoboMind is a small board based on the 68332 microcontroller
2192 +designed and build by Mark Castelluccio. For details, see:
2194 + http://www.robominds.com
2196 + This BSP was ported from the efi332 BSP by Matt Cross (profesor@gweep.net),
2197 +the efi332 BSP was written by John S Gwynne.
2201 +- integrate the interrupt driven stdin/stdout into RTEMS to (a) reduce
2202 + the interrupt priority and (2) to prevent it from blocking.
2203 +- add a timer driver for the tmtest set.
2205 Index: rtems/c/src/lib/libbsp/m68k/mo376/Makefile.am
2206 ===================================================================
2208 +++ rtems/c/src/lib/libbsp/m68k/mo376/Makefile.am
2211 +## $Id: Makefile.am,v 1.24 2006/01/12 10:12:30 ralf Exp $
2214 +ACLOCAL_AMFLAGS = -I ../../../../aclocal
2216 +include $(top_srcdir)/../../../../automake/compile.am
2217 +include $(top_srcdir)/../../bsp.am
2219 +dist_project_lib_DATA = bsp_specs
2221 +include_HEADERS = include/bsp.h
2222 +include_HEADERS += include/tm27.h
2224 +nodist_include_HEADERS = include/bspopts.h
2225 +DISTCLEANFILES = include/bspopts.h
2228 +include_HEADERS += include/mrm332.h
2229 +nodist_include_HEADERS += ../../shared/include/coverhd.h
2233 +EXTRA_DIST += start/start.S
2234 +start.$(OBJEXT): start/start.S
2235 + $(CPPASCOMPILE) -DASM -o $@ -c $<
2237 +project_lib_DATA = start.$(OBJEXT)
2239 +dist_project_lib_DATA += startup/linkcmds startup/linkcmds_ROM
2241 +noinst_PROGRAMS += startup.rel
2242 +startup_rel_SOURCES = startup/start_c.c ../../shared/bsplibc.c \
2243 + ../../shared/bsppost.c startup/bspstart.c startup/bspclean.c \
2244 + ../../shared/bootcard.c ../../m68k/shared/m68kpretaskinghook.c \
2245 + ../../shared/main.c ../../shared/sbrk.c ../../m68k/shared/setvec.c \
2246 + ../../shared/gnatinstallhandler.c startup/except_vect_332_ROM.S
2247 +startup_rel_CPPFLAGS = $(AM_CPPFLAGS)
2248 +startup_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
2250 +noinst_PROGRAMS += clock.rel
2251 +clock_rel_SOURCES = clock/ckinit.c
2252 +clock_rel_CPPFLAGS = $(AM_CPPFLAGS)
2253 +clock_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
2255 +noinst_PROGRAMS += console.rel
2256 +console_rel_SOURCES = console/console.c console/sci.c console/sci.h
2257 +console_rel_CPPFLAGS = $(AM_CPPFLAGS)
2258 +console_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
2260 +noinst_PROGRAMS += spurious.rel
2261 +spurious_rel_SOURCES = spurious/spinit.c
2262 +spurious_rel_CPPFLAGS = $(AM_CPPFLAGS)
2263 +spurious_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
2265 +noinst_PROGRAMS += timer.rel
2266 +timer_rel_SOURCES = timer/timer.c
2267 +timer_rel_CPPFLAGS = $(AM_CPPFLAGS)
2268 +timer_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
2270 +noinst_LIBRARIES = libbsp.a
2272 +libbsp_a_LIBADD = startup.rel clock.rel console.rel spurious.rel timer.rel
2273 +libbsp_a_LIBADD += ../../../libcpu/@RTEMS_CPU@/shared/cache.rel \
2274 + ../../../libcpu/@RTEMS_CPU@/shared/misc.rel
2276 +include $(srcdir)/preinstall.am
2277 +include $(top_srcdir)/../../../../automake/local.am
2278 Index: rtems/c/src/lib/libbsp/m68k/mo376/console/sci.c
2279 ===================================================================
2281 +++ rtems/c/src/lib/libbsp/m68k/mo376/console/sci.c
2283 +/*****************************************************************************
2286 +* Desc: This file contains the console IO routines for the SCI port.
2287 +* There are two interfaces in this module. One is for the rtems
2288 +* termios/console code and the other is a device driver interface.
2289 +* This module works together with the termio module which is
2290 +* sometimes referred to as the "line disciplines" which implements
2291 +* terminal i/o processing like tabs, backspaces, and newlines.
2292 +* The rtems printf uses interrupt io and the rtems printk routine
2293 +* uses polled io which is better for debugging.
2295 +* Index: Documentation
2296 +* Section A - Include Files
2297 +* Section B - Manifest Constants
2298 +* Section C - External Data
2299 +* Section D - External Functions
2300 +* Section E - Local Functions
2301 +* Section F - Local Variables
2302 +* Section G - A circular data buffer for rcv chars
2303 +* Section H - RTEMS termios callbacks for the interrupt api
2304 +* Section I - RTEMS termios callbacks for the polled api
2306 +* Section 0 - Miscellaneous routines
2307 +* Section 1 - Routines to manipulate the circular buffer
2308 +* Section 2 - Interrupt based entry points for the termios module
2309 +* Section 3 - Polling based entry points for the termios module
2310 +* Section 4 - Device driver public api entry points
2311 +* Section 5 - Hardware level routines
2312 +* Section 6 - Testing and debugging code
2314 +* Refer: Motorola QSM Reference Manual - Chapter 5 - SCI sub-module
2316 +* Note: See bsp.h,confdefs.h,system.h for installing drivers into RTEMS.
2318 +* $Id: sci.c,v 1.10 2005/01/05 18:12:35 ralf Exp $
2320 +*****************************************************************************/
2323 +/*****************************************************************************
2324 + Compiler Options for the incurably curious
2325 +*****************************************************************************/
2328 +/opt/rtems/bin/m68k-rtems-gcc
2329 + --pipe # use pipes, not tmp files
2330 + -B../../../../../../../../opti/lib/ # where the library is
2331 + -specs bsp_specs # ???
2333 + -g # add debugging info
2334 + -Wall # issue all warnings
2335 + -fasm # allow inline asm???
2336 + -DCONSOLE_SCI # for opti-r box/rev b proto
2337 + -mcpu32 # machine = motorola cpu 32
2338 + -c # compile, don't link
2339 + -O4 # max optimization
2340 + -fomit-frame-pointer # stack frames are optional
2341 + -o o-optimize/sci.o # the object file
2342 + ../../../../../../../../../rtems/c/src/lib/libbsp/m68k/opti/console/sci.c
2346 +/*****************************************************************************
2347 + Overview of serial port console terminal input/output
2348 +*****************************************************************************/
2351 + +-----------+ +---------+
2353 + +-----------+ +---------+
2355 + | (printf,scanf,etc.) |
2362 + | (open,close,read,write,ioctl) |
2363 + ======|==========================================|========================
2364 + | /dev/console | /dev/sci
2365 + | (stdin,stdout,stderr) |
2366 + ======|==========================================|========================
2370 + +-----------+ +-----------+ +---------+
2371 + | console | <---> | termios | <---> | sci |
2372 + | driver | | module | | driver |
2373 + +-----------+ +-----------+ +---------+
2385 +/*****************************************************************************
2386 + Section A - Include Files
2387 +*****************************************************************************/
2391 +#include <rtems/bspIo.h>
2393 +#include <rtems/libio.h>
2394 +#include <libchip/serial.h>
2395 +#include <libchip/sersupp.h>
2397 +//#include "../misc/include/cpu332.h"
2400 +/*****************************************************************************
2401 + Section B - Manifest Constants
2402 +*****************************************************************************/
2404 +#define SCI_MINOR 0 // minor device number
2406 +// IMPORTANT - if the device driver api is opened, it means the sci is being
2407 +// used for direct hardware access, so other users (like termios) get ignored
2409 +#define DRIVER_CLOSED 0 // the device driver api is closed
2410 +#define DRIVER_OPENED 1 // the device driver api is opened
2412 +// system clock definitions, i dont have documentation on this...
2414 +#if 0 // Not needed, this is provided in mrm332.h
2415 +#define XTAL 32768.0 // crystal frequency in Hz
2416 +#define NUMB_W 0 // system clock parameters
2418 +//efine NUMB_Y 0x38 // for 14.942 Mhz
2419 +#define NUMB_Y 0x3F // for 16.777 Mhz
2421 +#define SYS_CLOCK (XTAL * 4.0 * (NUMB_Y+1) * (1 << (2 * NUMB_W + NUMB_X)))
2426 +/*****************************************************************************
2427 + Section C - External Data
2428 +*****************************************************************************/
2432 +/*****************************************************************************
2433 + Section D - External Functions
2434 +*****************************************************************************/
2438 +/*****************************************************************************
2439 + Section E - Local Functions
2440 +*****************************************************************************/
2442 +void SCI_output_char(char c);
2444 +rtems_isr SciIsr( rtems_vector_number vector ); // interrupt handler
2446 +const rtems_termios_callbacks * SciGetTermiosHandlers( int32_t polled );
2448 +rtems_device_driver SciInitialize (); // device driver api
2449 +rtems_device_driver SciOpen (); // device driver api
2450 +rtems_device_driver SciClose (); // device driver api
2451 +rtems_device_driver SciRead (); // device driver api
2452 +rtems_device_driver SciWrite (); // device driver api
2453 +rtems_device_driver SciControl (); // device driver api
2455 +int32_t SciInterruptOpen(); // termios api
2456 +int32_t SciInterruptClose(); // termios api
2457 +int32_t SciInterruptWrite(); // termios api
2459 +int32_t SciSetAttributes(); // termios api
2461 +int32_t SciPolledOpen(); // termios api
2462 +int32_t SciPolledClose(); // termios api
2463 +int32_t SciPolledRead(); // termios api
2464 +int32_t SciPolledWrite(); // termios api
2466 +static void SciSetBaud(uint32_t rate); // hardware routine
2467 +static void SciSetDataBits(uint16_t bits); // hardware routine
2468 +static void SciSetParity(uint16_t parity); // hardware routine
2470 +static void inline SciDisableAllInterrupts( void ); // hardware routine
2471 +static void inline SciDisableTransmitInterrupts( void );// hardware routine
2472 +static void inline SciDisableReceiveInterrupts( void ); // hardware routine
2474 +static void inline SciEnableTransmitInterrupts( void ); // hardware routine
2475 +static void inline SciEnableReceiveInterrupts( void ); // hardware routine
2477 +static void inline SciDisableReceiver( void ); // hardware routine
2478 +static void inline SciDisableTransmitter( void ); // hardware routine
2480 +static void inline SciEnableReceiver( void ); // hardware routine
2481 +static void inline SciEnableTransmitter( void ); // hardware routine
2483 +void SciWriteCharWait ( uint8_t); // hardware routine
2484 +void SciWriteCharNoWait( uint8_t); // hardware routine
2486 +uint8_t inline SciCharAvailable( void ); // hardware routine
2488 +uint8_t inline SciReadCharWait( void ); // hardware routine
2489 +uint8_t inline SciReadCharNoWait( void ); // hardware routine
2491 +void SciSendBreak( void ); // test routine
2493 +static int8_t SciRcvBufGetChar(); // circular rcv buf
2494 +static void SciRcvBufPutChar( uint8_t); // circular rcv buf
2495 +//atic void SciRcvBufFlush( void ); // circular rcv buf
2497 +void SciUnitTest(); // test routine
2498 +void SciPrintStats(); // test routine
2501 +/*****************************************************************************
2502 + Section F - Local Variables
2503 +*****************************************************************************/
2505 +static struct rtems_termios_tty *SciTermioTty;
2507 +static uint8_t SciInited = 0; // has the driver been inited
2509 +static uint8_t SciOpened; // has the driver been opened
2511 +static uint8_t SciMajor; // major device number
2513 +static uint16_t SciBaud; // current value in baud register
2515 +static uint32_t SciBytesIn = 0; // bytes received
2516 +static uint32_t SciBytesOut = 0; // bytes transmitted
2518 +static uint32_t SciErrorsParity = 0; // error counter
2519 +static uint32_t SciErrorsNoise = 0; // error counter
2520 +static uint32_t SciErrorsFraming = 0; // error counter
2521 +static uint32_t SciErrorsOverrun = 0; // error counter
2523 +#if defined(CONSOLE_SCI)
2525 +// this is what rtems printk uses to do polling based output
2527 +BSP_output_char_function_type BSP_output_char = SCI_output_char;
2528 +BSP_polling_getchar_function_type BSP_poll_char = NULL;
2532 +// cvs id string so you can use the unix ident command on the object
2535 +static const char SciIdent[]="$Id: sci.c,v 1.10 2005/01/05 18:12:35 ralf Exp $";
2539 +/*****************************************************************************
2540 + Section G - A circular buffer for rcv chars when the driver interface is used.
2541 +*****************************************************************************/
2543 +// it is trivial to wrap your buffer pointers when size is a power of two
2545 +#define SCI_RCV_BUF_SIZE 256 // must be a power of 2 !!!
2547 +// if someone opens the sci device using the device driver interface,
2548 +// then the receive data interrupt handler will put characters in this buffer
2549 +// instead of sending them up to the termios module for the console
2551 +static uint8_t SciRcvBuffer[SCI_RCV_BUF_SIZE];
2553 +static uint8_t SciRcvBufPutIndex = 0; // array index to put in next char
2555 +static uint8_t SciRcvBufGetIndex = 0; // array index to take out next char
2557 +static uint16_t SciRcvBufCount = 0; // how many bytes are in the buffer
2561 +/*****************************************************************************
2562 + Section H - RTEMS termios callbacks for the interrupt version of the driver
2563 +*****************************************************************************/
2565 +static const rtems_termios_callbacks SciInterruptCallbacks =
2567 + SciInterruptOpen, // first open
2568 + SciInterruptClose, // last close
2569 + NULL, // polled read (not required)
2570 + SciInterruptWrite, // write
2571 + SciSetAttributes, // set attributes
2572 + NULL, // stop remote xmit
2573 + NULL, // start remote xmit
2574 + TRUE // output uses interrupts
2577 +/*****************************************************************************
2578 + Section I - RTEMS termios callbacks for the polled version of the driver
2579 +*****************************************************************************/
2581 +static const rtems_termios_callbacks SciPolledCallbacks =
2583 + SciPolledOpen, // first open
2584 + SciPolledClose, // last close
2585 + SciPolledRead, // polled read
2586 + SciPolledWrite, // write
2587 + SciSetAttributes, // set attributes
2588 + NULL, // stop remote xmit
2589 + NULL, // start remote xmit
2590 + FALSE // output uses interrupts
2594 +/////////////////////////////////////////////////////////////////////////////
2597 +// MISCELLANEOUS ROUTINES
2599 +/////////////////////////////////////////////////////////////////////////////
2601 +/****************************************************************************
2602 +* Func: SCI_output_char
2603 +* Desc: used by rtems printk function to send a char to the uart
2604 +* Inputs: the character to transmit
2608 +****************************************************************************/
2610 +void SCI_output_char(char c)
2612 +// ( minor device number, pointer to the character, length )
2614 + SciPolledWrite( SCI_MINOR, &c, 1);
2620 +/****************************************************************************
2621 +* Func: SciGetTermiosHandlers
2622 +* Desc: returns a pointer to the table of serial io functions
2623 +* this is called from console_open with polled set to false
2624 +* Inputs: flag indicating whether we want polled or interrupt driven io
2625 +* Outputs: pointer to function table
2628 +****************************************************************************/
2630 +const rtems_termios_callbacks * SciGetTermiosHandlers( int32_t polled )
2634 + return &SciPolledCallbacks; // polling based
2638 + return &SciInterruptCallbacks; // interrupt driven
2643 +/****************************************************************************
2645 +* Desc: interrupt handler for serial communications interface
2646 +* Inputs: vector number - unused
2649 +* Scope: public API
2650 +****************************************************************************/
2652 +rtems_isr SciIsr( rtems_vector_number vector )
2656 + if ( (*SCSR) & SCI_ERROR_PARITY ) SciErrorsParity ++;
2657 + if ( (*SCSR) & SCI_ERROR_FRAMING ) SciErrorsFraming ++;
2658 + if ( (*SCSR) & SCI_ERROR_NOISE ) SciErrorsNoise ++;
2659 + if ( (*SCSR) & SCI_ERROR_OVERRUN ) SciErrorsOverrun ++;
2661 + // see if it was a transmit interrupt
2663 + if ( (*SCSR) & SCI_XMTR_AVAILABLE ) // data reg empty, xmt complete
2665 + SciDisableTransmitInterrupts();
2667 + // tell termios module that the charcter was sent
2668 + // he will call us later to transmit more if there are any
2670 + if (rtems_termios_dequeue_characters( SciTermioTty, 1 ))
2672 + // there are more bytes to transmit so enable TX interrupt
2674 + SciEnableTransmitInterrupts();
2678 + // see if it was a receive interrupt
2679 + // on the sci uart we just get one character per interrupt
2681 + while ( SciCharAvailable() ) // char in data register?
2683 + ch = SciReadCharNoWait(); // get the char from the uart
2686 + // either send it to the termios module or keep it locally
2688 + if ( SciOpened == DRIVER_OPENED ) // the driver is open
2690 + SciRcvBufPutChar(ch); // keep it locally
2692 + else // put in termios buffer
2694 + rtems_termios_enqueue_raw_characters( SciTermioTty, &ch, 1 );
2697 + *SCSR &= SCI_CLEAR_RX_INT; // clear the interrupt
2702 +/////////////////////////////////////////////////////////////////////////////
2705 +// ROUTINES TO MANIPULATE THE CIRCULAR BUFFER
2707 +/////////////////////////////////////////////////////////////////////////////
2709 +/****************************************************************************
2710 +* Func: SciRcvBufGetChar
2711 +* Desc: read a character from the circular buffer
2712 +* make sure there is data before you call this!
2714 +* Outputs: the character or -1
2717 +****************************************************************************/
2719 +static int8_t SciRcvBufGetChar()
2721 + rtems_interrupt_level level;
2724 + if ( SciRcvBufCount == 0 )
2726 + rtems_fatal_error_occurred(0xDEAD); // check the count first!
2729 + rtems_interrupt_disable( level ); // disable interrupts
2731 + ch = SciRcvBuffer[SciRcvBufGetIndex]; // get next byte
2733 + SciRcvBufGetIndex++; // bump the index
2735 + SciRcvBufGetIndex &= SCI_RCV_BUF_SIZE - 1; // and wrap it
2737 + SciRcvBufCount--; // decrement counter
2739 + rtems_interrupt_enable( level ); // restore interrupts
2741 + return ch; // return the char
2745 +/****************************************************************************
2746 +* Func: SciRcvBufPutChar
2747 +* Desc: put a character into the rcv data circular buffer
2748 +* Inputs: the character
2752 +****************************************************************************/
2754 +static void SciRcvBufPutChar( uint8_t ch )
2756 + rtems_interrupt_level level;
2758 + if ( SciRcvBufCount == SCI_RCV_BUF_SIZE ) // is there room?
2760 + return; // no, throw it away
2763 + rtems_interrupt_disable( level ); // disable interrupts
2765 + SciRcvBuffer[SciRcvBufPutIndex] = ch; // put it in the buf
2767 + SciRcvBufPutIndex++; // bump the index
2769 + SciRcvBufPutIndex &= SCI_RCV_BUF_SIZE - 1; // and wrap it
2771 + SciRcvBufCount++; // increment counter
2773 + rtems_interrupt_enable( level ); // restore interrupts
2779 +/****************************************************************************
2780 +* Func: SciRcvBufFlush
2781 +* Desc: completely reset and clear the rcv buffer
2786 +****************************************************************************/
2788 +#if 0 // prevents compiler warning
2789 +static void SciRcvBufFlush( void )
2791 + rtems_interrupt_level level;
2793 + rtems_interrupt_disable( level ); // disable interrupts
2795 + memset( SciRcvBuffer, 0, sizeof(SciRcvBuffer) );
2797 + SciRcvBufPutIndex = 0; // clear
2799 + SciRcvBufGetIndex = 0; // clear
2801 + SciRcvBufCount = 0; // clear
2803 + rtems_interrupt_enable( level ); // restore interrupts
2810 +/////////////////////////////////////////////////////////////////////////////
2813 +// INTERRUPT BASED ENTRY POINTS FOR THE TERMIOS MODULE
2815 +/////////////////////////////////////////////////////////////////////////////
2817 +/****************************************************************************
2818 +* Func: SciInterruptOpen
2819 +* Desc: open routine for the interrupt based device driver
2820 +* Default state is 9600 baud, 8 bits, No parity, and 1 stop bit. ??
2821 +**CHANGED** Default baud rate is now 19200, 8N1
2822 +* called from rtems_termios_open which is called from console_open
2823 +* Inputs: major - device number
2824 +* minor - device number
2825 +* args - points to terminal info
2826 +* Outputs: success/fail
2828 +* Scope: public API
2829 +****************************************************************************/
2831 +int32_t SciInterruptOpen(
2837 + rtems_libio_open_close_args_t * args = arg;
2838 + rtems_isr_entry old_vector;
2840 + if ( minor != SCI_MINOR ) // check minor device num
2845 + if ( !args ) // must have args
2850 + SciTermioTty = args->iop->data1; // save address of struct
2852 + SciDisableAllInterrupts(); // turn off sci interrupts
2854 + // THIS IS ACTUALLY A BAD THING - SETTING LINE PARAMETERS HERE
2855 + // IT SHOULD BE DONE THROUGH TCSETATTR() WHEN THE CONSOLE IS OPENED!!!
2857 +// SciSetBaud(115200); // set the baud rate
2858 +// SciSetBaud( 57600); // set the baud rate
2859 +// SciSetBaud( 38400); // set the baud rate
2860 +SciSetBaud( 19200); // set the baud rate
2861 +// SciSetBaud( 9600); // set the baud rate
2863 + SciSetParity(SCI_PARITY_NONE); // set parity to none
2865 + SciSetDataBits(SCI_8_DATA_BITS); // set data bits to 8
2867 + // Install our interrupt handler into RTEMS, where does 66 come from?
2869 + rtems_interrupt_catch( SciIsr, 66, &old_vector );
2873 + *QILR |= 0x06 & 0x07;
2875 + SciEnableTransmitter(); // enable the transmitter
2877 + SciEnableReceiver(); // enable the receiver
2879 + SciEnableReceiveInterrupts(); // enable rcv interrupts
2881 + return RTEMS_SUCCESSFUL;
2885 +/****************************************************************************
2886 +* Func: SciInterruptClose
2887 +* Desc: close routine called by the termios module
2888 +* Inputs: major - device number
2889 +* minor - device number
2891 +* Outputs: success/fail
2893 +* Scope: public - termio entry point
2894 +****************************************************************************/
2896 +int32_t SciInterruptClose(
2902 + SciDisableAllInterrupts();
2904 + return RTEMS_SUCCESSFUL;
2908 +/****************************************************************************
2909 +* Func: SciInterruptWrite
2910 +* Desc: writes data to the uart using transmit interrupts
2911 +* Inputs: minor - device number
2912 +* buf - points to the data
2913 +* len - number of bytes to send
2914 +* Outputs: success/fail
2916 +* Scope: public API
2917 +****************************************************************************/
2919 +int32_t SciInterruptWrite(
2925 + // We are using interrupt driven output so termios only sends us
2926 + // one character at a time. The sci does not have a fifo.
2928 + if ( !len ) // no data?
2930 + return 0; // return error
2933 + if ( minor != SCI_MINOR ) // check the minor dev num
2935 + return 0; // return error
2938 + if ( SciOpened == DRIVER_OPENED ) // is the driver api open?
2940 + return 1; // yep, throw this away
2943 + SciWriteCharNoWait(*buf); // try to send a char
2945 + *SCSR &= SCI_CLEAR_TDRE; // clear tx data reg empty flag
2947 + SciEnableTransmitInterrupts(); // enable the tx interrupt
2949 + return 1; // return success
2953 +/****************************************************************************
2954 +* Func: SciSetAttributes
2955 +* Desc: setup the uart based on the termios modules requests
2956 +* Inputs: minor - device number
2957 +* t - pointer to the termios info struct
2960 +* Scope: public API
2961 +****************************************************************************/
2963 +int32_t SciSetAttributes(
2965 + const struct termios *t
2968 + uint32_t baud_requested;
2969 + uint32_t sci_rate = 0;
2970 + uint16_t sci_parity = 0;
2971 + uint16_t sci_databits = 0;
2973 + if ( minor != SCI_MINOR ) // check the minor dev num
2975 + return -1; // return error
2978 + // if you look closely you will see this is the only thing we use
2979 + // set the baud rate
2981 + baud_requested = t->c_cflag & CBAUD; // baud rate
2983 + if (!baud_requested)
2985 +// baud_requested = B9600; // default to 9600 baud
2986 + baud_requested = B19200; // default to 19200 baud
2989 + sci_rate = termios_baud_to_number( baud_requested );
2991 + // parity error detection
2993 + if (t->c_cflag & PARENB) // enable parity detection?
2995 + if (t->c_cflag & PARODD)
2997 + sci_parity = SCI_PARITY_ODD; // select odd parity
3001 + sci_parity = SCI_PARITY_EVEN; // select even parity
3006 + sci_parity = SCI_PARITY_NONE; // no parity, most common
3009 + // set the number of data bits, 8 is most common
3011 + if (t->c_cflag & CSIZE) // was it specified?
3013 + switch (t->c_cflag & CSIZE)
3015 + case CS8: sci_databits = SCI_8_DATA_BITS; break;
3016 + default : sci_databits = SCI_9_DATA_BITS; break;
3021 + sci_databits = SCI_8_DATA_BITS; // default to 8 data bits
3024 + // the number of stop bits; always 1 for SCI
3026 + if (t->c_cflag & CSTOPB)
3031 + // setup the hardware with these serial port parameters
3033 + SciSetBaud(sci_rate); // set the baud rate
3035 + SciSetParity(sci_parity); // set the parity type
3037 + SciSetDataBits(sci_databits); // set the data bits
3039 + return RTEMS_SUCCESSFUL;
3043 +/////////////////////////////////////////////////////////////////////////////
3046 +// POLLING BASED ENTRY POINTS FOR THE TERMIOS MODULE
3048 +/////////////////////////////////////////////////////////////////////////////
3050 +/****************************************************************************
3051 +* Func: SciPolledOpen
3052 +* Desc: open routine for the polled i/o version of the driver
3053 +* called from rtems_termios_open which is called from console_open
3054 +* Inputs: major - device number
3055 +* minor - device number
3056 +* args - points to terminal info struct
3057 +* Outputs: success/fail
3059 +* Scope: public - termios entry point
3060 +****************************************************************************/
3062 +int32_t SciPolledOpen(
3068 + rtems_libio_open_close_args_t * args = arg;
3070 + if ( minor != SCI_MINOR ) // check minor device num
3075 + if ( !args ) // must have args
3080 + SciTermioTty = args->iop->data1; // Store tty pointer
3082 + SciDisableAllInterrupts(); // don't generate interrupts
3084 + // THIS IS ACTUALLY A BAD THING - SETTING LINE PARAMETERS HERE
3085 + // IT SHOULD BE DONE THROUGH TCSETATTR() WHEN THE CONSOLE IS OPENED!!!
3087 +// SciSetBaud(115200); // set the baud rate
3088 +// SciSetBaud( 57600); // set the baud rate
3089 +// SciSetBaud( 38400); // set the baud rate
3090 + SciSetBaud( 19200); // set the baud rate
3091 +// SciSetBaud( 9600); // set the baud rate
3093 + SciSetParity(SCI_PARITY_NONE); // set no parity
3095 + SciSetDataBits(SCI_8_DATA_BITS); // set 8 data bits
3097 + SciEnableTransmitter(); // enable the xmitter
3099 + SciEnableReceiver(); // enable the rcvr
3101 + return RTEMS_SUCCESSFUL;
3105 +/****************************************************************************
3106 +* Func: SciPolledClose
3107 +* Desc: close routine for the device driver, same for both
3108 +* Inputs: major - device number
3109 +* minor - device number
3111 +* Outputs: success/fail
3113 +* Scope: public termios API
3114 +****************************************************************************/
3116 +int32_t SciPolledClose(
3122 + SciDisableAllInterrupts();
3124 + return RTEMS_SUCCESSFUL;
3128 +/****************************************************************************
3129 +* Func: SciPolledRead
3130 +* Desc: polling based read routine for the uart
3131 +* Inputs: minor - device number
3132 +* Outputs: error or the character read
3134 +* Scope: public API
3135 +****************************************************************************/
3137 +int32_t SciPolledRead(
3141 + if ( minor != SCI_MINOR ) // check the minor dev num
3143 + return -1; // return error
3146 + if ( SciCharAvailable() ) // if a char is available
3148 + return SciReadCharNoWait(); // read the rx data register
3151 + return -1; // return error
3155 +/****************************************************************************
3156 +* Func: SciPolledWrite
3157 +* Desc: writes out characters in polled mode, waiting for the uart
3158 +* check in console_open, but we only seem to use interrupt mode
3159 +* Inputs: minor - device number
3160 +* buf - points to the data
3161 +* len - how many bytes
3162 +* Outputs: error or number of bytes written
3164 +* Scope: public termios API
3165 +****************************************************************************/
3167 +int32_t SciPolledWrite(
3173 + int32_t written = 0;
3175 + if ( minor != SCI_MINOR ) // check minor device num
3180 + if ( SciOpened == DRIVER_OPENED ) // is the driver api open?
3182 + return -1; // toss the data
3185 + // send each byte in the string out the port
3187 + while ( written < len )
3189 + SciWriteCharWait(*buf++); // send a byte
3191 + written++; // increment counter
3194 + return written; // return count
3198 +/////////////////////////////////////////////////////////////////////////////
3201 +// DEVICE DRIVER PUBLIC API ENTRY POINTS
3203 +/////////////////////////////////////////////////////////////////////////////
3205 +/****************************************************************************
3207 +* Desc: Initialize the lasers device driver and hardware
3208 +* Inputs: major - the major device number which is assigned by rtems
3209 +* minor - the minor device number which is undefined at this point
3211 +* Outputs: RTEMS_SUCCESSFUL
3213 +* Scope: public API
3214 +****************************************************************************/
3216 +rtems_device_driver SciInitialize (
3217 + rtems_device_major_number major,
3218 + rtems_device_minor_number minor,
3222 +// rtems_status_code status;
3224 +//printk("%s\r\n", __FUNCTION__);
3226 + // register the SCI device name for termios console i/o
3227 + // this is done over in console.c which doesn't seem exactly right
3228 + // but there were problems doing it here...
3230 +// status = rtems_io_register_name( "/dev/sci", major, 0 );
3232 +// if (status != RTEMS_SUCCESSFUL)
3233 +// rtems_fatal_error_occurred(status);
3235 + SciMajor = major; // save the rtems major number
3237 + SciOpened = DRIVER_CLOSED; // initial state is closed
3239 + // if you have an interrupt handler, install it here
3241 + SciInited = 1; // set the inited flag
3243 + return RTEMS_SUCCESSFUL;
3247 +/****************************************************************************
3249 +* Desc: device driver open routine
3250 +* you must open a device before you can anything else
3251 +* only one process can have the device opened at a time
3252 +* you could look at the task id to restrict access if you want
3253 +* Inputs: major - the major device number assigned by rtems
3254 +* minor - the minor device number assigned by us
3256 +* Outputs: see below
3258 +* Scope: public API
3259 +****************************************************************************/
3261 +rtems_device_driver SciOpen (
3262 + rtems_device_major_number major,
3263 + rtems_device_minor_number minor,
3267 +//printk("%s major=%d minor=%d\r\n", __FUNCTION__,major,minor);
3269 + if (SciInited == 0) // must be initialized first!
3271 + return RTEMS_NOT_CONFIGURED;
3274 + if (minor != SCI_MINOR)
3276 + return RTEMS_INVALID_NAME; // verify minor number
3279 + if (SciOpened == DRIVER_OPENED)
3281 + return RTEMS_RESOURCE_IN_USE; // already opened!
3284 + SciOpened = DRIVER_OPENED; // set the opened flag
3286 + return RTEMS_SUCCESSFUL;
3290 +/****************************************************************************
3292 +* Desc: device driver close routine
3293 +* the device must be opened before you can close it
3294 +* the device must be closed before someone (else) can open it
3295 +* Inputs: major - the major device number
3296 +* minor - the minor device number
3298 +* Outputs: see below
3300 +* Scope: public API
3301 +****************************************************************************/
3303 +rtems_device_driver SciClose (
3304 + rtems_device_major_number major,
3305 + rtems_device_minor_number minor,
3309 +//printk("%s major=%d minor=%d\r\n", __FUNCTION__,major,minor);
3311 + if (minor != SCI_MINOR)
3313 + return RTEMS_INVALID_NAME; // check the minor number
3316 + if (SciOpened != DRIVER_OPENED)
3318 + return RTEMS_INCORRECT_STATE; // must be opened first
3321 + SciOpened = DRIVER_CLOSED; // set the flag
3323 + return RTEMS_SUCCESSFUL;
3327 +/****************************************************************************
3329 +* Desc: device driver read routine
3330 +* this function is not meaningful for the laser devices
3331 +* Inputs: major - the major device number
3332 +* minor - the minor device number
3333 +* arg - read/write arguments
3334 +* Outputs: see below
3336 +* Scope: public API
3337 +****************************************************************************/
3339 +rtems_device_driver SciRead (
3340 + rtems_device_major_number major,
3341 + rtems_device_minor_number minor,
3345 + rtems_libio_rw_args_t *rw_args; // ptr to argument struct
3349 + rw_args = (rtems_libio_rw_args_t *) arg; // arguments to read()
3351 + if (minor != SCI_MINOR)
3353 + return RTEMS_INVALID_NAME; // check the minor number
3356 + if (SciOpened == DRIVER_CLOSED)
3358 + return RTEMS_INCORRECT_STATE; // must be opened first
3361 + buffer = rw_args->buffer; // points to user's buffer
3363 + length = rw_args->count; // how many bytes they want
3365 +// *buffer = SciReadCharWait(); // wait for a character
3367 + // if there isn't a character available, wait until one shows up
3368 + // or the timeout period expires, which ever happens first
3370 + if ( SciRcvBufCount == 0 ) // no chars
3372 + // wait for someone to wake me up...
3373 + //rtems_task_wake_after(SciReadTimeout);
3376 + if ( SciRcvBufCount ) // any characters locally?
3378 + *buffer = SciRcvBufGetChar(); // get the character
3380 + rw_args->bytes_moved = 1; // how many we actually read
3383 + return RTEMS_SUCCESSFUL;
3387 +/****************************************************************************
3389 +* Desc: device driver write routine
3390 +* this function is not meaningful for the laser devices
3391 +* Inputs: major - the major device number
3392 +* minor - the minor device number
3393 +* arg - read/write arguments
3394 +* Outputs: see below
3396 +* Scope: public API
3397 +****************************************************************************/
3399 +rtems_device_driver SciWrite (
3400 + rtems_device_major_number major,
3401 + rtems_device_minor_number minor,
3405 + rtems_libio_rw_args_t *rw_args; // ptr to argument struct
3409 + rw_args = (rtems_libio_rw_args_t *) arg;
3411 + if (minor != SCI_MINOR)
3413 + return RTEMS_INVALID_NAME; // check the minor number
3416 + if (SciOpened == DRIVER_CLOSED)
3418 + return RTEMS_INCORRECT_STATE; // must be opened first
3421 + buffer = (uint8_t*)rw_args->buffer; // points to data
3423 + length = rw_args->count; // how many bytes
3427 + SciWriteCharWait(*buffer++); // send the bytes out
3430 + rw_args->bytes_moved = rw_args->count; // how many we wrote
3432 + return RTEMS_SUCCESSFUL;
3436 +/****************************************************************************
3438 +* Desc: device driver control routine
3439 +* see below for an example of how to use the ioctl interface
3440 +* Inputs: major - the major device number
3441 +* minor - the minor device number
3442 +* arg - io control args
3443 +* Outputs: see below
3445 +* Scope: public API
3446 +****************************************************************************/
3448 +rtems_device_driver SciControl (
3449 + rtems_device_major_number major,
3450 + rtems_device_minor_number minor,
3454 + rtems_libio_ioctl_args_t *args = arg; // rtems arg struct
3455 + uint16_t command; // the cmd to execute
3456 + uint16_t unused; // maybe later
3457 + uint16_t *ptr; // ptr to user data
3459 +//printk("%s major=%d minor=%d\r\n", __FUNCTION__,major,minor);
3461 + // do some sanity checking
3463 + if (minor != SCI_MINOR)
3465 + return RTEMS_INVALID_NAME; // check the minor number
3468 + if (SciOpened == DRIVER_CLOSED)
3470 + return RTEMS_INCORRECT_STATE; // must be open first
3475 + return RTEMS_INVALID_ADDRESS; // must have args
3478 + args->ioctl_return = -1; // assume an error
3480 + command = args->command; // get the command
3481 + ptr = args->buffer; // this is an address
3482 + unused = *ptr; // brightness
3484 + if (command == SCI_SEND_BREAK) // process the command
3486 + SciSendBreak(); // send break char
3489 + args->ioctl_return = 0; // return status
3491 + return RTEMS_SUCCESSFUL;
3495 +/////////////////////////////////////////////////////////////////////////////
3498 +// HARDWARE LEVEL ROUTINES
3500 +/////////////////////////////////////////////////////////////////////////////
3502 +/****************************************************************************
3504 +* Desc: setup the uart based on the termios modules requests
3505 +* Inputs: baud rate
3509 +****************************************************************************/
3511 +static void SciSetBaud(uint32_t rate)
3514 + uint16_t save_sccr1;
3516 +// when you open the console you need to set the termio struct baud rate
3517 +// it has a default value of 9600, when someone calls tcsetattr it reverts!
3519 + SciBaud = rate; // save the rate
3521 + // calculate the register value as a float and convert to an int
3522 + // set baud rate - you must define the system clock constant
3523 + // see mrm332.h for an example
3525 + value = ( (uint16_t) ( SYS_CLOCK / rate / 32.0 + 0.5 ) & 0x1fff );
3527 + save_sccr1 = *SCCR1; // save register
3529 + // also turns off the xmtr and rcvr
3531 + *SCCR1 &= SCI_DISABLE_INT_ALL; // disable interrupts
3533 + *SCCR0 = value; // write the register
3535 + *SCCR1 = save_sccr1; // restore register
3541 +/****************************************************************************
3542 +* Func: SciSetParity
3543 +* Desc: setup the uart based on the termios modules requests
3548 +****************************************************************************/
3550 +static void SciSetParity(uint16_t parity)
3554 + value = *SCCR1; // get the register
3556 + if (parity == SCI_PARITY_ODD)
3558 + value |= SCI_PARITY_ENABLE; // parity enabled
3559 + value |= SCI_PARITY_ODD; // parity odd
3562 + else if (parity == SCI_PARITY_EVEN)
3564 + value |= SCI_PARITY_ENABLE; // parity enabled
3565 + value &= ~SCI_PARITY_ODD; // parity even
3568 + else if (parity == SCI_PARITY_NONE)
3570 + value &= ~SCI_PARITY_ENABLE; // disabled, most common
3573 + /* else no changes */
3575 + *SCCR1 = value; // write the register
3581 +/****************************************************************************
3582 +* Func: SciSetDataBits
3583 +* Desc: setup the uart based on the termios modules requests
3584 +* Inputs: data bits
3588 +****************************************************************************/
3590 +static void SciSetDataBits(uint16_t bits)
3594 + value = *SCCR1; // get the register
3596 + /* note - the parity setting affects the number of data bits */
3598 + if (bits == SCI_9_DATA_BITS)
3600 + value |= SCI_9_DATA_BITS; // 9 data bits
3603 + else if (bits == SCI_8_DATA_BITS)
3605 + value &= SCI_8_DATA_BITS; // 8 data bits
3608 + /* else no changes */
3610 + *SCCR1 = value; // write the register
3616 +/****************************************************************************
3617 +* Func: SciDisableAllInterrupts
3618 +* Func: SciEnableTransmitInterrupts
3619 +* Func: SciEnableReceiveInterrupts
3620 +* Desc: handles generation of interrupts by the sci module
3625 +****************************************************************************/
3627 +static void inline SciDisableAllInterrupts( void )
3629 + // this also turns off the xmtr and rcvr
3631 + *SCCR1 &= SCI_DISABLE_INT_ALL;
3634 +static void inline SciEnableReceiveInterrupts( void )
3636 + *SCCR1 |= SCI_ENABLE_INT_RX;
3639 +static void inline SciDisableReceiveInterrupts( void )
3641 + *SCCR1 &= SCI_DISABLE_INT_RX;
3644 +static void inline SciEnableTransmitInterrupts( void )
3646 + *SCCR1 |= SCI_ENABLE_INT_TX;
3649 +static void inline SciDisableTransmitInterrupts( void )
3651 + *SCCR1 &= SCI_DISABLE_INT_TX;
3655 +/****************************************************************************
3656 +* Func: SciEnableTransmitter, SciDisableTransmitter
3657 +* Func: SciEnableReceiver, SciDisableReceiver
3658 +* Desc: turns the transmitter and receiver on and off
3663 +****************************************************************************/
3665 +static void inline SciEnableTransmitter( void )
3667 + *SCCR1 |= SCI_ENABLE_XMTR;
3670 +static void inline SciDisableTransmitter( void )
3672 + *SCCR1 &= SCI_DISABLE_XMTR;
3675 +static void inline SciEnableReceiver( void )
3677 + *SCCR1 |= SCI_ENABLE_RCVR;
3680 +static void inline SciDisableReceiver( void )
3682 + *SCCR1 &= SCI_DISABLE_RCVR;
3686 +/****************************************************************************
3687 +* Func: SciWriteCharWait
3688 +* Desc: wait for room in the fifo and then put a char in
3689 +* Inputs: a byte to send
3693 +****************************************************************************/
3695 +void SciWriteCharWait(uint8_t c)
3697 + // poll the fifo, waiting for room for another character
3699 + while ( ( *SCSR & SCI_XMTR_AVAILABLE ) == 0 )
3701 + /* Either we are writing to the fifo faster than
3702 + * the uart can clock bytes out onto the cable,
3703 + * or we are in flow control (actually no, we
3704 + * are ignoring flow control from the other end).
3705 + * In the first case, higher baud rates will help.
3707 + /* relinquish processor while waiting */
3708 + rtems_task_wake_after(RTEMS_YIELD_PROCESSOR);
3711 + *SCDR = c; // send the charcter
3713 + SciBytesOut++; // increment the counter
3718 +/****************************************************************************
3719 +* Func: SciWriteCharNoWait
3720 +* Desc: if no room in the fifo throw the char on the floor
3721 +* Inputs: a byte to send
3725 +****************************************************************************/
3727 +void SciWriteCharNoWait(uint8_t c)
3729 + if ( ( *SCSR & SCI_XMTR_AVAILABLE ) == 0 )
3731 + return; // no room, throw it away
3734 + *SCDR = c; // put the char in the fifo
3736 + SciBytesOut++; // increment the counter
3742 +/****************************************************************************
3743 +* Func: SciReadCharWait
3744 +* Desc: read a character, waiting for one to show up, if need be
3746 +* Outputs: a character
3749 +****************************************************************************/
3751 +uint8_t inline SciReadCharWait( void )
3755 + while ( SciCharAvailable() == 0 ) // anything there?
3757 + /* relinquish processor while waiting */
3758 + rtems_task_wake_after(RTEMS_YIELD_PROCESSOR);
3761 + // if you have rcv ints enabled, then the isr will probably
3762 + // get the character before you will unless you turn off ints
3763 + // ie polling and ints don't mix that well
3765 + ch = *SCDR; // get the charcter
3767 + SciBytesIn++; // increment the counter
3769 + return ch; // return the char
3772 +/****************************************************************************
3773 +* Func: SciReadCharNoWait
3774 +* Desc: try to get a char but dont wait for one
3776 +* Outputs: a character or -1 if none
3779 +****************************************************************************/
3781 +uint8_t inline SciReadCharNoWait( void )
3785 + if ( SciCharAvailable() == 0 ) // anything there?
3788 + ch = *SCDR; // get the character
3790 + SciBytesIn++; // increment the count
3792 + return ch; // return the char
3796 +/****************************************************************************
3797 +* Func: SciCharAvailable
3798 +* Desc: is there a receive character in the data register
3800 +* Outputs: false if no char available, else true
3803 +****************************************************************************/
3805 +uint8_t inline SciCharAvailable( void )
3807 + return ( *SCSR & SCI_RCVR_READY ); // char in data register?
3811 +/****************************************************************************
3812 +* Func: SciSendBreak
3813 +* Desc: send 1 or tow breaks (all zero bits)
3818 +****************************************************************************/
3820 +void SciSendBreak( void )
3822 + // From the Motorola QSM reference manual -
3824 + // "if SBK is toggled by writing it first to a one and then immediately
3825 + // to a zero (in less than one serial frame interval), the transmitter
3826 + // sends only one or two break frames before reverting to mark (idle)
3827 + // or before commencing to send more data"
3829 + *SCCR1 |= SCI_SEND_BREAK; // set the bit
3831 + *SCCR1 &= ~SCI_SEND_BREAK; // clear the bit
3837 +/////////////////////////////////////////////////////////////////////////////
3842 +/////////////////////////////////////////////////////////////////////////////
3844 +/****************************************************************************
3845 +* Func: SciUnitTest
3846 +* Desc: test the device driver
3850 +****************************************************************************/
3853 +#define O_RDWR LIBIO_FLAGS_READ_WRITE // dont like this but...
3857 + uint8_t byte; // a character
3858 + uint16_t fd; // file descriptor for device
3859 + uint16_t result; // result of ioctl
3861 + fd = open("/dev/sci",O_RDWR); // open the device
3863 +printk("SCI open fd=%d\r\n",fd);
3865 + result = write(fd, "abcd\r\n", 6); // send a string
3867 +printk("SCI write result=%d\r\n",result);
3869 + result = read(fd, &byte, 1); // read a byte
3871 +printk("SCI read result=%d,byte=%x\r\n",result,byte);
3878 +/****************************************************************************
3879 +* Func: SciPrintStats
3880 +* Desc: print out some driver information
3884 +****************************************************************************/
3886 +void SciPrintStats ( void )
3890 + printk( "SYS_CLOCK is %2.6f Mhz\r\n\n", SYS_CLOCK / 1000000.0 );
3892 + printk( "Current baud rate is %d bps or %d cps\r\n\n", SciBaud, SciBaud / 10 );
3894 + printk( "SCI Uart chars in %8d\r\n", SciBytesIn );
3895 + printk( "SCI Uart chars out %8d\r\n", SciBytesOut );
3896 + printk( "SCI Uart framing errors %8d\r\n", SciErrorsFraming );
3897 + printk( "SCI Uart parity errors %8d\r\n", SciErrorsParity );
3898 + printk( "SCI Uart overrun errors %8d\r\n", SciErrorsOverrun );
3899 + printk( "SCI Uart noise errors %8d\r\n", SciErrorsNoise );
3903 Index: rtems/c/src/lib/libbsp/m68k/mo376/startup/bspstart.c
3904 ===================================================================
3906 +++ rtems/c/src/lib/libbsp/m68k/mo376/startup/bspstart.c
3909 + * This routine starts the application. It includes application,
3910 + * board, and monitor specific initialization and configuration.
3911 + * The generic CPU dependent initialization has been performed
3912 + * before this routine is invoked.
3914 + * COPYRIGHT (c) 1989-1999.
3915 + * On-Line Applications Research Corporation (OAR).
3917 + * The license and distribution terms for this file may be
3918 + * found in the file LICENSE in this distribution or at
3919 + * http://www.rtems.com/license/LICENSE.
3921 + * $Id: bspstart.c,v 1.7 2004/04/21 10:42:52 ralf Exp $
3925 +#include <rtems/libio.h>
3927 +#include <string.h>
3930 + * The original table from the application and our copy of it with
3934 +extern rtems_configuration_table Configuration;
3935 +rtems_configuration_table BSP_Configuration;
3937 +rtems_cpu_table Cpu_table;
3939 +char *rtems_progname;
3942 + * Use the shared implementations of the following routines
3945 +void bsp_postdriver_hook(void);
3946 +void bsp_libc_init( void *, uint32_t, int );
3947 +void bsp_pretasking_hook(void); /* m68k version */
3950 + * Call Spurious_Initialize in bsp_predriver_hook because
3951 + * bsp_predriver_hook is call after the _ISR_Vector_Table allocation
3954 +void bsp_predriver_hook(void)
3956 + void Spurious_Initialize();
3957 + Spurious_Initialize();
3963 + * This routine does the bulk of the system initialization.
3966 +void bsp_start( void )
3969 + extern void *_WorkspaceBase;
3970 + extern void *_RamSize;
3971 + extern unsigned long _M68k_Ramsize;
3973 + _M68k_Ramsize = (unsigned long)&_RamSize; /* RAM size set in linker script */
3976 + * we only use a hook to get the C library initialized.
3979 + Cpu_table.pretasking_hook = bsp_pretasking_hook;
3980 + Cpu_table.predriver_hook = bsp_predriver_hook;
3981 + Cpu_table.postdriver_hook = bsp_postdriver_hook;
3983 + m68k_get_vbr( vbr );
3984 + Cpu_table.interrupt_vector_table = vbr;
3986 + BSP_Configuration.work_space_start = (void *) &_WorkspaceBase;
3988 + /* Clock_exit is done as an atexit() function */
3990 Index: rtems/c/src/lib/libbsp/m68k/mo376/startup/start_c.c
3991 ===================================================================
3993 +++ rtems/c/src/lib/libbsp/m68k/mo376/startup/start_c.c
3999 +#include <mrm332.h>
4000 +#include <rtems/m68k/sim.h>
4001 +#define __START_C__
4004 +m68k_isr_entry M68Kvec[256];
4005 +m68k_isr_entry vectors[256];
4006 +char * const __argv[]= {"main", ""};
4008 +void boot_card(int argc, char * const argv[]);
4011 + * This prototype really should have the noreturn attribute but
4012 + * that causes a warning. Not sure how to fix that.
4014 +/* void dumby_start () __attribute__ ((noreturn)); */
4019 + /* Synthesizer Control Register */
4020 + /* see section(s) 4.8 */
4021 + /* end include in ram_init.S */
4022 + *SYNCR = (unsigned short int)
4023 + ( SAM(MRM_W,15,VCO) | SAM(0x0,14,PRESCALE) | SAM(MRM_Y,8,COUNTER) );
4024 + while (! (*SYNCR & SLOCK)); /* protect from clock overshoot */
4025 + /* include in ram_init.S */
4026 + *SYNCR = (unsigned short int)
4027 + ( SAM(MRM_W,15,VCO) | SAM(MRM_X,14,PRESCALE) | SAM(MRM_Y,8,COUNTER) );
4029 + /* System Protection Control Register */
4030 + /* !!! can only write to once after reset !!! */
4031 + /* see section 3.8.4 of the SIM Reference Manual */
4032 + *SYPCR = (unsigned char)( HME | BME );
4034 + /* Periodic Interrupr Control Register */
4035 + /* see section 3.8.2 of the SIM Reference Manual */
4036 + *PICR = (unsigned short int)
4037 + ( SAM(0,8,PIRQL) | SAM(MRM_PIV,0,PIV) );
4038 + /* ^^^ zero disables interrupt, don't enable here or ram_init will
4039 + be wrong. It's enabled below. */
4041 + /* Periodic Interrupt Timer Register */
4042 + /* see section 3.8.3 of the SIM Reference Manual */
4043 + *PITR = (unsigned short int)( SAM(0x09,0,PITM) );
4044 + /* 1.098mS interrupt, assuming 32.768 KHz input clock */
4047 + /* load values before enabled */
4048 + *PORTC = (unsigned char) 0x0;
4050 + /* Port E and F Data Register */
4051 + /* see section 9 of the SIM Reference Manual */
4052 + *PORTE0 = (unsigned char) 0;
4053 + *PORTF0 = (unsigned char) 0;
4055 + /* Port E and F Data Direction Register */
4056 + /* see section 9 of the SIM Reference Manual */
4057 + *DDRE = (unsigned char) 0xff;
4058 + *DDRF = (unsigned char) 0xfd;
4060 + /* Port E and F Pin Assignment Register */
4061 + /* see section 9 of the SIM Reference Manual */
4062 + *PEPAR = (unsigned char) 0;
4063 + *PFPAR = (unsigned char) 0;
4065 + /* end of SIM initalization code */
4066 + /* end include in ram_init.S */
4069 + * Initialize RAM by copying the .data section out of ROM (if
4070 + * needed) and "zero-ing" the .bss section.
4073 + register char *src = _etext;
4074 + register char *dst = _copy_start;
4076 + if (_copy_data_from_rom)
4077 + /* ROM has data at end of text; copy it. */
4078 + while (dst < _edata)
4082 + for (dst = _clear_start; dst< end; dst++)
4089 + * Initialize vector table.
4092 + m68k_isr_entry *monitors_vector_table;
4094 + m68k_get_vbr(monitors_vector_table);
4096 + M68Kvec[ 4 ] = monitors_vector_table[ 4 ]; /* breakpoints vector */
4097 + M68Kvec[ 9 ] = monitors_vector_table[ 9 ]; /* trace vector */
4098 + M68Kvec[ 31 ] = monitors_vector_table[ 31 ]; /* level 7 interrupt */
4099 + M68Kvec[ 47 ] = monitors_vector_table[ 47 ]; /* system call vector */
4100 + M68Kvec[ 66 ] = monitors_vector_table[ 66 ]; /* user defined */
4102 + m68k_set_vbr(&M68Kvec);
4106 + * Initalize the board.
4109 + /* Spurious should be called in the predriver hook */
4110 + /* Spurious_Initialize(); */
4114 + * Execute main with arguments argc and agrv.
4116 + boot_card(1,__argv);
4120 Index: rtems/c/src/lib/libbsp/m68k/mo376/include/tm27.h
4121 ===================================================================
4123 +++ rtems/c/src/lib/libbsp/m68k/mo376/include/tm27.h
4128 + * The license and distribution terms for this file may be
4129 + * found in the file LICENSE in this distribution or at
4130 + * http://www.rtems.com/license/LICENSE.
4132 + * $Id: tm27.h,v 1.2 2004/04/23 04:47:36 ralf Exp $
4135 +#ifndef _RTEMS_TMTEST27
4136 +#error "This is an RTEMS internal file you must not include directly."
4143 + * Define the interrupt mechanism for Time Test 27
4146 +/* XXX - JRS - I want to compile the tmtests */
4148 +#define MUST_WAIT_FOR_INTERRUPT 1
4150 +#define Install_tm27_vector( handler ) /* empty */
4152 +#define Cause_tm27_intr() /* empty */
4154 +#define Clear_tm27_intr() /* empty */
4156 +#define Lower_tm27_intr() /* empty */
4159 Index: rtems/c/src/lib/libbsp/m68k/mo376/times
4160 ===================================================================
4162 +++ rtems/c/src/lib/libbsp/m68k/mo376/times
4165 +# Timing Test Suite Results for the MRM332 BSP
4167 +# $Id: times,v 1.2 2004/01/07 21:13:50 joel Exp $
4170 +NOTE: This BSP is user submitted and no information is currently available.
4172 +TBD: MATT - update this with real times!
4176 +Clock Speed: 20 Mhz
4177 +Memory Configuration: SRAM, DRAM, cache, etc
4180 +Times Reported in: cycles, microseconds, etc
4181 +Timer Source: Count Down Timer, on-CPU cycle counter, etc
4187 +== ================================================================= ==== ====
4188 + 1 rtems_semaphore_create 20
4189 + rtems_semaphore_delete 21
4190 + rtems_semaphore_obtain: available 15
4191 + rtems_semaphore_obtain: not available -- NO_WAIT 15
4192 + rtems_semaphore_release: no waiting tasks 16
4194 + 2 rtems_semaphore_obtain: not available -- caller blocks 62
4196 + 3 rtems_semaphore_release: task readied -- preempts caller 55
4198 + 4 rtems_task_restart: blocked task -- preempts caller 77
4199 + rtems_task_restart: ready task -- preempts caller 70
4200 + rtems_semaphore_release: task readied -- returns to caller 25
4201 + rtems_task_create 57
4202 + rtems_task_start 31
4203 + rtems_task_restart: suspended task -- returns to caller 36
4204 + rtems_task_delete: suspended task 47
4205 + rtems_task_restart: ready task -- returns to caller 37
4206 + rtems_task_restart: blocked task -- returns to caller 46
4207 + rtems_task_delete: blocked task 50
4209 + 5 rtems_task_suspend: calling task 51
4210 + rtems_task_resume: task readied -- preempts caller 49
4212 + 6 rtems_task_restart: calling task 59
4213 + rtems_task_suspend: returns to caller 18
4214 + rtems_task_resume: task readied -- returns to caller 19
4215 + rtems_task_delete: ready task 50
4217 + 7 rtems_task_restart: suspended task -- preempts caller 70
4219 + 8 rtems_task_set_priority: obtain current priority 12
4220 + rtems_task_set_priority: returns to caller 27
4221 + rtems_task_mode: obtain current mode 5
4222 + rtems_task_mode: no reschedule 5
4223 + rtems_task_mode: reschedule -- returns to caller 8
4224 + rtems_task_mode: reschedule -- preempts caller 39
4225 + rtems_task_set_note 13
4226 + rtems_task_get_note 13
4227 + rtems_clock_set 33
4230 + 9 rtems_message_queue_create 110
4231 + rtems_message_queue_send: no waiting tasks 37
4232 + rtems_message_queue_urgent: no waiting tasks 37
4233 + rtems_message_queue_receive: available 31
4234 + rtems_message_queue_flush: no messages flushed 12
4235 + rtems_message_queue_flush: messages flushed 16
4236 + rtems_message_queue_delete 26
4238 +10 rtems_message_queue_receive: not available -- NO_WAIT 15
4239 + rtems_message_queue_receive: not available -- caller blocks 62
4241 +11 rtems_message_queue_send: task readied -- preempts caller 72
4243 +12 rtems_message_queue_send: task readied -- returns to caller 39
4245 +13 rtems_message_queue_urgent: task readied -- preempts caller 72
4247 +14 rtems_message_queue_urgent: task readied -- returns to caller 39
4249 +15 rtems_event_receive: obtain current events 1
4250 + rtems_event_receive: not available -- NO_WAIT 12
4251 + rtems_event_receive: not available -- caller blocks 56
4252 + rtems_event_send: no task readied 12
4253 + rtems_event_receive: available 12
4254 + rtems_event_send: task readied -- returns to caller 24
4256 +16 rtems_event_send: task readied -- preempts caller 55
4258 +17 rtems_task_set_priority: preempts caller 62
4260 +18 rtems_task_delete: calling task 83
4262 +19 rtems_signal_catch 9
4263 + rtems_signal_send: returns to caller 15
4264 + rtems_signal_send: signal to self 18
4265 + exit ASR overhead: returns to calling task 22
4266 + exit ASR overhead: returns to preempting task 49
4268 +20 rtems_partition_create 35
4269 + rtems_region_create 23
4270 + rtems_partition_get_buffer: available 15
4271 + rtems_partition_get_buffer: not available 13
4272 + rtems_partition_return_buffer 18
4273 + rtems_partition_delete 16
4274 + rtems_region_get_segment: available 22
4275 + rtems_region_get_segment: not available -- NO_WAIT 21
4276 + rtems_region_return_segment: no waiting tasks 19
4277 + rtems_region_get_segment: not available -- caller blocks 64
4278 + rtems_region_return_segment: task readied -- preempts caller 74
4279 + rtems_region_return_segment: task readied -- returns to caller 44
4280 + rtems_region_delete 16
4281 + rtems_io_initialize 2
4286 + rtems_io_control 1
4288 +21 rtems_task_ident 149
4289 + rtems_message_queue_ident 145
4290 + rtems_semaphore_ident 156
4291 + rtems_partition_ident 145
4292 + rtems_region_ident 148
4293 + rtems_port_ident 145
4294 + rtems_timer_ident 145
4295 + rtems_rate_monotonic_ident 145
4297 +22 rtems_message_queue_broadcast: task readied -- returns to caller 42
4298 + rtems_message_queue_broadcast: no waiting tasks 17
4299 + rtems_message_queue_broadcast: task readied -- preempts caller 78
4301 +23 rtems_timer_create 14
4302 + rtems_timer_fire_after: inactive 22
4303 + rtems_timer_fire_after: active 24
4304 + rtems_timer_cancel: active 15
4305 + rtems_timer_cancel: inactive 13
4306 + rtems_timer_reset: inactive 21
4307 + rtems_timer_reset: active 23
4308 + rtems_timer_fire_when: inactive 34
4309 + rtems_timer_fire_when: active 34
4310 + rtems_timer_delete: active 19
4311 + rtems_timer_delete: inactive 17
4312 + rtems_task_wake_when 69
4314 +24 rtems_task_wake_after: yield -- returns to caller 9
4315 + rtems_task_wake_after: yields -- preempts caller 45
4317 +25 rtems_clock_tick 4
4322 + _Thread_Disable_dispatch 0
4323 + _Thread_Enable_dispatch 7
4324 + _Thread_Set_state 11
4325 + _Thread_Disptach (NO FP) 31
4326 + context switch: no floating point contexts 21
4327 + context switch: self 10
4328 + context switch: to another task 10
4329 + context switch: restore 1st FP task 25
4330 + fp context switch: save idle, restore idle 31
4331 + fp context switch: save idle, restore initialized 19
4332 + fp context switch: save initialized, restore initialized 20
4338 + _Thread_Get: invalid id 0
4340 +27 interrupt entry overhead: returns to interrupted task 6
4341 + interrupt exit overhead: returns to interrupted task 6
4342 + interrupt entry overhead: returns to nested interrupt 6
4343 + interrupt exit overhead: returns to nested interrupt 5
4344 + interrupt entry overhead: returns to preempting task 7
4345 + interrupt exit overhead: returns to preempting task 36
4347 +28 rtems_port_create 16
4348 + rtems_port_external_to_internal 11
4349 + rtems_port_internal_to_external 11
4350 + rtems_port_delete 16
4352 +29 rtems_rate_monotonic_create 15
4353 + rtems_rate_monotonic_period: initiate period -- returns to caller 21
4354 + rtems_rate_monotonic_period: obtain status 13
4355 + rtems_rate_monotonic_cancel 16
4356 + rtems_rate_monotonic_delete: inactive 18
4357 + rtems_rate_monotonic_delete: active 20
4358 + rtems_rate_monotonic_period: conclude periods -- caller blocks 53
4359 Index: rtems/c/src/lib/libbsp/m68k/mo376/include/mrm332.h
4360 ===================================================================
4362 +++ rtems/c/src/lib/libbsp/m68k/mo376/include/mrm332.h
4366 + * $Id: mrm332.h,v 1.5 2004/04/21 16:01:35 ralf Exp $
4372 +/* SIM_MM (SIM Module Mapping) determines the location of the control
4373 + register block. When MM=0, register addresses range fom 0x7ff000 to
4374 + 0x7FFFFF. When MM=1, register addresses range from 0xfff000 to
4378 +/* Interrupt related definitions */
4379 +#define SIM_IARB 15
4380 +#define QSM_IARB 10
4383 +#define ISRL_PIT 4 /* zero disables PIT */
4385 +#define EFI_QIVR 66 /* 66=>SCI and 67=>QSPI interrupt */
4386 +#define ISRL_QSPI 0
4388 +#define EFI_SPINT 24 /* spurious interrupt */
4389 +#define EFI_INT1 25 /* CTS interrupt */
4392 +/* System Clock definitions */
4393 +#define XTAL 32768.0 /* crystal frequency in Hz */
4396 +/* Default MRM clock rate (8.388688 MHz) set by CPU32: */
4397 +#define MRM_W 0 /* system clock parameters */
4403 +/* 16.77722 MHz: */
4404 +#define MRM_W 1 /* system clock parameters */
4410 +/* 25.16582 MHz: */
4411 +#define MRM_W 1 /* system clock parameters */
4416 +#define SYS_CLOCK (XTAL*4.0*(MRM_Y+1)*(1 << (2*MRM_W+MRM_X)))
4417 +#define SCI_BAUD 19200 /* RS232 Baud Rate */
4419 +/* macros/functions */
4424 + * This prototype really should have the noreturn attribute but
4425 + * that causes a warning. Not sure how to fix that.
4427 +/* static void reboot(void) __attribute__ ((noreturn)); */
4428 +static void reboot(void);
4429 +__inline__ static void reboot() {asm("trap #15; .word 0x0063");}
4433 +#endif /* _MRM_H_ */
4434 Index: rtems/c/src/lib/libbsp/m68k/mo376/include/bspopts.h.in
4435 ===================================================================
4437 +++ rtems/c/src/lib/libbsp/m68k/mo376/include/bspopts.h.in
4439 +/* include/bspopts.h.in. Generated from configure.ac by autoheader. */
4441 +/* Define to the address where bug reports for this package should be sent. */
4442 +#undef PACKAGE_BUGREPORT
4444 +/* Define to the full name of this package. */
4445 +#undef PACKAGE_NAME
4447 +/* Define to the full name and version of this package. */
4448 +#undef PACKAGE_STRING
4450 +/* Define to the one symbol short name of this package. */
4451 +#undef PACKAGE_TARNAME
4453 +/* Define to the version of this package. */
4454 +#undef PACKAGE_VERSION
4455 Index: rtems/c/src/lib/libbsp/m68k/mo376/spurious/spinit.c
4456 ===================================================================
4458 +++ rtems/c/src/lib/libbsp/m68k/mo376/spurious/spinit.c
4462 + * This routine installs spurious interrupt handlers for the mrm.
4464 + * Input parameters: NONE
4466 + * Output parameters: NONE
4468 + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993.
4469 + * On-Line Applications Research Corporation (OAR).
4471 + * The license and distribution terms for this file may be
4472 + * found in the file LICENSE in this distribution or at
4473 + * http://www.rtems.com/license/LICENSE.
4475 + * $Id: spinit.c,v 1.5 2004/04/21 10:42:52 ralf Exp $
4481 +const char * const _Spurious_Error_[] = {"Reset","Bus Error","Address Error",
4482 + "Illegal Instruction","Zero Division","CHK, CHK2 Instruction",
4483 + "TRAPcc, TRAPV Instruction","Privilege Violation","Trace",
4484 + "Line 1010 Emulation","Line 1111 Emulation","Hardware Breakpoint",
4485 + "Coprocessor Protocal Violation",
4486 + "Format Error ans Uninitialized Interrupt","Unassigned",
4487 + "Spurious Interrupt","AVec1","AVec2","AVec3","AVec4","AVec5","AVec6",
4488 + "AVec7","Trap Instruction","Debug","Reboot","Reserved Coprocessor",
4489 + "Reserved Unassigned","User Defined"};
4491 +rtems_isr Spurious_Isr(
4492 + rtems_vector_number vector
4497 + const char * const VectDescrip[] = {
4498 + _Spurious_Error_[0], _Spurious_Error_[0], _Spurious_Error_[1],
4499 + _Spurious_Error_[2], _Spurious_Error_[3], _Spurious_Error_[4],
4500 + _Spurious_Error_[5], _Spurious_Error_[6], _Spurious_Error_[7],
4501 + _Spurious_Error_[8], _Spurious_Error_[9], _Spurious_Error_[10],
4502 + _Spurious_Error_[11], _Spurious_Error_[12], _Spurious_Error_[13],
4503 + _Spurious_Error_[13], _Spurious_Error_[14], _Spurious_Error_[14],
4504 + _Spurious_Error_[14], _Spurious_Error_[14], _Spurious_Error_[14],
4505 + _Spurious_Error_[14], _Spurious_Error_[14], _Spurious_Error_[14],
4506 + _Spurious_Error_[15], _Spurious_Error_[16], _Spurious_Error_[17],
4507 + _Spurious_Error_[18], _Spurious_Error_[19], _Spurious_Error_[20],
4508 + _Spurious_Error_[21], _Spurious_Error_[22], _Spurious_Error_[23],
4509 + _Spurious_Error_[24], _Spurious_Error_[23], _Spurious_Error_[23],
4510 + _Spurious_Error_[23], _Spurious_Error_[23], _Spurious_Error_[23],
4511 + _Spurious_Error_[23], _Spurious_Error_[23], _Spurious_Error_[23],
4512 + _Spurious_Error_[23], _Spurious_Error_[23], _Spurious_Error_[23],
4513 + _Spurious_Error_[23], _Spurious_Error_[23], _Spurious_Error_[25],
4514 + _Spurious_Error_[26], _Spurious_Error_[26], _Spurious_Error_[26],
4515 + _Spurious_Error_[26], _Spurious_Error_[26], _Spurious_Error_[26],
4516 + _Spurious_Error_[26], _Spurious_Error_[26], _Spurious_Error_[26],
4517 + _Spurious_Error_[26], _Spurious_Error_[26], _Spurious_Error_[27],
4518 + _Spurious_Error_[27], _Spurious_Error_[27], _Spurious_Error_[27],
4519 + _Spurious_Error_[27], _Spurious_Error_[28]};
4522 + //asm volatile ( "movea.l %%sp,%0 " : "=a" (sp) : "0" (sp) );
4524 + _CPU_ISR_Set_level( 7 );
4527 + RAW_PUTS("\n\rRTEMS: Spurious interrupt: ");
4528 + RAW_PUTS((char *)VectDescrip[( (vector>64) ? 64 : vector )]);
4529 + RAW_PUTS("\n\rRTEMS: Vector: ");
4531 + RAW_PUTS(" sp: ");
4538 + asm(" .word 0x4afa");
4543 +void Spurious_Initialize(void)
4545 + rtems_vector_number vector;
4547 + for ( vector = 0x0 ; vector <= 0xFF ; vector++ )
4556 + /* These vectors used by CPU32bug - don't overwrite them. */
4560 + (void) set_vector( Spurious_Isr, vector, 1 );
4565 Index: rtems/c/src/lib/libbsp/m68k/mo376/startup/linkcmds
4566 ===================================================================
4568 +++ rtems/c/src/lib/libbsp/m68k/mo376/startup/linkcmds
4572 + * $Id: linkcmds,v 1.6 2006/02/08 12:25:24 joel Exp $
4579 + * The memory map looks like this:
4580 + * +--------------------+ <- low memory
4583 + * | ctor list | the ctor and dtor lists are for
4584 + * | dtor list | C++ support
4586 + * +--------------------+
4587 + * | .data | initialized data goes here
4590 + * +--------------------+
4592 + * | _clear_start| start of bss, cleared by crt0
4593 + * | _end | start of heap, used by sbrk()
4594 + * +--------------------+
4598 + * | __stack | top of stack
4599 + * +--------------------+ <- high memory
4603 + * Declare some sizes.
4605 +_RamBase = DEFINED(_RamBase) ? _RamBase : 0x10000;
4606 +_RamSize = DEFINED(_RamSize) ? _RamSize : 0x70000;
4607 +_RamEnd = _RamBase + _RamSize;
4608 +_HeapSize = DEFINED(_HeapSize) ? _HeapSize : 0x10000;
4609 +_StackSize = DEFINED(_StackSize) ? _StackSize : 0x2000;
4613 + ram : ORIGIN = 0x10000, LENGTH = 0x70000
4616 +_copy_data_from_rom = 0;
4619 + * stick everything in ram (of course)
4628 + * Text, data and bss segments
4634 + * C++ constructors/destructors
4636 + *(.gnu.linkonce.t.*)
4639 + * Initialization and finalization code.
4641 + * Various files can provide initialization and finalization
4642 + * functions. crtbegin.o and crtend.o are two instances. The
4643 + * body of these functions are in .init and .fini sections. We
4644 + * accumulate the bodies here, and prepend function prologues
4645 + * from crti.o and function epilogues from crtn.o. crti.o must
4646 + * be linked first; crtn.o must be linked last. Because these
4647 + * are wildcards, it doesn't matter if the user does not
4648 + * actually link against crti.o and crtn.o; the linker won't
4649 + * look for a file to match a wildcard. The wildcard also
4650 + * means that it doesn't matter which directory crti.o and
4653 + PROVIDE (_init = .);
4657 + PROVIDE (_fini = .);
4663 + * Special FreeBSD sysctl sections.
4666 + __start_set_sysctl_set = .;
4668 + __stop_set_sysctl_set = ABSOLUTE(.);
4673 + * C++ constructors/destructors
4675 + * gcc uses crtbegin.o to find the start of the constructors
4676 + * and destructors so we make sure it is first. Because this
4677 + * is a wildcard, it doesn't matter if the user does not
4678 + * actually link against crtbegin.o; the linker won't look for
4679 + * a file to match a wildcard. The wildcard also means that
4680 + * it doesn't matter which directory crtbegin.o is in. The
4681 + * constructor and destructor list are terminated in
4682 + * crtend.o. The same comments apply to it.
4685 + *crtbegin.o(.ctors)
4688 + *crtbegin.o(.dtors)
4693 + * Exception frame info
4702 + _rodata_start = .;
4704 + *(.gnu.linkonce.r*)
4707 + PROVIDE (_etext = .);
4710 + PROVIDE (_copy_start = .);
4712 + *(.gnu.linkonce.d*)
4713 + *(.gcc_except_table)
4716 + PROVIDE (_edata = .);
4717 + PROVIDE (_copy_end = .);
4722 + *(.bss* .gnu.linkonce.b.*)
4725 + PROVIDE (end = .);
4731 + _WorkspaceBase = .;
4734 Index: rtems/c/src/lib/libbsp/m68k/mo376/bsp_specs
4735 ===================================================================
4737 +++ rtems/c/src/lib/libbsp/m68k/mo376/bsp_specs
4739 +%rename endfile old_endfile
4740 +%rename startfile old_startfile
4741 +%rename link old_link
4744 +%{!qrtems: %(old_startfile)} %{!nostdlib: %{qrtems: \
4745 +%{!qrtems_debug: start.o%s} \
4746 +%{qrtems_debug: start_g.o%s} \
4747 +crti.o%s crtbegin.o%s}}
4750 +%{!qrtems: %(old_link)} %{qrtems: -dc -dp -N -e start}
4753 +%{!qrtems: %(old_endfile)} %{qrtems: crtend.o%s crtn.o%s}
4755 Index: rtems/c/src/lib/libbsp/m68k/mo376/include/.cvsignore
4756 ===================================================================
4758 +++ rtems/c/src/lib/libbsp/m68k/mo376/include/.cvsignore
4765 Index: rtems/c/src/lib/libbsp/m68k/mo376/wrapup/.keep
4766 ===================================================================
4768 +++ rtems/c/src/lib/libbsp/m68k/mo376/wrapup/.keep
4771 Index: rtems/c/src/lib/libbsp/m68k/mo376/preinstall.am
4772 ===================================================================
4774 +++ rtems/c/src/lib/libbsp/m68k/mo376/preinstall.am
4776 +## Automatically generated by ampolish3 - Do not edit
4779 +$(srcdir)/preinstall.am: Makefile.am
4780 + $(AMPOLISH3) $(srcdir)/Makefile.am > $(srcdir)/preinstall.am
4784 +DISTCLEANFILES += $(PREINSTALL_DIRS)
4786 +all-local: $(TMPINSTALL_FILES)
4789 +CLEANFILES = $(TMPINSTALL_FILES)
4791 +all-am: $(PREINSTALL_FILES)
4794 +CLEANFILES += $(PREINSTALL_FILES)
4796 +$(PROJECT_LIB)/$(dirstamp):
4797 + @$(mkdir_p) $(PROJECT_LIB)
4798 + @: > $(PROJECT_LIB)/$(dirstamp)
4799 +PREINSTALL_DIRS += $(PROJECT_LIB)/$(dirstamp)
4801 +$(PROJECT_INCLUDE)/$(dirstamp):
4802 + @$(mkdir_p) $(PROJECT_INCLUDE)
4803 + @: > $(PROJECT_INCLUDE)/$(dirstamp)
4804 +PREINSTALL_DIRS += $(PROJECT_INCLUDE)/$(dirstamp)
4806 +$(PROJECT_LIB)/bsp_specs: bsp_specs $(PROJECT_LIB)/$(dirstamp)
4807 + $(INSTALL_DATA) $< $(PROJECT_LIB)/bsp_specs
4808 +PREINSTALL_FILES += $(PROJECT_LIB)/bsp_specs
4810 +$(PROJECT_INCLUDE)/bsp.h: include/bsp.h $(PROJECT_INCLUDE)/$(dirstamp)
4811 + $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp.h
4812 +PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp.h
4814 +$(PROJECT_INCLUDE)/tm27.h: include/tm27.h $(PROJECT_INCLUDE)/$(dirstamp)
4815 + $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/tm27.h
4816 +PREINSTALL_FILES += $(PROJECT_INCLUDE)/tm27.h
4818 +$(PROJECT_INCLUDE)/bspopts.h: include/bspopts.h $(PROJECT_INCLUDE)/$(dirstamp)
4819 + $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bspopts.h
4820 +PREINSTALL_FILES += $(PROJECT_INCLUDE)/bspopts.h
4822 +$(PROJECT_INCLUDE)/mrm332.h: include/mrm332.h $(PROJECT_INCLUDE)/$(dirstamp)
4823 + $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/mrm332.h
4824 +PREINSTALL_FILES += $(PROJECT_INCLUDE)/mrm332.h
4826 +$(PROJECT_INCLUDE)/coverhd.h: ../../shared/include/coverhd.h $(PROJECT_INCLUDE)/$(dirstamp)
4827 + $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/coverhd.h
4828 +PREINSTALL_FILES += $(PROJECT_INCLUDE)/coverhd.h
4830 +$(PROJECT_LIB)/start.$(OBJEXT): start.$(OBJEXT) $(PROJECT_LIB)/$(dirstamp)
4831 + $(INSTALL_DATA) $< $(PROJECT_LIB)/start.$(OBJEXT)
4832 +TMPINSTALL_FILES += $(PROJECT_LIB)/start.$(OBJEXT)
4834 +$(PROJECT_LIB)/linkcmds: startup/linkcmds $(PROJECT_LIB)/$(dirstamp)
4835 + $(INSTALL_DATA) $< $(PROJECT_LIB)/linkcmds
4836 +PREINSTALL_FILES += $(PROJECT_LIB)/linkcmds
4838 +$(PROJECT_LIB)/linkcmds_ROM: startup/linkcmds_ROM $(PROJECT_LIB)/$(dirstamp)
4839 + $(INSTALL_DATA) $< $(PROJECT_LIB)/linkcmds_ROM
4840 +PREINSTALL_FILES += $(PROJECT_LIB)/linkcmds_ROM