|
|
@ -65,14 +65,18 @@ int PowerManagement(int pid, unsigned int signal) |
|
|
|
case POWER_STATE_IDLE: |
|
|
|
if (accumulator > SLEEP_TIMEOUT) |
|
|
|
{ |
|
|
|
sleep(); |
|
|
|
if (Kernel_count_running_tasks() == 1) |
|
|
|
{ |
|
|
|
sleep(); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
Kernel_signal(SIGNAL_STOP); |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
// TODO: On sleep, signal "STOP" to all tasks and reschedule ourselves more frequently
|
|
|
|
// Wait until Kernel_count_running == 1, then put chip to sleep
|
|
|
|
|
|
|
|
return 0; |
|
|
|
|
|
|
|
} |
|
|
|