Adaptation/GUID-529757E6-ABF2-5C5C-A995-7DED6D298F52.dita
changeset 15 307f4279f433
equal deleted inserted replaced
14:578be2adaf3e 15:307f4279f433
       
     1 <?xml version="1.0" encoding="utf-8"?>
       
     2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
       
     3 <!-- This component and the accompanying materials are made available under the terms of the License 
       
     4 "Eclipse Public License v1.0" which accompanies this distribution, 
       
     5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
       
     6 <!-- Initial Contributors:
       
     7     Nokia Corporation - initial contribution.
       
     8 Contributors: 
       
     9 -->
       
    10 <!DOCTYPE concept
       
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
       
    12 <concept id="GUID-529757E6-ABF2-5C5C-A995-7DED6D298F52" xml:lang="en"><title>Design</title><shortdesc>This topic describes how to design the USB client controller
       
    13 for different types of USB hardware.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody>
       
    14 <p>On most hardware platforms, the variant is split into a common,
       
    15 or ASSP, layer and a device specific, or variant, layer; for example,
       
    16 the Symbian port for the template board is split into a core layer
       
    17 for the ASSP (in <filepath>...\template_assp\...</filepath>) and code
       
    18 specific to the template board (in <filepath>...\template_variant\...</filepath>). </p>
       
    19 <p>On some hardware configurations, the USB platform-specific layer
       
    20 functionality is not only dependent on the USB device controller (in
       
    21 the ASSP) but also on the variant. As an example, the USB cable connection/disconnection
       
    22 notification mechanism is not defined in the USB specification. This
       
    23 means that some USB device controllers have a mechanism for detecting
       
    24 the status of a cable connection that is internal to the ASSP, while
       
    25 for other controllers the mechanism is variant specific, and requires
       
    26 software support in the variant layer. </p>
       
    27 <p>In the template example port, the ASSP layer is implemented by
       
    28 the <codeph>TemplateAssp</codeph> class defined in <filepath>...\template_assp\template_assp_priv.h</filepath>. This class defines a number of pure virtual functions that act
       
    29 as the interface to the cable connection status mechanism. </p>
       
    30 <codeblock id="GUID-4E7ED63E-5383-53D8-AC79-29AE307B1FED" xml:space="preserve">class TemplateAssp : public Asic
       
    31     {
       
    32 
       
    33     ...
       
    34   /**
       
    35      * USB client controller - Some example functions for the case that USB cable detection and
       
    36      * UDC connect/disconnect functionality are part of the variant.
       
    37      * Pure virtual functions called by the USB PSL, to be implemented by the variant (derived class).
       
    38      * If this functionality is part of the ASSP then these functions can be removed and calls to them
       
    39      * in the PSL (./pa_usbc.cpp) replaced by the appropriate internal operations.
       
    40      */
       
    41     virtual TBool UsbClientConnectorDetectable()=0;
       
    42     virtual TBool UsbClientConnectorInserted()=0;
       
    43     virtual TInt RegisterUsbClientConnectorCallback(TInt (*aCallback)(TAny*), TAny* aPtr)=0;
       
    44     virtual void UnregisterUsbClientConnectorCallback()=0;
       
    45     virtual TBool UsbSoftwareConnectable()=0;
       
    46     virtual TInt UsbConnect()=0;
       
    47     virtual TInt UsbDisconnect()=0;
       
    48 </codeblock>
       
    49 <p>In the template example port, the variant layer is implemented
       
    50 by the <codeph>Template</codeph> class defined in <filepath>...\template_variant\inc\variant.h</filepath>. The variant layer provides the implementation for these USB pure
       
    51 virtual functions. </p>
       
    52 <codeblock id="GUID-D697E009-5C21-5C7A-A31A-7A526413655E" xml:space="preserve">NONSHARABLE_CLASS(Template) : public TemplateAssp
       
    53     {
       
    54 
       
    55     ...
       
    56      /**
       
    57      * USB client controller - Some example functions for the case that USB cable detection and
       
    58      * UDC connect/disconnect functionality are part of the variant.
       
    59      * These virtual functions are called by the USB PSL (pa_usbc.cpp).
       
    60      * If this functionality is part of the ASSP then these functions can be removed as calls to them
       
    61      * in the PSL will have been replaced by the appropriate internal operations.
       
    62      */
       
    63     virtual TBool UsbClientConnectorDetectable();
       
    64     virtual TBool UsbClientConnectorInserted();
       
    65     virtual TInt RegisterUsbClientConnectorCallback(TInt (*aCallback)(TAny*), TAny* aPtr);
       
    66     virtual void UnregisterUsbClientConnectorCallback();
       
    67     virtual TBool UsbSoftwareConnectable();
       
    68     virtual TInt UsbConnect();
       
    69     virtual TInt UsbDisconnect();
       
    70 </codeblock>
       
    71 <p>The implementation for these functions can be found in <filepath>...\template_variant\specific\variant.cpp</filepath>. </p>
       
    72 <p>The USB port also needs interrupt handling code to deal with USB
       
    73 external interrupts. See the <xref href="GUID-3C34724F-B476-5329-B0B1-6D5A34294979.dita">Interrupt Dispatcher
       
    74 Tutorial</xref> for details about how to do this. </p>
       
    75 <note>This may be done by others as a specialist porting activity. </note>
       
    76 </conbody></concept>