RTEMS 6.1-rc4
Loading...
Searching...
No Matches
fsl_ocotp.h
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, 1, 3))
26#ifndef OCOTP_READ_FUSE_DATA_COUNT
27#define OCOTP_READ_FUSE_DATA_COUNT (1U)
28#endif
29
31enum
32{
39};
40
41#if (defined(FSL_FEATURE_OCOTP_HAS_TIMING_CTRL) && FSL_FEATURE_OCOTP_HAS_TIMING_CTRL)
53typedef struct _ocotp_timing
54{
55 uint32_t wait;
56 uint32_t relax;
57 uint32_t strobe_prog;
58 uint32_t strobe_read;
59} ocotp_timing_t;
60#endif /* FSL_FEATURE_OCOTP_HAS_TIMING_CTRL */
61
62/*******************************************************************************
63 * API
64 *******************************************************************************/
65
66#if defined(__cplusplus)
67extern "C" {
68#endif
69
78void OCOTP_Init(OCOTP_Type *base, uint32_t srcClock_Hz);
79
85void OCOTP_Deinit(OCOTP_Type *base);
86
94static inline bool OCOTP_CheckBusyStatus(OCOTP_Type *base)
95{
96 return ((OCOTP_CTRL_BUSY_MASK == (base->CTRL & OCOTP_CTRL_BUSY_MASK)) ? (true) : (false));
97}
98
105static inline bool OCOTP_CheckErrorStatus(OCOTP_Type *base)
106{
107 return ((OCOTP_CTRL_ERROR_MASK == (base->CTRL & OCOTP_CTRL_ERROR_MASK)) ? (true) : (false));
108}
109
115static inline void OCOTP_ClearErrorStatus(OCOTP_Type *base)
116{
117 base->CTRL_CLR = OCOTP_CTRL_CLR_ERROR_MASK;
118}
119
130
140uint32_t OCOTP_ReadFuseShadowRegister(OCOTP_Type *base, uint32_t address);
141
156status_t OCOTP_ReadFuseShadowRegisterExt(OCOTP_Type *base, uint32_t address, uint32_t *data, uint8_t fuseWords);
157
167status_t OCOTP_WriteFuseShadowRegister(OCOTP_Type *base, uint32_t address, uint32_t data);
168
192status_t OCOTP_WriteFuseShadowRegisterWithLock(OCOTP_Type *base, uint32_t address, uint32_t data, bool lock);
193
200static inline uint32_t OCOTP_GetVersion(OCOTP_Type *base)
201{
202 return (base->VERSION);
203}
204
205#if defined(__cplusplus)
206}
207#endif
208
211#endif /* _FSL_OCOTP_H_ */
int32_t status_t
Type used for all status and error return values.
Definition: fsl_common.h:225
#define MAKE_STATUS(group, code)
Construct a status code value from a group and code number.
Definition: fsl_common.h:47
@ kStatusGroup_SDK_OCOTP
Definition: fsl_common.h:184
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:292
status_t OCOTP_WriteFuseShadowRegisterWithLock(OCOTP_Type *base, uint32_t address, uint32_t data, bool lock)
Write the fuse shadow register and lock it.
Definition: fsl_ocotp.c:297
void OCOTP_Init(OCOTP_Type *base, uint32_t srcClock_Hz)
Initializes OCOTP controller.
Definition: fsl_ocotp.c:144
status_t 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:69
status_t OCOTP_ReadFuseShadowRegisterExt(OCOTP_Type *base, uint32_t address, uint32_t *data, uint8_t fuseWords)
Read the fuse shadow register from the fuse addess.
Definition: fsl_ocotp.c:203
void OCOTP_Deinit(OCOTP_Type *base)
De-initializes OCOTP controller.
Definition: fsl_ocotp.c:174
uint32_t OCOTP_ReadFuseShadowRegister(OCOTP_Type *base, uint32_t address)
Read the fuse shadow register with the fuse addess.
Definition: fsl_ocotp.c:192
@ kStatus_OCOTP_Locked
Definition: fsl_ocotp.h:38
@ kStatus_OCOTP_AccessError
Definition: fsl_ocotp.h:33
@ kStatus_OCOTP_CrcFail
Definition: fsl_ocotp.h:34
@ kStatus_OCOTP_ReloadError
Definition: fsl_ocotp.h:35
@ kStatus_OCOTP_ProgramFail
Definition: fsl_ocotp.h:37
Definition: MIMXRT1052.h:32184