forked from len0rd/rockbox
Added support for reading/writing 256 sectors
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1736 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
9ab90eabd1
commit
63457c5c63
2 changed files with 14 additions and 7 deletions
|
|
@ -136,10 +136,10 @@ static int wait_for_end_of_transfer(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
int ata_read_sectors(unsigned long start,
|
int ata_read_sectors(unsigned long start,
|
||||||
unsigned char count,
|
int count,
|
||||||
void* buf) __attribute__ ((section (".icode")));
|
void* buf) __attribute__ ((section (".icode")));
|
||||||
int ata_read_sectors(unsigned long start,
|
int ata_read_sectors(unsigned long start,
|
||||||
unsigned char count,
|
int count,
|
||||||
void* buf)
|
void* buf)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
@ -169,7 +169,11 @@ int ata_read_sectors(unsigned long start,
|
||||||
|
|
||||||
led(true);
|
led(true);
|
||||||
|
|
||||||
ATA_NSECTOR = count;
|
if ( count == 256 )
|
||||||
|
ATA_NSECTOR = 0; /* 0 means 256 sectors */
|
||||||
|
else
|
||||||
|
ATA_NSECTOR = (unsigned char)count;
|
||||||
|
|
||||||
ATA_SECTOR = start & 0xff;
|
ATA_SECTOR = start & 0xff;
|
||||||
ATA_LCYL = (start >> 8) & 0xff;
|
ATA_LCYL = (start >> 8) & 0xff;
|
||||||
ATA_HCYL = (start >> 16) & 0xff;
|
ATA_HCYL = (start >> 16) & 0xff;
|
||||||
|
|
@ -215,7 +219,7 @@ int ata_read_sectors(unsigned long start,
|
||||||
}
|
}
|
||||||
|
|
||||||
int ata_write_sectors(unsigned long start,
|
int ata_write_sectors(unsigned long start,
|
||||||
unsigned char count,
|
int count,
|
||||||
void* buf)
|
void* buf)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
@ -242,7 +246,10 @@ int ata_write_sectors(unsigned long start,
|
||||||
|
|
||||||
led(true);
|
led(true);
|
||||||
|
|
||||||
ATA_NSECTOR = count;
|
if ( count == 256 )
|
||||||
|
ATA_NSECTOR = 0; /* 0 means 256 sectors */
|
||||||
|
else
|
||||||
|
ATA_NSECTOR = (unsigned char)count;
|
||||||
ATA_SECTOR = start & 0xff;
|
ATA_SECTOR = start & 0xff;
|
||||||
ATA_LCYL = (start >> 8) & 0xff;
|
ATA_LCYL = (start >> 8) & 0xff;
|
||||||
ATA_HCYL = (start >> 16) & 0xff;
|
ATA_HCYL = (start >> 16) & 0xff;
|
||||||
|
|
|
||||||
|
|
@ -40,10 +40,10 @@ extern int ata_hard_reset(void);
|
||||||
extern int ata_soft_reset(void);
|
extern int ata_soft_reset(void);
|
||||||
extern int ata_init(void);
|
extern int ata_init(void);
|
||||||
extern int ata_read_sectors(unsigned long start,
|
extern int ata_read_sectors(unsigned long start,
|
||||||
unsigned char count,
|
int count,
|
||||||
void* buf);
|
void* buf);
|
||||||
extern int ata_write_sectors(unsigned long start,
|
extern int ata_write_sectors(unsigned long start,
|
||||||
unsigned char count,
|
int count,
|
||||||
void* buf);
|
void* buf);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue