?? burn.c
字號:
#if !BASIC_BIOS
#include <stdio.h>
#include "cli.h"
#include "uart.h"
#include "bios.h"
#include "39vf160.h"
extern void BurnFlash( unsigned short *dst, unsigned short *src, unsigned long size );
extern void CLI_BurnBasicBios( void );
extern void CLI_BurnExtendBios( void );
#if 0
static CommandNode CLI_NAME_NURN =
{
"burn", // node command hint pointer
"保存數據類", // node command help pointer
NULL, // node current input buffer pointer
NULL, // down leaf pointer
NULL, // right leaf pointer
COMMAND_TYPE_KEY, // node type
NULL // node command value
};
static CommandNode CLI_NAME_BIOS =
{
"bios", // node command hint pointer
"BIOS", // node command help pointer
NULL, // node current input buffer pointer
NULL, // down leaf pointer
NULL, // right leaf pointer
COMMAND_TYPE_KEY, // node type
NULL // node command value
};
static CommandNode CLI_NAME_BASIC =
{
"basic", // node command hint pointer
"基本BIOS", // node command help pointer
NULL, // node current input buffer pointer
NULL, // down leaf pointer
NULL, // right leaf pointer
COMMAND_TYPE_KEY, // node type
CLI_BURNBASICBIOS // node command value
};
static CommandNode CLI_NAME_EXTEND =
{
"extend", // node command hint pointer
"擴展BIOS", // node command help pointer
NULL, // node current input buffer pointer
NULL, // down leaf pointer
NULL, // right leaf pointer
COMMAND_TYPE_KEY, // node type
CLI_BURNEXTENDBIOS // node command value
};
static CommandNode CLI_NAME_FROM =
{
"from", // node command hint pointer
"源地址", // node command help pointer
NULL, // node current input buffer pointer
NULL, // down leaf pointer
NULL, // right leaf pointer
COMMAND_TYPE_HEX, // node type
NULL // node command value
};
static CommandNode CLI_NAME_FROM1 =
{
"from", // node command hint pointer
"源地址", // node command help pointer
NULL, // node current input buffer pointer
NULL, // down leaf pointer
NULL, // right leaf pointer
COMMAND_TYPE_HEX, // node type
NULL // node command value
};
static CommandNode CLI_NAME_PROGRAM =
{
"program", // node command hint pointer
"用戶程序", // node command help pointer
NULL, // node current input buffer pointer
NULL, // down leaf pointer
NULL, // right leaf pointer
COMMAND_TYPE_KEY, // node type
CLI_BURNPROGRAM // node command value
};
static CommandNode CLI_NAME_SIZE =
{
"size", // node command hint pointer
"程序大小", // node command help pointer
NULL, // node current input buffer pointer
NULL, // down leaf pointer
NULL, // right leaf pointer
COMMAND_TYPE_HEX, // node type
NULL // node command value
};
CommandNode *CLI_BurnBasicBios4[] =
{
&CLI_NAME_NURN,
&CLI_NAME_BIOS,
&CLI_NAME_BASIC,
&CLI_NAME_FROM
};
CommandNode *CLI_BurnExtendBios4[] =
{
&CLI_NAME_NURN,
&CLI_NAME_BIOS,
&CLI_NAME_EXTEND,
&CLI_NAME_FROM
};
CommandNode *CLI_BurnProgram4[] =
{
&CLI_NAME_NURN,
&CLI_NAME_PROGRAM,
&CLI_NAME_FROM1,
&CLI_NAME_SIZE
};
void CLI_BurnProc( unsigned char key )
{
switch( key )
{
case CLI_BURNBASICBIOS:
CLI_BurnBasicBios();
break;
case CLI_BURNEXTENDBIOS:
CLI_BurnExtendBios();
break;
case CLI_BURNPROGRAM:
break;
}
}
void CLI_BurnBasicBios( void )
{
char *str;
unsigned long addr;
str = CLI_GetCommandKey( 0 );
if( str != NULL )
{
if( 1 == sscanf( str, "%lx", &addr ))
{
BurnFlash( (unsigned short*)FLASH_BASIC_BIOS_ADDR, (unsigned short*)addr, FLASH_BASIC_BIOS_SIZE );
}
}
}
void CLI_BurnExtendBios( void )
{
char *str;
unsigned long addr;
str = CLI_GetCommandKey( 0 );
if( str != NULL )
{
if( 1 == sscanf( str, "%lx", &addr ))
{
BurnFlash( (unsigned short*)FLASH_EXTEND_BIOS_ADDR, (unsigned short*)addr, FLASH_EXTEND_BIOS_SIZE );
}
}
}
void CLI_BurnProgram( void )
{
char *str;
unsigned long addr, size;
str = CLI_GetCommandKey( 0 );
if( str != NULL )
{
if( 1 == sscanf( str, "%lx", &addr ))
{
}
else
{
return;
}
}
str = CLI_GetCommandKey( 1 );
if( str != NULL )
{
if( 1 == sscanf( str, "%lx", &size ))
{
BurnFlash( (unsigned short*)FLASH_PROGRAM_START_ADDR, (unsigned short*)addr, size );
}
}
}
#endif
void BurnFlash( unsigned short *dst, unsigned short *src, unsigned long size )
{
unsigned long i, k;
unsigned long tmp = (unsigned long)dst;
UART_Printf("\r\nBurning from SDRAM 0X%08X to FALSH 0X%08X", src, dst );
UART_Printf("\r\n0X " );
for( i = 0; i < (size + SECTOR_BYTE_SIZE - 1)/ SECTOR_BYTE_SIZE; i++ )
{
Erase_One_Sector( dst );
for( k = 0; k < SECTOR_WORD_SIZE; k++ )
{
Program_One_Word( dst, *src );
dst++;
src++;
}
UART_Printf("\b\b\b\b\b\b%06X", (unsigned long)dst - tmp );
}
}
#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -