This is a driver for configuring, enabling/disabling and use of the on-chip ICM.
The ICM module depends on the following modules:
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 |
enum icm_interrupt_source |
enum icm_region_num |
void icm_disable | ( | Icm * | p_icm | ) |
Disable ICM.
p_icm | Pointer to an ICM instance. |
References SLEEPMGR_SLEEP_WFI, and sleepmgr_unlock_mode().
|
inlinestatic |
ICM disable interrupt.
p_icm | Pointer to an ICM instance. |
ul_sources | Interrupt sources to be disabled. |
void icm_enable | ( | Icm * | p_icm | ) |
Enable ICM.
p_icm | Pointer to an ICM instance. |
References sleepmgr_lock_mode(), and SLEEPMGR_SLEEP_WFI.
Referenced by main().
|
inlinestatic |
ICM enable interrupt.
p_icm | Pointer to an ICM instance. |
ul_sources | Interrupt sources to be enabled. |
Referenced by icm_set_callback().
|
inlinestatic |
Get ICM interrupt mask.
p_icm | Pointer to an ICM instance. |
Referenced by ICM_Handler().
|
inlinestatic |
Get ICM interrupt status.
p_icm | Pointer to an ICM instance. |
Referenced by ICM_Handler().
|
inlinestatic |
Get the ICM status.
p_icm | Pointer to an ICM instance. |
Referenced by icm_region_recompute_hash().
|
inlinestatic |
Get ICM Undefined Register Access Trace.
p_icm | Pointer to an ICM instance. |
void ICM_Handler | ( | void | ) |
Interrupt handler for ICM.
References _ICM_NUM_OF_INTERRUPT_SOURCE, _ICM_NUM_OF_REGION, icm_get_interrupt_mask(), icm_get_interrupt_status(), icm_interrupt(), and ICM_INTERRUPT_URAD.
void icm_init | ( | Icm * | p_icm, |
struct icm_config * | icm_cfg | ||
) |
Initialize ICM with specified configuration.
p_icm | Pointer to an ICM instance. |
icm_cfg | Pointer to ICM Configuration. |
References icm_config::bbc, icm_config::des_area_val, icm_config::hash_area_val, icm_reset(), icm_set_algo(), icm_config::is_auto_mode, icm_config::is_dis_end_mon, icm_config::is_dual_buf, icm_config::is_sec_list_branch, icm_config::is_user_hash, icm_config::is_write_back, sysclk_enable_peripheral_clock(), and icm_config::ualgo.
Referenced by main().
|
static |
Common ICM interrupt handler.
The optional callback used by the interrupt handler is set by the icm_set_callback() function.
source | Interrupt source number |
References icm_callback_pointer.
Referenced by ICM_Handler().
|
inlinestatic |
Disable Region Monitoring.
p_icm | Pointer to an ICM instance. |
reg_num | The region number(0 ~ 3) |
|
inlinestatic |
Enable Region Monitoring.
p_icm | Pointer to an ICM instance. |
reg_num | The 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.
p_icm | Pointer to an ICM instance. |
reg_num | The region number(0 ~ 3) |
References icm_get_status(), STATUS_ERR_DENIED, and STATUS_OK.
|
inlinestatic |
void icm_set_algo | ( | Icm * | p_icm, |
enum icm_algo | algo | ||
) |
Set hash algorithm.
p_icm | Pointer to an ICM instance. |
algo | The 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.
p_icm | Pointer to an ICM instance. |
callback | Reference to a callback function. |
reg_num | The region number(0 ~ 3) |
interrupt_source | Interrupt source. |
irq_level | interrupt level. |
References _ICM_NUM_OF_REGION, Assert, icm_callback_pointer, icm_enable_interrupt(), ICM_INTERRUPT_URAD, and irq_register_handler.
Referenced by main().
|
inlinestatic |
Set Hash Area Start Address.
p_icm | Pointer to an ICM instance. |
addr | The start address value |
Referenced by main().
void icm_set_hash_value | ( | Icm * | p_icm, |
uint32_t * | p_value | ||
) |
Set Initial Hash Value.
p_icm | Pointer to an ICM instance. |
p_value | The hash value array. |
References ICM_SHA_1, ICM_SHA_224, and ICM_SHA_256.
|
inlinestatic |
Set Descriptor Area Start Address.
p_icm | Pointer to an ICM instance. |
addr | The start address value |
Referenced by main().
icm_callback_t icm_callback_pointer[_ICM_NUM_OF_INTERRUPT_SOURCE] |
ICM callback function pointer.
Referenced by icm_interrupt(), and icm_set_callback().