forked from Imagelibrary/rtems
2008-08-31 Joel Sherrill <joel.sherrill@oarcorp.com>
* sh7032/timer/timer.c, sh7045/timer/timer.c, sh7750/timer/timer.c: Rename timer driver methods to follow RTEMS programming conventions.
This commit is contained in:
@@ -1,3 +1,8 @@
|
|||||||
|
2008-08-31 Joel Sherrill <joel.sherrill@oarcorp.com>
|
||||||
|
|
||||||
|
* sh7032/timer/timer.c, sh7045/timer/timer.c, sh7750/timer/timer.c:
|
||||||
|
Rename timer driver methods to follow RTEMS programming conventions.
|
||||||
|
|
||||||
2008-08-19 Ralf Corsépius <ralf.corsepius@rtems.org>
|
2008-08-19 Ralf Corsépius <ralf.corsepius@rtems.org>
|
||||||
|
|
||||||
* sh7032/timer/timer.c, sh7045/timer/timer.c, sh7750/timer/timer.c:
|
* sh7032/timer/timer.c, sh7045/timer/timer.c, sh7750/timer/timer.c:
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
*
|
*
|
||||||
* This file manages the benchmark timer used by the RTEMS Timing Test
|
* This file manages the benchmark timer used by the RTEMS Timing Test
|
||||||
* Suite. Each measured time period is demarcated by calls to
|
* Suite. Each measured time period is demarcated by calls to
|
||||||
* Timer_initialize() and Read_timer(). Read_timer() usually returns
|
* benchmark_timer_initialize() and benchmark_timer_read(). benchmark_timer_read() usually returns
|
||||||
* the number of microseconds since Timer_initialize() exitted.
|
* the number of microseconds since benchmark_timer_initialize() exitted.
|
||||||
*
|
*
|
||||||
* NOTE: It is important that the timer start/stop overhead be
|
* NOTE: It is important that the timer start/stop overhead be
|
||||||
* determined when porting or modifying this code.
|
* determined when porting or modifying this code.
|
||||||
@@ -68,11 +68,11 @@ extern rtems_isr timerisr(void);
|
|||||||
|
|
||||||
static uint32_t Timer_interrupts;
|
static uint32_t Timer_interrupts;
|
||||||
|
|
||||||
rtems_boolean Timer_driver_Find_average_overhead;
|
rtems_boolean benchmark_timer_find_average_overhead;
|
||||||
|
|
||||||
static uint32_t Timer_HZ ;
|
static uint32_t Timer_HZ ;
|
||||||
|
|
||||||
void Timer_initialize( void )
|
void benchmark_timer_initialize( void )
|
||||||
{
|
{
|
||||||
uint8_t temp8;
|
uint8_t temp8;
|
||||||
uint16_t temp16;
|
uint16_t temp16;
|
||||||
@@ -135,7 +135,7 @@ void Timer_initialize( void )
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The following controls the behavior of Read_timer().
|
* The following controls the behavior of benchmark_timer_read().
|
||||||
*
|
*
|
||||||
* AVG_OVERHEAD is the overhead for starting and stopping the timer. It
|
* AVG_OVERHEAD is the overhead for starting and stopping the timer. It
|
||||||
* is usually deducted from the number returned.
|
* is usually deducted from the number returned.
|
||||||
@@ -149,7 +149,7 @@ void Timer_initialize( void )
|
|||||||
/* This value is in microseconds. */
|
/* This value is in microseconds. */
|
||||||
#define LEAST_VALID 0 /* 20 */ /* Don't trust a clicks value lower than this */
|
#define LEAST_VALID 0 /* 20 */ /* Don't trust a clicks value lower than this */
|
||||||
|
|
||||||
int Read_timer( void )
|
int benchmark_timer_read( void )
|
||||||
{
|
{
|
||||||
uint32_t cclicks;
|
uint32_t cclicks;
|
||||||
uint32_t total ;
|
uint32_t total ;
|
||||||
@@ -168,7 +168,7 @@ int Read_timer( void )
|
|||||||
|
|
||||||
total = cclicks + Timer_interrupts * 65536;
|
total = cclicks + Timer_interrupts * 65536;
|
||||||
|
|
||||||
if ( Timer_driver_Find_average_overhead )
|
if ( benchmark_timer_find_average_overhead )
|
||||||
return total / CLOCK_SCALE; /* in XXX microsecond units */
|
return total / CLOCK_SCALE; /* in XXX microsecond units */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -181,21 +181,11 @@ int Read_timer( void )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
void benchmark_timer_disable_subtracting_average_overhead(
|
||||||
* Empty function call used in loops to measure basic cost of looping
|
|
||||||
* in Timing Test Suite.
|
|
||||||
*/
|
|
||||||
|
|
||||||
rtems_status_code Empty_function( void )
|
|
||||||
{
|
|
||||||
return RTEMS_SUCCESSFUL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Set_find_average_overhead(
|
|
||||||
rtems_boolean find_flag
|
rtems_boolean find_flag
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Timer_driver_Find_average_overhead = find_flag;
|
benchmark_timer_find_average_overhead = find_flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Timer 1 is used */
|
/* Timer 1 is used */
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
*
|
*
|
||||||
* This file manages the benchmark timer used by the RTEMS Timing Test
|
* This file manages the benchmark timer used by the RTEMS Timing Test
|
||||||
* Suite. Each measured time period is demarcated by calls to
|
* Suite. Each measured time period is demarcated by calls to
|
||||||
* Timer_initialize() and Read_timer(). Read_timer() usually returns
|
* benchmark_timer_initialize() and benchmark_timer_read(). benchmark_timer_read() usually returns
|
||||||
* the number of microseconds since Timer_initialize() exitted.
|
* the number of microseconds since benchmark_timer_initialize() exitted.
|
||||||
*
|
*
|
||||||
* NOTE: It is important that the timer start/stop overhead be
|
* NOTE: It is important that the timer start/stop overhead be
|
||||||
* determined when porting or modifying this code.
|
* determined when porting or modifying this code.
|
||||||
@@ -59,11 +59,11 @@ extern rtems_isr timerisr(void);
|
|||||||
|
|
||||||
static uint32_t Timer_interrupts;
|
static uint32_t Timer_interrupts;
|
||||||
|
|
||||||
rtems_boolean Timer_driver_Find_average_overhead;
|
rtems_boolean benchmark_timer_find_average_overhead;
|
||||||
|
|
||||||
static uint32_t Timer_MHZ ;
|
static uint32_t Timer_MHZ ;
|
||||||
|
|
||||||
void Timer_initialize( void )
|
void benchmark_timer_initialize( void )
|
||||||
{
|
{
|
||||||
uint8_t temp8;
|
uint8_t temp8;
|
||||||
uint16_t temp16;
|
uint16_t temp16;
|
||||||
@@ -131,7 +131,7 @@ void Timer_initialize( void )
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The following controls the behavior of Read_timer().
|
* The following controls the behavior of benchmark_timer_read().
|
||||||
*
|
*
|
||||||
* AVG_OVERHEAD is the overhead for starting and stopping the timer. It
|
* AVG_OVERHEAD is the overhead for starting and stopping the timer. It
|
||||||
* is usually deducted from the number returned.
|
* is usually deducted from the number returned.
|
||||||
@@ -145,7 +145,7 @@ void Timer_initialize( void )
|
|||||||
/* This value is in microseconds. */
|
/* This value is in microseconds. */
|
||||||
#define LEAST_VALID 0 /* 20 */ /* Don't trust a clicks value lower than this */
|
#define LEAST_VALID 0 /* 20 */ /* Don't trust a clicks value lower than this */
|
||||||
|
|
||||||
int Read_timer( void )
|
int benchmark_timer_read( void )
|
||||||
{
|
{
|
||||||
uint32_t clicks;
|
uint32_t clicks;
|
||||||
uint32_t total ;
|
uint32_t total ;
|
||||||
@@ -164,7 +164,7 @@ int Read_timer( void )
|
|||||||
|
|
||||||
total = clicks + Timer_interrupts * 65536;
|
total = clicks + Timer_interrupts * 65536;
|
||||||
|
|
||||||
if ( Timer_driver_Find_average_overhead )
|
if ( benchmark_timer_find_average_overhead )
|
||||||
return total / SCALE; /* in XXX microsecond units */
|
return total / SCALE; /* in XXX microsecond units */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -177,21 +177,11 @@ int Read_timer( void )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
void benchmark_timer_disable_subtracting_average_overhead(
|
||||||
* Empty function call used in loops to measure basic cost of looping
|
|
||||||
* in Timing Test Suite.
|
|
||||||
*/
|
|
||||||
|
|
||||||
rtems_status_code Empty_function( void )
|
|
||||||
{
|
|
||||||
return RTEMS_SUCCESSFUL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Set_find_average_overhead(
|
|
||||||
rtems_boolean find_flag
|
rtems_boolean find_flag
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
Timer_driver_Find_average_overhead = find_flag;
|
benchmark_timer_find_average_overhead = find_flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Timer 1 is used */
|
/* Timer 1 is used */
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
*
|
*
|
||||||
* This file manages the benchmark timer used by the RTEMS Timing Test
|
* This file manages the benchmark timer used by the RTEMS Timing Test
|
||||||
* Suite. Each measured time period is demarcated by calls to
|
* Suite. Each measured time period is demarcated by calls to
|
||||||
* Timer_initialize() and Read_timer(). Read_timer() usually returns
|
* benchmark_timer_initialize() and benchmark_timer_read(). benchmark_timer_read() usually returns
|
||||||
* the number of microseconds since Timer_initialize() exitted.
|
* the number of microseconds since benchmark_timer_initialize() exitted.
|
||||||
*
|
*
|
||||||
* NOTE: It is important that the timer start/stop overhead be
|
* NOTE: It is important that the timer start/stop overhead be
|
||||||
* determined when porting or modifying this code.
|
* determined when porting or modifying this code.
|
||||||
@@ -49,9 +49,9 @@ static uint32_t microseconds_divider;
|
|||||||
/* Interrupt period in microseconds */
|
/* Interrupt period in microseconds */
|
||||||
static uint32_t microseconds_per_int;
|
static uint32_t microseconds_per_int;
|
||||||
|
|
||||||
rtems_boolean Timer_driver_Find_average_overhead;
|
rtems_boolean benchmark_timer_find_average_overhead;
|
||||||
|
|
||||||
/* Timer_initialize --
|
/* benchmark_timer_initialize --
|
||||||
* Initialize Timer 1 to operate as a RTEMS benchmark timer:
|
* Initialize Timer 1 to operate as a RTEMS benchmark timer:
|
||||||
* - determine timer clock frequency
|
* - determine timer clock frequency
|
||||||
* - install timer interrupt handler
|
* - install timer interrupt handler
|
||||||
@@ -65,7 +65,7 @@ rtems_boolean Timer_driver_Find_average_overhead;
|
|||||||
* none
|
* none
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
Timer_initialize(void)
|
benchmark_timer_initialize(void)
|
||||||
{
|
{
|
||||||
uint8_t temp8;
|
uint8_t temp8;
|
||||||
uint16_t temp16;
|
uint16_t temp16;
|
||||||
@@ -177,7 +177,7 @@ Timer_initialize(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The following controls the behavior of Read_timer().
|
* The following controls the behavior of benchmark_timer_read().
|
||||||
*
|
*
|
||||||
* AVG_OVERHEAD is the overhead for starting and stopping the timer. It
|
* AVG_OVERHEAD is the overhead for starting and stopping the timer. It
|
||||||
* is usually deducted from the number returned.
|
* is usually deducted from the number returned.
|
||||||
@@ -191,7 +191,7 @@ Timer_initialize(void)
|
|||||||
/* This value is in microseconds. */
|
/* This value is in microseconds. */
|
||||||
#define LEAST_VALID 0 /* 20 */ /* Don't trust a clicks value lower than this */
|
#define LEAST_VALID 0 /* 20 */ /* Don't trust a clicks value lower than this */
|
||||||
|
|
||||||
/* Read_timer --
|
/* benchmark_timer_read --
|
||||||
* Read timer value in microsecond units since timer start.
|
* Read timer value in microsecond units since timer start.
|
||||||
*
|
*
|
||||||
* PARAMETERS:
|
* PARAMETERS:
|
||||||
@@ -201,7 +201,7 @@ Timer_initialize(void)
|
|||||||
* number of microseconds since timer has been started
|
* number of microseconds since timer has been started
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
Read_timer(void)
|
benchmark_timer_read(void)
|
||||||
{
|
{
|
||||||
uint32_t clicks;
|
uint32_t clicks;
|
||||||
uint32_t ints;
|
uint32_t ints;
|
||||||
@@ -226,7 +226,7 @@ Read_timer(void)
|
|||||||
|
|
||||||
total = microseconds_per_int * ints + (clicks / microseconds_divider);
|
total = microseconds_per_int * ints + (clicks / microseconds_divider);
|
||||||
|
|
||||||
if ( Timer_driver_Find_average_overhead )
|
if ( benchmark_timer_find_average_overhead )
|
||||||
return total; /* in microsecond units */
|
return total; /* in microsecond units */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -239,25 +239,9 @@ Read_timer(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Empty_function --
|
/* benchmark_timer_disable_subtracting_average_overhead --
|
||||||
* Empty function call used in loops to measure basic cost of looping
|
|
||||||
* in Timing Test Suite.
|
|
||||||
*
|
|
||||||
* PARAMETERS:
|
|
||||||
* none
|
|
||||||
*
|
|
||||||
* RETURNS:
|
|
||||||
* RTEMS_SUCCESSFUL
|
|
||||||
*/
|
|
||||||
rtems_status_code
|
|
||||||
Empty_function( void )
|
|
||||||
{
|
|
||||||
return RTEMS_SUCCESSFUL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Set_find_average_overhead --
|
|
||||||
* This routine is invoked by the "Check Timer" (tmck) test in the
|
* This routine is invoked by the "Check Timer" (tmck) test in the
|
||||||
* RTEMS Timing Test Suite. It makes the Read_timer routine not
|
* RTEMS Timing Test Suite. It makes the benchmark_timer_read routine not
|
||||||
* subtract the overhead required to initialize and read the benchmark
|
* subtract the overhead required to initialize and read the benchmark
|
||||||
* timer.
|
* timer.
|
||||||
*
|
*
|
||||||
@@ -268,9 +252,9 @@ Empty_function( void )
|
|||||||
* none
|
* none
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
Set_find_average_overhead(rtems_boolean find_flag)
|
benchmark_timer_disable_subtracting_average_overhead(rtems_boolean find_flag)
|
||||||
{
|
{
|
||||||
Timer_driver_Find_average_overhead = find_flag;
|
benchmark_timer_find_average_overhead = find_flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* timerisr --
|
/* timerisr --
|
||||||
|
|||||||
Reference in New Issue
Block a user