Unit BCM2711

From Ultibo.org
Revision as of 05:12, 23 November 2022 by Ultibo (Talk | contribs)

Jump to: navigation, search

Return to Unit Reference


Description


Ultibo BCM2711 Interface unit

This unit provides the BCM2711 specific implementations of the following devices:

  • SPI0
  • SPI1
  • SPI2
  • SPI3
  • SPI4
  • SPI5
  • SPI6
  • I2C0
  • I2C1
  • I2C2
  • I2C3
  • I2C4
  • I2C5
  • I2C6
  • I2C7
  • I2C Slave
  • SPI Slave
  • DMA
  • PWM0
  • PWM1
  • PCM
  • GPIO
  • UART0
  • UART1
  • UART2
  • UART3
  • UART4
  • UART5
  • EMMC0
  • EMMC1
  • EMMC2
  • Clock (System Timer)
  • Clock (ARM Timer)
  • Clock (Local Timer)
  • ARM Timer
  • Local Timer
  • Random
  • Mailbox
  • Watchdog
  • Framebuffer

BCM2711 SPI0/3/4/5/6 Device

The BCM2711 has 5 master mode SPI controllers that support 3 wire, 2 wire and LoSSI modes of operation. It also has 2 auxiliary SPI masters which do not support DMA mode (see SPI1/2 below).

The main SPI0/3/4/5/6 controllers support polled, interrupt and DMA modes and include 3 chip selects although only CS0 and CS1 are available on the 40 pin header.

The GPIO pins and functions for each device are shown below, not all of these combinations are accessible via the 40 pin header.

         Device     Line      Pin          Function             Notes
          SPI0      CS1       GPIO_PIN_7   GPIO_FUNCTION_ALT0  
                    CS0       GPIO_PIN_8   GPIO_FUNCTION_ALT0  
                    MISO      GPIO_PIN_9   GPIO_FUNCTION_ALT0
                    MOSI      GPIO_PIN_10  GPIO_FUNCTION_ALT0
                    SCLK      GPIO_PIN_11  GPIO_FUNCTION_ALT0
                                  
                    CS1       GPIO_PIN_35  GPIO_FUNCTION_ALT0   CM4 only
                    CS0       GPIO_PIN_36  GPIO_FUNCTION_ALT0
                    MISO      GPIO_PIN_37  GPIO_FUNCTION_ALT0
                    MOSI      GPIO_PIN_38  GPIO_FUNCTION_ALT0
                    SCLK      GPIO_PIN_39  GPIO_FUNCTION_ALT0
                                  
          SPI3      CS1       GPIO_PIN_24  GPIO_FUNCTION_ALT5
                    CS0       GPIO_PIN_0   GPIO_FUNCTION_ALT3
                    MISO      GPIO_PIN_1   GPIO_FUNCTION_ALT3
                    MOSI      GPIO_PIN_2   GPIO_FUNCTION_ALT3
                    SCLK      GPIO_PIN_3   GPIO_FUNCTION_ALT3
                                  
          SPI4      CS1       GPIO_PIN_25  GPIO_FUNCTION_ALT5
                    CS0       GPIO_PIN_4   GPIO_FUNCTION_ALT3
                    MISO      GPIO_PIN_5   GPIO_FUNCTION_ALT3
                    MOSI      GPIO_PIN_6   GPIO_FUNCTION_ALT3
                    SCLK      GPIO_PIN_7   GPIO_FUNCTION_ALT3
                                  
          SPI5      CS1       GPIO_PIN_26  GPIO_FUNCTION_ALT5
                    CS0       GPIO_PIN_12  GPIO_FUNCTION_ALT3
                    MISO      GPIO_PIN_13  GPIO_FUNCTION_ALT3
                    MOSI      GPIO_PIN_14  GPIO_FUNCTION_ALT3
                    SCLK      GPIO_PIN_15  GPIO_FUNCTION_ALT3
                                  
          SPI6      CS1       GPIO_PIN_27  GPIO_FUNCTION_ALT5
                    CS0       GPIO_PIN_18  GPIO_FUNCTION_ALT3
                    MISO      GPIO_PIN_19  GPIO_FUNCTION_ALT3
                    MOSI      GPIO_PIN_20  GPIO_FUNCTION_ALT3
                    SCLK      GPIO_PIN_21  GPIO_FUNCTION_ALT3

BCM2711 I2C0/1/2/3/4/5/6/7 Device

The BCM2711 has 8 Broadcom Serial Controller (BSC) devices which are fast mode (400Kz) I2C masters numbered BSC0 to BSC7 (I2C0 to I2C7).

Devices BSC2 and BSC7 are dedicated to the HDMI interfaces but can be accessed by the ARM processor for controlling some HDMI functionality. All BSC devices contain a 16 byte FIFO, support 7 bit and 10 bit addressing and have software configurable clock timing.

The GPIO pins and functions for each device are shown below, not all of these combinations are accessible via the 40 pin header.

          Device     Line      Pin          Function             Notes
          I2C0       SDA0      GPIO_PIN_0   GPIO_FUNCTION_ALT0
                     SCL0      GPIO_PIN_1   GPIO_FUNCTION_ALT0
                     
                     SDA0      GPIO_PIN_28  GPIO_FUNCTION_ALT0
                     SCL0      GPIO_PIN_29  GPIO_FUNCTION_ALT0
                     
                     SDA0      GPIO_PIN_44  GPIO_FUNCTION_ALT1
                     SCL0      GPIO_PIN_45  GPIO_FUNCTION_ALT1
                     
          I2C1       SDA1      GPIO_PIN_2   GPIO_FUNCTION_ALT0
                     SCL1      GPIO_PIN_3   GPIO_FUNCTION_ALT0
                    
                     SDA1      GPIO_PIN_44  GPIO_FUNCTION_ALT2
                     SCL1      GPIO_PIN_45  GPIO_FUNCTION_ALT2
           
          I2C2       SDA2                                       Not Applicable
                     SCL2                                       Not Applicable
           
          I2C3       SDA3      GPIO_PIN_2   GPIO_FUNCTION_ALT5
                     SCL3      GPIO_PIN_3   GPIO_FUNCTION_ALT5
                                  
                     SDA3      GPIO_PIN_4   GPIO_FUNCTION_ALT5
                     SCL3      GPIO_PIN_5   GPIO_FUNCTION_ALT5
                                  
          I2C4       SDA4      GPIO_PIN_6   GPIO_FUNCTION_ALT5
                     SCL4      GPIO_PIN_7   GPIO_FUNCTION_ALT5
                                  
                     SDA4      GPIO_PIN_8   GPIO_FUNCTION_ALT5
                     SCL4      GPIO_PIN_9   GPIO_FUNCTION_ALT5
                     
          I2C5       SDA5      GPIO_PIN_10  GPIO_FUNCTION_ALT5
                     SCL5      GPIO_PIN_11  GPIO_FUNCTION_ALT5
                     
                     SDA5      GPIO_PIN_12  GPIO_FUNCTION_ALT5
                     SCL5      GPIO_PIN_13  GPIO_FUNCTION_ALT5
                     
          I2C6       SDA6      GPIO_PIN_0   GPIO_FUNCTION_ALT5
                     SCL6      GPIO_PIN_1   GPIO_FUNCTION_ALT5
                     
                     SDA6      GPIO_PIN_22  GPIO_FUNCTION_ALT5
                     SCL6      GPIO_PIN_23  GPIO_FUNCTION_ALT5
           
          I2C7       SDA7                                       Not Applicable
                     SCL7                                       Not Applicable

Note: On the Raspberry Pi 4B the ID EEPROM pins on the 40 pin header are actually connected to GPIO 0 and 1 (I2C0).

BCM2711 SPI1/2 Device

The SPI1/2 devices are part of the AUX device which also includes the UART1 device.

They are master SPI devices which are considered secondary low throughput interfaces as they have small FIFOs and no DMA support.

The GPIO pins and functions for each device are shown below, not all of these combinations are accessible via the 40 pin header.

          Device     Line      Pin          Function             Notes
          SPI1       CS2       GPIO_PIN_16  GPIO_FUNCTION_ALT4  
                     CS1       GPIO_PIN_17  GPIO_FUNCTION_ALT4  
                     CS0       GPIO_PIN_18  GPIO_FUNCTION_ALT4  
                     MISO      GPIO_PIN_19  GPIO_FUNCTION_ALT4
                     MOSI      GPIO_PIN_20  GPIO_FUNCTION_ALT4
                     SCLK      GPIO_PIN_21  GPIO_FUNCTION_ALT4

          SPI2       CS2       GPIO_PIN_45  GPIO_FUNCTION_ALT4   CM4 only
                     CS1       GPIO_PIN_44  GPIO_FUNCTION_ALT4
                     CS0       GPIO_PIN_43  GPIO_FUNCTION_ALT4
                     MISO      GPIO_PIN_40  GPIO_FUNCTION_ALT4
                     MOSI      GPIO_PIN_41  GPIO_FUNCTION_ALT4
                     SCLK      GPIO_PIN_42  GPIO_FUNCTION_ALT4

Note: The GPIO function assignments section of the BCM2711 ARM Peripherals document incorrectly lists SPI2 as SPI0.

BCM2711 SPI/I2C Slave Device

The slave device can be used as either an I2C or an SPI interface, the I2C slave supports 400KHz fast mode operation. Only 7 bit addressing is supported, DMA is not supported and neither is clock stretching.

Unlike earlier models where the SPI slave device was apparently faulty on the Raspberry Pi 4 it is reported to work.

