Difference between revisions of "Unit PL18X"

From Ultibo.org
Jump to: navigation, search
Line 302: Line 302:
 
----
 
----
  
''To be documented''
 
  
 +
'''Initialization functions'''
 +
 +
<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 PL18XInit;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Initialize the PL18X unit and version table</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''Note'''
 +
| Called only during system startup
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
 +
'''PL18X functions'''
 +
 +
<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;">function PL180SDHCICreate(Address:LongWord; const Name:String; IRQ0,IRQ1,ClockMinimum,ClockMaximum:LongWord; CardDetect:TMMCDeviceGetCardDetect; WriteProtect:TMMCDeviceGetWriteProtect):PSDHCIHost;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Create and register a new PL180 SDHCI device which can be accessed using the SDHCI API</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''Address'''
 +
| The address of the PL180 registers
 +
|-
 +
! '''Name'''
 +
| The text description of this device which will show in the device list (Optional)
 +
|-
 +
! '''IRQ0'''
 +
| The interrupt 0 number for the PL180
 +
|-
 +
! '''IRQ1'''
 +
| The interrupt 1 number for the PL180
 +
|-
 +
! '''ClockMinimum'''
 +
| The minimum frequency for the Pl180 clock
 +
|-
 +
! '''ClockMaximum'''
 +
| The maximum frequency for the Pl180 clock
 +
|-
 +
! '''Return'''
 +
| Pointer to the new SDHCI device or nil if the SDHCI device could not be created
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<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;">function PL181SDHCICreate(Address:LongWord; const Name:String; IRQ0,IRQ1,ClockMinimum,ClockMaximum:LongWord; CardDetect:TMMCDeviceGetCardDetect; WriteProtect:TMMCDeviceGetWriteProtect):PSDHCIHost;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Create and register a new PL181 SDHCI device which can be accessed using the SDHCI API</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''Address'''
 +
| The address of the PL181 registers
 +
|-
 +
! '''Name'''
 +
| The text description of this device which will show in the device list (Optional)
 +
|-
 +
! '''IRQ0'''
 +
| The interrupt 0 number for the PL181
 +
|-
 +
! '''IRQ1'''
 +
| The interrupt 1 number for the PL181
 +
|-
 +
! '''ClockMinimum'''
 +
| The minimum frequency for the Pl181 clock
 +
|-
 +
! '''ClockMaximum'''
 +
| The maximum frequency for the Pl181 clock
 +
|-
 +
! '''Return'''
 +
| Pointer to the new SDHCI device or nil if the SDHCI device could not be created
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<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;">function PL18XSDHCIDestroy(SDHCI:PSDHCIHost):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Stop, deregister and destroy a PL18X SDHCI device created by this driver</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''SDHCI'''
 +
| The SDHCI device to destroy
 +
|-
 +
! '''Return'''
 +
| ERROR_SUCCESS if completed or another error code on failure
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
 +
'''PL18X MMC functions'''
 +
 +
<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;">function PL18XMMCDeviceInitialize(MMC:PMMCDevice):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of MMCDeviceInitialize API for PL18X SDHCI</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''Note'''
 +
| Not intended to be called directly by applications, use MMCDeviceInitialize instead
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<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;">function PL18XMMCDeviceGetCardDetect(MMC:PMMCDevice):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of MMCDeviceGetCardDetect API for PL18X SDHCI</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''Note'''
 +
| Not intended to be called directly by applications, use MMCDeviceGetCardDetect instead
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<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;">function PL18XMMCDeviceGetWriteProtect(MMC:PMMCDevice):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of MMCDeviceGetWriteProtect API for PL18X SDHCI</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''Note'''
 +
| Not intended to be called directly by applications, use MMCDeviceGetWriteProtect instead
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<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;">function PL18XMMCDeviceSendCommand(MMC:PMMCDevice; Command:PMMCCommand):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of MMCDeviceSendCommand API for PL18X SDHCI</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''Note'''
 +
| Not intended to be called directly by applications, use MMCDeviceSendCommand instead
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<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;">function PL18XMMCDeviceSetIOS(MMC:PMMCDevice):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of MMCDeviceSetIOS API for PL18X SDHCI</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''Note'''
 +
| Not intended to be called directly by applications, use MMCDeviceSetIOS instead
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
 +
'''PL18X SDHCI functions'''
 +
 +
<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;">function PL18XSDHCIHostStart(SDHCI:PSDHCIHost):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of SDHCIHostStart API for PL18X SDHCI</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''Note'''
 +
| Not intended to be called directly by applications, use SDHCIHostStart instead
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<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;">function PL18XSDHCIHostStop(SDHCI:PSDHCIHost):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of SDHCIHostStop API for PL18X SDHCI</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''Note'''
 +
| Not intended to be called directly by applications, use SDHCIHostStop instead
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<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;">function PL18XSDHCIHostReadByte(SDHCI:PSDHCIHost; Reg:LongWord):Byte;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of SDHCIHostReadByte API for PL18X SDHCI</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''Note'''
 +
| Not intended to be called directly by applications, use SDHCIHostReadByte instead
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<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;">function PL18XSDHCIHostReadWord(SDHCI:PSDHCIHost; Reg:LongWord):Word;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of SDHCIHostReadWord API for PL18X SDHCI</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''Note'''
 +
| Not intended to be called directly by applications, use SDHCIHostReadWord instead
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<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;">function PL18XSDHCIHostReadLong(SDHCI:PSDHCIHost; Reg:LongWord):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of SDHCIHostReadLong API for PL18X SDHCI</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''Note'''
 +
| Not intended to be called directly by applications, use SDHCIHostReadLong instead
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<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 PL18XSDHCIHostWriteByte(SDHCI:PSDHCIHost; Reg:LongWord; Value:Byte);</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of SDHCIHostWriteByte API for PL18X SDHCI</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''Note'''
 +
| Not intended to be called directly by applications, use SDHCIHostWriteByte instead
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<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 PL18XSDHCIHostWriteWord(SDHCI:PSDHCIHost; Reg:LongWord; Value:Word);</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of SDHCIHostWriteWord API for PL18X SDHCI</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''Note'''
 +
| Not intended to be called directly by applications, use SDHCIHostWriteWord instead
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<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 PL18XSDHCIHostWriteLong(SDHCI:PSDHCIHost; Reg:LongWord; Value:LongWord);</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Implementation of SDHCIHostWriteLong API for PL18X SDHCI</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''Note'''
 +
| Not intended to be called directly by applications, use SDHCIHostWriteLong instead
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<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 PL18XSDHCIInterruptHandler(SDHCI:PPL18XSDHCIHost);</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Interrupt handler for the PL18X SDHCI</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''Note'''
 +
| Not intended to be called directly by applications
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<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 PL18XSDHCIDataInterrupt(SDHCI:PPL18XSDHCIHost; Status:LongWord);</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Data interrupt handler for the PL18X SDHCI</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''Note'''
 +
| Not intended to be called directly by applications
 +
Caller must hold the host lock
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<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 PL18XSDHCICommandInterrupt(SDHCI:PPL18XSDHCIHost; Status:LongWord);</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Command interrupt handler for the PL18X SDHCI</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''Note'''
 +
| Not intended to be called directly by applications
 +
Caller must hold the host lock
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<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 PL18XSDHCIStopData(SDHCI:PPL18XSDHCIHost);</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Data stop handler for the PL18X SDHCI</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''Note'''
 +
| Not intended to be called directly by applications
 +
Caller must hold the host lock
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<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 PL18XSDHCIPIOInterruptHandler(SDHCI:PPL18XSDHCIHost);</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' PIO Interrupt handler for the PL18X SDHCI</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''Note'''
 +
| Not intended to be called directly by applications
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<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;">function PL18XSHDCIReadPIO(SDHCI:PPL18XSDHCIHost ;Buffer:Pointer; Remain:LongWord):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' PIO read interrupt handler for the PL18X SDHCI</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''Note'''
 +
