Changeset 4a238002 in rtems


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
Files:
40 added
5 deleted
30 edited
1 moved

Legend:

Unmodified
Added
Removed
  • c/configure.in

    r5503d75 r4a238002  
    101101AC_CONFIG_SUBDIRS(make)
    102102
     103AC_CONFIG_SUBDIRS(make)
     104
    103105AC_OUTPUT(
    104106Makefile
  • c/src/exec/score/cpu/sh/cpu.c

    r5503d75 r4a238002  
    3131
    3232
    33 /* referenced in start.s */
     33/* referenced in start.S */
    3434extern proc_ptr vectab[] ;
    3535
  • c/src/exec/score/cpu/sh/cpu_asm.c

    r5503d75 r4a238002  
    4242#include <rtems/score/isr.h>
    4343#include <rtems/score/thread.h>
    44 #include <rtems/score/cpu_isps.h>
     44#include <rtems/score/sh.h>
     45
     46#if defined(sh7032)
     47#include <rtems/score/ispsh7032.h>
     48#include <rtems/score/iosh7032.h>
     49#elif defined (sh7045)
     50#include <rtems/score/ispsh7045.h>
     51#include <rtems/score/iosh7045.h>
     52#endif
     53
    4554#include <rtems/score/sh_io.h>
    46 #include <rtems/score/sh.h>
    47 #include <rtems/score/iosh7030.h>
    4855
    4956/* from cpu_isps.c */
  • c/src/exec/score/cpu/sh/ispsh7032.c

    r5503d75 r4a238002  
    3131#include <rtems/system.h>
    3232#include <rtems/score/shtypes.h>
    33 #include <rtems/score/cpu_isps.h>
     33#include <rtems/score/ispsh7032.h>
     34
     35#if !defined(sh7032)
     36#error Wrong CPU MODEL
     37#endif
    3438
    3539/*
    36  * This is a exception vector table
     40 * This is an exception vector table
    3741 *
    3842 * It has the same structure like the actual vector table (vectab)
  • c/src/exec/score/cpu/sh/rtems/score/Makefile.in

    r5503d75 r4a238002  
    1919C_O_FILES = $(C_PIECES:%=${ARCH}/%.o)
    2020
    21 H_PIECES = cpu.h shtypes.h sh.h sh_io.h cpu_isps.h iosh7030.h
     21H_PIECES = cpu.h shtypes.h sh.h sh_io.h isp$(RTEMS_CPU_MODEL).h \
     22    io$(RTEMS_CPU_MODEL).h
    2223H_FILES = $(H_PIECES:%=$(srcdir)/%)
    2324
  • c/src/exec/score/cpu/sh/rtems/score/cpu.h

    r5503d75 r4a238002  
    378378  void       (*stack_free_hook)( void* );
    379379  /* end of fields required on all CPUs */
     380  unsigned32    clicks_per_second ; /* cpu frequency in Hz */
    380381}   rtems_cpu_table;
    381382
     
    389390 */
    390391
    391 /* There are no CPU specific additions to the CPU Table for this port. */
    392 
     392#define rtems_cpu_configuration_get_clicks_per_second() \
     393  (_CPU_Table.clicks_per_second)
     394   
    393395/*
    394396 *  This variable is optional.  It is used on CPUs on which it is difficult
     
    435437
    436438/* XXX: if needed, put more variables here */
     439SCORE_EXTERN void CPU_delay( unsigned32 microseconds );
    437440
    438441/*
     
    638641 *  Other models include (1) not doing anything, and (2) putting
    639642 *  a "null FP status word" in the correct place in the FP context.
    640  *  SH has no FPU !!!!!!!!!!!!
     643 *  SH1, SH2, SH3 have no FPU, but the SH3e and SH4 have.
    641644 */
    642645
  • c/src/exec/score/cpu/sh/rtems/score/sh.h

    r5503d75 r4a238002  
    4343
    4444#define CPU_MODEL_NAME  "SH 7032"
     45#define SH_HAS_FPU      0
    4546
     47/*
     48 * If the following macro is set to 0 there will be no software irq stack
     49 */
     50#define SH_HAS_SEPARATE_STACKS 1
     51
     52#elif defined (sh7045)
     53
     54#define CPU_MODEL_NAME  "SH 7045"
    4655#define SH_HAS_FPU      0
    4756
  • c/src/exec/score/cpu/sh/wrap/Makefile.in

    r5503d75 r4a238002  
    2424
    2525# C source names, if any, go here -- minus the .c
    26 C_PIECES = cpu cpu_asm cpu_isps
     26C_PIECES = cpu cpu_asm isp$(RTEMS_CPU_MODEL)
    2727C_FILES = $(C_PIECES:%=%.c)
    2828C_O_FILES = $(C_PIECES:%=${ARCH}/%.o)
  • 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
  • c/src/lib/libcpu/sh/sh7032/Makefile.in

    r5503d75 r4a238002  
    1919INSTALL_CHANGE = @INSTALL_CHANGE@
    2020
    21 SUB_DIRS = include clock console timer null
     21SUB_DIRS = include clock timer null sci delay
    2222
    2323Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
  • c/src/lib/libcpu/sh/sh7032/clock/Makefile.in

    r5503d75 r4a238002  
    4141
    4242DEFINES +=
    43 CPPFLAGS += -DMHZ=$(MHZ)
     43CPPFLAGS +=
    4444CFLAGS += $(CFLAGS_OS_V)
    4545
  • c/src/lib/libcpu/sh/sh7032/clock/ckinit.c

    r5503d75 r4a238002  
    3030#include <rtems/score/sh_io.h>
    3131#include <rtems/score/sh.h>
    32 #include <rtems/score/cpu_isps.h>
    33 #include <rtems/score/iosh7030.h>
    34 
    35 #define _ITU_COUNTER0_MICROSECOND (MHZ/4)
     32#include <rtems/score/ispsh7032.h>
     33#include <rtems/score/iosh7032.h>
    3634
    3735#ifndef CLOCKPRIO
     
    3937#endif
    4038
     39#define I_CLK_PHI_1     0
     40#define I_CLK_PHI_2     1
     41#define I_CLK_PHI_4     2
     42#define I_CLK_PHI_8     3
     43
     44/*
     45 * Set I_CLK_PHI to one of the I_CLK_PHI_X values from above to choose
     46 * a PHI/X clock rate.
     47 */
     48 
     49#define I_CLK_PHI       I_CLK_PHI_4
     50#define CLOCK_SCALE     (1<<I_CLK_PHI)
     51
    4152#define ITU0_STARTMASK  0xfe
    4253#define ITU0_SYNCMASK   0xfe
    4354#define ITU0_MODEMASK   0xfe
    44 #define ITU0_TCRMASK    0x22
     55#define ITU0_TCRMASK    (0x20 | I_CLK_PHI)
    4556#define ITU_STAT_MASK   0xf8
    4657#define ITU0_IRQMASK    0xfe
     
    5061
    5162/*
     63 * clicks_per_tick := clicks_per_sec * usec_per_tick
     64 *
     65 * This is a very expensive function ;-)
     66 *
     67 * Below are two variants:
     68 * 1. A variant applying integer arithmetics, only.
     69 * 2. A variant applying floating point arithmetics
     70 *
     71 * The floating point variant pulls in the fmath routines when linking,
     72 * resulting in slightly larger executables for applications that do not
     73 * apply fmath otherwise. However, the imath variant is significantly slower
     74 * than the fmath variant and more complex.
     75 *
     76 * Assuming that most applications will not use fmath, but are critical
     77 * in memory size constraints, we apply the integer variant.
     78 *
     79 * To the sake of simplicity, we might abandon one of both variants in
     80 * future.
     81 */
     82static unsigned int sh_clicks_per_tick(
     83  unsigned int clicks_per_sec,
     84  unsigned int usec_per_tick )
     85{
     86#if 1
     87  unsigned int clicks_per_tick = 0 ;
     88 
     89  unsigned int b = clicks_per_sec ;
     90  unsigned int c = 1000000 ;
     91  unsigned int d = 1 ;
     92  unsigned int a = ( ( b / c ) * usec_per_tick ) / d;
     93
     94  clicks_per_tick += a ;
     95
     96  while ( ( b %= c ) > 0 )
     97  {
     98    c /= 10 ;
     99    d *= 10 ;
     100    a = ( ( b / c ) * usec_per_tick ) / d ;
     101    clicks_per_tick += a ;
     102  }
     103  return clicks_per_tick ;
     104#else
     105  double fclicks_per_tick =
     106    ((double) clicks_per_sec * (double) usec_per_tick) / 1000000.0 ;
     107  return (unsigned32) fclicks_per_tick ;
     108#endif
     109}
     110
     111/*
    52112 *  The interrupt vector number associated with the clock tick device
    53113 *  driver.
     
    101161   * bump the number of clock driver ticks since initialization
    102162   *
    103 
    104163   * determine if it is time to announce the passing of tick as configured
    105164   * to RTEMS through the rtems_clock_tick directive
     
    138197{
    139198  unsigned8 temp8 = 0;
     199  unsigned32 microseconds_per_tick ;
     200  unsigned32 cclicks_per_tick ;
     201  unsigned16 Clock_limit ;
    140202 
    141203  /*
     
    144206
    145207  Clock_driver_ticks = 0;
    146   Clock_isrs_const = rtems_configuration_get_microseconds_per_tick() / 10000;
     208   
     209  if ( rtems_configuration_get_microseconds_per_tick() != 0 )
     210    microseconds_per_tick = rtems_configuration_get_microseconds_per_tick() ;
     211  else
     212    microseconds_per_tick = 10000 ; /* 10000 us */
     213
     214  /* clock clicks per tick */
     215  cclicks_per_tick =
     216    sh_clicks_per_tick(
     217      rtems_cpu_configuration_get_clicks_per_second() / CLOCK_SCALE,
     218      microseconds_per_tick );
     219
     220  Clock_isrs_const = cclicks_per_tick >> 16 ;
     221  if ( ( cclicks_per_tick | 0xffff ) > 0 )
     222    Clock_isrs_const++ ;
     223  Clock_limit = cclicks_per_tick / Clock_isrs_const ;
    147224  Clock_isrs = Clock_isrs_const;
    148225
     
    192269
    193270    /* set counter limits */
    194     write16( _ITU_COUNTER0_MICROSECOND * rtems_configuration_get_microseconds_per_tick(),
    195              ITU_GRA0);
     271    write16( Clock_limit, ITU_GRA0);
    196272   
    197273    /* start counter */
  • c/src/lib/libcpu/sh/sh7032/include/Makefile.in

    r5503d75 r4a238002  
    1414VPATH = @srcdir@
    1515
    16 H_FILES = $(srcdir)/ioqueue.h $(srcdir)/null.h $(srcdir)/sci.h \
    17     $(srcdir)/sh7_pfc.h $(srcdir)/sh7_sci.h
     16H_FILES = $(srcdir)/null.h $(srcdir)/sci.h  $(srcdir)/sh7_pfc.h \
     17    $(srcdir)/sh7_sci.h
    1818
    1919SRCS = $(H_FILES)
  • c/src/lib/libcpu/sh/sh7032/include/sci.h

    r5503d75 r4a238002  
    7979);
    8080
    81 /* Internal error codes */
    82 #define SH_TTY_NO_ERROR         0x2000
    83 #define SH_TTY_FRAME_ERR        0x2001
    84 #define SH_TTY_PARITY_ERR       0x2002
    85 #define SH_TTY_OVERRUN_ERR      0x2003
    86 
    8781#ifdef __cplusplus
    8882}
  • c/src/lib/libcpu/sh/sh7032/include/sh7_pfc.h

    r5503d75 r4a238002  
    2828#define _sh7_pfc_h
    2929
    30 #include <rtems/score/iosh7030.h>
     30#include <rtems/score/iosh7032.h>
    3131
    3232/*
  • c/src/lib/libcpu/sh/sh7032/include/sh7_sci.h

    r5503d75 r4a238002  
    2828#define _sh7_sci_h
    2929
    30 #include <rtems/score/iosh7030.h>
     30#include <rtems/score/iosh7032.h>
    3131
    3232/*
  • c/src/lib/libcpu/sh/sh7032/score/cpu_asm.c

    r5503d75 r4a238002  
    4242#include <rtems/score/isr.h>
    4343#include <rtems/score/thread.h>
    44 #include <rtems/score/cpu_isps.h>
     44#include <rtems/score/sh.h>
     45
     46#if defined(sh7032)
     47#include <rtems/score/ispsh7032.h>
     48#include <rtems/score/iosh7032.h>
     49#elif defined (sh7045)
     50#include <rtems/score/ispsh7045.h>
     51#include <rtems/score/iosh7045.h>
     52#endif
     53
    4554#include <rtems/score/sh_io.h>
    46 #include <rtems/score/sh.h>
    47 #include <rtems/score/iosh7030.h>
    4855
    4956/* from cpu_isps.c */
  • c/src/lib/libcpu/sh/sh7032/score/ispsh7032.c

    r5503d75 r4a238002  
    3131#include <rtems/system.h>
    3232#include <rtems/score/shtypes.h>
    33 #include <rtems/score/cpu_isps.h>
     33#include <rtems/score/ispsh7032.h>
     34
     35#if !defined(sh7032)
     36#error Wrong CPU MODEL
     37#endif
    3438
    3539/*
    36  * This is a exception vector table
     40 * This is an exception vector table
    3741 *
    3842 * It has the same structure like the actual vector table (vectab)
  • c/src/lib/libcpu/sh/sh7032/timer/Makefile.in

    r5503d75 r4a238002  
    4141
    4242DEFINES +=
    43 CPPFLAGS += -DMHZ=$(MHZ)
     43CPPFLAGS +=
    4444CFLAGS +=
    4545
  • c/src/lib/libcpu/sh/sh7032/timer/timer.c

    r5503d75 r4a238002  
    3333
    3434#include <rtems/score/sh_io.h>
    35 #include <rtems/score/iosh7030.h>
    36 
    37 /*
    38  * We use a Phi/4 timer
    39  */
    40 #define SCALE (MHZ/4)
     35#include <rtems/score/ispsh7032.h>
     36#include <rtems/score/iosh7032.h>
     37
     38#define I_CLK_PHI_1     0
     39#define I_CLK_PHI_2     1
     40#define I_CLK_PHI_4     2
     41#define I_CLK_PHI_8     3
     42
     43/*
     44 * Set I_CLK_PHI to one of the I_CLK_PHI_X values from above to choose
     45 * a PHI/X clock rate. 
     46 */
     47   
     48#define I_CLK_PHI       I_CLK_PHI_4
     49#define CLOCK_SCALE     (1<<I_CLK_PHI)
    4150
    4251#define ITU1_STARTMASK  0xfd
    4352#define ITU1_SYNCMASK   0xfd
    4453#define ITU1_MODEMASK   0xfd
    45 #define ITU1_TCRMASK    0x02
     54#define ITU1_TCRMASK    (0x00 | I_CLK_PHI)
    4655#define ITU1_TIORMASK   0x88
    4756#define ITU1_STAT_MASK  0xf8
     
    5362#endif
    5463
    55 #define ITU1_VECTOR 86
     64#define ITU1_VECTOR OVI1_ISP_V
    5665
    5766rtems_isr timerisr();
     
    6069
    6170rtems_boolean Timer_driver_Find_average_overhead;
     71
     72static rtems_unsigned32 Timer_HZ ;
    6273
    6374void Timer_initialize( void )
     
    6879  rtems_isr        *ignored;
    6980
     81  Timer_HZ = rtems_cpu_configuration_get_clicks_per_second() / CLOCK_SCALE ;
     82
    7083  /*
    7184   *  Timer has never overflowed.  This may not be necessary on some
     
    94107  write8( temp8, ITU_TMDR);
    95108
    96   /* x0000000
    97    * |||||+++--- Internal Clock
    98    * |||++------ Count on rising edge
    99    * |++-------- disable TCNT clear
    100    * +---------- don`t care
    101    */
     109  /* Use a Phi/X counter */
    102110  write8( ITU1_TCRMASK, ITU_TCR1);
    103111
     
    143151int Read_timer( void )
    144152{
    145   rtems_unsigned32 clicks;
     153  rtems_unsigned32 cclicks;
    146154  rtems_unsigned32 total ;
    147155  /*
     
    150158 
    151159
    152   clicks = read16( ITU_TCNT1);   /* XXX: read some HW here */
     160  cclicks = read16( ITU_TCNT1);   /* XXX: read some HW here */
    153161 
    154162  /*
     
    158166   */
    159167
    160   total = clicks + Timer_interrupts * 65536 ;
     168  total = cclicks + Timer_interrupts * 65536 ;
    161169
    162170  if ( Timer_driver_Find_average_overhead )
    163     return total / SCALE;          /* in XXX microsecond units */
     171    return total / CLOCK_SCALE;          /* in XXX microsecond units */
    164172  else
    165173  {
     
    169177   *  Somehow convert total into microseconds
    170178   */
    171     return (total / SCALE - AVG_OVERHEAD) ;
     179    return (total / CLOCK_SCALE - AVG_OVERHEAD) ;
    172180  }
    173181}
  • c/src/lib/libcpu/sh/sh7045/score/cpu_asm.c

    r5503d75 r4a238002  
    4242#include <rtems/score/isr.h>
    4343#include <rtems/score/thread.h>
    44 #include <rtems/score/cpu_isps.h>
     44#include <rtems/score/sh.h>
     45
     46#if defined(sh7032)
     47#include <rtems/score/ispsh7032.h>
     48#include <rtems/score/iosh7032.h>
     49#elif defined (sh7045)
     50#include <rtems/score/ispsh7045.h>
     51#include <rtems/score/iosh7045.h>
     52#endif
     53
    4554#include <rtems/score/sh_io.h>
    46 #include <rtems/score/sh.h>
    47 #include <rtems/score/iosh7030.h>
    4855
    4956/* from cpu_isps.c */
  • cpukit/score/cpu/sh/cpu.c

    r5503d75 r4a238002  
    3131
    3232
    33 /* referenced in start.s */
     33/* referenced in start.S */
    3434extern proc_ptr vectab[] ;
    3535
  • cpukit/score/cpu/sh/rtems/score/cpu.h

    r5503d75 r4a238002  
    378378  void       (*stack_free_hook)( void* );
    379379  /* end of fields required on all CPUs */
     380  unsigned32    clicks_per_second ; /* cpu frequency in Hz */
    380381}   rtems_cpu_table;
    381382
     
    389390 */
    390391
    391 /* There are no CPU specific additions to the CPU Table for this port. */
    392 
     392#define rtems_cpu_configuration_get_clicks_per_second() \
     393  (_CPU_Table.clicks_per_second)
     394   
    393395/*
    394396 *  This variable is optional.  It is used on CPUs on which it is difficult
     
    435437
    436438/* XXX: if needed, put more variables here */
     439SCORE_EXTERN void CPU_delay( unsigned32 microseconds );
    437440
    438441/*
     
    638641 *  Other models include (1) not doing anything, and (2) putting
    639642 *  a "null FP status word" in the correct place in the FP context.
    640  *  SH has no FPU !!!!!!!!!!!!
     643 *  SH1, SH2, SH3 have no FPU, but the SH3e and SH4 have.
    641644 */
    642645
  • cpukit/score/cpu/sh/rtems/score/sh.h

    r5503d75 r4a238002  
    4343
    4444#define CPU_MODEL_NAME  "SH 7032"
     45#define SH_HAS_FPU      0
    4546
     47/*
     48 * If the following macro is set to 0 there will be no software irq stack
     49 */
     50#define SH_HAS_SEPARATE_STACKS 1
     51
     52#elif defined (sh7045)
     53
     54#define CPU_MODEL_NAME  "SH 7045"
    4655#define SH_HAS_FPU      0
    4756
  • make/custom/gensh1.cfg

    r5503d75 r4a238002  
    99#
    1010
    11 MHZ=20
     11HZ=20000000
    1212
    1313include $(RTEMS_ROOT)/make/custom/default.cfg
     
    2121# BSP specific preprocessor flags.
    2222# These should only be used in BSP dependent directories.
    23 BSP_CPPFLAGS=-DMHZ=$(MHZ)
     23BSP_CPPFLAGS=-DHZ=$(HZ)
    2424
    2525#
     
    2727#  and (hopefully) optimize for it.
    2828#
    29 #  HACK: We have to append BSP_CPPFLAGS to CPU_CFLAGS, because
    30 #        per BSP and per CPU CPPFLAGS are not (yet?) supported
    31 CPU_CFLAGS=-m1 $(BSP_CPPFLAGS)
    32 # CPU_CFLAGS=-m1
     29CPU_CFLAGS=-m1
    3330
    3431# debug flags: typically none, but we use -O1 as it produces better code
    35 CFLAGS_DEBUG_V = -O1
     32# CFLAGS_DEBUG_V = -O1
     33CFLAGS_DEBUG_V =
    3634
    3735# optimize flag: typically -0, could use -O4 or -fast
     
    7674else
    7775define make-exe
    78         $(CC) $(CPPFLAGS) -Wl,-Map,$(basename $@).map \
    79             $(CFLAGS) $(CFLAGS_LD) -o $(basename $@).exe \
     76        $(LINK.c) -Wl,-Map,$(basename $@).map \
     77            $(LDLIBS) -o $(basename $@).exe \
    8078            $(LINK_OBJS) $(LINK_LIBS)
    8179        $(NM) -n $(basename $@).exe > $(basename $@).num
Note: See TracChangeset for help on using the changeset viewer.