; Copyright 2011 Castle Technology Ltd
;
; Licensed under the Apache License, Version 2.0 (the "License");
; you may not use this file except in compliance with the License.
; You may obtain a copy of the License at
;
;     http://www.apache.org/licenses/LICENSE-2.0
;
; Unless required by applicable law or agreed to in writing, software
; distributed under the License is distributed on an "AS IS" BASIS,
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; See the License for the specific language governing permissions and
; limitations under the License.
;

; Public interface of GPIO HAL devices

        GET     hdr:HALDevice

OldOpt  SETA    {OPT}
        OPT     OptNoList+OptNoP1List

 [ :LNOT: :DEF: Included_Hdr_GPIODevice
                       GBLL Included_Hdr_GPIODevice
Included_Hdr_GPIODevice SETL {TRUE}

; Device for GPIO devices
; This device just reports the board type and revision, so that the GPIO manager
; knows how everything is set up and which bits should be off-limits.

                                 ^       0
                                 #       HALDeviceSize
HALDevice_GPIOType               #       4
HALDevice_GPIORevision           #       4
HALDevice_GPIO_Size              *       :INDEX: @

; Type & revision values specific to HALDeviceID_GPIO_OMAP3:

                                 ^       0
GPIOType_OMAP3_BeagleBoard       #       1 ; It's a BeagleBoard or BB-xM
GPIOType_OMAP3_DevKit8000        #       1 ; It's a DevKit 8000
GPIOType_OMAP3_IGEPv2            #       1 ; It's an IGEP v2
GPIOType_OMAP3_Pandora           #       1 ; It's a Pandora

; BeagleBoard revision values:

                                 ^       0
                                           ; BeagleBoard:
GPIORevision_BeagleBoard_AB      #       1 ; Rev A or B
GPIORevision_BeagleBoard_C123    #       1 ; Rev C1, C2 or C3
GPIORevision_BeagleBoard_C4      #       1 ; Rev C4
                                           ; BeagleBoard-xM:
GPIORevision_BeagleBoard_xMA     #       1 ; Rev A
GPIORevision_BeagleBoard_xMB     #       1 ; Rev B
GPIORevision_BeagleBoard_xMC     #       1 ; Rev C

; DevKit revision values:

                                 ^       0
GPIORevision_DevKit8000_Unknown  #       1

; IGEP revision values:

                                 ^       0
GPIORevision_IGEPv2_BC           #       1 ; Rev B or C (B-compatible)
GPIORevision_IGEPv2_C            #       1 ; Rev C (not a B-compatible one)

; Type & revision values specific to HALDeviceID_GPIO_BCM2835:

                                 ^       0
GPIOType_BCM2835_RaspberryPi     #       1 ; It's a Raspberry Pi

; Raspberry Pi revision values:

                                 ^       0
GPIORevision_RaspberryPi_B_1     #       1 ; Model B Rev 1.0
GPIORevision_RaspberryPi_B_2     #       1 ; Model B Rev 2.0
GPIORevision_RaspberryPi_A_2     #       1 ; Model A Rev 2.0
GPIORevision_RaspberryPi_BPlus   #       1 ; Model B+

; Type & revision values specific to HALDeviceID_GPIO_OMAP4:

                                 ^       0
GPIOType_OMAP4_Panda             #       1 ; It's a PandaBoard or PandaBoard-ES

; Panda revision values:

                                 ^       0
GPIORevision_Panda               #       1 ; PandaBoard
GPIORevision_PandaES             #       1 ; PandaBoard-ES

 ]

        OPT     OldOpt
        END