Commit 86b987a8 authored by Ben Avison's avatar Ben Avison
Browse files

Added SWI CD_SCSIUserOp (see Doc/SCSIUserOp).

Version 2.38. Tagged as 'CDFSDriver-2_38'
parent df2541fb
......@@ -218,7 +218,7 @@ cd_identify
; on exit:
; if oVerflow clear:
; r0 - r1 preserved
; r2 = drive type given by CDFS driver, else -1 if type not recognized
; r2 = drive type given by CDFS driver, else -1 if type not recognised
; if oVerflow set:
; r0 -> error block, could be because no drivers loaded
; r1 - r9 preserved
......@@ -239,7 +239,7 @@ cd_register
; block + 0 = information word for CDFSDriver module
; block + 4 = number of times registered (should be set to zero
; and will be updated by CDFSDriver)
; block + 8 = number of drive types recognized by this driver
; block + 8 = number of drive types recognised by this driver
; r1 -> special tag (&EE50EE50 = 1 word) followed by the handler code
; r2 -> workspace for soft-loadable module (this will be R12 in the handler)
;
......@@ -257,7 +257,7 @@ cd_unregister
; block + 0 = information word for CDFSDriver module
; block + 4 = number of times registered (should be set to zero
; and will be updated by CDFSDriver)
; block + 8 = number of drive types recognized by this driver
; block + 8 = number of drive types recognised by this driver
; r1 -> special tag (&EE50EE50 = 1 word) followed by the handler code
;
; r12 -> my workspace pointer
......
CDFSDriver
~~~~~~~~~~
SWI CD_Register (SWI &41260) / CD_Unregister (SWI &41261):
Bit 21 of the information word may be set to indicate that CDFSDriver
should call SWI SCSI_Op to implement SWI CD_SCSIUserOp, instead of
calling the soft-loadable driver.
SWI CD_SCSIUserOp (SWI &4126B):
On entry:
R0 bits 24-25 = 0 => no data transfer
= 1 => read
= 2 => write
= 3 reserved
R1 = length of control block
R2 -> control block
R3 -> buffer for data transfer
R4 = length of transfer
R5 = timeout in cs (0 = default)
R7 -> CDFS control block
On exit:
R3,R4 updated
R5-R9 preserved
NZC flags corrupted
If V set,
R0-R2 are as for SWI SCSI_Op
or R0 -> error not in SCSI range and R1,R2 corrupt
Else R0-R2 preserved
Must not be called from background (for compatibility with ATAPI drives)
"Soft-loadable" drivers
~~~~~~~~~~~~~~~~~~~~~~~
Entry #36 ("SCSIUserOp"):
On entry:
R0 bits 24-25 = 0 => no data transfer
= 1 => read
= 2 => write
= 3 reserved
R1 = length of control block
R2 -> control block
R3 -> buffer for data transfer
R4 = length of transfer
R5 = timeout in cs (0 = default)
R7 -> CDFS control block
R11 = reason code (36)
R12 = workspace
On exit:
R3,R4 updated
R5-R12 may be corrupted
NZC flags may be corrupted
If V set,
R0-R2 are as for SWI SCSI_Op
or R0 -> error not in SCSI range and R1,R2 may be corrupted
Else R0-R2 may be corrupted
......@@ -11,13 +11,13 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "2.37"
Module_Version SETA 237
Module_MajorVersion SETS "2.38"
Module_Version SETA 238
Module_MinorVersion SETS ""
Module_Date SETS "06 Nov 2002"
Module_ApplicationDate SETS "06-Nov-02"
Module_Date SETS "22 Nov 2002"
Module_ApplicationDate SETS "22-Nov-02"
Module_ComponentName SETS "CDFSDriver"
Module_ComponentPath SETS "RiscOS/Sources/HWSupport/CD/CDFSDriver"
Module_FullVersion SETS "2.37"
Module_HelpVersion SETS "2.37 (06 Nov 2002)"
Module_FullVersion SETS "2.38"
Module_HelpVersion SETS "2.38 (22 Nov 2002)"
END
/* (2.37)
/* (2.38)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.68.
*
*/
#define Module_MajorVersion_CMHG 2.37
#define Module_MajorVersion_CMHG 2.38
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 06 Nov 2002
#define Module_Date_CMHG 22 Nov 2002
#define Module_MajorVersion "2.37"
#define Module_Version 237
#define Module_MajorVersion "2.38"
#define Module_Version 238
#define Module_MinorVersion ""
#define Module_Date "06 Nov 2002"
#define Module_Date "22 Nov 2002"
#define Module_ApplicationDate "06-Nov-02"
#define Module_ApplicationDate "22-Nov-02"
#define Module_ComponentName "CDFSDriver"
#define Module_ComponentPath "RiscOS/Sources/HWSupport/CD/CDFSDriver"
#define Module_FullVersion "2.37"
#define Module_HelpVersion "2.37 (06 Nov 2002)"
#define Module_LibraryVersionInfo "2:37"
#define Module_FullVersion "2.38"
#define Module_HelpVersion "2.38 (22 Nov 2002)"
#define Module_LibraryVersionInfo "2:38"
......@@ -76,6 +76,7 @@ SWIClass SETS CDROMSWI_Name
AddSWI SeekUserData ; +40
AddSWI GetAudioParms ; +41
AddSWI SetAudioParms ; +42
AddSWI SCSIUserOp ; +43
OPT OldOpt
END
......@@ -220,8 +220,8 @@ backgroundoff * 2_000000000000000000000000000000 ; = 0
;I_bit * &08000000
FIRQ_Flag * 1:ROL:26
IRQ_Flag * 1:ROL:27
;FIRQ_Flag * 1:ROL:26
;IRQ_Flag * 1:ROL:27
Overflow_Flag * 1:ROL:28
Carry_Flag * 1:ROL:29
Zero_Flag * 1:ROL:30
......@@ -264,6 +264,7 @@ USE_PROPRIETARY_RUD * 1<<17 ; = 1 if support own method of reading dat
USE_COMPLEX_RUD * 1<<18 ; = 1 if want SCSI scatter list method of reading data
USE_PROPRIETARY_SUD * 1<<19 ; = 1 if support own method of seeking to data
USE_COMPLEX_SUD * 1<<20 ; = 1 if want SCSI scatter list method of seeking to data
USE_SCSI_OP * 1<<21
;----------------------------------------------------------------------------------------------
; Maximum number of soft-loadable device drivers
......
......@@ -763,6 +763,31 @@ cd_checkdrive ROUT
STR r0, [sp, #0*4]
SWIExitVC
;-----------------------------------------------------------------------------------------------
cd_scsiuserop ROUT
;
; on entry:
; r0-r5 as for SCSI_Op (but no device info in R0)
; r7 -> control block
; on exit:
; usual error stuff
;-----------------------------------------------------------------------------------------------
Debug "cd_scsiuserop",NL
LDMIA r7, { r8, r9, r10 }
ORR r0, r0, r8 ; device
ORR r0, r0, r9, LSL #3 ; card number
ORR r0, r0, r10, LSL #5 ; lun
ORR r0, r0, #escapepolloff ; prevent 'escape key'
MOV r8, #1
SWI XSCSI_Op
BVS error_handler_manyregs
SWIExitVC
;-----------------------------------------------------------------------------------------------
cd_readuserdata ROUT
;
......
......@@ -61,7 +61,7 @@ cd_identify ROUT
; on exit:
; if oVerflow clear:
; r0 - r1 preserved
; r2 = drive type given by CDFS driver, else -1 if type not recognized
; r2 = drive type given by CDFS driver, else -1 if type not recognised
; if oVerflow set:
; r0 -> error block, could be because no drivers loaded
; r1 - r9 preserved
......@@ -132,7 +132,7 @@ cd_identify ROUT
02
LDR r5, [ r4 ], #4
SUBS r3, r3, #1
BEQ not_recognized
BEQ not_recognised
TEQ r5, #0
BEQ %BT02
......@@ -159,7 +159,7 @@ cd_identify ROUT
back_from_identify
; r2 = drive type or -1 if not recognized
; r2 = drive type or -1 if not recognised
Pull "r0, r1, r3, r4, r6, r7, r12"
......@@ -180,7 +180,7 @@ cdb_inquiry = &12, 0, 0, 0, 36, 0
ALIGN
;----------------------------------------------------------------------------------------------
not_recognized
not_recognised
MOV r2, #-1
STR r2, [sp, #2*4]
SWIExitVC
......
......@@ -250,8 +250,8 @@ SWIentry_after_wp
;----------------------------------------------------------
; Should I carry out the read data or seek command myself ?
;----------------------------------------------------------
EOR r8, r8, #USE_SCSI_READ + USE_SCSI_SEEK + USE_SCSI_INQUIRY + USE_SCSI_CAPACITY + USE_SCSI_READY + USE_SCSI_STOPOPEN + USE_SCSI_STATUS + USE_SCSI_CHECK
EOR r8, r8, #USE_SCSI_CONTROL + USE_SCSI_PREFETCH + USE_SCSI_RESET + USE_PROPRIETARY_RUD + USE_PROPRIETARY_SUD
EOR r8, r8, #USE_SCSI_READ + USE_SCSI_SEEK + USE_SCSI_INQUIRY + USE_SCSI_CAPACITY + USE_SCSI_READY + USE_SCSI_STOPOPEN + USE_SCSI_CHECK + USE_SCSI_STATUS
EOR r8, r8, #USE_SCSI_CONTROL + USE_SCSI_PREFETCH + USE_SCSI_RESET + USE_PROPRIETARY_RUD + USE_PROPRIETARY_SUD + USE_SCSI_OP
TEQ r11, #(XCD_ReadData - XCD_BaseNumber) - 1
TSTEQ r8, #USE_SCSI_READ
......@@ -301,6 +301,10 @@ SWIentry_after_wp
TSTEQ r8, #USE_SCSI_CHECK
BEQ cd_checkdrive
TEQ r11, #(XCD_SCSIUserOp - XCD_BaseNumber) - 1
TSTEQ r8, #USE_SCSI_OP
BEQ cd_scsiuserop
; Make sure that CD_Get/SetAudioParms supported if its being called
[ Module_Version >= 232
TEQ r11, # DRIVER__GetAudioParms
......@@ -409,7 +413,10 @@ UPR_jump
MOV r8, r14
TEQ r11, #(XCD_SCSIUserOp - XCD_BaseNumber) - 1 ; this one has different exit
MOV r14, pc
ADDNE r14, r14, #come_back_here-.-4
ADDEQ r14, r14, #come_back_here_manyregs-.-0
ADD pc, r9, #4
come_back_here ; only V flag is significant on return
......@@ -424,6 +431,16 @@ come_back_here ; only V flag is significant on return
STR r0, [ r13 ]
SWIExitVC
come_back_here_manyregs
Pull r12
BVS error_handler_manyregs
STR r3, [ r13, #3 * 4 ]
STR r4, [ r13, #4 * 4 ]
SWIExitVC
;-----------------------------------------------------------------------------------------------
END
......@@ -52,6 +52,22 @@ message_file_name
DCB "Resources:Resources.CDFSDriver.CDFSDriver.Messages",0
ALIGN
;-----------------------------------------------------------------------------------------------
error_handler_manyregs ROUT
;
; on entry:
; r0 -> error block
; r1, r2 may contain additional error information
; r3, r4 must be passed back (unless retrying)
; r12 -> workspace
; r13 -> full descending stack with r0-r11 and r14 stacked
; on exit:
; this routine will retry or exit back to the User
;-----------------------------------------------------------------------------------------------
MOV r11, #2 ; Signal that r1-r4 have important values.
B error_common
;-----------------------------------------------------------------------------------------------
error_handler_lookup ROUT
;
......@@ -82,31 +98,31 @@ error_handler ROUT
MOV r11, #0 ; Signal that error is not to be looked up.
error_common
LDR r1, [ r0 ]
LDR r5, [ r0 ]
;--------------------------------------
; Does the error signal a disc change ?
;--------------------------------------
LDR r2, =UnitAttention
TEQ r1, r2
LDRNE r2, =CheckCondition
TEQNE r1, r2
LDR r6, =UnitAttention
TEQ r5, r6
LDRNE r6, =CheckCondition
TEQNE r5, r6
BEQ change_of_disc
;------------------------------------------
; Convert the error to a CDFSDriver error ?
;------------------------------------------
ADR r2, error_conversion_start
MOV r5, #(error_conversion_end - error_conversion_start) / 8
ADR r6, error_conversion_start
MOV r9, #(error_conversion_end - error_conversion_start) / 8
01
LDMIA r2!, { r3, r4 }
TEQ r3, r1
SUBNES r5, r5, #1
LDMIA r6!, { r7, r8 }
TEQ r7, r5
SUBNES r9, r9, #1
BNE %BT01
TEQ r3, r1 ; If converting this error then point r0 and drop through to lookup.
TEQ r7, r5 ; If converting this error then point r0 and drop through to lookup.
ADREQ r0, error_conversion_start
ADDEQ r0, r0, r4
ADDEQ r0, r0, r8
TEQNE r11, #1 ; Not converting so check whether the error needs to be looked up.
BNE return_error
......@@ -133,24 +149,27 @@ error_common
; Return the error to the user
;-----------------------------
return_error
LDR r1, [ r0 ]
STR r1, LastErrorNumber
LDR r5, [ r0 ]
STR r5, LastErrorNumber
STR r0, [ r13 ]
SWIExitVS
TEQ r11, #2 ; many-result-reg exit?
SWIExitVS NE
VSET
ADD r13, r13, #5 * 4 ; leave r0-r4 as they are
Pull "r5-r11, pc"
;-----------------------------
change_of_disc
;-----------------------------
STR r0, buffer
LDMFD r13, { r0-r11, r14 }
LDR r10, [ r13, # 11 * 4 ]
; Check the number of retries currently performed
MOV r10, r11, LSR #30
MOV r10, r10, LSR #30
ADD r10, r10, #1
CMP r10, #3
LDRGE r0, buffer
BGE return_error
Pull "r0-r11, r14"
......
......@@ -57,7 +57,7 @@ cd_register ROUT
; block + 0 = information word for CDFSDriver module
; block + 4 = number of times registered (should be set to zero
; and will be updated by CDFSDriver)
; block + 8 = number of drive types recognized by this driver
; block + 8 = number of drive types recognised by this driver
; r1 -> special tag (&EE50EE50 = 1 word) followed by the handler code
; r2 -> workspace for soft-loadable module (this will be R12 in the handler)
;
......
......@@ -72,20 +72,14 @@ tableofswinames ; List of SWI names
= "ReadAudio", 0 ; 38
= "ReadUserData", 0 ; 39
= "SeekUserData", 0 ; 40
[ Module_Version >= 232
= "GetAudioParms", 0 ; 41
= "SetAudioParms", 0 ; 42
= "SCSIUserOp", 0 ; 43
NUMBEROFSWIS * 43
| ; old way
NUMBEROFSWIS * 41
; ADD NEW SWI'S HERE
]
NUMBEROFSWIS * 44
; ADD NEW SWI'S HERE
= 0
ALIGN
......
......@@ -57,7 +57,7 @@ cd_unregister ROUT
; block + 0 = information word for CDFSDriver module
; block + 4 = number of times registered (should be set to zero
; and will be updated by CDFSDriver)
; block + 8 = number of drive types recognized by this driver
; block + 8 = number of drive types recognised by this driver
; r1 -> special tag (&EE50EE50 = 1 word) followed by the handler code
;
; r12 -> my workspace pointer
......
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