fsl_ocotp.h
Go to the documentation of this file.
1 /*
2  * Copyright 2019-2020 NXP
3  * All rights reserved.
4  *
5  * SPDX-License-Identifier: BSD-3-Clause
6  */
7 #ifndef _FSL_OCOTP_H_
8 #define _FSL_OCOTP_H_
9 
10 #include "fsl_common.h"
11 
17 /*******************************************************************************
18  * Definitions
19  *******************************************************************************/
23 #define FSL_OCOTP_DRIVER_VERSION (MAKE_VERSION(2, 0, 1))
24 
28 {
31 };
32 
44 typedef struct _ocotp_timing
45 {
46  uint32_t wait;
47  uint32_t relax;
48  uint32_t strobe_prog;
49  uint32_t strobe_read;
51 
52 /*******************************************************************************
53  * API
54  *******************************************************************************/
55 
56 #if defined(__cplusplus)
57 extern "C" {
58 #endif
59 
66 void OCOTP_Init(OCOTP_Type *base, uint32_t srcClock_Hz);
67 
73 void OCOTP_Deinit(OCOTP_Type *base);
74 
82 static inline bool OCOTP_CheckBusyStatus(OCOTP_Type *base)
83 {
84  return ((OCOTP_CTRL_BUSY_MASK == (base->CTRL & OCOTP_CTRL_BUSY_MASK)) ? (true) : (false));
85 }
86 
93 static inline bool OCOTP_CheckErrorStatus(OCOTP_Type *base)
94 {
95  return ((OCOTP_CTRL_ERROR_MASK == (base->CTRL & OCOTP_CTRL_ERROR_MASK)) ? (true) : (false));
96 }
97 
103 static inline void OCOTP_ClearErrorStatus(OCOTP_Type *base)
104 {
106 }
107 
116 
123 uint32_t OCOTP_ReadFuseShadowRegister(OCOTP_Type *base, uint32_t address);
124 
134 status_t OCOTP_WriteFuseShadowRegister(OCOTP_Type *base, uint32_t address, uint32_t data);
135 
142 static inline uint32_t OCOTP_GetVersion(OCOTP_Type *base)
143 {
144  return (base->VERSION);
145 }
146 
147 #if defined(__cplusplus)
148 }
149 #endif
150 
153 #endif /* _FSL_OCOTP_H_ */
fsl_common.h
OCOTP_CheckBusyStatus
static bool OCOTP_CheckBusyStatus(OCOTP_Type *base)
Checking the BUSY bit in CTRL register. Checking this BUSY bit will help confirm if the OCOTP control...
Definition: fsl_ocotp.h:82
OCOTP_GetVersion
static uint32_t OCOTP_GetVersion(OCOTP_Type *base)
Get the OCOTP controller version from the register.
Definition: fsl_ocotp.h:142
kStatus_OCOTP_CrcFail
@ kStatus_OCOTP_CrcFail
Definition: fsl_ocotp.h:30
OCOTP_WriteFuseShadowRegister
status_t OCOTP_WriteFuseShadowRegister(OCOTP_Type *base, uint32_t address, uint32_t data)
Write the fuse shadow register with the fuse addess and data. Please make sure the wrtie address is n...
Definition: fsl_ocotp.c:209
OCOTP_Deinit
void OCOTP_Deinit(OCOTP_Type *base)
De-initializes OCOTP controller.
Definition: fsl_ocotp.c:140
OCOTP_CTRL_ERROR_MASK
#define OCOTP_CTRL_ERROR_MASK
Definition: MIMXRT1052.h:27818
_ocotp_timing
OCOTP timing structure. Note that, these value are used for calcalating the read/write timings....
Definition: fsl_ocotp.h:44
_ocotp_timing::relax
uint32_t relax
Definition: fsl_ocotp.h:47
OCOTP_CTRL_BUSY_MASK
#define OCOTP_CTRL_BUSY_MASK
Definition: MIMXRT1052.h:27815
OCOTP_CTRL_CLR_ERROR_MASK
#define OCOTP_CTRL_CLR_ERROR_MASK
Definition: MIMXRT1052.h:27856
OCOTP_ReloadShadowRegister
void OCOTP_ReloadShadowRegister(OCOTP_Type *base)
Reload the shadow register. This function will help reload the shadow register without reseting the O...
Definition: fsl_ocotp.c:59
OCOTP_ReadFuseShadowRegister
uint32_t OCOTP_ReadFuseShadowRegister(OCOTP_Type *base, uint32_t address)
Read the fuse shadow register with the fuse addess.
Definition: fsl_ocotp.c:156
OCOTP_ClearErrorStatus
static void OCOTP_ClearErrorStatus(OCOTP_Type *base)
Clear the error bit if this bit is set.
Definition: fsl_ocotp.h:103
MAKE_STATUS
#define MAKE_STATUS(group, code)
Construct a status code value from a group and code number.
Definition: fsl_common.h:43
_ocotp_status
_ocotp_status
Error codes for the OCOTP driver.
Definition: fsl_ocotp.h:27
kStatus_OCOTP_AccessError
@ kStatus_OCOTP_AccessError
Definition: fsl_ocotp.h:29
_ocotp_timing::strobe_prog
uint32_t strobe_prog
Definition: fsl_ocotp.h:48
kStatusGroup_SDK_OCOTP
@ kStatusGroup_SDK_OCOTP
Definition: fsl_common.h:165
OCOTP_Type::VERSION
__I uint32_t VERSION
Definition: MIMXRT1052.h:27718
OCOTP_Type::CTRL
__IO uint32_t CTRL
Definition: MIMXRT1052.h:27699
OCOTP_Init
void OCOTP_Init(OCOTP_Type *base, uint32_t srcClock_Hz)
Initializes OCOTP controller.
Definition: fsl_ocotp.c:114
ocotp_timing_t
struct _ocotp_timing ocotp_timing_t
OCOTP timing structure. Note that, these value are used for calcalating the read/write timings....
_ocotp_timing::strobe_read
uint32_t strobe_read
Definition: fsl_ocotp.h:49
OCOTP_Type
Definition: MIMXRT1052.h:27698
OCOTP_Type::CTRL_CLR
__IO uint32_t CTRL_CLR
Definition: MIMXRT1052.h:27701
OCOTP_CheckErrorStatus
static bool OCOTP_CheckErrorStatus(OCOTP_Type *base)
Checking the ERROR bit in CTRL register.
Definition: fsl_ocotp.h:93
_ocotp_timing::wait
uint32_t wait
Definition: fsl_ocotp.h:46
status_t
int32_t status_t
Type used for all status and error return values.
Definition: fsl_common.h:189


picovoice_driver
Author(s):
autogenerated on Fri Apr 1 2022 02:13:56