The GPIO pins and functions for each device are shown below, not all of these combinations are accessible via the 40 pin header.

          Device     Line      Pin          Function             Notes
          SPI Slave  CS        GPIO_PIN_8   GPIO_FUNCTION_ALT3
                     MISO      GPIO_PIN_9   GPIO_FUNCTION_ALT3
                     MOSI      GPIO_PIN_10  GPIO_FUNCTION_ALT3
                     SCLK      GPIO_PIN_11  GPIO_FUNCTION_ALT3
          I2C Slave  SDA       GPIO_PIN_10  GPIO_FUNCTION_ALT3
                     SCL       GPIO_PIN_11  GPIO_FUNCTION_ALT3

Note: The BCM2711 ARM Peripherals document does not include documentation for the I2C/SPI slave.

BCM2711 DMA Device

The DMA controller has 16 channels in total although not all are available for software to use as some are already used by the GPU.

The firmware will pass the value dma.dmachans on the command line which will indicate which channels are available for our use.

Channels 0 to 6 are normal channels which support 2D stride and transfers up to 1GB per control block.

Channels 7 to 10 are Lite channels which do not support stride and only allow transfers up to 64KB per control block.

Channels 11 to 14 are 40 bit channels which allow access to memory and peripherals beyond the 1GB boundary and have higher performance because they directly access the full 35 bit address map and can perform write bursts (DMA channel 11 is used to access the PCIe interface).

Channel 15 is not mentioned in most documentation and is shown as not available in the mask passed in dma.dmachans

Channel 0 and 15 are Bulk channels which have an additional FIFO for faster transfers (8 beat burst per read).

BCM2711 PWM0/1 Device

The BCM2711 has two PWM controllers with 2 independent output bit streams with multiple algorithms for generating the output pulse. The PWM controllers support either a single data register (independent per channel) or a 16 x 32 FIFO which also supports DMA mode transmission.

On the Raspberry Pi 4B PWM1_0 and PWM1_1 are also connected via GPIO pins 40 and 41 to the audio circuit and allow playback of digital audio signals via the 4 pole line jack.

The GPIO pins and functions for each device are shown below, not all of these combinations are accessible via the 40 pin header.

          Device     Line      Pin          Function             Notes
          PWM0       PWM0_0    GPIO_PIN_12  GPIO_FUNCTION_ALT0 
                     PWM0_1    GPIO_PIN_13  GPIO_FUNCTION_ALT0 
                     PWM0_0    GPIO_PIN_18  GPIO_FUNCTION_ALT5 
                     PWM0_1    GPIO_PIN_19  GPIO_FUNCTION_ALT5 
           
                     PWM0_1    GPIO_PIN_45  GPIO_FUNCTION_ALT0

          PWM1       PWM1_0    GPIO_PIN_40  GPIO_FUNCTION_ALT0 
                     PWM1_1    GPIO_PIN_41  GPIO_FUNCTION_ALT0 

On the Raspberry Pi 4B pins 12, 18 and 19 are exposed on the 40 pin header.

BCM2711 GPIO Device

The GPIO has 54 pins available each with multiple alternate functions. All pins can be configured as input or output and all can have pull up or down applied.

Not all pins are exposed on the 40 pin header of the Raspberry Pi, for details of which pins are available see:

Raspberry Pi 4B - https://www.raspberrypi.org/documentation/usage/gpio/README.md

Some of the 54 pins are used for peripheral communication (such as the SD card) and are not available for general use, take care when changing function selects on pins to avoid disabling certain system peripherals.

Event detection can be enabled for both high and low levels as well as rising and falling edges, there is also an asynchronous rising or falling edge detection which can detect edges of very short duration.

BCM2711 UART0/2/3/4/5 Device

The UART0/2/3/4/5 device is an ARM PL011 UART which supports programmable baud rates, start, stop and parity bits and hardware flow control and many others. The UART0 is similar to the industry standard 16C650 but with a number of differences, the PL011 has some optional features such as IrDA, Serial InfraRed and DMA which are not supported by the Broadcom implementation.

In the standard configuration the UART0 TX and RX lines are connected to GPIO pins 14 and 15 respectively (Alternate function 0) but they can be remapped via GPIO function selects to a number of other locations. On the Raspberry Pi 4B none of these alternate pin mappings are exposed via the 40 pin header and therefore cannot be used easily. This means that UART0 and UART1 cannot be used via the 40 pin header at the same time.

On the Raspberry Pi 4B the UART0 can be mapped to GPIO pins 32 and 33 (Alternate function 3) to communicate with the built in Bluetooth module.

The GPIO pins and functions for each device are shown below, not all of these combinations are accessible via the 40 pin header.

          Device     Line      Pin          Function             Notes
          UART0      TXD       GPIO_PIN_14  GPIO_FUNCTION_ALT0  
                     RXD       GPIO_PIN_15  GPIO_FUNCTION_ALT0  
                     CTS       GPIO_PIN_16  GPIO_FUNCTION_ALT3  
                     RTS       GPIO_PIN_17  GPIO_FUNCTION_ALT3  
                                 
                     TXD       GPIO_PIN_32  GPIO_FUNCTION_ALT3  
                     RXD       GPIO_PIN_33  GPIO_FUNCTION_ALT3  
                     CTS       GPIO_PIN_30  GPIO_FUNCTION_ALT3  
                     RTS       GPIO_PIN_31  GPIO_FUNCTION_ALT3  
                                  
                     TXD       GPIO_PIN_36  GPIO_FUNCTION_ALT2  
                     RXD       GPIO_PIN_37  GPIO_FUNCTION_ALT2  
                     CTS       GPIO_PIN_38  GPIO_FUNCTION_ALT2  
                     RTS       GPIO_PIN_39  GPIO_FUNCTION_ALT2  
                                  
          UART2      TXD       GPIO_PIN_0   GPIO_FUNCTION_ALT4  
                     RXD       GPIO_PIN_1   GPIO_FUNCTION_ALT4  
                     CTS       GPIO_PIN_2   GPIO_FUNCTION_ALT4  
                     RTS       GPIO_PIN_3   GPIO_FUNCTION_ALT4  
                                  
          UART3      TXD       GPIO_PIN_4   GPIO_FUNCTION_ALT4  
                     RXD       GPIO_PIN_5   GPIO_FUNCTION_ALT4  
                     CTS       GPIO_PIN_6   GPIO_FUNCTION_ALT4  
                     RTS       GPIO_PIN_7   GPIO_FUNCTION_ALT4  
                                  
          UART4      TXD       GPIO_PIN_8   GPIO_FUNCTION_ALT4  
                     RXD       GPIO_PIN_9   GPIO_FUNCTION_ALT4  
                     CTS       GPIO_PIN_10  GPIO_FUNCTION_ALT4  
                     RTS       GPIO_PIN_11  GPIO_FUNCTION_ALT4  
                                  
          UART5      TXD       GPIO_PIN_12  GPIO_FUNCTION_ALT4  
                     RXD       GPIO_PIN_13  GPIO_FUNCTION_ALT4  
                     CTS       GPIO_PIN_14  GPIO_FUNCTION_ALT4  
                     RTS       GPIO_PIN_15  GPIO_FUNCTION_ALT4  

BCM2711 UART1 Device

The UART1 device is a Broadcom implementation that is part of the AUX device which also includes the SPI1 and SPI2 devices.

This device is termed a Mini UART and has a smaller feature set than the PL011 UART but still supports a fairly standard communication protocol with programmable baud rate and hardware flow control.

The Mini UART is similar to the standard 16550 device but is missing some of the features, the device also has no DMA support so high speed transfers will produce a higher CPU load.

In the standard configuration the UART1 TX and RX lines are connected to GPIO pins 14 and 15 respectively (Alternate function 5) but they can be remapped via GPIO function selects to a number of other locations.

On the Raspberry Pi 4B none of these alternate pin mappings are exposed via the 40 pin header and therefore cannot be used easily. This means that UART0 and UART1 cannot be used via the 40 pin header at the same time.

On the Raspberry Pi 4B the UART1 can be mapped to GPIO pins 32 and 33 (Alternate function 5) to communicate with the built in Bluetooth module.

The GPIO pins and functions for the device are shown below, not all of these combinations are accessible via the 40 pin header.

          Device     Line      Pin          Function             Notes
          UART1      TXD       GPIO_PIN_14  GPIO_FUNCTION_ALT5  
                     RXD       GPIO_PIN_15  GPIO_FUNCTION_ALT5  
                     CTS       GPIO_PIN_16  GPIO_FUNCTION_ALT5  
                     RTS       GPIO_PIN_17  GPIO_FUNCTION_ALT5  
           
                     TXD       GPIO_PIN_32  GPIO_FUNCTION_ALT5  
                     RXD       GPIO_PIN_33  GPIO_FUNCTION_ALT5  
                     CTS       GPIO_PIN_30  GPIO_FUNCTION_ALT5  
                     RTS       GPIO_PIN_31  GPIO_FUNCTION_ALT5  

BCM2711 EMMC0 (SDHCI) Device

The SDHCI controller on the BCM2711 is an Arasan SD Host controller.

The Card Detect pin is not connected.

The Write Protect pin is not connected.

The device can be routed to GPIO pins 22 to 27 (ALT3) or 48 to 53 (ALT3), it can also be routed to GPIO pins 34 to 39 (ALT3) to provide an SDIO controller for the on board WiFi.

BCM2711 EMMC1 (SDHOST) Device

