本文整理汇总了C++中script_parser_fetch函数的典型用法代码示例。如果您正苦于以下问题:C++ script_parser_fetch函数的具体用法?C++ script_parser_fetch怎么用?C++ script_parser_fetch使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了script_parser_fetch函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mali_platform_init
_mali_osk_errcode_t mali_platform_init(_mali_osk_resource_t *resource)
{
unsigned long rate;
int clk_div;
int mali_used = 0;
//get mali ahb clock
h_ahb_mali = clk_get(NULL, "ahb_mali");
if(!h_ahb_mali){
MALI_PRINT(("try to get ahb mali clock failed!\n"));
}
//get mali clk
h_mali_clk = clk_get(NULL, "mali");
if(!h_mali_clk){
MALI_PRINT(("try to get mali clock failed!\n"));
}
h_ve_pll = clk_get(NULL, "ve_pll");
if(!h_ve_pll){
MALI_PRINT(("try to get ve pll clock failed!\n"));
}
//set mali parent clock
if(clk_set_parent(h_mali_clk, h_ve_pll)){
MALI_PRINT(("try to set mali clock source failed!\n"));
}
//set mali clock
rate = clk_get_rate(h_ve_pll);
if(!script_parser_fetch("mali_para", "mali_used", &mali_used, 1)) {
if (mali_used == 1) {
if (!script_parser_fetch("mali_para", "mali_clkdiv", &clk_div, 1)) {
if (clk_div > 0) {
pr_info("mali: use config clk_div %d\n", clk_div);
mali_clk_div = clk_div;
}
}
}
}
pr_info("mali: clk_div %d\n", mali_clk_div);
rate /= mali_clk_div;
if(clk_set_rate(h_mali_clk, rate)){
MALI_PRINT(("try to set mali clock failed!\n"));
}
if(clk_enable(h_ahb_mali)){
MALI_PRINT(("try to enable mali ahb failed!\n"));
}
if(clk_enable(h_mali_clk)){
MALI_PRINT(("try to enable mali clock failed!\n"));
}
if(clk_reset(h_mali_clk,0)){
MALI_PRINT(("try to reset release failed!\n"));
}
MALI_PRINT(("mali clock set completed, clock is %d Mhz\n", rate));
MALI_SUCCESS;
}
示例2: dht22_sun5i_init_driver
/* Init driver */
static int __init dht22_sun5i_init_driver() {
int err = 0;
int dht22_used = 0;
script_gpio_set_t info;
dht22_sun5i_proc = proc_mkdir("dht22", NULL);
create_proc_read_entry("raw_data", 0444, dht22_sun5i_proc, dht22_sun5i_proc_read, NULL);
err = script_parser_fetch("dht22_para", "dht22_used", &dht22_used, sizeof (dht22_used) / sizeof (int));
if (!dht22_used || err) {
printk(KERN_INFO "%s: dht22-bus is not used in config\n", __FUNCTION__);
return -EINVAL;
}
err = script_parser_fetch("dht22_para", "dht22_pin", (int *) &info, sizeof (script_gpio_set_t));
if (err) {
printk(KERN_INFO "%s: can not get \"dht22_para\" \"dht22_pin\" gpio handler, already used by others?", __FUNCTION__);
return -EBUSY;
}
dht22_sun5i_gpio_handler = gpio_request_ex("dht22_para", "dht22_pin");
dht22_sun5i_gpio_direction = PIN_DIR_OUT;
PIN_DIR(PIN_DIR_OUT);
return 0;
}
示例3: get_usb_cfg
/*
*******************************************************************************
* get_usb_cfg
*
* Description:
* void
*
* Parameters:
* void
*
* Return value:
* void
*
* note:
* void
*
*******************************************************************************
*/
static s32 get_usb_cfg(struct sw_hci_hcd *sw_hci)
{
__s32 ret = 0;
/* usbc enable */
ret = script_parser_fetch(usbc_name[sw_hci->usbc_no], "usb_used", (int *)&sw_hci->used, 64);
if(ret != 0){
DMSG_PANIC("ERR: get usbc2 enable failed\n");
//return -1;
}
/* request gpio */
ret = script_parser_fetch(usbc_name[sw_hci->usbc_no], "usb_drv_vbus_gpio", (int *)&sw_hci->drv_vbus_gpio_set, 64);
if(ret != 0){
DMSG_PANIC("ERR: get usbc%d(%s) id failed\n", sw_hci->usbc_no, usbc_name[sw_hci->usbc_no]);
return -1;
}
/* host_init_state */
ret = script_parser_fetch(usbc_name[sw_hci->usbc_no], "usb_host_init_state", (int *)&(sw_hci->host_init_state), 64);
if(ret != 0){
DMSG_PANIC("ERR: script_parser_fetch host_init_state failed\n");
return -1;
}
return 0;
}
示例4: ap6210_gpio_wifi_get_res
static int ap6210_gpio_wifi_get_res(void)
{
struct ap6210_gpio_wifi_ops *ops = &ap6210_wifi_select_pm_ops;
if (SCRIPT_PARSER_OK != script_parser_fetch(wifi_para, "wifi_used", &ops->wifi_used, 1)) {
AP6210_ERR("parse wifi_used failed in script.fex.\n" );
return -1;
}
if (!ops->wifi_used) {
AP6210_ERR("wifi pm disable in script.fex.\n" );
return -1;
}
if (SCRIPT_PARSER_OK != script_parser_fetch(wifi_para, "wifi_sdc_id", &ops->sdio_id, 1)) {
AP6210_ERR("parse wifi_sdc_id in script.fex failed.\n" );
return -1;
}
if (SCRIPT_PARSER_OK != script_parser_fetch(wifi_para, "wifi_usbc_id", &ops->usb_id, 1)) {
AP6210_ERR("parse wifi_sdc_id in script.fex failed.\n" );
return -1;
}
if (SCRIPT_PARSER_OK != script_parser_fetch(wifi_para, "wifi_mod_sel", &ops->module_sel, 1)) {
AP6210_ERR("parse wifi_sdc_id in script.fex failed.\n" );
return -1;
}
ops->mod_name = ap6210_gpio_wifi_get_name(ops->module_sel);
AP6210_ERR("select wifi %s\n", ops->mod_name);
return 0;
}
示例5: sunxi_pwm_get_sys_config
void sunxi_pwm_get_sys_config(int pwm)
{
int ret, val;
char primary_key[25];
user_gpio_set_t gpio_info[1];
sprintf(primary_key, "pwm%d_para", pwm);
ret = script_parser_fetch(primary_key, "pwm_used", &val, 1);
if(ret < 0) {
pwm_debug("fetch script data fail\n");
} else {
if(val == 1) {
ret = script_parser_fetch(primary_key, "pwm_positive", (int *)&gpio_info, sizeof(user_gpio_set_t) / sizeof(int));
if(ret < 0) {
pwm_debug("fetch script data fail\n");
} else {
pwm_pin_count[pwm]++;
memcpy(&pwm_gpio_info[pwm][0], gpio_info, sizeof(user_gpio_set_t));
}
ret = script_parser_fetch(primary_key, "pwm_negative", (int *)&gpio_info, sizeof(user_gpio_set_t) / sizeof(int));
if(ret < 0) {
pwm_debug("fetch script data fail\n");
} else {
pwm_pin_count[pwm]++;
memcpy(&pwm_gpio_info[pwm][1], gpio_info, sizeof(user_gpio_set_t));
}
}
}
}
示例6: modify_system_uart
int modify_system_uart(void)
{
script_gpio_set_t fetch_cfg_gpio[2];
int uart_port_id = 0;
char uartname[16] ;
char uart_data[8] ;
int sdc0_used = 0;
if(script_parser_fetch("force_uart_para","force_uart_rx",(int *)(&fetch_cfg_gpio[0]),sizeof(script_gpio_set_t)/4))
{
printf("debug_mode_error: can't find force_uart_rx \n");
return -1;
}
if(script_parser_fetch("force_uart_para","force_uart_tx",(int *)(&fetch_cfg_gpio[1]),sizeof(script_gpio_set_t)/4))
{
printf("debug_mode_error: can't find force_uart_tx \n");
return -1;
}
if(script_parser_fetch("force_uart_para","force_uart_port",(int *)(&uart_port_id),sizeof(int)/4))
{
printf("debug_mode_error: can't find card0_tx \n");
return -1;
}
memset(uartname,0,16);
memset(uart_data,0,8);
#if defined (CONFIG_ARCH_SUN7I) ||defined(CONFIG_ARCH_SUN8IW1P1)
strcat(uartname,"uart_para");
#else
strcat(uartname,"uart");
#endif
sprintf(uart_data,"%d",uart_port_id);
strcat(uartname,uart_data);
printf("the uartname is %s \n",uartname);
if(script_parser_patch(uartname,"uart_port",(int *)(&uart_port_id),sizeof(int)/4))
{
printf("debug_mode_error : can't find uart_debug_port \n");
return -1;
}
if(script_parser_patch(uartname,"uart_rx",(void*)&fetch_cfg_gpio[0],sizeof(script_gpio_set_t)/4))
{
printf("debug_mode_error : can't patch uart_debug_rx\n");
return -1;
}
if(script_parser_patch(uartname,"uart_tx",(void*)&fetch_cfg_gpio[1],sizeof(script_gpio_set_t)/4))
{
printf("debug_mode_error : can't patch uart_debug_rx\n");
return -1;
}
//disable card0 init in linux
if(script_parser_patch("mmc0_para","sdc_used",(int *)(&sdc0_used),sizeof(int)/4))
{
printf("debug_mode_error :can not patch sdc_used \n");
return -1;
}
return 0;
}
示例7: check_physical_key_early
int check_physical_key_early(void)
{
user_gpio_set_t gpio_recovery;
__u32 gpio_hd;
int ret;
int gpio_value = 0;
int used = 0;
int mode = 0;
if(uboot_spare_head.boot_data.work_mode != WORK_MODE_BOOT)
{
return 0;
}
ret = script_parser_fetch("recovery_para", "used", (int *)&used, sizeof(int) / 4);
if (ret || !used)
{
printf("[recovery] no use\n");
return 0;
}
ret = script_parser_fetch("recovery_para", "recovery_key", (int *)&gpio_recovery, sizeof(user_gpio_set_t) / 4);
if (!ret)
{
gpio_recovery.mul_sel = 0; //强制设置成输入
gpio_hd = gpio_request(&gpio_recovery, 1);
if (gpio_hd)
{
int time;
gpio_value = 0;
for(time = 0; time < 4; time++)
{
gpio_value += gpio_read_one_pin_value(gpio_hd, 0);
__msdelay(5);
}
if (!gpio_value)
{
printf("[box recovery] find the key\n");
script_parser_fetch("recovery_para", "mode", (int *)&mode, sizeof(int) / 4);
if (mode == ONEKEY_USB_RECOVERY_MODE)
{
gd->key_pressd_value = USB_RECOVERY_KEY_VALUE;
}
else if (mode == ONEKEY_SPRITE_RECOVERY_MODE)
{
gd->key_pressd_value = SPRITE_RECOVERY_KEY_VALUE;
uboot_spare_head.boot_data.work_mode = WORK_MODE_SPRITE_RECOVERY;
}
else
{
printf("[recovery] no option for one key recovery's mode (%d)\n", mode);
}
}
}
}
return 0;
}
示例8: check_boot_recovery_key
int check_boot_recovery_key(void)
{
user_gpio_set_t gpio_recovery;
__u32 gpio_hd;
int ret;
int gpio_value = 0;
int used = 0;
int mode = 0;
if(uboot_spare_head.boot_data.work_mode != WORK_MODE_BOOT)
{
return 0;
}
ret = script_parser_fetch("recovery_para", "used", (int *)&used, sizeof(int) / 4);
if (ret || !used)
{
printf("[recovery] no use\n");
return 0;
}
ret = script_parser_fetch("recovery_para", "recovery_key", (int *)&gpio_recovery, sizeof(user_gpio_set_t) / 4);
if (!ret)
{
gpio_recovery.mul_sel = 0; //强制设置成输入
gpio_hd = gpio_request(&gpio_recovery, 1);
if (gpio_hd)
{
int time;
gpio_value = 0;
for(time = 0; time < 4; time++)
{
gpio_value += gpio_read_one_pin_value(gpio_hd, 0);
__msdelay(5);
}
if (!gpio_value)
{
script_parser_fetch("recovery_para", "mode", (int *)&mode, sizeof(int) / 4);
if (mode == ONEKEY_USB_RECOVERY)
{
printf("set to one key usb recovery\n");
write_usb_recovery_to_misc();
}
else if (mode == ONEKEY_SPRITE_RECOVERY)
{
printf("set to one key sprite recovery\n");
setenv("bootcmd", "sprite_recovery");
}
else
{
printf("[recovery] no option for one key recovery's mode\n");
}
}
}
}
return 0;
}
示例9: tkey_fetch_sysconfig_para
/**
* tkey_fetch_sysconfig_para - get config info from sysconfig.fex file.
* return value:
* = 0; success;
* < 0; err
*/
static int tkey_fetch_sysconfig_para(void)
{
int ret = -1;
int device_used = -1;
__u32 twi_addr = 0;
char name[I2C_NAME_SIZE];
script_parser_value_type_t type = SCIRPT_PARSER_VALUE_TYPE_STRING;
//__u32 twi_id = 0;
printk("========HV Inital ===================\n");
if(SCRIPT_PARSER_OK != script_parser_fetch("tkey_para", "tkey_used", &device_used, 1)){
pr_err("hv_keyboard: script_parser_fetch err. \n");
goto script_parser_fetch_err;
}
if(1 == device_used){
if(SCRIPT_PARSER_OK != script_parser_fetch_ex("tkey_para", "tkey_name", (int *)(&name), &type, sizeof(name)/sizeof(int))){
pr_err("%s: script_parser_fetch err. \n", __func__);
goto script_parser_fetch_err;
}
if(strcmp(HV_NAME, name)){
pr_err("%s: name %s does not match HV_NAME. \n", __func__, name);
pr_err(HV_NAME);
//ret = 1;
return ret;
}
if(SCRIPT_PARSER_OK != script_parser_fetch("tkey_para", "tkey_twi_addr", &twi_addr, sizeof(twi_addr)/sizeof(__u32))){
pr_err("%s: script_parser_fetch err. \n", name);
goto script_parser_fetch_err;
}
u_i2c_addr.dirty_addr_buf[0] = twi_addr;
u_i2c_addr.dirty_addr_buf[1] = I2C_CLIENT_END;
printk("%s: after: tkey_twi_addr is 0x%x, dirty_addr_buf: 0x%hx. dirty_addr_buf[1]: 0x%hx \n", \
__func__, twi_addr, u_i2c_addr.dirty_addr_buf[0], u_i2c_addr.dirty_addr_buf[1]);
if(SCRIPT_PARSER_OK != script_parser_fetch("tkey_para", "tkey_twi_id", &twi_id, 1)){
pr_err("%s: script_parser_fetch err. \n", name);
goto script_parser_fetch_err;
}
printk("%s: tkey_twi_id is %d. \n", __func__, twi_id);
}else{
pr_err("%s: tkey_unused. \n", __func__);
ret = -1;
}
return 0;
script_parser_fetch_err:
pr_notice("=========script_parser_fetch_err============\n");
return ret;
}
示例10: gsensor_fetch_sysconfig_para
/**
* gsensor_fetch_sysconfig_para - get config info from sysconfig.fex file.
* return value:
* = 0; success;
* < 0; err
*/
static int gsensor_fetch_sysconfig_para(void)
{
int ret = -1;
int device_used = -1;
__u32 twi_addr = 0;
char name[I2C_NAME_SIZE];
script_parser_value_type_t type = SCRIPT_PARSER_VALUE_TYPE_STRING;
printk("========%s===================\n", __func__);
if(SCRIPT_PARSER_OK != (ret = script_parser_fetch("gsensor_para", "gsensor_used", &device_used, 1))){
pr_err("%s: script_parser_fetch err.ret = %d. \n", __func__, ret);
goto script_parser_fetch_err;
}
if(1 == device_used){
if(SCRIPT_PARSER_OK != script_parser_fetch_ex("gsensor_para", "gsensor_name", (int *)(&name), &type, sizeof(name)/sizeof(int))){
pr_err("%s: line: %d script_parser_fetch err. \n", __func__, __LINE__);
goto script_parser_fetch_err;
}
if(strcmp(SENSOR_NAME, name)){
pr_err("%s: name %s does not match SENSOR_NAME. \n", __func__, name);
pr_err(SENSOR_NAME);
//ret = 1;
return ret;
}
if(SCRIPT_PARSER_OK != script_parser_fetch("gsensor_para", "gsensor_twi_addr", &twi_addr, sizeof(twi_addr)/sizeof(__u32))){
pr_err("%s: line: %d: script_parser_fetch err. \n", name, __LINE__);
goto script_parser_fetch_err;
}
u_i2c_addr.dirty_addr_buf[0] = twi_addr;
u_i2c_addr.dirty_addr_buf[1] = I2C_CLIENT_END;
printk("%s: after: gsensor_twi_addr is 0x%x, dirty_addr_buf: 0x%hx. dirty_addr_buf[1]: 0x%hx \n", \
__func__, twi_addr, u_i2c_addr.dirty_addr_buf[0], u_i2c_addr.dirty_addr_buf[1]);
if(SCRIPT_PARSER_OK != script_parser_fetch("gsensor_para", "gsensor_twi_id", &twi_id, 1)){
pr_err("%s: script_parser_fetch err. \n", name);
goto script_parser_fetch_err;
}
printk("%s: twi_id is %d. \n", __func__, twi_id);
ret = 0;
}else{
pr_err("%s: gsensor_unused. \n", __func__);
ret = -1;
}
return ret;
script_parser_fetch_err:
pr_notice("=========script_parser_fetch_err============\n");
return ret;
}
示例11: detect_other_boot_mode
/*
************************************************************************************************************
*
* function
*
* name :
*
* parmeters :
*
* return :
*
* note :
*
*
************************************************************************************************************
*/
static int detect_other_boot_mode(void)
{
int ret1, ret2;
int key_high, key_low;
int keyvalue;
int user_mode_used = 0;
keyvalue = gd->key_pressd_value;
printf("key %d\n", keyvalue);
script_parser_fetch("platform", "user_mode_used", &user_mode_used, 1);
if(user_mode_used)
{
if(keyvalue >0)
{
return USER_SELECT_MODE;
}
}
else
{
ret1 = script_parser_fetch("recovery_key", "key_max", &key_high, 1);
ret2 = script_parser_fetch("recovery_key", "key_min", &key_low, 1);
if((ret1) || (ret2))
{
printf("cant find rcvy value\n");
}
else
{
printf("recovery key high %d, low %d\n", key_high, key_low);
if((keyvalue >= key_low) && (keyvalue <= key_high))
{
printf("key found, android recovery\n");
return ANDROID_RECOVERY_MODE;
}
}
ret1 = script_parser_fetch("fastboot_key", "key_max", &key_high, 1);
ret2 = script_parser_fetch("fastboot_key", "key_min", &key_low, 1);
if((ret1) || (ret2))
{
printf("cant find fstbt value\n");
}
else
{
printf("fastboot key high %d, low %d\n", key_high, key_low);
if((keyvalue >= key_low) && (keyvalue <= key_high))
{
printf("key found, android fastboot\n");
return ANDROID_FASTBOOT_MODE;
}
}
}
return ANDROID_NULL_MODE;
}
示例12: sun4i_vibrator_init
static int __init sun4i_vibrator_init(void)
{
int vibe_used;
int err = -1;
pr_info("hello, sun4i_vibrator init\n");
err = script_parser_fetch("motor_para", "motor_used",
&vibe_used, sizeof(vibe_used)/sizeof(int));
if(err) {
pr_err("%s script_parser_fetch \"motor_para\" \"motor_used\" error = %d\n",
__FUNCTION__, err);
goto exit;
}
if(!vibe_used) {
pr_err("%s motor is not used in config\n", __FUNCTION__);
err = -1;
goto exit;
}
err = script_parser_fetch("motor_para", "motor_shake",
(int *)&vibe_gpio, sizeof(vibe_gpio)/sizeof(int));
if(err) {
pr_err("%s script_parser_fetch \"motor_para\" \"motor_shaked\" error = %d\n",
__FUNCTION__, err);
goto exit;
}
vibe_off = vibe_gpio.data;
pr_debug("vibe_off is %d\n", vibe_off);
vibe_gpio_handler = gpio_request_ex("motor_para", "motor_shake");
if(!vibe_gpio_handler) {
pr_err("%s request motor gpio err\n", __FUNCTION__);
err = -1;
goto exit;
}
INIT_WORK(&vibrator_work, update_vibrator);
spin_lock_init(&vibe_lock);
vibe_state = 0;
hrtimer_init(&vibe_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
vibe_timer.function = vibrator_timer_func;
timed_output_dev_register(&sun4i_vibrator);
exit:
return err;
}
示例13: power_oz_patch_gpio
/*
************************************************************************************************************
*
* function
*
* 函数名称:power_oz_patch_gpio
*
* 参数列表:
*
* 返回值 :
*
* 说明 :change the gpio data status in sys_config.fex with the vol input
*
*
************************************************************************************************************
*/
static int power_oz_patch_gpio(int set_vol)
{
int ret;
int i;
u8 index;
char sub_name[16];
user_gpio_set_t oz_gpio_cfg[3];
memset(oz_gpio_cfg, 0, sizeof(oz_gpio_cfg));
ret = script_parser_fetch("external_power", "a15_vset1", (int*)&oz_gpio_cfg[0], sizeof(oz_gpio_cfg[0])/sizeof(int));
if(ret)
{
printf("get oz power cfg failed\n");
return -1;
}
ret = script_parser_fetch("external_power", "a15_vset2", (int*)&oz_gpio_cfg[1], sizeof(oz_gpio_cfg[1])/sizeof(int));
if(ret)
{
printf("get oz power cfg failed\n");
return -1;
}
ret = script_parser_fetch("external_power", "a15_vset3", (int*)&oz_gpio_cfg[2], sizeof(oz_gpio_cfg[2])/sizeof(int));
if(ret)
{
printf("get oz power cfg failed\n");
return -1;
}
//get the gpio status with the set_vol
index = power_oz_probe_gpio(set_vol);
//配置gpio data
for(i = 0; i < 3; i++)
{
oz_gpio_cfg[i].data = gpio_value[index][i];
memset(sub_name, 0, 16);
sprintf(sub_name, "%s%d", "a15_vset", i+1);
ret = script_parser_patch("external_power", sub_name, (void *)&oz_gpio_cfg[i], sizeof(oz_gpio_cfg[i])/sizeof(int));
if(ret)
{
printf("patch gpio config failed\n");
return -2;
}
}
return 0;
}
示例14: Hdmi_init
__s32 Hdmi_init(void)
{
s32 ret = 0;
disp_hdmi_func disp_func;
s32 val;
hdmi_used = 0;
ret = script_parser_fetch("hdmi_para", "hdmi_used", &val, 1);
if(ret == 0) {
hdmi_used = val;
if(hdmi_used)
{
#if defined(CONFIG_ARCH_HOMELET) //need to be same later
ret = script_parser_fetch("hdmi_para", "hdmi_power_boot", (int *)hdmi_power, 25);
#else
ret = script_parser_fetch("hdmi_para", "hdmi_power", (int *)hdmi_power, 25);
#endif
if(ret == 0) {
OSAL_Power_Enable(hdmi_power);
}
ret = script_parser_fetch("hdmi_para", "hdmi_cts_compatibility", &val, 1);
if(ret == 0) {
Hdmi_hal_cts_enable(val);
printf("cts_enable, %d\n", val);
}
ret = script_parser_fetch("hdmi_para", "hdmi_hdcp_enable", &val, 1);
if(ret == 0) {
Hdmi_hal_hdcp_enable(val);
printf("hdcp_enable, %d\n", val);
}
Hdmi_hal_init();
disp_func.hdmi_open = Hdmi_open;
disp_func.hdmi_close = Hdmi_close;
disp_func.hdmi_set_mode = Hdmi_set_display_mode;
disp_func.hdmi_mode_support = Hdmi_mode_support;
disp_func.hdmi_get_HPD_status = Hdmi_get_HPD_status;
disp_func.hdmi_get_video_timing_info = Hdmi_get_video_timming_info;
disp_func.hdmi_get_video_info_index = Hdmi_get_video_info_index;
disp_set_hdmi_func(0, &disp_func);
disp_set_hdmi_func(1, &disp_func);
}
}
return 0;
}
示例15: sw_serial_init
static int __init sw_serial_init(void)
{
int ret;
int i;
int used = 0;
char uart_para[16];
memset(sw_serial, 0, sizeof(sw_serial));
uart_used = 0;
for (i=0; i<MAX_PORTS; i++, used=0) {
sprintf(uart_para, "uart_para%d", i);
ret = script_parser_fetch(uart_para, "uart_used", &used, sizeof(int));
if (ret)
UART_MSG("failed to get uart%d's used information\n", i);
if (used) {
uart_used |= 1 << i;
platform_device_register(&sw_uart_dev[i]);
}
}
if (uart_used) {
UART_MSG("used uart info.: 0x%02x\n", uart_used);
ret = platform_driver_register(&sw_serial_driver);
return ret;
}
return 0;
}