diff options
Diffstat (limited to 'firmware/target/arm/philips/piezo.c')
-rw-r--r-- | firmware/target/arm/philips/piezo.c | 67 |
1 files changed, 67 insertions, 0 deletions
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 | } | ||