summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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__ */