summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-rw-r--r--firmware/drivers/ata.c10
-rw-r--r--firmware/export/config/mpiohd200.h2
-rw-r--r--firmware/target/coldfire/ata-as-coldfire.S68
-rw-r--r--firmware/target/sh/archos/ata-target.h2
4 files changed, 41 insertions, 41 deletions
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c
index 4780cf5c0f..ff463e52d1 100644
--- a/firmware/drivers/ata.c
+++ b/firmware/drivers/ata.c
@@ -280,7 +280,7 @@ STATICIRAM ICODE_ATTR void copy_read_sectors(unsigned char* buf, int wordcount)
280 do 280 do
281 { 281 {
282 tmp = ATA_DATA; 282 tmp = ATA_DATA;
283#if defined(SWAP_WORDS) || defined(ROCKBOX_LITTLE_ENDIAN) 283#if defined(ATA_SWAP_WORDS) || defined(ROCKBOX_LITTLE_ENDIAN)
284 *buf++ = tmp & 0xff; /* I assume big endian */ 284 *buf++ = tmp & 0xff; /* I assume big endian */
285 *buf++ = tmp >> 8; /* and don't use the SWAB16 macro */ 285 *buf++ = tmp >> 8; /* and don't use the SWAB16 macro */
286#else 286#else
@@ -295,7 +295,7 @@ STATICIRAM ICODE_ATTR void copy_read_sectors(unsigned char* buf, int wordcount)
295 unsigned short* wbufend = wbuf + wordcount; 295 unsigned short* wbufend = wbuf + wordcount;
296 do 296 do
297 { 297 {
298#ifdef SWAP_WORDS 298#ifdef ATA_SWAP_WORDS
299 *wbuf = swap16(ATA_DATA); 299 *wbuf = swap16(ATA_DATA);
300#else 300#else
301 *wbuf = ATA_DATA; 301 *wbuf = ATA_DATA;
@@ -315,7 +315,7 @@ STATICIRAM ICODE_ATTR void copy_write_sectors(const unsigned char* buf,
315 const unsigned char* bufend = buf + wordcount*2; 315 const unsigned char* bufend = buf + wordcount*2;
316 do 316 do
317 { 317 {
318#if defined(SWAP_WORDS) || defined(ROCKBOX_LITTLE_ENDIAN) 318#if defined(ATA_SWAP_WORDS) || defined(ROCKBOX_LITTLE_ENDIAN)
319 tmp = (unsigned short) *buf++; 319 tmp = (unsigned short) *buf++;
320 tmp |= (unsigned short) *buf++ << 8; 320 tmp |= (unsigned short) *buf++ << 8;
321 SET_16BITREG(ATA_DATA, tmp); 321 SET_16BITREG(ATA_DATA, tmp);
@@ -332,7 +332,7 @@ STATICIRAM ICODE_ATTR void copy_write_sectors(const unsigned char* buf,
332 unsigned short* wbufend = wbuf + wordcount; 332 unsigned short* wbufend = wbuf + wordcount;
333 do 333 do
334 { 334 {
335#ifdef SWAP_WORDS 335#ifdef ATA_SWAP_WORDS
336 SET_16BITREG(ATA_DATA, swap16(*wbuf)); 336 SET_16BITREG(ATA_DATA, swap16(*wbuf));
337#else 337#else
338 SET_16BITREG(ATA_DATA, *wbuf); 338 SET_16BITREG(ATA_DATA, *wbuf);
@@ -1127,7 +1127,7 @@ static int identify(void)
1127 for (i=0; i<SECTOR_SIZE/2; i++) { 1127 for (i=0; i<SECTOR_SIZE/2; i++) {
1128 /* the IDENTIFY words are already swapped, so we need to treat 1128 /* the IDENTIFY words are already swapped, so we need to treat
1129 this info differently that normal sector data */ 1129 this info differently that normal sector data */
1130#if defined(ROCKBOX_BIG_ENDIAN) && !defined(SWAP_WORDS) 1130#if defined(ROCKBOX_BIG_ENDIAN) && !defined(ATA_SWAP_WORDS)
1131 identify_info[i] = swap16(ATA_DATA); 1131 identify_info[i] = swap16(ATA_DATA);
1132#else 1132#else
1133 identify_info[i] = ATA_DATA; 1133 identify_info[i] = ATA_DATA;
diff --git a/firmware/export/config/mpiohd200.h b/firmware/export/config/mpiohd200.h
index 358079a612..465154a4bd 100644
--- a/firmware/export/config/mpiohd200.h
+++ b/firmware/export/config/mpiohd200.h
@@ -11,7 +11,7 @@
11/* define this if you use an ATA controller */ 11/* define this if you use an ATA controller */
12#define CONFIG_STORAGE STORAGE_ATA 12#define CONFIG_STORAGE STORAGE_ATA
13#define HAVE_LBA48 13#define HAVE_LBA48
14#define SWAP_WORDS 14#define ATA_SWAP_WORDS
15 15
16/* define this if you have recording possibility */ 16/* define this if you have recording possibility */
17/* not implemented yet 17/* not implemented yet
diff --git a/firmware/target/coldfire/ata-as-coldfire.S b/firmware/target/coldfire/ata-as-coldfire.S
index e7e0ee19c0..0b2cb850f4 100644
--- a/firmware/target/coldfire/ata-as-coldfire.S
+++ b/firmware/target/coldfire/ata-as-coldfire.S
@@ -56,14 +56,14 @@
56 * %d1 - shift count 56 * %d1 - shift count
57 * %d2-%d6 - read buffers 57 * %d2-%d6 - read buffers
58 * 58 *
59 * #ifdef SWAP_WORDS 59 * #ifdef ATA_SWAP_WORDS
60 * %d7 - byte swap scrach 60 * %d7 - byte swap scrach
61 * %a3 - byte swap mask 61 * %a3 - byte swap mask
62 * #endif 62 * #endif
63 */ 63 */
64 64
65copy_read_sectors: 65copy_read_sectors:
66#ifdef SWAP_WORDS 66#ifdef ATA_SWAP_WORDS
67 lea.l (-32, %sp), %sp 67 lea.l (-32, %sp), %sp
68 movem.l %d2-%d7/%a2-%a3, (%sp) 68 movem.l %d2-%d7/%a2-%a3, (%sp)
69 movem.l (36, %sp), %a0-%a1 69 movem.l (36, %sp), %a0-%a1
@@ -86,7 +86,7 @@ copy_read_sectors:
86 moveq.l #24, %d1 /* preload shift count */ 86 moveq.l #24, %d1 /* preload shift count */
87 87
88 move.w (%a2), %d2 /* load initial word */ 88 move.w (%a2), %d2 /* load initial word */
89#ifdef SWAP_WORDS 89#ifdef ATA_SWAP_WORDS
90 move.b %d2, (%a0)+ 90 move.b %d2, (%a0)+
91 lsr.l #8, %d2 91 lsr.l #8, %d2
92#else 92#else
@@ -96,7 +96,7 @@ copy_read_sectors:
96#endif 96#endif
97 btst.l #1, %d0 /* longword aligned? (testing old d0 value!) */ 97 btst.l #1, %d0 /* longword aligned? (testing old d0 value!) */
98 bne.b .r_end_u_w1 /* yes, skip leading word handling */ 98 bne.b .r_end_u_w1 /* yes, skip leading word handling */
99#ifdef SWAP_WORDS 99#ifdef ATA_SWAP_WORDS
100 move.w (%a2), %d3 100 move.w (%a2), %d3
101 lsl.l #8, %d2 101 lsl.l #8, %d2
102 move.b %d3, %d2 102 move.b %d3, %d2
@@ -123,7 +123,7 @@ copy_read_sectors:
123 swap %d3 /* move to upper 16 bit */ 123 swap %d3 /* move to upper 16 bit */
124 move.w (%a2), %d3 /* load second word */ 124 move.w (%a2), %d3 /* load second word */
125 125
126#ifdef SWAP_WORDS 126#ifdef ATA_SWAP_WORDS
127 SWAP_BYTES %d3 127 SWAP_BYTES %d3
128#endif 128#endif
129 129
@@ -144,7 +144,7 @@ copy_read_sectors:
144 swap %d3 /* move to upper 16 bit */ 144 swap %d3 /* move to upper 16 bit */
145 move.w (%a2), %d3 /* load 2nd word */ 145 move.w (%a2), %d3 /* load 2nd word */
146 146
147#ifdef SWAP_WORDS 147#ifdef ATA_SWAP_WORDS
148 SWAP_BYTES %d3 148 SWAP_BYTES %d3
149#endif 149#endif
150 150
@@ -156,7 +156,7 @@ copy_read_sectors:
156 swap %d4 /* move to upper 16 bit */ 156 swap %d4 /* move to upper 16 bit */
157 move.w (%a2), %d4 /* load 4th word */ 157 move.w (%a2), %d4 /* load 4th word */
158 158
159#ifdef SWAP_WORDS 159#ifdef ATA_SWAP_WORDS
160 SWAP_BYTES %d4 160 SWAP_BYTES %d4
161#endif 161#endif
162 162
@@ -168,7 +168,7 @@ copy_read_sectors:
168 swap %d5 /* move to upper 16 bit */ 168 swap %d5 /* move to upper 16 bit */
169 move.w (%a2), %d5 /* load 6th word */ 169 move.w (%a2), %d5 /* load 6th word */
170 170
171#ifdef SWAP_WORDS 171#ifdef ATA_SWAP_WORDS
172 SWAP_BYTES %d5 172 SWAP_BYTES %d5
173#endif 173#endif
174 174
@@ -180,7 +180,7 @@ copy_read_sectors:
180 swap %d6 /* move to upper 16 bit */ 180 swap %d6 /* move to upper 16 bit */
181 move.w (%a2), %d6 /* load 8th word */ 181 move.w (%a2), %d6 /* load 8th word */
182 182
183#ifdef SWAP_WORDS 183#ifdef ATA_SWAP_WORDS
184 SWAP_BYTES %d6 184 SWAP_BYTES %d6
185#endif 185#endif
186 186
@@ -203,7 +203,7 @@ copy_read_sectors:
203 swap %d3 /* move to upper 16 bit */ 203 swap %d3 /* move to upper 16 bit */
204 move.w (%a2), %d3 /* load second word */ 204 move.w (%a2), %d3 /* load second word */
205 205
206#ifdef SWAP_WORDS 206#ifdef ATA_SWAP_WORDS
207 SWAP_BYTES %d3 207 SWAP_BYTES %d3
208#endif 208#endif
209 209
@@ -219,7 +219,7 @@ copy_read_sectors:
219.r_end_u_l2: 219.r_end_u_l2:
220 blo.b .r_end_u_w2 /* one word left? */ 220 blo.b .r_end_u_w2 /* one word left? */
221 221
222#ifdef SWAP_WORDS 222#ifdef ATA_SWAP_WORDS
223 move.w (%a2), %d3 223 move.w (%a2), %d3
224 lsl.l #8, %d2 224 lsl.l #8, %d2
225 move.b %d3, %d2 225 move.b %d3, %d2
@@ -245,7 +245,7 @@ copy_read_sectors:
245 btst.l #1, %d0 /* longword aligned? */ 245 btst.l #1, %d0 /* longword aligned? */
246 beq.b .r_end_a_w1 /* yes, skip leading word handling */ 246 beq.b .r_end_a_w1 /* yes, skip leading word handling */
247 247
248#ifdef SWAP_WORDS 248#ifdef ATA_SWAP_WORDS
249 move.w (%a2), %d7 /* copy initial word after byte swap */ 249 move.w (%a2), %d7 /* copy initial word after byte swap */
250 move.b %d7, (%a0)+ 250 move.b %d7, (%a0)+
251 lsr.l #8, %d7 251 lsr.l #8, %d7
@@ -265,7 +265,7 @@ copy_read_sectors:
265 swap %d1 /* move it to upper 16 bits */ 265 swap %d1 /* move it to upper 16 bits */
266 move.w (%a2), %d1 /* load second word */ 266 move.w (%a2), %d1 /* load second word */
267 267
268#ifdef SWAP_WORDS 268#ifdef ATA_SWAP_WORDS
269 SWAP_BYTES %d1 269 SWAP_BYTES %d1
270#endif 270#endif
271 271
@@ -290,7 +290,7 @@ copy_read_sectors:
290 swap %d3 /* move it to upper 16 bits */ 290 swap %d3 /* move it to upper 16 bits */
291 move.w (%a2), %d3 /* load 8th word */ 291 move.w (%a2), %d3 /* load 8th word */
292 292
293#ifdef SWAP_WORDS 293#ifdef ATA_SWAP_WORDS
294 SWAP_BYTES %d0 294 SWAP_BYTES %d0
295 SWAP_BYTES %d1 295 SWAP_BYTES %d1
296 SWAP_BYTES %d2 296 SWAP_BYTES %d2
@@ -311,7 +311,7 @@ copy_read_sectors:
311 swap %d1 /* move it to upper 16 bits */ 311 swap %d1 /* move it to upper 16 bits */
312 move.w (%a2), %d1 /* read second word */ 312 move.w (%a2), %d1 /* read second word */
313 313
314#ifdef SWAP_WORDS 314#ifdef ATA_SWAP_WORDS
315 SWAP_BYTES %d1 315 SWAP_BYTES %d1
316#endif 316#endif
317 317
@@ -322,7 +322,7 @@ copy_read_sectors:
322.r_end_a_l2: 322.r_end_a_l2:
323 blo.b .r_end_a_w2 /* one word left? */ 323 blo.b .r_end_a_w2 /* one word left? */
324 324
325#ifdef SWAP_WORDS 325#ifdef ATA_SWAP_WORDS
326 move.w (%a2), %d7 /* copy final word after byte swap */ 326 move.w (%a2), %d7 /* copy final word after byte swap */
327 move.b %d7, (%a0)+ 327 move.b %d7, (%a0)+
328 lsr.l #8, %d7 328 lsr.l #8, %d7
@@ -333,7 +333,7 @@ copy_read_sectors:
333.r_end_a_w2: 333.r_end_a_w2:
334 334
335.r_exit: 335.r_exit:
336#ifdef SWAP_WORDS 336#ifdef ATA_SWAP_WORDS
337 movem.l (%sp), %d2-%d7/%a2-%a3 337 movem.l (%sp), %d2-%d7/%a2-%a3
338 lea.l (32, %sp), %sp 338 lea.l (32, %sp), %sp
339#else 339#else
@@ -365,14 +365,14 @@ copy_read_sectors:
365 * %d1 - shift count 365 * %d1 - shift count
366 * %d2-%d6 - read buffers 366 * %d2-%d6 - read buffers
367 * 367 *
368 * #ifdef SWAP_WORDS 368 * #ifdef ATA_SWAP_WORDS
369 * %d7 - swap scrach 369 * %d7 - swap scrach
370 * %a3 - swap mask 370 * %a3 - swap mask
371 * #endif 371 * #endif
372 */ 372 */
373 373
374copy_write_sectors: 374copy_write_sectors:
375#ifdef SWAP_WORDS 375#ifdef ATA_SWAP_WORDS
376 lea.l (-32, %sp), %sp 376 lea.l (-32, %sp), %sp
377 movem.l %d2-%d7/%a2-%a3, (%sp) 377 movem.l %d2-%d7/%a2-%a3, (%sp)
378 movem.l (36, %sp), %a0-%a1 378 movem.l (36, %sp), %a0-%a1
@@ -404,7 +404,7 @@ copy_write_sectors:
404 move.l %d2, %d3 404 move.l %d2, %d3
405 lsr.l #8, %d3 405 lsr.l #8, %d3
406 406
407#ifdef SWAP_WORDS 407#ifdef ATA_SWAP_WORDS
408 move.l %d3, %d7 /* byte swap low word of %d3 */ 408 move.l %d3, %d7 /* byte swap low word of %d3 */
409 lsr.l #8, %d7 409 lsr.l #8, %d7
410 lsl.l #8, %d3 410 lsl.l #8, %d3
@@ -427,7 +427,7 @@ copy_write_sectors:
427 lsr.l #8, %d3 427 lsr.l #8, %d3
428 or.l %d3, %d2 428 or.l %d3, %d2
429 429
430#ifdef SWAP_WORDS 430#ifdef ATA_SWAP_WORDS
431 SWAP_BYTES %d2 431 SWAP_BYTES %d2
432#endif 432#endif
433 433
@@ -450,7 +450,7 @@ copy_write_sectors:
450 lsr.l #8, %d0 450 lsr.l #8, %d0
451 or.l %d0, %d2 451 or.l %d0, %d2
452 452
453#ifdef SWAP_WORDS 453#ifdef ATA_SWAP_WORDS
454 SWAP_BYTES %d2 454 SWAP_BYTES %d2
455#endif 455#endif
456 456
@@ -463,7 +463,7 @@ copy_write_sectors:
463 lsr.l #8, %d0 463 lsr.l #8, %d0
464 or.l %d0, %d3 464 or.l %d0, %d3
465 465
466#ifdef SWAP_WORDS 466#ifdef ATA_SWAP_WORDS
467 SWAP_BYTES %d3 467 SWAP_BYTES %d3
468#endif 468#endif
469 469
@@ -476,7 +476,7 @@ copy_write_sectors:
476 lsr.l #8, %d0 476 lsr.l #8, %d0
477 or.l %d0, %d4 477 or.l %d0, %d4
478 478
479#ifdef SWAP_WORDS 479#ifdef ATA_SWAP_WORDS
480 SWAP_BYTES %d4 480 SWAP_BYTES %d4
481#endif 481#endif
482 482
@@ -489,7 +489,7 @@ copy_write_sectors:
489 lsr.l #8, %d0 489 lsr.l #8, %d0
490 or.l %d0, %d5 490 or.l %d0, %d5
491 491
492#ifdef SWAP_WORDS 492#ifdef ATA_SWAP_WORDS
493 SWAP_BYTES %d5 493 SWAP_BYTES %d5
494#endif 494#endif
495 495
@@ -512,7 +512,7 @@ copy_write_sectors:
512 lsr.l #8, %d3 512 lsr.l #8, %d3
513 or.l %d3, %d2 513 or.l %d3, %d2
514 514
515#ifdef SWAP_WORDS 515#ifdef ATA_SWAP_WORDS
516 SWAP_BYTES %d2 516 SWAP_BYTES %d2
517#endif 517#endif
518 518
@@ -532,14 +532,14 @@ copy_write_sectors:
532 move.l %d2, %d3 532 move.l %d2, %d3
533 lsr.l #8, %d3 533 lsr.l #8, %d3
534 534
535#ifdef SWAP_WORDS 535#ifdef ATA_SWAP_WORDS
536 SWAP_BYTES %d3 536 SWAP_BYTES %d3
537#endif 537#endif
538 538
539 move.w %d3, (%a2) 539 move.w %d3, (%a2)
540 540
541.w_end_u_w2: 541.w_end_u_w2:
542#ifdef SWAP_WORDS 542#ifdef ATA_SWAP_WORDS
543 move.l %d2, %d7 543 move.l %d2, %d7
544 move.b (%a0)+, %d2 544 move.b (%a0)+, %d2
545 lsl.l #8, %d2 545 lsl.l #8, %d2
@@ -558,7 +558,7 @@ copy_write_sectors:
558 btst.l #1, %d0 558 btst.l #1, %d0
559 beq.b .w_end_a_w1 559 beq.b .w_end_a_w1
560 560
561#ifdef SWAP_WORDS 561#ifdef ATA_SWAP_WORDS
562 move.w (%a0)+, %d1 /* copy initial word bytes swaped */ 562 move.w (%a0)+, %d1 /* copy initial word bytes swaped */
563 move.l %d1, %d7 563 move.l %d1, %d7
564 lsl.l #8, %d1 564 lsl.l #8, %d1
@@ -579,7 +579,7 @@ copy_write_sectors:
579.w_loop_a_l1: 579.w_loop_a_l1:
580 move.l (%a0)+, %d1 580 move.l (%a0)+, %d1
581 581
582#ifdef SWAP_WORDS 582#ifdef ATA_SWAP_WORDS
583 SWAP_BYTES %d1 583 SWAP_BYTES %d1
584#endif 584#endif
585 585
@@ -597,7 +597,7 @@ copy_write_sectors:
597 movem.l (%a0), %d0-%d3 597 movem.l (%a0), %d0-%d3
598 lea.l (16, %a0), %a0 598 lea.l (16, %a0), %a0
599 599
600#ifdef SWAP_WORDS 600#ifdef ATA_SWAP_WORDS
601 SWAP_BYTES %d0 601 SWAP_BYTES %d0
602 SWAP_BYTES %d1 602 SWAP_BYTES %d1
603 SWAP_BYTES %d2 603 SWAP_BYTES %d2
@@ -630,7 +630,7 @@ copy_write_sectors:
630.w_loop_a_l2: 630.w_loop_a_l2:
631 move.l (%a0)+, %d1 631 move.l (%a0)+, %d1
632 632
633#ifdef SWAP_WORDS 633#ifdef ATA_SWAP_WORDS
634 SWAP_BYTES %d1 634 SWAP_BYTES %d1
635#endif 635#endif
636 636
@@ -644,7 +644,7 @@ copy_write_sectors:
644.w_end_a_l2: 644.w_end_a_l2:
645 blo.b .w_end_a_w2 /* one word left? */ 645 blo.b .w_end_a_w2 /* one word left? */
646 646
647#ifdef SWAP_WORDS 647#ifdef ATA_SWAP_WORDS
648 move.w (%a0)+, %d0 /* copy final word after byte swap */ 648 move.w (%a0)+, %d0 /* copy final word after byte swap */
649 move.l %d0, %d7 649 move.l %d0, %d7
650 lsl.l #8, %d0 650 lsl.l #8, %d0
@@ -658,7 +658,7 @@ copy_write_sectors:
658.w_end_a_w2: 658.w_end_a_w2:
659 659
660.w_exit: 660.w_exit:
661#ifdef SWAP_WORDS 661#ifdef ATA_SWAP_WORDS
662 movem.l (%sp), %d2-%d7/%a2-%a3 662 movem.l (%sp), %d2-%d7/%a2-%a3
663 lea.l (32, %sp), %sp 663 lea.l (32, %sp), %sp
664#else 664#else
diff --git a/firmware/target/sh/archos/ata-target.h b/firmware/target/sh/archos/ata-target.h
index aef025e1df..42faf6fd80 100644
--- a/firmware/target/sh/archos/ata-target.h
+++ b/firmware/target/sh/archos/ata-target.h
@@ -25,7 +25,7 @@
25#define ATA_OPTIMIZED_READING 25#define ATA_OPTIMIZED_READING
26#define ATA_OPTIMIZED_WRITING 26#define ATA_OPTIMIZED_WRITING
27 27
28#define SWAP_WORDS 28#define ATA_SWAP_WORDS
29 29
30#define ATA_IOBASE 0x06100100 30#define ATA_IOBASE 0x06100100
31#define ATA_DATA (*((volatile unsigned short*)0x06104100)) 31#define ATA_DATA (*((volatile unsigned short*)0x06104100))