kernel/eka/include/drivers/resource.h
changeset 259 57b9594f5772
parent 247 d8d70de2bd36
equal deleted inserted replaced
247:d8d70de2bd36 259:57b9594f5772
    10 //
    10 //
    11 // Contributors:
    11 // Contributors:
    12 //
    12 //
    13 // Description:
    13 // Description:
    14 // e32\include\drivers\resource.h
    14 // e32\include\drivers\resource.h
    15 // 
    15 //
    16 // WARNING: This file contains some APIs which are internal and are subject
    16 // WARNING: This file contains some APIs which are internal and are subject
    17 //          to change without notice. Such APIs should therefore not be used
    17 //          to change without notice. Such APIs should therefore not be used
    18 //          outside the Kernel and Hardware Services package.
    18 //          outside the Kernel and Hardware Services package.
    19 //
    19 //
    20 
    20 
    24 #include <kernel/kern_priv.h>
    24 #include <kernel/kern_priv.h>
    25 #include <drivers/resourcecontrol_trace.h>
    25 #include <drivers/resourcecontrol_trace.h>
    26 #include <drivers/resource_category.h>
    26 #include <drivers/resource_category.h>
    27 
    27 
    28 //Definition for resource flag setting. Used by PSL.
    28 //Definition for resource flag setting. Used by PSL.
    29 static const TUint KTypeMask= 0x3;
    29 const TUint KTypeMask             = 0x3;
    30 static const TUint KUsageOffset=0x1F;
    30 const TUint KUsageOffset          = 0x1F;
    31 static const TUint KLongLatencySetOffset=0x1E;
    31 const TUint KLongLatencySetOffset = 0x1E;
    32 static const TUint KLongLatencyGetOffset=0x1D;
    32 const TUint KLongLatencyGetOffset = 0x1D;
    33 static const TUint KClassOffset=0x1C;
    33 const TUint KClassOffset          = 0x1C;
    34 static const TUint KSenseOffset=0x1A;
    34 const TUint KSenseOffset          = 0x1A;
    35 static const TUint KShared=0x1U<<KUsageOffset;
    35 const TUint KShared               = 0x1u << KUsageOffset;
    36 static const TUint KLongLatencySet=0x1<<KLongLatencySetOffset;
    36 const TUint KLongLatencySet       = 0x1u << KLongLatencySetOffset;
    37 static const TUint KLongLatencyGet=0x1<<KLongLatencyGetOffset;
    37 const TUint KLongLatencyGet       = 0x1u << KLongLatencyGetOffset;
    38 static const TUint KLogical=0x1<<KClassOffset;
    38 const TUint KLogical              = 0x1u << KClassOffset;
    39 static const TUint KSenseNegative=0x01<<KSenseOffset;
    39 const TUint KSenseNegative        = 0x1u << KSenseOffset;
    40 static const TUint KSenseCustom=0x2<<KSenseOffset;
    40 const TUint KSenseCustom          = 0x2u << KSenseOffset;
    41 
    41 
    42 struct TPowerRequest;
    42 struct TPowerRequest;
    43 struct SIdleResourceInfo;
    43 struct SIdleResourceInfo;
    44 
    44 
    45 
    45 
   147                                    TAny* /*aParam*/);
   147                                    TAny* /*aParam*/);
   148 
   148 
   149 /**
   149 /**
   150 @publishedPartner
   150 @publishedPartner
   151 @prototype 9.5
   151 @prototype 9.5
   152 An object of this type prepresents a customised Dfc
   152 An object of this type represents a customized Dfc
   153 used to signal completion of the resource manager's asynchronous APIs
   153 used to signal completion of the resource manager's asynchronous APIs
   154 and completion of notifications
   154 and completion of notifications
   155 @see TPowerResourceManager
   155 @see TPowerResourceManager
   156  */
   156  */
   157 class TPowerResourceCb : public TDfc
   157 class TPowerResourceCb : public TDfc
   189         PRM_CALLBACK_COMPLETION_TRACE
   189         PRM_CALLBACK_COMPLETION_TRACE
   190         }
   190         }
   191 private:
   191 private:
   192     void Lock()
   192     void Lock()
   193         {
   193         {
       
   194 		__ASSERT_DEBUG(iMutex, Kern::Fault("TPowerResourceCb::Lock", __LINE__));
   194         NKern::ThreadEnterCS();
   195         NKern::ThreadEnterCS();
   195         Kern::MutexWait(*iMutex);
   196         Kern::MutexWait(*iMutex);
   196         }
   197         }
   197     void UnLock()
   198     void UnLock()
   198         {
   199         {
       
   200 		__ASSERT_DEBUG(iMutex, Kern::Fault("TPowerResourceCb::UnLock", __LINE__));
   199         Kern::MutexSignal(*iMutex);
   201         Kern::MutexSignal(*iMutex);
   200         NKern::ThreadLeaveCS();
   202         NKern::ThreadLeaveCS();
   201         }
   203         }
   202     TAny* iParam; //Stores the aPtr argument passed in the constructor, to be passed as 5th argument to the callback function
   204     TAny* iParam; //Stores the aPtr argument passed in the constructor, to be passed as 5th argument to the callback function
   203     TInt iResult; //Used to store the result aswell as binary usage count for the callback
   205     TInt iResult; //Used to store the result as well as binary usage count for the callback
   204     TInt iLevel; // Level of the resource
   206     TInt iLevel; // Level of the resource
   205 	TInt iLevelOwnerId; // Stores owner of the resource for asynchronous get operation
   207 	TInt iLevelOwnerId; // Stores owner of the resource for asynchronous get operation
   206     TUint iResourceId; //Stores the ID of the resource whose state is changed/read asynchronously
   208     TUint iResourceId; //Stores the ID of the resource whose state is changed/read asynchronously
   207     TUint iClientId; //Stores the ID of the client that requested the asynchronous operation
   209     TUint iClientId; //Stores the ID of the client that requested the asynchronous operation
   208     TPowerResourceCbFn iCallback; //Callback function object
   210     TPowerResourceCbFn iCallback; //Callback function object