diff --git a/trunk/bootrom/build/libraries/os/common/os_alarm.c b/trunk/bootrom/build/libraries/os/common/os_alarm.c index 2f37fcb..99cc1a0 100644 --- a/trunk/bootrom/build/libraries/os/common/os_alarm.c +++ b/trunk/bootrom/build/libraries/os/common/os_alarm.c @@ -104,7 +104,7 @@ static void i_osSetTimer(OSAlarm *alarm) //osPrintf( "**i_osSetTimer alarm=%x, fire=%llx time=%llx delta=%lld timeCount=%x \n", alarm, alarm->fire, time, delta, (int)timerCount ); #ifdef SDK_ARM11 - osStartTimer(OSi_ALARM_TIMER, timerCount, 0); + osStartTimer(OSi_ALARM_TIMER, timerCount, OS_TICK_PRESCALE); #else // SDK_ARM9 osSetTimerCount((OSTimer)OSi_ALARM_TIMER, timerCount); osSetTimerControl(OSi_ALARM_TIMER, (u16)OSi_ALARM_TIMERCONTROL); diff --git a/trunk/bootrom/build/libraries/os/common/os_tick.c b/trunk/bootrom/build/libraries/os/common/os_tick.c index ae881ac..896efcc 100644 --- a/trunk/bootrom/build/libraries/os/common/os_tick.c +++ b/trunk/bootrom/build/libraries/os/common/os_tick.c @@ -73,7 +73,7 @@ void osInitTick(void) #ifdef SDK_ARM11 osStopTimer(OSi_TICK_TIMER); osEnableTimerReload(OSi_TICK_TIMER); - osStartTimer(OSi_TICK_TIMER, OS_TICK_LO_LIMIT, 0); + osStartTimer(OSi_TICK_TIMER, OS_TICK_LO_LIMIT, OS_TICK_PRESCALE); #else // SDK_ARM9 //---- setting timer osSetTimerControl(OSi_TICK_TIMER, 0); @@ -130,7 +130,7 @@ static void i_osCountUpTick(void) { #ifdef SDK_ARM11 osStopTimer(OSi_TICK_TIMER); - osStartTimer(OSi_TICK_TIMER, OS_TICK_LO_LIMIT, 0); + osStartTimer(OSi_TICK_TIMER, OS_TICK_LO_LIMIT, OS_TICK_PRESCALE); #else // SDK_ARM9 osSetTimerControl(OSi_TICK_TIMER, 0); #ifdef OS_TICK_USE_2TIMERS @@ -258,7 +258,7 @@ void i_osSetTick(u64 count) osStopTimer(OSi_TICK_TIMER); osClearInterruptPendingID(OSi_TICK_IE_TIMER_ID); - osStartTimer(OSi_TICK_TIMER, (u32)(count & OS_TICK_LO_MASK), 0); + osStartTimer(OSi_TICK_TIMER, (u32)(count & OS_TICK_LO_MASK), OS_TICK_PRESCALE); #else // SDK_ARM9 osSetTimerControl(OSi_TICK_TIMER, 0); diff --git a/trunk/bootrom/build/libraries/os/common/os_timer.c b/trunk/bootrom/build/libraries/os/common/os_timer.c index fb50eb2..16648ff 100644 --- a/trunk/bootrom/build/libraries/os/common/os_timer.c +++ b/trunk/bootrom/build/libraries/os/common/os_timer.c @@ -138,9 +138,16 @@ void i_osUnsetTimerReserved( int timer_id ) void osStartTimer( OSTimer id, OSTimerCount count, OSTimerPrescaler preScale ) { SDK_ASSERT(OS_TIMER_0 <= id && id < OS_TIMER_NUM); + SDK_ASSERT(2 <= preScale && preScale <= (256*2)); //---- check if system reserved SDK_ASSERT(!i_osIsTimerReserved(id)); + preScale /= 2; + if ( preScale ) + { + preScale--; + } + osSetTimerCount(id, count); osSetTimerControl(id, REG_OS_TM_CNT_E_MASK | REG_OS_TM_CNT_IT_MASK | i_osTimerControl[id] |