Commit aefa85eb authored by Kevin Bracey's avatar Kevin Bracey
Browse files

Stuff. A bit of touchscreen, I expect, and probably some other bits too.

parent 88a863f1
......@@ -296,14 +296,66 @@ Matrix Keyboard
===============
Many devices provide a matrix keyboard interface. The following calls
provide access to it.
provide access to it. Interrupt driven operation, or high-level calls will be
defined later.
int HAL_MatrixColumns(void)
Returns the number of columns available via the matrix interface.
Columns are numbered from 0 to <num columns>-1.
unsigned int HAL_MatrixScan(int column).
Returns a bitfield describing which rows are active on the specified column.
Pass in column=-1 to deassert the column selects.
Any timing issues, or the driving of the matrix between calls are left to
the HAL.
Touchscreen
===========
PDA-type devices usually have a touchscreen as their primary pointing device.
This API provides a simple interface to a touchscreen. The calls are described
in terms of a resistive touchscreen, but other technologies should be mappable
onto it. Interrupt operation is yet to be defined.
unsigned int HAL_TouchscreenType(void)
Returns a flags word indicating the type of touchscreen.
bits 0-7: Touchscreen type 0=>none, 1=>resistive
bit 8: Interrupt operation supported
bit 9: Calibration not required
bits 10-15: Reserved
bits 16-21: Bits of precision available
bits 22-31: Reserved
"Calibration not required" indicates that the raw values returned map linearly
onto the screen display area to a usable accuracy as follows:
X,Y (00000000,00000000) = bottom left of display area
X,Y (FFFFFFFF,FFFFFFFF) = top right of display area
Pres 00000000-1FFFFFFF = no touch
Pres 20000000-3FFFFFFF = light touch
Pres 3FFFFFFF-7FFFFFFF = touch
Pres 80000000-FFFFFFFF = firm touch
unsigned int HAL_TouchscreenMeasure(int meas)
Performs a touchscreen measurement. Measurements are:
0 = X position
1 = Y position
2 = pressure
3 = X resistance
4 = Y resistance
"X" and "Y" need not actually be X and Y - rotation can be dealt with by
calibration.
All values are returned as unsigned 32-bit values in the range &00000000-&FFFFFFFF.
If using, for example, a 10-bit DAC, the 10-bit value read should be placed at the
top of the returned word. Ideally, the 10 bits should be replicated in lower bits
(ABCDEFGH IJABCDEF GHIJABCD EFGHIJAB) to ensure the returned values fully span
the 32-bit range.
Resistance measurements can be used to compensate for large pressed areas causing
shorts - subtract the instantaneous resistance from the instantaneous precision.
(I think).
......@@ -77,6 +77,9 @@ EntryNo_HAL_Video_BufferAlignment # 1
EntryNo_HAL_MatrixColumns # 1
EntryNo_HAL_MatrixScan # 1
EntryNo_HAL_TouchscreenType # 1
EntryNo_HAL_TouchscreenRead # 1
EntryNo_HAL_MachineID # 1
EntryNo_HAL_ControllerAddress # 1
EntryNo_HAL_HardwareInfo # 1
......
......@@ -239,7 +239,7 @@ UNDStackSize * 8*1024
SVCStackAddress * &01C00000
AplWorkMaxSize * &01F00000 ; 31M - temporary (need to decide this at boot time)
AplWorkMaxSize * &01C00000 ; 28M - temporary (need to decide this at boot time)
ScreenEndAdr * &24000000 ; temporary - run time allocate
FreePoolAddress * &28000000 ; ditto
......
......@@ -369,7 +369,7 @@ GetMessages SETS ""
DebugForcedReset SETL {FALSE}
GBLA ConfiguredLang
ConfiguredLang SETA 0;10 ; default configured language
ConfiguredLang SETA 10 ; default configured language
GBLA FirstUnpluggableModule
FirstUnpluggableModule SETA 8 ; Podule, FileSwitch, ResourceFS, Messages, MessageTrans,
......
......@@ -110,7 +110,7 @@ DAHandler_TestShrink * 4 ; new reason added to find amount area c
; Number of entries in page block on stack
NumPageBlockEntries * 32
NumPageBlockEntries * 63
PageBlockSize * NumPageBlockEntries * 12
PageBlockChunk * NumPageBlockEntries * 4096
......
......@@ -13,8 +13,10 @@
; limitations under the License.
;
GBLL MajorL2PThack
MajorL2PThack SETL {TRUE}
MajorL2PThack SETL {FALSE}
GBLL MinorL2PThack
MinorL2PThack SETL :LNOT:MajorL2PThack
; Fixed page allocation is as follows
......@@ -332,6 +334,13 @@ RISCOS_Start
; v2 -> next address to allocate in v1 (may point at end of v1)
; v3 -> L1PT (or 0 if MMU on - not yet)
; Allocate the L2PT backing store for the logical L2PT space, to
; prevent recursion.
LDR a1, =L2PT
MOV a2, #&400000
LDR a3, =(AP_None * L2_APMult)
BL AllocateL2PT
; Allocate workspace for the HAL
ADD a4, v3, #DRAMOffset_PageZero - DRAMOffset_L1PT
......@@ -578,12 +587,19 @@ MMUon_nol1ptoverlap
LDR sp, =ScratchSpace + ScratchSpaceSize - 4*3 ; 3 items already on stack :)
LDR a1, =ZeroPage
ADD lr, v3, #DRAMOffset_PageZero-DRAMOffset_L1PT ; lr = PhysAddr of zero page
SUB v1, v1, lr
ADD v1, v1, a1 ; turn v1 from LogAddr to PhysAddr
ADD v1, v1, a1 ; turn v1 from PhysAddr to LogAddr
LDR a2, [a1, #InitUsedBlock] ; turn this from Phys to Log too
SUB a2, a2, lr
ADD a2, a2, a1
STR a2, [a1, #InitUsedBlock]
; Store the logical address of the HAL descriptor
LDR a1, =ZeroPage
LDR a2, [sp, #8]
STR a2, [a1, #HAL_Descriptor]
......@@ -606,11 +622,21 @@ MMUon_nol1ptoverlap
BL SetUpHALEntryTable
; Initialise the HAL
; Initialise the HAL. Due to its memory claiming we need to get our v1 and v2 values
; into workspace and out again around it.
MOV a1, #ZeroPage
STR v1, [a1, #InitUsedBlock]
STR v2, [a1, #InitUsedEnd]
LDR a1, =RISCOS_Header
AddressHAL
CallHAL HAL_Init
MOV a1, #ZeroPage
LDR v1, [a1, #InitUsedBlock]
LDR v2, [a1, #InitUsedEnd]
; Start timer zero, at 100 ticks per second
MOV a1, #0
CallHAL HAL_TimerGranularity
......@@ -680,6 +706,24 @@ MMUon_nol1ptoverlap
LDR a3, =32*1024
BL Init_MapInRAM
[ MinorL2PThack
; Allocate backing L2PT for the free pool
MOV a1, #FreePoolAddress
LDR a2, [v8, #RAMLIMIT]
LDR a3, =(AP_None * L2_APMult) + L2_B
BL AllocateL2PT
; And for application space
MOV a1, #0
LDR a2, [v8, #RAMLIMIT] ; Not quite right, but the whole thing's wrong anyway
LDR a3, =(AP_Full * L2_APMult) + L2_C + L2_B
BL AllocateL2PT
; And for the system heap. Sigh
LDR a1, =SysHeapAddress
LDR a2, =SysHeapMaxSize
LDR a3, =(AP_Full * L2_APMult) + L2_C + L2_B
BL AllocateL2PT
]
LDR a1, =ZeroPage
STR v2, [a1, #InitUsedEnd]
......@@ -1082,22 +1126,30 @@ AllocateL2PT
ORR a3, a3, lr, LSL #10
STR a3, [v6, v8, LSL #2] ; fill in the L1PT
TEQ v3, #0 ; MMU off?
[ EmulatorSupport
ARM_on_emulator a1,NE ; and not on the emulator?
]
MOVNE a1, v4 ; if so, zero out the L2PT
MOVNE a2, #0 ; (if it's on then it will already
MOVNE a3, #4*1024 ; be clear from ClearPhysRAM, and
BLNE memset ; it's not mapped in yet anyway)
; Need to zero the L2PT. Must do it before calling in MapInPage, as that may well
; want to put something in the thing we are clearing. If the MMU is off, no problem,
; but if the MMU is on, then the L2PT isn't accessible until we've called MapInPage.
; Solution is to use the AccessPhysicalAddress call.
TEQ v3, #0 ; MMU on?
MOVNE a1, v4 ; if not, just access v4
MOVEQ a1, #L1_B ; if so, map in v4
MOVEQ a2, v4
MOVEQ a3, #0
BLEQ RISCOS_AccessPhysicalAddress
MOV a2, #0
MOV a3, #4*1024
BL memset
MOV a1, v4 ; Map in the L2PT page itself
LDR a2, =L2PT ; (will recurse...)
ADD a2, a2, v8, LSL #10
LDR a2, =L2PT ; (can't recurse, because L2PT
ADD a2, a2, v8, LSL #10 ; backing for L2PT is preallocated)
BIC a2, a2, #&C00
LDR a3, =(AP_None * L2_APMult) + L2_SmallPage
BL Init_MapInPage
40 ADD v8, v8, #1 ; go back until all
CMP v8, v7 ; pages allocated
BLO %BT05
......@@ -1388,6 +1440,9 @@ RISCOS_MapInIO
MOV v3, #0
BL Init_MapIn
MOV a1, v4
MOV ip, #ZeroPage
STR v1, [ip, #InitUsedBlock]
STR v2, [ip, #InitUsedEnd]
EXIT
; In: a1 = Physical address
......
......@@ -245,6 +245,15 @@ v8 RN 11
LDR pc, [sb, #-(EntryNo_$rout+1) * 4]
MEND
; Checks whether a HAL routine exits. If it does, a1 points to it (probably
; not useful), and Z is clear. lr corrupted.
MACRO
CheckHAL $rout
LDR a1, [sb, #-(EntryNo_$rout+1) * 4]
ADRL lr, NullHALEntry
TEQ a1, lr
MEND
; +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
; Various constants
......
......@@ -964,7 +964,19 @@ not_full_reset
BL Write
[ HAL
AddressHAL
CheckHAL HAL_TouchscreenType
BEQ dont_program_mousetype
CallHAL HAL_TouchscreenType
TST R0, #&FF
BEQ dont_program_mousetype
MOV R0, #MouseCMOS
MOV R1, #6 ; To be assigned
BL Write
! 0, "Sort out 16-bit sound + PS/2 mouse CMOS reset selection"
dont_program_mousetype
|
[ MorrisSupport
......
......@@ -279,18 +279,26 @@ ReadMouse ROUT
Pull "R4-R6,R10-R12,PC"
Abso DCB "Abso"
; *****************************************************************************
;
; ProcessMouseXY - Called to update mouse position.
;
; in: r2 = signed 32-bit X movement
; r3 = signed 32-bit Y movement
; r4 = "Abso" if absolute movement
; r11 ->KeyWorkSpace
; out: r2,r3 corrupted
;
ProcessMouseXY
Push "r4,lr"
; check for absolute position
LDR lr, Abso
TEQ r4, lr
BEQ %FT40
; process X movement
CMP r2, #0
BEQ %FT10
......@@ -336,6 +344,30 @@ ProcessMouseXY
Pull "r4,pc"
40
; process absolute position
MOV r2, r2, ASL #16 ; look only at bottom 16 bits,
MOV r3, r3, ASL #16 ; sign extended
MOV r2, r2, ASR #16
MOV r3, r3, ASR #16
LDR r4, MouseBoundLCol ; bound to bounding box
CMP r2, r4
MOVLT r2, r4
LDR r4, MouseBoundRCol
CMP r4, r2
MOVLT r2, r4
STR r2, MouseX
LDR r4, MouseBoundBRow ; bound to bounding box
CMP r3, r4
MOVLT r3, r4
LDR r4, MouseBoundTRow
CMP r4, r3
MOVLT r3, r4
STR r3, MouseY
Pull "r4,pc"
[ AssemblePointerV
; *****************************************************************************
......@@ -345,13 +377,14 @@ ProcessMouseXY
; out: corrupts r0-r3,r9-r11
;
PollPointer
Push "r12,lr"
Push "r4,r12,lr"
MOV r11, #KeyWorkSpace
MOV r0, #0 ; Request pointer state.
LDRB r1, MouseType
MOV r2, #0 ; Default to no movement.
MOV r3, #0
MOV r4, #0 ; They might fill this in
SavePSR r9 ; Save current PSR.
WritePSRc SVC_mode+I_bit, r10 ; Call PointerV in SVC mode, no IRQs.
MOV r10, #PointerV ; Call PointerV to get movements & button states
......@@ -369,7 +402,7 @@ PollPointer
BL ProcessMouseXY
]
Pull "r12,pc"
Pull "r4,r12,pc"
; *****************************************************************************
......
......@@ -118,6 +118,9 @@ temp SETA .-ArthurVduDriver-temp
MACRO
GetBandwidthAndSize $bw, $size
[ HAL
MOV $size, #0
MOV $bw, #100*1024*1024
LDR $size, [$size, #VideoSize]
! 0, "Sort out GetBandwidthAndSize"
|
MOV $size, #0
......@@ -2093,8 +2096,8 @@ DefaultWindows ROUT
STMIA R4!, {R0-R3} ; zero OlderCsX, OlderCsY, OldCsX, OldCsY
STMIA R4!, {R0-R3} ; zero GCsIX, GCsIY, NewPtX, NewPtY
LDR R0, [WsPtr, #ModeFlags]
TST R0, #Flag_HardScrollDisabled
LDR R0, [WsPtr, #VduSprite]
TEQ R0, #0
LDR R0, [WsPtr, #VduStatus] ; if not outputting to sprite
BICEQ R0, R0, #Windowing ; then indicate no text window
......
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