HAL XSPI Functions

Initialization and de-initialization functions

group XSPI_Exported_Functions_Group1

This subsection provides a set of functions allowing to initialize and deinitialize the XSPIx peripheral:

  • Call the function HAL_XSPI_Init() to initialize the selected HAL XSPI handle and associate an XSPI peripheral instance

  • Call the function HAL_XSPI_DeInit() to de-initialize the given HAL XSPI instance by stopping any ongoing process and resetting the state machine

Functions

hal_status_t HAL_XSPI_Init ( hal_xspi_handle_t * hxspi , hal_xspi_t instance )

Initialize the XSPI according to the associated instance.

Note

The XSPI clock can be activated within the HAL_XSPI_Init() function by setting the USE_XSPI_CLK_ENABLE_MODEL flag to HAL_CLK_ENABLE_XSPI_ONLY in the configuration file ** stm32tnxx_hal_conf.h **.

Parameters :
  • instance – XSPI instance, can be one of the XSPI instances as defined in the CMSIS device header file.

  • hxspi – Pointer to a hal_xspi_handle_t structure that contains handle information for the specified XSPI instance.

Return values :
  • HAL_INVALID_PARAM – Invalid parameter.

  • HAL_OK – hxspi instance has been correctly Initialized.

void HAL_XSPI_DeInit ( hal_xspi_handle_t * hxspi )

De-Initialize the XSPI peripheral.

Parameters :

hxspi – Pointer to a hal_xspi_handle_t structure that contains handle information for the specified XSPI instance.

XSPI Configuration functions

group XSPI_Exported_Functions_Group2

This subsection provides a set of functions allowing to configure the XSPIx peripheral:

There are 3 categories of HAL configuration APIs

These APIs are intended to dynamically modify/Retrieve a unitary item meaning that a global config has been already applied Unitary config APIs must check first if we are in IDLE state (meaning a global config was applied) in order to modify or retrieve a single item Items that can alter other config parameters must not be handled within unitary APIs

Functions

hal_status_t HAL_XSPI_SetConfig ( hal_xspi_handle_t * hxspi , const hal_xspi_config_t * p_config )

Configure the XSPI according to the user parameters.

Parameters :
Return values :
  • HAL_ERROR – XSPI instance is already configured and can not be modified.

  • HAL_INVALID_PARAM – Invalid parameter.

  • HAL_OK – XSPI instance has been correctly configured.

void HAL_XSPI_GetConfig ( hal_xspi_handle_t * hxspi , hal_xspi_config_t * p_config )

Get the XSPI configuration.

Parameters :
hal_status_t HAL_XSPI_SetFifoThreshold ( hal_xspi_handle_t * hxspi , uint32_t threshold )

Set XSPI Fifo threshold.

Parameters :
  • hxspi – XSPI handle.

  • threshold – Threshold of the Fifo can be a value from 0 to 31.

Return values :

HAL_OK – Fifo threshold has been correctly configured.

uint32_t HAL_XSPI_GetFifoThreshold ( const hal_xspi_handle_t * hxspi )

Get XSPI Fifo threshold.

Parameters :

hxspi – XSPI handle.

Returns :

Retrieve the value Fifo threshold.

hal_status_t HAL_XSPI_SetPrescaler ( hal_xspi_handle_t * hxspi , uint32_t clk_prescaler )

Set XSPI Clock Prescaler.

Parameters :
  • hxspi – XSPI handle.

  • clk_prescaler – Prescaler generating the external clock can be a value from 0 to 255.

Return values :
  • HAL_ERROR – An error has occurred.

  • HAL_OK – Clock Prescaler has been correctly configured.

uint32_t HAL_XSPI_GetPrescaler ( const hal_xspi_handle_t * hxspi )

Get XSPI Clock Prescaler.

Parameters :

hxspi – XSPI handle.

Returns :

Retrieve the value clock prescaler.

hal_status_t HAL_XSPI_SetMemorySize ( hal_xspi_handle_t * hxspi , hal_xspi_memory_size_t size )

Configure device memory size.

Parameters :
  • hxspi – XSPI handle.

  • size – The size of the external device connected to the XSPI.

Return values :

HAL_OK – Size has been correctly configured.

hal_xspi_memory_size_t HAL_XSPI_GetMemorySize ( const hal_xspi_handle_t * hxspi )

Get XSPI Memory Size.

Parameters :

hxspi – XSPI handle.

Returns :

Retrieve the value device memory size.

hal_status_t HAL_XSPI_SetMemoryType ( hal_xspi_handle_t * hxspi , hal_xspi_memory_type_t type )

Set XSPI Memory Type.

Parameters :
  • hxspi – XSPI handle.

  • type – The type of the external device connected to the XSPI.

Return values :

HAL_OK – Type has been correctly configured.

