HAL PSSI Functions

Initialization and de-initialization functions

group PSSI_Exported_Functions_Group1

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

Functions

hal_status_t HAL_PSSI_Init ( hal_pssi_handle_t * hpssi , hal_pssi_t instance )

Initialize the HAL PSSI handle and associate it to an instance.

Parameters :
Return values :
  • HAL_OK – HAL PSSI instance has been correctly initialized.

  • HAL_INVALID_PARAM – HAL PSSI instance is NULL

  • HAL_ERROR – HAL PSSI semaphore creation is failed (USE_HAL_MUTEX is set to 1U)

void HAL_PSSI_DeInit ( hal_pssi_handle_t * hpssi )

DeInitialize the HAL PSSI driver for the given handle and disable the peripheral.

Parameters :

hpssi – Pointer to a hal_pssi_handle_t structure.

Configuration functions

group PSSI_Exported_Functions_Group2

A set of functions allowing to configure the pssix peripheral:

Functions

hal_status_t HAL_PSSI_SetConfig ( hal_pssi_handle_t * hpssi , const hal_pssi_config_t * p_config )

Configure the PSSI according to the user parameters.

Note

When using HAL_PSSI_DATA_WIDTH_8BIT in polling mode or using HAL_DMA_SRC_DATA_WIDTH_BYTE in DMA mode, the Bus Width must be HAL_PSSI_BUS_WIDTH_8LINE .

Parameters :
Return values :
  • HAL_OK – Operation completed successfully

  • HAL_INVALID_PARAM – Invalid parameter

void HAL_PSSI_GetConfig ( const hal_pssi_handle_t * hpssi , hal_pssi_config_t * p_config )

Retrieve the PSSI configuration.

Parameters :
hal_status_t HAL_PSSI_SetControlSignal ( hal_pssi_handle_t * hpssi , hal_pssi_control_signal_t control_signal )

Configure the PSSI Control Signal.

Parameters :
Return values :

HAL_OK.

hal_pssi_control_signal_t HAL_PSSI_GetControlSignal ( const hal_pssi_handle_t * hpssi )

Retrieve the current PSSI Control Signal configuration.

Parameters :

hpssi – Pointer to a hal_pssi_handle_t

Return values :
  • HAL_PSSI_CONTROL_SIGNAL_DE_RDY_DISABLE

  • HAL_PSSI_CONTROL_SIGNAL_RDY_ENABLE

  • HAL_PSSI_CONTROL_SIGNAL_DE_ENABLE

  • HAL_PSSI_CONTROL_SIGNAL_DE_RDY_ALT_ENABLE

  • HAL_PSSI_CONTROL_SIGNAL_MAP_RDY_BIDIR_ENABLE

  • HAL_PSSI_CONTROL_SIGNAL_RDY_MAP_ENABLE

  • HAL_PSSI_CONTROL_SIGNAL_DE_MAP_ENABLE

  • HAL_PSSI_CONTROL_SIGNAL_MAP_DE_BIDIR_ENABLE

hal_status_t HAL_PSSI_SetDataEnablePolarity ( hal_pssi_handle_t * hpssi , hal_pssi_data_enable_polarity_t data_enable_polarity )

Configure the PSSI Data Enable Polarity.

Parameters :
Return values :

HAL_OK.

hal_pssi_data_enable_polarity_t HAL_PSSI_GetDataEnablePolarity ( const hal_pssi_handle_t * hpssi )

Retrieve the current PSSI Data Enable Polarity configuration.

Parameters :

hpssi – Pointer to a hal_pssi_handle_t

Return values :
  • HAL_PSSI_DATA_ENABLE_POLARITY_LOW

  • HAL_PSSI_DATA_ENABLE_POLARITY_HIGH

hal_status_t HAL_PSSI_SetReadyPolarity ( hal_pssi_handle_t * hpssi , hal_pssi_ready_polarity_t ready_polarity )

