X-Git-Url: http://sraa.de/git/?a=blobdiff_plain;f=dol%2Fsrc%2Fdol%2Fvisitor%2Fepiphany%2Ftemplate%2Fprocess_Wrapper.c;fp=dol%2Fsrc%2Fdol%2Fvisitor%2Fepiphany%2Ftemplate%2Fprocess_Wrapper.c;h=def5887b9e445a1d98a7abe7130773d058e132f1;hb=2858109405a90a4d9df149b10444678d42e41c59;hp=0000000000000000000000000000000000000000;hpb=cbc1f1265fd129d066da10e72e819d7d20f5360a;p=jump.git diff --git a/dol/src/dol/visitor/epiphany/template/process_Wrapper.c b/dol/src/dol/visitor/epiphany/template/process_Wrapper.c new file mode 100644 index 0000000..def5887 --- /dev/null +++ b/dol/src/dol/visitor/epiphany/template/process_Wrapper.c @@ -0,0 +1,65 @@ +/* @@PROCESSNAME@@_Wrapper + * ===================================================================== */ +#include +#include +#include "../esrc/@@PROCESSNAME@@.h" +#include "../shared.h" +#include "ports.h" +#include "index.h" + +shm_t shm SECTION(".shared_dram"); + +/* DOL structures + * ===================================================================== */ +struct _DOL_wptr @@PROCESSNAME@@_wptr = { + 1, /* active */ + {0,0,0,0} /* instance */ +}; + +@@PROCESSNAME@@_State @@PROCESSNAME@@_local; +DOLProcess @@PROCESSNAME@@_process = { + &@@PROCESSNAME@@_local, + &@@PROCESSNAME@@_init, + &@@PROCESSNAME@@_fire, + &@@PROCESSNAME@@_wptr, +}; + +/* Port Read/Write Functions + * ===================================================================== */ +@@PORTFUNCTIONS@@ + +/* Port Mapping + * ===================================================================== */ +#define NUM_PORTS @@NUM_PORTS@@ +port_t ports[NUM_PORTS] = { +@@PORTMAPPING@@ +}; + +port_t *get_port(void *port) +{ + for(int i = 0; i < NUM_PORTS; i++) { + if(!strncmp(ports[i].name, port, PORTNAME_MAXLEN)) { + /* found the port */ + return(&ports[i]); + } + } + return(NULL); +} + +/* eCore entry point + * ===================================================================== */ +int main(void) +{ + int index = core_id2lin(e_get_coreid()); + int state = 0; + + @@PROCESSNAME@@_process.init((struct _DOLProcess_struct*)&@@PROCESSNAME@@_process); + while(@@PROCESSNAME@@_process.wptr->active) { + shm.states[index] = ++state; + @@PROCESSNAME@@_process.fire((struct _DOLProcess_struct*)&@@PROCESSNAME@@_process); + } + + shm.states[index] = -1; + while(1); +} +