summaryrefslogtreecommitdiff
path: root/bootloader/main-pp.c
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2007-06-30 02:08:27 +0000
committerMichael Sevakis <jethead71@rockbox.org>2007-06-30 02:08:27 +0000
commit1167e3c72f5d0d581b81fd2cb8f2580a1524ca5a (patch)
tree501f9901636d5586271067d0c157204e500a2cfd /bootloader/main-pp.c
parent189a5f812f47e43e5704a44c3abb85a4c37c8662 (diff)
downloadrockbox-1167e3c72f5d0d581b81fd2cb8f2580a1524ca5a.tar.gz
rockbox-1167e3c72f5d0d581b81fd2cb8f2580a1524ca5a.zip
Accept FS#7134 - Sansa: external sd card support by Antonius Hellmann with some tweaks. All testers have given the green light. (Now for the RED ?? ;).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13741 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'bootloader/main-pp.c')
-rw-r--r--bootloader/main-pp.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/bootloader/main-pp.c b/bootloader/main-pp.c
index 49d7f0a2f7..dd8b7984ca 100644
--- a/bootloader/main-pp.c
+++ b/bootloader/main-pp.c
@@ -352,7 +352,7 @@ int load_mi4_part(unsigned char* buf, struct partinfo* pinfo,
352 unsigned long sum; 352 unsigned long sum;
353 353
354 /* Read header to find out how long the mi4 file is. */ 354 /* Read header to find out how long the mi4 file is. */
355 ata_read_sectors(pinfo->start + PPMI_SECTOR_OFFSET, 355 ata_read_sectors(IF_MV2(0,) pinfo->start + PPMI_SECTOR_OFFSET,
356 PPMI_SECTORS, &ppmi_header); 356 PPMI_SECTORS, &ppmi_header);
357 357
358 /* The first four characters at 0x80000 (sector 1024) should be PPMI*/ 358 /* The first four characters at 0x80000 (sector 1024) should be PPMI*/
@@ -362,7 +362,7 @@ int load_mi4_part(unsigned char* buf, struct partinfo* pinfo,
362 printf("BL mi4 size: %x", ppmi_header.length); 362 printf("BL mi4 size: %x", ppmi_header.length);
363 363
364 /* Read mi4 header of the OF */ 364 /* Read mi4 header of the OF */
365 ata_read_sectors(pinfo->start + PPMI_SECTOR_OFFSET + PPMI_SECTORS 365 ata_read_sectors(IF_MV2(0,) pinfo->start + PPMI_SECTOR_OFFSET + PPMI_SECTORS
366 + (ppmi_header.length/512), MI4_HEADER_SECTORS, &mi4header); 366 + (ppmi_header.length/512), MI4_HEADER_SECTORS, &mi4header);
367 367
368 /* We don't support encrypted mi4 files yet */ 368 /* We don't support encrypted mi4 files yet */
@@ -385,7 +385,7 @@ int load_mi4_part(unsigned char* buf, struct partinfo* pinfo,
385 printf("Binary type: %.4s", mi4header.type); 385 printf("Binary type: %.4s", mi4header.type);
386 386
387 /* Load firmware */ 387 /* Load firmware */
388 ata_read_sectors(pinfo->start + PPMI_SECTOR_OFFSET + PPMI_SECTORS 388 ata_read_sectors(IF_MV2(0,) pinfo->start + PPMI_SECTOR_OFFSET + PPMI_SECTORS
389 + (ppmi_header.length/512) + MI4_HEADER_SECTORS, 389 + (ppmi_header.length/512) + MI4_HEADER_SECTORS,
390 (mi4header.mi4size-MI4_HEADER_SIZE)/512, buf); 390 (mi4header.mi4size-MI4_HEADER_SIZE)/512, buf);
391 391
@@ -404,7 +404,7 @@ int load_mi4_part(unsigned char* buf, struct partinfo* pinfo,
404 unsigned int i; 404 unsigned int i;
405 /* check which known version we have */ 405 /* check which known version we have */
406 /* These are taken from the PPPS section, 0x00780240 */ 406 /* These are taken from the PPPS section, 0x00780240 */
407 ata_read_sectors(pinfo->start + 0x3C01, 1, block); 407 ata_read_sectors(IF_MV2(0,) pinfo->start + 0x3C01, 1, block);
408 for (i=0; i<sizeof(OFDatabaseOffsets)/sizeof(*OFDatabaseOffsets); i++) 408 for (i=0; i<sizeof(OFDatabaseOffsets)/sizeof(*OFDatabaseOffsets); i++)
409 { 409 {
410 if (!memcmp(&block[0x40], OFDatabaseOffsets[i].version, 410 if (!memcmp(&block[0x40], OFDatabaseOffsets[i].version,
@@ -417,9 +417,9 @@ int load_mi4_part(unsigned char* buf, struct partinfo* pinfo,
417 } 417 }
418 if (sector && offset) 418 if (sector && offset)
419 { 419 {
420 ata_read_sectors(sector, 1, block); 420 ata_read_sectors(IF_MV2(0,) sector, 1, block);
421 block[offset] = 0; 421 block[offset] = 0;
422 ata_write_sectors(sector, 1, block); 422 ata_write_sectors(IF_MV2(0,) sector, 1, block);
423 } 423 }
424 } 424 }
425 return EOK; 425 return EOK;
@@ -428,12 +428,14 @@ int load_mi4_part(unsigned char* buf, struct partinfo* pinfo,
428 428
429void* main(void) 429void* main(void)
430{ 430{
431#ifndef SANSA_E200
431 char buf[256]; 432 char buf[256];
433 unsigned short* identify_info;
434#endif
432 int i; 435 int i;
433 int btn; 436 int btn;
434 int rc; 437 int rc;
435 int num_partitions; 438 int num_partitions;
436 unsigned short* identify_info;
437 struct partinfo* pinfo; 439 struct partinfo* pinfo;
438#ifdef SANSA_E200 440#ifdef SANSA_E200
439 int usb_retry = 0; 441 int usb_retry = 0;
@@ -475,6 +477,7 @@ void* main(void)
475 printf(MODEL_NAME); 477 printf(MODEL_NAME);
476 478
477 i=ata_init(); 479 i=ata_init();
480#ifndef SANSA_E200
478 if (i==0) { 481 if (i==0) {
479 identify_info=ata_get_identify(); 482 identify_info=ata_get_identify();
480 /* Show model */ 483 /* Show model */
@@ -489,8 +492,9 @@ void* main(void)
489 } else { 492 } else {
490 error(EATA, i); 493 error(EATA, i);
491 } 494 }
495#endif
492 496
493 disk_init(); 497 disk_init(IF_MV(0));
494 num_partitions = disk_mount_all(); 498 num_partitions = disk_mount_all();
495 if (num_partitions<=0) 499 if (num_partitions<=0)
496 { 500 {