Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Integrity Check Monitor Controller (ICM)

This is a driver for configuring, enabling/disabling and use of the on-chip ICM.

Dependencies

The ICM module depends on the following modules:

Modules

 
 Quick Start Guide(s)
 In this section you can find a list of all Quick Start guides related to the Integrity Check Monitor Controller (ICM).
 

Data Structures

struct  icm_config
 Basic configuration for ICM. More...
 
struct  icm_region_descriptor_main_list
 ICM region descriptor in main list. More...
 
struct  icm_region_descriptor_sec_list
 ICM region descriptor in secondary list. More...
 

Typedefs

typedef void(* icm_callback_t )(uint8_t)
 Interrupt event callback function type. More...
 

Enumerations

enum  icm_algo {
  ICM_SHA_1 = 0,
  ICM_SHA_224 = 4,
  ICM_SHA_256 = 1
}
 The SHA Algorithm definition. More...
 
enum  icm_interrupt_source {
  ICM_INTERRUPT_RHC = 0,
  ICM_INTERRUPT_RDM,
  ICM_INTERRUPT_RBE,
  ICM_INTERRUPT_RWC,
  ICM_INTERRUPT_REC,
  ICM_INTERRUPT_RSU,
  ICM_INTERRUPT_URAD,
  _ICM_NUM_OF_INTERRUPT_SOURCE,
  ICM_INTERRUPT_ALL = 0x1FFFFFFF
}
 ICM interrupt source type. More...
 
enum  icm_region_num {
  ICM_REGION_NUM_0 = 0,
  ICM_REGION_NUM_1,
  ICM_REGION_NUM_2,
  ICM_REGION_NUM_3,
  _ICM_NUM_OF_REGION
}
 The region number definition. More...
 

Functions

void icm_disable (Icm *p_icm)
 Disable ICM. More...
 
static void icm_disable_interrupt (Icm *p_icm, uint32_t ul_sources)
 ICM disable interrupt. More...
 
void icm_enable (Icm *p_icm)
 Enable ICM. More...
 
static void icm_enable_interrupt (Icm *p_icm, uint32_t ul_sources)
 ICM enable interrupt. More...
 
static uint32_t icm_get_interrupt_mask (Icm *p_icm)
 Get ICM interrupt mask. More...
 
static uint32_t icm_get_interrupt_status (Icm *p_icm)
 Get ICM interrupt status. More...
 
static uint32_t icm_get_status (Icm *p_icm)
 Get the ICM status. More...
 
static uint32_t icm_get_urat (Icm *p_icm)
 Get ICM Undefined Register Access Trace. More...
 
void icm_init (Icm *p_icm, struct icm_config *icm_cfg)
 Initialize ICM with specified configuration. More...
 
static void icm_region_disable_monitor (Icm *p_icm, enum icm_region_num reg_num)
 Disable Region Monitoring. More...
 
static void icm_region_enable_monitor (Icm *p_icm, enum icm_region_num reg_num)
 Enable Region Monitoring. More...
 
status_code_t icm_region_recompute_hash (Icm *p_icm, enum icm_region_num reg_num)
 Recompute internal hash. More...
 
static void icm_reset (Icm *p_icm)
 Reset ICM. More...
 
void icm_set_algo (Icm *p_icm, enum icm_algo algo)
 Set hash algorithm. More...
 
void icm_set_callback (Icm *p_icm, icm_callback_t callback, enum icm_region_num reg_num, enum icm_interrupt_source interrupt_source, uint8_t irq_level)
 ICM interrupt callback function. More...
 
static void icm_set_hash_area_addr (Icm *p_icm, uint32_t addr)
 Set Hash Area Start Address. More...
 
void icm_set_hash_value (Icm *p_icm, uint32_t *p_value)
 Set Initial Hash Value. More...
 
static void icm_set_reg_des_addr (Icm *p_icm, uint32_t addr)
 Set Descriptor Area Start Address. More...
 
icm_callback_t icm_callback_pointer [_ICM_NUM_OF_INTERRUPT_SOURCE]
 ICM callback function pointer. More...
 
static void icm_interrupt (enum icm_interrupt_source source, enum icm_region_num reg_num)
 Common ICM interrupt handler. More...
 
void ICM_Handler (void)
 Interrupt handler for ICM. More...
 

typedef void(* icm_callback_t)(uint8_t)

Interrupt event callback function type.

The interrupt handler can be configured to do a function callback, the callback function must match the icm_callback_t type.

enum icm_algo

The SHA Algorithm definition.

Enumerator
ICM_SHA_1 
ICM_SHA_224 
ICM_SHA_256 

ICM interrupt source type.

Enumerator
ICM_INTERRUPT_RHC 
ICM_INTERRUPT_RDM 
ICM_INTERRUPT_RBE 
ICM_INTERRUPT_RWC 
ICM_INTERRUPT_REC 
ICM_INTERRUPT_RSU 
ICM_INTERRUPT_URAD 
_ICM_NUM_OF_INTERRUPT_SOURCE 
ICM_INTERRUPT_ALL 

The region number definition.

Enumerator
ICM_REGION_NUM_0 
ICM_REGION_NUM_1 
ICM_REGION_NUM_2 
ICM_REGION_NUM_3 
_ICM_NUM_OF_REGION 

void icm_disable ( Icm *  p_icm)

Disable ICM.

