wince6.0系统S5PV210实现软件重启或复位或关机

应用层实现方法:

利用OEM制造商提供的OEMIoControl可以随意地处理IOCTL_HAL_REBOOT。然而应用程序不能直接调用OEMIoControl,只能通过先调用KernelIoControl然后由KernelIoControl调用OEMIoControl。   
  #include   "winioctl.h"   
  BOOL   KernelIoControl(DWORD   dwIoControlCode,   LPVOID   lpInBuf,   DWORD   nInBufSize,   LPVOID   lpOutBuf,   DWORD   nOutBufSize,   LPDWORD   lpBytesReturned);   
  #define   IOCTL_HAL_GET_DEVICE_INFO   CTL_CODE(FILE_DEVICE_HAL,   1,   METHOD_BUFFERED,   FILE_ANY_ACCESS)   
  #define   IOCTL_HAL_REBOOT   CTL_CODE(FILE_DEVICE_HAL,   15,   METHOD_BUFFERED,   FILE_ANY_ACCESS)   
  KernelIoControl(IOCTL_HAL_REBOOT,   &inVal,   4,   outBuf,   1024,   &bytesReturned);   
  执行上面的代码可以实现软重起。如果你想要实现硬重起,还需首先调用SetCleanRebootFlag函数。   
也可以这样用KernelIoControl(IOCTL_HAL_REBOOT, NULL, 0, NULL, 0, NULL);这个函数调用底层的OEMIoControl()函数。

或者:关机:SetSystemPowerState(NULL, POWER_STATE_OFF, POWER_FORCE);改为RESET就行。这个函数调用底层的哪个函数呢?
    待机:GwesPowerOffSystem();

底层实现方法:

The kernel calls the OEMIoControl function when a device driver or application calls the kernel function KernelIoControl and passes an I/O control code.

(当应用程序或者驱动调用KernelIoControl 的时候,KernelIoControl 就会调用OEMIoControl 去实现。)

This function is also called when the SystemParametersInfo function is called with SPI_GETOEMINFO or SPI_GETPLATFORMINFO.

The system is fully preemptible when this function is called. The kernel does no processing, but it passes all parameters directly to the function supplied by you. (当这个函数被调用的时候系统完全可能被抢占,内核没有处理,直接传递参数到你提供的函数。这个我觉得说的很别扭,估计是直接传递参数到OEMIoControl )

This function is provided solely to allow your device driver or application to communicate with an OAL and its specific functionality.

(该函数用来提供驱动/应用程序和OAL的通信)

2012-08-20今天在:oal\power\reset.c文件的OEMSWReset函数里实现硬件关闭PMIC_PWRHOLD_OUTPUT,然后调用KernelIoControl(IOCTL_HAL_REBOOT, &inVal, 4, outBuf, 2, &bytesReturned)这个函数,测试还是没有实现系统重启。继续研究看是怎么回事,跟注册表有关?注册表common.reg里和重启有个的如下:

; Entering this system power state reboots the system with a clean object
; store.  If an OEM includes this state in their platform, they must
; support KernelIoControl() with IOCTL_HAL_REBOOT.
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\State\ColdReboot]
    "Default"=dword:4           ; D4
    "Flags"=dword:800000        ; POWER_STATE_RESET

; Entering this system power state reboots the system.  If an OEM includes this state in
; their platform, they must support KernelIoControl() with IOCTL_HAL_REBOOT.

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\State\Reboot]
    "Default"=dword:4           ; D4
    "Flags"=dword:800000        ; POWER_STATE_RESET
这里面Flags是什么含义?

2012-08-21:在自己的电源控制的驱动里实现软件重启或关机了。

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

zhengmeifu

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值