00001 00006 /* 00007 * The contents of this file are subject to the Mozilla Public License 00008 * Version 1.0 (the "License"); you may not use this file except in 00009 * compliance with the License. You may obtain a copy of the License 00010 * at http://www.mozilla.org/MPL/ 00011 * 00012 * Software distributed under the License is distributed on an "AS IS" 00013 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See 00014 * the License for the specific language governing rights and 00015 * limitations under the License. 00016 * 00017 * The Original Code is legOS code, released October 17, 1999. 00018 * 00019 * The Initial Developer of the Original Code is Markus L. Noga. 00020 * Portions created by Markus L. Noga are Copyright (C) 1999 00021 * Markus L. Noga. All Rights Reserved. 00022 * 00023 * Contributor(s): Markus L. Noga <markus@noga.de> 00024 * Rossz Vámos-Wentworth <rossw@jps.net> 00025 */ 00026 00027 #include <sys/irq.h> 00028 #include <sys/tm.h> 00029 #include <sys/timeout.h> 00030 00031 #ifdef CONF_AUTOSHUTOFF 00032 volatile unsigned int auto_shutoff_counter = 0; //<! current count - used by the system timer 00033 unsigned int auto_shutoff_period = 500; //<! milliseconds between shutoff checks 00034 unsigned int auto_shutoff_secs = DEFAULT_SHUTOFF_TIME; //<! seconds of idle to auto shutoff 00035 volatile unsigned int auto_shutoff_elapsed = 0; //<! idle seconds elapsed 00036 volatile unsigned int idle_powerdown = 0; //<! true if a auto-shutoff should occur 00037 00038 void shutoff_restart(void) { 00039 auto_shutoff_elapsed=0; 00040 auto_shutoff_counter=auto_shutoff_period; 00041 } 00042 00043 void shutoff_init(void) { 00044 // auto_shutoff_secs = DEFAULT_SHUTOFF_TIME; 00045 auto_shutoff_elapsed=0; 00046 idle_powerdown = 0; 00047 } 00048 00049 #ifdef CONF_RCX_COMPILER 00050 void autoshutoff_check(void) { 00051 #else 00052 HANDLER_WRAPPER("autoshutoff_check","autoshutoff_check_core"); 00053 void autoshutoff_check_core(void) { 00054 #endif 00055 #ifdef CONF_TM 00056 if (nb_tasks <= nb_system_tasks) { 00057 #endif // CONF_TM 00058 auto_shutoff_elapsed++; 00059 if (auto_shutoff_elapsed > auto_shutoff_secs) 00060 idle_powerdown = 1; 00061 #ifdef CONF_TM 00062 } 00063 else 00064 shutoff_restart(); 00065 #endif // CONF_TM 00066 } 00067 00068 #endif
brickOS is released under the
Mozilla Public License.
Original code copyright 1998-2002 by the authors. |