hal_xspi_memory_type_t HAL_XSPI_GetMemoryType ( const hal_xspi_handle_t * hxspi )

Get XSPI Memory Type.

Parameters :

hxspi – XSPI handle.

Returns :

Retrieve the type of the external device connected to the XSPI.

hal_status_t HAL_XSPI_EnableFreeRunningClock ( hal_xspi_handle_t * hxspi )

Enable the free running clock.

Parameters :

hxspi – XSPI handle.

Return values :

HAL_OK – free running clock has been correctly enabled.

hal_status_t HAL_XSPI_DisableFreeRunningClock ( hal_xspi_handle_t * hxspi )

Disable the free running clock.

Parameters :

hxspi – XSPI handle.

Return values :

HAL_OK – free running clock has been correctly disabled.

hal_xspi_free_running_clk_status_t HAL_XSPI_IsEnabledFreeRunningClock ( const hal_xspi_handle_t * hxspi )

Check whether the free running clock is enabled or disabled.

Parameters :

hxspi – XSPI handle.

Returns :

Retrieve the state of the free running clock.

hal_status_t HAL_XSPI_EnableSIOO ( hal_xspi_handle_t * hxspi )

Enable the Send Instruction Only Once mode.

Parameters :

hxspi – XSPI handle.

Return values :

HAL_OK – Send Instruction Only Once mode has been correctly enabled.

hal_status_t HAL_XSPI_DisableSIOO ( hal_xspi_handle_t * hxspi )

Disable the Send Instruction Only Once mode.

Parameters :

hxspi – XSPI handle.

Return values :

HAL_OK – Send Instruction Only Once mode has been correctly disabled.

hal_xspi_sioo_status_t HAL_XSPI_IsEnabledSIOO ( const hal_xspi_handle_t * hxspi )

Check whether the Send Instruction Only Once mode is enabled or disabled.

Parameters :

hxspi – XSPI handle.

Returns :

Retrieve the state of the Send Instruction Only Once mode.

XSPI Command and IO operation functions

group XSPI_Exported_Functions_Group3

This subsection provides a set of functions allowing to manage the data transfer from/to external memory

There are 3 categories of HAL functions APIs to manage the data transfer

Functions

hal_status_t HAL_XSPI_StartMemoryMappedMode ( hal_xspi_handle_t * hxspi , const hal_xspi_memory_mapped_config_t * p_config )

Start the Memory Mapped mode.

Parameters :
  • hxspi – XSPI handle.

  • p_config – Pointer to structure that contains the memory mapped configuration information.

Return values :
  • HAL_ERROR – An error has occurred.

  • HAL_INVALID_PARAM – Invalid parameter.

  • HAL_BUSY – XSPI state is active when calling this API.

  • HAL_OK – XSPI instance has been correctly configured.

hal_status_t HAL_XSPI_StopMemoryMappedMode ( hal_xspi_handle_t * hxspi )

Stop the Memory Mapped mode.

Note

This function is used only in Memory mapped Mode.

Parameters :

hxspi – XSPI handle.

Return values :
  • HAL_ERROR – An error has occurred.

  • HAL_OK – XSPI instance has been correctly configured.

hal_status_t HAL_XSPI_SendRegularCmd ( hal_xspi_handle_t * hxspi , const hal_xspi_regular_cmd_t * p_cmd , uint32_t timeout_ms )

Set the Regular command configuration.

Parameters :
  • hxspi – XSPI handle.

  • p_cmd – Structure that contains the Regular command configuration information.

  • timeout_ms – Timeout duration.

Return values :
  • HAL_ERROR – An error has occurred.

  • HAL_TIMEOUT – In case of user timeout.

  • HAL_BUSY – XSPI state is active when calling this API.

  • HAL_OK – Operation completed.

hal_status_t HAL_XSPI_SendRegularCmd_IT ( hal_xspi_handle_t * hxspi , const hal_xspi_regular_cmd_t * p_cmd )

Set the Regular command configuration in interrupt mode.

Note

This function is used only in Indirect Read or Write Modes.

Parameters :
  • hxspi – XSPI handle.

  • p_cmd – Structure that contains the Regular command configuration information.

Return values :
  • HAL_ERROR – An error has occurred.

  • HAL_INVALID_PARAM – Invalid parameter.

  • HAL_BUSY – XSPI state is active when calling this API.

  • HAL_OK – Operation completed.

hal_status_t HAL_XSPI_SendHyperbusCmd ( hal_xspi_handle_t * hxspi , const hal_xspi_hyperbus_cmd_t * p_cmd , uint32_t timeout_ms )

Set the Hyperbus command configuration.

Parameters :
  • hxspi – XSPI handle.

  • p_cmd – Structure containing the Hyperbus command.

  • timeout_ms – Timeout duration.