| Not intended to be called directly by applications
 +
Caller must hold the host lock
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<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;">function PL18XSDHCIWritePIO(SDHCI:PPL18XSDHCIHost; Buffer:Pointer; Remain,Status:LongWord):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' PIO read interrupt handler for the PL18X SDHCI</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''Note'''
 +
| Not intended to be called directly by applications
 +
Caller must hold the host lock
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
 +
'''PL18X helper functions'''
 +
 +
<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;">function PL18XGetPeripheralID(SDHCI:PPL18XSDHCIHost):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Return the Peripheral Id for a PL18X SDHCI device</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''Note'''
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<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;">function PL18XGetVersionData(SDHCI:PPL18XSDHCIHost):PPL18XVersionData;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Return the version data for a PL18X SDHCI device based on the Peripheral Id</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''Note'''
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<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;">function PL18XGetRXFIFOCount(SDHCI:PPL18XSDHCIHost; Status,Remain:LongWord):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Determine the receive FIFO count available</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''Note'''
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<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;">function PL18XQualcommGetRXFIFOCount(SDHCI:PPL18XSDHCIHost; Status,Remain:LongWord):LongWord;</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Determine the receive FIFO count available</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''Note'''
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<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 PL18XRegisterDelay(SDHCI:PPL18XSDHCIHost);</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Delay for the required amount of time after a register write</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''Note'''
 +
| None documented
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<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 PL18XSetClockRegister(SDHCI:PPL18XSDHCIHost; MMC:PMMCDevice; Desired:LongWord);</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Setup the current clock rate in the clock register</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''Note'''
 +
| Caller must hold the host lock
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<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 PL18XSetPowerRegister(SDHCI:PPL18XSDHCIHost; Value:LongWord);</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Setup the current power state in the power register</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''Note'''
 +
| Caller must hold the host lock
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<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 PL18XSetInterruptMask1(SDHCI:PPL18XSDHCIHost; Mask:LongWord);</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Setup the interrupt mask to use either Mask0 or Mask1 depending on configuration</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''Note'''
 +
| Caller must hold the host lock
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<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 PL18XWriteClockRegister(SDHCI:PPL18XSDHCIHost; Clock:LongWord);</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Write to the clock register</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''Note'''
 +
| Caller must hold the host lock
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<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 PL18XWritePowerRegister(SDHCI:PPL18XSDHCIHost; Power:LongWord);</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Write to the power register</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''Note'''
 +
| Caller must hold the host lock
 +
|-
 +
|}
 +
</div></div>
 +
<br />
 +
<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 PL18XWriteDataCtrlRegister(SDHCI:PPL18XSDHCIHost; DataCtrl:LongWord);</pre>
 +
<div style="font-size: 14px; padding-left: 12px;">'''Description:''' Write to the data control register</div>
 +
<div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;">
 +
{| class="wikitable" style="font-size: 14px; background: white;"
 +
|-
 +
! '''Note'''
 +
| Caller must hold the host lock
 +
|-
 +
|}
 +
</div></div>
 +
<br />
  
 
Return to [[Unit_Reference|Unit Reference]]
 
Return to [[Unit_Reference|Unit Reference]]

Revision as of 05:34, 13 June 2017

Return to Unit Reference


Description


ARM PrimeCell PL180/181 Multimedia Card Interface Driver unit

The PL180/181 Multimedia Card is an ARM peripheral that is compatible with MMC multimedia cards and SD secure digital cards in memory mapped I/O format compatible with the ARM advanced peripheral bus (APB).

The design of the Pl180/181 allows for multiple cards per controller however this driver currently only supports attaching one card.

Constants


To be documented

Type definitions



PL18X version Id

PPL18XVersionID = ^TPL18XVersionID;

TPL18XVersionID = record

PeripheralID:LongWord;  
PeripheralMask:LongWord;  
VersionData:PPL18XVersionData;  

PL18X version data

PPL18XVersionData = ^TPL18XVersionData;

TPL18XVersionData = record

