CMSIS-Driver_PIC32CZ-MC70  
Peripheral Library (PLIB) Documentation
 
Loading...
Searching...
No Matches
ICM Peripheral Library API

Data Structures

struct  ICM_REGION_CONFIG_T
 ICM region configuration structure. More...
 
struct  ICM_REGION_DESCRIPTOR_T
 ICM Region Descriptor structure in system memory. More...
 
struct  ICM_ERROR_STATUS_T
 ICM error status structure. More...
 

Macros

#define ICM_RCFG_ALGO_Pos   _UINT32_(12)
 
#define ICM_RCFG_ALGO_Msk   (_UINT32_(0x7) << ICM_RCFG_ALGO_Pos)
 
#define ICM_RCFG_ALGO(value)   (ICM_RCFG_ALGO_Msk & (_UINT32_(value) << ICM_RCFG_ALGO_Pos))
 
#define ICM_RCFG_ALGO_SHA1_Val   _UINT32_(0x0)
 
#define ICM_RCFG_ALGO_SHA256_Val   _UINT32_(0x1)
 
#define ICM_RCFG_PROCDLY_Pos   _UINT32_(10)
 
#define ICM_RCFG_PROCDLY_Msk   (_UINT32_(0x1) << ICM_RCFG_PROCDLY_Pos)
 
#define ICM_RCFG_SUIEN_Pos   _UINT32_(9)
 
#define ICM_RCFG_SUIEN_Msk   (_UINT32_(0x1) << ICM_RCFG_SUIEN_Pos)
 
#define ICM_RCFG_ECIEN_Pos   _UINT32_(8)
 
#define ICM_RCFG_ECIEN_Msk   (_UINT32_(0x1) << ICM_RCFG_ECIEN_Pos)
 
#define ICM_RCFG_WCIEN_Pos   _UINT32_(7)
 
#define ICM_RCFG_WCIEN_Msk   (_UINT32_(0x1) << ICM_RCFG_WCIEN_Pos)
 
#define ICM_RCFG_BEIEN_Pos   _UINT32_(6)
 
#define ICM_RCFG_BEIEN_Msk   (_UINT32_(0x1) << ICM_RCFG_BEIEN_Pos)
 
#define ICM_RCFG_DMIEN_Pos   _UINT32_(5)
 
#define ICM_RCFG_DMIEN_Msk   (_UINT32_(0x1) << ICM_RCFG_DMIEN_Pos)
 
#define ICM_RCFG_RHIEN_Pos   _UINT32_(4)
 
#define ICM_RCFG_RHIEN_Msk   (_UINT32_(0x1) << ICM_RCFG_RHIEN_Pos)
 
#define ICM_RCFG_EOM_Pos   _UINT32_(2)
 
#define ICM_RCFG_EOM_Msk   (_UINT32_(0x1) << ICM_RCFG_EOM_Pos)
 
#define ICM_RCFG_WRAP_Pos   _UINT32_(1)
 
#define ICM_RCFG_WRAP_Msk   (_UINT32_(0x1) << ICM_RCFG_WRAP_Pos)
 
#define ICM_RCFG_CDWBN_Pos   _UINT32_(0)
 
#define ICM_RCFG_CDWBN_Msk   (_UINT32_(0x1) << ICM_RCFG_CDWBN_Pos)
 
#define ICM_RCTRL_TRSIZE_Pos   _UINT32_(0)
 
#define ICM_RCTRL_TRSIZE_Msk   (_UINT32_(0xFFFF) << ICM_RCTRL_TRSIZE_Pos)
 
#define ICM_RCTRL_TRSIZE(value)   (ICM_RCTRL_TRSIZE_Msk & (_UINT32_(value) << ICM_RCTRL_TRSIZE_Pos))
 
#define ICM_INTERRUPT_URAD   (0U)
 ICM interrupt source definitions.
 
#define ICM_INTERRUPT_RSU   (1U)
 
#define ICM_INTERRUPT_REC   (2U)
 
#define ICM_INTERRUPT_RWC   (3U)
 
#define ICM_INTERRUPT_RBE   (4U)
 
#define ICM_INTERRUPT_RDM   (5U)
 
#define ICM_INTERRUPT_RHC   (6U)
 
#define ICM_REGIONS_NUM   (4U)
 Maximum number of memory regions supported by ICM peripheral.
 

Typedefs

