📄 shell.c
字号:
#include "../inc/def.h"
#include "44b.h"
#include "../inc/config.h"
#include "../inc/board.h"
#include "../inc/utils.h"
#include "../inc/shell.h"
void SetParams(void);
static unsigned int BaudSet[] = {4800, 9600, 19200, 38400, 57600, 115200, 0};
static EnvParams Env;
extern U32 NandFlashSize;
struct Partition *pNandPart = Env.NandPartition;
typedef int (*cmdproc)(int argc, char *argv[]);
typedef struct {
char *cmd;
char *hlp;
cmdproc proc;
}CMD_STRUC;
CMD_STRUC CMD_INNER[] = {
{"help", "show this list", Help},
{"?", "= help", Help},
#ifdef RTC_TIMER_SUPPORT
{"date", "show or set current date", GetDate},
{"time", "show or set current time", GetTime},
{"setweek", "set weekday", SetWeek},
#endif
{"clock", "show system running clock", ShowSysClock},
#ifdef SET_SYSCLK_SUPPORT
{"setmclk", "set system running clock", ChgSysClk},
#endif
#ifdef SERIAL_PORTS_SWITCH
{"chguart", "change uart(0/1)", ChgUartPort},
#endif
{"setbaud", "set baud rate", ChgBaudRate},
#ifdef TFTP_DOWNLOAD_SUPPORT
{"ipcfg", "show or set current IP address", SetIpAddr},
{"netload", "download file by net", LoadFromNet},
{"netrun", "download file by net and run", NetLoadRun},
{"g", "download file by net and run", NetLoadRun},
#endif
{"comload", "download file by uart", LoadFromUart},
{"comrun", "download file by uart and run", UartLoadRun},
#ifdef XMODEM_DOWNLOAD_SUPPORT
{"rx", "download file by xmodem", XmodemReceive},
{"rxrun", "download file by xmodem and run", XmodemReceiveRun},
#endif
#ifdef USB_DOWNLOAD_SUPPORT
{"usbload", "download file by usb", UsbDownload},
{"usbrun", "download file by usb and run", UsbDownloadRun},
#endif
#ifdef NOR_FLASH_SUPPORT
{"prog", "program flash", ProgFlash},
{"ap", "download file and program it to flash", AutoLoadAndProgFlash},
{"backup", "move bios to the top of flash", BackupBios},
{"copy", "copy flash from src to dst address", CopyFlash},
{"boot", "boot from flash", BootLoader},
#endif
{"run", "run program", RunProgram},
{"move", "move data from addr1 to addr2", MoveMem},
{"mrun", "move data form prog_s_addr to prog_r_addr and run", MoveRun},
{"md", "show memory data", MemoryDisplay},
{"memd", "show 8/16/32bits memory", MemoryShow},
{"mems", "set 8/16/32bits memory", MemorySet},
#ifdef SAVE_ENV_SUPPORT
{"senv", "save enviroment value to flash", SaveEnv},
#endif
{"machine", "set machine number", SetMachine},
{"setpa", "set program save(run) address", SetProgAddr},
{"setbp", "set program boot parameters", SetBootParams},
{"bootkey", "set key to autoboot", SetBootKey},
#ifdef NAND_FLASH_SUPPORT
{"nfpart", "set nand flash partitions", NandPart},
{"nferase", "erase nand flash partition", NandErase},
{"nfprog", "program nand flash", NandProg},
{"nfload", "load program from nand flash", NandLoad},
#endif
{"defset", "default setting for ucLinux", Default_Setting },
{NULL, NULL, NULL}
};
U32 download_addr;
U32 download_len;
#ifdef RTC_TIMER_SUPPORT
TIME_STRUC SysTime;
char *WeekDay[7] = {"MON", "TUES", "WED", "THURS","FRI", "SAT", "SUN"};
#endif
/*
void cache_flush(void)
{
unsigned int *pLRU, i;
pLRU = (unsigned int *)0x10004000;
for(i=0; i<(128<<2); i+=4)
pLRU[i] = 0;
}*/
void GetBoardKey(void)
{
/* unsigned int key;
void (*fp)(void) =(void (*)(void))BIOS_LOAD;
if((rPDATG&0xf0) != 0xf0)
{
key = rPDATG&0xf0;
Delay(500); //┑
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -