SDCardInfoQuery (Compact 2013)
3/26/2014
This function retrieves specific card information.
Syntax
SD_API_STATUS SDCardInfoQuery(
SD_DEVICE_HANDLE hHandle,
SD_INFO_TYPE InfoType,
PVOID pCardInfo,
ULONG StructureSize
);
Parameters
- hHandle
[in] Handle to a secure digital (SD) bus device.
- InfoType
[in] Card information to retrieve.
- pCardInfo
[in, out] Pointer to a buffer to receive card information.
- StructureSize
[in] Size of the buffer pointed to by pCardInfo, in bytes.
The following table shows the valid values for InfoType and pCardInfo.
InfoType value |
pCardInfo value type |
Description |
---|---|---|
SD_INFO_REGISTER_CID |
SD_PARSED_REGISTER_CID |
Returns the parsed contents of the CID register. The raw CID data is made available at the end of the structure, SD_PARSED_REGISTER_CID. |
SD_INFO_REGISTER_CSD |
SD_PARSED_REGISTER_CSD |
Returns the parsed contents of the CSD register. The raw CSD data is made available at the end of the structure, SD_PARSED_REGISTER_CSD. |
SD_INFO_REGISTER_RCA |
SD_CARD_RCA |
Returns the RCA register of the card. |
SD_INFO_CARD_INTERFACE |
SD_CARD_INTERFACE |
Returns information about the physical interface of the SD card. |
SD_INFO_SDIO |
SDIO_CARD_INFO |
Returns information on a secure digital input output (SDIO) card. |
SD_INFO_CARD_STATUS |
SD_CARD_STATUS |
Retrieves the SD card status by issuing SD command 13 to the card. This will cause the function call to block and must not be used in bus request or interrupt callback routines. |
SD_INFO_HOST_IF_CAPABILITIES |
SD_CARD_INTERFACE |
Returns the host interface capabilities in a card interface structure. The ClockRate member indicates the maximum clock rate. The InterfaceMode member defines the highest bus width of which the host is capable. |
SD_INFO_HOST_BLOCK_CAPABILITY |
SD_HOST_BLOCK_CAPABILITY |
Checks whether the requested block capabilities are supported by the host controller driver. The structure passed will be updated with block capabilities that closely match those requested. |
SD_INFO_HIGH_CAPACITY_SUPPORT |
DWORD |
Returns the value 0x00000001 if the SD card is high capacity SD memory, otherwise returns 0x00000000. |
SD_INFO_CARD_INTERFACE_EX |
SD_CARD_INTERFACE_EX |
Returns information about the physical interface of the SD card. This structure contains additional information for the SD 2.0 bus, including information on high speed and high capacity support. |
SD_INFO_SWITCH_FUNCTION |
SD_CARD_SWITCH_FUNCTION |
Returns the SD card switch function. |
Return Value
Returns a value of type SD_API_STATUS that indicates success or failure.
Remarks
For the CSD and CID registers, this function performs full parsing of the register data. Data for these registers is returned to the client driver in the structure, SD_PARSED_REGISTER_XXX.
From the parsed structure, the client driver is able, for example, to obtain the StructureSize of a memory card without having to extract several bit fields from the raw register data.
For both CSD and CID registers, all 128 bits of raw register data is included within the parsed register structure.
In addition to accessing register data, this function can also return information about the physical interface of a card, and its current status.
The interface query can be performed by passing an InfoTypevalueof SD_INFO_CARD_INTERFACE**.** The query returns information describing the physical connection used to access the card, including the clock rate, and whether the interface is 1-bit or 4-bit.
The card status is obtained by passing an InfoType value of SD_INFO_CARD_STATUS. This will return the 32-bit status word for the peripheral card. This query internally performs a synchronous bus request to obtain the card status. Because of this, the card status query must not be performed within the callback of an asynchronous bus request.
This function can also be used to query SDIO information for SDIO clients, and to query information about a host.
SD register data is retrieved either as a portion of the response by a bus request or as separate data buffers from a bus request. The high-bit byte varies depending on the method of retrieval. If register data is retrieved through a response by a bus request, the high-bit is in the highest byte. For example, byte 5 contains bit 47 and byte 0 contains bit 0. If register data is retrieved using a data buffer, the high-bit is stored in the lowest byte.
Requirements
Header |
sdcardddk.h |
Library |
sdcardlib.lib |