Configure the PSSI Ready Polarity.

Parameters :
Return values :

HAL_OK.

hal_pssi_ready_polarity_t HAL_PSSI_GetReadyPolarity ( const hal_pssi_handle_t * hpssi )

Retrieve the current PSSI Ready Polarity configuration.

Parameters :

hpssi – Pointer to a hal_pssi_handle_t

Return values :
  • HAL_PSSI_READY_POLARITY_LOW

  • HAL_PSSI_READY_POLARITY_HIGH

hal_status_t HAL_PSSI_SetClockPolarity ( hal_pssi_handle_t * hpssi , hal_pssi_clock_polarity_t clock_polarity )

Configure the PSSI Clock Polarity.

Parameters :
Return values :

HAL_OK.

hal_pssi_clock_polarity_t HAL_PSSI_GetClockPolarity ( const hal_pssi_handle_t * hpssi )

Retrieve the current PSSI Clock Polarity configuration.

Parameters :

hpssi – Pointer to a hal_pssi_handle_t

Return values :
  • HAL_PSSI_CLOCK_POLARITY_RX_FALLING_TX_RISING_EDGE

  • HAL_PSSI_CLOCK_POLARITY_RX_RISING_TX_FALLING_EDGE

hal_status_t HAL_PSSI_RegisterTxCpltCallback ( hal_pssi_handle_t * hpssi , hal_pssi_cb_t p_callback )

Register the PSSI Tx Transfer completed callback.

Parameters :
  • hpssi – Pointer to a hal_pssi_handle_t

  • p_callback – Pointer to the Tx Transfer completed callback function

Return values :
  • HAL_OK – Operation completed successfully

  • HAL_INVALID_PARAM – Invalid parameter

hal_status_t HAL_PSSI_RegisterRxCpltCallback ( hal_pssi_handle_t * hpssi , hal_pssi_cb_t p_callback )

Register the PSSI Rx Transfer completed callback.

Parameters :
  • hpssi – Pointer to a hal_pssi_handle_t

  • p_callback – Pointer to the Rx Transfer completed callback function

Return values :
  • HAL_OK – Operation completed successfully

  • HAL_INVALID_PARAM – Invalid parameter

hal_status_t HAL_PSSI_RegisterErrorCallback ( hal_pssi_handle_t * hpssi , hal_pssi_cb_t p_callback )

Register the PSSI Error callback.

Parameters :
  • hpssi – Pointer to a hal_pssi_handle_t

  • p_callback – Pointer to the Error callback function

Return values :
  • HAL_OK – Operation completed successfully

  • HAL_INVALID_PARAM – Invalid parameter

hal_status_t HAL_PSSI_RegisterAbortCpltCallback ( hal_pssi_handle_t * hpssi , hal_pssi_cb_t p_callback )

Register the PSSI Abort completed callback.

Parameters :
  • hpssi – Pointer to a hal_pssi_handle_t

  • p_callback – Pointer to the Abort completed callback function

Return values :
  • HAL_OK – Operation completed successfully

  • HAL_INVALID_PARAM – Invalid parameter

hal_status_t HAL_PSSI_SetTxDMA ( hal_pssi_handle_t * hpssi , hal_dma_handle_t * hdma )

Link the Transmit DMA handle to the PSSI handle.

Parameters :
Return values :
  • HAL_OK – Operation completed successfully

  • HAL_INVALID_PARAM – Invalid parameter

hal_status_t HAL_PSSI_SetRxDMA ( hal_pssi_handle_t * hpssi , hal_dma_handle_t * hdma )

Link the Receive DMA handle to the PSSI handle.

Parameters :
Return values :
  • HAL_OK – Operation completed successfully

  • HAL_INVALID_PARAM – Invalid parameter

Input and Output operation functions

group PSSI_Exported_Functions_Group3

This subsection provides a set of functions allowing to manage the PSSI data transfers.

Functions

