LPCOpen Platform  v1.03
LPCOpen Platform for NXP LPC Microcontrollers
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
flash_13xx.h
Go to the documentation of this file.
1 /*
2  * @brief LPC13xx Flash/EEPROM programming
3  *
4  * @note
5  * Copyright(C) NXP Semiconductors, 2012
6  * All rights reserved.
7  *
8  * @par
9  * Software that is described herein is for illustrative purposes only
10  * which provides customers with programming information regarding the
11  * LPC products. This software is supplied "AS IS" without any warranties of
12  * any kind, and NXP Semiconductors and its licensor disclaim any and
13  * all warranties, express or implied, including all implied warranties of
14  * merchantability, fitness for a particular purpose and non-infringement of
15  * intellectual property rights. NXP Semiconductors assumes no responsibility
16  * or liability for the use of the software, conveys no license or rights under any
17  * patent, copyright, mask work right, or any other intellectual property rights in
18  * or to any products. NXP Semiconductors reserves the right to make changes
19  * in the software without notification. NXP Semiconductors also makes no
20  * representation or warranty that such application will be suitable for the
21  * specified use without further testing or modification.
22  *
23  * @par
24  * Permission to use, copy, modify, and distribute this software and its
25  * documentation is hereby granted, under NXP Semiconductors' and its
26  * licensor's relevant copyrights in the software, without fee, provided that it
27  * is used in conjunction with NXP Semiconductors microcontrollers. This
28  * copyright, permission, and disclaimer notice must appear in all copies of
29  * this code.
30  */
31 
32 #ifndef __FLASH_EEPROM_13XX_H_
33 #define __FLASH_EEPROM_13XX_H_
34 
35 #if defined(CHIP_LPC1347)
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
47 #define FLASH_ENTRY_LOCATION (0x1fff1ff1)
48 
50 #define EEPROM_SIZE (4 << 10)
51 
53 #define PART_ID (0x08020543)
54 
60 STATIC INLINE uint32_t Chip_FLASH_GetSecNum(uint32_t adr)
61 {
62  return adr >> 12;
63 }
64 
71 STATIC INLINE void Chip_FLASH_Execute(FLASH_COMMAND_T *pCommand, FLASH_OUTPUT_T *pOutput)
72 {
73  IP_FLASH_Execute(((FLASH_ENTRY_T) FLASH_ENTRY_LOCATION), pCommand, pOutput);
74 }
75 
84 STATIC INLINE void Chip_FLASH_PrepareSectors(FLASH_PREPARE_SECTORS_COMMAND_T *pCommand,
86 {
87  Chip_FLASH_Execute((FLASH_COMMAND_T *) pCommand, (FLASH_OUTPUT_T *) pOutput);
88 }
89 
98 STATIC INLINE void Chip_FLASH_CopyRamToFlash(FLASH_COPY_RAM_TO_FLASH_COMMAND_T *pCommand,
100 {
101  Chip_FLASH_Execute((FLASH_COMMAND_T *) pCommand, (FLASH_OUTPUT_T *) pOutput);
102 }
103 
111 STATIC INLINE void Chip_FLASH_EraseSectors(FLASH_ERASE_SECTORS_COMMAND_T *pCommand,
113 {
114  Chip_FLASH_Execute((FLASH_COMMAND_T *) pCommand, (FLASH_OUTPUT_T *) pOutput);
115 }
116 
123 STATIC INLINE void Chip_FLASH_BlankCheckSectors(FLASH_BLANK_CHECK_SECTORS_COMMAND_T *pCommand,
125 {
126  Chip_FLASH_Execute((FLASH_COMMAND_T *) pCommand, (FLASH_OUTPUT_T *) pOutput);
127 }
128 
134 void Chip_FLASH_ReadPartID(FLASH_READ_PART_ID_OUTPUT_T *pOutput);
135 
141 void Chip_FLASH_ReadBootCodeVersion(FLASH_READ_BOOTCODE_VER_OUTPUT_T *pOutput);
142 
151 STATIC INLINE void Chip_FLASH_CompareMem(FLASH_COMPARE_MEM_COMMAND_T *pCommand,
153 {
154  Chip_FLASH_Execute((FLASH_COMMAND_T *) pCommand, (FLASH_OUTPUT_T *) pOutput);
155 }
156 
161 void Chip_FLASH_ReInvokeISP(void);
162 
168 void Chip_FLASH_ReadUID(FLASH_READ_UID_OUTPUT_T *pOutput);
175 STATIC INLINE void Chip_FLASH_ErasePages(FLASH_ERASE_PAGES_COMMAND_T *pCommand,
176  FLASH_ERASE_PAGES_OUTPUT_T *pOutput)
177 {
178  Chip_FLASH_Execute((FLASH_COMMAND_T *) pCommand, (FLASH_OUTPUT_T *) pOutput);
179 }
180 
188 STATIC INLINE void Chip_EEPROM_Write(EEPROM_WRITE_COMMAND_T *pCommand,
189  EEPROM_WRITE_OUTPUT_T *pOutput)
190 {
191  Chip_FLASH_Execute((FLASH_COMMAND_T *) pCommand, (FLASH_OUTPUT_T *) pOutput);
192 }
193 
200 STATIC INLINE void Chip_EEPROM_Read(EEPROM_READ_COMMAND_T *pCommand,
201  EEPROM_READ_OUTPUT_T *pOutput)
202 {
203  Chip_FLASH_Execute((FLASH_COMMAND_T *) pCommand, (FLASH_OUTPUT_T *) pOutput);
204 }
205 
210 #ifdef __cplusplus
211 }
212 #endif
213 
214 #endif /* defined(CHIP_LPC1347) */
215 
216 #endif /* __FLASH_EEPROM_13XX_H_ */