HAL ICACHE Functions

Initialization and Deinitialization functions

group ICACHE_Exported_Functions_Group1

This section provides a set of functions allowing to initialize and deinitialize the ICACHE peripheral:

  • Call the function HAL_ICACHE_Init() to initialize the selected ICACHE handle and associate an instance.

  • Call the function HAL_ICACHE_DeInit() :

    • to reset the ICACHE to the initial state by resetting the monitors,

    • to reset and disable remap regions,

    • to set burst type to WRAP mode, master1 port selected, 2-ways associativity mode,

    • to disable interrupts,

    • to reset and stop ongoing commands if any,

    • to stop the cache and clear the flags.

Functions

hal_status_t HAL_ICACHE_Init ( hal_icache_handle_t * hicache , hal_icache_t instance )

Initialize the ICACHE according to the associated handle.

Parameters :
  • hicache – Pointer to a hal_icache_handle_t structure that contains the handle information for the specified ICACHE.

  • instance – ICACHE instance.

Return values :
  • HAL_INVALID_PARAM – When the handle is NULL.

  • HAL_OK – HAL ICACHE driver correctly Initialized for the given ICACHE instance.

void HAL_ICACHE_DeInit ( hal_icache_handle_t * hicache )

DeInitialize the ICACHE.

Note

The goal of this function is to reset the ICACHE to the initial state:

  • stop the ICACHE,

  • disable and reset the monitors,

  • set the associativity in 2-ways mode (default),

  • disable the interrupts,

  • clear the interrupt flags,

  • disable and reset the remapped regions,

  • and reset the last error code.

Parameters :

hicache – Pointer to a hal_icache_handle_t structure that contains the handle information for the specified ICACHE instance.

Configuration functions

group ICACHE_Exported_Functions_Group2

This section provides a set of functions allowing to configure the ICACHE peripheral:

Functions

hal_status_t HAL_ICACHE_SetAssociativityMode ( hal_icache_handle_t * hicache , hal_icache_associativity_t mode )

Set the ICACHE associativity mode selection.

Note

If ICACHE is enabled, the mode cannot be set.

Parameters :
  • hicache – Pointer to a hal_icache_handle_t structure that contains the handle information for the specified ICACHE instance.

  • mode – Associativity mode to be applied.

Return values :

HAL_OK – ICACHE associativity mode has been correctly configured.

hal_icache_associativity_t HAL_ICACHE_GetAssociativityMode ( const hal_icache_handle_t * hicache )

Get the ICACHE associativity mode selection.

Parameters :

hicache – Pointer to a hal_icache_handle_t structure that contains the handle information for the specified ICACHE instance.

Return values :
  • HAL_ICACHE_ASSOCIATIVITY_1WAY – Associativity mode is 1-way.

  • HAL_ICACHE_ASSOCIATIVITY_2WAYS – Associativity mode is 2-ways.

hal_status_t HAL_ICACHE_SetConfigRemapRegion ( hal_icache_handle_t * hicache , hal_icache_region_t region , const hal_icache_region_config_t * p_region_config )

Configure the ICACHE remap region.

Note

If ICACHE is enabled, the remap region cannot be set.

Parameters :
  • hicache – Pointer to a hal_icache_handle_t structure that contains the handle information for the specified ICACHE instance.

  • region – Region number.

  • p_region_config – Pointer to region config structure.

Return values :

HAL_OK – ICACHE remap region has been correctly initialized.

void HAL_ICACHE_GetConfigRemapRegion ( const hal_icache_handle_t * hicache , hal_icache_region_t region , hal_icache_region_config_t * p_region_config )

Get the ICACHE remap region configuration.

Parameters :
  • hicache – Pointer to a hal_icache_handle_t structure that contains the handle information for the specified ICACHE instance.

  • region – Region number.

  • p_region_config – Pointer to config region structure.

Control functions

group ICACHE_Exported_Functions_Group3

The functions are :

Functions

hal_status_t HAL_ICACHE_Start ( hal_icache_handle_t * hicache , uint32_t interrupts )

Start ICACHE.

Note

This function can enable the interrupts, and starts the ICACHE.

Parameters :
  • hicache – Pointer to a hal_icache_handle_t structure that contains the handle information for the specified ICACHE instance.

  • interrupts – Interrupts

    • HAL_ICACHE_IT_NONE

    • HAL_ICACHE_IT_ERROR

Return values :

HAL_OK – Only success, even if there is any ongoing cache operation.

hal_status_t HAL_ICACHE_Stop ( hal_icache_handle_t * hicache )

Stop ICACHE.

Note

This function disables interrupts, clears the flags and stops the ICACHE.

Note

This function disables the Error Interrupt detection following an eviction or a clean operation, clears the error flag and stop the ICACHE driver.

