Secure Digital Card Host Controller Driver
Other versions of this page are also available for the following:
8/28/2008
The Secure Digital (SD) card host controller driver is the software component that controls the host controller hardware and conforms to a host controller software interface that the bus driver uses to communicate and set operating parameters. The host controller driver uses an API set exported by the bus driver for registration and unregistration.
Registration involves providing information about host and slot capabilities, including maximum clock rate, acceptable voltage windows, SD data bus width, and power up delay. Registration also provides callback functions, a slot options handler, a power handler, and a bus request handler.
The SD Card stack uses a dynamic architecture that allows host controller drivers to register or unregister at any time.
The host controller driver interface provides a hardware abstraction layer between the bus driver and the host controller implementation. Host controller drivers contain platform and chipset dependent code and only communicate information to the bus driver through this interface. This keeps the bus driver independent of host controller and platform design. The host controller driver interface is only required by host controller drivers and is independent from the client driver API.
The host controller driver:
- Includes the controller, slot, and supporting logic, and comprises the actual hardware implementation.
- Implements the SD and multimedia card (MMC) transmit and receive electronics.
- Can be a memory-mapped device on a local bus such as an integrated controller, or on a peripheral bus such as PCMCIA, PCI, and USB.
- Can also use programmed I/O or direct memory access (DMA).**
- Beginning with Windows Embedded CE 6.0 R2, can use single operation direct memory access (SDMA). If you are using a different host controller driver, you can refer to the Microsoft SD standard host controller driver implementation for help modifying your own. For additional information on DMA support, see Secure Digital Card Direct Memory Access Support**
The SD card driver architecture allows for an unlimited number of host controller drivers per system. Multiple slot implementations must utilize independent power, clock, and bus width control. This allows the system to accept cards that have different SD interface requirements.
The SD card host controller electrical interface is fully hot swappable and can operate in 1-bit or 4-bit mode, with a clock speed of 0 to 50 megahertz (MHz) as of Windows Embedded CE 6.0 R2. When using a Windows Embedded CE version prior to Windows Embedded CE 6.0 R2 the supported clock speed is 0 to 25 megahertz (MHz). The default clock speed is 25 megahertz (MHz) for all releases. The host controller driver is responsible for registering the capabilities of a slot to the bus driver.
Note
Support of clock speeds up to 50 megahertz (MHz) is hardware dependent. The SD client hardware must support high speed mode and the specific desired clock speed.
A host controller can be based on any subordinate bus architecture. For example, a PCI-based host controller may be loaded as a streams driver.
**** Applies to Windows Embedded CE 6.0 R2** **
The new SD bus driver implements version 2.0 of the SD Card Physical Layer Specification. For more information, see Secure Digital Card Bus Driver. Usually, no changes will be necessary to the SD card host controller driver when using the new SD bus driver. However, it is possible that some existing SD card host controller drivers will not work with the new SD bus. One of the most common problems found regards the new commands supported in version 2.0 of the SD Card Physical Layer Specification that use Response 7. The Response 7 case must be addressed when bus requests are submitted to the SD card host controller or the request will fail with SD_API_STATUS_INVALID_PARAMETER. Handling this issue may involve introducing a new enum for the command response in the SD card host controller driver. For more information, see the following code excerpt.
SD_API_STATUS
CSDHCSlotBase::SubmitBusRequestHandler( PSD_BUS_REQUEST pRequest)
{
…
// bypass CMD12 if AutoCMD12 was done by hardware
…
// initialize command register with command code
wRegCommand = (pRequest->CommandCode << CMD_INDEX_SHIFT) & CMD_INDEX_MASK;
// check for a response
switch (pRequest->CommandResponse.ResponseType) {
case NoResponse:
break;
case ResponseR2:
wRegCommand |= CMD_RESPONSE_R2;
break;
case ResponseR3:
case ResponseR4:
wRegCommand |= CMD_RESPONSE_R3_R4;
break;
case ResponseR1:
case ResponseR5:
case ResponseR6:
case ResponseR7:
wRegCommand |= CMD_RESPONSE_R1_R5_R6_R7;
break;
case ResponseR1b:
wRegCommand |= CMD_RESPONSE_R1B_R5B;
break;
default:
status = SD_API_STATUS_INVALID_PARAMETER;
goto EXIT;
}
…
}
See Also
Concepts
Secure Digital Card Driver Development Concepts
Secure Digital Card Multimedia Card Compatibility
High Capacity Secure Digital Card Common Issues