diff options
Diffstat (limited to 'firmware/target/arm')
-rw-r--r-- | firmware/target/arm/iriver/backlight-target.h (renamed from firmware/target/arm/iriver/h10/backlight-target.h) | 0 | ||||
-rw-r--r-- | firmware/target/arm/iriver/ifp7xx/adc-ifp7xx.c | 57 | ||||
-rw-r--r-- | firmware/target/arm/iriver/ifp7xx/adc-target.h | 29 | ||||
-rw-r--r-- | firmware/target/arm/iriver/ifp7xx/backlight-ifp7xx.c | 33 | ||||
-rw-r--r-- | firmware/target/arm/iriver/ifp7xx/button-ifp7xx.c | 89 | ||||
-rw-r--r-- | firmware/target/arm/iriver/ifp7xx/button-target.h | 56 | ||||
-rw-r--r-- | firmware/target/arm/iriver/ifp7xx/power-ifp7xx.c | 86 | ||||
-rw-r--r-- | firmware/target/arm/iriver/ifp7xx/usb-ifp7xx.c | 51 | ||||
-rw-r--r-- | firmware/target/arm/iriver/usb-target.h (renamed from firmware/target/arm/iriver/h10/usb-target.h) | 0 |
9 files changed, 401 insertions, 0 deletions
diff --git a/firmware/target/arm/iriver/h10/backlight-target.h b/firmware/target/arm/iriver/backlight-target.h index d35dccdc4a..d35dccdc4a 100644 --- a/firmware/target/arm/iriver/h10/backlight-target.h +++ b/firmware/target/arm/iriver/backlight-target.h | |||
diff --git a/firmware/target/arm/iriver/ifp7xx/adc-ifp7xx.c b/firmware/target/arm/iriver/ifp7xx/adc-ifp7xx.c new file mode 100644 index 0000000000..79b1ad0fcb --- /dev/null +++ b/firmware/target/arm/iriver/ifp7xx/adc-ifp7xx.c | |||
@@ -0,0 +1,57 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2006 by Barry Wardell | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #include "config.h" | ||
20 | #include "cpu.h" | ||
21 | #include "system.h" | ||
22 | #include "kernel.h" | ||
23 | #include "thread.h" | ||
24 | #include "adc.h" | ||
25 | |||
26 | static unsigned short adcdata[NUM_ADC_CHANNELS]; | ||
27 | |||
28 | unsigned short adc_read(int channel) | ||
29 | { | ||
30 | return adcdata[channel]; | ||
31 | } | ||
32 | |||
33 | static void adc_tick(void) | ||
34 | { | ||
35 | if (ADCST & 0x10) { | ||
36 | adcdata[0] = ADCCH0 & 0x3ff; | ||
37 | adcdata[1] = ADCCH1 & 0x3ff; | ||
38 | adcdata[2] = ADCCH2 & 0x3ff; | ||
39 | adcdata[3] = ADCCH3 & 0x3ff; | ||
40 | adcdata[4] = ADCCH4 & 0x3ff; | ||
41 | ADCST = 0xa; | ||
42 | } | ||
43 | } | ||
44 | |||
45 | void adc_init(void) | ||
46 | { | ||
47 | ADCR24 = 0xaaaaa; | ||
48 | ADCR28 = 0; | ||
49 | ADCST = 2; | ||
50 | ADCST = 0xa; | ||
51 | |||
52 | while (!(ADCST & 0x10)); | ||
53 | adc_tick(); | ||
54 | |||
55 | tick_add_task(adc_tick); | ||
56 | } | ||
57 | |||
diff --git a/firmware/target/arm/iriver/ifp7xx/adc-target.h b/firmware/target/arm/iriver/ifp7xx/adc-target.h new file mode 100644 index 0000000000..8e5e6edbc5 --- /dev/null +++ b/firmware/target/arm/iriver/ifp7xx/adc-target.h | |||
@@ -0,0 +1,29 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2006 by Barry Wardell | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #ifndef _ADC_TARGET_H_ | ||
20 | #define _ADC_TARGET_H_ | ||
21 | |||
22 | #define NUM_ADC_CHANNELS 5 | ||
23 | |||
24 | #define ADC_BUTTONS 0 | ||
25 | #define ADC_BATTERY 1 | ||
26 | #define ADC_BUTTON_PLAY 2 | ||
27 | #define ADC_UNREG_POWER ADC_BATTERY /* For compatibility */ | ||
28 | |||
29 | #endif | ||
diff --git a/firmware/target/arm/iriver/ifp7xx/backlight-ifp7xx.c b/firmware/target/arm/iriver/ifp7xx/backlight-ifp7xx.c new file mode 100644 index 0000000000..c0dc3974c0 --- /dev/null +++ b/firmware/target/arm/iriver/ifp7xx/backlight-ifp7xx.c | |||
@@ -0,0 +1,33 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2006 by Barry Wardell | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #include "config.h" | ||
20 | #include "cpu.h" | ||
21 | #include "system.h" | ||
22 | #include "backlight.h" | ||
23 | #include "lcd.h" | ||
24 | |||
25 | void __backlight_on(void) | ||
26 | { | ||
27 | GPIO3_SET = 1; | ||
28 | } | ||
29 | |||
30 | void __backlight_off(void) | ||
31 | { | ||
32 | GPIO3_CLR = 1; | ||
33 | } | ||
diff --git a/firmware/target/arm/iriver/ifp7xx/button-ifp7xx.c b/firmware/target/arm/iriver/ifp7xx/button-ifp7xx.c new file mode 100644 index 0000000000..52e29fdfdf --- /dev/null +++ b/firmware/target/arm/iriver/ifp7xx/button-ifp7xx.c | |||
@@ -0,0 +1,89 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2006 by Barry Wardell | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | |||
21 | #include <stdlib.h> | ||
22 | #include "config.h" | ||
23 | #include "cpu.h" | ||
24 | #include "system.h" | ||
25 | #include "button.h" | ||
26 | #include "kernel.h" | ||
27 | #include "backlight.h" | ||
28 | #include "adc.h" | ||
29 | #include "system.h" | ||
30 | |||
31 | |||
32 | void button_init_device(void) | ||
33 | { | ||
34 | |||
35 | } | ||
36 | |||
37 | bool button_hold(void) | ||
38 | { | ||
39 | return (GPIO5_READ & 4) ? false : true; | ||
40 | } | ||
41 | |||
42 | /* | ||
43 | * Get button pressed from hardware | ||
44 | */ | ||
45 | int button_read_device(void) | ||
46 | { | ||
47 | int btn = BUTTON_NONE; | ||
48 | int data; | ||
49 | static bool hold_button = false; | ||
50 | bool hold_button_old; | ||
51 | |||
52 | /* normal buttons */ | ||
53 | hold_button_old = hold_button; | ||
54 | hold_button = button_hold(); | ||
55 | |||
56 | if (hold_button != hold_button_old) | ||
57 | backlight_hold_changed(hold_button); | ||
58 | |||
59 | if (!button_hold()) | ||
60 | { | ||
61 | data = adc_read(ADC_BUTTONS); | ||
62 | if (data < 0x35c) | ||
63 | { | ||
64 | if (data < 0x151) | ||
65 | if (data < 0xc7) | ||
66 | if (data < 0x41) | ||
67 | btn = BUTTON_LEFT; | ||
68 | else | ||
69 | btn = BUTTON_RIGHT; | ||
70 | else | ||
71 | btn = BUTTON_SELECT; | ||
72 | else | ||
73 | if (data < 0x268) | ||
74 | if (data < 0x1d7) | ||
75 | btn = BUTTON_UP; | ||
76 | else | ||
77 | btn = BUTTON_DOWN; | ||
78 | else | ||
79 | if (data < 0x2f9) | ||
80 | btn = BUTTON_EQ; | ||
81 | else | ||
82 | btn = BUTTON_MODE; | ||
83 | } | ||
84 | |||
85 | if (adc_read(ADC_BUTTON_PLAY) < 0x64) | ||
86 | btn |= BUTTON_PLAY; | ||
87 | } | ||
88 | return btn; | ||
89 | } | ||
diff --git a/firmware/target/arm/iriver/ifp7xx/button-target.h b/firmware/target/arm/iriver/ifp7xx/button-target.h new file mode 100644 index 0000000000..954a2dfe9c --- /dev/null +++ b/firmware/target/arm/iriver/ifp7xx/button-target.h | |||
@@ -0,0 +1,56 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2006 by Barry Wardell | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | |||
20 | /* Custom written for the ifp7xx */ | ||
21 | |||
22 | #ifndef _BUTTON_TARGET_H_ | ||
23 | #define _BUTTON_TARGET_H_ | ||
24 | |||
25 | #include <stdbool.h> | ||
26 | #include "config.h" | ||
27 | |||
28 | #define HAS_BUTTON_HOLD | ||
29 | |||
30 | bool button_hold(void); | ||
31 | void button_init_device(void); | ||
32 | int button_read_device(void); | ||
33 | |||
34 | /* iriver IFP7XX specific button codes */ | ||
35 | |||
36 | #define BUTTON_PLAY 0x00000001 | ||
37 | #define BUTTON_SELECT 0x00000002 | ||
38 | |||
39 | #define BUTTON_LEFT 0x00000004 | ||
40 | #define BUTTON_RIGHT 0x00000008 | ||
41 | #define BUTTON_UP 0x00000010 | ||
42 | #define BUTTON_DOWN 0x00000020 | ||
43 | |||
44 | #define BUTTON_MODE 0x00000040 | ||
45 | #define BUTTON_EQ 0x00000080 | ||
46 | |||
47 | #define BUTTON_MAIN (BUTTON_PLAY|BUTTON_SELECT\ | ||
48 | |BUTTON_LEFT|BUTTON_RIGHT|BUTTON_UP|BUTTON_DOWN\ | ||
49 | |BUTTON_MODE|BUTTON_EQ) | ||
50 | |||
51 | #define BUTTON_REMOTE 0 | ||
52 | |||
53 | #define POWEROFF_BUTTON BUTTON_PLAY | ||
54 | #define POWEROFF_COUNT 40 | ||
55 | |||
56 | #endif /* _BUTTON_TARGET_H_ */ | ||
diff --git a/firmware/target/arm/iriver/ifp7xx/power-ifp7xx.c b/firmware/target/arm/iriver/ifp7xx/power-ifp7xx.c new file mode 100644 index 0000000000..6c5114a84e --- /dev/null +++ b/firmware/target/arm/iriver/ifp7xx/power-ifp7xx.c | |||
@@ -0,0 +1,86 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Linus Nielsen Feltzing | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #include "config.h" | ||
20 | #include "cpu.h" | ||
21 | #include <stdbool.h> | ||
22 | #include "adc.h" | ||
23 | #include "kernel.h" | ||
24 | #include "system.h" | ||
25 | #include "power.h" | ||
26 | #include "hwcompat.h" | ||
27 | #include "logf.h" | ||
28 | #include "usb.h" | ||
29 | |||
30 | #ifdef CONFIG_TUNER | ||
31 | |||
32 | static bool powered = false; | ||
33 | |||
34 | bool radio_powered(void) | ||
35 | { | ||
36 | return powered; | ||
37 | } | ||
38 | |||
39 | bool radio_power(bool status) | ||
40 | { | ||
41 | bool old_status = powered; | ||
42 | powered = status; | ||
43 | |||
44 | return old_status; | ||
45 | } | ||
46 | |||
47 | #endif /* #ifdef CONFIG_TUNER */ | ||
48 | |||
49 | #ifndef SIMULATOR | ||
50 | |||
51 | void power_init(void) | ||
52 | { | ||
53 | } | ||
54 | |||
55 | void ide_power_enable(bool on) | ||
56 | { | ||
57 | (void)on; | ||
58 | /* no ide controller */ | ||
59 | } | ||
60 | |||
61 | bool ide_powered(void) | ||
62 | { | ||
63 | return true; /* pretend always powered if not controlable */ | ||
64 | } | ||
65 | |||
66 | void power_off(void) | ||
67 | { | ||
68 | set_irq_level(HIGHEST_IRQ_LEVEL); | ||
69 | GPIO1_CLR = 1 << 16; | ||
70 | GPIO2_SET = 1; | ||
71 | while(1) | ||
72 | yield(); | ||
73 | } | ||
74 | |||
75 | #else | ||
76 | |||
77 | void power_off(void) | ||
78 | { | ||
79 | } | ||
80 | |||
81 | void ide_power_enable(bool on) | ||
82 | { | ||
83 | (void)on; | ||
84 | } | ||
85 | |||
86 | #endif /* SIMULATOR */ | ||
diff --git a/firmware/target/arm/iriver/ifp7xx/usb-ifp7xx.c b/firmware/target/arm/iriver/ifp7xx/usb-ifp7xx.c new file mode 100644 index 0000000000..1ab7534d4c --- /dev/null +++ b/firmware/target/arm/iriver/ifp7xx/usb-ifp7xx.c | |||
@@ -0,0 +1,51 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2006 by Barry Wardell | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #include "config.h" | ||
20 | #include "cpu.h" | ||
21 | #include "kernel.h" | ||
22 | #include "thread.h" | ||
23 | #include "system.h" | ||
24 | #include "debug.h" | ||
25 | #include "ata.h" | ||
26 | #include "fat.h" | ||
27 | #include "disk.h" | ||
28 | #include "panic.h" | ||
29 | #include "lcd.h" | ||
30 | #include "adc.h" | ||
31 | #include "usb.h" | ||
32 | #include "button.h" | ||
33 | #include "sprintf.h" | ||
34 | #include "string.h" | ||
35 | #include "hwcompat.h" | ||
36 | |||
37 | void usb_init_device(void) | ||
38 | { | ||
39 | } | ||
40 | |||
41 | bool usb_detect(void) | ||
42 | { | ||
43 | /* TODO: Implement USB_ISP1582 */ | ||
44 | return false; | ||
45 | } | ||
46 | |||
47 | void usb_enable(bool on) | ||
48 | { | ||
49 | /* TODO: Implement USB_ISP1582 */ | ||
50 | (void)on; | ||
51 | } | ||
diff --git a/firmware/target/arm/iriver/h10/usb-target.h b/firmware/target/arm/iriver/usb-target.h index 7a17f7bacf..7a17f7bacf 100644 --- a/firmware/target/arm/iriver/h10/usb-target.h +++ b/firmware/target/arm/iriver/usb-target.h | |||