2008-08-31 Joel Sherrill <joel.sherrill@oarcorp.com>

* mpc505/timer/timer.c, mpc5xx/timer/timer.c, mpc6xx/timer/timer.c,
	mpc8260/timer/timer.c, mpc8xx/timer/timer.c, ppc403/timer/timer.c:
	Rename timer driver methods to follow RTEMS programming conventions.
This commit is contained in:
Joel Sherrill
2008-08-31 17:03:54 +00:00
parent a903b7beff
commit 6427f1a24f
7 changed files with 43 additions and 72 deletions

View File

@@ -1,3 +1,9 @@
2008-08-31 Joel Sherrill <joel.sherrill@oarcorp.com>
* mpc505/timer/timer.c, mpc5xx/timer/timer.c, mpc6xx/timer/timer.c,
mpc8260/timer/timer.c, mpc8xx/timer/timer.c, ppc403/timer/timer.c:
Rename timer driver methods to follow RTEMS programming conventions.
2008-08-26 Thomas Doerfler <Thomas.Doerflerr@embedded-brains.de> 2008-08-26 Thomas Doerfler <Thomas.Doerflerr@embedded-brains.de>
* mpc83xx/i2c/mpc83xx_i2cdrv.c: wait for proper end of transfer * mpc83xx/i2c/mpc83xx_i2cdrv.c: wait for proper end of transfer

View File

@@ -2,8 +2,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.
@@ -16,17 +16,17 @@
#include <rtems.h> #include <rtems.h>
rtems_boolean Timer_driver_Find_average_overhead; rtems_boolean benchmark_timer_find_average_overhead;
static unsigned int volatile lastInitValue; static unsigned int volatile lastInitValue;
void Timer_initialize( void ) void benchmark_timer_initialize( void )
{ {
asm volatile( " mftb %0": "=r" (lastInitValue) ); asm volatile( " mftb %0": "=r" (lastInitValue) );
} }
/* /*
* The following controls the behavior of Read_timer(). * The following controls the behavior of benchmark_timer_read().
* *
* AVG_OVEREHAD is the overhead for starting and stopping the timer. It * AVG_OVEREHAD is the overhead for starting and stopping the timer. It
* is usually deducted from the number returned. * is usually deducted from the number returned.
@@ -40,26 +40,16 @@ void Timer_initialize( void )
/* This value is in microseconds. */ /* This value is in microseconds. */
#define LEAST_VALID 1 /* Don't trust a clicks value lower than this */ #define LEAST_VALID 1 /* Don't trust a clicks value lower than this */
int Read_timer( void ) int benchmark_timer_read( void )
{ {
uint32_t value; uint32_t value;
asm volatile ( " mftb %0": "=r" (value) ); asm volatile ( " mftb %0": "=r" (value) );
return value - lastInitValue; return value - lastInitValue;
} }
/* 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;
} }

View File

@@ -52,7 +52,7 @@
#include <mpc5xx.h> #include <mpc5xx.h>
static volatile uint32_t Timer_starting; static volatile uint32_t Timer_starting;
static rtems_boolean Timer_driver_Find_average_overhead; static rtems_boolean benchmark_timer_find_average_overhead;
/* /*
* This is so small that this code will be reproduced where needed. * This is so small that this code will be reproduced where needed.
@@ -66,7 +66,7 @@ static inline uint32_t get_itimer(void)
return ret; return ret;
} }
void Timer_initialize(void) void benchmark_timer_initialize(void)
{ {
/* set interrupt level and enable timebase. This should never */ /* set interrupt level and enable timebase. This should never */
/* generate an interrupt however. */ /* generate an interrupt however. */
@@ -79,7 +79,7 @@ void Timer_initialize(void)
Timer_starting = get_itimer(); Timer_starting = get_itimer();
} }
int Read_timer(void) int benchmark_timer_read(void)
{ {
uint32_t clicks; uint32_t clicks;
uint32_t total; uint32_t total;
@@ -90,7 +90,7 @@ int Read_timer(void)
total = clicks - Timer_starting; total = clicks - Timer_starting;
if ( Timer_driver_Find_average_overhead == 1 ) if ( benchmark_timer_find_average_overhead == 1 )
return total; /* in XXX microsecond units */ return total; /* in XXX microsecond units */
else { else {
@@ -101,12 +101,7 @@ int Read_timer(void)
} }
} }
rtems_status_code Empty_function(void) void benchmark_timer_disable_subtracting_average_overhead(rtems_boolean find_flag)
{ {
return RTEMS_SUCCESSFUL; benchmark_timer_find_average_overhead = find_flag;
}
void Set_find_average_overhead(rtems_boolean find_flag)
{
Timer_driver_Find_average_overhead = find_flag;
} }

View File

