2 c/src/lib/libbsp/m68k/mo376/ChangeLog | 455 +++
3 c/src/lib/libbsp/m68k/mo376/Makefile.am | 68
4 c/src/lib/libbsp/m68k/mo376/README | 24
5 c/src/lib/libbsp/m68k/mo376/bsp_specs | 16
6 c/src/lib/libbsp/m68k/mo376/clock/ckinit.c | 128 +
7 c/src/lib/libbsp/m68k/mo376/configure.ac | 20
8 c/src/lib/libbsp/m68k/mo376/console/console.c | 174 +
9 c/src/lib/libbsp/m68k/mo376/console/sci.c | 1596 ++++++++++++++
10 c/src/lib/libbsp/m68k/mo376/console/sci.h | 234 ++
11 c/src/lib/libbsp/m68k/mo376/include/bsp.h | 139 +
12 c/src/lib/libbsp/m68k/mo376/include/bspopts.h.in | 16
13 c/src/lib/libbsp/m68k/mo376/include/mrm332.h | 70
14 c/src/lib/libbsp/m68k/mo376/include/tm27.h | 34
15 c/src/lib/libbsp/m68k/mo376/misc/dotests | 15
16 c/src/lib/libbsp/m68k/mo376/misc/gdbinit68 | 16
17 c/src/lib/libbsp/m68k/mo376/misc/interr.c | 99
18 c/src/lib/libbsp/m68k/mo376/preinstall.am | 66
19 c/src/lib/libbsp/m68k/mo376/spurious/spinit.c | 105
20 c/src/lib/libbsp/m68k/mo376/start/start.S | 150 +
21 c/src/lib/libbsp/m68k/mo376/startup/bspclean.c | 27
22 c/src/lib/libbsp/m68k/mo376/startup/bspstart.c | 82
23 c/src/lib/libbsp/m68k/mo376/startup/except_vect_332_ROM.S | 293 ++
24 c/src/lib/libbsp/m68k/mo376/startup/linkcmds | 164 +
25 c/src/lib/libbsp/m68k/mo376/startup/linkcmds_ROM | 200 +
26 c/src/lib/libbsp/m68k/mo376/startup/start_c.c | 125 +
27 c/src/lib/libbsp/m68k/mo376/timer/timer.c | 81
28 c/src/lib/libbsp/m68k/mo376/times | 195 +
29 make/custom/mo376.cfg | 67
30 28 files changed, 4659 insertions(+)
32 Index: rtems/make/custom/mo376.cfg
33 ===================================================================
34 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
35 +++ rtems/make/custom/mo376.cfg 2007-08-14 17:20:30.000000000 +0200
38 +# Config file for the mrm332 BSP
40 +# $Id: mrm332.cfg,v 1.9.2.3 2007/01/18 11:27:07 ralf Exp $
43 +include $(RTEMS_ROOT)/make/custom/default.cfg
46 +RTEMS_CPU_MODEL=m68332
48 +# This is the actual bsp directory used during the build process.
49 +RTEMS_BSP_FAMILY=mrm332
51 +# This contains the compiler options necessary to select the CPU model
52 +# and (hopefully) optimize for it.
55 +# optimize flag: typically -O2
56 +CFLAGS_OPTIMIZE_V = -O2 -g -fomit-frame-pointer
58 +# The following are definitions of make-exe which will work using ld as
59 +# is currently required.
61 +ifeq ($(MRM_IN_ROM),yes)
62 +# Build a rommable image - move the .data section after the .text section
64 +CPU_CFLAGS += -qnolinkcmds -T $(exec_prefix)/mrm332/lib/linkcmds_ROM
66 +# This is a good way to get debug information. The output file is large
67 +# though and greatly slows the build process so only do this if needed.
68 +# $(OBJDUMP) -dxC $(basename $@).nxe > $(basename $@).dump
71 + $(LINK.c) $(AM_CFLAGS) $(AM_LDFLAGS) -o $(basename $@).pxe \
72 + $(LINK_OBJS) $(LINK_LIBS)
73 + $(OBJCOPY) --adjust-section-vma \
74 + .data=`m68k-rtems-objdump --section-headers $(basename $@).pxe | \
75 + awk 'function h2d(x) { x=toupper(x); digits=length(x); s=0 ; \
76 + for (p=digits; p>0; p--) \
77 + s += (16^(p-1)) * ( index("0123456789ABCDEF",\
78 + substr(x,1+digits-p,1)) -1 );\
80 + /\.text/ { base = $$4 ; size = $$3 };\
81 + END { printf("0x%x", h2d(base) + h2d(size)) }'\
82 + ` $(basename $@).pxe $(basename $@).nxe
83 + $(OBJCOPY) -O srec $(basename $@).nxe $(basename $@).srec
84 + sed -e 's/.$$//' -e '/^S0/d' $(basename $@).srec | \
85 + $(PACKHEX) > $(basename $@).exe
86 + $(NM) -g -n $(basename $@).pxe > $(basename $@).pnum
87 + $(NM) -g -n $(basename $@).nxe > $(basename $@).num
88 + $(SIZE) $(basename $@).nxe
92 + $(LINK.c) $(AM_CFLAGS) $(AM_LDFLAGS) -o $(basename $@).nxe \
93 + $(LINK_OBJS) $(LINK_LIBS)
94 + $(OBJCOPY) -O srec $(basename $@).nxe $(basename $@).srec
95 +# m68k-rtems-objdump -dxC $(basename $@).nxe > $(basename $@).dump
96 + sed -e 's/.$$//' -e '/^S0/d' $(basename $@).srec | \
97 + $(PACKHEX) > $(basename $@).exe
98 + $(NM) -g -n $(basename $@).nxe > $(basename $@).num
99 + $(SIZE) $(basename $@).nxe
103 +# Miscellaneous additions go here
104 Index: rtems/c/src/lib/libbsp/m68k/mo376/console/sci.h
105 ===================================================================
106 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
107 +++ rtems/c/src/lib/libbsp/m68k/mo376/console/sci.h 2007-08-14 17:20:30.000000000 +0200
109 +/****************************************************************************
112 +* Desc: This is the include file for the serial communications interface.
114 +* Note: See bsp.h,confdefs.h,system.h for installing drivers into RTEMS.
116 +* $Id: sci.h,v 1.5 2006/09/11 21:43:55 joel Exp $
117 +****************************************************************************/
122 +/*******************************************************************************
123 + IOCTL commands for the sci driver.
124 + I'm still working on these...
125 +*******************************************************************************/
127 +#define SCI_IOCTL_PARITY_NONE 0x00 /* no parity bit after the data bits */
128 +#define SCI_IOCTL_PARITY_ODD 0x01 /* parity bit added after data bits */
129 +#define SCI_IOCTL_PARITY_EVEN 0x02 /* parity bit added after data bits */
130 +#define SCI_IOCTL_PARITY_MARK 0x03 /* parity bit is lo, -12 volts, logical 1 */
131 +#define SCI_IOCTL_PARITY_SPACE 0x04 /* parity bit is hi, +12 volts, logical 0 */
132 +#define SCI_IOCTL_PARITY_FORCED_ON 0x03 /* parity bit is forced hi or lo */
133 +#define SCI_IOCTL_PARITY_FORCED_OFF 0x04 /* parity bit is forced hi or lo */
135 +#define SCI_IOCTL_BAUD_RATE 0x20 /* set the baud rate, arg is baud */
137 +#define SCI_IOCTL_DATA_BITS 0x30 /* set the data bits, arg is # bits */
139 +#define SCI_IOCTL_STOP_BITS_1 0x40 /* 1 stop bit after char frame */
140 +#define SCI_IOCTL_STOP_BITS_2 0x41 /* 2 stop bit after char frame */
142 +#define SCI_IOCTL_MODE_NORMAL 0x50 /* normal operating mode */
143 +#define SCI_IOCTL_MODE_LOOP 0x51 /* internal loopback mode */
145 +#define SCI_IOCTL_FLOW_NONE 0x60 /* no flow control */
146 +#define SCI_IOCTL_FLOW_RTS_CTS 0x61 /* hardware flow control */
148 +#define SCI_IOCTL_SEND_BREAK 0x70 /* send an rs-232 break */
150 +#define SCI_IOCTL_MODE_1200 0x80 /* 1200,n,8,1 download mode */
151 +#define SCI_IOCTL_MODE_9600 0x81 /* 9600,n,8,1 download mode */
152 +#define SCI_IOCTL_MODE_9_BIT 0x82 /* 9600,forced,8,1 command mode */
155 +/*******************************************************************************
157 +*******************************************************************************/
159 +/* SCI Control Register 0 (SCCR0) $FFFC08
161 + 8 4 2 1 - 8 4 2 1 - 8 4 2 1 - 8 4 2 1
162 + ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^
163 + | | | | | | | | | | | | | | | |
164 + | | | | | | | | | | | | | | | +----- 0 baud rate divisor
165 + | | | | | | | | | | | | | | +------- 1 baud rate divisor
166 + | | | | | | | | | | | | | +--------- 2 baud rate divisor
167 + | | | | | | | | | | | | +----------- 3 baud rate divisor
168 + | | | | | | | | | | | |
169 + | | | | | | | | | | | +--------------- 4 baud rate divisor
170 + | | | | | | | | | | +----------------- 5 baud rate divisor
171 + | | | | | | | | | +------------------- 6 baud rate divisor
172 + | | | | | | | | +--------------------- 7 baud rate divisor
174 + | | | | | | | +------------------------- 8 baud rate divisor
175 + | | | | | | +--------------------------- 9 baud rate divisor
176 + | | | | | +----------------------------- 10 baud rate divisor
177 + | | | | +------------------------------- 11 baud rate divisor
179 + | | | +----------------------------------- 12 baud rate divisor
180 + | | +------------------------------------- 13 unused
181 + | +--------------------------------------- 14 unused
182 + +----------------------------------------- 15 unused
184 + 0 0 0 0 - 0 0 0 0 - 0 0 0 0 - 0 1 0 0 reset value - (64k baud?)
187 +#define SCI_BAUD_57_6K 9
188 +#define SCI_BAUD_38_4K 14
189 +#define SCI_BAUD_19_2K 27
190 +#define SCI_BAUD_9600 55
191 +#define SCI_BAUD_4800 109
192 +#define SCI_BAUD_2400 218
193 +#define SCI_BAUD_1200 437
196 +/* SCI Control Register 1 (SCCR1) $FFFC0A
198 + 8 4 2 1 - 8 4 2 1 - 8 4 2 1 - 8 4 2 1
199 + ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^
200 + | | | | | | | | | | | | | | | |
201 + | | | | | | | | | | | | | | | +----- 0 send a break
202 + | | | | | | | | | | | | | | +------- 1 rcvr wakeup mode
203 + | | | | | | | | | | | | | +--------- 2 rcvr enable
204 + | | | | | | | | | | | | +----------- 3 xmtr enable
205 + | | | | | | | | | | | |
206 + | | | | | | | | | | | +--------------- 4 idle line intr enable
207 + | | | | | | | | | | +----------------- 5 rcvr intr enable
208 + | | | | | | | | | +------------------- 6 xmit complete intr enable
209 + | | | | | | | | +--------------------- 7 xmtr intr enable
211 + | | | | | | | +------------------------- 8 wakeup on address mark
212 + | | | | | | +--------------------------- 9 mode 1=9 bits, 0=8 bits
213 + | | | | | +----------------------------- 10 parity enable 1=on, 0=off
214 + | | | | +------------------------------- 11 parity type 1=odd, 0=even
216 + | | | +----------------------------------- 12 idle line select
217 + | | +------------------------------------- 13 wired-or mode
218 + | +--------------------------------------- 14 loop mode
219 + +----------------------------------------- 15 unused
221 + 0 0 0 0 - 0 0 0 0 - 0 0 0 0 - 0 0 0 0 reset value
224 +#define SCI_SEND_BREAK 0x0001 /* 0000-0000-0000-0001 */
225 +#define SCI_RCVR_WAKEUP 0x0002 /* 0000-0000-0000-0010 */
226 +#define SCI_ENABLE_RCVR 0x0004 /* 0000-0000-0000-0100 */
227 +#define SCI_ENABLE_XMTR 0x0008 /* 0000-0000-0000-1000 */
229 +#define SCI_DISABLE_RCVR 0xFFFB /* 1111-1111-1111-1011 */
230 +#define SCI_DISABLE_XMTR 0xFFF7 /* 1111-1111-1111-0111 */
232 +#define SCI_ENABLE_INT_IDLE 0x0010 /* 0000-0000-0001-0000 */
233 +#define SCI_ENABLE_INT_RX 0x0020 /* 0000-0000-0010-0000 */
234 +#define SCI_ENABLE_INT_TX_DONE 0x0040 /* 0000-0000-0100-0000 */
235 +#define SCI_ENABLE_INT_TX 0x0080 /* 0000-0000-1000-0000 */
237 +#define SCI_DISABLE_INT_ALL 0xFF00 /* 1111-1111-0000-0000 ??? */
239 +#define SCI_DISABLE_INT_RX 0xFFDF /* 1111-1111-1101-1111 */
240 +#define SCI_CLEAR_RX_INT 0xFFBF /* 1111-1111-1011-1111 */
241 +#define SCI_DISABLE_INT_TX 0xFF7F /* 1111-1111-0111-1111 */
242 +#define SCI_CLEAR_TDRE 0xFEFF /* 1111-1110-1111-1111 */
244 +#define SCI_RCVR_WAKE_ON_MARK 0x0100 /* 0000-0001-0000-0000 */
245 +#define SCI_9_DATA_BITS 0x0200 /* 0000-0010-0000-0000 */
246 +#define SCI_PARITY_ENABLE 0x0400 /* 0000-0100-0000-0000 */
247 +#define SCI_PARITY_ODD 0x0800 /* 0000-1000-0000-0000 */
249 +#define SCI_RCVR_WAKE_ON_IDLE 0xFEFF /* 1111-1110-1111-1111 */
250 +#define SCI_8_DATA_BITS 0xFDFF /* 1111-1101-1111-1111 */
251 +#define SCI_PARITY_DISABLE 0xFBFF /* 1111-1011-1111-1111 */
252 +#define SCI_PARITY_EVEN 0xF7FF /* 1111-0111-1111-1111 */
254 +#define SCI_PARITY_NONE 0xF3FF /* 1111-0011-1111-1111 */
256 +#define SCI_IDLE_LINE_LONG 0x1000 /* 0001-0000-0000-0000 */
257 +#define SCI_TXD_OPEN_DRAIN 0x2000 /* 0010-0000-0000-0000 */
258 +#define SCI_LOOPBACK_MODE 0x4000 /* 0100-0000-0000-0000 */
259 +#define SCI_SCCR1_UNUSED 0x8000 /* 1000-0000-0000-0000 */
262 +/* SCI Status Register (SCSR) $FFFC0C
264 + 8 4 2 1 - 8 4 2 1 - 8 4 2 1 - 8 4 2 1
265 + ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^
266 + | | | | | | | | | | | | | | | |
267 + | | | | | | | | | | | | | | | +----- 0 PF - parity error
268 + | | | | | | | | | | | | | | +------- 1 FE - framing error
269 + | | | | | | | | | | | | | +--------- 2 NF - noise flag
270 + | | | | | | | | | | | | +----------- 3 OR - overrun flag
271 + | | | | | | | | | | | |
272 + | | | | | | | | | | | +--------------- 4 IDLE - idle line detected
273 + | | | | | | | | | | +----------------- 5 RAF - rcvr active flag
274 + | | | | | | | | | +------------------- 6 RDRF - rcv data reg full
275 + | | | | | | | | +--------------------- 7 TC - xmt complete flag
277 + | | | | | | | +------------------------- 8 TDRE - xmt data reg empty
278 + | | | | | | +--------------------------- 9 always zero
279 + | | | | | +----------------------------- 10 always zero
280 + | | | | +------------------------------- 11 always zero
282 + | | | +----------------------------------- 12 always zero
283 + | | +------------------------------------- 13 always zero
284 + | +--------------------------------------- 14 always zero
285 + +----------------------------------------- 15 always zero
287 + 0 0 0 0 - 0 0 0 1 - 1 0 0 0 - 0 0 0 0 reset value
290 +#define SCI_ERROR_PARITY 0x0001 /* 0000-0000-0000-0001 */
291 +#define SCI_ERROR_FRAMING 0x0002 /* 0000-0000-0000-0010 */
292 +#define SCI_ERROR_NOISE 0x0004 /* 0000-0000-0000-0100 */
293 +#define SCI_ERROR_OVERRUN 0x0008 /* 0000-0000-0000-1000 */
295 +#define SCI_IDLE_LINE 0x0010 /* 0000-0000-0001-0000 */
296 +#define SCI_RCVR_ACTIVE 0x0020 /* 0000-0000-0010-0000 */
297 +#define SCI_RCVR_READY 0x0040 /* 0000-0000-0100-0000 */
298 +#define SCI_XMTR_IDLE 0x0080 /* 0000-0000-1000-0000 */
300 +#define SCI_CLEAR_RX_INT 0xFFBF /* 1111-1111-1011-1111 */
302 +#define SCI_XMTR_READY 0x0100 /* 0000-0001-0000-0000 */
304 +#define SCI_CLEAR_TDRE 0xFEFF /* 1111-1110-1111-1111 */
306 +#define SCI_XMTR_AVAILABLE 0x0180 /* 0000-0001-1000-0000 */
310 +/*******************************************************************************
311 + Function prototypes
312 +*******************************************************************************/
318 +/* look at console_open to see how this is called */
320 +const rtems_termios_callbacks * SciGetTermiosHandlers( int32_t polled );
324 +/*rtems_isr SciIsr( rtems_vector_number vector ); */
326 +/*int32_t SciOpenPolled ( int32_t major, int32_t minor, void *arg ); */
327 +/*int32_t SciOpenInterrupt ( int32_t major, int32_t minor, void *arg ); */
329 +/*int32_t SciClose ( int32_t major, int32_t minor, void *arg ); */
331 +/*int32_t SciWritePolled ( int32_t minor, const char *buf, int32_t len ); */
332 +/*int32_t SciWriteInterrupt( int32_t minor, const char *buf, int32_t len ); */
334 +/*int32_t SciReadPolled ( int32_t minor ); */
336 +/*int32_t SciSetAttributes ( int32_t minor, const struct termios *t ); */
342 +#endif /* _sci_h_ */
343 Index: rtems/c/src/lib/libbsp/m68k/mo376/startup/linkcmds_ROM
344 ===================================================================
345 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
346 +++ rtems/c/src/lib/libbsp/m68k/mo376/startup/linkcmds_ROM 2007-08-14 17:20:30.000000000 +0200
350 + * $Id: linkcmds_ROM,v 1.4 2006/02/08 12:25:24 joel Exp $
354 +STARTUP(except_vect_332_ROM.o)
359 + * +--------------------+ <- low memory
362 + * | ctor list | the ctor and dtor lists are for
363 + * | dtor list | C++ support
365 + * | temporary .data | .data is moved to RAM by crt0
367 + * +--------------------+ <- high memory
371 + * +--------------------+ <- low memory
372 + * | .data | initialized data goes here
375 + * +--------------------+
377 + * | __bss_start | start of bss, cleared by crt0
378 + * | _end | start of heap, used by sbrk()
379 + * +--------------------+
383 + * | __stack | top of stack
384 + * +--------------------+ <- high memory
389 + rom : ORIGIN = 0x90000, LENGTH = 0x70000
390 + ram : ORIGIN = 0x03000, LENGTH = 0x7d000
393 +_RamBase = DEFINED(_RamBase) ? _RamBase : 0x003000;
394 +_RamSize = DEFINED(_RamSize) ? _RamSize : 0x7d000;
395 +_RamEnd = _RamBase + _RamSize;
397 +__end_of_ram = 0x080000;
398 +_copy_data_from_rom = 1;
399 +_HeapSize = DEFINED(_HeapSize) ? _HeapSize : 0x10000;
400 +_StackSize = DEFINED(_StackSize) ? _StackSize : 0x2000;
410 + CREATE_OBJECT_SYMBOLS
418 + * Initialization and finalization code.
420 + * Various files can provide initialization and finalization
421 + * functions. crtbegin.o and crtend.o are two instances. The
422 + * body of these functions are in .init and .fini sections. We
423 + * accumulate the bodies here, and prepend function prologues
424 + * from crti.o and function epilogues from crtn.o. crti.o must
425 + * be linked first; crtn.o must be linked last. Because these
426 + * are wildcards, it doesn't matter if the user does not
427 + * actually link against crti.o and crtn.o; the linker won't
428 + * look for a file to match a wildcard. The wildcard also
429 + * means that it doesn't matter which directory crti.o and
432 + PROVIDE (_init = .);
436 + PROVIDE (_fini = .);
442 + * Special FreeBSD sysctl sections.
445 + __start_set_sysctl_set = .;
447 + __stop_set_sysctl_set = ABSOLUTE(.);
452 + * C++ constructors/destructors
454 + * gcc uses crtbegin.o to find the start of the constructors
455 + * and destructors so we make sure it is first. Because this
456 + * is a wildcard, it doesn't matter if the user does not
457 + * actually link against crtbegin.o; the linker won't look for
458 + * a file to match a wildcard. The wildcard also means that
459 + * it doesn't matter which directory crtbegin.o is in. The
460 + * constructor and destructor list are terminated in
461 + * crtend.o. The same comments apply to it.
464 + *crtbegin.o(.ctors)
467 + *crtbegin.o(.dtors)
478 + _rodata_start = . ;
480 + *(.gnu.linkonce.r*)
482 + etext = ALIGN(0x10);
484 + LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2)
489 + LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2)
499 + AT ( ADDR(.text) + SIZEOF( .text ) )
510 + *(.gnu.linkonce.d*)
511 + *(.gcc_except_table)
515 + edata = ALIGN(0x10);
524 + __bss_start = ALIGN(0x8);
530 + *(.bss* .gnu.linkonce.b.*)
535 + __end = ALIGN(0x8);
537 + _WorkspaceBase = . + _StackSize;
543 + .stabstr . (NOLOAD) :
548 Index: rtems/c/src/lib/libbsp/m68k/mo376/startup/except_vect_332_ROM.S
549 ===================================================================
550 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
551 +++ rtems/c/src/lib/libbsp/m68k/mo376/startup/except_vect_332_ROM.S 2007-08-14 17:20:30.000000000 +0200
554 + * $Id: except_vect_332_ROM.S,v 1.3 2004/04/21 16:01:35 ralf Exp $
557 +/* Exception Vector definitions follow */
559 + /* !!! Warning !!! This table is not tested, and
560 + the user must make sure it is complete. */
562 + /* If we use TRAP #15 for reboot, note that group 0 and 1 exceptions
563 + will have priority. */
565 + /* This is the "magic word" that CPU32bug uses to indicate that
566 + there is a bootable image here. */
569 + /* Vector 0: RESET: Initial SSP */
571 + /* Vector 1: RESET: Initial PC */
574 + /* default action for undefined vectors is to re-boot */
576 + /* Note group 0 and 1 exception (like trace) have priority
577 + over other exceptions (like trap #15) that may call this. */
579 + /* Vectors 2-255 */
580 + .long reboot /* exception vector: 2 */
581 + .long reboot /* exception vector: 3 */
582 + .long reboot /* exception vector: 4 */
583 + .long reboot /* exception vector: 5 */
584 + .long reboot /* exception vector: 6 */
585 + .long reboot /* exception vector: 7 */
586 + .long reboot /* exception vector: 8 */
587 + .long reboot /* exception vector: 9 */
588 + .long reboot /* exception vector: 10 */
589 + .long reboot /* exception vector: 11 */
590 + .long reboot /* exception vector: 12 */
591 + .long reboot /* exception vector: 13 */
592 + .long reboot /* exception vector: 14 */
593 + .long reboot /* exception vector: 15 */
594 + .long reboot /* exception vector: 16 */
595 + .long reboot /* exception vector: 17 */
596 + .long reboot /* exception vector: 18 */
597 + .long reboot /* exception vector: 19 */
598 + .long reboot /* exception vector: 20 */
599 + .long reboot /* exception vector: 21 */
600 + .long reboot /* exception vector: 22 */
601 + .long reboot /* exception vector: 23 */
602 + .long reboot /* exception vector: 24 */
603 + .long reboot /* exception vector: 25 */
604 + .long reboot /* exception vector: 26 */
605 + .long reboot /* exception vector: 27 */
606 + .long reboot /* exception vector: 28 */
607 + .long reboot /* exception vector: 29 */
608 + .long reboot /* exception vector: 30 */
609 + .long reboot /* exception vector: 31 */
610 + .long reboot /* exception vector: 32 */
611 + .long reboot /* exception vector: 33 */
612 + .long reboot /* exception vector: 34 */
613 + .long reboot /* exception vector: 35 */
614 + .long reboot /* exception vector: 36 */
615 + .long reboot /* exception vector: 37 */
616 + .long reboot /* exception vector: 38 */
617 + .long reboot /* exception vector: 39 */
618 + .long reboot /* exception vector: 40 */
619 + .long reboot /* exception vector: 41 */
620 + .long reboot /* exception vector: 42 */
621 + .long reboot /* exception vector: 43 */
622 + .long reboot /* exception vector: 44 */
623 + .long reboot /* exception vector: 45 */
624 + .long reboot /* exception vector: 46 */
625 + .long _reboot /* the reboot trap: 47 */
626 + .long reboot /* exception vector: 48 */
627 + .long reboot /* exception vector: 49 */
628 + .long reboot /* exception vector: 50 */
629 + .long reboot /* exception vector: 51 */
630 + .long reboot /* exception vector: 52 */
631 + .long reboot /* exception vector: 53 */
632 + .long reboot /* exception vector: 54 */
633 + .long reboot /* exception vector: 55 */
634 + .long reboot /* exception vector: 56 */
635 + .long reboot /* exception vector: 57 */
636 + .long reboot /* exception vector: 58 */
637 + .long reboot /* exception vector: 59 */
638 + .long reboot /* exception vector: 60 */
639 + .long reboot /* exception vector: 61 */
640 + .long reboot /* exception vector: 62 */
641 + .long reboot /* exception vector: 63 */
642 + .long reboot /* exception vector: 64 */
643 + .long reboot /* exception vector: 65 */
644 + .long reboot /* exception vector: 66 */
645 + .long reboot /* exception vector: 67 */
646 + .long reboot /* exception vector: 68 */
647 + .long reboot /* exception vector: 69 */
648 + .long reboot /* exception vector: 70 */
649 + .long reboot /* exception vector: 71 */
650 + .long reboot /* exception vector: 72 */
651 + .long reboot /* exception vector: 73 */
652 + .long reboot /* exception vector: 74 */
653 + .long reboot /* exception vector: 75 */
654 + .long reboot /* exception vector: 76 */
655 + .long reboot /* exception vector: 77 */
656 + .long reboot /* exception vector: 78 */
657 + .long reboot /* exception vector: 79 */
658 + .long reboot /* exception vector: 80 */
659 + .long reboot /* exception vector: 81 */
660 + .long reboot /* exception vector: 82 */
661 + .long reboot /* exception vector: 83 */
662 + .long reboot /* exception vector: 84 */
663 + .long reboot /* exception vector: 85 */
664 + .long reboot /* exception vector: 86 */
665 + .long reboot /* exception vector: 87 */
666 + .long reboot /* exception vector: 88 */
667 + .long reboot /* exception vector: 89 */
668 + .long reboot /* exception vector: 90 */
669 + .long reboot /* exception vector: 91 */
670 + .long reboot /* exception vector: 92 */
671 + .long reboot /* exception vector: 93 */
672 + .long reboot /* exception vector: 94 */
673 + .long reboot /* exception vector: 95 */
674 + .long reboot /* exception vector: 96 */
675 + .long reboot /* exception vector: 97 */
676 + .long reboot /* exception vector: 98 */
677 + .long reboot /* exception vector: 99 */
678 + .long reboot /* exception vector: 100 */
679 + .long reboot /* exception vector: 101 */
680 + .long reboot /* exception vector: 102 */
681 + .long reboot /* exception vector: 103 */
682 + .long reboot /* exception vector: 104 */
683 + .long reboot /* exception vector: 105 */
684 + .long reboot /* exception vector: 106 */
685 + .long reboot /* exception vector: 107 */
686 + .long reboot /* exception vector: 108 */
687 + .long reboot /* exception vector: 109 */
688 + .long reboot /* exception vector: 110 */
689 + .long reboot /* exception vector: 111 */
690 + .long reboot /* exception vector: 112 */
691 + .long reboot /* exception vector: 113 */
692 + .long reboot /* exception vector: 114 */
693 + .long reboot /* exception vector: 115 */
694 + .long reboot /* exception vector: 116 */
695 + .long reboot /* exception vector: 117 */
696 + .long reboot /* exception vector: 118 */
697 + .long reboot /* exception vector: 119 */
698 + .long reboot /* exception vector: 120 */
699 + .long reboot /* exception vector: 121 */
700 + .long reboot /* exception vector: 122 */
701 + .long reboot /* exception vector: 123 */
702 + .long reboot /* exception vector: 124 */
703 + .long reboot /* exception vector: 125 */
704 + .long reboot /* exception vector: 126 */
705 + .long reboot /* exception vector: 127 */
706 + .long reboot /* exception vector: 128 */
707 + .long reboot /* exception vector: 129 */
708 + .long reboot /* exception vector: 130 */
709 + .long reboot /* exception vector: 131 */
710 + .long reboot /* exception vector: 132 */
711 + .long reboot /* exception vector: 133 */
712 + .long reboot /* exception vector: 134 */
713 + .long reboot /* exception vector: 135 */
714 + .long reboot /* exception vector: 136 */
715 + .long reboot /* exception vector: 137 */
716 + .long reboot /* exception vector: 138 */
717 + .long reboot /* exception vector: 139 */
718 + .long reboot /* exception vector: 140 */
719 + .long reboot /* exception vector: 141 */
720 + .long reboot /* exception vector: 142 */
721 + .long reboot /* exception vector: 143 */
722 + .long reboot /* exception vector: 144 */
723 + .long reboot /* exception vector: 145 */
724 + .long reboot /* exception vector: 146 */
725 + .long reboot /* exception vector: 147 */
726 + .long reboot /* exception vector: 148 */
727 + .long reboot /* exception vector: 149 */
728 + .long reboot /* exception vector: 150 */
729 + .long reboot /* exception vector: 151 */
730 + .long reboot /* exception vector: 152 */
731 + .long reboot /* exception vector: 153 */
732 + .long reboot /* exception vector: 154 */
733 + .long reboot /* exception vector: 155 */
734 + .long reboot /* exception vector: 156 */
735 + .long reboot /* exception vector: 157 */
736 + .long reboot /* exception vector: 158 */
737 + .long reboot /* exception vector: 159 */
738 + .long reboot /* exception vector: 160 */
739 + .long reboot /* exception vector: 161 */
740 + .long reboot /* exception vector: 162 */
741 + .long reboot /* exception vector: 163 */
742 + .long reboot /* exception vector: 164 */
743 + .long reboot /* exception vector: 165 */
744 + .long reboot /* exception vector: 166 */
745 + .long reboot /* exception vector: 167 */
746 + .long reboot /* exception vector: 168 */
747 + .long reboot /* exception vector: 169 */
748 + .long reboot /* exception vector: 170 */
749 + .long reboot /* exception vector: 171 */
750 + .long reboot /* exception vector: 172 */
751 + .long reboot /* exception vector: 173 */
752 + .long reboot /* exception vector: 174 */
753 + .long reboot /* exception vector: 175 */
754 + .long reboot /* exception vector: 176 */
755 + .long reboot /* exception vector: 177 */
756 + .long reboot /* exception vector: 178 */
757 + .long reboot /* exception vector: 179 */
758 + .long reboot /* exception vector: 180 */
759 + .long reboot /* exception vector: 181 */
760 + .long reboot /* exception vector: 182 */
761 + .long reboot /* exception vector: 183 */
762 + .long reboot /* exception vector: 184 */
763 + .long reboot /* exception vector: 185 */
764 + .long reboot /* exception vector: 186 */
765 + .long reboot /* exception vector: 187 */
766 + .long reboot /* exception vector: 188 */
767 + .long reboot /* exception vector: 189 */
768 + .long reboot /* exception vector: 190 */
769 + .long reboot /* exception vector: 191 */
770 + .long reboot /* exception vector: 192 */
771 + .long reboot /* exception vector: 193 */
772 + .long reboot /* exception vector: 194 */
773 + .long reboot /* exception vector: 195 */
774 + .long reboot /* exception vector: 196 */
775 + .long reboot /* exception vector: 197 */
776 + .long reboot /* exception vector: 198 */
777 + .long reboot /* exception vector: 199 */
778 + .long reboot /* exception vector: 200 */
779 + .long reboot /* exception vector: 201 */
780 + .long reboot /* exception vector: 202 */
781 + .long reboot /* exception vector: 203 */
782 + .long reboot /* exception vector: 204 */
783 + .long reboot /* exception vector: 205 */
784 + .long reboot /* exception vector: 206 */
785 + .long reboot /* exception vector: 207 */
786 + .long reboot /* exception vector: 208 */
787 + .long reboot /* exception vector: 209 */
788 + .long reboot /* exception vector: 210 */
789 + .long reboot /* exception vector: 211 */
790 + .long reboot /* exception vector: 212 */
791 + .long reboot /* exception vector: 213 */
792 + .long reboot /* exception vector: 214 */
793 + .long reboot /* exception vector: 215 */
794 + .long reboot /* exception vector: 216 */
795 + .long reboot /* exception vector: 217 */
796 + .long reboot /* exception vector: 218 */
797 + .long reboot /* exception vector: 219 */
798 + .long reboot /* exception vector: 220 */
799 + .long reboot /* exception vector: 221 */
800 + .long reboot /* exception vector: 222 */
801 + .long reboot /* exception vector: 223 */
802 + .long reboot /* exception vector: 224 */
803 + .long reboot /* exception vector: 225 */
804 + .long reboot /* exception vector: 226 */
805 + .long reboot /* exception vector: 227 */
806 + .long reboot /* exception vector: 228 */
807 + .long reboot /* exception vector: 229 */
808 + .long reboot /* exception vector: 230 */
809 + .long reboot /* exception vector: 231 */
810 + .long reboot /* exception vector: 232 */
811 + .long reboot /* exception vector: 233 */
812 + .long reboot /* exception vector: 234 */
813 + .long reboot /* exception vector: 235 */
814 + .long reboot /* exception vector: 236 */
815 + .long reboot /* exception vector: 237 */
816 + .long reboot /* exception vector: 238 */
817 + .long reboot /* exception vector: 239 */
818 + .long reboot /* exception vector: 240 */
819 + .long reboot /* exception vector: 241 */
820 + .long reboot /* exception vector: 242 */
821 + .long reboot /* exception vector: 243 */
822 + .long reboot /* exception vector: 244 */
823 + .long reboot /* exception vector: 245 */
824 + .long reboot /* exception vector: 246 */
825 + .long reboot /* exception vector: 247 */
826 + .long reboot /* exception vector: 248 */
827 + .long reboot /* exception vector: 249 */
828 + .long reboot /* exception vector: 250 */
829 + .long reboot /* exception vector: 251 */
830 + .long reboot /* exception vector: 252 */
831 + .long reboot /* exception vector: 253 */
832 + .long reboot /* exception vector: 254 */
833 + .long reboot /* exception vector: 255 */
836 + move #0x2700,%sr /* mask interrupts */
837 + movea.l (0x0).w,%a7 /* load stack */
838 + movea.l (0x4).w,%a0 /* jmp to location of reset vector */
842 + trap #15 /* use trap exception to enter supervisor
843 + state. Trace mode ( and other group 0
844 + and 1 exceptions) *could* screw this up if
845 + not vectored to reboot or did not return. */
846 Index: rtems/c/src/lib/libbsp/m68k/mo376/console/console.c
847 ===================================================================
848 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
849 +++ rtems/c/src/lib/libbsp/m68k/mo376/console/console.c 2007-08-14 17:20:30.000000000 +0200
852 + * This file contains the generic console driver shell used
853 + * by all console drivers using libchip.
855 + * This driver uses the termios pseudo driver.
857 + * COPYRIGHT (c) 1989-1997.
858 + * On-Line Applications Research Corporation (OAR).
860 + * The license and distribution terms for this file may be
861 + * found in the file LICENSE in this distribution or at
862 + * http://www.rtems.com/license/LICENSE.
864 + * $Id: console.c,v 1.8 2006/09/11 21:43:53 joel Exp $
868 +#include <rtems/libio.h>
869 +#include <termios.h>
876 + * open a port as a termios console.
878 + * the console is opened in bsp_postdriver_hook() in bsppost.c
882 +rtems_device_driver console_open(
883 + rtems_device_major_number major,
884 + rtems_device_minor_number minor,
888 + rtems_status_code status;
890 + /* the console is opened three times at startup */
891 + /* for standard input, output, and error */
893 + /* Get correct callback structure for the device */
895 + /* argument of FALSE gives us interrupt driven serial io */
896 + /* argument of TRUE gives us polling based serial io */
898 + /* SCI internal uart */
900 + status = rtems_termios_open( major, minor, arg, SciGetTermiosHandlers( TRUE ) );
909 + * This routine closes a port that has been opened as console.
912 +rtems_device_driver console_close(
913 + rtems_device_major_number major,
914 + rtems_device_minor_number minor,
918 + return rtems_termios_close (arg);
925 + * This routine uses the termios driver to read a character.
928 +rtems_device_driver console_read(
929 + rtems_device_major_number major,
930 + rtems_device_minor_number minor,
934 + return rtems_termios_read (arg);
941 + * this routine uses the termios driver to write a character.
944 +rtems_device_driver console_write(
945 + rtems_device_major_number major,
946 + rtems_device_minor_number minor,
950 + return rtems_termios_write (arg);
957 + * this routine uses the termios driver to process io
960 +rtems_device_driver console_control(
961 + rtems_device_major_number major,
962 + rtems_device_minor_number minor,
966 + return rtems_termios_ioctl (arg);
971 + * console_initialize
973 + * Routine called to initialize the console device driver.
976 +rtems_device_driver console_initialize(
977 + rtems_device_major_number major,
978 + rtems_device_minor_number minor_arg,
982 + rtems_status_code status;
985 + * initialize the termio interface.
987 + rtems_termios_initialize();
990 + * register the SCI device name for termios
991 + * do this over in the sci driver init routine?
994 + status = rtems_io_register_name( "/dev/sci", major, 0 );
996 + if (status != RTEMS_SUCCESSFUL)
998 + rtems_fatal_error_occurred(status);
1002 + * Link the uart device to the console device
1006 + status = rtems_io_register_name( "/dev/console", major, 0 );
1008 + if (status != RTEMS_SUCCESSFUL)
1010 + rtems_fatal_error_occurred(status);
1013 + if ( link( "/dev/sci", "/dev/console") < 0 )
1015 + rtems_fatal_error_occurred( RTEMS_IO_ERROR );
1020 + * Console Initialize Succesful
1023 + return RTEMS_SUCCESSFUL;
1025 Index: rtems/c/src/lib/libbsp/m68k/mo376/start/start.S
1026 ===================================================================
1027 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1028 +++ rtems/c/src/lib/libbsp/m68k/mo376/start/start.S 2007-08-14 17:20:30.000000000 +0200
1034 +#include "mrm332.h"
1035 +#include <rtems/asm.h>
1036 +#include <rtems/m68k/sim.h>
1040 + /* Put the header necessary for the modified CPU32bug to automatically
1041 + start up rtems: */
1053 + addl #_StackSize,d0
1057 + /* include in ram_init.S */
1059 + * Initalize the SIM module.
1060 + * The stack pointer is not usable until the RAM chip select lines
1061 + * are configured. The following code must remain inline.
1064 + /* Module Configuration Register */
1065 + /* see section(s) 3.1.3-3.1.6 of the SIM Reference Manual */
1068 + oriw #SAM(0,8,SHEN),d0
1069 + oriw #(MM*SIM_MM),d0
1070 + oriw #SAM(SIM_IARB,0,IARB),d0
1073 + jsr start_c /* Jump to the C startup code */
1079 + /* Synthesizer Control Register */
1080 + /* see section(s) 4.8 */
1081 + /* end include in ram_init.S */
1082 + *SYNCR = (unsigned short int)
1083 + ( SAM(MRM_W,15,VCO) | SAM(0x0,14,PRESCALE) | SAM(MRM_Y,8,COUNTER) );
1084 + while (! (*SYNCR & SLOCK)); /* protect from clock overshoot */
1085 + /* include in ram_init.S */
1086 + *SYNCR = (unsigned short int)
1087 + ( SAM(MRM_W,15,VCO) | SAM(MRM_X,14,PRESCALE) | SAM(MRM_Y,8,COUNTER) );
1089 + /* System Protection Control Register */
1090 + /* !!! can only write to once after reset !!! */
1091 + /* see section 3.8.4 of the SIM Reference Manual */
1092 + *SYPCR = (unsigned char)( HME | BME );
1094 + /* Periodic Interrupr Control Register */
1095 + /* see section 3.8.2 of the SIM Reference Manual */
1096 + *PICR = (unsigned short int)
1097 + ( SAM(0,8,PIRQL) | SAM(MRM_PIV,0,PIV) );
1098 + /* ^^^ zero disables interrupt, don't enable here or ram_init will
1099 + be wrong. It's enabled below. */
1101 + /* Periodic Interrupt Timer Register */
1102 + /* see section 3.8.3 of the SIM Reference Manual */
1103 + *PITR = (unsigned short int)( SAM(0x09,0,PITM) );
1104 + /* 1.098mS interrupt, assuming 32.768 KHz input clock */
1107 + /* load values before enabled */
1108 + *PORTC = (unsigned char) 0x0;
1110 + /* Port E and F Data Register */
1111 + /* see section 9 of the SIM Reference Manual */
1112 + *PORTE0 = (unsigned char) 0;
1113 + *PORTF0 = (unsigned char) 0;
1115 + /* Port E and F Data Direction Register */
1116 + /* see section 9 of the SIM Reference Manual */
1117 + *DDRE = (unsigned char) 0xff;
1118 + *DDRF = (unsigned char) 0xfd;
1120 + /* Port E and F Pin Assignment Register */
1121 + /* see section 9 of the SIM Reference Manual */
1122 + *PEPAR = (unsigned char) 0;
1123 + *PFPAR = (unsigned char) 0;
1125 + /* end of SIM initalization code */
1126 + /* end include in ram_init.S */
1129 + * Initialize RAM by copying the .data section out of ROM (if
1130 + * needed) and "zero-ing" the .bss section.
1133 + register char *src = _etext;
1134 + register char *dst = _copy_start;
1136 + if (_copy_data_from_rom)
1137 + /* ROM has data at end of text; copy it. */
1138 + while (dst < _edata)
1142 + for (dst = _clear_start; dst< end; dst++)
1149 + * Initialize vector table.
1152 + m68k_isr_entry *monitors_vector_table;
1154 + m68k_get_vbr(monitors_vector_table);
1156 + M68Kvec[ 4 ] = monitors_vector_table[ 4 ]; /* breakpoints vector */
1157 + M68Kvec[ 9 ] = monitors_vector_table[ 9 ]; /* trace vector */
1158 + M68Kvec[ 31 ] = monitors_vector_table[ 31 ]; /* level 7 interrupt */
1159 + M68Kvec[ 47 ] = monitors_vector_table[ 47 ]; /* system call vector */
1160 + M68Kvec[ 66 ] = monitors_vector_table[ 66 ]; /* user defined */
1162 + m68k_set_vbr(&M68Kvec);
1166 + * Initalize the board.
1168 + Spurious_Initialize();
1172 + * Execute main with arguments argc and agrv.
1174 + boot_card(1,__argv);
1180 Index: rtems/c/src/lib/libbsp/m68k/mo376/misc/dotests
1181 ===================================================================
1182 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1183 +++ rtems/c/src/lib/libbsp/m68k/mo376/misc/dotests 2007-08-14 17:20:30.000000000 +0200
1187 +# $Id: dotests,v 1.1 2001/05/25 16:28:46 joel Exp $
1191 +find -name MyTests -prune -or -name "*.nxe" -exec cp {} MyTests \;
1193 +stty 1:0:80001cb2:0:3:1c:7f:15:4:5:1:0:11:13:1a:0:12:f:17:16:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0 </dev/ttyS1
1194 +/bin/cp /dev/ttyS1 screen &
1197 +( cd MyTests; for f in *nxe; do m68k-elf-gdb ${f} </dev/null; done )
1200 Index: rtems/c/src/lib/libbsp/m68k/mo376/include/bsp.h
1201 ===================================================================
1202 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1203 +++ rtems/c/src/lib/libbsp/m68k/mo376/include/bsp.h 2007-08-14 17:20:30.000000000 +0200
1207 + * This include file contains all mrm board IO definitions.
1209 + * COPYRIGHT (c) 1989-1999.
1210 + * On-Line Applications Research Corporation (OAR).
1212 + * The license and distribution terms for this file may be
1213 + * found in the file LICENSE in this distribution or at
1214 + * http://www.rtems.com/license/LICENSE.
1216 + * $Id: bsp.h,v 1.14 2006/03/17 10:11:36 ralf Exp $
1226 +#include <bspopts.h>
1229 +#include <rtems/bspIo.h>
1230 +#include <rtems/clockdrv.h>
1231 +#include <rtems/console.h>
1232 +#include <rtems/iosupp.h>
1233 +#include <mrm332.h>
1234 +#include <rtems/m68k/sim.h>
1235 +#include <rtems/m68k/qsm.h>
1238 + * confdefs.h overrides for this BSP:
1239 + * - number of termios serial ports (defaults to 1)
1240 + * - Interrupt stack space is not minimum if defined.
1243 +#define CONSOLE_SCI
1244 +/* #define CONFIGURE_NUMBER_OF_TERMIOS_PORTS 2 */
1245 +/* #define CONFIGURE_INTERRUPT_STACK_MEMORY (TBD * 1024) */
1248 + * Simple spin delay in microsecond units for device drivers.
1249 + * This is very dependent on the clock speed of the target.
1252 +#define rtems_bsp_delay( microseconds ) \
1253 + { register uint32_t _delay=(microseconds); \
1254 + register uint32_t _tmp=123; \
1255 + asm volatile( "0: \
1259 + : "=d" (_tmp), "=d" (_delay) \
1260 + : "0" (_tmp), "1" (_delay) ); \
1265 +extern char _etext[];
1266 +extern char _copy_start[];
1267 +extern char _edata[];
1268 +extern char _clear_start[];
1270 +extern char _copy_data_from_rom[];
1275 +#define STACK_SIZE "#0x800"
1277 +#define STACK_SIZE 0x800
1282 +#define RAW_PUTS(str) \
1283 + { register char *ptr = str; \
1284 + while (*ptr) SCI_output_char(*ptr++); \
1287 +#define RAW_PUTI(n) { \
1288 + register int i, j; \
1291 + for (i=28;i>=0;i -= 4) { \
1292 + j = (n>>i) & 0xf; \
1293 + SCI_output_char( (j>9 ? j-10+'a' : j+'0') ); \
1297 +/* miscellaneous stuff assumed to exist */
1299 +extern rtems_configuration_table BSP_Configuration;
1301 +extern m68k_isr_entry M68Kvec[]; /* vector table address */
1303 +extern int stack_size;
1305 +extern int stack_start;
1308 + * Device Driver Table Entries
1312 + * NOTE: Use the standard Console driver entry
1316 + * NOTE: Use the standard Clock driver entry
1321 +void bsp_cleanup( void );
1323 +m68k_isr_entry set_vector(
1324 + rtems_isr_entry handler,
1325 + rtems_vector_number vector,
1329 +void console_init(void);
1331 +void Spurious_Initialize(void);
1333 +void _UART_flush(void);
1335 +void Clock_exit(void);
1337 +void outbyte(char);
1344 Index: rtems/c/src/lib/libbsp/m68k/mo376/misc/interr.c
1345 ===================================================================
1346 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1347 +++ rtems/c/src/lib/libbsp/m68k/mo376/misc/interr.c 2007-08-14 17:20:30.000000000 +0200
1350 + * Internal Error Handler
1352 + * COPYRIGHT (c) 1989-1999.
1353 + * On-Line Applications Research Corporation (OAR).
1355 + * The license and distribution terms for this file may be
1356 + * found in the file LICENSE in this distribution or at
1357 + * http://www.rtems.com/license/LICENSE.
1359 + * $Id: interr.c,v 1.3 2004/03/31 04:37:05 ralf Exp $
1362 +#include <rtems/system.h>
1363 +#include <rtems/score/interr.h>
1364 +#include <rtems/score/sysstate.h>
1365 +#include <rtems/score/userext.h>
1369 + * _Internal_error_Occurred
1371 + * This routine will invoke the fatal error handler supplied by the user
1372 + * followed by the the default one provided by the executive. The default
1373 + * error handler assumes no hardware is present to help inform the user
1374 + * of the problem. Halt stores the error code in a known register,
1375 + * disables interrupts, and halts the CPU. If the CPU does not have a
1376 + * halt instruction, it will loop to itself.
1378 + * Input parameters:
1379 + * the_source - what subsystem the error originated in
1380 + * is_internal - if the error was internally generated
1381 + * the_error - fatal error status code
1383 + * Output parameters:
1384 + * As much information as possible is stored in a CPU dependent fashion.
1385 + * See the CPU dependent code for more information.
1387 + * NOTE: The the_error is not necessarily a directive status code.
1391 + * Ugly hack.... _CPU_Fatal_halt() disonnects the bdm. Without this
1392 + * change, the_error is only known only to the cpu :).
1394 + * From "bsp.h" which is not yet available in the arch tree during
1395 + * this phase of install. jsg
1397 +void outbyte(char);
1398 +void bsp_cleanup( void );
1400 +#define RAW_PUTS(str) \
1401 + { register char *ptr = str; \
1402 + while (*ptr) outbyte(*ptr++); \
1405 +#define RAW_PUTI(n) { \
1406 + register int i, j; \
1409 + for (i=28;i>=0;i -= 4) { \
1410 + j = (n>>i) & 0xf; \
1411 + outbyte( (j>9 ? j-10+'a' : j+'0') ); \
1415 +void volatile _Internal_error_Occurred(
1416 + Internal_errors_Source the_source,
1417 + boolean is_internal,
1418 + uint32_t the_error
1422 + Internal_errors_What_happened.the_source = the_source;
1423 + Internal_errors_What_happened.is_internal = is_internal;
1424 + Internal_errors_What_happened.the_error = the_error;
1426 + _User_extensions_Fatal( the_source, is_internal, the_error );
1428 + _System_state_Set( SYSTEM_STATE_FAILED );
1430 + /* try to print error message to outbyte */
1431 + RAW_PUTS("\r\nRTEMS: A fatal error has occured.\r\n");
1432 + RAW_PUTS("RTEMS: fatal error ");
1433 + RAW_PUTI( the_error );
1435 + outbyte( (char)((the_error>>24) & 0xff) );
1436 + outbyte( (char)((the_error>>16) & 0xff) );
1437 + outbyte( (char)((the_error>>8) & 0xff) );
1438 + outbyte( (char)(the_error & 0xff) );
1439 + RAW_PUTS(").\r\n");
1441 + /* configure peripherals for a safe exit */
1444 + _CPU_Fatal_halt( the_error );
1446 + /* will not return from this routine */
1448 Index: rtems/c/src/lib/libbsp/m68k/mo376/ChangeLog
1449 ===================================================================
1450 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1451 +++ rtems/c/src/lib/libbsp/m68k/mo376/ChangeLog 2007-08-14 17:20:30.000000000 +0200
1453 +2006-12-02 Ralf Corsépius <ralf.corsepius@rtems.org>
1455 + * configure.ac: New BUG-REPORT address.
1457 +2006-10-20 Ralf Corsépius <ralf.corsepius@rtems.org>
1459 + * Makefile.am: Remove superfluous -DASM.
1461 +2006-10-19 Ralf Corsépius <ralf.corsepius@rtems.org>
1463 + * configure.ac: Require automake-1.10. Require autoconf-2.60.
1465 +2006-09-11 Joel Sherrill <joel@OARcorp.com>
1467 + * console/console.c, console/sci.c, console/sci.h, spurious/spinit.c,
1468 + startup/bspclean.c, startup/start_c.c: Convert C++ style comments to
1471 +2006-02-08 Joel Sherrill <joel@OARcorp.com>
1473 + * startup/linkcmds, startup/linkcmds_ROM: Add sections required by
1474 + newer gcc versions.
1476 +2006-01-11 Ralf Corsepius <ralf.corsepius@rtems.org>
1478 + * Makefile.am: Add preinstall.am.
1480 +2005-05-26 Ralf Corsepius <ralf.corsepius@rtems.org>
1482 + * include/bsp.h: New header guard.
1484 +2005-01-07 Ralf Corsepius <ralf.corsepius@rtems.org>
1486 + * Makefile.am: Eliminate CFLAGS_OPTIMIZE_V.
1488 +2005-01-05 Ralf Corsepius <ralf.corsepius@rtems.org>
1490 + * console/sci.c: Remove CVS Log.
1492 +2005-01-04 Joel Sherrill <joel@OARcorp.com>
1494 + * console/sci.c: Remove warnings.
1496 +2005-01-02 Ralf Corsepius <ralf.corsepius@rtems.org>
1498 + * Makefile.am: Remove build-variant support.
1500 +2004-11-25 Joel Sherrill <joel@OARcorp.com>
1502 + * startup/linkcmds, startup/linkcmds_ROM: Add new bss sections .bss.*
1503 + and .gnu.linkonce.b*.
1505 +2004-09-24 Ralf Corsepius <ralf_corsepius@rtems.org>
1507 + * configure.ac: Require automake > 1.9.
1509 +2004-04-23 Ralf Corsepius <ralf_corsepius@rtems.org>
1512 + * Makefile.am: Add include/tm27.h, Cosmetics.
1513 + * include/tm27.h: Final cosmetics.
1515 +2004-04-22 Ralf Corsepius <ralf_corsepius@rtems.org>
1517 + * include/bsp.h: Split out tmtest27 support.
1518 + * include/tm27.h: New.
1520 +2004-04-21 Ralf Corsepius <ralf_corsepius@rtems.org>
1523 + * include/bsp.h: Remove MAX_LONG_TEST_DURATION.
1525 +2004-04-21 Ralf Corsepius <ralf_corsepius@rtems.org>
1528 + * include/bsp.h: Remove MAX_SHORT_TEST_DURATION (Unused).
1530 +2004-04-03 Ralf Corsepiu <ralf_corsepiu@rtems.org>
1532 + * c/src/lib/libbsp/m68k/mrm332/include/bsp.h,
1533 + c/src/lib/libbsp/m68k/mrm332/start/start.S,
1534 + c/src/lib/libbsp/m68k/mrm332/startup/start_c.c: Include
1535 + <rtems/m68k/sim.h> instead of <sim.h>.
1536 + * c/src/lib/libbsp/m68k/mrm332/include/bsp.h: Include
1537 + <rtems/m68k/qsm.h> instead of <qsm.h>.
1539 +2004-04-02 Ralf Corsepius <ralf_corsepius@rtems.org>
1541 + * start/start.S: Include <rtems/asm.h> instead of <asm.h>.
1543 +2004-04-01 Ralf Corsepius <ralf_corsepius@rtems.org>
1545 + * include/bsp.h: Include <rtems/clockdrv.h> instead of <clockdrv.h>.
1546 + * include/bsp.h: Include <rtems/console.h> instead of <console.h>.
1547 + * include/bsp.h: Include <rtems/iosupp.h> instead of <iosupp.h>.
1549 +2004-03-31 Ralf Corsepius <ralf_corsepius@rtems.org>
1551 + * clock/ckinit.c, console/sci.c, console/sci.h, include/bsp.h,
1552 + misc/interr.c, startup/bspstart.c, timer/timer.c: Convert to using
1553 + c99 fixed size types.
1555 +2004-02-19 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1557 + * Makefile.am: Reflect changes to bsp.am.
1558 + Preinstall dist_project_lib*.
1560 +2004-02-14 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1562 + * Makefile.am: Reflect changes to bsp.am.
1564 +2004-02-12 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1566 + * Makefile.am: Use CPPASCOMPILE instead of CCASCOMPILE.
1568 +2004-02-06 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1570 + * Makefile.am: Pickup files from ../../m68k/shared instead of
1571 + ../shared. Reformat.
1573 +2004-01-28 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1575 + * configure.ac: Add nostdinc to AUTOMAKE_OPTIONS.
1577 +2004-01-28 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1579 + * Makefile.am: Don't include subdirs.am.
1581 +2004-01-28 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1583 + * Makefile.am: Fix typo.
1585 +2004-01-28 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1587 + * Makefile.am: Merge-in clock/Makefile.am, console/Makefile.am,
1588 + spurious/Makefile.am, startup/Makefile.am, timer/Makefile.am,
1589 + wrapup/Makefile.am.
1590 + Use automake compilation rules.
1591 + * clock/Makefile.am, console/Makefile.am, spurious/Makefile.am,
1592 + startup/Makefile.am, timer/Makefile.am, wrapup/Makefile.am:
1594 + * configure.ac: Reflect changes above.
1596 +2004-01-21 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1598 + * Makefile.am: Add PREINSTALL_DIRS.
1599 + * wrapup/Makefile.am: Reflect changes to libcpu.
1601 +2004-01-20 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1603 + * wrapup/Makefile.am: Reflect changes to libcpu.
1605 +2004-01-14 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1607 + * Makefile.am: Re-add dirstamps to PRE/TMPINSTALL_FILES.
1608 + Add PRE/TMPINSTALL_FILES to CLEANFILES.
1609 + * startup/Makefile.am: Ditto.
1611 +2004-01-07 Joel Sherrill <joel@OARcorp.com>
1613 + * times, console/sci.c: Remove efi68k and efi332 references as they are
1614 + no longer in the tree.
1616 +2004-01-07 Joel Sherrill <joel@OARcorp.com>
1618 + * timer/timer.c: Remove efi68k and efi332 references as they are no
1619 + longer in the tree.
1621 +2004-01-07 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1623 + * start/Makefile.am: Remove.
1624 + * Makefile.am: Merge-in start/Makefile.am.
1625 + * configure.ac: Reflect changes above.
1627 +2004-01-05 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1629 + * wrapup/Makefile.am: Eliminate $(LIB).
1630 + Use noinst_DATA to trigger building libbsp.a.
1632 +2003-12-13 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1634 + * start/Makefile.am: s,${PROJECT_RELEASE}/lib,$(PROJECT_LIB),g.
1635 + * startup/Makefile.am: s,${PROJECT_RELEASE}/lib,$(PROJECT_LIB),g.
1637 +2003-12-12 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1639 + * start/Makefile.am: Use mkdir_p. Remove dirs from PRE/TMPINSTALL_FILES.
1640 + * startup/Makefile.am: Use mkdir_p. Remove dirs from PRE/TMPINSTALL_FILES.
1642 +2003-12-12 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1644 + * configure.ac: Require automake >= 1.8, autoconf >= 2.59.
1646 +2003-12-10 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1648 + * start/Makefile.am: Misc cleanups and fixes.
1649 + * startup/Makefile.am: Misc cleanups and fixes.
1650 + * wrapup/Makefile.am: Misc cleanups and fixes.
1652 +2003-12-03 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1654 + * Makefile.am: Add preinstallation dirstamp support.
1655 + * clock/Makefile.am: Cosmetics.
1656 + * console/Makefile.am: Cosmetics.
1657 + * spurious/Makefile.am: Cosmetics.
1658 + * startup/Makefile.am: Cosmetics.
1659 + * timer/Makefile.am: Cosmetics.
1660 + * wrapup/Makefile.am: Cosmetics.
1662 +2003-12-02 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1664 + * clock/Makefile.am: Remove all-local: $(ARCH).
1665 + * console/Makefile.am: Remove all-local: $(ARCH).
1666 + * spurious/Makefile.am: Remove all-local: $(ARCH).
1667 + * start/Makefile.am: Remove all-local: $(ARCH).
1668 + * startup/Makefile.am: Remove all-local: $(ARCH).
1669 + * timer/Makefile.am: Remove all-local: $(ARCH).
1670 + * wrapup/Makefile.am: Remove all-local: $(ARCH).
1672 +2003-09-29 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1674 + * Makefile.am: Merge-in include/Makefile.am.
1675 + Reflect changes to bsp.am.
1676 + * include/Makefile.am: Remove.
1677 + * configure.ac: Reflect changes above.
1679 +2003-09-19 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1681 + * bsp_specs: Remove *lib:.
1683 +2003-09-15 Joel Sherrill <joel@OARcorp.com>
1686 + * startup/bspstart.c, startup/start_c.c: Spurious interrupt handlers
1687 + cannot be installed until RTEMS has initialized the vector table.
1689 +2003-09-04 Joel Sherrill <joel@OARcorp.com>
1691 + * clock/ckinit.c, console/console.c, include/bsp.h, misc/interr.c,
1692 + spurious/spinit.c, startup/bspclean.c, startup/bspstart.c,
1693 + timer/timer.c: URL for license changed.
1695 +2003-08-20 Joel Sherrill <joel@OARcorp.com>
1697 + * console/console.c: Correct copyright statements.
1699 +2003-08-18 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1701 + * Makefile.am: Reflect having moved aclocal/.
1703 +2003-08-16 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1705 + * Makefile.am: Reflect having moved automake/.
1706 + * clock/Makefile.am: Reflect having moved automake/.
1707 + * console/Makefile.am: Reflect having moved automake/.
1708 + * include/Makefile.am: Reflect having moved automake/.
1709 + * spurious/Makefile.am: Reflect having moved automake/.
1710 + * start/Makefile.am: Reflect having moved automake/.
1711 + * startup/Makefile.am: Reflect having moved automake/.
1712 + * timer/Makefile.am: Reflect having moved automake/.
1713 + * wrapup/Makefile.am: Reflect having moved automake/.
1715 +2003-08-11 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1718 + * startup/Makefile.am: Remove USE_INIT_FINI.
1720 +2003-08-11 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1722 + * configure.ac: Use rtems-bugs@rtems.com as bug report email address.
1724 +2003-08-06 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1727 + * bsp_specs: Remove -D__embedded__ -Asystem(embedded) from cpp.
1728 + Remove cpp, old_cpp (now unused).
1730 +2003-03-06 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1732 + * configure.ac: Remove AC_CONFIG_AUX_DIR.
1734 +2003-02-11 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1736 + * configure.ac: AM_INIT_AUTOMAKE([1.7.2]).
1738 +2003-02-11 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1740 + * configure.ac: AC_PREREQ(2.57).
1742 +2003-01-20 Duane Gustavus <duane@unt.edu>
1744 + * console/sci.c, include/mrm332.h, startup/linkcmds,
1745 + startup/linkcmds_ROM: Various updates to make this run properly
1748 +2002-12-20 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1750 + * clock/Makefile.am: Don't include @RTEMS_BSP@.cfg.
1751 + * console/Makefile.am: Don't include @RTEMS_BSP@.cfg.
1752 + * spurious/Makefile.am: Don't include @RTEMS_BSP@.cfg.
1753 + * start/Makefile.am: Don't include @RTEMS_BSP@.cfg.
1754 + * startup/Makefile.am: Don't include @RTEMS_BSP@.cfg.
1755 + * timer/Makefile.am: Don't include @RTEMS_BSP@.cfg.
1757 +2002-12-12 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1759 + * start/Makefile.am: Use install-data-local to install startfile.
1761 +2002-12-10 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1763 + * wrapup/Makefile.am: Don't include @RTEMS_BSP@.cfg.
1765 +2002-11-04 Joel Sherrill <joel@OARcorp.com>
1767 + * console/sci.c, spurious/spinit.c: Removed warnings.
1769 +2002-10-21 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1771 + * .cvsignore: Reformat.
1772 + Add autom4te*cache.
1773 + Remove autom4te.cache.
1775 +2002-09-08 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1777 + * Makefile.am: ACLOCAL_AMFLAGS = -I ../../../../../../aclocal.
1779 +2002-08-21 Joel Sherrill <joel@OARcorp.com>
1781 + * wrapup/Makefile.am: PR217 required that the idle task be moved to
1782 + libcpu so it could be more acutely aware of the CPU model. This
1783 + file was modified to pick up the idle task from there.
1785 +2002-08-21 Joel Sherrill <joel@OARcorp.com>
1787 + * bsp_specs: Added support for -nostdlibs.
1789 +2002-08-11 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1791 + * clock/Makefile.am: Use .$(OBJEXT) instead of .o.
1792 + * console/Makefile.am: Use .$(OBJEXT) instead of .o.
1793 + * spurious/Makefile.am: Use .$(OBJEXT) instead of .o.
1794 + * start/Makefile.am: Use .$(OBJEXT) instead of .o.
1795 + * startup/Makefile.am: Use .$(OBJEXT) instead of .o.
1796 + * timer/Makefile.am: Use .$(OBJEXT) instead of .o.
1797 + * wrapup/Makefile.am: Use .$(OBJEXT) instead of .o.
1799 +2002-08-05 Joel Sherrill <joel@OARcorp.com>
1801 + * Per PR260 eliminate use of make-target-options. This impacted
1802 + RTEMS allowing a distinction between the CPU32 and CPU32+ in the
1803 + SuperCore and required that the m68k optimized memcpy be moved
1805 + * wrapup/Makefile.am: Pick up memcpy.o from libcpu.
1807 +2002-07-21 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1809 + * start/Makefile.am: Eliminate PGM.
1810 + Add bsplib_DATA = $(PROJECT_RELEASE)/lib/start$(LIB_VARIANT).o.
1812 +2002-07-19 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1814 + * startup/Makefile.am: Add bsplib_DATA = linkcmds linkcmds_ROM.
1816 +2002-07-04 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1818 + * wrapup/Makefile.am: Eliminate TMPINSTALL_FILES.
1819 + Remove $(OBJS) from all-local.
1821 +2002-06-29 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1823 + * wrapup/Makefile.am: Remove preinstallation of libbsp.a,
1825 +2001-05-09 Joel Sherrill <joel@OARcorp.com>
1827 + * startup/linkcmds: In support of gcc 3.1, added one of more
1828 + of the sections .jcr, .rodata*, .data.*, .gnu.linkonce.s2.*,
1829 + .gnu.linkonce.sb2.*, and .gnu.linkonce.s.*. Spacing corrections
1830 + and direction of segments to memory regions may also have been
1831 + addressed. This was a sweep across all BSPs.
1833 +2002-03-27 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1836 + AC_INIT(package,_RTEMS_VERSION,_RTEMS_BUGS).
1837 + AM_INIT_AUTOMAKE([no-define foreign 1.6]).
1838 + * clock/Makefile.am: Remove AUTOMAKE_OPTIONS.
1839 + * Makefile.am: Remove AUTOMAKE_OPTIONS.
1840 + * console/Makefile.am: Remove AUTOMAKE_OPTIONS.
1841 + * include/Makefile.am: Remove AUTOMAKE_OPTIONS.
1842 + * spurious/Makefile.am: Remove AUTOMAKE_OPTIONS.
1843 + * start/Makefile.am: Remove AUTOMAKE_OPTIONS.
1844 + * startup/Makefile.am: Remove AUTOMAKE_OPTIONS.
1845 + * timer/Makefile.am: Remove AUTOMAKE_OPTIONS.
1846 + * wrapup/Makefile.am: Remove AUTOMAKE_OPTIONS.
1848 +2002-02-28 Mike Panetta <ahuitzot@mindspring.com>
1850 + * console/sci.c, console/sci.h,
1851 + console/console.c: Added new SCI driver.
1852 + * start/start.c: Removed file.
1853 + * start/start.S: New file, the asm portion of the updated start code.
1854 + * start/configure.am: Added start.S, removed start.c
1855 + * startup/start_c.c: New file, the C portion of the updated start code. Contains most of the code that was in the old start.c.
1856 + * startup/configure.am: Added start_c.c to C_FILES.
1857 + * include/bsp.h: Added include <rtems/bspIo.h>
1859 +2001-11-30 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1861 + * configure.ac: Introduce RTEMS_BSP_CONFIGURE.
1863 +2001-10-11 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1865 + * .cvsignore: Add autom4te.cache for autoconf > 2.52.
1866 + * configure.in: Remove.
1867 + * configure.ac: New file, generated from configure.in by autoupdate.
1869 +2001-09-27 Joel Sherrill <joel@OARcorp.com>
1871 + * include/bsp.h: Renamed delay() to rtems_bsp_delay().
1873 +2001-09-27 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1875 + * include/Makefile.am: Use 'TMPINSTALL_FILES ='.
1877 +2001-05-26 Ralf Corsepius <corsepiu@faw.uni-ulm.de>
1879 + * configure.in: Add bspopts.h.
1880 + * include/.cvsignore: Add bspopts.h*, stamp-h*.
1881 + * include/Makefile.am: Use *_HEADERS instead of *H_FILES.
1882 + * include/bsp.h: Include bspopts.h.
1884 +2001-05-25 Joel Sherrill <joel@OARcorp.com>
1886 + * clock/Makefile.am, console/Makefile.am, spurious/Makefile.am,
1887 + start/Makefile.am, startup/Makefile.am, timer/Makefile.am,
1888 + wrapup/Makefile.am: Modified to include compile.am.
1889 + * startup/bspstart.c: Removed include of <libcsupport.h>
1891 +2000-05-25 Matt Cross <profesor@gweep.net>
1893 + * New MRM332 BSP for the Mini RoboMind board based
1894 + on the 68332 microcontroller designed and build by Mark
1895 + Castelluccio. For details on the MRM see http://www.robominds.com.
1896 + * .cvsignore, ChangeLog Makefile.am, README, bsp_specs,
1897 + clock/.cvsignore, clock/Makefile.am, clock/ckinit.c, configure.in,
1898 + console/.cvsignore, console/Makefile.am, console/console.c,
1899 + include/.cvsignore, include/Makefile.am, include/bsp.h,
1900 + include/mrm332.h, misc/dotests, misc/gdbinit68, misc/interr.c,
1901 + spurious/.cvsignore, spurious/Makefile.am, spurious/spinit.c,
1902 + start/.cvsignore, start/Makefile.am, start/start.c, startup/.cvsignore,
1903 + startup/Makefile.am, startup/bspclean.c, startup/bspstart.c,
1904 + startup/except_vect_332_ROM.S, startup/linkcmds, startup/linkcmds_ROM,
1905 + timer/.cvsignore, timer/Makefile.am, timer/timer.c, times,
1906 + wrapup/.cvsignore, wrapup/Makefile.am: Initial files.
1908 Index: rtems/c/src/lib/libbsp/m68k/mo376/startup/bspclean.c
1909 ===================================================================
1910 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1911 +++ rtems/c/src/lib/libbsp/m68k/mo376/startup/bspclean.c 2007-08-14 17:20:30.000000000 +0200
1915 + * This routine cleans up in the sense that it places the board
1916 + * in a safe state and flushes the I/O buffers before exiting.
1922 + * COPYRIGHT (c) 1989-1999.
1923 + * On-Line Applications Research Corporation (OAR).
1925 + * The license and distribution terms for this file may be
1926 + * found in the file LICENSE in this distribution or at
1927 + * http://www.rtems.com/license/LICENSE.
1929 + * $Id: bspclean.c,v 1.5 2006/09/11 21:43:56 joel Exp $
1934 +void bsp_cleanup(void)
1936 + /* interrupt driven stdio must be flushed */
1937 + _CPU_ISR_Set_level( 7 );
1938 + /*_UART_flush(); */
1940 Index: rtems/c/src/lib/libbsp/m68k/mo376/timer/timer.c
1941 ===================================================================
1942 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
1943 +++ rtems/c/src/lib/libbsp/m68k/mo376/timer/timer.c 2007-08-14 17:20:30.000000000 +0200
1947 + * This routine is not implemented for this BSP.
1949 + * Input parameters: NONE
1951 + * Output parameters: NONE
1953 + * NOTE: It is important that the timer start/stop overhead be
1954 + * determined when porting or modifying this code.
1956 + * COPYRIGHT (c) 1989-1999.
1957 + * On-Line Applications Research Corporation (OAR).
1959 + * The license and distribution terms for this file may be
1960 + * found in the file LICENSE in this distribution or at
1961 + * http://www.rtems.com/license/LICENSE.
1963 + * $Id: timer.c,v 1.6 2004/04/21 16:01:35 ralf Exp $
1968 +rtems_boolean Timer_driver_Find_average_overhead;
1970 +extern rtems_isr Clock_isr();
1972 +void Timer_initialize( void )
1977 + * The following controls the behavior of Read_timer().
1979 + * FIND_AVG_OVERHEAD * instructs the routine to return the "raw" count.
1981 + * AVG_OVEREHAD is the overhead for starting and stopping the timer. It
1982 + * is usually deducted from the number returned.
1984 + * LEAST_VALID is the lowest number this routine should trust. Numbers
1985 + * below this are "noise" and zero is returned.
1988 +#define AVG_OVERHEAD 0 /* It typically takes X.X microseconds */
1989 + /* (Y countdowns) to start/stop the timer. */
1990 + /* This value is in microseconds. */
1991 +#define LEAST_VALID 1 /* Don't trust a clicks value lower than this */
1994 + * Return timer value in 1/2-microsecond units
1996 +int Read_timer( void )
2001 + if ( Timer_driver_Find_average_overhead == 1 )
2002 + return total; /* in XXX microsecond units */
2004 + if ( total < LEAST_VALID )
2005 + return 0; /* below timer resolution */
2007 + return (total - AVG_OVERHEAD);
2011 + * Empty function call used in loops to measure basic cost of looping
2012 + * in Timing Test Suite.
2015 +rtems_status_code Empty_function(void)
2017 + return RTEMS_SUCCESSFUL;
2020 +void Set_find_average_overhead(
2021 + rtems_boolean find_flag
2024 + Timer_driver_Find_average_overhead = find_flag;
2026 Index: rtems/c/src/lib/libbsp/m68k/mo376/clock/ckinit.c
2027 ===================================================================
2028 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
2029 +++ rtems/c/src/lib/libbsp/m68k/mo376/clock/ckinit.c 2007-08-14 17:20:30.000000000 +0200
2033 + * This routine initailizes the periodic interrupt timer on
2034 + * the Motorola 68332.
2036 + * Input parameters: NONE
2038 + * Output parameters: NONE
2040 + * COPYRIGHT (c) 1989-1999.
2041 + * On-Line Applications Research Corporation (OAR).
2043 + * The license and distribution terms for this file may be
2044 + * found in the file LICENSE in this distribution or at
2045 + * http://www.rtems.com/license/LICENSE.
2047 + * $Id: ckinit.c,v 1.5 2004/04/21 10:42:52 ralf Exp $
2050 +#include <stdlib.h>
2052 +#include <rtems/libio.h>
2053 +#include <mrm332.h>
2055 +#define CLOCK_VECTOR MRM_PIV
2057 +uint32_t Clock_isrs; /* ISRs until next tick */
2058 +volatile uint32_t Clock_driver_ticks;
2059 + /* ticks since initialization */
2060 +rtems_isr_entry Old_ticker;
2062 +void Clock_exit( void );
2065 + * These are set by clock driver during its init
2068 +rtems_device_major_number rtems_clock_major = ~0;
2069 +rtems_device_minor_number rtems_clock_minor;
2071 +rtems_isr Clock_isr(rtems_vector_number vector)
2073 + Clock_driver_ticks += 1;
2075 + if ( Clock_isrs == 1 ) {
2076 + rtems_clock_tick();
2077 + Clock_isrs = BSP_Configuration.microseconds_per_tick / 1000;
2083 +void Install_clock(
2084 + rtems_isr_entry clock_isr
2087 + Clock_driver_ticks = 0;
2088 + Clock_isrs = BSP_Configuration.microseconds_per_tick / 1000;
2090 + Old_ticker = (rtems_isr_entry) set_vector( clock_isr, CLOCK_VECTOR, 1 );
2092 + /* enable 1mS interrupts */
2093 + *PITR = (unsigned short int)( SAM(0x09,0,PITM) );/* load counter */
2094 + *PICR = (unsigned short int) /* enable interrupt */
2095 + ( SAM(ISRL_PIT,8,PIRQL) | SAM(CLOCK_VECTOR,0,PIV) );
2097 + atexit( Clock_exit );
2100 +void Clock_exit( void )
2102 + /* shutdown the periodic interrupt */
2103 + *PICR = (unsigned short int)
2104 + ( SAM(0,8,PIRQL) | SAM(CLOCK_VECTOR,0,PIV) );
2105 + /* ^^ zero disables interrupt */
2107 + /* do not restore old vector */
2110 +rtems_device_driver Clock_initialize(
2111 + rtems_device_major_number major,
2112 + rtems_device_minor_number minor,
2116 + Install_clock( Clock_isr );
2119 + * make major/minor avail to others such as shared memory driver
2122 + rtems_clock_major = major;
2123 + rtems_clock_minor = minor;
2125 + return RTEMS_SUCCESSFUL;
2128 +rtems_device_driver Clock_control(
2129 + rtems_device_major_number major,
2130 + rtems_device_minor_number minor,
2134 + uint32_t isrlevel;
2135 + rtems_libio_ioctl_args_t *args = pargp;
2141 + * This is hokey, but until we get a defined interface
2142 + * to do this, it will just be this simple...
2145 + if (args->command == rtems_build_name('I', 'S', 'R', ' '))
2147 + Clock_isr(CLOCK_VECTOR);
2149 + else if (args->command == rtems_build_name('N', 'E', 'W', ' '))
2151 + rtems_interrupt_disable( isrlevel );
2152 + (void) set_vector( args->buffer, CLOCK_VECTOR, 1 );
2153 + rtems_interrupt_enable( isrlevel );
2157 + return RTEMS_SUCCESSFUL;
2159 Index: rtems/c/src/lib/libbsp/m68k/mo376/misc/gdbinit68
2160 ===================================================================
2161 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
2162 +++ rtems/c/src/lib/libbsp/m68k/mo376/misc/gdbinit68 2007-08-14 17:20:30.000000000 +0200
2165 +# $Id: gdbinit68,v 1.1 2001/05/25 16:28:46 joel Exp $
2167 +echo Setting up the environment for mrm debuging.\n
2169 +target bdm /dev/bdmcpu320
2172 +set remotecache off
2180 Index: rtems/c/src/lib/libbsp/m68k/mo376/configure.ac
2181 ===================================================================
2182 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
2183 +++ rtems/c/src/lib/libbsp/m68k/mo376/configure.ac 2007-08-14 17:20:30.000000000 +0200
2185 +## Process this file with autoconf to produce a configure script.
2187 +## $Id: configure.ac,v 1.14.2.2 2006/12/02 06:04:46 ralf Exp $
2190 +AC_INIT([rtems-c-src-lib-libbsp-m68k-mrm332],[_RTEMS_VERSION],[http://www.rtems.org/bugzilla])
2191 +AC_CONFIG_SRCDIR([bsp_specs])
2192 +RTEMS_TOP(../../../../../..)
2194 +RTEMS_CANONICAL_TARGET_CPU
2195 +AM_INIT_AUTOMAKE([no-define nostdinc foreign 1.10])
2196 +RTEMS_BSP_CONFIGURE
2198 +RTEMS_PROG_CC_FOR_TARGET
2199 +RTEMS_CANONICALIZE_TOOLS
2202 +# Explicitly list all Makefiles here
2203 +AC_CONFIG_FILES([Makefile])
2205 Index: rtems/c/src/lib/libbsp/m68k/mo376/README
2206 ===================================================================
2207 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
2208 +++ rtems/c/src/lib/libbsp/m68k/mo376/README 2007-08-14 17:20:30.000000000 +0200
2211 +# $Id: README,v 1.1 2001/05/25 16:28:46 joel Exp $
2214 +Description: mrm332
2216 +CPU: MC68332 @16 or 25MHz
2220 + The Mini RoboMind is a small board based on the 68332 microcontroller
2221 +designed and build by Mark Castelluccio. For details, see:
2223 + http://www.robominds.com
2225 + This BSP was ported from the efi332 BSP by Matt Cross (profesor@gweep.net),
2226 +the efi332 BSP was written by John S Gwynne.
2230 +- integrate the interrupt driven stdin/stdout into RTEMS to (a) reduce
2231 + the interrupt priority and (2) to prevent it from blocking.
2232 +- add a timer driver for the tmtest set.
2234 Index: rtems/c/src/lib/libbsp/m68k/mo376/Makefile.am
2235 ===================================================================
2236 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
2237 +++ rtems/c/src/lib/libbsp/m68k/mo376/Makefile.am 2007-08-14 17:20:30.000000000 +0200
2240 +## $Id: Makefile.am,v 1.24.2.1 2006/10/20 11:54:57 ralf Exp $
2243 +ACLOCAL_AMFLAGS = -I ../../../../aclocal
2245 +include $(top_srcdir)/../../../../automake/compile.am
2246 +include $(top_srcdir)/../../bsp.am
2248 +dist_project_lib_DATA = bsp_specs
2250 +include_HEADERS = include/bsp.h
2251 +include_HEADERS += include/tm27.h
2253 +nodist_include_HEADERS = include/bspopts.h
2254 +DISTCLEANFILES = include/bspopts.h
2257 +include_HEADERS += include/mrm332.h
2258 +nodist_include_HEADERS += ../../shared/include/coverhd.h
2262 +EXTRA_DIST += start/start.S
2263 +start.$(OBJEXT): start/start.S
2264 + $(CPPASCOMPILE) -o $@ -c $<
2266 +project_lib_DATA = start.$(OBJEXT)
2268 +dist_project_lib_DATA += startup/linkcmds startup/linkcmds_ROM
2270 +noinst_PROGRAMS += startup.rel
2271 +startup_rel_SOURCES = startup/start_c.c ../../shared/bsplibc.c \
2272 + ../../shared/bsppost.c startup/bspstart.c startup/bspclean.c \
2273 + ../../shared/bootcard.c ../../m68k/shared/m68kpretaskinghook.c \
2274 + ../../shared/main.c ../../shared/sbrk.c ../../m68k/shared/setvec.c \
2275 + ../../shared/gnatinstallhandler.c startup/except_vect_332_ROM.S
2276 +startup_rel_CPPFLAGS = $(AM_CPPFLAGS)
2277 +startup_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
2279 +noinst_PROGRAMS += clock.rel
2280 +clock_rel_SOURCES = clock/ckinit.c
2281 +clock_rel_CPPFLAGS = $(AM_CPPFLAGS)
2282 +clock_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
2284 +noinst_PROGRAMS += console.rel
2285 +console_rel_SOURCES = console/console.c console/sci.c console/sci.h
2286 +console_rel_CPPFLAGS = $(AM_CPPFLAGS)
2287 +console_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
2289 +noinst_PROGRAMS += spurious.rel
2290 +spurious_rel_SOURCES = spurious/spinit.c
2291 +spurious_rel_CPPFLAGS = $(AM_CPPFLAGS)
2292 +spurious_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
2294 +noinst_PROGRAMS += timer.rel
2295 +timer_rel_SOURCES = timer/timer.c
2296 +timer_rel_CPPFLAGS = $(AM_CPPFLAGS)
2297 +timer_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
2299 +noinst_LIBRARIES = libbsp.a
2301 +libbsp_a_LIBADD = startup.rel clock.rel console.rel spurious.rel timer.rel
2302 +libbsp_a_LIBADD += ../../../libcpu/@RTEMS_CPU@/shared/cache.rel \
2303 + ../../../libcpu/@RTEMS_CPU@/shared/misc.rel
2305 +include $(srcdir)/preinstall.am
2306 +include $(top_srcdir)/../../../../automake/local.am
2307 Index: rtems/c/src/lib/libbsp/m68k/mo376/console/sci.c
2308 ===================================================================
2309 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
2310 +++ rtems/c/src/lib/libbsp/m68k/mo376/console/sci.c 2007-08-14 17:20:30.000000000 +0200
2312 +/*****************************************************************************
2315 +* Desc: This file contains the console IO routines for the SCI port.
2316 +* There are two interfaces in this module. One is for the rtems
2317 +* termios/console code and the other is a device driver interface.
2318 +* This module works together with the termio module which is
2319 +* sometimes referred to as the "line disciplines" which implements
2320 +* terminal i/o processing like tabs, backspaces, and newlines.
2321 +* The rtems printf uses interrupt io and the rtems printk routine
2322 +* uses polled io which is better for debugging.
2324 +* Index: Documentation
2325 +* Section A - Include Files
2326 +* Section B - Manifest Constants
2327 +* Section C - External Data
2328 +* Section D - External Functions
2329 +* Section E - Local Functions
2330 +* Section F - Local Variables
2331 +* Section G - A circular data buffer for rcv chars
2332 +* Section H - RTEMS termios callbacks for the interrupt api
2333 +* Section I - RTEMS termios callbacks for the polled api
2335 +* Section 0 - Miscellaneous routines
2336 +* Section 1 - Routines to manipulate the circular buffer
2337 +* Section 2 - Interrupt based entry points for the termios module
2338 +* Section 3 - Polling based entry points for the termios module
2339 +* Section 4 - Device driver public api entry points
2340 +* Section 5 - Hardware level routines
2341 +* Section 6 - Testing and debugging code
2343 +* Refer: Motorola QSM Reference Manual - Chapter 5 - SCI sub-module
2345 +* Note: See bsp.h,confdefs.h,system.h for installing drivers into RTEMS.
2347 +* $Id: sci.c,v 1.11 2006/09/11 21:43:53 joel Exp $
2349 +*****************************************************************************/
2351 +/*****************************************************************************
2352 + Overview of serial port console terminal input/output
2353 +*****************************************************************************/
2356 + +-----------+ +---------+
2358 + +-----------+ +---------+
2360 + | (printf,scanf,etc.) |
2367 + | (open,close,read,write,ioctl) |
2368 + ======|==========================================|========================
2369 + | /dev/console | /dev/sci
2370 + | (stdin,stdout,stderr) |
2371 + ======|==========================================|========================
2375 + +-----------+ +-----------+ +---------+
2376 + | console | <---> | termios | <---> | sci |
2377 + | driver | | module | | driver |
2378 + +-----------+ +-----------+ +---------+
2390 +/*****************************************************************************
2391 + Section A - Include Files
2392 +*****************************************************************************/
2396 +#include <rtems/bspIo.h>
2398 +#include <rtems/libio.h>
2399 +#include <libchip/serial.h>
2400 +#include <libchip/sersupp.h>
2402 +/*#include "../misc/include/cpu332.h" */
2405 +/*****************************************************************************
2406 + Section B - Manifest Constants
2407 +*****************************************************************************/
2409 +#define SCI_MINOR 0 /* minor device number */
2411 +/* IMPORTANT - if the device driver api is opened, it means the sci is being
2412 + * used for direct hardware access, so other users (like termios) get ignored
2414 +#define DRIVER_CLOSED 0 /* the device driver api is closed */
2415 +#define DRIVER_OPENED 1 /* the device driver api is opened */
2417 +/* system clock definitions, i dont have documentation on this... */
2419 +#if 0 /* Not needed, this is provided in mrm332.h */
2420 +#define XTAL 32768.0 /* crystal frequency in Hz */
2421 +#define NUMB_W 0 /* system clock parameters */
2423 +#define NUMB_Y 0x38 /* for 14.942 Mhz */
2424 +#define NUMB_Y 0x3F /* for 16.777 Mhz */
2426 +#define SYS_CLOCK (XTAL * 4.0 * (NUMB_Y+1) * (1 << (2 * NUMB_W + NUMB_X)))
2431 +/*****************************************************************************
2432 + Section C - External Data
2433 +*****************************************************************************/
2437 +/*****************************************************************************
2438 + Section D - External Functions
2439 +*****************************************************************************/
2443 +/*****************************************************************************
2444 + Section E - Local Functions
2445 +*****************************************************************************/
2447 +void SCI_output_char(char c);
2449 +/*rtems_isr SciIsr( rtems_vector_number vector ); interrupt handler */
2451 +const rtems_termios_callbacks * SciGetTermiosHandlers( int32_t polled );
2453 +rtems_device_driver SciInitialize( /* device driver api */
2454 + rtems_device_major_number, rtems_device_minor_number, void *);
2455 +rtems_device_driver SciOpen( /* device driver api */
2456 + rtems_device_major_number, rtems_device_minor_number, void *);
2457 +rtems_device_driver SciClose( /* device driver api */
2458 + rtems_device_major_number, rtems_device_minor_number, void *);
2459 +rtems_device_driver SciRead( /* device driver api */
2460 + rtems_device_major_number, rtems_device_minor_number, void *);
2461 +rtems_device_driver SciWrite( /* device driver api */
2462 + rtems_device_major_number, rtems_device_minor_number, void *);
2463 +rtems_device_driver SciControl( /* device driver api */
2464 + rtems_device_major_number, rtems_device_minor_number, void *);
2465 +rtems_device_driver SciRead (
2466 + rtems_device_major_number, rtems_device_minor_number, void *);
2468 +int SciInterruptOpen(int, int, void *); /* termios api */
2469 +int SciInterruptClose(int, int, void *); /* termios api */
2470 +int SciInterruptWrite(int, const char *, int); /* termios api */
2472 +int SciSetAttributes(int, const struct termios*); /* termios api */
2473 +int SciPolledOpen(int, int, void *); /* termios api */
2474 +int SciPolledClose(int, int, void *); /* termios api */
2475 +int SciPolledRead(int); /* termios api */
2476 +int SciPolledWrite(int, const char *, int); /* termios api */
2478 +static void SciSetBaud(uint32_t rate); /* hardware routine */
2479 +static void SciSetDataBits(uint16_t bits); /* hardware routine */
2480 +static void SciSetParity(uint16_t parity); /* hardware routine */
2482 +static void inline SciDisableAllInterrupts( void ); /* hardware routine */
2483 +static void inline SciDisableTransmitInterrupts( void );/* hardware routine */
2484 +static void inline SciDisableReceiveInterrupts( void ); /* hardware routine */
2486 +static void inline SciEnableTransmitInterrupts( void ); /* hardware routine */
2487 +static void inline SciEnableReceiveInterrupts( void ); /* hardware routine */
2489 +static void inline SciDisableReceiver( void ); /* hardware routine */
2490 +static void inline SciDisableTransmitter( void ); /* hardware routine */
2492 +static void inline SciEnableReceiver( void ); /* hardware routine */
2493 +static void inline SciEnableTransmitter( void ); /* hardware routine */
2495 +void SciWriteCharWait ( uint8_t ); /* hardware routine */
2496 +void SciWriteCharNoWait( uint8_t ); /* hardware routine */
2498 +uint8_t inline SciCharAvailable( void ); /* hardware routine */
2500 +uint8_t inline SciReadCharWait( void ); /* hardware routine */
2501 +uint8_t inline SciReadCharNoWait( void ); /* hardware routine */
2503 +void SciSendBreak( void ); /* test routine */
2505 +static int8_t SciRcvBufGetChar(); /* circular rcv buf */
2506 +static void SciRcvBufPutChar( uint8_t); /* circular rcv buf */
2508 +static void SciRcvBufFlush( void ); /* unused routine */
2511 +void SciUnitTest(); /* test routine */
2512 +void SciPrintStats(); /* test routine */
2515 +/*****************************************************************************
2516 + Section F - Local Variables
2517 +*****************************************************************************/
2519 +static struct rtems_termios_tty *SciTermioTty;
2521 +static uint8_t SciInited = 0; /* has the driver been inited */
2523 +static uint8_t SciOpened; /* has the driver been opened */
2525 +static uint8_t SciMajor; /* major device number */
2527 +static uint16_t SciBaud; /* current value in baud register */
2529 +static uint32_t SciBytesIn = 0; /* bytes received */
2530 +static uint32_t SciBytesOut = 0; /* bytes transmitted */
2532 +static uint32_t SciErrorsParity = 0; /* error counter */
2533 +static uint32_t SciErrorsNoise = 0; /* error counter */
2534 +static uint32_t SciErrorsFraming = 0; /* error counter */
2535 +static uint32_t SciErrorsOverrun = 0; /* error counter */
2537 +#if defined(CONSOLE_SCI)
2539 +/* this is what rtems printk uses to do polling based output */
2541 +BSP_output_char_function_type BSP_output_char = SCI_output_char;
2542 +BSP_polling_getchar_function_type BSP_poll_char = NULL;
2546 +/* cvs id string so you can use the unix ident command on the object */
2549 +static const char SciIdent[]="$Id: sci.c,v 1.11 2006/09/11 21:43:53 joel Exp $";
2553 +/*****************************************************************************
2554 + Section G - A circular buffer for rcv chars when the driver interface is used.
2555 +*****************************************************************************/
2557 +/* it is trivial to wrap your buffer pointers when size is a power of two */
2559 +#define SCI_RCV_BUF_SIZE 256 /* must be a power of 2 !!! */
2561 +/* if someone opens the sci device using the device driver interface,
2562 + * then the receive data interrupt handler will put characters in this buffer
2563 + * instead of sending them up to the termios module for the console
2565 +static uint8_t SciRcvBuffer[SCI_RCV_BUF_SIZE];
2567 +static uint8_t SciRcvBufPutIndex = 0; /* array index to put in next char */
2569 +static uint8_t SciRcvBufGetIndex = 0; /* array index to take out next char */
2571 +static uint16_t SciRcvBufCount = 0; /* how many bytes are in the buffer */
2575 +/*****************************************************************************
2576 + Section H - RTEMS termios callbacks for the interrupt version of the driver
2577 +*****************************************************************************/
2579 +static const rtems_termios_callbacks SciInterruptCallbacks =
2581 + SciInterruptOpen, /* first open */
2582 + SciInterruptClose, /* last close */
2583 + NULL, /* polled read (not required) */
2584 + SciInterruptWrite, /* write */
2585 + SciSetAttributes, /* set attributes */
2586 + NULL, /* stop remote xmit */
2587 + NULL, /* start remote xmit */
2588 + TRUE /* output uses interrupts */
2591 +/*****************************************************************************
2592 + Section I - RTEMS termios callbacks for the polled version of the driver
2593 +*****************************************************************************/
2595 +static const rtems_termios_callbacks SciPolledCallbacks =
2597 + SciPolledOpen, /* first open */
2598 + SciPolledClose, /* last close */
2599 + SciPolledRead, /* polled read */
2600 + SciPolledWrite, /* write */
2601 + SciSetAttributes, /* set attributes */
2602 + NULL, /* stop remote xmit */
2603 + NULL, /* start remote xmit */
2604 + FALSE /* output uses interrupts */
2610 + * MISCELLANEOUS ROUTINES
2613 +/****************************************************************************
2614 + * Func: SCI_output_char
2615 + * Desc: used by rtems printk function to send a char to the uart
2616 + * Inputs: the character to transmit
2620 + ****************************************************************************/
2622 +void SCI_output_char(char c)
2624 +/* ( minor device number, pointer to the character, length ) */
2626 + SciPolledWrite( SCI_MINOR, &c, 1);
2632 +/****************************************************************************
2633 +* Func: SciGetTermiosHandlers
2634 +* Desc: returns a pointer to the table of serial io functions
2635 +* this is called from console_open with polled set to false
2636 +* Inputs: flag indicating whether we want polled or interrupt driven io
2637 +* Outputs: pointer to function table
2640 +****************************************************************************/
2642 +const rtems_termios_callbacks * SciGetTermiosHandlers( int32_t polled )
2646 + return &SciPolledCallbacks; /* polling based */
2650 + return &SciInterruptCallbacks; /* interrupt driven */
2655 +/****************************************************************************
2657 +* Desc: interrupt handler for serial communications interface
2658 +* Inputs: vector number - unused
2661 +* Scope: public API
2662 +****************************************************************************/
2664 +rtems_isr SciIsr( rtems_vector_number vector )
2668 + if ( (*SCSR) & SCI_ERROR_PARITY ) SciErrorsParity ++;
2669 + if ( (*SCSR) & SCI_ERROR_FRAMING ) SciErrorsFraming ++;
2670 + if ( (*SCSR) & SCI_ERROR_NOISE ) SciErrorsNoise ++;
2671 + if ( (*SCSR) & SCI_ERROR_OVERRUN ) SciErrorsOverrun ++;
2673 + /* see if it was a transmit interrupt */
2675 + if ( (*SCSR) & SCI_XMTR_AVAILABLE ) /* data reg empty, xmt complete */
2677 + SciDisableTransmitInterrupts();
2679 + /* tell termios module that the charcter was sent */
2680 + /* he will call us later to transmit more if there are any */
2682 + if (rtems_termios_dequeue_characters( SciTermioTty, 1 ))
2684 + /* there are more bytes to transmit so enable TX interrupt */
2686 + SciEnableTransmitInterrupts();
2690 + /* see if it was a receive interrupt */
2691 + /* on the sci uart we just get one character per interrupt */
2693 + while ( SciCharAvailable() ) /* char in data register? */
2695 + ch = SciReadCharNoWait(); /* get the char from the uart */
2697 + /* IMPORTANT!!! */
2698 + /* either send it to the termios module or keep it locally */
2700 + if ( SciOpened == DRIVER_OPENED ) /* the driver is open */
2702 + SciRcvBufPutChar(ch); /* keep it locally */
2704 + else /* put in termios buffer */
2706 + char c = (char) ch;
2707 + rtems_termios_enqueue_raw_characters( SciTermioTty, &c, 1 );
2710 + *SCSR &= SCI_CLEAR_RX_INT; /* clear the interrupt */
2717 + * ROUTINES TO MANIPULATE THE CIRCULAR BUFFER
2720 +/****************************************************************************
2721 +* Func: SciRcvBufGetChar
2722 +* Desc: read a character from the circular buffer
2723 +* make sure there is data before you call this!
2725 +* Outputs: the character or -1
2728 +****************************************************************************/
2730 +static int8_t SciRcvBufGetChar()
2732 + rtems_interrupt_level level;
2735 + if ( SciRcvBufCount == 0 )
2737 + rtems_fatal_error_occurred(0xDEAD); /* check the count first! */
2740 + rtems_interrupt_disable( level ); /* disable interrupts */
2742 + ch = SciRcvBuffer[SciRcvBufGetIndex]; /* get next byte */
2744 + SciRcvBufGetIndex++; /* bump the index */
2746 + SciRcvBufGetIndex &= SCI_RCV_BUF_SIZE - 1; /* and wrap it */
2748 + SciRcvBufCount--; /* decrement counter */
2750 + rtems_interrupt_enable( level ); /* restore interrupts */
2752 + return ch; /* return the char */
2756 +/****************************************************************************
2757 +* Func: SciRcvBufPutChar
2758 +* Desc: put a character into the rcv data circular buffer
2759 +* Inputs: the character
2763 +****************************************************************************/
2765 +static void SciRcvBufPutChar( uint8_t ch )
2767 + rtems_interrupt_level level;
2769 + if ( SciRcvBufCount == SCI_RCV_BUF_SIZE ) /* is there room? */
2771 + return; /* no, throw it away */
2774 + rtems_interrupt_disable( level ); /* disable interrupts */
2776 + SciRcvBuffer[SciRcvBufPutIndex] = ch; /* put it in the buf */
2778 + SciRcvBufPutIndex++; /* bump the index */
2780 + SciRcvBufPutIndex &= SCI_RCV_BUF_SIZE - 1; /* and wrap it */
2782 + SciRcvBufCount++; /* increment counter */
2784 + rtems_interrupt_enable( level ); /* restore interrupts */
2786 + return; /* return */
2790 +/****************************************************************************
2791 +* Func: SciRcvBufFlush
2792 +* Desc: completely reset and clear the rcv buffer
2797 +****************************************************************************/
2799 +#if 0 /* prevents compiler warning */
2800 +static void SciRcvBufFlush( void )
2802 + rtems_interrupt_level level;
2804 + rtems_interrupt_disable( level ); /* disable interrupts */
2806 + memset( SciRcvBuffer, 0, sizeof(SciRcvBuffer) );
2808 + SciRcvBufPutIndex = 0; /* clear */
2810 + SciRcvBufGetIndex = 0; /* clear */
2812 + SciRcvBufCount = 0; /* clear */
2814 + rtems_interrupt_enable( level ); /* restore interrupts */
2816 + return; /* return */
2824 + * INTERRUPT BASED ENTRY POINTS FOR THE TERMIOS MODULE
2827 +/****************************************************************************
2828 +* Func: SciInterruptOpen
2829 +* Desc: open routine for the interrupt based device driver
2830 +* Default state is 9600 baud, 8 bits, No parity, and 1 stop bit. ??
2831 +**CHANGED** Default baud rate is now 19200, 8N1
2832 +* called from rtems_termios_open which is called from console_open
2833 +* Inputs: major - device number
2834 +* minor - device number
2835 +* args - points to terminal info
2836 +* Outputs: success/fail
2838 +* Scope: public API
2839 +****************************************************************************/
2841 +int SciInterruptOpen(
2847 + rtems_libio_open_close_args_t * args = arg;
2848 + rtems_isr_entry old_vector;
2850 + if ( minor != SCI_MINOR ) /* check minor device num */
2855 + if ( !args ) /* must have args */
2860 + SciTermioTty = args->iop->data1; /* save address of struct */
2862 + SciDisableAllInterrupts(); /* turn off sci interrupts */
2864 + /* THIS IS ACTUALLY A BAD THING - SETTING LINE PARAMETERS HERE */
2865 + /* IT SHOULD BE DONE THROUGH TCSETATTR() WHEN THE CONSOLE IS OPENED!!! */
2867 +/* SciSetBaud(115200); set the baud rate */
2868 +/* SciSetBaud( 57600); set the baud rate */
2869 +/* SciSetBaud( 38400); set the baud rate */
2870 + SciSetBaud( 19200); /* set the baud rate */
2871 +/* SciSetBaud( 9600); set the baud rate */
2873 + SciSetParity(SCI_PARITY_NONE); /* set parity to none */
2875 + SciSetDataBits(SCI_8_DATA_BITS); /* set data bits to 8 */
2877 + /* Install our interrupt handler into RTEMS, where does 66 come from? */
2879 + rtems_interrupt_catch( SciIsr, 66, &old_vector );
2883 + *QILR |= 0x06 & 0x07;
2885 + SciEnableTransmitter(); /* enable the transmitter */
2887 + SciEnableReceiver(); /* enable the receiver */
2889 + SciEnableReceiveInterrupts(); /* enable rcv interrupts */
2891 + return RTEMS_SUCCESSFUL;
2895 +/****************************************************************************
2896 +* Func: SciInterruptClose
2897 +* Desc: close routine called by the termios module
2898 +* Inputs: major - device number
2899 +* minor - device number
2901 +* Outputs: success/fail
2903 +* Scope: public - termio entry point
2904 +****************************************************************************/
2906 +int SciInterruptClose(
2912 + SciDisableAllInterrupts();
2914 + return RTEMS_SUCCESSFUL;
2918 +/****************************************************************************
2919 +* Func: SciInterruptWrite
2920 +* Desc: writes data to the uart using transmit interrupts
2921 +* Inputs: minor - device number
2922 +* buf - points to the data
2923 +* len - number of bytes to send
2924 +* Outputs: success/fail
2926 +* Scope: public API
2927 +****************************************************************************/
2929 +int SciInterruptWrite(
2935 + /* We are using interrupt driven output so termios only sends us */
2936 + /* one character at a time. The sci does not have a fifo. */
2938 + if ( !len ) /* no data? */
2940 + return 0; /* return error */
2943 + if ( minor != SCI_MINOR ) /* check the minor dev num */
2945 + return 0; /* return error */
2948 + if ( SciOpened == DRIVER_OPENED ) /* is the driver api open? */
2950 + return 1; /* yep, throw this away */
2953 + SciWriteCharNoWait(*buf); /* try to send a char */
2955 + *SCSR &= SCI_CLEAR_TDRE; /* clear tx data reg empty flag */
2957 + SciEnableTransmitInterrupts(); /* enable the tx interrupt */
2959 + return 1; /* return success */
2963 +/****************************************************************************
2964 +* Func: SciSetAttributes
2965 +* Desc: setup the uart based on the termios modules requests
2966 +* Inputs: minor - device number
2967 +* t - pointer to the termios info struct
2970 +* Scope: public API
2971 +****************************************************************************/
2973 +int SciSetAttributes(
2975 + const struct termios *t
2978 + uint32_t baud_requested;
2979 + uint32_t sci_rate = 0;
2980 + uint16_t sci_parity = 0;
2981 + uint16_t sci_databits = 0;
2983 + if ( minor != SCI_MINOR ) /* check the minor dev num */
2985 + return -1; /* return error */
2988 + /* if you look closely you will see this is the only thing we use */
2989 + /* set the baud rate */
2991 + baud_requested = t->c_cflag & CBAUD; /* baud rate */
2993 + if (!baud_requested)
2995 +/* baud_requested = B9600; default to 9600 baud */
2996 + baud_requested = B19200; /* default to 19200 baud */
2999 + sci_rate = termios_baud_to_number( baud_requested );
3001 + /* parity error detection */
3003 + if (t->c_cflag & PARENB) /* enable parity detection? */
3005 + if (t->c_cflag & PARODD)
3007 + sci_parity = SCI_PARITY_ODD; /* select odd parity */
3011 + sci_parity = SCI_PARITY_EVEN; /* select even parity */
3016 + sci_parity = SCI_PARITY_NONE; /* no parity, most common */
3019 + /* set the number of data bits, 8 is most common */
3021 + if (t->c_cflag & CSIZE) /* was it specified? */
3023 + switch (t->c_cflag & CSIZE)
3025 + case CS8: sci_databits = SCI_8_DATA_BITS; break;
3026 + default : sci_databits = SCI_9_DATA_BITS; break;
3031 + sci_databits = SCI_8_DATA_BITS; /* default to 8 data bits */
3034 + /* the number of stop bits; always 1 for SCI */
3036 + if (t->c_cflag & CSTOPB)
3041 + /* setup the hardware with these serial port parameters */
3043 + SciSetBaud(sci_rate); /* set the baud rate */
3044 + SciSetParity(sci_parity); /* set the parity type */
3045 + SciSetDataBits(sci_databits); /* set the data bits */
3047 + return RTEMS_SUCCESSFUL;
3054 + * POLLING BASED ENTRY POINTS FOR THE TERMIOS MODULE
3057 +/****************************************************************************
3058 +* Func: SciPolledOpen
3059 +* Desc: open routine for the polled i/o version of the driver
3060 +* called from rtems_termios_open which is called from console_open
3061 +* Inputs: major - device number
3062 +* minor - device number
3063 +* args - points to terminal info struct
3064 +* Outputs: success/fail
3066 +* Scope: public - termios entry point
3067 +****************************************************************************/
3075 + rtems_libio_open_close_args_t * args = arg;
3077 + if ( minor != SCI_MINOR ) /* check minor device num */
3082 + if ( !args ) /* must have args */
3087 + SciTermioTty = args->iop->data1; /* Store tty pointer */
3089 + SciDisableAllInterrupts(); /* don't generate interrupts */
3091 + /* THIS IS ACTUALLY A BAD THING - SETTING LINE PARAMETERS HERE */
3092 + /* IT SHOULD BE DONE THROUGH TCSETATTR() WHEN THE CONSOLE IS OPENED!!! */
3094 +/* SciSetBaud(115200); set the baud rate */
3095 +/* SciSetBaud( 57600); set the baud rate */
3096 +/* SciSetBaud( 38400); set the baud rate */
3097 + SciSetBaud( 19200); /* set the baud rate */
3098 +/* SciSetBaud( 9600); set the baud rate */
3100 + SciSetParity(SCI_PARITY_NONE); /* set no parity */
3102 + SciSetDataBits(SCI_8_DATA_BITS); /* set 8 data bits */
3104 + SciEnableTransmitter(); /* enable the xmitter */
3106 + SciEnableReceiver(); /* enable the rcvr */
3108 + return RTEMS_SUCCESSFUL;
3112 +/****************************************************************************
3113 +* Func: SciPolledClose
3114 +* Desc: close routine for the device driver, same for both
3115 +* Inputs: major - device number
3116 +* minor - device number
3118 +* Outputs: success/fail
3120 +* Scope: public termios API
3121 +****************************************************************************/
3123 +int SciPolledClose(
3129 + SciDisableAllInterrupts();
3131 + return RTEMS_SUCCESSFUL;
3135 +/****************************************************************************
3136 +* Func: SciPolledRead
3137 +* Desc: polling based read routine for the uart
3138 +* Inputs: minor - device number
3139 +* Outputs: error or the character read
3141 +* Scope: public API
3142 +****************************************************************************/
3148 + if ( minor != SCI_MINOR ) /* check the type-punned dev num */
3150 + return -1; /* return error */
3153 + if ( SciCharAvailable() ) /* if a char is available */
3155 + return SciReadCharNoWait(); /* read the rx data register */
3158 + return -1; /* return error */
3162 +/****************************************************************************
3163 +* Func: SciPolledWrite
3164 +* Desc: writes out characters in polled mode, waiting for the uart
3165 +* check in console_open, but we only seem to use interrupt mode
3166 +* Inputs: minor - device number
3167 +* buf - points to the data
3168 +* len - how many bytes
3169 +* Outputs: error or number of bytes written
3171 +* Scope: public termios API
3172 +****************************************************************************/
3174 +int SciPolledWrite(
3180 + int32_t written = 0;
3182 + if ( minor != SCI_MINOR ) /* check minor device num */
3187 + if ( SciOpened == DRIVER_OPENED ) /* is the driver api open? */
3189 + return -1; /* toss the data */
3192 + /* send each byte in the string out the port */
3194 + while ( written < len )
3196 + SciWriteCharWait(*buf++); /* send a byte */
3198 + written++; /* increment counter */
3201 + return written; /* return count */
3208 + * DEVICE DRIVER PUBLIC API ENTRY POINTS
3211 +/****************************************************************************
3213 +* Desc: Initialize the lasers device driver and hardware
3214 +* Inputs: major - the major device number which is assigned by rtems
3215 +* minor - the minor device number which is undefined at this point
3217 +* Outputs: RTEMS_SUCCESSFUL
3219 +* Scope: public API
3220 +****************************************************************************/
3222 +rtems_device_driver SciInitialize (
3223 + rtems_device_major_number major,
3224 + rtems_device_minor_number minor,
3228 +/* rtems_status_code status; */
3230 +/*printk("%s\r\n", __FUNCTION__); */
3232 + /* register the SCI device name for termios console i/o
3233 + * this is done over in console.c which doesn't seem exactly right
3234 + * but there were problems doing it here...
3237 +/* status = rtems_io_register_name( "/dev/sci", major, 0 ); */
3239 +/* if (status != RTEMS_SUCCESSFUL) */
3240 +/* rtems_fatal_error_occurred(status); */
3242 + SciMajor = major; /* save the rtems major number */
3244 + SciOpened = DRIVER_CLOSED; /* initial state is closed */
3246 + /* if you have an interrupt handler, install it here */
3248 + SciInited = 1; /* set the inited flag */
3250 + return RTEMS_SUCCESSFUL;
3254 +/****************************************************************************
3256 +* Desc: device driver open routine
3257 +* you must open a device before you can anything else
3258 +* only one process can have the device opened at a time
3259 +* you could look at the task id to restrict access if you want
3260 +* Inputs: major - the major device number assigned by rtems
3261 +* minor - the minor device number assigned by us
3263 +* Outputs: see below
3265 +* Scope: public API
3266 +****************************************************************************/
3268 +rtems_device_driver SciOpen (
3269 + rtems_device_major_number major,
3270 + rtems_device_minor_number minor,
3274 +/*printk("%s major=%d minor=%d\r\n", __FUNCTION__,major,minor); */
3276 + if (SciInited == 0) /* must be initialized first! */
3278 + return RTEMS_NOT_CONFIGURED;
3281 + if (minor != SCI_MINOR)
3283 + return RTEMS_INVALID_NAME; /* verify minor number */
3286 + if (SciOpened == DRIVER_OPENED)
3288 + return RTEMS_RESOURCE_IN_USE; /* already opened! */
3291 + SciOpened = DRIVER_OPENED; /* set the opened flag */
3293 + return RTEMS_SUCCESSFUL;
3297 +/****************************************************************************
3299 +* Desc: device driver close routine
3300 +* the device must be opened before you can close it
3301 +* the device must be closed before someone (else) can open it
3302 +* Inputs: major - the major device number
3303 +* minor - the minor device number
3305 +* Outputs: see below
3307 +* Scope: public API
3308 +****************************************************************************/
3310 +rtems_device_driver SciClose (
3311 + rtems_device_major_number major,
3312 + rtems_device_minor_number minor,
3316 +/*printk("%s major=%d minor=%d\r\n", __FUNCTION__,major,minor); */
3318 + if (minor != SCI_MINOR)
3320 + return RTEMS_INVALID_NAME; /* check the minor number */
3323 + if (SciOpened != DRIVER_OPENED)
3325 + return RTEMS_INCORRECT_STATE; /* must be opened first */
3328 + SciOpened = DRIVER_CLOSED; /* set the flag */
3330 + return RTEMS_SUCCESSFUL;
3334 +/****************************************************************************
3336 +* Desc: device driver read routine
3337 +* this function is not meaningful for the laser devices
3338 +* Inputs: major - the major device number
3339 +* minor - the minor device number
3340 +* arg - read/write arguments
3341 +* Outputs: see below
3343 +* Scope: public API
3344 +****************************************************************************/
3346 +rtems_device_driver SciRead (
3347 + rtems_device_major_number major,
3348 + rtems_device_minor_number minor,
3352 + rtems_libio_rw_args_t *rw_args; /* ptr to argument struct */
3356 + rw_args = (rtems_libio_rw_args_t *) arg; /* arguments to read() */
3358 + if (minor != SCI_MINOR)
3360 + return RTEMS_INVALID_NAME; /* check the minor number */
3363 + if (SciOpened == DRIVER_CLOSED)
3365 + return RTEMS_INCORRECT_STATE; /* must be opened first */
3368 + buffer = rw_args->buffer; /* points to user's buffer */
3370 + length = rw_args->count; /* how many bytes they want */
3372 +/* *buffer = SciReadCharWait(); wait for a character */
3374 + /* if there isn't a character available, wait until one shows up */
3375 + /* or the timeout period expires, which ever happens first */
3377 + if ( SciRcvBufCount == 0 ) /* no chars */
3379 + /* wait for someone to wake me up... */
3380 + /*rtems_task_wake_after(SciReadTimeout); */
3383 + if ( SciRcvBufCount ) /* any characters locally? */
3385 + *buffer = SciRcvBufGetChar(); /* get the character */
3387 + rw_args->bytes_moved = 1; /* how many we actually read */
3390 + return RTEMS_SUCCESSFUL;
3394 +/****************************************************************************
3396 +* Desc: device driver write routine
3397 +* this function is not meaningful for the laser devices
3398 +* Inputs: major - the major device number
3399 +* minor - the minor device number
3400 +* arg - read/write arguments
3401 +* Outputs: see below
3403 +* Scope: public API
3404 +****************************************************************************/
3406 +rtems_device_driver SciWrite (
3407 + rtems_device_major_number major,
3408 + rtems_device_minor_number minor,
3412 + rtems_libio_rw_args_t *rw_args; /* ptr to argument struct */
3416 + rw_args = (rtems_libio_rw_args_t *) arg;
3418 + if (minor != SCI_MINOR)
3420 + return RTEMS_INVALID_NAME; /* check the minor number */
3423 + if (SciOpened == DRIVER_CLOSED)
3425 + return RTEMS_INCORRECT_STATE; /* must be opened first */
3428 + buffer = (uint8_t*)rw_args->buffer; /* points to data */
3430 + length = rw_args->count; /* how many bytes */
3434 + SciWriteCharWait(*buffer++); /* send the bytes out */
3437 + rw_args->bytes_moved = rw_args->count; /* how many we wrote */
3439 + return RTEMS_SUCCESSFUL;
3443 +/****************************************************************************
3445 +* Desc: device driver control routine
3446 +* see below for an example of how to use the ioctl interface
3447 +* Inputs: major - the major device number
3448 +* minor - the minor device number
3449 +* arg - io control args
3450 +* Outputs: see below
3452 +* Scope: public API
3453 +****************************************************************************/
3455 +rtems_device_driver SciControl (
3456 + rtems_device_major_number major,
3457 + rtems_device_minor_number minor,
3461 + rtems_libio_ioctl_args_t *args = arg; /* rtems arg struct */
3462 + uint16_t command; /* the cmd to execute */
3463 + uint16_t unused; /* maybe later */
3464 + uint16_t *ptr; /* ptr to user data */
3466 +/*printk("%s major=%d minor=%d\r\n", __FUNCTION__,major,minor); */
3468 + /* do some sanity checking */
3470 + if (minor != SCI_MINOR)
3472 + return RTEMS_INVALID_NAME; /* check the minor number */
3475 + if (SciOpened == DRIVER_CLOSED)
3477 + return RTEMS_INCORRECT_STATE; /* must be open first */
3482 + return RTEMS_INVALID_ADDRESS; /* must have args */
3485 + args->ioctl_return = -1; /* assume an error */
3487 + command = args->command; /* get the command */
3488 + ptr = args->buffer; /* this is an address */
3489 + unused = *ptr; /* brightness */
3491 + if (command == SCI_SEND_BREAK) /* process the command */
3493 + SciSendBreak(); /* send break char */
3496 + args->ioctl_return = 0; /* return status */
3498 + return RTEMS_SUCCESSFUL;
3505 + * HARDWARE LEVEL ROUTINES
3508 +/****************************************************************************
3510 +* Desc: setup the uart based on the termios modules requests
3511 +* Inputs: baud rate
3515 +****************************************************************************/
3517 +static void SciSetBaud(uint32_t rate)
3520 + uint16_t save_sccr1;
3522 +/* when you open the console you need to set the termio struct baud rate */
3523 +/* it has a default value of 9600, when someone calls tcsetattr it reverts! */
3525 + SciBaud = rate; /* save the rate */
3527 + /* calculate the register value as a float and convert to an int */
3528 + /* set baud rate - you must define the system clock constant */
3529 + /* see mrm332.h for an example */
3531 + value = ( (uint16_t) ( SYS_CLOCK / rate / 32.0 + 0.5 ) & 0x1fff );
3533 + save_sccr1 = *SCCR1; /* save register */
3535 + /* also turns off the xmtr and rcvr */
3537 + *SCCR1 &= SCI_DISABLE_INT_ALL; /* disable interrupts */
3539 + *SCCR0 = value; /* write the register */
3541 + *SCCR1 = save_sccr1; /* restore register */
3547 +/****************************************************************************
3548 +* Func: SciSetParity
3549 +* Desc: setup the uart based on the termios modules requests
3554 +****************************************************************************/
3556 +static void SciSetParity(uint16_t parity)
3560 + value = *SCCR1; /* get the register */
3562 + if (parity == SCI_PARITY_ODD)
3564 + value |= SCI_PARITY_ENABLE; /* parity enabled */
3565 + value |= SCI_PARITY_ODD; /* parity odd */
3568 + else if (parity == SCI_PARITY_EVEN)
3570 + value |= SCI_PARITY_ENABLE; /* parity enabled */
3571 + value &= ~SCI_PARITY_ODD; /* parity even */
3574 + else if (parity == SCI_PARITY_NONE)
3576 + value &= ~SCI_PARITY_ENABLE; /* disabled, most common */
3579 + /* else no changes */
3581 + *SCCR1 = value; /* write the register */
3587 +/****************************************************************************
3588 +* Func: SciSetDataBits
3589 +* Desc: setup the uart based on the termios modules requests
3590 +* Inputs: data bits
3594 +****************************************************************************/
3596 +static void SciSetDataBits(uint16_t bits)
3600 + value = *SCCR1; /* get the register */
3602 + /* note - the parity setting affects the number of data bits */
3604 + if (bits == SCI_9_DATA_BITS)
3606 + value |= SCI_9_DATA_BITS; /* 9 data bits */
3609 + else if (bits == SCI_8_DATA_BITS)
3611 + value &= SCI_8_DATA_BITS; /* 8 data bits */
3614 + /* else no changes */
3616 + *SCCR1 = value; /* write the register */
3622 +/****************************************************************************
3623 +* Func: SciDisableAllInterrupts
3624 +* Func: SciEnableTransmitInterrupts
3625 +* Func: SciEnableReceiveInterrupts
3626 +* Desc: handles generation of interrupts by the sci module
3631 +****************************************************************************/
3633 +static void inline SciDisableAllInterrupts( void )
3635 + /* this also turns off the xmtr and rcvr */
3637 + *SCCR1 &= SCI_DISABLE_INT_ALL;
3640 +static void inline SciEnableReceiveInterrupts( void )
3642 + *SCCR1 |= SCI_ENABLE_INT_RX;
3645 +static void inline SciDisableReceiveInterrupts( void )
3647 + *SCCR1 &= SCI_DISABLE_INT_RX;
3650 +static void inline SciEnableTransmitInterrupts( void )
3652 + *SCCR1 |= SCI_ENABLE_INT_TX;
3655 +static void inline SciDisableTransmitInterrupts( void )
3657 + *SCCR1 &= SCI_DISABLE_INT_TX;
3661 +/****************************************************************************
3662 +* Func: SciEnableTransmitter, SciDisableTransmitter
3663 +* Func: SciEnableReceiver, SciDisableReceiver
3664 +* Desc: turns the transmitter and receiver on and off
3669 +****************************************************************************/
3671 +static void inline SciEnableTransmitter( void )
3673 + *SCCR1 |= SCI_ENABLE_XMTR;
3676 +static void inline SciDisableTransmitter( void )
3678 + *SCCR1 &= SCI_DISABLE_XMTR;
3681 +static void inline SciEnableReceiver( void )
3683 + *SCCR1 |= SCI_ENABLE_RCVR;
3686 +static void inline SciDisableReceiver( void )
3688 + *SCCR1 &= SCI_DISABLE_RCVR;
3692 +/****************************************************************************
3693 +* Func: SciWriteCharWait
3694 +* Desc: wait for room in the fifo and then put a char in
3695 +* Inputs: a byte to send
3699 +****************************************************************************/
3701 +void SciWriteCharWait(uint8_t c)
3703 + /* poll the fifo, waiting for room for another character */
3705 + while ( ( *SCSR & SCI_XMTR_AVAILABLE ) == 0 )
3707 + /* Either we are writing to the fifo faster than
3708 + * the uart can clock bytes out onto the cable,
3709 + * or we are in flow control (actually no, we
3710 + * are ignoring flow control from the other end).
3711 + * In the first case, higher baud rates will help.
3713 + /* relinquish processor while waiting */
3714 + rtems_task_wake_after(RTEMS_YIELD_PROCESSOR);
3717 + *SCDR = c; /* send the charcter */
3719 + SciBytesOut++; /* increment the counter */
3724 +/****************************************************************************
3725 +* Func: SciWriteCharNoWait
3726 +* Desc: if no room in the fifo throw the char on the floor
3727 +* Inputs: a byte to send
3731 +****************************************************************************/
3733 +void SciWriteCharNoWait(uint8_t c)
3735 + if ( ( *SCSR & SCI_XMTR_AVAILABLE ) == 0 )
3737 + return; /* no room, throw it away */
3740 + *SCDR = c; /* put the char in the fifo */
3742 + SciBytesOut++; /* increment the counter */
3748 +/****************************************************************************
3749 +* Func: SciReadCharWait
3750 +* Desc: read a character, waiting for one to show up, if need be
3752 +* Outputs: a character
3755 +****************************************************************************/
3757 +uint8_t inline SciReadCharWait( void )
3761 + while ( SciCharAvailable() == 0 ) /* anything there? */
3763 + /* relinquish processor while waiting */
3764 + rtems_task_wake_after(RTEMS_YIELD_PROCESSOR);
3767 + /* if you have rcv ints enabled, then the isr will probably */
3768 + /* get the character before you will unless you turn off ints */
3769 + /* ie polling and ints don't mix that well */
3771 + ch = *SCDR; /* get the charcter */
3773 + SciBytesIn++; /* increment the counter */
3775 + return ch; /* return the char */
3778 +/****************************************************************************
3779 +* Func: SciReadCharNoWait
3780 +* Desc: try to get a char but dont wait for one
3782 +* Outputs: a character or -1 if none
3785 +****************************************************************************/
3787 +uint8_t inline SciReadCharNoWait( void )
3791 + if ( SciCharAvailable() == 0 ) /* anything there? */
3794 + ch = *SCDR; /* get the character */
3796 + SciBytesIn++; /* increment the count */
3798 + return ch; /* return the char */
3802 +/****************************************************************************
3803 +* Func: SciCharAvailable
3804 +* Desc: is there a receive character in the data register
3806 +* Outputs: false if no char available, else true
3809 +****************************************************************************/
3811 +uint8_t inline SciCharAvailable( void )
3813 + return ( *SCSR & SCI_RCVR_READY ); /* char in data register? */
3817 +/****************************************************************************
3818 +* Func: SciSendBreak
3819 +* Desc: send 1 or tow breaks (all zero bits)
3824 +****************************************************************************/
3826 +void SciSendBreak( void )
3828 + /* From the Motorola QSM reference manual - */
3830 + /* "if SBK is toggled by writing it first to a one and then immediately */
3831 + /* to a zero (in less than one serial frame interval), the transmitter */
3832 + /* sends only one or two break frames before reverting to mark (idle) */
3833 + /* or before commencing to send more data" */
3835 + *SCCR1 |= SCI_SEND_BREAK; /* set the bit */
3837 + *SCCR1 &= ~SCI_SEND_BREAK; /* clear the bit */
3849 +/****************************************************************************
3850 +* Func: SciUnitTest
3851 +* Desc: test the device driver
3855 +****************************************************************************/
3858 +#define O_RDWR LIBIO_FLAGS_READ_WRITE /* dont like this but... */
3862 + uint8_t byte; /* a character */
3863 + uint16_t fd; /* file descriptor for device */
3864 + uint16_t result; /* result of ioctl */
3866 + fd = open("/dev/sci",O_RDWR); /* open the device */
3868 +printk("SCI open fd=%d\r\n",fd);
3870 + result = write(fd, "abcd\r\n", 6); /* send a string */
3872 +printk("SCI write result=%d\r\n",result);
3874 + result = read(fd, &byte, 1); /* read a byte */
3876 +printk("SCI read result=%d,byte=%x\r\n",result,byte);
3883 +/****************************************************************************
3884 +* Func: SciPrintStats
3885 +* Desc: print out some driver information
3889 +****************************************************************************/
3891 +void SciPrintStats ( void )
3895 + printk( "SYS_CLOCK is %2.6f Mhz\r\n\n", SYS_CLOCK / 1000000.0 );
3897 + printk( "Current baud rate is %d bps or %d cps\r\n\n", SciBaud, SciBaud / 10 );
3899 + printk( "SCI Uart chars in %8d\r\n", SciBytesIn );
3900 + printk( "SCI Uart chars out %8d\r\n", SciBytesOut );
3901 + printk( "SCI Uart framing errors %8d\r\n", SciErrorsFraming );
3902 + printk( "SCI Uart parity errors %8d\r\n", SciErrorsParity );
3903 + printk( "SCI Uart overrun errors %8d\r\n", SciErrorsOverrun );
3904 + printk( "SCI Uart noise errors %8d\r\n", SciErrorsNoise );
3908 Index: rtems/c/src/lib/libbsp/m68k/mo376/startup/bspstart.c
3909 ===================================================================
3910 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
3911 +++ rtems/c/src/lib/libbsp/m68k/mo376/startup/bspstart.c 2007-08-14 17:20:30.000000000 +0200
3914 + * This routine starts the application. It includes application,
3915 + * board, and monitor specific initialization and configuration.
3916 + * The generic CPU dependent initialization has been performed
3917 + * before this routine is invoked.
3919 + * COPYRIGHT (c) 1989-1999.
3920 + * On-Line Applications Research Corporation (OAR).
3922 + * The license and distribution terms for this file may be
3923 + * found in the file LICENSE in this distribution or at
3924 + * http://www.rtems.com/license/LICENSE.
3926 + * $Id: bspstart.c,v 1.7 2004/04/21 10:42:52 ralf Exp $
3930 +#include <rtems/libio.h>
3932 +#include <string.h>
3935 + * The original table from the application and our copy of it with
3939 +extern rtems_configuration_table Configuration;
3940 +rtems_configuration_table BSP_Configuration;
3942 +rtems_cpu_table Cpu_table;
3944 +char *rtems_progname;
3947 + * Use the shared implementations of the following routines
3950 +void bsp_postdriver_hook(void);
3951 +void bsp_libc_init( void *, uint32_t, int );
3952 +void bsp_pretasking_hook(void); /* m68k version */
3955 + * Call Spurious_Initialize in bsp_predriver_hook because
3956 + * bsp_predriver_hook is call after the _ISR_Vector_Table allocation
3959 +void bsp_predriver_hook(void)
3961 + void Spurious_Initialize();
3962 + Spurious_Initialize();
3968 + * This routine does the bulk of the system initialization.
3971 +void bsp_start( void )
3974 + extern void *_WorkspaceBase;
3975 + extern void *_RamSize;
3976 + extern unsigned long _M68k_Ramsize;
3978 + _M68k_Ramsize = (unsigned long)&_RamSize; /* RAM size set in linker script */
3981 + * we only use a hook to get the C library initialized.
3984 + Cpu_table.pretasking_hook = bsp_pretasking_hook;
3985 + Cpu_table.predriver_hook = bsp_predriver_hook;
3986 + Cpu_table.postdriver_hook = bsp_postdriver_hook;
3988 + m68k_get_vbr( vbr );
3989 + Cpu_table.interrupt_vector_table = vbr;
3991 + BSP_Configuration.work_space_start = (void *) &_WorkspaceBase;
3993 + /* Clock_exit is done as an atexit() function */
3995 Index: rtems/c/src/lib/libbsp/m68k/mo376/startup/start_c.c
3996 ===================================================================
3997 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
3998 +++ rtems/c/src/lib/libbsp/m68k/mo376/startup/start_c.c 2007-08-14 17:20:30.000000000 +0200
4004 +#include <mrm332.h>
4005 +#include <rtems/m68k/sim.h>
4006 +#define __START_C__
4009 +m68k_isr_entry M68Kvec[256];
4010 +m68k_isr_entry vectors[256];
4011 +char * const __argv[]= {"main", ""};
4013 +void boot_card(int argc, char * const argv[]);
4016 + * This prototype really should have the noreturn attribute but
4017 + * that causes a warning. Not sure how to fix that.
4019 +/* void dumby_start () __attribute__ ((noreturn)); */
4024 + /* Synthesizer Control Register */
4025 + /* see section(s) 4.8 */
4026 + /* end include in ram_init.S */
4027 + *SYNCR = (unsigned short int)
4028 + ( SAM(MRM_W,15,VCO) | SAM(0x0,14,PRESCALE) | SAM(MRM_Y,8,COUNTER) );
4029 + while (! (*SYNCR & SLOCK)); /* protect from clock overshoot */
4030 + /* include in ram_init.S */
4031 + *SYNCR = (unsigned short int)
4032 + ( SAM(MRM_W,15,VCO) | SAM(MRM_X,14,PRESCALE) | SAM(MRM_Y,8,COUNTER) );
4034 + /* System Protection Control Register */
4035 + /* !!! can only write to once after reset !!! */
4036 + /* see section 3.8.4 of the SIM Reference Manual */
4037 + *SYPCR = (unsigned char)( HME | BME );
4039 + /* Periodic Interrupr Control Register */
4040 + /* see section 3.8.2 of the SIM Reference Manual */
4041 + *PICR = (unsigned short int)
4042 + ( SAM(0,8,PIRQL) | SAM(MRM_PIV,0,PIV) );
4043 + /* ^^^ zero disables interrupt, don't enable here or ram_init will
4044 + be wrong. It's enabled below. */
4046 + /* Periodic Interrupt Timer Register */
4047 + /* see section 3.8.3 of the SIM Reference Manual */
4048 + *PITR = (unsigned short int)( SAM(0x09,0,PITM) );
4049 + /* 1.098mS interrupt, assuming 32.768 KHz input clock */
4052 + /* load values before enabled */
4053 + *PORTC = (unsigned char) 0x0;
4055 + /* Port E and F Data Register */
4056 + /* see section 9 of the SIM Reference Manual */
4057 + *PORTE0 = (unsigned char) 0;
4058 + *PORTF0 = (unsigned char) 0;
4060 + /* Port E and F Data Direction Register */
4061 + /* see section 9 of the SIM Reference Manual */
4062 + *DDRE = (unsigned char) 0xff;
4063 + *DDRF = (unsigned char) 0xfd;
4065 + /* Port E and F Pin Assignment Register */
4066 + /* see section 9 of the SIM Reference Manual */
4067 + *PEPAR = (unsigned char) 0;
4068 + *PFPAR = (unsigned char) 0;
4070 + /* end of SIM initalization code */
4071 + /* end include in ram_init.S */
4074 + * Initialize RAM by copying the .data section out of ROM (if
4075 + * needed) and "zero-ing" the .bss section.
4078 + register char *src = _etext;
4079 + register char *dst = _copy_start;
4081 + if (_copy_data_from_rom)
4082 + /* ROM has data at end of text; copy it. */
4083 + while (dst < _edata)
4087 + for (dst = _clear_start; dst< end; dst++)
4094 + * Initialize vector table.
4097 + m68k_isr_entry *monitors_vector_table;
4099 + m68k_get_vbr(monitors_vector_table);
4101 + M68Kvec[ 4 ] = monitors_vector_table[ 4 ]; /* breakpoints vector */
4102 + M68Kvec[ 9 ] = monitors_vector_table[ 9 ]; /* trace vector */
4103 + M68Kvec[ 31 ] = monitors_vector_table[ 31 ]; /* level 7 interrupt */
4104 + M68Kvec[ 47 ] = monitors_vector_table[ 47 ]; /* system call vector */
4105 + M68Kvec[ 66 ] = monitors_vector_table[ 66 ]; /* user defined */
4107 + m68k_set_vbr(&M68Kvec);
4111 + * Initalize the board.
4114 + /* Spurious should be called in the predriver hook */
4115 + /* Spurious_Initialize(); */
4116 + /*console_init(); */
4119 + * Execute main with arguments argc and agrv.
4121 + boot_card(1,__argv);
4125 Index: rtems/c/src/lib/libbsp/m68k/mo376/include/tm27.h
4126 ===================================================================
4127 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
4128 +++ rtems/c/src/lib/libbsp/m68k/mo376/include/tm27.h 2007-08-14 17:20:30.000000000 +0200
4133 + * The license and distribution terms for this file may be
4134 + * found in the file LICENSE in this distribution or at
4135 + * http://www.rtems.com/license/LICENSE.
4137 + * $Id: tm27.h,v 1.2 2004/04/23 04:47:36 ralf Exp $
4140 +#ifndef _RTEMS_TMTEST27
4141 +#error "This is an RTEMS internal file you must not include directly."
4148 + * Define the interrupt mechanism for Time Test 27
4151 +/* XXX - JRS - I want to compile the tmtests */
4153 +#define MUST_WAIT_FOR_INTERRUPT 1
4155 +#define Install_tm27_vector( handler ) /* empty */
4157 +#define Cause_tm27_intr() /* empty */
4159 +#define Clear_tm27_intr() /* empty */
4161 +#define Lower_tm27_intr() /* empty */
4164 Index: rtems/c/src/lib/libbsp/m68k/mo376/times
4165 ===================================================================
4166 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
4167 +++ rtems/c/src/lib/libbsp/m68k/mo376/times 2007-08-14 17:20:30.000000000 +0200
4170 +# Timing Test Suite Results for the MRM332 BSP
4172 +# $Id: times,v 1.2 2004/01/07 21:13:50 joel Exp $
4175 +NOTE: This BSP is user submitted and no information is currently available.
4177 +TBD: MATT - update this with real times!
4181 +Clock Speed: 20 Mhz
4182 +Memory Configuration: SRAM, DRAM, cache, etc
4185 +Times Reported in: cycles, microseconds, etc
4186 +Timer Source: Count Down Timer, on-CPU cycle counter, etc
4192 +== ================================================================= ==== ====
4193 + 1 rtems_semaphore_create 20
4194 + rtems_semaphore_delete 21
4195 + rtems_semaphore_obtain: available 15
4196 + rtems_semaphore_obtain: not available -- NO_WAIT 15
4197 + rtems_semaphore_release: no waiting tasks 16
4199 + 2 rtems_semaphore_obtain: not available -- caller blocks 62
4201 + 3 rtems_semaphore_release: task readied -- preempts caller 55
4203 + 4 rtems_task_restart: blocked task -- preempts caller 77
4204 + rtems_task_restart: ready task -- preempts caller 70
4205 + rtems_semaphore_release: task readied -- returns to caller 25
4206 + rtems_task_create 57
4207 + rtems_task_start 31
4208 + rtems_task_restart: suspended task -- returns to caller 36
4209 + rtems_task_delete: suspended task 47
4210 + rtems_task_restart: ready task -- returns to caller 37
4211 + rtems_task_restart: blocked task -- returns to caller 46
4212 + rtems_task_delete: blocked task 50
4214 + 5 rtems_task_suspend: calling task 51
4215 + rtems_task_resume: task readied -- preempts caller 49
4217 + 6 rtems_task_restart: calling task 59
4218 + rtems_task_suspend: returns to caller 18
4219 + rtems_task_resume: task readied -- returns to caller 19
4220 + rtems_task_delete: ready task 50
4222 + 7 rtems_task_restart: suspended task -- preempts caller 70
4224 + 8 rtems_task_set_priority: obtain current priority 12
4225 + rtems_task_set_priority: returns to caller 27
4226 + rtems_task_mode: obtain current mode 5
4227 + rtems_task_mode: no reschedule 5
4228 + rtems_task_mode: reschedule -- returns to caller 8
4229 + rtems_task_mode: reschedule -- preempts caller 39
4230 + rtems_task_set_note 13
4231 + rtems_task_get_note 13
4232 + rtems_clock_set 33
4235 + 9 rtems_message_queue_create 110
4236 + rtems_message_queue_send: no waiting tasks 37
4237 + rtems_message_queue_urgent: no waiting tasks 37
4238 + rtems_message_queue_receive: available 31
4239 + rtems_message_queue_flush: no messages flushed 12
4240 + rtems_message_queue_flush: messages flushed 16
4241 + rtems_message_queue_delete 26
4243 +10 rtems_message_queue_receive: not available -- NO_WAIT 15
4244 + rtems_message_queue_receive: not available -- caller blocks 62
4246 +11 rtems_message_queue_send: task readied -- preempts caller 72
4248 +12 rtems_message_queue_send: task readied -- returns to caller 39
4250 +13 rtems_message_queue_urgent: task readied -- preempts caller 72
4252 +14 rtems_message_queue_urgent: task readied -- returns to caller 39
4254 +15 rtems_event_receive: obtain current events 1
4255 + rtems_event_receive: not available -- NO_WAIT 12
4256 + rtems_event_receive: not available -- caller blocks 56
4257 + rtems_event_send: no task readied 12
4258 + rtems_event_receive: available 12
4259 + rtems_event_send: task readied -- returns to caller 24
4261 +16 rtems_event_send: task readied -- preempts caller 55
4263 +17 rtems_task_set_priority: preempts caller 62
4265 +18 rtems_task_delete: calling task 83
4267 +19 rtems_signal_catch 9
4268 + rtems_signal_send: returns to caller 15
4269 + rtems_signal_send: signal to self 18
4270 + exit ASR overhead: returns to calling task 22
4271 + exit ASR overhead: returns to preempting task 49
4273 +20 rtems_partition_create 35
4274 + rtems_region_create 23
4275 + rtems_partition_get_buffer: available 15
4276 + rtems_partition_get_buffer: not available 13
4277 + rtems_partition_return_buffer 18
4278 + rtems_partition_delete 16
4279 + rtems_region_get_segment: available 22
4280 + rtems_region_get_segment: not available -- NO_WAIT 21
4281 + rtems_region_return_segment: no waiting tasks 19
4282 + rtems_region_get_segment: not available -- caller blocks 64
4283 + rtems_region_return_segment: task readied -- preempts caller 74
4284 + rtems_region_return_segment: task readied -- returns to caller 44
4285 + rtems_region_delete 16
4286 + rtems_io_initialize 2
4291 + rtems_io_control 1
4293 +21 rtems_task_ident 149
4294 + rtems_message_queue_ident 145
4295 + rtems_semaphore_ident 156
4296 + rtems_partition_ident 145
4297 + rtems_region_ident 148
4298 + rtems_port_ident 145
4299 + rtems_timer_ident 145
4300 + rtems_rate_monotonic_ident 145
4302 +22 rtems_message_queue_broadcast: task readied -- returns to caller 42
4303 + rtems_message_queue_broadcast: no waiting tasks 17
4304 + rtems_message_queue_broadcast: task readied -- preempts caller 78
4306 +23 rtems_timer_create 14
4307 + rtems_timer_fire_after: inactive 22
4308 + rtems_timer_fire_after: active 24
4309 + rtems_timer_cancel: active 15
4310 + rtems_timer_cancel: inactive 13
4311 + rtems_timer_reset: inactive 21
4312 + rtems_timer_reset: active 23
4313 + rtems_timer_fire_when: inactive 34
4314 + rtems_timer_fire_when: active 34
4315 + rtems_timer_delete: active 19
4316 + rtems_timer_delete: inactive 17
4317 + rtems_task_wake_when 69
4319 +24 rtems_task_wake_after: yield -- returns to caller 9
4320 + rtems_task_wake_after: yields -- preempts caller 45
4322 +25 rtems_clock_tick 4
4327 + _Thread_Disable_dispatch 0
4328 + _Thread_Enable_dispatch 7
4329 + _Thread_Set_state 11
4330 + _Thread_Disptach (NO FP) 31
4331 + context switch: no floating point contexts 21
4332 + context switch: self 10
4333 + context switch: to another task 10
4334 + context switch: restore 1st FP task 25
4335 + fp context switch: save idle, restore idle 31
4336 + fp context switch: save idle, restore initialized 19
4337 + fp context switch: save initialized, restore initialized 20
4343 + _Thread_Get: invalid id 0
4345 +27 interrupt entry overhead: returns to interrupted task 6
4346 + interrupt exit overhead: returns to interrupted task 6
4347 + interrupt entry overhead: returns to nested interrupt 6
4348 + interrupt exit overhead: returns to nested interrupt 5
4349 + interrupt entry overhead: returns to preempting task 7
4350 + interrupt exit overhead: returns to preempting task 36
4352 +28 rtems_port_create 16
4353 + rtems_port_external_to_internal 11
4354 + rtems_port_internal_to_external 11
4355 + rtems_port_delete 16
4357 +29 rtems_rate_monotonic_create 15
4358 + rtems_rate_monotonic_period: initiate period -- returns to caller 21
4359 + rtems_rate_monotonic_period: obtain status 13
4360 + rtems_rate_monotonic_cancel 16
4361 + rtems_rate_monotonic_delete: inactive 18
4362 + rtems_rate_monotonic_delete: active 20
4363 + rtems_rate_monotonic_period: conclude periods -- caller blocks 53
4364 Index: rtems/c/src/lib/libbsp/m68k/mo376/include/mrm332.h
4365 ===================================================================
4366 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
4367 +++ rtems/c/src/lib/libbsp/m68k/mo376/include/mrm332.h 2007-08-14 17:20:30.000000000 +0200
4371 + * $Id: mrm332.h,v 1.5 2004/04/21 16:01:35 ralf Exp $
4377 +/* SIM_MM (SIM Module Mapping) determines the location of the control
4378 + register block. When MM=0, register addresses range fom 0x7ff000 to
4379 + 0x7FFFFF. When MM=1, register addresses range from 0xfff000 to
4383 +/* Interrupt related definitions */
4384 +#define SIM_IARB 15
4385 +#define QSM_IARB 10
4388 +#define ISRL_PIT 4 /* zero disables PIT */
4390 +#define EFI_QIVR 66 /* 66=>SCI and 67=>QSPI interrupt */
4391 +#define ISRL_QSPI 0
4393 +#define EFI_SPINT 24 /* spurious interrupt */
4394 +#define EFI_INT1 25 /* CTS interrupt */
4397 +/* System Clock definitions */
4398 +#define XTAL 32768.0 /* crystal frequency in Hz */
4401 +/* Default MRM clock rate (8.388688 MHz) set by CPU32: */
4402 +#define MRM_W 0 /* system clock parameters */
4408 +/* 16.77722 MHz: */
4409 +#define MRM_W 1 /* system clock parameters */
4415 +/* 25.16582 MHz: */
4416 +#define MRM_W 1 /* system clock parameters */
4421 +#define SYS_CLOCK (XTAL*4.0*(MRM_Y+1)*(1 << (2*MRM_W+MRM_X)))
4422 +#define SCI_BAUD 19200 /* RS232 Baud Rate */
4424 +/* macros/functions */
4429 + * This prototype really should have the noreturn attribute but
4430 + * that causes a warning. Not sure how to fix that.
4432 +/* static void reboot(void) __attribute__ ((noreturn)); */
4433 +static void reboot(void);
4434 +__inline__ static void reboot() {asm("trap #15; .word 0x0063");}
4438 +#endif /* _MRM_H_ */
4439 Index: rtems/c/src/lib/libbsp/m68k/mo376/include/bspopts.h.in
4440 ===================================================================
4441 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
4442 +++ rtems/c/src/lib/libbsp/m68k/mo376/include/bspopts.h.in 2007-08-14 17:20:30.000000000 +0200
4444 +/* include/bspopts.h.in. Generated from configure.ac by autoheader. */
4446 +/* Define to the address where bug reports for this package should be sent. */
4447 +#undef PACKAGE_BUGREPORT
4449 +/* Define to the full name of this package. */
4450 +#undef PACKAGE_NAME
4452 +/* Define to the full name and version of this package. */
4453 +#undef PACKAGE_STRING
4455 +/* Define to the one symbol short name of this package. */
4456 +#undef PACKAGE_TARNAME
4458 +/* Define to the version of this package. */
4459 +#undef PACKAGE_VERSION
4460 Index: rtems/c/src/lib/libbsp/m68k/mo376/spurious/spinit.c
4461 ===================================================================
4462 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
4463 +++ rtems/c/src/lib/libbsp/m68k/mo376/spurious/spinit.c 2007-08-14 17:20:30.000000000 +0200
4467 + * This routine installs spurious interrupt handlers for the mrm.
4469 + * Input parameters: NONE
4471 + * Output parameters: NONE
4473 + * COPYRIGHT (c) 1989, 1990, 1991, 1992, 1993.
4474 + * On-Line Applications Research Corporation (OAR).
4476 + * The license and distribution terms for this file may be
4477 + * found in the file LICENSE in this distribution or at
4478 + * http://www.rtems.com/license/LICENSE.
4480 + * $Id: spinit.c,v 1.6 2006/09/11 21:43:55 joel Exp $
4486 +const char * const _Spurious_Error_[] = {"Reset","Bus Error","Address Error",
4487 + "Illegal Instruction","Zero Division","CHK, CHK2 Instruction",
4488 + "TRAPcc, TRAPV Instruction","Privilege Violation","Trace",
4489 + "Line 1010 Emulation","Line 1111 Emulation","Hardware Breakpoint",
4490 + "Coprocessor Protocal Violation",
4491 + "Format Error ans Uninitialized Interrupt","Unassigned",
4492 + "Spurious Interrupt","AVec1","AVec2","AVec3","AVec4","AVec5","AVec6",
4493 + "AVec7","Trap Instruction","Debug","Reboot","Reserved Coprocessor",
4494 + "Reserved Unassigned","User Defined"};
4496 +rtems_isr Spurious_Isr(
4497 + rtems_vector_number vector
4502 + const char * const VectDescrip[] = {
4503 + _Spurious_Error_[0], _Spurious_Error_[0], _Spurious_Error_[1],
4504 + _Spurious_Error_[2], _Spurious_Error_[3], _Spurious_Error_[4],
4505 + _Spurious_Error_[5], _Spurious_Error_[6], _Spurious_Error_[7],
4506 + _Spurious_Error_[8], _Spurious_Error_[9], _Spurious_Error_[10],
4507 + _Spurious_Error_[11], _Spurious_Error_[12], _Spurious_Error_[13],
4508 + _Spurious_Error_[13], _Spurious_Error_[14], _Spurious_Error_[14],
4509 + _Spurious_Error_[14], _Spurious_Error_[14], _Spurious_Error_[14],
4510 + _Spurious_Error_[14], _Spurious_Error_[14], _Spurious_Error_[14],
4511 + _Spurious_Error_[15], _Spurious_Error_[16], _Spurious_Error_[17],
4512 + _Spurious_Error_[18], _Spurious_Error_[19], _Spurious_Error_[20],
4513 + _Spurious_Error_[21], _Spurious_Error_[22], _Spurious_Error_[23],
4514 + _Spurious_Error_[24], _Spurious_Error_[23], _Spurious_Error_[23],
4515 + _Spurious_Error_[23], _Spurious_Error_[23], _Spurious_Error_[23],
4516 + _Spurious_Error_[23], _Spurious_Error_[23], _Spurious_Error_[23],
4517 + _Spurious_Error_[23], _Spurious_Error_[23], _Spurious_Error_[23],
4518 + _Spurious_Error_[23], _Spurious_Error_[23], _Spurious_Error_[25],
4519 + _Spurious_Error_[26], _Spurious_Error_[26], _Spurious_Error_[26],
4520 + _Spurious_Error_[26], _Spurious_Error_[26], _Spurious_Error_[26],
4521 + _Spurious_Error_[26], _Spurious_Error_[26], _Spurious_Error_[26],
4522 + _Spurious_Error_[26], _Spurious_Error_[26], _Spurious_Error_[27],
4523 + _Spurious_Error_[27], _Spurious_Error_[27], _Spurious_Error_[27],
4524 + _Spurious_Error_[27], _Spurious_Error_[28]};
4527 + /*asm volatile ( "movea.l %%sp,%0 " : "=a" (sp) : "0" (sp) ); */
4529 + _CPU_ISR_Set_level( 7 );
4530 + /*_UART_flush(); */
4532 + RAW_PUTS("\n\rRTEMS: Spurious interrupt: ");
4533 + RAW_PUTS((char *)VectDescrip[( (vector>64) ? 64 : vector )]);
4534 + RAW_PUTS("\n\rRTEMS: Vector: ");
4536 + RAW_PUTS(" sp: ");
4543 + asm(" .word 0x4afa");
4548 +void Spurious_Initialize(void)
4550 + rtems_vector_number vector;
4552 + for ( vector = 0x0 ; vector <= 0xFF ; vector++ )
4561 + /* These vectors used by CPU32bug - don't overwrite them. */
4565 + (void) set_vector( Spurious_Isr, vector, 1 );
4570 Index: rtems/c/src/lib/libbsp/m68k/mo376/startup/linkcmds
4571 ===================================================================
4572 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
4573 +++ rtems/c/src/lib/libbsp/m68k/mo376/startup/linkcmds 2007-08-14 17:20:30.000000000 +0200
4577 + * $Id: linkcmds,v 1.6 2006/02/08 12:25:24 joel Exp $
4584 + * The memory map looks like this:
4585 + * +--------------------+ <- low memory
4588 + * | ctor list | the ctor and dtor lists are for
4589 + * | dtor list | C++ support
4591 + * +--------------------+
4592 + * | .data | initialized data goes here
4595 + * +--------------------+
4597 + * | _clear_start| start of bss, cleared by crt0
4598 + * | _end | start of heap, used by sbrk()
4599 + * +--------------------+
4603 + * | __stack | top of stack
4604 + * +--------------------+ <- high memory
4608 + * Declare some sizes.
4610 +_RamBase = DEFINED(_RamBase) ? _RamBase : 0x10000;
4611 +_RamSize = DEFINED(_RamSize) ? _RamSize : 0x70000;
4612 +_RamEnd = _RamBase + _RamSize;
4613 +_HeapSize = DEFINED(_HeapSize) ? _HeapSize : 0x10000;
4614 +_StackSize = DEFINED(_StackSize) ? _StackSize : 0x2000;
4618 + ram : ORIGIN = 0x10000, LENGTH = 0x70000
4621 +_copy_data_from_rom = 0;
4624 + * stick everything in ram (of course)
4633 + * Text, data and bss segments
4639 + * C++ constructors/destructors
4641 + *(.gnu.linkonce.t.*)
4644 + * Initialization and finalization code.
4646 + * Various files can provide initialization and finalization
4647 + * functions. crtbegin.o and crtend.o are two instances. The
4648 + * body of these functions are in .init and .fini sections. We
4649 + * accumulate the bodies here, and prepend function prologues
4650 + * from crti.o and function epilogues from crtn.o. crti.o must
4651 + * be linked first; crtn.o must be linked last. Because these
4652 + * are wildcards, it doesn't matter if the user does not
4653 + * actually link against crti.o and crtn.o; the linker won't
4654 + * look for a file to match a wildcard. The wildcard also
4655 + * means that it doesn't matter which directory crti.o and
4658 + PROVIDE (_init = .);
4662 + PROVIDE (_fini = .);
4668 + * Special FreeBSD sysctl sections.
4671 + __start_set_sysctl_set = .;
4673 + __stop_set_sysctl_set = ABSOLUTE(.);
4678 + * C++ constructors/destructors
4680 + * gcc uses crtbegin.o to find the start of the constructors
4681 + * and destructors so we make sure it is first. Because this
4682 + * is a wildcard, it doesn't matter if the user does not
4683 + * actually link against crtbegin.o; the linker won't look for
4684 + * a file to match a wildcard. The wildcard also means that
4685 + * it doesn't matter which directory crtbegin.o is in. The
4686 + * constructor and destructor list are terminated in
4687 + * crtend.o. The same comments apply to it.
4690 + *crtbegin.o(.ctors)
4693 + *crtbegin.o(.dtors)
4698 + * Exception frame info
4707 + _rodata_start = .;
4709 + *(.gnu.linkonce.r*)
4712 + PROVIDE (_etext = .);
4715 + PROVIDE (_copy_start = .);
4717 + *(.gnu.linkonce.d*)
4718 + *(.gcc_except_table)
4721 + PROVIDE (_edata = .);
4722 + PROVIDE (_copy_end = .);
4727 + *(.bss* .gnu.linkonce.b.*)
4730 + PROVIDE (end = .);
4736 + _WorkspaceBase = .;
4739 Index: rtems/c/src/lib/libbsp/m68k/mo376/bsp_specs
4740 ===================================================================
4741 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
4742 +++ rtems/c/src/lib/libbsp/m68k/mo376/bsp_specs 2007-08-14 17:20:30.000000000 +0200
4744 +%rename endfile old_endfile
4745 +%rename startfile old_startfile
4746 +%rename link old_link
4749 +%{!qrtems: %(old_startfile)} %{!nostdlib: %{qrtems: \
4750 +%{!qrtems_debug: start.o%s} \
4751 +%{qrtems_debug: start_g.o%s} \
4752 +crti.o%s crtbegin.o%s}}
4755 +%{!qrtems: %(old_link)} %{qrtems: -dc -dp -N -e start}
4758 +%{!qrtems: %(old_endfile)} %{qrtems: crtend.o%s crtn.o%s}
4760 Index: rtems/c/src/lib/libbsp/m68k/mo376/preinstall.am
4761 ===================================================================
4762 --- /dev/null 1970-01-01 00:00:00.000000000 +0000
4763 +++ rtems/c/src/lib/libbsp/m68k/mo376/preinstall.am 2007-08-14 17:20:30.000000000 +0200
4765 +## Automatically generated by ampolish3 - Do not edit
4768 +$(srcdir)/preinstall.am: Makefile.am
4769 + $(AMPOLISH3) $(srcdir)/Makefile.am > $(srcdir)/preinstall.am
4773 +DISTCLEANFILES += $(PREINSTALL_DIRS)
4775 +all-local: $(TMPINSTALL_FILES)
4778 +CLEANFILES = $(TMPINSTALL_FILES)
4780 +all-am: $(PREINSTALL_FILES)
4783 +CLEANFILES += $(PREINSTALL_FILES)
4785 +$(PROJECT_LIB)/$(dirstamp):
4786 + @$(MKDIR_P) $(PROJECT_LIB)
4787 + @: > $(PROJECT_LIB)/$(dirstamp)
4788 +PREINSTALL_DIRS += $(PROJECT_LIB)/$(dirstamp)
4790 +$(PROJECT_INCLUDE)/$(dirstamp):
4791 + @$(MKDIR_P) $(PROJECT_INCLUDE)
4792 + @: > $(PROJECT_INCLUDE)/$(dirstamp)
4793 +PREINSTALL_DIRS += $(PROJECT_INCLUDE)/$(dirstamp)
4795 +$(PROJECT_LIB)/bsp_specs: bsp_specs $(PROJECT_LIB)/$(dirstamp)
4796 + $(INSTALL_DATA) $< $(PROJECT_LIB)/bsp_specs
4797 +PREINSTALL_FILES += $(PROJECT_LIB)/bsp_specs
4799 +$(PROJECT_INCLUDE)/bsp.h: include/bsp.h $(PROJECT_INCLUDE)/$(dirstamp)
4800 + $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp.h
4801 +PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp.h
4803 +$(PROJECT_INCLUDE)/tm27.h: include/tm27.h $(PROJECT_INCLUDE)/$(dirstamp)
4804 + $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/tm27.h
4805 +PREINSTALL_FILES += $(PROJECT_INCLUDE)/tm27.h
4807 +$(PROJECT_INCLUDE)/bspopts.h: include/bspopts.h $(PROJECT_INCLUDE)/$(dirstamp)
4808 + $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bspopts.h
4809 +PREINSTALL_FILES += $(PROJECT_INCLUDE)/bspopts.h
4811 +$(PROJECT_INCLUDE)/mrm332.h: include/mrm332.h $(PROJECT_INCLUDE)/$(dirstamp)
4812 + $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/mrm332.h
4813 +PREINSTALL_FILES += $(PROJECT_INCLUDE)/mrm332.h
4815 +$(PROJECT_INCLUDE)/coverhd.h: ../../shared/include/coverhd.h $(PROJECT_INCLUDE)/$(dirstamp)
4816 + $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/coverhd.h
4817 +PREINSTALL_FILES += $(PROJECT_INCLUDE)/coverhd.h
4819 +$(PROJECT_LIB)/start.$(OBJEXT): start.$(OBJEXT) $(PROJECT_LIB)/$(dirstamp)
4820 + $(INSTALL_DATA) $< $(PROJECT_LIB)/start.$(OBJEXT)
4821 +TMPINSTALL_FILES += $(PROJECT_LIB)/start.$(OBJEXT)
4823 +$(PROJECT_LIB)/linkcmds: startup/linkcmds $(PROJECT_LIB)/$(dirstamp)
4824 + $(INSTALL_DATA) $< $(PROJECT_LIB)/linkcmds
4825 +PREINSTALL_FILES += $(PROJECT_LIB)/linkcmds
4827 +$(PROJECT_LIB)/linkcmds_ROM: startup/linkcmds_ROM $(PROJECT_LIB)/$(dirstamp)
4828 + $(INSTALL_DATA) $< $(PROJECT_LIB)/linkcmds_ROM
4829 +PREINSTALL_FILES += $(PROJECT_LIB)/linkcmds_ROM