summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libcpu
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2007-11-26 23:02:03 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2007-11-26 23:02:03 +0000
commit99f67930c27d2dcc757b90aa9f3c15639456dde2 (patch)
tree9ee200ba474c123fd54edc8d0b92e04f6bf59e84 /c/src/lib/libcpu
parent2007-11-26 Joel Sherrill <joel.sherrill@oarcorp.com> (diff)
downloadrtems-99f67930c27d2dcc757b90aa9f3c15639456dde2.tar.bz2
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.
Diffstat (limited to 'c/src/lib/libcpu')
-rw-r--r--c/src/lib/libcpu/sh/ChangeLog8
-rw-r--r--c/src/lib/libcpu/sh/sh7032/clock/ckinit.c17
-rw-r--r--c/src/lib/libcpu/sh/sh7032/delay/delay.c9
-rw-r--r--c/src/lib/libcpu/sh/sh7032/timer/timer.c4
-rw-r--r--c/src/lib/libcpu/sh/sh7045/clock/ckinit.c4
-rw-r--r--c/src/lib/libcpu/sh/sh7045/timer/timer.c4
-rw-r--r--c/src/lib/libcpu/sh/sh7750/clock/ckinit.c5
-rw-r--r--c/src/lib/libcpu/sh/sh7750/timer/timer.c6
8 files changed, 37 insertions, 20 deletions
diff --git a/c/src/lib/libcpu/sh/ChangeLog b/c/src/lib/libcpu/sh/ChangeLog
index 6cb9cab3a3..a749d1306b 100644
--- a/c/src/lib/libcpu/sh/ChangeLog
+++ b/c/src/lib/libcpu/sh/ChangeLog
@@ -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
diff --git a/c/src/lib/libcpu/sh/sh7032/clock/ckinit.c b/c/src/lib/libcpu/sh/sh7032/clock/ckinit.c
index 96abdd3f46..7468d404a7 100644
--- a/c/src/lib/libcpu/sh/sh7032/clock/ckinit.c
+++ b/c/src/lib/libcpu/sh/sh7032/clock/ckinit.c
@@ -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 )
diff --git a/c/src/lib/libcpu/sh/sh7032/delay/delay.c b/c/src/lib/libcpu/sh/sh7032/delay/delay.c
index 41d4753908..16645ea200 100644
--- a/c/src/lib/libcpu/sh/sh7032/delay/delay.c
+++ b/c/src/lib/libcpu/sh/sh7032/delay/delay.c
@@ -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\
diff --git a/c/src/lib/libcpu/sh/sh7032/timer/timer.c b/c/src/lib/libcpu/sh/sh7032/timer/timer.c
index 6b7a8ba335..3fb5151457 100644
--- a/c/src/lib/libcpu/sh/sh7032/timer/timer.c
+++ b/c/src/lib/libcpu/sh/sh7032/timer/timer.c
@@ -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
diff --git a/c/src/lib/libcpu/sh/sh7045/clock/ckinit.c b/c/src/lib/libcpu/sh/sh7045/clock/ckinit.c
index 76c08a690e..6a43c5fc54 100644
--- a/c/src/lib/libcpu/sh/sh7045/clock/ckinit.c
+++ b/c/src/lib/libcpu/sh/sh7045/clock/ckinit.c
@@ -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 );
diff --git a/c/src/lib/libcpu/sh/sh7045/timer/timer.c b/c/src/lib/libcpu/sh/sh7045/timer/timer.c
index aa889f39c8..0ed7f19da8 100644
--- a/c/src/lib/libcpu/sh/sh7045/timer/timer.c
+++ b/c/src/lib/libcpu/sh/sh7045/timer/timer.c
@@ -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
diff --git a/c/src/lib/libcpu/sh/sh7750/clock/ckinit.c b/c/src/lib/libcpu/sh/sh7750/clock/ckinit.c
index 9fb729bec6..02c0de4262 100644
--- a/c/src/lib/libcpu/sh/sh7750/clock/ckinit.c
+++ b/c/src/lib/libcpu/sh/sh7750/clock/ckinit.c
@@ -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();
/*
diff --git a/c/src/lib/libcpu/sh/sh7750/timer/timer.c b/c/src/lib/libcpu/sh/sh7750/timer/timer.c
index 893e54a88f..8611bdb4fc 100644
--- a/c/src/lib/libcpu/sh/sh7750/timer/timer.c
+++ b/c/src/lib/libcpu/sh/sh7750/timer/timer.c
@@ -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;
/*