os/kernelhwsrv/kernel/eka/euser/us_power.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of the License "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
// e32\euser\us_power.cpp
sl@0
    15
// 
sl@0
    16
//
sl@0
    17
sl@0
    18
#include <e32power.h>
sl@0
    19
#include "us_std.h"
sl@0
    20
sl@0
    21
sl@0
    22
sl@0
    23
sl@0
    24
/**
sl@0
    25
Enables wakeup events.
sl@0
    26
sl@0
    27
Starts a system-wide transition to a low power state enabling wakeup events.
sl@0
    28
sl@0
    29
The exact specification of wakeup events depends on the target power state
sl@0
    30
and the platform.
sl@0
    31
For example, an absolute timer expiration event wakes up the system from
sl@0
    32
the EPwStandby power state on all currently supported platforms.
sl@0
    33
sl@0
    34
If, at the time this function is called, wakeup events are enabled, then
sl@0
    35
the implementation disables them before enabling them again.  
sl@0
    36
sl@0
    37
The caller must have PowerMgnt capability to perform this call; otherwise
sl@0
    38
it panics with EPlatformSecurityTrap code.
sl@0
    39
sl@0
    40
@param aState   The target low power state; this can be EPwStandby or KPwOff.
sl@0
    41
				
sl@0
    42
@return KErrNone, if successful,
sl@0
    43
        KErrArgument, if aState is neither EPwStandby nor KPwOff;
sl@0
    44
        otherwise one of the other system-wide error codes.
sl@0
    45
		
sl@0
    46
@panic KERN-EXEC 46 if the caller does not have PowerMgnt capability.
sl@0
    47
		
sl@0
    48
@see Power::DisableWakeupEvents()		
sl@0
    49
sl@0
    50
@capability PowerMgmt
sl@0
    51
*/
sl@0
    52
EXPORT_C TInt Power::EnableWakeupEvents(TPowerState aState)
sl@0
    53
	{
sl@0
    54
	return Exec::PowerEnableWakeupEvents(aState);
sl@0
    55
	}
sl@0
    56
sl@0
    57
sl@0
    58
sl@0
    59
sl@0
    60
/**
sl@0
    61
Disables wakeup events.
sl@0
    62
sl@0
    63
If, at the time this function is called, wakeup events are disabled, then
sl@0
    64
the function does nothing and returns immediately.
sl@0
    65
sl@0
    66
The caller must have PowerMgnt capability to perform this call; otherwise it
sl@0
    67
panics with EPlatformSecurityTrap code.
sl@0
    68
		
sl@0
    69
@panic KERN-EXEC 46 if the caller does not have PowerMgnt capability.		
sl@0
    70
sl@0
    71
@capability PowerMgmt
sl@0
    72
*/
sl@0
    73
EXPORT_C void Power::DisableWakeupEvents()
sl@0
    74
	{
sl@0
    75
	Exec::PowerDisableWakeupEvents();
sl@0
    76
	}
sl@0
    77
sl@0
    78
sl@0
    79
sl@0
    80
sl@0
    81
/**
sl@0
    82
Requests notification of a subsequent wakeup event.
sl@0
    83
sl@0
    84
Typically the user-side domain manager issues this request 
sl@0
    85
before starting a system-wide transition to a low power state by
sl@0
    86
enabling wakeup events.
sl@0
    87
sl@0
    88
Only one pending request is allowed. The request completes immediately
sl@0
    89
with KErrInUse status if another request is currently pending.
sl@0
    90
sl@0
    91
The caller must have PowerMgnt capability to perform this call; otherwise
sl@0
    92
it panics with EPlatformSecurityTrap code.
sl@0
    93
sl@0
    94
@param aStatus The request status to signal on wakeup event
sl@0
    95
sl@0
    96
@panic KERN-EXEC 46 if the caller does not have PowerMgnt capability.
sl@0
    97
sl@0
    98
@see Power::EnableWakeupEvents()
sl@0
    99
sl@0
   100
@capability PowerMgmt
sl@0
   101
*/
sl@0
   102
EXPORT_C void Power::RequestWakeupEventNotification(TRequestStatus& aStatus)
sl@0
   103
	{
sl@0
   104
	aStatus = KRequestPending;
sl@0
   105
	Exec::PowerRequestWakeupEventNotification(&aStatus);
sl@0
   106
	}
sl@0
   107
sl@0
   108
sl@0
   109
sl@0
   110
sl@0
   111
/**
sl@0
   112
Cancels a pending wakeup event notification request.
sl@0
   113
sl@0
   114
If, at the time this function is called, the notification request is still
sl@0
   115
pending, then the request completes with KErrCancel status.
sl@0
   116
sl@0
   117
The caller must have PowerMgnt capability to perform this call; otherwise it panics with
sl@0
   118
EPlatformSecurityTrap code
sl@0
   119
sl@0
   120
@panic KERN-EXEC 46 if the caller does not have PowerMgnt capability.
sl@0
   121
sl@0
   122
@capability PowerMgmt
sl@0
   123
*/
sl@0
   124
EXPORT_C void Power::CancelWakeupEventNotification()
sl@0
   125
	{
sl@0
   126
	Exec::PowerCancelWakeupEventNotification();
sl@0
   127
	}
sl@0
   128
sl@0
   129
sl@0
   130
sl@0
   131
sl@0
   132
/**
sl@0
   133
Lowers the kernel power state.
sl@0
   134
	 
sl@0
   135
Changes the kernel power state from EPwActive to the state specified by the last 
sl@0
   136
call to EnableWakeupEvents().
sl@0
   137
sl@0
   138
If the target state is EPwStandby, the function returns either immediately,
sl@0
   139
if at least one wakeup event has occurred since the last call
sl@0
   140
to EnableWakeupEvent(), or when a wakeup event eventually occurs.
sl@0
   141
		
sl@0
   142
When this function returns, wakeup events are disabled.
sl@0
   143
sl@0
   144
If the target state is EPwOff, this function never returns,
sl@0
   145
the system is powered off, and can subsequently only come back by rebooting.
sl@0
   146
sl@0
   147
The caller must have PowerMgnt capability to perform this call; otherwise
sl@0
   148
it panics with EPlatformSecurityTrap code
sl@0
   149
sl@0
   150
@return KErrNone, if successful;
sl@0
   151
        KErrNotReady, if wakeup events are disabled at the time this function is called;
sl@0
   152
        otherwise one of the other system-wide error codes.
sl@0
   153
sl@0
   154
@panic KERN-EXEC 46 if the caller does not have PowerMgnt capability.
sl@0
   155
sl@0
   156
@capability PowerMgmt
sl@0
   157
*/
sl@0
   158
EXPORT_C TInt Power::PowerDown()
sl@0
   159
	{ 
sl@0
   160
	return Exec::PowerDown();
sl@0
   161
	}