GAPE/gape_chipset_api.h
changeset 0 bb4b476bbb96
child 5 ef85d0a8d402
equal deleted inserted replaced
-1:000000000000 0:bb4b476bbb96
       
     1 /*
       
     2   gptimer_chipset_api.h
       
     3 
       
     4   Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
       
     5   All rights reserved.
       
     6 
       
     7   This program and the accompanying materials are made available 
       
     8   under the terms of the Eclipse Public License v1.0 which accompanies 
       
     9   this distribution, and is available at 
       
    10   http://www.eclipse.org/legal/epl-v10.html
       
    11 
       
    12   Initial Contributors:
       
    13   Nokia Corporation - initial contribution.
       
    14 
       
    15   Contributors:
       
    16 */
       
    17 
       
    18 /** @file
       
    19 @brief gape_chipset_api.h
       
    20 
       
    21 This a header file of gape_chipset_api.h
       
    22 
       
    23 @publishedDeviceAbstraction
       
    24 */
       
    25 
       
    26 #ifndef __GAPE_H__
       
    27 #define __GAPE_H__
       
    28 
       
    29 // Include files
       
    30 
       
    31 #include <kern_priv.h>
       
    32 
       
    33 // Constants
       
    34 
       
    35 /* The list of the descriptor names what the array can hold */
       
    36 _LIT8( KTvOut, "TvOut" );
       
    37 _LIT8( KKeypad, "Keypad" );
       
    38 _LIT8( KNand, "Nand" );
       
    39 _LIT8( KPrimaryDisplay, "PriDisp" );
       
    40 _LIT8( KSecondaryDisplay, "SecDisp" );
       
    41 _LIT8( KSecurity, "Security" );
       
    42 _LIT8( KUsbExt, "UsbExtension" );
       
    43 _LIT8( KUsbDriver, "UsbDriver" );
       
    44 _LIT8( KDigitiser, "Digitiser" );
       
    45 _LIT8( KMmc, "Mmc" );
       
    46 _LIT8( KSd, "Sd" );
       
    47 _LIT8( KHdd, "Hdd" );
       
    48 _LIT8( KCustom, "Custom" );
       
    49 _LIT8( KJoystick, "Joystick" );
       
    50 _LIT8( KLight, "Light" );
       
    51 _LIT8( KSwitch, "Switch" );
       
    52 _LIT8( KQwerty, "Qwerty" );
       
    53 _LIT8( KPanicScreen, "PanicScreen" );
       
    54 _LIT8( KBootFigure0, "BootFigure0" );
       
    55 _LIT8( KBootFigure1, "BootFigure1" );
       
    56 _LIT8( KThermalSensor, "ThermalSensor" );
       
    57 _LIT8( KCameraHWA, "CameraHWA" );
       
    58 _LIT8( KCameraDriver, "CameraDriver" );
       
    59 _LIT8( KDisplayDriver, "DisplayDriver" );
       
    60 _LIT8( KPowerModel, "PowerController" );
       
    61 _LIT8( KTwistDriver, "TwistDriver" );
       
    62 _LIT8( KCameraStaticData, "CameraStaticData" );
       
    63 _LIT8( KAccelerometer, "Accelerometer" );
       
    64 _LIT8( KExpander, "KeypadExpander" );
       
    65 _LIT8( KPowerTouareg, "PowerTouareg" );
       
    66 _LIT8( KKernelDataTransferApiUsb, "UsbDataIf" );
       
    67 _LIT8( KNaviScroll, "NaviScroll" );
       
    68 _LIT8( KTouchIC, "TouchIC" );
       
    69 
       
    70 /** Array for pointers (for registered descriptors) */
       
    71 const TDesC8* const KPtrArray[] =
       
    72     {
       
    73     &KTvOut,
       
    74     &KKeypad,
       
    75     &KNand,
       
    76     &KPrimaryDisplay,
       
    77     &KSecondaryDisplay,
       
    78     &KSecurity,
       
    79     &KUsbExt,
       
    80     &KUsbDriver,
       
    81     &KDigitiser,
       
    82     &KMmc,
       
    83     &KSd,
       
    84     &KHdd,
       
    85     &KCustom,
       
    86     &KJoystick,
       
    87     &KLight,
       
    88     &KSwitch,
       
    89     &KQwerty,
       
    90     &KPanicScreen,
       
    91     &KBootFigure0,
       
    92     &KBootFigure1,
       
    93     &KThermalSensor,
       
    94     &KCameraHWA,
       
    95     &KCameraDriver,
       
    96     &KDisplayDriver,
       
    97     &KPowerModel,
       
    98     &KCameraStaticData,
       
    99     &KAccelerometer,
       
   100     &KExpander,
       
   101     &KPowerTouareg,
       
   102     &KKernelDataTransferApiUsb,
       
   103     &KNaviScroll,
       
   104     &KTouchIC
       
   105     };
       
   106 
       
   107 /** Maximum number of items in an array */
       
   108 const TUint KPtrArraySize = ( sizeof( KPtrArray ) / sizeof( KPtrArray[0] ) );
       
   109 
       
   110 // Macros
       
   111 
       
   112 // Data types
       
   113 
       
   114 // Function prototypes
       
   115 
       
   116 // Forward declarations
       
   117 
       
   118 // Class declaration
       
   119 
       
   120 /**
       
   121 @brief Class description
       
   122 /**
       
   123 
       
   124 Generic APE-side library for kernel side clients.
       
   125 
       
   126 */
       
   127 class GApe
       
   128     {
       
   129     public:
       
   130         /**
       
   131             Return an instance to GApe interface. This method returns the
       
   132             only GApe instance system can have, it is not possible to create
       
   133             new instances of this class.
       
   134 
       
   135             @return GApe* An instance to GApe class
       
   136         */
       
   137         static GApe* Instance();
       
   138 
       
   139         /**
       
   140             Save pointer to internal array e.g.
       
   141 
       
   142             @code
       
   143             TInt ret = GApe::SetPtr( KTvOut, this );
       
   144             if ( ret != KErrNone )
       
   145                 {
       
   146                 // Error handling...
       
   147                 }
       
   148             @endcode
       
   149 
       
   150             @param  aName   Name used for registering pointer
       
   151             @param  aPtr    Pointer to be saved
       
   152 
       
   153             @return KErrNone, if successful. KErrAlreadyExists, if the pointer
       
   154                     is already registered. KErrNotFound, if the 'aName' is not
       
   155                     a valid name.
       
   156         */
       
   157         IMPORT_C static TInt SetPtr(const TDesC8& aName, TAny* const aPtr);
       
   158 
       
   159         /**
       
   160             Get pointer from internal array e.g.
       
   161 
       
   162             @code
       
   163             DTvOut* tvout = static_cast<DTvOut*>( GApe::GetPtr( KTvOut ) );
       
   164             if ( tvout )
       
   165                 {
       
   166                 // Usage...
       
   167                 }
       
   168             @endcode
       
   169 
       
   170             @param  aName   Name of the registered pointer
       
   171 
       
   172             @return Pointer to requested item. May also return NULL, which
       
   173                     indicates that the pointer is not registered or the name
       
   174                     is not valid.
       
   175         */
       
   176         IMPORT_C static TAny* GetPtr(const TDesC8& aName);
       
   177 
       
   178     private:
       
   179         /**
       
   180             Defined as a private to prevent clients to create own instances
       
   181             from this class.
       
   182         */
       
   183         GApe();
       
   184 
       
   185         /**
       
   186             Defined as a private to prevent clients to delete the instance of
       
   187             this class.
       
   188         */
       
   189         ~GApe();
       
   190 
       
   191     private:
       
   192         /** Array where the registered pointers are stored */
       
   193         TAny* iPtrArray[ KPtrArraySize ];
       
   194 
       
   195         /** Internal instance to allow static methods to access instance
       
   196             data. */
       
   197         static GApe* GApePtr;
       
   198     };
       
   199 
       
   200 // Global Function Prototypes
       
   201 
       
   202 // Inline Functions
       
   203 
       
   204 // Namespace
       
   205 
       
   206 #endif // __GAPE_H__
       
   207 
       
   208 // End of File