4.104.114.84.95
Rev | Line | |
---|
[572484f] | 1 | /* |
---|
| 2 | * Timer Init |
---|
| 3 | * |
---|
| 4 | * Use the last DMA timer (DTIM3) as the diagnostic timer. |
---|
| 5 | */ |
---|
| 6 | |
---|
| 7 | #include <rtems.h> |
---|
| 8 | #include <bsp.h> |
---|
| 9 | |
---|
| 10 | void |
---|
| 11 | Timer_initialize(void) |
---|
| 12 | { |
---|
| 13 | int preScaleDivisor = get_CPU_clock_speed() / 1000000; |
---|
| 14 | int div = MCF5282_TIMER_DTMR_CLK_DIV1; |
---|
| 15 | |
---|
| 16 | if (preScaleDivisor > 256) { |
---|
| 17 | preScaleDivisor /= 16; |
---|
| 18 | div = MCF5282_TIMER_DTMR_CLK_DIV16; |
---|
| 19 | } |
---|
| 20 | MCF5282_TIMER3_DTMR = 0; |
---|
| 21 | MCF5282_TIMER3_DTMR = MCF5282_TIMER_DTMR_PS(preScaleDivisor - 1) | div | |
---|
| 22 | MCF5282_TIMER_DTMR_RST; |
---|
| 23 | } |
---|
| 24 | |
---|
| 25 | /* |
---|
| 26 | * Return timer value in microsecond units |
---|
| 27 | */ |
---|
| 28 | int |
---|
| 29 | Read_timer(void) |
---|
| 30 | { |
---|
| 31 | return MCF5282_TIMER3_DTCN; |
---|
| 32 | } |
---|
| 33 | |
---|
| 34 | /* |
---|
| 35 | * Empty function call used in loops to measure basic cost of looping |
---|
| 36 | * in Timing Test Suite. |
---|
| 37 | */ |
---|
| 38 | rtems_status_code |
---|
| 39 | Empty_function(void) |
---|
| 40 | { |
---|
| 41 | return RTEMS_SUCCESSFUL; |
---|
| 42 | } |
---|
| 43 | |
---|
| 44 | void |
---|
| 45 | Set_find_average_overhead(rtems_boolean find_flag) |
---|
| 46 | { |
---|
| 47 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.