iriver_flash: refactor code to be easier to understand
This overhauls most of the code to be easier to understand in terms of the interactions with the flash. I found the original to be rather confusing with how it kept switching between byte and word offsets. My solution was to make all external access to the flash in terms of sectors and bytes. Whatever the flash uses internally is now handled by the subroutines for performing the erase, program, and verify operations. This helps make it far more consistent for the code that actually uses these operations as they do not need to concern themselves with word sizes and offsets anymore. As a side effect of this change the flash operations are now done entirely by subroutines; even the batch operations that used to use custom loops. Additionally some functions were merged with other functions in order to reduce the amount of functions as well as consolidating common code fragments. Change-Id: I4698e920a226a3bbe8070004a14e5848abdd70ec
This commit is contained in:
parent
c4254d10fc
commit
4aa749b59d
5 changed files with 662 additions and 558 deletions
File diff suppressed because it is too large
Load diff
|
@ -172,6 +172,7 @@
|
|||
#define BOOTFILE "rockbox." BOOTFILE_EXT
|
||||
#define BOOTDIR "/.rockbox"
|
||||
|
||||
#define FLASH_BASE 0x00000000
|
||||
#define BOOTLOADER_ENTRYPOINT 0x001F0000
|
||||
#define FLASH_RAMIMAGE_ENTRY 0x00001000
|
||||
#define FLASH_ROMIMAGE_ENTRY 0x00100000
|
||||
|
|
|
@ -178,6 +178,7 @@
|
|||
#define BOOTFILE "rockbox." BOOTFILE_EXT
|
||||
#define BOOTDIR "/.rockbox"
|
||||
|
||||
#define FLASH_BASE 0x00000000
|
||||
#define BOOTLOADER_ENTRYPOINT 0x001F0000
|
||||
#define FLASH_RAMIMAGE_ENTRY 0x00001000
|
||||
#define FLASH_ROMIMAGE_ENTRY 0x00100000
|
||||
|
|
|
@ -187,6 +187,7 @@
|
|||
#define BOOTFILE "rockbox." BOOTFILE_EXT
|
||||
#define BOOTDIR "/.rockbox"
|
||||
|
||||
#define FLASH_BASE 0x00000000
|
||||
#define BOOTLOADER_ENTRYPOINT 0x003F0000
|
||||
#define FLASH_RAMIMAGE_ENTRY 0x00001000
|
||||
#define FLASH_ROMIMAGE_ENTRY 0x00200000
|
||||
|
|
|
@ -36,8 +36,8 @@ extern void system_init(void);
|
|||
extern long cpu_frequency;
|
||||
|
||||
struct flash_header {
|
||||
unsigned long magic;
|
||||
unsigned long length;
|
||||
uint32_t magic;
|
||||
uint32_t length;
|
||||
char version[32];
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue