Unit PL18X

From Ultibo.org
Revision as of 04:57, 13 June 2017 by Ultibo (Talk | contribs)

Jump to: navigation, search

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


To be documented


Return to Unit Reference