forked from Imagelibrary/rtems
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:
@@ -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>
|
2007-09-12 Joel Sherrill <joel.sherrill@OARcorp.com>
|
||||||
|
|
||||||
PR 1257/bsps
|
PR 1257/bsps
|
||||||
|
|||||||
@@ -31,6 +31,8 @@
|
|||||||
#include <rtems/score/ispsh7032.h>
|
#include <rtems/score/ispsh7032.h>
|
||||||
#include <rtems/score/iosh7032.h>
|
#include <rtems/score/iosh7032.h>
|
||||||
|
|
||||||
|
extern uint32_t bsp_clicks_per_second;
|
||||||
|
|
||||||
#ifndef CLOCKPRIO
|
#ifndef CLOCKPRIO
|
||||||
#define CLOCKPRIO 10
|
#define CLOCKPRIO 10
|
||||||
#endif
|
#endif
|
||||||
@@ -80,7 +82,8 @@
|
|||||||
*/
|
*/
|
||||||
static unsigned int sh_clicks_per_tick(
|
static unsigned int sh_clicks_per_tick(
|
||||||
unsigned int clicks_per_sec,
|
unsigned int clicks_per_sec,
|
||||||
unsigned int usec_per_tick )
|
unsigned int usec_per_tick
|
||||||
|
)
|
||||||
{
|
{
|
||||||
#if 1
|
#if 1
|
||||||
unsigned int clicks_per_tick = 0 ;
|
unsigned int clicks_per_tick = 0 ;
|
||||||
@@ -195,9 +198,9 @@ void Install_clock(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
uint8_t temp8 = 0;
|
uint8_t temp8 = 0;
|
||||||
uint32_t microseconds_per_tick ;
|
uint32_t microseconds_per_tick;
|
||||||
uint32_t cclicks_per_tick ;
|
uint32_t cclicks_per_tick;
|
||||||
uint16_t Clock_limit ;
|
uint16_t Clock_limit;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize the clock tick device driver variables
|
* Initialize the clock tick device driver variables
|
||||||
@@ -211,10 +214,8 @@ void Install_clock(
|
|||||||
microseconds_per_tick = 10000 ; /* 10000 us */
|
microseconds_per_tick = 10000 ; /* 10000 us */
|
||||||
|
|
||||||
/* clock clicks per tick */
|
/* clock clicks per tick */
|
||||||
cclicks_per_tick =
|
cclicks_per_tick = sh_clicks_per_tick(
|
||||||
sh_clicks_per_tick(
|
bsp_clicks_per_second / CLOCK_SCALE, microseconds_per_tick );
|
||||||
rtems_cpu_configuration_get_clicks_per_second() / CLOCK_SCALE,
|
|
||||||
microseconds_per_tick );
|
|
||||||
|
|
||||||
Clock_isrs_const = cclicks_per_tick >> 16 ;
|
Clock_isrs_const = cclicks_per_tick >> 16 ;
|
||||||
if ( ( cclicks_per_tick | 0xffff ) > 0 )
|
if ( ( cclicks_per_tick | 0xffff ) > 0 )
|
||||||
|
|||||||
@@ -23,6 +23,8 @@
|
|||||||
|
|
||||||
#include <rtems.h>
|
#include <rtems.h>
|
||||||
|
|
||||||
|
extern uint32_t bsp_clicks_per_second;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Simple spin delay in microsecond units for device drivers.
|
* Simple spin delay in microsecond units for device drivers.
|
||||||
* This is very dependent on the clock speed of the target.
|
* This is very dependent on the clock speed of the target.
|
||||||
@@ -38,10 +40,9 @@
|
|||||||
|
|
||||||
void CPU_delay( uint32_t microseconds )
|
void CPU_delay( uint32_t microseconds )
|
||||||
{
|
{
|
||||||
register uint32_t clicks_per_usec =
|
register uint32_t clicks_per_usec = bsp_clicks_per_second / 1000000;
|
||||||
rtems_cpu_configuration_get_clicks_per_second() / 1000000 ;
|
register uint32_t _delay = (microseconds) * (clicks_per_usec);
|
||||||
register uint32_t _delay =
|
|
||||||
(microseconds) * (clicks_per_usec);
|
|
||||||
asm volatile (
|
asm volatile (
|
||||||
"0: add #-4,%0\n\
|
"0: add #-4,%0\n\
|
||||||
nop\n\
|
nop\n\
|
||||||
|
|||||||
@@ -34,6 +34,8 @@
|
|||||||
#include <rtems/score/ispsh7032.h>
|
#include <rtems/score/ispsh7032.h>
|
||||||
#include <rtems/score/iosh7032.h>
|
#include <rtems/score/iosh7032.h>
|
||||||
|
|
||||||
|
extern uint32_t bsp_clicks_per_second;
|
||||||
|
|
||||||
#define I_CLK_PHI_1 0
|
#define I_CLK_PHI_1 0
|
||||||
#define I_CLK_PHI_2 1
|
#define I_CLK_PHI_2 1
|
||||||
#define I_CLK_PHI_4 2
|
#define I_CLK_PHI_4 2
|
||||||
@@ -77,7 +79,7 @@ void Timer_initialize( void )
|
|||||||
rtems_interrupt_level level;
|
rtems_interrupt_level level;
|
||||||
rtems_isr *ignored;
|
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
|
* Timer has never overflowed. This may not be necessary on some
|
||||||
|
|||||||
@@ -43,6 +43,8 @@
|
|||||||
#include <rtems/score/ispsh7045.h>
|
#include <rtems/score/ispsh7045.h>
|
||||||
#include <rtems/score/iosh7045.h>
|
#include <rtems/score/iosh7045.h>
|
||||||
|
|
||||||
|
extern uint32_t bsp_clicks_per_second;
|
||||||
|
|
||||||
#define _MTU_COUNTER0_MICROSECOND (Clock_MHZ/16)
|
#define _MTU_COUNTER0_MICROSECOND (Clock_MHZ/16)
|
||||||
|
|
||||||
#ifndef CLOCKPRIO
|
#ifndef CLOCKPRIO
|
||||||
@@ -161,7 +163,7 @@ void Install_clock(
|
|||||||
Clock_isrs = Clock_isrs_const;
|
Clock_isrs = Clock_isrs_const;
|
||||||
|
|
||||||
factor /= rtems_configuration_get_microseconds_per_tick(); /* minimalization of integer division error */
|
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 );
|
rtems_interrupt_catch( Clock_isr, CLOCK_VECTOR, &Old_ticker );
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,8 @@
|
|||||||
#include <rtems/score/sh_io.h>
|
#include <rtems/score/sh_io.h>
|
||||||
#include <rtems/score/iosh7045.h>
|
#include <rtems/score/iosh7045.h>
|
||||||
|
|
||||||
|
extern uint32_t bsp_clicks_per_second;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We use a Phi/4 timer
|
* We use a Phi/4 timer
|
||||||
*/
|
*/
|
||||||
@@ -68,7 +70,7 @@ void Timer_initialize( void )
|
|||||||
rtems_interrupt_level level;
|
rtems_interrupt_level level;
|
||||||
rtems_isr *ignored;
|
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
|
* Timer has never overflowed. This may not be necessary on some
|
||||||
|
|||||||
@@ -24,6 +24,8 @@
|
|||||||
#include <rtems/score/ispsh7750.h>
|
#include <rtems/score/ispsh7750.h>
|
||||||
#include <rtems/score/iosh7750.h>
|
#include <rtems/score/iosh7750.h>
|
||||||
|
|
||||||
|
extern uint32_t bsp_clicks_per_second;
|
||||||
|
|
||||||
#ifndef CLOCKPRIO
|
#ifndef CLOCKPRIO
|
||||||
#define CLOCKPRIO 10
|
#define CLOCKPRIO 10
|
||||||
#endif
|
#endif
|
||||||
@@ -176,8 +178,7 @@ Install_clock(rtems_isr_entry clock_isr)
|
|||||||
rtems_fatal_error_occurred( RTEMS_NOT_CONFIGURED);
|
rtems_fatal_error_occurred( RTEMS_NOT_CONFIGURED);
|
||||||
}
|
}
|
||||||
timer_divider =
|
timer_divider =
|
||||||
(rtems_cpu_configuration_get_clicks_per_second() *
|
(bsp_clicks_per_second * cpudiv / (tidiv*1000000)) *
|
||||||
cpudiv / (tidiv*1000000)) *
|
|
||||||
rtems_configuration_get_microseconds_per_tick();
|
rtems_configuration_get_microseconds_per_tick();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -27,6 +27,8 @@
|
|||||||
#include <rtems/score/sh_io.h>
|
#include <rtems/score/sh_io.h>
|
||||||
#include <rtems/score/iosh7750.h>
|
#include <rtems/score/iosh7750.h>
|
||||||
|
|
||||||
|
extern uint32_t bsp_clicks_per_second;
|
||||||
|
|
||||||
#ifndef TIMER_PRIO
|
#ifndef TIMER_PRIO
|
||||||
#define TIMER_PRIO 15
|
#define TIMER_PRIO 15
|
||||||
#endif
|
#endif
|
||||||
@@ -133,9 +135,7 @@ Timer_initialize(void)
|
|||||||
rtems_fatal_error_occurred( RTEMS_NOT_CONFIGURED);
|
rtems_fatal_error_occurred( RTEMS_NOT_CONFIGURED);
|
||||||
}
|
}
|
||||||
|
|
||||||
microseconds_divider =
|
microseconds_divider = bsp_clicks_per_second * cpudiv / (tidiv * 1000000);
|
||||||
rtems_cpu_configuration_get_clicks_per_second() * cpudiv /
|
|
||||||
(tidiv * 1000000);
|
|
||||||
microseconds_per_int = 0xFFFFFFFF / microseconds_divider;
|
microseconds_per_int = 0xFFFFFFFF / microseconds_divider;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user