Return values :
  • HAL_ERROR – An error has occurred.

  • HAL_INVALID_PARAM – Invalid parameter.

  • HAL_TIMEOUT – In case of user timeout.

  • HAL_BUSY – XSPI state is active when calling this API.

  • HAL_OK – Operation completed.

hal_status_t HAL_XSPI_ExecRegularAutoPoll ( hal_xspi_handle_t * hxspi , const hal_xspi_auto_polling_config_t * p_config , uint32_t timeout_ms )

Execute the XSPI Automatic Polling Mode in blocking mode.

Note

This function is used only in Automatic Polling Mode for Regular protocol.

Parameters :
  • hxspi – XSPI handle.

  • p_config – Pointer to structure that contains the polling configuration information.

  • timeout_ms – Timeout duration.

Return values :
  • HAL_ERROR – An error has occurred.

  • HAL_INVALID_PARAM – Invalid parameter.

  • HAL_TIMEOUT – In case of user timeout.

  • HAL_BUSY – XSPI state is active when calling this API.

  • HAL_OK – Operation completed.

hal_status_t HAL_XSPI_ExecRegularAutoPoll_IT ( hal_xspi_handle_t * hxspi , const hal_xspi_auto_polling_config_t * p_config )

Execute the XSPI Automatic Polling Mode in non-blocking mode.

Note

This function is used only in Automatic Polling Mode for Regular protocol.

Parameters :
  • hxspi – XSPI handle.

  • p_config – Pointer to structure that contains the polling configuration information

Return values :
  • HAL_ERROR – An error has occurred.

  • HAL_INVALID_PARAM – Invalid parameter.

  • HAL_BUSY – XSPI state is active when calling this API.

  • HAL_OK – Operation completed.

hal_status_t HAL_XSPI_Transmit ( hal_xspi_handle_t * hxspi , const void * p_data , uint32_t timeout_ms )

Transmit an amount of data in blocking mode.

Note

This function is used only in Indirect Write Mode.

Parameters :
  • hxspi – XSPI handle.

  • p_data – Pointer to data buffer.

  • timeout_ms – Timeout duration.

Return values :
  • HAL_INVALID_PARAM – Invalid parameter.

  • HAL_TIMEOUT – In case of user timeout.

  • HAL_BUSY – XSPI state is active when calling this API.

  • HAL_OK – Transfer completed.

hal_status_t HAL_XSPI_Receive ( hal_xspi_handle_t * hxspi , void * p_data , uint32_t timeout_ms )

Receive an amount of data in blocking mode.

Note

This function is used only in Indirect Read Mode.

Parameters :
  • hxspi – XSPI handle.

  • p_data – Pointer to data buffer.

  • timeout_ms – Timeout duration.

Return values :
  • HAL_INVALID_PARAM – Invalid parameter.

  • HAL_TIMEOUT – In case of user timeout.

  • HAL_BUSY – XSPI state is active when calling this API.

  • HAL_OK – Operation completed.

hal_status_t HAL_XSPI_Transmit_IT ( hal_xspi_handle_t * hxspi , const void * p_data )

Send an amount of data in non-blocking mode with interrupt.

Note

This function is used only in Indirect Write Mode.

Parameters :
  • hxspi – XSPI handle.

  • p_data – Pointer to data buffer.

Return values :
  • HAL_BUSY – XSPI state is active when calling this API.

  • HAL_INVALID_PARAM – Invalid parameter.

  • HAL_OK – Transfer completed.

hal_status_t HAL_XSPI_Receive_IT ( hal_xspi_handle_t * hxspi , void * p_data )

Receive an amount of data in non-blocking mode with interrupt.

Note

This function is used only in Indirect Read Mode.

Parameters :
  • hxspi – XSPI handle.

  • p_data – Pointer to data buffer.

Return values :
  • HAL_ERROR – An error has occurred.

  • HAL_INVALID_PARAM – Invalid parameter.

  • HAL_BUSY – XSPI state is active when calling this API.

  • HAL_OK – Operation completed.

hal_status_t HAL_XSPI_Transmit_DMA ( hal_xspi_handle_t * hxspi , const void * p_data )

Send an amount of data in non-blocking mode with DMA.

Note

This function is used only in Indirect Write Mode.

Warning

If DMA peripheral access is configured as halfword, the number of data and the fifo threshold must be aligned on halfword.

Warning

If DMA peripheral access is configured as word, the number of data and the fifo threshold must be aligned on word.

Parameters :
  • hxspi – XSPI handle.

  • p_data – Pointer to data buffer.

Return values :
  • HAL_ERROR – An error has occurred.

  • HAL_INVALID_PARAM – Invalid parameter.

  • HAL_BUSY – XSPI state is active when calling this API.

  • HAL_OK – Operation completed.

