Wince power management to cope with mobile embedded energy consumption bottlenecks

Source: Internet
Author: User
  • Http://developer.51cto.com Beijing name chinaitlab I want to comment (0)
    With the popularization of Mobile Embedded products, power management has become an important technical indicator and an organic component of the product. Typical mobile embedded devices are increasingly sensitive to energy consumption, and power management technology is becoming the key to product design. In order to cope with the challenges of power management, how to design an efficient embedded system power management has become a research hotspot. The main energy consumption components of typical mobile embedded systems include embedded microprocessor CPU, memory, LCD and backlight, power conversion components, DSP, and peripheral controller. Among these components, some components have fixed energy consumption, and some components can work in different time periods and have various controllable energy consumption states. The effective use of these components becomes the key to saving energy for embedded systems.

    1. What is wince power management?
    (1) power management concepts and methods
    In Mobile Embedded Systems powered by batteries, high-efficiency power chips are generally used for power supply management, or large-capacity batteries are used to meet energy consumption requirements, however, the development of these two technologies cannot meet the dynamic and static power consumption requirements of mobile embedded devices. One way to coordinate the contradiction between high performance and low power consumption is to adjust the performance according to the system load and minimize the energy consumption by stopping the clock and power supply of some modules.

    Embedded systems are divided into sleep, idle, and run modes based on their power consumption. During most of the time, the device works normally during run, while in sleep and idle mode, the processor can perform corresponding energy saving according to the specific mode. Therefore, the purpose of power management is to save energy, and the basic energy-saving method is to make the system enter and exit sleep in a timely manner. In the energy-saving status, the processor hangs and the main memory runs in the energy-saving self-Refresh mode. Only the power consumption management circuit and the wake-up circuit continue to work. For example, if you press the on/off button, the timer that monitors user activity times out, or the application API can make the embedded system sleep, when the user presses on/off again or another wake-up interruption occurs, the system will quit sleep. Therefore, the power management module is inseparable from user activity, and power management is driven by user activity.

    GWES is part of Wince's processing of user-system interaction, so early power management work is also implemented by GWES. However, the power management module provided by GWES is too rough and rigid. All Sub-devices can only have on and suspend statuses, and applications cannot receive any status switch notifications. Later, WinCE introduced the Power Manager module to replace the power management function in GWES. The new power management module provides more complete and flexible functions, for example, the power status of the sub-device can be set separately, and the application can receive power notifications. As a result, the Power Manager is responsible for managing device power and is compatible with devices and applications that do not support power management. It acts as a intermediary between the kernel oal layer, device drivers, and applications.

    (2) Power Manager Structure
    In the wince system powered by battery, it is critical to correctly design the power management. The functions can be roughly divided into three categories: system-level power management, dynamic power management, and device power management. Generally, applications do not need to pay attention to the power loss of the wince device most of the time, but pay attention to these losses in some cases. The wincepower supply manager connects a dynamic chainfo library named pm.dllto the device.exe of the device manager. PM. DLL Dynamic Link Library supports three types of interfaces: one is the driver interface: Used for the driver of the device that requires power management; the other is the application interface: used for applications that require power management; 3. Notification: used for applications that require power event reminders.

    For example, the wince system first checks the task load. If there is no task to be run, it generally enters the idle energy-saving status and waits for waking up. After a period of idle time, it enters deep sleep, suspended to Ram or hard disk. During task running, WinCE can also use the power management function provided by hardware to dynamically adjust the operating voltage and frequency of the chip and perform more detailed power management on the system.

    2. wince power management classification
    (1) system power status
    The power status of the Win CE system is a configuration scheme that represents the power supply of the system. It is a collection of power configurations of each sub-device. It sets a possible scenario and develops a power allocation policy in advance under this scenario (which sub-devices are enabled and which sub-devices are disabled ). Wince supports the following power status: ① on, the user is actively using the device. ② Useridle status. The user stops interacting with the device, but the device may still be used. ③ Systemidle status, which enters this status after a period of useridle, but the driver and system are still active. ④ Suspend status. This status is entered when the driver and system process no longer interact with the system. ⑤ Coldreboot and reboot status, and the system power status after cold start.

    Therefore, based on the platform features, technicians can add new policies to meet the needs of different mobile embedded products. A common practice is to design a streaming driver with a power button. When the button is detected, call the API to convert the system power to suspend, such as on/off. In addition, the backlight control is added. For example, in the on status, the driver is requested to turn on the backlight, and in the useridle and systemidle statuses, the driver is requested to turn off the backlight.

    (2) device power management
    Wince has added the advanced power management component function, which allows each peripheral to have its own power status, which is different from the general system power status ), it is called device power state ). Currently, applications generally have the ability to set the power status of individual peripherals. For example, a file transfer program can disable the display screen and backlight while maintaining normal communication between the serial port or Bluetooth port, this makes it possible to achieve more advanced dynamic power management.

    The interaction between the Power Manager and the device that supports power management includes two mechanisms: one is from the Power Manager to the driver, and the Power Manager uses deviceiocontrol () the function sends I/O Control (IOCTLs) to the device driver, so the device must be able to respond to IOCTLs such as the query and status settings of the Power Manager. Second, the driver is sent to the Power Manager. The driver uses the devicepower notify () function to interact with the Power Manager. For example, the driver requests the Power Manager to put its device in a certain state,

    If the power manager accepts this request, it sends ioctl_power_set and other IOCTLs for setting.

    (3) Application and Power Manager Interaction
    The Win CE application interacts with the Power Manager by using an application interface to obtain the power status of the current system and device. The application uses setsystempowerstate () to set the system power status, setdevicepower to set the power status of the sub-device, and setpowerrequirement to notify the Power Manager to set the sub-device to a special power status, does not change with system power supply. Second, the power event reminder interface. To implement the reminder interface, the application can also use the createmsgqueue () function to create a message queue, send its handle to the power manager, and the power manager then sends the reminder to the message queue, the caller can select a subset of available reminders for response.

    (4) Implementation of oal Layer Power Management
    OEM adaptation layer (oal) is a layer of Code related to the hardware platform. It plays an important role in power status conversion. In wince, The oal layer power management is implemented through the oemidle () and oempoweroff () functions. Oeminit is called upon initial power-on (or after cold start), such as initializing system memory, establishing a debugging environment, and setting system interruptions; when there is no scheduling thread in the system, the kernel calls oemidle () to reduce the frequency of the processor to reduce power consumption. This function can be modified and customized by the OEM in BSP.

    When an external interrupt occurs, the CPU can be recovered from it. For example, when you press the off button or the application calls the API to enter the suspend state, the kernel calls the oempoweroff () function, after the system wakes up, the oempoweroff () is suspended for execution. The oempoweroff function is implemented based on the hardware platform. It can store CPU registers, set up and recover wake-up data. The system idle status is different from the preceding useridle status. The former is driven by CPU load, indicating that the system is idle, and the latter is driven by user activity, indicating that the user is idle.

    3. Analyze the power management status from application interaction
    When the wince system is suspended, you need to turn off the processor and power supply of most devices to save power, and then wake up by using a timer or wireless module when you need to wake up. In general, after being awakened, the system will return to the same status as before the system suspension. Therefore, the application does not know that the system has been suspended unless it explicitly requests to notify the system when the system is suspended. From the perspective of applications, there are three ways to manage power: querying Power status, changing power status, and preventing power status changes.

    (1) query Power status
    For embedded systems, OEMs define the power status of the system. For example, the power status may be on, idle, suspend, screenoff, incradle, and onbattery. From the perspective of the application, the Power Management Program provides the ability to notify the power status change and the ability to change the power status through a series of functions.

    Therefore, the current power status of the system is an important function of wince. You can call DWORD getsystempowerstatusex2 (psystem_power_status_ex2, DWORD dwlen, bool fupdate) to query the current power status. The function uses three parameters to tell the wince system to query the final information of the battery driver or directly return the information in the battery cache. The system queries the battery status every five seconds. Because wince does not verify the data returned by the battery drive, different systems have different changes. The data returned by this function is mainly dependent on the battery drive. For example, many systems do not report accurate power levels when using AC power, while others do.

    (2) Changing the Power Supply Status
    Applications can change the power status of the system in a series of ways. The preferred method in wince is to use the power management program. The power management program provides functions to allow applications to control the power status. For example, an application requests a specific power status by calling the setsystempowerstate function. Generally, there are two ways to control the power supply. The first method is to give the application a power supply setting, and the second method is to request the power status not lower than the given level.

    For example, ① when the power is disabled, the application suspends the system by calling the gwespoweroffsystem function. For example, if the void gwespoweroffsystem (void) function is called, the system is suspended. ② Turn off the screen. If the system displays colored backlights, the main power consumption is not the CPU but the backlights. In some environments, an application does not need to be displayed on the screen when running the program. For example, in the music player app, if a user does not pay attention to the screen while listening to music, turning off the backlight in these cases will increase the battery life. Of course, when users want to view the screen, any application that turns off the backlight needs a simple way to re-open the screen. The display control is implemented through the ext-escape function, which allows the application to open or close the display. In addition, WinCE does not have a uniform way to control the brightness of the backlight. Each system has its own OEM-specific method to control the brightness of the backlight. ③ Turn on the system power, which means that when the suspended application is to run again, there must be a way to wake up a suspended system power. You can use the notification API to wake up the system. In general, OEM manufacturers allocate some interruption conditions to enable or wake up the power supply.

    (3) prevent system power-off
    On the other hand, Preventing System suspension is also an important issue. The wince system is usually set to automatically suspend when there is no user input for a period of time. Therefore, if the timer reaches a pre-defined interval without user input, the system automatically suspends. To prevent automatic suspension, the application can periodically call this function: void winapi systemidletimerreset (void). This function can reset wince to monitor user input timers. Therefore, when an application needs to change the timeout value, it can call systemidletimerreset to change the timeout value of the suspension. Generally, the wince system maintains three timeout values to prevent the power supply from being automatically suspended. You can use systemparametersinfo to query these three values and return systemidletimerreset in the shortest time. If the timeout value is set to 0, the timeout value is disabled.

    (4) Power Supply notification
    Finally, the Power Management Program also has a very popular feature, that is, it can notify the application when the system power status changes, which can free the application from manual detection of Power status.

    The application sends a notification to the application when the power status changes by calling requestpowerconfigurications to request the Power Management Program. The power management program then sends this notification through a message queue established by the application.

    In short, embedded power management is a rapidly developing research topic in the wince system. It has a key impact on the design of mobile embedded products. An efficient power management design can help Mobile Embedded products stand out in the market competition and win the enemy.

    [Edit recommendations]

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.