Parameters :

hicache – Pointer to a hal_icache_handle_t structure that contains the handle information for the specified ICACHE instance.

Return values :

HAL_OK – Operation completed successfully.

hal_status_t HAL_ICACHE_EnableRemapRegion ( hal_icache_handle_t * hicache , hal_icache_region_t region )

Enable the memory remapping for a predefined region.

Note

If ICACHE is enabled, the remap region cannot be enabled.

Parameters :
  • hicache – Pointer to the ICACHE handle.

  • region – Region number.

Return values :

HAL_OK – ICACHE remap region has been correctly activated.

hal_status_t HAL_ICACHE_DisableRemapRegion ( hal_icache_handle_t * hicache , hal_icache_region_t region )

Disable the memory remapping for a predefined region.

Note

If ICACHE is enabled, the remap region cannot be disabled.

Parameters :
  • hicache – Pointer to the ICACHE handle.

  • region – Region number.

Return values :

HAL_OK – ICACHE remap region has been correctly de-activated.

hal_icache_remap_region_status_t HAL_ICACHE_IsEnabledRemapRegion ( const hal_icache_handle_t * hicache , hal_icache_region_t region )

Check if corresponding region is enabled or not.

Parameters :
  • hicache – Pointer to the ICACHE handle.

  • region – Region number.

Return values :
  • HAL_ICACHE_REMAP_REGION_DISABLED – Remap region is disabled.

  • HAL_ICACHE_REMAP_REGION_ENABLED – Remap region is enabled.

Monitoring functions

group ICACHE_Exported_Functions_Group5

This section provides functions allowing to monitor ICACHE:

Functions

hal_status_t HAL_ICACHE_EnableMonitors ( hal_icache_handle_t * hicache , uint32_t monitor_type )

Enable the ICACHE performance monitoring.

Parameters :
  • hicache – Pointer to a hal_icache_handle_t structure that contains the handle information for the specified ICACHE instance.

  • monitor_type – It can be a combination of the following values:

    • HAL_ICACHE_MONITOR_HIT

    • HAL_ICACHE_MONITOR_MISS

    • HAL_ICACHE_MONITOR_ALL

Return values :

HAL_OK – ICACHE Monitor(s) enabled successfully.

hal_status_t HAL_ICACHE_DisableMonitors ( hal_icache_handle_t * hicache , uint32_t monitor_type )

Disable the ICACHE performance monitoring.

Note

Stopping the monitoring does not reset the values.

Parameters :
  • hicache – Pointer to a hal_icache_handle_t structure that contains the handle information for the specified ICACHE instance.

  • monitor_type – It can be a combination of the following values:

    • HAL_ICACHE_MONITOR_HIT

    • HAL_ICACHE_MONITOR_MISS

    • HAL_ICACHE_MONITOR_ALL

Return values :

HAL_OK – ICACHE Monitor(s) disabled successfully.

hal_status_t HAL_ICACHE_ResetMonitors ( hal_icache_handle_t * hicache , uint32_t monitor_type )

Reset the ICACHE performance monitoring values.

Parameters :
  • hicache – Pointer to a hal_icache_handle_t structure that contains the handle information for the specified ICACHE instance.

  • monitor_type – It can be a combination of the following values:

    • HAL_ICACHE_MONITOR_HIT

    • HAL_ICACHE_MONITOR_MISS

    • HAL_ICACHE_MONITOR_ALL

Return values :

HAL_OK – Monitor(s) reset successfully.

uint32_t HAL_ICACHE_GetMonitorHitValue ( const hal_icache_handle_t * hicache )

Get the ICACHE performance Hit monitoring value.

Note

Upon reaching the maximum value, monitor does not wrap.

Parameters :

hicache – Pointer to a hal_icache_handle_t structure that contains the handle information for the specified ICACHE instance.

Return values :

uint32_t – Hit monitoring value.

uint32_t HAL_ICACHE_GetMonitorMissValue ( const hal_icache_handle_t * hicache )

Get the ICACHE performance Miss monitoring value.

Note

Upon reaching the maximum value, monitor does not wrap.

Parameters :

hicache – Pointer to a hal_icache_handle_t structure that contains the handle information for the specified ICACHE instance.

Return values :

uint32_t – Miss monitoring value.

Maintenance operation functions

group ICACHE_Exported_Functions_Group6

This section provides functions allowing to launch maintenance operation:

Functions

hal_status_t HAL_ICACHE_Invalidate ( hal_icache_handle_t * hicache )

Invalidate the ICACHE.

Parameters :

hicache – Pointer to the ICACHE handle.

Return values :
  • HAL_OK – ICACHE Invalidate operation ended successfully.

  • HAL_ERROR – Operation error.