hal_status_t HAL_XSPI_Transmit_DMA_Opt ( hal_xspi_handle_t * hxspi , const void * p_data , uint32_t interrupts )

Send an amount of data with DMA in interrupt mode with optional interrupts.

Note

This function is used only in Indirect Write Mode.

Warning

If DMA peripheral access is configured as halfword, the number of data and the fifo threshold must be aligned on halfword.

Warning

If DMA peripheral access is configured as word, the number of data and the fifo threshold must be aligned on word.

Parameters :
  • hxspi – XSPI handle.

  • p_data – Pointer to data buffer.

  • interrupts – Specifies the DMA optional interrupt to be enable. This parameter can be one of Optional interrupts group.

Return values :
  • HAL_ERROR – An error has occurred.

  • HAL_INVALID_PARAM – Invalid parameter.

  • HAL_BUSY – XSPI state is active when calling this API.

  • HAL_OK – Operation completed.

hal_status_t HAL_XSPI_Receive_DMA ( hal_xspi_handle_t * hxspi , void * p_data )

Receive an amount of data in non-blocking mode with DMA.

Note

This function is used only in Indirect Read Mode.

Warning

If DMA peripheral access is configured as halfword, the number of data and the fifo threshold must be aligned on halfword.

Warning

If DMA peripheral access is configured as word, the number of data and the fifo threshold must be aligned on word.

Parameters :
  • hxspi – XSPI handle.

  • p_data – Pointer to data buffer.

Return values :
  • HAL_ERROR – An error has occurred.

  • HAL_INVALID_PARAM – Invalid parameter.

  • HAL_BUSY – XSPI state is active when calling this API.

  • HAL_OK – Operation completed.

hal_status_t HAL_XSPI_Receive_DMA_Opt ( hal_xspi_handle_t * hxspi , void * p_data , uint32_t interrupts )

Receive an amount of data with DMA in interrupt mode with optional interrupts.

Note

This function is used only in Indirect Read Mode.

Warning

If DMA peripheral access is configured as halfword, the number of data and the fifo threshold must be aligned on halfword.

Warning

If DMA peripheral access is configured as word, the number of data and the fifo threshold must be aligned on word.

Parameters :
  • hxspi – XSPI handle.

  • p_data – Pointer to data buffer.

  • interrupts – Specifies the DMA optional interrupt to be enable This parameter can be one of Optional interrupts group.

Return values :
  • HAL_ERROR – An error has occurred.

  • HAL_INVALID_PARAM – Invalid parameter.

  • HAL_BUSY – XSPI state is active when calling this API.

  • HAL_OK – Operation completed.

hal_status_t HAL_XSPI_Abort ( hal_xspi_handle_t * hxspi , uint32_t timeout_ms )

Abort the current transmission.

Parameters :
  • hxspi – XSPI handle.

  • timeout_ms – Timeout duration.

Return values :
  • HAL_TIMEOUT – In case of user timeout.

  • HAL_OK – Operation completed.

hal_status_t HAL_XSPI_Abort_IT ( hal_xspi_handle_t * hxspi )

Abort the current transmission (non-blocking function).

Parameters :

hxspi – XSPI handle.

Return values :
  • HAL_ERROR – An error has occurred.

  • HAL_OK – Operation completed.

Peripheral current frequency, state and errors functions

group XSPI_Exported_Functions_Group5

This subsection provides a set of functions allowing to read peripheral current frequency, state and last occurred errors.

Functions

uint32_t HAL_XSPI_GetClockFreq ( const hal_xspi_handle_t * hxspi )

Return the peripheral clock frequency for XSPI.

Parameters :

hxspi – Pointer to a hal_xspi_handle_t structure that contains the configuration information for XSPI module.

Return values :
  • uint32_t – Frequency in Hz.

  • 0 – source clock of the hxspi not configured or not ready.

hal_xspi_state_t HAL_XSPI_GetState ( const hal_xspi_handle_t * hxspi )

Retrieve the HAL XSPI Global State.

Parameters :

hxspi – Pointer to a hal_xspi_handle_t structure that contains handle information for the specified XSPI instance.

Returns :

Retrieve the XSPI global state.

uint32_t HAL_XSPI_GetLastErrorCodes ( const hal_xspi_handle_t * hxspi )

Return the XSPI error code.

Parameters :

hxspi – XSPI handle

Return values :

XSPI – error code

XSPI Delay Block functions

group XSPI_Exported_Functions_Group6

This subsection provides a set of functions allowing to configure the Delay Block :

Functions

hal_status_t HAL_XSPI_DLYB_SetConfigDelay ( hal_xspi_handle_t * hxspi , uint32_t clock_phase_value )

Set the delay configuration of the delay block peripheral.

Parameters :
  • hxspi – Pointer to XSPI handle.

  • clock_phase_value – The desired output clock phase value.

