diff options
author | Jens Arnold <amiconn@rockbox.org> | 2008-05-08 05:39:29 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2008-05-08 05:39:29 +0000 |
commit | f18e4db81b5503c864c41505cf5e8122638c0089 (patch) | |
tree | 87b81afb4ce0cb3ddbf3a31b90cfc5abfe05fe06 /firmware | |
parent | 93651ed84d8595bc57580dc7ca97db57d3682b78 (diff) | |
download | rockbox-f18e4db81b5503c864c41505cf5e8122638c0089.tar.gz rockbox-f18e4db81b5503c864c41505cf5e8122638c0089.zip |
Apply 2 small size optimisations. * Put ICODE_ATTR into the function definitions where applicable, saving the separate declaration.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17408 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/drivers/ata.c | 48 |
1 files changed, 21 insertions, 27 deletions
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c index 4f4fb4c9b3..397cb9ac82 100644 --- a/firmware/drivers/ata.c +++ b/firmware/drivers/ata.c @@ -179,23 +179,22 @@ static int perform_soft_reset(void); static int set_multiple_mode(int sectors); static int set_features(void); -STATICIRAM int wait_for_bsy(void) ICODE_ATTR; -STATICIRAM int wait_for_bsy(void) +STATICIRAM ICODE_ATTR int wait_for_bsy(void) { long timeout = current_tick + HZ*30; - while (TIME_BEFORE(current_tick, timeout) && (ATA_STATUS & STATUS_BSY)) { + + do + { + if (!(ATA_STATUS & STATUS_BSY)) + return 1; last_disk_activity = current_tick; yield(); - } + } while (TIME_BEFORE(current_tick, timeout)); - if (TIME_BEFORE(current_tick, timeout)) - return 1; - else - return 0; /* timeout */ + return 0; /* timeout */ } -STATICIRAM int wait_for_rdy(void) ICODE_ATTR; -STATICIRAM int wait_for_rdy(void) +STATICIRAM ICODE_ATTR int wait_for_rdy(void) { long timeout; @@ -203,21 +202,19 @@ STATICIRAM int wait_for_rdy(void) return 0; timeout = current_tick + HZ*10; - - while (TIME_BEFORE(current_tick, timeout) && - !(ATA_ALT_STATUS & STATUS_RDY)) { + + do + { + if (ATA_ALT_STATUS & STATUS_RDY) + return 1; last_disk_activity = current_tick; yield(); - } + } while (TIME_BEFORE(current_tick, timeout)); - if (TIME_BEFORE(current_tick, timeout)) - return STATUS_RDY; - else - return 0; /* timeout */ + return 0; /* timeout */ } -STATICIRAM int wait_for_start_of_transfer(void) ICODE_ATTR; -STATICIRAM int wait_for_start_of_transfer(void) +STATICIRAM ICODE_ATTR int wait_for_start_of_transfer(void) { if (!wait_for_bsy()) return 0; @@ -225,8 +222,7 @@ STATICIRAM int wait_for_start_of_transfer(void) return (ATA_ALT_STATUS & (STATUS_BSY|STATUS_DRQ)) == STATUS_DRQ; } -STATICIRAM int wait_for_end_of_transfer(void) ICODE_ATTR; -STATICIRAM int wait_for_end_of_transfer(void) +STATICIRAM ICODE_ATTR int wait_for_end_of_transfer(void) { if (!wait_for_bsy()) return 0; @@ -247,8 +243,7 @@ static void ata_led(bool on) #endif #ifndef ATA_OPTIMIZED_READING -STATICIRAM void copy_read_sectors(unsigned char* buf, int wordcount) ICODE_ATTR; -STATICIRAM void copy_read_sectors(unsigned char* buf, int wordcount) +STATICIRAM ICODE_ATTR void copy_read_sectors(unsigned char* buf, int wordcount) { unsigned short tmp = 0; @@ -456,9 +451,8 @@ int ata_read_sectors(IF_MV2(int drive,) } #ifndef ATA_OPTIMIZED_WRITING -STATICIRAM void copy_write_sectors(const unsigned char* buf, int wordcount) - ICODE_ATTR; -STATICIRAM void copy_write_sectors(const unsigned char* buf, int wordcount) +STATICIRAM ICODE_ATTR void copy_write_sectors(const unsigned char* buf, + int wordcount) { if ( (unsigned long)buf & 1) { /* not 16-bit aligned, copy byte by byte */ |