diff options
author | Björn Stenberg <bjorn@haxx.se> | 2002-08-14 16:37:28 +0000 |
---|---|---|
committer | Björn Stenberg <bjorn@haxx.se> | 2002-08-14 16:37:28 +0000 |
commit | 63457c5c638e52349eebdce8ce16bba84723118b (patch) | |
tree | 9927d0ed62fdc27890fa8d5b7cb7196c29508565 /firmware/drivers | |
parent | 9ab90eabd1053a7ba8fbbd0ace579b519f2338fa (diff) | |
download | rockbox-63457c5c638e52349eebdce8ce16bba84723118b.tar.gz rockbox-63457c5c638e52349eebdce8ce16bba84723118b.zip |
Added support for reading/writing 256 sectors
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1736 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers')
-rw-r--r-- | firmware/drivers/ata.c | 17 | ||||
-rw-r--r-- | firmware/drivers/ata.h | 4 |
2 files changed, 14 insertions, 7 deletions
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c index 8e2aa48017..ebe9602f01 100644 --- a/firmware/drivers/ata.c +++ b/firmware/drivers/ata.c | |||
@@ -136,10 +136,10 @@ static int wait_for_end_of_transfer(void) | |||
136 | } | 136 | } |
137 | 137 | ||
138 | int ata_read_sectors(unsigned long start, | 138 | int ata_read_sectors(unsigned long start, |
139 | unsigned char count, | 139 | int count, |
140 | void* buf) __attribute__ ((section (".icode"))); | 140 | void* buf) __attribute__ ((section (".icode"))); |
141 | int ata_read_sectors(unsigned long start, | 141 | int ata_read_sectors(unsigned long start, |
142 | unsigned char count, | 142 | int count, |
143 | void* buf) | 143 | void* buf) |
144 | { | 144 | { |
145 | int i; | 145 | int i; |
@@ -169,7 +169,11 @@ int ata_read_sectors(unsigned long start, | |||
169 | 169 | ||
170 | led(true); | 170 | led(true); |
171 | 171 | ||
172 | ATA_NSECTOR = count; | 172 | if ( count == 256 ) |
173 | ATA_NSECTOR = 0; /* 0 means 256 sectors */ | ||
174 | else | ||
175 | ATA_NSECTOR = (unsigned char)count; | ||
176 | |||
173 | ATA_SECTOR = start & 0xff; | 177 | ATA_SECTOR = start & 0xff; |
174 | ATA_LCYL = (start >> 8) & 0xff; | 178 | ATA_LCYL = (start >> 8) & 0xff; |
175 | ATA_HCYL = (start >> 16) & 0xff; | 179 | ATA_HCYL = (start >> 16) & 0xff; |
@@ -215,7 +219,7 @@ int ata_read_sectors(unsigned long start, | |||
215 | } | 219 | } |
216 | 220 | ||
217 | int ata_write_sectors(unsigned long start, | 221 | int ata_write_sectors(unsigned long start, |
218 | unsigned char count, | 222 | int count, |
219 | void* buf) | 223 | void* buf) |
220 | { | 224 | { |
221 | int i; | 225 | int i; |
@@ -242,7 +246,10 @@ int ata_write_sectors(unsigned long start, | |||
242 | 246 | ||
243 | led(true); | 247 | led(true); |
244 | 248 | ||
245 | ATA_NSECTOR = count; | 249 | if ( count == 256 ) |
250 | ATA_NSECTOR = 0; /* 0 means 256 sectors */ | ||
251 | else | ||
252 | ATA_NSECTOR = (unsigned char)count; | ||
246 | ATA_SECTOR = start & 0xff; | 253 | ATA_SECTOR = start & 0xff; |
247 | ATA_LCYL = (start >> 8) & 0xff; | 254 | ATA_LCYL = (start >> 8) & 0xff; |
248 | ATA_HCYL = (start >> 16) & 0xff; | 255 | ATA_HCYL = (start >> 16) & 0xff; |
diff --git a/firmware/drivers/ata.h b/firmware/drivers/ata.h index aa9c767cbb..4209fdcd1e 100644 --- a/firmware/drivers/ata.h +++ b/firmware/drivers/ata.h | |||
@@ -40,10 +40,10 @@ extern int ata_hard_reset(void); | |||
40 | extern int ata_soft_reset(void); | 40 | extern int ata_soft_reset(void); |
41 | extern int ata_init(void); | 41 | extern int ata_init(void); |
42 | extern int ata_read_sectors(unsigned long start, | 42 | extern int ata_read_sectors(unsigned long start, |
43 | unsigned char count, | 43 | int count, |
44 | void* buf); | 44 | void* buf); |
45 | extern int ata_write_sectors(unsigned long start, | 45 | extern int ata_write_sectors(unsigned long start, |
46 | unsigned char count, | 46 | int count, |
47 | void* buf); | 47 | void* buf); |
48 | 48 | ||
49 | #endif | 49 | #endif |