diff options
author | Jens Arnold <amiconn@rockbox.org> | 2004-10-04 17:53:53 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2004-10-04 17:53:53 +0000 |
commit | 36813086e6fa4bfe75484db20bedbf564b5a2420 (patch) | |
tree | a094ccdd137b35991feef51943624e62d74ae61f /firmware/drivers/ata_mmc.c | |
parent | 0bc2c6cc2cb2e2ff75626f35bfa33e0a8af15355 (diff) | |
download | rockbox-36813086e6fa4bfe75484db20bedbf564b5a2420.tar.gz rockbox-36813086e6fa4bfe75484db20bedbf564b5a2420.zip |
MMC: 10 % faster reading and 15 % faster writing
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@5161 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers/ata_mmc.c')
-rw-r--r-- | firmware/drivers/ata_mmc.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/firmware/drivers/ata_mmc.c b/firmware/drivers/ata_mmc.c index 18864cd746..b4006c6aff 100644 --- a/firmware/drivers/ata_mmc.c +++ b/firmware/drivers/ata_mmc.c | |||
@@ -198,32 +198,40 @@ static void setup_sci1(int bitrate_register) | |||
198 | static void write_transfer(const unsigned char *buf, int len) | 198 | static void write_transfer(const unsigned char *buf, int len) |
199 | { | 199 | { |
200 | const unsigned char *buf_end = buf + len; | 200 | const unsigned char *buf_end = buf + len; |
201 | register unsigned char data; | ||
201 | 202 | ||
202 | /* TODO: DMA */ | 203 | /* TODO: DMA */ |
203 | 204 | ||
204 | while (buf < buf_end) | 205 | while (buf < buf_end) |
205 | { | 206 | { |
207 | data = fliptable[(signed char)(*buf++)]; /* bitswap */ | ||
206 | while (!(SSR1 & SCI_TEND)); /* wait for end of transfer */ | 208 | while (!(SSR1 & SCI_TEND)); /* wait for end of transfer */ |
207 | TDR1 = fliptable[(signed char)(*buf++)]; /* write byte */ | 209 | TDR1 = data; /* write byte */ |
208 | SSR1 = 0; /* start transmitting */ | 210 | SSR1 = 0; /* start transmitting */ |
209 | } | 211 | } |
210 | } | 212 | } |
211 | 213 | ||
214 | /* don't call this with len == 0 */ | ||
212 | static void read_transfer(unsigned char *buf, int len) | 215 | static void read_transfer(unsigned char *buf, int len) |
213 | { | 216 | { |
214 | unsigned char *buf_end = buf + len; | 217 | unsigned char *buf_end = buf + len - 1; |
218 | register signed char data; | ||
215 | 219 | ||
216 | /* TODO: DMA */ | 220 | /* TODO: DMA */ |
217 | 221 | ||
218 | while (!(SSR1 & SCI_TEND)); /* wait for end of transfer */ | 222 | while (!(SSR1 & SCI_TEND)); /* wait for end of transfer */ |
219 | TDR1 = 0xFF; /* send do-nothing data in parallel */ | 223 | TDR1 = 0xFF; /* send do-nothing data in parallel */ |
220 | 224 | ||
225 | SSR1 = 0; /* start receiving first byte */ | ||
221 | while (buf < buf_end) | 226 | while (buf < buf_end) |
222 | { | 227 | { |
223 | SSR1 = 0; /* start receiving */ | 228 | while (!(SSR1 & SCI_RDRF)); /* wait for data */ |
224 | while (!(SSR1 & SCI_RDRF)); /* wait for data */ | 229 | data = RDR1; /* read byte */ |
225 | *buf++ = fliptable[(signed char)(RDR1)]; /* read byte */ | 230 | SSR1 = 0; /* start receiving */ |
231 | *buf++ = fliptable[data]; /* bitswap */ | ||
226 | } | 232 | } |
233 | while (!(SSR1 & SCI_RDRF)); /* wait for last byte */ | ||
234 | *buf = fliptable[(signed char)(RDR1)]; /* read & bitswap */ | ||
227 | } | 235 | } |
228 | 236 | ||
229 | /* timeout is in bytes */ | 237 | /* timeout is in bytes */ |