extern xme_status_t xme_core_loop_init( void ) { XME_HAL_SINGLYLINKEDLIST_INIT(xme_core_loop_SchedulerData.initQueue); XME_HAL_SINGLYLINKEDLIST_INIT(xme_core_loop_SchedulerData.chunks); /* Registration of the RTE modules */ XME_CHECK_MSG( XME_STATUS_SUCCESS == xme_core_loop_RegisterModulesCallback(), XME_STATUS_INVALID_CONFIGURATION, XME_LOG_FATAL, MODULE_ACRONYM "Could not register RTE modules!\n"); /* A configuration routine to define RTE "chunks" - the basic blocks of RTE module execution on OS level */ XME_CHECK_MSG( XME_STATUS_SUCCESS == xme_core_loop_CreateChunksCallback(), XME_STATUS_INVALID_CONFIGURATION, XME_LOG_FATAL, MODULE_ACRONYM "Could not create RTE chunks!\n"); /* Check the chunks for plausibility and register in EM */ XME_CHECK_MSG( XME_STATUS_SUCCESS == xme_core_loop_completeInitialization(), XME_STATUS_INVALID_CONFIGURATION, XME_LOG_FATAL, MODULE_ACRONYM "Could not complete RTE initialization!\n"); XME_HAL_SINGLYLINKEDLIST_ITERATE_BEGIN(xme_core_loop_SchedulerData.initQueue, xme_core_exec_componentDescriptor_t, compToInit); if(compToInit->autoInit) { XME_LOG(XME_LOG_NOTE, MODULE_ACRONYM "RTE scheduler: initialize component %3d with priority %5d\n", compToInit->componentId, compToInit->initPriority); XME_CHECK_MSG(XME_STATUS_SUCCESS == compToInit->init(compToInit->initParam), XME_STATUS_INVALID_CONFIGURATION, XME_LOG_FATAL, MODULE_ACRONYM "Failure during initialization of the component %d\n", compToInit->componentId); } XME_HAL_SINGLYLINKEDLIST_ITERATE_END(); XME_CHECK( XME_STATUS_SUCCESS == xme_core_loop_ActivateScheduleCallback(), XME_STATUS_INTERNAL_ERROR); return XME_STATUS_SUCCESS; }
virtual void SetUp(void) { int index = 0; /* Initialize execution manager */ xme_core_exec_init(&testConfig); /* Create functions */ for (index = 0; index < TEST_FUNCTIONS_TOTAL; index++) { cid[index] = (xme_core_component_t) (index + 1); fid[index] = (xme_core_component_functionId_t) 1; args[index] = NULL; createHelperInstance(cid[index], fid[index], 1); } /* Set up a schedule set using configuration functions */ for (index = 0; index < 5; index++) { xme_core_exec_schedule_table_t* table; xme_core_exec_scheduler_createScheduleTable(&table, xme_hal_time_timeIntervalFromMilliseconds(10 * index + 10)); xme_core_exec_scheduler_registerSchedule(table, &(schedules[index])); } /* Fill in configuration schedule sets */ for (index = 0; index < TEST_FUNCTIONS_TOTAL; index++) { XME_HAL_SINGLYLINKEDLIST_INIT(scheduleSets[index]); /* schedules[0] has all the items */ XME_HAL_SINGLYLINKEDLIST_ADD_ITEM(scheduleSets[index], &(schedules[0])); if (index % 2) { XME_HAL_SINGLYLINKEDLIST_ADD_ITEM(scheduleSets[index], &(schedules[1])); XME_HAL_SINGLYLINKEDLIST_ADD_ITEM(scheduleSets[index], &(schedules[3])); } else { XME_HAL_SINGLYLINKEDLIST_ADD_ITEM(scheduleSets[index], &(schedules[2])); XME_HAL_SINGLYLINKEDLIST_ADD_ITEM(scheduleSets[index], &(schedules[4])); } } /* Schedule the functions */ for (index = 0; index < TEST_FUNCTIONS_TOTAL; index++) { xme_hal_linkedList_descriptor_t* currentScheduleSet; xme_core_exec_scheduler_getScheduleSetPointer(¤tScheduleSet); xme_core_exec_scheduler_addFunctionToScheduleSet(currentScheduleSet, &(scheduleSets[index]), cid[index], fid[index], NULL, 0, 1000, 0, 0); } clearExecutionCounters(); }
void xme_core_pnp_pnpClientSendLogoutRequestFunction_step ( xme_core_pnp_pnpClientComponent_config_t* const componentConfig ) { xme_status_t status[1]; xme_core_topic_pnp_logoutRequest_t* portOutLogoutRequestDataPtr = &portOutLogoutRequestData; { // PROTECTED REGION ID(XME_CORE_PNP_PNPCLIENTSENDLOGOUTREQUESTFUNCTION_STEP_C) ENABLED START xme_hal_singlyLinkedList_t(10) tmpList; XME_UNUSED_PARAMETER(componentConfig); XME_HAL_SINGLYLINKEDLIST_INIT(tmpList); status[0] = xme_core_pnp_pnpClient_getLoggedoutNodes(&tmpList); if (XME_STATUS_SUCCESS == status[0]) { XME_HAL_SINGLYLINKEDLIST_ITERATE_BEGIN(tmpList, void, tempNodeId); { portOutLogoutRequestData.nodeId = (xme_core_node_nodeId_t)(uintptr_t)tempNodeId; } XME_HAL_SINGLYLINKEDLIST_ITERATE_END(); } else { portOutLogoutRequestDataPtr = NULL; } // PROTECTED REGION END } status[0] = xme_core_pnp_pnpClientComponentWrapper_writePortOutLogoutRequest(portOutLogoutRequestDataPtr); { // PROTECTED REGION ID(XME_CORE_PNP_PNPCLIENTSENDLOGOUTREQUESTFUNCTION_STEP_2_C) ENABLED START // TODO: Check return values of writePort calls here // PROTECTED REGION END } }
xme_status_t configuratorExtension_adv_pnpControlUI_pnpControlUIFunction_init ( configuratorExtension_adv_pnpControlUI_pnpControlUIComponent_config_t* const componentConfig ) { // PROTECTED REGION ID(CONFIGURATOREXTENSION_ADV_PNPCONTROLUI_PNPCONTROLUIFUNCTION_INITIALIZE_C) ENABLED START XME_UNUSED_PARAMETER(componentConfig); commandQueueMutex = xme_hal_sync_createCriticalSection(); XME_HAL_SINGLYLINKEDLIST_INIT(commandQueue); userInputTaskHandle = xme_hal_sched_addTask(0, xme_hal_time_timeIntervalFromSeconds(1u), 0, userInputTask, NULL); return XME_STATUS_SUCCESS; // PROTECTED REGION END }
xme_status_t setUp(void) { xme_core_broker_initStruct_t brokerParams; xme_core_exec_schedule_handle_t* schedule; printf("fixture:setup\n"); /* Initialization of XME components */ /* Init sync */ XME_CHECK_MSG(XME_STATUS_SUCCESS == xme_hal_sync_init(), XME_STATUS_INTERNAL_ERROR, XME_LOG_FATAL, MODULE_ACRONYM "Initialization of XME sync Module failed!\n"); /* Init tls */ XME_CHECK_MSG(XME_STATUS_SUCCESS == xme_hal_tls_init(), XME_STATUS_INTERNAL_ERROR, XME_LOG_FATAL, MODULE_ACRONYM "Initialization of XME tls Module failed!\n"); /* Init sched */ XME_CHECK_MSG(XME_STATUS_SUCCESS == xme_hal_context_init(), XME_STATUS_INTERNAL_ERROR, XME_LOG_FATAL, MODULE_ACRONYM "Initialization of XME context Module failed!\n"); /* Init sched */ XME_CHECK_MSG(XME_STATUS_SUCCESS == xme_hal_sched_init(), XME_STATUS_INTERNAL_ERROR, XME_LOG_FATAL, MODULE_ACRONYM "Initialization of XME sched Module failed!\n"); brokerParams.componentId = (xme_core_component_t)BROKER_ID; XME_CHECK_MSG(XME_STATUS_SUCCESS == xme_core_broker_init(&brokerParams), XME_STATUS_INTERNAL_ERROR, XME_LOG_FATAL, MODULE_ACRONYM "Initialization of Broker failed!\n"); XME_CHECK_MSG(XME_STATUS_SUCCESS == xme_core_dataHandler_init(DATAHANDLERMEMORY), XME_STATUS_INTERNAL_ERROR, XME_LOG_FATAL, MODULE_ACRONYM "Initialization of DataHandler failed!\n"); XME_CHECK_MSG(XME_STATUS_SUCCESS == xme_core_exec_init(NULL), XME_STATUS_INTERNAL_ERROR, XME_LOG_FATAL, MODULE_ACRONYM "Initialization of RTE failed!\n"); XME_HAL_SINGLYLINKEDLIST_INIT(modeList); schedule = (xme_core_exec_schedule_handle_t*) xme_hal_mem_alloc(sizeof(xme_core_exec_schedule_handle_t)); *schedule = (xme_core_exec_schedule_handle_t)LS_NORMAL_OPERATION; XME_HAL_SINGLYLINKEDLIST_ADD_ITEM(modeList, schedule); schedule = (xme_core_exec_schedule_handle_t*)xme_hal_mem_alloc(sizeof(xme_core_exec_schedule_handle_t)); *schedule = (xme_core_exec_schedule_handle_t)LS_NORMAL_OPERATION_INITIALIZE; XME_HAL_SINGLYLINKEDLIST_ADD_ITEM(modeList, schedule); schedule = (xme_core_exec_schedule_handle_t*)xme_hal_mem_alloc(sizeof(xme_core_exec_schedule_handle_t)); *schedule = (xme_core_exec_schedule_handle_t)LS_OFF_OR_SLEEPING; XME_HAL_SINGLYLINKEDLIST_ADD_ITEM(modeList, schedule); /* Instantiate components */ createHelperInstance((xme_core_component_t)1, (xme_core_component_functionId_t)1, 5000000); createHelperInstance((xme_core_component_t)2, (xme_core_component_functionId_t)1, 6000000); createHelperInstance((xme_core_component_t)3, (xme_core_component_functionId_t)1, 4000000); createHelperInstance((xme_core_component_t)4, (xme_core_component_functionId_t)1, 1000000); createHelperInstance((xme_core_component_t)5, (xme_core_component_functionId_t)1, 2000000); /* Create up a schedule set */ { xme_core_exec_schedule_table_t* table=NULL; int i; for(i=0; i<LS_MAX; i++) { xme_core_exec_scheduler_createScheduleTable(&table, xme_hal_time_timeIntervalFromMicroseconds(5000)); xme_core_exec_scheduler_registerSchedule(table, &(schedules[i])); } } return XME_STATUS_SUCCESS; }