Return values :
  • HAL_INVALID_PARAM – When no valid XSPI.

  • HAL_OK – The delay is correctly configured.

hal_status_t HAL_XSPI_DLYB_GetConfigDelay ( const hal_xspi_handle_t * hxspi , uint32_t * p_clock_phase )

Get the delay output clock phase of the delay block peripheral.

Parameters :
  • hxspi – Pointer to XSPI handle.

  • p_clock_phase – Pointer to the variable where the selected output clock phase value will be stored.

Return values :
  • HAL_INVALID_PARAM – When no valid XSPI.

  • HAL_OK – When the register reading was successful.

hal_status_t HAL_XSPI_DLYB_CalculateMaxClockPhase ( hal_xspi_handle_t * hxspi , uint32_t * p_max_clock_phase )

Calculate maximum output clock phase of the delay block peripheral.

Parameters :
  • hxspi – Pointer to XSPI handle.

  • p_max_clock_phase – Pointer to the variable where the maximum clock phase value will be stored.

Return values :
  • HAL_ERROR – The max clock phase is not correctly calculated.

  • HAL_INVALID_PARAM – When no valid XSPI or invalid p_max_clock_phase parameter.

  • HAL_OK – The max clock phase is correctly calculated.

hal_status_t HAL_XSPI_DLYB_Enable ( hal_xspi_handle_t * hxspi )

Enable the delay block peripheral.

Parameters :

hxspi – Pointer to XSPI handle.

Return values :
  • HAL_ERROR – The delay is not correctly configured.

  • HAL_INVALID_PARAM – When no valid XSPI instance.

  • HAL_OK – The delay is correctly configured.

hal_status_t HAL_XSPI_DLYB_Disable ( hal_xspi_handle_t * hxspi )

Disable the delay block peripheral.

Parameters :

hxspi – Pointer to XSPI handle.

Return values :
  • HAL_INVALID_PARAM – When no valid XSPI instance.

  • HAL_OK – The delay block is disabled.

hal_xspi_dlyb_status_t HAL_XSPI_DLYB_IsEnabled ( const hal_xspi_handle_t * hxspi )

Check if the delay block peripheral is enabled or not.

Parameters :

hxspi – Pointer to XSPI handle.

Return values :
  • HAL_XSPI_DLYB_ENABLED – The delay block is enabled.

  • HAL_XSPI_DLYB_DISABLED – The delay block is disabled.

XSPI high-speed interface and calibration functions

group XSPI_Exported_Functions_Group7

This subsection provides a set of functions allowing to configure the high-speed interface and calibration :

Functions

hal_status_t HAL_XSPI_HSIC_SetConfigDelay ( hal_xspi_handle_t * hxspi , const hal_xspi_hsic_config_t * p_config )

Set a delay value for the high-speed interface DLLs.

Parameters :
  • hxspi – Pointer to XSPI handle.

  • p_config – Configuration of delay value specified in DelayValueType field.

Return values :
  • HAL_INVALID_PARAM – Invalid parameter.

  • HAL_OK.

hal_status_t HAL_XSPI_HSIC_GetConfigDelay ( const hal_xspi_handle_t * hxspi , hal_xspi_hsic_config_t * p_config )

Get the delay values of the high-speed interface DLLs.

Parameters :
  • hxspi – Pointer to XSPI handle.

  • p_config – Current delay values corresponding to the DelayValueType field.

Return values :
  • HAL_INVALID_PARAM – Invalid parameter.

  • HAL_OK.

XSPI high-speed interface and calibration functions

group XSPI_Exported_Functions_Group8

This subsection provides a set of functions allowing to configure the XSPIM IO Manager :

Functions

hal_status_t HAL_XSPI_XSPIM_SetConfig ( const hal_xspi_xspim_config_t * p_config )

Configure the XSPIM according to the user parameters.

Note

XSPIM XSPI I/O Manager Instance.

Parameters :

p_config – Pointer to the hal_xspi_xspim_config_t structure.

Return values :
  • HAL_INVALID_PARAM – Invalid parameter.

  • HAL_ERROR – XSPI instance is enabled.

  • HAL_OK – XSPIM instance has been correctly configured.

void HAL_XSPI_XSPIM_GetConfig ( hal_xspi_xspim_config_t * p_config )

Get the current IOM configuration from XSPIM.

Parameters :

p_config – Pointer to the hal_xspi_xspim_config_t structure.

XSPI OTFDEC functions

group XSPI_Exported_Functions_Group10

This subsection provides a set of functions allowing to configure the OTFDEC :

Functions

hal_status_t HAL_XSPI_OTFDEC_SetConfigRegion ( hal_xspi_handle_t * hxspi , hal_xspi_otfdec_region_t region , const hal_xspi_otfdec_config_t * p_config , const hal_xspi_otfdec_key_t * p_key_config )

