Commit 29b63845 authored by Ben Avison's avatar Ben Avison
Browse files

Support newer ARMs better

Detail:
  A couple of the routines relied on pre-ARMv6 style LDM functionality, and
  would abort on ARMv7+ (or ARMv6 in ARMv7 mode, if we ever get an ARMv6
  platform with ATAPI). Also took the opportunity to replace a lot of byte
  swizzling code fragments with REV instructions if only targeting ARMv6 or
  later. Bit of a shame they weren't macroised considering how many times
  they were used...
Admin:
  Untested

Version 1.36. Tagged as 'ATAPI-1_36'
parent 4ccd7489
......@@ -11,13 +11,13 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "1.35"
Module_Version SETA 135
Module_MajorVersion SETS "1.36"
Module_Version SETA 136
Module_MinorVersion SETS ""
Module_Date SETS "08 Nov 2015"
Module_ApplicationDate SETS "08-Nov-15"
Module_Date SETS "19 Nov 2015"
Module_ApplicationDate SETS "19-Nov-15"
Module_ComponentName SETS "ATAPI"
Module_ComponentPath SETS "castle/RiscOS/Sources/HWSupport/CD/ATAPI"
Module_FullVersion SETS "1.35"
Module_HelpVersion SETS "1.35 (08 Nov 2015)"
Module_FullVersion SETS "1.36"
Module_HelpVersion SETS "1.36 (19 Nov 2015)"
END
/* (1.35)
/* (1.36)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 1.35
#define Module_MajorVersion_CMHG 1.36
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 08 Nov 2015
#define Module_Date_CMHG 19 Nov 2015
#define Module_MajorVersion "1.35"
#define Module_Version 135
#define Module_MajorVersion "1.36"
#define Module_Version 136
#define Module_MinorVersion ""
#define Module_Date "08 Nov 2015"
#define Module_Date "19 Nov 2015"
#define Module_ApplicationDate "08-Nov-15"
#define Module_ApplicationDate "19-Nov-15"
#define Module_ComponentName "ATAPI"
#define Module_ComponentPath "castle/RiscOS/Sources/HWSupport/CD/ATAPI"
#define Module_FullVersion "1.35"
#define Module_HelpVersion "1.35 (08 Nov 2015)"
#define Module_LibraryVersionInfo "1:35"
#define Module_FullVersion "1.36"
#define Module_HelpVersion "1.36 (19 Nov 2015)"
#define Module_LibraryVersionInfo "1:36"
......@@ -320,11 +320,15 @@ ReadData ROUT
; and then adds 16 to it - cpartington, by observation
LDR r8, buffer + 4 + 4
[ NoARMv6
MOV r5, #&ff00
ORR r5, r5, r5, LSL #16
AND r6, r5, r8, ROR #8
AND r14, r5, r8
ORR r6, r6, r14, ROR #24
|
REV r6, r8
]
; r6 = reversed address
; r1 = 16
......@@ -366,6 +370,7 @@ RD_HowManyBlocks
; Set up the CDB
; Swap the byte order of the start LBA and number of blocks
[ NoARMv6
MOV r5, #&ff00
ORR r5, r5, r5, LSL #16
......@@ -378,6 +383,11 @@ RD_HowManyBlocks
AND r1, r5, r2, ROR #8
AND r14, r5, r2
ORR r5, r1, r14, ROR #24
|
MOV r2, r2, LSL #8
REV r6, r1
REV r5, r2
]
; r0 = mode we think this is
; r3 -> data buffer
......@@ -578,12 +588,16 @@ SeekTo ROUT
; Swap the byte order of the start LBA and number of blocks
[ NoARMv6
MOV r5, #&ff00
ORR r5, r5, r5, LSL #16
AND r6, r5, r1, ROR #8
AND r14, r5, r1
ORR r1, r6, r14, ROR #24
|
REV r1, r1
]
[ cdebug2
CDebug_StrReg8 "=",r1,cc
......@@ -1400,11 +1414,15 @@ EnquireAddress ROUT
; Get the LBAFormat absolute address
;-----------------------------------
LDR r2, buffer + 16 + 8
[ NoARMv6
MOV r5, #&ff00
ORR r5, r5, r5, LSL #16
AND r6, r5, r2, ROR #8
AND r1, r5, r2
ORR r1, r6, r1, ROR #24
|
REV r1, r2
]
;---------------------------------------
; If caller wants return in MSF then ...
......@@ -1477,14 +1495,19 @@ EnquireDataMode ROUT
;--------------------------
; swap byte order of LBA
[ NoARMv6
MOV r2, #&ff00
ORR r2, r2, r2, LSL #16
AND r14, r2, r1, ROR #8
AND r8, r2, r1
ORR r6, r14, r8, ROR #24
|
REV r6, r1
]
; Build read header command
ASSERT ((EDM_CDBReadHeader - .) :AND: 3) = 0
ADR r2, EDM_CDBReadHeader
ADR r3, buffer
LDMIA r2, { r0, r4, r8, r14 }
......@@ -1548,7 +1571,8 @@ EnquireDataMode ROUT
;---------------------------------------------------------------
; Build read cd command
ADR r2, EDM_CDBReadCD
ASSERT ((EDM_CDBReadCD - .) :AND: 3) = 2
ADR r2, EDM_CDBReadCD - 2
ADR r3, buffer
LDMIA r2, { r0, r4, r8, r14 }
STMIA r3!, { r0, r6, r8, r14 }
......@@ -1649,19 +1673,27 @@ PlayAudio ROUT
;------------------------------------------------
; Reverse start address to hi/lo
;------------------------------------------------
[ NoARMv6
MOV r2, #&ff00
ORR r2, r2, r2, LSL #16
AND r14, r2, r3, ROR #8
AND r8, r2, r3
ORR r3, r14, r8, ROR #24
|
REV r3, r3
]
;------------------------------------------------
; Reverse transfer length to hi/lo
;------------------------------------------------
[ NoARMv6
AND r14, r2, r0, ROR #8
AND r8, r2, r0
ORR r4, r14, r8, ROR #24
|
REV r4, r0
]
;------------------------------------------------
; Play audio
......@@ -1818,6 +1850,7 @@ PT_OKLast
LDR r0, buffer + 12 + 8
LDR r1, buffer + 24 + 8
[ NoARMv6
MOV r2, #&ff00
ORR r2, r2, r2, LSL #16
......@@ -1828,13 +1861,21 @@ PT_OKLast
AND r14, r2, r1, ROR #8
AND r8, r2, r1
ORR r4, r14, r8, ROR #24
|
REV r3, r0
REV r4, r1
]
; Subtract the end and start address to get a transfer length, then swap to hi/lo format
SUB r4, r4, r3
SUB r4, r4, # &1
[ NoARMv6
AND r14, r2, r4, ROR #8
AND r8, r2, r4
ORR r4, r14, r8, ROR #24
|
REV r4, r4
]
; Get back the start address in hi/lo format
......@@ -1874,7 +1915,7 @@ PT_OKLast
PT_CDBPlayTrack
DCB ATAPI__READ_TOC ; 0 command byte
DCB 0 ; 1
DCB 0 ; 2reserved
DCB 0 ; 2 reserved
DCB 0 ; 3 reserved
DCB 0 ; 4 reserved
DCB 0 ; 5 reserved
......@@ -2070,12 +2111,16 @@ ET_OK
ADRNE r5, buffer + 12 + 4
LDMNEIA r5, { r2, r6 }
[ NoARMv6
MOVNE r5, #&ff00
ORRNE r5, r5, r5, LSL #16
ANDNE r4, r5, r6, ROR #8
ANDNE r3, r5, r6
ORRNE r3, r4, r3, ROR #24
|
REVNE r3, r6
]
STRNE r3, [ r1, #0 ]
......@@ -2093,7 +2138,7 @@ ET_OK
ET_CDBEnquireTrack
DCB ATAPI__READ_TOC ; 0 command byte
DCB 0 ; 1 MSF bit
DCB 0 ; 2reserved
DCB 0 ; 2 reserved
DCB 0 ; 3 reserved
DCB 0 ; 4 reserved
DCB 0 ; 5 reserved
......@@ -2158,6 +2203,7 @@ ReadSubChannel ROUT
LDMIA r14, { r2, r3, r4 }
; Swap byte order of LBAs
[ NoARMv6
MOV r5, #&ff00
ORR r5, r5, r5, LSL #16
......@@ -2168,6 +2214,10 @@ ReadSubChannel ROUT
AND r14, r5, r4, ROR #8
AND r6, r5, r4
ORR r6, r14, r6, ROR #24
|
REV r8, r3
REV r6, r4
]
STMIA r1!, { r6, r8 } ; Absolute, relative LBA
......@@ -2354,12 +2404,16 @@ DiscUsed ROUT
LDR r3, buffer + 8
[ NoARMv6
MOV r5, #255
ORR r5, r5, r5, LSL #16
AND r2, r5, r3, ROR #24
AND r4, r5, r3
ORR r2, r2, r4, ROR #8
|
REV r2, r3
]
; Blocksize = &800
MOV r14, # &800
......@@ -2396,7 +2450,7 @@ DiscUsed ROUT
DU_CDBDiscUsed
DCB ATAPI__READ_TOC ; 0 command byte
DCB 0 ; 1
DCB 0 ; 2reserved
DCB 0 ; 2 reserved
DCB 0 ; 3 reserved
DCB 0 ; 4 reserved
DCB 0 ; 5 reserved
......@@ -2838,6 +2892,7 @@ ReadAudio ROUT
;----------------------------------
; Swap byte order of LBA and number of blocks
[ NoARMv6
MOV r5, #&ff00
ORR r5, r5, r5, LSL #16
......@@ -2851,13 +2906,19 @@ ReadAudio ROUT
AND r14, r5, r2, ROR #8
AND r8, r5, r2
ORR r8, r14, r8, ROR #24
|
MOV r2, r2, LSL #8
REV r6, r1
REV r8, r2
]
;---------------------------------------------
; Read CD-DA
;---------------------------------------------
; Build read cd command
ADR r2, RA_CDBReadCD
ASSERT ((RA_CDBReadCD - .) :AND: 3) = 2
ADR r2, RA_CDBReadCD - 2
LDMIA r2, { r0, r1, r5, r14 }
ORR r8, r8, r5
ADR r2, buffer
......@@ -3263,6 +3324,7 @@ RUD_ReadAll
; Swap the byte order of the start LBA and number of blocks
[ NoARMv6
MOV r5, #&ff00
ORR r5, r5, r5, LSL #16
......@@ -3275,6 +3337,11 @@ RUD_ReadAll
AND r1, r5, r2, ROR #8
AND r8, r5, r2
ORR r8, r1, r8, ROR #24
|
MOV r2, r2, LSL #8
REV r6, r1
REV r8, r2
]
ORR r8, r8, # 2_11111000:SHL:24 ; all headers + user + EDC & ECC + sync
; ORR r8, r8, # 2_10000000:SHL:24 ; user
......
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