📄 runapp.c
字号:
/* MShowTec - www.mshowtec.com
** msLinux runapp.c ver1.0
** 20051221 lmjx create limiao@mshowtec.com
**
*/
#define MSLINUX_RUNAPP_C
#include "kernel.h"
#include "string.h"
#include "sys.h"
#include "msApp_entry.h"
#include "runapp.h"
unsigned char msappbin[72] ={0x01, 0x01, 0x01, 0x01, 0x00, 0x08, 0x00, 0x00, 0x24, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x8F, 0xE2, 0xFB, 0x05, 0xC8, 0xEA, 0x63, 0x61, 0x6C, 0x6C, 0x5F, 0x74,
0x65, 0x73, 0x74, 0x0D, 0x0A, 0x00, 0x08, 0x40, 0x2D, 0xE9, 0x08, 0x00, 0x8F, 0xE2, 0xF5,
0x05, 0xC8, 0xEB, 0x08, 0x40, 0xBD, 0xE8, 0xF5, 0xFF, 0xFF, 0xEA, 0x6D, 0x73, 0x61, 0x70,
0x70, 0x5F, 0x68, 0x61, 0x6E, 0x64, 0x6C, 0x65, 0x72, 0x0D, 0x0A, 0x00};
int msApp_load(char *p_app_name)
{
memcpy((void*)MSAPP_ENTRY_ADDR,msappbin,72);
if(app_entry.app_ver <= ACCEPT_APPVER &&
app_entry.compile_ver <= ACCEPT_COMPILEVER &&
app_entry.platform_id <= ACCEPT_PLATFORMID &&
app_entry.product_id == ACCEPT_PRODUCTID
){
//caculate the crc code
//if crc ok
return 0;
}
return -1;
}
int run_app(char *p_app_name)
{
int ret,i;
void (*app_handler)();
ret = msApp_load(p_app_name);
if(ret){
printk("app load error\r\n");
return -1;
}
(long)app_handler = app_entry.app_entry;
printk("p_appver->ver = %d\r\n",app_entry.app_ver);
printk("p_appver->stacksz = %d\r\n",app_entry.stack_sz);
if(!_sys_fork()){
int stack_sz = 0;
stack_sz = sys_setstack(app_entry.stack_sz);
if(stack_sz > 0){
app_handler();
}else{
printk("set app stack error\r\n");
}
sys_exit(0);
}
wait(&i);
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -