diff options
author | Barry Wardell <rockbox@barrywardell.net> | 2007-10-20 17:08:41 +0000 |
---|---|---|
committer | Barry Wardell <rockbox@barrywardell.net> | 2007-10-20 17:08:41 +0000 |
commit | d46cf9702400d7457371c4d27cc11e46522d4694 (patch) | |
tree | bfc3c6006551015857f132d5d9fdcc59cfa40049 /bootloader | |
parent | 45b830d09efd67eed8fe7e46563db61c576cf182 (diff) | |
download | rockbox-d46cf9702400d7457371c4d27cc11e46522d4694.tar.gz rockbox-d46cf9702400d7457371c4d27cc11e46522d4694.zip |
Support database rebuild disabling when USB is connected for all e200 OF versions. Some people may have to update the OF (to any version they want) using sansapatcher before it will work. This just ensures that the NVPARAMS are in a good state and we can be sure where to look for the rebuild flag.The c200 OF doesn't reboot before rebuilding the database, so our trick won't ever work there.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15225 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'bootloader')
-rw-r--r-- | bootloader/main-pp.c | 56 |
1 files changed, 9 insertions, 47 deletions
diff --git a/bootloader/main-pp.c b/bootloader/main-pp.c index b0add13fb4..0262384d91 100644 --- a/bootloader/main-pp.c +++ b/bootloader/main-pp.c | |||
@@ -344,32 +344,6 @@ int load_mi4(unsigned char* buf, char* firmware, unsigned int buffer_size) | |||
344 | } | 344 | } |
345 | 345 | ||
346 | #if defined(SANSA_E200) || defined(SANSA_C200) | 346 | #if defined(SANSA_E200) || defined(SANSA_C200) |
347 | #ifdef SANSA_E200 | ||
348 | struct OFDB_info { | ||
349 | char *version; | ||
350 | int version_length; | ||
351 | int sector; | ||
352 | int offset; | ||
353 | } OFDatabaseOffsets[] = { | ||
354 | { "PP5022AF-05.51-S301-01.11-S301.01.11A-D", 39, 0x3c08, 0xe1 }, | ||
355 | { "PP5022AF-05.51-S301-00.12-S301.00.12E-D", 39, 0x3c5c, 0x2 }, | ||
356 | { "PP5022AF-05.51-S301-00.12-S301.00.12A-D", 39, 0x3c08, 0xe1 }, | ||
357 | { "PP5022AF-05.51-S301-02.15-S301.02.15E-D", 39, 0x3c08, 0xe1 }, | ||
358 | { "PP5022AF-05.51-S301-02.18-S301.02.18A-D", 39, 0x3c08, 0xe1 }, | ||
359 | { "PP5022AF-05.51-S301-02.18-S301.02.18E-D", 39, 0x3c08, 0xe1 } | ||
360 | }; | ||
361 | #else /* SANSA_C200 */ | ||
362 | /* TODO: need to determine these for the c200 */ | ||
363 | struct OFDB_info { | ||
364 | char *version; | ||
365 | int version_length; | ||
366 | int sector; | ||
367 | int offset; | ||
368 | } OFDatabaseOffsets[] = { | ||
369 | { "PP5022AF-05.51-S301-01.11-S301.01.11A-D", 39, 0x3c08, 0xe1 }, | ||
370 | }; | ||
371 | #endif | ||
372 | |||
373 | /* Load mi4 firmware from a hidden disk partition */ | 347 | /* Load mi4 firmware from a hidden disk partition */ |
374 | int load_mi4_part(unsigned char* buf, struct partinfo* pinfo, | 348 | int load_mi4_part(unsigned char* buf, struct partinfo* pinfo, |
375 | unsigned int buffer_size, bool disable_rebuild) | 349 | unsigned int buffer_size, bool disable_rebuild) |
@@ -424,31 +398,19 @@ int load_mi4_part(unsigned char* buf, struct partinfo* pinfo, | |||
424 | if(sum != mi4header.crc32) | 398 | if(sum != mi4header.crc32) |
425 | return EBAD_CHKSUM; | 399 | return EBAD_CHKSUM; |
426 | 400 | ||
401 | #ifdef SANSA_E200 | ||
427 | if (disable_rebuild) | 402 | if (disable_rebuild) |
428 | { | 403 | { |
429 | char block[512]; | 404 | char block[512]; |
430 | int sector = 0, offset = 0; | 405 | |
431 | unsigned int i; | 406 | printf("Disabling database rebuild"); |
432 | /* check which known version we have */ | 407 | |
433 | /* These are taken from the PPPS section, 0x00780240 */ | 408 | ata_read_sectors(IF_MV2(0,) pinfo->start + 0x3c08, 1, block); |
434 | ata_read_sectors(IF_MV2(0,) pinfo->start + 0x3C01, 1, block); | 409 | block[0xe1] = 0; |
435 | for (i=0; i<sizeof(OFDatabaseOffsets)/sizeof(*OFDatabaseOffsets); i++) | 410 | ata_write_sectors(IF_MV2(0,) pinfo->start + 0x3c08, 1, block); |
436 | { | ||
437 | if (!memcmp(&block[0x40], OFDatabaseOffsets[i].version, | ||
438 | OFDatabaseOffsets[i].version_length)) | ||
439 | { | ||
440 | sector = pinfo->start + OFDatabaseOffsets[i].sector; | ||
441 | offset = OFDatabaseOffsets[i].offset; | ||
442 | break; | ||
443 | } | ||
444 | } | ||
445 | if (sector && offset) | ||
446 | { | ||
447 | ata_read_sectors(IF_MV2(0,) sector, 1, block); | ||
448 | block[offset] = 0; | ||
449 | ata_write_sectors(IF_MV2(0,) sector, 1, block); | ||
450 | } | ||
451 | } | 411 | } |
412 | #endif | ||
413 | |||
452 | return EOK; | 414 | return EOK; |
453 | } | 415 | } |
454 | #endif | 416 | #endif |