MTB CAT1 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...
 
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. More...
 
void Cy_EFUSE_Enable (EFUSE_Type *base)
 Enables the EFUSE block. More...
 
void Cy_EFUSE_Disable (EFUSE_Type *base)
 Disables the EFUSE block. More...
 
bool Cy_EFUSE_IsEnabled (EFUSE_Type *base)
 Check if EFUSE block is Enabled or Not. More...
 
void Cy_EFUSE_DeInit (EFUSE_Type *base)
 Disables the EFUSE block. More...
 
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. More...
 
cy_en_efuse_status_t Cy_EFUSE_WriteByte (EFUSE_Type *base, uint32_t src, uint32_t offset)
 Writes one byte. More...
 
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. More...
 
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. More...
 
cy_en_efuse_status_t Cy_EFUSE_ReadBit (EFUSE_Type *base, uint8_t *dst, uint32_t bitPos, uint32_t offset)
 Reads a bit from EFUSE. More...
 
cy_en_efuse_status_t Cy_EFUSE_ReadByte (EFUSE_Type *base, uint8_t *dst, uint32_t offset)
 Reads byte from EFUSE. More...
 
cy_en_efuse_status_t Cy_EFUSE_ReadWord (EFUSE_Type *base, uint32_t *dst, uint32_t offset)
 Reads a 32-bit word from EFUSE. More...
 
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. More...
 
cy_en_efuse_status_t Cy_EFUSE_WriteBootRow (EFUSE_Type *base, uint32_t bootrow)
 Writes data into BOOTROW. More...
 
cy_en_efuse_status_t Cy_EFUSE_ReadBootRow (EFUSE_Type *base, uint32_t *bootrow)
 Reads data from BOOTROW. 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
Note
Supported in CAT1A and CAT1C devices.
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
Note
Supported in CAT1A and CAT1C devices.
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.
Note
Supported in CAT1A and CAT1C devices.

◆ Cy_EFUSE_Init()

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.

Parameters
baseThe pointer to the EFUSE instance.
Returns
The EFUSE API status cy_en_efuse_status_t.
Note
Supported in CAT1B devices.

◆ Cy_EFUSE_Enable()

void Cy_EFUSE_Enable ( EFUSE_Type *  base)

Enables the EFUSE block.

Parameters
baseThe pointer to the EFUSE instance.
Note
Supported in CAT1B devices.

◆ Cy_EFUSE_Disable()

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.

Parameters
baseThe pointer to the EFUSE instance.
Note
Supported in CAT1B devices.

◆ Cy_EFUSE_IsEnabled()

bool Cy_EFUSE_IsEnabled ( EFUSE_Type *  base)

Check if EFUSE block is Enabled or Not.

Parameters
baseThe pointer to the EFUSE instance.
Returns
  • True if the EFUSE is enabled.
  • False if EFUSE is disabled.
Note
Supported in CAT1B devices.

◆ Cy_EFUSE_DeInit()

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.

Parameters
baseThe pointer to the EFUSE instance.
Note
Supported in CAT1B devices.

◆ Cy_EFUSE_WriteBit()

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.

Parameters
baseThe pointer to the EFUSE instance.
bitPosBit position within byte.
offsetByte position within EFUSE address space.
Returns
The EFUSE API status cy_en_efuse_status_t.
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.

◆ Cy_EFUSE_WriteByte()

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.

Parameters
baseThe pointer to the EFUSE instance.
srcValue to be written.
offsetByte offset from the EFUSE base address
Returns
The EFUSE API status cy_en_efuse_status_t.
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.

◆ Cy_EFUSE_WriteWord()

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.

Parameters
baseThe pointer to the EFUSE instance.
srcValue to be written.
offsetOffset from the EFUSE base address. Must be 4-byte aligned.
Returns
The EFUSE API status cy_en_efuse_status_t.
Note
  • The caller is expected to check whether the bits within the 32-bit word are already blown before calling this function to not over-program bits.
  • Supported in CAT1B devices.

◆ Cy_EFUSE_WriteWordArray()

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.

Parameters
baseThe pointer to the EFUSE instance.
srcPointer to the source of data to be written.
offsetOffset from the EFUSE base address. Must be 4-byte aligned.
numNumber of 32-bit words to be written.
Returns
The EFUSE API status cy_en_efuse_status_t.
Note
  • The caller is expected to check whether the bits within the 32-bit words are already blown before calling this function to not over-program bits.
  • Supported in CAT1B devices.

◆ Cy_EFUSE_ReadBit()

cy_en_efuse_status_t Cy_EFUSE_ReadBit ( EFUSE_Type *  base,
uint8_t *  dst,
uint32_t  bitPos,
uint32_t  offset 
)

Reads a bit 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.

Parameters
baseThe pointer to the EFUSE instance.
dstPointer to the destination where the read bit is stored.
bitPosBit position within byte.
offsetByte offset from the EFUSE base address.
Returns
The EFUSE API status cy_en_efuse_status_t.
Note
Supported in CAT1B devices.

◆ Cy_EFUSE_ReadByte()

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.

Parameters
baseThe pointer to the EFUSE instance.
dstPointer to the destination where the read byte is stored.
offsetByte offset from the EFUSE base address.
Returns
The EFUSE API status cy_en_efuse_status_t.
Note
Supported in CAT1B devices.

◆ Cy_EFUSE_ReadWord()

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.

Parameters
baseThe pointer to the EFUSE instance.
dstPointer to the destination where the read word is stored.
offsetOffset from the EFUSE base address. Must be 4-byte aligned.
Returns
The EFUSE API status cy_en_efuse_status_t.
Note
Supported in CAT1B devices.

◆ Cy_EFUSE_ReadWordArray()

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.

Parameters
baseThe pointer to the EFUSE instance.
dstPointer to the destination array where the content is to be read.
offsetStart address of the data to read in EFUSE.
numNumber of words to read.
Returns
The EFUSE API status cy_en_efuse_status_t.
Note
Supported in CAT1B devices.

◆ Cy_EFUSE_WriteBootRow()

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.

Parameters
baseThe pointer to the EFUSE instance.
bootrow32-bit value to be written into bootrow.
Returns
The EFUSE API status cy_en_efuse_status_t.
Note
Supported in CAT1B devices.

◆ Cy_EFUSE_ReadBootRow()

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.

Parameters
baseThe pointer to the EFUSE instance.
bootrowPointer to the variable where the content of BOOTROW is read to.
Returns
The EFUSE API status cy_en_efuse_status_t.
Note
Supported in CAT1B devices.