summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2002-08-13 13:21:55 +0000
committerBjörn Stenberg <bjorn@haxx.se>2002-08-13 13:21:55 +0000
commit113fffaa86ca105694dd4da28fc8685350aba947 (patch)
treef219a657d235d587d7436da80a725dc146c1a0fa
parentf6f3a1395ece444556583139d988657396bf8cb7 (diff)
downloadrockbox-113fffaa86ca105694dd4da28fc8685350aba947.tar.gz
rockbox-113fffaa86ca105694dd4da28fc8685350aba947.zip
Don't save settings on disk if it has no partition table
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1712 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/settings.c2
-rw-r--r--firmware/drivers/fat.c5
-rw-r--r--firmware/drivers/fat.h1
3 files changed, 7 insertions, 1 deletions
diff --git a/apps/settings.c b/apps/settings.c
index 67530a9fbc..e285d266d5 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -198,7 +198,7 @@ static int save_config_buffer( void )
198 /* update the checksum in the end of the block before saving */ 198 /* update the checksum in the end of the block before saving */
199 calculate_config_checksum(rtc_config_block + sizeof(rtc_config_block) - 2); 199 calculate_config_checksum(rtc_config_block + sizeof(rtc_config_block) - 2);
200#ifdef SAVE_TO_DISK 200#ifdef SAVE_TO_DISK
201 if(battery_level_safe()) 201 if(battery_level_safe() && (fat_firstsector()!=0))
202 return !ata_write_sectors( 61, 1, rtc_config_block); 202 return !ata_write_sectors( 61, 1, rtc_config_block);
203 else 203 else
204 return -1; 204 return -1;
diff --git a/firmware/drivers/fat.c b/firmware/drivers/fat.c
index 7fe011c863..78d0f8ff44 100644
--- a/firmware/drivers/fat.c
+++ b/firmware/drivers/fat.c
@@ -218,6 +218,11 @@ static int first_sector_of_cluster(int cluster)
218 return (cluster - 2) * fat_bpb.bpb_secperclus + fat_bpb.firstdatasector; 218 return (cluster - 2) * fat_bpb.bpb_secperclus + fat_bpb.firstdatasector;
219} 219}
220 220
221int fat_startsector(void)
222{
223 return fat_bpb.startsector;
224}
225
221int fat_mount(int startsector) 226int fat_mount(int startsector)
222{ 227{
223 unsigned char buf[SECTOR_SIZE]; 228 unsigned char buf[SECTOR_SIZE];
diff --git a/firmware/drivers/fat.h b/firmware/drivers/fat.h
index 844864d88b..836d5c6866 100644
--- a/firmware/drivers/fat.h
+++ b/firmware/drivers/fat.h
@@ -66,6 +66,7 @@ extern int fat_mount(int startsector);
66extern int fat_create_file(unsigned int currdir, char *name); 66extern int fat_create_file(unsigned int currdir, char *name);
67extern int fat_create_dir(unsigned int currdir, char *name); 67extern int fat_create_dir(unsigned int currdir, char *name);
68#endif 68#endif
69extern int fat_startsector(void);
69extern int fat_open(unsigned int cluster, struct fat_file *ent); 70extern int fat_open(unsigned int cluster, struct fat_file *ent);
70extern int fat_read(struct fat_file *ent, int sectorcount, void* buf ); 71extern int fat_read(struct fat_file *ent, int sectorcount, void* buf );
71extern int fat_seek(struct fat_file *ent, int sector ); 72extern int fat_seek(struct fat_file *ent, int sector );