Commit 00ad2a9b authored by Ben Avison's avatar Ben Avison

Brought into line with latest version of SCSISoft spec.

Detail:
  * Returns separate error numbers for the different "cancel background
    operation" reasons
  * Reports that it supports scatter lists
  * Debugging output is LF-CR terminated, not CR-LF
Admin:
  Tested briefly.

Version 0.03. Tagged as 'SCSISoftUSB-0_03'
parent 61710f61
/* (0.02)
/* (0.03)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.68.
*
*/
#define Module_MajorVersion_CMHG 0.02
#define Module_MajorVersion_CMHG 0.03
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 23 May 2003
#define Module_Date_CMHG 03 Jun 2003
#define Module_MajorVersion "0.02"
#define Module_Version 2
#define Module_MajorVersion "0.03"
#define Module_Version 3
#define Module_MinorVersion ""
#define Module_Date "23 May 2003"
#define Module_Date "03 Jun 2003"
#define Module_ApplicationDate "23-May-03"
#define Module_ApplicationDate "03-Jun-03"
#define Module_ComponentName "SCSISoftUSB"
#define Module_ComponentPath "RiscOS/Sources/HWSupport/SCSI/SCSISoftUSB"
#define Module_FullVersion "0.02"
#define Module_HelpVersion "0.02 (23 May 2003)"
#define Module_LibraryVersionInfo "0:2"
#define Module_FullVersion "0.03"
#define Module_HelpVersion "0.03 (03 Jun 2003)"
#define Module_LibraryVersionInfo "0:3"
......@@ -217,6 +217,7 @@ void glue_ResetBus(my_usb_device_t *device)
*
* Inputs
* device: struct describing the interface to reset
* reason: 0 => timeout, 1 => escape, 2 => aborted
*
* Outputs
* NONE
......@@ -224,7 +225,7 @@ void glue_ResetBus(my_usb_device_t *device)
* Returns
* NOTHING
*****************************************************************************/
void glue_ResetDevice(my_usb_device_t *device)
void glue_ResetDevice(my_usb_device_t *device, int reason)
{
DEBUGf("ResetDevice\n");
if (device->dying) return;
......@@ -241,7 +242,7 @@ void glue_ResetDevice(my_usb_device_t *device)
if (!irqs_were_off) _kernel_irqs_on();
device->background_transfer_active = false;
softc->sc_methods->wire_reset(softc, STATUS_ABORTED, (usbd_status *)&device->status);
softc->sc_methods->wire_reset(softc, STATUS_TIMED_OUT + reason, (usbd_status *)&device->status);
while (softc->transfer_state != TSTATE_IDLE /* && !device->background_transfer_active *** reset doesn't start any of these */)
{
softc->sc_methods->wire_state(softc, 0 /* last xfer wasn't bulk */, (usbd_status *)&device->status);
......@@ -683,6 +684,17 @@ static void Callback(struct umass_softc *softc, void *void_device, int not_trans
device->callback_error = (_kernel_oserror *)(ErrorNumber_SCSI_Died & 0xFF);
break;
case STATUS_TIMED_OUT:
device->callback_error = (_kernel_oserror *)(ErrorNumber_SCSI_Timeout2 & 0xFF);
break;
case STATUS_ESCAPE:
device->callback_error = _swix(MessageTrans_ErrorLookup, _INR(0,2),
& (_kernel_oserror) { 17, "Escape" },
0,
0);
break;
case STATUS_ABORTED:
device->callback_error = (_kernel_oserror *)(ErrorNumber_SCSI_AbortOp & 0xFF);
break;
......
......@@ -643,7 +643,7 @@ static _kernel_oserror *CheckConnectedDevice(const USBServiceCall *service_call_
break;
}
}
glue_ResetDevice(device);
glue_ResetDevice(device, 0);
device->scsi_driver_handle = RegisterSCSIDevice(device);
}
else
......@@ -770,7 +770,7 @@ _kernel_oserror *module_SCSIHandler(_kernel_swi_regs *r, void *pw)
switch ( ((int *)r)[11] )
{
case 0: /* Features */
r->r[1] = 2; /* supports background ops, not foreground ops */
r->r[1] = (1<<1) | (1<<5); /* supports background ops and scatter lists */
break;
case 1: /* Reset bus */
......@@ -779,7 +779,7 @@ _kernel_oserror *module_SCSIHandler(_kernel_swi_regs *r, void *pw)
case 2: /* Reset device */
case 3: /* Abort */
glue_ResetDevice((my_usb_device_t *)r->r[8]);
glue_ResetDevice((my_usb_device_t *)r->r[8], 0);
break;
case 4: /* Foreground op */
......@@ -813,7 +813,7 @@ _kernel_oserror *module_SCSIHandler(_kernel_swi_regs *r, void *pw)
}
case 6: /* Cancel background operation */
glue_ResetDevice((my_usb_device_t *)r->r[8]);
glue_ResetDevice((my_usb_device_t *)r->r[8], r->r[0] & (1<<11) ? 0 : r->r[0] & (1<<12) ? 1 : 2);
break;
default: /* Unknown reason code */
......
......@@ -119,8 +119,14 @@ static void prf(char *format, unsigned *argp, ...)
if( c == '\0' )
return;
if( c == '\n' )
{
oswrch('\n');
oswrch('\r');
oswrch(c);
}
else
{
oswrch(c);
}
}
again:
......
......@@ -112,6 +112,7 @@ extern void glue_DetachDevice(my_usb_device_t *device);
*
* Inputs
* device: struct describing the interface to reset
* reason: 0 => timeout, 1 => escape, 2 => aborted
*
* Outputs
* NONE
......@@ -119,7 +120,7 @@ extern void glue_DetachDevice(my_usb_device_t *device);
* Returns
* NOTHING
*****************************************************************************/
extern void glue_ResetDevice(my_usb_device_t *device);
extern void glue_ResetDevice(my_usb_device_t *device, int reason);
/*****************************************************************************
* glue_DoCommand
......
......@@ -151,7 +151,9 @@ typedef void (*umass_callback)(struct umass_softc *, void *, int, int);
#define STATUS_CMD_FAILED 2 /* transfer was ok, command failed */
#define STATUS_WIRE_FAILED 3 /* couldn't even get command across */
#ifdef __riscos
#define STATUS_ABORTED 4 /* aborted by higher layer (eg timeout) */
#define STATUS_TIMED_OUT 4 /* switcher detected timeout */
#define STATUS_ESCAPE 5 /* switcher detected Escape pressed */
#define STATUS_ABORTED 6 /* aborted by higher layer */
#endif
typedef void (*umass_wire_xfer)(struct umass_softc *, int, const void *, int, void *,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment