usb_plat/usb_shai_api/inc/usb_charger_detection_shai_shared.h
changeset 51 eaaed528d5fd
equal deleted inserted replaced
46:613028a7da24 51:eaaed528d5fd
       
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 /** @file
       
    19     @brief USB Charger Detection SHAI shared constants and types
       
    20     @version 0.3.0
       
    21 
       
    22     This header specifies USB Charger Detection SHAI common types and
       
    23     constants used by both the kernel side code and user side code. It
       
    24     is automatically included by the USB Charger Detection SHAI header
       
    25     and is not intended to be directly included by SHAI
       
    26     implementations.
       
    27 
       
    28     The file is versioned for the sake of the human reader and follows
       
    29     the version of the USB Charger Detection SHAI header
       
    30     usb_charger_detection_shai.h.
       
    31 
       
    32     @publishedDeviceAbstraction
       
    33 */
       
    34 
       
    35 
       
    36 #ifndef USB_CHARGER_DETECTION_SHAI_SHARED_H
       
    37 #define USB_CHARGER_DETECTION_SHAI_SHARED_H
       
    38 
       
    39 
       
    40 // The namespace is documented in file usb_common_shai.h, so it is not
       
    41 // repeated here
       
    42 namespace UsbShai
       
    43     {
       
    44     // Data types
       
    45 
       
    46     /**
       
    47      * An enumeration listing the different port types that can be
       
    48      * reported to the PIL layer by a registered Charger Detector
       
    49      * PSL. The available types mostly correspond to those mentioned
       
    50      * in the Battery Charging Specification Revision 1.1.
       
    51      */
       
    52     enum TPortType
       
    53         {
       
    54         /**
       
    55          * This type is reported to indicate that the Charger Detector
       
    56          * PSL has detected that we are no longer connected to a
       
    57          * powered port. This situation occurs when VBUS driven from
       
    58          * outside drops, or the Accessory Charger Adapter changes the
       
    59          * RID state from RID_A to RID_GND (which usually also means
       
    60          * that VBUS will drop very soon).
       
    61          */
       
    62         EPortTypeNone = 0,
       
    63 
       
    64         /**
       
    65          * This type is reported to indicate that the Charger
       
    66          * Detector PSL has detected that our device is connected to
       
    67          * an unsupported port. One common type of an unsupported port
       
    68          * is a PS/2 to USB adapter connected to a PS/2 port of a
       
    69          * computer.
       
    70          */
       
    71         EPortTypeUnsupported,
       
    72 
       
    73         /** 
       
    74          * This type is reported when the Charger Detector PSL has
       
    75          * detected that our device is connected to a charging port,
       
    76          * but has not yet distinguished whether the port is a
       
    77          * Charging Downstream Port or a Dedicated Charging Port.
       
    78          *
       
    79          * When this port type is detected, the upper layers will
       
    80          * connect to the USB bus as the peripheral by requesting the
       
    81          * Peripheral Controller PSL to assert the D+ pull-up. The
       
    82          * Charger Detector PSL can then detect the exact port type by
       
    83          * observing what happens to the level of the D- line, as
       
    84          * specified in the Battery Charging Specification. Upon
       
    85          * detecting the exact port type, the Charger Detector PSL can
       
    86          * notify a new event with the correct type.
       
    87          *
       
    88          * If the Charger Detector PSL can directly distinguish the
       
    89          * exact port type, the PSL does not need to report this
       
    90          * generic charging port type, but can directly report the
       
    91          * more specific type EPortTypeDedicatedChargingPort or
       
    92          * EPortTypeChargingDownstreamPort.
       
    93          */
       
    94         EPortTypeChargingPort,
       
    95 
       
    96         /** 
       
    97          * This type is reported when the Charger Detector PSL has
       
    98          * detected that our device is connected to a Dedicated
       
    99          * Charging Port.
       
   100          *
       
   101          * When this port type is detected, the upper layers will
       
   102          * connect to the USB bus as the peripheral by requesting the
       
   103          * Peripheral Controller PSL to assert the D+ pull-up, as
       
   104          * specified in the Battery Charging Specification.
       
   105          */
       
   106         EPortTypeDedicatedChargingPort,
       
   107             
       
   108         /** 
       
   109          * This type is reported when the Charger Detector PSL has
       
   110          * detected that our device is connected to a Charging
       
   111          * Downstream Port.
       
   112          *
       
   113          * When this port type is detected, the upper layers will
       
   114          * connect to the USB bus as the peripheral by requesting the
       
   115          * Peripheral Controller PSL to assert the D+ pull-up, as
       
   116          * specified in the Battery Charging Specification.
       
   117          */
       
   118         EPortTypeChargingDownstreamPort,
       
   119             
       
   120         /**
       
   121          * This type is reported when the Charger Detector PSL has
       
   122          * detected that our device is connected to a Standard
       
   123          * Downstream Port.
       
   124          *
       
   125          * When this port type is detected, the upper layers will
       
   126          * connect to the USB bus as the peripheral by requesting the
       
   127          * Peripheral Controller PSL to assert the D+ pull-up, as
       
   128          * specified in the Battery Charging Specification.
       
   129          */
       
   130         EPortTypeStandardDownstreamPort,
       
   131 
       
   132         /** 
       
   133          * This type is reported when the Charger Detector PSL has
       
   134          * detected that our device is connected to the OTG port of an
       
   135          * Accessory Charger Adapter and the ID pin is in the RID_A
       
   136          * range.
       
   137          *
       
   138          * When this port type is detected in an OTG-capable device,
       
   139          * the OTG State Machine will default to the host role.
       
   140          */
       
   141         EPortTypeAcaRidA,
       
   142 
       
   143         /** 
       
   144          * This type is reported when the Charger Detector PSL has
       
   145          * detected that our device is connected to the OTG port of an
       
   146          * Accessory Charger Adapter and the ID pin is in the RID_B
       
   147          * range.
       
   148          *
       
   149          * When this port type is detected, the USB Peripheral PIL
       
   150          * layer will ensure that the Peripheral Controller PSL is not
       
   151          * allowed to connect to the bus, as required by the Battery
       
   152          * Charging Specification.
       
   153          */
       
   154         EPortTypeAcaRidB,
       
   155 
       
   156         /** 
       
   157          * This type is reported when the Charger Detector PSL has
       
   158          * detected that our device is connected to the OTG port of an
       
   159          * Accessory Charger Adapter and the ID pin is in the RID_C
       
   160          * range.
       
   161          *
       
   162          * When this port type is detected, the upper layers will
       
   163          * connect to the USB bus as the peripheral by requesting the
       
   164          * Peripheral Controller PSL to assert the D+ pull-up, as
       
   165          * specified in the Battery Charging Specification.
       
   166          */
       
   167         EPortTypeAcaRidC,
       
   168         };
       
   169 
       
   170 
       
   171      /**
       
   172      * This class specifies the information provided by a Charger
       
   173      * Detector PSL when registering to the PIL layer.
       
   174      *
       
   175      * The PSL should prepare for the possibility that members may be
       
   176      * added to the end of this class in later SHAI versions if new
       
   177      * information is needed to support new features. The PSL should
       
   178      * not use this class as a direct member in an object that is not
       
   179      * allowed to grow in size due to binary compatibility reasons.
       
   180      *
       
   181      * @see UsbChargerDetectionPil::RegisterChargerDetector()
       
   182      */
       
   183     NONSHARABLE_CLASS( TChargerDetectorProperties )
       
   184         {
       
   185         public: // Types and constants
       
   186         /**
       
   187          * A bitmask type used to indicate the static capabilities of
       
   188          * the Charger Detector.
       
   189          */
       
   190         typedef TUint32 TChargerDetectorCaps;
       
   191 
       
   192         /**
       
   193          * Capability bit to indicate whether the USB system below the
       
   194          * SHAI (either in HW or in the low-level SW) supports
       
   195          * automatically reducing charging current for the duration of
       
   196          * the USB high-speed chirp signalling. See Battery Charging
       
   197          * Specification Revision 1.1, Chapter 3.6.2 for description
       
   198          * of the problem.
       
   199          *
       
   200          * If the system does not support this feature, the upper
       
   201          * layer USB components that calculate available charging
       
   202          * current will always limit the charging current taken from a
       
   203          * Charging Downstream Port so that the maximum current during
       
   204          * chirp is not violated.
       
   205          *
       
   206          * If the system supports this feature, the full available
       
   207          * charging current from a Charging Downstream Port is
       
   208          * utilized. It is then the responsibility of the HW or some
       
   209          * low-level SW below to SHAI to ensure that the charging
       
   210          * current is automatically reduced for the duration of chirp
       
   211          * signalling.
       
   212          *
       
   213          * If the system supports this feature, the PSL shall set the
       
   214          * corresponding bit in iCapabilities (by bitwise OR'ing this
       
   215          * value). Otherwise the PSL shall clear the corresponding bit
       
   216          * in iCapabilities.
       
   217          */
       
   218         static const TChargerDetectorCaps KChargerDetectorCapChirpCurrentLimiting = 0x00000001;
       
   219 
       
   220         public:
       
   221         /**
       
   222          * Inline constructor for the Charger Detector properties
       
   223          * object. This is inline rather than an exported function to
       
   224          * prevent a binary break in a case where an older PSL binary
       
   225          * might provide the constructor a smaller object due to the
       
   226          * PSL being compiled against an older version of the SHAI
       
   227          * header. When it's inline, the function is always in sync
       
   228          * with the object size.
       
   229          *
       
   230          * We slightly violate the coding conventions which say that
       
   231          * inline functions should be in their own file. We don't want
       
   232          * to double the number of USB SHAI headers just for sake of a
       
   233          * trivial constructor.
       
   234          */
       
   235         inline TChargerDetectorProperties() :
       
   236             iCapabilities(0)
       
   237             {
       
   238             };
       
   239 
       
   240         public: // Data
       
   241         /**
       
   242          * A bitmask specifying the static capabilities of this
       
   243          * Charger Detector. The PSL fills this field by bitwise
       
   244          * OR'ing the TChargerDetectorCaps capability bits
       
   245          * corresponding to supported features.
       
   246          */
       
   247         TChargerDetectorCaps iCapabilities;
       
   248         };
       
   249     };
       
   250 
       
   251 #endif //USB_CHARGER_DETECTION_SHAI_SHARED_H
       
   252 // END of file
       
   253