/********************************************************************* * @fn osal_start_znp * * @brief * * This function is the main loop function of the task system. It * will look through all task events and call the task_event_processor() * function for the task with the event. If there are no events (for * all tasks), this function puts the processor into Sleep. * This Function doesn't return. * * @param void * * @return none */ void osal_start_znp( void ) { #if !defined ( ZBIT ) && !defined ( UBIT ) for(;;) // Forever Loop #endif { #if defined( POWER_SAVING ) uint8 busy = FALSE; #endif uint8 idx; osalTimeUpdate(); Hal_ProcessPoll(); for (idx = 1; idx < tasksCnt; idx++) { if (tasksEvents[idx]) { osal_run_task(idx); #if defined( POWER_SAVING ) busy = TRUE; #endif break; } } if (tasksEvents[0]) // Always run the ZNP task. { osal_run_task(0); #if defined( POWER_SAVING ) busy = TRUE; #endif } #if defined( POWER_SAVING ) if (!busy) // Complete pass through all task events with no activity? { osal_pwrmgr_powerconserve(); // Put the processor/system into sleep. } #endif } }
long OS_millis(void) { osalTimeUpdate(); return osal_GetSystemClock(); }
long OS_get_millis(void) { osalTimeUpdate(); return osal_getClock() * 1000 + osal_getMSClock(); }