Commit 37c448aa authored by Jeffrey Lee's avatar Jeffrey Lee
Browse files

Add USB support

Detail:
  hdr/USB - New header with definition of usbinfo struct that's used by HAL_USBControllerInfo
  hdr/BCM2835 - Add note clarifying how mailboxes are used
  s/Top - Enable power to USB on startup
  s/USB - Implement HAL_USBControllerInfo to expose Synopsys USB controller details to RISC OS
Admin:
  Tested in BCM2835 ROM with Apr 19th start.elf


Version 0.07. Tagged as 'BCM2835-0_07'
parent 6d2a16e5
......@@ -11,13 +11,13 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "0.06"
Module_Version SETA 6
Module_MajorVersion SETS "0.07"
Module_Version SETA 7
Module_MinorVersion SETS ""
Module_Date SETS "24 May 2012"
Module_ApplicationDate SETS "24-May-12"
Module_Date SETS "03 Jun 2012"
Module_ApplicationDate SETS "03-Jun-12"
Module_ComponentName SETS "BCM2835"
Module_ComponentPath SETS "mixed/RiscOS/Sources/HAL/BCM2835"
Module_FullVersion SETS "0.06"
Module_HelpVersion SETS "0.06 (24 May 2012)"
Module_FullVersion SETS "0.07"
Module_HelpVersion SETS "0.07 (03 Jun 2012)"
END
/* (0.06)
/* (0.07)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 0.06
#define Module_MajorVersion_CMHG 0.07
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 24 May 2012
#define Module_Date_CMHG 03 Jun 2012
#define Module_MajorVersion "0.06"
#define Module_Version 6
#define Module_MajorVersion "0.07"
#define Module_Version 7
#define Module_MinorVersion ""
#define Module_Date "24 May 2012"
#define Module_Date "03 Jun 2012"
#define Module_ApplicationDate "24-May-12"
#define Module_ApplicationDate "03-Jun-12"
#define Module_ComponentName "BCM2835"
#define Module_ComponentPath "mixed/RiscOS/Sources/HAL/BCM2835"
#define Module_FullVersion "0.06"
#define Module_HelpVersion "0.06 (24 May 2012)"
#define Module_LibraryVersionInfo "0:6"
#define Module_FullVersion "0.07"
#define Module_HelpVersion "0.07 (03 Jun 2012)"
#define Module_LibraryVersionInfo "0:7"
......@@ -204,7 +204,9 @@ NumTimers SETA NumTimers + 1
;
; Mailbox 0
; Mailbox
;
; There are two mailboxes; we write to mailbox 1 and read from mailbox 0
;
MB_Base * &0000b800 ; offset from IO space start
MB_ChRd * &80 ; normal read - offset from MB_Base
......
;
; Copyright (c) 2012, 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.
;
; usbinfo struct
^ 0
USBINFO_TYPE # 4 ; 0=OHCI, 1=EHCI, 2=MUSBMHDRC, 3=Synopsys DWC
USBINFO_FLAGS # 4 ; See below
USBINFO_HW # 4 ; Base addr
USBINFO_DEVNO # 4 ; IRQ number
USBINFO_DMAOFFSET # 4 ; Offset to convert ARM phys addrs to DMA addrs
USBINFO_SIZEOF # 0 ; Size of struct
USBINFO_FLAG_HAL_USBPortPower * 1 ; Use HAL_USBPortPower
USBINFO_FLAG_HAL_USBPortStatus * 2 ; Use HAL_USBPortStatus
USBINFO_FLAG_HAL_USBPortIRQ * 4 ; Use HAL_USBPortIRQ
USBINFO_FLAG_32bit_Regs * 8 ; Must use 32bit access for all registers
END
......@@ -296,10 +296,21 @@ start MSR CPSR_c,#F32_bit+I32_bit+SVC32_mode
ALIGN
]
LDR R4,mbox_addr
[ UseALBlob
MOV R5,#&80 + MB_Chan_Pwr ; (looks like turn on USB)
STR R5,[R4,#MB_ChWr]
; Enable USB power
; Note - may need changing to enable other devices in future
; Looks like we need to write the logical OR of all the devices we want enabled
LDR r3,=(16:SHL:MB_Pwr_USB)+MB_Chan_Pwr
STR r3,[r4,#MB_ChWr]
09
LDR r1,[r4,#MB_Sta]
TST r1,#MB_Sta_Empty
BNE %BT09
LDR r0,[r4,#MB_ChRd]
CMP r0,r3
BNE %BT09
[ UseALBlob
; For now, just assume that we have 40MB of memory...
; set frame buffer at the top...1920x1080x32bpp requires 8MB
LDR R1,=FB_Length
......
......@@ -34,18 +34,43 @@
GET hdr.BCM2835
GET hdr.StaticWS
GET hdr.USB
EXPORT HAL_USBControllerInfo
EXPORT HAL_USBPortPower
EXPORT HAL_USBPortStatus
EXPORT HAL_USBPortIRQ
; a1 = interface #
; a2 = usbinfo ptr
; a3 = sizeof(usbinfo)
; Return sizeof(usbinfo) or 0 for fail
HAL_USBControllerInfo
MOV a1,#0
CMP a3, #USBINFO_SIZEOF
MOVNE a1, #0
MOVNE pc, lr
CMP a1, #0
MOVHI a1, #0
MOVHI pc, lr
; Fill in the usbinfo struct
MOV a1, #3 ; DWC
STR a1, [a2, #USBINFO_TYPE]
MOV a1, #0 ; flags
STR a1, [a2, #USBINFO_FLAGS]
LDR a1, PeriBase
ADD a1, a1, #USB_Base
STR a1, [a2, #USBINFO_HW]
MOV a1, #iDev_GPU_VCUSB
STR a1, [a2, #USBINFO_DEVNO]
LDR a1, FB_CacheMode
STR a1, [a2, #USBINFO_DMAOFFSET]
MOV a1, #USBINFO_SIZEOF
MOV pc, lr
HAL_USBPortPower
HAL_USBPortStatus
HAL_USBPortIRQ
MOV a1,#-1
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