typedef void(* IcmCallback_t) (uint32_t status, const void *context)
 ICM callback function type.
 

Functions

void ICM_SetGlobalConfig (uint32_t cfgBits)
 Write the ICM global configuration register (ICM_CFG).
 
uint32_t ICM_GetGlobalConfig (void)
 Read the ICM global configuration register (ICM_CFG).
 
bool ICM_SetDescriptorAddress (uint32_t address)
 Set the region descriptor area base address (ICM_DSCR).
 
uint32_t ICM_GetDescriptorAddress (void)
 Get the region descriptor area base address (ICM_DSCR).
 
bool ICM_SetHashAddress (uint32_t address)
 Set the hash area base address (ICM_HASH).
 
uint32_t ICM_GetHashAddress (void)
 Get the hash area base address (ICM_HASH).
 
void ICM_Enable (void)
 Enable the ICM peripheral.
 
void ICM_Disable (void)
 Disable the ICM peripheral.
 
void ICM_ResetSoftware (void)
 Perform a software reset of the ICM peripheral.
 
bool ICM_ConfigureRegion (uint8_t regionIndex, const ICM_REGION_CONFIG_T *regionConfig)
 Configure a region descriptor for monitoring.
 
bool ICM_EnableRegionMonitoring (uint8_t regionIndex)
 Enable monitoring for a specified region.
 
bool ICM_DisableRegionMonitoring (uint8_t regionIndex)
 Disable monitoring for a specified region.
 
bool ICM_RehashRegion (uint8_t regionIndex)
 Recompute the internal hash for a region.
 
void ICM_SetCallbackHandler (IcmCallback_t callback, const void *context)
 Register a callback function for ICM events.
 
void ICM_EnableInterrupt (uint8_t source, uint8_t regionIndex)
 Enable a specified ICM interrupt source.
 
void ICM_DisableInterrupt (uint8_t source, uint8_t regionIndex)
 Disable a specified ICM interrupt source.
 
ICM_ERROR_STATUS_T ICM_GetErrorStatus (uint8_t regionIndex)
 Get error and event status for a region.
 
void ICM_Shutdown (void)
 Disable and reset the ICM peripheral.
 
void ICM_Handler (void)
 ICM peripheral interrupt handler.
 

Description

Macro Definition Documentation

◆ ICM_INTERRUPT_RBE

#define ICM_INTERRUPT_RBE   (4U)

Region Bus Error

◆ ICM_INTERRUPT_RDM

#define ICM_INTERRUPT_RDM   (5U)

Region Digest Mismatch

◆ ICM_INTERRUPT_REC

#define ICM_INTERRUPT_REC   (2U)

Region End Bit Condition

◆ ICM_INTERRUPT_RHC

#define ICM_INTERRUPT_RHC   (6U)

Region Hash Completed

◆ ICM_INTERRUPT_RSU

#define ICM_INTERRUPT_RSU   (1U)

Region Status Updated

◆ ICM_INTERRUPT_RWC

#define ICM_INTERRUPT_RWC   (3U)

Region Wrap Condition

◆ ICM_INTERRUPT_URAD

#define ICM_INTERRUPT_URAD   (0U)

ICM interrupt source definitions.

Undefined Register Access

◆ ICM_RCFG_ALGO

#define ICM_RCFG_ALGO ( value)    (ICM_RCFG_ALGO_Msk & (_UINT32_(value) << ICM_RCFG_ALGO_Pos))

Assignment of value for ALGO in the ICM_RCFG descriptor word

◆ ICM_RCFG_ALGO_Msk

#define ICM_RCFG_ALGO_Msk   (_UINT32_(0x7) << ICM_RCFG_ALGO_Pos)

(ICM_RCFG) SHA Algorithm Mask

◆ ICM_RCFG_ALGO_Pos

#define ICM_RCFG_ALGO_Pos   _UINT32_(12)

(ICM_RCFG) SHA Algorithm Position

◆ ICM_RCFG_ALGO_SHA1_Val

#define ICM_RCFG_ALGO_SHA1_Val   _UINT32_(0x0)

(ICM_RCFG) SHA1 algorithm processed

◆ ICM_RCFG_ALGO_SHA256_Val

#define ICM_RCFG_ALGO_SHA256_Val   _UINT32_(0x1)

(ICM_RCFG) SHA256 algorithm processed

