Share via


SDIO Bus Driver Fast-Path Support (Windows Embedded CE 6.0)

1/6/2010

The majority of changes necessary for enabling Fast-Path are in the bus driver. For Fast-Path, the bus driver tags synchronous bus requests as Fast-Path capable. The bus driver also sets up and processes the synchronous bus requests. Otherwise, the only other change for Fast-Path operations is the addition of polling to the host controller driver.

Bus Driver Changes

The bus driver indicates Fast-Path support through the SD_SYNCHRONOUS_REQUEST flag. SDBusRequest uses this flag bit to set the system flag bit SD_FAST_PATH_AVAILABLE during the request. The host controller driver determines if Fast-Path is supported using the new SD_FAST_PATH_AVAILABLE system flag. For more information, see SDIO Host Controller Driver Fast-Path Support.

The host controller driver determines if Fast-Path will be used, after the SD_FAST_PATH_AVAILABLE system flag is set. If the host controller notices the SD_FAST_PATH_AVAILABLE flag bit and changes the status from SD_API_STATUS_SUCCESS to SD_API_STATUS_FAST_PATH_SUCCESS, then the bus driver will proceed with the request as a Fast-Path operation.

Note

Old host controller drivers ignore the new SD_FAST_PATH_AVAILABLE flag bit and complete requests using the preexisting status values.

SDHCDIndicateBusRequestComplete handles Fast-Path completion processing. When the status is SD_API_STATUS_FAST_PATH_SUCCESS the request skips the retry processing, the marking of the request for completion, the saving of the status, and the queuing of the request to the dispatcher thread. Instead Fast-Path operations copy any additional data from the request into the pSynchInfo->pResponse field and free the request structure. SDHCDIndicateBusRequestComplete also returns a status value that indicates whether the completion routine needs to be called. If the Fast-Path request is successful, the status value is SD_API_STATUS_FAST_PATH_SUCCESS. If the request is a normal operation, the status value is SD_API_STATUS_PENDING. SDSynchronousBusRequest sets the completion status to SD_API_STATUS_SUCCESS when the host controller driver returns SD_API_STATUS_FAST_PATH_SUCCESS. SDSynchronousBusRequest also skips the call to WaitForSingleObject and the status fetch when it detects the status value SD_API_STATUS_FAST_PATH_SUCCESS. The request proceeds normally from this point on. For more information on Fast-Path operations, see SDIO Fast-Path Overview.

Multiple Bus Requests

If an additional bus request is issued before the first bus request is complete, then the new request enters a waiting queue and a status value is returned to SDSynchronousBusRequest. When SDSynchronousBusRequest detects the status value it relinquishes control to the thread performing the SD bus operation. SDHCDIndicateBusRequestComplete starts queued operations and marks them with the system flag SD_SET_EVENT_FLAG. SD_SET_EVENT_FLAG indicates that the operation requires a slightly modified Fast-Path completion path. When SD_SET_EVENT_FLAG is set, SD_API_STATUS_SUCCESS is saved in pSynchInfo->Status. Additionally, the event flag indicated by pSynchInfo->hWaitEvent is set, which results in the release of the waiting thread.

Avoiding Stack Overflow

SDHCDIndicateBusRequestComplete handles the dispatch of additional bus requests from the request queue. Fast-Path operations avoid stack overflow by delaying the execution of the next request in the queue until the stack is completely unwound in SDSynchronousBusRequest. While this wait delays request startup slightly, it ensures that the stack is not deeper than what occurs for a single bus request.

See Also

Other Resources

SDIO Fast-Path Support