Exemplo n.º 1
0
KHMEXP void KHMAPI
khui_cfg_set_param_inst(khui_config_node vnode,
                        khui_config_node noderef,
                        LPARAM param) {
    khui_config_node_i * node;
    cfg_node_data * data;

    cfgui_init_once();

    if (vnode &&
        !cfgui_is_valid_node_handle(vnode))
        return;

    EnterCriticalSection(&cs_cfgui);
    if (cfgui_is_valid_node_handle(vnode))
        node = cfgui_node_i_from_handle(vnode);
    else if (!vnode)
        node = cfgui_root_config;
    else
        node = NULL;

    if (node) {
        data = get_node_data(node, noderef, TRUE);
        if (data)
            data->param = param;
    }
    LeaveCriticalSection(&cs_cfgui);
}
Exemplo n.º 2
0
static bool network_process_probe_node(network_t * network, tree_node_t * node, size_t i)
{
    tree_node_probe_t * tree_node_probe = get_node_data(node);
    probe_t           * probe;

    if (!(tree_node_probe->tag == PROBE))                               goto ERR_TAG;
    probe = (probe_t *) (tree_node_probe->data.probe);
    //TODO packet_from_probe must manage generator

    probe_set_queueing_time(probe, get_timestamp());
    if (!(queue_push_element(network->sendq, probe)))                   goto ERR_QUEUE_PUSH;
    /*
    probe_set_left_to_send(probe, probe_get_left_to_send(probe) - 1);
    num_probes_to_send = probe_get_left_to_send(probe);

    if (num_probes_to_send == 0) {
    */
    if (--(probe->left_to_send) == 0) {
        if (!(probe_group_del(network->scheduled_probes, node->parent, i)))  goto ERR_PROBE_GROUP_DEL;
    } else {
        get_node_next_delay(node);
        probe_group_update_delay(network->scheduled_probes, node);
        return true;
    }

ERR_PROBE_GROUP_DEL:
ERR_QUEUE_PUSH:
ERR_TAG:
    return false;
}
Exemplo n.º 3
0
KHMEXP HWND KHMAPI
khui_cfg_get_hwnd_inst(khui_config_node vnode,
                       khui_config_node noderef) {
    khui_config_node_i * node;
    cfg_node_data * data;
    HWND hwnd;

    cfgui_init_once();

    if (vnode &&
        !cfgui_is_valid_node_handle(vnode))
        return NULL;

    EnterCriticalSection(&cs_cfgui);
    if (cfgui_is_valid_node_handle(vnode))
        node = cfgui_node_i_from_handle(vnode);
    else if (!vnode)
        node = cfgui_root_config;
    else
        node = NULL;

    if (node) {
        data = get_node_data(node, noderef, FALSE);
        if (data)
            hwnd = data->hwnd;
        else
            hwnd = NULL;
    } else
        hwnd = NULL;
    LeaveCriticalSection(&cs_cfgui);

    return hwnd;
}
Exemplo n.º 4
0
KHMEXP LPARAM KHMAPI
khui_cfg_get_param_inst(khui_config_node vnode,
                        khui_config_node noderef) {
    khui_config_node_i * node;
    cfg_node_data * data;
    LPARAM lParam;

    cfgui_init_once();

    if (vnode &&
        !cfgui_is_valid_node_handle(vnode))
        return 0;

    EnterCriticalSection(&cs_cfgui);
    if (cfgui_is_valid_node_handle(vnode))
        node = cfgui_node_i_from_handle(vnode);
    else if (!vnode)
        node = cfgui_root_config;
    else
        node = NULL;

    if (node) {
        data = get_node_data(node, noderef, FALSE);
        if (data)
            lParam = data->param;
        else
            lParam = 0;
    } else
        lParam = 0;
    LeaveCriticalSection(&cs_cfgui);

    return lParam;
}
Exemplo n.º 5
0
int get_ss_corner()
{
    int data_count;
    int is_ss = 0;
    char *data_buf = NULL;
    
    get_node_data(SS_DEVNODE, &data_buf, &data_count);
    sscanf (data_buf,"%d", &is_ss);
    AUTOK_FREE(data_buf);
    return is_ss;
}
Exemplo n.º 6
0
int get_debug()
{
    int data_count;
    int debug_value = -1;    
    char *data_buf = NULL;
    
    get_node_data(DEBUG_DEVNODE, &data_buf, &data_count);
    sscanf(data_buf, "%d\n", &debug_value);
    AUTOK_FREE(data_buf);
    return debug_value;
}
Exemplo n.º 7
0
char* get_stage1_log(int id, int *data_count)
{
    char devnode[BUF_LEN]="";    
    int value = -1;
    char *data_buf = NULL;

    snprintf(devnode, BUF_LEN, "%s/%d/%s", STAGE1_DEVNODE, id, "LOG");
    get_node_data(devnode, &data_buf, data_count);

    return data_buf;     
}
Exemplo n.º 8
0
int get_param_count()
{
    int data_count;
    char *data_buf = NULL;
    int param_count = 0;
    
    get_node_data(PARAM_COUNT_DEVNODE, &data_buf, &data_count);
    sscanf (data_buf,"%d", &param_count);
    AUTOK_FREE(data_buf);
    return param_count;
}   
Exemplo n.º 9
0
/* called with cs_cfgui held */
static void
recalc_node_flags(khui_config_node vnode, khm_boolean plural) {
    khui_config_node_i * node;
    khui_config_node_i * parent;
    khui_config_node_i * subpanel;
    cfg_node_data * data;
    khm_int32 flags;

#ifdef DEBUG
    assert(cfgui_is_valid_node_handle(vnode));
#endif

    node = cfgui_node_i_from_handle(vnode);

    if (plural)
        parent = TPARENT(node);
    else
        parent = node;
#ifdef DEBUG
    assert(parent);
#endif

    flags = 0;

    for(subpanel = TFIRSTCHILD(parent); subpanel;
        subpanel = LNEXT(subpanel)) {
        if (!(subpanel->reg.flags & KHUI_CNFLAG_SUBPANEL) ||
            (plural && !(subpanel->reg.flags & KHUI_CNFLAG_PLURAL)) ||
            (!plural && (subpanel->reg.flags & KHUI_CNFLAG_PLURAL)))
            continue;

        data = get_node_data(subpanel,
                             vnode,
                             FALSE);

        if (data) {
            flags |= data->flags;
        }
    }

    flags &= KHUI_CNFLAGMASK_DYNAMIC;

    if ((node->flags & KHUI_CNFLAGMASK_DYNAMIC) == flags)
        return;

    node->flags = (node->flags & ~KHUI_CNFLAGMASK_DYNAMIC) | flags;

    if (hwnd_cfgui)
        PostMessage(hwnd_cfgui, KHUI_WM_CFG_NOTIFY,
                    MAKEWPARAM((WORD) node->flags, WMCFG_UPDATE_STATE),
                    (LPARAM) vnode);
}
Exemplo n.º 10
0
int get_stage1_voltage(int id)
{
    int data_count;
    char devnode[BUF_LEN]="";    
    int value = -1;
    char *data_buf = NULL;
    
    snprintf(devnode, BUF_LEN, "%s/%d/%s", STAGE1_DEVNODE, id, "VOLTAGE");
    get_node_data(devnode, &data_buf, &data_count);
    sscanf(data_buf, "%d\n", &value);
    AUTOK_FREE(data_buf);
    return value;     
}
Exemplo n.º 11
0
std::list<struct host_progress*> get_ready()
{
    std::list<struct host_progress*> proglist;
    int data_count;
    std::list<struct host_progress*>::iterator it_prog;
    char *line;
    char *s_idx, *e_idx;
    char temp_str[512];
    int debug_value = -1;
    int host_id = -1;
    int is_done = 0;
    char *data_buf = NULL;
    
    get_node_data(READY_DEVNODE, &data_buf, &data_count);
	line = strtok(data_buf,"\n");
	while (line != NULL)
	{
		//LOGI ("%s\n",line);
		s_idx = line;
		if((e_idx = strstr(line, ":"))){
			memcpy(temp_str, s_idx, e_idx-s_idx);
			memset(temp_str+(e_idx-s_idx), 0, 1);
			sscanf(temp_str, "%d", &host_id);
			s_idx = e_idx+1;
			if((e_idx = strstr(s_idx, "\t")) || (e_idx = strstr(s_idx, " "))){
				memcpy(temp_str, s_idx, e_idx-s_idx);
				memset(temp_str+(e_idx-s_idx), 0, 1);
				sscanf(temp_str, "%d", &is_done);
				//LOGI("host_id:%d, done:%d\n", host_id, is_done);
			}
			for (it_prog=proglist.begin(); it_prog!=proglist.end() ; ++it_prog){
				struct host_progress *temp_prog = *it_prog;
				if(temp_prog->host_id == host_id){
					temp_prog->is_done = is_done;
					break;
				}
			}
			if(it_prog == proglist.end()){
				struct host_progress *prog = (struct host_progress *)malloc(sizeof(struct host_progress));
				prog->host_id = host_id;
				prog->is_done = is_done;
				proglist.push_back(prog);
			}
		}
		line = strtok (NULL, "\n");
	}  
    AUTOK_FREE(data_buf);
    return proglist;
}
Exemplo n.º 12
0
KHMEXP void KHMAPI
khui_cfg_set_flags_inst(khui_config_init_data * d,
                        khm_int32 flags,
                        khm_int32 mask) {
    khui_config_node_i * node;
    cfg_node_data * data;

    cfgui_init_once();
    if (!cfgui_is_valid_node_handle(d->this_node))
        return;

    mask &= KHUI_CNFLAGMASK_DYNAMIC;

    EnterCriticalSection(&cs_cfgui);
    if (cfgui_is_valid_node_handle(d->this_node))
        node = cfgui_node_i_from_handle(d->this_node);
    else
        node = NULL;

    if (node) {
        data = get_node_data(node, d->ctx_node, TRUE);
        if (data) {
            khm_int32 new_flags;

            new_flags = (flags & mask) |
                (data->flags & ~mask);

            if (new_flags != data->flags) {
                data->flags = new_flags;

                if (d->ctx_node != d->ref_node)
                    recalc_node_flags(d->ctx_node, TRUE);
                else
                    recalc_node_flags(d->ctx_node, FALSE);
            }
        }
    }
    LeaveCriticalSection(&cs_cfgui);
}
Exemplo n.º 13
0
int get_suggest_vols(unsigned int **vol_list)
{
    char* pre_index, *post_index;
    int data_count;
    unsigned int vol;
    int i;
    int is_ss = 0;
    char *data_buf = NULL;
    char devnode[BUF_LEN]=""; 
    unsigned int vol_temps[10] = {0};
  
    //std::list<unsigned int>::iterator it_vol;
    snprintf(devnode, BUF_LEN, "%s", SUGGEST_VOL_DEVNODE);
    get_node_data(devnode, &data_buf, &data_count);
   
    pre_index = data_buf;
    i=0;
    while(1){
        if((post_index = strchr(pre_index, ':'))==NULL)
            break;
        *post_index = '\0';
        sscanf(pre_index, "%u", &vol);
        vol_temps[i] = vol;
        i++;
        if((pre_index = post_index+1)>=data_buf+data_count)
            break;
    }
    AUTOK_FREE(data_buf);
    
    // [FIXME]Limitation for max suggest voltages
    if(i==0)
        return 0;
    if(i>10)
        i=10;
    *vol_list = (unsigned int*)malloc(sizeof(unsigned int)*i);
    memcpy(*vol_list, vol_temps, sizeof(unsigned int)*i);
    return i;
}