diff options
author | Jan Belle | 2017-09-29 15:02:37 +0000 |
---|---|---|
committer | Jan Belle | 2017-09-29 15:02:37 +0000 |
commit | 8af5bcbaef7702567916a34995c4c0731b782a81 (patch) | |
tree | 8365ef2436d78d85ca272dd6e52cafeb7cded268 /runtime/org.eclipse.etrice.modellib.c | |
parent | 0c6dd920fe0bf9c508a9621069c92a37206dd806 (diff) | |
download | org.eclipse.etrice-8af5bcbaef7702567916a34995c4c0731b782a81.tar.gz org.eclipse.etrice-8af5bcbaef7702567916a34995c4c0731b782a81.tar.xz org.eclipse.etrice-8af5bcbaef7702567916a34995c4c0731b782a81.zip |
[runtime.c] new osal for sockets
Change-Id: I76c7facd9294d93e349760f7fcc617fdfebe48a4
Diffstat (limited to 'runtime/org.eclipse.etrice.modellib.c')
6 files changed, 0 insertions, 523 deletions
diff --git a/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/test/PTestControl.c b/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/test/PTestControl.c deleted file mode 100644 index 7d5c5db58..000000000 --- a/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/test/PTestControl.c +++ /dev/null @@ -1,119 +0,0 @@ -/** - * @author generated by eTrice - * - * Source File of ProtocolClass PTestControl - * - */ - -#include "PTestControl.h" -#include "debugging/etMSCLogger.h" -#include "PTestControl_Utils.h" - - -/*--------------------- port methods */ - -void PTestControlPort_done(const PTestControlPort* self, bool data__et) { - ET_MSC_LOGGER_SYNC_ENTRY("PTestControlPort", "done") - etPort_sendMessage(self, PTestControl_OUT_done, sizeof(bool), &data__et); - ET_MSC_LOGGER_ASYNC_OUT(self->myInstName, "done", self->peerInstName) - ET_MSC_LOGGER_SYNC_EXIT -} - -void PTestControlReplPort_done_broadcast(const PTestControlReplPort* self, bool data__et) { - int i; - ET_MSC_LOGGER_SYNC_ENTRY("PTestControlReplPort", "done") - for (i=0; i<((etReplPort*)self)->size; ++i) { - etPort_sendMessage((&((etReplPort*)self)->ports[i].port), PTestControl_OUT_done, sizeof(bool), &data__et); - ET_MSC_LOGGER_ASYNC_OUT(((etReplPort*)self)->ports[i].port.myInstName, "done", ((etReplPort*)self)->ports[i].port.peerInstName) - } - ET_MSC_LOGGER_SYNC_EXIT -} - -void PTestControlReplPort_done(const PTestControlReplPort* self, int idx__et, bool data__et) { - ET_MSC_LOGGER_SYNC_ENTRY("PTestControlReplPort", "done") - if (0<=idx__et && idx__et<((etReplPort*)self)->size) { - etPort_sendMessage((&((etReplPort*)self)->ports[idx__et].port), PTestControl_OUT_done, sizeof(bool), &data__et); - ET_MSC_LOGGER_ASYNC_OUT(((etReplPort*)self)->ports[idx__et].port.myInstName, "done", ((etReplPort*)self)->ports[idx__et].port.peerInstName) - } - ET_MSC_LOGGER_SYNC_EXIT -} - -etInt32 PTestControlReplPort_getReplication(const PTestControlReplPort* self) { - return ((etReplPort*)self)->size; -} - - - -void PTestControlConjPort_start(const PTestControlConjPort* self) { - ET_MSC_LOGGER_SYNC_ENTRY("PTestControlConjPort", "start") - etPort_sendMessage(self, PTestControl_IN_start, 0, NULL); - ET_MSC_LOGGER_ASYNC_OUT(self->myInstName, "start", self->peerInstName) - ET_MSC_LOGGER_SYNC_EXIT -} - -void PTestControlConjReplPort_start_broadcast(const PTestControlConjReplPort* self) { - int i; - ET_MSC_LOGGER_SYNC_ENTRY("PTestControlConjReplPort", "start") - for (i=0; i<((etReplPort*)self)->size; ++i) { - etPort_sendMessage((&((etReplPort*)self)->ports[i].port), PTestControl_IN_start, 0, NULL); - ET_MSC_LOGGER_ASYNC_OUT(((etReplPort*)self)->ports[i].port.myInstName, "start", ((etReplPort*)self)->ports[i].port.peerInstName) - } - ET_MSC_LOGGER_SYNC_EXIT -} - -void PTestControlConjReplPort_start(const PTestControlConjReplPort* self, int idx__et) { - ET_MSC_LOGGER_SYNC_ENTRY("PTestControlConjReplPort", "start") - if (0<=idx__et && idx__et<((etReplPort*)self)->size) { - etPort_sendMessage((&((etReplPort*)self)->ports[idx__et].port), PTestControl_IN_start, 0, NULL); - ET_MSC_LOGGER_ASYNC_OUT(((etReplPort*)self)->ports[idx__et].port.myInstName, "start", ((etReplPort*)self)->ports[idx__et].port.peerInstName) - } - ET_MSC_LOGGER_SYNC_EXIT -} - - -void PTestControlConjPort_abort(const PTestControlConjPort* self) { - ET_MSC_LOGGER_SYNC_ENTRY("PTestControlConjPort", "abort") - etPort_sendMessage(self, PTestControl_IN_abort, 0, NULL); - ET_MSC_LOGGER_ASYNC_OUT(self->myInstName, "abort", self->peerInstName) - ET_MSC_LOGGER_SYNC_EXIT -} - -void PTestControlConjReplPort_abort_broadcast(const PTestControlConjReplPort* self) { - int i; - ET_MSC_LOGGER_SYNC_ENTRY("PTestControlConjReplPort", "abort") - for (i=0; i<((etReplPort*)self)->size; ++i) { - etPort_sendMessage((&((etReplPort*)self)->ports[i].port), PTestControl_IN_abort, 0, NULL); - ET_MSC_LOGGER_ASYNC_OUT(((etReplPort*)self)->ports[i].port.myInstName, "abort", ((etReplPort*)self)->ports[i].port.peerInstName) - } - ET_MSC_LOGGER_SYNC_EXIT -} - -void PTestControlConjReplPort_abort(const PTestControlConjReplPort* self, int idx__et) { - ET_MSC_LOGGER_SYNC_ENTRY("PTestControlConjReplPort", "abort") - if (0<=idx__et && idx__et<((etReplPort*)self)->size) { - etPort_sendMessage((&((etReplPort*)self)->ports[idx__et].port), PTestControl_IN_abort, 0, NULL); - ET_MSC_LOGGER_ASYNC_OUT(((etReplPort*)self)->ports[idx__et].port.myInstName, "abort", ((etReplPort*)self)->ports[idx__et].port.peerInstName) - } - ET_MSC_LOGGER_SYNC_EXIT -} - -etInt32 PTestControlConjReplPort_getReplication(const PTestControlConjReplPort* self) { - return ((etReplPort*)self)->size; -} - - - -/*--------------------- debug helpers */ - -/* message names as strings for debugging (generate MSC) */ -static const char* const PTestControl_messageStrings[] = {"MIN", "done","start", "abort", "MAX"}; - -const char* PTestControl_getMessageString(int msg_id) { - if (msg_id<PTestControl_MSG_MIN || msg_id>PTestControl_MSG_MAX+1){ - /* id out of range */ - return "Message ID out of range"; - } - else{ - return PTestControl_messageStrings[msg_id]; - } -} diff --git a/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/test/PTestControl.h b/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/test/PTestControl.h deleted file mode 100644 index 380b03803..000000000 --- a/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/test/PTestControl.h +++ /dev/null @@ -1,58 +0,0 @@ -/** - * @author generated by eTrice - * - * Header File of ProtocolClass PTestControl - * - */ - -#ifndef _ROOM_BASIC_TEST_PTESTCONTROL_H_ -#define _ROOM_BASIC_TEST_PTESTCONTROL_H_ - -#include "etDatatypes.h" -#include "modelbase/etPort.h" - - - - -/* message IDs */ -enum PTestControl_msg_ids { - PTestControl_MSG_MIN = 0, - PTestControl_OUT_done = 1, - PTestControl_IN_start = 2, - PTestControl_IN_abort = 3, - PTestControl_MSG_MAX = 4 -}; - -/*--------------------- port structs and methods */ -typedef etPort PTestControlPort; -typedef etReplPort PTestControlReplPort; - - -void PTestControlPort_done(const PTestControlPort* self, bool data); -void PTestControlReplPort_done_broadcast(const PTestControlReplPort* self, bool data); -void PTestControlReplPort_done(const PTestControlReplPort* self, int idx, bool data); - - -etInt32 PTestControlReplPort_getReplication(const PTestControlReplPort* self); -typedef etPort PTestControlConjPort; -typedef etReplPort PTestControlConjReplPort; - - -void PTestControlConjPort_start(const PTestControlConjPort* self); -void PTestControlConjReplPort_start_broadcast(const PTestControlConjReplPort* self); -void PTestControlConjReplPort_start(const PTestControlConjReplPort* self, int idx); -void PTestControlConjPort_abort(const PTestControlConjPort* self); -void PTestControlConjReplPort_abort_broadcast(const PTestControlConjReplPort* self); -void PTestControlConjReplPort_abort(const PTestControlConjReplPort* self, int idx); - - -etInt32 PTestControlConjReplPort_getReplication(const PTestControlConjReplPort* self); - -/*--------------------- debug helpers */ - -/* get message string for message id */ -const char* PTestControl_getMessageString(int msg_id); - - -#endif /* _ROOM_BASIC_TEST_PTESTCONTROL_H_ */ - diff --git a/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/test/PTestControl_Utils.h b/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/test/PTestControl_Utils.h deleted file mode 100644 index 1528e06f5..000000000 --- a/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/test/PTestControl_Utils.h +++ /dev/null @@ -1,19 +0,0 @@ -/** - * @author generated by eTrice - * - * Utils File of ProtocolClass PTestControl - * - */ - -#ifndef _ROOM_BASIC_TEST_PTESTCONTROL_UTILS_H_ -#define _ROOM_BASIC_TEST_PTESTCONTROL_UTILS_H_ - -#include "room/basic/test/PTestControl.h" - -/* - * access macros for operations and attributes -*/ - - -#endif /* _ROOM_BASIC_TEST_PTESTCONTROL_UTILS_H_ */ - diff --git a/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/test/SequentialTestExecutor.c b/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/test/SequentialTestExecutor.c deleted file mode 100644 index 4f5bf3747..000000000 --- a/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/test/SequentialTestExecutor.c +++ /dev/null @@ -1,220 +0,0 @@ -/** - * @author generated by eTrice - * - * Source File of ActorClass SequentialTestExecutor - * - */ - -#include "SequentialTestExecutor.h" - -#include "modelbase/etActor.h" -#include "debugging/etLogger.h" -#include "debugging/etMSCLogger.h" -#include "etUnit/etUnit.h" -#include "base/etMemory.h" - -#include "room/basic/test/PTestControl.h" - -#include "SequentialTestExecutor_Utils.h" - -/*--------------------- begin user code ---------------------*/ -#include "etUnit/etUnit.h" -/*--------------------- end user code ---------------------*/ - -/* interface item IDs */ -enum interface_items { - IFITEM_control = 1 -}; - -/* state IDs */ -enum state_ids { - NO_STATE = 0, - STATE_TOP = 1, - STATE_execute = 2, - STATE_MAX = 3 -}; - -/* transition chains */ -enum ChainIDs { - CHAIN_TRANS_INITIAL_TO__execute = 1, - CHAIN_TRANS_tr0_FROM_execute_TO_execute_BY_donecontrol_tr0 = 2 -}; - -/* triggers */ -enum triggers { - POLLING = 0, - TRIG_control__done = IFITEM_control + EVT_SHIFT*PTestControl_OUT_done -}; - -/* state names */ -static char* stateStrings[] = {"<no state>","<top>","execute" -}; - -static void setState(SequentialTestExecutor* self, etInt16 new_state) { - self->state = new_state; - ET_MSC_LOGGER_CHANGE_STATE(self->constData->instName, stateStrings[new_state]) -} - -static etInt16 getState(SequentialTestExecutor* self) { - return self->state; -} - -/* Entry and Exit Codes */ -static void entry_execute(SequentialTestExecutor* self) { - if(next < self->constData->control.size){ - control_start(next++); - } else { - etUnit_testFinished(0); - } -} - -/* Action Codes */ - -/* State Switch Methods */ -/** - * calls exit codes while exiting from the current state to one of its - * parent states while remembering the history - * @param current__et - the current state - * @param to - the final parent state - */ -static void exitTo(SequentialTestExecutor* self, etInt16 current__et, etInt16 to) { - while (current__et!=to) { - switch (current__et) { - case STATE_execute: - self->history[STATE_TOP] = STATE_execute; - current__et = STATE_TOP; - break; - default: - /* should not occur */ - break; - } - } -} - -/** - * calls action, entry and exit codes along a transition chain. The generic data are cast to typed data - * matching the trigger of this chain. The ID of the final state is returned - * @param chain__et - the chain ID - * @param generic_data__et - the generic data pointer - * @return the +/- ID of the final state either with a positive sign, that indicates to execute the state's entry code, or a negative sign vice versa - */ -static etInt16 executeTransitionChain(SequentialTestExecutor* self, int chain__et, const InterfaceItemBase* ifitem, void* generic_data__et) { - switch (chain__et) { - case CHAIN_TRANS_INITIAL_TO__execute: - { - return STATE_execute; - } - case CHAIN_TRANS_tr0_FROM_execute_TO_execute_BY_donecontrol_tr0: - { - bool success = *((bool*) generic_data__et); - return STATE_execute; - } - default: - /* should not occur */ - break; - } - return NO_STATE; -} - -/** - * calls entry codes while entering a state's history. The ID of the final leaf state is returned - * @param state__et - the state which is entered - * @return - the ID of the final leaf state - */ -static etInt16 enterHistory(SequentialTestExecutor* self, etInt16 state__et) { - etBool skip_entry__et = ET_FALSE; - if (state__et >= STATE_MAX) { - state__et = (etInt16) (state__et - STATE_MAX); - skip_entry__et = ET_TRUE; - } - while (ET_TRUE) { - switch (state__et) { - case STATE_execute: - if (!(skip_entry__et)) entry_execute(self); - /* in leaf state: return state id */ - return STATE_execute; - case STATE_TOP: - state__et = self->history[STATE_TOP]; - break; - default: - /* should not occur */ - break; - } - skip_entry__et = ET_FALSE; - } - /* return NO_STATE; // required by CDT but detected as unreachable by JDT because of while (true) */ -} - -static void SequentialTestExecutor_executeInitTransition(SequentialTestExecutor* self) { - int chain__et = CHAIN_TRANS_INITIAL_TO__execute; - etInt16 next__et = executeTransitionChain(self, chain__et, NULL, NULL); - next__et = enterHistory(self, next__et); - setState(self, next__et); -} - -/* receiveEvent contains the main implementation of the FSM */ -static void SequentialTestExecutor_receiveEventInternal(SequentialTestExecutor* self, InterfaceItemBase* ifitem, int localId, int evt, void* generic_data__et) { - int trigger__et = localId + EVT_SHIFT*evt; - int chain__et = NOT_CAUGHT; - etInt16 catching_state__et = NO_STATE; - ((void)trigger__et); /* avoids unused warning */ - - if (!handleSystemEvent(ifitem, evt, generic_data__et)) { - switch (getState(self)) { - case STATE_execute: - switch(trigger__et) { - case TRIG_control__done: - { - chain__et = CHAIN_TRANS_tr0_FROM_execute_TO_execute_BY_donecontrol_tr0; - catching_state__et = STATE_TOP; - } - break; - default: - /* should not occur */ - break; - } - break; - default: - /* should not occur */ - break; - } - } - if (chain__et != NOT_CAUGHT) { - exitTo(self, getState(self), catching_state__et); - { - etInt16 next__et = executeTransitionChain(self, chain__et, ifitem, generic_data__et); - next__et = enterHistory(self, next__et); - setState(self, next__et); - } - } -} -static void SequentialTestExecutor_receiveEvent(SequentialTestExecutor* self, InterfaceItemBase* ifitem, int evt, void* generic_data__et) { - int localId = (ifitem==NULL)? 0 : ifitem->localId; - SequentialTestExecutor_receiveEventInternal(self, ifitem, localId, evt, generic_data__et); -} - -void SequentialTestExecutor_init(SequentialTestExecutor* self){ - ET_MSC_LOGGER_SYNC_ENTRY("SequentialTestExecutor", "init") - self->state = STATE_TOP; - { - int i; - for (i=0; i<SEQUENTIALTESTEXECUTOR_HISTORY_SIZE; ++i) - self->history[i] = NO_STATE; - } - SequentialTestExecutor_executeInitTransition(self); - ET_MSC_LOGGER_SYNC_EXIT -} - - -void SequentialTestExecutor_receiveMessage(void* self, const void* ifitem, const etMessage* msg){ - ET_MSC_LOGGER_SYNC_ENTRY("SequentialTestExecutor", "_receiveMessage") - SequentialTestExecutor_receiveEvent(self, (etPort*)ifitem, msg->evtID, (void*)(((char*)msg)+MEM_CEIL(sizeof(etMessage)))); - - ET_MSC_LOGGER_SYNC_EXIT -} - - -/*--------------------- user constructor/destructor ---------------------*/ - -/*--------------------- operations ---------------------*/ - diff --git a/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/test/SequentialTestExecutor.h b/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/test/SequentialTestExecutor.h deleted file mode 100644 index 597d0a43e..000000000 --- a/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/test/SequentialTestExecutor.h +++ /dev/null @@ -1,65 +0,0 @@ -/** - * @author generated by eTrice - * - * Header File of ActorClass SequentialTestExecutor - * - */ - -#ifndef _ROOM_BASIC_TEST_SEQUENTIALTESTEXECUTOR_H_ -#define _ROOM_BASIC_TEST_SEQUENTIALTESTEXECUTOR_H_ - -#include "etDatatypes.h" -#include "messaging/etMessage.h" - -#include "room/basic/test/PTestControl.h" - - -typedef struct SequentialTestExecutor SequentialTestExecutor; - -/* const part of ActorClass (ROM) */ -typedef struct SequentialTestExecutor_const { - const char* instName; - - /* simple ports */ - - /* data receive ports */ - - /* saps */ - - /* replicated ports */ - const etReplPort control; - - /* services */ -} SequentialTestExecutor_const; - - -/* constant for state machine data */ -#define SEQUENTIALTESTEXECUTOR_HISTORY_SIZE 2 - -/* variable part of ActorClass (RAM) */ -struct SequentialTestExecutor { - const SequentialTestExecutor_const* const constData; - - /* data send ports */ - - /*--------------------- attributes ---------------------*/ - int16 next; - - - /* state machine variables */ - etInt16 state; - etInt16 history[SEQUENTIALTESTEXECUTOR_HISTORY_SIZE]; -}; - -void SequentialTestExecutor_init(SequentialTestExecutor* self); - -void SequentialTestExecutor_receiveMessage(void* self, const void* ifitem, const etMessage* msg); - - -/*--------------------- user constructor/destructor ---------------------*/ - -/*--------------------- operations ---------------------*/ - - -#endif /* _ROOM_BASIC_TEST_SEQUENTIALTESTEXECUTOR_H_ */ - diff --git a/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/test/SequentialTestExecutor_Utils.h b/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/test/SequentialTestExecutor_Utils.h deleted file mode 100644 index 65c142abb..000000000 --- a/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/test/SequentialTestExecutor_Utils.h +++ /dev/null @@ -1,42 +0,0 @@ -/** - * @author generated by eTrice - * - * Utils File of ActorClass SequentialTestExecutor - * - */ - -#ifndef _ROOM_BASIC_TEST_SEQUENTIALTESTEXECUTOR_UTILS_H_ -#define _ROOM_BASIC_TEST_SEQUENTIALTESTEXECUTOR_UTILS_H_ - -#include "room/basic/test/SequentialTestExecutor.h" - -/* - * access macros for ports, operations and attributes -*/ - -/* simple event ports */ - -/* data receive ports */ - -/* data send ports */ - -/* saps */ - -/* replicated event ports */ -#define ifitem_index (((etReplSubPort*)ifitem)->index) -#define control_start_broadcast() PTestControlConjReplPort_start_broadcast(&self->constData->control) -#define control_start(idx) PTestControlConjReplPort_start(&self->constData->control, idx) -#define control_abort_broadcast() PTestControlConjReplPort_abort_broadcast(&self->constData->control) -#define control_abort(idx) PTestControlConjReplPort_abort(&self->constData->control, idx) - -/* services */ - -/* operations */ - -/* attributes */ -#define next (self->next) - -/* port operations */ - -#endif /* _ROOM_BASIC_TEST_SEQUENTIALTESTEXECUTOR_UTILS_H_ */ - |