Commit 3981af57 authored by Jeffrey Lee's avatar Jeffrey Lee
Browse files

Preperation for working Raspberry Pi video driver

Detail:
  hdr/HALEntries - Add new HAL_Video_StartupMode HAL entry to allow the HAL to specify a startup mode
  s/HAL, s/Kernel - Tweaked debug routines
  s/vdu/vdudriver - Make use of HAL_Video_StartupMode in InitialiseMode to decide what initial mode should be. Clean up some hacks & debug. Improve handling of external framestores; if bit 5 of GraphicsV_DisplayFeatures r0 is set, the kernel will now allow the display driver to grow/shrink/move its framestore in response to mode changes.
  s/vdu/vdugrafv - Adjust default GV_FramestoreAddress implementation to only claim vector if HAL returns a framestore
  s/vdu/vduswis - Re-enable FindOKMode
Admin:
  Tested on Raspberry Pi with high processor vectors


Version 5.35, 4.79.2.147.2.18. Tagged as 'Kernel-5_35-4_79_2_147_2_18'
parent ea14a968
......@@ -13,11 +13,11 @@
GBLS Module_ComponentPath
Module_MajorVersion SETS "5.35"
Module_Version SETA 535
Module_MinorVersion SETS "4.79.2.147.2.17"
Module_Date SETS "15 Aug 2012"
Module_ApplicationDate SETS "15-Aug-12"
Module_MinorVersion SETS "4.79.2.147.2.18"
Module_Date SETS "02 Sep 2012"
Module_ApplicationDate SETS "02-Sep-12"
Module_ComponentName SETS "Kernel"
Module_ComponentPath SETS "castle/RiscOS/Sources/Kernel"
Module_FullVersion SETS "5.35 (4.79.2.147.2.17)"
Module_HelpVersion SETS "5.35 (15 Aug 2012) 4.79.2.147.2.17"
Module_FullVersion SETS "5.35 (4.79.2.147.2.18)"
Module_HelpVersion SETS "5.35 (02 Sep 2012) 4.79.2.147.2.18"
END
......@@ -5,19 +5,19 @@
*
*/
#define Module_MajorVersion_CMHG 5.35
#define Module_MinorVersion_CMHG 4.79.2.147.2.17
#define Module_Date_CMHG 15 Aug 2012
#define Module_MinorVersion_CMHG 4.79.2.147.2.18
#define Module_Date_CMHG 02 Sep 2012
#define Module_MajorVersion "5.35"
#define Module_Version 535
#define Module_MinorVersion "4.79.2.147.2.17"
#define Module_Date "15 Aug 2012"
#define Module_MinorVersion "4.79.2.147.2.18"
#define Module_Date "02 Sep 2012"
#define Module_ApplicationDate "15-Aug-12"
#define Module_ApplicationDate "02-Sep-12"
#define Module_ComponentName "Kernel"
#define Module_ComponentPath "castle/RiscOS/Sources/Kernel"
#define Module_FullVersion "5.35 (4.79.2.147.2.17)"
#define Module_HelpVersion "5.35 (15 Aug 2012) 4.79.2.147.2.17"
#define Module_FullVersion "5.35 (4.79.2.147.2.18)"
#define Module_HelpVersion "5.35 (02 Sep 2012) 4.79.2.147.2.18"
#define Module_LibraryVersionInfo "5:35"
......@@ -174,6 +174,8 @@ EntryNo_HAL_Video_FramestoreAddress # 1 ; 116
EntryNo_HAL_UARTDefault # 1 ; 117
EntryNo_HAL_Video_StartupMode # 1 ; 118
KnownHALEntries # 0 ; Used inside Kernel
; Various flags and constants
......
......@@ -2544,25 +2544,6 @@ DebugTerminal_Wrch
Pull "a1-a4,sb,ip,pc" ; don't claim it
]
[ DebugHALTX
DebugHALPrint
Push "a1-a4,v1,sb,ip"
AddressHAL
MOV v1, lr
10 LDRB a1, [v1], #1
TEQ a1, #0
BEQ %FT20
CallHAL HAL_DebugTX
B %BT10
20 MOV a1, #13
CallHAL HAL_DebugTX
MOV a1, #10
CallHAL HAL_DebugTX
ADD v1, v1, #3
BIC lr, v1, #3
Pull "a1-a4,v1,sb,ip"
MOV pc, lr
]
Reset_IRQ_Handler
SUB lr, lr, #4
......@@ -2605,5 +2586,83 @@ Reset_IRQ_Exit
MSR SPSR_cxsf, a1
Pull "a1-a4,v1-v2,sb,ip,pc",,^
[ DebugHALTX
DebugHALPrint
Push "a1-a4,v1,sb,ip"
AddressHAL
MOV v1, lr
10 LDRB a1, [v1], #1
TEQ a1, #0
BEQ %FT20
CallHAL HAL_DebugTX
B %BT10
20 MOV a1, #13
CallHAL HAL_DebugTX
MOV a1, #10
CallHAL HAL_DebugTX
ADD v1, v1, #3
BIC lr, v1, #3
Pull "a1-a4,v1,sb,ip"
MOV pc, lr
]
[ DebugHALTX
HALDebugHexTX
stmfd r13!, {r0-r3,sb,ip,lr}
AddressHAL
b jbdt1
HALDebugHexTX2
stmfd r13!, {r0-r3,sb,ip,lr}
AddressHAL
b jbdt2
HALDebugHexTX4
stmfd r13!, {r0-r3,sb,ip,lr}
AddressHAL
mov r0,r0,ror #24 ; hi byte
bl jbdtxh
mov r0,r0,ror #24
bl jbdtxh
jbdt2
mov r0,r0,ror #24
bl jbdtxh
mov r0,r0,ror #24
jbdt1
bl jbdtxh
mov r0,#' '
CallHAL HAL_DebugTX
ldmfd r13!, {r0-r3,sb,ip,pc}
jbdtxh stmfd r13!,{r0-r3,lr} ; print byte as hex
and a4,a1,#&f ; get low nibble
and a1,a1,#&f0 ; get hi nibble
mov a1,a1,lsr #4 ; shift to low nibble
cmp a1,#&9 ; 9?
addle a1,a1,#&30
addgt a1,a1,#&37 ; convert letter if needed
CallHAL HAL_DebugTX
cmp a4,#9
addle a1,a4,#&30
addgt a1,a4,#&37
CallHAL HAL_DebugTX
ldmfd r13!,{r0-r3,pc}
|
HALDebugHexTX
HALDebugHexTX2
HALDebugHexTX4
MOV pc, lr
]
END
......@@ -41,30 +41,33 @@
MACRO
DebugTXHex
DebugTXHex $reg
! 0, "FIXME: jb temporary code"
;!!!
STR lr,[sp,#-4]!
stmfd sp!,{a1,lr}
mov a1, $reg
BL HALDebugHexTX
LDR lr,[sp],#4
ldmfd sp!,{a1,lr}
MEND
MACRO
DebugTXHex4
DebugTXHex4 $reg
! 0, "FIXME: temporary code"
;!!!
STR lr,[sp,#-4]!
stmfd sp!,{a1,lr}
mov a1, $reg
BL HALDebugHexTX4
LDR lr,[sp],#4
ldmfd sp!,{a1,lr}
MEND
MACRO
DebugTXHex2
DebugTXHex2 $reg
! 0, "FIXME: temporary code"
;!!!
STR lr,[sp,#-4]!
stmfd sp!,{a1,lr}
mov a1, $reg
BL HALDebugHexTX2
LDR lr,[sp],#4
ldmfd sp!,{a1,lr}
MEND
MACRO
......
......@@ -365,11 +365,13 @@ InitialiseMode Entry
MOV r0, #1 ; no need to check for soft reset,
SWI XOS_ReadSysInfo ; always use configured value
]
! 0, "FIXME: temporary code"
;!!!
ADR r1,mode_defn
; at this stage, r0 = current screen mode either mode number or mode specifier
; lets give the HAL a chance to be fussy.
mjsAddressHAL
mjsCallHAL HAL_Video_StartupMode
; MOV r1, r0
01
MOV r1, r0
MOV r0, #ScreenModeReason_SelectMode
SWI XOS_ScreenMode
......@@ -382,14 +384,7 @@ InitialiseMode Entry
SWIVC XOS_WriteI+0 ; and if we can't get mode 0, we're really fooked!!!
EXIT
! 0, "FIXME: temporary code"
mode_defn DCD 1
DCD 1920
DCD 1080
DCD 5
DCD -1
DCD -1
;
;
;------------------------------------------------------------------------------
;
......@@ -757,10 +752,6 @@ VduBadExit ; jumped to if an error in VDU code
ModeChangeSub ROUT
Push lr
! 0, "FIXME: temporary code"
; !!!
ADRL R2,mode_defn
;If its a common mode number (0..49) consider a possible mode number
;substitution, if hardware does not support given bits per pixel.
;We are vaguely assuming h/w supports at least 8 bpp, otherwise we may
......@@ -808,7 +799,6 @@ mchsub_3
IssueService
TEQ R1, #0 ; was service claimed ?
BNE %FT03 ; no, so continue
CMP R0, #0 ; service claimed; generate error ?
Pull PC, EQ ; no, just exit (V=0 from CMP)
B %FT07 ; yes, then generate error
......@@ -826,7 +816,6 @@ mchsub_3
TEQ R0, R1 ; if substitute mode
MOVNE R2, #0 ; then don't use shadow
DebugTX "FindOKMode reached"
CMP r1, #&100
BICCC r10, r1, #&80
......@@ -834,7 +823,6 @@ mchsub_3
MOV R11, R10
BL PushModeInfo
BVS %FT07 ; [probably duff mode selector]
DebugTX "PushModeInfo done"
LDR R11, [R13, #wkScreenSize] ; get screen size for this mode
LDR R9, [WsPtr, #TotalScreenSize] ; maximum allowed amount
......@@ -846,7 +834,9 @@ mchsub_3
[ UseGraphicsV
LDRB R0, [WsPtr, #ExternalFramestore]
TEQ R0, #0
BNE %FT06 ; can't grow an external framestore
BNE %FT08 ; video driver agreed to the mode change
; so should handle memory growth OK
; maybe complain if GV_Features R0 bit 5 not set?
]
; try to extend the amount of screen memory
......@@ -862,9 +852,7 @@ mchsub_3
[ International
BL TranslateError
]
DebugTX "Can't grow framestore"
07
DebugTX "Mode fail"
SETV ; indicate error
Pull PC
......@@ -947,11 +935,20 @@ TV_Mode_string
[ UseGraphicsV
Push "r0-r6"
! 0, "FIXME: fixed (!?) temporary code"
MOV r4, #GraphicsV_DisplayFeatures
BL CallGraphicsV
; If driver handles memory allocation, must change mode before asking for memory
TST r0, #1<<5
ADDNE R0, R13, #wkwordsize+7*4 ; R0 -> VIDCList3
BLNE HardwareModeChange
MOV r4, #GraphicsV_FramestoreAddress
BL CallGraphicsV
TEQ r4, #0
BNE %FT581
[ {TRUE}
; for mapping in, round start address down and size up to megabyte boundaries
; r0 = physical start, r1= size
......@@ -1079,12 +1076,73 @@ TV_Mode_string
; finished doing other variables
[ :LNOT:UseGraphicsV
Push "R0-R3, R9, R12" ; preserve registers ready to make HAL call later
ADD R0, R13, #wkwordsize+6*4 ; R0 -> VIDCList3 (we have just pushed 6 regs)
|
ADD R0, R13, #wkwordsize ; R0 -> VIDCList3
]
; tell hardware to change mode, unless already done
MOV r4, #GraphicsV_DisplayFeatures
BL CallGraphicsV
TST r0, #1<<5
ADDEQ R0, R13, #wkwordsize ; R0 -> VIDCList3
BLEQ HardwareModeChange
ADD R13, R13, #PushedInfoSize ; junk stacked data
; for backward compatibility, show that video DMA is enabled in
; MEMC soft copy (DON'T call OS_UpdateMEMC, which would also
; make redundant call to HAL)
;
SavePSR R2
LDR R0, =ZeroPage
WritePSRc SVC_mode+I_bit+F_bit, R14
LDR R1, [R0, #MEMC_CR_SoftCopy]
ORR R1, R1, #(1 :SHL: 10)
STR R1, [R0, #MEMC_CR_SoftCopy]
RestPSR R2
BL SetVendDefault
LDR R1, [WsPtr, #ScreenEndAddr] ; need to reload cos corrupt
LDR R2, [WsPtr, #TotalScreenSize]
SUB R0, R1, R2 ; R0 = Vstart
BL SetVstart
MOV R0, #0
STRB R0, [WsPtr, #PointerShapeNumber]
STR R0, [WsPtr, #TeletextOffset]
STR R0, [WsPtr, #CursorStack] ; restore cursor on a mode
BL PalInit ; set default palette
BL UnblankScreen
BL SetMouseRectangle
BL FF
[ {FALSE} ;;; LCDPowerCtrl :LAND: :LNOT: STB
;;; mjsHAL no LCD support
;Switch the LCD on if LCD mode
Push "r0"
MOV R1, #0
LDRB R1, [R1, #LCD_Active]
ANDS R1, R1, #&7F ;Check the LCD mode bits only, not the single/dual panel bit
LDRNE R0, =(PortableControl_LCDEnable :OR: PortableControl_BacklightEnable)
LDRNE R1, =:NOT:(PortableControl_LCDEnable :OR: PortableControl_BacklightEnable)
SWINE XPortable_Control
Pull "r0"
]
MOV R1, #Service_ModeChange
BL IssueModeService
CLRV ; indicate no error
Pull PC ; return to caller
; *****************************************************************************
;
; HardwareModeChange - Tell the video driver to change the mode
;
; in: R0 = VIDC list
;
; out: All regs preserved
;
HardwareModeChange
Push "R0-R4, LR"
;adjust vertical porch parameters in VIDCList3 for TVVertical (from *TV)
;
......@@ -1134,64 +1192,11 @@ TV_Mode_string
;kernel/HAL split - call the HAL to program video controller for mode,
;
[ UseGraphicsV
MOV R4, #GraphicsV_SetMode
BL CallGraphicsV
|
mjsAddressHAL
mjsCallHAL HAL_Video_SetMode
Pull "R0-R3, R9, R12" ; restore registers after HAL call
]
ADD R13, R13, #PushedInfoSize ; junk stacked data
; for backward compatibility, show that video DMA is enabled in
; MEMC soft copy (DON'T call OS_UpdateMEMC, which would also
; make redundant call to HAL)
;
SavePSR R2
LDR R0, =ZeroPage
WritePSRc SVC_mode+I_bit+F_bit, R14
LDR R1, [R0, #MEMC_CR_SoftCopy]
ORR R1, R1, #(1 :SHL: 10)
STR R1, [R0, #MEMC_CR_SoftCopy]
RestPSR R2
Pull "R0-R4, PC"
BL SetVendDefault
LDR R1, [WsPtr, #ScreenEndAddr] ; need to reload cos corrupt
LDR R2, [WsPtr, #TotalScreenSize]
SUB R0, R1, R2 ; R0 = Vstart
BL SetVstart
MOV R0, #0
STRB R0, [WsPtr, #PointerShapeNumber]
STR R0, [WsPtr, #TeletextOffset]
STR R0, [WsPtr, #CursorStack] ; restore cursor on a mode
BL PalInit ; set default palette
BL UnblankScreen
BL SetMouseRectangle
BL FF
[ {FALSE} ;;; LCDPowerCtrl :LAND: :LNOT: STB
;;; mjsHAL no LCD support
;Switch the LCD on if LCD mode
Push "r0"
MOV R1, #0
LDRB R1, [R1, #LCD_Active]
ANDS R1, R1, #&7F ;Check the LCD mode bits only, not the single/dual panel bit
LDRNE R0, =(PortableControl_LCDEnable :OR: PortableControl_BacklightEnable)
LDRNE R1, =:NOT:(PortableControl_LCDEnable :OR: PortableControl_BacklightEnable)
SWINE XPortable_Control
Pull "r0"
]
MOV R1, #Service_ModeChange
BL IssueModeService
CLRV ; indicate no error
Pull PC ; return to caller
MakeErrorBlock BadMODE
......@@ -1262,13 +1267,8 @@ PushModeInfo ROUT
BL ReadMonitorType
PushModeInfoCommon
MOV r2, r10 ; r2 = original mode
! 0, "FIXME: temporary code"
;!!!
; BL OfferModeExtension
; BEQ %FT30 ; [service claimed]
MOV r3,#0
MOV r4,#0
B %FT30
BL OfferModeExtension
BEQ %FT30 ; [service claimed]
CMP r2, #&100 ; service not claimed - check if mode selector
MOVCC r10, r11 ; unrecognised mode number, so use substitute
......@@ -1343,7 +1343,6 @@ PushModeInfoCommonNoService
LDR r2, [r3, #0] ; is it type 3? (actually, it always should be now)
TEQ r2, #3
BNE %FT58
LDR r10, [r3, #VIDCList3_SyncPol]
TST r10, #SyncPol_InterlaceSpecified
BNE %FT56 ; Interlace already specified
......@@ -1467,11 +1466,9 @@ GenerateModeSelectorVars Entry "r0,r1,r3-r8,r10-r12"
TST r2, #1 ; is it a new format sprite mode word?
BNE %FT50 ; [yes, so skip]
MOV r0, r2
; DebugTX "ValModeSel"
BL ValidateModeSelector
BVS %FT95 ; invalid - return error
LDMIB r2, {r4-r6} ; r4 = xres; r5 = yres; r6 = pixdepth
; DebugTX "Passed"
STR r6, [r9, #wkLog2BPC] ; log2bpc = log2bpp = pixdepth
STR r6, [r9, #wkLog2BPP]
......
......@@ -139,8 +139,11 @@ GV_DisplayFeatures
GV_FramestoreAddress
Push "r3, r9, lr"
mjsAddressHAL WsPtr
MOV r4, #0
MOV r0, #0
MOV r1, #0
mjsCallHAL HAL_Video_FramestoreAddress
ORRS r2, r0, r1
MOVNE r4, #0
Pull "r3, r9, pc"
GV_WritePaletteEntry
......
......@@ -773,11 +773,6 @@ SWICheckModeValid ROUT
;
FindOKMode ROUT
! 0, "FIXME: temporary code"
;!!!
ADDS R1,R0,#0
MOV pc,lr
Push "r0,r2-r4,r10,r11,lr"
BL ReadMonitorType
CMP r0, #&100 ; if it's a mode number
......
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