summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2008-05-08 05:39:29 +0000
committerJens Arnold <amiconn@rockbox.org>2008-05-08 05:39:29 +0000
commitf18e4db81b5503c864c41505cf5e8122638c0089 (patch)
tree87b81afb4ce0cb3ddbf3a31b90cfc5abfe05fe06
parent93651ed84d8595bc57580dc7ca97db57d3682b78 (diff)
downloadrockbox-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
-rw-r--r--firmware/drivers/ata.c48
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);
179static int set_multiple_mode(int sectors); 179static int set_multiple_mode(int sectors);
180static int set_features(void); 180static int set_features(void);
181 181
182STATICIRAM int wait_for_bsy(void) ICODE_ATTR; 182STATICIRAM ICODE_ATTR int wait_for_bsy(void)
183STATICIRAM int wait_for_bsy(void)
184{ 183{
185 long timeout = current_tick + HZ*30; 184 long timeout = current_tick + HZ*30;
186 while (TIME_BEFORE(current_tick, timeout) && (ATA_STATUS & STATUS_BSY)) { 185
186 do
187 {
188 if (!(ATA_STATUS & STATUS_BSY))
189 return 1;
187 last_disk_activity = current_tick; 190 last_disk_activity = current_tick;
188 yield(); 191 yield();
189 } 192 } while (TIME_BEFORE(current_tick, timeout));
190 193
191 if (TIME_BEFORE(current_tick, timeout)) 194 return 0; /* timeout */
192 return 1;
193 else
194 return 0; /* timeout */
195} 195}
196 196
197STATICIRAM int wait_for_rdy(void) ICODE_ATTR; 197STATICIRAM ICODE_ATTR int wait_for_rdy(void)
198STATICIRAM int wait_for_rdy(void)
199{ 198{
200 long timeout; 199 long timeout;
201 200
@@ -203,21 +202,19 @@ STATICIRAM int wait_for_rdy(void)
203 return 0; 202 return 0;
204 203
205 timeout = current_tick + HZ*10; 204 timeout = current_tick + HZ*10;
206 205
207 while (TIME_BEFORE(current_tick, timeout) && 206 do
208 !(ATA_ALT_STATUS & STATUS_RDY)) { 207 {
208 if (ATA_ALT_STATUS & STATUS_RDY)
209 return 1;
209 last_disk_activity = current_tick; 210 last_disk_activity = current_tick;
210 yield(); 211 yield();
211 } 212 } while (TIME_BEFORE(current_tick, timeout));
212 213
213 if (TIME_BEFORE(current_tick, timeout)) 214 return 0; /* timeout */
214 return STATUS_RDY;
215 else
216 return 0; /* timeout */
217} 215}
218 216
219STATICIRAM int wait_for_start_of_transfer(void) ICODE_ATTR; 217STATICIRAM ICODE_ATTR int wait_for_start_of_transfer(void)
220STATICIRAM int wait_for_start_of_transfer(void)
221{ 218{
222 if (!wait_for_bsy()) 219 if (!wait_for_bsy())
223 return 0; 220 return 0;
@@ -225,8 +222,7 @@ STATICIRAM int wait_for_start_of_transfer(void)
225 return (ATA_ALT_STATUS & (STATUS_BSY|STATUS_DRQ)) == STATUS_DRQ; 222 return (ATA_ALT_STATUS & (STATUS_BSY|STATUS_DRQ)) == STATUS_DRQ;
226} 223}
227 224
228STATICIRAM int wait_for_end_of_transfer(void) ICODE_ATTR; 225STATICIRAM ICODE_ATTR int wait_for_end_of_transfer(void)
229STATICIRAM int wait_for_end_of_transfer(void)
230{ 226{
231 if (!wait_for_bsy()) 227 if (!wait_for_bsy())
232 return 0; 228 return 0;
@@ -247,8 +243,7 @@ static void ata_led(bool on)
247#endif 243#endif
248 244
249#ifndef ATA_OPTIMIZED_READING 245#ifndef ATA_OPTIMIZED_READING
250STATICIRAM void copy_read_sectors(unsigned char* buf, int wordcount) ICODE_ATTR; 246STATICIRAM ICODE_ATTR void copy_read_sectors(unsigned char* buf, int wordcount)
251STATICIRAM void copy_read_sectors(unsigned char* buf, int wordcount)
252{ 247{
253 unsigned short tmp = 0; 248 unsigned short tmp = 0;
254 249
@@ -456,9 +451,8 @@ int ata_read_sectors(IF_MV2(int drive,)
456} 451}
457 452
458#ifndef ATA_OPTIMIZED_WRITING 453#ifndef ATA_OPTIMIZED_WRITING
459STATICIRAM void copy_write_sectors(const unsigned char* buf, int wordcount) 454STATICIRAM ICODE_ATTR void copy_write_sectors(const unsigned char* buf,
460 ICODE_ATTR; 455 int wordcount)
461STATICIRAM void copy_write_sectors(const unsigned char* buf, int wordcount)
462{ 456{
463 if ( (unsigned long)buf & 1) 457 if ( (unsigned long)buf & 1)
464 { /* not 16-bit aligned, copy byte by byte */ 458 { /* not 16-bit aligned, copy byte by byte */