📄 main_cf.c
字号:
#define GLOBAL_CLK 1
/*
*********************************************************
* 头文件
*********************************************************
*/
#include <stdlib.h>
#include <string.h>
#include "def.h"
#include "option.h"
#include "2440addr.h"
#include "2440lib.h"
/*
*********************************************************
* 常量
*********************************************************
*/
extern void CF_Card_Test( void );
/*
*********************************************************
* 变量
*********************************************************
*/
void * func_uart_test[][2]=
{
//iic
(void *)CF_Card_Test, "Test CF Card ",
0,0
};
/*
*********************************************************
* 函数介绍:本函数被使用来做测试cf Card/ide的功能。
* 输入参数:无
* 输出参数:无
* 返回值 :无
*********************************************************
*/
void Main(void)
{
int i;
U8 key;
U32 mpll_val = 0 ;
Port_Init(); //端口初始化
Isr_Init(); //中断初始化
i = 2 ; //don't use 100M!
//boot_params.cpu_clk.val = 3;
switch ( i ) {
case 0: //200
key = 12;
mpll_val = (92<<12)|(4<<4)|(1);
break;
case 1: //300
key = 13;
mpll_val = (67<<12)|(1<<4)|(1);
break;
case 2: //400
key = 14;
mpll_val = (92<<12)|(1<<4)|(1);
break;
case 3: //440!!!
key = 14;
mpll_val = (102<<12)|(1<<4)|(1);
break;
default:
key = 14;
mpll_val = (92<<12)|(1<<4)|(1);
break;
}
//init FCLK=400M, so change MPLL first
ChangeMPllValue((mpll_val>>12)&0xff, (mpll_val>>4)&0x3f, mpll_val&3);
ChangeClockDivider(key, 12);
cal_cpu_bus_clk();
Clk0_Disable();
Clk1_Disable();
Uart_Init(0,115200); //串口初始化 波特率为115200
Uart_Select(0); //选者串口0
Uart_Printf("\n====== cf Card Test start ======\n");
while(1)
{
i=0;
Uart_Printf("\n\n");
while(1)
{ //display menu
Uart_Printf("%2d:%s",i,func_uart_test[i][1]);
i++;
if((int)(func_uart_test[i][0])==0)
{
Uart_Printf("\n");
break;
}
if((i%4)==0)
Uart_Printf("\n");
}
Uart_Printf("\nPress Enter key to exit : ");
i = Uart_GetIntNum();
if(i==-1) break; // return.
if(i>=0 && i<7 ) // select and execute...
( (void (*)(void)) (func_uart_test[i][0]) )();
}
Uart_Printf("\n====== cf Card Test end ======\n");
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -