1 /*
2  * Copyright 2020 - 2021 NXP
3  * All rights reserved.
4  *
5  * SPDX-License-Identifier: BSD-3-Clause
6  *
7  */
8 
9 #include <stdint.h>
10 #include <stdbool.h>
11 #include "life_cycle.h"
12 #include "fusemap.h"
13 
14 /*******************************************************************************
15  * Definitions
16  ******************************************************************************/
17 
18 /*******************************************************************************
19  * Prototype
20  ******************************************************************************/
21 
22 /*******************************************************************************
23  * Variables
24  ******************************************************************************/
25 
26 /*******************************************************************************
27  * Codes
28  ******************************************************************************/
get_lifecycle_state(void)29 uint32_t get_lifecycle_state(void)
30 {
31     uint32_t lifeCycleStateOtpShadow          = OTP_LCS_FUSE_VALUE();
32     uint32_t lifeCycleStateRedundantOtpShadow = OTP_LCS_REDUNDANT_FUSE_VALUE();
33     if (lifeCycleStateOtpShadow != lifeCycleStateRedundantOtpShadow)
34     {
35         while (true)
36         {
37             ; /* No necessary actions. */
38         }
39     }
40 
41     return ((lifeCycleStateOtpShadow & OTP_LCS_FUSE_MASK) >> OTP_LCS_FUSE_SHIFT);
42 }
43