PSOC E8XXGP Device Support Library

| PSOC E8XXGP Device Support Library

Functions
Functions
PDL API Reference » Crypto (Cryptography) » Direct Crypto Core Access » Control and Status

## General Description

## Functions
cy_en_crypto_status_t | Cy_Crypto_Core_Enable (CRYPTO_Type *base)
| The function to enable the Crypto hardware. More...
cy_en_crypto_status_t | Cy_Crypto_Core_Disable (CRYPTO_Type *base)
| Disables the operation of the CRYPTO block. More...
cy_en_crypto_status_t | Cy_Crypto_Core_Cleanup (CRYPTO_Type *base)
| Cleans up the Crypto block. More...
cy_en_crypto_status_t | Cy_Crypto_Core_Shutdown (CRYPTO_Type *base)
| Cleans up the Crypto block, disable it and reset all crypto registers. More...
cy_en_crypto_status_t | Cy_Crypto_Core_GetLibInfo (cy_en_crypto_lib_info_t *libInfo)
| Get Crypto service information. More...
cy_en_crypto_status_t | Cy_Crypto_Core_SetVuMemoryAddress (CRYPTO_Type *base, uint32_t const *vuMemoryAddr, uint32_t vuMemorySize)
| Sets the new memory buffer address and size. More...
__STATIC_INLINE uint32_t * | Cy_Crypto_Core_GetVuMemoryAddress (CRYPTO_Type *base)
| Gets Crypto memory buffer address. More...
uint32_t | Cy_Crypto_Core_GetVuMemorySize (CRYPTO_Type *base)
| Get Crypto memory buffer size. More...
void | Cy_Crypto_Core_InvertEndianness (void *inArrPtr, uint32_t byteSize)
| This function reverts byte-array memory block, like: inArr[0] <—> inArr[n] inArr[1] <—> inArr[n-1] inArr[2] <—> inArr[n-2] ........................ inArr[n/2] <—> inArr[n/2-1] More...
__STATIC_INLINE bool | Cy_Crypto_Core_IsEnabled (CRYPTO_Type *base)
| The function checks whether the Crypto hardware is enabled. More...
__STATIC_INLINE uint8_t | Cy_Crypto_Core_GetFIFODepth (CRYPTO_Type *base)
| Returns the total available number of instructions in the instruction FIFO. More...
__STATIC_INLINE uint8_t | Cy_Crypto_Core_GetFIFOUsed (CRYPTO_Type *base)
| Returns the number of instructions in the instruction FIFO. More...
__STATIC_INLINE void | Cy_Crypto_Core_WaitForInstrFifoAvailable (CRYPTO_Type *base, uint32_t instr)
| Waits until number of entries in the instruction FIFO is less than specified number. More...
__STATIC_INLINE void | Cy_Crypto_Core_WaitForFifoAvailable (CRYPTO_Type *base)
| Waits until number of entries in the instruction FIFO is less than specified in EVENT_LEVEL field in FF_CTL register, an event is generated: "event" = INSTR_FF_STATUS.USED < EVENT_LEVEL. More...
__STATIC_INLINE void | Cy_Crypto_Core_WaitForReady (CRYPTO_Type *base)
| Waits until all instruction in FIFO will be completed. More...
__STATIC_INLINE void | Cy_Crypto_Core_Vu_WaitForComplete (CRYPTO_Type *base)
| Waits until VU instruction will be completed. More...
__STATIC_INLINE void | Cy_Crypto_Core_SetInterruptMask (CRYPTO_Type *base, uint32_t interrupts)
| Masks / unmasks multiple interrupt sources. More...
__STATIC_INLINE uint32_t | Cy_Crypto_Core_GetInterruptMask (CRYPTO_Type const *base)
| Reports mask / unmask multiple interrupt sources. More...
__STATIC_INLINE uint32_t | Cy_Crypto_Core_GetInterruptStatusMasked (CRYPTO_Type const *base)
| Reports states of multiple enabled interrupt sources. More...
__STATIC_INLINE uint32_t | Cy_Crypto_Core_GetInterruptStatus (CRYPTO_Type *base)
| Reports states of multiple interrupt sources. More...
__STATIC_INLINE void | Cy_Crypto_Core_SetInterrupt (CRYPTO_Type *base, uint32_t interrupts)
| Sets one of more interrupt sources. More...
__STATIC_INLINE void | Cy_Crypto_Core_ClearInterrupt (CRYPTO_Type *base, uint32_t interrupts)
| Clears multiple interrupt sources. More...
void | Cy_Crypto_Core_ClearVuRegisters (CRYPTO_Type *base)
| The function to initialize the Crypto VU registers. More...

