summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorAidan MacDonald <amachronic@protonmail.com>2021-08-15 17:14:06 +0100
committerAidan MacDonald <amachronic@protonmail.com>2021-08-15 20:41:58 +0100
commit5a4cc8da3fd4fa7cd3b89ac8d636fe8ef77ee9e0 (patch)
treec7c7b3b754d74fe06e5a5453e37df81341b0b00e /apps
parentde578bde1fb283027545b4a6a3292e39d0a1f1a7 (diff)
downloadrockbox-5a4cc8da3fd4fa7cd3b89ac8d636fe8ef77ee9e0.tar.gz
rockbox-5a4cc8da3fd4fa7cd3b89ac8d636fe8ef77ee9e0.zip
Drop HAVE_RTC_RAM
Only Archos players ever used this feature and it isn't implemented on any current targets. Change-Id: I39c8455480a3fe33cd25b667e8d4d6ff3a092d3e
Diffstat (limited to 'apps')
-rw-r--r--apps/gui/wps.c4
-rw-r--r--apps/main.c5
-rw-r--r--apps/settings.c39
3 files changed, 4 insertions, 44 deletions
diff --git a/apps/gui/wps.c b/apps/gui/wps.c
index e491d6f35b..cdb34ab447 100644
--- a/apps/gui/wps.c
+++ b/apps/gui/wps.c
@@ -584,7 +584,7 @@ void wps_do_playpause(bool updatewps)
584 state->paused = true; 584 state->paused = true;
585 pause_action(true, updatewps); 585 pause_action(true, updatewps);
586 settings_save(); 586 settings_save();
587#if !defined(HAVE_RTC_RAM) && !defined(HAVE_SW_POWEROFF) 587#if !defined(HAVE_SW_POWEROFF)
588 call_storage_idle_notifys(true); /* make sure resume info is saved */ 588 call_storage_idle_notifys(true); /* make sure resume info is saved */
589#endif 589#endif
590 } 590 }
@@ -630,7 +630,7 @@ long gui_wps_show(void)
630 about to shut down. lets save the settings. */ 630 about to shut down. lets save the settings. */
631 if (state->paused) { 631 if (state->paused) {
632 settings_save(); 632 settings_save();
633#if !defined(HAVE_RTC_RAM) && !defined(HAVE_SW_POWEROFF) 633#if !defined(HAVE_SW_POWEROFF)
634 call_storage_idle_notifys(true); 634 call_storage_idle_notifys(true);
635#endif 635#endif
636 } 636 }
diff --git a/apps/main.c b/apps/main.c
index 483d280204..3b7ec6d4c1 100644
--- a/apps/main.c
+++ b/apps/main.c
@@ -444,11 +444,6 @@ static void init(void)
444#if CONFIG_RTC 444#if CONFIG_RTC
445 rtc_init(); 445 rtc_init();
446#endif 446#endif
447#ifdef HAVE_RTC_RAM
448 CHART(">settings_load(RTC)");
449 settings_load(SETTINGS_RTC); /* early load parts of global_settings */
450 CHART("<settings_load(RTC)");
451#endif
452 447
453 adc_init(); 448 adc_init();
454 449
diff --git a/apps/settings.c b/apps/settings.c
index f89fc581ca..3f257e093a 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -83,11 +83,7 @@ struct system_status global_status;
83#include "pcm_sampr.h" 83#include "pcm_sampr.h"
84 84
85#define NVRAM_DATA_START 8 85#define NVRAM_DATA_START 8
86#ifdef HAVE_RTC_RAM
87#define NVRAM_BLOCK_SIZE 44
88#else
89#define NVRAM_BLOCK_SIZE (sizeof(struct system_status) + NVRAM_DATA_START) 86#define NVRAM_BLOCK_SIZE (sizeof(struct system_status) + NVRAM_DATA_START)
90#endif
91 87
92#define MAX_LINES 10 88#define MAX_LINES 10
93 89
@@ -118,7 +114,6 @@ static bool read_nvram_data(char* buf, int max_len)
118{ 114{
119 unsigned crc32 = 0xffffffff; 115 unsigned crc32 = 0xffffffff;
120 int var_count = 0, i = 0, buf_pos = 0; 116 int var_count = 0, i = 0, buf_pos = 0;
121#ifndef HAVE_RTC_RAM
122 int fd = open(NVRAM_FILE, O_RDONLY); 117 int fd = open(NVRAM_FILE, O_RDONLY);
123 int bytes; 118 int bytes;
124 if (fd < 0) 119 if (fd < 0)
@@ -128,12 +123,6 @@ static bool read_nvram_data(char* buf, int max_len)
128 close(fd); 123 close(fd);
129 if (bytes < 8) /* min is 8 bytes,magic, ver, vars, crc32 */ 124 if (bytes < 8) /* min is 8 bytes,magic, ver, vars, crc32 */
130 return false; 125 return false;
131#else
132 memset(buf,0,max_len);
133 /* read rtc block */
134 for (i=0; i < max_len; i++ )
135 buf[i] = rtc_read(0x14+i);
136#endif
137 /* check magic, version */ 126 /* check magic, version */
138 if ((buf[0] != 'R') || (buf[1] != 'b') 127 if ((buf[0] != 'R') || (buf[1] != 'b')
139 || (buf[2] != NVRAM_CONFIG_VERSION)) 128 || (buf[2] != NVRAM_CONFIG_VERSION))
@@ -171,9 +160,7 @@ static bool write_nvram_data(char* buf, int max_len)
171 unsigned crc32 = 0xffffffff; 160 unsigned crc32 = 0xffffffff;
172 int i = 0, buf_pos = 0; 161 int i = 0, buf_pos = 0;
173 char var_count = 0; 162 char var_count = 0;
174#ifndef HAVE_RTC_RAM
175 int fd; 163 int fd;
176#endif
177 memset(buf,0,max_len); 164 memset(buf,0,max_len);
178 /* magic, version */ 165 /* magic, version */
179 buf[0] = 'R'; buf[1] = 'b'; 166 buf[0] = 'R'; buf[1] = 'b';
@@ -195,7 +182,6 @@ static bool write_nvram_data(char* buf, int max_len)
195 crc32 = crc_32(&buf[NVRAM_DATA_START], 182 crc32 = crc_32(&buf[NVRAM_DATA_START],
196 max_len-NVRAM_DATA_START-1,0xffffffff); 183 max_len-NVRAM_DATA_START-1,0xffffffff);
197 memcpy(&buf[4],&crc32,4); 184 memcpy(&buf[4],&crc32,4);
198#ifndef HAVE_RTC_RAM
199 fd = open(NVRAM_FILE,O_CREAT|O_TRUNC|O_WRONLY, 0666); 185 fd = open(NVRAM_FILE,O_CREAT|O_TRUNC|O_WRONLY, 0666);
200 if (fd >= 0) 186 if (fd >= 0)
201 { 187 {
@@ -204,16 +190,6 @@ static bool write_nvram_data(char* buf, int max_len)
204 if (len < 8) 190 if (len < 8)
205 return false; 191 return false;
206 } 192 }
207#else
208 /* FIXME: okay, it _would_ be cleaner and faster to implement rtc_write so
209 that it would write a number of bytes at a time since the RTC chip
210 supports that, but this will have to do for now 8-) */
211 for (i=0; i < NVRAM_BLOCK_SIZE; i++ ) {
212 int r = rtc_write(0x14+i, buf[i]);
213 if (r)
214 return false;
215 }
216#endif
217 return true; 193 return true;
218} 194}
219 195
@@ -586,12 +562,12 @@ static bool settings_write_config(const char* filename, int options)
586 close(fd); 562 close(fd);
587 return true; 563 return true;
588} 564}
589#ifndef HAVE_RTC_RAM 565
590static void flush_global_status_callback(void) 566static void flush_global_status_callback(void)
591{ 567{
592 write_nvram_data(nvram_buffer,NVRAM_BLOCK_SIZE); 568 write_nvram_data(nvram_buffer,NVRAM_BLOCK_SIZE);
593} 569}
594#endif 570
595static void flush_config_block_callback(void) 571static void flush_config_block_callback(void)
596{ 572{
597 write_nvram_data(nvram_buffer,NVRAM_BLOCK_SIZE); 573 write_nvram_data(nvram_buffer,NVRAM_BLOCK_SIZE);
@@ -621,23 +597,12 @@ static void update_runtime(void)
621void status_save(void) 597void status_save(void)
622{ 598{
623 update_runtime(); 599 update_runtime();
624#ifdef HAVE_RTC_RAM
625 /* this will be done in the storage_callback if
626 target doesnt have rtc ram */
627 write_nvram_data(nvram_buffer,NVRAM_BLOCK_SIZE);
628#else
629 register_storage_idle_func(flush_global_status_callback); 600 register_storage_idle_func(flush_global_status_callback);
630#endif
631} 601}
632 602
633int settings_save(void) 603int settings_save(void)
634{ 604{
635 update_runtime(); 605 update_runtime();
636#ifdef HAVE_RTC_RAM
637 /* this will be done in the storage_callback if
638 target doesnt have rtc ram */
639 write_nvram_data(nvram_buffer,NVRAM_BLOCK_SIZE);
640#endif
641 register_storage_idle_func(flush_config_block_callback); 606 register_storage_idle_func(flush_config_block_callback);
642 return 0; 607 return 0;
643} 608}