diff options
Diffstat (limited to 'firmware/target/arm/philips')
-rw-r--r-- | firmware/target/arm/philips/hdd1630/button-hdd1630.c | 20 | ||||
-rw-r--r-- | firmware/target/arm/philips/hdd6330/button-hdd6330.c | 18 | ||||
-rw-r--r-- | firmware/target/arm/philips/piezo.c | 67 | ||||
-rw-r--r-- | firmware/target/arm/philips/piezo.h | 23 | ||||
-rw-r--r-- | firmware/target/arm/philips/sa9200/button-sa9200.c | 17 |
5 files changed, 91 insertions, 54 deletions
diff --git a/firmware/target/arm/philips/hdd1630/button-hdd1630.c b/firmware/target/arm/philips/hdd1630/button-hdd1630.c index df0f5afbed..faed6abb72 100644 --- a/firmware/target/arm/philips/hdd1630/button-hdd1630.c +++ b/firmware/target/arm/philips/hdd1630/button-hdd1630.c | |||
@@ -29,18 +29,6 @@ | |||
29 | 29 | ||
30 | static int int_btn = BUTTON_NONE; | 30 | static int int_btn = BUTTON_NONE; |
31 | 31 | ||
32 | /* | ||
33 | * Generate a click sound from the player (not in headphones yet) | ||
34 | * TODO: integrate this with the "key click" option | ||
35 | */ | ||
36 | static void button_click(void) | ||
37 | { | ||
38 | GPO32_ENABLE |= 0x2000; | ||
39 | GPO32_VAL |= 0x2000; | ||
40 | udelay(1000); | ||
41 | GPO32_VAL &= ~0x2000; | ||
42 | } | ||
43 | |||
44 | #ifndef BOOTLOADER | 32 | #ifndef BOOTLOADER |
45 | void button_init_device(void) | 33 | void button_init_device(void) |
46 | { | 34 | { |
@@ -59,7 +47,7 @@ void button_int(void) | |||
59 | int_btn = BUTTON_NONE; | 47 | int_btn = BUTTON_NONE; |
60 | 48 | ||
61 | val = touchpad_read_device(data, 4); | 49 | val = touchpad_read_device(data, 4); |
62 | 50 | ||
63 | if (val == MEP_BUTTON_HEADER) | 51 | if (val == MEP_BUTTON_HEADER) |
64 | { | 52 | { |
65 | /* Buttons packet */ | 53 | /* Buttons packet */ |
@@ -96,7 +84,6 @@ bool button_hold(void) | |||
96 | */ | 84 | */ |
97 | int button_read_device(void) | 85 | int button_read_device(void) |
98 | { | 86 | { |
99 | static int btn_old = BUTTON_NONE; | ||
100 | int btn = int_btn; | 87 | int btn = int_btn; |
101 | 88 | ||
102 | /* Hold */ | 89 | /* Hold */ |
@@ -111,11 +98,6 @@ int button_read_device(void) | |||
111 | if (!(GPIOD_INPUT_VAL & 0x20)) btn |= BUTTON_PLAYLIST; | 98 | if (!(GPIOD_INPUT_VAL & 0x20)) btn |= BUTTON_PLAYLIST; |
112 | if (!(GPIOD_INPUT_VAL & 0x40)) btn |= BUTTON_POWER; | 99 | if (!(GPIOD_INPUT_VAL & 0x40)) btn |= BUTTON_POWER; |
113 | 100 | ||
114 | if ((btn != btn_old) && (btn != BUTTON_NONE)) | ||
115 | button_click(); | ||
116 | |||
117 | btn_old = btn; | ||
118 | |||
119 | return btn; | 101 | return btn; |
120 | } | 102 | } |
121 | 103 | ||
diff --git a/firmware/target/arm/philips/hdd6330/button-hdd6330.c b/firmware/target/arm/philips/hdd6330/button-hdd6330.c index 3f662cca4f..9e9bfd941a 100644 --- a/firmware/target/arm/philips/hdd6330/button-hdd6330.c +++ b/firmware/target/arm/philips/hdd6330/button-hdd6330.c | |||
@@ -37,18 +37,6 @@ static int scroll_repeat = BUTTON_NONE; | |||
37 | #endif | 37 | #endif |
38 | static int repeat = 0; | 38 | static int repeat = 0; |
39 | 39 | ||
40 | /* | ||
41 | * Generate a click sound from the player (not in headphones yet) | ||
42 | * TODO: integrate this with the "key click" option | ||
43 | */ | ||
44 | static void button_click(void) | ||
45 | { | ||
46 | GPO32_ENABLE |= 0x2000; | ||
47 | GPO32_VAL |= 0x2000; | ||
48 | udelay(1000); | ||
49 | GPO32_VAL &= ~0x2000; | ||
50 | } | ||
51 | |||
52 | #ifndef BOOTLOADER | 40 | #ifndef BOOTLOADER |
53 | void button_init_device(void) | 41 | void button_init_device(void) |
54 | { | 42 | { |
@@ -142,7 +130,6 @@ bool button_hold(void) | |||
142 | */ | 130 | */ |
143 | int button_read_device(void) | 131 | int button_read_device(void) |
144 | { | 132 | { |
145 | static int btn_old = BUTTON_NONE; | ||
146 | int btn = int_btn; | 133 | int btn = int_btn; |
147 | 134 | ||
148 | /* Hold */ | 135 | /* Hold */ |
@@ -167,11 +154,6 @@ int button_read_device(void) | |||
167 | btn = BUTTON_NONE; | 154 | btn = BUTTON_NONE; |
168 | } | 155 | } |
169 | 156 | ||
170 | if ((btn != btn_old) && (btn != BUTTON_NONE)) | ||
171 | button_click(); | ||
172 | |||
173 | btn_old = btn; | ||
174 | |||
175 | return btn; | 157 | return btn; |
176 | } | 158 | } |
177 | 159 | ||
diff --git a/firmware/target/arm/philips/piezo.c b/firmware/target/arm/philips/piezo.c new file mode 100644 index 0000000000..52c3fed2d0 --- /dev/null +++ b/firmware/target/arm/philips/piezo.c | |||
@@ -0,0 +1,67 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2014 Szymon Dziok | ||
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 "system.h" | ||
23 | #include "kernel.h" | ||
24 | #include "piezo.h" | ||
25 | |||
26 | void piezo_hw_voltage_on(void) | ||
27 | { | ||
28 | #ifndef SIMULATOR | ||
29 | |||
30 | #if defined(PHILIPS_SA9200) | ||
31 | GPIOF_ENABLE |= 0x08; | ||
32 | GPIOF_OUTPUT_VAL |= 0x08; | ||
33 | GPIOF_OUTPUT_EN |= 0x08; | ||
34 | #else | ||
35 | GPO32_ENABLE |= 0x2000; | ||
36 | GPO32_VAL |= 0x2000; | ||
37 | #endif /* PHILIPS_SA9200 */ | ||
38 | |||
39 | #endif | ||
40 | } | ||
41 | |||
42 | void piezo_hw_voltage_off(void) | ||
43 | { | ||
44 | #ifndef SIMULATOR | ||
45 | |||
46 | #if defined(PHILIPS_SA9200) | ||
47 | GPIOF_OUTPUT_VAL &= ~0x08; | ||
48 | #else | ||
49 | GPO32_VAL &= ~0x2000; | ||
50 | #endif /* PHILIPS_SA9200 */ | ||
51 | |||
52 | #endif | ||
53 | } | ||
54 | |||
55 | void piezo_init(void) | ||
56 | { | ||
57 | } | ||
58 | |||
59 | void piezo_button_beep(bool beep, bool force) | ||
60 | { | ||
61 | /* hw can only do a click */ | ||
62 | (void)beep; | ||
63 | (void)force; | ||
64 | piezo_hw_voltage_on(); | ||
65 | udelay(1000); | ||
66 | piezo_hw_voltage_off(); | ||
67 | } | ||
diff --git a/firmware/target/arm/philips/piezo.h b/firmware/target/arm/philips/piezo.h new file mode 100644 index 0000000000..730042c4f3 --- /dev/null +++ b/firmware/target/arm/philips/piezo.h | |||
@@ -0,0 +1,23 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2014 Szymon Dziok | ||
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 | void piezo_init(void); | ||
23 | void piezo_button_beep(bool beep, bool force); | ||
diff --git a/firmware/target/arm/philips/sa9200/button-sa9200.c b/firmware/target/arm/philips/sa9200/button-sa9200.c index c02d1088dc..bef5be7522 100644 --- a/firmware/target/arm/philips/sa9200/button-sa9200.c +++ b/firmware/target/arm/philips/sa9200/button-sa9200.c | |||
@@ -29,19 +29,6 @@ | |||
29 | 29 | ||
30 | static int int_btn = BUTTON_NONE; | 30 | static int int_btn = BUTTON_NONE; |
31 | 31 | ||
32 | /* | ||
33 | * Generate a click sound from the player (not in headphones yet) | ||
34 | * TODO: integrate this with the "key click" option | ||
35 | */ | ||
36 | static void button_click(void) | ||
37 | { | ||
38 | GPIOF_ENABLE |= 0x08; | ||
39 | GPIOF_OUTPUT_VAL |= 0x08; | ||
40 | GPIOF_OUTPUT_EN |= 0x08; | ||
41 | udelay(1000); | ||
42 | GPIOF_OUTPUT_VAL &= ~0x08; | ||
43 | } | ||
44 | |||
45 | #ifndef BOOTLOADER | 32 | #ifndef BOOTLOADER |
46 | static bool hold_button_old = false; | 33 | static bool hold_button_old = false; |
47 | 34 | ||
@@ -148,7 +135,6 @@ bool button_hold(void) | |||
148 | */ | 135 | */ |
149 | int button_read_device(void) | 136 | int button_read_device(void) |
150 | { | 137 | { |
151 | static int btn_old = BUTTON_NONE; | ||
152 | int btn = int_btn; | 138 | int btn = int_btn; |
153 | bool hold = !(GPIOL_INPUT_VAL & 0x40); | 139 | bool hold = !(GPIOL_INPUT_VAL & 0x40); |
154 | 140 | ||
@@ -168,9 +154,6 @@ int button_read_device(void) | |||
168 | if (!(GPIOF_INPUT_VAL & 0x10)) btn |= BUTTON_VOL_UP; | 154 | if (!(GPIOF_INPUT_VAL & 0x10)) btn |= BUTTON_VOL_UP; |
169 | if (!(GPIOF_INPUT_VAL & 0x04)) btn |= BUTTON_VOL_DOWN; | 155 | if (!(GPIOF_INPUT_VAL & 0x04)) btn |= BUTTON_VOL_DOWN; |
170 | 156 | ||
171 | if ((btn != btn_old) && (btn != BUTTON_NONE)) button_click(); | ||
172 | btn_old = btn; | ||
173 | |||
174 | return btn; | 157 | return btn; |
175 | } | 158 | } |
176 | 159 | ||