## Function Documentation

## ◆ Cy_Crypto_Core_Enable()

cy_en_crypto_status_t Cy_Crypto_Core_Enable | ( | CRYPTO_Type * | base | ) |

The function to enable the Crypto hardware.

Parameters

  base | The pointer to the CRYPTO instance.

Returns
  Crypto status cy_en_crypto_status_t

Function Usage
  cy_en_crypto_status_t cryptoStatus;
  /* Enable Crypto IP */
  cryptoStatus = Cy_Crypto_Core_Enable(
  CRYPTO_HW); /* Pointer to Crypto instance */
  /* ... check for errors... */
  cy_en_crypto_status_t
  cy_en_crypto_status_t
  Errors of the Crypto block.
  Definition: cy_crypto_common.h:532
  Cy_Crypto_Core_Enable
  cy_en_crypto_status_t Cy_Crypto_Core_Enable(CRYPTO_Type *base)
  The function to enable the Crypto hardware.
  Definition: cy_crypto_core_hw.c:459

## ◆ Cy_Crypto_Core_Disable()

cy_en_crypto_status_t Cy_Crypto_Core_Disable | ( | CRYPTO_Type * | base | ) |

Disables the operation of the CRYPTO block.

Parameters

  base | The pointer to the CRYPTO instance.

Returns
  cy_en_crypto_status_t

Function Usage
  /* Check if Crypto IP is enabled */
  if (Cy_Crypto_Core_IsEnabled(CRYPTO_HW)) {
  /* Disable Crypto HW */
  Cy_Crypto_Core_Disable(CRYPTO_HW);
  /* Clear whole register file */
  Cy_Crypto_Core_ClearVuRegisters(CRYPTO_HW);
  }
  Cy_Crypto_Core_ClearVuRegisters
  void Cy_Crypto_Core_ClearVuRegisters(CRYPTO_Type *base)
  The function to initialize the Crypto VU registers.
  Definition: cy_crypto_core_hw.c:178
  Cy_Crypto_Core_Disable
  cy_en_crypto_status_t Cy_Crypto_Core_Disable(CRYPTO_Type *base)
  Disables the operation of the CRYPTO block.
  Definition: cy_crypto_core_hw.c:551
  Cy_Crypto_Core_IsEnabled
  __STATIC_INLINE bool Cy_Crypto_Core_IsEnabled(CRYPTO_Type *base)
  The function checks whether the Crypto hardware is enabled.
  Definition: cy_crypto_core_hw.h:810

## ◆ Cy_Crypto_Core_Cleanup()

cy_en_crypto_status_t Cy_Crypto_Core_Cleanup | ( | CRYPTO_Type * | base | ) |

Cleans up the Crypto block.

Parameters

  base | The pointer to the CRYPTO instance.

Returns
  cy_en_crypto_status_t

## ◆ Cy_Crypto_Core_Shutdown()

cy_en_crypto_status_t Cy_Crypto_Core_Shutdown | ( | CRYPTO_Type * | base | ) |

Cleans up the Crypto block, disable it and reset all crypto registers.

Parameters

  base | The pointer to the CRYPTO instance.

Returns
  cy_en_crypto_status_t

## ◆ Cy_Crypto_Core_GetLibInfo()

cy_en_crypto_status_t Cy_Crypto_Core_GetLibInfo | ( | cy_en_crypto_lib_info_t * | libInfo | ) |