hal_status_t HAL_ICACHE_Invalidate_IT ( hal_icache_handle_t * hicache )

Invalidate the ICACHE with interrupt.

Parameters :

hicache – Pointer to the ICACHE handle.

Return values :
  • HAL_OK – ICACHE Invalidate operation started successfully.

  • HAL_BUSY – ICACHE driver busy with another ongoing operation.

IRQ and callback functions

group ICACHE_Exported_Functions_Group7

The functions are :

Note

The register user callback functions can be used only if USE_HAL_ICACHE_REGISTER_CALLBACKS = 1

Functions

void HAL_ICACHE_IRQHandler ( hal_icache_handle_t * hicache )

Handle the ICACHE interrupt request.

Note

This function must be called from ICACHE_IRQHandler().

Note

This function disables the interrupt related to a detected operation flag.

Parameters :

hicache – Pointer to the ICACHE handle.

void HAL_ICACHE_ErrorCallback ( hal_icache_handle_t * hicache )

ICACHE Error callback.

Parameters :

hicache – Pointer to a hal_icache_handle_t structure that contains the handle information for the specified ICACHE instance.

void HAL_ICACHE_InvalidateCompleteCallback ( hal_icache_handle_t * hicache )

ICACHE Invalidate complete callback.

Parameters :

hicache – Pointer to a hal_icache_handle_t structure that contains the handle information for the specified ICACHE instance.

hal_status_t HAL_ICACHE_RegisterErrorCallback ( hal_icache_handle_t * hicache , hal_icache_cb_t p_callback )

Register a User ICACHE callback for error.

Note

The function is only available if USE_HAL_ICACHE_REGISTER_CALLBACKS = 1.

Parameters :
  • hicache – Pointer to a hal_icache_handle_t structure that contains the handle information for the specified ICACHE instance.

  • p_callback – Pointer to the hal_icache_error_cb_t Error Callback function.

Return values :
  • HAL_OK – Callback registered successfully.

  • HAL_INVALID_PARAM – p_callback pointer is NULL.

hal_status_t HAL_ICACHE_RegisterInvalidateCompleteCallback ( hal_icache_handle_t * hicache , hal_icache_cb_t p_callback )

Register a User ICACHE callback for invalidate.

Note

The function is only available if USE_HAL_ICACHE_REGISTER_CALLBACKS = 1.

Parameters :
  • hicache – Pointer to a hal_icache_handle_t structure that contains the handle information for the specified ICACHE instance.

  • p_callback – Pointer to the hal_icache_cb_t Callback function.

Return values :
  • HAL_OK – Callback registered successfully.

  • HAL_INVALID_PARAM – p_callback pointer is NULL.

State function

group ICACHE_Exported_Functions_Group8

The function is :

Functions

hal_icache_state_t HAL_ICACHE_GetState ( const hal_icache_handle_t * hicache )

Get the ICACHE handle state.

Parameters :

hicache – Pointer to a hal_icache_handle_t structure that contains the handle information for the specified ICACHE instance.

Return values :
  • HAL_ICACHE_STATE_RESET – ICACHE driver not initialized and not started.

  • HAL_ICACHE_STATE_IDLE – ICACHE driver initialized and not started.

  • HAL_ICACHE_STATE_ACTIVE – ICACHE driver initialized and started.

  • HAL_ICACHE_STATE_MAINTENANCE – ICACHE driver initialized, started and a maintenance operation is ongoing.

Error function

group ICACHE_Exported_Functions_Group9

This section permits to get in runtime the last error codes of the peripheral ICACHE.

Functions

uint32_t HAL_ICACHE_GetLastErrorCodes ( const hal_icache_handle_t * hicache )

Get the ICACHE last error codes.

Parameters :

hicache – Pointer to a hal_icache_handle_t structure that contains the handle information for the specified ICACHE instance.

Return values :
  • HAL_ICACHE_ERROR_NONE

  • HAL_ICACHE_ERROR_WRITE_INTRUSION

Set/Get user data functions

group ICACHE_Exported_Functions_Group10

This section provides functions allowing to Set and Get user data:

Functions

void HAL_ICACHE_SetUserData ( hal_icache_handle_t * hicache , const void * p_user_data )

Store the user data into the ICACHE handle.

Parameters :
  • hicache – Pointer to a hal_icache_handle_t structure that contains the handle information for the specified ICACHE instance.

  • p_user_data – Pointer to the user data.

const void * HAL_ICACHE_GetUserData ( const hal_icache_handle_t * hicache )

Retrieve the user data from the ICACHE handle.

Parameters :

hicache – Pointer to a hal_icache_handle_t structure that contains the handle information for the specified ICACHE instance.

Return values :

Pointer – to the user data.