embeded/Cortex-M3 Ti

cortex-m3 hibernate module...

구차니 2016. 4. 14. 13:51

아.. 이래서 시간이 초기화가 안된거였나..





unsigned long ulStatus;

unsigned long ulNVData[64];

//

// Need to enable the hibernation peripheral before using it.

//

SysCtlPeripheralEnable(SYSCTL_PERIPH_HIBERNATE);

//

// Enable clocking to the Hibernation module.

//

HibernateEnableExpClk(SysCtlClockGet());

//

// User-implemented delay here to allow crystal to power up and stabilize.

//

//

// Configure the clock source for Hibernation module, and enable the RTC

// feature. This configuration is for a 4.194304 MHz crystal.

//

HibernateClockSelect(HIBERNATE_CLOCK_SEL_DIV128);

HibernateRTCEnable();

//

// Set the RTC to 0, or an initial value. The RTC can be set once when the

// system is initialized after the cold-startup, and then left to run. Or

// it can be initialized before every hibernate.

//

HibernateRTCSet(0);

//

// Set the match 0 register for 30 seconds from now.

//

HibernateRTCMatch0Set(HibernateRTCGet() + 30);

//

// Clear any pending status.

//

ulStatus = HibernateIntStatus(0);

HibernateIntClear(ulStatus);

//

// Save the program state information. The state information will be

// stored in the ulNVData[] array. It is not necessary to save the full 64

// words of data, only as much as is actually needed by the program.

//

HibernateDataSet(ulNVData, 64);

//

// Configure to wake on RTC match.

//

HibernateWakeSet(HIBERNATE_WAKE_RTC);

//

// Request hibernation. The following call may return since it takes a

// finite amount of time for power to be removed.

//

HibernateRequest();