2 * @brief LPC18xx/43xx OTP Controller driver
\r
5 * Copyright(C) NXP Semiconductors, 2012
\r
6 * All rights reserved.
\r
9 * Software that is described herein is for illustrative purposes only
\r
10 * which provides customers with programming information regarding the
\r
11 * LPC products. This software is supplied "AS IS" without any warranties of
\r
12 * any kind, and NXP Semiconductors and its licensor disclaim any and
\r
13 * all warranties, express or implied, including all implied warranties of
\r
14 * merchantability, fitness for a particular purpose and non-infringement of
\r
15 * intellectual property rights. NXP Semiconductors assumes no responsibility
\r
16 * or liability for the use of the software, conveys no license or rights under any
\r
17 * patent, copyright, mask work right, or any other intellectual property rights in
\r
18 * or to any products. NXP Semiconductors reserves the right to make changes
\r
19 * in the software without notification. NXP Semiconductors also makes no
\r
20 * representation or warranty that such application will be suitable for the
\r
21 * specified use without further testing or modification.
\r
24 * Permission to use, copy, modify, and distribute this software and its
\r
25 * documentation is hereby granted, under NXP Semiconductors' and its
\r
26 * licensor's relevant copyrights in the software, without fee, provided that it
\r
27 * is used in conjunction with NXP Semiconductors microcontrollers. This
\r
28 * copyright, permission, and disclaimer notice must appear in all copies of
\r
32 #ifndef __OTP_18XX_43XX_H_
\r
33 #define __OTP_18XX_43XX_H_
\r
39 /** @defgroup OTP_18XX_43XX CHIP: LPC18xx/43xx OTP Controller driver
\r
40 * @ingroup CHIP_18XX_43XX_Drivers
\r
45 * @brief OTP Register block
\r
48 __IO uint32_t OTP0_0; /*!< (@ 0x40045000) OTP content */
\r
49 __IO uint32_t OTP0_1; /*!< (@ 0x40045004) OTP content */
\r
50 __IO uint32_t OTP0_2; /*!< (@ 0x40045008) OTP content */
\r
51 __IO uint32_t OTP0_3; /*!< (@ 0x4004500C) OTP content */
\r
52 __IO uint32_t OTP1_0; /*!< (@ 0x40045010) OTP content */
\r
53 __IO uint32_t OTP1_1; /*!< (@ 0x40045014) OTP content */
\r
54 __IO uint32_t OTP1_2; /*!< (@ 0x40045018) OTP content */
\r
55 __IO uint32_t OTP1_3; /*!< (@ 0x4004501C) OTP content */
\r
56 __IO uint32_t OTP2_0; /*!< (@ 0x40045020) OTP content */
\r
57 __IO uint32_t OTP2_1; /*!< (@ 0x40045024) OTP content */
\r
58 __IO uint32_t OTP2_2; /*!< (@ 0x40045028) OTP content */
\r
59 __IO uint32_t OTP2_3; /*!< (@ 0x4004502C) OTP content */
\r
60 uint32_t RESERVED0[4];
\r
61 __IO uint32_t UNIQUE_KEY0; /*!< (@ 0x40045040) Unique Key bit 31..0. R/W locked at default */
\r
62 __IO uint32_t UNIQUE_KEY1; /*!< (@ 0x40045044) Unique Key bit 63..32. R/W locked at default */
\r
63 __IO uint32_t UNIQUE_KEY2; /*!< (@ 0x40045048) Unique Key bit 95..64. R/W locked at default */
\r
64 __IO uint32_t UNIQUE_KEY3; /*!< (@ 0x4004504C) Unique Key bit 127..96. R/W locked at default */
\r
65 __IO uint32_t RANDOM_NUM0; /*!< (@ 0x40045050) Random number bit 31..0. R/W locked at default */
\r
66 __IO uint32_t RANDOM_NUM1; /*!< (@ 0x40045054) Random number bit 63..32. R/W locked at default */
\r
67 __IO uint32_t RANDOM_NUM2; /*!< (@ 0x40045058) Random number bit 95..64. R/W locked at default */
\r
68 __IO uint32_t RANDOM_NUM3; /*!< (@ 0x4004505C) Random number bit 127..96. R/W locked at default */
\r
69 __IO uint32_t USER_KEY0; /*!< (@ 0x40045060) User Key bit 31..0. R locked at default */
\r
70 __IO uint32_t USER_KEY1; /*!< (@ 0x40045064) User Key bit 63..32. R locked at default */
\r
71 __IO uint32_t USER_KEY2; /*!< (@ 0x40045068) User Key bit 95..64. R locked at default */
\r
72 __IO uint32_t USER_KEY3; /*!< (@ 0x4004506C) User Key bit 127..96. R locked at default */
\r
73 uint32_t RESERVED1[4];
\r
74 __IO uint32_t WRTMASK; /*!< (@ 0x40045080) Masks APB write to fuses */
\r
75 __O uint32_t STATUS; /*!< (@ 0x40045084) Indicates write status of fuses */
\r
76 uint32_t RESERVED2[2];
\r
77 __IO uint32_t PROGRAM; /*!< (@ 0x40045090) Enables write of Shuffled AES value to OTP1c */
\r
78 __IO uint32_t AES_SSEL; /*!< (@ 0x40045094) Controls selecting source for SKey output to AES Engine */
\r
79 __IO uint32_t SHUFFLE_CTRL; /*!< (@ 0x40045098) Shuffle block control */
\r
81 __IO uint32_t OTP0_WR_LOCK; /*!< (@ 0x400450A0) Locks write access to itself and OTP0 write access */
\r
82 __IO uint32_t OTP0_RD_LOCK; /*!< (@ 0x400450A4) Locks write access to itself and OTP0 read access */
\r
83 __IO uint32_t OTP1_WR_LOCK; /*!< (@ 0x400450A8) Locks write access to itself and OTP1 write access */
\r
84 __IO uint32_t OTP1_RD_LOCK; /*!< (@ 0x400450AC) Locks write access to itself and OTP1 read access */
\r
85 __IO uint32_t OTP2_WR_LOCK; /*!< (@ 0x400450B0) Locks write access to itself and OTP2 write access */
\r
86 __IO uint32_t OTP2_RD_LOCK; /*!< (@ 0x400450B4) Locks write access to itself and OTP2 read access */
\r
87 __IO uint32_t RESERVED4[2];
\r
88 __IO uint32_t UNIQUE_KEY_WR_LOCK; /*!< (@ 0x400450C0) Locks write access to itself and Unique Key write access */
\r
89 __IO uint32_t UNIQUE_KEY_RD_LOCK; /*!< (@ 0x400450C4) */
\r
90 __IO uint32_t RANDOM_NUM_WR_LOCK; /*!< (@ 0x400450C8) */
\r
91 __IO uint32_t RANDOM_NUM_RD_LOCK; /*!< (@ 0x400450CC) */
\r
92 __IO uint32_t RESERVED5; /*!< (@ 0x400450D0) */
\r
93 __IO uint32_t USER_KEY_RD_LOCK; /*!< (@ 0x400450D4) */
\r
97 * @brief OTP Boot Source selection used in Chip driver
\r
99 typedef enum CHIP_OTP_BOOT_SRC {
\r
100 CHIP_OTP_BOOTSRC_PINS, /*!< Boot source - External pins */
\r
101 CHIP_OTP_BOOTSRC_UART0, /*!< Boot source - UART0 */
\r
102 CHIP_OTP_BOOTSRC_SPIFI, /*!< Boot source - EMC 8-bit memory */
\r
103 CHIP_OTP_BOOTSRC_EMC8, /*!< Boot source - EMC 16-bit memory */
\r
104 CHIP_OTP_BOOTSRC_EMC16, /*!< Boot source - EMC 32-bit memory */
\r
105 CHIP_OTP_BOOTSRC_EMC32, /*!< Boot source - EMC 32-bit memory */
\r
106 CHIP_OTP_BOOTSRC_USB0, /*!< Boot source - DFU USB0 boot */
\r
107 CHIP_OTP_BOOTSRC_USB1, /*!< Boot source - DFU USB1 boot */
\r
108 CHIP_OTP_BOOTSRC_SPI, /*!< Boot source - SPI boot */
\r
109 CHIP_OTP_BOOTSRC_UART3 /*!< Boot source - UART3 */
\r
110 } CHIP_OTP_BOOT_SRC_T;
\r
113 * @brief Initialize for OTP Controller functions
\r
114 * @return Status of Otp_Init function
\r
115 * This function will initialise all the OTP driver function pointers
\r
116 * and call the ROM OTP Initialisation function.
\r
118 uint32_t Chip_OTP_Init(void);
\r
121 * @brief Program boot source in OTP Controller
\r
122 * @param BootSrc : Boot Source enum value
\r
125 uint32_t Chip_OTP_ProgBootSrc(CHIP_OTP_BOOT_SRC_T BootSrc);
\r
128 * @brief Program the JTAG bit in OTP Controller
\r
131 uint32_t Chip_OTP_ProgJTAGDis(void);
\r
134 * @brief Program USB ID in OTP Controller
\r
135 * @param ProductID : USB Product ID
\r
136 * @param VendorID : USB Vendor ID
\r
139 uint32_t Chip_OTP_ProgUSBID(uint32_t ProductID, uint32_t VendorID);
\r
142 * @brief Program OTP GP Word memory
\r
143 * @param WordNum : Word Number (Select word 0 or word 1 or word 2)
\r
144 * @param Data : Data value
\r
145 * @param Mask : Mask value
\r
147 * This function available in devices which are not AES capable
\r
149 uint32_t Chip_OTP_ProgGPWord(uint32_t WordNum, uint32_t Data, uint32_t Mask);
\r
152 * @brief Program AES Key
\r
153 * @param KeyNum : Key Number (Select 0 or 1)
\r
154 * @param key : Pointer to AES Key (16 bytes required)
\r
156 * This function available in devices which are AES capable
\r
158 uint32_t Chip_OTP_ProgKey(uint32_t KeyNum, uint8_t *key);
\r
161 * @brief Generate Random Number using HW Random Number Generator
\r
162 * @return Random Number value
\r
164 uint32_t Chip_OTP_GenRand(void);
\r
174 #endif /* __OTP_18XX_43XX_H_ */
\r