2007-10-14 Eric Norum <norume@aps.anl.gov>

* clock/clock.c: Add nanoseconds since tick support.
This commit is contained in:
Joel Sherrill
2007-10-16 17:14:24 +00:00
parent 57c56dbcea
commit d83028566d
2 changed files with 23 additions and 6 deletions

View File

@@ -1,3 +1,7 @@
2007-10-14 Eric Norum <norume@aps.anl.gov>
* clock/clock.c: Add nanoseconds since tick support.
2007-05-03 Joel Sherrill <joel@OARcorp.com>
* startup/linkcmds: Handle .data.* sections

View File

@@ -30,8 +30,19 @@ extern int __SRAMBASE[];
#define IDLE_COUNTER __SRAMBASE[0]
#define FILTERED_IDLE __SRAMBASE[1]
#define MAX_IDLE_COUNT __SRAMBASE[2]
#define PCNTR_AT_TICK (*(uint16 *)&__SRAMBASE[3])
#define FILTER_SHIFT 6
uint32_t bsp_clock_nanoseconds_since_last_tick(void)
{
int i = MCF5282_PIT3_PCNTR;
if (MCF5282_PIT3_PCSR & MCF5282_PIT_PCSR_PIF)
i = MCF5282_PIT3_PCNTR + MCF5282_PIT3_PMR;
return (i - PCNTR_AT_TICK) * 1000;
}
#define Clock_driver_nanoseconds_since_last_tick bsp_clock_nanoseconds_since_last_tick
/*
* Periodic interval timer interrupt handler
*/
@@ -42,6 +53,7 @@ extern int __SRAMBASE[];
if (idle > MAX_IDLE_COUNT) \
MAX_IDLE_COUNT = idle; \
FILTERED_IDLE = idle + FILTERED_IDLE - (FILTERED_IDLE>>FILTER_SHIFT);\
PCNTR_AT_TICK = MCF5282_PIT3_PCNTR; \
MCF5282_PIT3_PCSR |= MCF5282_PIT_PCSR_PIF; \
} while (0)
@@ -95,6 +107,7 @@ extern int __SRAMBASE[];
MCF5282_PIT_PCSR_PIE | \
MCF5282_PIT_PCSR_RLD | \
MCF5282_PIT_PCSR_EN; \
PCNTR_AT_TICK = MCF5282_PIT3_PCNTR; \
} while (0)
/*