Get Crypto service information.

Parameters

  libInfo | The pointer to a variable to store gathered crypto library information.

Returns
  cy_en_crypto_status_t

## ◆ Cy_Crypto_Core_SetVuMemoryAddress()

cy_en_crypto_status_t Cy_Crypto_Core_SetVuMemoryAddress | ( | CRYPTO_Type * | base,
|  | uint32_t const * | vuMemoryAddr,
|  | uint32_t | vuMemorySize
| ) |  |

Sets the new memory buffer address and size.

Parameters

  base | The pointer to the CRYPTO instance.
  vuMemoryAddr | The memory buffer location that will be used as Crypto MEM_BUFF and it should be aligned to the vuMemorySize
  vuMemorySize | The provided memory buffer size in bytes.

Returns
  cy_en_crypto_status_t

Note
  This function sets the default device specific values when vuMemoryAddr parameter is NULL and vuMemorySize parameter is zero.
  New memory buffer should be allocated in a memory region that is not protected by a protection scheme for use by Crypto hardware.

## ◆ Cy_Crypto_Core_GetVuMemoryAddress()

__STATIC_INLINE uint32_t * Cy_Crypto_Core_GetVuMemoryAddress | ( | CRYPTO_Type * | base | ) |

Gets Crypto memory buffer address.

Parameters

  base | The pointer to the CRYPTO instance.

Returns
  Current Crypto MEM_BUFF location address or NULL if Crypto IP is not enabled.

## ◆ Cy_Crypto_Core_GetVuMemorySize()

uint32_t Cy_Crypto_Core_GetVuMemorySize | ( | CRYPTO_Type * | base | ) |

Get Crypto memory buffer size.

Parameters

  base | The pointer to the CRYPTO instance.

Returns
  The current MEM_BUFF size in bytes.

## ◆ Cy_Crypto_Core_InvertEndianness()

void Cy_Crypto_Core_InvertEndianness | ( | void * | inArrPtr,
|  | uint32_t | byteSize
| ) |  |

This function reverts byte-array memory block, like:
inArr[0] <—> inArr[n]
inArr[1] <—> inArr[n-1]
inArr[2] <—> inArr[n-2]
........................
inArr[n/2] <—> inArr[n/2-1]

Odd or even byteSize are acceptable.

Parameters

  inArrPtr | The pointer to the memory whose endianness is to be inverted.
  byteSize | The length of the memory array whose endianness is to be inverted (in bytes)

## ◆ Cy_Crypto_Core_IsEnabled()

__STATIC_INLINE bool Cy_Crypto_Core_IsEnabled | ( | CRYPTO_Type * | base | ) |

The function checks whether the Crypto hardware is enabled.

Parameters

  base | The pointer to the CRYPTO instance.

Returns
  Crypto status cy_en_crypto_status_t

Function Usage
  /* Check if Crypto IP is enabled */
  if (Cy_Crypto_Core_IsEnabled(CRYPTO_HW)) {
  /* Disable Crypto HW */
  Cy_Crypto_Core_Disable(CRYPTO_HW);
  /* Clear whole register file */
  Cy_Crypto_Core_ClearVuRegisters(CRYPTO_HW);
  }

## ◆ Cy_Crypto_Core_GetFIFODepth()

__STATIC_INLINE uint8_t Cy_Crypto_Core_GetFIFODepth | ( | CRYPTO_Type * | base | ) |

Returns the total available number of instructions in the instruction FIFO.

Parameters

  base | The pointer to the CRYPTO instance.

## ◆ Cy_Crypto_Core_GetFIFOUsed()

__STATIC_INLINE uint8_t Cy_Crypto_Core_GetFIFOUsed | ( | CRYPTO_Type * | base | ) |

Returns the number of instructions in the instruction FIFO.

The value of this field ranges from 0 to 8

Parameters

  base | The pointer to the CRYPTO instance.

## ◆ Cy_Crypto_Core_WaitForInstrFifoAvailable()