Configure the OTFDEC region.

Parameters :
  • hxspi – Pointer to a hal_xspi_handle_t structure that contains handle information for the specified XSPI instance.

  • region – Region index, can be a value of hal_xspi_otfdec_region_t.

  • p_config – Pointer to the hal_xspi_otfdec_config_t structure.

  • p_key_config – Pointer to the hal_xspi_otfdec_key_t.

Return values :
  • HAL_ERROR – OTFDEC region key is not correctly generated.

  • HAL_INVALID_PARAM – Invalid parameter.

  • HAL_OK – OTFDEC region has been correctly configured.

void HAL_XSPI_OTFDEC_GetConfigRegion ( hal_xspi_handle_t * hxspi , hal_xspi_otfdec_region_t region , hal_xspi_otfdec_config_t * p_config )

Get the OTFDEC region configuration.

Parameters :
  • hxspi – Pointer to a hal_xspi_handle_t structure that contains handle information for the specified XSPI instance.

  • region – Region index, can be a value of hal_xspi_otfdec_region_t.

  • p_config – Pointer to the hal_xspi_config_t structure.

hal_status_t HAL_XSPI_OTFDEC_StartRegionDecryption ( hal_xspi_handle_t * hxspi , hal_xspi_otfdec_region_t region , uint32_t interrupts )

Start the OTFDEC region decryption.

Parameters :
  • hxspi – Pointer to a hal_xspi_handle_t structure that contains handle information for the specified XSPI instance.

  • region – region index, can be a value of hal_xspi_otfdec_region_t.

  • interrupts – Specifies the OTFDEC interrupt sources to be enabled. This parameter can be a combination of OTFDEC interrupts group.

Return values :
  • HAL_INVALID_PARAM – Invalid parameter.

  • HAL_OK – OTFDEC region has been correctly enabled.

hal_status_t HAL_XSPI_OTFDEC_StopRegionDecryption ( hal_xspi_handle_t * hxspi , hal_xspi_otfdec_region_t region )

Stop the OTFDEC region decryption.

Parameters :
  • hxspi – Pointer to a hal_xspi_handle_t structure that contains handle information for the specified XSPI instance.

  • region – Region index, can be a value of hal_xspi_otfdec_region_t.

Return values :
  • HAL_INVALID_PARAM – Invalid param return when the XSPI handle is NULL.

  • HAL_OK – OTFDEC region has been correctly disabled.

hal_status_t HAL_XSPI_OTFDEC_Encrypt ( hal_xspi_handle_t * hxspi , hal_xspi_otfdec_region_t region , uint32_t * p_input , uint32_t * p_output , uint32_t size_byte , uint32_t start_address , uint32_t interrupts )

Encrypt the OTFDEC region.

Parameters :
  • hxspi – Pointer to a hal_xspi_handle_t structure that contains handle information for the specified XSPI instance.

  • region – Region index, can be a value of hal_xspi_otfdec_region_t.

  • p_input – Pointer to plain data.

  • p_output – Pointer to ciphered data.

  • size_byte – Plain data size in byte.

  • start_address – Starting address in the external memory area where the enciphered data will be eventually stored.

  • interrupts – Specifies the OTFDEC interrupt sources to be enabled. This parameter can be a combination of OTFDEC interrupts group.

Return values :
  • HAL_INVALID_PARAM – Invalid param return when one of the provided inputs is NULL.

  • HAL_OK – OTFDEC region has been correctly encrypted.

hal_status_t HAL_XSPI_OTFDEC_GetRegionKeyCRC ( hal_xspi_handle_t * hxspi , hal_xspi_otfdec_region_t region , uint8_t * p_key_crc )

Get the region key crc.

Parameters :
  • hxspi – Pointer to a hal_xspi_handle_t structure that contains handle information for the specified XSPI instance.

  • region – Region index, can be a value of hal_xspi_otfdec_region_t.

  • p_key_crc – Pointer to be filled with crc key.

Return values :
  • HAL_INVALID_PARAM – Invalid param return when one of the provided inputs is NULL.

  • HAL_OK – OTFDEC region key crc has been returned correctly.

hal_status_t HAL_XSPI_OTFDEC_EnablePrivAccess ( hal_xspi_handle_t * hxspi )

Enable the privilege access protection.

Parameters :

hxspi – Pointer to a hal_xspi_handle_t structure that contains handle information for the specified XSPI instance.

Return values :
  • HAL_INVALID_PARAM – Invalid parameter.

  • HAL_OK – OTFDEC Privilege access protection has been correctly enabled.

hal_status_t HAL_XSPI_OTFDEC_DisablePrivAccess ( hal_xspi_handle_t * hxspi )

Disable the privilege access protection.

Parameters :

hxspi – Pointer to a hal_xspi_handle_t structure that contains handle information for the specified XSPI instance.

