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
This commit is contained in:
Björn Stenberg 2002-08-13 13:21:55 +00:00
parent f6f3a1395e
commit 113fffaa86
3 changed files with 7 additions and 1 deletions

View file

@ -198,7 +198,7 @@ static int save_config_buffer( void )
/* update the checksum in the end of the block before saving */ /* update the checksum in the end of the block before saving */
calculate_config_checksum(rtc_config_block + sizeof(rtc_config_block) - 2); calculate_config_checksum(rtc_config_block + sizeof(rtc_config_block) - 2);
#ifdef SAVE_TO_DISK #ifdef SAVE_TO_DISK
if(battery_level_safe()) if(battery_level_safe() && (fat_firstsector()!=0))
return !ata_write_sectors( 61, 1, rtc_config_block); return !ata_write_sectors( 61, 1, rtc_config_block);
else else
return -1; return -1;

View file

@ -218,6 +218,11 @@ static int first_sector_of_cluster(int cluster)
return (cluster - 2) * fat_bpb.bpb_secperclus + fat_bpb.firstdatasector; return (cluster - 2) * fat_bpb.bpb_secperclus + fat_bpb.firstdatasector;
} }
int fat_startsector(void)
{
return fat_bpb.startsector;
}
int fat_mount(int startsector) int fat_mount(int startsector)
{ {
unsigned char buf[SECTOR_SIZE]; unsigned char buf[SECTOR_SIZE];

View file

@ -66,6 +66,7 @@ extern int fat_mount(int startsector);
extern int fat_create_file(unsigned int currdir, char *name); extern int fat_create_file(unsigned int currdir, char *name);
extern int fat_create_dir(unsigned int currdir, char *name); extern int fat_create_dir(unsigned int currdir, char *name);
#endif #endif
extern int fat_startsector(void);
extern int fat_open(unsigned int cluster, struct fat_file *ent); extern int fat_open(unsigned int cluster, struct fat_file *ent);
extern int fat_read(struct fat_file *ent, int sectorcount, void* buf ); extern int fat_read(struct fat_file *ent, int sectorcount, void* buf );
extern int fat_seek(struct fat_file *ent, int sector ); extern int fat_seek(struct fat_file *ent, int sector );