Asynchronous Bus Requests (Windows CE 5.0)

Send Feedback

By using asynchronous bus requests, a client driver can issue multiple bus requests without the need to wait for previous requests to complete. The bus requests are internally queued within the bus driver, and sequentially issued to the Secure Digital (SD) device when the SD bus is available.

By making use of asynchronous requests, a client driver can maximize use of the available SD bus bandwidth. For example, while a SD I/O (SDIO) network adapter is busy transmitting a packet, the client driver can be formatting the next packet to be sent.

As each request completes, the bus driver invokes a callback routine by using the client driver. This callback routine can then inform the main client driver thread that the request has completed. With a sequence of requests, the callback routine should keep track of the outstanding requests and signal the main client driver thread when all outstanding requests are complete.

SDBusRequest

An asynchronous bus request is issued by calling the SDBusRequest function. The pCallback parameter is a pointer to a callback routine that will be called by the completion thread of the bus driver when the bus request is complete. The RequestParam parameter is optional and is passed to the callback routine for the bus request.

The *ppRequest*****parameter is used to obtain a pointer to a newly created bus request structure. Usually, the client driver should store this pointer to enable request cancellation and deletion. This is not mandatory, since the pointer is also passed to the callback function upon completion of the request.

SDFreeBusRequest

The client driver is responsible for freeing the memory allocated for this new bus request. This can be done with a call to the SDFreeBusRequest function within the callback when a request is completed. The callback is invoked whenever a request is completed. A request can be completed on success, error, or cancellation.

Since the callback will run in the completion thread of the bus driver, the callback should do as little as possible. Most importantly, it must not make any blocking function calls. Several blocking or potentially blocking function calls are:

SDCancelBusRequest

The client driver is able to cancel any outstanding bus request by calling the SDCancelBusRequest function. If the bus request has yet to be sent, it will be removed from the queue of requests, and the completion callback will be called. The callback routine must free the bus request as normal. The request status of SD_API_STATUS_CANCELED indicates the request was cancelled. In all cases, the client driver should wait until all requests have been completed.

See Also

Client Driver Bus Requests | Synchronous Bus Requests | SDBusRequest | SDFreeBusRequest | SDSynchronousBusRequest | SDSetCardFeature | SDCardInfoQuery | SDCancelBusRequest

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.