Commit bbe41f94 authored by Ben Avison's avatar Ben Avison Committed by ROOL

GPIO support

Detail:
* Board recognition for Pi 4
* Updated the pin enumeration table to specify new functions available in Pi 4
  (I2C[3456], SPI[3456], UART[2345])
parent 8aac3b72
......@@ -215,6 +215,7 @@ GPIORevision_RaspberryPi_Mk3_B # 1 ; Model Pi 3 B
GPIORevision_RaspberryPi_Mk3_BPlus # 1 ; Model Pi 3 B+
GPIORevision_RaspberryPi_Mk3_APlus # 1 ; Model Pi 3 A+
GPIORevision_RaspberryPi_C_3Plus # 1 ; Model CM3+
GPIORevision_RaspberryPi_Mk4_B # 1 ; Model Pi 4 B
GPIORevision_RaspberryPi_Max # 0
Name_B_1 = "Raspberry Pi B PCB 1.0", 0
......@@ -231,6 +232,7 @@ Name_Mk3_B = "Raspberry Pi 3 Model B", 0
Name_Mk3_BPlus = "Raspberry Pi 3 Model B+", 0
Name_Mk3_APlus = "Raspberry Pi 3 Model A+", 0
Name_C_3Plus = "Raspberry Pi Compute Module 3+", 0
Name_B_4 = "Raspberry Pi 4 Model B", 0
Name_Unknown = "Raspberry Pi Unknown", 0
ALIGN
......@@ -249,6 +251,7 @@ GPIO_Board_Names_Table ; same order as GPIORevision_RaspberryPi types
DCD Name_Mk3_BPlus
DCD Name_Mk3_APlus
DCD Name_C_3Plus
DCD Name_B_4
ASSERT (.-GPIO_Board_Names_Table) :SHR: 2 = GPIORevision_RaspberryPi_Max
; Lookup table to determine board type (old style)
......@@ -312,6 +315,12 @@ GPIO_Board_Conversion_Table
DCD GPIORevision_RaspberryPi_Mk3_APlus
DCD BoardRevision_Mem_1G+BoardRevision_Model_Compute3Plus+(0:SHL:BoardRevision_Rev_Shift)
DCD GPIORevision_RaspberryPi_C_3Plus
DCD BoardRevision_Mem_1G+BoardRevision_Model_B4+(1:SHL:BoardRevision_Rev_Shift)
DCD GPIORevision_RaspberryPi_Mk4_B
DCD BoardRevision_Mem_2G+BoardRevision_Model_B4+(1:SHL:BoardRevision_Rev_Shift)
DCD GPIORevision_RaspberryPi_Mk4_B
DCD BoardRevision_Mem_4G+BoardRevision_Model_B4+(1:SHL:BoardRevision_Rev_Shift)
DCD GPIORevision_RaspberryPi_Mk4_B
DCD &FF
; Initialise our HAL devices
......@@ -898,6 +907,8 @@ GPIOFreeToUse
DCD 2_00000000000000000000000000000000
DCD 2_11111111111111111111111111111111 ; Compute CM3+
DCD 2_00000000000000000011111111111111
DCD 2_00001111111111111111111111111111 ; 4B
DCD 2_00000000000000000000000000000000
ASSERT (.-GPIOFreeToUse) :SHR: 3 = GPIORevision_RaspberryPi_Max
; Pin enumerations
......@@ -905,67 +916,109 @@ GPIO_Port0_Table
PinStart 0, IO
PinBelongsTo GPIOType_GPIO, 0, AltGPI ; GPIO
PinBelongsTo GPIOType_I2C, 0, Alt0 ; I2C0 SDA
PinBelongsTo GPIOType_SPI, 3, Alt3 ; SPI3 CE0
PinBelongsTo GPIOType_UART, 2, Alt4 ; UART2 TXD
PinBelongsTo GPIOType_I2C, 6, Alt5 ; I2C6 SDA
PinEnd
PinStart 1, IO
PinBelongsTo GPIOType_GPIO, 1, AltGPI ; GPIO
PinBelongsTo GPIOType_I2C, 0, Alt0 ; I2C0 SCL
PinBelongsTo GPIOType_SPI, 3, Alt3 ; SPI3 MISO
PinBelongsTo GPIOType_UART, 2, Alt4 ; UART2 RXD
PinBelongsTo GPIOType_I2C, 6, Alt5 ; I2C6 SCL
PinEnd
PinStart 2, IO
PinBelongsTo GPIOType_GPIO, 2, AltGPI ; GPIO
PinBelongsTo GPIOType_I2C, 1, Alt0 ; I2C1 SDA
PinBelongsTo GPIOType_SPI, 3, Alt3 ; SPI3 MOSI
PinBelongsTo GPIOType_UART, 2, Alt4 ; UART2 CTS
PinBelongsTo GPIOType_I2C, 3, Alt5 ; I2C3 SDA
PinEnd
PinStart 3, IO
PinBelongsTo GPIOType_GPIO, 3, AltGPI ; GPIO
PinBelongsTo GPIOType_I2C, 1, Alt0 ; I2C1 SCL
PinBelongsTo GPIOType_SPI, 3, Alt3 ; SPI3 SCLK
PinBelongsTo GPIOType_UART, 2, Alt4 ; UART2 RTS
PinBelongsTo GPIOType_I2C, 3, Alt5 ; I2C3 SCL
PinEnd
PinStart 4, IO
PinBelongsTo GPIOType_GPIO, 4, AltGPI ; GPIO
PinBelongsTo GPIOType_GPCLK, 0, Alt0 ; GPCLK0
PinBelongsTo GPIOType_SPI, 4, Alt3 ; SPI4 CE0
PinBelongsTo GPIOType_UART, 3, Alt4 ; UART3 TXD
PinBelongsTo GPIOType_I2C, 3, Alt5 ; I2C3 SDA
PinEnd
PinStart 5, IO
PinBelongsTo GPIOType_GPIO, 5, AltGPI ; GPIO
PinBelongsTo GPIOType_GPCLK, 1, Alt0 ; GPCLK1
PinBelongsTo GPIOType_SPI, 4, Alt3 ; SPI4 MISO
PinBelongsTo GPIOType_UART, 3, Alt4 ; UART3 RXD
PinBelongsTo GPIOType_I2C, 3, Alt5 ; I2C3 SCL
PinEnd
PinStart 6, IO
PinBelongsTo GPIOType_GPIO, 6, AltGPI ; GPIO
PinBelongsTo GPIOType_GPCLK, 2, Alt0 ; GPCLK2
PinBelongsTo GPIOType_SPI, 4, Alt3 ; SPI4 MOSI
PinBelongsTo GPIOType_UART, 3, Alt4 ; UART3 CTS
PinBelongsTo GPIOType_I2C, 4, Alt5 ; I2C4 SDA
PinEnd
PinStart 7, IO
PinBelongsTo GPIOType_GPIO, 7, AltGPI ; GPIO
PinBelongsTo GPIOType_SPI, 0, Alt0 ; SPI0 CE1
PinBelongsTo GPIOType_SPI, 4, Alt3 ; SPI4 SCLK
PinBelongsTo GPIOType_UART, 3, Alt4 ; UART3 RTS
PinBelongsTo GPIOType_I2C, 4, Alt5 ; I2C4 SCL
PinEnd
PinStart 8, IO
PinBelongsTo GPIOType_GPIO, 8, AltGPI ; GPIO
PinBelongsTo GPIOType_SPI, 0, Alt0 ; SPI0 CE0
PinBelongsTo GPIOType_UART, 4, Alt4 ; UART4 TXD
PinBelongsTo GPIOType_I2C, 4, Alt5 ; I2C4 SDA
PinEnd
PinStart 9, IO
PinBelongsTo GPIOType_GPIO, 9, AltGPI ; GPIO
PinBelongsTo GPIOType_SPI, 0, Alt0 ; SPI0 MISO
PinBelongsTo GPIOType_UART, 4, Alt4 ; UART4 RXD
PinBelongsTo GPIOType_I2C, 4, Alt5 ; I2C4 SCL
PinEnd
PinStart 10, IO
PinBelongsTo GPIOType_GPIO, 10, AltGPI ; GPIO
PinBelongsTo GPIOType_SPI, 0, Alt0 ; SPI0 MOSI
PinBelongsTo GPIOType_UART, 4, Alt4 ; UART4 CTS
PinBelongsTo GPIOType_I2C, 5, Alt5 ; I2C5 SDA
PinEnd
PinStart 11, IO
PinBelongsTo GPIOType_GPIO, 11, AltGPI ; GPIO
PinBelongsTo GPIOType_SPI, 0, Alt0 ; SPI0 SCLK
PinBelongsTo GPIOType_UART, 4, Alt4 ; UART4 RTS
PinBelongsTo GPIOType_I2C, 5, Alt5 ; I2C5 SCL
PinEnd
PinStart 12, IO
PinBelongsTo GPIOType_GPIO, 12, AltGPI ; GPIO
PinBelongsTo GPIOType_PWM, 0, Alt0 ; PWM0
PinBelongsTo GPIOType_SPI, 5, Alt3 ; SPI5 CE0
PinBelongsTo GPIOType_UART, 5, Alt4 ; UART5 TXD
PinBelongsTo GPIOType_I2C, 5, Alt5 ; I2C5 SDA
PinEnd
PinStart 13, IO
PinBelongsTo GPIOType_GPIO, 13, AltGPI ; GPIO
PinBelongsTo GPIOType_PWM, 1, Alt0 ; PWM1
PinBelongsTo GPIOType_SPI, 5, Alt3 ; SPI5 MISO
PinBelongsTo GPIOType_UART, 5, Alt4 ; UART5 RXD
PinBelongsTo GPIOType_I2C, 5, Alt5 ; I2C5 SCL
PinEnd
PinStart 14, IO
PinBelongsTo GPIOType_GPIO, 14, AltGPI ; GPIO
PinBelongsTo GPIOType_UART, 0, Alt0 ; UART0 TXD
PinBelongsTo GPIOType_SPI, 5, Alt3 ; SPI5 MOSI
PinBelongsTo GPIOType_UART, 5, Alt4 ; UART5 CTS
PinBelongsTo GPIOType_UART, 1, Alt5 ; UART1 TXD
PinEnd
PinStart 15, IO
PinBelongsTo GPIOType_GPIO, 15, AltGPI ; GPIO
PinBelongsTo GPIOType_UART, 0, Alt0 ; UART0 RXD
PinBelongsTo GPIOType_SPI, 5, Alt3 ; SPI5 SCLK
PinBelongsTo GPIOType_UART, 5, Alt4 ; UART5 RTS
PinBelongsTo GPIOType_UART, 1, Alt5 ; UART1 RXD
PinEnd
PinStart 16, IO
......@@ -983,48 +1036,58 @@ GPIO_Port0_Table
PinStart 18, IO
PinBelongsTo GPIOType_GPIO, 18, AltGPI ; GPIO
PinBelongsTo GPIOType_PCM, 0, Alt0 ; PCM0 CLK
PinBelongsTo GPIOType_BSC, 0, Alt3 ; BSC0 SDA/MOSI
PinBelongsTo GPIOType_BSC, 0, Alt3 ; BSC0 SDA/MOSI BCM2835-7
PinBelongsTo GPIOType_SPI, 6, Alt3 ; SPI6 CE0 BCM2838
PinBelongsTo GPIOType_SPI, 1, Alt4 ; SPI1 CE0
PinBelongsTo GPIOType_PWM, 0, Alt5 ; PWM0
PinEnd
PinStart 19, IO
PinBelongsTo GPIOType_GPIO, 19, AltGPI ; GPIO
PinBelongsTo GPIOType_PCM, 0, Alt0 ; PCM0 FS
PinBelongsTo GPIOType_BSC, 0, Alt3 ; BSC0 SCL/SCLK
PinBelongsTo GPIOType_BSC, 0, Alt3 ; BSC0 SCL/SCLK BM2835-7
PinBelongsTo GPIOType_SPI, 5, Alt3 ; SPI5 MISO BCM2838
PinBelongsTo GPIOType_SPI, 1, Alt4 ; SPI1 MISO
PinBelongsTo GPIOType_PWM, 1, Alt5 ; PWM1
PinEnd
PinStart 20, IO
PinBelongsTo GPIOType_GPIO, 20, AltGPI ; GPIO
PinBelongsTo GPIOType_PCM, 0, Alt0 ; PCM0 DIN
PinBelongsTo GPIOType_BSC, 0, Alt3 ; BSC0 MISO
PinBelongsTo GPIOType_BSC, 0, Alt3 ; BSC0 MISO BCM2835-7
PinBelongsTo GPIOType_SPI, 5, Alt3 ; SPI5 MOSI BCM2838
PinBelongsTo GPIOType_SPI, 1, Alt4 ; SPI1 MOSI
PinBelongsTo GPIOType_GPCLK, 0, Alt5 ; GPCLK0
PinEnd
PinStart 21, IO
PinBelongsTo GPIOType_GPIO, 21, AltGPI ; GPIO
PinBelongsTo GPIOType_PCM, 0, Alt0 ; PCM0 DOUT
PinBelongsTo GPIOType_BSC, 0, Alt3 ; BSC0 CE
PinBelongsTo GPIOType_BSC, 0, Alt3 ; BSC0 CE BCM2835-7
PinBelongsTo GPIOType_SPI, 5, Alt3 ; SPI5 SCLK BCM2838
PinBelongsTo GPIOType_SPI, 1, Alt4 ; SPI1 SCLK
PinBelongsTo GPIOType_GPCLK, 0, Alt5 ; GPCLK1
PinEnd
PinStart 22, IO
PinBelongsTo GPIOType_GPIO, 22, AltGPI ; GPIO
PinBelongsTo GPIOType_I2C, 6, Alt5 ; I2C6 SDA
PinEnd
PinStart 23, IO
PinBelongsTo GPIOType_GPIO, 23, AltGPI ; GPIO
PinBelongsTo GPIOType_I2C, 6, Alt5 ; I2C6 SCL
PinEnd
PinStart 24, IO
PinBelongsTo GPIOType_GPIO, 24, AltGPI ; GPIO
PinBelongsTo GPIOType_SPI, 3, Alt5 ; SPI3 CE1
PinEnd
PinStart 25, IO
PinBelongsTo GPIOType_GPIO, 25, AltGPI ; GPIO
PinBelongsTo GPIOType_SPI, 4, Alt5 ; SPI4 CE1
PinEnd
PinStart 26, IO
PinBelongsTo GPIOType_GPIO, 26, AltGPI ; GPIO
PinBelongsTo GPIOType_SPI, 5, Alt5 ; SPI5 CE1
PinEnd
PinStart 27, IO
PinBelongsTo GPIOType_GPIO, 27, AltGPI ; GPIO
PinBelongsTo GPIOType_SPI, 6, Alt5 ; SPI6 CE1
PinEnd
PinStart 28, IO
PinBelongsTo GPIOType_GPIO, 28, AltGPI ; GPIO
......
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