diff options
Diffstat (limited to 'examples/org.eclipse.etrice.generator.c.reference/src-gen-ts/cGenRef/Node1.c')
-rw-r--r-- | examples/org.eclipse.etrice.generator.c.reference/src-gen-ts/cGenRef/Node1.c | 340 |
1 files changed, 170 insertions, 170 deletions
diff --git a/examples/org.eclipse.etrice.generator.c.reference/src-gen-ts/cGenRef/Node1.c b/examples/org.eclipse.etrice.generator.c.reference/src-gen-ts/cGenRef/Node1.c index 9d13e2242..4d51fbaa2 100644 --- a/examples/org.eclipse.etrice.generator.c.reference/src-gen-ts/cGenRef/Node1.c +++ b/examples/org.eclipse.etrice.generator.c.reference/src-gen-ts/cGenRef/Node1.c @@ -1,170 +1,170 @@ -/**
- * @author generated by eTrice
- *
- * Source File of SubSystemClass SubSys
- *
- */
-
-#include "Node1.h"
-
-/* include instances for all classes */
-#include "node1_sys1_Inst.h"
-#include "node1_sys1_Disp.h"
-
-#include "debugging/etLogger.h"
-#include "debugging/etMSCLogger.h"
-
-#include "platform/etTimer.h"
-#include "etRuntimeConfig.h"
-#include "messaging/etMessageService.h"
-
-/* data for Node1 */
-typedef struct Node1 {
- char *name;
- volatile int shutdownRequest;
-} Node1;
-
-static Node1 Node1Inst = {"Node1",0};
-
-void node1_sys1_initActorInstances(void);
-void node1_sys1_constructActorInstances(void);
-
-
-void node1_sys1_initMessageServices(void){
- ET_MSC_LOGGER_SYNC_ENTRY("Node1", "initMessageServices")
-
- /* filling all message service threads with data */
- /*PhysicalThread1*/
- // TODO: gen
- msgService_PhysicalThread1.thread.stacksize = 1024;
- msgService_PhysicalThread1.thread.priority = 0;
- msgService_PhysicalThread1.thread.threadName = "PhysicalThread1";
- msgService_PhysicalThread1.thread.threadFunction = (etThreadFunction) etMessageService_execute;
- msgService_PhysicalThread1.thread.threadFunctionData = &msgService_PhysicalThread1;
-
-
- /*PhysicalThread2*/
- // TODO: gen
- msgService_PhysicalThread2.thread.stacksize = 1024;
- msgService_PhysicalThread2.thread.priority = 0;
- msgService_PhysicalThread2.thread.threadName = "PhysicalThread2";
- msgService_PhysicalThread2.thread.threadFunction = (etThreadFunction) etMessageService_execute;
- msgService_PhysicalThread2.thread.threadFunctionData = &msgService_PhysicalThread2;
-
- /* initialization of all message services */
- etMessageService_init(&msgService_PhysicalThread1, msgBuffer_PhysicalThread1, MESSAGE_POOL_MAX, MESSAGE_BLOCK_SIZE, MsgDispatcher_PhysicalThread1_receiveMessage);
- etMessageService_init(&msgService_PhysicalThread2, msgBuffer_PhysicalThread2, MESSAGE_POOL_MAX, MESSAGE_BLOCK_SIZE, MsgDispatcher_PhysicalThread2_receiveMessage);
-
- ET_MSC_LOGGER_SYNC_EXIT
-}
-
-void node1_sys1_startMessageServices(void){
- ET_MSC_LOGGER_SYNC_ENTRY("Node1", "startMessageServices")
-
- etMessageService_start(&msgService_PhysicalThread1);
- etMessageService_start(&msgService_PhysicalThread2);
-
- ET_MSC_LOGGER_SYNC_EXIT
-}
-
-void node1_sys1_stopMessageServices(void){
- ET_MSC_LOGGER_SYNC_ENTRY("Node1", "stopMessageServices")
-
- etMessageService_stop(&msgService_PhysicalThread1);
- etMessageService_stop(&msgService_PhysicalThread2);
-
- ET_MSC_LOGGER_SYNC_EXIT
-}
-
-void node1_sys1_destroyMessageServices(void){
- ET_MSC_LOGGER_SYNC_ENTRY("Node1", "destroyMessageServices")
-
- etMessageService_destroy(&msgService_PhysicalThread1);
- etMessageService_destroy(&msgService_PhysicalThread2);
-
- ET_MSC_LOGGER_SYNC_EXIT
-}
-
-void node1_sys1_init(void){
- ET_MSC_LOGGER_SYNC_ENTRY("Node1", "init")
- etLogger_logInfoF("%s_init", Node1Inst.name);
-
- /* construct all actors */
- node1_sys1_constructActorInstances();
-
- node1_sys1_initMessageServices();
-
- /* init all actors */
- node1_sys1_initActorInstances();
-
- ET_MSC_LOGGER_SYNC_EXIT
-}
-
-void node1_sys1_start(void){
- ET_MSC_LOGGER_SYNC_ENTRY("Node1", "start")
- etLogger_logInfoF("%s_start", Node1Inst.name);
- node1_sys1_startMessageServices();
- ET_MSC_LOGGER_SYNC_EXIT
-}
-
-void node1_sys1_run(void){
- ET_MSC_LOGGER_SYNC_ENTRY("Node1", "run")
-
- etThread_sleep(1000);
-
-// #ifdef ET_RUNTIME_ENDLESS
-// while(!(Node1Inst.shutdownRequest)){
-// if (etTimer_executeNeeded()){
-// etMessageService_execute(&msgService_PhysicalThread1);
-// }
-// }
-// #else
-// uint32 loopCounter = 0;
-// while(!(Node1Inst.shutdownRequest)){
-// if (etTimer_executeNeeded()){
-// etMessageService_execute(&msgService_PhysicalThread1);
-// etLogger_logInfo("Execute");
-// if (loopCounter++ > ET_RUNTIME_MAXLOOP){
-// break;
-// }
-// }
-// }
-// #endif
-
- ET_MSC_LOGGER_SYNC_EXIT
-}
-
-void node1_sys1_stop(void){
- ET_MSC_LOGGER_SYNC_ENTRY("Node1", "stop")
- etLogger_logInfoF("%s_stop", Node1Inst.name);
- node1_sys1_stopMessageServices();
- ET_MSC_LOGGER_SYNC_EXIT
-}
-
-void node1_sys1_destroy(void){
- ET_MSC_LOGGER_SYNC_ENTRY("Node1", "destroy")
- etLogger_logInfoF("%s_destroy", Node1Inst.name);
- node1_sys1_destroyMessageServices();
- ET_MSC_LOGGER_SYNC_EXIT
-}
-
-void node1_sys1_shutdown(void){
- ET_MSC_LOGGER_SYNC_ENTRY("Node1", "shutdown")
- etLogger_logInfoF("%s_shutdown", Node1Inst.name);
- Node1Inst.shutdownRequest = 1;
- ET_MSC_LOGGER_SYNC_EXIT
-}
-
-
-void node1_sys1_constructActorInstances(void){
- ET_MSC_LOGGER_SYNC_ENTRY("Node1", "constructActorInstances")
- ET_MSC_LOGGER_SYNC_EXIT
-}
-
-void node1_sys1_initActorInstances(void){
- ET_MSC_LOGGER_SYNC_ENTRY("Node1", "initActorInstances")
- Sender_init(&_SubSys_Sender);
- Receiver_init(&_SubSys_Receiver);
- ET_MSC_LOGGER_SYNC_EXIT
-}
-
+/** + * @author generated by eTrice + * + * Source File of SubSystemClass SubSys + * + */ + +#include "Node1.h" + +/* include instances for all classes */ +#include "node1_sys1_Inst.h" +#include "node1_sys1_Disp.h" + +#include "debugging/etLogger.h" +#include "debugging/etMSCLogger.h" + +#include "platform/etTimer.h" +#include "etRuntimeConfig.h" +#include "messaging/etMessageService.h" + +/* data for Node1 */ +typedef struct Node1 { + char *name; + volatile int shutdownRequest; +} Node1; + +static Node1 Node1Inst = {"Node1",0}; + +void node1_sys1_initActorInstances(void); +void node1_sys1_constructActorInstances(void); + + +void node1_sys1_initMessageServices(void){ + ET_MSC_LOGGER_SYNC_ENTRY("Node1", "initMessageServices") + + /* filling all message service threads with data */ + /*PhysicalThread1*/ + // TODO: gen + msgService_PhysicalThread1.thread.stacksize = 1024; + msgService_PhysicalThread1.thread.priority = 0; + msgService_PhysicalThread1.thread.threadName = "PhysicalThread1"; + msgService_PhysicalThread1.thread.threadFunction = (etThreadFunction) etMessageService_execute; + msgService_PhysicalThread1.thread.threadFunctionData = &msgService_PhysicalThread1; + + + /*PhysicalThread2*/ + // TODO: gen + msgService_PhysicalThread2.thread.stacksize = 1024; + msgService_PhysicalThread2.thread.priority = 0; + msgService_PhysicalThread2.thread.threadName = "PhysicalThread2"; + msgService_PhysicalThread2.thread.threadFunction = (etThreadFunction) etMessageService_execute; + msgService_PhysicalThread2.thread.threadFunctionData = &msgService_PhysicalThread2; + + /* initialization of all message services */ + etMessageService_init(&msgService_PhysicalThread1, msgBuffer_PhysicalThread1, MESSAGE_POOL_MAX, MESSAGE_BLOCK_SIZE, MsgDispatcher_PhysicalThread1_receiveMessage); + etMessageService_init(&msgService_PhysicalThread2, msgBuffer_PhysicalThread2, MESSAGE_POOL_MAX, MESSAGE_BLOCK_SIZE, MsgDispatcher_PhysicalThread2_receiveMessage); + + ET_MSC_LOGGER_SYNC_EXIT +} + +void node1_sys1_startMessageServices(void){ + ET_MSC_LOGGER_SYNC_ENTRY("Node1", "startMessageServices") + + etMessageService_start(&msgService_PhysicalThread1); + etMessageService_start(&msgService_PhysicalThread2); + + ET_MSC_LOGGER_SYNC_EXIT +} + +void node1_sys1_stopMessageServices(void){ + ET_MSC_LOGGER_SYNC_ENTRY("Node1", "stopMessageServices") + + etMessageService_stop(&msgService_PhysicalThread1); + etMessageService_stop(&msgService_PhysicalThread2); + + ET_MSC_LOGGER_SYNC_EXIT +} + +void node1_sys1_destroyMessageServices(void){ + ET_MSC_LOGGER_SYNC_ENTRY("Node1", "destroyMessageServices") + + etMessageService_destroy(&msgService_PhysicalThread1); + etMessageService_destroy(&msgService_PhysicalThread2); + + ET_MSC_LOGGER_SYNC_EXIT +} + +void node1_sys1_init(void){ + ET_MSC_LOGGER_SYNC_ENTRY("Node1", "init") + etLogger_logInfoF("%s_init", Node1Inst.name); + + /* construct all actors */ + node1_sys1_constructActorInstances(); + + node1_sys1_initMessageServices(); + + /* init all actors */ + node1_sys1_initActorInstances(); + + ET_MSC_LOGGER_SYNC_EXIT +} + +void node1_sys1_start(void){ + ET_MSC_LOGGER_SYNC_ENTRY("Node1", "start") + etLogger_logInfoF("%s_start", Node1Inst.name); + node1_sys1_startMessageServices(); + ET_MSC_LOGGER_SYNC_EXIT +} + +void node1_sys1_run(void){ + ET_MSC_LOGGER_SYNC_ENTRY("Node1", "run") + + etThread_sleep(1000); + +// #ifdef ET_RUNTIME_ENDLESS +// while(!(Node1Inst.shutdownRequest)){ +// if (etTimer_executeNeeded()){ +// etMessageService_execute(&msgService_PhysicalThread1); +// } +// } +// #else +// uint32 loopCounter = 0; +// while(!(Node1Inst.shutdownRequest)){ +// if (etTimer_executeNeeded()){ +// etMessageService_execute(&msgService_PhysicalThread1); +// etLogger_logInfo("Execute"); +// if (loopCounter++ > ET_RUNTIME_MAXLOOP){ +// break; +// } +// } +// } +// #endif + + ET_MSC_LOGGER_SYNC_EXIT +} + +void node1_sys1_stop(void){ + ET_MSC_LOGGER_SYNC_ENTRY("Node1", "stop") + etLogger_logInfoF("%s_stop", Node1Inst.name); + node1_sys1_stopMessageServices(); + ET_MSC_LOGGER_SYNC_EXIT +} + +void node1_sys1_destroy(void){ + ET_MSC_LOGGER_SYNC_ENTRY("Node1", "destroy") + etLogger_logInfoF("%s_destroy", Node1Inst.name); + node1_sys1_destroyMessageServices(); + ET_MSC_LOGGER_SYNC_EXIT +} + +void node1_sys1_shutdown(void){ + ET_MSC_LOGGER_SYNC_ENTRY("Node1", "shutdown") + etLogger_logInfoF("%s_shutdown", Node1Inst.name); + Node1Inst.shutdownRequest = 1; + ET_MSC_LOGGER_SYNC_EXIT +} + + +void node1_sys1_constructActorInstances(void){ + ET_MSC_LOGGER_SYNC_ENTRY("Node1", "constructActorInstances") + ET_MSC_LOGGER_SYNC_EXIT +} + +void node1_sys1_initActorInstances(void){ + ET_MSC_LOGGER_SYNC_ENTRY("Node1", "initActorInstances") + Sender_init(&_SubSys_Sender); + Receiver_init(&_SubSys_Receiver); + ET_MSC_LOGGER_SYNC_EXIT +} + |