Return values :
  • HAL_INVALID_PARAM – Invalid parameter.

  • HAL_OK – OTFDEC Privilege access protection has been correctly disabled.

hal_xspi_otfdec_privilege_attr_t HAL_XSPI_OTFDEC_IsEnabledPrivAccess ( hal_xspi_handle_t * hxspi )

Check whether the otfdec privilege access protection is enabled or not.

Parameters :

hxspi – Pointer to a hal_xspi_handle_t structure that contains handle information for the specified XSPI instance.

Return values :
  • HAL_XSPI_OTFDEC_ATTRIBUTE_NON_PRIVILEGED – OTFDEC is accessed .in non privileged mode.

  • HAL_XSPI_OTFDEC_ATTRIBUTE_PRIVILEGED – OTFDEC is accessed only in privileged mode.

hal_status_t HAL_XSPI_OTFDEC_LockRegionConfig ( hal_xspi_handle_t * hxspi , hal_xspi_otfdec_region_t region )

Lock the OTFDEC region configuration.

Parameters :
  • hxspi – Pointer to a hal_xspi_handle_t structure that contains handle information for the specified XSPI instance.

  • region – region index, can be a value of hal_xspi_otfdec_region_t.

Return values :
  • HAL_INVALID_PARAM – Invalid parameter.

  • HAL_OK – OTFDEC Region configuration has been correctly locked.

hal_xspi_otfdec_lock_config_status_t HAL_XSPI_OTFDEC_IsLockedRegionConfig ( hal_xspi_handle_t * hxspi , hal_xspi_otfdec_region_t region )

Check whether the OTFDEC region configuration is locked or not.

Parameters :
  • hxspi – Pointer to a hal_xspi_handle_t structure that contains handle information for the specified XSPI instance.

  • region – Region index, can be a value of hal_xspi_otfdec_region_t.

Return values :
  • HAL_XSPI_OTFDEC_LOCK_CONFIG_ENABLED – OTFDEC region configuration is locked.

  • HAL_XSPI_OTFDEC_LOCK_CONFIG_DISABLED – OTFDEC region configuration is not locked.

hal_status_t HAL_XSPI_OTFDEC_LockRegionKey ( hal_xspi_handle_t * hxspi , hal_xspi_otfdec_region_t region )

Enable the OTFDEC region key lock.

Parameters :
  • hxspi – Pointer to a hal_xspi_handle_t structure that contains handle information for the specified XSPI instance.

  • region – Region index, can be a value of hal_xspi_otfdec_region_t.

Return values :
  • HAL_INVALID_PARAM – Invalid parameter.

  • HAL_OK – Region Key lock has been correctly locked.

hal_xspi_otfdec_lock_key_status_t HAL_XSPI_OTFDEC_IsLockedRegionKey ( hal_xspi_handle_t * hxspi , hal_xspi_otfdec_region_t region )

Check whether the region key is locked or not.

Parameters :
  • hxspi – Pointer to a hal_xspi_handle_t structure that contains handle information for the specified XSPI instance.

  • region – Region index, can be a value of hal_xspi_otfdec_region_t.

Return values :
  • HAL_XSPI_OTFDEC_LOCK_KEY_ENABLED – OTFDEC region key is locked.

  • HAL_XSPI_OTFDEC_LOCK_KEY_DISABLED – OTFDEC region key is not locked.

void HAL_XSPI_OTFDEC_IRQHandler ( hal_xspi_handle_t * hxspi )

Handle the OTFDEC interrupt request.

Parameters :

hxspi – Pointer to hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.

void HAL_XSPI_OTFDEC_ErrorCallback ( hal_xspi_handle_t * hxspi )

OTFDEC Error callback.

Parameters :

hxspi – Pointer to hal_xspi_handle_t structure that contains the handle information for the specified XSPI instance.

hal_status_t HAL_XSPI_OTFDEC_RegisterErrorCallback ( hal_xspi_handle_t * hxspi , hal_xspi_cb_t callback )

Register the XSPI OTFDEC Error Callback to be used instead of the weak HAL_XSPI_OTFDEC_ErrorCallback() predefined callback.

Parameters :
  • hxspi – Pointer to a hal_xspi_handle_t structure that contains handle information for the specified XSPI instance.

  • callback – Specifies the error callback.

Return values :
  • HAL_INVALID_PARAM – Invalid parameter.

  • HAL_OK – Register completed successfully.

hal_xspi_otfdec_region_state_t HAL_XSPI_OTFDEC_GetRegionState ( const hal_xspi_handle_t * hxspi , hal_xspi_otfdec_region_t region )

Return the XSPI OTFDEC region state.

Parameters :
  • hxspi – Pointer to a hal_xspi_handle_t structure that contains handle information for the specified XSPI instance.

  • region – Can be a value of hal_xspi_otfdec_region_t.

