Commit 76db1228 authored by Jeffrey Lee's avatar Jeffrey Lee
Browse files

Add basic HAL device for the official DSI display/touchscreen. Delete superfluous code.

Detail:
  Makefile, s/Touch - Basic HAL device for the official touchscreen, which just exposes the address of the buffer which the GPU periodically fills with a register dump of the touchscreen controller.
  hdr/BCM2835 - Remove old comment. Add new tag for getting the touchscreen buffer address.
  hdr/StaticWS - Remove old workspace entries. Add new entries for touchscreen.
  s/Messaging - Remove the messagebox tags which set a screen mode on startup (BCMVideo will handle that for us), and just blank the screen instead (to stop the GPU displaying a coloured square). Add tag to get the touchscreen buffer address.
  s/Top - Register touchscreen HAL device during HAL_InitDevices. Remove more old code.
Admin:
  Tested on Raspberry Pi 1 B


Version 0.50. Tagged as 'BCM2835-0_50'
parent 059ba08a
......@@ -17,7 +17,7 @@
COMPONENT = BCM2835 HAL
TARGET = BCM2835
OBJS = Top CLib CMOS Debug Interrupts SDIO Stubs Timers UART USB Video DMA Messaging GPIO VCHIQ IIC RTC SPI
OBJS = Top CLib CMOS Debug Interrupts SDIO Stubs Timers UART USB Video DMA Messaging GPIO VCHIQ IIC RTC SPI Touch
HDRS =
CMHGFILE =
......
/* (0.49)
/* (0.50)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 0.49
#define Module_MajorVersion_CMHG 0.50
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 08 Nov 2015
#define Module_Date_CMHG 14 Nov 2015
#define Module_MajorVersion "0.49"
#define Module_Version 49
#define Module_MajorVersion "0.50"
#define Module_Version 50
#define Module_MinorVersion ""
#define Module_Date "08 Nov 2015"
#define Module_Date "14 Nov 2015"
#define Module_ApplicationDate "08-Nov-15"
#define Module_ApplicationDate "14-Nov-15"
#define Module_ComponentName "BCM2835"
#define Module_ComponentPath "mixed/RiscOS/Sources/HAL/BCM2835"
#define Module_FullVersion "0.49"
#define Module_HelpVersion "0.49 (08 Nov 2015)"
#define Module_LibraryVersionInfo "0:49"
#define Module_FullVersion "0.50"
#define Module_HelpVersion "0.50 (14 Nov 2015)"
#define Module_LibraryVersionInfo "0:50"
......@@ -226,7 +226,6 @@ MB_Pwr_SPI_MASK * 7
MB_Pwr_CCP2TX_MASK * 8
; ARM2VC tags
; see https://github.com/raspberrypi/firmware/wiki/Mailbox-property-interface
; Note - this interface isn't implemented in the GPU firmware yet!
ARM2VC_Tag_End * &00000000 ; End of tag list
ARM2VC_Tag_GetFirmwareVersion * &00000001 ; return 4 byte firmware version
ARM2VC_Tag_GetBoardModel * &00010001 ; return 4 byte model
......@@ -273,7 +272,7 @@ ARM2VC_Tag_FBSetOverscan * &0004800a ; set overscan values
ARM2VC_Tag_FBGetPalette * &0004000b ; get full palette table
ARM2VC_Tag_FBTestPalette * &0004400b ; test ranged update of table
ARM2VC_Tag_FBSetPalette * &0004800b ; do ranged update of table
ARM2VC_Tag_FBGetTouchBuf * &0004000f ; get address of FT5406 register bank softcopy
; mem barrier operation; ensures all explicit mem operations completed before
; instruction exits.
......
......@@ -112,8 +112,6 @@ Timer$Timer.Ws # TimerWsSize
Timer SETA Timer + 1
WEND
FB_Base # 4
FB_Size # 4
FB_CacheMode # 4
; info interrogated from the VC side
......@@ -124,6 +122,7 @@ VC_Size # 4
Board_Model # 4
Board_Revision # 4
ARM_DMAChannels # 4
TouchBuf # 4
; align to 16 byte boundary NB this isnt aligned once hal initialised
# (((:INDEX:@)+15):AND::NOT:15)-(:INDEX:@)
......@@ -161,6 +160,7 @@ RTCDeviceStruct # 80
SPI0Device # HALDeviceSize
SPI1Device # HALDeviceSize
SPI2Device # HALDeviceSize
TouchDevice # HALDeviceSize
HAL_WsSize * :INDEX:@
sizeof_workspace * :INDEX:@
......
......@@ -46,7 +46,6 @@
EXPORT MacAdd
EXPORT RamAd
EXPORT SerNo
EXPORT Displ
; send a message packet to the host and await the reply
......@@ -122,18 +121,10 @@ lp1 ldr r3, [r0], #4 ; copy to workspace buffer
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
ADD r0,r5,#Dispbs-tagb ; frame buffer address and size
LDMIA r0, {r1, r2}
STR r1, FB_Base
STR r2, FB_Size
[ HALDebug
mov a1,a2
bl HAL_DebugHexTX4
mov a1,a3
bl HAL_DebugHexTX4
]
STR r0, TouchBuf
LDR r0, [r5, #boardmodel-tagb]
LDR r1, [r5, #boardrev-tagb]
LDR r2, [r5, #dmachans-tagb]
......@@ -207,7 +198,6 @@ gbit ;
MacAdd DCD :INDEX:MAClo - :INDEX:tagb + :INDEX:tagbuffer
RamAd DCD :INDEX:ARMbs - :INDEX:tagb + :INDEX:tagbuffer
SerNo DCD :INDEX:SNlo - :INDEX:tagb + :INDEX:tagbuffer
Displ DCD :INDEX:Dispbs - :INDEX:tagb + :INDEX:tagbuffer
; series of VC side query tags. Using inline code as this is writable at this
......@@ -253,51 +243,14 @@ tagdmachans
DCD 4
DCD 0
dmachans DCD 0
tagdisplphyswh
DCD ARM2VC_Tag_FBSetPhysDimension
DCD 8
DCD 8
phyx DCD 1920
DCD 1080
tagdisplvirtwh
DCD ARM2VC_Tag_FBSetVirtDimension
DCD 8
DCD 8
virtx DCD 1920
DCD 1080
tagdisplvirtoffset
DCD ARM2VC_Tag_FBSetVirtOffset
DCD 8
DCD 8
vxoff DCD 0
DCD 0
tagdispldepth
DCD ARM2VC_Tag_FBSetDepth
DCD 4
DCD 4
dispbpp DCD 32 ; 32bit
tagdisplpixord
DCD ARM2VC_Tag_FBSetPixelOrder
DCD ARM2VC_Tag_FBBlank
DCD 4
DCD 4
DCD 1 ; RGB
tagdisplalpha
DCD ARM2VC_Tag_FBSetAlphaMode
DCD 4
DCD 4
DCD 2 ; channel 1=alpha reversed 2=ignore
taggetpitch
DCD ARM2VC_Tag_FBGetPitch
DCD 1 ; Start with the screen blanked (avoids firmware displaying an RGB square)
DCD ARM2VC_Tag_FBGetTouchBuf
DCD 4
DCD 0
dispit DCD 0
tagdisplalloc
DCD ARM2VC_Tag_FBAlloc
DCD 8
DCD 8
Dispbs DCD 0x100000 ; megabyte aligned
Dispsz DCD 0
DCD ARM2VC_Tag_End
touchbuf DCD 0
tagslen * . - tagb
ASSERT tagslen <= ?tagbuffer
......
......@@ -133,13 +133,14 @@
IMPORT SPI_InitDevices
IMPORT Touch_InitDevices
IMPORT HAL_SendHostMessage
IMPORT HAL_QueryPlatform
EXPORT HAL_Base
IMPORT RamAd
IMPORT SerNo
IMPORT Displ
HAL_Base
......@@ -261,11 +262,6 @@ start
; query the platform and set up a frame buffer.
BL HAL_QueryPlatform
LDR r3, FB_Base
mov r0,r3
bl HAL_DebugHexTX4
[ HALDebug
bl HAL_DebugTXStrInline
DCB "HalStartup2",10,0
......@@ -585,21 +581,19 @@ HAL_Init
MOV a4, sb ; confirm the caching mode in use in GPU
ADRL sb, workspace ; where we remembered it is
LDR a3, FB_Size
LDR a2, FB_Base ; effectively part of the ROM image
LDR a1, FB_CacheMode ; GPU cache mode
LDR a2, TouchBuf
mov sb, a4
STR a3, FB_Size ; put in our workspace
STR a2, FB_Base ; for HAL_FramestoreAddress use
STR a1, FB_CacheMode
STR a2, TouchBuf
ADRL sb, workspace ; where we remembered it is
LDR a3, VC_Size ; VC Start
LDR a2, VC_Base ; VC_Size
LDR a3, VC_Size
LDR a2, VC_Base
LDR a1, ARM_Base
LDR ip, ARM_Size
mov sb, a4
STR a3, VC_Size ; VC Start
STR a2, VC_Base ; VC_Size
STR a3, VC_Size
STR a2, VC_Base
STR a1, ARM_Base
STR ip, ARM_Size
ADRL sb, workspace ; where we remembered it is
......@@ -808,6 +802,7 @@ HAL_InitDevices
BL VCHIQ_InitDevices
BL RTC_InitDevices
BL SPI_InitDevices
BL Touch_InitDevices
LDR pc, [sp], #4
......
;
; Copyright (c) 2015, RISC OS Open Ltd
; All rights reserved.
;
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions are met:
; * Redistributions of source code must retain the above copyright
; notice, this list of conditions and the following disclaimer.
; * Redistributions in binary form must reproduce the above copyright
; notice, this list of conditions and the following disclaimer in the
; documentation and/or other materials provided with the distribution.
; * Neither the name of RISC OS Open Ltd nor the names of its contributors
; may be used to endorse or promote products derived from this software
; without specific prior written permission.
;
; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
; ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
; LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
; INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
; CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
; ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
; POSSIBILITY OF SUCH DAMAGE.
;
AREA |ARM$$code|, CODE, READONLY, PIC
GET Hdr:ListOpts
GET Hdr:Macros
GET Hdr:Proc
$GetMEMM
GET hdr.BCM2835
GET hdr.StaticWS
GET hdr.CastleMacros
EXPORT Touch_InitDevices
IMPORT memcpy
MACRO
$class HALDeviceField $field, $value
LCLS myvalue
[ "$value" = ""
myvalue SETS "$field"
|
myvalue SETS "$value"
]
ASSERT . - %A0 = HALDevice_$class$field
[ ?HALDevice_$class$field = 2
DCW $myvalue
ELIF ?HALDevice_$class$field = 4
DCD $myvalue
|
% ?HALDevice_$class$field
]
MEND
; Template for touchscreen device
Touch_Dev
0
HALDeviceField Type, HALDeviceType_HID + HALDeviceHID_Touchscreen
HALDeviceField ID, HALDeviceID_Touchscreen_FT5406
HALDeviceField Location, HALDeviceBus_Sys + HALDeviceSysBus_AHB ; Guess
HALDeviceField Version, 0
HALDeviceField Description, Touch_Description
HALDeviceField Address, 0 ; Filled in later
HALDeviceField Reserved1, 0
HALDeviceField Activate, Touch_Activate
HALDeviceField Deactivate, Touch_Deactivate
HALDeviceField Reset, Touch_Reset
HALDeviceField Sleep, Touch_Sleep
HALDeviceField Device, -1
HALDeviceField TestIRQ, 0
HALDeviceField ClearIRQ, 0
HALDeviceField Reserved2, 0
ASSERT . - %A0 = HALDeviceSize
Touch_Description
= "FT5406 Touch Panel Controller", 0
ALIGN
; Initialise our HAL devices
Touch_InitDevices ROUT
Entry "v1"
LDR v1, TouchBuf
CMP v1, #0
EXIT EQ
ADRL a1, TouchDevice
ADR a2, Touch_Dev
MOV a3, #HALDeviceSize
BL memcpy
; Guess whether we've been given an ARM or GPU physical address
LDR a1, FB_CacheMode
CMP v1, a1
SUBHS v1, v1, a1
; Map in the memory (assumed to be RAM, not actual hardware regs)
MOV a1, #1:SHL:L1_TEXShift ; VMSA Normal, non-cacheable
MOV a2, v1
MOV a3, #256
CallOS OS_MapInIO
ADRL a2, TouchDevice
STR a1, [a2, #HALDevice_Address]
; Register the device
MOV a1, #0
CallOS OS_AddDevice
EXIT
Touch_Activate
MOV a1, #1
Touch_Deactivate
Touch_Reset
MOV pc, lr
Touch_Sleep
MOV a1, #0
MOV pc, lr
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