static void wake(const EOnv* nv)
{
    eOprotID32_t id32 = 0;
    eOprotProgNumber_t prognum = 0 ;
    void *mchandler = (void*) feat_MC_handler_get(eo_nv_GetIP(nv), eo_nv_GetID32(nv));
    if(NULL == mchandler)
    {
        printf("eoMC class not found\n");
        return;
    }

    id32 = eo_nv_GetID32(nv);
    prognum = eoprot_endpoint_id2prognum(eo_nv_GetBRD(nv), id32);
    if(eobool_false == feat_MC_mutex_post(mchandler, prognum) )
    {
        char nvinfo[128];
        char ipinfo[20];
        char str[256] = {0};
        eoprot_ID2information(id32, nvinfo, sizeof(nvinfo));
        eo_common_ipv4addr_to_string(eo_nv_GetIP(nv), ipinfo, sizeof(ipinfo));
        snprintf(str, sizeof(str),"while releasing mutex for IP %s and NV %s", ipinfo, nvinfo);
        feat_PrintWarning(str);
    }

}
예제 #2
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);  
}
static void wake(const EOnv* nv)
{
    eOprotID32_t id32 = 0;
    eOprotProgNumber_t prognum = 0 ;
    void *mchandler = (void*) feat_MC_handler_get(nvBoardNum2FeatIdBoardNum(eo_nv_GetBRD(nv)), eo_nv_GetID32(nv));
    if(NULL == mchandler)
    {
        printf("eoMC class not found\n");
        return;
    }

    id32 = eo_nv_GetID32(nv);
    prognum = eoprot_endpoint_id2prognum(eo_nv_GetBRD(nv), id32);
    if(fakestdbool_false == feat_MC_mutex_post(mchandler, prognum) )
    {
        char nvinfo[128];
        char str[256] = {0};
        eoprot_ID2information(id32, nvinfo, sizeof(nvinfo));
        snprintf(str, sizeof(str),"while releasing mutex in BOARD %d for variable %s", eo_nv_GetBRD(nv)+1, nvinfo); 
        embObjPrintWarning(str);
    }
}