Functions
Functions
Peripheral Driver » HAL Driver » ISO7816
Collaboration diagram for Functions:

## Functions
hal_status_t | hal_iso7816_transmit (iso7816_handle_t *p_iso7816, uint16_t tx_size, uint32_t timeout)
| Transimit data in blocking mode. More...
hal_status_t | hal_iso7816_receive (iso7816_handle_t *p_iso7816, uint16_t rx_size, uint32_t timeout)
| Receive data in blocking mode. More...
hal_status_t | hal_iso7816_transmit_receive (iso7816_handle_t *p_iso7816, uint16_t tx_size, uint16_t rx_size, uint32_t timeout)
| Transimit and receive data in blocking mode. More...
hal_status_t | hal_iso7816_transmit_it (iso7816_handle_t *p_iso7816, uint16_t tx_size)
| Transimit data in non-blocking mode with Interrupt. More...
hal_status_t | hal_iso7816_receive_it (iso7816_handle_t *p_iso7816, uint16_t rx_size)
| Receive data in non-blocking mode with Interrupt. More...
hal_status_t | hal_iso7816_transmit_receive_it (iso7816_handle_t *p_iso7816, uint16_t tx_size, uint16_t rx_size)
| Transimit and receive data in non-blocking mode with Interrupt. More...
hal_status_t | hal_iso7816_abort (iso7816_handle_t *p_iso7816)
| Transfer Abort functions. More...
hal_status_t | hal_iso7816_init (iso7816_handle_t *p_iso7816)
| Initializes the ISO7816 according to the specified parameters in the iso7816_init_t and initialize the associated handle. More...
hal_status_t | hal_iso7816_deinit (iso7816_handle_t *p_iso7816)
| De-initializes the ISO7816 according to the specified parameters in the iso7816_init_t and initialize the associated handle. More...
void | hal_iso7816_msp_init (iso7816_handle_t *p_iso7816)
| Initialize the ISO7816 MSP. More...
void | hal_iso7816_msp_deinit (iso7816_handle_t *p_iso7816)
| De-initialize the ISO7816 MSP. More...
void | hal_iso7816_irq_handler (iso7816_handle_t *p_iso7816)
| Handle ISO7816 interrupt request. More...
void | hal_iso7816_presence_callback (iso7816_handle_t *p_iso7816)
| Card presence state changed callback. More...
void | hal_iso7816_atr_cplt_callback (iso7816_handle_t *p_iso7816)
| Receive ART completed callback. More...
void | hal_iso7816_rx_cplt_callback (iso7816_handle_t *p_iso7816)
| Rx Transfer completed callback. More...
void | hal_iso7816_tx_cplt_callback (iso7816_handle_t *p_iso7816)
| Tx Transfer completed callback. More...
void | hal_iso7816_tx_rx_cplt_callback (iso7816_handle_t *p_iso7816)
| Tx and Rx Transfer completed callback. More...
void | hal_iso7816_error_callback (iso7816_handle_t *p_iso7816)
| ISO7816 error callback. More...
void | hal_iso7816_abort_cplt_callback (iso7816_handle_t *p_iso7816)
| ISO7816 Abort Completed callback. More...
hal_iso7816_state_t | hal_iso7816_get_state (iso7816_handle_t *p_iso7816)
| Return the ISO7816 handle state. More...
hal_status_t | hal_iso7816_set_action (iso7816_handle_t *p_iso7816, uint32_t action)
| Request ISO7816 to go to the next action. More...
uint32_t | hal_iso7816_get_power_states (iso7816_handle_t *p_iso7816)
| Get ISO7816 Power States. More...
hal_status_t | hal_iso7816_set_etudiv (iso7816_handle_t *p_iso7816, uint32_t divide)
| Set divide ISO7816 clock. More...
uint32_t | hal_iso7816_get_error (iso7816_handle_t *p_iso7816)
| Return the ISO7816 error code. More...
hal_status_t | hal_iso7816_suspend_reg (iso7816_handle_t *p_iso7816)
| Suspend some registers related to ISO7816 configuration before sleep. More...
hal_status_t | hal_iso7816_resume_reg (iso7816_handle_t *p_iso7816)
| Restore some registers related to ISO7816 configuration after sleep. More...

## Detailed Description

## Function Documentation

## ◆ hal_iso7816_abort()

hal_status_t hal_iso7816_abort | ( | iso7816_handle_t * | p_iso7816 | ) |

Transfer Abort functions.

Parameters

  p_iso7816 | Pointer to an ISO7816 handle which contains the configuration information for the specified ISO7816.

