nvm read works now.

This commit is contained in:
Mariano Alvira 2009-04-15 17:32:00 -04:00
parent 28242cc8e1
commit 438c940ed7
3 changed files with 23 additions and 5 deletions

View File

@ -35,6 +35,6 @@ typedef enum
/* ROM code seems to be THUMB */
/* need to be in a THUMB block before calling them */
volatile nvmErr_t (*nvm_detect)(nvmInterface_t nvmInterface,nvmType_t* pNvmType) = 0x00006cb9;
volatile nvmErr_t (*nvm_read)(nvmInterface_t nvmInterface , nvmType_t nvmType , void *pDest, uint32_t address, uint32_t numBytes);
volatile nvmErr_t (*nvm_read)(nvmInterface_t nvmInterface , nvmType_t nvmType , void *pDest, uint32_t address, uint32_t numBytes) = 0x00006d69;
volatile void(*nvm_setsvar)(uint32_t zero_for_awesome) = 0x00007085;
#endif //NVM_H

View File

@ -49,6 +49,7 @@ _start: b _begin
/* these vectors are used for rom patching */
.org 0x20
.code 16
_RPTV_0_START:
bx lr /* do nothing */
@ -68,7 +69,7 @@ _RPTV_3_START:
ROM_var_start: .word 0
.org 0x7ff
ROM_var_end: .word 0
.code 32
.align
_begin:
bl _rom_data_init+.-base

View File

@ -29,10 +29,13 @@ void put_hex32(uint32_t x);
const uint8_t hex[16]={'0','1','2','3','4','5','6','7',
'8','9','a','b','c','d','e','f'};
#define NBYTES 128
__attribute__ ((section ("startup")))
void main(void) {
uint32_t type=0xdeadbeef;
nvmType_t type=0;
nvmErr_t err;
uint32_t buf[NBYTES/4];
uint32_t i;
*(volatile uint32_t *)GPIO_PAD_DIR0 = 0x00000100;
@ -62,13 +65,27 @@ void main(void) {
puts("Detecting internal nvm\n\r");
err = nvm_detect(gNvmInternalInterface_c, &type);
puts("nvm_detect returned: 0x");
put_hex(err);
puts(" type is: 0x");
put_hex32(type);
puts("\n\r");
nvm_setsvar(0);
err = nvm_read(gNvmInternalInterface_c, type, (uint8_t *)buf, 0x1F000, NBYTES);
puts("nvm_read returned: 0x");
put_hex(err);
puts("\n\r");
for(i=0; i<NBYTES/4; i++) {
puts("0x");
put_hex32(buf[i]);
puts("\n\r");
}
while(1) {continue;};
}