Commit 51cfd31e authored by Ben Avison's avatar Ben Avison
Browse files

Add another SDCMOS build variant

Detail:
  Enabled by setting StoreAtDiscAddress on the amu command line or using
  -options in the Components file, this allows the CMOS to be stored at a
  fixed address on the SD card. Useful on platforms that don't use a boot
  FAT partition.

Version 0.14. Tagged as 'SDCMOS-0_14'
parent 2069f731
......@@ -11,13 +11,13 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "0.13"
Module_Version SETA 13
Module_MajorVersion SETS "0.14"
Module_Version SETA 14
Module_MinorVersion SETS ""
Module_Date SETS "29 Apr 2014"
Module_ApplicationDate SETS "29-Apr-14"
Module_Date SETS "04 Nov 2014"
Module_ApplicationDate SETS "04-Nov-14"
Module_ComponentName SETS "SDCMOS"
Module_ComponentPath SETS "cddl/RiscOS/Sources/HWSupport/SD/SDCMOS"
Module_FullVersion SETS "0.13"
Module_HelpVersion SETS "0.13 (29 Apr 2014)"
Module_FullVersion SETS "0.14"
Module_HelpVersion SETS "0.14 (04 Nov 2014)"
END
/* (0.13)
/* (0.14)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 0.13
#define Module_MajorVersion_CMHG 0.14
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 29 Apr 2014
#define Module_Date_CMHG 04 Nov 2014
#define Module_MajorVersion "0.13"
#define Module_Version 13
#define Module_MajorVersion "0.14"
#define Module_Version 14
#define Module_MinorVersion ""
#define Module_Date "29 Apr 2014"
#define Module_Date "04 Nov 2014"
#define Module_ApplicationDate "29-Apr-14"
#define Module_ApplicationDate "04-Nov-14"
#define Module_ComponentName "SDCMOS"
#define Module_ComponentPath "cddl/RiscOS/Sources/HWSupport/SD/SDCMOS"
#define Module_FullVersion "0.13"
#define Module_HelpVersion "0.13 (29 Apr 2014)"
#define Module_LibraryVersionInfo "0:13"
#define Module_FullVersion "0.14"
#define Module_HelpVersion "0.14 (04 Nov 2014)"
#define Module_LibraryVersionInfo "0:14"
......@@ -46,6 +46,7 @@ StoreInHAL SETL {FALSE};
GET Hdr:RTC
GET Hdr:HALDevice
GET Hdr:HALEntries
GET Hdr:SDFS
GET VersionASM
AREA |Asm$$Code|, CODE, READONLY, PIC
......@@ -86,7 +87,7 @@ NonCanonicalisedPath2
CMOSMarker UND #&C305
OSIm = "OSIm"
|
ELIF :LNOT::DEF: StoreAtDiscAddress
NonCanonicalisedPath
= "SDFS::0.$.CMOS", 0
......@@ -94,8 +95,6 @@ NonCanonicalisedPath2
= "SDFS::0.$.!Boot.Loader.CMOS", 0
ALIGN
ReqdAPIMajor * 0
SaveCMOS
= "SaveCMOS "
Len_SaveCMOS * .-SaveCMOS
......@@ -103,6 +102,8 @@ Len_SaveCMOS * .-SaveCMOS
]
ReqdAPIMajor * 0
Init ROUT
Entry
[ :LNOT: StoreInHAL
......@@ -148,6 +149,7 @@ CallBackFromInit ROUT
ADD lr, sp, #4
Push "r0-r6, lr" ; yes, need to stack sp
[ :LNOT::DEF: StoreAtDiscAddress
; We assume that we're entered during or soon after boot. In which case,
; if there is an SD card inserted, and if it contains a file called
; "CMOS" in its root directory of the correct filetype, then we must
......@@ -159,6 +161,7 @@ CallBackFromInit ROUT
ADRVS r1, NonCanonicalisedPath2
BLVS TryInit
BVS %FT90
]
; All good - get on ByteV
MOV r0, #ByteV
......@@ -189,6 +192,7 @@ CallBackFromInit ROUT
99
[ :LNOT::DEF: StoreAtDiscAddress
; In: r1 = filename
; Out: Regs corrupt
; V set on failure
......@@ -347,6 +351,7 @@ TryInit ROUT
STR r2, [r12]
SETV
EXIT
] ; :LNOT::DEF: StoreAtDiscAddress
[ StoreInHAL
Services ROUT
......@@ -369,7 +374,30 @@ MyByteV
10 ; ... we end up here after the CMOS has been written
Pull "r12" ; get our own r12 back
Pull "pc", VS ; if an error, just pass it up to original claim address
[ StoreInHAL
[ :DEF: StoreAtDiscAddress
Push "r0-r4,r6"
MOV r6, #0
MOV r0, #1
MOV r1, #StoreAtDiscAddress :SHR: 29
MOV r2, #0
SWI XSDFS_MiscOp
BVS %F75
TEQ r2, #1
BNE %F75 ; disc has been changed since boot - don't write to it
MOV r6, #256
BL CMOSToStack
MOV r1, #2
LDR r2, =StoreAtDiscAddress
MOV r3, sp
MOV r4, r6
SWI XSDFS_DiscOp
75
ADD sp, sp, r6
STRVS r0, [sp]
Pull "r0-r4,r6, pc" ; go to original claim address
ELIF StoreInHAL
15
Push "r0-r7"
SUB sp, sp, #4 ; allocate space on stack for buffer
......@@ -404,24 +432,7 @@ MyByteV
LDR r6, [sp]
MOV r5, r1 ; keep file handle safe
; Copy the CMOS RAM into a block on the stack (should be small enough)
; in physical address order
SUB sp, sp, r6
MOV r3, #0
30 MOV r0, #OsByte_ReadCMOS
MOV r1, r3
CMP r3, #&10
ADDLO r1, r1, #&40
CMP r3, #&40
ADDLO r1, r1, #&F0
CMP r3, #&100
SUBLO r1, r1, #&40
SWI XOS_Byte
MOVVS r2, #0
STRB r2, [sp, r3]
ADD r3, r3, #1
CMP r3, r6
BLO %B30
BL CMOSToStack
; Overwrite the HAL with the block from the stack
MOV r0, #OSGBPB_WriteAtPTR
......@@ -463,6 +474,30 @@ MyByteV
Pull "r0, pc" ; go to original claim address
]
[ StoreInHAL :LOR: :DEF: StoreAtDiscAddress
CMOSToStack ROUT
MOV r4, lr
; Copy the CMOS RAM into a block on the stack (should be small enough)
; in physical address order
SUB sp, sp, r6
MOV r3, #0
30 MOV r0, #OsByte_ReadCMOS
MOV r1, r3
CMP r3, #&10
ADDLO r1, r1, #&40
CMP r3, #&40
ADDLO r1, r1, #&F0
CMP r3, #&100
SUBLO r1, r1, #&40
SWI XOS_Byte
MOVVS r2, #0
STRB r2, [sp, r3]
ADD r3, r3, #1
CMP r3, r6
BLO %B30
MOV pc, r4
]
Final ROUT
Entry
; It's good practice to remove our callback here just in case we got
......
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