- Timestamp:
- Jul 3, 2020, 7:19:17 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
EcnlProtoTool/trunk/asp3_dcre/tecsgen/tecs/mruby/tMruby.cdl
r321 r429 1 2 1 /* 3 2 * Copyright (C) 2012 by Ubiquitous Computing and Networking Laboratory … … 38 37 39 38 import(<mruby.cdl>); 39 import(<sMruby.cdl>); 40 import(<tTLSFMalloc.cdl>); 40 41 41 42 namespace nMruby{ 42 celltype tMruby{ 43 entry sTaskBody eMrubyBody; 43 44 /*** mruby VM ***/ 45 celltype tMrubyVM{ 46 entry sMrubyVM eMrubyVM; 44 47 attr{ 45 48 [omit]char_t *mrubyFile; 46 c har_t *irep=C_EXP("&$cell_global$_irep");49 const uint8_t *irep=C_EXP("$cell_global$_irep"); 47 50 }; 48 49 /* write関数の接続先 */ 50 // [optional] call sSerialPort cSerialPort; 51 var{ 52 mrb_irep *var_irep; 53 mrb_state *mrb; 54 struct RProc *rproc; 55 }; 56 57 /* MrubyBridgePlugin の生成する VM_TECSInitializeer.eInitialize へ結合する */ 51 58 [optional] call sInitializeBridge cInit; 52 59 /* 60 * アロケータ 61 * 他と共有しないのであれば、このアロケータは排他制御される必要はない 62 */ 63 call sMalloc cMalloc; 64 53 65 FACTORY{ 54 66 write("Makefile.tecsgen", "clean_mrb_c :"); … … 61 73 write("Makefile.tecsgen", "TECS_COBJS := $(TECS_COBJS) $cell_global$_mrb.o"); 62 74 write("Makefile.tecsgen", "MRB_C := $(MRB_C) $cell_global$_mrb.c"); 63 write("$ct_global$_factory.h","extern const char_t *$cell_global$_irep;");75 write("$ct_global$_factory.h","extern const uint8_t $cell_global$_irep[];"); 64 76 }; 65 77 }; 78 79 /*** Standard Task Versoin ***/ 80 /* 81 * tMruby の eMrubyBody.main が、繰り返し起床されることは想定されていません。 82 */ 83 celltype tMrubyTaskBody{ 84 entry sTaskBody eMrubyBody; 85 call sMrubyVM cMrubyVM; 86 }; 87 composite tMruby{ 88 entry sTaskBody eMrubyBody; 89 [optional] call sInitializeBridge cInit; 90 attr{ 91 [omit]char_t *mrubyFile; 92 size_t memoryPoolSize = 1024 * 1024; /** 1MB default **/ 93 /* note: this requires enough memory */ 94 /* please pay attention to memory layout */ 95 }; 96 97 /** **/ 98 cell tMrubyVM MrubyVM{ 99 mrubyFile = composite.mrubyFile; 100 cInit => composite.cInit; 101 cMalloc = TLSFMalloc.eMalloc; 102 }; 103 cell tMrubyTaskBody MrubyTaskBody { 104 cMrubyVM = MrubyVM.eMrubyVM; 105 }; 106 cell tTLSFMalloc TLSFMalloc { 107 memoryPoolSize = composite.memoryPoolSize; 108 }; 109 composite.eMrubyBody => MrubyTaskBody.eMrubyBody; 110 }; 111 112 /*** Cyclic Task Versoin ***/ 113 /* 114 * tMrubyCyclic の eMrubyBody.main が繰り返し呼び出されることが想定されています。 115 * この実装では mrb_close は呼び出されません (終了は、突然電源が切れることを想定) 116 */ 117 celltype tMrubyCyclicTaskBody{ 118 entry sTaskBody eMrubyBody; 119 call sMrubyVM cMrubyVM; 120 var { 121 bool_t b_init; 122 }; 123 }; 124 composite tMrubyCyclic{ 125 entry sTaskBody eMrubyBody; 126 [optional] call sInitializeBridge cInit; 127 attr{ 128 [omit]char_t *mrubyFile; 129 size_t memoryPoolSize = 1024 * 1024; /** 1MB default **/ 130 /* note: this requires enough memory */ 131 /* please pay attention to memory layout */ 132 }; 133 134 /** **/ 135 cell tMrubyVM MrubyVM{ 136 mrubyFile = composite.mrubyFile; 137 cInit => composite.cInit; 138 cMalloc = TLSFMalloc.eMalloc; 139 }; 140 cell tMrubyCyclicTaskBody MrubyTaskBody { 141 cMrubyVM = MrubyVM.eMrubyVM; 142 }; 143 cell tTLSFMalloc TLSFMalloc { 144 memoryPoolSize = composite.memoryPoolSize; 145 }; 146 composite.eMrubyBody => MrubyTaskBody.eMrubyBody; 147 }; 66 148 };
Note:
See TracChangeset
for help on using the changeset viewer.