?? copy.c
字號(hào):
#if !BASIC_BIOS
#include <stdio.h>
#include "cli.h"
#include "uart.h"
static CommandNode CLI_NAME_COPY =
{
"copy", // node command hint pointer
"內(nèi)存copy", // 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_FROM =
{
"from", // node command hint pointer
"源地址(HEX)", // node command help pointer
NULL, // node current input buffer pointer
NULL, // down leaf pointer
NULL, // right leaf pointer
COMMAND_TYPE_HEX, // node type
CLI_COPY // node command value
};
static CommandNode CLI_NAME_TO =
{
"to", // node command hint pointer
"目的地址(HEX)", // 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_SIZE =
{
"size", // node command hint pointer
"大小(HEX)", // 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_Copy[] =
{
&CLI_NAME_COPY, // copy
&CLI_NAME_FROM, // from
&CLI_NAME_TO, // to
&CLI_NAME_SIZE, // size
NULL
};
void CLI_CopyProc( void )
{
char *s, *d, *str;
unsigned long src, dst, size, i;
str = CLI_GetCommandKey( 0 );
if( str != NULL )
{
if( 1 == sscanf( str, "%lx", &src ))
{
s = (char*)src;
}
else
{
UART_Printf("\r\nError start");
}
}
str = CLI_GetCommandKey( 1 );
if( str != NULL )
{
if( 1 == sscanf( str, "%lx", &dst ))
{
d = (char*)dst;
}
else
{
UART_Printf("\r\nError end");
}
}
str = CLI_GetCommandKey( 2 );
if( str != NULL )
{
if( 1 == sscanf( str, "%lx", &size ))
{
}
else
{
UART_Printf("\r\nError size");
}
}
if( src > dst )
{
src^=dst^=src;
}
if( src + size < dst )
{
for( i = 0; i < size; i++ )
{
*d = *s;
s++;
d++;
}
}
else
{
d+=size;
s+=size;
for( i = 0; i < size; i++ )
{
*d = *s;
s--;
d--;
}
}
UART_Printf("\r\nCopy from 0X%X to 0X%X, size 0X%X OK", src, dst, size );
}
#endif
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -