Unit MMC

From Ultibo.org
Revision as of 04:45, 20 April 2018 by Ultibo (Talk | contribs)

Jump to: navigation, search

Return to Unit Reference


Description


Ultibo MMC/SD interface unit

This unit implements the standards based part of the SD/MMC specification including the standard SDHCI interfaces.

For each platform a SDHCI module needs to be provided that implements the platform specific parts of the SDHCI interface.

This is similar in model to USB and other interfaces in Ultibo, where the generic interface unit requires a platform specific module to register with it in order to communicate with platform specific devices.

The SD/MMC interfaces are 2 tier (ie Host and Device) whereas the USB interface is 3 tier (Host, Device and Driver).

Constants



[Expand]
MMC specific constants MMC_*


[Expand]
MMC device type MMC_TYPE_*


[Expand]
MMC device state MMC_STATE_*


[Expand]
MMC device flag MMC_FLAG_*


[Expand]
MMC/SD status code MMC_STATUS_*


[Expand]
MMC/SD version SD_VERSION_*, MMC_VERSION_*


[Expand]
MMC/SD mode MMC_MODE_*


[Expand]
MMC/SD capabilities MMC_CAP_*


[Expand]
MMC/SD direction MMC_DATA_*


[Expand]
MMC/SD bus width MMC_BUS_WIDTH_*


[Expand]
MMC bus speed (Hz) MMC_BUS_SPEED_*


[Expand]
MMC/SD timing MMC_TIMING_*


[Expand]
MMC command MMC_CMD_*


[Expand]
MMC response type MMC_RSP_*


[Expand]
MMC response value MMC_RSP_R1_*, MMC_RSP_R2_*


[Expand]
MMC operation condition register (OCR) value MMC_OCR_*


[Expand]
MMC card status register (CSR) value MMC_CARD_STATUS_*


[Expand]
MMC current state value MMC_CURRENT_STATE_*


[Expand]
MMC card identification data (CID) value MMC_CID_*


[Expand]
MMC card specific data (CSD) value MMC_CSD_*


[Expand]
MMC CSD structure value MMC_CSD_STRUCT_*


[Expand]
MMC CSD spec version value MMC_CSD_SPEC_VER_*


[Expand]
MMC CSD TAAC time unit MMC_CSD_TAAC_UNITS*


[Expand]
MMC CSD TAAC time value MMC_CSD_TAAC_VALUES*


[Expand]
MMC CSD card command class (CCC) value MMC_CCC_*


[Expand]
MMC CSD transfer speed rate unit MMC_CSD_TRAN_SPEED_UNITS*


[Expand]
MMC CSD transfer speed time value MMC_CSD_TRAN_SPEED_VALUES*


[Expand]
MMC voltage value MMC_VDD_*


[Expand]
MMC switch mode value MMC_SWITCH_MODE_*


[Expand]
MMC EXT_CSD field EXT_CSD_*


[Expand]
MMC EXT_CSD field definition EXT_CSD_*


[Expand]
MMC miscellaneous MMCPART_*, MMC_MAX_*


[Expand]
MMC logging MMC_LOG_*


[Expand]
SD specific constants SD_*


[Expand]
SD bus width SD_BUS_WIDTH_*


[Expand]
SD bus speed (Hz) SD_BUS_SPEED_*


[Expand]
SD command SD_CMD_*


[Expand]
SD switch mode value SD_SWITCH_MODE_*


[Expand]
SD switch function group SD_SWITCH_FUNCTION_GROUP_*


[Expand]
SD switch access mode SD_SWITCH_ACCESS_MODE_*


[Expand]
SD switch command system SD_SWITCH_COMMAND_SYSTEM_*


[Expand]
SD switch driver strength SD_SWITCH_DRIVER_STRENGTH_*


[Expand]
SD switch power limit SD_SWITCH_POWER_LIMIT_*


[Expand]
SD send interface condition value SD_SEND_IF_COND_*


[Expand]
SD send operation condition value SD_SEND_OP_COND_*


[Expand]
SD operation condition register value SD_OCR_*


[Expand]
SD CSD structure value SD_CSD_STRUCT_*


[Expand]
SD status register (SSR) value SD_SSR_*


[Expand]
SD SSR bus width value SD_SSR_BUS_WIDTH_*


[Expand]
SD SSR card type value SD_SSR_CARD_TYPE_*


[Expand]
SD SSR speed class value SD_SSR_SPEED_CLASS_*


[Expand]
SD SSR AU size value SD_SSR_AU_SIZE_*


[Expand]
SD SSR UHS speed grade value SD_SSR_UHS_SPEED_*


[Expand]
SD SSR UHS AU size value SD_SSR_UHS_AU_SIZE_*


[Expand]
SD switch status value SD_SWITCH_*


[Expand]
SD configuration register (SCR) value SD_SCR_*


[Expand]
SD SCR structure value SD_SCR_STRUCT_*


[Expand]
SD SCR spec version value SD_SCR_SPEC_VER_*


[Expand]
SD SCR security value SD_SCR_SECURITY_*


[Expand]
SD SCR bus width value SD_SCR_BUS_WIDTH_*


[Expand]
SD SCR extended security value SD_SCR_EX_SECURITY_*


[Expand]
SD SCR command support value SD_SCR_*_SUPPORT


[Expand]
SDIO command SDIO_CMD_*


[Expand]
SDIO response value SDIO_RSP_*


[Expand]
SDIO card common control registers (CCCR) SDIO_CCCR_*


[Expand]
SDIO revision SDIO_*_REV_*


[Expand]
SDIO bus width SDIO_BUS_*


[Expand]
SDIO CCCR caps register value SDIO_CCCR_CAP_*


[Expand]
SDIO CCCR power register value SDIO_POWER_*


[Expand]
SDIO CCCR speed register value SDIO_SPEED_*


[Expand]
SDIO CCCR UHS register value SDIO_UHS_*


[Expand]
SDIO CCCR drive strength register value SDIO_DRIVE_*


[Expand]
SDIO function basic register (FBR) SDIO_FBR_*


[Expand]
SDHCI specific constants SDHCI_*


[Expand]
SDHCI host type SDHCI_TYPE_*


[Expand]
SDHCI host state SDHCI_STATE_*


[Expand]
SDHCI host flag SDHCI_FLAG_*


[Expand]
SDHCI controller register SDHCI_DMA_*, SDHCI_BLOCK_*


[Expand]
SDHCI transfer mode SDHCI_TRNS_*


[Expand]
SDHCI command value SDHCI_CMD_*


[Expand]
SDHCI command response value SDHCI_CMD_RESP_*


[Expand]
SDHCI present state value SDHCI_DATA_*, SDHCI_CARD_*


[Expand]
SDHCI host control value SDHCI_CTRL_*


[Expand]
SDHCI power control value SDHCI_POWER_*


[Expand]
SDHCI wakeup control value SDHCI_WAKE_*


[Expand]
SDHCI clock control value SDHCI_CLOCK_*


[Expand]
SDHCI software reset value SDHCI_RESET_*


[Expand]
SDHCI interrupt value SDHCI_INT_*


[Expand]
SDHCI capabilities value SDHCI_*_MASK*, SDHCI_*SHIFT


[Expand]
SDHCI host version value SDHCI_*_VER_*


[Expand]
SDHCI clock divider SDHCI_MAX_CLOCK_DIV_*


[Expand]
SDHCI quirks/bug SDHCI_QUIRK*


[Expand]
SDHCI host SDMA buffer boundary SDHCI_DEFAULT_BOUNDARY_*


[Expand]
SDHCI timeout value SDHCI_TIMEOUT_VALUE*


Type definitions



MMC command

[Expand]

PMMCCommand = ^TMMCCommand;

TMMCCommand = record

MMC data

[Expand]

PMMCData = ^TMMCData;

TMMCData = record

MMC card identification data (CID)

[Expand]

PMMCCardIdentificationData = ^TMMCCardIdentificationData;

TMMCCardIdentificationData = record

MMC card specific erase data (CSD)

[Expand]

TMMCCardSpecificSDEraseData = record

MMC card specific MMC22 erase data

[Expand]

TMMCCardSpecificMMC22EraseData = record

MMC card specific MMC31 erase data

[Expand]

TMMCCardSpecificMMC31EraseData = record

MMC card specific erase data

[Expand]

TMMCCardSpecificEraseData = record

MMC card specific data

[Expand]

PMMCCardSpecificData = ^TMMCCardSpecificData;

TMMCCardSpecificData = record

SD status data (SSR)

[Expand]

PSDStatusData = ^TSDStatusData;

TSDStatusData = record

SD switch data

[Expand]

PSDSwitchData = ^TSDSwitchData;

