#include <cpu_def.h>
#include <hal_machperiph.h>
-#define IAP_PLL_FULL_SPEED 1
-
#define CMD_SUCCESS 0
#define BUSY 11
#define IAP_CMD_ERASE 52
#define IAP_CMD_READ_PARTID 54
-uint32_t command[5];
-uint32_t result[2];
+unsigned int command[5];
+unsigned int result[2];
extern void iap_asm_entry (unsigned int *,unsigned int *);
#define iap_entry iap_asm_entry
command[0] = IAP_CMD_PREPARE;
command[1] = start;
command[2] = end;
- command[3] = FOSC/1000;
+ command[3] = system_frequency/1000;
iap_entry(command, result);
command[0] = IAP_CMD_ERASE;
command[1] = start;
command[2] = end;
- command[3] = FOSC/1000;
+ command[3] = system_frequency/1000;
iap_entry(command, result);
if (end<start) return 0;
save_and_cli(flags);
- #ifndef IAP_PLL_FULL_SPEED
- lpc_pll_off();
- #endif
lpcisp_prepare_sectors(start,end);
if (CMD_SUCCESS != *result) return 0;
lpcisp_erase_sectors(start,end);
- #ifndef IAP_PLL_FULL_SPEED
- lpc_pll_on();
- #endif
restore_flags(flags);
return (CMD_SUCCESS == *result);
end=start;
save_and_cli(flags);
- #ifndef IAP_PLL_FULL_SPEED
- lpc_pll_off();
- #endif
lpcisp_prepare_sectors(start,end);
if (CMD_SUCCESS != *result) return 0;
command[1] = (unsigned int)addr_des;
command[2] = (unsigned int)addr_src;
command[3] = len;
- command[4] = FOSC/1000;
+ command[4] = system_frequency/1000;
iap_entry(command, result);
- #ifndef IAP_PLL_FULL_SPEED
- lpc_pll_on();
- #endif
restore_flags(flags);
return (CMD_SUCCESS == *result);