os/kernelhwsrv/kernel/eka/euser/us_power.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/kernel/eka/euser/us_power.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,161 @@
     1.4 +// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of the License "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// e32\euser\us_power.cpp
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 +#include <e32power.h>
    1.22 +#include "us_std.h"
    1.23 +
    1.24 +
    1.25 +
    1.26 +
    1.27 +/**
    1.28 +Enables wakeup events.
    1.29 +
    1.30 +Starts a system-wide transition to a low power state enabling wakeup events.
    1.31 +
    1.32 +The exact specification of wakeup events depends on the target power state
    1.33 +and the platform.
    1.34 +For example, an absolute timer expiration event wakes up the system from
    1.35 +the EPwStandby power state on all currently supported platforms.
    1.36 +
    1.37 +If, at the time this function is called, wakeup events are enabled, then
    1.38 +the implementation disables them before enabling them again.  
    1.39 +
    1.40 +The caller must have PowerMgnt capability to perform this call; otherwise
    1.41 +it panics with EPlatformSecurityTrap code.
    1.42 +
    1.43 +@param aState   The target low power state; this can be EPwStandby or KPwOff.
    1.44 +				
    1.45 +@return KErrNone, if successful,
    1.46 +        KErrArgument, if aState is neither EPwStandby nor KPwOff;
    1.47 +        otherwise one of the other system-wide error codes.
    1.48 +		
    1.49 +@panic KERN-EXEC 46 if the caller does not have PowerMgnt capability.
    1.50 +		
    1.51 +@see Power::DisableWakeupEvents()		
    1.52 +
    1.53 +@capability PowerMgmt
    1.54 +*/
    1.55 +EXPORT_C TInt Power::EnableWakeupEvents(TPowerState aState)
    1.56 +	{
    1.57 +	return Exec::PowerEnableWakeupEvents(aState);
    1.58 +	}
    1.59 +
    1.60 +
    1.61 +
    1.62 +
    1.63 +/**
    1.64 +Disables wakeup events.
    1.65 +
    1.66 +If, at the time this function is called, wakeup events are disabled, then
    1.67 +the function does nothing and returns immediately.
    1.68 +
    1.69 +The caller must have PowerMgnt capability to perform this call; otherwise it
    1.70 +panics with EPlatformSecurityTrap code.
    1.71 +		
    1.72 +@panic KERN-EXEC 46 if the caller does not have PowerMgnt capability.		
    1.73 +
    1.74 +@capability PowerMgmt
    1.75 +*/
    1.76 +EXPORT_C void Power::DisableWakeupEvents()
    1.77 +	{
    1.78 +	Exec::PowerDisableWakeupEvents();
    1.79 +	}
    1.80 +
    1.81 +
    1.82 +
    1.83 +
    1.84 +/**
    1.85 +Requests notification of a subsequent wakeup event.
    1.86 +
    1.87 +Typically the user-side domain manager issues this request 
    1.88 +before starting a system-wide transition to a low power state by
    1.89 +enabling wakeup events.
    1.90 +
    1.91 +Only one pending request is allowed. The request completes immediately
    1.92 +with KErrInUse status if another request is currently pending.
    1.93 +
    1.94 +The caller must have PowerMgnt capability to perform this call; otherwise
    1.95 +it panics with EPlatformSecurityTrap code.
    1.96 +
    1.97 +@param aStatus The request status to signal on wakeup event
    1.98 +
    1.99 +@panic KERN-EXEC 46 if the caller does not have PowerMgnt capability.
   1.100 +
   1.101 +@see Power::EnableWakeupEvents()
   1.102 +
   1.103 +@capability PowerMgmt
   1.104 +*/
   1.105 +EXPORT_C void Power::RequestWakeupEventNotification(TRequestStatus& aStatus)
   1.106 +	{
   1.107 +	aStatus = KRequestPending;
   1.108 +	Exec::PowerRequestWakeupEventNotification(&aStatus);
   1.109 +	}
   1.110 +
   1.111 +
   1.112 +
   1.113 +
   1.114 +/**
   1.115 +Cancels a pending wakeup event notification request.
   1.116 +
   1.117 +If, at the time this function is called, the notification request is still
   1.118 +pending, then the request completes with KErrCancel status.
   1.119 +
   1.120 +The caller must have PowerMgnt capability to perform this call; otherwise it panics with
   1.121 +EPlatformSecurityTrap code
   1.122 +
   1.123 +@panic KERN-EXEC 46 if the caller does not have PowerMgnt capability.
   1.124 +
   1.125 +@capability PowerMgmt
   1.126 +*/
   1.127 +EXPORT_C void Power::CancelWakeupEventNotification()
   1.128 +	{
   1.129 +	Exec::PowerCancelWakeupEventNotification();
   1.130 +	}
   1.131 +
   1.132 +
   1.133 +
   1.134 +
   1.135 +/**
   1.136 +Lowers the kernel power state.
   1.137 +	 
   1.138 +Changes the kernel power state from EPwActive to the state specified by the last 
   1.139 +call to EnableWakeupEvents().
   1.140 +
   1.141 +If the target state is EPwStandby, the function returns either immediately,
   1.142 +if at least one wakeup event has occurred since the last call
   1.143 +to EnableWakeupEvent(), or when a wakeup event eventually occurs.
   1.144 +		
   1.145 +When this function returns, wakeup events are disabled.
   1.146 +
   1.147 +If the target state is EPwOff, this function never returns,
   1.148 +the system is powered off, and can subsequently only come back by rebooting.
   1.149 +
   1.150 +The caller must have PowerMgnt capability to perform this call; otherwise
   1.151 +it panics with EPlatformSecurityTrap code
   1.152 +
   1.153 +@return KErrNone, if successful;
   1.154 +        KErrNotReady, if wakeup events are disabled at the time this function is called;
   1.155 +        otherwise one of the other system-wide error codes.
   1.156 +
   1.157 +@panic KERN-EXEC 46 if the caller does not have PowerMgnt capability.
   1.158 +
   1.159 +@capability PowerMgmt
   1.160 +*/
   1.161 +EXPORT_C TInt Power::PowerDown()
   1.162 +	{ 
   1.163 +	return Exec::PowerDown();
   1.164 +	}