Share via


USB Function Controller Driver MDD (Windows Embedded CE 6.0)

1/6/2010

The model device driver (MDD) exposes a stream driver interface. The platform dependent driver (PDD) returns a PDD context variable to the MDD that is passed back to the PDD in all pfnXXX calls to enable multiple function controllers on the same host. The UFN_IOControl function in the MDD passes all unhandled IOCTLs, including power IOCTLs, to the pfnIOControl in the PDD. To simplify the PDD, the MDD must guarantee that all parameters passed to the PDD are valid. Then, the PDD must use DEBUGCHK to check the parameters. For more information on DEBUGCHK, see Debugging Macros.

The following table shows the requirements of the USB function controller MDD.

Requirement Description

Support the registration of a USB descriptor set.

Provides a mounted function driver with the ability to assign a USB descriptor set to the underlying USB function controller.

Provide pipe access and maintain pipe-to-endpoint mapping.

Specifies an endpoint address that is specified with the bEndpointAddress field of an endpoint descriptor. This endpoint descriptor does not strictly correspond to a physical endpoint. The MDD must provide a function driver with the ability to read data from and write data to a logical pipe. For more information, see the Universal Serial Bus Specification.

Device Registration

USB function clients have pre-populated descriptors that they pass to the MDD through a call to lpRegisterDevice. These descriptors contain the maximum desired packet sizes for their endpoint packets. The MDD and PDD coordinate which endpoint sizes to use under the maximum constraints specified by the client. The MDD and PDD can use a smaller value than supplied, but not a larger value. The client is responsible for opening pipes to the endpoints using the adjusted packet lengths. The function lpRegisterDevice returns FALSE if there is no way for the PDD to support the client. This could be because there are not enough available endpoints or because there is no way to satisfy the maximum packet size constraint.

If the packet sizes that return from lpRegisterDevice are not acceptable to the client, the client should fail gracefully.

To handle this registration process, the client supplies the maximum possible endpoint sizes for the bus speed. For example, with USB 1.1, the bulk endpoint maximum is 64 bytes, but for USB 2.0 the bulk endpoint maximum is 512 bytes. This allows flexibility within the MDD and PDD when assigning values.

Handling Enumeration

For USB 1.1 and USB 2.0, the client driver passes all of its descriptors to the MDD and PDD. The MDD handles the standard enumeration requests, unless the PDD handles them first. When enumeration completes, the MDD or PDD passes an enumeration complete event to the client. Then, the client initializes the endpoints appropriately.

The following list shows the setup requests that the MDD is required to handle:

  • Get device descriptor
  • Get device qualifier
  • Get high speed configuration descriptor, if the MDD is on a high speed bus
  • Get Full Speed Configuration Descriptor, if the MDD is on a full speed bus
  • Get string descriptor
  • Set address

The function controller or the PDD might intercept and process setup requests before they get to the MDD. If that occurs, the PDD should notify the MDD of any of setup requests before the MDD is required to process a transfer.

For more information about setup requests, see the Universal Serial Bus Specification.

See Also

Concepts

USB Function Controller Driver Architecture

Other Resources

USB Function Controller Driver Reference