summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-rw-r--r--firmware/drivers/ata.c25
-rw-r--r--firmware/export/config.h9
-rw-r--r--firmware/target/arm/sandisk/sansa-e200/ata-e200.c12
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);
98static int set_multiple_mode(int sectors); 98static int set_multiple_mode(int sectors);
99static int set_features(void); 99static int set_features(void);
100 100
101static int wait_for_bsy(void) ICODE_ATTR; 101STATICIRAM int wait_for_bsy(void) ICODE_ATTR;
102static int wait_for_bsy(void) 102STATICIRAM 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
116static int wait_for_rdy(void) ICODE_ATTR; 116STATICIRAM int wait_for_rdy(void) ICODE_ATTR;
117static int wait_for_rdy(void) 117STATICIRAM 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
138static int wait_for_start_of_transfer(void) ICODE_ATTR; 138STATICIRAM int wait_for_start_of_transfer(void) ICODE_ATTR;
139static int wait_for_start_of_transfer(void) 139STATICIRAM 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
147static int wait_for_end_of_transfer(void) ICODE_ATTR; 147STATICIRAM int wait_for_end_of_transfer(void) ICODE_ATTR;
148static int wait_for_end_of_transfer(void) 148STATICIRAM 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
169static void copy_read_sectors(unsigned char* buf, int wordcount) ICODE_ATTR; 169STATICIRAM void copy_read_sectors(unsigned char* buf, int wordcount) ICODE_ATTR;
170static void copy_read_sectors(unsigned char* buf, int wordcount) 170STATICIRAM 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
368static void copy_write_sectors(const unsigned char* buf, int wordcount) ICODE_ATTR; 368STATICIRAM void copy_write_sectors(const unsigned char* buf, int wordcount)
369static void copy_write_sectors(const unsigned char* buf, int wordcount) 369 ICODE_ATTR;
370STATICIRAM 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
237static void copy_read_sectors(unsigned char* buf, int wordcount) 237STATICIRAM void copy_read_sectors(unsigned char* buf, int wordcount)
238 NOINLINE_ATTR ICODE_ATTR; 238 NOINLINE_ATTR ICODE_ATTR;
239 239
240static void copy_read_sectors(unsigned char* buf, int wordcount) 240STATICIRAM 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
265static void copy_write_sectors(const unsigned char* buf, int wordcount) 265STATICIRAM void copy_write_sectors(const unsigned char* buf, int wordcount)
266 NOINLINE_ATTR ICODE_ATTR; 266 NOINLINE_ATTR ICODE_ATTR;
267 267
268static void copy_write_sectors(const unsigned char* buf, int wordcount) 268STATICIRAM 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;