@@ -21,7 +21,7 @@
uint64_t Timer_driver_Start_time; uint64_t Timer_driver_Start_time;
rtems_boolean Timer_driver_Find_average_overhead = 0; rtems_boolean benchmark_timer_find_average_overhead = 0;
unsigned clicks_overhead = 0; unsigned clicks_overhead = 0;
/* /*
@@ -40,9 +40,9 @@ int Timer_get_clicks_overhead(void)
} }
/* /*
* Timer_initialize * benchmark_timer_initialize
*/ */
void Timer_initialize(void) void benchmark_timer_initialize(void)
{ {
/* /*
@@ -55,10 +55,10 @@ void Timer_initialize(void)
/* /*
* Read_timer * benchmark_timer_read
*/ */
int Read_timer(void) int benchmark_timer_read(void)
{ {
uint64_t total64; uint64_t total64;
uint32_t total; uint32_t total;
@@ -71,7 +71,7 @@ int Read_timer(void)
total = (uint32_t) total64; total = (uint32_t) total64;
if ( Timer_driver_Find_average_overhead == 1 ) if ( benchmark_timer_find_average_overhead == 1 )
return total; /* in "clicks" of the decrementer units */ return total; /* in "clicks" of the decrementer units */
return (int) BSP_Convert_decrementer(total - clicks_overhead); return (int) BSP_Convert_decrementer(total - clicks_overhead);
@@ -85,14 +85,9 @@ unsigned long long Read_long_timer(void)
return BSP_Convert_decrementer(total64 - clicks_overhead); return BSP_Convert_decrementer(total64 - clicks_overhead);
} }
rtems_status_code Empty_function( void ) void benchmark_timer_disable_subtracting_average_overhead(
{
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;
} }

View File

@@ -51,7 +51,7 @@
#include <mpc8260.h> #include <mpc8260.h>
static volatile uint32_t Timer_starting; static volatile uint32_t Timer_starting;
static rtems_boolean Timer_driver_Find_average_overhead; static rtems_boolean benchmark_timer_find_average_overhead;
/* /*
* This is so small that this code will be reproduced where needed. * This is so small that this code will be reproduced where needed.
@@ -65,7 +65,7 @@ static inline uint32_t get_itimer(void)
return ret; return ret;
} }
void Timer_initialize(void) void benchmark_timer_initialize(void)
{ {
/* set interrupt level and enable timebase. This should never */ /* set interrupt level and enable timebase. This should never */
/* generate an interrupt however. */ /* generate an interrupt however. */
@@ -78,7 +78,7 @@ void Timer_initialize(void)
Timer_starting = get_itimer(); Timer_starting = get_itimer();
} }
int Read_timer(void) int benchmark_timer_read(void)
{ {
uint32_t clicks; uint32_t clicks;
uint32_t total; uint32_t total;
@@ -89,7 +89,7 @@ int Read_timer(void)
total = clicks - Timer_starting; total = clicks - Timer_starting;
if ( Timer_driver_Find_average_overhead == 1 ) if ( benchmark_timer_find_average_overhead == 1 )
return total; /* in XXX microsecond units */ return total; /* in XXX microsecond units */
else { else {
@@ -100,12 +100,7 @@ int Read_timer(void)
} }
} }
rtems_status_code Empty_function(void) void benchmark_timer_disable_subtracting_average_overhead(rtems_boolean find_flag)
{ {
return RTEMS_SUCCESSFUL; benchmark_timer_find_average_overhead = find_flag;
}
void Set_find_average_overhead(rtems_boolean find_flag)
{
Timer_driver_Find_average_overhead = find_flag;
} }

View File

@@ -46,7 +46,7 @@
#include <mpc8xx.h> #include <mpc8xx.h>
static volatile uint32_t Timer_starting; static volatile uint32_t Timer_starting;
static rtems_boolean Timer_driver_Find_average_overhead; static rtems_boolean benchmark_timer_find_average_overhead;
/* /*
* This is so small that this code will be reproduced where needed. * This is so small that this code will be reproduced where needed.
@@ -60,7 +60,7 @@ static inline uint32_t get_itimer(void)
return ret; return ret;
} }
void Timer_initialize(void) void benchmark_timer_initialize(void)
{ {
/* set interrupt level and enable timebase. This should never */ /* set interrupt level and enable timebase. This should never */
/* generate an interrupt however. */ /* generate an interrupt however. */
@@ -69,7 +69,7 @@ void Timer_initialize(void)
Timer_starting = get_itimer(); Timer_starting = get_itimer();
} }
int Read_timer(void) int benchmark_timer_read(void)
{ {
uint32_t clicks; uint32_t clicks;
uint32_t total; uint32_t total;
@@ -80,7 +80,7 @@ int Read_timer(void)
total = clicks - Timer_starting; total = clicks - Timer_starting;
if ( Timer_driver_Find_average_overhead == 1 ) if ( benchmark_timer_find_average_overhead == 1 )
return total; /* in XXX microsecond units */ return total; /* in XXX microsecond units */
else { else {
@@ -91,12 +91,7 @@ int Read_timer(void)
} }
} }
rtems_status_code Empty_function(void) void benchmark_timer_disable_subtracting_average_overhead(rtems_boolean find_flag)
{ {
return RTEMS_SUCCESSFUL; benchmark_timer_find_average_overhead = find_flag;
}
void Set_find_average_overhead(rtems_boolean find_flag)
{
Timer_driver_Find_average_overhead = find_flag;
} }

View File

@@ -47,13 +47,13 @@ extern uint32_t bsp_timer_average_overhead;
static volatile uint32_t startedAt; static volatile uint32_t startedAt;
static rtems_boolean subtractOverhead; static rtems_boolean subtractOverhead;
void Timer_initialize(void) void benchmark_timer_initialize(void)
{ {
/* We are going to rely on clock.c to sort out where the clock comes from */ /* We are going to rely on clock.c to sort out where the clock comes from */
startedAt = ppc_time_base(); startedAt = ppc_time_base();
} }
int Read_timer(void) int benchmark_timer_read(void)
{ {
uint32_t clicks, total; uint32_t clicks, total;
@@ -67,12 +67,7 @@ int Read_timer(void)
return (total - bsp_timer_average_overhead); return (total - bsp_timer_average_overhead);
} }
rtems_status_code Empty_function( void ) void benchmark_timer_disable_subtracting_average_overhead( rtems_boolean find_flag)
{
return RTEMS_SUCCESSFUL;
}
void Set_find_average_overhead( rtems_boolean find_flag)
{ {
subtractOverhead = find_flag; subtractOverhead = find_flag;
} }