Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to WakeUp Windows CE with RTC

277 views
Skip to first unread message

Alexander Kovachev

unread,
Feb 3, 2005, 3:58:55 PM2/3/05
to
Hello I'm developing Windows CE platform based on PXA27x CPU.
So far I was able to put the system to sleep (SUSPEND) mode, however I
cannot make it to WakeUp at specified time. The only functions I saw in PB
help were CeRunAppAtTime and CeRunAppAtEvent. However those functions do
much more than just resuming the execution. I also saw OEMSetAlamrTime
function, however it is not accesible from my application. So here is my
code:

Printf("\r\nEntering POWER_STATE_SUSPEND ...");
// alarm should be set here
SetSystemPowerState(NULL,POWER_STATE_SUSPEND, POWER_FORCE);
Printf("\r\nExiting POWER_STATE_SUSPEND ...");

So how can I setup RTC alarm so the OS resumes at particular time? And also
how do I configure to resume on COMM event (character) ?


Chuck Lin

unread,
Feb 3, 2005, 6:07:22 PM2/3/05
to
Try:
RequestPowerNoticications() API
Read from MessageQ
POWER_BROADCAST state will be PBT_RESUME to wake up.

Make sure your platform support power management.

Chuck

"Alexander Kovachev" <alex...@sontek.com> wrote in message
news:ex0XtMjC...@TK2MSFTNGP09.phx.gbl...

Alexander Kovachev

unread,
Feb 3, 2005, 7:14:29 PM2/3/05
to
It looks like RequestPowerNotifications function will allow me to receive
notification about the power events. However what I need is to be able to
tell Windows CE when to wake-up from SUSPEND. Or in other word I need to set
up a wake-up alarm.
Example:

SetWakeupTime(...) - or something like that which will end up in
OEMSetAlarmTime
SetSystemPowerState(SUSPEND)

Any ideas ?

"Chuck Lin" <clin[at]applieddata[dot]net> wrote in message
news:uiQoiUkC...@TK2MSFTNGP10.phx.gbl...

John Baik

unread,
Feb 4, 2005, 2:01:49 AM2/4/05
to
As you mentioned, you can set up Alarm Timer with CeRunAppAtTime(). It will
call OEMSetAlarmTime() in kernel mode.
From other process you can put system in sleep mode.

If your system is in Sleep Mode and it hits Alarm Timer, System will wake up
and run your application.
If your System is not in Sleep Mode and it hits Alarm Timer, Registered Apps
will be launched.

Here I have undocumented important information.
I have to have two processes which one is for making system Sleep, another
for calling CeRunAppAtTime.
I have to set Alarm Timer 15 Secs or more later than current time.

As you know, Xscale can wake up GPIO Line Status Changes.
If you can wire one of GPIO line to Serial Control Line, you may wake up
your system.
But this require H/W implementation.

If you want to sample code, send me email(John...@hotmail.com).

Thanks
John Baik

"Alexander Kovachev" <alex...@sontek.com> wrote in message
news:ex0XtMjC...@TK2MSFTNGP09.phx.gbl...

Chuck Lin

unread,
Feb 4, 2005, 10:08:01 AM2/4/05
to
Hi:

You can try the other way without the fancy power management feature.
This is the easy way to do it. Please try it.

while(true)
{
// get current time
GetLocalTime(&st);

// increment 1 second
SystemTimeToFileTime(&st, &ft);

// *** store file time to time64
time64 = ft.dwHighDateTime;
time64 *= 0x100000000;
time64 |= ((LONGLONG) ft.dwLowDateTime);

// ***
time64 += (delay * 10000000);

// *** store time64 back to file time
ft.dwHighDateTime = (DWORD) (time64/0x100000000);
ft.dwLowDateTime = (DWORD) (time64%0x100000000);
// ***

FileTimeToSystemTime(&ft, &st);

// register app to run --> anything to wake up system
CeRunAppAtTime(_T("\\Storage Card\\WriteTest.exe"), &st);

Sleep(1000);

// suspend
GwesPowerOffSystem();

}
"Chuck Lin" <clin[at]applieddata[dot]net> wrote in message
news:uiQoiUkC...@TK2MSFTNGP10.phx.gbl...

Alex

unread,
Feb 8, 2005, 4:56:20 PM2/8/05
to
Ensure that the wakeup time is programmed into the RTC in
OEMSetAlarmTime. Also ensure that WERTC bit is set in PXA27x PWER register.
0 new messages