"panelargs=light=on;display=10;bit=10bit;repack=0;delay1=50;delay2=60;delay3=100\0" \
===============================================================
extern unsigned long simple_strtoul(const char *cp,char **endp,unsigned int base);
static void get_panel_config(cmd_tbl_t * cmdtp,int flag,int argc,char * const argv [ ])
{
printf("%s\n", __FUNCTION__);
const char *strDelimit = ";";//
char buf[512]={0};
int Count = 0;
char *token = NULL;
char *value = NULL;
char env_buf[20] ={0};
char *cmdline = getenv ("panelargs");//"panelargs=light=on;display=10;bit=10bit;repack=0;delay1=50;delay2=60;delay3=100\0" \
//int info = simple_strtoul(getenv("fb_addr"), NULL, NULL);
if(cmdline !=NULL)
{
strcpy(buf,cmdline);
}
//setenv ("panelargs", buf);
token = strtok(buf, strDelimit);
while (token != NULL) {
//data_buf[tmpTotalItemCount] = strtol(token, NULL, radix);
printf("panel %d : %s\n",Count,token);
strcpy(env_buf,token);
token = strtok(NULL, strDelimit);
Count += 1;
printf("env_buf %d : %s\n",Count,env_buf);
value = strchr(env_buf, '=');
//value--;
printf("value : %s\n",value);
if(value ==NULL)
printf("value is null \n",);
ext_value = simple_strtoul(value, NULL, 10);
printf("ext_value: %d \n",ext_value);
memset(env_buf,0,20);
}
}
U_BOOT_CMD(
doconfig, 2, 1, get_panel_config,
"test lcd config",
"show display lcd info\n"
"doconfig \n"
);
阅读(914) | 评论(0) | 转发(0) |