summaryrefslogtreecommitdiffstats
path: root/firmware/target/coldfire/iriver
diff options
context:
space:
mode:
authorBertrik Sikken <bertrik@sikken.nl>2009-06-28 17:43:04 +0000
committerBertrik Sikken <bertrik@sikken.nl>2009-06-28 17:43:04 +0000
commit7df759c95107bc8e5f9a6ba17f77114fa9d80357 (patch)
tree476eba9a9add512991bd237e366c0704124d9c12 /firmware/target/coldfire/iriver
parentc3f9ab46dea336437b7fb6113a76d75fe1b0c119 (diff)
downloadrockbox-7df759c95107bc8e5f9a6ba17f77114fa9d80357.tar.gz
rockbox-7df759c95107bc8e5f9a6ba17f77114fa9d80357.tar.bz2
rockbox-7df759c95107bc8e5f9a6ba17f77114fa9d80357.zip
Create an udacodec interface (similar to ascodec and wmcoded) and adapt/implement it for the iriver h1xx/h3xx and the meizus.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21546 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/coldfire/iriver')
-rw-r--r--firmware/target/coldfire/iriver/udacodec-iriver.c76
1 files changed, 76 insertions, 0 deletions
diff --git a/firmware/target/coldfire/iriver/udacodec-iriver.c b/firmware/target/coldfire/iriver/udacodec-iriver.c
new file mode 100644
index 0000000000..6c41964ffa
--- /dev/null
+++ b/firmware/target/coldfire/iriver/udacodec-iriver.c
@@ -0,0 +1,76 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2009 by Bertrik Sikken
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+#include "config.h"
+#include "kernel.h"
+#include "i2c-coldfire.h"
+#include "pcf50606.h"
+#include "uda1380.h"
+#include "udacodec.h"
+
+void udacodec_reset(void)
+{
+#ifdef IRIVER_H300_SERIES
+ int mask = disable_irq_save();
+ pcf50606_write(0x3b, 0x00); /* GPOOD2 high Z */
+ pcf50606_write(0x3b, 0x07); /* GPOOD2 low */
+ restore_irq(mask);
+#else
+ /* RESET signal */
+ or_l(1<<29, &GPIO_OUT);
+ or_l(1<<29, &GPIO_ENABLE);
+ or_l(1<<29, &GPIO_FUNCTION);
+ sleep(HZ/100);
+ and_l(~(1<<29), &GPIO_OUT);
+#endif
+}
+
+int udacodec_write(unsigned char reg, unsigned short value)
+{
+ unsigned char data[3];
+
+ data[0] = reg;
+ data[1] = value >> 8;
+ data[2] = value & 0xff;
+
+ if (i2c_write(I2C_IFACE_0, UDA1380_ADDR, data, 3) != 3) {
+ return -1;
+ }
+ return 0;
+}
+
+int udacodec_write2(unsigned char reg,
+ unsigned short value1, unsigned short value2)
+{
+ unsigned char data[5];
+
+ data[0] = reg;
+ data[1] = value1 >> 8;
+ data[2] = value1 & 0xFF;
+ data[3] = value2 >> 8;
+ data[4] = value2 & 0xFF;
+
+ if (i2c_write(I2C_IFACE_0, UDA1380_ADDR, data, 5) != 5) {
+ return -1;
+ }
+ return 0;
+}
+