NOTE Kernel global variables

For detailed information about global variables that the kernel exports for scheduling, see the section 'Kernel Global Variables for Scheduling' in the Windows Embedded CE 6.0 Documentation, available on the Microsoft MSDN Web site at http://msdn.microsoft.com/en- us/library/aa915099.aspx.

Powering Off and Suspending the System

The maximum power saving state that a Windows Embedded CE device can support is the Power Off or Suspend state. The system can request the device to enter the Suspend state by calling GwesPowerOffSystem directly or SetSystemPowerState. Both functions eventually call the OEMPowerOff routine.

The OEMPowerOff routine is part of the OAL and responsible for switching the CPU into Suspend state. OEMPowerOff should also put the RAM into self-refresh mode if the processor does not automatically do so when it enters the Suspend state. You can also set up the interrupts to wake up the device. In handheld devices, this is typically the power-button interrupt, but you may use any wakeup event source that is appropriate for your target platform.

Entering the Suspend State

When entering the Suspend state, Windows Embedded CE performs the following sequence of steps:

1. GWES notifies the Taskbar about the power down event.

2. The system aborts calibration if in the calibration screen.

3. The system stops the Windows message queues. After step 3, the system enters single-thread mode, which prevents function calls that rely on blocking operations.

4. The system checks if the startup user interface (UI) must appear on resume.

5. The system saves video memory to RAM.

6. The system calls SetSystemPowerState (NULL, POWER_STATE_SUSPEND, POWER_FORCE).

7. Power Manager:

 a. Calls the FileSystemPowerFunction to power off the drivers related to the file system.

 b. Calls PowerOffSystem to inform the kernel to do the final power down.

 c. Calls Sleep(0) to invoke the scheduler.

NOTE FileSystemPowerFunction and PowerOffSystem

If the OS design does not include Power Manager or GWES, then the OEM must explicitly call FileSystemPowerFunction and PowerOffSystem.

8. Kernel:

 a. Unloads GWES process.

 b. Unloads Filesys.exe.

 c. Calls OEMPowerOff.

9. OEMPowerOff configures the interrupts and puts the CPU in Suspend state.

Waking Up from Suspend State

When a pre-configured interrupt wakes up the system, the associated ISR runs and returns to the OEMPowerOff routine. On returning from this function, the system goes through the resume sequence, which includes the following steps:

1. OEMPowerOff re-configures interrupts to original state and returns.

2. Kernel:

 a. Calls InitClock to re-initialize the system timer.

 b. Starts Filesys.exe with power on notification.

 c. Starts GWES with power on notification.

 d. Re-initializes KITL interrupt if it was in use.

3. Power Manager calls FileSystemPowerFunction with power on notification.

4. GWES:

 a. Restores video memory from RAM.

 b. Powers on Windows Manager.

 c. Sets the display contrast.

 d. Shows startup UI if required.

 e. Notifies Taskbar of resume.

 f. Notifies User Subsystem.

 g. Triggers applications as required.

NOTE Registering wakeup sources

If the OAL supports the kernel IOCTL_HAL_ENABLE_WAKE, applications can register wake up sources. For detailed information, see the section 'IOCTL_HAL_ENABLE_WAKE' in the Windows Embedded CE 6.0 Documentation, available on the Microsoft MSDN Web site at http://msdn2.microsoft.com/en- us/library/aa914884.aspx.

Supporting the Critical Off State

On hardware platforms equipped with a voltage comparator that triggers NMI, you can implement support for the Critical Off state to protect the user from data loss in low-battery conditions. On x86 hardware, the kernel exports the OEMNMIHandler function to capture critical events in the system. On other systems, you might have to implement a custom IST that calls SetSystemPowerState to turn off the system gracefully with the help of Power Manager. The Critical Off state typically corresponds to the Suspend state with dynamic RAM refresh enabled.

NOTE Battery level reaches zero

When implementing Critical Off state support, make sure you trigger the NMI at a point when the system still has time to perform all power down tasks , such as powering down peripherals, putting RAM into self-refresh, perhaps setting a wakeup condition, and suspending the CPU.

Добавить отзыв
ВСЕ ОТЗЫВЫ О КНИГЕ В ИЗБРАННОЕ

0

Вы можете отметить интересные вам фрагменты текста, которые будут доступны по уникальной ссылке в адресной строке браузера.

Отметить Добавить цитату