Commit e65005cf authored by Robert Sprowson's avatar Robert Sprowson

Refactor early GPU queries

Remove the baffling double indirection of RamAd (and unused exports SerNo and MacAdd), and treat these the same as the other pre-HAL_Init query results.
This means the scope of the tagbuffer is limited to Messaging.s, rather than having to be kept preserved globally.
Use memcpy() to copy tag list to tagbuffer for clarity.
Tested on a Pi 3.

Version 0.68. Tagged as 'BCM2835-0_68'
parent 62e5efb4
/* (0.67)
/* (0.68)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 0.67
#define Module_MajorVersion_CMHG 0.68
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 11 Feb 2017
#define Module_Date_CMHG 21 Feb 2017
#define Module_MajorVersion "0.67"
#define Module_Version 67
#define Module_MajorVersion "0.68"
#define Module_Version 68
#define Module_MinorVersion ""
#define Module_Date "11 Feb 2017"
#define Module_Date "21 Feb 2017"
#define Module_ApplicationDate "11-Feb-17"
#define Module_ApplicationDate "21-Feb-17"
#define Module_ComponentName "BCM2835"
#define Module_ComponentPath "mixed/RiscOS/Sources/HAL/BCM2835"
#define Module_FullVersion "0.67"
#define Module_HelpVersion "0.67 (11 Feb 2017)"
#define Module_LibraryVersionInfo "0:67"
#define Module_FullVersion "0.68"
#define Module_HelpVersion "0.68 (21 Feb 2017)"
#define Module_LibraryVersionInfo "0:68"
......@@ -51,9 +51,6 @@
EXPORT HAL_SendHostMessage
EXPORT HAL_QueryPlatform
EXPORT BCMMBox_InitDevices
EXPORT MacAdd
EXPORT RamAd
EXPORT SerNo
; Send a message packet to the host and await the reply
; on entry, r0 = message channel to use and/or wholemessage
......@@ -116,22 +113,21 @@ HAL_QueryPlatform ROUT
ADRL r0, tagbuffer
ADR r1, tagb
MOV r2, #tagslen
lp1 ldr r3, [r0], #4 ; copy to workspace buffer
str r3, [r1], #4
subs r2, r2, #4
bgt lp1
BL memcpy ; copy to workspace buffer
adrl r1, tagbuffer
MOV r1, r0
MOV r0, #MB_Chan_ARM2VC
BL HAL_SendHostMessage ; ask the questions
ADRL r5, tagbuffer ; now read the answers
ADD r0,r5,#VCbs-tagb ; VC address and size
LDMIA r0, {r1, r2}
LDR r0, [r5, #touchbuf-tagb]
STR r1, VC_Base
STR r2, VC_Size
STR r0, TouchBuf
ADD r0,r5,#ARMbs-tagb ; ARM address and size
LDMIA r0, {r1, r2}
STR r1, ARM_Base
STR r2, ARM_Size
LDR r0, [r5, #boardmodel-tagb]
LDR r1, [r5, #boardrev-tagb]
LDR r2, [r5, #dmachans-tagb]
......@@ -143,17 +139,13 @@ lp1 ldr r3, [r0], #4 ; copy to workspace buffer
MOVEQ r2, #1<<4
STR r2, ARM_DMAChannels
LDR r0, [r5, #virtgpio-tagb]
LDR r1, [r5, #touchbuf-tagb]
STR r0, VirtGPIOBuf
STR r1, TouchBuf
; copy out and construct machine ID from MAC address
ADRL r0, tagbuffer
ADD r0, r0,#:INDEX:MAClo-:INDEX:tagb
ADRL a3, workspace
ADRL lr,MacAdd
LDR lr, [lr]
ADD a3, a3, lr
; Copy out and construct machine ID from MAC address
ADRL a3, tagbuffer
ADD a3, a3,#:INDEX:MAClo-:INDEX:tagb
LDR lr, [a3, #-4] ; check if message completed
TST lr, #&80000000 ; NE if successful
MOVEQ a1, #0
......@@ -204,49 +196,45 @@ gbit ;
]
LDMFD R13!, {r0-r6, pc}
MacAdd DCD :INDEX:MAClo - :INDEX:tagb + :INDEX:tagbuffer
RamAd DCD :INDEX:ARMbs - :INDEX:tagb + :INDEX:tagbuffer
SerNo DCD :INDEX:SNlo - :INDEX:tagb + :INDEX:tagbuffer
; Series of VC side query tags.
;
tagb DCD tagslen
DCD 0
tagmac DCD ARM2VC_Tag_GetBoardMAC
DCD ARM2VC_Tag_GetBoardMAC
DCD 8
DCD 0
MAClo DCD 0
MAChi DCD 0
tagserial
DCD ARM2VC_Tag_GetBoardSerial
DCD 8
DCD 0
SNlo DCD 0
SNhi DCD 0
tagarmmem
DCD ARM2VC_Tag_GetARMMemory
DCD 8
DCD 0
ARMbs DCD 0
ARMsz DCD 0
tagvcmem
DCD ARM2VC_Tag_GetVCMemory
DCD 8
DCD 0
VCbs DCD 0
VCsz DCD 0
tagboardmodel
DCD ARM2VC_Tag_GetBoardModel
DCD 4
DCD 0
boardmodel DCD 0
tagboardrev
DCD ARM2VC_Tag_GetBoardRevision
DCD 4
DCD 0
boardrev DCD 0
tagdmachans
DCD ARM2VC_Tag_GetDMAChannels
DCD 4
DCD 0
......
......@@ -148,8 +148,6 @@
IMPORT HAL_QueryPlatform
EXPORT HAL_Base
IMPORT RamAd
IMPORT SerNo
IMPORT memcpy
[ HALDebug
......@@ -286,7 +284,7 @@ start
LDR a3, =?SimulatedCMOS
BL memcpy
; Query the platform and set up a frame buffer.
; Query the platform
BL HAL_QueryPlatform
[ HALDebug
......@@ -294,13 +292,8 @@ start
DCB "HalStartup2",10,0
ALIGN
]
ADRL a3, workspace
ADRL lr,RamAd
LDR lr, [lr]
ADD a3, a3, lr
LDMIA a3, {v3, v4} ; v3=base, v4=size
STR v3, ARM_Base
STR v4, ARM_Size
LDR v3, ARM_Base
LDR v4, ARM_Size
[ HALDebug
ADRL a1, reset
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