Ejemplo n.º 1
0
extern void eom_emsappl_hid_userdef_on_exit_RUN(EOMtheEMSappl* p)
{    
    // EOtheCANservice: set straigth mode and force parsing of all packets in the RX queues.
    eo_canserv_SetMode(eo_canserv_GetHandle(), eocanserv_mode_straight);
    eo_canserv_ParseAll(eo_canserv_GetHandle());  
  
    
    // stop services 
    
    // motion-control
    eo_motioncontrol_Stop(eo_motioncontrol_GetHandle());
    eo_motioncontrol_Deactivate(eo_motioncontrol_GetHandle());
    
    // stop tx activity of services that may have been started by callback function
    
    // strain... no strain in here
//    eo_strain_Stop(eo_strain_GetHandle());
//    eo_strain_Deactivate(eo_strain_GetHandle());
        
    // skin
    eo_skin_Stop(eo_skin_GetHandle());
    eo_skin_Deactivate(eo_skin_GetHandle());
        
    // mais
    eo_mais_Stop(eo_mais_GetHandle());
    eo_mais_Deactivate(eo_mais_GetHandle());

    // inertials
    eo_inertials2_Stop(eo_inertials2_GetHandle());    
    eo_inertials2_Deactivate(eo_inertials2_GetHandle());
}
Ejemplo n.º 2
0
extern eOresult_t eo_skin_Activate(EOtheSKIN *p, const eOmn_serv_configuration_t * servcfg)
{
    if((NULL == p) || (NULL == servcfg))
    {
        return(eores_NOK_nullpointer);
    } 

    if(eomn_serv_SK_skin != servcfg->type)
    {
        return(eores_NOK_generic);
    }
    
    if(eobool_true == p->service.active)
    {
        eo_skin_Deactivate(p);        
    }   
    
    eo_entities_SetNumOfSkins(eo_entities_GetHandle(), servcfg->data.sk.skin.numofpatches);
    

    if(0 == eo_entities_NumOfSkins(eo_entities_GetHandle()))
    {
        p->service.active = eobool_false;
        return(eores_NOK_generic);
    }
    else
    {         
        memcpy(&p->service.servconfig, servcfg, sizeof(eOmn_serv_configuration_t));

        p->numofskinpatches = servcfg->data.sk.skin.numofpatches;
        
        uint8_t i = 0;
        for(i=0; i<p->numofskinpatches; i++)
        {
            p->skinpatches[i] = eo_entities_GetSkin(eo_entities_GetHandle(), i);
        }
        
        // now i must add all the mtb boards. i iterate per patch and then per canbus
        
        eObrd_canproperties_t prop = 
        {
            .type               = eobrd_cantype_mtb, 
            .location           = { .port = 0, .addr = 0, .insideindex = eobrd_caninsideindex_none },
            .requiredprotocol   = { .major = servcfg->data.sk.skin.version.protocol.major, .minor = servcfg->data.sk.skin.version.protocol.minor }
        };  
        
        eOcanmap_entitydescriptor_t des = 
        {
            .location   = { .port = 0, .addr = 0, .insideindex = eobrd_caninsideindex_none },
            .index      = entindexNONE
        };        
Ejemplo n.º 3
0
extern void eom_emsappl_hid_userdef_on_entry_ERR(EOMtheEMSappl* p)
{
    // pulse led3 forever at 4 hz.
    eo_ledpulser_Start(eo_ledpulser_GetHandle(), eo_ledpulser_led_three, EOK_reltime1sec/4, 0);
   

    // EOtheCANservice: set straight mode and force parsing of all packets in the RX queues.
    eo_canserv_SetMode(eo_canserv_GetHandle(), eocanserv_mode_straight);
    eo_canserv_ParseAll(eo_canserv_GetHandle());  

    
    
    // stop services which may have been started 
    
    // motion-control
    eo_motioncontrol_Stop(eo_motioncontrol_GetHandle());
    eo_motioncontrol_Deactivate(eo_motioncontrol_GetHandle());
        
    // stop tx activity of services that may have been started by callback function
    
    // strain... no strain in here
//    eo_strain_Stop(eo_strain_GetHandle());
//    eo_strain_Deactivate(eo_strain_GetHandle());
        
    // skin
    eo_skin_Stop(eo_skin_GetHandle());
    eo_skin_Deactivate(eo_skin_GetHandle());
        
    // mais
    eo_mais_Stop(eo_mais_GetHandle());
    eo_mais_Deactivate(eo_mais_GetHandle());

    // inertials
    eo_inertials2_Stop(eo_inertials2_GetHandle());    
    eo_inertials2_Deactivate(eo_inertials2_GetHandle());
    
    // inertials3
    eo_inertials3_Stop(eo_inertials3_GetHandle());    
    eo_inertials3_Deactivate(eo_inertials3_GetHandle());
    
    // temperatures
    eo_temperatures_Stop(eo_temperatures_GetHandle());    
    eo_temperatures_Deactivate(eo_temperatures_GetHandle());     
}
Ejemplo n.º 4
0
extern eOresult_t eo_skin_Verify(EOtheSKIN *p, const eOmn_serv_configuration_t * servcfg, eOservice_onendofoperation_fun_t onverify, eObool_t activateafterverify)
{
    if((NULL == p) || (NULL == servcfg))
    {
        s_eo_theskin.service.state = eomn_serv_state_failureofverify;
        eo_service_hid_SynchServiceState(eo_services_GetHandle(), eomn_serv_category_skin, s_eo_theskin.service.state);
        if(NULL != onverify)
        {
            onverify(p, eobool_false); 
        }                
        return(eores_NOK_nullpointer);
    } 

    if(eomn_serv_SK_skin != servcfg->type)
    {
        p->service.state = eomn_serv_state_failureofverify;
        eo_service_hid_SynchServiceState(eo_services_GetHandle(), eomn_serv_category_skin, p->service.state);
        if(NULL != onverify)
        {
            onverify(p, eobool_false); 
        }      
        return(eores_NOK_generic);
    }   
    
 
    if(eobool_true == p->service.active)
    {
        eo_skin_Deactivate(p);        
    }   
    
    p->service.state = eomn_serv_state_verifying;
    eo_service_hid_SynchServiceState(eo_services_GetHandle(), eomn_serv_category_skin, p->service.state);
    
    // make sure the timer is not running
    eo_timer_Stop(p->diagnostics.reportTimer);  
      
    p->service.onverify = onverify;
    p->service.activateafterverify = activateafterverify;

    p->sharedcan.discoverytarget.info.type = eobrd_cantype_mtb;
    p->sharedcan.discoverytarget.info.protocol.major = servcfg->data.sk.skin.version.protocol.major; 
    p->sharedcan.discoverytarget.info.protocol.minor = servcfg->data.sk.skin.version.protocol.minor;
    p->sharedcan.discoverytarget.info.firmware.major = servcfg->data.sk.skin.version.firmware.major; 
    p->sharedcan.discoverytarget.info.firmware.minor = servcfg->data.sk.skin.version.firmware.minor;    
    p->sharedcan.discoverytarget.info.firmware.build = servcfg->data.sk.skin.version.firmware.build;    
    
    // now i must do discovery of the patches. all patches can be at most on the two can buses ...
    // moreover, we cannot have more than .... eo_skin_maxnumberofMTBboards boards

    p->sharedcan.discoverytarget.canmap[eOcanport1] = p->sharedcan.discoverytarget.canmap[eOcanport2] = 0x0000;
    uint8_t i=0;
    for(i=0; i<servcfg->data.sk.skin.numofpatches; i++)
    {
        p->sharedcan.discoverytarget.canmap[eOcanport1] |= servcfg->data.sk.skin.canmapskin[i][eOcanport1];
        p->sharedcan.discoverytarget.canmap[eOcanport2] |= servcfg->data.sk.skin.canmapskin[i][eOcanport2];
    }
    
    uint8_t numofboards = eo_common_hlfword_bitsetcount(p->sharedcan.discoverytarget.canmap[eOcanport1]) +
                          eo_common_hlfword_bitsetcount(p->sharedcan.discoverytarget.canmap[eOcanport2]);
    
    if(numofboards > eo_skin_maxnumberofMTBboards)
    {        
        p->diagnostics.errorDescriptor.sourcedevice       = eo_errman_sourcedevice_localboard;
        p->diagnostics.errorDescriptor.sourceaddress      = 0;
        p->diagnostics.errorDescriptor.par16              = (numofboards << 8) | (eo_skin_maxnumberofMTBboards & 0x00ff);
        p->diagnostics.errorDescriptor.par64              = (p->sharedcan.discoverytarget.canmap[eOcanport2] << 16) | (p->sharedcan.discoverytarget.canmap[eOcanport1]);
       
        EOaction_strg astrg = {0};
        EOaction *act = (EOaction*)&astrg;
        eo_action_SetCallback(act, s_eo_skin_send_periodic_error_report, p, eov_callbackman_GetTask(eov_callbackman_GetHandle()));        
        
        p->diagnostics.errorDescriptor.code = eoerror_code_get(eoerror_category_Config, eoerror_value_CFG_skin_failed_toomanyboards);
        p->diagnostics.errorType = eo_errortype_error;                
        eo_errman_Error(eo_errman_GetHandle(), p->diagnostics.errorType, NULL, s_eobj_ownname, &p->diagnostics.errorDescriptor);
        
        if(0 != p->diagnostics.reportPeriod)
        {
            p->diagnostics.errorCallbackCount = EOK_int08dummy;
            eo_timer_Start(p->diagnostics.reportTimer, eok_abstimeNOW, p->diagnostics.reportPeriod, eo_tmrmode_FOREVER, act);   
        }  

        p->service.state = eomn_serv_state_failureofverify;
        eo_service_hid_SynchServiceState(eo_services_GetHandle(), eomn_serv_category_skin, p->service.state);
        if(NULL != onverify)
        {
            onverify(p, eobool_false); 
        }  
        
        return(eores_NOK_generic); 
    }
              
    p->sharedcan.ondiscoverystop.function = s_eo_skin_onstop_search4mtbs;
    p->sharedcan.ondiscoverystop.parameter = (void*)servcfg;
    
    // start discovery   
    eo_candiscovery2_Start(eo_candiscovery2_GetHandle(), &p->sharedcan.discoverytarget, &p->sharedcan.ondiscoverystop);   
   
    return(eores_OK);   
}