Functions

group group_efuse_functions

Functions

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.

The EFUSE_EFUSE_NR macro is defined in the series-specific header file, e.g

<PDL_DIR>/devices/include/psoc6_01_config.h
Parameters
  • bitNum: The 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.

note

Supported in eFuse v1.

Return

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);

Parameters
  • bitVal: The pointer to the location to store the bit value.

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.

The EFUSE_EFUSE_NR macro is defined in the series-specific header file, e.g

<PDL_DIR>/devices/include/psoc6_01_config.h
Parameters
  • offset: The 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.

note

Supported in eFuse v1.

Return

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);

Parameters
  • byteVal: The pointer to the location to store eFuse data.

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.

note

Supported in eFuse v1.

Return

The error code of the previous efuse operation.

cy_en_efuse_status_t Cy_EFUSE_Init(EFUSE_Type *base)

This function enables the EFUSE block and initializes the registers with the default values.

note

Supported in CAT1B devices.

Return

The EFUSE API status cy_en_efuse_status_t.

Parameters
  • base: The pointer to the EFUSE instance.

void Cy_EFUSE_Enable(EFUSE_Type *base)

Enables the EFUSE block.

note

Supported in CAT1B devices.

Parameters
  • base: The pointer to the EFUSE instance.

void Cy_EFUSE_Disable(EFUSE_Type *base)

Disables the EFUSE block.

All non-retention registers (command and status registers) are reset to their default values when the IP is disabled.

note

Supported in CAT1B devices.

Parameters
  • base: The pointer to the EFUSE instance.

void Cy_EFUSE_DeInit(EFUSE_Type *base)

Disables the EFUSE block.

All non-retention registers (command and status registers) are reset to their default values when the IP is disabled.

note

Supported in CAT1B devices.

Parameters
  • base: The pointer to the EFUSE instance.

cy_en_efuse_status_t Cy_EFUSE_WriteBit(EFUSE_Type *base, uint32_t bitPos, uint32_t offset)

Writes a bit to EFUSE by blowing a fuse, so this function is able to write 1s only.

Before write operations you must call Cy_EFUSE_Init(). It is recommended to disable the block when not using it. Call Cy_EFUSE_Disable() to disable the EFUSE block.

note

-The caller is expected to verify the input parameters for correctness and to check whether the bit is already blown before calling this function to not over-program bits. -Supported in CAT1B devices.

Return

The EFUSE API status cy_en_efuse_status_t.

Parameters
  • base: The pointer to the EFUSE instance.

  • bitPos: Bit position within byte.

  • offset: Byte position within EFUSE address space.

cy_en_efuse_status_t Cy_EFUSE_WriteByte(EFUSE_Type *base, uint32_t src, uint32_t offset)

Writes one byte.

Before write operations you must call Cy_EFUSE_Init(). It is recommended to disable the block when not using it. Call Cy_EFUSE_Disable() to disable the EFUSE block.

note

  • The caller is expected to check whether the bits within the byte are already blown before calling this function to not over-program bits.

  • Supported in CAT1B devices.

Return

The EFUSE API status cy_en_efuse_status_t.

Parameters
  • base: The pointer to the EFUSE instance.

  • src: Value to be written.

  • offset: Byte offset from the EFUSE base address

cy_en_efuse_status_t Cy_EFUSE_WriteWord(EFUSE_Type *base, uint32_t src, uint32_t offset)

Writes every bit set in src that was not already programmed.

Before write operations you must call Cy_EFUSE_Init(). It is recommended to disable the block when not using it. Call Cy_EFUSE_Disable() to disable the EFUSE block.

note

Supported in CAT1B devices.

Return

The EFUSE API status cy_en_efuse_status_t.

Parameters
  • base: The pointer to the EFUSE instance.

  • src: Value to be written.

  • offset: Offset from the EFUSE base address. Must be 4-byte aligned.

cy_en_efuse_status_t Cy_EFUSE_WriteWordArray(EFUSE_Type *base, const uint32_t *src, uint32_t offset, uint32_t num)

Writes the values of num 32-bit words from the location pointed to by src to the EFUSE location pointed to by offset.

Before write operations you must call Cy_EFUSE_Init(). It is recommended to disable the block when not using it. Call Cy_EFUSE_Disable() to disable the EFUSE block.

note

Supported in CAT1B devices.

Return

The EFUSE API status cy_en_efuse_status_t.

Parameters
  • base: The pointer to the EFUSE instance.

  • src: Pointer to the source of data to be written.

  • offset: Offset from the EFUSE base address. Must be 4-byte aligned.

  • num: Number of 32-bit words to be written.

cy_en_efuse_status_t Cy_EFUSE_ReadByte(EFUSE_Type *base, uint8_t *dst, uint32_t offset)

Reads byte from EFUSE.

Before read operations you must call Cy_EFUSE_Init(). It is recommended to disable the block when not using it. Call Cy_EFUSE_Disable() to disable the EFUSE block.

note

Supported in CAT1B devices.

Return

The EFUSE API status cy_en_efuse_status_t.

Parameters
  • base: The pointer to the EFUSE instance.

  • dst: Pointer to the destination where the read byte is stored.

  • offset: Byte offset from the EFUSE base address.

cy_en_efuse_status_t Cy_EFUSE_ReadWord(EFUSE_Type *base, uint32_t *dst, uint32_t offset)

Reads a 32-bit word from EFUSE.

Before read operations you must call Cy_EFUSE_Init(). It is recommended to disable the block when not using it. Call Cy_EFUSE_Disable() to disable the EFUSE block.

note

Supported in CAT1B devices.

Return

The EFUSE API status cy_en_efuse_status_t.

Parameters
  • base: The pointer to the EFUSE instance.

  • dst: Pointer to the destination where the read word is stored.

  • offset: Offset from the EFUSE base address. Must be 4 byte aligned.

cy_en_efuse_status_t Cy_EFUSE_ReadWordArray(EFUSE_Type *base, uint32_t *dst, uint32_t offset, uint32_t num)

Reads an array of 32-bit words from EFUSE.

Before read operations you must call Cy_EFUSE_Init(). It is recommended to disable the block when not using it. Call Cy_EFUSE_Disable() to disable the EFUSE block.

note

Supported in CAT1B devices.

Return

The EFUSE API status cy_en_efuse_status_t.

Parameters
  • base: The pointer to the EFUSE instance.

  • dst: Pointer to the destination array where the content is to be read.

  • offset: Start address of the data to read in EFUSE.

  • num: Number of words to read.

cy_en_efuse_status_t Cy_EFUSE_WriteBootRow(EFUSE_Type *base, uint32_t bootrow)

Writes data into BOOTROW.

Before write operations you must call Cy_EFUSE_Init(). It is recommended to disable the block when not using it. Call Cy_EFUSE_Disable() to disable the EFUSE block.

note

Supported in CAT1B devices.

Return

The EFUSE API status cy_en_efuse_status_t.

Parameters
  • base: The pointer to the EFUSE instance.

  • bootrow: 32-bit value to be written into bootrow.

cy_en_efuse_status_t Cy_EFUSE_ReadBootRow(EFUSE_Type *base, uint32_t *bootrow)

Reads data from BOOTROW.

The BOOTROW information is latched upon system reset and is readable as MMIO register.

note

Supported in CAT1B devices.

Return

The EFUSE API status cy_en_efuse_status_t.

Parameters
  • base: The pointer to the EFUSE instance.

  • bootrow: Pointer to the variable where the content of BOOTROW is read to.