forked from Imagelibrary/rtems
2001-01-09 Joel Sherrill <joel@OARcorp.com>
* clockdrv_shell.c (CLOCK_DRIVER_ISRS_PER_TICK): Add support for multiple ISRs per clock tick. Testing per hacking on mips/jmr3904 clock driver.
This commit is contained in:
@@ -1,3 +1,9 @@
|
|||||||
|
2001-01-09 Joel Sherrill <joel@OARcorp.com>
|
||||||
|
|
||||||
|
* clockdrv_shell.c (CLOCK_DRIVER_ISRS_PER_TICK): Add support for
|
||||||
|
multiple ISRs per clock tick. Testing per hacking on mips/jmr3904
|
||||||
|
clock driver.
|
||||||
|
|
||||||
2001-01-03 Joel Sherrill <joel@OARcorp.com>
|
2001-01-03 Joel Sherrill <joel@OARcorp.com>
|
||||||
|
|
||||||
* clockdrv_shell.c: Fixed syntax error in fast idle support.
|
* clockdrv_shell.c: Fixed syntax error in fast idle support.
|
||||||
|
|||||||
@@ -16,18 +16,34 @@
|
|||||||
#include <bsp.h>
|
#include <bsp.h>
|
||||||
#include <rtems/libio.h>
|
#include <rtems/libio.h>
|
||||||
|
|
||||||
|
#if defined(CLOCK_DRIVER_USE_FAST_IDLE) && defined(CLOCK_DRIVER_ISRS_PER_TICK)
|
||||||
|
#error "clockdrv_shell.c: fast idle and N ISRs per tick is not supported"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ISRs until next clock tick
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef CLOCK_DRIVER_ISRS_PER_TICK
|
||||||
|
volatile rtems_unsigned32 Clock_driver_isrs;
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Clock ticks since initialization
|
* Clock ticks since initialization
|
||||||
*/
|
*/
|
||||||
|
|
||||||
volatile rtems_unsigned32 Clock_driver_ticks;
|
volatile rtems_unsigned32 Clock_driver_ticks;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ISR formerly installed.
|
||||||
|
*/
|
||||||
|
|
||||||
rtems_isr_entry Old_ticker;
|
rtems_isr_entry Old_ticker;
|
||||||
|
|
||||||
void Clock_exit( void );
|
void Clock_exit( void );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* These are set by clock driver during its init
|
* Major and minor number.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
rtems_device_major_number rtems_clock_major = ~0;
|
rtems_device_major_number rtems_clock_major = ~0;
|
||||||
@@ -51,16 +67,23 @@ rtems_isr Clock_isr(
|
|||||||
rtems_vector_number vector
|
rtems_vector_number vector
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
|
* Accurate count of ISRs
|
||||||
|
*/
|
||||||
|
|
||||||
|
Clock_driver_ticks += 1;
|
||||||
|
|
||||||
#ifdef CLOCK_DRIVER_USE_FAST_IDLE
|
#ifdef CLOCK_DRIVER_USE_FAST_IDLE
|
||||||
do {
|
do {
|
||||||
Clock_driver_ticks += 1;
|
|
||||||
rtems_clock_tick();
|
rtems_clock_tick();
|
||||||
} while ( _Thread_Executing == _Thread_Idle &&
|
} while ( _Thread_Executing == _Thread_Idle &&
|
||||||
_Thread_Heir == _Thread_Executing);
|
_Thread_Heir == _Thread_Executing);
|
||||||
|
|
||||||
Clock_driver_support_at_tick();
|
Clock_driver_support_at_tick();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Do the hardware specific per-tick action.
|
* Do the hardware specific per-tick action.
|
||||||
*
|
*
|
||||||
@@ -69,21 +92,25 @@ rtems_isr Clock_isr(
|
|||||||
|
|
||||||
Clock_driver_support_at_tick();
|
Clock_driver_support_at_tick();
|
||||||
|
|
||||||
|
#ifdef CLOCK_DRIVER_ISRS_PER_TICK
|
||||||
/*
|
/*
|
||||||
* The driver has seen another tick.
|
* The driver is multiple ISRs per clock tick.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
Clock_driver_ticks += 1;
|
if ( !Clock_driver_isrs ) {
|
||||||
|
|
||||||
/*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef CLOCK_DRIVER_ISRS_ARE_ONE_MILLISECOND
|
|
||||||
rtems_clock_tick();
|
rtems_clock_tick();
|
||||||
#else
|
|
||||||
#error "Clock driver shell: Does not currently support counting mseconds."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
Clock_driver_isrs = CLOCK_DRIVER_ISRS_PER_TICK;
|
||||||
|
}
|
||||||
|
Clock_driver_isrs--;
|
||||||
|
#else
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The driver is one ISR per clock tick.
|
||||||
|
*/
|
||||||
|
rtems_clock_tick();
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,8 +128,6 @@ rtems_isr Clock_isr(
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
extern int CLOCK_SPEED;
|
|
||||||
|
|
||||||
void Install_clock(
|
void Install_clock(
|
||||||
rtems_isr_entry clock_isr
|
rtems_isr_entry clock_isr
|
||||||
)
|
)
|
||||||
@@ -176,6 +201,14 @@ rtems_device_driver Clock_initialize(
|
|||||||
rtems_clock_major = major;
|
rtems_clock_major = major;
|
||||||
rtems_clock_minor = minor;
|
rtems_clock_minor = minor;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If we are counting ISRs per tick, then initialize the counter.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef CLOCK_DRIVER_ISRS_PER_TICK
|
||||||
|
Clock_driver_isrs = CLOCK_DRIVER_ISRS_PER_TICK;
|
||||||
|
#endif
|
||||||
|
|
||||||
return RTEMS_SUCCESSFUL;
|
return RTEMS_SUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user