hal_status_t HAL_PSSI_Transmit ( hal_pssi_handle_t * hpssi , const void * p_data , uint32_t size_byte , uint32_t timeout_ms )

Transmit in master mode an amount of data in blocking mode.

Warning

The PSSI has an eight-word FIFO. A delay of some PDCK cycles (between 0 and 32 cycles) must be added after using this API.

Parameters :
  • hpssi – Pointer to a hal_pssi_handle_t structure.

  • p_data – Pointer to data buffer

  • size_byte – Amount of data to be sent (in bytes)

  • timeout_ms – Timeout duration

Return values :
  • HAL_OK – Operation completed successfully

  • HAL_INVALID_PARAM – Invalid parameter

  • HAL_TIMEOUT – Timeout exceeded

  • HAL_ERROR – Underrun Error Occurred

  • HAL_BUSY – there is ongoing process

hal_status_t HAL_PSSI_Receive ( hal_pssi_handle_t * hpssi , void * p_data , uint32_t size_byte , uint32_t timeout_ms )

Receive an amount of data in blocking mode.

Parameters :
  • hpssi – Pointer to a hal_pssi_handle_t structure.

  • p_data – Pointer to data buffer

  • size_byte – Amount of data to be received (in bytes)

  • timeout_ms – Timeout duration

Return values :
  • HAL_OK – Operation completed successfully

  • HAL_INVALID_PARAM – Invalid parameter

  • HAL_TIMEOUT – Timeout exceeded

  • HAL_ERROR – Overrun Error Occurred

  • HAL_BUSY – there is ongoing process

hal_status_t HAL_PSSI_Transmit_DMA ( hal_pssi_handle_t * hpssi , const void * p_data , uint32_t size_byte )

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

Warning

The PSSI has an eight-word FIFO. A delay of some PDCK cycles (between 0 and 32 cycles) must be added after calling the HAL_PSSI_TxCpltCallback()

Parameters :
  • hpssi – Pointer to a hal_pssi_handle_t structure.

  • p_data – Pointer to data buffer

  • size_byte – Amount of data to be sent (in bytes)

Return values :
  • HAL_OK – Operation completed successfully

  • HAL_INVALID_PARAM – Invalid parameter

  • HAL_ERROR – DMA failed to start the transfer

  • HAL_BUSY – there is ongoing process

hal_status_t HAL_PSSI_Receive_DMA ( hal_pssi_handle_t * hpssi , void * p_data , uint32_t size_byte )

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

Parameters :
  • hpssi – Pointer to a hal_pssi_handle_t structure.

  • p_data – Pointer to data buffer

  • size_byte – Amount of data to be received (in bytes)

Return values :
  • HAL_OK – Operation completed successfully

  • HAL_INVALID_PARAM – Invalid parameter

  • HAL_ERROR – DMA failed to start the transfer

  • HAL_BUSY – there is ongoing process

hal_status_t HAL_PSSI_Abort ( hal_pssi_handle_t * hpssi )

Abort a DMA process communication with Polling.

Parameters :

hpssi – Pointer to a hal_pssi_handle_t structure.

Return values :
  • HAL_OK – Operation completed successfully

  • HAL_ERROR – DMA is not processing any transfer

hal_status_t HAL_PSSI_Abort_IT ( hal_pssi_handle_t * hpssi )

Abort a DMA process communication with Interrupt.

Parameters :

hpssi – Pointer to a hal_pssi_handle_t structure.

Return values :
  • HAL_OK – Operation completed successfully

  • HAL_ERROR – DMA is not processing any transfer

IRQ Handler and Weak Callbacks Functions

group PSSI_Exported_Functions_Group4

A set of functions allowing to register IRQ Handler, Callbacks/weak functions. PSSI IRQHandler and Callbacks are used in non blocking modes (DMA). The end of the data processing will be indicated through the dedicated PSSI IRQ.

Functions

void HAL_PSSI_IRQHandler ( hal_pssi_handle_t * hpssi )

