2 * ===================================================================== */
5 #include "../esrc/Square.h"
10 shm_t shm SECTION(".shared_dram");
13 * ===================================================================== */
14 struct _DOL_wptr Square_wptr = {
16 {0,0,0,0} /* instance */
19 Square_State Square_local;
20 DOLProcess Square_process = {
27 /* Port Read/Write Functions
28 * ===================================================================== */
29 int size_0 (void) { return(size_shm (&shm.buf0)); }
30 int level_0(void) { return(level_shm(&shm.buf0)); }
31 int read_0 (void *buf, int len) { return(read_shm (&shm.buf0, buf, len)); }
32 int write_0(void *buf, int len) { return(write_shm(&shm.buf0, buf, len)); }
33 int size_1 (void) { return(size_shm (&shm.buf1)); }
34 int level_1(void) { return(level_shm(&shm.buf1)); }
35 int read_1 (void *buf, int len) { return(read_shm (&shm.buf1, buf, len)); }
36 int write_1(void *buf, int len) { return(write_shm(&shm.buf1, buf, len)); }
39 * ===================================================================== */
41 port_t ports[NUM_PORTS] = {
42 { "0", size_0, level_0, read_0, NULL },
43 { "1", size_1, level_1, NULL, write_1 },
46 port_t *get_port(void *port)
48 for(int i = 0; i < NUM_PORTS; i++) {
49 if(!strncmp(ports[i].name, port, PORTNAME_MAXLEN)) {
58 * ===================================================================== */
61 int index = core_id2lin(e_get_coreid());
64 Square_process.init((struct _DOLProcess_struct*)&Square_process);
65 while(Square_process.wptr->active) {
66 shm.states[index] = ++state;
67 Square_process.fire((struct _DOLProcess_struct*)&Square_process);
70 shm.states[index] = -1;