Commit 7c2fe7dc authored by Robert Sprowson's avatar Robert Sprowson
Browse files

Check Board_Model only once

Do an upfront check for the model being 0, if that ever changes there's probably something seriously different. Look only at the Board_Revision elsewhere.
Add the other Compute module to the SPI2 check (though currently the checks don't consider "New" revision words).

Version 0.78. Tagged as 'BCM2835-0_78'
parent 9a2c1030
/* (0.77) /* (0.78)
* *
* This file is automatically maintained by srccommit, do not edit manually. * This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1. * Last processed by srccommit version: 1.1.
* *
*/ */
#define Module_MajorVersion_CMHG 0.77 #define Module_MajorVersion_CMHG 0.78
#define Module_MinorVersion_CMHG #define Module_MinorVersion_CMHG
#define Module_Date_CMHG 01 Dec 2018 #define Module_Date_CMHG 25 Feb 2019
#define Module_MajorVersion "0.77" #define Module_MajorVersion "0.78"
#define Module_Version 77 #define Module_Version 78
#define Module_MinorVersion "" #define Module_MinorVersion ""
#define Module_Date "01 Dec 2018" #define Module_Date "25 Feb 2019"
#define Module_ApplicationDate "01-Dec-18" #define Module_ApplicationDate "25-Feb-19"
#define Module_ComponentName "BCM2835" #define Module_ComponentName "BCM2835"
#define Module_ComponentPath "mixed/RiscOS/Sources/HAL/BCM2835" #define Module_ComponentPath "mixed/RiscOS/Sources/HAL/BCM2835"
#define Module_FullVersion "0.77" #define Module_FullVersion "0.78"
#define Module_HelpVersion "0.77 (01 Dec 2018)" #define Module_HelpVersion "0.78 (25 Feb 2019)"
#define Module_LibraryVersionInfo "0:77" #define Module_LibraryVersionInfo "0:78"
...@@ -251,24 +251,23 @@ GPIO_Board_Names_Table ; same order as GPIORevision_RaspberryPi types ...@@ -251,24 +251,23 @@ GPIO_Board_Names_Table ; same order as GPIORevision_RaspberryPi types
; Lookup table to determine board type (old style) ; Lookup table to determine board type (old style)
; Ref: http://elinux.org/RPi_HardwareHistory#Board_Revision_History ; Ref: http://elinux.org/RPi_HardwareHistory#Board_Revision_History
MACRO MACRO
BoardType $model, $minrev, $maxrev, $type BoardType $minrev, $maxrev, $type
DCD $model
DCD $minrev DCD $minrev
DCD $maxrev DCD $maxrev
DCD GPIORevision_RaspberryPi_$type DCD GPIORevision_RaspberryPi_$type
MEND MEND
GPIO_BoardTypes GPIO_BoardTypes
BoardType 0, &02, &03, B_1 BoardType &02, &03, B_1
BoardType 0, &04, &06, B_2 BoardType &04, &06, B_2
BoardType 0, &07, &09, A_2 BoardType &07, &09, A_2
BoardType 0, &0d, &0f, B_2 BoardType &0d, &0f, B_2
BoardType 0, &10, &10, BPlus BoardType &10, &10, BPlus
BoardType 0, &11, &11, C_1 BoardType &11, &11, C_1
BoardType 0, &12, &12, APlus BoardType &12, &12, APlus
BoardType 0, &13, &13, BPlus BoardType &13, &13, BPlus
BoardType 0, &14, &14, C_1 BoardType &14, &14, C_1
BoardType 0, &15, &15, APlus BoardType &15, &15, APlus
GPIO_BoardTypes_End GPIO_BoardTypes_End
; Lookup table to determine board type (new style) ; Lookup table to determine board type (new style)
...@@ -399,31 +398,27 @@ HAL_PlatformName ...@@ -399,31 +398,27 @@ HAL_PlatformName
; Return a1 = enumerated platform number (GPIORevision_RaspberryPi type) ; Return a1 = enumerated platform number (GPIORevision_RaspberryPi type)
; or -1 if unknown ; or -1 if unknown
GPIO_Get_Platform GPIO_Get_Platform
Entry "v1-v5" Entry "v1-v2"
ADR v1, GPIO_BoardTypes ADR v1, GPIO_BoardTypes
LDR v2, Board_Model LDR v2, Board_Revision
LDR v3, Board_Revision
ADR ip, GPIO_BoardTypes_End ADR ip, GPIO_BoardTypes_End
ADR v5, GPIO_Board_Names_Table
TST v3, #BoardRevision_NewScheme TST v2, #BoardRevision_NewScheme
BNE %FT20 ; new decode BNE %FT20 ; new decode
10 10
CMP v1, ip CMP v1, ip
MOVHS a1, #-1 MOVHS a1, #-1
EXIT HS ; unknown model, exit EXIT HS ; unknown model, exit
LDMIA v1!, {a1-a4} LDMIA v1!, {a2-a4}
CMP a1, v2 ; model match? CMP a2, v2
BNE %BT10 CMPLS v2, a3 ; revision within range?
CMP a2, v3
CMPLS v3, a3 ; revision within range?
MOVLS a1, a4 MOVLS a1, a4
EXIT LS ; match a1 = GPIORevision_RaspberryPi type EXIT LS ; match a1 = GPIORevision_RaspberryPi type
B %BT10 B %BT10
20 20
ADR a2, GPIO_Board_Conversion_Table ADR a2, GPIO_Board_Conversion_Table
LDR a3, =BoardRevision_Model_Mask+BoardRevision_Mem_Mask+BoardRevision_Rev_Mask LDR a3, =BoardRevision_Model_Mask+BoardRevision_Mem_Mask+BoardRevision_Rev_Mask
AND a1, v3, a3 AND a1, v2, a3
30 30
LDR a4, [a2], #4 LDR a4, [a2], #4
CMP a4, #&FF CMP a4, #&FF
......
...@@ -143,10 +143,8 @@ SPI_InitDevices ROUT ...@@ -143,10 +143,8 @@ SPI_InitDevices ROUT
MOV lr, pc MOV lr, pc
LDR pc, OSentries+4*OS_AddDevice LDR pc, OSentries+4*OS_AddDevice
; SPI1 is available on the larger 40 pin header used on B+ and later ; SPI1 is available on the larger 40 pin header used on B+ and later
LDR a1, Board_Model
LDR a2, Board_Revision LDR a2, Board_Revision
CMP a1, #0 CMP a2, #&10
CMPEQ a2, #&10
EXIT LO EXIT LO
ADRL a1, SPI1Device ADRL a1, SPI1Device
ADR a2, SPI1_Dev ADR a2, SPI1_Dev
...@@ -161,10 +159,9 @@ SPI_InitDevices ROUT ...@@ -161,10 +159,9 @@ SPI_InitDevices ROUT
MOV lr, pc MOV lr, pc
LDR pc, OSentries+4*OS_AddDevice LDR pc, OSentries+4*OS_AddDevice
; SPI2 is currently only available on the Compute ; SPI2 is currently only available on the Compute
LDR a1, Board_Model
LDR a2, Board_Revision LDR a2, Board_Revision
CMP a1, #0 CMP a2, #BoardRevision_Compute_Sony
CMPEQ a2, #&11 CMPNE a2, #BoardRevision_Compute_Embest
EXIT NE EXIT NE
ADRL a1, SPI2Device ADRL a1, SPI2Device
ADR a2, SPI2_Dev ADR a2, SPI2_Dev
......
...@@ -757,6 +757,11 @@ HAL_Init ...@@ -757,6 +757,11 @@ HAL_Init
STR a1, ARM_DMAChannels STR a1, ARM_DMAChannels
STR ip, SafetyCatch STR ip, SafetyCatch
; Model is expected to be 0, to save checking it elsewhere halt
; if it looks wrong
MOVS a3, a3
BNE .
[ HALDebug [ HALDebug
LDR a1, VC_Base LDR a1, VC_Base
BL HAL_DebugHexTX4 BL HAL_DebugHexTX4
......
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