Return values :
  • HAL_XSPI_OTFDEC_REGION_STATE_RESET – OTFDEC region is not yet configured.

  • HAL_XSPI_OTFDEC_REGION_STATE_CONFIGURED – OTFDEC region is configured.

  • HAL_XSPI_OTFDEC_REGION_STATE_DECRYPT – OTFDEC region is decryption is ongoing.

uint32_t HAL_XSPI_OTFDEC_GetLastErrorCodes ( const hal_xspi_handle_t * hxspi )

Return the XSPI OTFDEC error code.

Parameters :

hxspi – Pointer to a hal_xspi_handle_t structure that contains handle information for the specified XSPI instance.

Return values :

uint32_t – Last error codes which can be a combination of OTFDEC Error Code definition reflecting the processes asynchronous errors

Interrupt functions

group XSPI_Exported_Functions_Group9

Functions

void HAL_XSPI_EnableIT ( hal_xspi_handle_t * hxspi , uint32_t it_source )

Enable the specified XSPI interrupt.

Parameters :
  • hxspi – specifies the XSPI Handle.

  • it_source – specifies the XSPI interrupt source to enable This parameter can be any combination of the following values:

    • HAL_XSPI_IT_TO: XSPI Timeout interrupt

    • HAL_XSPI_IT_SM: XSPI Status match interrupt

    • HAL_XSPI_IT_FT: XSPI FIFO threshold interrupt

    • HAL_XSPI_IT_TC: XSPI Transfer complete interrupt

    • HAL_XSPI_IT_TE: XSPI Transfer error interrupt

    • HAL_XSPI_IT_ALL: XSPI All interrupts

void HAL_XSPI_DisableIT ( hal_xspi_handle_t * hxspi , uint32_t it_source )

Disable the specified XSPI interrupt.

Parameters :
  • hxspi – specifies the XSPI Handle.

  • it_source – specifies the XSPI interrupt source to disable This parameter can be any combination of the following values:

    • HAL_XSPI_IT_TO: XSPI Timeout interrupt

    • HAL_XSPI_IT_SM: XSPI Status match interrupt

    • HAL_XSPI_IT_FT: XSPI FIFO threshold interrupt

    • HAL_XSPI_IT_TC: XSPI Transfer complete interrupt

    • HAL_XSPI_IT_TE: XSPI Transfer error interrupt

    • HAL_XSPI_IT_ALL: XSPI All interrupts

uint32_t HAL_XSPI_IsEnabledIT ( const hal_xspi_handle_t * hxspi , uint32_t it_source )

Check whether the specified XSPI interrupt source is enabled or not.

Parameters :
  • hxspi – specifies the XSPI Handle.

  • it_source – specifies the XSPI interrupt source to check This parameter can be one of the following values:

    • HAL_XSPI_IT_TO: XSPI Timeout interrupt

    • HAL_XSPI_IT_SM: XSPI Status match interrupt

    • HAL_XSPI_IT_FT: XSPI FIFO threshold interrupt

    • HAL_XSPI_IT_TC: XSPI Transfer complete interrupt

    • HAL_XSPI_IT_TE: XSPI Transfer error interrupt

Returns :

retrieve the state of the selected XSPI interrupt.

hal_xspi_flag_status_t HAL_XSPI_IsActiveFlag ( const hal_xspi_handle_t * hxspi , uint32_t flag )

Check whether the selected XSPI flag is set or not.

Parameters :
  • hxspi – specifies the XSPI Handle.

  • flag – specifies the XSPI flag to check This parameter can be one of the following values:

    • HAL_XSPI_FLAG_BUSY: XSPI Busy flag

    • HAL_XSPI_FLAG_TO: XSPI Timeout flag

    • HAL_XSPI_FLAG_SM: XSPI Status match flag

    • HAL_XSPI_FLAG_FT: XSPI FIFO threshold flag

    • HAL_XSPI_FLAG_TC: XSPI Transfer complete flag

    • HAL_XSPI_FLAG_TE: XSPI Transfer error flag

Returns :

retrieve the state of the selected XSPI flag.

void HAL_XSPI_ClearFlag ( hal_xspi_handle_t * hxspi , uint32_t flag )

Clears the specified XSPI’s flag status.

Parameters :
  • hxspi – specifies the XSPI Handle.

  • flag – specifies the XSPI clear register flag that needs to be set This parameter can be any combination of the following values:

    • HAL_XSPI_FLAG_TO: XSPI Timeout flag

    • HAL_XSPI_FLAG_SM: XSPI Status match flag

    • HAL_XSPI_FLAG_TC: XSPI Transfer complete flag

    • HAL_XSPI_FLAG_TE: XSPI Transfer error flag

    • HAL_XSPI_FLAG_ALL: XSPI All flags