summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/recorder/radio.c8
-rw-r--r--docs/CREDITS1
-rw-r--r--firmware/drivers/fmradio_i2c.c52
-rw-r--r--firmware/drivers/i2c-coldfire.c7
-rw-r--r--firmware/export/config-h300.h3
-rw-r--r--firmware/pcm_record.c10
6 files changed, 62 insertions, 19 deletions
diff --git a/apps/recorder/radio.c b/apps/recorder/radio.c
index 2ed2a68ef8..5e40425d30 100644
--- a/apps/recorder/radio.c
+++ b/apps/recorder/radio.c
@@ -78,7 +78,7 @@
78#define FM_PRESET_ADD BUTTON_F1 78#define FM_PRESET_ADD BUTTON_F1
79#define FM_PRESET_ACTION BUTTON_F3 79#define FM_PRESET_ACTION BUTTON_F3
80 80
81#elif CONFIG_KEYPAD == IRIVER_H100_PAD 81#elif (CONFIG_KEYPAD == IRIVER_H100_PAD) || (CONFIG_KEYPAD == IRIVER_H300_PAD)
82/* pause/play - short PLAY */ 82/* pause/play - short PLAY */
83#define FM_PLAY_PRE BUTTON_ON 83#define FM_PLAY_PRE BUTTON_ON
84#define FM_RC_PLAY_PRE BUTTON_RC_ON 84#define FM_RC_PLAY_PRE BUTTON_RC_ON
@@ -1075,7 +1075,7 @@ int handle_radio_presets_cb(int key, int m)
1075 key = BUTTON_NONE; 1075 key = BUTTON_NONE;
1076 break; 1076 break;
1077#endif 1077#endif
1078#if CONFIG_KEYPAD != IRIVER_H100_PAD 1078#if (CONFIG_KEYPAD != IRIVER_H100_PAD) && (CONFIG_KEYPAD != IRIVER_H300_PAD)
1079#ifdef FM_PRESET 1079#ifdef FM_PRESET
1080 case FM_PRESET: 1080 case FM_PRESET:
1081 menu_draw(m); 1081 menu_draw(m);
@@ -1285,7 +1285,7 @@ int radio_menu_cb(int key, int m)
1285 (void)m; 1285 (void)m;
1286 switch(key) 1286 switch(key)
1287 { 1287 {
1288#if CONFIG_KEYPAD != IRIVER_H100_PAD 1288#if (CONFIG_KEYPAD != IRIVER_H100_PAD) && (CONFIG_KEYPAD != IRIVER_H300_PAD)
1289#ifdef MENU_ENTER2 1289#ifdef MENU_ENTER2
1290 case MENU_ENTER2: 1290 case MENU_ENTER2:
1291#endif 1291#endif
@@ -1294,7 +1294,7 @@ int radio_menu_cb(int key, int m)
1294 key = BUTTON_NONE; /* eat the downpress, next menu reacts on release */ 1294 key = BUTTON_NONE; /* eat the downpress, next menu reacts on release */
1295 break; 1295 break;
1296 1296
1297#if CONFIG_KEYPAD != IRIVER_H100_PAD 1297#if (CONFIG_KEYPAD != IRIVER_H100_PAD) && (CONFIG_KEYPAD != IRIVER_H300_PAD)
1298#ifdef MENU_ENTER2 1298#ifdef MENU_ENTER2
1299 case MENU_ENTER2 | BUTTON_REL: 1299 case MENU_ENTER2 | BUTTON_REL:
1300#endif 1300#endif
diff --git a/docs/CREDITS b/docs/CREDITS
index a5a1426383..52fead8dff 100644
--- a/docs/CREDITS
+++ b/docs/CREDITS
@@ -149,3 +149,4 @@ Toshihiko Itoh
149David J. Song 149David J. Song
150Jeong Taek In 150Jeong Taek In
151Anders Kagerin 151Anders Kagerin
152Peter D'Hoye
diff --git a/firmware/drivers/fmradio_i2c.c b/firmware/drivers/fmradio_i2c.c
index 4e491093f0..2475084696 100644
--- a/firmware/drivers/fmradio_i2c.c
+++ b/firmware/drivers/fmradio_i2c.c
@@ -30,18 +30,38 @@
30/* cute little functions, atomic read-modify-write */ 30/* cute little functions, atomic read-modify-write */
31/* SDA is GPIO1,23 */ 31/* SDA is GPIO1,23 */
32 32
33#define SDA_LO and_l(~0x00800000, &GPIO1_OUT) // and_b(~0x10, &PBDRL) 33#ifdef IRIVER_H300_SERIES
34#define SDA_HI or_l( 0x00800000, &GPIO1_OUT) // or_b( 0x10, &PBDRL) 34
35#define SDA_INPUT and_l(~0x00800000, &GPIO1_ENABLE) // and_b(~0x10, &PBIORL) 35/* SDA is GPIO57 */
36#define SDA_OUTPUT or_l( 0x00800000, &GPIO1_ENABLE) // or_b( 0x10, &PBIORL) 36#define SDA_LO and_l(~0x02000000, &GPIO1_OUT)
37#define SDA ( 0x00800000 & GPIO1_READ) // (PBDR & 0x0010) 37#define SDA_HI or_l( 0x02000000, &GPIO1_OUT)
38 38#define SDA_INPUT and_l(~0x02000000, &GPIO1_ENABLE)
39/* SCL is GPIO, 3 */ 39#define SDA_OUTPUT or_l( 0x02000000, &GPIO1_ENABLE)
40#define SCL_INPUT and_l(~0x00000008, &GPIO_ENABLE) // and_b(~0x02, &PBIORL) 40#define SDA ( 0x02000000 & GPIO1_READ)
41#define SCL_OUTPUT or_l( 0x00000008, &GPIO_ENABLE) // or_b( 0x02, &PBIORL) 41
42#define SCL_LO and_l(~0x00000008, &GPIO_OUT) // and_b(~0x02, &PBDRL) 42/* SCL is GPIO56 */
43#define SCL_HI or_l( 0x00000008, &GPIO_OUT) // or_b( 0x02, &PBDRL) 43#define SCL_INPUT and_l(~0x01000000, &GPIO1_ENABLE)
44#define SCL ( 0x00000008 & GPIO_READ) // (PBDR & 0x0002) 44#define SCL_OUTPUT or_l( 0x01000000, &GPIO1_ENABLE)
45#define SCL_LO and_l(~0x01000000, &GPIO1_OUT)
46#define SCL_HI or_l( 0x01000000, &GPIO1_OUT)
47#define SCL ( 0x01000000 & GPIO1_READ)
48
49#else
50
51/* SDA is GPIO55 */
52#define SDA_LO and_l(~0x00800000, &GPIO1_OUT)
53#define SDA_HI or_l( 0x00800000, &GPIO1_OUT)
54#define SDA_INPUT and_l(~0x00800000, &GPIO1_ENABLE)
55#define SDA_OUTPUT or_l( 0x00800000, &GPIO1_ENABLE)
56#define SDA ( 0x00800000 & GPIO1_READ)
57
58/* SCL is GPIO3 */
59#define SCL_INPUT and_l(~0x00000008, &GPIO_ENABLE)
60#define SCL_OUTPUT or_l( 0x00000008, &GPIO_ENABLE)
61#define SCL_LO and_l(~0x00000008, &GPIO_OUT)
62#define SCL_HI or_l( 0x00000008, &GPIO_OUT)
63#define SCL ( 0x00000008 & GPIO_READ)
64#endif
45 65
46/* delay loop to achieve 400kHz at 120MHz CPU frequency */ 66/* delay loop to achieve 400kHz at 120MHz CPU frequency */
47#define DELAY do { int _x; for(_x=0;_x<22;_x++);} while(0) 67#define DELAY do { int _x; for(_x=0;_x<22;_x++);} while(0)
@@ -84,8 +104,8 @@ static void fmradio_i2c_ack(void)
84 SCL_INPUT; /* Set the clock to input */ 104 SCL_INPUT; /* Set the clock to input */
85 while(!SCL) /* and wait for the slave to release it */ 105 while(!SCL) /* and wait for the slave to release it */
86 { 106 {
87 SCL_OUTPUT; /* Set the clock to output */
88 SCL_HI; 107 SCL_HI;
108 SCL_OUTPUT; /* Set the clock to output */
89 SCL_INPUT; /* Set the clock to input */ 109 SCL_INPUT; /* Set the clock to input */
90 DELAY; 110 DELAY;
91 } 111 }
@@ -111,8 +131,8 @@ static int fmradio_i2c_getack(void)
111 SCL_INPUT; /* Set the clock to input */ 131 SCL_INPUT; /* Set the clock to input */
112 while(!SCL) /* and wait for the slave to release it */ 132 while(!SCL) /* and wait for the slave to release it */
113 { 133 {
114 SCL_OUTPUT; /* Set the clock to output */
115 SCL_HI; 134 SCL_HI;
135 SCL_OUTPUT; /* Set the clock to output */
116 SCL_INPUT; /* Set the clock to input */ 136 SCL_INPUT; /* Set the clock to input */
117 DELAY; 137 DELAY;
118 } 138 }
@@ -160,10 +180,12 @@ static unsigned char fmradio_i2c_inb(void)
160 /* clock in each bit, MSB first */ 180 /* clock in each bit, MSB first */
161 for ( i=0x80; i; i>>=1 ) { 181 for ( i=0x80; i; i>>=1 ) {
162 SDA_INPUT; /* And set to input */ 182 SDA_INPUT; /* And set to input */
163 SCL_HI; 183 DELAY;
164 DELAY; 184 DELAY;
165 if ( SDA ) 185 if ( SDA )
166 byte |= i; 186 byte |= i;
187 SCL_HI;
188 DELAY;
167 SCL_LO; 189 SCL_LO;
168 DELAY; 190 DELAY;
169 SDA_OUTPUT; 191 SDA_OUTPUT;
diff --git a/firmware/drivers/i2c-coldfire.c b/firmware/drivers/i2c-coldfire.c
index 0c83c1cb1a..ffdc4f29de 100644
--- a/firmware/drivers/i2c-coldfire.c
+++ b/firmware/drivers/i2c-coldfire.c
@@ -46,7 +46,14 @@ void i2c_init(void)
46 or_l(0x00000008, &GPIO_ENABLE); 46 or_l(0x00000008, &GPIO_ENABLE);
47 or_l(0x00800000, &GPIO1_FUNCTION); 47 or_l(0x00800000, &GPIO1_FUNCTION);
48 or_l(0x00000008, &GPIO_FUNCTION); 48 or_l(0x00000008, &GPIO_FUNCTION);
49#elif defined(IRIVER_H300_SERIES)
50 /* The FM chip has no pullup for SCL, so we have to bit-bang the
51 I2C for that one. */
52 or_l(0x03000000, &GPIO1_OUT);
53 or_l(0x03000000, &GPIO1_ENABLE);
54 or_l(0x03000000, &GPIO1_FUNCTION);
49#endif 55#endif
56
50 /* I2C Clock divisor = 576 => 119.952 MHz / 2 / 576 = 104.125 kHz */ 57 /* I2C Clock divisor = 576 => 119.952 MHz / 2 / 576 = 104.125 kHz */
51 MFDR = 0x14; 58 MFDR = 0x14;
52 59
diff --git a/firmware/export/config-h300.h b/firmware/export/config-h300.h
index 5524a55dc0..3f7c7d391e 100644
--- a/firmware/export/config-h300.h
+++ b/firmware/export/config-h300.h
@@ -48,6 +48,9 @@
48/* The number of bytes reserved for loadable plugins */ 48/* The number of bytes reserved for loadable plugins */
49#define PLUGIN_BUFFER_SIZE 0xC0000 49#define PLUGIN_BUFFER_SIZE 0xC0000
50 50
51#define CONFIG_TUNER TEA5767
52#define CONFIG_TUNER_XTAL 32768
53
51#define HAVE_UDA1380 54#define HAVE_UDA1380
52 55
53#ifndef SIMULATOR 56#ifndef SIMULATOR
diff --git a/firmware/pcm_record.c b/firmware/pcm_record.c
index d26a4d303a..af58df36d0 100644
--- a/firmware/pcm_record.c
+++ b/firmware/pcm_record.c
@@ -905,6 +905,15 @@ static void pcmrec_thread(void)
905/* Select VINL & VINR source: 0=Line-in, 1=FM Radio */ 905/* Select VINL & VINR source: 0=Line-in, 1=FM Radio */
906void pcm_rec_mux(int source) 906void pcm_rec_mux(int source)
907{ 907{
908#ifdef IRIVER_H300_SERIES
909 if(source == 0)
910 and_l(~0x40000000, &GPIO_OUT); /* Line In */
911 else
912 or_l(0x40000000, &GPIO_OUT); /* FM radio */
913
914 or_l(0x40000000, &GPIO_ENABLE);
915 or_l(0x40000000, &GPIO_FUNCTION);
916#else
908 if(source == 0) 917 if(source == 0)
909 and_l(~0x00800000, &GPIO_OUT); /* Line In */ 918 and_l(~0x00800000, &GPIO_OUT); /* Line In */
910 else 919 else
@@ -912,4 +921,5 @@ void pcm_rec_mux(int source)
912 921
913 or_l(0x00800000, &GPIO_ENABLE); 922 or_l(0x00800000, &GPIO_ENABLE);
914 or_l(0x00800000, &GPIO_FUNCTION); 923 or_l(0x00800000, &GPIO_FUNCTION);
924#endif
915} 925}