Name:String; Name of the device
ClockRegister:LongWord; Default value for MCICLOCK register
ClockEnable:LongWord; Enable value for MMCICLOCK register
Clock8BitEnable:LongWord; Enable value for 8 bit bus
ClockNegativeEdgeEnable:LongWord; Enable value for inverted data/cmd output
DataLengthBits:LongWord; Number of bits in the MMCIDATALENGTH register
FIFOSize:LongWord; Number of bytes that can be written when MMCI_TXFIFOEMPTY is asserted (likewise for RX)
FIFOHalfSize:LongWord; Number of bytes that can be written when MCI_TXFIFOHALFEMPTY is asserted (likewise for RX)
DataCommandEnable:LongWord; Enable value for data commands
DataControlMaskDDR:LongWord; DDR mode mask in MMCIDATACTRL register
DataControlMaskSDIO:LongWord; SDIO enable mask in MMCIDATACTRL register
STSDIO:LongBool; Enable ST specific SDIO logic
STClockDivider:LongBool; True if using a ST-specific clock divider algorithm
BlockSizeDataControl16:LongBool; True if Block size is at b16..b30 position in MMCIDATACTRL register
BlockSizeDataControl4:LongBool; True if Block size is at b4..b16 position in MMCIDATACTRL register
PowerPowerUp:LongWord; Power up value for MMCIPOWER register
ClockMaximum:LongWord; Maximum clk frequency supported by the controller
SignalDirection:LongBool; Input/out direction of bus signals can be indicated
PowerClockGate:LongBool; MMCIPOWER register must be used to gate the clock
BusyDetect:LongBool; True if busy detection on dat0 is supported
PowerNoPower:LongBool; Bits in MMCIPOWER don't control external power supply
ExplicitMClockControl:LongBool; Enable explicit mclk control in driver
QualcommFIFO:LongBool; Enable Qualcomm specific FIFO PIO read logic
QualcommDMA:LongBool; Enable Qualcomm specific DMA glue for DMA transfers
ReversedIRQ:LongBool; Handle data irq before cmd irq

PL18X MMCI registers

PPL18XMMCIRegisters = ^TPL18XMMCIRegisters;

TPL18XMMCIRegisters = record

Note: Layout of the PL18X registers (See: http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0172a/i1006458.html)
Power:LongWord; Power control register
Clock:LongWord; Clock control register
Argument:LongWord; Argument register
Command:LongWord; Command register
RespCmd:LongWord; Response command register
Response0:LongWord; Response register
Response1:LongWord; Response register
Response2:LongWord; Response register
Response3:LongWord; Response register
DataTimer:LongWord; Data timer
DataLength:LongWord; Data length register
DataCtrl:LongWord; Data control register
DataCnt:LongWord; Data counter
Status:LongWord; Status register
Clear:LongWord; Clear register
Mask0:LongWord; Interrupt 0 mask register
Mask1:LongWord; Interrupt 1 mask register
Select:LongWord; Secure digital memory card select register
FifoCnt:LongWord; FIFO counter
Reserved:array[$4C..$7C] of Byte; Reserved
FIFO:LongWord; Data FIFO register (0x80 to 0xBC)

PL18X SDHCI get RXFIFO count

TPL18XSDHCIGetRXFIFOCount = function(SDHCI:PPL18XSDHCIHost; Status,Remain:LongWord):LongWord;

PL18X SDHCI host

PPL18XSDHCIHost = ^TPL18XSDHCIHost;

TPL18XSDHCIHost = record

SDHCI Properties
SDHCI:TSDHCIHost;  
PL18X Properties
IRQ0:LongWord;  
IRQ1:LongWord;  
Lock:TSpinHandle; Host lock (Differs from lock in Host portion) Spin lock due to use by interrupt handler
SingleIRQ:LongBool; The host only has a single IRQ line instead of the standard 2 lines
Registers:PPL18XMMCIRegisters; Host registers
Version:PPL18XVersionData; Host version data
ClockRegister:LongWord; Current clock register value
PowerRegister:LongWord; Current power register value
DataCtrlRegister:LongWord; Current data control register value
MaximumBlockSize:LongWord; Host maximum block size
MaximumRequestSize:LongWord; Host maximum request size
BusyStatus:LongWord; Current Busy Status for ST Micro variants
GetRXFIFOCount:TPL18XSDHCIGetRXFIFOCount; Model specific GetRXFIFOCount function