The SDHOST controller on the BCM2711 is a non SDHCI-compliant device which requires a specific driver.

It can be routed to GPIO pins 22 to 27 (ALT0) or 48 to 53 (ALT0) however only 22 to 27 are accessible to use.

Note: The actual driver is implemented in the BCMSDHOST unit

BCM2711 EMMC2 (SDHCI) Device

The EMMC2 controller on the BCM2711 is an SDHCI-compliant device which does not appear on the GPIO pins and is internally connected to the SD card slot.

The BCM2838_GPPINMUX register allows routing the SDHCI controller (EMMC0) to the SD card slot which then renders the EMMC2 unusable.

BCM2711 Clock (System Timer) Device

The clock device in the BCM2711 is based on the System Timer which is a 64 bit free running counter that runs at 1MHz regardless of core or CPU clock speeds. The System Timer cannot be stopped and the counter cannot be set or reset.

The System Timer includes 4 compare registers which can each generate an interrupt when the compare value is matched, however 2 of the 4 are consumed by the GPU and on the Raspberry Pi A/B/A+/B+/Zero the other 2 are used for the scheduler and clock interrupts in Ultibo.

This device simply exposes the free running counter as a clock value and does not provide access to the timer compare functionality or to interrupt based events, for those see the timer devices below.

BCM2711 Clock (ARM Timer) Device

This device represents that free running counter from the ARM Timer device (below) as a clock device. The free running counter does not appear in the original SP804 timer. The counter is 32 bits wide and has its own divider that is 8 bits wide meaning that it can be set to clock rates of between 975KHz and 250MHz (or 1.5MHz to 400MHz on the Raspberry Pi 3B).

The counter does not generate an interrupt and cannot be set or reset but it can be stopped and started.

BCM2711 ARM Timer Device

The ARM Timer device in the BCM2711 is based on the ARM SP804 timer with some modifications and additions. In the Raspberry Pi it is connected to the core clock which by default is 250MHz but was increased to 400MHz on the Raspberry Pi 3B.

The divider is 10 bits wide which means that the ARM Timer can be set to clock rates of between 250KHz and 250MHz (or 400KHz to 400MHz on the Raspberry Pi 3B). Both the counter and the load/reload value are 32 bits wide by default giving a wide range of tick intervals.

The ARM Timer features a free running counter which is not enabled or used by this driver and a down counter which operates in wrapping mode so that each time it reaches 0 it triggers an interrupt and reloads the value from a load or reload register to begin counting again.

Constants



BCM2711 SPI0/3/4/5/6 BCM2711_SPI0_*
BCM2711_SPI0_DESCRIPTION = 'BCM2838 Master SPI';  
 
BCM2711_SPI0_MAX_SIZE = $FFFF;  
 
BCM2711_SPI0_MIN_CLOCK = 7629; Default minimum based on the default settings from the firmware (Recalculated during open)
BCM2711_SPI0_MAX_CLOCK = 250000000; Default maximum based on the default settings from the firmware (Recalculated during open)
 
BCM2711_SPI0_MIN_DIVIDER = 2; Divider is always rounded down to an even number and a value of 0 sets the divider to 65536
BCM2711_SPI0_MAX_DIVIDER = $FFFE; Divider is always rounded down to an even number
 
BCM2711_SPI0_CORE_CLOCK = 500000000; Default core clock based on the default settings from the firmware (Requested from firmware during start)
 
BCM2711_SPI0_MODE_IRQ = 0;  
BCM2711_SPI0_MODE_DMA = 1;  
BCM2711_SPI0_MODE_PIO = 2;  


BCM2711 I2C0/1/2/3/4/5/6/7 BCM2711_I2C0_*
BCM2711_I2C0_DESCRIPTION = 'BCM2838 Master I2C';  
 
BCM2711_I2C0_MAX_SIZE = $FFFF;  
 
BCM2711_I2C0_MIN_CLOCK = 7629; Default minimum based on the default settings from the firmware (Recalculated during open)
BCM2711_I2C0_MAX_CLOCK = 250000000; Default maximum based on the default settings from the firmware (Recalculated during open)
BCM2711_I2C0_DEFAULT_CLOCK = 100000;  
 
BCM2711_I2C0_MIN_DIVIDER = 2; Divider is always rounded down to an even number and a value of 0 sets the divider to 32768
BCM2711_I2C0_MAX_DIVIDER = $FFFE; Divider is always rounded down to an even number
 
BCM2711_I2C0_CORE_CLOCK = 500000000; Default core clock based on the default settings from the firmware (Requested from firmware during start)
 
BCM2711_I2C0_MODE_WRITE = 0;  
BCM2711_I2C0_MODE_READ = 1;  


BCM2711 SPI1/2 (AUX) BCM2711_SPI*_*
BCM2711_SPI1_DESCRIPTION = 'BCM2838 AUX Master SPI1';  
BCM2711_SPI2_DESCRIPTION = 'BCM2838 AUX Master SPI2';  


BCM2711 SPI/I2C slave BCM2711_*SLAVE_*
BCM2711_I2CSLAVE_DESCRIPTION = 'BCM2838 I2C Slave';  
BCM2711_SPISLAVE_DESCRIPTION = 'BCM2838 SPI Slave';  


BCM2711 DMA BCM2711_DMA_*
BCM2711_DMA_DESCRIPTION = 'BCM2838 DMA';  
 
BCM2711_DMA_CHANNEL_COUNT = 16; Total number of DMA channels (Not all are usable)
 
BCM2711_DMA_40_CHANNELS = $7800; Mask of 40 bit channels (11 to 14)
BCM2711_DMA_LITE_CHANNELS = $0780; Mask of Lite channels (7 to 10)
BCM2711_DMA_NORMAL_CHANNELS = $007E; {807F} Mask of normal channels (1 to 6)
BCM2711_DMA_BULK_CHANNELS = $8001; Mask of Bulk channels (0 and 15)
 
BCM2711_DMA_SHARED_CHANNELS = $0780; Mask of channels with shared interrupt (7 to 10)
 
BCM2711_DMA_MAX_40_TRANSFER = 1073741824; Maximum transfer length for a 40 bit channel
BCM2711_DMA_MAX_LITE_TRANSFER = 65536; Maximum transfer length for a Lite channel
BCM2711_DMA_MAX_NORMAL_TRANSFER = 1073741824; Maximum transfer length for a normal channel
 
BCM2711_DMA_MAX_STRIDE = $FFFF; Maximum stride value (Increment between rows) Note this is a signed value (Min -32768 / Max 32767)
BCM2711_DMA_MAX_Y_COUNT = $3FFF; Maximum number of X length transfers in 2D stride
BCM2711_DMA_MAX_X_LENGTH = $FFFF; Maximum X transfer length in 2D stride
 
BCM2711_DMA_CB_ALIGNMENT = 32; Alignment required for DMA control blocks
 
BCM2711_DMA_40_BURST_LENGTH = 8; Burst length for 40 bit channels
BCM2711_DMA_LITE_BURST_LENGTH = 1; Burst length for DMA Lite channels
BCM2711_DMA_NORMAL_BURST_LENGTH = 2; Burst length for normal channels
BCM2711_DMA_BULK_BURST_LENGTH = 8; Burst length for DMA Bulk channels
 
BCM2711_DMA_REQUIRE_40_ADDRESS = SIZE_1G; DMA transfers to or from address above 1GB require a 40-bit channel
 
BCM2711_DMA_40_PERIPHERAL_OFFSET = 4; 40 bit DMA channels use the "Full 35-bit address map" and must access peripherals at 0x4:7C000000 - 0x4:7FFFFFFF
BCM2711_DMA_40_PERIPHERAL_IO_BASE = BCM2838_EXT_PERIPHERALS_BASE;  
BCM2711_DMA_40_PERIPHERAL_IO_ALIAS = $7C000000;  
BCM2711_DMA_40_PERIPHERAL_IO_MASK = $03FFFFFF;  


BCM2711 PWM0/1 BCM2711_PWM0_*
BCM2711_PWM0_DESCRIPTION = 'BCM2838 PWM';  
 
BCM2711_PWM0_MIN_PERIOD = 38; Default based on 54MHz PWM clock (Oscillator source)
BCM2711_PWM0_DEFAULT_CLOCK = 54000000; Default to the 54MHz oscillator clock


BCM2711 GPIO BCM2711_GPIO_*
BCM2711_GPIO_DESCRIPTION = 'BCM2838 GPIO';  
 
BCM2711_GPIO_MIN_PIN = GPIO_PIN_0;  
BCM2711_GPIO_MAX_PIN = GPIO_PIN_57;  
 
BCM2711_GPIO_MAX_LEVEL = GPIO_LEVEL_HIGH;  
 
BCM2711_GPIO_MAX_PULL = GPIO_PULL_DOWN;  
 
BCM2711_GPIO_MIN_FUNCTION = GPIO_FUNCTION_IN;  
BCM2711_GPIO_MAX_FUNCTION = GPIO_FUNCTION_ALT5;  
 
BCM2711_GPIO_MIN_TRIGGER = GPIO_TRIGGER_LOW;  
BCM2711_GPIO_MAX_TRIGGER = GPIO_TRIGGER_ASYNC_FALLING;  
 
BCM2711_GPIO_PULL_MAP:array[GPIO_PULL_NONE..GPIO_PULL_DOWN] of LongWord = (BCM2838_GPPUD_NONE, BCM2838_GPPUD_UP, BCM2838_GPPUD_DOWN); GPIO pull up/down to BCM2838 pull up/down
 
