]> git.donarmstrong.com Git - qmk_firmware.git/blob - tool/mbed/mbed-sdk/libraries/mbed/targets/hal/TARGET_Freescale/TARGET_KPSDK_MCUS/TARGET_K22F/device/MK22F51212/MK22F51212_nv.h
Squashed 'tmk_core/' changes from 7967731..b9e0ea0
[qmk_firmware.git] / tool / mbed / mbed-sdk / libraries / mbed / targets / hal / TARGET_Freescale / TARGET_KPSDK_MCUS / TARGET_K22F / device / MK22F51212 / MK22F51212_nv.h
1 /*
2 ** ###################################################################
3 **     Compilers:           Keil ARM C/C++ Compiler
4 **                          Freescale C/C++ for Embedded ARM
5 **                          GNU C Compiler
6 **                          IAR ANSI C/C++ Compiler for ARM
7 **
8 **     Reference manual:    K22P121M120SF7RM, Rev. 1, March 24, 2014
9 **     Version:             rev. 2.5, 2014-05-06
10 **     Build:               b140604
11 **
12 **     Abstract:
13 **         Extension to the CMSIS register access layer header.
14 **
15 **     Copyright (c) 2014 Freescale Semiconductor, Inc.
16 **     All rights reserved.
17 **
18 **     Redistribution and use in source and binary forms, with or without modification,
19 **     are permitted provided that the following conditions are met:
20 **
21 **     o Redistributions of source code must retain the above copyright notice, this list
22 **       of conditions and the following disclaimer.
23 **
24 **     o Redistributions in binary form must reproduce the above copyright notice, this
25 **       list of conditions and the following disclaimer in the documentation and/or
26 **       other materials provided with the distribution.
27 **
28 **     o Neither the name of Freescale Semiconductor, Inc. nor the names of its
29 **       contributors may be used to endorse or promote products derived from this
30 **       software without specific prior written permission.
31 **
32 **     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
33 **     ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
34 **     WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
35 **     DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
36 **     ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
37 **     (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
38 **     LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
39 **     ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
40 **     (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
41 **     SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42 **
43 **     http:                 www.freescale.com
44 **     mail:                 support@freescale.com
45 **
46 **     Revisions:
47 **     - rev. 1.0 (2013-07-23)
48 **         Initial version.
49 **     - rev. 1.1 (2013-09-17)
50 **         RM rev. 0.4 update.
51 **     - rev. 2.0 (2013-10-29)
52 **         Register accessor macros added to the memory map.
53 **         Symbols for Processor Expert memory map compatibility added to the memory map.
54 **         Startup file for gcc has been updated according to CMSIS 3.2.
55 **         System initialization updated.
56 **     - rev. 2.1 (2013-10-30)
57 **         Definition of BITBAND macros updated to support peripherals with 32-bit acces disabled.
58 **     - rev. 2.2 (2013-12-20)
59 **         Update according to reference manual rev. 0.6,
60 **     - rev. 2.3 (2014-01-13)
61 **         Update according to reference manual rev. 0.61,
62 **     - rev. 2.4 (2014-02-10)
63 **         The declaration of clock configurations has been moved to separate header file system_MK22F51212.h
64 **     - rev. 2.5 (2014-05-06)
65 **         Update according to reference manual rev. 1.0,
66 **         Update of system and startup files.
67 **         Module access macro module_BASES replaced by module_BASE_PTRS.
68 **
69 ** ###################################################################
70 */
71
72 /*
73  * WARNING! DO NOT EDIT THIS FILE DIRECTLY!
74  *
75  * This file was generated automatically and any changes may be lost.
76  */
77 #ifndef __HW_NV_REGISTERS_H__
78 #define __HW_NV_REGISTERS_H__
79
80 #include "MK22F51212.h"
81 #include "fsl_bitaccess.h"
82
83 /*
84  * MK22F51212 NV
85  *
86  * Flash configuration field
87  *
88  * Registers defined in this header file:
89  * - HW_NV_BACKKEY3 - Backdoor Comparison Key 3.
90  * - HW_NV_BACKKEY2 - Backdoor Comparison Key 2.
91  * - HW_NV_BACKKEY1 - Backdoor Comparison Key 1.
92  * - HW_NV_BACKKEY0 - Backdoor Comparison Key 0.
93  * - HW_NV_BACKKEY7 - Backdoor Comparison Key 7.
94  * - HW_NV_BACKKEY6 - Backdoor Comparison Key 6.
95  * - HW_NV_BACKKEY5 - Backdoor Comparison Key 5.
96  * - HW_NV_BACKKEY4 - Backdoor Comparison Key 4.
97  * - HW_NV_FPROT3 - Non-volatile P-Flash Protection 1 - Low Register
98  * - HW_NV_FPROT2 - Non-volatile P-Flash Protection 1 - High Register
99  * - HW_NV_FPROT1 - Non-volatile P-Flash Protection 0 - Low Register
100  * - HW_NV_FPROT0 - Non-volatile P-Flash Protection 0 - High Register
101  * - HW_NV_FSEC - Non-volatile Flash Security Register
102  * - HW_NV_FOPT - Non-volatile Flash Option Register
103  *
104  * - hw_nv_t - Struct containing all module registers.
105  */
106
107 #define HW_NV_INSTANCE_COUNT (1U) /*!< Number of instances of the NV module. */
108
109 /*******************************************************************************
110  * HW_NV_BACKKEY3 - Backdoor Comparison Key 3.
111  ******************************************************************************/
112
113 /*!
114  * @brief HW_NV_BACKKEY3 - Backdoor Comparison Key 3. (RO)
115  *
116  * Reset value: 0xFFU
117  */
118 typedef union _hw_nv_backkey3
119 {
120     uint8_t U;
121     struct _hw_nv_backkey3_bitfields
122     {
123         uint8_t KEY : 8;               /*!< [7:0] Backdoor Comparison Key. */
124     } B;
125 } hw_nv_backkey3_t;
126
127 /*!
128  * @name Constants and macros for entire NV_BACKKEY3 register
129  */
130 /*@{*/
131 #define HW_NV_BACKKEY3_ADDR(x)   ((x) + 0x0U)
132
133 #define HW_NV_BACKKEY3(x)        (*(__I hw_nv_backkey3_t *) HW_NV_BACKKEY3_ADDR(x))
134 #define HW_NV_BACKKEY3_RD(x)     (HW_NV_BACKKEY3(x).U)
135 /*@}*/
136
137 /*
138  * Constants & macros for individual NV_BACKKEY3 bitfields
139  */
140
141 /*!
142  * @name Register NV_BACKKEY3, field KEY[7:0] (RO)
143  */
144 /*@{*/
145 #define BP_NV_BACKKEY3_KEY   (0U)          /*!< Bit position for NV_BACKKEY3_KEY. */
146 #define BM_NV_BACKKEY3_KEY   (0xFFU)       /*!< Bit mask for NV_BACKKEY3_KEY. */
147 #define BS_NV_BACKKEY3_KEY   (8U)          /*!< Bit field size in bits for NV_BACKKEY3_KEY. */
148
149 /*! @brief Read current value of the NV_BACKKEY3_KEY field. */
150 #define BR_NV_BACKKEY3_KEY(x) (HW_NV_BACKKEY3(x).U)
151 /*@}*/
152
153 /*******************************************************************************
154  * HW_NV_BACKKEY2 - Backdoor Comparison Key 2.
155  ******************************************************************************/
156
157 /*!
158  * @brief HW_NV_BACKKEY2 - Backdoor Comparison Key 2. (RO)
159  *
160  * Reset value: 0xFFU
161  */
162 typedef union _hw_nv_backkey2
163 {
164     uint8_t U;
165     struct _hw_nv_backkey2_bitfields
166     {
167         uint8_t KEY : 8;               /*!< [7:0] Backdoor Comparison Key. */
168     } B;
169 } hw_nv_backkey2_t;
170
171 /*!
172  * @name Constants and macros for entire NV_BACKKEY2 register
173  */
174 /*@{*/
175 #define HW_NV_BACKKEY2_ADDR(x)   ((x) + 0x1U)
176
177 #define HW_NV_BACKKEY2(x)        (*(__I hw_nv_backkey2_t *) HW_NV_BACKKEY2_ADDR(x))
178 #define HW_NV_BACKKEY2_RD(x)     (HW_NV_BACKKEY2(x).U)
179 /*@}*/
180
181 /*
182  * Constants & macros for individual NV_BACKKEY2 bitfields
183  */
184
185 /*!
186  * @name Register NV_BACKKEY2, field KEY[7:0] (RO)
187  */
188 /*@{*/
189 #define BP_NV_BACKKEY2_KEY   (0U)          /*!< Bit position for NV_BACKKEY2_KEY. */
190 #define BM_NV_BACKKEY2_KEY   (0xFFU)       /*!< Bit mask for NV_BACKKEY2_KEY. */
191 #define BS_NV_BACKKEY2_KEY   (8U)          /*!< Bit field size in bits for NV_BACKKEY2_KEY. */
192
193 /*! @brief Read current value of the NV_BACKKEY2_KEY field. */
194 #define BR_NV_BACKKEY2_KEY(x) (HW_NV_BACKKEY2(x).U)
195 /*@}*/
196
197 /*******************************************************************************
198  * HW_NV_BACKKEY1 - Backdoor Comparison Key 1.
199  ******************************************************************************/
200
201 /*!
202  * @brief HW_NV_BACKKEY1 - Backdoor Comparison Key 1. (RO)
203  *
204  * Reset value: 0xFFU
205  */
206 typedef union _hw_nv_backkey1
207 {
208     uint8_t U;
209     struct _hw_nv_backkey1_bitfields
210     {
211         uint8_t KEY : 8;               /*!< [7:0] Backdoor Comparison Key. */
212     } B;
213 } hw_nv_backkey1_t;
214
215 /*!
216  * @name Constants and macros for entire NV_BACKKEY1 register
217  */
218 /*@{*/
219 #define HW_NV_BACKKEY1_ADDR(x)   ((x) + 0x2U)
220
221 #define HW_NV_BACKKEY1(x)        (*(__I hw_nv_backkey1_t *) HW_NV_BACKKEY1_ADDR(x))
222 #define HW_NV_BACKKEY1_RD(x)     (HW_NV_BACKKEY1(x).U)
223 /*@}*/
224
225 /*
226  * Constants & macros for individual NV_BACKKEY1 bitfields
227  */
228
229 /*!
230  * @name Register NV_BACKKEY1, field KEY[7:0] (RO)
231  */
232 /*@{*/
233 #define BP_NV_BACKKEY1_KEY   (0U)          /*!< Bit position for NV_BACKKEY1_KEY. */
234 #define BM_NV_BACKKEY1_KEY   (0xFFU)       /*!< Bit mask for NV_BACKKEY1_KEY. */
235 #define BS_NV_BACKKEY1_KEY   (8U)          /*!< Bit field size in bits for NV_BACKKEY1_KEY. */
236
237 /*! @brief Read current value of the NV_BACKKEY1_KEY field. */
238 #define BR_NV_BACKKEY1_KEY(x) (HW_NV_BACKKEY1(x).U)
239 /*@}*/
240
241 /*******************************************************************************
242  * HW_NV_BACKKEY0 - Backdoor Comparison Key 0.
243  ******************************************************************************/
244
245 /*!
246  * @brief HW_NV_BACKKEY0 - Backdoor Comparison Key 0. (RO)
247  *
248  * Reset value: 0xFFU
249  */
250 typedef union _hw_nv_backkey0
251 {
252     uint8_t U;
253     struct _hw_nv_backkey0_bitfields
254     {
255         uint8_t KEY : 8;               /*!< [7:0] Backdoor Comparison Key. */
256     } B;
257 } hw_nv_backkey0_t;
258
259 /*!
260  * @name Constants and macros for entire NV_BACKKEY0 register
261  */
262 /*@{*/
263 #define HW_NV_BACKKEY0_ADDR(x)   ((x) + 0x3U)
264
265 #define HW_NV_BACKKEY0(x)        (*(__I hw_nv_backkey0_t *) HW_NV_BACKKEY0_ADDR(x))
266 #define HW_NV_BACKKEY0_RD(x)     (HW_NV_BACKKEY0(x).U)
267 /*@}*/
268
269 /*
270  * Constants & macros for individual NV_BACKKEY0 bitfields
271  */
272
273 /*!
274  * @name Register NV_BACKKEY0, field KEY[7:0] (RO)
275  */
276 /*@{*/
277 #define BP_NV_BACKKEY0_KEY   (0U)          /*!< Bit position for NV_BACKKEY0_KEY. */
278 #define BM_NV_BACKKEY0_KEY   (0xFFU)       /*!< Bit mask for NV_BACKKEY0_KEY. */
279 #define BS_NV_BACKKEY0_KEY   (8U)          /*!< Bit field size in bits for NV_BACKKEY0_KEY. */
280
281 /*! @brief Read current value of the NV_BACKKEY0_KEY field. */
282 #define BR_NV_BACKKEY0_KEY(x) (HW_NV_BACKKEY0(x).U)
283 /*@}*/
284
285 /*******************************************************************************
286  * HW_NV_BACKKEY7 - Backdoor Comparison Key 7.
287  ******************************************************************************/
288
289 /*!
290  * @brief HW_NV_BACKKEY7 - Backdoor Comparison Key 7. (RO)
291  *
292  * Reset value: 0xFFU
293  */
294 typedef union _hw_nv_backkey7
295 {
296     uint8_t U;
297     struct _hw_nv_backkey7_bitfields
298     {
299         uint8_t KEY : 8;               /*!< [7:0] Backdoor Comparison Key. */
300     } B;
301 } hw_nv_backkey7_t;
302
303 /*!
304  * @name Constants and macros for entire NV_BACKKEY7 register
305  */
306 /*@{*/
307 #define HW_NV_BACKKEY7_ADDR(x)   ((x) + 0x4U)
308
309 #define HW_NV_BACKKEY7(x)        (*(__I hw_nv_backkey7_t *) HW_NV_BACKKEY7_ADDR(x))
310 #define HW_NV_BACKKEY7_RD(x)     (HW_NV_BACKKEY7(x).U)
311 /*@}*/
312
313 /*
314  * Constants & macros for individual NV_BACKKEY7 bitfields
315  */
316
317 /*!
318  * @name Register NV_BACKKEY7, field KEY[7:0] (RO)
319  */
320 /*@{*/
321 #define BP_NV_BACKKEY7_KEY   (0U)          /*!< Bit position for NV_BACKKEY7_KEY. */
322 #define BM_NV_BACKKEY7_KEY   (0xFFU)       /*!< Bit mask for NV_BACKKEY7_KEY. */
323 #define BS_NV_BACKKEY7_KEY   (8U)          /*!< Bit field size in bits for NV_BACKKEY7_KEY. */
324
325 /*! @brief Read current value of the NV_BACKKEY7_KEY field. */
326 #define BR_NV_BACKKEY7_KEY(x) (HW_NV_BACKKEY7(x).U)
327 /*@}*/
328
329 /*******************************************************************************
330  * HW_NV_BACKKEY6 - Backdoor Comparison Key 6.
331  ******************************************************************************/
332
333 /*!
334  * @brief HW_NV_BACKKEY6 - Backdoor Comparison Key 6. (RO)
335  *
336  * Reset value: 0xFFU
337  */
338 typedef union _hw_nv_backkey6
339 {
340     uint8_t U;
341     struct _hw_nv_backkey6_bitfields
342     {
343         uint8_t KEY : 8;               /*!< [7:0] Backdoor Comparison Key. */
344     } B;
345 } hw_nv_backkey6_t;
346
347 /*!
348  * @name Constants and macros for entire NV_BACKKEY6 register
349  */
350 /*@{*/
351 #define HW_NV_BACKKEY6_ADDR(x)   ((x) + 0x5U)
352
353 #define HW_NV_BACKKEY6(x)        (*(__I hw_nv_backkey6_t *) HW_NV_BACKKEY6_ADDR(x))
354 #define HW_NV_BACKKEY6_RD(x)     (HW_NV_BACKKEY6(x).U)
355 /*@}*/
356
357 /*
358  * Constants & macros for individual NV_BACKKEY6 bitfields
359  */
360
361 /*!
362  * @name Register NV_BACKKEY6, field KEY[7:0] (RO)
363  */
364 /*@{*/
365 #define BP_NV_BACKKEY6_KEY   (0U)          /*!< Bit position for NV_BACKKEY6_KEY. */
366 #define BM_NV_BACKKEY6_KEY   (0xFFU)       /*!< Bit mask for NV_BACKKEY6_KEY. */
367 #define BS_NV_BACKKEY6_KEY   (8U)          /*!< Bit field size in bits for NV_BACKKEY6_KEY. */
368
369 /*! @brief Read current value of the NV_BACKKEY6_KEY field. */
370 #define BR_NV_BACKKEY6_KEY(x) (HW_NV_BACKKEY6(x).U)
371 /*@}*/
372
373 /*******************************************************************************
374  * HW_NV_BACKKEY5 - Backdoor Comparison Key 5.
375  ******************************************************************************/
376
377 /*!
378  * @brief HW_NV_BACKKEY5 - Backdoor Comparison Key 5. (RO)
379  *
380  * Reset value: 0xFFU
381  */
382 typedef union _hw_nv_backkey5
383 {
384     uint8_t U;
385     struct _hw_nv_backkey5_bitfields
386     {
387         uint8_t KEY : 8;               /*!< [7:0] Backdoor Comparison Key. */
388     } B;
389 } hw_nv_backkey5_t;
390
391 /*!
392  * @name Constants and macros for entire NV_BACKKEY5 register
393  */
394 /*@{*/
395 #define HW_NV_BACKKEY5_ADDR(x)   ((x) + 0x6U)
396
397 #define HW_NV_BACKKEY5(x)        (*(__I hw_nv_backkey5_t *) HW_NV_BACKKEY5_ADDR(x))
398 #define HW_NV_BACKKEY5_RD(x)     (HW_NV_BACKKEY5(x).U)
399 /*@}*/
400
401 /*
402  * Constants & macros for individual NV_BACKKEY5 bitfields
403  */
404
405 /*!
406  * @name Register NV_BACKKEY5, field KEY[7:0] (RO)
407  */
408 /*@{*/
409 #define BP_NV_BACKKEY5_KEY   (0U)          /*!< Bit position for NV_BACKKEY5_KEY. */
410 #define BM_NV_BACKKEY5_KEY   (0xFFU)       /*!< Bit mask for NV_BACKKEY5_KEY. */
411 #define BS_NV_BACKKEY5_KEY   (8U)          /*!< Bit field size in bits for NV_BACKKEY5_KEY. */
412
413 /*! @brief Read current value of the NV_BACKKEY5_KEY field. */
414 #define BR_NV_BACKKEY5_KEY(x) (HW_NV_BACKKEY5(x).U)
415 /*@}*/
416
417 /*******************************************************************************
418  * HW_NV_BACKKEY4 - Backdoor Comparison Key 4.
419  ******************************************************************************/
420
421 /*!
422  * @brief HW_NV_BACKKEY4 - Backdoor Comparison Key 4. (RO)
423  *
424  * Reset value: 0xFFU
425  */
426 typedef union _hw_nv_backkey4
427 {
428     uint8_t U;
429     struct _hw_nv_backkey4_bitfields
430     {
431         uint8_t KEY : 8;               /*!< [7:0] Backdoor Comparison Key. */
432     } B;
433 } hw_nv_backkey4_t;
434
435 /*!
436  * @name Constants and macros for entire NV_BACKKEY4 register
437  */
438 /*@{*/
439 #define HW_NV_BACKKEY4_ADDR(x)   ((x) + 0x7U)
440
441 #define HW_NV_BACKKEY4(x)        (*(__I hw_nv_backkey4_t *) HW_NV_BACKKEY4_ADDR(x))
442 #define HW_NV_BACKKEY4_RD(x)     (HW_NV_BACKKEY4(x).U)
443 /*@}*/
444
445 /*
446  * Constants & macros for individual NV_BACKKEY4 bitfields
447  */
448
449 /*!
450  * @name Register NV_BACKKEY4, field KEY[7:0] (RO)
451  */
452 /*@{*/
453 #define BP_NV_BACKKEY4_KEY   (0U)          /*!< Bit position for NV_BACKKEY4_KEY. */
454 #define BM_NV_BACKKEY4_KEY   (0xFFU)       /*!< Bit mask for NV_BACKKEY4_KEY. */
455 #define BS_NV_BACKKEY4_KEY   (8U)          /*!< Bit field size in bits for NV_BACKKEY4_KEY. */
456
457 /*! @brief Read current value of the NV_BACKKEY4_KEY field. */
458 #define BR_NV_BACKKEY4_KEY(x) (HW_NV_BACKKEY4(x).U)
459 /*@}*/
460
461 /*******************************************************************************
462  * HW_NV_FPROT3 - Non-volatile P-Flash Protection 1 - Low Register
463  ******************************************************************************/
464
465 /*!
466  * @brief HW_NV_FPROT3 - Non-volatile P-Flash Protection 1 - Low Register (RO)
467  *
468  * Reset value: 0xFFU
469  */
470 typedef union _hw_nv_fprot3
471 {
472     uint8_t U;
473     struct _hw_nv_fprot3_bitfields
474     {
475         uint8_t PROT : 8;              /*!< [7:0] P-Flash Region Protect */
476     } B;
477 } hw_nv_fprot3_t;
478
479 /*!
480  * @name Constants and macros for entire NV_FPROT3 register
481  */
482 /*@{*/
483 #define HW_NV_FPROT3_ADDR(x)     ((x) + 0x8U)
484
485 #define HW_NV_FPROT3(x)          (*(__I hw_nv_fprot3_t *) HW_NV_FPROT3_ADDR(x))
486 #define HW_NV_FPROT3_RD(x)       (HW_NV_FPROT3(x).U)
487 /*@}*/
488
489 /*
490  * Constants & macros for individual NV_FPROT3 bitfields
491  */
492
493 /*!
494  * @name Register NV_FPROT3, field PROT[7:0] (RO)
495  */
496 /*@{*/
497 #define BP_NV_FPROT3_PROT    (0U)          /*!< Bit position for NV_FPROT3_PROT. */
498 #define BM_NV_FPROT3_PROT    (0xFFU)       /*!< Bit mask for NV_FPROT3_PROT. */
499 #define BS_NV_FPROT3_PROT    (8U)          /*!< Bit field size in bits for NV_FPROT3_PROT. */
500
501 /*! @brief Read current value of the NV_FPROT3_PROT field. */
502 #define BR_NV_FPROT3_PROT(x) (HW_NV_FPROT3(x).U)
503 /*@}*/
504
505 /*******************************************************************************
506  * HW_NV_FPROT2 - Non-volatile P-Flash Protection 1 - High Register
507  ******************************************************************************/
508
509 /*!
510  * @brief HW_NV_FPROT2 - Non-volatile P-Flash Protection 1 - High Register (RO)
511  *
512  * Reset value: 0xFFU
513  */
514 typedef union _hw_nv_fprot2
515 {
516     uint8_t U;
517     struct _hw_nv_fprot2_bitfields
518     {
519         uint8_t PROT : 8;              /*!< [7:0] P-Flash Region Protect */
520     } B;
521 } hw_nv_fprot2_t;
522
523 /*!
524  * @name Constants and macros for entire NV_FPROT2 register
525  */
526 /*@{*/
527 #define HW_NV_FPROT2_ADDR(x)     ((x) + 0x9U)
528
529 #define HW_NV_FPROT2(x)          (*(__I hw_nv_fprot2_t *) HW_NV_FPROT2_ADDR(x))
530 #define HW_NV_FPROT2_RD(x)       (HW_NV_FPROT2(x).U)
531 /*@}*/
532
533 /*
534  * Constants & macros for individual NV_FPROT2 bitfields
535  */
536
537 /*!
538  * @name Register NV_FPROT2, field PROT[7:0] (RO)
539  */
540 /*@{*/
541 #define BP_NV_FPROT2_PROT    (0U)          /*!< Bit position for NV_FPROT2_PROT. */
542 #define BM_NV_FPROT2_PROT    (0xFFU)       /*!< Bit mask for NV_FPROT2_PROT. */
543 #define BS_NV_FPROT2_PROT    (8U)          /*!< Bit field size in bits for NV_FPROT2_PROT. */
544
545 /*! @brief Read current value of the NV_FPROT2_PROT field. */
546 #define BR_NV_FPROT2_PROT(x) (HW_NV_FPROT2(x).U)
547 /*@}*/
548
549 /*******************************************************************************
550  * HW_NV_FPROT1 - Non-volatile P-Flash Protection 0 - Low Register
551  ******************************************************************************/
552
553 /*!
554  * @brief HW_NV_FPROT1 - Non-volatile P-Flash Protection 0 - Low Register (RO)
555  *
556  * Reset value: 0xFFU
557  */
558 typedef union _hw_nv_fprot1
559 {
560     uint8_t U;
561     struct _hw_nv_fprot1_bitfields
562     {
563         uint8_t PROT : 8;              /*!< [7:0] P-Flash Region Protect */
564     } B;
565 } hw_nv_fprot1_t;
566
567 /*!
568  * @name Constants and macros for entire NV_FPROT1 register
569  */
570 /*@{*/
571 #define HW_NV_FPROT1_ADDR(x)     ((x) + 0xAU)
572
573 #define HW_NV_FPROT1(x)          (*(__I hw_nv_fprot1_t *) HW_NV_FPROT1_ADDR(x))
574 #define HW_NV_FPROT1_RD(x)       (HW_NV_FPROT1(x).U)
575 /*@}*/
576
577 /*
578  * Constants & macros for individual NV_FPROT1 bitfields
579  */
580
581 /*!
582  * @name Register NV_FPROT1, field PROT[7:0] (RO)
583  */
584 /*@{*/
585 #define BP_NV_FPROT1_PROT    (0U)          /*!< Bit position for NV_FPROT1_PROT. */
586 #define BM_NV_FPROT1_PROT    (0xFFU)       /*!< Bit mask for NV_FPROT1_PROT. */
587 #define BS_NV_FPROT1_PROT    (8U)          /*!< Bit field size in bits for NV_FPROT1_PROT. */
588
589 /*! @brief Read current value of the NV_FPROT1_PROT field. */
590 #define BR_NV_FPROT1_PROT(x) (HW_NV_FPROT1(x).U)
591 /*@}*/
592
593 /*******************************************************************************
594  * HW_NV_FPROT0 - Non-volatile P-Flash Protection 0 - High Register
595  ******************************************************************************/
596
597 /*!
598  * @brief HW_NV_FPROT0 - Non-volatile P-Flash Protection 0 - High Register (RO)
599  *
600  * Reset value: 0xFFU
601  */
602 typedef union _hw_nv_fprot0
603 {
604     uint8_t U;
605     struct _hw_nv_fprot0_bitfields
606     {
607         uint8_t PROT : 8;              /*!< [7:0] P-Flash Region Protect */
608     } B;
609 } hw_nv_fprot0_t;
610
611 /*!
612  * @name Constants and macros for entire NV_FPROT0 register
613  */
614 /*@{*/
615 #define HW_NV_FPROT0_ADDR(x)     ((x) + 0xBU)
616
617 #define HW_NV_FPROT0(x)          (*(__I hw_nv_fprot0_t *) HW_NV_FPROT0_ADDR(x))
618 #define HW_NV_FPROT0_RD(x)       (HW_NV_FPROT0(x).U)
619 /*@}*/
620
621 /*
622  * Constants & macros for individual NV_FPROT0 bitfields
623  */
624
625 /*!
626  * @name Register NV_FPROT0, field PROT[7:0] (RO)
627  */
628 /*@{*/
629 #define BP_NV_FPROT0_PROT    (0U)          /*!< Bit position for NV_FPROT0_PROT. */
630 #define BM_NV_FPROT0_PROT    (0xFFU)       /*!< Bit mask for NV_FPROT0_PROT. */
631 #define BS_NV_FPROT0_PROT    (8U)          /*!< Bit field size in bits for NV_FPROT0_PROT. */
632
633 /*! @brief Read current value of the NV_FPROT0_PROT field. */
634 #define BR_NV_FPROT0_PROT(x) (HW_NV_FPROT0(x).U)
635 /*@}*/
636
637 /*******************************************************************************
638  * HW_NV_FSEC - Non-volatile Flash Security Register
639  ******************************************************************************/
640
641 /*!
642  * @brief HW_NV_FSEC - Non-volatile Flash Security Register (RO)
643  *
644  * Reset value: 0xFFU
645  *
646  * Allows the user to customize the operation of the MCU at boot time
647  */
648 typedef union _hw_nv_fsec
649 {
650     uint8_t U;
651     struct _hw_nv_fsec_bitfields
652     {
653         uint8_t SEC : 2;               /*!< [1:0] Flash Security */
654         uint8_t FSLACC : 2;            /*!< [3:2] Freescale Failure Analysis Access Code
655                                         * */
656         uint8_t MEEN : 2;              /*!< [5:4]  */
657         uint8_t KEYEN : 2;             /*!< [7:6] Backdoor Key Security Enable */
658     } B;
659 } hw_nv_fsec_t;
660
661 /*!
662  * @name Constants and macros for entire NV_FSEC register
663  */
664 /*@{*/
665 #define HW_NV_FSEC_ADDR(x)       ((x) + 0xCU)
666
667 #define HW_NV_FSEC(x)            (*(__I hw_nv_fsec_t *) HW_NV_FSEC_ADDR(x))
668 #define HW_NV_FSEC_RD(x)         (HW_NV_FSEC(x).U)
669 /*@}*/
670
671 /*
672  * Constants & macros for individual NV_FSEC bitfields
673  */
674
675 /*!
676  * @name Register NV_FSEC, field SEC[1:0] (RO)
677  *
678  * Values:
679  * - 10 - MCU security status is unsecure
680  * - 11 - MCU security status is secure
681  */
682 /*@{*/
683 #define BP_NV_FSEC_SEC       (0U)          /*!< Bit position for NV_FSEC_SEC. */
684 #define BM_NV_FSEC_SEC       (0x03U)       /*!< Bit mask for NV_FSEC_SEC. */
685 #define BS_NV_FSEC_SEC       (2U)          /*!< Bit field size in bits for NV_FSEC_SEC. */
686
687 /*! @brief Read current value of the NV_FSEC_SEC field. */
688 #define BR_NV_FSEC_SEC(x)    (HW_NV_FSEC(x).B.SEC)
689 /*@}*/
690
691 /*!
692  * @name Register NV_FSEC, field FSLACC[3:2] (RO)
693  *
694  * Values:
695  * - 10 - Freescale factory access denied
696  * - 11 - Freescale factory access granted
697  */
698 /*@{*/
699 #define BP_NV_FSEC_FSLACC    (2U)          /*!< Bit position for NV_FSEC_FSLACC. */
700 #define BM_NV_FSEC_FSLACC    (0x0CU)       /*!< Bit mask for NV_FSEC_FSLACC. */
701 #define BS_NV_FSEC_FSLACC    (2U)          /*!< Bit field size in bits for NV_FSEC_FSLACC. */
702
703 /*! @brief Read current value of the NV_FSEC_FSLACC field. */
704 #define BR_NV_FSEC_FSLACC(x) (HW_NV_FSEC(x).B.FSLACC)
705 /*@}*/
706
707 /*!
708  * @name Register NV_FSEC, field MEEN[5:4] (RO)
709  *
710  * Values:
711  * - 10 - Mass erase is disabled
712  * - 11 - Mass erase is enabled
713  */
714 /*@{*/
715 #define BP_NV_FSEC_MEEN      (4U)          /*!< Bit position for NV_FSEC_MEEN. */
716 #define BM_NV_FSEC_MEEN      (0x30U)       /*!< Bit mask for NV_FSEC_MEEN. */
717 #define BS_NV_FSEC_MEEN      (2U)          /*!< Bit field size in bits for NV_FSEC_MEEN. */
718
719 /*! @brief Read current value of the NV_FSEC_MEEN field. */
720 #define BR_NV_FSEC_MEEN(x)   (HW_NV_FSEC(x).B.MEEN)
721 /*@}*/
722
723 /*!
724  * @name Register NV_FSEC, field KEYEN[7:6] (RO)
725  *
726  * Values:
727  * - 10 - Backdoor key access enabled
728  * - 11 - Backdoor key access disabled
729  */
730 /*@{*/
731 #define BP_NV_FSEC_KEYEN     (6U)          /*!< Bit position for NV_FSEC_KEYEN. */
732 #define BM_NV_FSEC_KEYEN     (0xC0U)       /*!< Bit mask for NV_FSEC_KEYEN. */
733 #define BS_NV_FSEC_KEYEN     (2U)          /*!< Bit field size in bits for NV_FSEC_KEYEN. */
734
735 /*! @brief Read current value of the NV_FSEC_KEYEN field. */
736 #define BR_NV_FSEC_KEYEN(x)  (HW_NV_FSEC(x).B.KEYEN)
737 /*@}*/
738
739 /*******************************************************************************
740  * HW_NV_FOPT - Non-volatile Flash Option Register
741  ******************************************************************************/
742
743 /*!
744  * @brief HW_NV_FOPT - Non-volatile Flash Option Register (RO)
745  *
746  * Reset value: 0xFFU
747  */
748 typedef union _hw_nv_fopt
749 {
750     uint8_t U;
751     struct _hw_nv_fopt_bitfields
752     {
753         uint8_t LPBOOT : 1;            /*!< [0]  */
754         uint8_t EZPORT_DIS : 1;        /*!< [1]  */
755         uint8_t NMI_DIS : 1;           /*!< [2]  */
756         uint8_t RESERVED0 : 2;         /*!< [4:3]  */
757         uint8_t FAST_INIT : 1;         /*!< [5]  */
758         uint8_t RESERVED1 : 2;         /*!< [7:6]  */
759     } B;
760 } hw_nv_fopt_t;
761
762 /*!
763  * @name Constants and macros for entire NV_FOPT register
764  */
765 /*@{*/
766 #define HW_NV_FOPT_ADDR(x)       ((x) + 0xDU)
767
768 #define HW_NV_FOPT(x)            (*(__I hw_nv_fopt_t *) HW_NV_FOPT_ADDR(x))
769 #define HW_NV_FOPT_RD(x)         (HW_NV_FOPT(x).U)
770 /*@}*/
771
772 /*
773  * Constants & macros for individual NV_FOPT bitfields
774  */
775
776 /*!
777  * @name Register NV_FOPT, field LPBOOT[0] (RO)
778  *
779  * Values:
780  * - 00 - Low-power boot
781  * - 01 - Normal boot
782  */
783 /*@{*/
784 #define BP_NV_FOPT_LPBOOT    (0U)          /*!< Bit position for NV_FOPT_LPBOOT. */
785 #define BM_NV_FOPT_LPBOOT    (0x01U)       /*!< Bit mask for NV_FOPT_LPBOOT. */
786 #define BS_NV_FOPT_LPBOOT    (1U)          /*!< Bit field size in bits for NV_FOPT_LPBOOT. */
787
788 /*! @brief Read current value of the NV_FOPT_LPBOOT field. */
789 #define BR_NV_FOPT_LPBOOT(x) (BITBAND_ACCESS8(HW_NV_FOPT_ADDR(x), BP_NV_FOPT_LPBOOT))
790 /*@}*/
791
792 /*!
793  * @name Register NV_FOPT, field EZPORT_DIS[1] (RO)
794  */
795 /*@{*/
796 #define BP_NV_FOPT_EZPORT_DIS (1U)         /*!< Bit position for NV_FOPT_EZPORT_DIS. */
797 #define BM_NV_FOPT_EZPORT_DIS (0x02U)      /*!< Bit mask for NV_FOPT_EZPORT_DIS. */
798 #define BS_NV_FOPT_EZPORT_DIS (1U)         /*!< Bit field size in bits for NV_FOPT_EZPORT_DIS. */
799
800 /*! @brief Read current value of the NV_FOPT_EZPORT_DIS field. */
801 #define BR_NV_FOPT_EZPORT_DIS(x) (BITBAND_ACCESS8(HW_NV_FOPT_ADDR(x), BP_NV_FOPT_EZPORT_DIS))
802 /*@}*/
803
804 /*!
805  * @name Register NV_FOPT, field NMI_DIS[2] (RO)
806  *
807  * Values:
808  * - 00 - NMI interrupts are always blocked
809  * - 01 - NMI_b pin/interrupts reset default to enabled
810  */
811 /*@{*/
812 #define BP_NV_FOPT_NMI_DIS   (2U)          /*!< Bit position for NV_FOPT_NMI_DIS. */
813 #define BM_NV_FOPT_NMI_DIS   (0x04U)       /*!< Bit mask for NV_FOPT_NMI_DIS. */
814 #define BS_NV_FOPT_NMI_DIS   (1U)          /*!< Bit field size in bits for NV_FOPT_NMI_DIS. */
815
816 /*! @brief Read current value of the NV_FOPT_NMI_DIS field. */
817 #define BR_NV_FOPT_NMI_DIS(x) (BITBAND_ACCESS8(HW_NV_FOPT_ADDR(x), BP_NV_FOPT_NMI_DIS))
818 /*@}*/
819
820 /*!
821  * @name Register NV_FOPT, field FAST_INIT[5] (RO)
822  *
823  * Values:
824  * - 00 - Slower initialization
825  * - 01 - Fast Initialization
826  */
827 /*@{*/
828 #define BP_NV_FOPT_FAST_INIT (5U)          /*!< Bit position for NV_FOPT_FAST_INIT. */
829 #define BM_NV_FOPT_FAST_INIT (0x20U)       /*!< Bit mask for NV_FOPT_FAST_INIT. */
830 #define BS_NV_FOPT_FAST_INIT (1U)          /*!< Bit field size in bits for NV_FOPT_FAST_INIT. */
831
832 /*! @brief Read current value of the NV_FOPT_FAST_INIT field. */
833 #define BR_NV_FOPT_FAST_INIT(x) (BITBAND_ACCESS8(HW_NV_FOPT_ADDR(x), BP_NV_FOPT_FAST_INIT))
834 /*@}*/
835
836 /*******************************************************************************
837  * hw_nv_t - module struct
838  ******************************************************************************/
839 /*!
840  * @brief All NV module registers.
841  */
842 #pragma pack(1)
843 typedef struct _hw_nv
844 {
845     __I hw_nv_backkey3_t BACKKEY3;         /*!< [0x0] Backdoor Comparison Key 3. */
846     __I hw_nv_backkey2_t BACKKEY2;         /*!< [0x1] Backdoor Comparison Key 2. */
847     __I hw_nv_backkey1_t BACKKEY1;         /*!< [0x2] Backdoor Comparison Key 1. */
848     __I hw_nv_backkey0_t BACKKEY0;         /*!< [0x3] Backdoor Comparison Key 0. */
849     __I hw_nv_backkey7_t BACKKEY7;         /*!< [0x4] Backdoor Comparison Key 7. */
850     __I hw_nv_backkey6_t BACKKEY6;         /*!< [0x5] Backdoor Comparison Key 6. */
851     __I hw_nv_backkey5_t BACKKEY5;         /*!< [0x6] Backdoor Comparison Key 5. */
852     __I hw_nv_backkey4_t BACKKEY4;         /*!< [0x7] Backdoor Comparison Key 4. */
853     __I hw_nv_fprot3_t FPROT3;             /*!< [0x8] Non-volatile P-Flash Protection 1 - Low Register */
854     __I hw_nv_fprot2_t FPROT2;             /*!< [0x9] Non-volatile P-Flash Protection 1 - High Register */
855     __I hw_nv_fprot1_t FPROT1;             /*!< [0xA] Non-volatile P-Flash Protection 0 - Low Register */
856     __I hw_nv_fprot0_t FPROT0;             /*!< [0xB] Non-volatile P-Flash Protection 0 - High Register */
857     __I hw_nv_fsec_t FSEC;                 /*!< [0xC] Non-volatile Flash Security Register */
858     __I hw_nv_fopt_t FOPT;                 /*!< [0xD] Non-volatile Flash Option Register */
859 } hw_nv_t;
860 #pragma pack()
861
862 /*! @brief Macro to access all NV registers. */
863 /*! @param x NV module instance base address. */
864 /*! @return Reference (not a pointer) to the registers struct. To get a pointer to the struct,
865  *     use the '&' operator, like <code>&HW_NV(FTFA_FlashConfig_BASE)</code>. */
866 #define HW_NV(x)       (*(hw_nv_t *)(x))
867
868 #endif /* __HW_NV_REGISTERS_H__ */
869 /* EOF */