/** Command processing for an issued SCSI READ CAPACITY (10) command. This command returns information about the device's capacity * on the selected Logical Unit (drive), as a number of OS-sized blocks. * * \param[in] MSInterfaceInfo Pointer to the Mass Storage class interface structure that the command is associated with * * \return Boolean \c true if the command completed successfully, \c false otherwise. */ static bool SCSI_Command_Read_Capacity_10(USB_ClassInfo_MS_Device_t* const MSInterfaceInfo) { Endpoint_Write_32_BE(LUN_MEDIA_BLOCKS - 1); Endpoint_Write_32_BE(SECTOR_SIZE_BYTES); Endpoint_ClearIN(); /* Succeed the command and update the bytes transferred counter */ MSInterfaceInfo->State.CommandBlock.DataTransferLength -= 8; return true; }
/** Command processing for an issued SCSI READ CAPACITY (10) command. This command returns information about the device's capacity * on the selected Logical Unit (drive), as a number of OS-sized blocks. * * \return Boolean true if the command completed successfully, false otherwise. */ static bool SCSI_Command_Read_Capacity_10(void) { /* Send the total number of logical blocks in the current LUN */ Endpoint_Write_32_BE(LUN_MEDIA_BLOCKS - 1); /* Send the logical block size of the device (must be 512 bytes) */ Endpoint_Write_32_BE(VIRTUAL_MEMORY_BLOCK_SIZE); /* Check if the current command is being aborted by the host */ if (IsMassStoreReset) return false; /* Send the endpoint data packet to the host */ Endpoint_ClearIN(); /* Succeed the command and update the bytes transferred counter */ CommandBlock.DataTransferLength -= 8; return true; }