]> rtime.felk.cvut.cz Git - lincan.git/blobdiff - embedded/arch/arm/mach-lpc21xx/libs/iap/iap.c
Update of system-less architecture and board support code to actual uLAN.sf.net version.
[lincan.git] / embedded / arch / arm / mach-lpc21xx / libs / iap / iap.c
index cc39097139694eeb8479623a5015a44a869ca7f5..23f7bc0261a8fd3ac5392939f2e6bfcc1e869ed1 100644 (file)
@@ -2,8 +2,6 @@
 #include <cpu_def.h>
 #include <hal_machperiph.h>
 
-#define IAP_PLL_FULL_SPEED      1
-
 #define CMD_SUCCESS 0
 #define BUSY 11
 
@@ -12,8 +10,8 @@
 #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
@@ -46,7 +44,7 @@ int lpcisp_prepare_sectors(unsigned char start, unsigned char end)
   command[0] = IAP_CMD_PREPARE;
   command[1] = start;
   command[2] = end;
-  command[3] = FOSC/1000;
+  command[3] = system_frequency/1000;
 
   iap_entry(command, result);
 
@@ -58,7 +56,7 @@ int lpcisp_erase_sectors(unsigned char start, unsigned char end)
   command[0] = IAP_CMD_ERASE;
   command[1] = start;
   command[2] = end;
-  command[3] = FOSC/1000;
+  command[3] = system_frequency/1000;
 
   iap_entry(command, result);
 
@@ -76,18 +74,12 @@ int lpcisp_erase(void *addr, int len)
   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);
@@ -102,9 +94,6 @@ int lpcisp_write(void *addr_des, const void *addr_src, int len)
   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;
@@ -113,13 +102,10 @@ int lpcisp_write(void *addr_des, const void *addr_src, int len)
   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);