TSDSwitchData = record

SD configuration data (SCR)

[Expand]

PSDConfigurationData = ^TSDConfigurationData;

TSDConfigurationData = record

MMC enumeration callback

TMMCEnumerate = function(MMC:PMMCDevice; Data:Pointer):LongWord;

MMC notification callback

TMMCNotification = function(Device:PDevice; Data:Pointer; Notification:LongWord):LongWord;

MMC device initialize

TMMCDeviceInitialize = function(MMC:PMMCDevice):LongWord;

MMC device deinitialize

TMMCDeviceDeinitialize = function(MMC:PMMCDevice):LongWord;

MMC device get card detect

TMMCDeviceGetCardDetect = function(MMC:PMMCDevice):LongWord;

MMC device get write protect

TMMCDeviceGetWriteProtect = function(MMC:PMMCDevice):LongWord;

MMC device send command

TMMCDeviceSendCommand = function(MMC:PMMCDevice; Command:PMMCCommand):LongWord;

MMC device set IOS

TMMCDeviceSetIOS = function(MMC:PMMCDevice):LongWord;

MMC device types

[Expand]

PMMCDevice = ^TMMCDevice;

TMMCDevice = record

SDHCI enumeration callback

TSDHCIEnumerate = function(SDHCI:PSDHCIHost; Data:Pointer):LongWord;

SDHCI notification callback

TSDHCINotification = function(Device:PDevice; Data:Pointer; Notification:LongWord):LongWord;

SDHCI host start

TSDHCIHostStart = function(SDHCI:PSDHCIHost):LongWord;

SDHCI host stop

TSDHCIHostStop = function(SDHCI:PSDHCIHost):LongWord;

SDHCI host read byte

TSDHCIHostReadByte = function(SDHCI:PSDHCIHost; Reg:LongWord):Byte;

SDHCI host read word

TSDHCIHostReadWord = function(SDHCI:PSDHCIHost; Reg:LongWord):Word;

SDHCI host read long

TSDHCIHostReadLong = function(SDHCI:PSDHCIHost; Reg:LongWord):LongWord;

SDHCI host write byte

TSDHCIHostWriteByte = procedure(SDHCI:PSDHCIHost; Reg:LongWord; Value:Byte);

SDHCI host write word

TSDHCIHostWriteWord = procedure(SDHCI:PSDHCIHost; Reg:LongWord; Value:Word);

SDHCI host write long

TSDHCIHostWriteLong = procedure(SDHCI:PSDHCIHost; Reg:LongWord; Value:LongWord);

SDHCI host set clock divider

TSDHCIHostSetClockDivider = function(SDHCI:PSDHCIHost; Index:Integer; Divider:LongWord):LongWord;

SDHCI host set control register

TSDHCIHostSetControlRegister = function(SDHCI:PSDHCIHost):LongWord;

SDHCI host types

[Expand]

PSDHCIHost = ^TSDHCIHost;

TSDHCIHost = record


Public variables



MMC logging

MMC_DEFAULT_LOG_LEVEL:LongWord = MMC_LOG_LEVEL_DEBUG; Minimum level for MMC messages. Only messages with level greater than or equal to this will be printed.
MMC_LOG_ENABLED:Boolean;


Function declarations



Initialization functions

[Expand]
procedure MMCInit;
Description: To be documented


[Expand]
function MMCStart:LongWord;
Description: To be documented


[Expand]
function MMCStop:LongWord;
Description: To be documented


[Expand]
procedure MMCAsyncStart(SDHCI:PSDHCIHost);
Description: To be documented


MMC functions

[Expand]
function MMCDeviceReadBlocks(MMC:PMMCDevice; const Start,Count:Int64; Buffer:Pointer):LongWord;
Description: To be documented


[Expand]
function MMCDeviceWriteBlocks(MMC:PMMCDevice; const Start,Count:Int64; Buffer:Pointer):LongWord;
Description: To be documented


[Expand]
function MMCDeviceEraseBlocks(MMC:PMMCDevice; const Start,Count:Int64):LongWord;
Description: To be documented


[Expand]
function MMCDeviceGoIdle(MMC:PMMCDevice):LongWord;
Description: To be documented


[Expand]
function MMCDeviceSetClock(MMC:PMMCDevice; Clock:LongWord):LongWord;
Description: To be documented


