Commit fc0b6873 authored by Jeffrey Lee's avatar Jeffrey Lee
Browse files

Fix HAL RTC initialisation in Cortex kernel

Detail:
  LookForHALRTC wasn't initialising R12 to point to the OS Byte workspace before calling CheckYear, and instead relying on the previous value. This resulted in the RTC initialisation breaking once HAL_InitDevices started doing things to corrupt R12.
Admin:
  Tested on rev C2 beagleboard


Version 5.35, 4.79.2.98.2.18. Tagged as 'Kernel-5_35-4_79_2_98_2_18'
parent 232135e5
...@@ -13,11 +13,11 @@ ...@@ -13,11 +13,11 @@
GBLS Module_ComponentPath GBLS Module_ComponentPath
Module_MajorVersion SETS "5.35" Module_MajorVersion SETS "5.35"
Module_Version SETA 535 Module_Version SETA 535
Module_MinorVersion SETS "4.79.2.98.2.17" Module_MinorVersion SETS "4.79.2.98.2.18"
Module_Date SETS "29 Nov 2009" Module_Date SETS "05 Dec 2009"
Module_ApplicationDate SETS "29-Nov-09" Module_ApplicationDate SETS "05-Dec-09"
Module_ComponentName SETS "Kernel" Module_ComponentName SETS "Kernel"
Module_ComponentPath SETS "castle/RiscOS/Sources/Kernel" Module_ComponentPath SETS "castle/RiscOS/Sources/Kernel"
Module_FullVersion SETS "5.35 (4.79.2.98.2.17)" Module_FullVersion SETS "5.35 (4.79.2.98.2.18)"
Module_HelpVersion SETS "5.35 (29 Nov 2009) 4.79.2.98.2.17" Module_HelpVersion SETS "5.35 (05 Dec 2009) 4.79.2.98.2.18"
END END
...@@ -5,19 +5,19 @@ ...@@ -5,19 +5,19 @@
* *
*/ */
#define Module_MajorVersion_CMHG 5.35 #define Module_MajorVersion_CMHG 5.35
#define Module_MinorVersion_CMHG 4.79.2.98.2.17 #define Module_MinorVersion_CMHG 4.79.2.98.2.18
#define Module_Date_CMHG 29 Nov 2009 #define Module_Date_CMHG 05 Dec 2009
#define Module_MajorVersion "5.35" #define Module_MajorVersion "5.35"
#define Module_Version 535 #define Module_Version 535
#define Module_MinorVersion "4.79.2.98.2.17" #define Module_MinorVersion "4.79.2.98.2.18"
#define Module_Date "29 Nov 2009" #define Module_Date "05 Dec 2009"
#define Module_ApplicationDate "29-Nov-09" #define Module_ApplicationDate "05-Dec-09"
#define Module_ComponentName "Kernel" #define Module_ComponentName "Kernel"
#define Module_ComponentPath "castle/RiscOS/Sources/Kernel" #define Module_ComponentPath "castle/RiscOS/Sources/Kernel"
#define Module_FullVersion "5.35 (4.79.2.98.2.17)" #define Module_FullVersion "5.35 (4.79.2.98.2.18)"
#define Module_HelpVersion "5.35 (29 Nov 2009) 4.79.2.98.2.17" #define Module_HelpVersion "5.35 (05 Dec 2009) 4.79.2.98.2.18"
#define Module_LibraryVersionInfo "5:35" #define Module_LibraryVersionInfo "5:35"
...@@ -2352,38 +2352,39 @@ HexTable = "0123456789ABCDEF" ...@@ -2352,38 +2352,39 @@ HexTable = "0123456789ABCDEF"
[ HAL [ HAL
LookForHALRTC LookForHALRTC
Push "R0-R2,R8,R14" Push "R0-R2,R8,R12,R14"
MOV R0, #0 MOV R0, #0
LDR R0, [R0, #RTCFitted] LDR R0, [R0, #RTCFitted]
CMP R0, #0 CMP R0, #0
Pull "R0-R2,R8,PC",NE ; We already have an RTC Pull "R0-R2,R8,PC",NE ; We already have an RTC
LDR R0, =(0:SHL:16)+HALDeviceType_SysPeri+HALDeviceSysPeri_RTC LDR R0, =(0:SHL:16)+HALDeviceType_SysPeri+HALDeviceSysPeri_RTC
MOV R1, #0 MOV R1, #0
MOV R8, #4 MOV R8, #4
01 01
SWI XOS_Hardware SWI XOS_Hardware
Pull "R0-R2,R8,PC",VS Pull "R0-R2,R8,PC",VS
CMP R1, #-1 CMP R1, #-1
Pull "R0-R2,R8,PC",EQ Pull "R0-R2,R8,PC",EQ
LDR R14, [R2, #HALDevice_Location] LDR R14, [R2, #HALDevice_Location]
; Currently, we only support devices located on IIC bus 0 ; Currently, we only support devices located on IIC bus 0
CMP R14, #HALDeviceBus_Ser+HALDeviceSerBus_IIC CMP R14, #HALDeviceBus_Ser+HALDeviceSerBus_IIC
BNE %BT01 BNE %BT01
; Try activating ; Try activating
Push "R0-R3,R12" Push "R0-R3"
MOV R0, R2 MOV R0, R2
MOV LR, PC MOV LR, PC
LDR PC, [R2, #HALDevice_Activate] LDR PC, [R2, #HALDevice_Activate]
CMP R0, #1 CMP R0, #1
Pull "R0-R3,R12" Pull "R0-R3"
BNE %BT01 BNE %BT01
DebugTX "HAL RTC detected!" DebugTX "HAL RTC detected!"
MOV R0, #0 MOV R0, #0
STR R2, [R0, #RTCFitted] STR R2, [R0, #RTCFitted]
; Read the time from the RTC into RealTime, and fixup YearCMOS if needed ; Read the time from the RTC into RealTime, and fixup YearCMOS if needed
BL CheckYear BYTEWS WsPtr
DebugTX "Leaving LookForHALRTC" BL CheckYear
Pull "R0-R2,R8,PC" DebugTX "Leaving LookForHALRTC"
Pull "R0-R2,R8,R12,PC"
] ]
END END
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