]> rtime.felk.cvut.cz Git - rtems-devel.git/blob - rtems-patches/rtems-clone-ss555-to-ec555.patch
ec555 clone from ss555 updated to clone ss555.cvf to ec555.cfg.
[rtems-devel.git] / rtems-patches / rtems-clone-ss555-to-ec555.patch
1 Index: rtems/c/src/lib/libbsp/powerpc/ec555/.cvsignore
2 ===================================================================
3 --- /dev/null
4 +++ rtems/c/src/lib/libbsp/powerpc/ec555/.cvsignore
5 @@ -0,0 +1,14 @@
6 +aclocal.m4
7 +autom4te*.cache
8 +config.cache
9 +config.guess
10 +config.log
11 +config.status
12 +config.sub
13 +configure
14 +depcomp
15 +install-sh
16 +Makefile
17 +Makefile.in
18 +missing
19 +mkinstalldirs
20 Index: rtems/c/src/lib/libbsp/powerpc/ec555/ChangeLog
21 ===================================================================
22 --- /dev/null
23 +++ rtems/c/src/lib/libbsp/powerpc/ec555/ChangeLog
24 @@ -0,0 +1,97 @@
25 +2005-05-26     Ralf Corsepius <ralf.corsepius@rtems.org>
26 +
27 +       * include/bsp.h: New header guard.
28 +
29 +2005-05-10     Ralf Corsepius <ralf.corsepius@rtems.org>
30 +
31 +       * console/console.c: Eliminate unsigned8.
32 +
33 +2005-04-26     Joel Sherrill <joel@OARcorp.com>
34 +
35 +       * startup/bspstart.c: Eliminate warnings.
36 +
37 +2005-04-25      Jennifer Averett <jennifer.averett@oarcorp.com>
38 +
39 +        PR 779/bsp
40 +        * clock/p_clock.c: Add parameter to powerpc exception handler routines
41 +
42 +2005-02-17     Ralf Corsepius <ralf.corsepius@rtems.org>
43 +
44 +       * startup/bspstart.c: include <rtems/powerpc/powerpc.h>.
45 +       Use PPC_MINIMUM_STACK_FRAME_SIZE instead of
46 +       CPU_MINIMUM_STACK_FRAME_SIZE.
47 +
48 +2005-02-16     Ralf Corsepius <ralf.corsepius@rtems.org>
49 +
50 +       * configure.ac: Remove argument from RTEMS_PPC_EXCEPTIONS.
51 +
52 +2005-02-11     Ralf Corsepius <ralf.corsepius@rtems.org>
53 +
54 +       * Makefile.am: Merge-in wrapup/Makefile.am.
55 +       * wrapup/Makefile.am: Remove.
56 +       * configure.ac: Reflect changes above.
57 +
58 +2005-01-07     Ralf Corsepius <ralf.corsepius@rtems.org>
59 +
60 +       * Makefile.am: Eliminate CFLAGS_OPTIMIZE_V.
61 +
62 +2005-01-02     Ralf Corsepius <ralf.corsepius@rtems.org>
63 +
64 +       * Makefile.am, wrapup/Makefile.am: Remove build-variant support.
65 +
66 +2004-10-20     Ralf Corsepius <ralf_corsepius@rtems.org>
67 +
68 +       * console/console.c, include/bsp.h, startup/bspstart.c,
69 +       startup/iss555.c: Use POSIX fixed size types.
70 +
71 +2004-09-24     Ralf Corsepius <ralf_corsepius@rtems.org>
72 +
73 +       * configure.ac: Require automake > 1.9.
74 +
75 +2004-04-23     Ralf Corsepius <ralf_corsepius@rtems.org>
76 +
77 +       PR 610/bsps
78 +       * Makefile.am: Add include/tm27.h, Cosmetics.
79 +       * include/tm27.h: Final cosmetics.
80 +
81 +2004-04-22     Ralf Corsepius <ralf_corsepius@rtems.org>
82 +
83 +       * include/bsp.h: Split out tmtest27 support.
84 +       * include/tm27.h: New.
85 +
86 +2004-04-21     Joel Sherrill <joel@OARcorp.com>
87 +
88 +       PR 611/bsps
89 +       * Makefile.am, include/bsp.h, wrapup/Makefile.am: Follow conventions
90 +       for tm27 and do not add another macro definition.
91 +       * startup/tm27supp.c: New file.
92 +
93 +2004-04-21     Joel Sherrill <joel@OARcorp.com>
94 +
95 +       PR 611/bsps
96 +       * Makefile.am, include/bsp.h, wrapup/Makefile.am: Follow conventions
97 +       for tm27 and do not add another macro definition.
98 +       * startup/tm27supp.c: New file.
99 +
100 +2004-04-21     Ralf Corsepius <ralf_corsepius@rtems.org>
101 +
102 +       PR 613/bsps
103 +       * include/bsp.h: Remove MAX_LONG_TEST_DURATION.
104 +
105 +2004-04-21     Ralf Corsepius <ralf_corsepius@rtems.org>
106 +
107 +       PR 614/bsps
108 +       * include/bsp.h: Remove MAX_SHORT_TEST_DURATION (Unused).
109 +
110 +2004-04-13     Ralf Corsepius <ralf_corsepius@rtems.org>
111 +
112 +       * include/bsp.h, startup/start.S: Reflect new locations of cpukit headers.
113 +
114 +2004-04-12     David Querbach <querbach@realtime.bc.ca>
115 +
116 +       * .cvsignore, ChangeLog, Makefile.am, README, bsp_specs, configure.ac,
117 +       times, clock/p_clock.c, console/console.c, include/.cvsignore,
118 +       include/bsp.h, include/coverhd.h, irq/irq.h, startup/bspstart.c,
119 +       startup/iss555.c, startup/linkcmds, startup/start.S,
120 +       wrapup/.cvsignore, wrapup/Makefile.am: New files.
121 +
122 Index: rtems/c/src/lib/libbsp/powerpc/ec555/Makefile.am
123 ===================================================================
124 --- /dev/null
125 +++ rtems/c/src/lib/libbsp/powerpc/ec555/Makefile.am
126 @@ -0,0 +1,116 @@
127 +##
128 +## $Id: Makefile.am,v 1.6 2005/02/12 03:31:07 ralf Exp $
129 +##
130 +
131 +ACLOCAL_AMFLAGS = -I ../../../../aclocal
132 +
133 +include $(top_srcdir)/../../../../automake/compile.am
134 +include $(top_srcdir)/../../bsp.am
135 +
136 +dist_project_lib_DATA = bsp_specs
137 +
138 +include_HEADERS = include/bsp.h
139 +include_HEADERS += include/tm27.h
140 +
141 +nodist_include_HEADERS = include/bspopts.h
142 +DISTCLEANFILES = include/bspopts.h
143 +
144 +noinst_PROGRAMS =
145 +
146 +include_bspdir = $(includedir)/bsp
147 +
148 +include_HEADERS += include/coverhd.h
149 +include_bsp_HEADERS = irq/irq.h
150 +
151 +EXTRA_DIST = times
152 +
153 +dist_project_lib_DATA += startup/linkcmds
154 +
155 +noinst_PROGRAMS += pclock.rel
156 +pclock_rel_SOURCES = clock/p_clock.c
157 +pclock_rel_CPPFLAGS = $(AM_CPPFLAGS)
158 +pclock_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
159 +
160 +noinst_PROGRAMS += console.rel
161 +console_rel_SOURCES = console/console.c
162 +console_rel_CPPFLAGS = $(AM_CPPFLAGS)
163 +console_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
164 +
165 +noinst_PROGRAMS += startup.rel
166 +startup_rel_SOURCES = ../../shared/bspclean.c ../../shared/bsplibc.c \
167 +    ../../shared/bsppost.c startup/bspstart.c ../../shared/bootcard.c \
168 +    startup/iss555.c ../../shared/main.c ../../shared/sbrk.c \
169 +    ../../shared/gnatinstallhandler.c startup/start.S
170 +startup_rel_CPPFLAGS = $(AM_CPPFLAGS)
171 +startup_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
172 +
173 +noinst_PROGRAMS += tm27supp.rel
174 +tm27supp_rel_SOURCES = startup/tm27supp.c
175 +tm27supp_rel_CPPFLAGS = $(AM_CPPFLAGS)
176 +tm27supp_rel_LDFLAGS = $(RTEMS_RELLDFLAGS)
177 +
178 +noinst_LIBRARIES = libbsp.a
179 +libbsp_a_SOURCES =
180 +libbsp_a_LIBADD = pclock.rel console.rel startup.rel tm27supp.rel
181 +libbsp_a_LIBADD += ../../../libcpu/@RTEMS_CPU@/shared/cpuIdent.rel \
182 +    ../../../libcpu/@RTEMS_CPU@/@exceptions@/rtems-cpu.rel \
183 +    ../../../libcpu/@RTEMS_CPU@/mpc5xx/clock.rel \
184 +    ../../../libcpu/@RTEMS_CPU@/mpc5xx/console-generic.rel \
185 +    ../../../libcpu/@RTEMS_CPU@/mpc5xx/exceptions.rel \
186 +    ../../../libcpu/@RTEMS_CPU@/mpc5xx/irq.rel \
187 +    ../../../libcpu/@RTEMS_CPU@/mpc5xx/timer.rel \
188 +    ../../../libcpu/@RTEMS_CPU@/mpc5xx/vectors.rel
189 +
190 +all-local: $(PREINSTALL_FILES) $(TMPINSTALL_FILES)
191 +
192 +PREINSTALL_DIRS =
193 +PREINSTALL_FILES =
194 +
195 +$(PROJECT_INCLUDE)/$(dirstamp):
196 +       @$(mkdir_p) $(PROJECT_INCLUDE)
197 +       @: > $(PROJECT_INCLUDE)/$(dirstamp)
198 +PREINSTALL_DIRS += $(PROJECT_INCLUDE)/$(dirstamp)
199 +
200 +$(PROJECT_LIB)/$(dirstamp):
201 +       @$(mkdir_p) $(PROJECT_LIB)
202 +       @: > $(PROJECT_LIB)/$(dirstamp)
203 +PREINSTALL_DIRS += $(PROJECT_LIB)/$(dirstamp)
204 +
205 +$(PROJECT_LIB)/bsp_specs: bsp_specs $(PROJECT_LIB)/$(dirstamp)
206 +       $(INSTALL_DATA) $< $(PROJECT_LIB)/bsp_specs
207 +PREINSTALL_FILES += $(PROJECT_LIB)/bsp_specs
208 +
209 +$(PROJECT_INCLUDE)/bsp.h: include/bsp.h $(PROJECT_INCLUDE)/$(dirstamp)
210 +       $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp.h
211 +PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp.h
212 +
213 +$(PROJECT_INCLUDE)/tm27.h: include/tm27.h $(PROJECT_INCLUDE)/$(dirstamp)
214 +       $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/tm27.h
215 +PREINSTALL_FILES += $(PROJECT_INCLUDE)/tm27.h
216 +
217 +$(PROJECT_INCLUDE)/bspopts.h: include/bspopts.h $(PROJECT_INCLUDE)/$(dirstamp)
218 +       $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bspopts.h
219 +PREINSTALL_FILES += $(PROJECT_INCLUDE)/bspopts.h
220 +
221 +$(PROJECT_INCLUDE)/bsp/$(dirstamp):
222 +       @$(mkdir_p) $(PROJECT_INCLUDE)/bsp
223 +       @: > $(PROJECT_INCLUDE)/bsp/$(dirstamp)
224 +PREINSTALL_DIRS += $(PROJECT_INCLUDE)/bsp/$(dirstamp)
225 +
226 +$(PROJECT_INCLUDE)/coverhd.h: include/coverhd.h $(PROJECT_INCLUDE)/$(dirstamp)
227 +       $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/coverhd.h
228 +PREINSTALL_FILES += $(PROJECT_INCLUDE)/coverhd.h
229 +
230 +$(PROJECT_INCLUDE)/bsp/irq.h: irq/irq.h $(PROJECT_INCLUDE)/bsp/$(dirstamp)
231 +       $(INSTALL_DATA) $< $(PROJECT_INCLUDE)/bsp/irq.h
232 +PREINSTALL_FILES += $(PROJECT_INCLUDE)/bsp/irq.h
233 +
234 +$(PROJECT_LIB)/linkcmds: startup/linkcmds $(PROJECT_LIB)/$(dirstamp)
235 +       $(INSTALL_DATA) $< $(PROJECT_LIB)/linkcmds
236 +PREINSTALL_FILES += $(PROJECT_LIB)/linkcmds
237 +
238 +CLEANFILES = $(PREINSTALL_FILES)
239 +DISTCLEANFILES += $(PREINSTALL_DIRS)
240 +
241 +include $(top_srcdir)/../../../../automake/subdirs.am
242 +include $(top_srcdir)/../../../../automake/local.am
243 Index: rtems/c/src/lib/libbsp/powerpc/ec555/README
244 ===================================================================
245 --- /dev/null
246 +++ rtems/c/src/lib/libbsp/powerpc/ec555/README
247 @@ -0,0 +1,262 @@
248 +#
249 +#  $Id: README,v 1.1 2004/04/12 21:52:13 joel Exp $
250 +#
251 +
252 +This is a README file for the Intec SS555 of RTEMS 4.6.0
253 +
254 +The SS555 port was sponsored by Defence Research and Development 
255 +Canada - Suffield, and is Copyright (C) 2004, Real-Time Systems Inc.
256 +
257 +Please send any comments, improvements, or bug reports to:
258 +
259 +David Querbach
260 +querbach@realtime.bc.ca
261 +
262 +
263 +Summary
264 +-------
265 +
266 +BSP NAME:           ss555
267 +BOARD:              Intec Automation Inc. SS555
268 +BUS:                None 
269 +CPU FAMILY:         PowerPC
270 +CPU:                PowerPC MPC555
271 +COPROCESSORS:       Built-in Motorola TPU
272 +MODE:               32 bit mode
273 +
274 +DEBUG MONITOR:      None
275 +
276 +PERIPHERALS
277 +===========
278 +TIMERS:             PIT / Timebase
279 +  RESOLUTION:       1 microsecond (4 MHz crystal / 4)
280 +SERIAL PORTS:       2 SCI
281 +REAL-TIME CLOCK:    On-chip.
282 +DMA:                None.
283 +VIDEO:              None.
284 +SCSI:               None.
285 +NETWORKING:         None.
286 +                  
287 +
288 +DRIVER INFORMATION
289 +==================
290 +CLOCK DRIVER:       yes
291 +CONSOLE DRIVER:     yes
292 +SHMSUPP:            N/A
293 +TIMER DRIVER:       yes
294 +NETWORK DRIVER:            no
295 +
296 +NOTES
297 +=====
298 +On-chip resources:
299 +       SCI1            serial port
300 +       SCI2            serial port (console)
301 +       PIT             clock
302 +       TB              timing test support
303 +       DEC
304 +       SWT             watchdog timer -- enable in startup/iss555.c
305 +       *CS0            external 512k 2-1-1-1 Burst SRAM
306 +       *CS1
307 +       *CS2
308 +       *CS3            CPLD
309 +       IRQ0
310 +       IRQ1
311 +       IRQ2            
312 +       IRQ3            
313 +       IRQ4            
314 +       IRQ5    
315 +       IRQ6
316 +       IRQ7
317 +       IRQ_LVL0        
318 +       IRQ_LVL1
319 +       IRQ_LVL2
320 +       IRQ_LVL3
321 +       IRQ_LVL4
322 +       IRQ_LVL5        SCI
323 +       IRQ_LVL6        PIT
324 +       IRQ_LVL7
325 +       
326 +
327 +Board description
328 +-----------------
329 +Clock rate:     40 MHz development/embeddable board
330 +Bus width:      32-bit on-board RAM, 16-bit off-board I/O
331 +FLASH:         512k on-chip
332 +RAM:            512k 2-1-1-1 burst SRAM
333 +
334 +
335 +Installation
336 +------------
337 +
338 +The ss555 port uses the Intec SS555's external RAM in two different ways,
339 +depending on whether or not it is built for debugging by giving the
340 +VARIANT=DEBUG switch to make:
341 +
342 +       make VARIANT=DEBUG all
343 +
344 +1.  In the debugging case, the linker script concanttenates the .text,
345 +.data, and .bss sections starting at location zero, so they all can be
346 +loaded into the external RAM for debugging.  We assume that the debugger
347 +disables the internal Flash ROM and enables the external RAM before loading
348 +the code into the external RAM.
349 +
350 +2.  In the normal (non-debugging) case, the linker script still places the
351 +.text section near zero, but places the start of the .data and .bss sections
352 +at the start location of the MPC555's internal RAM.  The system startup code
353 +then configures the external RAM just after the internal RAM in memory,
354 +forming one large block from the two RAM devices.
355 +
356 +
357 +Console driver
358 +---------------
359 +
360 +This BSP includes an termios-capable asynchronous serial line driver that
361 +supports SCI1 and SCI2. The RTEMS console is selected at configuration time
362 +with the CONSOLE_MINOR variable (see .../ss555/configure.ac).  We default to
363 +SCI2 for the console, since SCI1 has some extra features which may be
364 +desired for application use.
365 +
366 +The BSP console supports three different modes of operation:
367 +
368 +  1. polled I/O done with termios support,
369 +  2. polled I/O done without termios support,
370 +  3. interrupt-driven I/O with termios support.
371 +     
372 +The mode of operation of the serial driver is determined at configure time in
373 +part by the value of the UARTS_IO_MODE variable (see .../ss555/configure.ac).
374 +
375 +  0 - polled I/O.
376 +  1 - interrupt-driven I/O.
377 +  
378 +Also, set the value of UARTS_USE_TERMIOS to select whether termios should be
379 +used to perform buffering and input/output processing. Without termios
380 +support, input processing is limited to the substitution of LF for a
381 +received CR, and output processing is limited to the transmission of a CR
382 +following the transmission of a LF. The choices for UARTS_USE_TERMIOS are:
383 +
384 +  0 - do not use termios
385 +  1 - use termios
386 +
387 +In most real-time applications, the driver should be configured to use
388 +termios and interrupt-driven I/O. Special requirements may dictate otherwise.
389 +
390 +Polled I/O must be used when running the timing tests. It must also be used
391 +to run some other tests and some samples, such as the cdtest. Some tests
392 +change the interrupt mask and will hang interrupt-driven I/O indefinitely.
393 +Others, such as cdtest, perform console output from the static constructors
394 +before the console is opened, causing the test to hang. Still other tests
395 +produce output that is supposed to be in some specific order. For these
396 +tests, termios should not be used, as termios buffers output and the
397 +transmission of the buffers occur at somewhat unpredictable times.
398 +
399 +The real solution is to fix the tests so that they work with interrupt-driven
400 +I/O and termios.
401 +
402 +
403 +printk() and debug output
404 +-----------------------
405 +
406 +The implementation of printk() in RTEMS is mostly independent of most system
407 +services. The printk() function can therefore be used to print messages to a
408 +debug console, particularly when debugging startup code or device drivers,
409 +i.e. code that runs before the console driver is opened or that runs with
410 +interrupts disabled.
411 +
412 +Support is provided to send printk output to either port. Specify the
413 +desired port at configure time by setting the value of PRINTK_MINOR to one
414 +of SCI1_MINOR or SCI2_MINOR.
415 +
416 +printk() always uses polled I/O, and never uses termios.
417 +
418 +If the printk() port is opened by RTEMS, then UARTS_IO_MODE must be set for
419 +polled I/O, otherwise the I/O functions will be in conflict.  Using printk()
420 +before the port is initialized is, of course, not possible.  This
421 +initialization occurs in console_initialize(), which is called by
422 +rtems_initialize_executive_early().
423 +
424 +
425 +Watchdog Timer
426 +--------------
427 +
428 +The MPC555 watchdog timer can be enabled at configuration time by defining
429 +the WATCHDOG_TIMEOUT variable.  This variable sets the watchdog timeout
430 +period in steps of
431 +
432 +         2048          2048
433 +       ---------  =  ---------  =  51.2 usec
434 +        Fsystem       40 MHz
435 +
436 +or about 1/20 msec.  When WATCHDOG_TIMEOUT is left undefined, the watchdog
437 +timer is disabled.
438 +
439 +
440 +Miscellaneous
441 +-------------
442 +
443 +Most code came from the mbx8xx port, except for the floating-point handling
444 +which came from the mpc8260ads.
445 +
446 +
447 +Host System
448 +-----------
449 +
450 +The port was developed on an x86 box running Debian 3.0.  The toolchain was
451 +built from the sources at rtems.org, except for the autotools which came
452 +from the Debian distribution.
453 +
454 +
455 +Test Configuration
456 +------------------
457 +
458 +Board:                Intec SS555 v1.1
459 +CPU:                  Motorola MPC555LFMZP40, mask 1K83H
460 +Clock Speed:          Crystal 4.0 MHz, CPU 40.0 MHz
461 +RAM:                  512K bytes of 2-1-1-1 Burst SRAM
462 +Times Reported in:    Microseconds
463 +Timer Source:         Timebase clock
464 +GCC Flags:            -O4 -fno-keep-inline-functions -mcpu=(821/860) 
465 +Console:              Operates in polled mode on SMC2. No I/O through EPPC-Bug.    
466 +
467 +
468 +Test Results
469 +------------
470 +
471 +Single processor tests:  
472 +  All tests passed, except that:
473 +    - sp09 aborts due to memory shortage
474 +    - sp20 needs to be run with output buffering enabled (see
475 +      buffer_test_io.h)
476 +
477 +Multi-processor tests:  
478 +  Not applicable.
479 +
480 +Library tests:
481 +  All tests passed.  Note that the termios test only works if the system is
482 +  rebuilt with termios enabled.                         
483 +
484 +Posix tests:
485 +  All tests passed, except that:
486 +    - the message queue test failed with "errno (91 - File or path name too
487 +      long)"
488 +
489 +Timing tests:
490 +  Due to memory limitations, many of the tests will not run unless you set
491 +  OPERATION_COUNT=20 at configuration time.
492 +
493 +  To run tm27 (the interrupt latency timer test), short CN5-48 to CN5-50 on
494 +  the SS555 board.
495 +
496 +  All tests run cleanly, except for tm26, which gives a "PANIC 12" after it
497 +  exits.  This doesn't seem to cause a problem otherwise.
498 +
499 +  See the times file for the results of the timing tests.
500 +
501 +Network tests:  
502 +  Not applicable.
503 +
504 +Sample programs:
505 +  These run correctly, except that:
506 +    - The "minimum" sample is not designed to run properly on any system.
507 +    - The loopback, fileio, unilimited, and pppd tests fail due to memory
508 +      limitations.
509 +    - The paranoia program dies on a floating-point assist exception.
510 Index: rtems/c/src/lib/libbsp/powerpc/ec555/bsp_specs
511 ===================================================================
512 --- /dev/null
513 +++ rtems/c/src/lib/libbsp/powerpc/ec555/bsp_specs
514 @@ -0,0 +1,20 @@
515 +%rename lib old_lib
516 +%rename endfile old_endfile
517 +%rename startfile old_startfile
518 +%rename link old_link
519 +
520 +*lib:
521 +%{!qrtems: %(old_lib)} %{!nostdlib: %{qrtems: --start-group \
522 +%{!qrtems_debug: -lrtemsbsp -lrtemscpu} %{qrtems_debug: -lrtemsbsp_g -lrtemscpu_g} \
523 +%{qjava: -lffi -lgcjgc -lzgcj -lgcj} %{qc++: -lstdc++} -lc -lgcc --end-group \
524 +%{!qnolinkcmds: %{qrtems_debug: --defsym RTEMS_DEBUG=1} -T linkcmds%s -Map %b.map}}}
525 +
526 +*startfile:
527 +%{!qrtems: %(old_startfile)} %{!nostdlib: %{qrtems: ecrti%O%s}}
528 +
529 +*endfile:
530 +%{!qrtems: %(old_endfile)} %{qrtems: ecrtn%O%s}
531 +
532 +*link:
533 +%{!qrtems: %(old_link)} %{qrtems: -dc -dp -u __vectors -N -u start -e start}
534 +
535 Index: rtems/c/src/lib/libbsp/powerpc/ec555/clock/p_clock.c
536 ===================================================================
537 --- /dev/null
538 +++ rtems/c/src/lib/libbsp/powerpc/ec555/clock/p_clock.c
539 @@ -0,0 +1,69 @@
540 +/*
541 + *  Clock Tick interrupt conexion code.
542 + *
543 + *  COPYRIGHT (c) 1989-1997.
544 + *  On-Line Applications Research Corporation (OAR).
545 + *
546 + *  The license and distribution terms for this file may in
547 + *  the file LICENSE in this distribution or at
548 + *  http://www.rtems.com/license/LICENSE.
549 + *
550 + *  SS555 port sponsored by Defence Research and Development Canada - Suffield
551 + *  Copyright (C) 2004, Real-Time Systems Inc. (querbach@realtime.bc.ca)
552 + *
553 + *  Derived from c/src/lib/libbsp/powerpc/mbx8xx/clock/p_clock.c:
554 + *
555 + *  Modified to support the MPC750.
556 + *  Modifications Copyright (c) 1999 Eric Valette valette@crf.canon.fr
557 + *
558 + *  $Id: p_clock.c,v 1.3 2005/04/25 14:46:37 jennifer Exp $
559 + */
560 +
561 +#include <bsp.h>
562 +#include <bsp/irq.h>
563 +#include <rtems/bspIo.h>
564 +
565 +extern void clockOn(void*);
566 +extern void clockOff (void*);
567 +extern int clockIsOn(void*);
568 +extern void Clock_isr(void *);
569 +
570 +static rtems_irq_connect_data clockIrqData = {
571 +  CPU_PERIODIC_TIMER,
572 +  (rtems_irq_hdl)Clock_isr,
573 +  NULL,
574 +  (rtems_irq_enable)clockOn,
575 +  (rtems_irq_disable)clockOff,
576 +  (rtems_irq_is_enabled)clockIsOn
577 +};
578 +
579 +int BSP_disconnect_clock_handler (void)
580 +{
581 +  if (!BSP_get_current_rtems_irq_handler(&clockIrqData)) {
582 +     printk("Unable to stop system clock\n");
583 +    rtems_fatal_error_occurred(1);
584 +  }
585 +  return BSP_remove_rtems_irq_handler (&clockIrqData);
586 +}
587 +
588 +int BSP_connect_clock_handler (rtems_irq_hdl hdl)
589 +{
590 +  if (!BSP_get_current_rtems_irq_handler(&clockIrqData)) {
591 +     printk("Unable to get system clock handler\n");
592 +    rtems_fatal_error_occurred(1);
593 +  }
594 +  if (!BSP_remove_rtems_irq_handler (&clockIrqData)) {
595 +   printk("Unable to remove current system clock handler\n");
596 +    rtems_fatal_error_occurred(1);
597 +  }
598 +  /*
599 +   * Reinit structure
600 +   */
601 +  clockIrqData.name = CPU_PERIODIC_TIMER;
602 +  clockIrqData.hdl = (rtems_irq_hdl) hdl;
603 +  clockIrqData.on = (rtems_irq_enable)clockOn;
604 +  clockIrqData.off = (rtems_irq_enable)clockOff;
605 +  clockIrqData.isOn = (rtems_irq_is_enabled)clockIsOn;
606 +
607 +  return BSP_install_rtems_irq_handler (&clockIrqData);
608 +}
609 Index: rtems/c/src/lib/libbsp/powerpc/ec555/configure.ac
610 ===================================================================
611 --- /dev/null
612 +++ rtems/c/src/lib/libbsp/powerpc/ec555/configure.ac
613 @@ -0,0 +1,52 @@
614 +## Process this file with autoconf to produce a configure script.
615 +## 
616 +## $Id: configure.ac,v 1.5 2005/02/16 10:13:09 ralf Exp $
617 +
618 +AC_PREREQ(2.59)
619 +AC_INIT([rtems-c-src-lib-libbsp-powerpc-mbx5xx],[_RTEMS_VERSION],[rtems-bugs@rtems.com])
620 +AC_CONFIG_SRCDIR([bsp_specs])
621 +RTEMS_TOP(../../../../../..)
622 +
623 +RTEMS_CANONICAL_TARGET_CPU
624 +AM_INIT_AUTOMAKE([no-define nostdinc foreign 1.9])
625 +RTEMS_BSP_CONFIGURE
626 +
627 +RTEMS_PROG_CC_FOR_TARGET([-ansi -fasm])
628 +RTEMS_CANONICALIZE_TOOLS
629 +RTEMS_PROG_CCAS
630 +
631 +RTEMS_CHECK_NETWORKING
632 +AM_CONDITIONAL(HAS_NETWORKING,test "$HAS_NETWORKING" = "yes")
633 +
634 +RTEMS_BSPOPTS_SET([WATCHDOG_TIMEOUT],[*],[0xFFFF])
635 +RTEMS_BSPOPTS_HELP([WATCHDOG_TIMEOUT], 
636 +[Define to the desired timeout (in steps of 1/20 msec) to enable the
637 + watchdog.  Default is to disable the watchdog entirely.])
638 +
639 +RTEMS_BSPOPTS_SET([UARTS_USE_TERMIOS],[*],[0])
640 +RTEMS_BSPOPTS_HELP([UARTS_USE_TERMIOS],
641 +[Define to 1 if you want termios support for every port.
642 + Termios support is independent of the choice of UART I/O mode.])
643 +
644 +RTEMS_BSPOPTS_SET([CONSOLE_MINOR],[*],[SCI2_MINOR])
645 +RTEMS_BSPOPTS_HELP([CONSOLE_MINOR],
646 +[Must be defined to be one of SCI1_MINOR or SCI2_MINOR.  Determines which
647 + device will be registered as /dev/console.])
648 +
649 +RTEMS_BSPOPTS_SET([UARTS_IO_MODE],[*],[0])
650 +RTEMS_BSPOPTS_HELP([UARTS_IO_MODE],
651 +[Define to 1 if you want interrupt-driven I/O for the SCI ports.])
652 +
653 +RTEMS_BSPOPTS_SET([PRINTK_MINOR],[*],[SCI2_MINOR])
654 +RTEMS_BSPOPTS_HELP([PRINTK_MINOR],
655 +[Must be defined to be one of SCI1_MINOR or SCI2_MINOR.  Determines which
656 + device is used for output by printk().  The printk port always uses polled
657 + I/O.  Don't open the printk port from RTEMS unless also using polled I/O
658 + for the SCI ports.])
659 +
660 +# Explicitly list a Makefile here 
661 +AC_CONFIG_FILES([Makefile])
662 +
663 +RTEMS_PPC_EXCEPTIONS
664 +
665 +AC_OUTPUT
666 Index: rtems/c/src/lib/libbsp/powerpc/ec555/console/console.c
667 ===================================================================
668 --- /dev/null
669 +++ rtems/c/src/lib/libbsp/powerpc/ec555/console/console.c
670 @@ -0,0 +1,368 @@
671 +/*
672 + *  console.c
673 + *
674 + *  This file contains the Intec SS555 termios serial I/O package.
675 + *
676 + *  The SCI channels are assigned as follows
677 + *
678 + *   Channel     Device      Minor
679 + *    SCI1      /dev/tty0      0
680 + *    SCI2      /dev/tty1      1
681 + *
682 + *  All ports support termios. The use of termios is recommended for real-time
683 + *  applications. Termios provides buffering and input processing. When not
684 + *  using termios, processing is limited to the substitution of LF for CR on
685 + *  input, and the output of a CR following the output of a LF character.
686 + *  Note that the terminal should not send CR/LF pairs when the return key
687 + *  is pressed, and that output lines are terminated with LF/CR, not CR/LF
688 + *  (although that would be easy to change).
689 + *
690 + *  I/O may be interrupt-driven (recommended for real-time applications) or
691 + *  polled.
692 + *
693 + *  LIMITATIONS:
694 + *
695 + *  It is not possible to use different I/O modes on the different ports. The
696 + *  exception is with printk. The printk port can use a different mode from
697 + *  the other ports. If this is done, it is important not to open the printk
698 + *  port from an RTEMS application.
699 + *
700 + *  Currently, the I/O modes are determined at build time. It would be much
701 + *  better to have the mode selected at boot time based on parameters in
702 + *  NVRAM.
703 + *
704 + *  Interrupt-driven I/O requires termios.
705 + *
706 + *  TESTS:
707 + *
708 + *  TO RUN THE TESTS, USE POLLED I/O WITHOUT TERMIOS SUPPORT. Some tests
709 + *  play with the interrupt masks and turn off I/O. Those tests will hang
710 + *  when interrupt-driven I/O is used. Other tests, such as cdtest, do I/O
711 + *  from the static constructors before the console is open. This test
712 + *  will not work with interrupt-driven I/O. Because of the buffering
713 + *  performed in termios, test output may not be in sequence.The tests
714 + *  should all be fixed to work with interrupt-driven I/O and to
715 + *  produce output in the expected sequence. Obviously, the termios test
716 + *  requires termios support in the driver.
717 + *
718 + *  Set CONSOLE_MINOR to the appropriate device minor number in the
719 + *  config file. This allows the RTEMS application console to be different
720 + *  from the GDB port.
721 + *
722 + *  This driver handles both available serial ports: it distinguishes
723 + *  the sub-devices using minor device numbers. It is not possible to have
724 + *  other protocols running on the other ports when this driver is used as
725 + *  currently written.
726 + *
727 + *
728 + *  SS555 port sponsored by Defence Research and Development Canada - Suffield
729 + *  Copyright (C) 2004, Real-Time Systems Inc. (querbach@realtime.bc.ca)
730 + *
731 + *  Derived from c/src/lib/libbsp/powerpc/mbx8xx/console/console.c:
732 + *
733 + *  Based on code (alloc860.c in eth_comm port) by
734 + *  Jay Monkman (jmonkman@frasca.com),
735 + *  Copyright (C) 1998 by Frasca International, Inc.
736 + *
737 + *  Modifications by Darlene Stewart <Darlene.Stewart@iit.nrc.ca>
738 + *  and Charles-Antoine Gauthier <charles.gauthier@iit.nrc.ca>.
739 + *  Copyright (c) 2000, National Research Council of Canada
740 + *
741 + */
742 +#include <stdarg.h>
743 +#include <stdio.h>
744 +#include <bsp.h>                /* Must be before libio.h */
745 +#include <rtems/bspIo.h>
746 +#include <rtems/libio.h>
747 +#include <termios.h>
748 +
749 +static void _BSP_output_char( char c );
750 +static rtems_status_code do_poll_read( rtems_device_major_number major, rtems_device_minor_number minor, void * arg);
751 +static rtems_status_code do_poll_write( rtems_device_major_number major, rtems_device_minor_number minor, void * arg);
752 +
753 +static void _BSP_null_char( char c ) {return;}
754 +
755 +BSP_output_char_function_type BSP_output_char = _BSP_null_char;
756 +
757 +/*
758 + *  do_poll_read
759 + *
760 + *  Input characters through polled I/O. Returns as soon as a character has
761 + *  been received. Otherwise, if we wait for the number of requested
762 + *  characters, we could be here forever!
763 + *
764 + *  CR is converted to LF on input. The terminal should not send a CR/LF pair
765 + *  when the return or enter key is pressed.
766 + *
767 + *  Input parameters:
768 + *    major - ignored. Should be the major number for this driver.
769 + *    minor - selected channel.
770 + *    arg->buffer - where to put the received characters.
771 + *    arg->count  - number of characters to receive before returning--Ignored.
772 + *
773 + *  Output parameters:
774 + *    arg->bytes_moved - the number of characters read. Always 1.
775 + *
776 + *  Return value: RTEMS_SUCCESSFUL
777 + *
778 + *  CANNOT BE COMBINED WITH INTERRUPT DRIVEN I/O!
779 + */
780 +static rtems_status_code do_poll_read(
781 +  rtems_device_major_number major,
782 +  rtems_device_minor_number minor,
783 +  void                    * arg
784 +)
785 +{
786 +  rtems_libio_rw_args_t *rw_args = arg;
787 +  int c;
788 +
789 +  while( (c = m5xx_uart_pollRead(minor)) == -1 );
790 +  rw_args->buffer[0] = (uint8_t)c;
791 +  if( rw_args->buffer[0] == '\r' )
792 +      rw_args->buffer[0] = '\n';
793 +  rw_args->bytes_moved = 1;
794 +
795 +  return RTEMS_SUCCESSFUL;
796 +}
797 +
798 +/*
799 + *  do_poll_write
800 + *
801 + *  Output characters through polled I/O. Returns only once every character has
802 + *  been sent.
803 + *
804 + *  CR is transmitted AFTER a LF on output.
805 + *
806 + *  Input parameters:
807 + *    major - ignored. Should be the major number for this driver.
808 + *    minor - selected channel
809 + *    arg->buffer - where to get the characters to transmit.
810 + *    arg->count  - the number of characters to transmit before returning.
811 + *
812 + *  Output parameters:
813 + *    arg->bytes_moved - the number of characters read
814 + *
815 + *  Return value: RTEMS_SUCCESSFUL
816 + *
817 + *  CANNOT BE COMBINED WITH INTERRUPT DRIVEN I/O!
818 + */
819 +static rtems_status_code do_poll_write(
820 +  rtems_device_major_number major,
821 +  rtems_device_minor_number minor,
822 +  void                    * arg
823 +)
824 +{
825 +  rtems_libio_rw_args_t *rw_args = arg;
826 +  uint32_t i;
827 +  char cr ='\r';
828 +
829 +  for( i = 0; i < rw_args->count; i++ ) {
830 +    m5xx_uart_pollWrite(minor, &(rw_args->buffer[i]), 1);
831 +    if ( rw_args->buffer[i] == '\n' )
832 +      m5xx_uart_pollWrite(minor, &cr, 1);
833 +  }
834 +  rw_args->bytes_moved = i;
835 +
836 +  return RTEMS_SUCCESSFUL;
837 +}
838 +
839 +/*
840 + *  Print functions prototyped in bspIo.h
841 + */
842 +
843 +static void _BSP_output_char( char c )
844 +{
845 +  char cr = '\r';
846 +
847 +  /*
848 +   *  Can't rely on console_initialize having been called before this
849 +   *  function is used, so it may fail.
850 +   */
851 +
852 +  m5xx_uart_pollWrite( PRINTK_MINOR, &c, 1 );
853 +  if( c == '\n' )
854 +    m5xx_uart_pollWrite( PRINTK_MINOR, &cr, 1 );
855 +}
856 +
857 +/*
858 + ***************
859 + * BOILERPLATE *
860 + ***************
861 + *
862 + *  All these functions are prototyped in rtems/c/src/lib/include/console.h.
863 + */
864 +
865 +/*
866 + * Initialize and register the device
867 + */
868 +rtems_device_driver console_initialize(
869 +  rtems_device_major_number major,
870 +  rtems_device_minor_number minor,
871 +  void *arg
872 +)
873 +{
874 +  rtems_status_code status;
875 +
876 +  /*
877 +   * Set up TERMIOS if needed
878 +   */
879 +  #if UARTS_USE_TERMIOS == 1
880 +    rtems_termios_initialize ();
881 +  #endif /* UARTS_USE_TERMIOS */
882 +
883 +  /*
884 +   * Do device-specific initialization
885 +   */
886 +  BSP_output_char = _BSP_output_char;
887 +
888 +  m5xx_uart_initialize(SCI1_MINOR);
889 +  status = rtems_io_register_name ("/dev/tty0", major, SCI1_MINOR);
890 +  if (status != RTEMS_SUCCESSFUL)
891 +    rtems_fatal_error_occurred (status);
892 +
893 +  m5xx_uart_initialize(SCI2_MINOR);
894 +  status = rtems_io_register_name ("/dev/tty1", major, SCI2_MINOR);
895 +  if (status != RTEMS_SUCCESSFUL)
896 +    rtems_fatal_error_occurred (status);
897 +
898 +  /* Now register the RTEMS console */
899 +  status = rtems_io_register_name ("/dev/console", major, CONSOLE_MINOR);
900 +  if (status != RTEMS_SUCCESSFUL)
901 +    rtems_fatal_error_occurred (status);
902 +
903 +  return RTEMS_SUCCESSFUL;
904 +}
905 +
906 +/*
907 + * Open the device
908 + */
909 +rtems_device_driver console_open(
910 +  rtems_device_major_number major,
911 +  rtems_device_minor_number minor,
912 +  void *arg
913 +)
914 +{
915 +  rtems_status_code sc;
916 +
917 +  if ( minor > NUM_PORTS - 1 )
918 +    return RTEMS_INVALID_NUMBER;
919 +
920 +  #if (UARTS_USE_TERMIOS == 1)
921 +  {
922 +    #if (UARTS_IO_MODE == 1)    /* RTEMS interrupt-driven I/O with termios */
923 +
924 +      static const rtems_termios_callbacks callbacks = {
925 +        m5xx_uart_firstOpen,                   /* firstOpen */
926 +        m5xx_uart_lastClose,                   /* lastClose */
927 +        NULL,                           /* pollRead */
928 +        m5xx_uart_write,                       /* write */
929 +        m5xx_uart_setAttributes,       /* setAttributes */
930 +        NULL,                          /* stopRemoteTx */
931 +        NULL,                          /* startRemoteTx */
932 +        TERMIOS_IRQ_DRIVEN             /* outputUsesInterrupts */
933 +      };
934 +      sc = rtems_termios_open( major, minor, arg, &callbacks );
935 +
936 +    #else /* UARTS_IO_MODE != 1        */      /* RTEMS polled I/O with termios */
937 +
938 +      static const rtems_termios_callbacks callbacks = {
939 +        m5xx_uart_firstOpen,                   /* firstOpen */
940 +        m5xx_uart_lastClose,                   /* lastClose */
941 +        m5xx_uart_pollRead,             /* pollRead */
942 +        m5xx_uart_pollWrite,            /* write */
943 +        m5xx_uart_setAttributes,        /* setAttributes */
944 +        NULL,                           /* stopRemoteTx */
945 +        NULL,                          /* startRemoteTx */
946 +        TERMIOS_POLLED                         /* outputUsesInterrupts */
947 +      };
948 +      sc = rtems_termios_open( major, minor, arg, &callbacks );
949 +
950 +    #endif
951 +
952 +    return sc;
953 +  }
954 +
955 +  #else                /* no termios -- default to polled I/O */
956 +  {
957 +    sc = RTEMS_SUCCESSFUL;
958 +  }
959 +  #endif
960 +
961 +  return sc;
962 +}
963 +
964 +/*
965 + * Close the device
966 + */
967 +rtems_device_driver console_close(
968 +  rtems_device_major_number major,
969 +  rtems_device_minor_number minor,
970 +  void *arg
971 +)
972 +{
973 +  if ( minor > NUM_PORTS-1 )
974 +    return RTEMS_INVALID_NUMBER;
975 +
976 +  #if UARTS_USE_TERMIOS == 1
977 +    return rtems_termios_close( arg );
978 +  #else
979 +    return RTEMS_SUCCESSFUL;
980 +  #endif
981 +}
982 +
983 +/*
984 + * Read from the device
985 + */
986 +rtems_device_driver console_read(
987 +  rtems_device_major_number major,
988 +  rtems_device_minor_number minor,
989 +  void *arg
990 +)
991 +{
992 +  if ( minor > NUM_PORTS-1 )
993 +    return RTEMS_INVALID_NUMBER;
994 +
995 +  #if UARTS_USE_TERMIOS == 1
996 +    return rtems_termios_read( arg );
997 +  #else
998 +    return do_poll_read( major, minor, arg );
999 +  #endif
1000 +}
1001 +
1002 +/*
1003 + * Write to the device
1004 + */
1005 +rtems_device_driver console_write(
1006 +  rtems_device_major_number major,
1007 +  rtems_device_minor_number minor,
1008 +  void *arg
1009 +)
1010 +{
1011 +  if ( minor > NUM_PORTS-1 )
1012 +    return RTEMS_INVALID_NUMBER;
1013 +
1014 +  #if UARTS_USE_TERMIOS == 1
1015 +    return rtems_termios_write( arg );
1016 +  #else
1017 +    return do_poll_write( major, minor, arg );
1018 +  #endif
1019 +}
1020 +
1021 +/*
1022 + * Handle ioctl request.
1023 + */
1024 +rtems_device_driver console_control(
1025 +  rtems_device_major_number major,
1026 +  rtems_device_minor_number minor,
1027 +  void *arg
1028 +)
1029 +{
1030 +  if ( minor > NUM_PORTS-1 )
1031 +    return RTEMS_INVALID_NUMBER;
1032 +
1033 +  #if UARTS_USE_TERMIOS == 1
1034 +    return rtems_termios_ioctl( arg );
1035 +  #else
1036 +    return RTEMS_SUCCESSFUL;
1037 +  #endif
1038 +}
1039 Index: rtems/c/src/lib/libbsp/powerpc/ec555/include/.cvsignore
1040 ===================================================================
1041 --- /dev/null
1042 +++ rtems/c/src/lib/libbsp/powerpc/ec555/include/.cvsignore
1043 @@ -0,0 +1,4 @@
1044 +bspopts.h
1045 +bspopts.h.in
1046 +stamp-h
1047 +stamp-h.in
1048 Index: rtems/c/src/lib/libbsp/powerpc/ec555/include/bsp.h
1049 ===================================================================
1050 --- /dev/null
1051 +++ rtems/c/src/lib/libbsp/powerpc/ec555/include/bsp.h
1052 @@ -0,0 +1,115 @@
1053 +/*  bsp.h
1054 + *
1055 + *  This include file contains all board IO definitions.
1056 + *
1057 + *  This file includes definitions for the Intec SS555.
1058 + *
1059 + *
1060 + *  SS555 port sponsored by Defence Research and Development Canada - Suffield
1061 + *  Copyright (C) 2004, Real-Time Systems Inc. (querbach@realtime.bc.ca)
1062 + *
1063 + *  Derived from c/src/lib/libbsp/powerpc/mbx8xx/include/bsp.h:
1064 + *
1065 + *  COPYRIGHT (c) 1989-1998.
1066 + *  On-Line Applications Research Corporation (OAR).
1067 + *
1068 + *  The license and distribution terms for this file may be
1069 + *  found in the file LICENSE in this distribution or at
1070 + *  http://www.rtems.com/license/LICENSE.
1071 + *
1072 + *  $Id: bsp.h,v 1.9 2005/05/26 05:36:48 ralf Exp $
1073 + */
1074 +
1075 +#ifndef _BSP_H
1076 +#define _BSP_H
1077 +
1078 +#ifdef __cplusplus
1079 +extern "C" {
1080 +#endif
1081 +
1082 +#include <bspopts.h>
1083 +
1084 +#include <rtems.h>
1085 +#include <rtems/console.h>
1086 +#include <rtems/clockdrv.h>
1087 +#include <mpc5xx.h>
1088 +#include <mpc5xx/console.h>
1089 +#include <libcpu/vectors.h>
1090 +#include <bsp/irq.h>
1091 +
1092 +/*
1093 + * Clock definitions
1094 + */
1095 +
1096 +#define BSP_CRYSTAL_HZ          4000000        /* crystal frequency, Hz */
1097 +#define BSP_CLOCK_HZ   40000000        /* CPU clock frequency, Hz
1098 +
1099 +/*
1100 + * I/O definitions
1101 + *
1102 + * The SS555 board includes a CPLD to control on-board features and
1103 + * off-board devices.
1104 + */
1105 +typedef struct cpld_ {
1106 +  uint8_t      cs3a[32];               /* Chip select 3A */
1107 +  uint8_t      pad0[0x200000 - 0x000020];
1108 +
1109 +  uint8_t      cs3b[32];               /* Chip select 3B */
1110 +  uint8_t      pad2[0x400000 - 0x200020];
1111 +
1112 +  uint8_t      cs3c[32];               /* Chip select 3C */
1113 +  uint8_t      pad4[0x600000 - 0x400020];
1114 +
1115 +  uint8_t      cs3d[32];               /* Chip select 3D */
1116 +  uint8_t      pad6[0x800000 - 0x600020];
1117 +
1118 +  uint8_t      serial_ints;    /* Enable/disable serial interrupts */
1119 +  uint8_t      serial_resets;  /* Enable/disable serial resets */
1120 +  uint8_t      serial_ack;     /* Acknowledge serial transfers */
1121 +  uint8_t      pad8[0xA00000 - 0x800003];
1122 +
1123 +  uint8_t      iflash_writess; /* Enable/disable internal-flash writes */
1124 +  uint8_t      nflash_writess; /* Enable/disable NAND-flash writes */
1125 +  uint8_t      padA[0xC00000 - 0xA00002];
1126 +} cpld_t;
1127 +
1128 +extern volatile cpld_t cpld;              /* defined in linkcmds */
1129 +
1130 +/* miscellaneous stuff assumed to exist */
1131 +
1132 +extern rtems_configuration_table BSP_Configuration;
1133 +
1134 +/*
1135 + *  Device Driver Table Entries
1136 + */
1137 +
1138 +/*
1139 + * NOTE: Use the standard Console driver entry
1140 + */
1141 +
1142 +/*
1143 + * NOTE: Use the standard Clock driver entry
1144 + */
1145 +
1146 +/*
1147 + * How many libio files we want
1148 + */
1149 +
1150 +#define BSP_LIBIO_MAX_FDS       20
1151 +
1152 +/* functions */
1153 +
1154 +void bsp_cleanup( void );
1155 +
1156 +rtems_isr_entry set_vector(                    /* returns old vector */
1157 +  rtems_isr_entry     handler,                  /* isr routine        */
1158 +  rtems_vector_number vector,                   /* vector number      */
1159 +  int                 type                      /* RTEMS or RAW intr  */
1160 +);
1161 +
1162 +#ifdef __cplusplus
1163 +}
1164 +#endif
1165 +
1166 +#endif
1167 +/* end of include file */
1168 Index: rtems/c/src/lib/libbsp/powerpc/ec555/include/coverhd.h
1169 ===================================================================
1170 --- /dev/null
1171 +++ rtems/c/src/lib/libbsp/powerpc/ec555/include/coverhd.h
1172 @@ -0,0 +1,117 @@
1173 +/*  coverhd.h
1174 + *
1175 + *  This include file has defines to represent the overhead associated
1176 + *  with calling a particular directive from C.  These are used in the
1177 + *  Timing Test Suite to ignore the overhead required to pass arguments
1178 + *  to directives.  On some CPUs and/or target boards, this overhead
1179 + *  is significant and makes it difficult to distinguish internal
1180 + *  RTEMS execution time from that used to call the directive.
1181 + *  This file should be updated after running the C overhead timing
1182 + *  test.  Once this update has been performed, the RTEMS Time Test
1183 + *  Suite should be rebuilt to account for these overhead times in the
1184 + *  timing results.
1185 + *
1186 + *  NOTE:  If these are all zero, then the times reported include
1187 + *         all calling overhead including passing of arguments.
1188 + *
1189 + *  COPYRIGHT (c) 1989-1998.
1190 + *  On-Line Applications Research Corporation (OAR).
1191 + *
1192 + *  The license and distribution terms for this file may be
1193 + *  found in the file LICENSE in this distribution or at
1194 + *  http://www.rtems.com/license/LICENSE.
1195 + *
1196 + *  $Id: coverhd.h,v 1.1 2004/04/12 21:52:13 joel Exp $
1197 + */
1198 +
1199 +#ifndef __COVERHD_h
1200 +#define __COVERHD_h
1201 +
1202 +#ifdef __cplusplus
1203 +extern "C" {
1204 +#endif
1205 +
1206 +/*
1207 + * 40 MHz processor, running from external 2-1-1-1 burst SRAM.
1208 + */
1209 +#define CALLING_OVERHEAD_INITIALIZE_EXECUTIVE      0
1210 +#define CALLING_OVERHEAD_SHUTDOWN_EXECUTIVE        0
1211 +#define CALLING_OVERHEAD_TASK_CREATE               0
1212 +#define CALLING_OVERHEAD_TASK_IDENT                0
1213 +#define CALLING_OVERHEAD_TASK_START                0
1214 +#define CALLING_OVERHEAD_TASK_RESTART              0
1215 +#define CALLING_OVERHEAD_TASK_DELETE               0
1216 +#define CALLING_OVERHEAD_TASK_SUSPEND              0
1217 +#define CALLING_OVERHEAD_TASK_RESUME               0
1218 +#define CALLING_OVERHEAD_TASK_SET_PRIORITY         0
1219 +#define CALLING_OVERHEAD_TASK_MODE                 0
1220 +#define CALLING_OVERHEAD_TASK_GET_NOTE             0
1221 +#define CALLING_OVERHEAD_TASK_SET_NOTE             0
1222 +#define CALLING_OVERHEAD_TASK_WAKE_WHEN            2
1223 +#define CALLING_OVERHEAD_TASK_WAKE_AFTER           0
1224 +#define CALLING_OVERHEAD_INTERRUPT_CATCH           0
1225 +#define CALLING_OVERHEAD_CLOCK_GET                 2
1226 +#define CALLING_OVERHEAD_CLOCK_SET                 3
1227 +#define CALLING_OVERHEAD_CLOCK_TICK                0
1228 +
1229 +#define CALLING_OVERHEAD_TIMER_CREATE              0
1230 +#define CALLING_OVERHEAD_TIMER_IDENT               0
1231 +#define CALLING_OVERHEAD_TIMER_DELETE              0
1232 +#define CALLING_OVERHEAD_TIMER_FIRE_AFTER          0
1233 +#define CALLING_OVERHEAD_TIMER_FIRE_WHEN           3
1234 +#define CALLING_OVERHEAD_TIMER_RESET               0
1235 +#define CALLING_OVERHEAD_TIMER_CANCEL              0
1236 +#define CALLING_OVERHEAD_SEMAPHORE_CREATE          0
1237 +#define CALLING_OVERHEAD_SEMAPHORE_IDENT           0
1238 +#define CALLING_OVERHEAD_SEMAPHORE_DELETE          0
1239 +#define CALLING_OVERHEAD_SEMAPHORE_OBTAIN          0
1240 +#define CALLING_OVERHEAD_SEMAPHORE_RELEASE         0
1241 +#define CALLING_OVERHEAD_MESSAGE_QUEUE_CREATE      0
1242 +#define CALLING_OVERHEAD_MESSAGE_QUEUE_IDENT       0
1243 +#define CALLING_OVERHEAD_MESSAGE_QUEUE_DELETE      0
1244 +#define CALLING_OVERHEAD_MESSAGE_QUEUE_SEND        0
1245 +#define CALLING_OVERHEAD_MESSAGE_QUEUE_URGENT      0
1246 +#define CALLING_OVERHEAD_MESSAGE_QUEUE_BROADCAST   0
1247 +#define CALLING_OVERHEAD_MESSAGE_QUEUE_RECEIVE     0
1248 +#define CALLING_OVERHEAD_MESSAGE_QUEUE_FLUSH       0
1249 +
1250 +#define CALLING_OVERHEAD_EVENT_SEND                0
1251 +#define CALLING_OVERHEAD_EVENT_RECEIVE             0
1252 +#define CALLING_OVERHEAD_SIGNAL_CATCH              0
1253 +#define CALLING_OVERHEAD_SIGNAL_SEND               0
1254 +#define CALLING_OVERHEAD_PARTITION_CREATE          0
1255 +#define CALLING_OVERHEAD_PARTITION_IDENT           0
1256 +#define CALLING_OVERHEAD_PARTITION_DELETE          0
1257 +#define CALLING_OVERHEAD_PARTITION_GET_BUFFER      0
1258 +#define CALLING_OVERHEAD_PARTITION_RETURN_BUFFER   0
1259 +#define CALLING_OVERHEAD_REGION_CREATE             0
1260 +#define CALLING_OVERHEAD_REGION_IDENT              0
1261 +#define CALLING_OVERHEAD_REGION_DELETE             0
1262 +#define CALLING_OVERHEAD_REGION_GET_SEGMENT        0
1263 +#define CALLING_OVERHEAD_REGION_RETURN_SEGMENT     0
1264 +#define CALLING_OVERHEAD_PORT_CREATE               0
1265 +#define CALLING_OVERHEAD_PORT_IDENT                0
1266 +#define CALLING_OVERHEAD_PORT_DELETE               0
1267 +#define CALLING_OVERHEAD_PORT_EXTERNAL_TO_INTERNAL 0
1268 +#define CALLING_OVERHEAD_PORT_INTERNAL_TO_EXTERNAL 0
1269 +
1270 +#define CALLING_OVERHEAD_IO_INITIALIZE             0
1271 +#define CALLING_OVERHEAD_IO_OPEN                   0
1272 +#define CALLING_OVERHEAD_IO_CLOSE                  0
1273 +#define CALLING_OVERHEAD_IO_READ                   0
1274 +#define CALLING_OVERHEAD_IO_WRITE                  0
1275 +#define CALLING_OVERHEAD_IO_CONTROL                0
1276 +#define CALLING_OVERHEAD_FATAL_ERROR_OCCURRED      0
1277 +#define CALLING_OVERHEAD_RATE_MONOTONIC_CREATE     0
1278 +#define CALLING_OVERHEAD_RATE_MONOTONIC_IDENT      0
1279 +#define CALLING_OVERHEAD_RATE_MONOTONIC_DELETE     0
1280 +#define CALLING_OVERHEAD_RATE_MONOTONIC_CANCEL     0
1281 +#define CALLING_OVERHEAD_RATE_MONOTONIC_PERIOD     0
1282 +#define CALLING_OVERHEAD_MULTIPROCESSING_ANNOUNCE  0
1283 +
1284 +#ifdef __cplusplus
1285 +}
1286 +#endif
1287 +
1288 +#endif
1289 +/* end of include file */
1290 Index: rtems/c/src/lib/libbsp/powerpc/ec555/include/tm27.h
1291 ===================================================================
1292 --- /dev/null
1293 +++ rtems/c/src/lib/libbsp/powerpc/ec555/include/tm27.h
1294 @@ -0,0 +1,54 @@
1295 +/*
1296 + *  tm27.h
1297 + *
1298 + *  The license and distribution terms for this file may be
1299 + *  found in the file LICENSE in this distribution or at
1300 + *  http://www.rtems.com/license/LICENSE.
1301 + *
1302 + *  $Id: tm27.h,v 1.2 2004/04/23 04:47:38 ralf Exp $
1303 + */
1304 +
1305 +#ifndef _RTEMS_TMTEST27
1306 +#error "This is an RTEMS internal file you must not include directly."
1307 +#endif
1308 +
1309 +#ifndef __tm27_h
1310 +#define __tm27_h
1311 +
1312 +/*
1313 + * Stuff for Time Test 27
1314 + *
1315 + * The following require that IRQ7 be jumpered to ground.  On the SS555,
1316 + * this can be done by shorting together CN5 pin 48 and CN5 pin 50.
1317 + */
1318 +
1319 +#define MUST_WAIT_FOR_INTERRUPT 1
1320 +
1321 +#define Install_tm27_vector( handler )                                 \
1322 +{                                                                      \
1323 +  extern rtems_irq_connect_data tm27IrqData;                            \
1324 +  usiu.siel |= (1 << 17);                                              \
1325 +  usiu.sipend |= (1 << 17);                                            \
1326 +                                                                       \
1327 +  tm27IrqData.hdl = (rtems_irq_hdl)handler;                            \
1328 +  BSP_install_rtems_irq_handler (&tm27IrqData);                                \
1329 +}
1330 +
1331 +#define Cause_tm27_intr()                                              \
1332 +{                                                                      \
1333 +  usiu.siel &= ~(1 << 17);                                             \
1334 +}
1335 +
1336 +#define Clear_tm27_intr()                                              \
1337 +{                                                                      \
1338 +  usiu.siel |= (1 << 17);                                              \
1339 +  usiu.sipend |= (1 << 17);                                            \
1340 +}
1341 +
1342 +#define Lower_tm27_intr()                                              \
1343 +{                                                                      \
1344 +  ppc_cached_irq_mask |= (1 << 17);                                    \
1345 +  usiu.simask = ppc_cached_irq_mask;                                   \
1346 +}
1347 +
1348 +#endif
1349 Index: rtems/c/src/lib/libbsp/powerpc/ec555/irq/irq.h
1350 ===================================================================
1351 --- /dev/null
1352 +++ rtems/c/src/lib/libbsp/powerpc/ec555/irq/irq.h
1353 @@ -0,0 +1,55 @@
1354 +/* irq.h
1355 + *
1356 + *  This include file describe the data structure and the functions implemented
1357 + *  by rtems to write interrupt handlers.
1358 + *
1359 + *
1360 + *  SS555 port sponsored by Defence Research and Development Canada - Suffield
1361 + *  Copyright (C) 2004, Real-Time Systems Inc. (querbach@realtime.bc.ca)
1362 + *
1363 + *  Derived from libbsp/powerpc/mbx8xx/irq/irq.h:
1364 + *
1365 + *  CopyRight (C) 1999 valette@crf.canon.fr
1366 + *
1367 + *  This code is heavilly inspired by the public specification of STREAM V2
1368 + *  that can be found at :
1369 + *
1370 + *      <http://www.chorus.com/Documentation/index.html> by following
1371 + *  the STREAM API Specification Document link.
1372 + *
1373 + *  The license and distribution terms for this file may be
1374 + *  found in found in the file LICENSE in this distribution or at
1375 + *  http://www.rtems.com/license/LICENSE.
1376 + *
1377 + *  $Id: irq.h,v 1.2 2004/04/21 10:43:03 ralf Exp $
1378 + */
1379 +
1380 +#ifndef LIBBSP_POWERPC_SS555_IRQ_IRQ_H
1381 +#define LIBBSP_POWERPC_SS555_IRQ_IRQ_H
1382 +
1383 +#include <libcpu/irq.h>
1384 +
1385 +#ifndef ASM
1386 +
1387 +#ifdef __cplusplus
1388 +extern "C" {
1389 +#endif
1390 +
1391 +/*
1392 + * The SS555 has no external interrupt controller chip, so use the standard
1393 + * routines from the CPU-dependent code.
1394 + */
1395 +#define BSP_install_rtems_irq_handler(ptr)     CPU_install_rtems_irq_handler(ptr)
1396 +#define BSP_get_current_rtems_irq_handler(ptr) CPU_get_current_rtems_irq_handler(ptr)
1397 +#define BSP_remove_rtems_irq_handler(ptr)      CPU_remove_rtems_irq_handler(ptr)
1398 +#define BSP_rtems_irq_mngt_set(config)         CPU_rtems_irq_mngt_set(config)
1399 +#define BSP_rtems_irq_mngt_get(config)         CPU_rtems_irq_mngt_get(config)
1400 +#define BSP_rtems_irq_mng_init(cpuId)          CPU_rtems_irq_mng_init(cpuId)
1401 +
1402 +#ifdef __cplusplus
1403 +}
1404 +#endif
1405 +
1406 +#endif /* ASM */
1407 +
1408 +#endif /* LIBBSP_POWERPC_SS555_IRQ_IRQ_H */
1409 Index: rtems/c/src/lib/libbsp/powerpc/ec555/startup/bspstart.c
1410 ===================================================================
1411 --- /dev/null
1412 +++ rtems/c/src/lib/libbsp/powerpc/ec555/startup/bspstart.c
1413 @@ -0,0 +1,201 @@
1414 +/*  bspstart.c
1415 + *
1416 + *  This set of routines starts the application.  It includes application,
1417 + *  board, and monitor specific initialization and configuration.
1418 + *  The generic CPU dependent initialization has been performed
1419 + *  before this routine is invoked.
1420 + *
1421 + *  COPYRIGHT (c) 1989-1998.
1422 + *  On-Line Applications Research Corporation (OAR).
1423 + *
1424 + *  The license and distribution terms for this file may be
1425 + *  found in the file LICENSE in this distribution or at
1426 + *  http://www.rtems.com/license/LICENSE.
1427 + *
1428 + *  SS555 port sponsored by Defence Research and Development Canada - Suffield
1429 + *  Copyright (C) 2004, Real-Time Systems Inc. (querbach@realtime.bc.ca)
1430 + *
1431 + *  Derived from c/src/lib/libbsp/powerpc/mbx8xx/startup/bspstart.c:
1432 + *
1433 + *  Modifications for MBX860:
1434 + *  Copyright (c) 1999, National Research Council of Canada
1435 + *
1436 + *  $Id: bspstart.c,v 1.7 2005/04/26 23:16:21 joel Exp $
1437 + */
1438 +
1439 +#include <string.h>
1440 +
1441 +#include <rtems/libio.h>
1442 +#include <rtems/libcsupport.h>
1443 +#include <rtems/bspIo.h>
1444 +#include <rtems/powerpc/powerpc.h>
1445 +
1446 +#include <libcpu/cpuIdent.h>
1447 +#include <libcpu/spr.h>
1448 +
1449 +#include <bsp/irq.h>
1450 +#include <bsp.h>
1451 +
1452 +SPR_RW(SPRG0)
1453 +SPR_RW(SPRG1)
1454 +
1455 +/*
1456 + *  The original table from the application (in ROM) and our copy of it with
1457 + *  some changes. Configuration is defined in <confdefs.h>. Make sure that
1458 + *  our configuration tables are uninitialized so that they get allocated in
1459 + *  the .bss section (RAM).
1460 + */
1461 +extern rtems_configuration_table Configuration;
1462 +extern unsigned long intrStackPtr;
1463 +rtems_configuration_table  BSP_Configuration;
1464 +
1465 +rtems_cpu_table Cpu_table;
1466 +
1467 +char *rtems_progname;
1468 +
1469 +/*
1470 + *  Use the shared implementations of the following routines.
1471 + *  Look in rtems/c/src/lib/libbsp/shared/bsppost.c and
1472 + *  rtems/c/src/lib/libbsp/shared/bsplibc.c.
1473 + */
1474 +void bsp_postdriver_hook(void);
1475 +void bsp_libc_init( void *, uint32_t, int );
1476 +
1477 +void BSP_panic(char *s)
1478 +{
1479 +  printk("%s PANIC %s\n",_RTEMS_version, s);
1480 +  __asm__ __volatile ("sc");
1481 +}
1482 +
1483 +void _BSP_Fatal_error(unsigned int v)
1484 +{
1485 +  printk("%s PANIC ERROR %x\n",_RTEMS_version, v);
1486 +  __asm__ __volatile ("sc");
1487 +}
1488 +
1489 +/*
1490 + *  bsp_pretasking_hook
1491 + *
1492 + *  Called when RTEMS initialization is complete but before interrupts and
1493 + *  tasking are enabled. Used to setup libc and install any BSP extensions.
1494 + *
1495 + *  Must not use libc (to do io) from here, since drivers are not yet
1496 + *  initialized.
1497 + *
1498 + *  Installed in the rtems_cpu_table defined in
1499 + *  rtems/c/src/exec/score/cpu/powerpc/rtems/new-exceptions/cpu.h by main()
1500 + *  below.  Called from rtems_initialize_executive() defined in
1501 + *  rtems/c/src/exec/sapi/src/init.c
1502 + *
1503 + *  Input parameters: NONE
1504 + *
1505 + *  Output parameters: NONE
1506 + *
1507 + *  Return values: NONE
1508 + */
1509 +void bsp_pretasking_hook(void)
1510 +{
1511 +  /*
1512 +   *  These are assigned addresses in the linkcmds file for the BSP. This
1513 +   *  approach is better than having these defined as manifest constants and
1514 +   *  compiled into the kernel, but it is still not ideal when dealing with
1515 +   *  multiprocessor configuration in which each board as a different memory
1516 +   *  map. A better place for defining these symbols might be the makefiles.
1517 +   *  Consideration should also be given to developing an approach in which
1518 +   *  the kernel and the application can be linked and burned into ROM
1519 +   *  independently of each other.
1520 +   */
1521 +    uint8_t *_HeapStart =
1522 +      (uint8_t *)BSP_Configuration.work_space_start
1523 +           + BSP_Configuration.work_space_size;
1524 +    extern uint8_t _HeapEnd[];
1525 +
1526 +    bsp_libc_init( _HeapStart, _HeapEnd - _HeapStart, 0 );
1527 +
1528 +#ifdef RTEMS_DEBUG
1529 +  rtems_debug_enable( RTEMS_DEBUG_ALL_MASK );
1530 +#endif
1531 +}
1532 +
1533 +/*
1534 + *  bsp_start()
1535 + *
1536 + *  Board-specific initialization code. Called from the generic boot_card()
1537 + *  function defined in rtems/c/src/lib/libbsp/shared/main.c. That function
1538 + *  does some of the board independent initialization. It is called from the
1539 + *  SS555 entry point _start() defined in
1540 + *  rtems/c/src/lib/libbsp/powerpc/ss555/startup/start.S
1541 + *
1542 + *  _start() has set up a stack, has zeroed the .bss section, has set up the
1543 + *  .data section from contents stored in ROM, has turned off interrupts,
1544 + *  and placed the processor in the supervisor mode.  boot_card() has left
1545 + *  the processor in that state when bsp_start() was called.
1546 + *
1547 + *  Input parameters: NONE
1548 + *
1549 + *  Output parameters: NONE
1550 + *
1551 + *  Return values: NONE
1552 + */
1553 +void bsp_start(void)
1554 +{
1555 +  extern char _WorkspaceBase[];
1556 +
1557 +  ppc_cpu_id_t myCpu;
1558 +  ppc_cpu_revision_t myCpuRevision;
1559 +  register unsigned char* intrStack;
1560 +
1561 +  /*
1562 +   * Get CPU identification dynamically.  Note that the get_ppc_cpu_type()
1563 +   * function stores the result in global variables so that it can be used
1564 +   * later.
1565 +   */
1566 +  myCpu        = get_ppc_cpu_type();
1567 +  myCpuRevision = get_ppc_cpu_revision();
1568 +
1569 +  /*
1570 +   * Initialize some SPRG registers related to irq handling
1571 +   */
1572 +  intrStack = (((unsigned char*)&intrStackPtr) - PPC_MINIMUM_STACK_FRAME_SIZE);
1573 +  _write_SPRG1((unsigned int)intrStack);
1574 +  /* signal them that we have fixed PR288 - eventually, this should go away */
1575 +  _write_SPRG0(PPC_BSP_HAS_FIXED_PR288);
1576 +
1577 +  /*
1578 +   * Install our own set of exception vectors
1579 +   */
1580 +  initialize_exceptions();
1581 +
1582 +  /*
1583 +   *  Allocate the memory for the RTEMS Work Space.  This can come from
1584 +   *  a variety of places: hard coded address, malloc'ed from outside
1585 +   *  RTEMS world (e.g. simulator or primitive memory manager), or (as
1586 +   *  typically done by stock BSPs) by subtracting the required amount
1587 +   *  of work space from the last physical address on the CPU board.
1588 +   *
1589 +   *  In this case, the memory is not malloc'ed.  It is just
1590 +   *  "pulled from the air".
1591 +   */
1592 +  BSP_Configuration.work_space_start = _WorkspaceBase;
1593 +
1594 +  /*
1595 +   *  initialize the CPU table for this BSP
1596 +   */
1597 +  Cpu_table.pretasking_hook = bsp_pretasking_hook;  /* init libc, etc. */
1598 +  Cpu_table.postdriver_hook = bsp_postdriver_hook;
1599 +  if( Cpu_table.interrupt_stack_size < 4 * 1024 )
1600 +      Cpu_table.interrupt_stack_size = 4 * 1024;
1601 +
1602 +  Cpu_table.clicks_per_usec = BSP_CRYSTAL_HZ / 4 / 1000000;
1603 +  Cpu_table.clock_speed = BSP_CLOCK_HZ;        /* for SCI baud rate generator */
1604 +
1605 +  /*
1606 +   * Call this in case we use TERMIOS for console I/O
1607 +   */
1608 +  m5xx_uart_reserve_resources( &BSP_Configuration );
1609 +
1610 +  /*
1611 +   * Initalize RTEMS IRQ system
1612 +   */
1613 +  BSP_rtems_irq_mng_init(0);
1614 +}
1615 Index: rtems/c/src/lib/libbsp/powerpc/ec555/startup/iss555.c
1616 ===================================================================
1617 --- /dev/null
1618 +++ rtems/c/src/lib/libbsp/powerpc/ec555/startup/iss555.c
1619 @@ -0,0 +1,148 @@
1620 +/*
1621 + *  iss555.c
1622 + *
1623 + *  Intec SS555 initialization routines.
1624 + *
1625 + *  SS555 port sponsored by Defence Research and Development Canada - Suffield
1626 + *  Copyright (C) 2004, Real-Time Systems Inc. (querbach@realtime.bc.ca)
1627 + *
1628 + *  Derived from c/src/lib/libbsp/powerpc/mbx8xx/startup/imbx8xx.c:
1629 + *
1630 + *  Copyright (c) 1999, National Research Council of Canada
1631 + *
1632 + *  The license and distribution terms for this file may be
1633 + *  found in the file LICENSE in this distribution or at
1634 + *  http://www.rtems.com/license/LICENSE.
1635 + */
1636 +
1637 +#include <bsp.h>
1638 +
1639 +SPR_RW(ICTRL);
1640 +SPR_RW(DEC);
1641 +SPR_RW(TBWU);
1642 +SPR_RW(TBWL);
1643 +SPR_RO(IMMR);
1644 +SPR_RW(MI_GRA);
1645 +SPR_RW(L2U_GRA);
1646 +SPR_RW(BBCMCR);
1647 +
1648 +/*
1649 + *  Initialize SS555
1650 + */
1651 +void _InitSS555 (void)
1652 +{
1653 +  register uint32_t plprcr, msr;
1654 +
1655 +  /*
1656 +   * Initialize the System Protection Control Register (SYPCR).
1657 +   * The SYPCR can only be written once after Reset.
1658 +   */
1659 +  usiu.sypcr =
1660 +      USIU_SYPCR_SWTC(WATCHDOG_TIMEOUT)        /* set watchdog timeout */
1661 +    | USIU_SYPCR_BMT(0xFF)             /* set bus monitor timeout */
1662 +    | USIU_SYPCR_BME                   /* enable bus monitor */
1663 +    | USIU_SYPCR_SWF                   /* watchdog halted in freeze */
1664 +#if WATCHDOG_TIMEOUT != 0xFFFF
1665 +    | USIU_SYPCR_SWE                   /* enable watchdog */
1666 +#endif
1667 +    | USIU_SYPCR_SWRI                  /* watchdog forces reset */
1668 +    | USIU_SYPCR_SWP;                  /* prescale watchdog by 2048 */
1669 +
1670 +  TICKLE_WATCHDOG();                   /* restart watchdog timer */
1671 +
1672 +  /*
1673 +   * Re-tune the PLL to the desired system clock frequency.
1674 +   */
1675 +  usiu.plprck = USIU_UNLOCK_KEY;       /* unlock PLPRCR */
1676 +  usiu.plprcr =
1677 +      USIU_PLPRCR_TEXPS                        /* assert TEXP always */
1678 +    | USIU_PLPRCR_MF(BSP_CLOCK_HZ / BSP_CRYSTAL_HZ);
1679 +                                       /* PLL multiplication factor */
1680 +  usiu.plprck = 0;                     /* lock PLPRCR */
1681 +
1682 +  while (((plprcr = usiu.plprcr) & USIU_PLPRCR_SPLS) == 0)
1683 +    ;                                  /* wait for PLL to re-lock */
1684 +
1685 +  /*
1686 +   * Enable the timebase and decrementer, then initialize decrementer
1687 +   * register to a large value to guarantee that a decrementer interrupt
1688 +   * will not be generated before the kernel is fully initialized.
1689 +   * Initialize the timebase register to zero.
1690 +   */
1691 +  usiu.tbscrk = USIU_UNLOCK_KEY;
1692 +  usiu.tbscr |= USIU_TBSCR_TBE;                /* enable time base and decrementer */
1693 +  usiu.tbscrk = 0;
1694 +
1695 +  usiu.tbk = USIU_UNLOCK_KEY;
1696 +  _write_DEC(0x7FFFFFFF);
1697 +  _write_TBWU(0x00000000 );
1698 +  _write_TBWL(0x00000000 );
1699 +  usiu.tbk = 0;
1700 +
1701 +  /*
1702 +   * Run the Inter-Module Bus at full speed.
1703 +   */
1704 +  imb.uimb.umcr &= ~UIMB_UMCR_HSPEED;
1705 +
1706 +  /*
1707 +   * Initialize Memory Controller for External RAM
1708 +   *
1709 +   * Initialize the Base and Option Registers (BR0-BR7 and OR0-OR7).  Note
1710 +   * that for all chip selects, ORx should be programmed before BRx.
1711 +   *
1712 +   * If booting from internal flash ROM, configure the external RAM to
1713 +   * extend the internal RAM.  If booting from external RAM, leave it at
1714 +   * zero but set it up appropriately.
1715 +   */
1716 +  extern char int_ram_top[];           /* top of internal ram */
1717 +
1718 +  usiu.memc[0]._or =
1719 +      USIU_MEMC_OR_512K                        /* bank size */
1720 +    | USIU_MEMC_OR_SCY(0)              /* wait states in first beat of burst */
1721 +    | USIU_MEMC_OR_BSCY(0);            /* wait states in subsequent beats */
1722 +
1723 +  usiu.memc[0]._br =
1724 +      USIU_MEMC_BR_BA(_read_IMMR() & IMMR_FLEN
1725 +        ? (uint32_t)int_ram_top : 0)   /* base address */
1726 +    | USIU_MEMC_BR_PS32                        /* 32-bit data bus */
1727 +    | USIU_MEMC_BR_TBDIP               /* toggle bdip */
1728 +    | USIU_MEMC_BR_V;                  /* base register valid */
1729 +
1730 +  /*
1731 +   * Initialize Memory Controller for External CPLD
1732 +   *
1733 +   * The SS555 board includes a CPLD to control on-board features and
1734 +   * off-board devices.  (Configuration taken from Intec's hwhook.c)
1735 +   */
1736 +  usiu.memc[3]._or =
1737 +      USIU_MEMC_OR_16M                 /* bank size */
1738 +    | USIU_MEMC_OR_CSNT                        /* negate CS/WE early */
1739 +    | USIU_MEMC_OR_ACS_HALF            /* assert CS half cycle after address */
1740 +    | USIU_MEMC_OR_SCY(15)             /* wait states in first beat of burst */
1741 +    | USIU_MEMC_OR_TRLX;               /* relaxed timing */
1742 +
1743 +  usiu.memc[3]._br =
1744 +      USIU_MEMC_BR_BA(&cpld)           /* base address */
1745 +    | USIU_MEMC_BR_PS16                        /* 16-bit data bus */
1746 +    | USIU_MEMC_BR_BI                  /* inhibit bursting */
1747 +    | USIU_MEMC_BR_V;                  /* base register valid */
1748 +
1749 +  /*
1750 +   * Disable show cycles and serialization so that burst accesses will work
1751 +   * properly.  A different value, such as 0x0, may be more appropriate for
1752 +   * debugging, but can be set with the debugger, if needed.
1753 +   */
1754 +  _write_ICTRL(0x00000007);
1755 +
1756 +  /*
1757 +   * Set up Burst Buffer Controller (BBC)
1758 +   */
1759 +  _write_BBCMCR(
1760 +      BBCMCR_ETRE                      /* enable exception relocation */
1761 +    | BBCMCR_BE);                      /* enable burst accesses */
1762 +  _isync;
1763 +
1764 +  _CPU_MSR_GET(msr);
1765 +  msr |= MSR_IP;               /* set prefix for exception relocation */
1766 +  _CPU_MSR_SET(msr);
1767 +}
1768 Index: rtems/c/src/lib/libbsp/powerpc/ec555/startup/linkcmds
1769 ===================================================================
1770 --- /dev/null
1771 +++ rtems/c/src/lib/libbsp/powerpc/ec555/startup/linkcmds
1772 @@ -0,0 +1,320 @@
1773 +/*
1774 + * Linker command file for Intec SS555 board
1775 + *
1776 + * When debugging, we assume that the internal flash ROM will be replaced by
1777 + * the external RAM on the SS555 board.  All sections are stacked starting
1778 + * at address zero.  Nothing is placed in the internal RAM, since it's not
1779 + * contiguous with the external SRAM when the external RAM is placed at
1780 + * zero.
1781 + *
1782 + * For final production, we assume that the .text section will be burned
1783 + * into flash ROM starting at address zero.  The .data, .bss, heap, and
1784 + * workspace will reside in RAM, starting at the beginning of the internal
1785 + * RAM.  The system startup code will configure the external RAM to begin
1786 + * where the internal RAM ends, so as to make one large RAM block.
1787 + *
1788 + * Debugging mode is chosen when the RTEMS_DEBUG symbol is defined.  The
1789 + * RTEMS_DEBUG symbol is defined in the bsp_specs file whenever make(1) is
1790 + * invoked with VARIANT=DEBUG.
1791 + *
1792 + *  $Id: linkcmds,v 1.1 2004/04/12 21:52:13 joel Exp $
1793 + */
1794 +
1795 +OUTPUT_FORMAT("elf32-powerpc", "elf32-powerpc", "elf32-powerpc")
1796 +OUTPUT_ARCH(powerpc) 
1797 +ENTRY(start)
1798 +
1799 +int_ram_org    = 0x003F9800;           /* base of internal RAM */
1800 +int_ram_top    = 0x00400000;           /* top of internal RAM */
1801 +ext_ram_size   = 0x00080000;           /* size of external RAM */
1802 +
1803 +
1804 +SECTIONS
1805 +{
1806 +  .vectors 0x0:
1807 +  {
1808 +    /*
1809 +     * For the MPC555, we use the compressed vector table format which puts
1810 +     * all of the exception vectors before 0x100.
1811 +     */ 
1812 +    *(.vectors)
1813 +  }
1814 +
1815 +  .text 0x100:
1816 +  {
1817 +    /* Read-only sections, merged into text segment: */
1818 +    
1819 +    text.start = .;
1820 +
1821 +    /* Entry point is the .entry section */
1822 +    *(.entry)
1823 +    *(.entry2)
1824 +
1825 +    /* Actual code */
1826 +    *(.text)
1827 +    *(.text.*)
1828 +            
1829 +    /* C++ constructors/destructors */
1830 +    *(.gnu.linkonce.t*)
1831 +            
1832 +    /*  Initialization and finalization code.
1833 +     *
1834 +     *  Various files can provide initialization and finalization functions.
1835 +     *  The bodies of these functions are in .init and .fini sections. We
1836 +     *  accumulate the bodies here, and prepend function prologues from
1837 +     *  ecrti.o and function epilogues from ecrtn.o. ecrti.o must be linked
1838 +     *  first; ecrtn.o must be linked last. Because these are wildcards, it
1839 +     *  doesn't matter if the user does not actually link against ecrti.o and
1840 +     *  ecrtn.o; the linker won't look for a file to match a wildcard.  The
1841 +     *  wildcard also means that it doesn't matter which directory ecrti.o
1842 +     *  and ecrtn.o are in. 
1843 +     */
1844 +    PROVIDE (_init = .);
1845 +    *ecrti.o(.init)
1846 +    *(.init)
1847 +    *ecrtn.o(.init)
1848 +    
1849 +    PROVIDE (_fini = .);
1850 +    *ecrti.o(.fini)
1851 +    *(.fini)
1852 +    *ecrtn.o(.init)
1853 +
1854 +    /* 
1855 +     *  C++ constructors and destructors for static objects.
1856 +     *  PowerPC EABI does not use crtstuff yet, so we build "old-style"
1857 +     *  constructor and destructor lists that begin with the list length
1858 +     *  end terminate with a NULL entry.
1859 +     */
1860 +    PROVIDE (__CTOR_LIST__ = .);            
1861 +    /* LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) */
1862 +    *crtbegin.o(.ctors)
1863 +    *(.ctors)
1864 +    *crtend.o(.ctors)
1865 +    LONG(0)
1866 +    PROVIDE (__CTOR_END__ = .);
1867 +       
1868 +    PROVIDE (__DTOR_LIST__ = .);
1869 +    /* LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2) */
1870 +    *crtbegin.o(.dtors)
1871 +    *(.dtors)
1872 +    *crtend.o(.dtors)
1873 +    LONG(0)
1874 +    PROVIDE (__DTOR_END__ = .);
1875 +       
1876 +    /*
1877 +     * Special FreeBSD sysctl sections.
1878 +     */
1879 +    . = ALIGN (16);
1880 +    __start_set_sysctl_set = .;
1881 +    *(set_sysctl_*);
1882 +    __stop_set_sysctl_set = ABSOLUTE(.);
1883 +    *(set_domain_*);
1884 +    *(set_pseudo_*);
1885 +
1886 +    /* Exception frame info */
1887 +    *(.eh_frame)
1888 +
1889 +    /* Miscellaneous read-only data */
1890 +    _rodata_start = . ;
1891 +    *(.gnu.linkonce.r*)
1892 +    *(.lit)
1893 +    *(.shdata)
1894 +    *(.rodata*)
1895 +    *(.rodata1)
1896 +    *.(eh_frame)
1897 +    *(.descriptors)
1898 +    *(rom_ver)
1899 +    _erodata = .;
1900 +
1901 +    /* Various possible names for the end of the .text section */
1902 +    etext = ALIGN(0x10);
1903 +    _etext = .;
1904 +    _endtext = .;
1905 +    text.end = .;
1906 +    PROVIDE (etext = .);
1907 +    PROVIDE (__etext = .);
1908 +
1909 +    /* 
1910 +     * .data section contents, copied to RAM at system startup. 
1911 +     */
1912 +    . = ALIGN(0x20);
1913 +    data.contents.start = .;
1914 +  }
1915 +  text.size = text.end - text.start;
1916 +
1917 +  /*
1918 +   * If debugging, stack the read/write sections directly after the text
1919 +   * section.  Otherwise, stack the read/write sections starting at base of
1920 +   * internal RAM.
1921 +   */
1922 +  . = DEFINED(RTEMS_DEBUG) ? . : int_ram_org;
1923
1924 +  .data : AT (data.contents.start)
1925 +  {
1926 +    data.start = .;
1927 +    
1928 +    *(.data)
1929 +    *(.data.*)
1930 +    *(.data1)
1931 +    
1932 +    PROVIDE (__SDATA_START__ = .);
1933 +    *(.sdata)
1934 +    *(.gnu.linkonce.d*)
1935 +    *(.gnu.linkonce.s.*)
1936 +    PROVIDE (__SDATA_END__ = .);
1937 +    
1938 +    PROVIDE (__EXCEPT_START__ = .);
1939 +    *(.gcc_except_table)
1940 +    PROVIDE (__EXCEPT_END__ = .);
1941 +    
1942 +    PROVIDE(__GOT_START__ = .);
1943 +    *(.got.plt) 
1944 +    *(.got)
1945 +    PROVIDE(__GOT_END__ = .);
1946 +       
1947 +    *(.got1)
1948 +    
1949 +    PROVIDE (__GOT2_START__ = .);
1950 +    PROVIDE (_GOT2_START_ = .);
1951 +    *(.got2)
1952 +    PROVIDE (__GOT2_END__ = .);
1953 +    PROVIDE (_GOT2_END_ = .);
1954 +       
1955 +    PROVIDE (__FIXUP_START__ = .);
1956 +    PROVIDE (_FIXUP_START_ = .);
1957 +    *(.fixup)
1958 +    PROVIDE (_FIXUP_END_ = .);
1959 +    PROVIDE (__FIXUP_END__ = .);
1960 +
1961 +    /*  We want the small data sections together, so single-instruction
1962 +     *   offsets can access them all.
1963 +     */
1964 +    PROVIDE (__SDATA2_START__ = .);
1965 +    *(.sdata2)
1966 +    *(.gnu.linkonce.s2.*)
1967 +    PROVIDE (__SDATA2_END__ = .);
1968 +
1969 +    data.end = .;
1970 +  }
1971 +  data.size = data.end - data.start;
1972 +       
1973 +  .bss :
1974 +  {
1975 +    bss.start = .;
1976 +       
1977 +    PROVIDE (__SBSS2_START__ = .);
1978 +    *(.sbss2)
1979 +    PROVIDE (__SBSS2_END__ = .);
1980 +       
1981 +    PROVIDE (__SBSS_START__ = .);
1982 +    *(.sbss)
1983 +    PROVIDE (__SBSS_END__ = .);
1984 +
1985 +    *(.bss) 
1986 +    *(COMMON)
1987 +
1988 +    . = ALIGN(4);
1989 +    bss.end = .;
1990 +  }
1991 +  bss.size = bss.end - bss.start;
1992 +
1993 +  PROVIDE(_end = bss.end);
1994 +
1995 +  /*
1996 +   * Initialization stack
1997 +   */
1998 +  InitStack_start = ALIGN(0x10);
1999 +  . += 0x1000;
2000 +  initStack = .;
2001 +  PROVIDE(initStackPtr = initStack);
2002 +
2003 +  /*
2004 +   * Interrupt stack
2005 +   */
2006 +  IntrStack_start = ALIGN(0x10);
2007 +  . += 0x4000;
2008 +  intrStack = .;
2009 +  PROVIDE(intrStackPtr = intrStack);
2010 +
2011 +  _WorkspaceBase = .;
2012 +  __WorkspaceBase = .;
2013 +       
2014 +  /*
2015 +   * Heap
2016 +   *
2017 +   * The heap is configured at run-time to use all available memory.  It
2018 +   * begins just after the end of the Workspace and continues to the end of
2019 +   * the external RAM.
2020 +   */
2021 +  . = DEFINED(RTEMS_DEBUG) ? 0 + ext_ram_size : int_ram_top + ext_ram_size;
2022 +  _HeapEnd = .;
2023 +  __HeapEnd = .;
2024
2025 +        
2026 +  /* 
2027 +   * Internal I/O devices 
2028 +   */
2029 +  .usiu 0x002FC000:            /* unified system interface unit */
2030 +  {
2031 +    usiu = .;
2032 +  }
2033 +
2034 +  .imb 0x00300000:             /* inter-module bus and devices */
2035 +  {
2036 +    imb = .;
2037 +  }
2038 +
2039 +  .sram 0x00380000:            /* internal SRAM control registers */
2040 +  {
2041 +    sram = .;
2042 +  }
2043 +
2044 +  /*
2045 +   * SS555 external devices managed by on-board CPLD
2046 +   */
2047 +  .cpld 0xFF000000:            /* SS555 external CPLD devices */
2048 +  {
2049 +    cpld = .;
2050 +  }
2051 +
2052 +
2053 +  /* Stabs debugging sections.  */
2054 +  .stab 0 : { *(.stab) }
2055 +  .stabstr 0 : { *(.stabstr) }
2056 +  .stab.excl 0 : { *(.stab.excl) }
2057 +  .stab.exclstr 0 : { *(.stab.exclstr) }
2058 +  .stab.index 0 : { *(.stab.index) }
2059 +  .stab.indexstr 0 : { *(.stab.indexstr) }
2060 +  .comment 0 : { *(.comment) }
2061 +  
2062 +  /* DWARF debug sections.
2063 +     Symbols in the DWARF debugging sections are relative to the beginning
2064 +     of the section so we begin them at 0.  */
2065 +  /* DWARF 1 */
2066 +  .debug          0 : { *(.debug) }
2067 +  .line           0 : { *(.line) }
2068 +  
2069 +  /* GNU DWARF 1 extensions */
2070 +  .debug_srcinfo  0 : { *(.debug_srcinfo) }
2071 +  .debug_sfnames  0 : { *(.debug_sfnames) }
2072 +  
2073 +  /* DWARF 1.1 and DWARF 2 */
2074 +  .debug_aranges  0 : { *(.debug_aranges) }
2075 +  .debug_pubnames 0 : { *(.debug_pubnames) }
2076 +  
2077 +  /* DWARF 2 */
2078 +  .debug_info     0 : { *(.debug_info) }
2079 +  .debug_abbrev   0 : { *(.debug_abbrev) }
2080 +  .debug_line     0 : { *(.debug_line) }
2081 +  .debug_frame    0 : { *(.debug_frame) }
2082 +  .debug_str      0 : { *(.debug_str) }
2083 +  .debug_loc      0 : { *(.debug_loc) }
2084 +  .debug_macinfo  0 : { *(.debug_macinfo) }
2085 +  
2086 +  /* SGI/MIPS DWARF 2 extensions */
2087 +  .debug_weaknames 0 : { *(.debug_weaknames) }
2088 +  .debug_funcnames 0 : { *(.debug_funcnames) }
2089 +  .debug_typenames 0 : { *(.debug_typenames) }
2090 +  .debug_varnames  0 : { *(.debug_varnames) }
2091 +  /* These must appear regardless of  .  */
2092 +}
2093 Index: rtems/c/src/lib/libbsp/powerpc/ec555/startup/start.S
2094 ===================================================================
2095 --- /dev/null
2096 +++ rtems/c/src/lib/libbsp/powerpc/ec555/startup/start.S
2097 @@ -0,0 +1,411 @@
2098 +/*  start.S
2099 + *
2100 + *  This file contains the entry veneer for RTEMS programs on the Intec
2101 + *  SS555 board.  It jumps to the BSP which is responsible for performing
2102 + *  all remaining initialization.
2103 + *
2104 + * This file is based on several others:
2105 + *
2106 + * (1) start360.s from the gen68360 BSP by
2107 + *     W. Eric Norum (eric@skatter.usask.ca)
2108 + *     with the following copyright and license:
2109 + *
2110 + *     COPYRIGHT (c) 1989-1998.
2111 + *     On-Line Applications Research Corporation (OAR).
2112 + *
2113 + *     The license and distribution terms for this file may in
2114 + *     the file LICENSE in this distribution or at
2115 + *     http://www.rtems.com/license/LICENSE.
2116 + *
2117 + * (2) start.s for the eth_comm port by
2118 + *     Jay Monkman (jmonkman@fracsa.com),
2119 + *     which itself is based on the
2120 + *
2121 + * (3) dlentry.s for the Papyrus BSP, written by:
2122 + *     Andrew Bray <andy@i-cubed.co.uk>
2123 + *     with the following copyright and license:
2124 + *
2125 + *     COPYRIGHT (c) 1995 by i-cubed ltd.
2126 + *
2127 + * (4) start860.S for the MBX821/MBX860, written by:
2128 + *     Darlene A. Stewart <darlene.stewart@iit.nrc.ca>
2129 + *     Copyright (c) 1999, National Research Council of Canada
2130 + *
2131 + *     To anyone who acknowledges that this file is provided "AS IS"
2132 + *     without any express or implied warranty:
2133 + *         permission to use, copy, modify, and distribute this file
2134 + *         for any purpose is hereby granted without fee, provided that
2135 + *         the above copyright notice and this notice appears in all
2136 + *         copies, and that the name of i-cubed limited not be used in
2137 + *         advertising or publicity pertaining to distribution of the
2138 + *         software without specific, written prior permission.
2139 + *         i-cubed limited makes no representations about the suitability
2140 + *         of this software for any purpose.
2141 + *
2142 + * (5) Modifications (for MBX8xx) of respective RTEMS files:
2143 + *     Copyright (c) 1999, National Research Council of Canada
2144 + *
2145 + * SS555 port sponsored by Defence Research and Development Canada - Suffield
2146 + * Copyright (C) 2004, Real-Time Systems Inc. (querbach@realtime.bc.ca)
2147 + */
2148 +
2149 +#include <rtems/asm.h>
2150 +#include <rtems/powerpc/registers.h>
2151 +
2152 +/*
2153 + *  The initial stack is set to the top of the internal RAM.
2154 + *
2155 + *  All the entry veneer has to do is to clear the .bss section and copy the
2156 + *  initializers into the .data section.
2157 + */
2158 +
2159 +/*
2160 + *  GDB likes to have debugging information for the entry veneer.
2161 + *  Play compiler and provide some DWARF information.
2162 + *
2163 + *  CHANGE TO SUIT YOUR SETUP!
2164 + */
2165 +
2166 +        .section .entry,"ax",@progbits
2167 +.L_text_b:
2168 +.L_LC1:
2169 +       .previous
2170 +
2171 +.section       .debug_sfnames
2172 +.L_sfnames_b:
2173 +       .byte "rtems/c/src/lib/libbsp/powerpc/ss555/startup/"
2174 +       .byte 0
2175 +.L_F0:
2176 +       .byte "start.S"
2177 +       .byte 0
2178 +       .previous
2179 +
2180 +.section       .line
2181 +.L_line_b:
2182 +       .4byte  .L_line_e-.L_line_b
2183 +       .4byte  .L_text_b
2184 +.L_LE1:
2185 +.L_line_last:
2186 +       .4byte  0x0
2187 +       .2byte  0xffff
2188 +       .4byte  .L_text_e-.L_text_b
2189 +.L_line_e:
2190 +       .previous
2191 +
2192 +.section       .debug_srcinfo
2193 +.L_srcinfo_b:
2194 +       .4byte  .L_line_b
2195 +       .4byte  .L_sfnames_b
2196 +       .4byte  .L_text_b
2197 +       .4byte  .L_text_e
2198 +       .4byte  0xffffffff
2199 +       .4byte  .L_LE1-.L_line_b
2200 +       .4byte  .L_F0-.L_sfnames_b
2201 +       .4byte  .L_line_last-.L_line_b
2202 +       .4byte  0xffffffff
2203 +       .previous
2204 +
2205 +.section       .debug_pubnames
2206 +       .4byte  .L_debug_b
2207 +       .4byte  .L_P0
2208 +       .byte "start"
2209 +       .byte 0
2210 +       .4byte  0x0
2211 +       .byte 0
2212 +       .previous
2213 +
2214 +.section       .debug_aranges
2215 +       .4byte  .L_debug_b
2216 +       .4byte  .L_text_b
2217 +       .4byte  .L_text_e-.L_text_b
2218 +       .4byte  0
2219 +       .4byte  0
2220 +       .4byte  0
2221 +       .4byte  0
2222 +       .4byte  0
2223 +       .4byte  0
2224 +       .4byte  0x0
2225 +       .4byte  0x0
2226 +       .previous
2227 +
2228 +.section       .debug
2229 +.L_debug_b:
2230 +.L_D1:
2231 +       .4byte  .L_D1_e-.L_D1
2232 +       .2byte  0x11    /* TAG_compile_unit */
2233 +       .2byte  0x12    /* AT_sibling */
2234 +       .4byte  .L_D2
2235 +       .2byte  0x38    /* AT_name */
2236 +       .byte "start.S"
2237 +       .byte 0
2238 +       .2byte  0x258   /* AT_producer */
2239 +       .byte "GAS 2.5.2"
2240 +       .byte 0
2241 +       .2byte  0x111   /* AT_low_pc */
2242 +       .4byte  .L_text_b
2243 +       .2byte  0x121   /* AT_high_pc */
2244 +       .4byte  .L_text_e
2245 +       .2byte  0x106   /* AT_stmt_list */
2246 +       .4byte  .L_line_b
2247 +       .2byte  0x1b8   /* AT_comp_dir */
2248 +       .byte "rtems/c/src/lib/libbsp/powerpc/ss555/startup/"
2249 +       .byte 0
2250 +       .2byte  0x8006  /* AT_sf_names */
2251 +       .4byte  .L_sfnames_b
2252 +       .2byte  0x8016  /* AT_src_info */
2253 +       .4byte  .L_srcinfo_b
2254 +.L_D1_e:
2255 +.L_P0:
2256 +.L_D3:
2257 +       .4byte  .L_D3_e-.L_D3
2258 +       .2byte  0x6     /* TAG_global_subroutine */
2259 +       .2byte  0x12    /* AT_sibling */
2260 +       .4byte  .L_D4
2261 +       .2byte  0x38    /* AT_name */
2262 +       .byte "start"
2263 +       .byte 0
2264 +       .2byte  0x278   /* AT_prototyped */
2265 +       .byte 0
2266 +       .2byte  0x111   /* AT_low_pc */
2267 +       .4byte  .L_text_b
2268 +       .2byte  0x121   /* AT_high_pc */
2269 +       .4byte  .L_text_e
2270 +       .2byte  0x8041  /* AT_body_begin */
2271 +       .4byte  .L_text_b
2272 +       .2byte  0x8051  /* AT_body_end */
2273 +       .4byte  .L_text_e
2274 +.L_D3_e:
2275 +
2276 +.L_D4:
2277 +       .4byte  .L_D4_e-.L_D4
2278 +       .align 2
2279 +.L_D4_e:
2280 +.L_D2:
2281 +       .previous
2282 +
2283 +/*
2284 + * Tell C's eabi-ctor's that we have an atexit function,
2285 + * and that it is to register __do_global_dtors.
2286 + */
2287 +       EXTERN_PROC(atexit)
2288 +       PUBLIC_VAR(__atexit)
2289 +       .section ".sdata","aw"
2290 +       .align  2
2291 +SYM(__atexit):
2292 +       EXT_PROC_REF(atexit)@fixup
2293 +       .previous
2294 +
2295 +       .section ".fixup","aw"
2296 +       .align  2
2297 +       EXT_SYM_REF(__atexit)
2298 +       .previous
2299 +
2300 +/* That should do it */
2301 +
2302 +/*
2303 + *  Put the entry point in its own section. That way, we can guarantee
2304 + *  to put it first in the .text section in the linker script.
2305 + */
2306 +        .section .entry
2307 +
2308 +        PUBLIC_VAR (start)
2309 +SYM(start):
2310 +        bl      .startup       /* or bl .spin */
2311 +base_addr:
2312 +
2313 +/*
2314 + * Parameters from linker
2315 + */
2316 +stack_top:
2317 +       .long   initStackPtr
2318 +
2319 +toc_pointer:
2320 +        .long   __GOT_START__
2321 +
2322 +bss_length:
2323 +        .long   bss.size
2324 +bss_addr:
2325 +        .long   bss.start
2326 +
2327 +data_length:
2328 +        .long   data.size
2329 +data_addr:
2330 +        .long   data.start
2331 +contents_addr:
2332 +        .long   data.contents.start
2333 +
2334 +PUBLIC_VAR (text_addr)
2335 +text_addr:
2336 +        .long   text.start
2337 +
2338 +PUBLIC_VAR (text_length)
2339 +text_length:
2340 +        .long   text.size
2341 +
2342 +/*
2343 + * Spin, if necessary, to acquire control from debugger (CodeWarrior).
2344 + */
2345 +spin:
2346 +       .long   0x0001
2347 +.spin:
2348 +       lis     r3, spin@ha
2349 +       lwz     r3, spin@l(r3)
2350 +       cmpwi   r3, 0x1
2351 +       beq     .spin
2352 +
2353 +/*
2354 + * Initialization code
2355 + */
2356 +.startup:
2357 +        /* Capture address of linker parameters. */
2358 +        mflr    r3
2359 +
2360 +       /* Set initial stack pointer to end of internal RAM - 56. */
2361 +       lwz     r1, stack_top-base_addr(r3)
2362 +        addi    r1, r1, -56
2363 +
2364 +        /* Initialize essential registers. */
2365 +        bl      initregs
2366 +
2367 +        /* Set TOC pointer */
2368 +        lwz r2, toc_pointer-base_addr(r3)
2369 +
2370 +        /* Initialize the memory mapped MPC555 registers (done in C). */
2371 +        EXTERN_PROC (_InitSS555)
2372 +        bl     PROC (_InitSS555)
2373 +
2374 +        /* Clear the .bss section. */
2375 +        bl      bssclr
2376 +
2377 +       /* Copy initializers into the .data section */
2378 +       bl      datacopy
2379 +
2380 +       /* Enable floating point, since gcc sometimes uses the floating
2381 +        * point registers for data moves, even if the C source code doesn't
2382 +        * include floating point operations.
2383 +        */
2384 +       mfmsr   r0
2385 +       ori     r0, r0, MSR_FP
2386 +       mtmsr   r0
2387 +
2388 +       /* Start system. */
2389 +       lis     r5, environ@ha
2390 +       la      r5,environ@l(r5)        /* environp */
2391 +       li      r4, 0                   /* argv */
2392 +       li      r3, 0                   /* argc */
2393 +        EXTERN_PROC (boot_card)
2394 +        bl       PROC (boot_card)      /* call the first C routine */
2395 +
2396 +        /* We should never return from boot_card, but in case we do ... */
2397 +       /* The next instructions are dependent on your runtime environment. */
2398 +
2399 +stop_here:
2400 +       b       stop_here
2401 +
2402 +/*
2403 + * datacopy - copy initializers into .data section
2404 + */
2405 +datacopy:
2406 +       lis     r3, base_addr@ha                /* point to linker data */
2407 +       addi    r3, r3, base_addr@l
2408 +
2409 +        lwz     r4, contents_addr-base_addr(r3) /* .data contents in ROM */
2410 +        lwz     r5, data_addr-base_addr(r3)     /* .data section in RAM */
2411 +        lwz     r6, data_length-base_addr(r3)   /* length of .data */
2412 +
2413 +        rlwinm. r6, r6, 30, 0x3FFFFFFF          /* form length / 4 */
2414 +        beqlr                                   /* no .data - return */
2415 +
2416 +        mtctr   r6                              /* set ctr reg */
2417 +dc1:
2418 +       lwz     r6, 0(r4)                       /* get word */
2419 +        stw     r6, 0(r5)                       /* store word */
2420 +        addi    r4, r4, 0x4                     /* next source */
2421 +        addi    r5, r5, 0x4                     /* next target */
2422 +        bdnz    dc1                             /* dec counter and loop */
2423 +
2424 +        blr                                     /* return */
2425 +
2426 +/*
2427 + * bssclr - zero out bss
2428 + */
2429 +bssclr:
2430 +       lis     r3, base_addr@ha                /* point to linker data */
2431 +       addi    r3, r3, base_addr@l
2432 +
2433 +        lwz     r4, bss_addr-base_addr(r3)      /* Start of bss */
2434 +        lwz     r5, bss_length-base_addr(r3)    /* Length of bss */
2435 +
2436 +        rlwinm. r5, r5, 30, 0x3FFFFFFF          /* form length/4 */
2437 +        beqlr                                   /* no bss - return */
2438 +
2439 +        mtctr   r5                              /* set ctr reg */
2440 +        li      r5, 0x0000                      /* r5 = 0 */
2441 +clear_bss:
2442 +        stw     r5, 0(r4)                       /* store r6 */
2443 +        addi    r4, r4, 0x4                     /* update r4 */
2444 +        bdnz    clear_bss                       /* dec counter and loop */
2445 +
2446 +        blr                                     /* return */
2447 +
2448 +/*
2449 + * initregs
2450 + *     Initialize the MSR and basic core PowerPC registers
2451 + *
2452 + * Register usage:
2453 + *     r0 - scratch
2454 + */
2455 +initregs:
2456 +       /*
2457 +        * Set the processor for big-endian mode, exceptions vectored to
2458 +        * 0x000n_nnnn, no execution tracing, machine check exceptions
2459 +        * enabled, floating-point not available, supervisor priviledge
2460 +        * level, external interrupts disabled, power management disabled
2461 +        * (normal operation mode).
2462 +        */
2463 +       li      r0, 0x1000      /* MSR_ME */
2464 +       mtmsr   r0              /* Context-synchronizing */
2465 +       isync
2466 +
2467 +       /*
2468 +        * Clear the exception handling registers.
2469 +        */
2470 +       li      r0, 0x0000
2471 +       mtdar   r0
2472 +       mtspr   sprg0, r0
2473 +       mtspr   sprg1, r0
2474 +       mtspr   sprg2, r0
2475 +       mtspr   sprg3, r0
2476 +       mtspr   srr0, r0
2477 +       mtspr   srr1, r0
2478 +
2479 +       mr      r6, r0
2480 +       mr      r7, r0
2481 +       mr      r8, r0
2482 +       mr      r9, r0
2483 +       mr      r10, r0
2484 +       mr      r11, r0
2485 +       mr      r12, r0
2486 +       mr      r13, r0
2487 +       mr      r14, r0
2488 +       mr      r15, r0
2489 +       mr      r16, r0
2490 +       mr      r17, r0
2491 +       mr      r18, r0
2492 +       mr      r19, r0
2493 +       mr      r20, r0
2494 +       mr      r21, r0
2495 +       mr      r22, r0
2496 +       mr      r23, r0
2497 +       mr      r24, r0
2498 +       mr      r25, r0
2499 +       mr      r26, r0
2500 +       mr      r27, r0
2501 +       mr      r28, r0
2502 +       mr      r29, r0
2503 +       mr      r30, r0
2504 +       mr      r31, r0
2505 +
2506 +       blr                     /* return */
2507 +
2508 +.L_text_e:
2509 Index: rtems/c/src/lib/libbsp/powerpc/ec555/startup/tm27supp.c
2510 ===================================================================
2511 --- /dev/null
2512 +++ rtems/c/src/lib/libbsp/powerpc/ec555/startup/tm27supp.c
2513 @@ -0,0 +1,29 @@
2514 +/*
2515 + *  Support routines for TM27
2516 + *
2517 + *  $Id: tm27supp.c,v 1.1 2004/04/21 20:24:36 joel Exp $
2518 + */
2519 +
2520 +#include <bsp.h>
2521 +
2522 +void tm27On()                                                          
2523 +{                                                                      
2524 +}                                                                      
2525 +                                                                       
2526 +void tm27Off()                                                         
2527 +{                                                                      
2528 +}                                                                      
2529 +                                                                       
2530 +int tm27IsOn()                                                         
2531 +{                                                                      
2532 +  return 1;                                                            
2533 +}                                                                      
2534 +                                                                       
2535 +rtems_irq_connect_data tm27IrqData = {                                 
2536 +  CPU_USIU_EXT_IRQ_7,                                                  
2537 +  (rtems_irq_hdl)0,                                                    
2538 +  (rtems_irq_enable)tm27On,                                            
2539 +  (rtems_irq_disable)tm27Off,                                          
2540 +  (rtems_irq_is_enabled)tm27IsOn                                       
2541 +};
2542 +
2543 Index: rtems/c/src/lib/libbsp/powerpc/ec555/times
2544 ===================================================================
2545 --- /dev/null
2546 +++ rtems/c/src/lib/libbsp/powerpc/ec555/times
2547 @@ -0,0 +1,189 @@
2548 +#
2549 +#  Timing Test Suite Results for the Intec SS555
2550 +#
2551 +#  $Id: times,v 1.1 2004/04/12 21:52:13 joel Exp $
2552 +#
2553 +
2554 +Board: SS555
2555 +CPU: MPC555
2556 +Clock Speed: 40 MHz
2557 +Memory Configuration: 512k external 2-1-1-1 SRAM
2558 +Wait States: 0
2559 +
2560 +Times Reported in: microseconds
2561 +Timer Source: Timebase register (TMBCLK = (4 MHz crystal / 4) = 1.0 Mhz)
2562 +
2563 +#                          DESCRIPTION                                  A       B
2564 +== =================================================================   ====    ====
2565 +
2566 + 1 rtems_semaphore_create                                               21
2567 +   rtems_semaphore_delete                                               22
2568 +   rtems_semaphore_obtain: available                                     7
2569 +   rtems_semaphore_obtain: not available -- NO_WAIT                      7
2570 +   rtems_semaphore_release: no waiting tasks                            18
2571 +
2572 + 2 rtems_semaphore_obtain: not available -- caller blocks               50
2573 +
2574 + 3 rtems_semaphore_release: task readied -- preempts caller             41
2575 +
2576 + 4 rtems_task_restart: blocked task -- preempts caller                  69
2577 +   rtems_task_restart: ready task -- preempts caller                    67
2578 +   rtems_semaphore_release: task readied -- returns to caller           23
2579 +   rtems_task_create                                                    75
2580 +   rtems_task_start                                                     30
2581 +   rtems_task_restart: suspended task -- returns to caller              37
2582 +   rtems_task_delete: suspended task                                    68
2583 +   rtems_task_restart: ready task -- returns to caller                  38
2584 +   rtems_task_restart: blocked task -- returns to caller                44
2585 +   rtems_task_delete: blocked task                                      70
2586 +
2587 + 5 rtems_task_suspend: calling task                                     40
2588 +   rtems_task_resume: task readied -- preempts caller                   35
2589 +
2590 + 6 rtems_task_restart: calling task                                     46
2591 +   rtems_task_suspend: returns to caller                                16
2592 +   rtems_task_resume: task readied -- returns to caller                 18
2593 +   rtems_task_delete: ready task                                        71
2594 +
2595 + 7 rtems_task_restart: suspended task -- preempts caller                64
2596 +
2597 + 8 rtems_task_set_priority: obtain current priority                     13
2598 +   rtems_task_set_priority: returns to caller                           24
2599 +   rtems_task_mode: obtain current mode                                  4
2600 +   rtems_task_mode: no reschedule                                        5
2601 +   rtems_task_mode: reschedule -- returns to caller                      7
2602 +   rtems_task_mode: reschedule -- preempts caller                       37
2603 +   rtems_task_set_note                                                  13
2604 +   rtems_task_get_note                                                  13
2605 +   rtems_clock_set                                                      27
2606 +   rtems_clock_get                                                       1
2607 +
2608 + 9 rtems_message_queue_create                                           34
2609 +   rtems_message_queue_send: no waiting tasks                           26
2610 +   rtems_message_queue_urgent: no waiting tasks                         26
2611 +   rtems_message_queue_receive: available                               24
2612 +   rtems_message_queue_flush: no messages flushed                       12
2613 +   rtems_message_queue_flush: messages flushed                          15
2614 +   rtems_message_queue_delete                                           26
2615 +
2616 +10 rtems_message_queue_receive: not available -- NO_WAIT                15
2617 +   rtems_message_queue_receive: not available -- caller blocks          52
2618 +
2619 +11 rtems_message_queue_send: task readied -- preempts caller            47
2620 +
2621 +12 rtems_message_queue_send: task readied -- returns to caller          29
2622 +
2623 +13 rtems_message_queue_urgent: task readied -- preempts caller          46
2624 +
2625 +14 rtems_message_queue_urgent: task readied -- returns to caller        29
2626 +
2627 +15 rtems_event_receive: obtain current events                            1
2628 +   rtems_event_receive: not available -- NO_WAIT                        12
2629 +   rtems_event_receive: not available -- caller blocks                  44
2630 +   rtems_event_send: no task readied                                    13
2631 +   rtems_event_receive: available                                       13
2632 +   rtems_event_send: task readied -- returns to caller                  21
2633 +
2634 +16 rtems_event_send: task readied -- preempts caller                    41
2635 +
2636 +17 rtems_task_set_priority: preempts caller                             49
2637 +
2638 +18 rtems_task_delete: calling task                                      95
2639 +
2640 +19 rtems_signal_catch                                                   10
2641 +   rtems_signal_send: returns to caller                                 15
2642 +   rtems_signal_send: signal to self                                    20
2643 +   exit ASR overhead: returns to calling task                           15
2644 +   exit ASR overhead: returns to preempting task                        30
2645 +
2646 +20 rtems_partition_create                                               25
2647 +   rtems_region_create                                                  38
2648 +   rtems_partition_get_buffer: available                                14
2649 +   rtems_partition_get_buffer: not available                            13
2650 +   rtems_partition_return_buffer                                        15
2651 +   rtems_partition_delete                                               16
2652 +   rtems_region_get_segment: available                                  34
2653 +   rtems_region_get_segment: not available -- NO_WAIT                   32
2654 +   rtems_region_return_segment: no waiting tasks                        33
2655 +   rtems_region_get_segment: not available -- caller blocks             68
2656 +   rtems_region_return_segment: task readied -- preempts caller         67
2657 +   rtems_region_return_segment: task readied -- returns to caller       48
2658 +   rtems_region_delete                                                  30
2659 +   rtems_io_initialize                                                   2
2660 +   rtems_io_open                                                         1
2661 +   rtems_io_close                                                        1
2662 +   rtems_io_read                                                         1
2663 +   rtems_io_write                                                        1
2664 +   rtems_io_control                                                      1
2665 +
2666 +21 rtems_task_ident                                                     25
2667 +   rtems_message_queue_ident                                            22
2668 +   rtems_semaphore_ident                                                29
2669 +   rtems_partition_ident                                                22
2670 +   rtems_region_ident                                                   24
2671 +   rtems_port_ident                                                     22
2672 +   rtems_timer_ident                                                    22
2673 +   rtems_rate_monotonic_ident                                           22
2674 +
2675 +22 rtems_message_queue_broadcast: task readied -- returns to caller     33
2676 +   rtems_message_queue_broadcast: no waiting tasks                      20
2677 +   rtems_message_queue_broadcast: task readied -- preempts caller       50
2678 +
2679 +23 rtems_timer_create                                                   13
2680 +   rtems_timer_fire_after: inactive                                     22
2681 +   rtems_timer_fire_after: active                                       24
2682 +   rtems_timer_cancel: active                                           13
2683 +   rtems_timer_cancel: inactive                                         12
2684 +   rtems_timer_reset: inactive                                          21
2685 +   rtems_timer_reset: active                                            22
2686 +   rtems_timer_fire_when: inactive                                      26
2687 +   rtems_timer_fire_when: active                                        26
2688 +   rtems_timer_delete: active                                           18
2689 +   rtems_timer_delete: inactive                                         16
2690 +   rtems_task_wake_when                                                 49
2691 +
2692 +24 rtems_task_wake_after: yield -- returns to caller                    10
2693 +   rtems_task_wake_after: yields -- preempts caller                     36
2694 +
2695 +25 rtems_clock_tick                                                      8
2696 +
2697 +26 _ISR_Disable                                                          1
2698 +   _ISR_Flash                                                            1
2699 +   _ISR_Enable                                                           1
2700 +   _Thread_Disable_dispatch                                              1
2701 +   _Thread_Enable_dispatch                                               7
2702 +   _Thread_Set_state                                                     7
2703 +   _Thread_Disptach (NO FP)                                             32
2704 +   context switch: no floating point contexts                           25
2705 +   context switch: self                                                 11
2706 +   context switch: to another task                                      12
2707 +   fp context switch: restore 1st FP task                               37
2708 +   fp context switch: save idle, restore initialized                    34
2709 +   fp context switch: save idle, restore idle                           48
2710 +   fp context switch: save initialized, restore initialized             34
2711 +   _Thread_Resume                                                        7
2712 +   _Thread_Unblock                                                       6
2713 +   _Thread_Ready                                                         7
2714 +   _Thread_Get                                                           4
2715 +   _Semaphore_Get                                                        2
2716 +   _Thread_Get: invalid id                                               1
2717 +
2718 +27 interrupt entry overhead: returns to interrupted task                13
2719 +   interrupt exit overhead: returns to interrupted task                 11
2720 +   interrupt entry overhead: returns to nested interrupt                12
2721 +   interrupt exit overhead: returns to nested interrupt                 10
2722 +   interrupt entry overhead: returns to preempting task                 12
2723 +   interrupt exit overhead: returns to preempting task                  38
2724 +
2725 +28 rtems_port_create                                                    16
2726 +   rtems_port_external_to_internal                                      11
2727 +   rtems_port_internal_to_external                                      11
2728 +   rtems_port_delete                                                    16
2729 +
2730 +29 rtems_rate_monotonic_create                                          15
2731 +   rtems_rate_monotonic_period: initiate period -- returns to caller    20
2732 +   rtems_rate_monotonic_period: obtain status                           12
2733 +   rtems_rate_monotonic_cancel                                          15
2734 +   rtems_rate_monotonic_delete: inactive                                18
2735 +   rtems_rate_monotonic_delete: active                                  20
2736 +   rtems_rate_monotonic_period: conclude periods -- caller blocks       36
2737 Index: rtems/make/custom/ec555.cfg
2738 ===================================================================
2739 --- /dev/null
2740 +++ rtems/make/custom/ec555.cfg
2741 @@ -0,0 +1,49 @@
2742 +#
2743 +#  Config file for an Intec Automation SS555 MPC555-based card
2744 +#
2745 +#  This file is derived from:
2746 +#
2747 +#  Config file for a PowerPC MPC860-based MBX821-001 card.
2748 +#  Config file for a PowerPC 403 based helas403 card
2749 +#  Config file for MPC860 based Ethernet Comm Board
2750 +#
2751 +
2752 +include $(RTEMS_ROOT)/make/custom/default.cfg
2753 +
2754 +RTEMS_CPU=powerpc
2755 +GCC_CPU_MODEL=505
2756 +RTEMS_CPU_MODEL=mpc555
2757 +
2758 +# This is the actual bsp directory used during the build process.
2759 +RTEMS_BSP_FAMILY=ss555
2760 +
2761 +#  This contains the compiler options necessary to select the CPU model
2762 +#  and (hopefully) optimize for it.
2763 +#
2764 +CPU_CFLAGS = -mcpu=$(GCC_CPU_MODEL) -D$(RTEMS_CPU_MODEL) -D$(RTEMS_BSP_FAMILY)
2765 +
2766 +# Debugging flags:  If we debug with optimization on, single-stepping
2767 +# sometimes looks a little odd, but there won't be any surprises later.
2768 +CFLAGS_DEBUG_V += -O4 -ggdb
2769 +CXXFLAGS_DEBUG_V += -O4 -ggdb
2770 +
2771 +# optimize flag: typically -O, could use -O4 or -fast
2772 +# -O4 is ok for RTEMS
2773 +# NOTE: some level of -O may be actually required by inline assembler
2774 +CFLAGS_OPTIMIZE_V=-O4 -fno-keep-inline-functions
2775 +CXXFLAGS_OPTIMIZE_V=-O4
2776 +
2777 +define make-exe
2778 +       $(LINK.c) $(AM_CFLAGS) $(AM_LDFLAGS) $(SS555_LDFLAGS) \
2779 +           -o $(basename $@)_sym.exe $(LINK_OBJS) $(LINK_LIBS)
2780 +       $(NM) -g -n $(basename $@)_sym.exe > $(basename $@).nm
2781 +       cp $(basename $@)_sym.exe $(basename $@).exe 
2782 +       $(STRIP) $(basename $@).exe
2783 +       $(SIZE) $(basename $@)_sym.exe
2784 +endef
2785 +
2786 +# Miscellaneous additions go here
2787 +
2788 +# Override default start file
2789 +START_BASE=
2790 +