IAP class library for LPC1768, LPC11U24, LPC1114, LPC1347, LPC1549, LPC812 and LPC824
Fork of IAP by
Revision 10:56f1e488b250, committed 2016-05-03
- Comitter:
- yuhki50
- Date:
- Tue May 03 07:43:30 2016 +0000
- Parent:
- 9:f33e8f9a3677
- Commit message:
- Fix LPC15XX support
Changed in this revision
IAP.cpp | Show annotated file Show diff for this revision Revisions of this file |
IAP.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r f33e8f9a3677 -r 56f1e488b250 IAP.cpp --- a/IAP.cpp Sun Jan 17 00:44:10 2016 +0900 +++ b/IAP.cpp Tue May 03 07:43:30 2016 +0000 @@ -180,8 +180,21 @@ #if defined(TARGET_LPC11UXX) || defined(TARGET_LPC13XX) || defined(TARGET_LPC15XX) +void IAP::init_eeprom() +{ +#if defined(TARGET_LPC15XX) + __disable_irq(); + LPC_SYSCON->SYSAHBCLKCTRL0 |= 1 << 9; + LPC_SYSCON->PRESETCTRL0 |= 1 << 9; + LPC_SYSCON->PRESETCTRL0 &= ~(1 << 9); + __enable_irq(); +#endif +} + int IAP::write_eeprom( char *source_addr, char *target_addr, int size ) { + init_eeprom(); + IAP_command[ 0 ] = IAPCommand_EEPROM_Write; IAP_command[ 1 ] = (unsigned int)target_addr; // Destination EEPROM address where data bytes are to be written. This address should be a 256 byte boundary. IAP_command[ 2 ] = (unsigned int)source_addr; // Source RAM address from which data bytes are to be read. This address should be a word boundary. @@ -195,6 +208,8 @@ int IAP::read_eeprom( char *source_addr, char *target_addr, int size ) { + init_eeprom(); + IAP_command[ 0 ] = IAPCommand_EEPROM_Read; IAP_command[ 1 ] = (unsigned int)source_addr; // Source EEPROM address from which data bytes are to be read. This address should be a word boundary. IAP_command[ 2 ] = (unsigned int)target_addr; // Destination RAM address where data bytes are to be written. This address should be a 256 byte boundary.
diff -r f33e8f9a3677 -r 56f1e488b250 IAP.h --- a/IAP.h Sun Jan 17 00:44:10 2016 +0900 +++ b/IAP.h Tue May 03 07:43:30 2016 +0000 @@ -349,7 +349,11 @@ * "IAP commands" */ -#define IAP_LOCATION 0x1fff1ff1 +#if defined(TARGET_LPC11UXX) || defined(TARGET_LPC13XX) || defined(TARGET_LPC81X) || defined(TARGET_LPC82X) + #define IAP_LOCATION 0x1fff1ff1 +#elif defined(TARGET_LPC15XX) + #define IAP_LOCATION 0x3000205UL +#endif typedef void (*IAP_call)(unsigned int [], unsigned int []); @@ -452,6 +456,11 @@ #if defined(TARGET_LPC11UXX) || defined(TARGET_LPC13XX) || defined(TARGET_LPC15XX) + /** + * + */ + void init_eeprom(); + /** Copy RAM to EEPROM (LPC11U24) * * @param source_addr Source RAM address from which data bytes are to be read.