Difference between revisions of "Unit BCMSDHOST"

From Ultibo.org
Jump to: navigation, search
 
(3 intermediate revisions by the same user not shown)
Line 5: Line 5:
 
----
 
----
  
'''Broadcom BCM27XX SDHOST driver'''
+
'''Broadcom BCM27XX SDHOST Driver unit'''
  
 
The SDHOST controller on the BCM27XX is a non SDHCI-compliant device which requires a specific driver.
 
The SDHOST controller on the BCM27XX is a non SDHCI-compliant device which requires a specific driver.
Line 175: Line 175:
 
|colspan="2"|04 Reserved
 
|colspan="2"|04 Reserved
 
|-
 
|-
|colspan="2"|-02 Reserved
+
|colspan="2"|02 Reserved
 
|-
 
|-
 
| <code>BCMSDHOST_SDHSTS_DATA_FLAG = $01;</code>
 
| <code>BCMSDHOST_SDHSTS_DATA_FLAG = $01;</code>
Line 367: Line 367:
 
| <code>IRQ:LongWord;</code>
 
| <code>IRQ:LongWord;</code>
 
| The IRQ number for this device
 
| The IRQ number for this device
|-
 
| <code>DREQ:LongWord;</code>
 
| The DMA DREQ ID for this device
 
 
|-
 
|-
 
| <code>Lock:TSpinHandle;</code>
 
| <code>Lock:TSpinHandle;</code>
Line 402: Line 399:
 
|-
 
|-
 
| <code>AllowDMA:LongBool;</code>
 
| <code>AllowDMA:LongBool;</code>
| &nbsp;
+
| Allow DMA to be used for data transfers
 
|-
 
|-
 
| <code>ResetClock:LongBool;</code>
 
| <code>ResetClock:LongBool;</code>
Line 419: Line 416:
 
| Offset for data during FIFO drain on DMA read
 
| Offset for data during FIFO drain on DMA read
 
|-
 
|-
| <code>UseDMA:LongBool;</code>
+
| <code>UseSBC:LongBool;</code>
| Use DMA for the current data transfer
+
| Use CMD23 (Set Block Count) for the current transfer
 
|-
 
|-
 
| <code>UseBusy:LongBool;</code>
 
| <code>UseBusy:LongBool;</code>
Line 445: Line 442:
 
| <code>PIOTimeout:LongWord;</code>
 
| <code>PIOTimeout:LongWord;</code>
 
| PIO Read or Write block timeout (in milliseconds)
 
| 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)
 
 
|-
 
|-
 
|}
 
|}
Line 472: Line 460:
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 
<div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial; padding-top: 0px; padding-bottom: 15px;">
 
<pre style="border: 0; padding-bottom:0px;">procedure BCMSDHOSTInit;</pre>
 
<pre style="border: 0; padding-bottom:0px;">procedure BCMSDHOSTInit;</pre>
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Initialize the BCMSDHOST unit and version table</div>
+
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Initialize the BCMSDHOST unit and parameters</div>
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 
{| class="wikitable" style="font-size: 14px; background: white;"
 
{| class="wikitable" style="font-size: 14px; background: white;"

Latest revision as of 04:45, 29 October 2021

Return to Unit Reference


Description


Broadcom BCM27XX SDHOST Driver unit

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



[Expand]
BCMSDHOST specific constants BCMSDHOST_*


[Expand]
BCMSDHOST register BCMSDHOST_*


[Expand]
BCMSDHOST command register BCMSDHOST_SDCMD_*


[Expand]
BCMSDHOST clock divider register BCMSDHOST_SDCDIV_*


[Expand]
BCMSDHOST host status register BCMSDHOST_SDHSTS_*


[Expand]
BCMSDHOST host configuration register BCMSDHOST_SDHCFG_*


[Expand]
BCMSDHOST emergency debug mode register BCMSDHOST_SDEDM_*


[Expand]
BCMSDHOST mailbox constants BCMSDHOST_MBOX_TAG_SET_*


Type definitions



BCMSDHOST mailbox tag request

[Expand]

TBCMSDHOSTMailboxTagSetSDHostClock = record

BCMSDHOST host

[Expand]

PBCMSDHOSTHost = ^TBCMSDHOSTHost;

TBCMSDHOSTHost = record


Public variables


None defined

Function declarations



Initialization functions

[Expand]
procedure BCMSDHOSTInit;
Description: Initialize the BCMSDHOST unit and parameters


BCMSDHOST functions

[Expand]
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


[Expand]
function BCMSDHOSTDestroy(SDHCI:PSDHCIHost):LongWord;
Description: Stop, deregister and destroy a BCMSDHOST SDHCI device created by this driver


BCMSDHOST MMC functions

[Expand]
function BCMSDHOSTSendCommand(MMC:PMMCDevice; Command:PMMCCommand):LongWord;
Description: Implementation of MMCDeviceSendCommand API for BCMSDHOST SDHCI


[Expand]
function BCMSDHOSTSetIOS(MMC:PMMCDevice):LongWord;
Description: Implementation of MMCDeviceSetIOS API for BCMSDHOST SDHCI


[Expand]
function BCMSDHOSTGetCardDetect(MMC:PMMCDevice):LongWord;
Description: Implementation of MMCDeviceGetCardDetect API for BCMSDHOST SDHCI


[Expand]
function BCMSDHOSTGetWriteProtect(MMC:PMMCDevice):LongWord;
Description: Implementation of MMCDeviceGetWriteProtect API for BCMSDHOST SDHCI


BCMSDHOST SDHCI functions

[Expand]
function BCMSDHOSTHostStart(SDHCI:PSDHCIHost):LongWord;
Description: Implementation of SDHCIHostStart API for BCMSDHOST SDHCI


[Expand]
function BCMSDHOSTHostStop(SDHCI:PSDHCIHost):LongWord;
Description: Implementation of SDHCIHostStop API for BCMSDHOST SDHCI


[Expand]
function BCMSDHOSTReset(SDHCI:PSDHCIHost; Mask:Byte):LongWord;
Description: Implementation of SDHCIReset API for BCMSDHOST SDHCI


[Expand]
function BCMSDHOSTHardwareReset(SDHCI:PSDHCIHost):LongWord;
Description: Implementation of SDHCIHardwareReset API for BCMSDHOST SDHCI


[Expand]
function BCMSDHOSTSetPower(SDHCI:PSDHCIHost; Power:Word):LongWord;
Description: Implementation of SDHCISetPower API for BCMSDHOST SDHCI


[Expand]
function BCMSDHOSTSetClock(SDHCI:PSDHCIHost; Clock:LongWord):LongWord;
Description: Implementation of SDHCISetClock API for BCMSDHOST SDHCI


[Expand]
procedure BCMSDHOSTCommandWaitWorker(SDHCI:PSDHCIHost);
Description: Worker thread task to wait for BCMSDHOST command completion


[Expand]
procedure BCMSDHOSTDMARequestCompleted(Request:PDMARequest);
Description: DMA Request completion callback for the BCMSDHOST host controller


[Expand]
function BCMSDHOSTSharedInterruptHandler(Number,CPUID,Flags:LongWord; SDHCI:PSDHCIHost):LongWord;
Description: Interrupt handler for the BCMSDHOST host controller


BCMSDHOST helper functions

[Expand]
function BCMSDHOSTSetSDHostClock(var Clock,Value1,Value2:LongWord):LongWord;
Description: Set the SD Host Clock value in the Mailbox property tags channel


Return to Unit Reference