Beispiel #1
0
static EOVmutexDerived* s_eo_nvset_get_nvmutex(EOnvSet* p, eOnvID32_t id32)
{
    EOVmutexDerived* mtx2use = NULL;
    
    if(eo_nvset_protection_none == p->protection)
    {   // the most common situation is no protection, thus ...
        mtx2use = NULL;
    }
    else
    {
        switch(p->protection)
        {            
            case eo_nvset_protection_one_per_board:
            {
                mtx2use = p->theboard.mtx_board;
            } break;            
       
            case eo_nvset_protection_one_per_endpoint:
            {
                // compute the endpoint and ....
                eOnvset_ep_t* theEndpoint = s_eo_nvset_get_endpoint(p, eoprot_ID2endpoint(id32));
                if(NULL != theEndpoint)
                {
                    mtx2use = theEndpoint->mtx_endpoint;
                }                    
            } break;  
            
            case eo_nvset_protection_one_per_netvar:
            {
                eOnvset_ep_t* theEndpoint = s_eo_nvset_get_endpoint(p, eoprot_ID2endpoint(id32));
                if(NULL != theEndpoint)
                {
                    //#warning .... i think of void* as a uint32_t* ///////////// think of it
                    uint32_t nvprognumber = eoprot_endpoint_id2prognum(p->theboard.boardnum, id32);
                    uint32_t** addr = eo_vector_At(theEndpoint->themtxofthenvs, nvprognumber);
                    mtx2use = (EOVmutexDerived*) (*addr);
                }
            } break;  
            
            default:
            {
                mtx2use = NULL;
            } break;
            
        }
    }
    
    return(mtx2use);  
}
extern eObool_t eoprot_b02_b04_mc_isproxied(eOnvID32_t id)
{    
    eOprotEndpoint_t ep = eoprot_ID2endpoint(id);
    
    eOprotEntity_t ent = eoprot_ID2entity(id);
    if(eoprot_entity_mc_joint != ent)
    {
        return(eobool_false);
    }
    
    eOprotTag_t tag = eoprot_ID2tag(id);
    
    switch(tag)
    {
        //VALE get velocity pid not implemented!!!
        case eoprot_tag_mc_joint_config_pidposition:
        // case eoprot_tag_mc_joint_config_pidvelocity:     // marco.accame on 03mar15: the pidvelocity propagation to mc4 is is not implemented, thus i must remove from proxy.
        case eoprot_tag_mc_joint_config_pidtorque:
        case eoprot_tag_mc_joint_config_limitsofjoint:
        case eoprot_tag_mc_joint_config_impedance:
        case eoprot_tag_mc_joint_cmmnds_setpoint:           // marco.accame on 03mar15: the setpoint should not be asked, thus why in here? i may just remove the handler so that no reply is obtained if wrongly used
        {
            return(eobool_true);
        }
        
        default:
        {
            return(eobool_false);
        };
     };
}
Beispiel #3
0
extern eOresult_t eo_nvset_NV_Get(EOnvSet* p, eOnvID32_t id32, EOnv* thenv)
{
    eOnvEP8_t ep8 = eoprot_ID2endpoint(id32); 
    uint8_t brd = 0; // local, or 0, 1, 2, 3 ...
    eObool_t proxied = eobool_false;
    EOnv_rom_t* rom = NULL;
    uint8_t* ram = NULL;
    EOVmutexDerived* mtx2use = NULL;
    eOvoid_fp_cnvp_cropdesp_t onsay = NULL;
 
    if((NULL == p) || (NULL == thenv)) 
    {
        return(eores_NOK_nullpointer); 
    }

    brd = p->theboard.boardnum;
    
    // - verify that on the given endpoint there is a valid id32. if the id32 is not recognised, then ... eores_NOK_generic
    if(eobool_false == eoprot_id_isvalid(brd, id32))
    {
        return(eores_NOK_generic);       
    }
    
    // - retrieve from the device and endpoint what is required to form the netvar: con, ram, mtx, etc.   
    // - 0+. proxied? 
    proxied = eoprot_variable_is_proxied(brd, id32);
    // - 0++. the onsay function
    onsay = eoprot_onsay_endpoint_get(ep8);   
    // - 1. the rom
    rom = (EOnv_rom_t*) eoprot_variable_romof_get(brd, id32);
    // - 2. the ram
    ram = (uint8_t*) eoprot_variable_ramof_get(brd, id32);
    // - 3. the mtx
    mtx2use = s_eo_nvset_get_nvmutex(p, id32);
        
    // - final control about the validity of id32. it may be redundant but it is safer. for instance if the fptr_isepidsupported()
    //   does not take into account a removed tag and just checks that the tag-number is lower than the max allowed.
    
    if((NULL == rom) || (NULL == ram))  // mtx2use can be NULL
    {
        return(eores_NOK_generic); 
    }
    

    // - load everything into the nv
    eo_nv_hid_Load(     thenv,
                        p->theboard.ipaddress,
                        brd,
                        proxied,
                        id32,  
                        onsay,
                        rom,
                        ram,
                        mtx2use
                  );    

    return(eores_OK);
}