summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCástor Muñoz <cmvidal@gmail.com>2016-02-05 01:12:02 +0100
committerCástor Muñoz <cmvidal@gmail.com>2016-05-25 10:59:44 +0200
commite863f9a0ce8d968b085252c3b093b17ca07b65dd (patch)
tree04eedd67fc1dc82ed7e6fc533639171456fde788
parent9c032ba61aeb35625d20bf718c9394e092f88316 (diff)
downloadrockbox-e863f9a0ce8d968b085252c3b093b17ca07b65dd.tar.gz
rockbox-e863f9a0ce8d968b085252c3b093b17ca07b65dd.tar.bz2
rockbox-e863f9a0ce8d968b085252c3b093b17ca07b65dd.zip
iPod Classic: piezo support for bootloader
Low level functions that do not depend on Rockbox kernel, intended to be used by the bootloader, dualboot-installer, RB drivers or other .dfu tools. Change-Id: If80214d26e505265ace19d9704f1e1300f98b2f4
-rw-r--r--firmware/SOURCES2
-rw-r--r--firmware/target/arm/s5l8702/ipod6g/piezo-ipod6g.c28
-rw-r--r--firmware/target/arm/s5l8702/ipod6g/piezo.h8
3 files changed, 37 insertions, 1 deletions
diff --git a/firmware/SOURCES b/firmware/SOURCES
index 70729bcfa3..2cace81c8b 100644
--- a/firmware/SOURCES
+++ b/firmware/SOURCES
@@ -1608,6 +1608,7 @@ target/arm/s5l8702/dma-s5l8702.c
target/arm/s5l8702/clocking-s5l8702.c
target/arm/s5l8702/ipod6g/lcd-ipod6g.c
target/arm/s5l8702/ipod6g/lcd-asm-ipod6g.S
+target/arm/s5l8702/ipod6g/piezo-ipod6g.c
#if 0 //TODO
target/arm/s5l8702/postmortemstub.S
#endif
@@ -1625,7 +1626,6 @@ target/arm/s5l8702/debug-s5l8702.c
target/arm/s5l8702/pcm-s5l8702.c
target/arm/s5l8702/ipod6g/audio-ipod6g.c
target/arm/s5l8702/ipod6g/adc-ipod6g.c
-target/arm/s5l8702/ipod6g/piezo-ipod6g.c
#endif
#endif
diff --git a/firmware/target/arm/s5l8702/ipod6g/piezo-ipod6g.c b/firmware/target/arm/s5l8702/ipod6g/piezo-ipod6g.c
index f3c00e34c5..06735673be 100644
--- a/firmware/target/arm/s5l8702/ipod6g/piezo-ipod6g.c
+++ b/firmware/target/arm/s5l8702/ipod6g/piezo-ipod6g.c
@@ -95,3 +95,31 @@ void piezo_button_beep(bool beep, bool force)
piezo_start(40, 4);
}
}
+
+#ifdef BOOTLOADER
+void piezo_tone(uint32_t period /*uS*/, int32_t duration /*ms*/)
+{
+ int32_t stop = USEC_TIMER + duration*1000;
+ uint32_t level = 0;
+
+ while ((int32_t)USEC_TIMER - stop < 0)
+ {
+ level ^= 1;
+ GPIOCMD = 0x0060e | level;
+ udelay(period >> 1);
+ }
+
+ GPIOCMD = 0x0060e;
+}
+
+void piezo_seq(uint16_t *seq)
+{
+ uint16_t period;
+
+ while ((period = *seq++) != 0)
+ {
+ piezo_tone(period, *seq++);
+ udelay(*seq++ * 1000);
+ }
+}
+#endif
diff --git a/firmware/target/arm/s5l8702/ipod6g/piezo.h b/firmware/target/arm/s5l8702/ipod6g/piezo.h
index 987d4ffdda..063b8231a6 100644
--- a/firmware/target/arm/s5l8702/ipod6g/piezo.h
+++ b/firmware/target/arm/s5l8702/ipod6g/piezo.h
@@ -18,9 +18,17 @@
* KIND, either express or implied.
*
****************************************************************************/
+#ifndef __PIEZO_H__
+#define __PIEZO_H__
void piezo_init(void);
void piezo_stop(void);
void piezo_clear(void);
bool piezo_busy(void);
void piezo_button_beep(bool beep, bool force);
+
+#ifdef BOOTLOADER
+void piezo_seq(uint16_t *seq);
+#endif
+
+#endif /* __PIEZO_H__ */