/******************************************************************************
* DESCRIPTION:
*
*****************************************************************************/
PRAGMA(INLINE_OFF)
u32_t __FlashCmd(u32_t cmd) {
u32_t fsr;
while(!(SAM256_MC->FSR0 & FRDY_BIT)){};
SAM256_MC->FCR0 = cmd;
do { fsr = SAM256_MC->FSR0;
} while(!(fsr & FRDY_BIT));
return fsr;
}
PRAGMA(INLINE_ON)
/******************************************************************************
* DESCRIPTION:
*
*****************************************************************************/
PRAGMA(INLINE_OFF)
u32_t flash_cmd_func[16];
u32_t FlashCmd(u32_t cmd) {
CPU_SR cpu_sr;
u32_t (*func)(u32_t);
u32_t res;
//////
sa_memcpy(flash_cmd_func,(void*)&__FlashCmd,16 * 4);
//////
OS_ENTER_CRITICAL();
func = (u32_t (*)(u32_t))flash_cmd_func;
res = func (cmd);
OS_EXIT_CRITICAL() ;
//////
SAM256_MC->FMR0 = 0;
return res;
}
PRAGMA(INLINE_ON)