Introduce "power" thread for RaaA
[maemo-rb.git] / firmware / target / hosted / powermgmt.c
blobd4103a0c0033802884fc643a95ce0a506396f23e
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2011 by Thomas Jarosch
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
21 #include "config.h"
22 #include "powermgmt.h"
23 #include "thread.h"
24 #include "kernel.h"
26 static char power_stack[DEFAULT_STACK_SIZE];
27 static const char power_thread_name[] = "power";
29 void powermgmt_init_target(void);
31 #if !(CONFIG_PLATFORM & PLATFORM_ANDROID)
32 void powermgmt_init_target(void)
34 /* Nothing to do */
36 #endif
38 static void power_thread(void)
40 powermgmt_init_target();
42 while (1)
44 /* Sleep two seconds */
45 sleep(HZ*2);
47 handle_sleep_timer();
49 } /* power_thread */
51 void powermgmt_init(void)
53 create_thread(power_thread, power_stack, sizeof(power_stack), 0,
54 power_thread_name IF_PRIO(, PRIORITY_SYSTEM)
55 IF_COP(, CPU));