summaryrefslogtreecommitdiff
path: root/firmware/target/arm/s3c2440/mini2440
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/s3c2440/mini2440')
-rw-r--r--firmware/target/arm/s3c2440/mini2440/adc-target.h42
-rw-r--r--firmware/target/arm/s3c2440/mini2440/backlight-mini2440.c151
-rw-r--r--firmware/target/arm/s3c2440/mini2440/backlight-target.h31
-rw-r--r--firmware/target/arm/s3c2440/mini2440/button-mini2440.c80
-rw-r--r--firmware/target/arm/s3c2440/mini2440/button-target.h70
-rw-r--r--firmware/target/arm/s3c2440/mini2440/lcd-target.h43
-rw-r--r--firmware/target/arm/s3c2440/mini2440/led-mini2440.c66
-rw-r--r--firmware/target/arm/s3c2440/mini2440/led-mini2440.h46
-rw-r--r--firmware/target/arm/s3c2440/mini2440/power-mini2440.c55
9 files changed, 584 insertions, 0 deletions
diff --git a/firmware/target/arm/s3c2440/mini2440/adc-target.h b/firmware/target/arm/s3c2440/mini2440/adc-target.h
new file mode 100644
index 0000000000..24e878e735
--- /dev/null
+++ b/firmware/target/arm/s3c2440/mini2440/adc-target.h
@@ -0,0 +1,42 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2009 by Bob Cousins
11 *
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.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21#ifndef _ADC_TARGET_H_
22#define _ADC_TARGET_H_
23
24/* Channel 0 is connected to an on board pot for testing
25 Channels 0-3 are available via expansion connector CON4
26 Channels 4-7 are routed to LCD connector for touchscreen operation if
27 supported by display panel.
28*/
29#define NUM_ADC_CHANNELS 8
30
31#define ADC_ONBOARD 0
32#define ADC_SPARE_1 1
33#define ADC_SPARE_2 2
34#define ADC_SPARE_3 3
35#define ADC_TSYM 4
36#define ADC_TSYP 5
37#define ADC_TSXM 6
38#define ADC_TSXP 7
39
40#define ADC_READ_ERROR 0xFFFF
41
42#endif
diff --git a/firmware/target/arm/s3c2440/mini2440/backlight-mini2440.c b/firmware/target/arm/s3c2440/mini2440/backlight-mini2440.c
new file mode 100644
index 0000000000..88c0b5ce2c
--- /dev/null
+++ b/firmware/target/arm/s3c2440/mini2440/backlight-mini2440.c
@@ -0,0 +1,151 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2009 by Bob Cousins
11 *
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.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21#include "config.h"
22#include "cpu.h"
23#include "system.h"
24#include "backlight-target.h"
25#include "backlight.h"
26#include "lcd.h"
27#include "power.h"
28
29
30/* Dummy value at index 0, 1-12 used. */
31static const unsigned char log_brightness[13] =
32 {0,0,1,2,3,5,7,10,15,22,31,44,63};
33
34
35static enum backlight_states
36{
37 BACKLIGHT_CONTROL_IDLE,
38 BACKLIGHT_CONTROL_OFF,
39 BACKLIGHT_CONTROL_ON,
40 BACKLIGHT_CONTROL_SET,
41 BACKLIGHT_CONTROL_FADE
42} backlight_control;
43
44static unsigned char _backlight_brightness;
45static unsigned char backlight_target;
46
47
48/* Assumes that the backlight has been initialized */
49void _backlight_set_brightness(int brightness)
50{
51 /* stop the interrupt from messing us up */
52 backlight_control = BACKLIGHT_CONTROL_IDLE;
53 _backlight_brightness = log_brightness[brightness];
54 backlight_control = BACKLIGHT_CONTROL_SET;
55}
56
57void _backlight_set_state (unsigned int level)
58{
59 if (level == 0)
60 GPGDAT &= ~GPIO_LCD_PWR;
61 else
62 GPGDAT |= GPIO_LCD_PWR;
63}
64
65/* led_control_service runs in interrupt context - be brief!
66 * This service is called once per interrupt timer tick - 100 times a second.
67 *
68 * There should be at most only one i2c operation per call - if more are need
69 * the calls should be spread across calls.
70 *
71 * Putting all led servicing in one thread means that we wont step on any
72 * i2c operations - they are all serialized here in the ISR tick. It also
73 * insures that we get called at equal timing for good visual effect.
74 */
75#ifndef BOOTLOADER
76static void led_control_service(void)
77{
78 switch (backlight_control)
79 {
80 case BACKLIGHT_CONTROL_IDLE:
81 backlight_control = BACKLIGHT_CONTROL_IDLE;
82 break;
83 case BACKLIGHT_CONTROL_OFF:
84 _backlight_set_brightness(0);
85 backlight_control = BACKLIGHT_CONTROL_IDLE;
86 break;
87 case BACKLIGHT_CONTROL_ON:
88 _backlight_set_brightness(255);
89 backlight_control = BACKLIGHT_CONTROL_IDLE;
90 break;
91 case BACKLIGHT_CONTROL_SET:
92 _backlight_set_brightness(255);
93 backlight_control = BACKLIGHT_CONTROL_IDLE;
94 break;
95 case BACKLIGHT_CONTROL_FADE:
96 _backlight_set_brightness(0);
97 backlight_control = BACKLIGHT_CONTROL_IDLE;
98 break;
99 default:
100 backlight_control = BACKLIGHT_CONTROL_IDLE;
101 break;
102 }
103}
104#endif /* BOOTLOADER */
105
106static void __backlight_dim(bool dim_now)
107{
108 /* dont let the interrupt tick happen */
109 backlight_control = BACKLIGHT_CONTROL_IDLE;
110 backlight_target = dim_now ? 0 : _backlight_brightness;
111 if(backlight_target==0 && _backlight_brightness==0)
112 {
113 if(dim_now == false)
114 backlight_control = BACKLIGHT_CONTROL_ON;
115 else
116 backlight_control = BACKLIGHT_CONTROL_OFF;
117 }
118 else
119 backlight_control = BACKLIGHT_CONTROL_FADE;
120}
121
122void _backlight_on(void)
123{
124#ifdef HAVE_LCD_ENABLE
125 lcd_enable(true); /* power on lcd + visible display */
126#endif
127 __backlight_dim(false);
128}
129
130void _backlight_off(void)
131{
132 __backlight_dim(true);
133}
134
135
136bool _backlight_init(void)
137{
138 unsigned char brightness = log_brightness[DEFAULT_BRIGHTNESS_SETTING];
139 _backlight_brightness = brightness;
140
141 backlight_control = BACKLIGHT_CONTROL_ON;
142
143 _backlight_set_state (1);
144 S3C2440_GPIO_CONFIG (GPGCON, 4, GPIO_OUTPUT);
145
146#ifndef BOOTLOADER
147 /* put the led control on the tick list */
148 tick_add_task(led_control_service);
149#endif
150 return true;
151}
diff --git a/firmware/target/arm/s3c2440/mini2440/backlight-target.h b/firmware/target/arm/s3c2440/mini2440/backlight-target.h
new file mode 100644
index 0000000000..c804f16bcc
--- /dev/null
+++ b/firmware/target/arm/s3c2440/mini2440/backlight-target.h
@@ -0,0 +1,31 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2006 by Linus Nielsen Feltzing
11 *
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.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21#ifndef BACKLIGHT_TARGET_H
22#define BACKLIGHT_TARGET_H
23
24#define GPIO_LCD_PWR (1 << 4) /* GPIO.G4 */
25
26bool _backlight_init(void);
27void _backlight_on(void);
28void _backlight_off(void);
29void _backlight_set_brightness(int brightness);
30
31#endif
diff --git a/firmware/target/arm/s3c2440/mini2440/button-mini2440.c b/firmware/target/arm/s3c2440/mini2440/button-mini2440.c
new file mode 100644
index 0000000000..787c04d1ef
--- /dev/null
+++ b/firmware/target/arm/s3c2440/mini2440/button-mini2440.c
@@ -0,0 +1,80 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2009 by Bob Cousins
11 *
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.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22#include "config.h"
23#include "cpu.h"
24#include "system.h"
25#include "button.h"
26#include "kernel.h"
27
28void button_init_device(void)
29{
30 /* Configure port directions and enable internal pullups on button inputs */
31
32 /* These are the standard 6 buttons on the Mini2440 */
33 S3C2440_GPIO_CONFIG (GPGCON, 0, GPIO_INPUT);
34 S3C2440_GPIO_CONFIG (GPGCON, 3, GPIO_INPUT);
35 S3C2440_GPIO_CONFIG (GPGCON, 5, GPIO_INPUT);
36 S3C2440_GPIO_CONFIG (GPGCON, 6, GPIO_INPUT);
37 S3C2440_GPIO_CONFIG (GPGCON, 7, GPIO_INPUT);
38 S3C2440_GPIO_CONFIG (GPGCON, 11, GPIO_INPUT);
39
40 S3C2440_GPIO_PULLUP (GPGUP, 0, GPIO_PULLUP_ENABLE);
41 S3C2440_GPIO_PULLUP (GPGUP, 3, GPIO_PULLUP_ENABLE);
42 S3C2440_GPIO_PULLUP (GPGUP, 5, GPIO_PULLUP_ENABLE);
43 S3C2440_GPIO_PULLUP (GPGUP, 6, GPIO_PULLUP_ENABLE);
44 S3C2440_GPIO_PULLUP (GPGUP, 7, GPIO_PULLUP_ENABLE);
45 S3C2440_GPIO_PULLUP (GPGUP, 11, GPIO_PULLUP_ENABLE);
46
47 /* These are additional buttons on my add on keypad */
48 S3C2440_GPIO_CONFIG (GPGCON, 9, GPIO_INPUT);
49 S3C2440_GPIO_CONFIG (GPGCON, 10, GPIO_INPUT);
50 S3C2440_GPIO_PULLUP (GPGUP, 9, GPIO_PULLUP_ENABLE);
51 S3C2440_GPIO_PULLUP (GPGUP, 10, GPIO_PULLUP_ENABLE);
52
53}
54
55inline bool button_hold(void)
56{
57 return 0;
58}
59
60int button_read_device(void)
61{
62 int btn = BUTTON_NONE;
63
64 /* Read the buttons - active low */
65 btn = (GPGDAT & BUTTON_MAIN) ^ BUTTON_MAIN;
66
67 return btn;
68}
69
70void touchpad_set_sensitivity(int level)
71{
72 (void)level;
73 /* No touchpad */
74}
75
76bool headphones_inserted(void)
77{
78 /* No detect */
79 return false;
80}
diff --git a/firmware/target/arm/s3c2440/mini2440/button-target.h b/firmware/target/arm/s3c2440/mini2440/button-target.h
new file mode 100644
index 0000000000..4a84014462
--- /dev/null
+++ b/firmware/target/arm/s3c2440/mini2440/button-target.h
@@ -0,0 +1,70 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2009 by Bob Cousins
11 *
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.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21#ifndef _BUTTON_TARGET_H_
22#define _BUTTON_TARGET_H_
23
24#include <stdbool.h>
25#include "config.h"
26
27
28bool button_hold(void);
29void button_init_device(void);
30int button_read_device(void);
31void touchpad_set_sensitivity(int level);
32
33/* Mini2440 specific button codes */
34
35#define BUTTON_ONE 0x0001
36#define BUTTON_TWO 0x0008
37#define BUTTON_THREE 0x0020
38#define BUTTON_FOUR 0x0040
39#define BUTTON_FIVE 0x0080
40#define BUTTON_SIX 0x0800
41
42/* Add on buttons */
43#define BUTTON_SEVEN 0x0200
44#define BUTTON_EIGHT 0x0400
45
46#define BUTTON_MENU BUTTON_ONE
47#define BUTTON_UP BUTTON_TWO
48#define BUTTON_SELECT BUTTON_THREE
49#define BUTTON_DOWN BUTTON_FOUR
50#define BUTTON_LEFT BUTTON_FIVE
51#define BUTTON_RIGHT BUTTON_SIX
52
53/* Add on buttons */
54#define BUTTON_A BUTTON_SEVEN
55#define BUTTON_POWER BUTTON_EIGHT
56
57/* TODO: bodge to keep keymap-mini2440 happy */
58#define BUTTON_VOL_DOWN 0x4000
59#define BUTTON_VOL_UP 0x8000
60
61#define BUTTON_MAIN (BUTTON_MENU|BUTTON_LEFT|BUTTON_RIGHT | \
62 BUTTON_UP |BUTTON_DOWN|BUTTON_SELECT | \
63 BUTTON_A |BUTTON_POWER )
64
65#define BUTTON_REMOTE 0
66
67#define POWEROFF_BUTTON BUTTON_MENU
68#define POWEROFF_COUNT 10
69
70#endif /* _BUTTON_TARGET_H_ */
diff --git a/firmware/target/arm/s3c2440/mini2440/lcd-target.h b/firmware/target/arm/s3c2440/mini2440/lcd-target.h
new file mode 100644
index 0000000000..b2882e2390
--- /dev/null
+++ b/firmware/target/arm/s3c2440/mini2440/lcd-target.h
@@ -0,0 +1,43 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2009 by Bob Cousins, Lyre Project
11 *
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.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22extern void lcd_enable(bool state);
23
24/* Setup for Mini2440, 3.5" TFT LCD Touchscreen */
25
26/* Config values for LCDCON1 */
27#define LCD_CLKVAL 4
28#define LCD_MMODE 0
29#define LCD_PNRMODE 3
30#define LCD_BPPMODE 12
31#define LCD_ENVID 1
32
33/* Config values for LCDCON2 */
34#define LCD_UPPER_MARGIN 1
35#define LCD_LOWER_MARGIN 4
36#define LCD_VSYNC_LEN 1
37
38/* Config values for LCDCON3 */
39#define LCD_RIGHT_MARGIN 0
40#define LCD_LEFT_MARGIN 25
41
42/* Config values for LCDCON4 */
43#define LCD_HSYNC_LEN 4
diff --git a/firmware/target/arm/s3c2440/mini2440/led-mini2440.c b/firmware/target/arm/s3c2440/mini2440/led-mini2440.c
new file mode 100644
index 0000000000..f541d75273
--- /dev/null
+++ b/firmware/target/arm/s3c2440/mini2440/led-mini2440.c
@@ -0,0 +1,66 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2009 by Bob Cousins
11 *
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.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21#include "config.h"
22#include "cpu.h"
23#include "kernel.h"
24
25/* LED functions for debug */
26
27void led_init (void)
28{
29 S3C2440_GPIO_CONFIG (GPBCON, 5, GPIO_OUTPUT);
30 S3C2440_GPIO_CONFIG (GPBCON, 6, GPIO_OUTPUT);
31 S3C2440_GPIO_CONFIG (GPBCON, 7, GPIO_OUTPUT);
32 S3C2440_GPIO_CONFIG (GPBCON, 8, GPIO_OUTPUT);
33
34 S3C2440_GPIO_PULLUP (GPBUP, 5, GPIO_PULLUP_DISABLE);
35 S3C2440_GPIO_PULLUP (GPBUP, 6, GPIO_PULLUP_DISABLE);
36 S3C2440_GPIO_PULLUP (GPBUP, 7, GPIO_PULLUP_DISABLE);
37 S3C2440_GPIO_PULLUP (GPBUP, 8, GPIO_PULLUP_DISABLE);
38}
39
40/* Turn on one or more LEDS */
41void set_leds (int led_mask)
42{
43 GPBDAT &= ~led_mask;
44}
45
46/* Turn off one or more LEDS */
47void clear_leds (int led_mask)
48{
49 GPBDAT |= led_mask;
50}
51
52/* Alternate flash pattern1 and pattern2 */
53/* Never returns */
54void led_flash (int led_pattern1, int led_pattern2)
55{
56 while (1)
57 {
58 set_leds (led_pattern1);
59 sleep(HZ/2);
60 clear_leds (led_pattern1);
61
62 set_leds(led_pattern2);
63 sleep(HZ/2);
64 clear_leds (led_pattern2);
65 }
66}
diff --git a/firmware/target/arm/s3c2440/mini2440/led-mini2440.h b/firmware/target/arm/s3c2440/mini2440/led-mini2440.h
new file mode 100644
index 0000000000..0aaad1c9a4
--- /dev/null
+++ b/firmware/target/arm/s3c2440/mini2440/led-mini2440.h
@@ -0,0 +1,46 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2009 by Bob Cousins
11 *
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.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22#ifndef _LED_MINI2440_H_
23#define _LED_MINI2440_H_
24
25/* LED functions for debug etc */
26
27#define LED1 0x0020 /* GPB5 */
28#define LED2 0x0040 /* GPB6 */
29#define LED3 0x0080 /* GPB7 */
30#define LED4 0x0100 /* GPB8 */
31
32#define LED_NONE 0x0000
33#define LED_ALL (LED1|LED2|LED3|LED4)
34
35void led_init (void);
36
37/* Turn on one or more LEDS */
38void set_leds (int led_mask);
39
40/* Turn off one or more LEDS */
41void clear_leds (int led_mask);
42
43/* Alternate flash of pattern1 and pattern2 - never returns */
44void led_flash (int led_pattern1, int led_pattern2);
45
46#endif /* _LED_MINI2440_H_ */
diff --git a/firmware/target/arm/s3c2440/mini2440/power-mini2440.c b/firmware/target/arm/s3c2440/mini2440/power-mini2440.c
new file mode 100644
index 0000000000..d4b00751e0
--- /dev/null
+++ b/firmware/target/arm/s3c2440/mini2440/power-mini2440.c
@@ -0,0 +1,55 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2009 by Bob Cousins
11 *
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.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21#include "config.h"
22#include "cpu.h"
23#include <stdbool.h>
24#include <stdio.h>
25#include "kernel.h"
26#include "system.h"
27#include "power.h"
28#include "led-mini2440.h"
29
30void power_init(void)
31{
32 /* Nothing to do */
33}
34
35unsigned int power_input_status(void)
36{
37 unsigned int status = 0;
38
39 /* Always on*/
40 status = POWER_INPUT_MAIN;
41 return status;
42}
43
44/* Returns true if the unit is charging the batteries. */
45bool charging_state(void)
46{
47 return false;
48}
49
50void power_off(void)
51{
52 /* we don't have any power control, user must do it */
53 led_flash (LED_NONE, LED_ALL);
54 while (1);
55}