示例#1
0
static eOresult_t s_eo_nvset_DeinitEPs(EOnvSet* p)
{
    eOnvset_brd_t* theBoard = &p->theboard;   
    uint16_t i = 0;  
    uint16_t endpointsnum = 0;
    
    if(NULL == theBoard->theendpoints)
    {   // already deinitted
        return(eores_OK);
    }
   
    endpointsnum = eo_vector_Size(theBoard->theendpoints);
 
    for(i=0; i<endpointsnum; i++)
    {
        eOnvset_ep_t **ppep = (eOnvset_ep_t **)eo_vector_At(theBoard->theendpoints, i);
        eOnvset_ep_t *theEndpoint = *ppep;
        
        // now i erase memory associated with this endpoint
        eo_mempool_Delete(eo_mempool_GetHandle(), theEndpoint->epram);
        // and i dissociates that from from the internals of the eoprot library
        eoprot_config_endpoint_ram(theBoard->boardnum, theEndpoint->epcfg.endpoint, NULL, 0);
        // i also de-init the number of entities for that endpoint
        eoprot_config_endpoint_entities(theBoard->boardnum, theEndpoint->epcfg.endpoint, NULL);
        
        // now i delete all data associated to the mutex protection
        
        if(NULL != theEndpoint->mtx_endpoint)
        {
            eov_mutex_Delete(theEndpoint->mtx_endpoint);
        }
        if(NULL != theEndpoint->themtxofthenvs)
        {
            uint16_t size = eo_vector_Size(theEndpoint->themtxofthenvs);
            int j = 0;
            for(j=0; j<size; j++)
            {
                EOVmutexDerived** pmtx =  (EOVmutexDerived**)eo_vector_At(theEndpoint->themtxofthenvs, j);
                eov_mutex_Delete(*pmtx);            
            } 
            eo_vector_Delete(theEndpoint->themtxofthenvs);
        }
   
        // now i erase the memory of the entire eOnvset_ep_t entry        
        eo_mempool_Delete(eo_mempool_GetHandle(), theEndpoint);       
    }
    
    // so that we dont get in here inside again
    theBoard->theendpoints = NULL;

    return(eores_OK);
}
示例#2
0
static eOresult_t s_eo_nvset_DeinitDEV(EOnvSet* p)
{
    eOnvset_brd_t *theBoard = &p->theboard;
    
    // the array of endpoints
    eo_vector_Delete(theBoard->theendpoints);
    
    // the mtx of device, if non NULL
    if(NULL != theBoard->mtx_board)
    {
        eov_mutex_Delete(theBoard->mtx_board);
    }
    
    
    // so that we know that everything is deinitted
    p->theboard.ipaddress = 0;
     
    return(eores_OK);
}
示例#3
0
extern void eo_confman_Delete(EOconfirmationManager *p)
{
    if(NULL == p)
    {    
        return;
    }
    
    if(NULL != p->mtx)
    {
        eov_mutex_Delete(p->mtx);
    }
    
    if(NULL != p->confrequests)
    {
        eo_vector_Delete(p->confrequests);
    }
   
    memset(p, 0, sizeof(EOconfirmationManager));
    eo_mempool_Delete(eo_mempool_GetHandle(), p);
    return;   
}