sources/common/libs/STM32Cube_F4/Middlewares/ST/STM32_USB_Device_Library/Class/MSC/Src/usbd_msc_scsi.c
/**
  * @brief  SCSI_ReadCapacity10
  *         Process Read Capacity 10 command
  * @param  lun: Logical unit number
  * @param  params: Command parameters
  * @retval status
  */
@brief  SCSI_ReadCapacity10
Process Read Capacity 10 command
@param  lun: Logical unit number
@param  params: Command parameters
@retval status
@brief SCSI_ReadCapacity10 Process Read Capacity 10 command @param lun : Logical unit number @param params : Command parameters @retval status
static int8_t SCSI_ReadCapacity10(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *params)
{
  UNUSED(params);
  int8_t ret;
  USBD_MSC_BOT_HandleTypeDef *hmsc = (USBD_MSC_BOT_HandleTypeDef *)pdev->pClassDataCmsit[pdev->classId];
  if (hmsc == NULL)
  {
    return -1;
  }
  ret = ((USBD_StorageTypeDef *)pdev->pUserData[pdev->classId])->GetCapacity(lun, &hmsc->scsi_blk_nbr, &hmsc->scsi_blk_size);
  if ((ret != 0) || (hmsc->scsi_medium_state == SCSI_MEDIUM_EJECTED))
  {
    SCSI_SenseCode(pdev, lun, NOT_READY, MEDIUM_NOT_PRESENT);
    return -1;
  }
  hmsc->bot_data[0] = (uint8_t)((hmsc->scsi_blk_nbr - 1U) >> 24);
  hmsc->bot_data[1] = (uint8_t)((hmsc->scsi_blk_nbr - 1U) >> 16);
  hmsc->bot_data[2] = (uint8_t)((hmsc->scsi_blk_nbr - 1U) >>  8);
  hmsc->bot_data[3] = (uint8_t)(hmsc->scsi_blk_nbr - 1U);
  hmsc->bot_data[4] = (uint8_t)(hmsc->scsi_blk_size >>  24);
  hmsc->bot_data[5] = (uint8_t)(hmsc->scsi_blk_size >>  16);
  hmsc->bot_data[6] = (uint8_t)(hmsc->scsi_blk_size >>  8);
  hmsc->bot_data[7] = (uint8_t)(hmsc->scsi_blk_size);
  hmsc->bot_data_length = 8U;
  return 0;
}
static int8_t SCSI_ReadCapacity10 ( USBD_HandleTypeDef * pdev , uint8_t lun , uint8_t * params ) { UNUSED ( params ) ; int8_t ret ; USBD_MSC_BOT_HandleTypeDef * hmsc = ( USBD_MSC_BOT_HandleTypeDef * ) pdev -> pClassDataCmsit [ pdev -> classId ] ; if ( hmsc == NULL ) { return -1 ; } ret = ( ( USBD_StorageTypeDef * ) pdev -> pUserData [ pdev -> classId ] ) -> GetCapacity ( lun , & hmsc -> scsi_blk_nbr , & hmsc -> scsi_blk_size ) ; if ( ( ret != 0 ) || ( hmsc -> scsi_medium_state == SCSI_MEDIUM_EJECTED ) ) { SCSI_SenseCode ( pdev , lun , NOT_READY , MEDIUM_NOT_PRESENT ) ; return -1 ; } hmsc -> bot_data [ 0 ] = ( uint8_t ) ( ( hmsc -> scsi_blk_nbr - 1U ) >> 24 ) ; hmsc -> bot_data [ 1 ] = ( uint8_t ) ( ( hmsc -> scsi_blk_nbr - 1U ) >> 16 ) ; hmsc -> bot_data [ 2 ] = ( uint8_t ) ( ( hmsc -> scsi_blk_nbr - 1U ) >> 8 ) ; hmsc -> bot_data [ 3 ] = ( uint8_t ) ( hmsc -> scsi_blk_nbr - 1U ) ; hmsc -> bot_data [ 4 ] = ( uint8_t ) ( hmsc -> scsi_blk_size >> 24 ) ; hmsc -> bot_data [ 5 ] = ( uint8_t ) ( hmsc -> scsi_blk_size >> 16 ) ; hmsc -> bot_data [ 6 ] = ( uint8_t ) ( hmsc -> scsi_blk_size >> 8 ) ; hmsc -> bot_data [ 7 ] = ( uint8_t ) ( hmsc -> scsi_blk_size ) ; hmsc -> bot_data_length = 8U ; return 0 ; }
@brief  SCSI_ReadCapacity10
         Process Read Capacity 10 command
 @param  lun: Logical unit number
 @param  params: Command parameters
 @retval status
@brief SCSI_ReadCapacity10 Process Read Capacity 10 command @param lun : Logical unit number @param params : Command parameters @retval status