diff -r 578be2adaf3e -r 307f4279f433 Adaptation/GUID-529757E6-ABF2-5C5C-A995-7DED6D298F52.dita --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Adaptation/GUID-529757E6-ABF2-5C5C-A995-7DED6D298F52.dita Fri Oct 15 14:32:18 2010 +0100 @@ -0,0 +1,76 @@ + + + + + +DesignThis topic describes how to design the USB client controller +for different types of USB hardware. +

On most hardware platforms, the variant is split into a common, +or ASSP, layer and a device specific, or variant, layer; for example, +the Symbian port for the template board is split into a core layer +for the ASSP (in ...\template_assp\...) and code +specific to the template board (in ...\template_variant\...).

+

On some hardware configurations, the USB platform-specific layer +functionality is not only dependent on the USB device controller (in +the ASSP) but also on the variant. As an example, the USB cable connection/disconnection +notification mechanism is not defined in the USB specification. This +means that some USB device controllers have a mechanism for detecting +the status of a cable connection that is internal to the ASSP, while +for other controllers the mechanism is variant specific, and requires +software support in the variant layer.

+

In the template example port, the ASSP layer is implemented by +the TemplateAssp class defined in ...\template_assp\template_assp_priv.h. This class defines a number of pure virtual functions that act +as the interface to the cable connection status mechanism.

+class TemplateAssp : public Asic + { + + ... + /** + * USB client controller - Some example functions for the case that USB cable detection and + * UDC connect/disconnect functionality are part of the variant. + * Pure virtual functions called by the USB PSL, to be implemented by the variant (derived class). + * If this functionality is part of the ASSP then these functions can be removed and calls to them + * in the PSL (./pa_usbc.cpp) replaced by the appropriate internal operations. + */ + virtual TBool UsbClientConnectorDetectable()=0; + virtual TBool UsbClientConnectorInserted()=0; + virtual TInt RegisterUsbClientConnectorCallback(TInt (*aCallback)(TAny*), TAny* aPtr)=0; + virtual void UnregisterUsbClientConnectorCallback()=0; + virtual TBool UsbSoftwareConnectable()=0; + virtual TInt UsbConnect()=0; + virtual TInt UsbDisconnect()=0; + +

In the template example port, the variant layer is implemented +by the Template class defined in ...\template_variant\inc\variant.h. The variant layer provides the implementation for these USB pure +virtual functions.

+NONSHARABLE_CLASS(Template) : public TemplateAssp + { + + ... + /** + * USB client controller - Some example functions for the case that USB cable detection and + * UDC connect/disconnect functionality are part of the variant. + * These virtual functions are called by the USB PSL (pa_usbc.cpp). + * If this functionality is part of the ASSP then these functions can be removed as calls to them + * in the PSL will have been replaced by the appropriate internal operations. + */ + virtual TBool UsbClientConnectorDetectable(); + virtual TBool UsbClientConnectorInserted(); + virtual TInt RegisterUsbClientConnectorCallback(TInt (*aCallback)(TAny*), TAny* aPtr); + virtual void UnregisterUsbClientConnectorCallback(); + virtual TBool UsbSoftwareConnectable(); + virtual TInt UsbConnect(); + virtual TInt UsbDisconnect(); + +

The implementation for these functions can be found in ...\template_variant\specific\variant.cpp.

+

The USB port also needs interrupt handling code to deal with USB +external interrupts. See the Interrupt Dispatcher +Tutorial for details about how to do this.

+This may be done by others as a specialist porting activity. +
\ No newline at end of file