summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter D'Hoye <peter.dhoye@gmail.com>2006-08-15 22:54:06 +0000
committerPeter D'Hoye <peter.dhoye@gmail.com>2006-08-15 22:54:06 +0000
commitc4a59a290b81cae137f8b3c2b709c9c565701eb9 (patch)
tree9d54832f14b8fe365e427152011b62026f61e898
parent98c9f959e53536a0b63d0376fad198ef883c5c03 (diff)
downloadrockbox-c4a59a290b81cae137f8b3c2b709c9c565701eb9.tar.gz
rockbox-c4a59a290b81cae137f8b3c2b709c9c565701eb9.zip
eeprom driver for the h3x0 series, cleaned up the h1x0 series driver a bit, added debug entry for h3x0 that allows to write to the eeprom
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@10597 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/debug_menu.c60
-rw-r--r--apps/main.c8
-rw-r--r--apps/misc.c2
-rw-r--r--apps/tagcache.c8
-rw-r--r--apps/tree.c4
-rw-r--r--bootloader/main.c10
-rw-r--r--firmware/SOURCES2
-rw-r--r--firmware/drivers/eeprom_24cxx.c55
-rw-r--r--firmware/drivers/pcf50606.c12
-rw-r--r--firmware/export/config-h100.h2
-rw-r--r--firmware/export/config-h120.h3
-rw-r--r--firmware/export/config-h300.h3
-rw-r--r--firmware/export/eeprom_24cxx.h5
-rw-r--r--firmware/export/pcf50606.h8
14 files changed, 132 insertions, 50 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index 0141c77fbe..1527e8abe7 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -1891,13 +1891,22 @@ bool dbg_save_roms(void)
1891 fd = creat("/internal_eeprom.bin", O_WRONLY); 1891 fd = creat("/internal_eeprom.bin", O_WRONLY);
1892 if (fd >= 0) 1892 if (fd >= 0)
1893 { 1893 {
1894 int old_irq_level;
1894 char buf[EEPROM_SIZE]; 1895 char buf[EEPROM_SIZE];
1895 1896 int err;
1896 if (eeprom_24cxx_read(0, buf, sizeof buf)) 1897
1897 gui_syncsplash(HZ*3, true, "Eeprom read failure!"); 1898 old_irq_level = set_irq_level(HIGHEST_IRQ_LEVEL);
1899
1900 err = eeprom_24cxx_read(0, buf, sizeof buf);
1901 if (err)
1902 gui_syncsplash(HZ*3, true, "Eeprom read failure (%d)",err);
1898 else 1903 else
1904 {
1899 write(fd, buf, sizeof buf); 1905 write(fd, buf, sizeof buf);
1900 1906 }
1907
1908 set_irq_level(old_irq_level);
1909
1901 close(fd); 1910 close(fd);
1902 } 1911 }
1903#endif 1912#endif
@@ -1976,6 +1985,46 @@ bool dbg_set_memory_guard(void)
1976} 1985}
1977#endif /* CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE) */ 1986#endif /* CONFIG_CPU == SH7034 || defined(CPU_COLDFIRE) */
1978 1987
1988#if defined(HAVE_EEPROM) && !defined(HAVE_EEPROM_SETTINGS)
1989bool dbg_write_eeprom(void)
1990{
1991 int fd;
1992 int rc;
1993 int old_irq_level;
1994 char buf[EEPROM_SIZE];
1995 int err;
1996
1997 fd = open("/internal_eeprom.bin", O_RDONLY);
1998
1999 if (fd >= 0)
2000 {
2001 rc = read(fd, buf, EEPROM_SIZE);
2002
2003 if(rc == EEPROM_SIZE)
2004 {
2005 old_irq_level = set_irq_level(HIGHEST_IRQ_LEVEL);
2006
2007 err = eeprom_24cxx_write(0, buf, sizeof buf);
2008 if (err)
2009 gui_syncsplash(HZ*3, true, "Eeprom write failure (%d)",err);
2010
2011 set_irq_level(old_irq_level);
2012 }
2013 else
2014 {
2015 gui_syncsplash(HZ*3, true, "File read error (%d)",rc);
2016 }
2017 close(fd);
2018 }
2019 else
2020 {
2021 gui_syncsplash(HZ*3, true, "Failed to open 'internal_eeprom.bin'");
2022 }
2023
2024 return false;
2025}
2026#endif /* defined(HAVE_EEPROM) && !defined(HAVE_EEPROM_SETTINGS) */
2027
1979bool debug_menu(void) 2028bool debug_menu(void)
1980{ 2029{
1981 int m; 2030 int m;
@@ -2023,6 +2072,9 @@ bool debug_menu(void)
2023#ifdef CONFIG_TUNER 2072#ifdef CONFIG_TUNER
2024 { "FM Radio", dbg_fm_radio }, 2073 { "FM Radio", dbg_fm_radio },
2025#endif 2074#endif
2075#if defined(HAVE_EEPROM) && !defined(HAVE_EEPROM_SETTINGS)
2076 { "Write back EEPROM", dbg_write_eeprom },
2077#endif
2026#ifdef ROCKBOX_HAS_LOGF 2078#ifdef ROCKBOX_HAS_LOGF
2027 {"logf", logfdisplay }, 2079 {"logf", logfdisplay },
2028 {"logfdump", logfdump }, 2080 {"logfdump", logfdump },
diff --git a/apps/main.c b/apps/main.c
index c50af865fc..90bd13ee32 100644
--- a/apps/main.c
+++ b/apps/main.c
@@ -120,7 +120,7 @@ int init_dircache(bool preinit)
120 120
121 if (global_settings.dircache) 121 if (global_settings.dircache)
122 { 122 {
123# ifdef HAVE_EEPROM 123# ifdef HAVE_EEPROM_SETTINGS
124 if (firmware_settings.initialized && firmware_settings.disk_clean 124 if (firmware_settings.initialized && firmware_settings.disk_clean
125 && preinit) 125 && preinit)
126 { 126 {
@@ -371,14 +371,14 @@ void init(void)
371 panicf("ata: %d", rc); 371 panicf("ata: %d", rc);
372 } 372 }
373 373
374#ifdef HAVE_EEPROM 374#ifdef HAVE_EEPROM_SETTINGS
375 eeprom_settings_init(); 375 eeprom_settings_init();
376#endif 376#endif
377 377
378 usb_start_monitoring(); 378 usb_start_monitoring();
379 while (usb_detect()) 379 while (usb_detect())
380 { 380 {
381#ifdef HAVE_EEPROM 381#ifdef HAVE_EEPROM_SETTINGS
382 firmware_settings.disk_clean = false; 382 firmware_settings.disk_clean = false;
383#endif 383#endif
384 /* enter USB mode early, before trying to mount */ 384 /* enter USB mode early, before trying to mount */
@@ -444,7 +444,7 @@ void init(void)
444 init_dircache(false); 444 init_dircache(false);
445 init_tagcache(); 445 init_tagcache();
446 446
447#ifdef HAVE_EEPROM 447#ifdef HAVE_EEPROM_SETTINGS
448 if (firmware_settings.initialized) 448 if (firmware_settings.initialized)
449 { 449 {
450 /* In case we crash. */ 450 /* In case we crash. */
diff --git a/apps/misc.c b/apps/misc.c
index ffacf7ed82..19cee60993 100644
--- a/apps/misc.c
+++ b/apps/misc.c
@@ -507,7 +507,7 @@ static bool clean_shutdown(void (*callback)(void *), void *parameter)
507 callback(parameter); 507 callback(parameter);
508 508
509 system_flush(); 509 system_flush();
510#ifdef HAVE_EEPROM 510#ifdef HAVE_EEPROM_SETTINGS
511 if (firmware_settings.initialized) 511 if (firmware_settings.initialized)
512 { 512 {
513 firmware_settings.disk_clean = true; 513 firmware_settings.disk_clean = true;
diff --git a/apps/tagcache.c b/apps/tagcache.c
index 179218ab1f..191c245597 100644
--- a/apps/tagcache.c
+++ b/apps/tagcache.c
@@ -153,7 +153,7 @@ struct ramcache_header {
153 int entry_count[TAG_COUNT]; /* Number of entries in the indices. */ 153 int entry_count[TAG_COUNT]; /* Number of entries in the indices. */
154}; 154};
155 155
156# ifdef HAVE_EEPROM 156# ifdef HAVE_EEPROM_SETTINGS
157struct statefile_header { 157struct statefile_header {
158 struct ramcache_header *hdr; 158 struct ramcache_header *hdr;
159 struct tagcache_stat stat; 159 struct tagcache_stat stat;
@@ -2829,7 +2829,7 @@ static bool allocate_tagcache(void)
2829 return true; 2829 return true;
2830} 2830}
2831 2831
2832# ifdef HAVE_EEPROM 2832# ifdef HAVE_EEPROM_SETTINGS
2833static bool tagcache_dumpload(void) 2833static bool tagcache_dumpload(void)
2834{ 2834{
2835 struct statefile_header shdr; 2835 struct statefile_header shdr;
@@ -3370,7 +3370,7 @@ static void tagcache_thread(void)
3370 free_tempbuf(); 3370 free_tempbuf();
3371 3371
3372#ifdef HAVE_TC_RAMCACHE 3372#ifdef HAVE_TC_RAMCACHE
3373# ifdef HAVE_EEPROM 3373# ifdef HAVE_EEPROM_SETTINGS
3374 if (firmware_settings.initialized && firmware_settings.disk_clean) 3374 if (firmware_settings.initialized && firmware_settings.disk_clean)
3375 check_done = tagcache_dumpload(); 3375 check_done = tagcache_dumpload();
3376 3376
@@ -3462,7 +3462,7 @@ bool tagcache_prepare_shutdown(void)
3462 if (tagcache_get_commit_step() > 0) 3462 if (tagcache_get_commit_step() > 0)
3463 return false; 3463 return false;
3464 3464
3465#ifdef HAVE_EEPROM 3465#ifdef HAVE_EEPROM_SETTINGS
3466 if (stat.ramcache) 3466 if (stat.ramcache)
3467 tagcache_dumpsave(); 3467 tagcache_dumpsave();
3468#endif 3468#endif
diff --git a/apps/tree.c b/apps/tree.c
index 1bbb5f8ca3..75562b30c8 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -1336,7 +1336,7 @@ void tree_flush(void)
1336 if (global_settings.dircache) 1336 if (global_settings.dircache)
1337 { 1337 {
1338 global_settings.dircache_size = dircache_get_cache_size(); 1338 global_settings.dircache_size = dircache_get_cache_size();
1339# ifdef HAVE_EEPROM 1339# ifdef HAVE_EEPROM_SETTINGS
1340 if (dircache_is_enabled() && firmware_settings.initialized) 1340 if (dircache_is_enabled() && firmware_settings.initialized)
1341 dircache_save(DIRCACHE_FILE); 1341 dircache_save(DIRCACHE_FILE);
1342# endif 1342# endif
@@ -1352,7 +1352,7 @@ void tree_flush(void)
1352 1352
1353void tree_restore(void) 1353void tree_restore(void)
1354{ 1354{
1355#ifdef HAVE_EEPROM 1355#ifdef HAVE_EEPROM_SETTINGS
1356 firmware_settings.disk_clean = false; 1356 firmware_settings.disk_clean = false;
1357#endif 1357#endif
1358 1358
diff --git a/bootloader/main.c b/bootloader/main.c
index 0b058272f1..7c2b1257a9 100644
--- a/bootloader/main.c
+++ b/bootloader/main.c
@@ -357,7 +357,7 @@ void main(void)
357 power_off(); 357 power_off();
358 } 358 }
359 359
360#ifdef HAVE_EEPROM 360#ifdef HAVE_EEPROM_SETTINGS
361 firmware_settings.initialized = false; 361 firmware_settings.initialized = false;
362#endif 362#endif
363 if (detect_flashed_rockbox()) 363 if (detect_flashed_rockbox())
@@ -365,7 +365,7 @@ void main(void)
365 bool load_from_flash; 365 bool load_from_flash;
366 366
367 load_from_flash = !rec_button; 367 load_from_flash = !rec_button;
368#ifdef HAVE_EEPROM 368#ifdef HAVE_EEPROM_SETTINGS
369 if (eeprom_settings_init()) 369 if (eeprom_settings_init())
370 { 370 {
371 /* If bootloader version has not been reset, disk might 371 /* If bootloader version has not been reset, disk might
@@ -389,7 +389,7 @@ void main(void)
389 lcd_update(); 389 lcd_update();
390 if (i == 0) 390 if (i == 0)
391 { 391 {
392#ifdef HAVE_EEPROM 392#ifdef HAVE_EEPROM_SETTINGS
393 eeprom_settings_store(); 393 eeprom_settings_store();
394#endif 394#endif
395 start_firmware(); 395 start_firmware();
@@ -457,7 +457,7 @@ void main(void)
457 sleep(HZ); 457 sleep(HZ);
458#endif 458#endif
459 459
460#ifdef HAVE_EEPROM 460#ifdef HAVE_EEPROM_SETTINGS
461 if (firmware_settings.initialized) 461 if (firmware_settings.initialized)
462 { 462 {
463 firmware_settings.disk_clean = false; 463 firmware_settings.disk_clean = false;
@@ -503,7 +503,7 @@ void main(void)
503 printf("Result: %d", i); 503 printf("Result: %d", i);
504 lcd_update(); 504 lcd_update();
505 505
506#ifdef HAVE_EEPROM 506#ifdef HAVE_EEPROM_SETTINGS
507 if (firmware_settings.initialized) 507 if (firmware_settings.initialized)
508 eeprom_settings_store(); 508 eeprom_settings_store();
509#endif 509#endif
diff --git a/firmware/SOURCES b/firmware/SOURCES
index fda83ee073..23da475304 100644
--- a/firmware/SOURCES
+++ b/firmware/SOURCES
@@ -150,8 +150,10 @@ drivers/pcf50606.c
150#endif 150#endif
151#ifdef HAVE_EEPROM 151#ifdef HAVE_EEPROM
152drivers/eeprom_24cxx.c 152drivers/eeprom_24cxx.c
153#ifdef HAVE_EEPROM_SETTINGS
153eeprom_settings.c 154eeprom_settings.c
154#endif 155#endif
156#endif
155#ifdef IPOD_ARCH 157#ifdef IPOD_ARCH
156drivers/pcf50605.c 158drivers/pcf50605.c
157#endif 159#endif
diff --git a/firmware/drivers/eeprom_24cxx.c b/firmware/drivers/eeprom_24cxx.c
index 9a8fa5d86d..66bc235052 100644
--- a/firmware/drivers/eeprom_24cxx.c
+++ b/firmware/drivers/eeprom_24cxx.c
@@ -35,21 +35,24 @@
35#define SW_I2C_WRITE 0 35#define SW_I2C_WRITE 0
36#define SW_I2C_READ 1 36#define SW_I2C_READ 1
37 37
38/* h1x0 needs its own i2c driver,
39 h3x0 uses the pcf i2c driver */
40
41#ifdef IRIVER_H100_SERIES
42
38/* cute little functions, atomic read-modify-write */ 43/* cute little functions, atomic read-modify-write */
39 44
40/* SCL is GPIO, 12 */ 45/* SCL is GPIO, 12 */
41#define SCL_LO and_l(~0x00001000, &GPIO_OUT) // and_b(~0x10, &PBDRL) 46#define SCL ( 0x00001000 & GPIO_READ)
42#define SCL_HI or_l( 0x00001000, &GPIO_OUT) // or_b( 0x10, &PBDRL) 47#define SCL_OUT_LO and_l(~0x00001000, &GPIO_OUT)
43#define SCL_INPUT and_l(~0x00001000, &GPIO_ENABLE) // and_b(~0x10, &PBIORL) 48#define SCL_LO or_l( 0x00001000, &GPIO_ENABLE)
44#define SCL_OUTPUT or_l( 0x00001000, &GPIO_ENABLE) // or_b( 0x10, &PBIORL) 49#define SCL_HI and_l(~0x00001000, &GPIO_ENABLE); while(!SCL);
45#define SCL ( 0x00001000 & GPIO_READ) // (PBDR & 0x0010)
46 50
47/* SDA is GPIO1, 13 */ 51/* SDA is GPIO1, 13 */
48#define SDA_LO and_l(~0x00002000, &GPIO1_OUT) // and_b(~0x02, &PBDRL) 52#define SDA ( 0x00002000 & GPIO1_READ)
49#define SDA_HI or_l( 0x00002000, &GPIO1_OUT) // or_b( 0x02, &PBDRL) 53#define SDA_OUT_LO and_l(~0x00002000, &GPIO1_OUT)
50#define SDA_INPUT and_l(~0x00002000, &GPIO1_ENABLE) // and_b(~0x02, &PBIORL) 54#define SDA_LO or_l( 0x00002000, &GPIO1_ENABLE)
51#define SDA_OUTPUT or_l( 0x00002000, &GPIO1_ENABLE) // or_b( 0x02, &PBIORL) 55#define SDA_HI and_l(~0x00002000, &GPIO1_ENABLE)
52#define SDA ( 0x00002000 & GPIO1_READ) // (PBDR & 0x0002)
53 56
54/* delay loop to achieve 400kHz at 120MHz CPU frequency */ 57/* delay loop to achieve 400kHz at 120MHz CPU frequency */
55#define DELAY do { int _x; for(_x=0;_x<22;_x++);} while(0) 58#define DELAY do { int _x; for(_x=0;_x<22;_x++);} while(0)
@@ -61,17 +64,15 @@ static void sw_i2c_init(void)
61 or_l(0x00002000, &GPIO1_FUNCTION); 64 or_l(0x00002000, &GPIO1_FUNCTION);
62 SDA_HI; 65 SDA_HI;
63 SCL_HI; 66 SCL_HI;
64 SDA_OUTPUT; 67 SDA_OUT_LO;
65 SCL_OUTPUT; 68 SCL_OUT_LO;
66} 69}
67 70
68static void sw_i2c_start(void) 71static void sw_i2c_start(void)
69{ 72{
70 SCL_LO; 73 SCL_LO;
71 SCL_OUTPUT;
72 DELAY; 74 DELAY;
73 SDA_HI; 75 SDA_HI;
74 SDA_OUTPUT;
75 DELAY; 76 DELAY;
76 SCL_HI; 77 SCL_HI;
77 DELAY; 78 DELAY;
@@ -88,7 +89,6 @@ static void sw_i2c_stop(void)
88 DELAY; 89 DELAY;
89} 90}
90 91
91
92static void sw_i2c_ack(void) 92static void sw_i2c_ack(void)
93{ 93{
94 SCL_LO; 94 SCL_LO;
@@ -105,7 +105,7 @@ static bool sw_i2c_getack(void)
105 int count = 10; 105 int count = 10;
106 106
107 SCL_LO; 107 SCL_LO;
108 SDA_INPUT; /* And set to input */ 108 SDA_HI; /* sets to input */
109 DELAY; 109 DELAY;
110 SCL_HI; 110 SCL_HI;
111 DELAY; 111 DELAY;
@@ -118,10 +118,8 @@ static bool sw_i2c_getack(void)
118 ret = false; 118 ret = false;
119 119
120 SCL_LO; 120 SCL_LO;
121 SCL_OUTPUT;
122 DELAY; 121 DELAY;
123 SDA_LO; 122 SDA_LO;
124 SDA_OUTPUT;
125 123
126 return ret; 124 return ret;
127} 125}
@@ -143,8 +141,6 @@ static void sw_i2c_outb(unsigned char byte)
143 SCL_HI; 141 SCL_HI;
144 DELAY; 142 DELAY;
145 } 143 }
146
147 // SDA_LO;
148} 144}
149 145
150static unsigned char sw_i2c_inb(void) 146static unsigned char sw_i2c_inb(void)
@@ -152,7 +148,7 @@ static unsigned char sw_i2c_inb(void)
152 int i; 148 int i;
153 unsigned char byte = 0; 149 unsigned char byte = 0;
154 150
155 SDA_INPUT; /* And set to input */ 151 SDA_HI; /* sets to input */
156 152
157 /* clock in each bit, MSB first */ 153 /* clock in each bit, MSB first */
158 for ( i=0x80; i; i>>=1 ) 154 for ( i=0x80; i; i>>=1 )
@@ -165,13 +161,26 @@ static unsigned char sw_i2c_inb(void)
165 DELAY; 161 DELAY;
166 } 162 }
167 163
168 SDA_OUTPUT;
169
170 sw_i2c_ack(); 164 sw_i2c_ack();
171 165
172 return byte; 166 return byte;
173} 167}
174 168
169#else
170
171#include "pcf50606.h"
172
173#define sw_i2c_init() /* no extra init required */
174#define sw_i2c_start() pcf50606_i2c_start()
175#define sw_i2c_stop() pcf50606_i2c_stop()
176#define sw_i2c_ack() pcf50606_i2c_ack(true)
177#define sw_i2c_getack() pcf50606_i2c_getack()
178#define sw_i2c_outb(x) pcf50606_i2c_outb(x)
179#define sw_i2c_inb() pcf50606_i2c_inb(false)
180
181#endif /* IRIVER_H100_SERIES */
182
183
175int sw_i2c_write(int location, const unsigned char* buf, int count) 184int sw_i2c_write(int location, const unsigned char* buf, int count)
176{ 185{
177 int i; 186 int i;
diff --git a/firmware/drivers/pcf50606.c b/firmware/drivers/pcf50606.c
index 0f2d73664b..28df295988 100644
--- a/firmware/drivers/pcf50606.c
+++ b/firmware/drivers/pcf50606.c
@@ -52,7 +52,7 @@ void pcf50606_i2c_recalc_delay(int cpu_clock)
52 i2c_delay = MAX(cpu_clock / (400000*2*3) - 7, 1); 52 i2c_delay = MAX(cpu_clock / (400000*2*3) - 7, 1);
53} 53}
54 54
55static inline void pcf50606_i2c_start(void) 55inline void pcf50606_i2c_start(void)
56{ 56{
57#ifdef USE_ASM 57#ifdef USE_ASM
58 asm ( 58 asm (
@@ -101,7 +101,7 @@ static inline void pcf50606_i2c_start(void)
101#endif 101#endif
102} 102}
103 103
104static inline void pcf50606_i2c_stop(void) 104inline void pcf50606_i2c_stop(void)
105{ 105{
106#ifdef USE_ASM 106#ifdef USE_ASM
107 asm ( 107 asm (
@@ -141,7 +141,7 @@ static inline void pcf50606_i2c_stop(void)
141#endif 141#endif
142} 142}
143 143
144static inline void pcf50606_i2c_ack(bool ack) 144inline void pcf50606_i2c_ack(bool ack)
145{ 145{
146#ifdef USE_ASM 146#ifdef USE_ASM
147 asm ( 147 asm (
@@ -193,7 +193,7 @@ static inline void pcf50606_i2c_ack(bool ack)
193#endif 193#endif
194} 194}
195 195
196static inline bool pcf50606_i2c_getack(void) 196inline bool pcf50606_i2c_getack(void)
197{ 197{
198 bool ret; 198 bool ret;
199 199
@@ -251,7 +251,7 @@ static inline bool pcf50606_i2c_getack(void)
251 return ret; 251 return ret;
252} 252}
253 253
254static void pcf50606_i2c_outb(unsigned char byte) 254void pcf50606_i2c_outb(unsigned char byte)
255{ 255{
256#ifdef USE_ASM 256#ifdef USE_ASM
257 asm volatile ( 257 asm volatile (
@@ -321,7 +321,7 @@ static void pcf50606_i2c_outb(unsigned char byte)
321#endif 321#endif
322} 322}
323 323
324static unsigned char pcf50606_i2c_inb(bool ack) 324unsigned char pcf50606_i2c_inb(bool ack)
325{ 325{
326 unsigned char byte = 0; 326 unsigned char byte = 0;
327 327
diff --git a/firmware/export/config-h100.h b/firmware/export/config-h100.h
index 88108c71f7..38f26c104b 100644
--- a/firmware/export/config-h100.h
+++ b/firmware/export/config-h100.h
@@ -129,7 +129,7 @@
129 129
130/* Define this if there is an EEPROM chip */ 130/* Define this if there is an EEPROM chip */
131/* Someone with H100 and BDM, please verify if this works. */ 131/* Someone with H100 and BDM, please verify if this works. */
132// #define HAVE_EEPROM 132/* #define HAVE_EEPROM */
133 133
134#endif /* !SIMULATOR */ 134#endif /* !SIMULATOR */
135 135
diff --git a/firmware/export/config-h120.h b/firmware/export/config-h120.h
index ca618139e9..a9b0ed3039 100644
--- a/firmware/export/config-h120.h
+++ b/firmware/export/config-h120.h
@@ -125,6 +125,9 @@
125/* Define this if there is an EEPROM chip */ 125/* Define this if there is an EEPROM chip */
126#define HAVE_EEPROM 126#define HAVE_EEPROM
127 127
128/* Define this if the EEPROM chip is used */
129#define HAVE_EEPROM_SETTINGS
130
128#endif /* !SIMULATOR */ 131#endif /* !SIMULATOR */
129 132
130/* Define this for S/PDIF input available */ 133/* Define this for S/PDIF input available */
diff --git a/firmware/export/config-h300.h b/firmware/export/config-h300.h
index f3ba076334..2a174bc4e5 100644
--- a/firmware/export/config-h300.h
+++ b/firmware/export/config-h300.h
@@ -133,4 +133,7 @@
133/* define this if the unit can be powered or charged via USB */ 133/* define this if the unit can be powered or charged via USB */
134#define HAVE_USB_POWER 134#define HAVE_USB_POWER
135 135
136/* Define this if there is an EEPROM chip */
137#define HAVE_EEPROM
138
136#endif /* SIMULATOR */ 139#endif /* SIMULATOR */
diff --git a/firmware/export/eeprom_24cxx.h b/firmware/export/eeprom_24cxx.h
index bc0f444f7e..c52dd830ef 100644
--- a/firmware/export/eeprom_24cxx.h
+++ b/firmware/export/eeprom_24cxx.h
@@ -20,8 +20,13 @@
20#ifndef _EEPROM_24CXX_H 20#ifndef _EEPROM_24CXX_H
21#define _EEPROM_24CXX_H 21#define _EEPROM_24CXX_H
22 22
23#ifdef IRIVER_H300_SERIES
24#define EEPROM_ADDR 0xA2
25#define EEPROM_SIZE 256
26#else
23#define EEPROM_ADDR 0xA0 27#define EEPROM_ADDR 0xA0
24#define EEPROM_SIZE 128 28#define EEPROM_SIZE 128
29#endif
25 30
26void eeprom_24cxx_init(void); 31void eeprom_24cxx_init(void);
27int eeprom_24cxx_read_byte(unsigned int address, char *c); 32int eeprom_24cxx_read_byte(unsigned int address, char *c);
diff --git a/firmware/export/pcf50606.h b/firmware/export/pcf50606.h
index d9f44bb577..3e567c963c 100644
--- a/firmware/export/pcf50606.h
+++ b/firmware/export/pcf50606.h
@@ -26,4 +26,12 @@ int pcf50606_write(int address, unsigned char val);
26int pcf50606_read_multiple(int address, unsigned char* buf, int count); 26int pcf50606_read_multiple(int address, unsigned char* buf, int count);
27int pcf50606_read(int address); 27int pcf50606_read(int address);
28 28
29/* internal low level calls used by the eeprom driver for h300 */
30void pcf50606_i2c_start(void);
31void pcf50606_i2c_stop(void);
32void pcf50606_i2c_ack(bool ack);
33bool pcf50606_i2c_getack(void);
34void pcf50606_i2c_outb(unsigned char byte);
35unsigned char pcf50606_i2c_inb(bool ack);
36
29#endif 37#endif