PSoC 6 Peripheral Driver Library

General Description

Functions

cy_en_efuse_status_t Cy_EFUSE_GetEfuseBit (uint32_t bitNum, bool *bitVal)
 Reports the current state of a given eFuse bit-number. More...
 
cy_en_efuse_status_t Cy_EFUSE_GetEfuseByte (uint32_t offset, uint8_t *byteVal)
 Reports the current state of the eFuse byte. More...
 
uint32_t Cy_EFUSE_GetExternalStatus (void)
 This function handles the case where a module such as a security image captures a system call from this driver and reports its own status or error code, for example, protection violation. More...
 

Function Documentation

◆ Cy_EFUSE_GetEfuseBit()

cy_en_efuse_status_t Cy_EFUSE_GetEfuseBit ( uint32_t  bitNum,
bool *  bitVal 
)

Reports the current state of a given eFuse bit-number.

Consult the device TRM to determine the target fuse bit number.

Note
An attempt to read an eFuse data from a protected memory region will generate a HardFault.
Parameters
bitNumThe number of the bit to read. The valid range of the bit number is from 0 to EFUSE_EFUSE_NR * 32 * 8 - 1 where:
  • EFUSE_EFUSE_NR is number of efuse macros in the selected device series,
  • 32 is a number of fuse bytes in one efuse macro,
  • 8 is a number of fuse bits in the byte.

The EFUSE_EFUSE_NR macro is defined in the series-specific header file, e.g <PDL_DIR>/devices/include/psoc6_01_config.h

Parameters
bitValThe pointer to the location to store the bit value.
Returns
cy_en_efuse_status_t
Function Usage
The example below shows how to read device life-cycle register bits in PSoC 6:
uint32_t offset = offsetof(cy_stc_efuse_data_t, LIFECYCLE_STAGE.SECURE);
bool bitVal;
(void) Cy_EFUSE_GetEfuseBit(offset, &bitVal);

◆ Cy_EFUSE_GetEfuseByte()

cy_en_efuse_status_t Cy_EFUSE_GetEfuseByte ( uint32_t  offset,
uint8_t *  byteVal 
)

Reports the current state of the eFuse byte.

If the offset parameter is beyond the available quantities, zeroes will be stored to the byteVal parameter. Consult the device TRM to determine the target fuse byte offset.

Note
An attempt to read an eFuse data from a protected memory region will generate a HardFault.
Parameters
offsetThe offset of the byte to read. The valid range of the byte offset is from 0 to EFUSE_EFUSE_NR * 32 - 1 where:
  • EFUSE_EFUSE_NR is a number of efuse macros in the selected device series,
  • 32 is a number of fuse bytes in one efuse macro.

The EFUSE_EFUSE_NR macro is defined in the series-specific header file, e.g <PDL_DIR>/devices/include/psoc6_01_config.h

Parameters
byteValThe pointer to the location to store eFuse data.
Returns
cy_en_efuse_status_t
Function Usage
The example below shows how to read a device life-cycle stage register in PSoC 6:
/* Determine the offset of the byte to read. Divide by 8 since the one byte in
* cy_stc_efuse_data_t struct corresponds to the one bit in the eFuse memory.
*/
uint32_t offset = offsetof(cy_stc_efuse_data_t, LIFECYCLE_STAGE.NORMAL) / CY_EFUSE_BITS_PER_BYTE;
uint8_t byteVal;
(void) Cy_EFUSE_GetEfuseByte(offset, &byteVal);

◆ Cy_EFUSE_GetExternalStatus()

uint32_t Cy_EFUSE_GetExternalStatus ( void  )

This function handles the case where a module such as a security image captures a system call from this driver and reports its own status or error code, for example, protection violation.

In that case, a function from this driver returns an unknown error (see cy_en_efuse_status_t). After receipt of an unknown error, the user may call this function to get the status of the capturing module.

The user is responsible for parsing the content of the returned value and casting it to the appropriate enumeration.

Returns
The error code of the previous efuse operation.