add bufsize to tud_msc_inquiry2_cb()
This commit is contained in:
@@ -119,8 +119,9 @@ uint8_t msc_disk[DISK_BLOCK_NUM][DISK_BLOCK_SIZE] = {
|
|||||||
// Invoked when received SCSI_CMD_INQUIRY, v2 with full inquiry response
|
// Invoked when received SCSI_CMD_INQUIRY, v2 with full inquiry response
|
||||||
// Some inquiry_resp's fields are already filled with default values, application can update them
|
// Some inquiry_resp's fields are already filled with default values, application can update them
|
||||||
// Return length of inquiry response, typically sizeof(scsi_inquiry_resp_t) (36 bytes), can be longer if included vendor data.
|
// Return length of inquiry response, typically sizeof(scsi_inquiry_resp_t) (36 bytes), can be longer if included vendor data.
|
||||||
uint32_t tud_msc_inquiry2_cb(uint8_t lun, scsi_inquiry_resp_t* inquiry_resp) {
|
uint32_t tud_msc_inquiry2_cb(uint8_t lun, scsi_inquiry_resp_t *inquiry_resp, uint32_t bufsize) {
|
||||||
(void) lun;
|
(void) lun;
|
||||||
|
(void) bufsize;
|
||||||
const char vid[] = "TinyUSB";
|
const char vid[] = "TinyUSB";
|
||||||
const char pid[] = "Mass Storage";
|
const char pid[] = "Mass Storage";
|
||||||
const char rev[] = "1.0";
|
const char rev[] = "1.0";
|
||||||
|
@@ -166,7 +166,7 @@ static void io_task(void *params) {
|
|||||||
io_ops_t io_ops;
|
io_ops_t io_ops;
|
||||||
while (1) {
|
while (1) {
|
||||||
if (xQueueReceive(io_queue, &io_ops, portMAX_DELAY)) {
|
if (xQueueReceive(io_queue, &io_ops, portMAX_DELAY)) {
|
||||||
const uint8_t* addr = msc_disk[io_ops.lba] + io_ops.offset;
|
uint8_t* addr = (uint8_t*) (uintptr_t) (msc_disk[io_ops.lba] + io_ops.offset);
|
||||||
int32_t nbytes = io_ops.bufsize;
|
int32_t nbytes = io_ops.bufsize;
|
||||||
if (io_ops.is_read) {
|
if (io_ops.is_read) {
|
||||||
memcpy(io_ops.buffer, addr, io_ops.bufsize);
|
memcpy(io_ops.buffer, addr, io_ops.bufsize);
|
||||||
@@ -191,8 +191,9 @@ void msc_disk_init() {}
|
|||||||
// Invoked when received SCSI_CMD_INQUIRY, v2 with full inquiry response
|
// Invoked when received SCSI_CMD_INQUIRY, v2 with full inquiry response
|
||||||
// Some inquiry_resp's fields are already filled with default values, application can update them
|
// Some inquiry_resp's fields are already filled with default values, application can update them
|
||||||
// Return length of inquiry response, typically sizeof(scsi_inquiry_resp_t) (36 bytes), can be longer if included vendor data.
|
// Return length of inquiry response, typically sizeof(scsi_inquiry_resp_t) (36 bytes), can be longer if included vendor data.
|
||||||
uint32_t tud_msc_inquiry2_cb(uint8_t lun, scsi_inquiry_resp_t* inquiry_resp) {
|
uint32_t tud_msc_inquiry2_cb(uint8_t lun, scsi_inquiry_resp_t* inquiry_resp, uint32_t bufsize) {
|
||||||
(void) lun;
|
(void) lun;
|
||||||
|
(void) bufsize;
|
||||||
const char vid[] = "TinyUSB";
|
const char vid[] = "TinyUSB";
|
||||||
const char pid[] = "Mass Storage";
|
const char pid[] = "Mass Storage";
|
||||||
const char rev[] = "1.0";
|
const char rev[] = "1.0";
|
||||||
|
@@ -119,8 +119,9 @@ uint8_t msc_disk[DISK_BLOCK_NUM][DISK_BLOCK_SIZE] =
|
|||||||
// Invoked when received SCSI_CMD_INQUIRY, v2 with full inquiry response
|
// Invoked when received SCSI_CMD_INQUIRY, v2 with full inquiry response
|
||||||
// Some inquiry_resp's fields are already filled with default values, application can update them
|
// Some inquiry_resp's fields are already filled with default values, application can update them
|
||||||
// Return length of inquiry response, typically sizeof(scsi_inquiry_resp_t) (36 bytes), can be longer if included vendor data.
|
// Return length of inquiry response, typically sizeof(scsi_inquiry_resp_t) (36 bytes), can be longer if included vendor data.
|
||||||
uint32_t tud_msc_inquiry2_cb(uint8_t lun, scsi_inquiry_resp_t* inquiry_resp) {
|
uint32_t tud_msc_inquiry2_cb(uint8_t lun, scsi_inquiry_resp_t *inquiry_resp, uint32_t bufsize) {
|
||||||
(void) lun;
|
(void) lun;
|
||||||
|
(void) bufsize;
|
||||||
const char vid[] = "TinyUSB";
|
const char vid[] = "TinyUSB";
|
||||||
const char pid[] = "Mass Storage";
|
const char pid[] = "Mass Storage";
|
||||||
const char rev[] = "1.0";
|
const char rev[] = "1.0";
|
||||||
|
@@ -210,8 +210,9 @@ uint8_t tud_msc_get_maxlun_cb(void) {
|
|||||||
// Invoked when received SCSI_CMD_INQUIRY, v2 with full inquiry response
|
// Invoked when received SCSI_CMD_INQUIRY, v2 with full inquiry response
|
||||||
// Some inquiry_resp's fields are already filled with default values, application can update them
|
// Some inquiry_resp's fields are already filled with default values, application can update them
|
||||||
// Return length of inquiry response, typically sizeof(scsi_inquiry_resp_t) (36 bytes), can be longer if included vendor data.
|
// Return length of inquiry response, typically sizeof(scsi_inquiry_resp_t) (36 bytes), can be longer if included vendor data.
|
||||||
uint32_t tud_msc_inquiry2_cb(uint8_t lun, scsi_inquiry_resp_t* inquiry_resp) {
|
uint32_t tud_msc_inquiry2_cb(uint8_t lun, scsi_inquiry_resp_t *inquiry_resp, uint32_t bufsize) {
|
||||||
(void) lun;
|
(void) lun;
|
||||||
|
uint32_t bufsize
|
||||||
const char vid[] = "TinyUSB";
|
const char vid[] = "TinyUSB";
|
||||||
const char pid[] = "Mass Storage";
|
const char pid[] = "Mass Storage";
|
||||||
const char rev[] = "1.0";
|
const char rev[] = "1.0";
|
||||||
|
@@ -47,8 +47,8 @@
|
|||||||
TU_ATTR_WEAK void tud_msc_inquiry_cb(uint8_t lun, uint8_t vendor_id[8], uint8_t product_id[16], uint8_t product_rev[4]) {
|
TU_ATTR_WEAK void tud_msc_inquiry_cb(uint8_t lun, uint8_t vendor_id[8], uint8_t product_id[16], uint8_t product_rev[4]) {
|
||||||
(void) lun; (void) vendor_id; (void) product_id; (void) product_rev;
|
(void) lun; (void) vendor_id; (void) product_id; (void) product_rev;
|
||||||
}
|
}
|
||||||
TU_ATTR_WEAK uint32_t tud_msc_inquiry2_cb(uint8_t lun, scsi_inquiry_resp_t* inquiry_resp) {
|
TU_ATTR_WEAK uint32_t tud_msc_inquiry2_cb(uint8_t lun, scsi_inquiry_resp_t *inquiry_resp, uint32_t bufsize) {
|
||||||
(void) lun; (void) inquiry_resp;
|
(void) lun; (void) inquiry_resp; (void) bufsize;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -749,7 +749,7 @@ static int32_t proc_builtin_scsi(uint8_t lun, uint8_t const scsi_cmd[16], uint8_
|
|||||||
inquiry_rsp->response_data_format = 2;
|
inquiry_rsp->response_data_format = 2;
|
||||||
inquiry_rsp->additional_length = sizeof(scsi_inquiry_resp_t) - 5;
|
inquiry_rsp->additional_length = sizeof(scsi_inquiry_resp_t) - 5;
|
||||||
|
|
||||||
resplen = (int32_t) tud_msc_inquiry2_cb(lun, inquiry_rsp);
|
resplen = (int32_t) tud_msc_inquiry2_cb(lun, inquiry_rsp, bufsize);
|
||||||
if (resplen == 0) {
|
if (resplen == 0) {
|
||||||
// stub callback with no response, use v1 callback
|
// stub callback with no response, use v1 callback
|
||||||
tud_msc_inquiry_cb(lun, inquiry_rsp->vendor_id, inquiry_rsp->product_id, inquiry_rsp->product_rev);
|
tud_msc_inquiry_cb(lun, inquiry_rsp->vendor_id, inquiry_rsp->product_id, inquiry_rsp->product_rev);
|
||||||
|
@@ -97,7 +97,7 @@ void tud_msc_inquiry_cb(uint8_t lun, uint8_t vendor_id[8], uint8_t product_id[16
|
|||||||
// Invoked when received SCSI_CMD_INQUIRY, v2 with full inquiry response
|
// Invoked when received SCSI_CMD_INQUIRY, v2 with full inquiry response
|
||||||
// Some inquiry_resp's fields are already filled with default values, application can update them
|
// Some inquiry_resp's fields are already filled with default values, application can update them
|
||||||
// Return length of inquiry response, typically sizeof(scsi_inquiry_resp_t) (36 bytes), can be longer if included vendor data.
|
// Return length of inquiry response, typically sizeof(scsi_inquiry_resp_t) (36 bytes), can be longer if included vendor data.
|
||||||
uint32_t tud_msc_inquiry2_cb(uint8_t lun, scsi_inquiry_resp_t* inquiry_resp);
|
uint32_t tud_msc_inquiry2_cb(uint8_t lun, scsi_inquiry_resp_t *inquiry_resp, uint32_t bufsize);
|
||||||
|
|
||||||
// Invoked when received Test Unit Ready command.
|
// Invoked when received Test Unit Ready command.
|
||||||
// return true allowing host to read/write this LUN e.g SD card inserted
|
// return true allowing host to read/write this LUN e.g SD card inserted
|
||||||
|
@@ -97,8 +97,9 @@ uint8_t msc_disk[DISK_BLOCK_NUM][DISK_BLOCK_SIZE];
|
|||||||
// Invoked when received SCSI_CMD_INQUIRY, v2 with full inquiry response
|
// Invoked when received SCSI_CMD_INQUIRY, v2 with full inquiry response
|
||||||
// Some inquiry_resp's fields are already filled with default values, application can update them
|
// Some inquiry_resp's fields are already filled with default values, application can update them
|
||||||
// Return length of inquiry response, typically sizeof(scsi_inquiry_resp_t) (36 bytes), can be longer if included vendor data.
|
// Return length of inquiry response, typically sizeof(scsi_inquiry_resp_t) (36 bytes), can be longer if included vendor data.
|
||||||
uint32_t tud_msc_inquiry2_cb(uint8_t lun, scsi_inquiry_resp_t* inquiry_resp) {
|
uint32_t tud_msc_inquiry2_cb(uint8_t lun, scsi_inquiry_resp_t* inquiry_resp, uint32_t bufsize) {
|
||||||
(void) lun;
|
(void) lun;
|
||||||
|
(void) bufsize;
|
||||||
const char vid[] = "TinyUSB";
|
const char vid[] = "TinyUSB";
|
||||||
const char pid[] = "Mass Storage";
|
const char pid[] = "Mass Storage";
|
||||||
const char rev[] = "1.0";
|
const char rev[] = "1.0";
|
||||||
|
Reference in New Issue
Block a user