[Expand]
function MMCDeviceSetBusWidth(MMC:PMMCDevice; Width:LongWord):LongWord;
Description: To be documented


[Expand]
function MMCDeviceSetBlockLength(MMC:PMMCDevice; Length:LongWord):LongWord;
Description: To be documented


[Expand]
function MMCDeviceSetBlockCount(MMC:PMMCDevice; Count:LongWord; Relative:Boolean):LongWord;
Description: To be documented


[Expand]
function MMCDeviceSetDriverStage(MMC:PMMCDevice; DriverStage:LongWord):LongWord;
Description: To be documented


[Expand]
function MMCDeviceStopTransmission(MMC:PMMCDevice):LongWord;
Description: To be documented


[Expand]
function MMCDeviceSelectCard(MMC:PMMCDevice):LongWord;
Description: To be documented


[Expand]
function MMCDeviceDeselectCard(MMC:PMMCDevice):LongWord;
Description: To be documented


[Expand]
function MMCDeviceSwitch(MMC:PMMCDevice; Setting,Index,Value:Byte):LongWord;
Description: To be documented


[Expand]
function MMCDeviceSendCardStatus(MMC:PMMCDevice):LongWord;
Description: To be documented


[Expand]
function MMCDeviceSendOperationCondition(MMC:PMMCDevice; Probe:Boolean):LongWord;
Description: To be documented


[Expand]
function MMCDeviceSendCardSpecific(MMC:PMMCDevice):LongWord;
Description: To be documented


[Expand]
function MMCDeviceDecodeCardSpecific(MMC:PMMCDevice):LongWord;
Description: Given a 128-bit response, decode to our card CSD structure


[Expand]
function MMCDeviceSendCardIdentification(MMC:PMMCDevice):LongWord;
Description: To be documented


[Expand]
function MMCDeviceSendAllCardIdentification(MMC:PMMCDevice):LongWord;
Description: To be documented


[Expand]
function MMCDeviceDecodeCardIdentification(MMC:PMMCDevice):LongWord;
Description: Given a 128-bit response, decode to our card CID structure


[Expand]
function MMCDeviceGetExtendedCardSpecific(MMC:PMMCDevice):LongWord;
Description: To be documented


[Expand]
function MMCDeviceSendExtendedCardSpecific(MMC:PMMCDevice):LongWord;
Description: To be documented


[Expand]
function MMCDeviceDecodeExtendedCardSpecific(MMC:PMMCDevice):LongWord;
Description: To be documented


[Expand]
function MMCDeviceSetRelativeAddress(MMC:PMMCDevice):LongWord;
Description: To be documented


[Expand]
function MMCDeviceSPISetCRC(MMC:PMMCDevice; Enable:Boolean):LongWord;
Description: To be documented


[Expand]
function MMCDeviceSPIReadOperationCondition(MMC:PMMCDevice; HighCapacity:Boolean):LongWord;
Description: To be documented


[Expand]
function MMCDeviceInsert(MMC:PMMCDevice):LongWord;
Description: To be documented


[Expand]
function MMCDeviceRemove(MMC:PMMCDevice):LongWord;
Description: To be documented


[Expand]
function MMCDeviceInitialize(MMC:PMMCDevice):LongWord;
Description: To be documented


[Expand]
function MMCDeviceDeinitialize(MMC:PMMCDevice):LongWord;
Description: To be documented


[Expand]
function MMCDeviceGetCardDetect(MMC:PMMCDevice):LongWord;
Description: To be documented


[Expand]
function MMCDeviceGetWriteProtect(MMC:PMMCDevice):LongWord;
Description: To be documented


[Expand]
function MMCDeviceSendCommand(MMC:PMMCDevice; Command:PMMCCommand):LongWord;
Description: To be documented


[Expand]
function MMCDeviceSetIOS(MMC:PMMCDevice):LongWord;
Description: To be documented


[Expand]
function MMCDeviceCreate:PMMCDevice;
Description: Create a new MMC entry


[Expand]
function MMCDeviceCreateEx(Size:LongWord):PMMCDevice;
Description: Create a new MMC entry


[Expand]
function MMCDeviceDestroy(MMC:PMMCDevice):LongWord;
Description: Destroy an existing MMC entry


[Expand]
function MMCDeviceRegister(MMC:PMMCDevice):LongWord;
Description: Register a new MMC in the MMC table


[Expand]
function MMCDeviceDeregister(MMC:PMMCDevice):LongWord;
Description: Deregister a MMC from the MMC table


