PAN1080 Peripheral API
pan_efuse.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2021 Panchip Technology Corp. All rights reserved.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
14#ifndef __PAN_EFUSE_H__
15#define __PAN_EFUSE_H__
16
23#ifdef __cplusplus
24extern "C"
25{
26#endif
27
31#define EFUSE_CMD_READ (0X0)
32#define EFUSE_CMD_PROGRAM (0X1)
33#define EFUSE_CMD_INACTIVE (0X2)
39#define EFUSE_STATUS_OK (0x0)
40#define EFUSE_STATUS_FAIL (0x1)
51__STATIC_INLINE void EFUSE_Init(EFUSE_T* efuse)
52{
53 efuse->EF_CTL = EFUSE_CTL_EFUSE_EN_Msk |
54 EFUSE_CTL_EFUSECTL_BANK1_Msk |
55 EFUSE_CTL_EFUSECTL_BANK2_Msk |
56 EFUSE_CTL_EFUSECTL_BANK3_Msk |
57 EFUSE_CTL_EFUSECTL_BANK4_Msk;
58}
59
68__STATIC_INLINE void EFUSE_UnInit(EFUSE_T* efuse)
69{
70 efuse->EF_CTL = 0;
71}
72
80__STATIC_INLINE uint32_t EFUSE_GetErrorStatus(EFUSE_T* efuse)
81{
82 return efuse->EF_OP_ERROR;
83}
84
91__STATIC_INLINE void EFUSE_ClrErrorStatus(EFUSE_T* efuse)
92{
93 // Write 0x1 to clear this register
94 efuse->EF_OP_ERROR = 1u;
95}
96
106extern uint8_t EFUSE_ReadByte(EFUSE_T* efuse, uint32_t addr);
107
118extern void EFUSE_WriteByte(EFUSE_T* efuse, uint32_t addr, uint8_t data);
119
132extern bool EFUSE_Read(EFUSE_T* efuse, uint32_t addr, uint8_t* data, uint16_t len);
133
146extern bool EFUSE_Write(EFUSE_T* efuse, uint32_t addr, uint8_t* data, uint16_t len);
147
160extern bool EFUSE_UserRead(EFUSE_T* efuse, uint32_t addr, uint8_t* data, uint16_t len);
161
174extern bool EFUSE_UserWrite(EFUSE_T* efuse, uint32_t addr, uint8_t* data, uint16_t len);
175
176
179#ifdef __cplusplus
180}
181#endif
182
183#endif /* __PAN_EFUSE_H__ */
bool EFUSE_UserRead(EFUSE_T *efuse, uint32_t addr, uint8_t *data, uint16_t len)
Read multiple data from User Area of eFuse (Address 0xE9 ~ 0xFF).
__STATIC_INLINE uint32_t EFUSE_GetErrorStatus(EFUSE_T *efuse)
Get eFuse error status flag.
Definition: pan_efuse.h:80
bool EFUSE_UserWrite(EFUSE_T *efuse, uint32_t addr, uint8_t *data, uint16_t len)
Write multiple data to User Area of eFuse (Address 0xE9 ~ 0xFF).
__STATIC_INLINE void EFUSE_ClrErrorStatus(EFUSE_T *efuse)
Clear eFuse error status flag.
Definition: pan_efuse.h:91
__STATIC_INLINE void EFUSE_Init(EFUSE_T *efuse)
Init eFuse module.
Definition: pan_efuse.h:51
__STATIC_INLINE void EFUSE_UnInit(EFUSE_T *efuse)
Un-Init eFuse module.
Definition: pan_efuse.h:68
void EFUSE_WriteByte(EFUSE_T *efuse, uint32_t addr, uint8_t data)
Write one byte data to specified eFuse address.
uint8_t EFUSE_ReadByte(EFUSE_T *efuse, uint32_t addr)
Read specified one byte from eFuse.
bool EFUSE_Write(EFUSE_T *efuse, uint32_t addr, uint8_t *data, uint16_t len)
Write multiple data to eFuse.
bool EFUSE_Read(EFUSE_T *efuse, uint32_t addr, uint8_t *data, uint16_t len)
Read multiple data from eFuse.