/*
* uboot go test
*/
//typedef void (*pr)(const char *fmt, ...);
//void (*pr)(const char *fmt, ...)=0x778137b8;
void (*pr)(const char *fmt, ...)=0xa7f8aef4;
void (*pc)(char fmt) = 0xa7f8aeb0; /*find in u-boot.map */
void (*puts)(const char *s)=0xa7f8aed8;
void (*udelay)(unsigned long usec)=0xa7f80ed4;
int add(int a, int b);
int rd8(int addr);
void wr8(int addr,char val);
//int g_val = 0;
int main(int argc, char **argv)
{
int i = 0;
int g_val = 0;
//pr print = (pr)0x0x778137b8;
/*pxa timer*/
*(int*)(0x40A000C0) = 0x8c;
*(int*)(0x40A00080) = 0x0AFFFFF;
*(int*)(0x40A00040) = 0x0;
pc('h');
pc('e');
pc('l');
pc('l');
pc('o');
pc(',');
pc('s');
pc('b');
pc('s');
pc('!');
for(i=10; i>0; i--)
{
puts("\nSBS");
g_val += i;
pr(" i(%d)+g_val(%d) = %d\n",i, g_val, add(i,g_val));
udelay(1000*1000);
}
pr("hello wolrd----i=%d\n",i);
pr("g_val addr is 0x%x\n", &g_val);
g_val = *(int*)0x40A00040;
pr("timer is %d\n", g_val);
return 0;
}
int add(int a, int b)
{
return a+b;
}
阅读(1993) | 评论(0) | 转发(0) |