
Software examples
34
Wake on RTC alarm
We start with an example that doesn’t need additional external hardware. The following code will put the
CPU module in soft-off sleep mode and wake it after 2 minutes using RTC alarm.
The RTC contains two sets of indexed registers that are accessed using the two separate Index and Target
registers (70h/71h or 72h/73h), as shown in the following table:
An0065. CPU-1450 Soft Power Management
#include <stdio.h>
#include <conio.h>
#include <i86.h>
/* Eurotech SpA
/* Version 0.5, date 07-02-2006 */
void main()
{
printf( "Eurotech S.p.a. CPU-1450 Wake On RTC\n" );
printf( "Put to sleep a Cpu1450 and wake with RTC alarm to 2 minutes \n" );
printf( "\npress any key to continue\n");
getch();
outp(0x2E, 0x2D );
/* Super IO PC87364 Initialization */
outp(0x2F, 0x19 );
/* set ACPI mode in SIO */
/* Configure the RTC Register accessing using the Index and Target registers, */
/* refer to the following table for detailed info on register contents */
outp(0x70, 0x0 );
/* Configure RTC Seconds 00s*/
outp(0x71, 0x0 );
outp(0x70, 0x1 );
/* Configure RTC Seconds Alarm 00s*/
outp(0x71, 0x0 );
outp(0x70, 0x2 );
/* Configure RTC Minutes 00m*/
outp(0x71, 0x0 );
outp(0x70, 0x3 );
/* Configure RTC Minutes Alarm 02m*/
outp(0x71, 0x2 );
outp(0x70, 0x4 );
/* Configure RTC Hours 00h*/
outp(0x71, 0x0 );
outp(0x70, 0x5 );
/* Configure RTC Hours Alarm 00h*/
outp(0x71, 0x0 );
outp(0x70, 0xB );
/* Configure RTC Register B Contents */
outp(0x71, 0x22 );
outp(0x6003, 0x4 );
/* Programming the 2
nd
byte of PM1_EN – PWR Manag 1 En Reg */
outpw (0x6000, 0xFFFF );
/* clr wake status and others into PM1_STS */
_disable();
/* disable interrupts */
outpw (0x6004, 0x1C00 );
/* set slp_type = slp_to_s5 */
outpw (0x6004, 0x3C00 );
/* set slp */
}
Содержание CPU-1450
Страница 1: ...Rev 1 0 Feb 2006 An0065 CPU 1450 Soft Power Management...
Страница 4: ...This page is intentionally left blank...
Страница 6: ...This page is intentionally left blank...
Страница 8: ...This page is intentionally left blank...
Страница 14: ...This page is intentionally left blank...
Страница 40: ...This page is intentionally left blank...
Страница 41: ...Chapter 8 Appendix...
Страница 42: ...This page is intentionally left blank...