sources/common/libs/STM32Cube_F4/Middlewares/ST/STM32_USB_Device_Library/Class/MSC/Src/usbd_msc_scsi.c
/**
  * @brief  SCSI_TestUnitReady
  *         Process SCSI Test Unit Ready Command
  * @param  lun: Logical unit number
  * @param  params: Command parameters
  * @retval status
  */
@brief  SCSI_TestUnitReady
Process SCSI Test Unit Ready Command
@param  lun: Logical unit number
@param  params: Command parameters
@retval status
@brief SCSI_TestUnitReady Process SCSI Test Unit Ready Command @param lun : Logical unit number @param params : Command parameters @retval status
static int8_t SCSI_TestUnitReady(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *params)
{
  UNUSED(params);
  USBD_MSC_BOT_HandleTypeDef *hmsc = (USBD_MSC_BOT_HandleTypeDef *)pdev->pClassDataCmsit[pdev->classId];
  if (hmsc == NULL)
  {
    return -1;
  }
  if (hmsc->cbw.dDataLength != 0U)
  {
    SCSI_SenseCode(pdev, hmsc->cbw.bLUN, ILLEGAL_REQUEST, INVALID_CDB);
    return -1;
  }
  if (hmsc->scsi_medium_state == SCSI_MEDIUM_EJECTED)
  {
    SCSI_SenseCode(pdev, lun, NOT_READY, MEDIUM_NOT_PRESENT);
    hmsc->bot_state = USBD_BOT_NO_DATA;
    return -1;
  }
  if (((USBD_StorageTypeDef *)pdev->pUserData[pdev->classId])->IsReady(lun) != 0)
  {
    SCSI_SenseCode(pdev, lun, NOT_READY, MEDIUM_NOT_PRESENT);
    hmsc->bot_state = USBD_BOT_NO_DATA;
    return -1;
  }
  hmsc->bot_data_length = 0U;
  return 0;
}
static int8_t SCSI_TestUnitReady ( USBD_HandleTypeDef * pdev , uint8_t lun , uint8_t * params ) { UNUSED ( params ) ; USBD_MSC_BOT_HandleTypeDef * hmsc = ( USBD_MSC_BOT_HandleTypeDef * ) pdev -> pClassDataCmsit [ pdev -> classId ] ; if ( hmsc == NULL ) { return -1 ; } if ( hmsc -> cbw . dDataLength != 0U ) { SCSI_SenseCode ( pdev , hmsc -> cbw . bLUN , ILLEGAL_REQUEST , INVALID_CDB ) ; return -1 ; } if ( hmsc -> scsi_medium_state == SCSI_MEDIUM_EJECTED ) { SCSI_SenseCode ( pdev , lun , NOT_READY , MEDIUM_NOT_PRESENT ) ; hmsc -> bot_state = USBD_BOT_NO_DATA ; return -1 ; } if ( ( ( USBD_StorageTypeDef * ) pdev -> pUserData [ pdev -> classId ] ) -> IsReady ( lun ) != 0 ) { SCSI_SenseCode ( pdev , lun , NOT_READY , MEDIUM_NOT_PRESENT ) ; hmsc -> bot_state = USBD_BOT_NO_DATA ; return -1 ; } hmsc -> bot_data_length = 0U ; return 0 ; }
@brief  SCSI_TestUnitReady
         Process SCSI Test Unit Ready Command
 @param  lun: Logical unit number
 @param  params: Command parameters
 @retval status
@brief SCSI_TestUnitReady Process SCSI Test Unit Ready Command @param lun : Logical unit number @param params : Command parameters @retval status
/* case 9 : Hi > D0 */