Parameters
p_icmPointer to an ICM instance.

References SLEEPMGR_SLEEP_WFI, and sleepmgr_unlock_mode().

static void icm_disable_interrupt ( Icm *  p_icm,
uint32_t  ul_sources 
)
inlinestatic

ICM disable interrupt.

Parameters
p_icmPointer to an ICM instance.
ul_sourcesInterrupt sources to be disabled.
void icm_enable ( Icm *  p_icm)

Enable ICM.

Parameters
p_icmPointer to an ICM instance.

References sleepmgr_lock_mode(), and SLEEPMGR_SLEEP_WFI.

Referenced by main(), and run_icm_test().

static void icm_enable_interrupt ( Icm *  p_icm,
uint32_t  ul_sources 
)
inlinestatic

ICM enable interrupt.

Parameters
p_icmPointer to an ICM instance.
ul_sourcesInterrupt sources to be enabled.

Referenced by icm_set_callback().

static uint32_t icm_get_interrupt_mask ( Icm *  p_icm)
inlinestatic

Get ICM interrupt mask.

Parameters
p_icmPointer to an ICM instance.
Returns
The interrupt mask value.

Referenced by ICM_Handler().

static uint32_t icm_get_interrupt_status ( Icm *  p_icm)
inlinestatic

Get ICM interrupt status.

Parameters
p_icmPointer to an ICM instance.
Returns
The interrupt status value.

Referenced by ICM_Handler().

static uint32_t icm_get_status ( Icm *  p_icm)
inlinestatic

Get the ICM status.

Parameters
p_icmPointer to an ICM instance.
Returns
return bit OR of the ICM status register.

Referenced by icm_region_recompute_hash().

static uint32_t icm_get_urat ( Icm *  p_icm)
inlinestatic

Get ICM Undefined Register Access Trace.

Parameters
p_icmPointer to an ICM instance.
Returns
The trace value.
void icm_init ( Icm *  p_icm,
struct icm_config icm_cfg 
)
static void icm_interrupt ( enum icm_interrupt_source  source,
enum icm_region_num  reg_num 
)
static

Common ICM interrupt handler.

The optional callback used by the interrupt handler is set by the icm_set_callback() function.

Parameters
sourceInterrupt source number

References icm_callback_pointer.

Referenced by ICM_Handler().

static void icm_region_disable_monitor ( Icm *  p_icm,
enum icm_region_num  reg_num 
)
inlinestatic

Disable Region Monitoring.

Parameters
p_icmPointer to an ICM instance.
reg_numThe region number(0 ~ 3)
static void icm_region_enable_monitor ( Icm *  p_icm,
enum icm_region_num  reg_num 
)
inlinestatic

Enable Region Monitoring.

Parameters
p_icmPointer to an ICM instance.
reg_numThe region number(0 ~ 3)
status_code_t icm_region_recompute_hash ( Icm *  p_icm,
enum icm_region_num  reg_num 
)

Recompute internal hash.

This function is available only when Region monitoring is disabled.

Parameters
p_icmPointer to an ICM instance.
reg_numThe region number(0 ~ 3)

References icm_get_status(), STATUS_ERR_DENIED, and STATUS_OK.

static void icm_reset ( Icm *  p_icm)
inlinestatic

Reset ICM.

Parameters
p_icmPointer to an ICM instance.

Referenced by icm_init().

void icm_set_algo ( Icm *  p_icm,
enum icm_algo  algo 
)

Set hash algorithm.

Parameters
p_icmPointer to an ICM instance.
algoThe hash algorithm type.

References ICM_SHA_1, ICM_SHA_224, and ICM_SHA_256.

Referenced by icm_init().

void icm_set_callback ( Icm *  p_icm,
icm_callback_t  callback,
enum icm_region_num  reg_num,
enum icm_interrupt_source  interrupt_source,
uint8_t  irq_level 
)

ICM interrupt callback function.

This function allows the caller to set and change the interrupt callback function. Without setting a callback function the interrupt handler in the driver will only clear the interrupt flags.

Parameters
p_icmPointer to an ICM instance.
callbackReference to a callback function.
reg_numThe region number(0 ~ 3)
interrupt_sourceInterrupt source.
irq_levelinterrupt level.

References _ICM_NUM_OF_REGION, Assert, callback, icm_callback_pointer, icm_enable_interrupt(), ICM_INTERRUPT_URAD, and irq_register_handler.

Referenced by main(), and run_icm_test().

static void icm_set_hash_area_addr ( Icm *  p_icm,
uint32_t  addr 
)
inlinestatic

Set Hash Area Start Address.

Parameters
p_icmPointer to an ICM instance.
addrThe start address value

References addr.

Referenced by main(), and run_icm_test().

void icm_set_hash_value ( Icm *  p_icm,
uint32_t *  p_value 
)

Set Initial Hash Value.

Parameters
p_icmPointer to an ICM instance.
p_valueThe hash value array.

References ICM_SHA_1, ICM_SHA_224, and ICM_SHA_256.

static void icm_set_reg_des_addr ( Icm *  p_icm,
uint32_t  addr 
)
inlinestatic

Set Descriptor Area Start Address.

Parameters
p_icmPointer to an ICM instance.
addrThe start address value

References addr.

Referenced by main(), and run_icm_test().

ICM callback function pointer.

Referenced by icm_interrupt(), and icm_set_callback().