📄 2410loader.c
字号:
/************************************************
* NAME : 2410loader.C *
* DESC : *
* History : 2002.02.25 ver 0.0 *
************************************************/
#include <stdlib.h>
#include <string.h>
#include "option.h"
#include "def.h"
#include "2410addr.h"
#include "2410slib.h"
#include "2410addr.h"
#include "k9f1208.h"
//#include "mmu.h"
#include "inc/serial.h"
#include "inc/xmodem.h"
#include "k9f1208.h"
#define DOWNLOAD_ADDRESS _RAM_STARTADDRESS
void ChangeClockDivider(int hdivn,int pdivn);
void ChangeMPllValue(int mdiv,int pdiv,int sdiv);
void Uart_SendString(char *pt);
void Uart_Init(int pclk,int baud);
void Uart_Printf(char *fmt,...);
void (*run)(void)=(void (*)(void))(_RAM_STARTADDRESS);
void Port_Init(void);
int NF_ReadPage(U32 block,U32 page,U8 *buffer);
void NF_Init(void);
U8 *downPt;
void Main(void)
{
size_t retlen;
int i,j,k=0,modem=1;
char c;
char *buf=(char *)0x30008000;
char file_name[255] = { 0, };
long size=0x000cc000;
unsigned long boot_delay=0x30000000;
MMU_EnableICache();
ChangeClockDivider(1,1); // 1:2:4
ChangeMPllValue(0x5c,0x4,0x0); //Fin=12MHz FCLK=200MHz
Port_Init();
Uart_Init(PCLK, 115200);
downPt=(U8 *)0x30008000;
Uart_SendString("\nPress Return to start the uCOS now, any other key for DownLoad");
c = awaitkey(boot_delay, NULL);
if (((c != '\r') && (c != '\n') && (c != '\0'))) {
retlen=download_file(buf, size, modem, file_name);
if (retlen == 0) {
Uart_SendString("Failed downloading file\n");
return;
}
Uart_Printf("Downloaded file at 0x%08lx, size = %d bytes\n", buf, retlen);
K9S1208_Program(retlen);//write flash
}
NF_Init();
j=4044;
while(j<4054) // Read 1~807 block(13635072B) for WinCE image
{
for(i=0;i<32;i++) // Read 32 page
{
NF_ReadPage(j, i, (U8 *)downPt);
downPt += 512; // Next page
k=1;
}
j++;
}
Uart_SendString("\nrun");
run();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -