コード例 #1
0
void bsp_set_pintrl(unsigned int type, unsigned int gpio, unsigned int value)
{
    unsigned int group = 0;
    unsigned int pin = 0;
    
    struct pintrl_stru *normal_stru = NULL;

    if(gpio > GPIO_TOTAL || (type >= MODEM_IO_BUTT))
    {
        ios_print_error("para is error, gpio = %d, type = %d, value = %d.\n", gpio, type, value);        
        return ;
    }

    group = gpio / GPIO_MAX_NUMBER;
    pin   = gpio % GPIO_MAX_NUMBER;
    
    normal_stru = get_pintrl(MODEM_PIN_NORMAL, group, pin);
    if(NULL == normal_stru)
    {
        ios_print_error("get_pintrl is fail, normal_stru = 0x%x.\n", normal_stru);  
        return ;
    }

    bsp_pinctrl_modify_dts(MODEM_PIN_NORMAL, type, gpio, value);
    bsp_pinctrl_modify_dts(MODEM_PIN_POWERDOWN, type, gpio, value);

    pintrl_config(normal_stru, 1);

}
コード例 #2
0
void modem_pintrl_config(int mode)
{

    if((MODEM_PIN_INIT != mode) && (MODEM_PIN_NORMAL != mode) && (MODEM_PIN_POWERDOWN != mode))
    {
        ios_print_error("modem pintrl mode is error, mode=%d.\n", mode);
        return ;
    }

    pintrl_config((struct pintrl_stru *)(g_pin_cfg->pintrl_addr[mode].addr.low), g_pin_cfg->pintrl_size[mode]);

}
コード例 #3
0
void modem_pintrl_config(int mode)
{
    //int ret = 0;
    //unsigned int length = 0;
    
    struct modem_pintrl_cfg *pintrl_cfg = (struct modem_pintrl_cfg *)SHM_MEM_MODEM_PINTRL_ADDR;

    if((MODEM_PIN_INIT != mode) && (MODEM_PIN_NORMAL != mode) && (MODEM_PIN_POWERDOWN != mode))
    {
        ios_print_error("modem pintrl mode is error, mode=%d.\n", mode);
        return ;
    }

    /*ret = modem_pintrl_dts_parse(mode, &iocfg_table, &length);
    if(0 != ret)
    {
        ios_print_error("modem pintrl parse is fail, ret=0x%x mode=%d.\n", ret, mode);
        return;
    }*/
    
    pintrl_config(pintrl_cfg->pintrl_addr[mode], pintrl_cfg->pintrl_size[mode]);

}
コード例 #4
0
void bsp_set_pintrl(unsigned int type, unsigned int gpio, unsigned int value)
{
    unsigned int group = 0;
    unsigned int pin = 0;
    
    struct pintrl_stru *init_stru = NULL;
    struct pintrl_stru *normal_stru = NULL;
    struct pintrl_stru *lowpower_stru = NULL;
    
    if(gpio > GPIO_TOTAL || (type >= MODEM_IO_BUTT))
    {
        ios_print_error("para is error, gpio = %d, type = %d, value = %d.\n", gpio, type, value);        
        return ;
    }

    group = gpio / GPIO_MAX_NUMBER;
    pin = gpio % GPIO_MAX_NUMBER;
    
    init_stru = get_pintrl(MODEM_PIN_INIT, group, pin);
    if(NULL == init_stru)
    {
        ios_print_error("get_pintrl is fail, init_stru = 0x%x.\n", init_stru);  
        return ;
    }
    
    normal_stru = get_pintrl(MODEM_PIN_NORMAL, group, pin);
    if(NULL == normal_stru)
    {
        ios_print_error("get_pintrl is fail, normal_stru = 0x%x.\n", normal_stru);  
        return ;
    }
    
    lowpower_stru = get_pintrl(MODEM_PIN_POWERDOWN, group, pin);
    if(NULL == lowpower_stru)
    {
        ios_print_error("get_pintrl is fail, lowpower_stru = 0x%x.\n", lowpower_stru);  
        return ;
    }
    
    switch(type)
    {
        case MODEM_IO_MUX:
            init_stru->iomg_val     = value;
            normal_stru->iomg_val   = value;
            lowpower_stru->iomg_val = value;
            break;
            
        case MODEM_IO_CFG:
            init_stru->iocg_val     = value;
            normal_stru->iocg_val   = value;
            lowpower_stru->iocg_val = value;
            break;
            
        case MODEM_GPIO_INPUT:
            init_stru->iomg_val   = 0;
            init_stru->gpio_dir   = 0;
            
            normal_stru->iomg_val = 0;
            normal_stru->gpio_dir = 0;            
            
            lowpower_stru->iomg_val = 0;
            lowpower_stru->gpio_dir = 0;
            break;
            
        case MODEM_GPIO_OUTPUT:
            init_stru->iomg_val   = 0;
            init_stru->gpio_dir   = 1;
            init_stru->gpio_val = !!value;
            
            normal_stru->iomg_val = 0;
            normal_stru->gpio_dir = 1;
            normal_stru->gpio_val = !!value;
            
            lowpower_stru->iomg_val = 0;
            lowpower_stru->gpio_dir = 1;
            lowpower_stru->gpio_val = !!value;
            break;
            
        default:
            ios_print_error("type is error, type = %d.\n", type);
            return ;
        
    }

    pintrl_config(normal_stru, 1);
}