sources/common/libs/STM32Cube_F4/Middlewares/ST/STM32_USB_Device_Library/Class/CCID/Src/usbd_ccid_cmd.c
/**
  * @brief  PC_to_RDR_SetParameters
  *         Set the ICC parameters to the host defined parameters
  *         Response to this command message is the RDR_to_PC_Parameters
  * @param  pdev: device instance
  * @retval status of the command execution
  */
@brief  PC_to_RDR_SetParameters
Set the ICC parameters to the host defined parameters
Response to this command message is the RDR_to_PC_Parameters
@param  pdev: device instance
@retval status of the command execution
@brief PC_to_RDR_SetParameters Set the ICC parameters to the host defined parameters Response to this command message is the RDR_to_PC_Parameters @param pdev : device instance @retval status of the command execution
uint8_t  PC_to_RDR_SetParameters(USBD_HandleTypeDef *pdev)
{
  USBD_CCID_HandleTypeDef  *hccid = (USBD_CCID_HandleTypeDef *)pdev->pClassDataCmsit[pdev->classId];
  uint8_t error;
  error = CCID_CheckCommandParams(pdev, CHK_PARAM_SLOT | CHK_PARAM_CARD_PRESENT |
                                  CHK_PARAM_ABRFU2 | CHK_ACTIVE_STATE);
  if (error != 0U)
  {
    return error;
  }
  error = SLOT_NO_ERROR;
  if (((hccid->UsbBlkOutData.dwLength == 5U) && (hccid->UsbBlkOutData.bSpecific_0 != 0U))
      || ((hccid->UsbBlkOutData.dwLength == 7U) && (hccid->UsbBlkOutData.bSpecific_0 != 1U)))
  {
    error = SLOTERROR_BAD_PROTOCOLNUM;
  }
  if (hccid->UsbBlkOutData.abData[4] != DEFAULT_CLOCKSTOP)
  {
    error = SLOTERROR_BAD_CLOCKSTOP;
  }
  if (error != SLOT_NO_ERROR)
  {
    CCID_UpdateCommandStatus(pdev, (BM_COMMAND_STATUS_FAILED), (BM_ICC_PRESENT_ACTIVE));
  }
  (void)USBD_memcpy(&ProtocolData, (void const *)(&hccid->UsbBlkOutData.abData[0]),
                    sizeof(ProtocolData));
  error = SC_Itf_SetParams(&ProtocolData, ProtocolNUM_OUT);
  if (error != SLOT_NO_ERROR)
  {
    CCID_UpdateCommandStatus(pdev, (BM_COMMAND_STATUS_FAILED), (BM_ICC_PRESENT_ACTIVE));
  }
  else
  {
    CCID_UpdateCommandStatus(pdev, (BM_COMMAND_STATUS_NO_ERROR), (BM_ICC_PRESENT_ACTIVE));
    error = SLOT_NO_ERROR;
  }
  return error;
}
uint8_t PC_to_RDR_SetParameters ( USBD_HandleTypeDef * pdev ) { USBD_CCID_HandleTypeDef * hccid = ( USBD_CCID_HandleTypeDef * ) pdev -> pClassDataCmsit [ pdev -> classId ] ; uint8_t error ; error = CCID_CheckCommandParams ( pdev , CHK_PARAM_SLOT | CHK_PARAM_CARD_PRESENT | CHK_PARAM_ABRFU2 | CHK_ACTIVE_STATE ) ; if ( error != 0U ) { return error ; } error = SLOT_NO_ERROR ; if ( ( ( hccid -> UsbBlkOutData . dwLength == 5U ) && ( hccid -> UsbBlkOutData . bSpecific_0 != 0U ) ) || ( ( hccid -> UsbBlkOutData . dwLength == 7U ) && ( hccid -> UsbBlkOutData . bSpecific_0 != 1U ) ) ) { error = SLOTERROR_BAD_PROTOCOLNUM ; } if ( hccid -> UsbBlkOutData . abData [ 4 ] != DEFAULT_CLOCKSTOP ) { error = SLOTERROR_BAD_CLOCKSTOP ; } if ( error != SLOT_NO_ERROR ) { CCID_UpdateCommandStatus ( pdev , ( BM_COMMAND_STATUS_FAILED ) , ( BM_ICC_PRESENT_ACTIVE ) ) ; } ( void ) USBD_memcpy ( & ProtocolData , ( void const * ) ( & hccid -> UsbBlkOutData . abData [ 0 ] ) , sizeof ( ProtocolData ) ) ; error = SC_Itf_SetParams ( & ProtocolData , ProtocolNUM_OUT ) ; if ( error != SLOT_NO_ERROR ) { CCID_UpdateCommandStatus ( pdev , ( BM_COMMAND_STATUS_FAILED ) , ( BM_ICC_PRESENT_ACTIVE ) ) ; } else { CCID_UpdateCommandStatus ( pdev , ( BM_COMMAND_STATUS_NO_ERROR ) , ( BM_ICC_PRESENT_ACTIVE ) ) ; error = SLOT_NO_ERROR ; } return error ; }
@brief  PC_to_RDR_SetParameters
         Set the ICC parameters to the host defined parameters
         Response to this command message is the RDR_to_PC_Parameters
 @param  pdev: device instance
 @retval status of the command execution
@brief PC_to_RDR_SetParameters Set the ICC parameters to the host defined parameters Response to this command message is the RDR_to_PC_Parameters @param pdev : device instance @retval status of the command execution
/* for Protocol T=0 (dwLength=00000005h) */ /* for Protocol T=1 (dwLength=00000007h) */