◆ ICM_RCFG_BEIEN_Msk

#define ICM_RCFG_BEIEN_Msk   (_UINT32_(0x1) << ICM_RCFG_BEIEN_Pos)

(ICM_RCFG) Bus Error Interrupt Disable Mask

◆ ICM_RCFG_BEIEN_Pos

#define ICM_RCFG_BEIEN_Pos   _UINT32_(6)

(ICM_RCFG) Bus Error Interrupt Disable Position

◆ ICM_RCFG_CDWBN_Msk

#define ICM_RCFG_CDWBN_Msk   (_UINT32_(0x1) << ICM_RCFG_CDWBN_Pos)

(ICM_RCFG) Compare Digest or Write Back Digest Mask

◆ ICM_RCFG_CDWBN_Pos

#define ICM_RCFG_CDWBN_Pos   _UINT32_(0)

(ICM_RCFG) Compare Digest or Write Back Digest Position

◆ ICM_RCFG_DMIEN_Msk

#define ICM_RCFG_DMIEN_Msk   (_UINT32_(0x1) << ICM_RCFG_DMIEN_Pos)

(ICM_RCFG) Digest Mismatch Interrupt Disable Mask

◆ ICM_RCFG_DMIEN_Pos

#define ICM_RCFG_DMIEN_Pos   _UINT32_(5)

(ICM_RCFG) Digest Mismatch Interrupt Disable Position

◆ ICM_RCFG_ECIEN_Msk

#define ICM_RCFG_ECIEN_Msk   (_UINT32_(0x1) << ICM_RCFG_ECIEN_Pos)

(ICM_RCFG) End Bit Condition Interrupt Disable Mask

◆ ICM_RCFG_ECIEN_Pos

#define ICM_RCFG_ECIEN_Pos   _UINT32_(8)

(ICM_RCFG) End Bit Condition Interrupt Disable Position

◆ ICM_RCFG_EOM_Msk

#define ICM_RCFG_EOM_Msk   (_UINT32_(0x1) << ICM_RCFG_EOM_Pos)

(ICM_RCFG) End Of Monitoring Mask

◆ ICM_RCFG_EOM_Pos

#define ICM_RCFG_EOM_Pos   _UINT32_(2)

(ICM_RCFG) End Of Monitoring Position

◆ ICM_RCFG_PROCDLY_Msk

#define ICM_RCFG_PROCDLY_Msk   (_UINT32_(0x1) << ICM_RCFG_PROCDLY_Pos)

(ICM_RCFG) Processing Delay Mask

◆ ICM_RCFG_PROCDLY_Pos

#define ICM_RCFG_PROCDLY_Pos   _UINT32_(10)

(ICM_RCFG) Processing Delay Position

◆ ICM_RCFG_RHIEN_Msk

#define ICM_RCFG_RHIEN_Msk   (_UINT32_(0x1) << ICM_RCFG_RHIEN_Pos)

(ICM_RCFG) Region Hash Completed Interrupt Disable Mask

◆ ICM_RCFG_RHIEN_Pos

#define ICM_RCFG_RHIEN_Pos   _UINT32_(4)

(ICM_RCFG) Region Hash Completed Interrupt Disable Position

◆ ICM_RCFG_SUIEN_Msk

#define ICM_RCFG_SUIEN_Msk   (_UINT32_(0x1) << ICM_RCFG_SUIEN_Pos)

(ICM_RCFG) Status Updated Interrupt Disable Mask

◆ ICM_RCFG_SUIEN_Pos

#define ICM_RCFG_SUIEN_Pos   _UINT32_(9)

(ICM_RCFG) Status Updated Interrupt Disable Position

◆ ICM_RCFG_WCIEN_Msk

#define ICM_RCFG_WCIEN_Msk   (_UINT32_(0x1) << ICM_RCFG_WCIEN_Pos)

(ICM_RCFG) Wrap Condition Interrupt Disable Mask

◆ ICM_RCFG_WCIEN_Pos

#define ICM_RCFG_WCIEN_Pos   _UINT32_(7)

(ICM_RCFG) Wrap Condition Interrupt Disable Position

◆ ICM_RCFG_WRAP_Msk

#define ICM_RCFG_WRAP_Msk   (_UINT32_(0x1) << ICM_RCFG_WRAP_Pos)

(ICM_RCFG) Wrap Command Mask

