devicesrv_plat/energymgmt_chipset_api/inc/adc_chipset_api.h
changeset 78 3f0699f2e14c
equal deleted inserted replaced
77:8a984d260a2d 78:3f0699f2e14c
       
     1 /*
       
     2  Nokia/Devices/R&D/CT/Adaptation SW/BB
       
     3  CONFIDENTIAL
       
     4  Deliverable software
       
     5 
       
     6 
       
     7 
       
     8  adc_chipset_api.h
       
     9  --------------------------------
       
    10 
       
    11  SW Include Document - Symbian OS
       
    12 
       
    13 
       
    14 
       
    15  Document identification and location in Synergy/CM
       
    16 
       
    17  Database:           co1core
       
    18 
       
    19  Object (this information is substituted by Synergy/CM):
       
    20  %name:           adc_chipset_api.h %
       
    21  %cvtype:         incl %
       
    22  %instance:       bh1dsgas_1 %
       
    23  %version:        1 %
       
    24  %date_modified:  Wed Oct 06 17:16:07 2010 %
       
    25 
       
    26  Copyright (c) Nokia. This material, including documentation and any related
       
    27  computer programs, is protected by copyright controlled by Nokia.
       
    28  All rights are reserved. Copying, including reproducing, storing, adapting or
       
    29  translating, any or all of this material requires the prior written consent
       
    30  of Nokia. This material also contains confidential information, which may not
       
    31  be disclosed to others without the prior written consent of Nokia.
       
    32  */
       
    33 
       
    34 /** @file
       
    35  @brief Chipset API H Template
       
    36 
       
    37  This is a header template for Chipset API work. This template should not be
       
    38  used as a normal code template because the location of where the API is
       
    39  documented is different in normal coding style! Doxygen commenting style tries
       
    40  to be similar what Symbian is using for their kernel side development.
       
    41 
       
    42  You can define here also the scope of the whole API see below, or you can
       
    43  define the scope separately before the class or even before the function if
       
    44  that is needed.
       
    45 
       
    46  @publishedDeviceAbstraction
       
    47  */
       
    48 
       
    49 #ifndef ADC_CHIPSET_API_H
       
    50 #define ADC_CHIPSET_API_H
       
    51 
       
    52 /* ---------------------------------------------------------------------------
       
    53  *
       
    54  * CONSTANTS
       
    55  *
       
    56  */
       
    57 
       
    58 /* Battery Voltage (VBAT) */
       
    59 #define HAL_ADC_CHIPSET_VBAT 0x01
       
    60 
       
    61 /* Battery Size Identification (BSI) */
       
    62 #define HAL_ADC_CHIPSET_BSI 0x04
       
    63 
       
    64 /* Battery TEMPerature (BTEMP) */
       
    65 #define HAL_ADC_CHIPSET_BTEMP 0x05
       
    66 
       
    67 /* Power Amplifier TEMPerature (PATEMP) */
       
    68 #define HAL_ADC_PATEMP 0x09
       
    69 
       
    70 /* Battery current (positive: current from battery to phone, negative: current running to the battery) */
       
    71 /* Ibat can be implemented as a physical or logical adc channel, in case of logical this channel is still used in calibration */
       
    72 #define HAL_ADC_CHIPSET_IBAT 0x0E
       
    73 
       
    74 /* PWB Temperature */
       
    75 #define HAL_ADC_CHIPSET_PWBTEMP 0x22
       
    76 
       
    77 /* Main channel  */
       
    78 #define HAL_ADC_MAIN_CAL 0xFE
       
    79 
       
    80 #include <kernel.h>
       
    81 #include <platform.h>
       
    82 
       
    83 /* ---------------------------------------------------------------------------
       
    84  *
       
    85  * TYPES
       
    86  *
       
    87  */
       
    88 
       
    89 /*
       
    90  * Type definition for the call-back function used writing to
       
    91  *  asynchronous em callback.
       
    92  */
       
    93 typedef void (*HAL_ADC_CALLBACK)(TUint event, TInt p1, TAny* p2);
       
    94 
       
    95 /* ---------------------------------------------------------------------------
       
    96  *
       
    97  * FUNCTIONAL PROTOTYPES AND MACROS
       
    98  *
       
    99  */
       
   100 class TAdcHal
       
   101     {
       
   102 
       
   103     // Class declaration
       
   104 
       
   105     /**
       
   106      Implements AdcHal chipset
       
   107      */
       
   108 
       
   109 public:
       
   110 
       
   111     enum THalAdcCalType
       
   112         {
       
   113         EHalAdcCalAppliedVoltage = 1,
       
   114         EHalAdcCalAppliedCurrent,
       
   115         EHalAdcCalSensor
       
   116         };
       
   117 
       
   118     /* ---------------------------------------------------------------------------
       
   119      *
       
   120      * DATA STRUCTURES
       
   121      *
       
   122      */
       
   123 
       
   124     class HAL_ADC_CAL_DATA_ELEMENT_TYPE
       
   125         {
       
   126     public:
       
   127         TUint8 Channel;
       
   128         TUint16 RawReading;
       
   129         THalAdcCalType Type;
       
   130         TInt32 ReferenceValue;
       
   131         TInt32 Identification;
       
   132         };
       
   133 
       
   134     class HAL_ADC_CAL_DATA_TYPE
       
   135         {
       
   136     public:
       
   137         TUint16 NumberOfElements;
       
   138         HAL_ADC_CAL_DATA_ELEMENT_TYPE *Element;
       
   139         };
       
   140 
       
   141     /*
       
   142      * Constructor:
       
   143      */
       
   144 
       
   145     TAdcHal();
       
   146 
       
   147     /*
       
   148      * Extension entrypoint
       
   149      */
       
   150     IMPORT_C static TAdcHal* hal_adc_entry_point();
       
   151 
       
   152     /* Initialisation */
       
   153     virtual void hal_adc_init();
       
   154 
       
   155     /* Read/convert raw values */
       
   156     virtual TInt hal_adc_raw_read(TUint channel, TUint* value,
       
   157             HAL_ADC_CALLBACK adc_handler, TAny* context);
       
   158     virtual TInt hal_adc_unit_convert(TUint channel, TUint value);
       
   159 
       
   160     /* Calibration depending function */
       
   161     virtual TInt hal_adc_unit_read(TUint channel, TInt* value,
       
   162             HAL_ADC_CALLBACK adc_handler, TAny* context);
       
   163     virtual TInt hal_adc_cal_unit_conv(TUint channel, TUint rawval,
       
   164             TInt *unitval);
       
   165     virtual TInt hal_adc_cal_get(TUint8 channel, TUint *identification,
       
   166             TInt *value1, TInt *value2, TInt *value3);
       
   167     virtual TInt hal_adc_cal_set(HAL_ADC_CAL_DATA_TYPE *data);
       
   168     virtual TInt hal_adc_cal_store();
       
   169     virtual TInt hal_adc_unit_lock_channel(TUint channel, TBool action,
       
   170             TInt value);
       
   171     };
       
   172 
       
   173 #endif /* ADC_CHIPSET_API_H */
       
   174 /* End of Include File */