diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/drivers/ata.c | 25 | ||||
-rw-r--r-- | firmware/export/config.h | 9 | ||||
-rw-r--r-- | firmware/target/arm/sandisk/sansa-e200/ata-e200.c | 12 |
3 files changed, 28 insertions, 18 deletions
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c index 349f76c0ec..91aae158c6 100644 --- a/firmware/drivers/ata.c +++ b/firmware/drivers/ata.c | |||
@@ -98,8 +98,8 @@ static int perform_soft_reset(void); | |||
98 | static int set_multiple_mode(int sectors); | 98 | static int set_multiple_mode(int sectors); |
99 | static int set_features(void); | 99 | static int set_features(void); |
100 | 100 | ||
101 | static int wait_for_bsy(void) ICODE_ATTR; | 101 | STATICIRAM int wait_for_bsy(void) ICODE_ATTR; |
102 | static int wait_for_bsy(void) | 102 | STATICIRAM int wait_for_bsy(void) |
103 | { | 103 | { |
104 | long timeout = current_tick + HZ*30; | 104 | long timeout = current_tick + HZ*30; |
105 | while (TIME_BEFORE(current_tick, timeout) && (ATA_STATUS & STATUS_BSY)) { | 105 | while (TIME_BEFORE(current_tick, timeout) && (ATA_STATUS & STATUS_BSY)) { |
@@ -113,8 +113,8 @@ static int wait_for_bsy(void) | |||
113 | return 0; /* timeout */ | 113 | return 0; /* timeout */ |
114 | } | 114 | } |
115 | 115 | ||
116 | static int wait_for_rdy(void) ICODE_ATTR; | 116 | STATICIRAM int wait_for_rdy(void) ICODE_ATTR; |
117 | static int wait_for_rdy(void) | 117 | STATICIRAM int wait_for_rdy(void) |
118 | { | 118 | { |
119 | long timeout; | 119 | long timeout; |
120 | 120 | ||
@@ -135,8 +135,8 @@ static int wait_for_rdy(void) | |||
135 | return 0; /* timeout */ | 135 | return 0; /* timeout */ |
136 | } | 136 | } |
137 | 137 | ||
138 | static int wait_for_start_of_transfer(void) ICODE_ATTR; | 138 | STATICIRAM int wait_for_start_of_transfer(void) ICODE_ATTR; |
139 | static int wait_for_start_of_transfer(void) | 139 | STATICIRAM int wait_for_start_of_transfer(void) |
140 | { | 140 | { |
141 | if (!wait_for_bsy()) | 141 | if (!wait_for_bsy()) |
142 | return 0; | 142 | return 0; |
@@ -144,8 +144,8 @@ static int wait_for_start_of_transfer(void) | |||
144 | return (ATA_ALT_STATUS & (STATUS_BSY|STATUS_DRQ)) == STATUS_DRQ; | 144 | return (ATA_ALT_STATUS & (STATUS_BSY|STATUS_DRQ)) == STATUS_DRQ; |
145 | } | 145 | } |
146 | 146 | ||
147 | static int wait_for_end_of_transfer(void) ICODE_ATTR; | 147 | STATICIRAM int wait_for_end_of_transfer(void) ICODE_ATTR; |
148 | static int wait_for_end_of_transfer(void) | 148 | STATICIRAM int wait_for_end_of_transfer(void) |
149 | { | 149 | { |
150 | if (!wait_for_bsy()) | 150 | if (!wait_for_bsy()) |
151 | return 0; | 151 | return 0; |
@@ -166,8 +166,8 @@ static void ata_led(bool on) | |||
166 | #endif | 166 | #endif |
167 | 167 | ||
168 | #ifndef ATA_OPTIMIZED_READING | 168 | #ifndef ATA_OPTIMIZED_READING |
169 | static void copy_read_sectors(unsigned char* buf, int wordcount) ICODE_ATTR; | 169 | STATICIRAM void copy_read_sectors(unsigned char* buf, int wordcount) ICODE_ATTR; |
170 | static void copy_read_sectors(unsigned char* buf, int wordcount) | 170 | STATICIRAM void copy_read_sectors(unsigned char* buf, int wordcount) |
171 | { | 171 | { |
172 | unsigned short tmp = 0; | 172 | unsigned short tmp = 0; |
173 | 173 | ||
@@ -365,8 +365,9 @@ int ata_read_sectors(IF_MV2(int drive,) | |||
365 | } | 365 | } |
366 | 366 | ||
367 | #ifndef ATA_OPTIMIZED_WRITING | 367 | #ifndef ATA_OPTIMIZED_WRITING |
368 | static void copy_write_sectors(const unsigned char* buf, int wordcount) ICODE_ATTR; | 368 | STATICIRAM void copy_write_sectors(const unsigned char* buf, int wordcount) |
369 | static void copy_write_sectors(const unsigned char* buf, int wordcount) | 369 | ICODE_ATTR; |
370 | STATICIRAM void copy_write_sectors(const unsigned char* buf, int wordcount) | ||
370 | { | 371 | { |
371 | if ( (unsigned long)buf & 1) | 372 | if ( (unsigned long)buf & 1) |
372 | { /* not 16-bit aligned, copy byte by byte */ | 373 | { /* not 16-bit aligned, copy byte by byte */ |
diff --git a/firmware/export/config.h b/firmware/export/config.h index 5e127b430d..4d7a3aecdf 100644 --- a/firmware/export/config.h +++ b/firmware/export/config.h | |||
@@ -298,11 +298,20 @@ | |||
298 | #if CONFIG_CPU != SH7034 | 298 | #if CONFIG_CPU != SH7034 |
299 | #define IRAM_STEAL | 299 | #define IRAM_STEAL |
300 | #endif | 300 | #endif |
301 | #if defined(CPU_ARM) | ||
302 | /* GCC quirk workaround: arm-elf-gcc treats static functions as short_call | ||
303 | * when not compiling with -ffunction-sections, even when the function has | ||
304 | * a section attribute. */ | ||
305 | #define STATICIRAM | ||
306 | #else | ||
307 | #define STATICIRAM static | ||
308 | #endif | ||
301 | #else | 309 | #else |
302 | #define ICODE_ATTR | 310 | #define ICODE_ATTR |
303 | #define ICONST_ATTR | 311 | #define ICONST_ATTR |
304 | #define IDATA_ATTR | 312 | #define IDATA_ATTR |
305 | #define IBSS_ATTR | 313 | #define IBSS_ATTR |
314 | #define STATICIRAM static | ||
306 | #endif | 315 | #endif |
307 | 316 | ||
308 | #ifndef IRAM_LCDFRAMEBUFFER | 317 | #ifndef IRAM_LCDFRAMEBUFFER |
diff --git a/firmware/target/arm/sandisk/sansa-e200/ata-e200.c b/firmware/target/arm/sandisk/sansa-e200/ata-e200.c index bfb0d27f97..56f351c001 100644 --- a/firmware/target/arm/sandisk/sansa-e200/ata-e200.c +++ b/firmware/target/arm/sandisk/sansa-e200/ata-e200.c | |||
@@ -234,10 +234,10 @@ void sd_wait_for_state(tSDCardInfo* card, unsigned int state) | |||
234 | } | 234 | } |
235 | 235 | ||
236 | 236 | ||
237 | static void copy_read_sectors(unsigned char* buf, int wordcount) | 237 | STATICIRAM void copy_read_sectors(unsigned char* buf, int wordcount) |
238 | NOINLINE_ATTR ICODE_ATTR; | 238 | NOINLINE_ATTR ICODE_ATTR; |
239 | 239 | ||
240 | static void copy_read_sectors(unsigned char* buf, int wordcount) | 240 | STATICIRAM void copy_read_sectors(unsigned char* buf, int wordcount) |
241 | { | 241 | { |
242 | unsigned int tmp = 0; | 242 | unsigned int tmp = 0; |
243 | 243 | ||
@@ -262,10 +262,10 @@ static void copy_read_sectors(unsigned char* buf, int wordcount) | |||
262 | } | 262 | } |
263 | } | 263 | } |
264 | 264 | ||
265 | static void copy_write_sectors(const unsigned char* buf, int wordcount) | 265 | STATICIRAM void copy_write_sectors(const unsigned char* buf, int wordcount) |
266 | NOINLINE_ATTR ICODE_ATTR; | 266 | NOINLINE_ATTR ICODE_ATTR; |
267 | 267 | ||
268 | static void copy_write_sectors(const unsigned char* buf, int wordcount) | 268 | STATICIRAM void copy_write_sectors(const unsigned char* buf, int wordcount) |
269 | { | 269 | { |
270 | unsigned short tmp = 0; | 270 | unsigned short tmp = 0; |
271 | const unsigned char* bufend = buf + wordcount*2; | 271 | const unsigned char* bufend = buf + wordcount*2; |