[Expand]
function MMCDeviceFind(MMCId:LongWord):PMMCDevice;
Description: To be documented


[Expand]
function MMCDeviceFindByDevice(Device:PDevice):PMMCDevice;
Description: Find an MMC/SD device by the matching DeviceData property


[Expand]
function MMCDeviceFindByName(const Name:String):PMMCDevice; inline;
Description: To be documented


[Expand]
function MMCDeviceFindByDescription(const Description:String):PMMCDevice; inline;
Description: To be documented


[Expand]
function MMCDeviceEnumerate(Callback:TMMCEnumerate; Data:Pointer):LongWord;
Description: To be documented


[Expand]
function MMCDeviceNotification(MMC:PMMCDevice; Callback:TMMCNotification; Data:Pointer; Notification,Flags:LongWord):LongWord;
Description: To be documented


SD functions

[Expand]
function SDDeviceSwitch(MMC:PMMCDevice; Mode,Group:Integer; Value:Byte; Buffer:Pointer):LongWord;
Description: To be documented


[Expand]
function SDDeviceSwitchHighspeed(MMC:PMMCDevice):LongWord;
Description: To be documented


[Expand]
function SDDeviceSetBusSpeed(MMC:PMMCDevice; Speed:LongWord):LongWord;
Description: To be documented


[Expand]
function SDDeviceSetBusWidth(MMC:PMMCDevice; Width:LongWord):LongWord;
Description: To be documented


[Expand]
function SDDeviceSendInterfaceCondition(MMC:PMMCDevice):LongWord;
Description: To be documented


[Expand]
function SDDeviceSendOperationCondition(MMC:PMMCDevice; Probe:Boolean):LongWord;
Description: To be documented


[Expand]
function SDDeviceGetCardSpecific(MMC:PMMCDevice):LongWord;
Description: To be documented


[Expand]
function SDDeviceDecodeCardSpecific(MMC:PMMCDevice):LongWord;
Description: Given a 128-bit response, decode to our card CSD structure


[Expand]
function SDDeviceGetCardIdentification(MMC:PMMCDevice):LongWord;
Description: To be documented


[Expand]
function SDDeviceDecodeCardIdentification(MMC:PMMCDevice):LongWord;
Description: Given a 128-bit response, decode to our card CID structure


[Expand]
function SDDeviceSendSDStatus(MMC:PMMCDevice):LongWord;
Description: To be documented


[Expand]
function SDDeviceDecodeSDStatus(MMC:PMMCDevice):LongWord;
Description: To be documented


[Expand]
function SDDeviceSendSDSwitch(MMC:PMMCDevice):LongWord;
Description: To be documented


[Expand]
function SDDeviceDecodeSDSwitch(MMC:PMMCDevice):LongWord;
Description: To be documented


[Expand]
function SDDeviceSendSDConfiguration(MMC:PMMCDevice):LongWord;
Description: To be documented


[Expand]
function SDDeviceDecodeSDConfiguration(MMC:PMMCDevice):LongWord;
Description: Given a 64-bit response, decode to our card SCR structure


[Expand]
function SDDeviceSendRelativeAddress(MMC:PMMCDevice):LongWord;
Description: To be documented


[Expand]
function SDDeviceSendApplicationCommand(MMC:PMMCDevice; Command:PMMCCommand):LongWord;
Description: To be documented


SDIO functions

[Expand]
function SDIODeviceReset(MMC:PMMCDevice):LongWord;
Description: To be documented


[Expand]
function SDIODeviceSendOperationCondition(MMC:PMMCDevice; Probe:Boolean):LongWord;
Description: To be documented


[Expand]
function SDIODeviceReadWriteDirect(MMC:PMMCDevice; Write:Boolean; Operation,Address:LongWord; Input:Byte; Output:PByte):LongWord;
Description: To be documented


[Expand]
function SDIODeviceReadWriteExtended(MMC:PMMCDevice; Write:Boolean; Operation,Address:LongWord; Increment:Boolean; Buffer:Pointer; BlockCount,BlockSize:LongWord):LongWord;
Description: To be documented


SDHCI functions

[Expand]
function SDHCIHostReset(SDHCI:PSDHCIHost; Mask:Byte):LongWord;
Description: To be documented


[Expand]
function SDHCIHostSetPower(SDHCI:PSDHCIHost; Power:Word):LongWord;
Description: To be documented