◆ ICM_RCFG_WRAP_Pos

#define ICM_RCFG_WRAP_Pos   _UINT32_(1)

(ICM_RCFG) Wrap Command Position

◆ ICM_RCTRL_TRSIZE

#define ICM_RCTRL_TRSIZE ( value)    (ICM_RCTRL_TRSIZE_Msk & (_UINT32_(value) << ICM_RCTRL_TRSIZE_Pos))

Assignment of value for TRSIZE in the ICM_RCTRL descriptor word

◆ ICM_RCTRL_TRSIZE_Msk

#define ICM_RCTRL_TRSIZE_Msk   (_UINT32_(0xFFFF) << ICM_RCTRL_TRSIZE_Pos)

(ICM_RCTRL) Transfer Size Mask

◆ ICM_RCTRL_TRSIZE_Pos

#define ICM_RCTRL_TRSIZE_Pos   _UINT32_(0)

(ICM_RCTRL) Transfer Size Position

◆ ICM_REGIONS_NUM

#define ICM_REGIONS_NUM   (4U)

Maximum number of memory regions supported by ICM peripheral.

The ICM can monitor up to 4 non-contiguous memory regions simultaneously. Valid region indices: 0 to 3.

Note
From datasheet Section 54.2: "up to 4 Non-Contiguous Memory Regions"

Typedef Documentation

◆ IcmCallback_t

typedef void(* IcmCallback_t) (uint32_t status, const void *context)

ICM callback function type.

Parameters
statusEvent status flags (ICM_ISR value)
contextUser context pointer

Function Documentation

◆ ICM_ConfigureRegion()

bool ICM_ConfigureRegion ( uint8_t regionIndex,
const ICM_REGION_CONFIG_T * regionConfig )

Configure a region descriptor for monitoring.

Parameters
regionIndexRegion number (0..N-1)
regionConfigPointer to region configuration structure
Returns
true if successful, false if regionConfig is NULL or regionIndex is out of range

◆ ICM_Disable()

void ICM_Disable ( void )

Disable the ICM peripheral.

◆ ICM_DisableInterrupt()

void ICM_DisableInterrupt ( uint8_t source,
uint8_t regionIndex )

Disable a specified ICM interrupt source.

Parameters
sourceOne of ICM_INTERRUPT_URAD/RSU/REC/RWC/RBE/RDM/RHC
regionIndexRegion number (0..N-1, if applicable)

◆ ICM_DisableRegionMonitoring()

bool ICM_DisableRegionMonitoring ( uint8_t regionIndex)

Disable monitoring for a specified region.

Parameters
regionIndexRegion number (0..N-1)
Returns
true if successful, false if regionIndex is out of range

◆ ICM_Enable()

void ICM_Enable ( void )

Enable the ICM peripheral.

◆ ICM_EnableInterrupt()

void ICM_EnableInterrupt ( uint8_t source,
uint8_t regionIndex )

Enable a specified ICM interrupt source.

Parameters
sourceOne of ICM_INTERRUPT_URAD/RSU/REC/RWC/RBE/RDM/RHC
regionIndexRegion number (0..N-1, if applicable)

◆ ICM_EnableRegionMonitoring()

bool ICM_EnableRegionMonitoring ( uint8_t regionIndex)

Enable monitoring for a specified region.

Parameters
regionIndexRegion number (0..N-1)
Returns
true if successful, false if regionIndex is out of range

◆ ICM_GetDescriptorAddress()

uint32_t ICM_GetDescriptorAddress ( void )

Get the region descriptor area base address (ICM_DSCR).

Returns
Current descriptor area base address.

◆ ICM_GetErrorStatus()

ICM_ERROR_STATUS_T ICM_GetErrorStatus ( uint8_t regionIndex)

Get error and event status for a region.

Parameters
regionIndexRegion number (0..N-1)
Returns
Error status structure
Note
The underlying ICM_ISR register is clear-on-read: any read of it clears the flags for ALL regions, not just regionIndex. This function and ICM_Handler() both read through a shared internal snapshot so that calling this for one region does not discard pending flags for other regions or for the interrupt handler. URAD is a global (not per-region) flag and is consumed on whichever call observes it first, regardless of regionIndex.
Unlike every other ICM_ISR bit, URAD/URAT are NOT clear-on-read: per the datasheet they remain latched in hardware until ICM_CTRL.SWRST. Once observed, status.urad will keep reporting true on every subsequent call - even after this function has consumed it out of the internal snapshot - until ICM_ResetSoftware() is called. See also the ICM_Handler() note about the URAD interrupt source.

