Changeset 4a238002 in rtems for c/src/lib/libbsp/sh


Ignore:
Timestamp:
11/18/99 21:22:58 (24 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
97c465c
Parents:
5503d75
Message:

Patch from "John M. Mills" <jmills@…> with subsequent cleanup from
Ralf Corsepius <corsepiu@…> that adds initial Hitachi SH-2
support to RTEMS. Ralf's comments are:

Changes:
------

  1. SH-Port:
  • Many files renamed.
  • CONSOLE_DEVNAME and MHZ defines removed from libcpu.
  • console.c moved to libbsp/sh/shared, build in libbsp/sh/<BSP>/console applying VPATH.
  • CONSOLE_DEVNAME made BSP-specific, replacement is defined in bsp.h
  • MHZ define replaced with HZ (extendent resolution) in custom/*.cfg
  • -DHZ=HZ used in bspstart.c, only
  • Makefile variable HZ used in bsp-dependent directories only.
  1. SH1-Port
  • clock-driver rewritten to provide better resolution for odd CPU frequencies. This driver is only partially tested on hardware, ie. sightly experimental, but I don't expect severe problems with it.
  • Polling SCI-driver added. This driver is experimental and completly untested yet. Therefore it is not yet used for the console (/dev/console is still pointing to /dev/null, cf. gensh1/bsp.h).
  • minor changes to the timer driver
  • SH1 specific delay()/CPU_delay() now is implemented as a function
  1. SH2-Port
  • Merged
  • IMO, the code is still in its infancy. Therefore I have interspersed comments (FIXME) it for items which I think John should look after.
  • sci and console drivers partially rewritten and extended (John, I hope you don't mind).
  • Copyright notices are not yet adapted
Location:
c/src/lib/libbsp/sh
Files:
19 added
6 edited
1 moved

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/sh/gensh1/Makefile.in

    r5503d75 r4a238002  
    2121# wrapup is the one that actually builds and installs the library
    2222#  from the individual .rel files built in other directories
    23 SUB_DIRS = include start startup scitab wrapup
     23SUB_DIRS = include start startup scitab console wrapup
    2424
    2525Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
  • c/src/lib/libbsp/sh/gensh1/README

    r5503d75 r4a238002  
    4646=====
    4747
    48 (1) Only stub console driver available at the moment.
    49     Driver for the on-chip serial devices (sci) will be available soon.
     48(1) The stub console driver (null) is enabled by default.
    5049
     50(2) The driver for the on-chip serial devices (sci) is still in its infancy
     51    and not fully tested. It may even be non-functional and therefore is
     52    disabled by default. Please let us know any problems you encounter with
     53    it.
     54    To activate it edit libbsp/sh/gensh1/include/bsp.h
  • c/src/lib/libbsp/sh/gensh1/include/bsp.h

    r5503d75 r4a238002  
    3131#endif
    3232
    33 #define CPU_CONSOLE_DEVNAME "/dev/null"
    34 
    35 
    3633#include <rtems.h>
    3734#include <clockdrv.h>
     35#include <console.h>
     36
     37/* EDIT: To activate the sci driver, change the define below */
     38#if 1
    3839#include <sh/null.h>
    39 #include <console.h>
     40#define BSP_CONSOLE_DEVNAME "/dev/null"
     41#define BSP_CONSOLE_DRIVER_TABLE_ENTRY DEVNULL_DRIVER_TABLE_ENTRY
     42#else
     43#include <sh/sci.h>
     44#define BSP_CONSOLE_DEVNAME "/dev/sci0"
     45#define BSP_CONSOLE_DRIVER_TABLE_ENTRY DEVSCI_DRIVER_TABLE_ENTRY
     46#endif
     47
    4048
    4149/*
     
    6977
    7078/* Constants */
    71 #ifndef MHZ
    72 #error Missing MHZ
    73 #endif
    7479
    7580/*
    7681 *  Simple spin delay in microsecond units for device drivers.
    7782 *  This is very dependent on the clock speed of the target.
    78  *
    79  *  Since we don't have a real time clock, this is a very rough
    80  *  approximation, assuming that each cycle of the delay loop takes
    81  *  approx. 4 machine cycles.
    82  *
    83  *  e.g.: MHZ = 20 =>     5e-8 secs per instruction
    84  *                 => 4 * 5e-8 secs per delay loop
    8583 */
    8684
    87 #define delay( microseconds ) \
    88 { register unsigned int _delay = (microseconds) * (MHZ / 4 ); \
    89   asm volatile ( \
    90 "0:     add  #-1,%0\n \
    91         nop\n \
    92         cmp/pl %0\n \
    93         bt 0b\
    94         nop" \
    95     :: "r" (_delay) );  \
    96 }
    97 
    98 /*
    99  * For backward compatibility only.
    100  * Do not rely on them being present in future
    101  */
    102 #define CPU_delay( microseconds ) delay( microseconds )
    103 #define sh_delay( microseconds ) delay( microseconds )
     85#define delay( microseconds ) CPU_delay(microseconds)
     86#define sh_delay( microseconds ) CPU_delay(microseconds)
    10487
    10588/*
     
    129112 * We redefine CONSOLE_DRIVER_TABLE_ENTRY to redirect /dev/console
    130113 */
    131 #if defined(CONSOLE_DRIVER_TABLE_ENTRY)
    132 #warning Overwriting CONSOLE_DRIVER_TABLE_ENTRY
    133114#undef CONSOLE_DRIVER_TABLE_ENTRY
    134 #endif
    135 
    136115#define CONSOLE_DRIVER_TABLE_ENTRY \
    137   DEVNULL_DRIVER_TABLE_ENTRY, \
     116  BSP_CONSOLE_DRIVER_TABLE_ENTRY, \
    138117  { console_initialize, console_open, console_close, \
    139118      console_read, console_write, console_control }
     
    143122 */
    144123
    145 /*
    146  * FIXME: Should this go to libcpu/sh/sh7032 ?
    147  */
    148 #if 0
    149 /* functions */
    150 sh_isr_entry set_vector(                    /* returns old vector */
    151   rtems_isr_entry     handler,                  /* isr routine        */
    152   rtems_vector_number vector,                   /* vector number      */
    153   int                 type                      /* RTEMS or RAW intr  */
    154 );
    155 #endif
    156 
    157124#ifdef __cplusplus
    158125}
  • c/src/lib/libbsp/sh/gensh1/scitab/Makefile.in

    r5503d75 r4a238002  
    6565
    6666scitab.c: $(SHGEN)
    67         $(SHGEN) -M $(MHZ) sci > $@
     67        $(SHGEN) -H $(HZ) sci > $@
    6868
    6969# the .rel file built here will be put into libbsp.a by ../wrapup/Makefile
  • c/src/lib/libbsp/sh/gensh1/startup/bspstart.c

    r5503d75 r4a238002  
    127127  Cpu_table.pretasking_hook = bsp_pretasking_hook;  /* init libc, etc. */
    128128  Cpu_table.postdriver_hook = bsp_postdriver_hook;
    129 
     129 
    130130#if ( CPU_ALLOCATE_INTERRUPT_STACK == TRUE )
    131131  Cpu_table.interrupt_stack_size = 4096;
    132132#endif
    133 
     133  Cpu_table.clicks_per_second = HZ ;
    134134}
  • c/src/lib/libbsp/sh/gensh1/wrapup/Makefile.in

    r5503d75 r4a238002  
    1616VPATH = @srcdir@
    1717
    18 BSP_PIECES = startup scitab
     18BSP_PIECES = startup scitab console
    1919GENERIC_PIECES =
    2020
    2121# pieces to pick up out of libcpu/sh
    22 CPU_PIECES = sh7032/null sh7032/clock sh7032/console sh7032/timer
     22CPU_PIECES = sh7032/null sh7032/clock sh7032/timer sh7032/sci sh7032/delay
    2323
    2424# bummer; have to use $foreach since % pattern subst rules only replace 1x
     
    6262        $(make-library)
    6363
    64 all: ${ARCH} $(SRCS) $(LIB)
    65         $(INSTALL_VARIANT) -m 644 $(LIB) $(PROJECT_RELEASE)/lib
     64$(PROJECT_RELEASE)/lib/libbsp$(LIBSUFFIX_VA): $(LIB)
     65        $(INSTALL_DATA) $^ $@
     66
     67all: ${ARCH} $(SRCS) $(PROJECT_RELEASE)/lib/libbsp$(LIBSUFFIX_VA)
    6668
    6769install: all
  • c/src/lib/libbsp/sh/gensh2/console/Makefile.in

    r5503d75 r4a238002  
    1 #
    2 #  $Id$
    3 #
     1##
     2##  $Id$
     3##
    44
    55@SET_MAKE@
     
    77top_srcdir = @top_srcdir@
    88top_builddir = ../../..
    9 subdir = sh/sh7032/console
     9subdir = sh/gensh2/console
    1010
    1111RTEMS_ROOT = @RTEMS_ROOT@
    1212PROJECT_ROOT = @PROJECT_ROOT@
    1313
    14 VPATH = @srcdir@
     14VPATH = @srcdir@:@top_srcdir@/sh/shared
    1515
    1616PGM = ${ARCH}/console.rel
     
    6464
    6565# the .rel file built here will be put into libbsp.a by
    66 #       libbsp/sh/BSP/wrapup/Makefile
     66#       ../wrapup/Makefile
    6767install: all
    6868
Note: See TracChangeset for help on using the changeset viewer.