The USB client LDD
The class DLddUsbcChannel is the USB client LDD channel object - an instance being created for each main interface that is set on the UDC. It is derived from logical channel base class DLogicalChannel - which means that channel requests are executed in the context of a kernel
thread. A DFC queue is associated with the controller object, and this determines which kernel thread is used to process these requests. It is set on a per-platform basis, with the default being DFC thread 0. The channel owns an instance of the TUsbcAlternateSettingList class for each alternative setting that exists for the interface, iAl-ternateSettingList. In turn, each alternative setting object owns an instance of the TUsbcEndpoint class for each endpoint that it contains, apart from ep0. Instead, the channel owns the TUsbcEnd-point instance for ep0 and also maintains a pointer to each of the endpoint objects for the current alternate interface via DLddUsbcChan-nel::iEndpoint. An important function of the TUsbcEndpoint class is to manage the buffers used for data transfer. However, the channel object owns these buffers since they are shared with other endpoints in the interface.
Up to three hardware memory chunks, each containing physically contiguous RAM pages, are allocated to every channel object, and these chunks are each divided into separate buffers for use during data transfers. All IN endpoints (that is, ones which transfer data back to the host) share one chunk, OUT endpoints share the second, and the third is used for ep0. These chunks are created when an interface is first set on the channel. The size of chunk for ep0 is fixed, containing four 1024-byte buffers. However, fairly obviously, the size of the IN and OUT chunks depends on the number of IN and OUT endpoints that are included in the interface. The number of buffers created for each of these endpoints is fixed, but the size of the buffers is configurable by the LDD client, using bandwidth priority arguments specified when setting an interface. A single buffer is created for each IN endpoint and four buffers are created for each OUT endpoint. The default buffer size for Bulk IN is 4 KB, and for Bulk OUT it is 4 KB too. We have selectable OUT endpoint buffer sizes for performance reasons - large buffer sizes are recommended for high bandwidth data transfers. Since different alternate interfaces may specify different groups of endpoints and different buffer sizes, the chunks often have to be reallocated each time the LDD client sets a different alternative interface. (The chunk size finally used is the maximum of each alternate setting's requirements.)
The TUsbcRequestCallback class encapsulates an LDD transfer request. It holds data specifying the request, together with a DFC that the controller uses to call back the LDD when transfer completes. The TUsbcEndpoint class owns a request object, iRequestCallback-Info, which it uses to issue requests to the controller. A channel can have asynchronous requests outstanding on all of its endpoints at once, and this includes ep0. Since ep0 is shared with other channels, the client controller has to manage multiple requests on the same endpoint.
Post a comment