Public variables



PL18X specific variables

PL18X_MMCI_FIQ_ENABLED:LongBool; The SDHCI uses Fast Interrupt Requests (FIQ) instead of IRQ
PL18X_MMCI_MIN_FREQ:LongWord = 400000; Minimum clock frequency for SDHCI (Default minimum of 400KHz)
PL18X_MMCI_MAX_FREQ:LongWord = 400000; Maximum clock frequency for SDHCI (Default maximum of 400KHz)


Function declarations



Initialization functions

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


PL18X functions

function PL180SDHCICreate(Address:LongWord; const Name:String; IRQ0,IRQ1,ClockMinimum,ClockMaximum:LongWord; CardDetect:TMMCDeviceGetCardDetect; WriteProtect:TMMCDeviceGetWriteProtect):PSDHCIHost;
Description: Create and register a new PL180 SDHCI device which can be accessed using the SDHCI API
Address The address of the PL180 registers
Name The text description of this device which will show in the device list (Optional)
IRQ0 The interrupt 0 number for the PL180
IRQ1 The interrupt 1 number for the PL180
ClockMinimum The minimum frequency for the Pl180 clock
ClockMaximum The maximum frequency for the Pl180 clock
Return Pointer to the new SDHCI device or nil if the SDHCI device could not be created


function PL181SDHCICreate(Address:LongWord; const Name:String; IRQ0,IRQ1,ClockMinimum,ClockMaximum:LongWord; CardDetect:TMMCDeviceGetCardDetect; WriteProtect:TMMCDeviceGetWriteProtect):PSDHCIHost;
Description: Create and register a new PL181 SDHCI device which can be accessed using the SDHCI API
Address The address of the PL181 registers
Name The text description of this device which will show in the device list (Optional)
IRQ0 The interrupt 0 number for the PL181
IRQ1 The interrupt 1 number for the PL181
ClockMinimum The minimum frequency for the Pl181 clock
ClockMaximum The maximum frequency for the Pl181 clock
Return Pointer to the new SDHCI device or nil if the SDHCI device could not be created


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


PL18X MMC functions

function PL18XMMCDeviceInitialize(MMC:PMMCDevice):LongWord;
Description: Implementation of MMCDeviceInitialize API for PL18X SDHCI
Note Not intended to be called directly by applications, use MMCDeviceInitialize instead


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


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


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


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


PL18X SDHCI functions

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


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


function PL18XSDHCIHostReadByte(SDHCI:PSDHCIHost; Reg:LongWord):Byte;
Description: Implementation of SDHCIHostReadByte API for PL18X SDHCI
Note Not intended to be called directly by applications, use SDHCIHostReadByte instead


function PL18XSDHCIHostReadWord(SDHCI:PSDHCIHost; Reg:LongWord):Word;
Description: Implementation of SDHCIHostReadWord API for PL18X SDHCI
Note Not intended to be called directly by applications, use SDHCIHostReadWord instead


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


procedure PL18XSDHCIHostWriteByte(SDHCI:PSDHCIHost; Reg:LongWord; Value:Byte);
Description: Implementation of SDHCIHostWriteByte API for PL18X SDHCI
Note Not intended to be called directly by applications, use SDHCIHostWriteByte instead


procedure PL18XSDHCIHostWriteWord(SDHCI:PSDHCIHost; Reg:LongWord; Value:Word);
Description: Implementation of SDHCIHostWriteWord API for PL18X SDHCI
Note Not intended to be called directly by applications, use SDHCIHostWriteWord instead