◆ ICM_GetGlobalConfig()

uint32_t ICM_GetGlobalConfig ( void )

Read the ICM global configuration register (ICM_CFG).

Returns
Current ICM_CFG register value.

◆ ICM_GetHashAddress()

uint32_t ICM_GetHashAddress ( void )

Get the hash area base address (ICM_HASH).

Returns
Current hash area base address.

◆ ICM_Handler()

void ICM_Handler ( void )

ICM peripheral interrupt handler.

Note
Reads the clear-on-read ICM_ISR register and merges it into the shared status snapshot also consumed by ICM_GetErrorStatus(), so that servicing an interrupt does not discard flags a polling caller has not yet observed.
URAD/URAT are latched in hardware until a full ICM_CTRL.SWRST (see ICM_GetErrorStatus() note), so leaving the URAD interrupt source enabled would re-trigger this handler indefinitely once tripped. To prevent that storm, this handler disables the URAD interrupt source (ICM_DisableInterrupt(ICM_INTERRUPT_URAD, ...)) the first time it observes URAD set. The application is responsible for calling ICM_ResetSoftware() (or otherwise reconfiguring) and then re-enabling ICM_INTERRUPT_URAD via ICM_EnableInterrupt() before another undefined access can be reported.

◆ ICM_RehashRegion()

bool ICM_RehashRegion ( uint8_t regionIndex)

Recompute the internal hash for a region.

Parameters
regionIndexRegion number (0..N-1)
Returns
true if successful, false if regionIndex is out of range

◆ ICM_ResetSoftware()

void ICM_ResetSoftware ( void )

Perform a software reset of the ICM peripheral.

Note
This clears the internal event-status cache shared with ICM_GetErrorStatus()/ICM_Handler(). If the ICM interrupt (ICM_IRQn) is already enabled at the NVIC when this is called, a pending event latched by ICM_Handler() at the same time could be discarded by this reset. If that race matters for your use case, call NVIC_DisableIRQ(ICM_IRQn) before this function and NVIC_EnableIRQ(ICM_IRQn) after, from the application/config layer - this function intentionally does not touch NVIC enable state itself.

◆ ICM_SetCallbackHandler()

void ICM_SetCallbackHandler ( IcmCallback_t callback,
const void * context )

Register a callback function for ICM events.

Parameters
callbackUser callback function pointer
contextUser context pointer

◆ ICM_SetDescriptorAddress()

bool ICM_SetDescriptorAddress ( uint32_t address)

Set the region descriptor area base address (ICM_DSCR).

Parameters
addressDescriptor area base address; must be 64-byte aligned.
Returns
true if successful, false if address is not 64-byte aligned.
Note
Per datasheet Section 54.5.7, modifying ICM_DSCR while the ICM is actively monitoring is an undefined register access and sets ICM_ISR.URAD. Call this only while the ICM is disabled (before ICM_Enable() or after ICM_Disable()/ICM_Shutdown()).

◆ ICM_SetGlobalConfig()

void ICM_SetGlobalConfig ( uint32_t cfgBits)

Write the ICM global configuration register (ICM_CFG).

Parameters
cfgBitsPre-combined ICM_CFG_*_Msk/ICM_CFG_*() bits.
Note
Per datasheet Section 54.5.7, modifying ICM_CFG while the ICM is actively monitoring is an undefined register access and sets ICM_ISR.URAD. Call this only while the ICM is disabled (before ICM_Enable() or after ICM_Disable()/ICM_Shutdown()).

◆ ICM_SetHashAddress()

bool ICM_SetHashAddress ( uint32_t address)

Set the hash area base address (ICM_HASH).

Parameters
addressHash area base address; must be 128-byte aligned.
Returns
true if successful, false if address is not 128-byte aligned.
Note
Per datasheet Section 54.5.7, modifying ICM_HASH while the ICM is actively monitoring is an undefined register access and sets ICM_ISR.URAD. Call this only while the ICM is disabled (before ICM_Enable() or after ICM_Disable()/ICM_Shutdown()).

◆ ICM_Shutdown()

void ICM_Shutdown ( void )

Disable and reset the ICM peripheral.