summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2006-10-27 11:24:23 +0000
committerDaniel Stenberg <daniel@haxx.se>2006-10-27 11:24:23 +0000
commit77c915ad61c654d6ef8f49e801ca9136f7cec49d (patch)
treeb8b4d88780488ec2e48810e74a8658264cfce6b3
parent2c1eec5533db4676e73132923f6c3fa73ad248e6 (diff)
downloadrockbox-77c915ad61c654d6ef8f49e801ca9136f7cec49d.tar.gz
rockbox-77c915ad61c654d6ef8f49e801ca9136f7cec49d.tar.bz2
rockbox-77c915ad61c654d6ef8f49e801ca9136f7cec49d.zip
Renamed the ipod_i2c functions to the more appropriate pp_i2c
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11361 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/drivers/i2c-pp5002.c28
-rw-r--r--firmware/drivers/i2c-pp5020.c28
-rw-r--r--firmware/drivers/pcf50605.c2
-rw-r--r--firmware/drivers/rtc.c2
-rw-r--r--firmware/export/i2c-pp5002.h2
-rw-r--r--firmware/export/i2c-pp5020.h2
-rw-r--r--firmware/target/arm/wmcodec-pp.c18
7 files changed, 41 insertions, 41 deletions
diff --git a/firmware/drivers/i2c-pp5002.c b/firmware/drivers/i2c-pp5002.c
index 958ddeebe4..7cb37f6090 100644
--- a/firmware/drivers/i2c-pp5002.c
+++ b/firmware/drivers/i2c-pp5002.c
@@ -49,7 +49,7 @@
#define POLL_TIMEOUT (HZ)
-static int ipod_i2c_wait_not_busy(void)
+static int pp_i2c_wait_not_busy(void)
{
unsigned long timeout;
timeout = current_tick + POLL_TIMEOUT;
@@ -66,9 +66,9 @@ static int ipod_i2c_wait_not_busy(void)
/* Public functions */
-int ipod_i2c_read_byte(unsigned int addr, unsigned int *data)
+int pp_i2c_read_byte(unsigned int addr, unsigned int *data)
{
- if (ipod_i2c_wait_not_busy() < 0)
+ if (pp_i2c_wait_not_busy() < 0)
{
return -1;
}
@@ -80,7 +80,7 @@ int ipod_i2c_read_byte(unsigned int addr, unsigned int *data)
outb(inb(IPOD_I2C_CTRL) | IPOD_I2C_SEND, IPOD_I2C_CTRL);
- if (ipod_i2c_wait_not_busy() < 0)
+ if (pp_i2c_wait_not_busy() < 0)
{
return -1;
}
@@ -93,7 +93,7 @@ int ipod_i2c_read_byte(unsigned int addr, unsigned int *data)
return 0;
}
-int ipod_i2c_send_bytes(unsigned int addr, unsigned int len, unsigned char *data)
+int pp_i2c_send_bytes(unsigned int addr, unsigned int len, unsigned char *data)
{
int data_addr;
unsigned int i;
@@ -103,7 +103,7 @@ int ipod_i2c_send_bytes(unsigned int addr, unsigned int len, unsigned char *data
return -1;
}
- if (ipod_i2c_wait_not_busy() < 0)
+ if (pp_i2c_wait_not_busy() < 0)
{
return -2;
}
@@ -127,21 +127,21 @@ int ipod_i2c_send_bytes(unsigned int addr, unsigned int len, unsigned char *data
return 0x0;
}
-int ipod_i2c_send_byte(unsigned int addr, int data0)
+int pp_i2c_send_byte(unsigned int addr, int data0)
{
unsigned char data[1];
data[0] = data0;
- return ipod_i2c_send_bytes(addr, 1, data);
+ return pp_i2c_send_bytes(addr, 1, data);
}
int i2c_readbytes(unsigned int dev_addr, int addr, int len, unsigned char *data) {
unsigned int temp;
int i;
- ipod_i2c_send_byte(dev_addr, addr);
+ pp_i2c_send_byte(dev_addr, addr);
for (i = 0; i < len; i++) {
- ipod_i2c_read_byte(dev_addr, &temp);
+ pp_i2c_read_byte(dev_addr, &temp);
data[i] = temp;
}
return i;
@@ -151,20 +151,20 @@ int i2c_readbyte(unsigned int dev_addr, int addr)
{
int data;
- ipod_i2c_send_byte(dev_addr, addr);
- ipod_i2c_read_byte(dev_addr, &data);
+ pp_i2c_send_byte(dev_addr, addr);
+ pp_i2c_read_byte(dev_addr, &data);
return data;
}
-int ipod_i2c_send(unsigned int addr, int data0, int data1)
+int pp_i2c_send(unsigned int addr, int data0, int data1)
{
unsigned char data[2];
data[0] = data0;
data[1] = data1;
- return ipod_i2c_send_bytes(addr, 2, data);
+ return pp_i2c_send_bytes(addr, 2, data);
}
void i2c_init(void)
diff --git a/firmware/drivers/i2c-pp5020.c b/firmware/drivers/i2c-pp5020.c
index e81783dba0..2aeb11128d 100644
--- a/firmware/drivers/i2c-pp5020.c
+++ b/firmware/drivers/i2c-pp5020.c
@@ -49,7 +49,7 @@
#define POLL_TIMEOUT (HZ)
-static int ipod_i2c_wait_not_busy(void)
+static int pp_i2c_wait_not_busy(void)
{
unsigned long timeout;
timeout = current_tick + POLL_TIMEOUT;
@@ -63,9 +63,9 @@ static int ipod_i2c_wait_not_busy(void)
return -1;
}
-static int ipod_i2c_read_byte(unsigned int addr, unsigned int *data)
+static int pp_i2c_read_byte(unsigned int addr, unsigned int *data)
{
- if (ipod_i2c_wait_not_busy() < 0)
+ if (pp_i2c_wait_not_busy() < 0)
{
return -1;
}
@@ -82,7 +82,7 @@ static int ipod_i2c_read_byte(unsigned int addr, unsigned int *data)
outb(inb(IPOD_I2C_CTRL) | IPOD_I2C_SEND, IPOD_I2C_CTRL);
set_irq_level(old_irq_level);
- if (ipod_i2c_wait_not_busy() < 0)
+ if (pp_i2c_wait_not_busy() < 0)
{
return -1;
}
@@ -99,7 +99,7 @@ static int ipod_i2c_read_byte(unsigned int addr, unsigned int *data)
return 0;
}
-static int ipod_i2c_send_bytes(unsigned int addr, unsigned int len, unsigned char *data)
+static int pp_i2c_send_bytes(unsigned int addr, unsigned int len, unsigned char *data)
{
int data_addr;
unsigned int i;
@@ -109,7 +109,7 @@ static int ipod_i2c_send_bytes(unsigned int addr, unsigned int len, unsigned cha
return -1;
}
- if (ipod_i2c_wait_not_busy() < 0)
+ if (pp_i2c_wait_not_busy() < 0)
{
return -2;
}
@@ -139,13 +139,13 @@ static int ipod_i2c_send_bytes(unsigned int addr, unsigned int len, unsigned cha
return 0x0;
}
-static int ipod_i2c_send_byte(unsigned int addr, int data0)
+static int pp_i2c_send_byte(unsigned int addr, int data0)
{
unsigned char data[1];
data[0] = data0;
- return ipod_i2c_send_bytes(addr, 1, data);
+ return pp_i2c_send_bytes(addr, 1, data);
}
/* Public functions */
@@ -155,9 +155,9 @@ int i2c_readbytes(unsigned int dev_addr, int addr, int len, unsigned char *data)
unsigned int temp;
int i;
mutex_lock(&i2c_mutex);
- ipod_i2c_send_byte(dev_addr, addr);
+ pp_i2c_send_byte(dev_addr, addr);
for (i = 0; i < len; i++) {
- ipod_i2c_read_byte(dev_addr, &temp);
+ pp_i2c_read_byte(dev_addr, &temp);
data[i] = temp;
}
mutex_unlock(&i2c_mutex);
@@ -169,14 +169,14 @@ int i2c_readbyte(unsigned int dev_addr, int addr)
int data;
mutex_lock(&i2c_mutex);
- ipod_i2c_send_byte(dev_addr, addr);
- ipod_i2c_read_byte(dev_addr, &data);
+ pp_i2c_send_byte(dev_addr, addr);
+ pp_i2c_read_byte(dev_addr, &data);
mutex_unlock(&i2c_mutex);
return data;
}
-int ipod_i2c_send(unsigned int addr, int data0, int data1)
+int pp_i2c_send(unsigned int addr, int data0, int data1)
{
int retval;
unsigned char data[2];
@@ -185,7 +185,7 @@ int ipod_i2c_send(unsigned int addr, int data0, int data1)
data[1] = data1;
mutex_lock(&i2c_mutex);
- retval = ipod_i2c_send_bytes(addr, 2, data);
+ retval = pp_i2c_send_bytes(addr, 2, data);
mutex_unlock(&i2c_mutex);
return retval;
diff --git a/firmware/drivers/pcf50605.c b/firmware/drivers/pcf50605.c
index 0f71229964..61c52a14f5 100644
--- a/firmware/drivers/pcf50605.c
+++ b/firmware/drivers/pcf50605.c
@@ -85,7 +85,7 @@ int pcf50605_read_multiple(int address, unsigned char* buf, int count)
int pcf50605_write(int address, unsigned char val)
{
- ipod_i2c_send(0x8, address, val);
+ pp_i2c_send(0x8, address, val);
return 0;
}
diff --git a/firmware/drivers/rtc.c b/firmware/drivers/rtc.c
index c911dabbb1..4f30539904 100644
--- a/firmware/drivers/rtc.c
+++ b/firmware/drivers/rtc.c
@@ -67,7 +67,7 @@ int rtc_write_datetime(unsigned char* buf)
buf[4]=tmp;
for (i=0;i<7;i++){
- ipod_i2c_send(0x51, 0x02+i,buf[i]);
+ pp_i2c_send(0x51, 0x02+i,buf[i]);
}
return 1;
}
diff --git a/firmware/export/i2c-pp5002.h b/firmware/export/i2c-pp5002.h
index 18f8c3461d..68c0dda8f7 100644
--- a/firmware/export/i2c-pp5002.h
+++ b/firmware/export/i2c-pp5002.h
@@ -29,7 +29,7 @@
void i2c_init(void);
int i2c_readbyte(unsigned int dev_addr, int addr);
-int ipod_i2c_send(unsigned int addr, int data0, int data1);
+int pp_i2c_send(unsigned int addr, int data0, int data1);
int i2c_readbytes(unsigned int dev_addr, int addr, int len, unsigned char *data);
#endif
diff --git a/firmware/export/i2c-pp5020.h b/firmware/export/i2c-pp5020.h
index 34f16ec12f..b8b10d6388 100644
--- a/firmware/export/i2c-pp5020.h
+++ b/firmware/export/i2c-pp5020.h
@@ -29,7 +29,7 @@
void i2c_init(void);
int i2c_readbyte(unsigned int dev_addr, int addr);
-int ipod_i2c_send(unsigned int addr, int data0, int data1);
+int pp_i2c_send(unsigned int addr, int data0, int data1);
int i2c_readbytes(unsigned int dev_addr, int addr, int len, unsigned char *data);
#endif
diff --git a/firmware/target/arm/wmcodec-pp.c b/firmware/target/arm/wmcodec-pp.c
index e9626220e7..73324c0dec 100644
--- a/firmware/target/arm/wmcodec-pp.c
+++ b/firmware/target/arm/wmcodec-pp.c
@@ -43,6 +43,14 @@
#include "i2c-pp5002.h"
#endif
+#if defined(IRIVER_H10) || defined(IRIVER_H10_5GB)
+/* The H10's audio codec uses an I2C address of 0x1b */
+#define I2C_AUDIO_ADDRESS 0x1b
+#else
+/* The iPod's audio codecs use an I2C address of 0x1a */
+#define I2C_AUDIO_ADDRESS 0x1a
+#endif
+
/*
* Reset the I2S BIT.FORMAT I2S, 16bit, FIFO.FORMAT 32bit
*/
@@ -144,13 +152,5 @@ int wmcodec_init(void) {
void wmcodec_write(int reg, int data)
{
-/* Todo: Since the ipod_i2c_* functions also work on H10 and possibly other PP
- targets, these functions should probably be renamed */
-#if defined(IRIVER_H10) || defined(IRIVER_H10_5GB)
- /* The H10's audio codec uses an I2C address of 0x1b */
- ipod_i2c_send(0x1b, (reg<<1) | ((data&0x100)>>8),data&0xff);
-#else
- /* The iPod's audio codecs use an I2C address of 0x1a */
- ipod_i2c_send(0x1a, (reg<<1) | ((data&0x100)>>8),data&0xff);
-#endif
+ pp_i2c_send(I2C_AUDIO_ADDRESS, (reg<<1) | ((data&0x100)>>8),data&0xff);
}