X-Git-Url: http://sraa.de/git/?a=blobdiff_plain;f=minidol%2Flib%2Fdol.h;fp=minidol%2Flib%2Fdol.h;h=f8424d166d3c7dc07182ce44eb07e821cb62cddd;hb=dea7a4fb1ed110d3ce6e6d9255103d724bd66c0e;hp=0000000000000000000000000000000000000000;hpb=3e30b001296fb059cb070498bbe5d8e8834cd3e3;p=jump.git diff --git a/minidol/lib/dol.h b/minidol/lib/dol.h new file mode 100644 index 0000000..f8424d1 --- /dev/null +++ b/minidol/lib/dol.h @@ -0,0 +1,66 @@ +/* DOL Block Header */ +#ifndef _DOL_H_ +#define _DOL_H_ + +/* defined by the blocks */ +typedef struct _local_states *LocalState; + +/* process functions */ +struct _DOLProcess_struct; +typedef void (*ProcessInit)(struct _DOLProcess_struct*); +typedef int (*ProcessFire)(struct _DOLProcess_struct*); + +/* WPTR definition */ +struct _DOL_wptr { + int active; + int instance[4]; +}; +typedef struct _DOL_wptr *WPTR; + +/* DOL process */ +typedef struct _DOLProcess_struct { + LocalState local; + ProcessInit init; + ProcessFire fire; + WPTR wptr; +} DOLProcess; + +/* DOL-specific functions */ +int DOL_read (void*, void*, int, DOLProcess*); +int DOL_write(void*, void*, int, DOLProcess*); +int DOL_rtest(void*, int, DOLProcess*); +int DOL_wtest(void*, int, DOLProcess*); +void DOL_detach(DOLProcess*); +#define GETINDEX(dim) DOL_get_index(dim, p) +int DOL_get_index(int, DOLProcess*); + +/* port generation */ +#define PORTNAME_MAXLEN 64 +#define CREATEPORTVAR(name) char name[PORTNAME_MAXLEN] + +#define CREATEPORT_FUNCTION(_1, _2, _3, _4, _5, \ + _6, _7, _8, _9, _10, _11, NAME, ...) NAME +#define CREATEPORT(...) CREATEPORT_FUNCTION(__VA_ARGS__, \ + CREATEPORT_4, CREATEPORT_BAD_PARAMETERS, \ + CREATEPORT_3, CREATEPORT_BAD_PARAMETERS, \ + CREATEPORT_2, CREATEPORT_BAD_PARAMETERS, \ + CREATEPORT_1, CREATEPORT_BAD_PARAMETERS, \ + CREATEPORT_BAD_PARAMETERS, CREATEPORT_BAD_PARAMETERS, \ + CREATEPORT_BAD_PARAMETERS, CREATEPORT_BAD_PARAMETERS)(__VA_ARGS__) + +#define CREATEPORT_1(port, base, ndim, i0, r0) \ + DOL_create_port(port, base, ndim, i0, r0, 0, 0, 0, 0, 0, 0) + +#define CREATEPORT_2(port, base, ndim, i0, r0, i1, r1) \ + DOL_create_port(port, base, ndim, i0, r0, i1, r1, 0, 0, 0, 0) + +#define CREATEPORT_3(port, base, ndim, i0, r0, i1, r1, i2, r2) \ + DOL_create_port(port, base, ndim, i0, r0, i1, r1, i2, r2, 0, 0) + +#define CREATEPORT_4(port, base, ndim, i0, r0, i1, r1, i2, r2, i3, r3) \ + DOL_create_port(port, base, ndim, i0, r0, i1, r1, i2, r2, i3, r3) + +char* DOL_create_port(char*, char*, int, + int, int, int, int, int, int, int, int); + +#endif /* _DOL_H_ */