Return values

  HAL_OK | Operation is OK.
  HAL_ERROR | Parameter error or operation not supported.
  HAL_BUSY | Driver is busy.
  HAL_TIMEOUT | Timeout occurred.

## ◆ hal_iso7816_abort_cplt_callback()

void hal_iso7816_abort_cplt_callback | ( | iso7816_handle_t * | p_iso7816 | ) |

ISO7816 Abort Completed callback.

Parameters

  [in] | p_iso7816 | ISO7816 handle.

## ◆ hal_iso7816_atr_cplt_callback()

void hal_iso7816_atr_cplt_callback | ( | iso7816_handle_t * | p_iso7816 | ) |

Receive ART completed callback.

Parameters

  [in] | p_iso7816 | Pointer to an ISO7816 handle which contains the configuration information for the specified ISO7816 module.

## ◆ hal_iso7816_deinit()

hal_status_t hal_iso7816_deinit | ( | iso7816_handle_t * | p_iso7816 | ) |

De-initializes the ISO7816 according to the specified parameters in the iso7816_init_t and initialize the associated handle.

Parameters

  [in] | p_iso7816 | Pointer to an ISO7816 handle which contains the configuration information for the specified ISO7816.

Return values

  HAL_OK | Operation is OK.
  HAL_ERROR | Parameter error or operation not supported.
  HAL_BUSY | Driver is busy.
  HAL_TIMEOUT | Timeout occurred.

## ◆ hal_iso7816_error_callback()

void hal_iso7816_error_callback | ( | iso7816_handle_t * | p_iso7816 | ) |

ISO7816 error callback.

Parameters

  [in] | p_iso7816 | Pointer to an ISO7816 handle which contains the configuration information for the specified ISO7816 module.

## ◆ hal_iso7816_get_error()

uint32_t hal_iso7816_get_error | ( | iso7816_handle_t * | p_iso7816 | ) |

Return the ISO7816 error code.

Parameters

  [in] | p_iso7816 | ISO7816 handle.

Returns
  ISO7816 Error Code

## ◆ hal_iso7816_get_power_states()

uint32_t hal_iso7816_get_power_states | ( | iso7816_handle_t * | p_iso7816 | ) |

Get ISO7816 Power States.

Parameters

  p_iso7816 | ISO7816 handle.

Return values

  Returned | value can be one of the following values: HAL_ISO7816_PWR_STATE_OFF HAL_ISO7816_PWR_STATE_PWRUP_VCC HAL_ISO7816_PWR_STATE_PWRUP_RST HAL_ISO7816_PWR_STATE_PWRDN_RST HAL_ISO7816_PWR_STATE_PWRDN_VCC HAL_ISO7816_PWR_STATE_STOP_PRE HAL_ISO7816_PWR_STATE_STOP HAL_ISO7816_PWR_STATE_STOP_POST HAL_ISO7816_PWR_STATE_IDLE HAL_ISO7816_PWR_STATE_RX_TS0 HAL_ISO7816_PWR_STATE_RX_TS1 HAL_ISO7816_PWR_STATE_RX HAL_ISO7816_PWR_STATE_TX HAL_ISO7816_PWR_STATE_TX_RX

## ◆ hal_iso7816_get_state()

hal_iso7816_state_t hal_iso7816_get_state | ( | iso7816_handle_t * | p_iso7816 | ) |

Return the ISO7816 handle state.

Parameters

  [in] | p_iso7816 | ISO7816 handle.

Return values

  HAL_ISO7816_STATE_RESET |
  HAL_ISO7816_STATE_READY |
  HAL_ISO7816_STATE_BUSY |
  HAL_ISO7816_STATE_BUSY_TX |
  HAL_ISO7816_STATE_BUSY_RX |
  HAL_ISO7816_STATE_BUSY_TX_RX |
  HAL_ISO7816_STATE_ABORT |
  HAL_ISO7816_STATE_TIMEOUT |
  HAL_ISO7816_STATE_ERROR |

## ◆ hal_iso7816_init()

hal_status_t hal_iso7816_init | ( | iso7816_handle_t * | p_iso7816 | ) |

Initializes the ISO7816 according to the specified parameters in the iso7816_init_t and initialize the associated handle.

Parameters

  [in] | p_iso7816 | Pointer to an ISO7816 handle which contains the configuration information for the specified ISO7816.

Return values

  HAL_OK | Operation is OK.
  HAL_ERROR | Parameter error or operation not supported.
  HAL_BUSY | Driver is busy.
  HAL_TIMEOUT | Timeout occurred.

