全志A20 fex 解析示例源码

1780阅读 0评论2020-05-10 fangdikui
分类:嵌入式

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
===================================================


点击(此处)折叠或打开

  1. void script_parser_fetch_test(){
  2.  //获取GPIO
  3.     user_gpio_set_t gpio_info[1];
  4.     int ret;
  5.     ret = script_parser_fetch("board_para", "pwm0", gpio_info, sizeof(user_gpio_set_t)/sizeof(int));
  6.     if(ret < 0)
  7.         printk("fetch script gpio infomation fail\n");
  8.     else
  9.         printk("fetch script gpio infomation ok \n");
  10.  printk("[info] gpio_info.port=%04x,file=%s,fun=%s,line=%d\n",gpio_info[0].port,__FILE__ ,__func__,__LINE__);
  11.  printk("[info] gpio_info.port_num=%04x,file=%s,fun=%s,line=%d\n",gpio_info[0].port_num,__FILE__ ,__func__,__LINE__);
  12.  printk("[info] gpio_info.mul_sel=%04x,file=%s,fun=%s,line=%d\n",gpio_info[0].mul_sel,__FILE__ ,__func__,__LINE__);
  13.  printk("[info] gpio_info.pull=%04x,file=%s,fun=%s,line=%d\n",gpio_info[0].pull,__FILE__ ,__func__,__LINE__);
  14.  printk("[info] gpio_info.drv_level=%04x,file=%s,fun=%s,line=%d\n",gpio_info[0].drv_level,__FILE__ ,__func__,__LINE__);
  15.  printk("[info] gpio_info.data=%04x,file=%s,fun=%s,line=%d\n",gpio_info[0].data,__FILE__ ,__func__,__LINE__);
  16.  
  17.  char string_info[128];
  18.     memset(string_info, 0, 128);
  19.     ret = script_parser_fetch("board_para", "string_demo", string_info, 128/sizeof(int));
  20.     if(ret < 0)
  21.         printk("fetch script string infomation fail\n");
  22.  else
  23.      printk("fetch script string infomation ok \n");
  24.  printk("[info] string_info=%s,file=%s,fun=%s,line=%d\n",string_info,__FILE__ ,__func__,__LINE__);


  25.  //获取子键个数
  26.     int sub_key_count = script_parser_subkey_count ("board_para");
  27.     if(sub_key_count < 0)
  28.         printk("fetch script sub key count fail\n");
  29.     else
  30.      printk("[info] sub_key_count=%d,file=%s,fun=%s,line=%d\n",sub_key_count,__FILE__ ,__func__,__LINE__);
  31. //获取主键个数


  32.     int main_key_count = script_parser_mainkey_count();
  33.     if(main_key_count < 0)
  34.         printk("fetch script sub key count fail\n");
  35.     else
  36.         printk("[info] main_key_count=%d,file=%s,fun=%s,line=%d\n",main_key_count,__FILE__ ,__func__,__LINE__);


  37.  
  38. //获取主键下GPIO配置
  39.     ret = script_parser_mainkey_get_gpio_cfg("board_para",gpio_info, 1);
  40.     if(ret < 0)
  41.         printk("fetch script gpio infomation fail\n");
  42.     else{
  43.         
  44.  printk("script_parser_mainkey_get_gpio_cfg script gpio infomation ok \n");
  45.  printk("[info] gpio_info.port=%04x,file=%s,fun=%s,line=%d\n",gpio_info[0].port,__FILE__ ,__func__,__LINE__);
  46.  printk("[info] gpio_info.port_num=%04x,file=%s,fun=%s,line=%d\n",gpio_info[0].port_num,__FILE__ ,__func__,__LINE__);
  47.  printk("[info] gpio_info.mul_sel=%04x,file=%s,fun=%s,line=%d\n",gpio_info[0].mul_sel,__FILE__ ,__func__,__LINE__);
  48.  printk("[info] gpio_info.pull=%04x,file=%s,fun=%s,line=%d\n",gpio_info[0].pull,__FILE__ ,__func__,__LINE__);
  49.  printk("[info] gpio_info.drv_level=%04x,file=%s,fun=%s,line=%d\n",gpio_info[0].drv_level,__FILE__ ,__func__,__LINE__);
  50.  printk("[info] gpio_info.data=%04x,file=%s,fun=%s,line=%d\n",gpio_info[0].data,__FILE__ ,__func__,__LINE__);
  51.     }
  52. //获取主键下GPIO个数
  53.     int gpio_key_count = script_parser_mainkey_get_gpio_count ("twi_para");
  54.     if(gpio_key_count < 0)
  55.         printk("fetch script sub key count fail\n");
  56.     else
  57.         printk("fetch script gpio key count ok , gpio_key_count = %d\n", gpio_key_count);


  58. }


上一篇:arm linux kgdb
下一篇:ts_calibrate不响应的问题