Handle PSSI event interrupt request.

Parameters :

hpssi – Pointer to a hal_pssi_handle_t structure.

void HAL_PSSI_TxCpltCallback ( hal_pssi_handle_t * hpssi )

Tx Transfer complete callback.

Parameters :

hpssi – Pointer to a hal_pssi_handle_t structure.

void HAL_PSSI_RxCpltCallback ( hal_pssi_handle_t * hpssi )

Rx Transfer complete callback.

Parameters :

hpssi – Pointer to a hal_pssi_handle_t structure.

void HAL_PSSI_ErrorCallback ( hal_pssi_handle_t * hpssi )

PSSI error callback.

Parameters :

hpssi – Pointer to a hal_pssi_handle_t structure.

void HAL_PSSI_AbortCpltCallback ( hal_pssi_handle_t * hpssi )

PSSI abort callback.

Parameters :

hpssi – Pointer to a hal_pssi_handle_t structure.

Peripheral State and Error functions

group PSSI_Exported_Functions_Group5

This subsection permits to get in run-time the status of the peripheral and the data flow.

Functions

hal_pssi_state_t HAL_PSSI_GetState ( const hal_pssi_handle_t * hpssi )

Return the PSSI handle state.

Parameters :

hpssi – Pointer to a hal_pssi_handle_t structure.

Return values :
  • HAL_PSSI_STATE_INIT

  • HAL_PSSI_STATE_IDLE

  • HAL_PSSI_STATE_TX

  • HAL_PSSI_STATE_RX

  • HAL_PSSI_STATE_ABORT

uint32_t HAL_PSSI_GetLastErrorCodes ( const hal_pssi_handle_t * hpssi )

Return the PSSI errors codes.

Parameters :

hpssi – Pointer to a hal_pssi_handle_t structure.

Returns :

uint32_t Returned value can be a combination of the following values:

  • HAL_PSSI_ERROR_NONE

  • HAL_PSSI_ERROR_UNDER_RUN

  • HAL_PSSI_ERROR_OVER_RUN

  • HAL_PSSI_ERROR_DMA

Peripheral Acquire/Release/Free the bus

group PSSI_Exported_Functions_Group6

A set of functions allowing to Acquire/Release the HAL PSSI handle based on the HAL OS abstraction layer (stm32_hal_os.c/.h osal):

Functions

hal_status_t HAL_PSSI_AcquireBus ( hal_pssi_handle_t * hpssi , uint32_t timeout_ms )

Acquire the HAL PSSI handle thanks to the HAL OS abstraction layer (stm32_hal_os.c/.h osal).

Note

The HAL_PSSI_AcquireBus must be called from thread mode only (not from handler mode i.e from ISR).

Parameters :
Return values :
  • HAL_OK – Operation completed successfully

  • HAL_ERROR – PSSI handle did not acquired

hal_status_t HAL_PSSI_ReleaseBus ( hal_pssi_handle_t * hpssi )

Release the HAL PSSI handle thanks to the HAL OS abstraction layer (stm32_hal_os.c/.h osal).

Note

The HAL_PSSI_ReleaseBus can be called from thread mode or from handler mode i.e from ISR.

Parameters :

hpssi – Pointer to a hal_pssi_handle_t

Return values :
  • HAL_OK – Operation completed successfully

  • HAL_ERROR – PSSI handle did not released

Set/Get user data

group PSSI_Exported_Functions_Group7

A set of functions allowing to manage a user data pointer stored to the PSSI handle:

Functions

void HAL_PSSI_SetUserData ( hal_pssi_handle_t * hpssi , const void * p_user_data )

Store the user data pointer into the handle.

Parameters :
const void * HAL_PSSI_GetUserData ( const hal_pssi_handle_t * hpssi )

Get the user data pointer from the handle.

Parameters :

hpssi – Pointer to a hal_pssi_handle_t

Returns :

Pointer to the user data.