[Expand]
function SDHCIHostSetClock(SDHCI:PSDHCIHost; Clock:LongWord):LongWord;
Description: To be documented


[Expand]
function SDHCIHostTransferPIO(SDHCI:PSDHCIHost):LongWord;
Description: To be documented


[Expand]
function SDHCIHostTransferDMA(SDHCI:PSDHCIHost):LongWord;
Description: To be documented


[Expand]
function SDHCIHostFinishCommand(SDHCI:PSDHCIHost):LongWord;
Description: Called by Interrupt Command handler when an SDHCI_INT_RESPONSE is received


[Expand]
function SDHCIHostFinishData(SDHCI:PSDHCIHost):LongWord;
Description: Called by Interrupt Data handler when data is received


[Expand]
function SDHCIHostCommandInterrupt(SDHCI:PSDHCIHost; InterruptMask:LongWord; var ReturnMask:LongWord):LongWord;
Description: To be documented


[Expand]
function SDHCIHostDataInterrupt(SDHCI:PSDHCIHost; InterruptMask:LongWord):LongWord;
Description: To be documented


[Expand]
function SDHCIHostStart(SDHCI:PSDHCIHost):LongWord;
Description: To be documented


[Expand]
function SDHCIHostStop(SDHCI:PSDHCIHost):LongWord;
Description: To be documented


[Expand]
function SDHCIHostReadByte(SDHCI:PSDHCIHost; Reg:LongWord):Byte; inline;
Description: To be documented


[Expand]
function SDHCIHostReadWord(SDHCI:PSDHCIHost; Reg:LongWord):Word; inline;
Description: To be documented


[Expand]
function SDHCIHostReadLong(SDHCI:PSDHCIHost; Reg:LongWord):LongWord; inline;
Description: To be documented


[Expand]
procedure SDHCIHostWriteByte(SDHCI:PSDHCIHost; Reg:LongWord; Value:Byte); inline;
Description: To be documented


[Expand]
procedure SDHCIHostWriteWord(SDHCI:PSDHCIHost; Reg:LongWord; Value:Word); inline;
Description: To be documented


[Expand]
procedure SDHCIHostWriteLong(SDHCI:PSDHCIHost; Reg:LongWord; Value:LongWord); inline;
Description: To be documented


[Expand]
function SDHCIHostSetClockDivider(SDHCI:PSDHCIHost; Index:Integer; Divider:LongWord):LongWord;
Description: To be documented


[Expand]
function SDHCIHostSetControlRegister(SDHCI:PSDHCIHost):LongWord;
Description: To be documented


[Expand]
function SDHCIHostCreate:PSDHCIHost;
Description: Create a new SDHCI entry


[Expand]
function SDHCIHostCreateEx(Size:LongWord):PSDHCIHost;
Description: Create a new SDHCI entry


[Expand]
function SDHCIHostDestroy(SDHCI:PSDHCIHost):LongWord;
Description: Destroy an existing SDHCI entry


[Expand]
function SDHCIHostRegister(SDHCI:PSDHCIHost):LongWord;
Description: Register a new SDHCI in the SDHCI table


[Expand]
function SDHCIHostDeregister(SDHCI:PSDHCIHost):LongWord;
Description: Deregister a SDHCI from the SDHCI table


[Expand]
function SDHCIHostFind(SDHCIId:LongWord):PSDHCIHost;
Description: To be documented


[Expand]
function SDHCIHostEnumerate(Callback:TSDHCIEnumerate; Data:Pointer):LongWord;
Description: To be documented


[Expand]
function SDHCIHostNotification(SDHCI:PSDHCIHost; Callback:TSDHCINotification; Data:Pointer; Notification,Flags:LongWord):LongWord;
Description: To be documented


MMC helper functions

[Expand]
function MMCGetCount:LongWord; inline;
Description: Get the current MMC count


[Expand]
function MMCDeviceCheck(MMC:PMMCDevice):PMMCDevice;
Description: Check if the supplied MMC is in the MMC table


[Expand]
function MMCIsSD(MMC:PMMCDevice):Boolean;
Description: To be documented


[Expand]
function MMCGetCIDValue(MMC:PMMCDevice; Version,Value:LongWord):LongWord;
Description: Extract a CID field value from the 128 bit Card Identification register


[Expand]
function MMCGetCSDValue(MMC:PMMCDevice; Value:LongWord):LongWord;
Description: Extract a CSD field value from the 128 bit Card Specific register