BCM2711_GPIO_PULL_UNMAP:array[BCM2838_GPPUD_NONE..BCM2838_GPPUD_DOWN] of LongWord = (GPIO_PULL_NONE, GPIO_PULL_UP, GPIO_PULL_DOWN); BCM2838 pull up/down to GPIO pull up/down
GPIO functions to BCM2838 functions
BCM2711_GPIO_FUNCTION_MAP:array[BCM2711_GPIO_MIN_FUNCTION..BCM2711_GPIO_MAX_FUNCTION] of LongWord = (BCM2838_GPFSEL_IN, BCM2838_GPFSEL_OUT, BCM2838_GPFSEL_ALT0, BCM2838_GPFSEL_ALT1, BCM2838_GPFSEL_ALT2, BCM2838_GPFSEL_ALT3, BCM2838_GPFSEL_ALT4, BCM2838_GPFSEL_ALT5);
BCM2838 functions to GPIO functions
BCM2711_GPIO_FUNCTION_UNMAP:array[BCM2711_GPIO_MIN_FUNCTION..BCM2711_GPIO_MAX_FUNCTION] of LongWord = (GPIO_FUNCTION_IN, GPIO_FUNCTION_OUT, GPIO_FUNCTION_ALT5, GPIO_FUNCTION_ALT4, GPIO_FUNCTION_ALT0, GPIO_FUNCTION_ALT1, GPIO_FUNCTION_ALT2, GPIO_FUNCTION_ALT3);
GPIO triggers to BCM2838 event registers
BCM2711_GPIO_TRIGGER_MAP:array[BCM2711_GPIO_MIN_TRIGGER..BCM2711_GPIO_MAX_TRIGGER] of LongWord = (BCM2838_GPLEN0, BCM2838_GPHEN0, BCM2838_GPREN0, BCM2838_GPFEN0, BCM2838_GPAREN0, BCM2838_GPAFEN0);


BCM2711 UART0/2/3/4/5 (PL011) BCM2711_UART0_*
BCM2711_UART0_DESCRIPTION = 'BCM2838 PL011 UART';  
 
BCM2711_UART0_MIN_BAUD = 300; Default minimum of 300 baud
BCM2711_UART0_MAX_BAUD = 187500; Default maximum based on the default settings from the firmware (Recalculated during open)
 
BCM2711_UART0_MIN_DATABITS = SERIAL_DATA_5BIT;  
BCM2711_UART0_MAX_DATABITS = SERIAL_DATA_8BIT;  
 
BCM2711_UART0_MIN_STOPBITS = SERIAL_STOP_1BIT;  
BCM2711_UART0_MAX_STOPBITS = SERIAL_STOP_2BIT;  
 
BCM2711_UART0_MAX_PARITY = SERIAL_PARITY_EVEN;  
 
BCM2711_UART0_MAX_FLOW = SERIAL_FLOW_RTS_CTS;  
 
BCM2711_UART0_CLOCK_RATE = 3000000; Default clock rate based on the default settings from the firmware (Requested from firmware during open)
BCM2711_UART0_RX_POLL_LIMIT = 256; Number of times interrupt handler may poll the read FIFO
BCM2711_UART0_RX_BUFFER_SIZE = 1024;  


BCM2711 UART1 (AUX) BCM2711_UART1_*
BCM2711_UART1_DESCRIPTION = 'BCM2838 AUX UART1';  


BCM2711 EMMC0 (SDHCI) BCM2711_EMMC0_*
BCM2711_EMMC0_DESCRIPTION = 'BCM2838 Arasan SD Host';  
 
BCM2711_EMMC0_MIN_FREQ = 400000; Default minimum of 400KHz
BCM2711_EMMC0_MAX_FREQ = 250000000; Default clock rate based on the default settings from the firmware (Requested from firmware during start)


BCM2711 EMMC1 (SDHOST) BCM2711_EMMC1_*
BCM2711_EMMC1_DESCRIPTION = 'BCM2838 SDHOST';  
 
BCM2711_EMMC1_MIN_FREQ = 400000; Default minimum of 400KHz
BCM2711_EMMC1_MAX_FREQ = 200000000; Default clock rate based on the default settings from the firmware (Requested from firmware during start)
See: BCMSDHOST for the driver implementation


BCM2711 EMMC2 (SDHCI) BCM2711_EMMC2_*
BCM2711_EMMC2_DESCRIPTION = 'BCM2838 SDHCI';  
 
BCM2711_EMMC2_MIN_FREQ = 400000; Default minimum of 400KHz
BCM2711_EMMC2_MAX_FREQ = 250000000; Default clock rate based on the default settings from the firmware (Requested from firmware during start)


BCM2711 clock (system timer) BCM2711_SYS_CLOCK_*
BCM2711_SYS_CLOCK_DESCRIPTION = 'BCM2838 System Timer Clock';  


BCM2711 clock (ARM timer) BCM2711_ARM_CLOCK_*
BCM2711_ARM_CLOCK_DESCRIPTION = 'BCM2838 ARM Timer Clock';  
 
BCM2711_ARM_CLOCK_MIN_RATE = 976562; Default minimum (Divider 255) based on the default settings from the firmware (Recalculated during start)
BCM2711_ARM_CLOCK_MAX_RATE = 250000000; Default maximum (Divider 0) based on the default settings from the firmware (Recalculated during start)
BCM2711_ARM_CLOCK_DEFAULT_RATE = 3968253; Default rate (Divider 62) based on the default settings from the firmware (Recalculated during start)
 
BCM2711_ARM_CLOCK_MIN_DIVIDER = 0;  
BCM2711_ARM_CLOCK_MAX_DIVIDER = 255;  
BCM2711_ARM_CLOCK_DEFAULT_DIVIDER = 62;  
 
BCM2711_ARM_CLOCK_CORE_CLOCK = 250000000; Default core clock based on the default settings from the firmware (Requested from firmware during start)


BCM2711 clock (local timer) BCM2711_LOCAL_CLOCK_*
BCM2711_LOCAL_CLOCK_DESCRIPTION = 'BCM2838 Local Timer Clock';  


BCM2711 ARM timer BCM2711_ARM_TIMER_*
BCM2711_ARM_TIMER_DESCRIPTION = 'BCM2838 ARM Timer';  
 
BCM2711_ARM_TIMER_MIN_RATE = 244140; Default minimum (Divider 1023) based on the default settings from the firmware (Recalculated during start)
BCM2711_ARM_TIMER_MAX_RATE = 250000000; Default maximum (Divider 0) based on the default settings from the firmware (Recalculated during start)
BCM2711_ARM_TIMER_DEFAULT_RATE = 1000000; Default rate (Divider 249) based on the default settings from the firmware (Recalculated during start)
 
BCM2711_ARM_TIMER_MIN_INTERVAL = 1;  
BCM2711_ARM_TIMER_MAX_INTERVAL = $FFFFFFFF;  
 
BCM2711_ARM_TIMER_MIN_DIVIDER = 0;  
BCM2711_ARM_TIMER_MAX_DIVIDER = 1023;  
BCM2711_ARM_TIMER_DEFAULT_DIVIDER = 249;  
 
BCM2711_ARM_TIMER_CORE_CLOCK = 250000000; Default core clock based on the default settings from the firmware (Requested from firmware during start)


BCM2711 local timer BCM2711_LOCAL_TIMER_*
BCM2711_LOCAL_TIMER_DESCRIPTION = 'BCM2838 Local Timer';  


BCM2711 random BCM2711_RANDOM_*
BCM2711_RANDOM_DESCRIPTION = 'BCM2838 Random Number Generator (RNG200)';  
 
BCM2711_RANDOM_WARMUP_COUNT = $00040000; The initial numbers generated are "less random" so will be discarded


BCM2711 mailbox BCM2711_MAILBOX_*
BCM2711_MAILBOX_DESCRIPTION = 'BCM2838 Mailbox';  


BCM2711 watchdog BCM2711_WATCHDOG_*
BCM2711_WATCHDOG_DESCRIPTION = 'BCM2838 Watchdog Timer';  


BCM2711 framebuffer BCM2711_FRAMEBUFFER_*
BCM2711_FRAMEBUFFER_DESCRIPTION = 'BCM2838 Framebuffer';  
NAME_  


Type definitions



BCM2711 SPI0/3/4/5/6

PBCM2711SPI0Device = ^TBCM2711SPI0Device;

TBCM2711SPI0Device = record

SPI Properties
SPI:TSPIDevice;  
BCM2711 Properties
Id:LongWord; Id of this device (0/3/4/5/6)
IRQ:LongWord; IRQ of this device
Address:Pointer; Device register base address
CoreClock:LongWord; Core clock rate
MOSIPin:LongWord; GPIO pin for the MOSI line
MISOPin:LongWord; GPIO pin for the MISO line
CS0Pin:LongWord; GPIO pin for the CS0 line
CS1Pin:LongWord; GPIO pin for the CS1 line
CS2Pin:LongWord; GPIO pin for the CS2 line
SCLKFunction:LongWord; GPIO function for the SCLK line
MOSIFunction:LongWord; GPIO function for the MOSI line
MISOFunction:LongWord; GPIO function for the MISO line
CS0Function:LongWord; GPIO function for the CS0 line
CS1Function:LongWord; GPIO function for the CS1 line
CS2Function:LongWord; GPIO function for the CS2 line
Transfer Properties
Mode:LongWord; Mode of current transfer (BCM2711_SPI0_MODE_IRQ / BCM2711_SPI0_MODE_DMA / BCM2711_SPI0_MODE_PIO)
Source:Pointer; Pointer to the source for current transfer (nil if reading only)
Dest:Pointer; Pointer to the destination for current transfer (nil if writing only)
Count:LongWord; Count of bytes for current transfer
SourceRemain:LongWord; Source bytes remaining for current transfer
DestRemain:LongWord; Destination bytes remaining for current transfer
Statistics Properties
InterruptCount:LongWord; Number of interrupt requests received by the device

