2007-11-26 Joel Sherrill <joel.sherrill@oarcorp.com>

* sh7032/clock/ckinit.c, sh7032/delay/delay.c, sh7032/timer/timer.c,
	sh7045/clock/ckinit.c, sh7045/timer/timer.c, sh7750/clock/ckinit.c,
	sh7750/timer/timer.c: Eliminate the clicks_per_microsecond field in
	the SuperH CPU Table and define another mechanism for drivers to
	obtain this information.
This commit is contained in:
Joel Sherrill
2007-11-26 23:02:03 +00:00
parent 1e2072e423
commit 99f67930c2
8 changed files with 37 additions and 20 deletions

View File

@@ -1,3 +1,11 @@
2007-11-26 Joel Sherrill <joel.sherrill@oarcorp.com>
* sh7032/clock/ckinit.c, sh7032/delay/delay.c, sh7032/timer/timer.c,
sh7045/clock/ckinit.c, sh7045/timer/timer.c, sh7750/clock/ckinit.c,
sh7750/timer/timer.c: Eliminate the clicks_per_microsecond field in
the SuperH CPU Table and define another mechanism for drivers to
obtain this information.
2007-09-12 Joel Sherrill <joel.sherrill@OARcorp.com>
PR 1257/bsps

View File

@@ -31,6 +31,8 @@
#include <rtems/score/ispsh7032.h>
#include <rtems/score/iosh7032.h>
extern uint32_t bsp_clicks_per_second;
#ifndef CLOCKPRIO
#define CLOCKPRIO 10
#endif
@@ -80,7 +82,8 @@
*/
static unsigned int sh_clicks_per_tick(
unsigned int clicks_per_sec,
unsigned int usec_per_tick )
unsigned int usec_per_tick
)
{
#if 1
unsigned int clicks_per_tick = 0 ;
@@ -195,9 +198,9 @@ void Install_clock(
)
{
uint8_t temp8 = 0;
uint32_t microseconds_per_tick ;
uint32_t cclicks_per_tick ;
uint16_t Clock_limit ;
uint32_t microseconds_per_tick;
uint32_t cclicks_per_tick;
uint16_t Clock_limit;
/*
* Initialize the clock tick device driver variables
@@ -211,10 +214,8 @@ void Install_clock(
microseconds_per_tick = 10000 ; /* 10000 us */
/* clock clicks per tick */
cclicks_per_tick =
sh_clicks_per_tick(
rtems_cpu_configuration_get_clicks_per_second() / CLOCK_SCALE,
microseconds_per_tick );
cclicks_per_tick = sh_clicks_per_tick(
bsp_clicks_per_second / CLOCK_SCALE, microseconds_per_tick );
Clock_isrs_const = cclicks_per_tick >> 16 ;
if ( ( cclicks_per_tick | 0xffff ) > 0 )

View File

@@ -23,6 +23,8 @@
#include <rtems.h>
extern uint32_t bsp_clicks_per_second;
/*
* Simple spin delay in microsecond units for device drivers.
* This is very dependent on the clock speed of the target.
@@ -38,10 +40,9 @@
void CPU_delay( uint32_t microseconds )
{
register uint32_t clicks_per_usec =
rtems_cpu_configuration_get_clicks_per_second() / 1000000 ;
register uint32_t _delay =
(microseconds) * (clicks_per_usec);
register uint32_t clicks_per_usec = bsp_clicks_per_second / 1000000;
register uint32_t _delay = (microseconds) * (clicks_per_usec);
asm volatile (
"0: add #-4,%0\n\
nop\n\

View File

@@ -34,6 +34,8 @@
#include <rtems/score/ispsh7032.h>
#include <rtems/score/iosh7032.h>
extern uint32_t bsp_clicks_per_second;
#define I_CLK_PHI_1 0
#define I_CLK_PHI_2 1
#define I_CLK_PHI_4 2
@@ -77,7 +79,7 @@ void Timer_initialize( void )
rtems_interrupt_level level;
rtems_isr *ignored;
Timer_HZ = rtems_cpu_configuration_get_clicks_per_second() / CLOCK_SCALE ;
Timer_HZ = bsp_clicks_per_second / CLOCK_SCALE ;
/*
* Timer has never overflowed. This may not be necessary on some

View File

@@ -43,6 +43,8 @@
#include <rtems/score/ispsh7045.h>
#include <rtems/score/iosh7045.h>
extern uint32_t bsp_clicks_per_second;
#define _MTU_COUNTER0_MICROSECOND (Clock_MHZ/16)
#ifndef CLOCKPRIO
@@ -161,7 +163,7 @@ void Install_clock(
Clock_isrs = Clock_isrs_const;
factor /= rtems_configuration_get_microseconds_per_tick(); /* minimalization of integer division error */
Clock_MHZ = rtems_cpu_configuration_get_clicks_per_second() / factor ;
Clock_MHZ = bsp_clicks_per_second / factor ;
rtems_interrupt_catch( Clock_isr, CLOCK_VECTOR, &Old_ticker );

View File

@@ -33,6 +33,8 @@
#include <rtems/score/sh_io.h>
#include <rtems/score/iosh7045.h>
extern uint32_t bsp_clicks_per_second;
/*
* We use a Phi/4 timer
*/
@@ -68,7 +70,7 @@ void Timer_initialize( void )
rtems_interrupt_level level;
rtems_isr *ignored;
Timer_MHZ = rtems_cpu_configuration_get_clicks_per_second() / 1000000 ;
Timer_MHZ = bsp_clicks_per_second / 1000000 ;
/*
* Timer has never overflowed. This may not be necessary on some

View File

@@ -24,6 +24,8 @@
#include <rtems/score/ispsh7750.h>
#include <rtems/score/iosh7750.h>
extern uint32_t bsp_clicks_per_second;
#ifndef CLOCKPRIO
#define CLOCKPRIO 10
#endif
@@ -176,8 +178,7 @@ Install_clock(rtems_isr_entry clock_isr)
rtems_fatal_error_occurred( RTEMS_NOT_CONFIGURED);
}
timer_divider =
(rtems_cpu_configuration_get_clicks_per_second() *
cpudiv / (tidiv*1000000)) *
(bsp_clicks_per_second * cpudiv / (tidiv*1000000)) *
rtems_configuration_get_microseconds_per_tick();
/*

View File

@@ -27,6 +27,8 @@
#include <rtems/score/sh_io.h>
#include <rtems/score/iosh7750.h>
extern uint32_t bsp_clicks_per_second;
#ifndef TIMER_PRIO
#define TIMER_PRIO 15
#endif
@@ -133,9 +135,7 @@ Timer_initialize(void)
rtems_fatal_error_occurred( RTEMS_NOT_CONFIGURED);
}
microseconds_divider =
rtems_cpu_configuration_get_clicks_per_second() * cpudiv /
(tidiv * 1000000);
microseconds_divider = bsp_clicks_per_second * cpudiv / (tidiv * 1000000);
microseconds_per_int = 0xFFFFFFFF / microseconds_divider;
/*