procedure PL18XSDHCIHostWriteLong(SDHCI:PSDHCIHost; Reg:LongWord; Value:LongWord);
Description: Implementation of SDHCIHostWriteLong API for PL18X SDHCI
Note Not intended to be called directly by applications, use SDHCIHostWriteLong instead


procedure PL18XSDHCIInterruptHandler(SDHCI:PPL18XSDHCIHost);
Description: Interrupt handler for the PL18X SDHCI
Note Not intended to be called directly by applications


procedure PL18XSDHCIDataInterrupt(SDHCI:PPL18XSDHCIHost; Status:LongWord);
Description: Data interrupt handler for the PL18X SDHCI
Note Not intended to be called directly by applications

Caller must hold the host lock


procedure PL18XSDHCICommandInterrupt(SDHCI:PPL18XSDHCIHost; Status:LongWord);
Description: Command interrupt handler for the PL18X SDHCI
Note Not intended to be called directly by applications

Caller must hold the host lock


procedure PL18XSDHCIStopData(SDHCI:PPL18XSDHCIHost);
Description: Data stop handler for the PL18X SDHCI
Note Not intended to be called directly by applications

Caller must hold the host lock


procedure PL18XSDHCIPIOInterruptHandler(SDHCI:PPL18XSDHCIHost);
Description: PIO Interrupt handler for the PL18X SDHCI
Note Not intended to be called directly by applications


function PL18XSHDCIReadPIO(SDHCI:PPL18XSDHCIHost ;Buffer:Pointer; Remain:LongWord):LongWord;
Description: PIO read interrupt handler for the PL18X SDHCI
Note Not intended to be called directly by applications

Caller must hold the host lock


function PL18XSDHCIWritePIO(SDHCI:PPL18XSDHCIHost; Buffer:Pointer; Remain,Status:LongWord):LongWord;
Description: PIO read interrupt handler for the PL18X SDHCI
Note Not intended to be called directly by applications

Caller must hold the host lock


PL18X helper functions

function PL18XGetPeripheralID(SDHCI:PPL18XSDHCIHost):LongWord;
Description: Return the Peripheral Id for a PL18X SDHCI device
Note None documented


function PL18XGetVersionData(SDHCI:PPL18XSDHCIHost):PPL18XVersionData;
Description: Return the version data for a PL18X SDHCI device based on the Peripheral Id
Note None documented


function PL18XGetRXFIFOCount(SDHCI:PPL18XSDHCIHost; Status,Remain:LongWord):LongWord;
Description: Determine the receive FIFO count available
Note None documented


function PL18XQualcommGetRXFIFOCount(SDHCI:PPL18XSDHCIHost; Status,Remain:LongWord):LongWord;
Description: Determine the receive FIFO count available
Note None documented


procedure PL18XRegisterDelay(SDHCI:PPL18XSDHCIHost);
Description: Delay for the required amount of time after a register write
Note None documented


procedure PL18XSetClockRegister(SDHCI:PPL18XSDHCIHost; MMC:PMMCDevice; Desired:LongWord);
Description: Setup the current clock rate in the clock register
Note Caller must hold the host lock


procedure PL18XSetPowerRegister(SDHCI:PPL18XSDHCIHost; Value:LongWord);
Description: Setup the current power state in the power register
Note Caller must hold the host lock


procedure PL18XSetInterruptMask1(SDHCI:PPL18XSDHCIHost; Mask:LongWord);
Description: Setup the interrupt mask to use either Mask0 or Mask1 depending on configuration
Note Caller must hold the host lock


procedure PL18XWriteClockRegister(SDHCI:PPL18XSDHCIHost; Clock:LongWord);
Description: Write to the clock register
Note Caller must hold the host lock


procedure PL18XWritePowerRegister(SDHCI:PPL18XSDHCIHost; Power:LongWord);
Description: Write to the power register
Note Caller must hold the host lock


procedure PL18XWriteDataCtrlRegister(SDHCI:PPL18XSDHCIHost; DataCtrl:LongWord);
Description: Write to the data control register
Note Caller must hold the host lock


Return to Unit Reference