__STATIC_INLINE void Cy_Crypto_Core_WaitForInstrFifoAvailable | ( | CRYPTO_Type * | base,
|  | uint32_t | instr
| ) |  |

Waits until number of entries in the instruction FIFO is less than specified number.

Parameters

  base | The pointer to the CRYPTO instance.
  instr | The number of needed available space in the instruction FIFO.

## ◆ Cy_Crypto_Core_WaitForFifoAvailable()

__STATIC_INLINE void Cy_Crypto_Core_WaitForFifoAvailable | ( | CRYPTO_Type * | base | ) |

Waits until number of entries in the instruction FIFO is less than specified in EVENT_LEVEL field in FF_CTL register, an event is generated: "event" = INSTR_FF_STATUS.USED < EVENT_LEVEL.

By default EVENT_LEVEL = 0;

Parameters

  base | The pointer to the CRYPTO instance.

## ◆ Cy_Crypto_Core_WaitForReady()

__STATIC_INLINE void Cy_Crypto_Core_WaitForReady | ( | CRYPTO_Type * | base | ) |

Waits until all instruction in FIFO will be completed.

Parameters

  base | The pointer to the CRYPTO instance.

## ◆ Cy_Crypto_Core_Vu_WaitForComplete()

__STATIC_INLINE void Cy_Crypto_Core_Vu_WaitForComplete | ( | CRYPTO_Type * | base | ) |

Waits until VU instruction will be completed.

Parameters

  base | The pointer to the CRYPTO instance.

## ◆ Cy_Crypto_Core_SetInterruptMask()

__STATIC_INLINE void Cy_Crypto_Core_SetInterruptMask | ( | CRYPTO_Type * | base,
|  | uint32_t | interrupts
| ) |  |

Masks / unmasks multiple interrupt sources.

Parameters

  base | The pointer to the CRYPTO instance.
  interrupts | Mask bits. See definitions above.

## ◆ Cy_Crypto_Core_GetInterruptMask()

__STATIC_INLINE uint32_t Cy_Crypto_Core_GetInterruptMask | ( | CRYPTO_Type const * | base | ) |

Reports mask / unmask multiple interrupt sources.

Parameters

  base | The pointer to the CRYPTO instance.

Returns
  Mask bits. See definitions above.

## ◆ Cy_Crypto_Core_GetInterruptStatusMasked()

__STATIC_INLINE uint32_t Cy_Crypto_Core_GetInterruptStatusMasked | ( | CRYPTO_Type const * | base | ) |

Reports states of multiple enabled interrupt sources.

Parameters

  base | The pointer to the CRYPTO instance.

Returns
  Source bits. See definitions above.

## ◆ Cy_Crypto_Core_GetInterruptStatus()

__STATIC_INLINE uint32_t Cy_Crypto_Core_GetInterruptStatus | ( | CRYPTO_Type * | base | ) |

Reports states of multiple interrupt sources.

Parameters

  base | The pointer to the CRYPTO instance.

Returns
  Source bits. See definitions above.

## ◆ Cy_Crypto_Core_SetInterrupt()

__STATIC_INLINE void Cy_Crypto_Core_SetInterrupt | ( | CRYPTO_Type * | base,
|  | uint32_t | interrupts
| ) |  |

Sets one of more interrupt sources.

Parameters

  base | The pointer to the CRYPTO instance.
  interrupts | Source bit(s)

## ◆ Cy_Crypto_Core_ClearInterrupt()

__STATIC_INLINE void Cy_Crypto_Core_ClearInterrupt | ( | CRYPTO_Type * | base,
|  | uint32_t | interrupts
| ) |  |

Clears multiple interrupt sources.

Parameters

  base | The pointer to the CRYPTO instance.
  interrupts | Source bit(s). See definitions above.

## ◆ Cy_Crypto_Core_ClearVuRegisters()

void Cy_Crypto_Core_ClearVuRegisters | ( | CRYPTO_Type * | base | ) |

The function to initialize the Crypto VU registers.

Parameters

  base | The pointer to the CRYPTO instance.