Secure Digital Card Driver Development Concepts

Other versions of this page are also available for the following:

Windows Mobile Not SupportedWindows Embedded CE Supported

8/28/2008

The Secure Digital (SD) card driver stack for Windows Embedded CE consists of a bus driver, host controller driver and client drivers.

The bus driver is an abstraction and management layer between a client driver and the host controller driver. It provides a standard API that allows for SD client drivers to run on any Windows Embedded CE-based device that includes the Sdbus.dll file. The bus driver is application and host controller independent and no changes are necessary to migrate the bus driver between processors. For more information, see Secure Digital Card Bus Driver.

The host controller driver controls the host controller hardware and conforms to a host controller driver interface that is used by the bus driver to communicate and set operating parameters. The host controller driver interface provides a hardware abstraction layer between the bus driver and the host controller implementation. For more information, see Secure Digital Card Host Controller Driver.

A client driver communicates with the SD client driver interface allowing the client driver to communicate with an SD device. The client driver interface has been designed to abstract the physical implementation of the SD bus while providing the client driver with maximum flexibility. The client driver interface allows a client driver to scale from a simple, synchronously accessed storage card driver to a fully threaded, asynchronous communication device driver. For more information, see Secure Digital Card Client Driver.

**** Applies to Windows Embedded CE 6.0 R2** **

Through the introduction of a new and enhanced SD bus implementation, the operating system now supports up to version 2.0 of the SD Card Physical Layer Specification. The Microsoft SD bus version 2.0 provides support for SD high capacity cards and also provides support for high speed mode. Specifically, the new SD bus supports SD cards greater than 4G and up to 32G as defined by the SD 2.0 protocol. Version 2.0 of the SD bus also allows for a high speed mode with a clock rate up to 50MHz and a Read/Write rate up to 25MB/sec using 4bit mode. Additionally, the new SD bus supports a new switch function command that allows for switching between card command mode and interface/high speed mode. With version 2.0 of the SD bus there is also a block addressing mode, with a fixed block length of 512 bytes for high capacity cards.

Note

When you are building a new image you need to set the image flag IMGSDBUS2 equal to 1 in order to use the new bus (sdbus2.dll). When IMGSDBUS2 is set to 1, sdbus2.dll is picked up during the makeimg process and is renamed to sdbus.dll in the generated image.

Source code for the SD bus can be found in the following directories:

  • SD 1.1 bus - %_WINCEROOT%\Public\Common\OAK\Drivers\SDCard\SDBusdriver
  • SD 2.0 bus - %_WINCEROOT%\Public\Common\OAK\Drivers\SDCard\SDBus

An additional change to the SD bus is a new initialization process for SD cards. Version 2.0 of the SD bus checks for high capacity support during the SD memory client initialization. For more information, reference the following code excerpt.

DWORD dwSDHC;
apiStatus = SDCardInfoQuery( pMemCard->hDevice,
                             SD_INFO_HIGH_CAPACITY_SUPPORT,
                             &dwSDHC,
                             sizeof(dwSDHC));

if(!SD_API_SUCCESS(apiStatus)) {
   pMemCard->HighCapacity = FALSE;
}
else {
   pMemCard->HighCapacity = dwSDHC != 0;
}

if( pMemCard->HighCapacity ) {
   //SDMemCardConfig: Card is high capacity (2.0+)
}

See Also

Concepts

Secure Digital Card Host Controller Driver
Secure Digital Card Bus Driver
Secure Digital Card Client Driver
Power On and Off Notifications for Secure Digital Card Drivers
Secure Digital Card Error Recovery
High Capacity Secure Digital Card Common Issues

Other Resources

Secure Digital Card Drivers
Single Function, Multi-Function, and Combo Cards
SDIO Soft-Block Support
SDIO Fast-Path Support