## ◆ hal_iso7816_irq_handler()

void hal_iso7816_irq_handler | ( | iso7816_handle_t * | p_iso7816 | ) |

Handle ISO7816 interrupt request.

Parameters

  [in] | p_iso7816 | Pointer to an ISO7816 handle which contains the configuration information for the specified ISO7816.

## ◆ hal_iso7816_msp_deinit()

void hal_iso7816_msp_deinit | ( | iso7816_handle_t * | p_iso7816 | ) |

De-initialize the ISO7816 MSP.

Note
  This function should not be modified. When the callback is needed, the hal_iso7816_msp_deinit could be implemented in the user file.

Parameters

  [in] | p_iso7816 | Pointer to an ISO7816 handle which contains the configuration information for the specified ISO7816.

## ◆ hal_iso7816_msp_init()

void hal_iso7816_msp_init | ( | iso7816_handle_t * | p_iso7816 | ) |

Initialize the ISO7816 MSP.

Note
  This function should not be modified. When the callback is needed, the hal_iso7816_msp_init could be implemented in the user file.

Parameters

  [in] | p_iso7816 | Pointer to an ISO7816 handle which contains the configuration information for the specified ISO7816.

## ◆ hal_iso7816_presence_callback()

void hal_iso7816_presence_callback | ( | iso7816_handle_t * | p_iso7816 | ) |

Card presence state changed callback.

Parameters

  [in] | p_iso7816 | Pointer to an ISO7816 handle which contains the configuration information for the specified ISO7816 module.

## ◆ hal_iso7816_receive()

hal_status_t hal_iso7816_receive | ( | iso7816_handle_t * | p_iso7816,
|  | uint16_t | rx_size,
|  | uint32_t | timeout
| ) |  |

Receive data in blocking mode.

Parameters

  p_iso7816 | Pointer to an ISO7816 handle which contains the configuration information for the specified ISO7816.
  rx_size | Bytes of data to receive
  timeout | Timeout duration

Return values

  HAL_OK | Operation is OK.
  HAL_ERROR | Parameter error or operation not supported.
  HAL_BUSY | Driver is busy.
  HAL_TIMEOUT | Timeout occurred.

## ◆ hal_iso7816_receive_it()

hal_status_t hal_iso7816_receive_it | ( | iso7816_handle_t * | p_iso7816,
|  | uint16_t | rx_size
| ) |  |

Receive data in non-blocking mode with Interrupt.

Parameters

  p_iso7816 | Pointer to an ISO7816 handle which contains the configuration information for the specified ISO7816.
  rx_size | Bytes of data to receive

Return values

  HAL_OK | Operation is OK.
  HAL_ERROR | Parameter error or operation not supported.
  HAL_BUSY | Driver is busy.
  HAL_TIMEOUT | Timeout occurred.

## ◆ hal_iso7816_resume_reg()

hal_status_t hal_iso7816_resume_reg | ( | iso7816_handle_t * | p_iso7816 | ) |

Restore some registers related to ISO7816 configuration after sleep.

This function must be used in conjunction with the hal_iso7816_suspend_reg().

Parameters

  [in] | p_iso7816 | ISO7816 handle.

Return values

  HAL_OK | Operation is OK.
  HAL_ERROR | Parameter error or operation not supported.
  HAL_BUSY | Driver is busy.
  HAL_TIMEOUT | Timeout occurred.

## ◆ hal_iso7816_rx_cplt_callback()

void hal_iso7816_rx_cplt_callback | ( | iso7816_handle_t * | p_iso7816 | ) |

Rx Transfer completed callback.

Parameters

  [in] | p_iso7816 | Pointer to an ISO7816 handle which contains the configuration information for the specified ISO7816 module.

## ◆ hal_iso7816_set_action()

hal_status_t hal_iso7816_set_action | ( | iso7816_handle_t * | p_iso7816,
|  | uint32_t | action
| ) |  |

Request ISO7816 to go to the next action.

Parameters

  p_iso7816 | ISO7816 handle.
  action | This parameter can be one of the following values: HAL_ISO7816_ACTION_NONE HAL_ISO7816_ACTION_OFF HAL_ISO7816_ACTION_STOPCLK HAL_ISO7816_ACTION_ON HAL_ISO7816_ACTION_WARMRST HAL_ISO7816_ACTION_RX HAL_ISO7816_ACTION_TX HAL_ISO7816_ACTION_TXRX

Return values

  HAL_OK | Operation is OK.
  HAL_ERROR | Parameter error or operation not supported.
  HAL_BUSY | Driver is busy.

