sources/common/libs/STM32Cube_F4/Middlewares/ST/STM32_USB_Device_Library/Class/MSC/Src/usbd_msc_scsi.c
/**
  * @brief  SCSI_StartStopUnit
  *         Process Start Stop Unit command
  * @param  lun: Logical unit number
  * @param  params: Command parameters
  * @retval status
  */
@brief  SCSI_StartStopUnit
Process Start Stop Unit command
@param  lun: Logical unit number
@param  params: Command parameters
@retval status
@brief SCSI_StartStopUnit Process Start Stop Unit command @param lun : Logical unit number @param params : Command parameters @retval status
static int8_t SCSI_StartStopUnit(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *params)
{
  UNUSED(lun);
  USBD_MSC_BOT_HandleTypeDef *hmsc = (USBD_MSC_BOT_HandleTypeDef *)pdev->pClassDataCmsit[pdev->classId];
  if (hmsc == NULL)
  {
    return -1;
  }
  if ((hmsc->scsi_medium_state == SCSI_MEDIUM_LOCKED) && ((params[4] & 0x3U) == 2U))
  {
    SCSI_SenseCode(pdev, lun, ILLEGAL_REQUEST, INVALID_FIELED_IN_COMMAND);
    return -1;
  }
  if ((params[4] & 0x3U) == 0x1U) 
  {
    hmsc->scsi_medium_state = SCSI_MEDIUM_UNLOCKED;
  }
  else if ((params[4] & 0x3U) == 0x2U) 
  {
    hmsc->scsi_medium_state = SCSI_MEDIUM_EJECTED;
  }
  else if ((params[4] & 0x3U) == 0x3U) 
  {
    hmsc->scsi_medium_state = SCSI_MEDIUM_UNLOCKED;
  }
  else
  {
  }
  hmsc->bot_data_length = 0U;
  return 0;
}
static int8_t SCSI_StartStopUnit ( USBD_HandleTypeDef * pdev , uint8_t lun , uint8_t * params ) { UNUSED ( lun ) ; USBD_MSC_BOT_HandleTypeDef * hmsc = ( USBD_MSC_BOT_HandleTypeDef * ) pdev -> pClassDataCmsit [ pdev -> classId ] ; if ( hmsc == NULL ) { return -1 ; } if ( ( hmsc -> scsi_medium_state == SCSI_MEDIUM_LOCKED ) && ( ( params [ 4 ] & 0x3U ) == 2U ) ) { SCSI_SenseCode ( pdev , lun , ILLEGAL_REQUEST , INVALID_FIELED_IN_COMMAND ) ; return -1 ; } if ( ( params [ 4 ] & 0x3U ) == 0x1U ) { hmsc -> scsi_medium_state = SCSI_MEDIUM_UNLOCKED ; } else if ( ( params [ 4 ] & 0x3U ) == 0x2U ) { hmsc -> scsi_medium_state = SCSI_MEDIUM_EJECTED ; } else if ( ( params [ 4 ] & 0x3U ) == 0x3U ) { hmsc -> scsi_medium_state = SCSI_MEDIUM_UNLOCKED ; } else { } hmsc -> bot_data_length = 0U ; return 0 ; }
@brief  SCSI_StartStopUnit
         Process Start Stop Unit command
 @param  lun: Logical unit number
 @param  params: Command parameters
 @retval status
@brief SCSI_StartStopUnit Process Start Stop Unit command @param lun : Logical unit number @param params : Command parameters @retval status
/* START=1 */ /* START=0 and LOEJ Load Eject=1 */ /* START=1 and LOEJ Load Eject=1 */ /* .. */