/*
* I think this is not the best way to go but we need to
* put flash routines into the sram
*/
char flash_write(int *data, short data_length, short pagen) __attribute__ ((section (".data")));
inline int perform_command( char command, short pagen ) __attribute__ ((section (".data")));
void efc_test()
{
SETTINGS_PAGE[0] = 1; /* write sth to the beginning */
SETTINGS_PAGE[32] = 1;
SETTINGS_PAGE[64] = 1; /* write sth to the end */
flash_write(NULL, 0, SETTINGS_PAGE_NUMBER);
}
/*
* Flash programming
*/
inline int perform_command( char command, short pagen )
{
int i;
DISABLE_INTERRUPTS();
i = AT91C_BASE_MC->MC_FSR;
while( ( i & AT91C_MC_FRDY ) != AT91C_MC_FRDY )
i = AT91C_BASE_MC->MC_FSR;