//============================================================================
// Include
//============================================================================
#include <stdio.h>
#include <cyg/kernel/kapi.h>
#include <cyg/io/pmu/fie702x_pmu.h>
#include <cyg/io/rtc/fie702x_rtc.h>
#include "RTCSystem.h"
#include "PMUSystem.h"
//============================================================================
// Global Variables
//============================================================================
cyg_io_handle_t pmu_handle, rtc_handle;
int main (void)
{
int err;
int m, n, i;
RTC_Time time;
err = cyg_io_lookup( "/dev/rtc", &rtc_handle );
if (ENOERR != err)
{
printf("Can't open '%s'\n", "/dev/rtc");
}
err = cyg_io_lookup( "/dev/pmu", &pmu_handle );
if (ENOERR != err)
{
printf("Can't open '%s'\n", "/dev/pmu");
}
while (1)
{
m = 24;
for (n = 1; n < 4; n ++)
{
printf("HCLK = %d Hz, PCLK = %d Hz\n", API_PMU_get_HCLK(pmu_handle), API_PMU_get_PCLK(pmu_handle));
for (i = 0; i < 3; i ++)
{
cyg_thread_delay (100);
API_RTC_get_Time(rtc_handle, &time);
printf("time = %02d: %02d\n", time.minute, time.second);
}
API_PMU_do_FCS(pmu_handle, m, n);
}
}
}