LPCOpen Platform for LPC18XX/43XX microcontrollers  18XX43XX
LPCOpen Platform for the NXP LPC18XX/43XX family of Microcontrollers
romapi_18xx_43xx.h
Go to the documentation of this file.
1 /*
2  * @brief LPC18xx_43xx ROM API declarations and functions
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 __ROMAPI_18XX_43XX_H_
33 #define __ROMAPI_18XX_43XX_H_
34 
35 #include "iap_18xx_43xx.h"
36 #include "error.h"
37 
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41 
50 typedef struct {
51  uint32_t (*Init)(void);
52  uint32_t (*ProgBootSrc)(CHIP_OTP_BOOT_SRC_T BootSrc);
53  uint32_t (*ProgJTAGDis)(void);
54  uint32_t (*ProgUSBID)(uint32_t ProductID, uint32_t VendorID);
55  uint32_t reserved01;
56  uint32_t reserved02;
57  uint32_t reserved03;
58  uint32_t reserved04;
59  uint32_t (*ProgGP0)(uint32_t data, uint32_t mask);
60  uint32_t (*ProgGP1)(uint32_t data, uint32_t mask);
61  uint32_t (*ProgGP2)(uint32_t data, uint32_t mask);
62  uint32_t (*ProgKey1)(uint8_t *key);
63  uint32_t (*ProgKey2)(uint8_t *key);
64  uint32_t (*GenRand)(void);
65 } OTP_API_T;
66 
70 typedef struct {
71  uint32_t (*Init)(void);
72  uint32_t (*SetMode)(uint32_t mode);
73  uint32_t (*LoadKey1)(void);
74  uint32_t (*LoadKey2)(void);
75  uint32_t (*LoadKeyRNG)(void);
76  uint32_t (*LoadKeySW)(uint8_t *pKey);
77  uint32_t (*LoadIV_SW)(uint8_t *pVector);
78  uint32_t (*LoadIV_IC)(void);
79  uint32_t (*Operate)(uint8_t *pOutput, uint8_t *pInput, uint32_t size);
80  uint32_t (*ProgramKey1)(uint8_t *pKey);
81  uint32_t (*ProgramKey2)(uint8_t *pKey);
82 } AES_API_T;
83 
87 typedef struct {
88  void(*const iap_entry) (uint32_t *, uint32_t *);
89  const OTP_API_T *pOtp;
90  const AES_API_T *pAes;
91  uint32_t reserved[3];
92  const uint32_t spifiApiBase;
93  const uint32_t usbdApiBase;
94  const uint32_t endMarker;
97 
98 /* Pointer to ROM API function address */
99 #define LPC_ROM_API_BASE_LOC 0x10400100
100 #define LPC_ROM_API ((LPC_ROM_API_T *) LPC_ROM_API_BASE)
101 
102 /* Pointer to ROM IAP entry functions */
103 #define IAP_ENTRY_LOCATION (*((uint32_t *) 0x10400100))
104 
108 #define IAP_FLASH_BANK_A 0
109 #define IAP_FLASH_BANK_B 1
110 
115 static INLINE void iap_entry(unsigned int cmd_param[], unsigned int status_result[])
116 {
117  ((IAP_ENTRY_T) IAP_ENTRY_LOCATION)(cmd_param, status_result);
118 }
119 
124 #ifdef __cplusplus
125 }
126 #endif
127 
128 #endif /* __ROMAPI_18XX_43XX_H_ */