From efefbd3a4ef9d867d4aaa05e3c06e51b441aca6e Mon Sep 17 00:00:00 2001 From: hathach Date: Mon, 6 May 2019 15:01:38 +0700 Subject: add Test Unit Ready to builtin command, add tud_msc_test_unit_ready_cb() - rename tud_msc_maxlun_cb to tud_msc_get_maxlun_cb --- src/class/msc/msc_device.h | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src/class/msc/msc_device.h') diff --git a/src/class/msc/msc_device.h b/src/class/msc/msc_device.h index 068bea3ef..cbaea4bb8 100644 --- a/src/class/msc/msc_device.h +++ b/src/class/msc/msc_device.h @@ -97,12 +97,19 @@ int32_t tud_msc_write10_cb (uint8_t lun, uint32_t lba, uint32_t offset, uint8_t* // Application fill vendor id, product id and revision with string up to 8, 16, 4 characters respectively void tud_msc_inquiry_cb(uint8_t lun, uint8_t vendor_id[8], uint8_t product_id[16], uint8_t product_rev[4]); +// Invoked when received Test Unit Ready command. +// return true allowing host to read/write this LUN e.g SD card inserted +bool tud_msc_test_unit_ready_cb(uint8_t lun); + // Invoked when received SCSI_CMD_READ_CAPACITY_10 and SCSI_CMD_READ_FORMAT_CAPACITY to determine the disk size // Application update block count and block size void tud_msc_capacity_cb(uint8_t lun, uint32_t* block_count, uint16_t* block_size); /** - * Callback invoked when received an SCSI command not in built-in list below. + * Invoked when received an SCSI command not in built-in list below. + * - READ_CAPACITY10, READ_FORMAT_CAPACITY, INQUIRY, MODE_SENSE6, REQUEST_SENSE + * - READ10 and WRITE10 has their own callbacks + * * \param[in] lun Logical unit number * \param[in] scsi_cmd SCSI command contents which application must examine to response accordingly * \param[out] buffer Buffer for SCSI Data Stage. @@ -113,17 +120,13 @@ void tud_msc_capacity_cb(uint8_t lun, uint32_t* block_count, uint16_t* block_siz * \return Actual bytes processed, can be zero for no-data command. * \retval negative Indicate error e.g unsupported command, tinyusb will \b STALL the corresponding * endpoint and return failed status in command status wrapper phase. - * - * \note Following command is automatically handled by tinyusb stack, callback should not be worried: - * - READ_CAPACITY10, READ_FORMAT_CAPACITY, INQUIRY, MODE_SENSE6, REQUEST_SENSE - * - READ10 and WRITE10 has their own callbacks */ int32_t tud_msc_scsi_cb (uint8_t lun, uint8_t const scsi_cmd[16], void* buffer, uint16_t bufsize); /*------------- Optional callbacks -------------*/ -// Invoked when received GET_MAX_LUN request -ATTR_WEAK uint8_t tud_msc_maxlun_cb(void); +// Invoked when received GET_MAX_LUN request, required for multiple LUNs implementation +ATTR_WEAK uint8_t tud_msc_get_maxlun_cb(void); // Invoked when Read10 command is complete ATTR_WEAK void tud_msc_read10_complete_cb(uint8_t lun); -- cgit v1.3.1