## ◆ hal_iso7816_set_etudiv()

hal_status_t hal_iso7816_set_etudiv | ( | iso7816_handle_t * | p_iso7816,
|  | uint32_t | divide
| ) |  |

Set divide ISO7816 clock.

Note
  Divide SIM clock by this value+1 to define ETU length. The reset value is the one, needed for theATR.

Parameters

  p_iso7816 | ISO7816 handle.
  divide | This parameter should range between 0x0 and 0x3FF.

Return values

  None. |

## ◆ hal_iso7816_suspend_reg()

hal_status_t hal_iso7816_suspend_reg | ( | iso7816_handle_t * | p_iso7816 | ) |

Suspend some registers related to ISO7816 configuration before sleep.

Parameters

  [in] | p_iso7816 | ISO7816 handle.

Return values

  HAL_OK | Operation is OK.
  HAL_ERROR | Parameter error or operation not supported.
  HAL_BUSY | Driver is busy.
  HAL_TIMEOUT | Timeout occurred.

## ◆ hal_iso7816_transmit()

hal_status_t hal_iso7816_transmit | ( | iso7816_handle_t * | p_iso7816,
|  | uint16_t | tx_size,
|  | uint32_t | timeout
| ) |  |

Transimit data in blocking mode.

Parameters

  p_iso7816 | Pointer to an ISO7816 handle which contains the configuration information for the specified ISO7816.
  tx_size | Bytes of data to transmit
  timeout | Timeout duration

Return values

  HAL_OK | Operation is OK.
  HAL_ERROR | Parameter error or operation not supported.
  HAL_BUSY | Driver is busy.
  HAL_TIMEOUT | Timeout occurred.

## ◆ hal_iso7816_transmit_it()

hal_status_t hal_iso7816_transmit_it | ( | iso7816_handle_t * | p_iso7816,
|  | uint16_t | tx_size
| ) |  |

Transimit data in non-blocking mode with Interrupt.

Parameters

  p_iso7816 | Pointer to an ISO7816 handle which contains the configuration information for the specified ISO7816.
  tx_size | Bytes of data to transmit

Return values

  HAL_OK | Operation is OK.
  HAL_ERROR | Parameter error or operation not supported.
  HAL_BUSY | Driver is busy.
  HAL_TIMEOUT | Timeout occurred.

## ◆ hal_iso7816_transmit_receive()

hal_status_t hal_iso7816_transmit_receive | ( | iso7816_handle_t * | p_iso7816,
|  | uint16_t | tx_size,
|  | uint16_t | rx_size,
|  | uint32_t | timeout
| ) |  |

Transimit and receive data in blocking mode.

Parameters

  p_iso7816 | Pointer to an ISO7816 handle which contains the configuration information for the specified ISO7816.
  tx_size | Bytes of data to transmit
  rx_size | Bytes of data to receive
  timeout | Timeout duration

Return values

  HAL_OK | Operation is OK.
  HAL_ERROR | Parameter error or operation not supported.
  HAL_BUSY | Driver is busy.
  HAL_TIMEOUT | Timeout occurred.

## ◆ hal_iso7816_transmit_receive_it()

hal_status_t hal_iso7816_transmit_receive_it | ( | iso7816_handle_t * | p_iso7816,
|  | uint16_t | tx_size,
|  | uint16_t | rx_size
| ) |  |

Transimit and receive data in non-blocking mode with Interrupt.

Parameters

  p_iso7816 | Pointer to an ISO7816 handle which contains the configuration information for the specified ISO7816.
  tx_size | Bytes of data to transfer.
  rx_size | Bytes of data to receive.

Return values

  HAL_OK | Operation is OK.
  HAL_ERROR | Parameter error or operation not supported.
  HAL_BUSY | Driver is busy.
  HAL_TIMEOUT | Timeout occurred.

## ◆ hal_iso7816_tx_cplt_callback()

void hal_iso7816_tx_cplt_callback | ( | iso7816_handle_t * | p_iso7816 | ) |

Tx Transfer completed callback.

Parameters

  [in] | p_iso7816 | Pointer to an ISO7816 handle which contains the configuration information for the specified ISO7816 module.

## ◆ hal_iso7816_tx_rx_cplt_callback()

void hal_iso7816_tx_rx_cplt_callback | ( | iso7816_handle_t * | p_iso7816 | ) |

Tx and Rx Transfer completed callback.

Parameters

  [in] | p_iso7816 | Pointer to an ISO7816 handle which contains the configuration information for the specified ISO7816 module.