[Expand]
function MMCGetExtendedCSDValue(MMC:PMMCDevice; Value:LongWord):LongWord;
Description: Extract an Extended CSD field value from the 512 byte Extended Card Specific register


[Expand]
function MMCExtractBits(Buffer:Pointer; Start,Size:LongWord):LongWord;
Description: To be documented


[Expand]
function MMCExtractBitsEx(Buffer:Pointer; Length,Start,Size:LongWord):LongWord;
Description: To be documented


[Expand]
function MMCIsMultiCommand(Command:Word):Boolean;
Description: To be documented


[Expand]
function MMCStatusToString(Status:LongWord):String;
Description: Translates an MMC status code into a string describing it


[Expand]
function MMCDeviceTypeToString(MMCType:LongWord):String;
Description: To be documented


[Expand]
function MMCDeviceStateToString(MMCState:LongWord):String;
Description: To be documented


[Expand]
procedure MMCLog(Level:LongWord; MMC:PMMCDevice; const AText:String);
Description: To be documented


[Expand]
procedure MMCLogInfo(MMC:PMMCDevice; const AText:String); inline;
Description: To be documented


[Expand]
procedure MMCLogWarn(MMC:PMMCDevice; const AText:String); inline;
Description: To be documented


[Expand]
procedure MMCLogError(MMC:PMMCDevice; const AText:String); inline;
Description: To be documented


[Expand]
procedure MMCLogDebug(MMC:PMMCDevice; const AText:String); inline;
Description: To be documented


SD helper functions

[Expand]
function SDGetMaxClock(MMC:PMMCDevice):LongWord;
Description: Determine the Maximum Clock (DTR) for the current card


[Expand]
function SDGetCIDValue(MMC:PMMCDevice; Value:LongWord):LongWord;
Description: Extract a CID field value from the 128 bit Card Identification register


[Expand]
function SDGetCSDValue(MMC:PMMCDevice; Version,Value:LongWord):LongWord;
Description: Extract a CSD field value from the 128 bit Card Specific register


[Expand]
function SDGetSCRValue(MMC:PMMCDevice; Value:LongWord):LongWord;
Description: Extract an SCR field value from the 64 bit SD Configuration register


[Expand]
function SDGetSSRValue(MMC:PMMCDevice; Value:LongWord):LongWord;
Description: Extract an SCR field value from the 512 bit SD Status register


[Expand]
function SDGetSwitchValue(MMC:PMMCDevice; Value:LongWord):LongWord;
Description: Extract a Switch field value from the 512 bit SD Switch status


SDHCI helper functions

[Expand]
function SDHCIGetCount:LongWord; inline;
Description: Get the current SDHCI count


[Expand]
function SDHCIHostCheck(SDHCI:PSDHCIHost):PSDHCIHost;
Description: Check if the supplied SDHCI is in the SDHCI table


[Expand]
function SDHCIIsSPI(SDHCI:PSDHCIHost):Boolean;
Description: To be documented


[Expand]
function SDHCIGetVersion(SDHCI:PSDHCIHost):Word;
Description: To be documented


[Expand]
function SDHCIGetCommand(Command:Word):Word;
Description: To be documented


[Expand]
function SDHCIMakeCommand(Command,Flags:Word):Word;
Description: To be documented


[Expand]
function SDHCIMakeBlockSize(DMA,BlockSize:Word):Word;
Description: To be documented


[Expand]
function SDHCIDeviceTypeToString(SDHCIType:LongWord):String;
Description: To be documented


[Expand]
function SDHCIDeviceStateToString(SDHCIState:LongWord):String;
Description: To be documented


MMC storage functions

[Expand]
function MMCStorageDeviceRead(Storage:PStorageDevice; const Start,Count:Int64; Buffer:Pointer):LongWord;
Description: To be documented


[Expand]
function MMCStorageDeviceWrite(Storage:PStorageDevice; const Start,Count:Int64; Buffer:Pointer):LongWord;
Description: To be documented


[Expand]
function MMCStorageDeviceErase(Storage:PStorageDevice; const Start,Count:Int64):LongWord;
Description: To be documented


[Expand]
function MMCStorageDeviceControl(Storage:PStorageDevice; Request:Integer; Argument1:LongWord; var Argument2:LongWord):LongWord;
Description: To be documented


Return to Unit Reference