extern eOresult_t eo_confman_ConfirmationRequest_Insert(EOconfirmationManager *p, eOropdescriptor_t* ropdesc) { if((NULL == p) || (NULL == ropdesc)) { return(eores_NOK_generic); } // if conf request is flagged on if(1 == ropdesc->control.rqstconf) { if(NULL != p->confrequests) { eov_mutex_Take(p->mtx, eok_reltimeINFINITE); if(eobool_false == eo_vector_Full(p->confrequests)) { eo_vector_PushBack(p->confrequests, ropdesc); } else { eov_mutex_Release(p->mtx); return(eores_NOK_generic); } eov_mutex_Release(p->mtx); } } return(eores_OK); }
extern eOresult_t eo_nvsetbrdbuilder_EP_Load(EOnvsetBRDbuilder* p, eOprot_EPcfg_t* epcfg) { EOvector *v = NULL; if((NULL == p) || (NULL == epcfg)) { return(eores_NOK_nullpointer); } if(eobool_false == eoprot_EPcfg_isvalid(epcfg)) { return(eores_NOK_generic); } // ok. now i put the item inside p->brdcfg->epcfg_constvect v = p->epcfg_vector; eo_vector_PushBack(v, epcfg); // and make sure that the constvector is udapted eo_constvector_Load(p->brdcfg->epcfg_constvect); return(eores_OK); }
extern eOresult_t eo_nvset_LoadEP(EOnvSet* p, eOprot_EPcfg_t *cfgofep, eObool_t initNVs) { eOnvset_brd_t* theBoard = NULL; eOnvBRD_t brd = 0; // local or 0, 1, 2, etc. eOnvset_ep_t *theEndpoint = NULL; uint16_t epnvsnumberof = 0; uint16_t sizeofram =0; if((NULL == p) || (NULL == cfgofep)) { return(eores_NOK_nullpointer); } theBoard = &p->theboard; brd = p->theboard.boardnum; theEndpoint = eo_mempool_New(eo_mempool_GetHandle(), 1*sizeof(eOnvset_ep_t)); memcpy(&theEndpoint->epcfg, cfgofep, sizeof(eOprot_EPcfg_t)); // ok, now in theEndpoint->epcfg.numberofsentities[] we have some ram. we use it to load the protocol. eoprot_config_endpoint_entities(brd, theEndpoint->epcfg.endpoint, theEndpoint->epcfg.numberofentities); // now it is ok to compute the size of the endpoint using the proper protocol function sizeofram = eoprot_endpoint_sizeof_get(brd, theEndpoint->epcfg.endpoint); // now that i have loaded the number of entities i verify if they are ok by checking the number of variables in the endpoint. epnvsnumberof = eoprot_endpoint_numberofvariables_get(brd, cfgofep->endpoint); if(0 == epnvsnumberof) { //#warning TBD: see how we continue in here .... char str[64] = {0}; snprintf(str, sizeof(str), "EOnvSet: ep %d has 0 nvs", cfgofep->endpoint); eo_errman_Error(eo_errman_GetHandle(), eo_errortype_error, str, NULL, &eo_errman_DescrRuntimeErrorLocal); eoprot_config_endpoint_entities(brd, theEndpoint->epcfg.endpoint, NULL); eo_mempool_Delete(eo_mempool_GetHandle(), theEndpoint); return(eores_NOK_generic); } theEndpoint->epnvsnumberof = epnvsnumberof; theEndpoint->initted = eobool_false; theEndpoint->epram = eo_mempool_GetMemory(eo_mempool_GetHandle(), eo_mempool_align_auto, sizeofram, 1); theEndpoint->mtx_endpoint = (eo_nvset_protection_one_per_endpoint == p->protection) ? p->mtxderived_new() : NULL; // now we must load the ram in the endpoint eoprot_config_endpoint_ram(brd, theEndpoint->epcfg.endpoint, theEndpoint->epram, sizeofram); // now add the vector of mtx if needed. if(eo_nvset_protection_one_per_netvar == p->protection) { uint16_t i; theEndpoint->themtxofthenvs = eo_vector_New(sizeof(EOVmutexDerived*), epnvsnumberof, NULL, 0, NULL, NULL); for(i=0; i<epnvsnumberof; i++) { EOVmutexDerived* mtx = p->mtxderived_new(); eo_vector_PushBack(theEndpoint->themtxofthenvs, &mtx); } } // now, i must update the mapping function from ep value to vector of endpoints theBoard->ep2indexlut[theEndpoint->epcfg.endpoint] = eo_vector_Size(theBoard->theendpoints); // and only now i push back the endpoint eo_vector_PushBack(theBoard->theendpoints, &theEndpoint); if(eobool_true == initNVs) { s_eo_nvset_NVsOfEP_Initialise(p, theEndpoint, theEndpoint->epcfg.endpoint); } return(eores_OK); }