BCM2711 I2C0/1/2/3/4/5/6/7

PBCM2711I2C0Device = ^TBCM2711I2C0Device;

TBCM2711I2C0Device = record

I2C Properties
I2C:TI2CDevice;  
BCM2711 Properties
Id:LongWord; Id of this device (0/1/3/4/5/6)
IRQ:LongWord; IRQ of this device
Address:Pointer; Device register base address
CoreClock:LongWord; Core clock rate
SDAPin:LongWord; GPIO pin for the SDA line
SCLPin:LongWord; GPIO pin for the SCL line
SDAFunction:LongWord; GPIO function for the SDA line
SCLFunction:LongWord; GPIO function for the SCL line
Transfer Properties
Mode:LongWord; Mode of current transfer (BCM2711_I2C0_MODE_WRITE / BCM2711_I2C0_MODE_READ)
Data:Pointer; Pointer to the data for current transfer
Count:LongWord; Count of bytes for current transfer
Remain:LongWord; Bytes remaining for current transfer
Error:LongBool; True if an error occurred during the transfer
Statistics Properties
InterruptCount:LongWord;{ Number of interrupt requests received by the device

BCM2711 SPI1/2 (AUX)

PBCM2711SPI1Device = ^TBCM2711SPI1Device;

TBCM2711SPI1Device = record

SPI Properties
SPI:TSPIDevice;  
BCM2711 Properties
Address:Pointer; Device register base address
CoreClock:LongWord; Core clock rate
Transfer Properties
 

BCM2711 DMA

PBCM2711DMAHost = ^TBCM2711DMAHost;

TBCM2711DMAHost = record

DMA Properties
DMA:TDMAHost;  
BCM2711 Properties
ChannelMask:LongWord; Mask of available channels (Passed from GPU firmware)
ChannelFree:LongWord; Bitmap of current free channels
ChannelLock:TMutexHandle; Lock for access to ChannelFree
ChannelWait:TSemaphoreHandle; Number of free normal channels in ChannelFree
Channel40:TSemaphoreHandle; Number of free 40 bit channels in ChannelFree
ChannelLite:TSemaphoreHandle; Number of free DMA Lite channels in ChannelFree
ChannelBulk:TSemaphoreHandle; Number of free DMA Bulk channels in ChannelFree
Channels:array[0..BCM2711_DMA_CHANNEL_COUNT - 1] of TBCM2711DMAChannel; Channel information for each DMA channel on the host
EnableRegister:PLongWord;  
InterruptRegister:PLongWord;  
Statistics Properties
InterruptCount:LongWord; Number of interrupt requests received by the host controller

BCM2711 DMA channel

PBCM2711DMAChannel = ^TBCM2711DMAChannel;

TBCM2711DMAChannel = record

Host:PBCM2711DMAHost; DMA host this channel belongs to
Request:PDMARequest; Current DMA request pending on this channel (or nil of no request is pending)
Number:LongWord; The channel number of this channel
Interrupt:LongWord; The interrupt number of this channel
Registers:PBCM2838DMARegisters; The channel registers for configuration
Registers40:PBCM2838DMA40Registers; The 40 bit channel registers for configuration

BCM2711 PWM0/1 device

PBCM2711PWM0Device = ^TBCM2711PWM0Device;

TBCM2711PWM0Device = record

PWM Properties
PWM:TPWMDevice;  
BCM2711 Properties
Id:LongWord; Id of this device (0/1)
Address:Pointer; Device register base address
Channel:LongWord; Channel for this device
Scaler:LongWord; Scaler for Duty cycle and Period
Pair:PBCM2711PWM0Device; The paired PWM device for the other channel
Audio Properties
Audio:PBCM2711PWM0Audio; The associated PWM Audio device

BCM2711 PWM0/1 audio

PBCM2711PWM0Audio = ^TBCM2711PWM0Audio;

TBCM2711PWM0Audio = record

Audio Properties
Audio:TAudioDevice;  
BCM2711 Properties
 
PWM Properties
PWM0:PBCM2711PWM0Device; The PWM device for channel 0
PWM1:PBCM2711PWM0Device; The PWM device for channel 1

BCM2711 GPIO

PBCM2711GPIOBank = ^TBCM2711GPIOBank;

TBCM2711GPIOBank = record

GPIO:PGPIODevice;  
Bank:LongWord;  
Address:PtrUInt;  
PinStart:LongWord;  

BCM2711 GPIO device

PBCM2711GPIODevice = ^TBCM2711GPIODevice;

TBCM2711GPIODevice = record

GPIO Properties
GPIO:TGPIODevice;  
BCM2711 Properties
Lock:TSpinHandle; Device lock (Differs from lock in Device portion) (Spin lock due to use by interrupt handler)
Banks:array[0..BCM2838_GPIO_BANK_COUNT - 1] of TBCM2711GPIOBank;  
Statistics Properties
InterruptCount:LongWord; Number of interrupt requests received by the device

BCM2711 UART0/2/3/4/5

PBCM2711UART0Device = ^TBCM2711UART0Device;

TBCM2711UART0Device = record

UART Properties
UART:TUARTDevice;  
BCM2711 Properties
Id:LongWord; Id of this device (0/2/3/4/5)
IRQ:LongWord; IRQ of this device
Lock:TSpinHandle; Device lock (Differs from lock in UART device) (Spin lock due to use by interrupt handler)
Address:Pointer; Device register base address
ClockRate:LongWord; Device clock rate
TXDPin:LongWord; GPIO pin for the TXD line
RXDPin:LongWord; GPIO pin for the RXD line
CTSPin:LongWord; GPIO pin for the CTS line
RTSPin:LongWord; GPIO pin for the RTS line
TXDFunction:LongWord; GPIO function for the TXD line
RXDFunction:LongWord; GPIO function for the RXD line
CTSFunction:LongWord; GPIO function for the CTS line
RTSFunction:LongWord; GPIO function for the RTS line
Start:LongWord; Index of first available buffer entry
Count:LongWord; Number of available entries in the buffer
Buffer:array[0..(BCM2711_UART0_RX_BUFFER_SIZE - 1)] of Word; Buffer for received data (Includes data and status)
Statistics Properties
InterruptCount:LongWord; Number of interrupt requests received by the device

BCM2711 UART1

PBCM2711UART1Device = ^TBCM2711UART1Device;

TBCM2711UART1Device = record

UART Properties
UART:TUARTDevice;  
BCM2711 Properties
 

BCM2711 EMMC0/EMMC2 (SDHCI)

PBCM2711EMMC0Host = ^TBCM2711EMMC0Host;

TBCM2711EMMC0Host = record

SDHCI Properties
SDHCI:TSDHCIHost;  
BCM2711 Properties
Id:LongWord;  
IRQ:LongWord;  
FIQ:LongBool;  
SDIO:LongBool;  
PowerId:LongWord;  
ClockId:LongWord;  
WriteDelay:LongWord;  
DelayClock:LongWord;  
ShadowRegister:LongWord;  

BCM2711 system clock

PBCM2711SystemClock = ^TBCM2711SystemClock;

TBCM2711SystemClock = record

Clock Properties
Clock:TClockDevice;  
BCM2711 Properties
 

BCM2711 ARM clock

PBCM2711ARMClock = ^TBCM2711ARMClock;

TBCM2711ARMClock = record

Clock Properties
Clock:TClockDevice;  
BCM2711 Properties
CoreClock:LongWord; Core clock rate

BCM2711 ARM timer

PBCM2711ARMTimer = ^TBCM2711ARMTimer;

TBCM2711ARMTimer = record

Timer Properties
Timer:TTimerDevice;  
BCM2711 Properties
CoreClock:LongWord; Core clock rate
Statistics Properties
InterruptCount:LongWord; Number of interrupt requests received by the device

BCM2711 local timer

PBCM2711LocalTimer = ^TBCM2711LocalTimer;

TBCM2711LocalTimer = record

Timer Properties
Timer:TTimerDevice;  
BCM2711 Properties
CoreClock:LongWord; Core clock rate
Statistics Properties
InterruptCount:LongWord; Number of interrupt requests received by the device

BCM2711 random

PBCM2711Random = ^TBCM2711Random;

TBCM2711Random = record

Random Properties
Random:TRandomDevice;  
BCM2711 Properties
 

BCM2711 mailbox

PBCM2711Mailbox = ^TBCM2711Mailbox;

TBCM2711Mailbox = record

Mailbox Properties
Mailbox:TMailboxDevice;  
BCM2711 Properties
 

BCM2711 watchdog

PBCM2711Watchdog = ^TBCM2711Watchdog;

TBCM2711Watchdog = record

Watchdog Properties
Watchdog:TWatchdogDevice;  
BCM2711 Properties
 

BCM2711 framebuffer

PBCM2711Framebuffer = ^TBCM2711Framebuffer;

TBCM2711Framebuffer = record

Framebuffer Properties
Framebuffer:TFramebufferDevice;  
BCM2711 Properties
MultiDisplay:LongBool;  
DisplayNum:LongWord;  
DisplaySettings:TDisplaySettings;  


Public variables


None defined

Function declarations



Initialization functions

procedure BCM2711Init;
Description: To be documented
Note None documented


BCM2711 SPI0/3/4/5/6 functions

function BCM2711SPI0Start(SPI:PSPIDevice; Mode,ClockRate,ClockPhase,ClockPolarity:LongWord):LongWord;
Description: To be documented
Note None documented


function BCM2711SPI0Stop(SPI:PSPIDevice):LongWord;
Description: To be documented
Note None documented


function BCM2711SPI0WriteRead(SPI:PSPIDevice; ChipSelect:Word; Source,Dest:Pointer; Size,Flags:LongWord; var Count:LongWord):LongWord;
Description: To be documented
Note None documented


function BCM2711SPI0SetMode(SPI:PSPIDevice; Mode:LongWord):LongWord;
Description: To be documented
Note None documented


function BCM2711SPI0SetClockRate(SPI:PSPIDevice; ChipSelect:Word; ClockRate:LongWord):LongWord;
Description: To be documented
Note None documented


function BCM2711SPI0SetClockPhase(SPI:PSPIDevice; ClockPhase:LongWord):LongWord;
Description: To be documented
Note None documented


function BCM2711SPI0SetClockPolarity(SPI:PSPIDevice; ClockPolarity:LongWord):LongWord;
Description: To be documented
Note None documented


function BCM2711SPI0SetSelectPolarity(SPI:PSPIDevice; ChipSelect:Word; SelectPolarity:LongWord):LongWord;
Description: To be documented
Note None documented


procedure BCM2711SPI0ReadFIFO(SPI:PBCM2711SPI0Device);
Description: Caller will hold the SPI device lock
Note Called from within the interrupt handler


procedure BCM2711SPI0WriteFIFO(SPI:PBCM2711SPI0Device);
Description: Caller will hold the SPI device lock
Note Called from within the interrupt handler


function BCM2711SPI0SharedInterruptHandler(Number,CPUID,Flags:LongWord; SPI:PBCM2711SPI0Device):LongWord;
Description: To be documented
Note None documented


procedure BCM2711SPI0DMARequestCompleted(Request:PDMARequest);
Description: DMA Request completion callback for SPI0
Note None documented


procedure BCM2711SPI0GetGPIOConfig(SPI:PBCM2711SPI0Device);
Description: Setup the GPIO config for the supplied SPI0 device
Note None documented


BCM2711 I2C0/1/2/3/4/5/6/7 functions

function BCM2711I2C0Start(I2C:PI2CDevice; Rate:LongWord):LongWord;
Description: To be documented
Note None documented


function BCM2711I2C0Stop(I2C:PI2CDevice):LongWord;
Description: To be documented
Note None documented


function BCM2711I2C0Read(I2C:PI2CDevice; Address:Word; Buffer:Pointer; Size:LongWord; var Count:LongWord):LongWord;
Description: To be documented
Note None documented


function BCM2711I2C0Write(I2C:PI2CDevice; Address:Word; Buffer:Pointer; Size:LongWord; var Count:LongWord):LongWord;
Description: To be documented
Note None documented


function BCM2711I2C0WriteRead(I2C:PI2CDevice; Address:Word; Initial:Pointer; Len:LongWord; Data:Pointer; Size:LongWord; var Count:LongWord):LongWord;
Description: To be documented
Note None documented


function BCM2711I2C0WriteWrite(I2C:PI2CDevice; Address:Word; Initial:Pointer; Len:LongWord; Data:Pointer; Size:LongWord; var Count:LongWord):LongWord;
Description: To be documented
Note None documented


function BCM2711I2C0SetRate(I2C:PI2CDevice; Rate:LongWord):LongWord;
Description: To be documented
Note None documented


function BCM2711I2C0SetAddress(I2C:PI2CDevice; Address:Word):LongWord;
Description: To be documented
Note None documented


procedure BCM2711I2C0FillFIFO(I2C:PBCM2711I2C0Device);
Description: Caller will hold the I2C device lock
Note Called from within the interrupt handler


procedure BCM2711I2C0DrainFIFO(I2C:PBCM2711I2C0Device);
Description: Caller will hold the I2C device lock
Note Called from within the interrupt handler


function BCM2711I2C0SharedInterruptHandler(Number,CPUID,Flags:LongWord; I2C:PBCM2711I2C0Device):LongWord;
Description: To be documented
Note Thread submitting the current request will hold the I2C device lock


procedure BCM2711I2C0GetGPIOConfig(I2C:PBCM2711I2C0Device);
Description: Setup the GPIO config for the supplied I2C0 device
Note None documented


BCM2711 DMA functions

function BCM2711DMAHostStart(DMA:PDMAHost):LongWord;
Description: To be documented
Note None documented


function BCM2711DMAHostStop(DMA:PDMAHost):LongWord;
Description: To be documented
Note None documented


function BCM2711DMAHostSubmit(DMA:PDMAHost; Request:PDMARequest):LongWord;
Description: To be documented
Note None documented


function BCM2711DMAHostCancel(DMA:PDMAHost; Request:PDMARequest):LongWord;
Description: To be documented
Note None documented


procedure BCM2711DMAInterruptHandler(Channel:PBCM2711DMAChannel);
Description: DMA Channels 0 to 6 each have a dedicated interrupt, this handler simply clears the interrupt and sends a completion on the associated channel
Note None documented


procedure BCM2711DMA40InterruptHandler(Channel:PBCM2711DMAChannel);
Description: DMA Channels 11 to 14 each have a dedicated interrupt, this handler simply clears the interrupt and sends a completion on the associated channel
Note None documented


procedure BCM2711DMASharedInterruptHandler(DMA:PBCM2711DMAHost);
Description: DMA Channels 7 to 10 share a common interrupt, this alternate handler determines which one triggered the current interrupt and sends a completion on that channel
Note None documented


procedure BCM2711DMARequestComplete(Channel:PBCM2711DMAChannel);
Description: To be documented
Note None documented


function BCM2711DMAPeripheralToDREQ(Peripheral:LongWord):LongWord;
Description: To be documented
Note None documented


procedure BCM2711DMADataToControlBlock(Request:PDMARequest; Data:PDMAData; Block:PBCM2838DMAControlBlock; Bulk,Lite:Boolean);
Description: To be documented
Note None documented


procedure BCM2711DMA40DataToControlBlock(Request:PDMARequest; Data:PDMAData; Block:PBCM2838DMA40ControlBlock);
Description: To be documented
Note None documented


BCM2711 PWM0/1 functions

function BCM2711PWM0Start(PWM:PPWMDevice):LongWord;
Description: To be documented
Note None documented


function BCM2711PWM0Stop(PWM:PPWMDevice):LongWord;
Description: To be documented
Note None documented


function BCM2711PWM0Write(PWM:PPWMDevice; Value:LongWord):LongWord;
Description: To be documented
Note None documented


function BCM2711PWM0SetGPIO(PWM:PPWMDevice; GPIO:LongWord):LongWord;
Description: To be documented
Note None documented


function BCM2711PWM0ResetGPIO(PWM:PPWMDevice; GPIO:LongWord):LongWord;
Description: To be documented
Note None documented


function BCM2711PWM0SetMode(PWM:PPWMDevice; Mode:LongWord):LongWord;
Description: To be documented
Note None documented


function BCM2711PWM0SetRange(PWM:PPWMDevice; Range:LongWord):LongWord;
Description: To be documented
Note None documented


function BCM2711PWM0SetFrequency(PWM:PPWMDevice; Frequency:LongWord):LongWord;
Description: To be documented
Note None documented


function BCM2711PWM0SetPolarity(PWM:PPWMDevice; Polarity:LongWord):LongWord;
Description: To be documented
Note None documented


function BCM2711PWM0Configure(PWM:PPWMDevice; DutyNS,PeriodNS:LongWord):LongWord;
Description: To be documented
Note None documented


function BCM2711PWM0ClockStart(PWM:PPWMDevice; Frequency:LongWord):LongWord;
Description: To be documented
Note None documented


function BCM2711PWM0ClockStop(PWM:PPWMDevice):LongWord;
Description: To be documented
Note None documented


function BCM2711PWM0ClockEnabled(PWM:PPWMDevice):Boolean;
Description: To be documented
Note None documented


BCM2711 GPIO functions

function BCM2711GPIOStart(GPIO:PGPIODevice):LongWord;
Description: To be documented
Note None documented


function BCM2711GPIOStop(GPIO:PGPIODevice):LongWord;
Description: To be documented
Note None documented


function BCM2711GPIORead(GPIO:PGPIODevice; Reg:LongWord):LongWord;
Description: To be documented
Note None documented


procedure BCM2711GPIOWrite(GPIO:PGPIODevice; Reg,Value:LongWord);
Description: To be documented
Note None documented


function BCM2711GPIOInputGet(GPIO:PGPIODevice; Pin:LongWord):LongWord;
Description: To be documented
Note None documented


function BCM2711GPIOInputWait(GPIO:PGPIODevice; Pin,Trigger,Timeout:LongWord):LongWord;
Description: To be documented
Note None documented


function BCM2711GPIOInputEvent(GPIO:PGPIODevice; Pin,Trigger,Flags,Timeout:LongWord; Callback:TGPIOCallback; Data:Pointer):LongWord;
Description: To be documented
Note None documented


function BCM2711GPIOInputCancel(GPIO:PGPIODevice; Pin:LongWord):LongWord;
Description: To be documented
Note None documented


function BCM2711GPIOOutputSet(GPIO:PGPIODevice; Pin,Level:LongWord):LongWord;
Description: To be documented
Note None documented


function BCM2711GPIOPullGet(GPIO:PGPIODevice; Pin:LongWord):LongWord;
Description: To be documented
Note None documented


function BCM2711GPIOPullSelect(GPIO:PGPIODevice; Pin,Mode:LongWord):LongWord;
Description: To be documented
Note None documented


function BCM2711GPIOFunctionGet(GPIO:PGPIODevice; Pin:LongWord):LongWord;
Description: To be documented
Note None documented


function BCM2711GPIOFunctionSelect(GPIO:PGPIODevice; Pin,Mode:LongWord):LongWord;
Description: To be documented
Note None documented


procedure BCM2711GPIOInterruptHandler(Bank:PBCM2711GPIOBank);
Description: To be documented
Note None documented


procedure BCM2711GPIOEventTrigger(Pin:PGPIOPin);
Description: To be documented
Note None documented


procedure BCM2711GPIOEventTimeout(Event:PGPIOEvent);
Description: To be documented
Note None documented


BCM2711 UART0/2/3/4/5 functions

function BCM2711UART0Open(UART:PUARTDevice; BaudRate,DataBits,StopBits,Parity,FlowControl:LongWord):LongWord;
Description: Implementation of UARTDeviceOpen API for BCM2711 UART0
Note Not intended to be called directly by applications, use UARTDeviceOpen instead.


function BCM2711UART0Close(UART:PUARTDevice):LongWord;
Description: Implementation of UARTDeviceClose API for BCM2711 UART0
Note Not intended to be called directly by applications, use UARTDeviceClose instead.


function BCM2711UART0Read(UART:PUARTDevice; Buffer:Pointer; Size,Flags:LongWord; var Count:LongWord):LongWord;
Description: Implementation of UARTDeviceRead API for BCM2711 UART0
Note Not intended to be called directly by applications, use UARTDeviceRead instead.


function BCM2711UART0Write(UART:PUARTDevice; Buffer:Pointer; Size,Flags:LongWord; var Count:LongWord):LongWord;
Description: Implementation of UARTDeviceWrite API for BCM2711 UART0
Note Not intended to be called directly by applications, use UARTDeviceWrite instead.


function BCM2711UART0GetStatus(UART:PUARTDevice):LongWord;
Description: Implementation of UARTDeviceGetStatus API for BCM2711 UART0
Note Not intended to be called directly by applications, use UARTDeviceGetStatus instead.


function BCM2711UART0SetStatus(UART:PUARTDevice; Status:LongWord):LongWord;
Description: Implementation of UARTDeviceSetStatus API for BCM2711 UART0
Note Not intended to be called directly by applications, use UARTDeviceSetStatus instead.


function BCM2711UART0SharedInterruptHandler(Number,CPUID,Flags:LongWord; UART:PUARTDevice):LongWord;
Description: Interrupt handler for the BCM2711 UART0 device
Note Not intended to be called directly by applications


procedure BCM2711UART0Receive(UART:PUARTDevice);
Description: Receive handler for the BCM2711 UART0 device
Note Not intended to be called directly by applications


procedure BCM2711UART0Transmit(UART:PUARTDevice);
Description: Transmit handler for the BCM2711 UART0 device
Note Not intended to be called directly by applications


procedure BCM2711UART0EnableInterrupt(UART:PBCM2711UART0Device; Interrupt:LongWord);
Description: Enable the specified interrupt in the interrupt mask register of a BCM2711 UART0 device
UART The BCM2711 UART0 device to enable the interrupt for
Interrupt The interrupt to enable
Note Caller must hold the UART lock


procedure BCM2711UART0DisableInterrupt(UART:PBCM2711UART0Device; Interrupt:LongWord);
Description: Disable the specified interrupt in the interrupt mask register of a BCM2711 UART0 device
UART The BCM2711 UART0 device to disable the interrupt for
Interrupt The interrupt to disable
Note Caller must hold the UART lock


procedure BCM2711UART0GetGPIOConfig(UART:PBCM2711UART0Device);
Description: Setup the GPIO config for the supplied UART0 device
Note None documented


BCM2711 EMMC0 (SDHCI) functions

function BCM2711EMMC0HostStart(SDHCI:PSDHCIHost):LongWord;
Description: Implementation of SDHCIHostStart API for BCM2711 SDHCI
Note Not intended to be called directly by applications, use SDHCIHostStart instead.


function BCM2711EMMC0HostStop(SDHCI:PSDHCIHost):LongWord;
Description: Implementation of SDHCIHostStop API for BCM2711 SDHCI
Note Not intended to be called directly by applications, use SDHCIHostStop instead.


function BCM2711EMMC0HostLock(SDHCI:PSDHCIHost):LongWord;
Description: Implementation of SDHCIHostLock API for BCM2711 SDHCI
Note Not intended to be called directly by applications, use SDHCIHostLock instead.


function BCM2711EMMC0HostUnlock(SDHCI:PSDHCIHost):LongWord;
Description: Implementation of SDHCIHostUnlock API for BCM2711 SDHCI
Note Not intended to be called directly by applications, use SDHCIHostUnlock instead.


function BCM2711EMMC0HostReadByte(SDHCI:PSDHCIHost; Reg:LongWord):Byte;
Description: Implementation of SDHCIHostReadByte API for BCM2711 SDHCI
Note Not intended to be called directly by applications, use SDHCIHostReadByte instead.
Note The Broadcom document BCM2835-ARM-Peripherals page 66 states the following: Contrary to Arasans documentation the EMMC module registers can only be accessed as 32 bit registers. i.e. The two LSBs of the address are always zero. For this reason this code must simulate Byte and Word reads using LongWord reads.


function BCM2711EMMC0HostReadWord(SDHCI:PSDHCIHost; Reg:LongWord):Word;
Description: Implementation of SDHCIHostReadWord API for BCM2711 SDHCI
Note Not intended to be called directly by applications, use SDHCIHostReadWord instead.
Note The Broadcom document BCM2835-ARM-Peripherals page 66 states the following: Contrary to Arasans documentation the EMMC module registers can only be accessed as 32 bit registers. i.e. The two LSBs of the address are always zero. For this reason this code must simulate Byte and Word reads using LongWord reads.


function BCM2711EMMC0HostReadLong(SDHCI:PSDHCIHost; Reg:LongWord):LongWord;
Description: Implementation of SDHCIHostReadLong API for BCM2711 SDHCI
Note Not intended to be called directly by applications, use SDHCIHostReadLong instead.


procedure BCM2711EMMC0HostWriteByte(SDHCI:PSDHCIHost; Reg:LongWord; Value:Byte);
Description: Implementation of SDHCIHostWriteByte API for BCM2711 SDHCI
Note Not intended to be called directly by applications, use SDHCIHostWriteByte instead.
Note The Broadcom document BCM2835-ARM-Peripherals page 66 states the following: Contrary to Arasans documentation the EMMC module registers can only be accessed as 32 bit registers. i.e. The two LSBs of the address are always zero. For this reason this code must simulate Byte and Word writes using LongWord writes.


procedure BCM2711EMMC0HostWriteWord(SDHCI:PSDHCIHost; Reg:LongWord; Value:Word);
Description: Implementation of SDHCIHostWriteWord API for BCM2711 SDHCI
Note Not intended to be called directly by applications, use SDHCIHostWriteWord instead.
Note The Broadcom document BCM2835-ARM-Peripherals page 66 states the following: Contrary to Arasans documentation the EMMC module registers can only be accessed as 32 bit registers. i.e. The two LSBs of the address are always zero. For this reason this code must simulate Byte and Word writes using LongWord writes.


procedure BCM2711EMMC0HostWriteLong(SDHCI:PSDHCIHost; Reg:LongWord; Value:LongWord);
Description: Implementation of SDHCIHostWriteLong API for BCM2711 SDHCI
Note Not intended to be called directly by applications, use SDHCIHostWriteLong instead.
Note The source code of U-Boot and Linux kernel drivers have this comment The Arasan has a bugette whereby it may lose the content of successive writes to registers that are within two SD-card clock cycles of each other (a clock domain crossing problem). It seems, however, that the data register does not have this problem (which is just as well - otherwise we'd have to nobble the DMA engine too). For this reason this code must delay after each write to the registers.


function BCM2711EMMC0SharedInterruptHandler(Number,CPUID,Flags:LongWord; SDHCI:PSDHCIHost):LongWord;
Description: Interrupt handler for the BCM2711 SDHCI host controller
Note Not intended to be called directly by applications


function BCM2711EMMC0SetupInterrupts(SDHCI:PSDHCIHost):LongWord;
Description: Configure and enable interrupt handling for the BCM2711 SDHCI
Note Not intended to be called directly by applications


function BCM2711EMMC0DeviceGetCardDetect(MMC:PMMCDevice):LongWord;
Description: Implementation of MMC GetCardDetect for the BCM2711 which does not update the bits in the SDHCI_PRESENT_STATE register to reflect card insertion or removal
Note Not intended to be called directly by applications, use MMCDeviceGetCardDetect instead.


BCM2711 system clock functions

function BCM2711SystemClockRead(Clock:PClockDevice):LongWord;
Description: Implementation of ClockDeviceRead API for System Clock
Note Not intended to be called directly by applications, use ClockDeviceRead instead.


function BCM2711SystemClockRead64(Clock:PClockDevice):Int64;
Description: Implementation of ClockDeviceRead64 API for System Clock
Note Not intended to be called directly by applications, use ClockDeviceRead64 instead.


BCM2711 ARM clock functions

function BCM2711ARMClockStart(Clock:PClockDevice):LongWord;
Description: Implementation of ClockDeviceStart API for ARM Clock
Note Not intended to be called directly by applications, use ClockDeviceStart instead.


function BCM2711ARMClockStop(Clock:PClockDevice):LongWord;
Description: Implementation of ClockDeviceStop API for ARM Clock
Note Not intended to be called directly by applications, use ClockDeviceStop instead.


function BCM2711ARMClockRead(Clock:PClockDevice):LongWord;
Description: Implementation of ClockDeviceRead API for ARM Clock
Note Not intended to be called directly by applications, use ClockDeviceRead instead.


function BCM2711ARMClockRead64(Clock:PClockDevice):Int64;
Description: Implementation of ClockDeviceRead64 API for ARM Clock
Note Not intended to be called directly by applications, use ClockDeviceRead64 instead.


function BCM2711ARMClockSetRate(Clock:PClockDevice; Rate:LongWord):LongWord;
Description: Implementation of ClockDeviceSetRate API for ARM Clock
Note Not intended to be called directly by applications, use ClockDeviceSetRate instead.


BCM2711 ARM timer functions

function BCM2711ARMTimerStart(Timer:PTimerDevice):LongWord;
Description: Implementation of TimerDeviceStart API for ARM Timer
Note Not intended to be called directly by applications, use TimerDeviceStart instead.


function BCM2711ARMTimerStop(Timer:PTimerDevice):LongWord;
Description: Implementation of TimerDeviceStop API for ARM Timer
Note Not intended to be called directly by applications, use TimerDeviceStop instead.


function BCM2711ARMTimerRead64(Timer:PTimerDevice):Int64;
Description: Implementation of TimerDeviceRead64 API for ARM Timer
Note Not intended to be called directly by applications, use TimerDeviceRead64 instead.


function BCM2711ARMTimerWait(Timer:PTimerDevice):LongWord;
Description: Implementation of TimerDeviceWait API for ARM Timer
Note Not intended to be called directly by applications, use TimerDeviceWait instead.


function BCM2711ARMTimerEvent(Timer:PTimerDevice; Flags:LongWord; Callback:TTimerCallback; Data:Pointer):LongWord;
Description: Implementation of TimerDeviceEvent API for ARM Timer
Note Not intended to be called directly by applications, use TimerDeviceEvent instead.


function BCM2711ARMTimerCancel(Timer:PTimerDevice):LongWord;
Description: Implementation of TimerDeviceCancel API for ARM Timer
Note Not intended to be called directly by applications, use TimerDeviceCancel instead.


function BCM2711ARMTimerSetRate(Timer:PTimerDevice; Rate:LongWord):LongWord;
Description: Implementation of TimerDeviceSetRate API for ARM Timer
Note Not intended to be called directly by applications, use TimerDeviceSetRate instead.


function BCM2711ARMTimerSetInterval(Timer:PTimerDevice; Interval:LongWord):LongWord;
Description: Implementation of TimerDeviceSetInterval API for ARM Timer
Note Not intended to be called directly by applications, use TimerDeviceSetInterval instead.


procedure BCM2711ARMTimerInterruptHandler(Timer:PTimerDevice);
Description: Interrupt handler for ARM Timer
Note Not intended to be called directly by applications


procedure BCM2711ARMTimerEventTrigger(Timer:PTimerDevice);
Description: Event handler for ARM Timer
Note Not intended to be called directly by applications


BCM2711 random functions

function BCM2711RandomStart(Random:PRandomDevice):LongWord;
Description: To be documented
Note None documented


function BCM2711RandomStop(Random:PRandomDevice):LongWord;
Description: To be documented
Note None documented


function BCM2711RandomReadLongWord(Random:PRandomDevice):LongWord;
Description: To be documented
Note None documented


BCM2711 watchdog functions

function BCM2711WatchdogStart(Watchdog:PWatchdogDevice):LongWord;
Description: To be documented
Note None documented


function BCM2711WatchdogStop(Watchdog:PWatchdogDevice):LongWord;
Description: To be documented
Note None documented


function BCM2711WatchdogRefresh(Watchdog:PWatchdogDevice):LongWord;
Description: To be documented
Note None documented


function BCM2711WatchdogGetRemain(Watchdog:PWatchdogDevice):LongWord;
Description: To be documented
Note None documented


BCM2711 framebuffer functions

function BCM2711FramebufferAllocate(Framebuffer:PFramebufferDevice; Properties:PFramebufferProperties):LongWord;
Description: Implementation of FramebufferDeviceAllocate API for BCM2711 Framebuffer
Note Not intended to be called directly by applications, use FramebufferDeviceAllocate instead.


function BCM2711FramebufferRelease(Framebuffer:PFramebufferDevice):LongWord;
Description: Implementation of FramebufferDeviceRelease API for BCM2711 Framebuffer
Note Not intended to be called directly by applications, use FramebufferDeviceRelease instead.


function BCM2711FramebufferBlank(Framebuffer:PFramebufferDevice; Blank:Boolean):LongWord;
Description: Implementation of FramebufferDeviceBlank API for BCM2711 Framebuffer
Note Not intended to be called directly by applications, use FramebufferDeviceBlank instead.


function BCM2711FramebufferCommit(Framebuffer:PFramebufferDevice; Address:PtrUInt; Size,Flags:LongWord):LongWord;
Description: Implementation of FramebufferDeviceCommit API for BCM2711 Framebuffer
Note Not intended to be called directly by applications, use FramebufferDeviceCommit instead.


function BCM2711FramebufferWaitSync(Framebuffer:PFramebufferDevice):LongWord;
Description: Implementation of FramebufferDeviceWaitSync API for BCM2711 Framebuffer
Note Not intended to be called directly by applications, use FramebufferDeviceWaitSync instead.


function BCM2711FramebufferSetOffset(Framebuffer:PFramebufferDevice; X,Y:LongWord; Pan:Boolean):LongWord;
Description: Implementation of FramebufferDeviceSetOffset API for BCM2711 Framebuffer
Note Not intended to be called directly by applications, use FramebufferDeviceSetOffset instead.


function BCM2711FramebufferGetPalette(Framebuffer:PFramebufferDevice; Palette:PFramebufferPalette):LongWord;
Description: Implementation of FramebufferDeviceGetPalette API for BCM2711 Framebuffer
Note Not intended to be called directly by applications, use FramebufferDeviceGetPalette instead.


function BCM2711FramebufferSetPalette(Framebuffer:PFramebufferDevice; Palette:PFramebufferPalette):LongWord;
Description: Implementation of FramebufferDeviceSetPalette API for BCM2711 Framebuffer
Note Not intended to be called directly by applications, use FramebufferDeviceSetPalette instead.


function BCM2711FramebufferSetBacklight(Framebuffer:PFramebufferDevice; Brightness:LongWord):LongWord;
Description: Implementation of FramebufferDeviceSetBacklight API for BCM2711 Framebuffer
Note Not intended to be called directly by applications, use FramebufferDeviceSetBacklight instead.


function BCM2711FramebufferSetCursor(Framebuffer:PFramebufferDevice; Width,Height,HotspotX,HotspotY:LongWord; Image:Pointer; Len:LongWord):LongWord;
Description: Implementation of FramebufferDeviceSetCursor API for BCM2711 Framebuffer
Note Not intended to be called directly by applications, use FramebufferDeviceSetCursor instead.


function BCM2711FramebufferUpdateCursor(Framebuffer:PFramebufferDevice; Enabled:Boolean; X,Y:LongInt; Relative:Boolean):LongWord;
Description: Implementation of FramebufferDeviceUpdateCursor API for BCM2711 Framebuffer
Note Not intended to be called directly by applications, use FramebufferDeviceUpdateCursor instead.


BCM2711 helper functions

function BCM2711SPIGetDescription(Id:LongWord):String;
Description: Get the device description of an SPI device
Id The Id number of the SPI device (0 to 6)
Return The correct device description suitable for passing to SPIDeviceFindByDescription
Note The Id number supplied to this function may differ from the Ultibo device id value.


function BCM2711I2CGetDescription(Id:LongWord):String;
Description: Get the device description of an I2C device
Id The Id number of the I2C device (0 to 7)
Return The correct device description suitable for passing to I2CDeviceFindByDescription
Note The Id number supplied to this function may differ from the Ultibo device id value.


function BCM2711I2CSlaveGetDescription(Id:LongWord):String;
Description: Get the device description of an I2C slave device
Id The Id number of the I2C slave device (Always 0)
Return The correct device description suitable for passing to I2CSlaveFindByDescription
Note The Id number supplied to this function may differ from the Ultibo device id value


function BCM2711PWMGetDescription(Id,Channel:LongWord):String;
Description: Get the device description of a PWM device
Id The Id number of the PWM device (0 or 1)
Channel The channel number of the PWM device (0 or 1)
Return The correct device description suitable for passing to PWMDeviceFindByDescription
Note The Id number supplied to this function may differ from the Ultibo device id value.


function BCM2711UARTGetDescription(Id:LongWord):String;
Description: Get the device description of a UART device
Id The Id number of the UART device (0 to 5)
Return The correct device description suitable for passing to UARTDeviceFindByDescription
Note The Id number supplied to this function may differ from the Ultibo device id value.


Return to Unit Reference