Hi follks, I got questions with regards to the following assembly code. Can anyone please explain what does Line 1, 2 and 3 do? Thanks in advance!  :D

// Setup EFC
IF (EFC_SETUP != 0)
                LDR    R0, =EFC_BASE                          //Line 1
                LDR    R1, =EFC_FMR_Val                      //Line 2
                STR    R1,                     //Line 3
ENDIF
Posted on 2006-10-11 05:12:34 by tantf
it looks like ARM code to me. google for "ARM assembly programming" and look at" advanced risc machine" at wikipedia
Posted on 2006-10-11 07:44:58 by vid
Another question. Anyone here has experience using  AT91SAM7 series? I've been having problem with my Write Flash function.

The program always hangs after the /* Write the write page command */ command . Can anyone tell me what are the possible reasons? The following is my Write Flash function. Thanks!

int32 AT91FlashWrite(uint32 fw_flash_addr, int32 fw_size, uint32 *fw_buff)
{
/* set the Flash controller base address */
AT91PS_MC fw_ptMC = AT91C_BASE_MC;
uint32 fw_i;
uint32 fw_page;
uint32 fw_status;
uint32 *fw_flash;


/* init flash pointer */
fw_flash = (uint32 *) fw_flash_addr;

AT91FlashInit();

/* Protect */
DisableInterrupts();

/* Get the Flash page number */
fw_page = ((fw_flash_addr - 0x00100000 ) /256);

/* copy the new value */
for(fw_i = 0; (fw_i < 256) & (fw_size > 0); fw_i++, fw_flash++, fw_buff++, fw_size -= 4)
{
/* copy the flash to the write buffer ensuring code generation */
*fw_flash=*fw_buff;
}

/* Write the write page command */
fw_ptMC->MC_FCR = 0x5A000000 | 0x00000001 | ((0x3FF & fw_page) << ;

(hangs) /* Wait the end of command */
fw_status = AT91FlashReady();

/* Protect */
EnableInterrupts();

/* Check the result */
if ((fw_status & (AT91C_MC_PROGE | AT91C_MC_LOCKE)) != 0)
return 1;
else
return 0;
}
Posted on 2006-10-11 20:19:17 by tantf