本文整理汇总了C++中script_get_item函数的典型用法代码示例。如果您正苦于以下问题:C++ script_get_item函数的具体用法?C++ script_get_item怎么用?C++ script_get_item使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了script_get_item函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sw_serial_get_config
static int sw_serial_get_config(struct sw_serial_port *sport, u32 uart_id)
{
char uart_para[16] = {0};
script_item_u val;
script_item_value_type_e type;
memset(uart_para, 0, sizeof(uart_para));
snprintf(uart_para, sizeof(uart_para), "uart_para%d", uart_id);
type = script_get_item(uart_para, "uart_port", &val);
if (SCIRPT_ITEM_VALUE_TYPE_INT != type) {
UART_ERR("%s: uart%d get uart port error\n", __func__,
uart_id);
return -1;
}
sport->port_no = val.val;
if (sport->port_no != uart_id) {
UART_ERR("%s: port%d and uart%d not match\n",
__func__, sport->port_no, uart_id);
return -1;
}
type = script_get_item(uart_para, "uart_type", &val);
if (SCIRPT_ITEM_VALUE_TYPE_INT != type) {
UART_ERR("%s: uart%d get uart type error\n", __func__,
uart_id);
return -1;
}
sport->pin_num = val.val;
return 0;
}
示例2: platform_wifi_power_on
/*
* Return:
* 0: power on successfully
* others: power on failed
*/
int platform_wifi_power_on(void)
{
int ret = 0;
#ifdef CONFIG_MMC
{
script_item_u val;
script_item_value_type_e type;
#ifdef CONFIG_PLATFORM_ARM_SUN8I_W5P1
unsigned int mod_sel = get_rf_mod_type();
#else
unsigned int mod_sel = wifi_pm_get_mod_type();
#endif
type = script_get_item("wifi_para", "wifi_sdc_id", &val);
if (SCIRPT_ITEM_VALUE_TYPE_INT != type) {
RTW_INFO("get wifi_sdc_id failed\n");
ret = -1;
} else {
sdc_id = val.val;
RTW_INFO("----- %s sdc_id: %d, mod_sel: %d\n", __FUNCTION__, sdc_id, mod_sel);
#if defined(CONFIG_PLATFORM_ARM_SUN6I) || defined(CONFIG_PLATFORM_ARM_SUN7I)
sw_mci_rescan_card(sdc_id, 1);
#elif defined(CONFIG_PLATFORM_ARM_SUN8I)
sunxi_mci_rescan_card(sdc_id, 1);
#endif
mdelay(100);
wifi_pm_power(1);
RTW_INFO("%s: power up, rescan card.\n", __FUNCTION__);
}
#ifdef CONFIG_GPIO_WAKEUP
#ifdef CONFIG_PLATFORM_ARM_SUN8I_W5P1
type = script_get_item("wifi_para", "wl_host_wake", &val);
#else
#ifdef CONFIG_RTL8723B
type = script_get_item("wifi_para", "rtl8723bs_wl_host_wake", &val);
#endif
#ifdef CONFIG_RTL8188E
type = script_get_item("wifi_para", "rtl8189es_host_wake", &val);
#endif
#endif /* CONFIG_PLATFORM_ARM_SUN8I_W5P1 */
if (SCIRPT_ITEM_VALUE_TYPE_PIO != type) {
RTW_INFO("No definition of wake up host PIN\n");
ret = -1;
} else {
gpio_eint_wlan = val.gpio.gpio;
#ifdef CONFIG_PLATFORM_ARM_SUN8I
oob_irq = gpio_to_irq(gpio_eint_wlan);
#endif
}
#endif /* CONFIG_GPIO_WAKEUP */
}
#endif /* CONFIG_MMC */
return ret;
}
示例3: camera_get_sysconfig
__s32 camera_get_sysconfig(char *main_name, char *sub_name, __s32 *buf, __u32 cnt)
{
script_item_u val;
script_item_value_type_e type;
int ret = -1;
if(cnt == 1)
{
type = script_get_item(main_name, sub_name, &val);
if(SCIRPT_ITEM_VALUE_TYPE_INT == type)
{
ret = 0;
*buf = val.val;
detect_print("%s.%s=%d\n", main_name, sub_name, *buf);
}
else
{
ret = -1;
detect_print("fetch script data %s.%s fail\n", main_name, sub_name);
}
}
else if(cnt == sizeof(__camera_gpio_set_t)/sizeof(__s32))
{
type = script_get_item(main_name, sub_name, &val);
if(SCIRPT_ITEM_VALUE_TYPE_PIO == type)
{
__camera_gpio_set_t *gpio_info = (__camera_gpio_set_t *)buf;
ret = 0;
gpio_info->gpio = val.gpio.gpio;
gpio_info->mul_sel = val.gpio.mul_sel;
gpio_info->pull = val.gpio.pull;
gpio_info->drv_level = val.gpio.drv_level;
gpio_info->data = val.gpio.data;
memcpy(gpio_info->gpio_name, sub_name, strlen(sub_name)+1);
detect_print("%s.%s gpio=%d,mul_sel=%d,data:%d\n",main_name, sub_name, gpio_info->gpio, gpio_info->mul_sel, gpio_info->data);
}
else
{
ret = -1;
detect_print("fetch script data %s.%s fail\n", main_name, sub_name);
}
}
else if(cnt == MAX_VDD_STR_LEN)
{
type = script_get_item(main_name, sub_name, &val);
if(SCIRPT_ITEM_VALUE_TYPE_STR == type)
{
strcpy((char *)buf, val.str);
detect_print("%s.%s=%s\n", main_name, sub_name, (char *)buf);
}
else
{
ret = -1;
detect_print("fetch script data %s.%s fail\n", main_name, sub_name);
}
}
return ret;
}
示例4: sunxi_daudio0_init
static int __init sunxi_daudio0_init(void)
{
int err = 0;
script_item_u val;
script_item_value_type_e type;
type = script_get_item(TDM_NAME, "daudio_used", &val);
if (SCIRPT_ITEM_VALUE_TYPE_INT != type) {
pr_err("[DAUDIO] type err!\n");
}
daudio_used = val.val;
type = script_get_item(TDM_NAME, "daudio_select", &val);
if (SCIRPT_ITEM_VALUE_TYPE_INT != type) {
pr_err("[DAUDIO] daudio_select:%s,line:%d type err!\n", __func__, __LINE__);
}
daudio_select = val.val;
if (daudio_used) {
if((err = platform_device_register(&sunxi_daudio_device)) < 0)
return err;
if ((err = platform_driver_register(&sunxi_daudio_driver)) < 0)
return err;
} else {
pr_err("[DAUDIO]sunxi-daudio cannot find any using configuration for controllers, return directly!\n");
return 0;
}
return 0;
}
示例5: keypad_sys_setup
static int keypad_sys_setup(void)/////unfinish
{
int ret = -1;
script_item_u val;
script_item_value_type_e type;
key_pressed[0] = 0;
key_pressed[1] = 0;
type = script_get_item("kp0", "keypad_used", &val);
if (SCIRPT_ITEM_VALUE_TYPE_INT != type) {
pr_err("%s: type err device_used = %d. \n", __func__, val.val);
ret = -1;
}
if (1 == val.val) {
type = script_get_item("kp0", "keypad_power_key_code", &val);
if(SCIRPT_ITEM_VALUE_TYPE_INT != type){
pr_err("%s: keypad power key type err! \n", __func__);
}
keypad_power_key = val.val;
ret = 0;
} else {
pr_err("%s: keypad_unused. \n", __func__);
ret = -1;
}
return ret;
}
示例6: rtl8723au_gpio_init
void rtl8723au_gpio_init(void)
{
script_item_u val;
script_item_value_type_e type;
struct wifi_pm_ops *ops = &wifi_select_pm_ops;
rtl8723au_msg("exec rtl8723au_wifi_gpio_init\n");
type = script_get_item(wifi_para, "wifi_power", &val);
if (SCIRPT_ITEM_VALUE_TYPE_STR != type) {
rtl8723au_msg("failed to fetch wifi_power\n");
return ;
}
axp_name = val.str;
type = script_get_item(wifi_para, "wifi_usbc_id", &val);
if (SCIRPT_ITEM_VALUE_TYPE_INT != type) {
rtl8723au_msg("failed to fetch wifi_usbc_id\n");
return ;
}
usbc_id = val.val;
ops->standby = rtl8723au_standby;
rtl8723au_wifi_power = 0;
rtl8723au_bt_power = 0;
// make sure wifi power up when system start up
rtl8723au_module_power(1);
}
示例7: sunxigk_script_init
static int sunxigk_script_init(void)
{
script_item_u val;
script_item_value_type_e type;
type = script_get_item("gpio_power_key", "key_used", &val);
if (SCIRPT_ITEM_VALUE_TYPE_INT != type) {
pr_err("%s: key para not found, used default para. \n", __func__);
return -1;
}
if(1 == val.val){
type = script_get_item("gpio_power_key", "key_io", &val);
if(SCIRPT_ITEM_VALUE_TYPE_PIO != type){
pr_err("%s: get key io err! \n", __func__);
return -1;
}
power_key_io = val.gpio;
dprintk(DEBUG_INT,"%s power key io number = %d.\n", __func__, power_key_io.gpio);
}else{
dprintk(DEBUG_INT,"sunxi io power key no used.\n");
return -1;
}
return 0;
}
示例8: twi_chan_cfg
static void twi_chan_cfg(struct sunxi_i2c_platform_data *pdata)
{
int i;
script_item_u item = {0};
script_item_value_type_e type = 0;
char twi_para[16] = {0};
for (i=0; i<SUNXI_TWI_NUM; i++) {
sprintf(twi_para, "twi%d", i);
type = script_get_item(twi_para, "twi_used", &item);
if (SCIRPT_ITEM_VALUE_TYPE_INT != type) {
I2C_ERR("[twi%d] has no twi_used!\n", i);
continue;
}
if (item.val)
twi_used_mask |= SUNXI_TWI_CHAN_MASK(i);
type = script_get_item(twi_para, "twi_regulator", &item);
if (SCIRPT_ITEM_VALUE_TYPE_STR != type) {
I2C_ERR("[twi%d] has no twi_regulator.\n", i);
continue;
}
strncpy(pdata[i].regulator_id, item.str, 16);
}
}
示例9: sw_rfkill_init
static int __init sw_rfkill_init(void)
{
script_item_value_type_e type;
script_item_u val;
struct gpio_config *gpio_p = NULL;
type = script_get_item("bt_para", "bt_used", &val);
if (SCIRPT_ITEM_VALUE_TYPE_INT != type) {
RF_MSG("failed to fetch bt configuration!\n");
return -1;
}
if (!val.val) {
RF_MSG("init no bt used in configuration\n");
return 0;
}
bt_used = val.val;
bt_rst_n = -1;
type = script_get_item("bt_para", "bt_rst_n", &val);
if (SCIRPT_ITEM_VALUE_TYPE_PIO!=type)
RF_MSG("mod has no bt_rst_n gpio\n");
else {
gpio_p = &val.gpio;
bt_rst_n = gpio_p->gpio;
sunxi_gpio_req(gpio_p);
}
platform_device_register(&sw_rfkill_dev);
return platform_driver_register(&sw_rfkill_driver);
}
示例10: ap6xxx_gpio_init
void ap6xxx_gpio_init(void)
{
script_item_u val;
script_item_value_type_e type;
struct wifi_pm_ops *ops = &wifi_select_pm_ops;
type = script_get_item(wifi_para, "wifi_power", &val);
if (SCIRPT_ITEM_VALUE_TYPE_STR != type) {
ap6xxx_msg("failed to fetch wifi_power\n");
return;
}
axp_name = val.str;
ap6xxx_msg("module power name %s\n", axp_name);
type = script_get_item(wifi_para, "ap6xxx_wl_regon", &val);
if (SCIRPT_ITEM_VALUE_TYPE_PIO!=type)
ap6xxx_msg("get ap6xxx ap6xxx_wl_regon gpio failed\n");
else
ap6xxx_wl_regon = val.gpio.gpio;
type = script_get_item(wifi_para, "ap6xxx_bt_regon", &val);
if (SCIRPT_ITEM_VALUE_TYPE_PIO!=type)
ap6xxx_msg("get ap6xxx ap6xxx_bt_regon gpio failed\n");
else
ap6xxx_bt_regon = val.gpio.gpio;
ops->gpio_ctrl = ap6xxx_gpio_ctrl;
ops->power = ap6xxx_power;
ap6xxx_module_power(1);
}
示例11: NAND_GetNandExtPara
__u32 NAND_GetNandExtPara(__u32 para_num)
{
script_item_u nand_para;
script_item_value_type_e type;
if (para_num == 0) {
type = script_get_item("nand0_para", "nand_p0", &nand_para);
if(SCIRPT_ITEM_VALUE_TYPE_INT != type)
{
printk("nand0_para, nand_p0, nand type err! %d\n", type);
return 0xffffffff;
}
else
return nand_para.val;
} else if (para_num == 1) {
type = script_get_item("nand0_para", "nand_p1", &nand_para);
if(SCIRPT_ITEM_VALUE_TYPE_INT != type)
{
printk("nand0_para, nand_p1, nand type err! %d\n", type);
return 0xffffffff;
}
else
return nand_para.val;
} else {
printk("NAND_GetNandExtPara: wrong para num: %d\n", para_num);
return 0xffffffff;
}
}
示例12: sun6i_i2s_init
static int __init sun6i_i2s_init(void)
{
int err = 0;
int cnt = 0;
int i = 0;
script_item_u val;
script_item_u *list = NULL;
script_item_value_type_e type;
type = script_get_item("i2s_para", "i2s_used", &val);
if (SCIRPT_ITEM_VALUE_TYPE_INT != type) {
printk("[I2S] type err!\n");
}
i2s_used = val.val;
type = script_get_item("i2s_para", "i2s_select", &val);
if (SCIRPT_ITEM_VALUE_TYPE_INT != type) {
printk("[I2S] i2s_select type err!\n");
}
i2s_select = val.val;
if (i2s_used) {
/* get gpio list */
cnt = script_get_pio_list("i2s_para", &list);
if (0 == cnt) {
printk("get i2s_para gpio list failed\n");
return -EFAULT;
}
/* req gpio */
for (i = 0; i < cnt; i++) {
if (0 != gpio_request(list[i].gpio.gpio, NULL)) {
printk("[i2s] request some gpio fail\n");
goto end;
}
}
/* config gpio list */
if (0 != sw_gpio_setall_range(&list[0].gpio, cnt)) {
printk("sw_gpio_setall_range failed\n");
}
if((err = platform_device_register(&sun6i_i2s_device)) < 0)
return err;
if ((err = platform_driver_register(&sun6i_i2s_driver)) < 0)
return err;
} else {
printk("[I2S]sun6i-i2s cannot find any using configuration for controllers, return directly!\n");
return 0;
}
end:
/* release gpio */
while(i--)
gpio_free(list[i].gpio.gpio);
return 0;
}
示例13: sunxi_snddaudio0_dev_probe
static int __devinit sunxi_snddaudio0_dev_probe(struct platform_device *pdev)
{
int ret = 0;
script_item_u val;
script_item_value_type_e type;
struct snd_soc_card *card = &snd_soc_sunxi_snddaudio;
type = script_get_item(TDM_NAME, "daudio_used", &val);
if (SCIRPT_ITEM_VALUE_TYPE_INT != type) {
pr_err("[daudio0]:%s,line:%d type err!\n", __func__, __LINE__);
}
daudio_used = val.val;
type = script_get_item(TDM_NAME, "daudio_select", &val);
if (SCIRPT_ITEM_VALUE_TYPE_INT != type) {
pr_err("[I2S0] daudio_select type err!\n");
}
daudio_pcm_select = val.val;
type = script_get_item(TDM_NAME, "daudio_master", &val);
if (SCIRPT_ITEM_VALUE_TYPE_INT != type) {
pr_err("[I2S0] daudio_master type err!\n");
}
daudio_master = val.val;
type = script_get_item(TDM_NAME, "audio_format", &val);
if (SCIRPT_ITEM_VALUE_TYPE_INT != type) {
pr_err("[I2S0] audio_format type err!\n");
}
audio_format = val.val;
type = script_get_item(TDM_NAME, "signal_inversion", &val);
if (SCIRPT_ITEM_VALUE_TYPE_INT != type) {
pr_err("[I2S0] signal_inversion type err!\n");
}
signal_inversion = val.val;
pr_debug("%s, line:%d, daudio_used:%d,daudio_pcm_select:%d,daudio_master:%d,audio_format:%d,signal_inversion:%d\n", __func__,
__LINE__, daudio_used,daudio_pcm_select,daudio_master,audio_format,signal_inversion);
if (daudio_used) {
card->dev = &pdev->dev;
ret = snd_soc_register_card(card);
if (ret) {
dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n",
ret);
}
} else {
pr_err("[daudio0]sunxi_snddaudio0 cannot find any using configuration for controllers, return directly!\n");
return 0;
}
return ret;
}
示例14: ls_fetch_sysconfig_para
static int ls_fetch_sysconfig_para(enum input_sensor_type *ls_type)
{
int ret = -1;
script_item_u val;
script_item_value_type_e type;
struct sensor_config_info *data = container_of(ls_type,
struct sensor_config_info, input_type);
type = script_get_item("ls_para", "ls_used", &val);
if (SCIRPT_ITEM_VALUE_TYPE_INT != type) {
pr_err("%s: type err device_used = %d. \n", __func__, val.val);
goto script_get_err;
}
data->sensor_used = val.val;
if (1 == data->sensor_used) {
type = script_get_item("ls_para", "ls_twi_id", &val);
if(SCIRPT_ITEM_VALUE_TYPE_INT != type){
pr_err("%s: type err twi_id = %d. \n", __func__, val.val);
goto script_get_err;
}
data->twi_id = val.val;
type = script_get_item("ls_para", "ls_int", &val);
if (SCIRPT_ITEM_VALUE_TYPE_PIO != type) {
printk("%s: type err twi int1 = %d. \n", __func__, val.gpio.gpio);
goto script_get_err;
}
data->irq_gpio = val.gpio;
data->int_number = val.gpio.gpio;
type = script_get_item("ls_para", "ls_ldo", &val);
if (SCIRPT_ITEM_VALUE_TYPE_STR != type)
pr_err("%s: no ldo for light distance sensor, ignore it\n", __func__);
else
data->ldo = val.str;
ret = 0;
} else {
pr_err("%s: ls_unused. \n", __func__);
ret = -1;
}
return ret;
script_get_err:
pr_notice("=========script_get_err============\n");
return ret;
}
示例15: aw_pm_init
/*
*********************************************************************************************************
* aw_pm_init
*
*Description: initial pm sub-system for platform;
*
*Arguments : none;
*
*Return : result;
*
*Notes :
*
*********************************************************************************************************
*/
static int __init aw_pm_init(void)
{
script_item_u item;
script_item_u *list = NULL;
int cpu0_en = 0;
int dram_selfresh_en = 0;
int wakeup_src_cnt = 0;
PM_DBG("aw_pm_init!\n");
if (fetch_dram_para(&standby_info.dram_para) != 0)
{
memset(&standby_info.dram_para, 0, sizeof(standby_info.dram_para));
pr_err("%s: fetch_dram_para err. \n", __func__);
}
memcpy(&mem_para_info.dram_para, &standby_info.dram_para, sizeof(standby_info.dram_para));
//get standby_mode.
if(SCIRPT_ITEM_VALUE_TYPE_INT != script_get_item("pm_para", "standby_mode", &item)){
pr_err("%s: script_parser_fetch err. \n", __func__);
standby_mode = 0;
//standby_mode = 1;
pr_err("notice: standby_mode = %d.\n", standby_mode);
}else{
standby_mode = item.val;
pr_info("standby_mode = %d. \n", standby_mode);
if(1 != standby_mode){
pr_err("%s: not support super standby. \n", __func__);
}
}
//get wakeup_src_para cpu_en
if(SCIRPT_ITEM_VALUE_TYPE_INT != script_get_item("wakeup_src_para", "cpu_en", &item)){
cpu0_en = 0;
}else{
cpu0_en = item.val;
}
pr_info("cpu0_en = %d.\n", cpu0_en);
//get dram_selfresh en
if(SCIRPT_ITEM_VALUE_TYPE_INT != script_get_item("wakeup_src_para", "dram_selfresh_en", &item)){
dram_selfresh_en = 1;
}else{
dram_selfresh_en = item.val;
}
pr_info("dram_selfresh_en = %d.\n", dram_selfresh_en);
if(0 == dram_selfresh_en && 0 == cpu0_en){
pr_err("Notice: if u don't want the dram enter selfresh mode,\n \
make sure the cpu0 is not allowed to be powered off.\n");
goto script_para_err;
}else{