sys_config.fex
[board_para]edp_bl_pwm_channel = 0
gpio_f_2 = port:PF02<2><1><2>
gpio_f_3 = port:PF02<2><1><2>
string_demo=string:abcd1234
===================================================
点击(此处)折叠或打开
-
void script_parser_fetch_test(){
-
//获取GPIO
-
user_gpio_set_t gpio_info[1];
-
int ret;
-
ret = script_parser_fetch("board_para", "pwm0", gpio_info, sizeof(user_gpio_set_t)/sizeof(int));
-
if(ret < 0)
-
printk("fetch script gpio infomation fail\n");
-
else
-
printk("fetch script gpio infomation ok \n");
-
printk("[info] gpio_info.port=%04x,file=%s,fun=%s,line=%d\n",gpio_info[0].port,__FILE__ ,__func__,__LINE__);
-
printk("[info] gpio_info.port_num=%04x,file=%s,fun=%s,line=%d\n",gpio_info[0].port_num,__FILE__ ,__func__,__LINE__);
-
printk("[info] gpio_info.mul_sel=%04x,file=%s,fun=%s,line=%d\n",gpio_info[0].mul_sel,__FILE__ ,__func__,__LINE__);
-
printk("[info] gpio_info.pull=%04x,file=%s,fun=%s,line=%d\n",gpio_info[0].pull,__FILE__ ,__func__,__LINE__);
-
printk("[info] gpio_info.drv_level=%04x,file=%s,fun=%s,line=%d\n",gpio_info[0].drv_level,__FILE__ ,__func__,__LINE__);
-
printk("[info] gpio_info.data=%04x,file=%s,fun=%s,line=%d\n",gpio_info[0].data,__FILE__ ,__func__,__LINE__);
-
-
char string_info[128];
-
memset(string_info, 0, 128);
-
ret = script_parser_fetch("board_para", "string_demo", string_info, 128/sizeof(int));
-
if(ret < 0)
-
printk("fetch script string infomation fail\n");
-
else
-
printk("fetch script string infomation ok \n");
-
printk("[info] string_info=%s,file=%s,fun=%s,line=%d\n",string_info,__FILE__ ,__func__,__LINE__);
-
-
-
//获取子键个数
-
int sub_key_count = script_parser_subkey_count ("board_para");
-
if(sub_key_count < 0)
-
printk("fetch script sub key count fail\n");
-
else
-
printk("[info] sub_key_count=%d,file=%s,fun=%s,line=%d\n",sub_key_count,__FILE__ ,__func__,__LINE__);
-
//获取主键个数
-
-
-
int main_key_count = script_parser_mainkey_count();
-
if(main_key_count < 0)
-
printk("fetch script sub key count fail\n");
-
else
-
printk("[info] main_key_count=%d,file=%s,fun=%s,line=%d\n",main_key_count,__FILE__ ,__func__,__LINE__);
-
-
-
-
//获取主键下GPIO配置
-
ret = script_parser_mainkey_get_gpio_cfg("board_para",gpio_info, 1);
-
if(ret < 0)
-
printk("fetch script gpio infomation fail\n");
-
else{
-
-
printk("script_parser_mainkey_get_gpio_cfg script gpio infomation ok \n");
-
printk("[info] gpio_info.port=%04x,file=%s,fun=%s,line=%d\n",gpio_info[0].port,__FILE__ ,__func__,__LINE__);
-
printk("[info] gpio_info.port_num=%04x,file=%s,fun=%s,line=%d\n",gpio_info[0].port_num,__FILE__ ,__func__,__LINE__);
-
printk("[info] gpio_info.mul_sel=%04x,file=%s,fun=%s,line=%d\n",gpio_info[0].mul_sel,__FILE__ ,__func__,__LINE__);
-
printk("[info] gpio_info.pull=%04x,file=%s,fun=%s,line=%d\n",gpio_info[0].pull,__FILE__ ,__func__,__LINE__);
-
printk("[info] gpio_info.drv_level=%04x,file=%s,fun=%s,line=%d\n",gpio_info[0].drv_level,__FILE__ ,__func__,__LINE__);
-
printk("[info] gpio_info.data=%04x,file=%s,fun=%s,line=%d\n",gpio_info[0].data,__FILE__ ,__func__,__LINE__);
-
}
-
//获取主键下GPIO个数
-
int gpio_key_count = script_parser_mainkey_get_gpio_count ("twi_para");
-
if(gpio_key_count < 0)
-
printk("fetch script sub key count fail\n");
-
else
-
printk("fetch script gpio key count ok , gpio_key_count = %d\n", gpio_key_count);
-
-
- }