forked from len0rd/rockbox
send the USB broadcast events at a less busy time
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20142 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
69a5349369
commit
ec602b7e75
1 changed files with 13 additions and 2 deletions
|
@ -235,6 +235,8 @@ static union {
|
||||||
static struct {
|
static struct {
|
||||||
unsigned int sector;
|
unsigned int sector;
|
||||||
unsigned int count;
|
unsigned int count;
|
||||||
|
unsigned int orig_count;
|
||||||
|
unsigned int cur_cmd;
|
||||||
unsigned int tag;
|
unsigned int tag;
|
||||||
unsigned int lun;
|
unsigned int lun;
|
||||||
unsigned char *data[2];
|
unsigned char *data[2];
|
||||||
|
@ -519,6 +521,14 @@ void usb_storage_transfer_complete(int ep,int dir,int status,int length)
|
||||||
}
|
}
|
||||||
//logf("csw sent, now go back to idle");
|
//logf("csw sent, now go back to idle");
|
||||||
state = WAITING_FOR_COMMAND;
|
state = WAITING_FOR_COMMAND;
|
||||||
|
if(cur_cmd.cur_cmd == SCSI_WRITE_10)
|
||||||
|
{
|
||||||
|
queue_broadcast(SYS_USB_WRITE_DATA, (cur_cmd.lun<<16)+cur_cmd.orig_count);
|
||||||
|
}
|
||||||
|
else if(cur_cmd.cur_cmd == SCSI_READ_10)
|
||||||
|
{
|
||||||
|
queue_broadcast(SYS_USB_READ_DATA, (cur_cmd.lun<<16)+cur_cmd.orig_count);
|
||||||
|
}
|
||||||
usb_drv_recv(ep_out, tb.transfer_buffer, 1024);
|
usb_drv_recv(ep_out, tb.transfer_buffer, 1024);
|
||||||
break;
|
break;
|
||||||
case SENDING_RESULT:
|
case SENDING_RESULT:
|
||||||
|
@ -688,6 +698,7 @@ static void handle_scsi(struct command_block_wrapper* cbw)
|
||||||
|
|
||||||
cur_cmd.tag = cbw->tag;
|
cur_cmd.tag = cbw->tag;
|
||||||
cur_cmd.lun = lun;
|
cur_cmd.lun = lun;
|
||||||
|
cur_cmd.cur_cmd = cbw->command_block[0];
|
||||||
|
|
||||||
switch (cbw->command_block[0]) {
|
switch (cbw->command_block[0]) {
|
||||||
case SCSI_TEST_UNIT_READY:
|
case SCSI_TEST_UNIT_READY:
|
||||||
|
@ -964,9 +975,9 @@ static void handle_scsi(struct command_block_wrapper* cbw)
|
||||||
cur_cmd.count = block_size_mult *
|
cur_cmd.count = block_size_mult *
|
||||||
(cbw->command_block[7] << 8 |
|
(cbw->command_block[7] << 8 |
|
||||||
cbw->command_block[8]);
|
cbw->command_block[8]);
|
||||||
|
cur_cmd.orig_count = cur_cmd.count;
|
||||||
|
|
||||||
//logf("scsi read %d %d", cur_cmd.sector, cur_cmd.count);
|
//logf("scsi read %d %d", cur_cmd.sector, cur_cmd.count);
|
||||||
queue_broadcast(SYS_USB_READ_DATA, (lun<<16)+cur_cmd.count);
|
|
||||||
|
|
||||||
if((cur_cmd.sector + cur_cmd.count) > block_count) {
|
if((cur_cmd.sector + cur_cmd.count) > block_count) {
|
||||||
send_csw(UMS_STATUS_FAIL);
|
send_csw(UMS_STATUS_FAIL);
|
||||||
|
@ -1016,8 +1027,8 @@ static void handle_scsi(struct command_block_wrapper* cbw)
|
||||||
cur_cmd.count = block_size_mult *
|
cur_cmd.count = block_size_mult *
|
||||||
(cbw->command_block[7] << 8 |
|
(cbw->command_block[7] << 8 |
|
||||||
cbw->command_block[8]);
|
cbw->command_block[8]);
|
||||||
|
cur_cmd.orig_count = cur_cmd.count;
|
||||||
|
|
||||||
queue_broadcast(SYS_USB_WRITE_DATA, (lun<<16)+cur_cmd.count);
|
|
||||||
/* expect data */
|
/* expect data */
|
||||||
if((cur_cmd.sector + cur_cmd.count) > block_count) {
|
if((cur_cmd.sector + cur_cmd.count) > block_count) {
|
||||||
send_csw(UMS_STATUS_FAIL);
|
send_csw(UMS_STATUS_FAIL);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue