diff options
author | Evan Lojewski <github@meklort.com> | 2019-02-23 13:28:15 -0700 |
---|---|---|
committer | Evan Lojewski <github@meklort.com> | 2019-02-23 13:28:15 -0700 |
commit | 7fe2ef3fb650247e4b8e4fed2294f564119f4b6b (patch) | |
tree | 2b561a63416ce322ceb03c6a824bb7a284c4424e /libs | |
parent | d81fa4c17c6c815fa30120dc9ddf26e29f19821b (diff) | |
download | bcm5719-ortega-7fe2ef3fb650247e4b8e4fed2294f564119f4b6b.tar.gz bcm5719-ortega-7fe2ef3fb650247e4b8e4fed2294f564119f4b6b.zip |
Update stage1 code to latest implimentation. Zero out bss during early init.
Diffstat (limited to 'libs')
-rw-r--r-- | libs/NVRam/nvm.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/libs/NVRam/nvm.c b/libs/NVRam/nvm.c index 9e69ecc..dbbad58 100644 --- a/libs/NVRam/nvm.c +++ b/libs/NVRam/nvm.c @@ -223,7 +223,7 @@ void NVRam_read(uint32_t address, uint32_t *buffer, size_t words) void NVRam_writeWord(uint32_t address, uint32_t data) { - if(data != NVRam_readWord(address)) + if(data != NVRam_readWord(address)) { // Only write if different. @@ -240,12 +240,27 @@ void NVRam_writeWord(uint32_t address, uint32_t data) void NVRam_write(uint32_t address, uint32_t *buffer, size_t words) { +#if 0 if (!words) { // No bytes to read. return; } + // Reduce beginning of buffer until we find the first different work. + while(buffer[0] == NVRam_readWord(address)) + { + address += 4; + buffer++; + words--; + } + + // Trim words at end of buffer if they don't need to change.s + while(words && (buffer[words-1] == NVRam_readWord(address + (words-1)*4))) + { + words--; + } + // First word. RegNVMCommand_t cmd; cmd.r32 = 0; @@ -269,4 +284,13 @@ void NVRam_write(uint32_t address, uint32_t *buffer, size_t words) // If we have more than one word, clear the first bit. cmd.bits.First = 0; } +#else + while (words) + { + NVRam_writeWord(address, *buffer); + buffer++; + words--; + address += 4; + } +#endif } |