RTC是S3C2440的内部时钟(包括定时器)。板子上有专门的电池供电。所以开发板断电下,也可以维持当前的时钟。
下面的实验是当时钟过一秒后,触发定时器(闹钟)发出一声鸣笛。
#define GLOBAL_CLK 1
#include "def.h"
#include "option.h"
#include "2440addr.h"
#include "2440lib.h"
#include "mmu.h"
static char enable_beep=0;
U8 month,date,weekday,hour,minute,second;
U16 year;//年份是16位长
char *week[] = {"星期一","星期二","星期三","星期四","星期五","星期六","星期日"};
static U32 cpu_freq;
static U32 UPLL;
static void cal_cpu_bus_clk(void)
{
U32 val;
U8 m, p, s;
val = rMPLLCON;
m = (val>>12)&0xff;
p = (val>>4)&0x3f;
s = val&3;
//(m+8)*FIN*2 不要超出32位数!
FCLK = ((m+8)*(FIN/100)*2)/((p+2)*(1<<s))*100;
val =