Difference between revisions of "Unit BCMSDHOST"
Line 21: | Line 21: | ||
---- | ---- | ||
− | '' | + | |
+ | '''BCMSDHOST mailbox tag request''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | |||
+ | <code>TBCMSDHOSTMailboxTagSetSDHostClock = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|Mailbox tag request for BCMSDHOST_MBOX_TAG_SET_SDHOST_CLOCK | ||
+ | |- | ||
+ | | <code>Clock:LongWord;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>Value1:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>Value2:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''BCMSDHOST host''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PBCMSDHOSTHost = ^TBCMSDHOSTHost;</code> | ||
+ | |||
+ | <code>TBCMSDHOSTHost = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|''SDHCI Properties'' | ||
+ | |- | ||
+ | | <code>SDHCI:TSDHCIHost;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | |colspan="2"|''BCMSDHOST Properties'' | ||
+ | |- | ||
+ | | <code>IRQ:LongWord;</code> | ||
+ | | The IRQ number for this device | ||
+ | |- | ||
+ | | <code>DREQ:LongWord;</code> | ||
+ | | The DMA DREQ ID for this device | ||
+ | |- | ||
+ | | <code>Lock:TSpinHandle;</code> | ||
+ | | Host lock (Differs from lock in Host portion) (Spin lock due to use by interrupt handler) | ||
+ | |- | ||
+ | | <code>EnableFIQ:LongBool;</code> | ||
+ | | Use FIQ instead of IRQ | ||
+ | |- | ||
+ | | <code>GPIOFirst:LongWord;</code> | ||
+ | | The starting pin number for GPIO assignments (or GPIO_PIN_UNKNOWN if externally configured) | ||
+ | |- | ||
+ | | <code>GPIOLast:LongWord;</code> | ||
+ | | The ending pin number for GPIO assignments (or GPIO_PIN_UNKNOWN if externally configured) | ||
+ | |- | ||
+ | | <code>GPIOFunction:LongWord;</code> | ||
+ | | The function number for GPIO assignments (or GPIO_FUNCTION_UNKNOWN if externally configured) | ||
+ | |- | ||
+ | | <code>ClockDivider:LongWord;</code> | ||
+ | | Cached Clock Divider (CDIV) register | ||
+ | |- | ||
+ | | <code>HostConfiguration:LongWord;</code> | ||
+ | | Cached Host Configuration (HCFG) register | ||
+ | |- | ||
+ | | <code>FirmwareSetsClockDivider:LongBool;</code> | ||
+ | | True if the firmware controls the clock divider | ||
+ | |- | ||
+ | | <code>CommandQuickPollRetries:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>NanosecondsPerFifoWord:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>AllowDMA:LongBool;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>ResetClock:LongBool;</code> | ||
+ | | Reset the clock for the next request | ||
+ | |- | ||
+ | | <code>MaxDelay:LongWord;</code> | ||
+ | | Maximum length of time spent waiting (in Milliseconds) | ||
+ | |- | ||
+ | | <code>StopTime:Int64;</code> | ||
+ | | When the last stop was issued (in Clock Ticks) | ||
+ | |- | ||
+ | | <code>DrainWords:LongWord;</code> | ||
+ | | Last words of FIFO to drain on DMA read | ||
+ | |- | ||
+ | | <code>DrainOffset:LongWord;</code> | ||
+ | | Offset for data during FIFO drain on DMA read | ||
+ | |- | ||
+ | | <code>UseDMA:LongBool;</code> | ||
+ | | Use DMA for the current data transfer | ||
+ | |- | ||
+ | | <code>UseBusy:LongBool;</code> | ||
+ | | Wait for busy interrupt on current command | ||
+ | |- | ||
+ | | <code>DelayAfterStop:LongWord;</code> | ||
+ | | Minimum time between stop and subsequent data transfer (in Microseconds) | ||
+ | |- | ||
+ | | <code>DelayAfterThisStop:LongWord;</code> | ||
+ | | Minimum time between this stop and subsequent data transfer (in Microseconds) | ||
+ | |- | ||
+ | | <code>UserOverclock50:LongWord;</code> | ||
+ | | User's preferred frequency to use when 50MHz is requested (in MHz) | ||
+ | |- | ||
+ | | <code>Overclock50:LongWord;</code> | ||
+ | | Frequency to use when 50MHz is requested (in MHz) | ||
+ | |- | ||
+ | | <code>Overclock:LongWord;</code> | ||
+ | | Current frequency if overclocked, else zero (in Hz) | ||
+ | |- | ||
+ | | <code>PIOLimit:LongWord;</code> | ||
+ | | Maximum block count for PIO (0 = always DMA / 0x7FFFFFF = always PIO) | ||
+ | |- | ||
+ | | <code>PIOTimeout:LongWord;</code> | ||
+ | | PIO Read or Write block timeout (in milliseconds) | ||
+ | |- | ||
+ | | <code>DMAData:TDMAData;</code> | ||
+ | | DMA data descriptor for current request (If applicable) | ||
+ | |- | ||
+ | | <code>DMADirection:LongWord;</code> | ||
+ | | DMA data direction for current request (If applicable) | ||
+ | |- | ||
+ | | <code>DMABuffer:Pointer;</code> | ||
+ | | DMA bounce buffer for the current request (If applicable) | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
=== Public variables === | === Public variables === |
Revision as of 04:18, 25 July 2021
Return to Unit Reference
Contents
[hide]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
BCMSDHOST mailbox tag request
TBCMSDHOSTMailboxTagSetSDHostClock = record
BCMSDHOST host
Public variables
None defined
Function declarations
Initialization functions
BCMSDHOST functions
function BCMSDHOSTCreate(Address:PtrUInt; const Name:String; IRQ,DREQ,ClockMinimum,ClockMaximum,GPIOFirst,GPIOLast,GPIOFunction:LongWord; EnableFIQ:Boolean):PSDHCIHost;
function BCMSDHOSTDestroy(SDHCI:PSDHCIHost):LongWord;
BCMSDHOST MMC functions
function BCMSDHOSTSendCommand(MMC:PMMCDevice; Command:PMMCCommand):LongWord;
function BCMSDHOSTSetIOS(MMC:PMMCDevice):LongWord;
function BCMSDHOSTGetCardDetect(MMC:PMMCDevice):LongWord;
function BCMSDHOSTGetWriteProtect(MMC:PMMCDevice):LongWord;
BCMSDHOST SDHCI functions
function BCMSDHOSTHostStart(SDHCI:PSDHCIHost):LongWord;
function BCMSDHOSTHostStop(SDHCI:PSDHCIHost):LongWord;
function BCMSDHOSTReset(SDHCI:PSDHCIHost; Mask:Byte):LongWord;
function BCMSDHOSTHardwareReset(SDHCI:PSDHCIHost):LongWord;
function BCMSDHOSTSetPower(SDHCI:PSDHCIHost; Power:Word):LongWord;
function BCMSDHOSTSetClock(SDHCI:PSDHCIHost; Clock:LongWord):LongWord;
procedure BCMSDHOSTCommandWaitWorker(SDHCI:PSDHCIHost);
procedure BCMSDHOSTDMARequestCompleted(Request:PDMARequest);
function BCMSDHOSTSharedInterruptHandler(Number,CPUID,Flags:LongWord; SDHCI:PSDHCIHost):LongWord;
BCMSDHOST helper functions
function BCMSDHOSTSetSDHostClock(var Clock,Value1,Value2:LongWord):LongWord;
Return to Unit Reference