summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-rw-r--r--firmware/backlight.c9
-rw-r--r--firmware/boot.lds39
-rw-r--r--firmware/drivers/ata.c8
-rw-r--r--firmware/drivers/i2c-coldfire.c3
-rw-r--r--firmware/drivers/power.c14
-rw-r--r--firmware/export/config-h100.h2
-rw-r--r--firmware/export/config-h120.h2
-rw-r--r--firmware/pcm_playback.c8
8 files changed, 51 insertions, 34 deletions
diff --git a/firmware/backlight.c b/firmware/backlight.c
index fa6a42be44..26d0362c27 100644
--- a/firmware/backlight.c
+++ b/firmware/backlight.c
@@ -456,7 +456,14 @@ void backlight_init(void)
456 456
457#else /* no backlight, empty dummy functions */ 457#else /* no backlight, empty dummy functions */
458 458
459void backlight_init(void) {} 459void backlight_init(void)
460{
461#if defined(IRIVER_H300_SERIES) && defined(BOOTLOADER)
462 or_l(0x00020000, &GPIO1_OUT);
463 or_l(0x00020000, &GPIO1_ENABLE);
464 or_l(0x00020000, &GPIO1_FUNCTION);
465#endif
466}
460void backlight_on(void) {} 467void backlight_on(void) {}
461void backlight_off(void) {} 468void backlight_off(void) {}
462void backlight_tick(void) {} 469void backlight_tick(void) {}
diff --git a/firmware/boot.lds b/firmware/boot.lds
index 2d320e2b81..d785fdcc2e 100644
--- a/firmware/boot.lds
+++ b/firmware/boot.lds
@@ -12,13 +12,7 @@ OUTPUT_FORMAT(elf32-sh)
12INPUT(crt0.o) 12INPUT(crt0.o)
13#endif 13#endif
14 14
15#if MEMORYSIZE >= 32 15#define DRAMSIZE (MEMORYSIZE * 0x100000)
16#define PLUGINSIZE 0xC0000
17#else
18#define PLUGINSIZE 0x8000
19#endif
20
21#define DRAMSIZE (MEMORYSIZE * 0x100000) - PLUGINSIZE
22 16
23#ifdef IRIVER_H100_SERIES 17#ifdef IRIVER_H100_SERIES
24#define DRAMORIG 0x31000000 18#define DRAMORIG 0x31000000
@@ -26,6 +20,12 @@ INPUT(crt0.o)
26#define IRAMSIZE 0x18000 20#define IRAMSIZE 0x18000
27#define FLASHORIG 0x001f0000 21#define FLASHORIG 0x001f0000
28#define FLASHSIZE 2M 22#define FLASHSIZE 2M
23#elif defined(IRIVER_H300_SERIES)
24#define DRAMORIG 0x31000000
25#define IRAMORIG 0x10000000
26#define IRAMSIZE 0x18000
27#define FLASHORIG 0x003f0000
28#define FLASHSIZE 4M
29#elif CONFIG_CPU == PP5020 29#elif CONFIG_CPU == PP5020
30#define DRAMORIG 0x10000000 30#define DRAMORIG 0x10000000
31#define IRAMORIG 0x40000000 31#define IRAMORIG 0x40000000
@@ -40,8 +40,6 @@ INPUT(crt0.o)
40#define FLASHSIZE 256K - ROM_START 40#define FLASHSIZE 256K - ROM_START
41#endif 41#endif
42 42
43#define ENDADDR (IRAMORIG + IRAMSIZE)
44
45#if CONFIG_CPU!=PP5020 43#if CONFIG_CPU!=PP5020
46MEMORY 44MEMORY
47{ 45{
@@ -141,29 +139,22 @@ SECTIONS
141 stackend = .; 139 stackend = .;
142 } > IRAM 140 } > IRAM
143 141
142#ifdef IRIVER_H300_SERIES
143 .bss DRAMORIG+0x1000000:
144#else
144 .bss : 145 .bss :
146#endif
145 { 147 {
146 _edata = .; 148 _edata = .;
147 *(.ibss) 149 *(.ibss)
148 *(.bss) 150 *(.bss)
149 *(COMMON) 151 *(COMMON)
150 _end = .; 152 _end = .;
153#ifdef IRIVER_H300_SERIES
154 } > DRAM
155#else
151 } > IRAM 156 } > IRAM
157#endif
152 158
153 .mp3buf :
154 {
155 . = ALIGN(0x4);
156 _mp3buffer = .;
157 } > IRAM
158
159 .mp3end ENDADDR:
160 {
161 _mp3end = .;
162 } > IRAM
163
164 .plugin ENDADDR:
165 {
166 _pluginbuf = .;
167 }
168} 159}
169#endif 160#endif
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c
index 9cc49c1731..c0799f30e4 100644
--- a/firmware/drivers/ata.c
+++ b/firmware/drivers/ata.c
@@ -1413,16 +1413,20 @@ int ata_init(void)
1413 or_b(0x02, &PADRH); /* release ATA reset */ 1413 or_b(0x02, &PADRH); /* release ATA reset */
1414 PACR2 &= 0xBFFF; /* GPIO function for PA7 (IDE enable) */ 1414 PACR2 &= 0xBFFF; /* GPIO function for PA7 (IDE enable) */
1415#elif CONFIG_CPU == MCF5249 1415#elif CONFIG_CPU == MCF5249
1416#ifdef HAVE_ATA_LED_CTRL
1416 /* Enable disk LED & ISD chip power control */ 1417 /* Enable disk LED & ISD chip power control */
1417 and_l(~0x0000240, &GPIO_OUT); 1418 and_l(~0x0000240, &GPIO_OUT);
1418 or_l(0x00000240, &GPIO_ENABLE); 1419 or_l(0x00000240, &GPIO_ENABLE);
1419 or_l(0x00000200, &GPIO_FUNCTION); 1420 or_l(0x00000200, &GPIO_FUNCTION);
1421#endif
1420 1422
1421 /* ATA reset */ 1423 /* ATA reset */
1422 or_l(0x00080000, &GPIO_OUT); 1424 and_l(~0x00080000, &GPIO_OUT);
1423 or_l(0x00080000, &GPIO_ENABLE); 1425 or_l(0x00080000, &GPIO_ENABLE);
1424 or_l(0x00080000, &GPIO_FUNCTION); 1426 or_l(0x00080000, &GPIO_FUNCTION);
1425 1427 sleep(10);
1428 or_l(0x00080000, &GPIO_OUT);
1429
1426 /* FYI: The IDECONFIGx registers are set by set_cpu_frequency() */ 1430 /* FYI: The IDECONFIGx registers are set by set_cpu_frequency() */
1427#elif CONFIG_CPU == PP5020 1431#elif CONFIG_CPU == PP5020
1428 /* From ipod-ide.c:ipod_ide_register() */ 1432 /* From ipod-ide.c:ipod_ide_register() */
diff --git a/firmware/drivers/i2c-coldfire.c b/firmware/drivers/i2c-coldfire.c
index aecd3a3b3b..0c83c1cb1a 100644
--- a/firmware/drivers/i2c-coldfire.c
+++ b/firmware/drivers/i2c-coldfire.c
@@ -37,6 +37,7 @@ static volatile unsigned char *i2c_get_addr(int device);
37 37
38void i2c_init(void) 38void i2c_init(void)
39{ 39{
40#ifdef IRIVER_H100_SERIES
40 /* The FM chip has no pullup for SCL, so we have to bit-bang the 41 /* The FM chip has no pullup for SCL, so we have to bit-bang the
41 I2C for that one. */ 42 I2C for that one. */
42 or_l(0x00800000, &GPIO1_OUT); 43 or_l(0x00800000, &GPIO1_OUT);
@@ -45,7 +46,7 @@ void i2c_init(void)
45 or_l(0x00000008, &GPIO_ENABLE); 46 or_l(0x00000008, &GPIO_ENABLE);
46 or_l(0x00800000, &GPIO1_FUNCTION); 47 or_l(0x00800000, &GPIO1_FUNCTION);
47 or_l(0x00000008, &GPIO_FUNCTION); 48 or_l(0x00000008, &GPIO_FUNCTION);
48 49#endif
49 /* I2C Clock divisor = 576 => 119.952 MHz / 2 / 576 = 104.125 kHz */ 50 /* I2C Clock divisor = 576 => 119.952 MHz / 2 / 576 = 104.125 kHz */
50 MFDR = 0x14; 51 MFDR = 0x14;
51 52
diff --git a/firmware/drivers/power.c b/firmware/drivers/power.c
index 4e5d347d54..2547c11cb0 100644
--- a/firmware/drivers/power.c
+++ b/firmware/drivers/power.c
@@ -62,23 +62,25 @@ int radio_get_status(void)
62void power_init(void) 62void power_init(void)
63{ 63{
64#if CONFIG_CPU == MCF5249 64#if CONFIG_CPU == MCF5249
65#if IRIVER_H100_SERIES 65#if defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES)
66 or_l(0x00080000, &GPIO1_OUT); 66// or_l(0x00080000, &GPIO1_OUT);
67 or_l(0x00080000, &GPIO1_ENABLE); 67// or_l(0x00080000, &GPIO1_ENABLE);
68 or_l(0x00080000, &GPIO1_FUNCTION); 68// or_l(0x00080000, &GPIO1_FUNCTION);
69 69
70#ifndef BOOTLOADER 70#ifndef BOOTLOADER
71 /* The boot loader controls the power */ 71 /* The boot loader controls the power */
72 ide_power_enable(true); 72// ide_power_enable(true);
73#endif 73#endif
74 or_l(0x80000000, &GPIO_OUT);
74 or_l(0x80000000, &GPIO_ENABLE); 75 or_l(0x80000000, &GPIO_ENABLE);
75 or_l(0x80000000, &GPIO_FUNCTION); 76 or_l(0x80000000, &GPIO_FUNCTION);
76#ifdef HAVE_SPDIF_POWER 77#ifdef HAVE_SPDIF_POWER
77 spdif_power_enable(false); 78 spdif_power_enable(false);
78#endif 79#endif
79#elif defined(IRIVER_H300_SERIES) 80#ifdef IRIVER_H300_SERIES
80 pcf50606_init(); 81 pcf50606_init();
81#endif 82#endif
83#endif
82#elif CONFIG_CPU == PP5020 84#elif CONFIG_CPU == PP5020
83 /* TODO: Implement power_init() */ 85 /* TODO: Implement power_init() */
84#else 86#else
diff --git a/firmware/export/config-h100.h b/firmware/export/config-h100.h
index 19bb99bc04..35b35e0f27 100644
--- a/firmware/export/config-h100.h
+++ b/firmware/export/config-h100.h
@@ -91,6 +91,8 @@
91 91
92#define USB_IRIVERSTYLE 92#define USB_IRIVERSTYLE
93 93
94#define HAVE_ATA_LED_CTRL
95
94/* Define this if you have adjustable CPU frequency */ 96/* Define this if you have adjustable CPU frequency */
95#define HAVE_ADJUSTABLE_CPU_FREQ 97#define HAVE_ADJUSTABLE_CPU_FREQ
96 98
diff --git a/firmware/export/config-h120.h b/firmware/export/config-h120.h
index b2c34c5a55..e6c829a2a5 100644
--- a/firmware/export/config-h120.h
+++ b/firmware/export/config-h120.h
@@ -88,6 +88,8 @@
88 88
89#define USB_IRIVERSTYLE 89#define USB_IRIVERSTYLE
90 90
91#define HAVE_ATA_LED_CTRL
92
91/* Define this if you have adjustable CPU frequency */ 93/* Define this if you have adjustable CPU frequency */
92#define HAVE_ADJUSTABLE_CPU_FREQ 94#define HAVE_ADJUSTABLE_CPU_FREQ
93 95
diff --git a/firmware/pcm_playback.c b/firmware/pcm_playback.c
index 05c5447ff8..5f87917844 100644
--- a/firmware/pcm_playback.c
+++ b/firmware/pcm_playback.c
@@ -77,8 +77,10 @@ static void dma_start(const void *addr, long size)
77 77
78 /* Enable the FIFO and force one write to it */ 78 /* Enable the FIFO and force one write to it */
79 IIS2CONFIG = IIS_DEFPARM(pcm_freq); 79 IIS2CONFIG = IIS_DEFPARM(pcm_freq);
80#ifdef HAVE_SPDIF_OUT
80 /* Also send the audio to S/PDIF */ 81 /* Also send the audio to S/PDIF */
81 EBU1CONFIG = EBU_DEFPARM; 82 EBU1CONFIG = EBU_DEFPARM;
83#endif
82 DCR0 = DMA_INT | DMA_EEXT | DMA_CS | DMA_SINC | DMA_START; 84 DCR0 = DMA_INT | DMA_EEXT | DMA_CS | DMA_SINC | DMA_START;
83} 85}
84 86
@@ -90,7 +92,9 @@ static void dma_stop(void)
90 DCR0 = 0; 92 DCR0 = 0;
91 /* Reset the FIFO */ 93 /* Reset the FIFO */
92 IIS2CONFIG = IIS_RESET | IIS_DEFPARM(pcm_freq); 94 IIS2CONFIG = IIS_RESET | IIS_DEFPARM(pcm_freq);
95#ifdef HAVE_SPDIF_OUT
93 EBU1CONFIG = IIS_RESET; 96 EBU1CONFIG = IIS_RESET;
97#endif
94 98
95 next_start = NULL; 99 next_start = NULL;
96 next_size = 0; 100 next_size = 0;
@@ -220,7 +224,9 @@ void pcm_play_pause(bool play)
220 //BCR0 = next_size; 224 //BCR0 = next_size;
221 /* Enable the FIFO and force one write to it */ 225 /* Enable the FIFO and force one write to it */
222 IIS2CONFIG = IIS_DEFPARM(pcm_freq); 226 IIS2CONFIG = IIS_DEFPARM(pcm_freq);
227#ifdef HAVE_SPDIF_OUT
223 EBU1CONFIG = EBU_DEFPARM; 228 EBU1CONFIG = EBU_DEFPARM;
229#endif
224 DCR0 |= DMA_EEXT | DMA_START; 230 DCR0 |= DMA_EEXT | DMA_START;
225 } 231 }
226 else if(!pcm_paused && !play) 232 else if(!pcm_paused && !play)
@@ -230,7 +236,9 @@ void pcm_play_pause(bool play)
230 /* Disable DMA peripheral request. */ 236 /* Disable DMA peripheral request. */
231 DCR0 &= ~DMA_EEXT; 237 DCR0 &= ~DMA_EEXT;
232 IIS2CONFIG = IIS_RESET | IIS_DEFPARM(pcm_freq); 238 IIS2CONFIG = IIS_RESET | IIS_DEFPARM(pcm_freq);
239#ifdef HAVE_SPDIF_OUT
233 EBU1CONFIG = IIS_RESET; 240 EBU1CONFIG = IIS_RESET;
241#endif
234 } 242 }
235 pcm_paused = !play; 243 pcm_paused = !play;
236} 244}