Difference between revisions of "Unit MMC"
Line 3,733: | Line 3,733: | ||
---- | ---- | ||
− | '' | + | |
+ | '''MMC command''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PMMCCommand = ^TMMCCommand;</code> | ||
+ | |||
+ | <code>TMMCCommand = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|''Command Properties'' | ||
+ | |- | ||
+ | | <code>Command:Word;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>Argument:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>ResponseType:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>Response:array[0..3] of LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>Status:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>Data:PMMCData;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|''Host Properties'' | ||
+ | |- | ||
+ | | <code>DataCompleted:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>BusyCompleted:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>TuningCompleted:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>CommandCompleted:Boolean;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''MMC data''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PMMCData = ^TMMCData;</code> | ||
+ | |||
+ | <code>TMMCData = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|''Data Properties'' | ||
+ | |- | ||
+ | | <code>Data:Pointer;</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>Flags:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>BlockSize:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>BlockCount:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|''Host Properties'' | ||
+ | |- | ||
+ | | <code>BlockOffset:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>BlocksRemaining:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>BytesTransfered:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''MMC card identification data (CID)''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PMMCCardIdentificationData = ^TMMCCardIdentificationData;</code> | ||
+ | |||
+ | <code>TMMCCardIdentificationData = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|Note: See: Section 5.2 of SD Physical Layer Simplified Specification Version 4.10 | ||
+ | |- | ||
+ | | <code>ManufacturerId:Byte;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>OEMId:Word;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>ProductName:array[0..7] of Char;</code> | ||
+ | | Max 0 to 6, 1 extra for null terminator | ||
+ | |- | ||
+ | | <code>ProductRevision:Byte;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>HardwareRevision:Byte;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>FirmwareRevision:Byte;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>ProductSerialNumber:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>ManufacturingMonth:Byte;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>ManufacturingYear:Word;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>CRC:Byte;</code> | ||
+ | | CRC7 checksum | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''MMC card specific erase data (CSD)''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | |||
+ | <code>TMMCCardSpecificSDEraseData = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|Note: See: Section 5.3 of SD Physical Layer Simplified Specification Version 4.10 (Defined here for CSD) | ||
+ | |- | ||
+ | | <code>EraseBlockEnable:Boolean;</code> | ||
+ | | Erase single block enable | ||
+ | |- | ||
+ | | <code>SectorSize:Byte;</code> | ||
+ | | Erase sector size | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''MMC card specific MMC22 erase data''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | |||
+ | <code>TMMCCardSpecificMMC22EraseData = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>SectorSize:Byte;</code> | ||
+ | | Erase sector size | ||
+ | |- | ||
+ | | <code>EraseGroupSize:Byte;</code> | ||
+ | | Erase group size | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''MMC card specific MMC31 erase data''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | |||
+ | <code>TMMCCardSpecificMMC31EraseData = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>EraseGroupSize:Byte;</code> | ||
+ | | Erase group size | ||
+ | |- | ||
+ | | <code>EraseGroupMultiplier:Byte;</code> | ||
+ | | Erase group size multiplier | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''MMC card specific erase data''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | |||
+ | <code>TMMCCardSpecificEraseData = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | | <code>case Integer of</code> | ||
+ | | style="width: 50%;"| | ||
+ | |- | ||
+ | | <code>0:(MMC22:TMMCCardSpecificMMC22EraseData);</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>1:(MMC31:TMMCCardSpecificMMC31EraseData);</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>2:(SD:TMMCCardSpecificSDEraseData);</code> | ||
+ | | | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''MMC card specific data''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PMMCCardSpecificData = ^TMMCCardSpecificData;</code> | ||
+ | |||
+ | <code>TMMCCardSpecificData = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|''Card Values'' | ||
+ | |- | ||
+ | | <code>CSDStructure:Byte;</code> | ||
+ | | CSD structure version | ||
+ | |- | ||
+ | | <code>SpecVersion:Byte;</code> | ||
+ | | System specification version (MMC/eMMC Only) | ||
+ | |- | ||
+ | | <code>TAAC:Byte;</code> | ||
+ | | Data read access-time-1 | ||
+ | |- | ||
+ | | <code>NSAC:Byte;</code> | ||
+ | | Data read access-time-2 in CLK cycles (NSAC*100) | ||
+ | |- | ||
+ | | <code>TransferSpeed:Byte;</code> | ||
+ | | Max. data transfer rate | ||
+ | |- | ||
+ | | <code>CCC:Word;</code> | ||
+ | | Card command classes | ||
+ | |- | ||
+ | | <code>ReadBlockLength:Byte;</code> | ||
+ | | Max. read data block length | ||
+ | |- | ||
+ | | <code>ReadBlockPartial:Boolean;</code> | ||
+ | | Partial blocks for read allowed | ||
+ | |- | ||
+ | | <code>WriteBlockMisalign:Boolean;</code> | ||
+ | | Write block misalignment | ||
+ | |- | ||
+ | | <code>ReadBlockMisalign:Boolean;</code> | ||
+ | | Read block misalignment | ||
+ | |- | ||
+ | | <code>DSRImplemented:Boolean;</code> | ||
+ | | DSR implemented | ||
+ | |- | ||
+ | | <code>DeviceSize:Word;</code> | ||
+ | | Device size | ||
+ | |- | ||
+ | | <code>VDDReadCurrentMin:Byte;</code> | ||
+ | | Max. read current @VDD min | ||
+ | |- | ||
+ | | <code>VDDReadCurrentMax:Byte;</code> | ||
+ | | Max. read current @VDD max | ||
+ | |- | ||
+ | | <code>VDDWriteCurrentMin:Byte;</code> | ||
+ | | Max. write current @VDD min | ||
+ | |- | ||
+ | | <code>VDDWriteCurrentMax:Byte;</code> | ||
+ | | Max. write current @VDD max | ||
+ | |- | ||
+ | | <code>DeviceSizeMultiplier:Byte;</code> | ||
+ | | Device size multiplier | ||
+ | |- | ||
+ | | <code>Erase:TMMCCardSpecificEraseData;</code> | ||
+ | | Erase group details | ||
+ | |- | ||
+ | | <code>WriteProtectGroupSize:Byte;</code> | ||
+ | | Write protect group size | ||
+ | |- | ||
+ | | <code>WriteProtectGroupEnable:Boolean;</code> | ||
+ | | Write protect group enable | ||
+ | |- | ||
+ | | <code>DefaultECC:Byte;</code> | ||
+ | | Manufacturer default ECC (MMC/eMMC Only) | ||
+ | |- | ||
+ | | <code>ReadToWriteFactor:Byte;</code> | ||
+ | | Write speed factor | ||
+ | |- | ||
+ | | <code>WriteBlockLength:Byte;</code> | ||
+ | | Max. write data block length | ||
+ | |- | ||
+ | | <code>WriteBlockPartial:Boolean;</code> | ||
+ | | Partial blocks for write allowed | ||
+ | |- | ||
+ | | <code>ContentProtectApplication:Boolean;</code> | ||
+ | | Content protection application (MMC/eMMC Only) | ||
+ | |- | ||
+ | | <code>FileFormatGroup:Byte;</code> | ||
+ | | File format group | ||
+ | |- | ||
+ | | <code>CopyFlag:Boolean;</code> | ||
+ | | Copy flag | ||
+ | |- | ||
+ | | <code>PermanentWriteProtect:Boolean;</code> | ||
+ | | Permanent write protection | ||
+ | |- | ||
+ | | <code>TemporaryWriteProtect:Boolean;</code> | ||
+ | | Temporary write protection | ||
+ | |- | ||
+ | | <code>FileFormat:Byte;</code> | ||
+ | | File format | ||
+ | |- | ||
+ | | <code>ECC:Byte;</code> | ||
+ | | ECC code (MMC/eMMC Only) | ||
+ | |- | ||
+ | | <code>CRC:Byte;</code> | ||
+ | | CRC | ||
+ | |- | ||
+ | |colspan="2"|''Calculated Values'' | ||
+ | |- | ||
+ | | <code>DataAccessTime:LongWord;</code> | ||
+ | | In Nanoseconds | ||
+ | |- | ||
+ | | <code>DataAccessClocks:Word;</code> | ||
+ | | In Clock cycles | ||
+ | |- | ||
+ | | <code>DataTransferRate:LongWord;</code> | ||
+ | | In Hz | ||
+ | |- | ||
+ | | <code>EraseSize:LongWord;</code> | ||
+ | | In Sectors | ||
+ | |- | ||
+ | | <code>BlockSize:LongWord;</code> | ||
+ | | "Normalized" Block Size | ||
+ | |- | ||
+ | | <code>BlockCount:LongWord;</code> | ||
+ | | In "Normalized" Blocks | ||
+ | |- | ||
+ | | <code>BlockShift:LongWord;</code> | ||
+ | | "Normalized" Block Shift | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''SD status data (SSR)''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PSDStatusData = ^TSDStatusData;</code> | ||
+ | |||
+ | <code>TSDStatusData = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|Note: See: Section 4.10.2 of SD Physical Layer Simplified Specification Version 4.10 (Defined here for MMC Device) | ||
+ | |- | ||
+ | |colspan="2"|''Card Values'' | ||
+ | |- | ||
+ | | <code>BusWidth:Byte;</code> | ||
+ | | Shows the currently defined data bus width that was defined by SET_BUS_WIDTH command | ||
+ | |- | ||
+ | | <code>SecuredMode:Boolean;</code> | ||
+ | | Card is in Secured Mode of operation (refer to the "Part 3 Security Specification") | ||
+ | |- | ||
+ | | <code>CardType:Word;</code> | ||
+ | | In the future, the 8 LSBs will be used to define different variations of an SD Memory Card (Each bit will define different SD Types). The 8 MSBs will be used to define SD Cards that do not comply with the Physical Layer Specification | ||
+ | |- | ||
+ | | <code>ProtectedSize:LongWord;</code> | ||
+ | | Size of protected area | ||
+ | |- | ||
+ | | <code>SpeedClass:Byte;</code> | ||
+ | | Speed Class of the card | ||
+ | |- | ||
+ | | <code>PerformanceMove:Byte;</code> | ||
+ | | Performance of move indicated by 1 [MB/s] step | ||
+ | |- | ||
+ | | <code>EraseSize:Word;</code> | ||
+ | | Number of AUs to be erased at a time | ||
+ | |- | ||
+ | | <code>EraseTimeout:Byte;</code> | ||
+ | | Timeout value for erasing areas specified by UNIT_OF_ERASE_AU | ||
+ | |- | ||
+ | | <code>EraseOffset:Byte;</code> | ||
+ | | Fixed offset value added to erase time | ||
+ | |- | ||
+ | | <code>UHSSpeedGrade:Byte;</code> | ||
+ | | Speed Grade for UHS mode | ||
+ | |- | ||
+ | |colspan="2"|''Calculated Values'' | ||
+ | |- | ||
+ | | <code>AllocationUnitSize:Byte;</code> | ||
+ | | Size of Allocation Unit | ||
+ | |- | ||
+ | | <code>UHSAllocationUnitSize:Byte;</code> | ||
+ | | Size of Allocation Unit for UHS mode | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''SD switch data''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PSDSwitchData = ^TSDSwitchData;</code> | ||
+ | |||
+ | <code>TSDSwitchData = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|Note: See: Section 4.3.10 of SD Physical Layer Simplified Specification Version 4.10 | ||
+ | |- | ||
+ | |colspan="2"|''Card Values'' | ||
+ | |- | ||
+ | | <code>MaximumCurrent:Word;</code> | ||
+ | | Maximum Current/Power Consumption | ||
+ | |- | ||
+ | | <code>Group6Support:Word;</code> | ||
+ | | Support Bits of Functions in Function Group 6 | ||
+ | |- | ||
+ | | <code>Group5Support:Word;</code> | ||
+ | | Support Bits of Functions in Function Group 5 | ||
+ | |- | ||
+ | | <code>Group4Support:Word;</code> | ||
+ | | Support Bits of Functions in Function Group 4 | ||
+ | |- | ||
+ | | <code>Group3Support:Word;</code> | ||
+ | | Support Bits of Functions in Function Group 3 | ||
+ | |- | ||
+ | | <code>Group2Support:Word;</code> | ||
+ | | Support Bits of Functions in Function Group 2 | ||
+ | |- | ||
+ | | <code>Group1Support:Word;</code> | ||
+ | | Support Bits of Functions in Function Group 1 | ||
+ | |- | ||
+ | | <code>Group6Selection:Byte;</code> | ||
+ | | Function Selection of Function Group 6 | ||
+ | |- | ||
+ | | <code>Group5Selection:Byte;</code> | ||
+ | | Function Selection of Function Group 5 | ||
+ | |- | ||
+ | | <code>Group4Selection:Byte;</code> | ||
+ | | Function Selection of Function Group 4 | ||
+ | |- | ||
+ | | <code>Group3Selection:Byte;</code> | ||
+ | | Function Selection of Function Group 3 | ||
+ | |- | ||
+ | | <code>Group2Selection:Byte;</code> | ||
+ | | Function Selection of Function Group 2 | ||
+ | |- | ||
+ | | <code>Group1Selection:Byte;</code> | ||
+ | | Function Selection of Function Group 1 | ||
+ | |- | ||
+ | | <code>StructureVersion:Byte;</code> | ||
+ | | Data Structure Version | ||
+ | |- | ||
+ | | <code>Group6BusyStatus:Word;</code> | ||
+ | | Busy Status of functions in group 6 | ||
+ | |- | ||
+ | | <code>Group5BusyStatus:Word;</code> | ||
+ | | Busy Status of functions in group 5 | ||
+ | |- | ||
+ | | <code>Group4BusyStatus:Word;</code> | ||
+ | | Busy Status of functions in group 4 | ||
+ | |- | ||
+ | | <code>Group3BusyStatus:Word;</code> | ||
+ | | Busy Status of functions in group 3 | ||
+ | |- | ||
+ | | <code>Group2BusyStatus:Word;</code> | ||
+ | | Busy Status of functions in group 2 | ||
+ | |- | ||
+ | | <code>Group1BusyStatus:Word;</code> | ||
+ | | Busy Status of functions in group 1 | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''SD configuration data (SCR)''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PSDConfigurationData = ^TSDConfigurationData;</code> | ||
+ | |||
+ | <code>TSDConfigurationData = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|Note: See: Section 5.6 of SD Physical Layer Simplified Specification Version 4.10 (Defined here for MMC Device) | ||
+ | |- | ||
+ | |colspan="2"|''Card Values'' | ||
+ | |- | ||
+ | | <code>SCRStructure:Byte;</code> | ||
+ | | SCR Structure version | ||
+ | |- | ||
+ | | <code>SpecVersion:Byte;</code> | ||
+ | | SD Memory Card - Spec. Version | ||
+ | |- | ||
+ | | <code>DataAfterErase:Byte;</code> | ||
+ | | Data status after erases | ||
+ | |- | ||
+ | | <code>Security:Byte;</code> | ||
+ | | CPRM Security Support | ||
+ | |- | ||
+ | | <code>SpecVersion3:Boolean;</code> | ||
+ | | Spec. Version 3.00 or higher | ||
+ | |- | ||
+ | | <code>ExtendedSecurity:Byte;</code> | ||
+ | | Extended Security Support | ||
+ | |- | ||
+ | | <code>SpecVersion4:Boolean; {Spec. Version 4.00 or higher}</code> | ||
+ | | Spec. Version 4.00 or higher | ||
+ | |- | ||
+ | | <code>CommandSupport:Byte;</code> | ||
+ | | Command Support bits | ||
+ | |- | ||
+ | |colspan="2"|''Calculated Values'' | ||
+ | |- | ||
+ | | <code>ErasedByte:Byte;</code> | ||
+ | | Value after Erase | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''MMC enumeration callback''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TMMCEnumerate = function(MMC:PMMCDevice; Data:Pointer):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''MMC notification callback''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TMMCNotification = function(Device:PDevice; Data:Pointer; Notification:LongWord):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''MMC device initialize''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TMMCDeviceInitialize = function(MMC:PMMCDevice):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''MMC device deinitialize''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TMMCDeviceDeinitialize = function(MMC:PMMCDevice):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''MMC device get card detect''' | ||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TMMCDeviceGetCardDetect = function(MMC:PMMCDevice):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''MMC device get write protect''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TMMCDeviceGetWriteProtect = function(MMC:PMMCDevice):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''MMC device send command''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TMMCDeviceSendCommand = function(MMC:PMMCDevice; Command:PMMCCommand):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''MMC device set IOS''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TMMCDeviceSetIOS = function(MMC:PMMCDevice):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''MMC device types''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PMMCDevice = ^TMMCDevice;</code> | ||
+ | |||
+ | <code>TMMCDevice = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|''Device Properties'' | ||
+ | |- | ||
+ | | <code>Device:TDevice;</code> | ||
+ | | The Device entry for this MMC | ||
+ | |- | ||
+ | |colspan="2"|''MMC Properties'' | ||
+ | |- | ||
+ | | <code>MMCId:LongWord;</code> | ||
+ | | Unique Id of this MMC in the MMC table | ||
+ | |- | ||
+ | | <code>MMCState:LongWord;</code> | ||
+ | | MMC state (eg MMC_STATE_INSERTED) | ||
+ | |- | ||
+ | | <code>DeviceInitialize:TMMCDeviceInitialize;</code> | ||
+ | | A Device specific DeviceInitialize method implementing a standard MMC device interface (Or nil if the default method is suitable) | ||
+ | |- | ||
+ | | <code>DeviceDeinitialize:TMMCDeviceDeinitialize;</code> | ||
+ | | A Device specific DeviceDeinitialize method implementing a standard MMC device interface (Or nil if the default method is suitable) | ||
+ | |- | ||
+ | | <code>DeviceGetCardDetect:TMMCDeviceGetCardDetect;</code> | ||
+ | | A Device specific DeviceGetCardDetect method implementing a standard MMC device interface (Or nil if the default method is suitable) | ||
+ | |- | ||
+ | | <code>DeviceGetWriteProtect:TMMCDeviceGetWriteProtect;</code> | ||
+ | | A Device specific DeviceGetWriteProtect method implementing a standard MMC device interface (Or nil if the default method is suitable) | ||
+ | |- | ||
+ | | <code>DeviceSendCommand:TMMCDeviceSendCommand;</code> | ||
+ | | A Device specific DeviceSendCommand method implementing a standard MMC device interface (Or nil if the default method is suitable) | ||
+ | |- | ||
+ | | <code>DeviceSetIOS:TMMCDeviceSetIOS;</code> | ||
+ | | A Device specific DeviceSetIOS method implementing a standard MMC device interface (Or nil if the default method is suitable) | ||
+ | |- | ||
+ | |colspan="2"|''Statistics Properties'' | ||
+ | |- | ||
+ | | <code>CommandCount:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>CommandErrors:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|''Driver Properties'' | ||
+ | |- | ||
+ | | <code>Lock:TMutexHandle;</code> | ||
+ | | Device lock | ||
+ | |- | ||
+ | | <code>Version:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>Clock:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>BusWidth:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>Voltages:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>Capabilities:LongWord;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|''Register Properties'' | ||
+ | |- | ||
+ | |colspan="2"|See: Table 3-2: SD Memory Card Registers of SD Physical Layer Simplified Specification Version 4.10 | ||
+ | |- | ||
+ | | <code>InterfaceCondition:LongWord;</code> | ||
+ | | Interface Condition Result | ||
+ | |- | ||
+ | | <code>OperationCondition:LongWord;</code> | ||
+ | | Operation Condition Register (OCR) See: Section 5.1 of SD Physical Layer Simplified Specification Version 4.10 | ||
+ | |- | ||
+ | | <code>RelativeCardAddress:LongWord;</code> | ||
+ | | Relative Card Address (RCA) (Word) See: Section 5.4 of SD Physical Layer Simplified Specification Version 4.10 | ||
+ | |- | ||
+ | | <code>CardSpecific:array[0..3] of LongWord;</code> | ||
+ | | Card Specific Data (CSD) See: Section 5.3 of SD Physical Layer Simplified Specification Version 4.10 | ||
+ | |- | ||
+ | | <code>CardIdentification:array[0..3] of LongWord;</code> | ||
+ | | Card Identification Data (CID) See: Section 5.2 of SD Physical Layer Simplified Specification Version 4.10 | ||
+ | |- | ||
+ | | <code>CardStatus:LongWord;</code> | ||
+ | | Card Status Register (CSR) See: Section 4.10.1 of SD Physical Layer Simplified Specification Version 4.10 | ||
+ | |- | ||
+ | | <code>DriverStage:LongWord;</code> | ||
+ | | Driver Stage Register (DSR) (Word) See: Section 5.5 of SD Physical Layer Simplified Specification Version 4.10 | ||
+ | |- | ||
+ | | <code>SDStatus:array[0..15] of LongWord;</code> | ||
+ | | SD Status Register (SSR) See: Section 4.10.2 of SD Physical Layer Simplified Specification Version 4.10 | ||
+ | |- | ||
+ | | <code>SDSwitch:array[0..15] of LongWord;</code> | ||
+ | | SD Switch Status See: Section 4.3.10 of SD Physical Layer Simplified Specification Version 4.10 | ||
+ | |- | ||
+ | | <code>SDConfiguration:array[0..1] of LongWord;</code> | ||
+ | | SD Configuration Register (SCR) See: Section 5.6 of SD Physical Layer Simplified Specification Version 4.10 | ||
+ | |- | ||
+ | |colspan="2"|''Configuration Properties'' | ||
+ | |- | ||
+ | | <code>CardSpecificData:TMMCCardSpecificData;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>CardIdentificationData:TMMCCardIdentificationData;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>SDStatusData:TSDStatusData;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>SDSwitchData:TSDSwitchData;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>SDConfigurationData:TSDConfigurationData;</code> | ||
+ | | | ||
+ | |- | ||
+ | |colspan="2"|''Storage Properties'' | ||
+ | |- | ||
+ | | <code>Storage:PStorageDevice;</code> | ||
+ | | The Storage entry for this MMC (Where Applicable) | ||
+ | |- | ||
+ | |colspan="2"|''Internal Properties'' | ||
+ | |- | ||
+ | | <code>Prev:PMMCDevice;</code> | ||
+ | | Previous entry in MMC table | ||
+ | |- | ||
+ | | <code>Next:PMMCDevice;</code> | ||
+ | | Next entry in MMC table | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | |||
+ | '''SDHCI enumeration callback''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TSDHCIEnumerate = function(SDHCI:PSDHCIHost; Data:Pointer):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''SDHCI notification callback''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TSDHCINotification = function(Device:PDevice; Data:Pointer; Notification:LongWord):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''SDHCI host start''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TSDHCIHostStart = function(SDHCI:PSDHCIHost):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''SDHCI host stop''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TSDHCIHostStop = function(SDHCI:PSDHCIHost):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''SDHCI host read byte''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TSDHCIHostReadByte = function(SDHCI:PSDHCIHost; Reg:LongWord):Byte;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''SDHCI host read word''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TSDHCIHostReadWord = function(SDHCI:PSDHCIHost; Reg:LongWord):Word;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''SDHCI host read long''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TSDHCIHostReadLong = function(SDHCI:PSDHCIHost; Reg:LongWord):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''SDHCI host write byte''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TSDHCIHostWriteByte = procedure(SDHCI:PSDHCIHost; Reg:LongWord; Value:Byte);</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''SDHCI host write word''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TSDHCIHostWriteWord = procedure(SDHCI:PSDHCIHost; Reg:LongWord; Value:Word);</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''SDHCI host write long''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TSDHCIHostWriteLong = procedure(SDHCI:PSDHCIHost; Reg:LongWord; Value:LongWord);</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''SDHCI host set clock divider''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TSDHCIHostSetClockDivider = function(SDHCI:PSDHCIHost; Index:Integer; Divider:LongWord):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''SDHCI host set control register''' | ||
+ | |||
+ | {| class="wikitable" style="font-size: 14px; text-align: left; width: 100%; height: 50px;" | ||
+ | |- | ||
+ | | <code>TSDHCIHostSetControlRegister = function(SDHCI:PSDHCIHost):LongWord;</code> | ||
+ | | style="width: 40%;"| | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''SDHCI host types''' | ||
+ | |||
+ | <div class="toccolours mw-collapsible mw-collapsed" style="border: 1; font-family: arial;"> | ||
+ | <code>PSDHCIHost = ^TSDHCIHost;</code> | ||
+ | |||
+ | <code>TSDHCIHost = record</code> | ||
+ | <div class="mw-collapsible-content" style="text-align: left; padding-left: 5px;"> | ||
+ | {| class="wikitable" style="font-size: 14px; background: white;" | ||
+ | |- | ||
+ | |colspan="2"|''Device Properties'' | ||
+ | |- | ||
+ | | <code>Device:TDevice;</code> | ||
+ | | The Device entry for this SDHCI | ||
+ | |- | ||
+ | |colspan="2"|''SDHCI Properties'' | ||
+ | |- | ||
+ | | <code>SDHCIId:LongWord;</code> | ||
+ | | Unique Id of this SDHCI in the SDHCI table | ||
+ | |- | ||
+ | | <code>SDHCIState:LongWord;</code> | ||
+ | | SDHCI state (eg SDHCI_STATE_ENABLED) | ||
+ | |- | ||
+ | | <code>HostStart:TSDHCIHostStart;</code> | ||
+ | | A Host specific HostStart method implementing a standard SDHCI host interface | ||
+ | |- | ||
+ | | <code>HostStop:TSDHCIHostStop;</code> | ||
+ | | A Host specific HostStop method implementing a standard SDHCI host interface | ||
+ | |- | ||
+ | | <code>HostReadByte:TSDHCIHostReadByte;</code> | ||
+ | | A Host specific HostReadByte method implementing a standard SDHCI host interface (Or nil if the default method is suitable) | ||
+ | |- | ||
+ | | <code>HostReadWord:TSDHCIHostReadWord;</code> | ||
+ | | A Host specific HostReadWord method implementing a standard SDHCI host interface (Or nil if the default method is suitable) | ||
+ | |- | ||
+ | | <code>HostReadLong:TSDHCIHostReadLong;</code> | ||
+ | | A Host specific HostReadLong method implementing a standard SDHCI host interface (Or nil if the default method is suitable) | ||
+ | |- | ||
+ | | <code>HostWriteByte:TSDHCIHostWriteByte;</code> | ||
+ | | A Host specific HostWriteByte method implementing a standard SDHCI host interface (Or nil if the default method is suitable) | ||
+ | |- | ||
+ | | <code>HostWriteWord:TSDHCIHostWriteWord;</code> | ||
+ | | A Host specific HostWriteWord method implementing a standard SDHCI host interface (Or nil if the default method is suitable) | ||
+ | |- | ||
+ | | <code>HostWriteLong:TSDHCIHostWriteLong;</code> | ||
+ | | A Host specific HostWriteLong method implementing a standard SDHCI host interface (Or nil if the default method is suitable) | ||
+ | |- | ||
+ | | <code>HostSetClockDivider:TSDHCIHostSetClockDivider;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>HostSetControlRegister:TSDHCIHostSetControlRegister;</code> | ||
+ | | | ||
+ | |- | ||
+ | | <code>DeviceInitialize:TMMCDeviceInitialize;</code> | ||
+ | | A Device specific DeviceInitialize method implementing a standard MMC device interface (Or nil if the default method is suitable) | ||
+ | |- | ||
+ | | <code>DeviceDeinitialize:TMMCDeviceDeinitialize;</code> | ||
+ | | A Device specific DeviceDeinitialize method implementing a standard MMC device interface (Or nil if the default method is suitable) | ||
+ | |- | ||
+ | | <code>DeviceGetCardDetect:TMMCDeviceGetCardDetect;</code> | ||
+ | | A Device specific DeviceGetCardDetect method implementing a standard MMC device interface (Or nil if the default method is suitable) | ||
+ | |- | ||
+ | | <code>DeviceGetWriteProtect:TMMCDeviceGetWriteProtect;</code> | ||
+ | | A Device specific DeviceGetWriteProtect method implementing a standard MMC device interface (Or nil if the default method is suitable) | ||
+ | |- | ||
+ | | <code>DeviceSendCommand:TMMCDeviceSendCommand;</code> | ||
+ | | A Device specific DeviceSendCommand method implementing a standard MMC device interface (Or nil if the default method is suitable) | ||
+ | |- | ||
+ | | <code>DeviceSetIOS:TMMCDeviceSetIOS;</code> | ||
+ | | A Device specific DeviceSetIOS method implementing a standard MMC device interface (Or nil if the default method is suitable) | ||
+ | |- | ||
+ | |colspan="2"|''Driver Properties'' | ||
+ | |- | ||
+ | | <code>Lock:TMutexHandle;</code> | ||
+ | | Host lock | ||
+ | |- | ||
+ | | <code>Address:Pointer;</code> | ||
+ | | Host register base address | ||
+ | |- | ||
+ | | <code>Version:LongWord;</code> | ||
+ | | Host version information | ||
+ | |- | ||
+ | | <code>Quirks:LongWord;</code> | ||
+ | | Host quirks/bugs flags | ||
+ | |- | ||
+ | | <code>Quirks2:LongWord;</code> | ||
+ | | Host additional quirks/bugs flags | ||
+ | |- | ||
+ | | <code>Clock:LongWord;</code> | ||
+ | | Host current clock | ||
+ | |- | ||
+ | | <code>BusWidth:LongWord;</code> | ||
+ | | Host current bus width | ||
+ | |- | ||
+ | | <code>Interrupts:LongWord;</code> | ||
+ | | Host interrupts to be handled | ||
+ | |- | ||
+ | | <code>Voltages:LongWord;</code> | ||
+ | | Host configured voltage flags | ||
+ | |- | ||
+ | | <code>Capabilities:LongWord;</code> | ||
+ | | Host configured capabilities flags | ||
+ | |- | ||
+ | | <code>MinimumFrequency:LongWord;</code> | ||
+ | | Host configured minimum frequency | ||
+ | |- | ||
+ | | <code>MaximumFrequency:LongWord;</code> | ||
+ | | Host configured maximum frequency | ||
+ | |- | ||
+ | | <code>MaximumBlockCount:LongWord;</code> | ||
+ | | Host configured maximum block count | ||
+ | |- | ||
+ | | <code>Command:PMMCCommand;</code> | ||
+ | | Currently processing command | ||
+ | |- | ||
+ | | <code>Wait:TSemaphoreHandle;</code> | ||
+ | | Command completed semaphore | ||
+ | |- | ||
+ | |colspan="2"|''Configuration Properties'' | ||
+ | |- | ||
+ | | <code>PresetVoltages:LongWord;</code> | ||
+ | | Host predefined voltage flags | ||
+ | |- | ||
+ | | <code>PresetCapabilities:LongWord;</code> | ||
+ | | Host predefined capabilities flags | ||
+ | |- | ||
+ | | <code>ClockMinimum:LongWord;</code> | ||
+ | | Host predefined minimum clock frequency | ||
+ | |- | ||
+ | | <code>ClockMaximum:LongWord;</code> | ||
+ | | Host predefined maximum clock frequency | ||
+ | |- | ||
+ | | <code>DriverStageRegister:LongWord;</code> | ||
+ | | Host predefined driver stage register (DSR) | ||
+ | |- | ||
+ | |colspan="2"|''Statistics Properties'' | ||
+ | |- | ||
+ | | <code>InterruptCount:LongWord;</code> | ||
+ | | Number of interrupt requests received by the host | ||
+ | |- | ||
+ | |colspan="2"|''Internal Properties'' | ||
+ | |- | ||
+ | | <code>Prev:PSDHCIHost;</code> | ||
+ | | Previous entry in SDHCI table | ||
+ | |- | ||
+ | | <code>Next:PSDHCIHost;</code> | ||
+ | | Next entry in SDHCI table | ||
+ | |- | ||
+ | |} | ||
+ | </div></div> | ||
+ | <br /> | ||
=== Public variables === | === Public variables === |
Revision as of 01:52, 22 January 2017
Return to Unit Reference
Contents
[hide]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
MMC_*
MMC_TYPE_*
MMC_STATE_*
MMC_FLAG_*
MMC_STATUS_*
SD_VERSION_*, MMC_VERSION_*
MMC_MODE_*
MMC_DATA_*
MMC_BUS_WIDTH_*
MMC_BUS_SPEED_*
MMC_CMD_*
MMC_RSP_*
MMC_RSP_R1_*, MMC_RSP_R2_*
MMC_OCR_*
MMC_CARD_STATUS_*
MMC_CURRENT_STATE_*
MMC_CID_*
MMC_CSD_*
MMC_CSD_STRUCT_*
MMC_CSD_SPEC_VER_*
MMC_CSD_TAAC_UNITS*
MMC_CSD_TAAC_VALUES*
MMC_CCC_*
MMC_CSD_TRAN_SPEED_UNITS*
MMC_CSD_TRAN_SPEED_VALUES*
MMC_VDD_*
MMC_SWITCH_MODE_*
EXT_CSD_*
EXT_CSD_*
MMCPART_*, MMC_MAX_*
MMC_LOG_*
SD_*
SD_BUS_WIDTH_*
SD_BUS_SPEED_*
SD_CMD_*
SD_SWITCH_MODE_*
SD_SWITCH_FUNCTION_GROUP_*
SD_SWITCH_ACCESS_MODE_*
SD_SWITCH_COMMAND_SYSTEM_*
SD_SWITCH_DRIVER_STRENGTH_*
SD_SWITCH_POWER_LIMIT_*
SD_SEND_IF_COND_*
SD_SEND_OP_COND_*
SD_OCR_*
SD_CSD_STRUCT_*
SD_SSR_*
SD_SSR_BUS_WIDTH_*
SD_SSR_CARD_TYPE_*
SD_SSR_SPEED_CLASS_*
SD_SSR_AU_SIZE_*
SD_SSR_UHS_SPEED_*
SD_SSR_UHS_AU_SIZE_*
SD_SWITCH_*
SD_SCR_*
SD_SCR_STRUCT_*
SD_SCR_SPEC_VER_*
SD_SCR_SECURITY_*
SD_SCR_BUS_WIDTH_*
SD_SCR_EX_SECURITY_*
SD_SCR_*_SUPPORT
SDIO_CMD_*
SDIO_RSP_*
SDIO_CCCR_*
SDIO_*_REV_*
SDIO_BUS_*
SDIO_CCCR_CAP_*
SDIO_POWER_*
SDIO_SPEED_*
SDIO_UHS_*
SDIO_DRIVE_*
SDIO_FBR_*
SDHCI_*
SDHCI_TYPE_*
SDHCI_STATE_*
SDHCI_FLAG_*
SDHCI_DMA_*, SDHCI_BLOCK_*
SDHCI_TRNS_*
SDHCI_CMD_*
SDHCI_CMD_RESP_*
SDHCI_DATA_*, SDHCI_CARD_*
SDHCI_CTRL_*
SDHCI_POWER_*
SDHCI_WAKE_*
SDHCI_CLOCK_*
SDHCI_RESET_*
SDHCI_INT_*
SDHCI_*_MASK*, SDHCI_*SHIFT
SDHCI_*_VER_*
SDHCI_MAX_CLOCK_DIV_*
SDHCI_QUIRK*
SDHCI_DEFAULT_BOUNDARY_*
SDHCI_TIMEOUT_VALUE*
Type definitions
MMC command
MMC data
MMC card identification data (CID)
PMMCCardIdentificationData = ^TMMCCardIdentificationData;
TMMCCardIdentificationData = record
MMC card specific erase data (CSD)
TMMCCardSpecificSDEraseData = record
MMC card specific MMC22 erase data
TMMCCardSpecificMMC22EraseData = record
MMC card specific MMC31 erase data
TMMCCardSpecificMMC31EraseData = record
MMC card specific erase data
TMMCCardSpecificEraseData = record
MMC card specific data
SD status data (SSR)
SD switch data
SD configuration data (SCR)
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
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
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
MMC functions
function MMCDeviceReadBlocks(MMC:PMMCDevice; const Start,Count:Int64; Buffer:Pointer):LongWord;
function MMCDeviceWriteBlocks(MMC:PMMCDevice; const Start,Count:Int64; Buffer:Pointer):LongWord;
function MMCDeviceEraseBlocks(MMC:PMMCDevice; const Start,Count:Int64):LongWord;
function MMCDeviceSetClock(MMC:PMMCDevice; Clock:LongWord):LongWord;
function MMCDeviceSetBusWidth(MMC:PMMCDevice; Width:LongWord):LongWord;
function MMCDeviceSetBlockLength(MMC:PMMCDevice; Length:LongWord):LongWord;
function MMCDeviceSetBlockCount(MMC:PMMCDevice; Count:LongWord; Relative:Boolean):LongWord;
function MMCDeviceSetDriverStage(MMC:PMMCDevice; DriverStage:LongWord):LongWord;
function MMCDeviceSwitch(MMC:PMMCDevice; Setting,Index,Value:Byte):LongWord;
function MMCDeviceSendOperationCondition(MMC:PMMCDevice; Probe:Boolean):LongWord;
function MMCDeviceDecodeCardSpecific(MMC:PMMCDevice):LongWord;
function MMCDeviceSendCardIdentification(MMC:PMMCDevice):LongWord;
function MMCDeviceSendAllCardIdentification(MMC:PMMCDevice):LongWord;
function MMCDeviceDecodeCardIdentification(MMC:PMMCDevice):LongWord;
function MMCDeviceGetExtendedCardSpecific(MMC:PMMCDevice):LongWord;
function MMCDeviceSendExtendedCardSpecific(MMC:PMMCDevice):LongWord;
function MMCDeviceDecodeExtendedCardSpecific(MMC:PMMCDevice):LongWord;
function MMCDeviceSetRelativeAddress(MMC:PMMCDevice):LongWord;
function MMCDeviceSPISetCRC(MMC:PMMCDevice; Enable:Boolean):LongWord;
function MMCDeviceSPIReadOperationCondition(MMC:PMMCDevice; HighCapacity:Boolean):LongWord;
function MMCDeviceSendCommand(MMC:PMMCDevice; Command:PMMCCommand):LongWord;
function MMCDeviceDestroy(MMC:PMMCDevice):LongWord;
function MMCDeviceRegister(MMC:PMMCDevice):LongWord;
function MMCDeviceDeregister(MMC:PMMCDevice):LongWord;
function MMCDeviceFindByName(const Name:String):PMMCDevice; inline;
function MMCDeviceFindByDescription(const Description:String):PMMCDevice; inline;
function MMCDeviceEnumerate(Callback:TMMCEnumerate; Data:Pointer):LongWord;
function MMCDeviceNotification(MMC:PMMCDevice; Callback:TMMCNotification; Data:Pointer; Notification,Flags:LongWord):LongWord;
SD functions
function SDDeviceSwitch(MMC:PMMCDevice; Mode,Group:Integer; Value:Byte; Buffer:Pointer):LongWord;
function SDDeviceSetBusSpeed(MMC:PMMCDevice; Speed:LongWord):LongWord;
function SDDeviceSetBusWidth(MMC:PMMCDevice; Width:LongWord):LongWord;
function SDDeviceSendInterfaceCondition(MMC:PMMCDevice):LongWord;
function SDDeviceSendOperationCondition(MMC:PMMCDevice; Probe:Boolean):LongWord;
function SDDeviceDecodeCardSpecific(MMC:PMMCDevice):LongWord;
function SDDeviceGetCardIdentification(MMC:PMMCDevice):LongWord;
function SDDeviceDecodeCardIdentification(MMC:PMMCDevice):LongWord;
function SDDeviceSendSDConfiguration(MMC:PMMCDevice):LongWord;
function SDDeviceDecodeSDConfiguration(MMC:PMMCDevice):LongWord;
function SDDeviceSendRelativeAddress(MMC:PMMCDevice):LongWord;
function SDDeviceSendApplicationCommand(MMC:PMMCDevice; Command:PMMCCommand):LongWord;
SDIO functions
function SDIODeviceSendOperationCondition(MMC:PMMCDevice; Probe:Boolean):LongWord;
function SDIODeviceReadWriteDirect(MMC:PMMCDevice; Write:Boolean; Operation,Address:LongWord; Input:Byte; Output:PByte):LongWord;
function SDIODeviceReadWriteExtended(MMC:PMMCDevice; Write:Boolean; Operation,Address:LongWord; Increment:Boolean; Buffer:Pointer; BlockCount,BlockSize:LongWord):LongWord;
SDHCI functions
function SDHCIHostReset(SDHCI:PSDHCIHost; Mask:Byte):LongWord;
function SDHCIHostSetPower(SDHCI:PSDHCIHost; Power:Word):LongWord;
function SDHCIHostSetClock(SDHCI:PSDHCIHost; Clock:LongWord):LongWord;
function SDHCIHostFinishCommand(SDHCI:PSDHCIHost):LongWord;
function SDHCIHostFinishData(SDHCI:PSDHCIHost):LongWord;
function SDHCIHostCommandInterrupt(SDHCI:PSDHCIHost; InterruptMask:LongWord; var ReturnMask:LongWord):LongWord;
function SDHCIHostDataInterrupt(SDHCI:PSDHCIHost; InterruptMask:LongWord):LongWord;
function SDHCIHostReadByte(SDHCI:PSDHCIHost; Reg:LongWord):Byte; inline;
function SDHCIHostReadWord(SDHCI:PSDHCIHost; Reg:LongWord):Word; inline;
function SDHCIHostReadLong(SDHCI:PSDHCIHost; Reg:LongWord):LongWord; inline;
procedure SDHCIHostWriteByte(SDHCI:PSDHCIHost; Reg:LongWord; Value:Byte); inline;
procedure SDHCIHostWriteWord(SDHCI:PSDHCIHost; Reg:LongWord; Value:Word); inline;
procedure SDHCIHostWriteLong(SDHCI:PSDHCIHost; Reg:LongWord; Value:LongWord); inline;
function SDHCIHostSetClockDivider(SDHCI:PSDHCIHost; Index:Integer; Divider:LongWord):LongWord;
function SDHCIHostSetControlRegister(SDHCI:PSDHCIHost):LongWord;
function SDHCIHostCreateEx(Size:LongWord):PSDHCIHost;
function SDHCIHostDestroy(SDHCI:PSDHCIHost):LongWord;
function SDHCIHostRegister(SDHCI:PSDHCIHost):LongWord;
function SDHCIHostDeregister(SDHCI:PSDHCIHost):LongWord;
function SDHCIHostEnumerate(Callback:TSDHCIEnumerate; Data:Pointer):LongWord;
function SDHCIHostNotification(SDHCI:PSDHCIHost; Callback:TSDHCINotification; Data:Pointer; Notification,Flags:LongWord):LongWord;
MMC helper functions
function MMCDeviceCheck(MMC:PMMCDevice):PMMCDevice;
function MMCGetCIDValue(MMC:PMMCDevice; Version,Value:LongWord):LongWord;
function MMCGetCSDValue(MMC:PMMCDevice; Value:LongWord):LongWord;
function MMCGetExtendedCSDValue(MMC:PMMCDevice; Value:LongWord):LongWord;
function MMCExtractBits(Buffer:Pointer; Start,Size:LongWord):LongWord;
function MMCExtractBitsEx(Buffer:Pointer; Length,Start,Size:LongWord):LongWord;
function MMCStatusToString(Status:LongWord):String;
procedure MMCLog(Level:LongWord; MMC:PMMCDevice; const AText:String);
SD helper functions
function SDGetMaxClock(MMC:PMMCDevice):LongWord;
function SDGetCIDValue(MMC:PMMCDevice; Value:LongWord):LongWord;
function SDGetCSDValue(MMC:PMMCDevice; Version,Value:LongWord):LongWord;
function SDGetSCRValue(MMC:PMMCDevice; Value:LongWord):LongWord;
function SDGetSSRValue(MMC:PMMCDevice; Value:LongWord):LongWord;
function SDGetSwitchValue(MMC:PMMCDevice; Value:LongWord):LongWord;
SDHCI helper functions
function SDHCIHostCheck(SDHCI:PSDHCIHost):PSDHCIHost;
function SDHCIDeviceStateToString(SDHCIState:LongWord):String;
MMC storage functions
function MMCStorageDeviceRead(Storage:PStorageDevice; const Start,Count:Int64; Buffer:Pointer):LongWord;
function MMCStorageDeviceWrite(Storage:PStorageDevice; const Start,Count:Int64; Buffer:Pointer):LongWord;
function MMCStorageDeviceErase(Storage:PStorageDevice; const Start,Count:Int64):LongWord;
function MMCStorageDeviceControl(Storage:PStorageDevice; Request:Integer; Argument1:LongWord; var Argument2:LongWord):LongWord;
Return to Unit Reference