Unit BCMSDHOST

From Ultibo.org
Revision as of 03:57, 25 July 2021 by Ultibo (Talk | contribs)

Jump to: navigation, search

Return to Unit Reference


Description


Broadcom BCM27XX SDHOST driver

The SDHOST controller on the BCM27XX 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) in order to control the SD card slot when the SDHCI device is being used for the on board WiFi.

Note that on the Raspberry Pi 4 the SD card is no longer connected to pins 48 to 53 so the SDHOST controller cannot control the primary SD card, there is an additional SDHCI controller (EMMC2) for that purpose.

Constants


To be documented

Type definitions


To be documented

Public variables


None defined

Function declarations



Initialization functions

procedure BCMSDHOSTInit;
Description: Initialize the BCMSDHOST unit and version table
Note Called only during system startup


BCMSDHOST functions

function BCMSDHOSTCreate(Address:PtrUInt; const Name:String; IRQ,DREQ,ClockMinimum,ClockMaximum,GPIOFirst,GPIOLast,GPIOFunction:LongWord; EnableFIQ:Boolean):PSDHCIHost;
Description: Create and register a new BCMSDHOST SDHCI device which can be accessed using the SDHCI API
Address The address of the BCMSDHOST registers
Name The text description of this device which will show in the device list (Optional)
IRQ The interrupt number for the BCMSDHOST
DREQ The DMA data request ID for the BCMSDHOST
ClockMinimum The minimum frequency for the BCMSDHOST clock
ClockMaximum The maximum frequency for the BCMSDHOST clock
GPIOFirst The starting pin number for GPIO assignments (or GPIO_PIN_UNKNOWN if externally configured)
GPIOLast The ending pin number for GPIO assignments (or GPIO_PIN_UNKNOWN if externally configured)
GPIOFunction The function number for GPIO assignments (or GPIO_FUNCTION_UNKNOWN if externally configured)
EnableFIQ Enable fast interrupt support for the BCMSDHOST
Return Pointer to the new SDHCI device or nil if the SDHCI device could not be created


function BCMSDHOSTDestroy(SDHCI:PSDHCIHost):LongWord;
Description: Stop, deregister and destroy a BCMSDHOST SDHCI device created by this driver
SDHCI The SDHCI device to destroy
Return ERROR_SUCCESS if completed or another error code on failure


BCMSDHOST MMC functions

function BCMSDHOSTSendCommand(MMC:PMMCDevice; Command:PMMCCommand):LongWord;
Description: Implementation of MMCDeviceSendCommand API for BCMSDHOST SDHCI
Note Not intended to be called directly by applications, use MMCDeviceSendCommand instead.


function BCMSDHOSTSetIOS(MMC:PMMCDevice):LongWord;
Description: Implementation of MMCDeviceSetIOS API for BCMSDHOST SDHCI
Note Not intended to be called directly by applications, use MMCDeviceSetIOS instead.


function BCMSDHOSTGetCardDetect(MMC:PMMCDevice):LongWord;
Description: Implementation of MMCDeviceGetCardDetect API for BCMSDHOST SDHCI
Note Not intended to be called directly by applications, use MMCDeviceGetCardDetect instead.


function BCMSDHOSTGetWriteProtect(MMC:PMMCDevice):LongWord;
Description: Implementation of MMCDeviceGetWriteProtect API for BCMSDHOST SDHCI
Note Not intended to be called directly by applications, use MMCDeviceGetWriteProtect instead.


BCMSDHOST SDHCI functions

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


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


function BCMSDHOSTReset(SDHCI:PSDHCIHost; Mask:Byte):LongWord;
Description: Implementation of SDHCIReset API for BCMSDHOST SDHCI
Note Not intended to be called directly by applications, use SDHCIReset instead.


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


function BCMSDHOSTSetPower(SDHCI:PSDHCIHost; Power:Word):LongWord;
Description: Implementation of SDHCISetPower API for BCMSDHOST SDHCI
Note Not intended to be called directly by applications, use SDHCISetPower instead.


function BCMSDHOSTSetClock(SDHCI:PSDHCIHost; Clock:LongWord):LongWord;
Description: Implementation of SDHCISetClock API for BCMSDHOST SDHCI
Note Not intended to be called directly by applications, use SDHCISetClock instead.


procedure BCMSDHOSTCommandWaitWorker(SDHCI:PSDHCIHost);
Description: Worker thread task to wait for BCMSDHOST command completion
Note Not intended to be called directly by applications


procedure BCMSDHOSTDMARequestCompleted(Request:PDMARequest);
Description: DMA Request completion callback for the BCMSDHOST host controller
Note Not intended to be called directly by applications


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


BCMSDHOST helper functions

function BCMSDHOSTSetSDHostClock(var Clock,Value1,Value2:LongWord):LongWord;
Description: Set the SD Host Clock value in the Mailbox property tags channel
Note None documented


Return to Unit Reference