diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c index dd28585ea1..0e0c48833c 100644 --- a/firmware/drivers/ata.c +++ b/firmware/drivers/ata.c @@ -189,21 +189,6 @@ static int check_registers(void) return 0; } -static int check_harddisk(void) -{ - if (!wait_for_rdy()) - return 0; - - if ((ATA_NSECTOR == 1) && - (ATA_SECTOR == 1) && - (ATA_LCYL == 0) && - (ATA_HCYL == 0) && - (ATA_SELECT == 0)) - return 1; - else - return 0; -} - static int freeze_lock(void) { if (!wait_for_rdy()) @@ -274,15 +259,9 @@ int ata_init(void) if (!check_registers()) return -2; -// if (!check_harddisk()) -// return -3; - if (freeze_lock() < 0) return -4; -// if(ata_spindown(-1) < 0) -// return -5; - ATA_SELECT = SELECT_LBA; ATA_CONTROL = CONTROL_nIEN; diff --git a/firmware/drivers/fat.c b/firmware/drivers/fat.c index 68a1f14b02..15974f4cbc 100644 --- a/firmware/drivers/fat.c +++ b/firmware/drivers/fat.c @@ -114,7 +114,7 @@ struct fsinfo { #define FSINFO_FREECOUNT 488 #define FSINFO_NEXTFREE 492 -static int first_sector_of_cluster(unsigned int cluster); +static int first_sector_of_cluster(int cluster); static int bpb_is_sane(void); static void *cache_fat_sector(int secnum); #ifdef DISK_WRITE @@ -143,13 +143,7 @@ struct fat_cache_entry fat_cache[FAT_CACHE_SIZE]; static unsigned char lastsector[SECTOR_SIZE]; static unsigned char lastsector2[SECTOR_SIZE]; -static unsigned int swap_fat_entry(unsigned int entry) -{ - SWAB32(entry); - return entry; -} - -static int sec2cluster(unsigned int sec) +static int sec2cluster(int sec) { if ( sec < fat_bpb.firstdatasector ) { @@ -160,7 +154,7 @@ static int sec2cluster(unsigned int sec) return ((sec - fat_bpb.firstdatasector) / fat_bpb.bpb_secperclus) + 2; } -static int cluster2sec(unsigned int cluster) +static int cluster2sec(int cluster) { int max_cluster = fat_bpb.totalsectors - fat_bpb.firstdatasector / fat_bpb.bpb_secperclus + 1; @@ -175,7 +169,7 @@ static int cluster2sec(unsigned int cluster) return first_sector_of_cluster(cluster); } -static int first_sector_of_cluster(unsigned int cluster) +static int first_sector_of_cluster(int cluster) { return (cluster - 2) * fat_bpb.bpb_secperclus + fat_bpb.firstdatasector; } diff --git a/firmware/drivers/fat.h b/firmware/drivers/fat.h index 3e8875f3e7..463910d52e 100644 --- a/firmware/drivers/fat.h +++ b/firmware/drivers/fat.h @@ -88,8 +88,8 @@ struct fat_direntry struct fat_dir { int entry; - unsigned int cached_sec; - unsigned int num_sec; + int cached_sec; + int num_sec; unsigned char cached_buf[SECTOR_SIZE]; };