mirror of
https://github.com/hathach/tinyusb.git
synced 2025-04-17 17:42:43 +00:00
house keeping
This commit is contained in:
parent
72b600c393
commit
f5cbc0f4af
@ -57,6 +57,9 @@ void msc_app_umount(uint8_t rhport)
|
||||
|
||||
}
|
||||
|
||||
// Callback 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
|
||||
int32_t tud_msc_scsi_cb (uint8_t lun, uint8_t const scsi_cmd[16], void* buffer, uint16_t bufsize)
|
||||
{
|
||||
// read10 & write10 has their own callback and MUST not be handled here
|
||||
@ -80,12 +83,12 @@ int32_t tud_msc_scsi_cb (uint8_t lun, uint8_t const scsi_cmd[16], void* buffer,
|
||||
break;
|
||||
|
||||
case SCSI_CMD_START_STOP_UNIT:
|
||||
// Host try to eject/safe remove/powerof us. We could safely disconnect with disk storage, or go into lower power
|
||||
// Host try to eject/safe remove/poweroff us. We could safely disconnect with disk storage, or go into lower power
|
||||
// scsi_start_stop_unit_t const * cmd_start_stop = (scsi_start_stop_unit_t const *) scsi_cmd
|
||||
len = 0;
|
||||
break;
|
||||
|
||||
// negative is error -> Data stage is STALL, status = failed
|
||||
// negative means error -> tusb could stall and/or response with failed status
|
||||
default: return -1;
|
||||
}
|
||||
|
||||
|
@ -88,9 +88,9 @@ uint8_t msc_device_ramdisk[DISK_BLOCK_NUM][DISK_BLOCK_SIZE] =
|
||||
[3] = README_CONTENTS
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// IMPLEMENTATION
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
// Callback invoked when received READ10 command.
|
||||
// Copy disk's data to buffer (up to bufsize) and return number of copied bytes.
|
||||
int32_t tud_msc_read10_cb(uint8_t lun, uint32_t lba, uint32_t offset, void* buffer, uint32_t bufsize)
|
||||
{
|
||||
uint8_t* addr = msc_device_ramdisk[lba] + offset;
|
||||
@ -99,6 +99,8 @@ int32_t tud_msc_read10_cb(uint8_t lun, uint32_t lba, uint32_t offset, void* buff
|
||||
return bufsize;
|
||||
}
|
||||
|
||||
// Callback invoked when received WRITE10 command.
|
||||
// Process data in buffer to disk's storage and return number of written bytes
|
||||
int32_t tud_msc_write10_cb(uint8_t lun, uint32_t lba, uint32_t offset, void* buffer, uint32_t bufsize)
|
||||
{
|
||||
uint8_t* addr = msc_device_ramdisk[lba] + offset;
|
||||
|
Loading…
x
Reference in New Issue
Block a user