X-Git-Url: http://sraa.de/git/?a=blobdiff_plain;f=dol%2Fsrc%2Fdol%2Fvisitor%2Fprotothread%2Flib%2FdolSupport.cpp;fp=dol%2Fsrc%2Fdol%2Fvisitor%2Fprotothread%2Flib%2FdolSupport.cpp;h=0c73f6d1388975243d7f5b5a64613f842439907b;hb=8c411cf24ed0eb889191aaeafd8fa1e69081df42;hp=0000000000000000000000000000000000000000;hpb=dea7a4fb1ed110d3ce6e6d9255103d724bd66c0e;p=jump.git diff --git a/dol/src/dol/visitor/protothread/lib/dolSupport.cpp b/dol/src/dol/visitor/protothread/lib/dolSupport.cpp new file mode 100644 index 0000000..0c73f6d --- /dev/null +++ b/dol/src/dol/visitor/protothread/lib/dolSupport.cpp @@ -0,0 +1,89 @@ +#include "dolSupport.h" + +/** + * + */ +unsigned read(void* fifo, void* buf, unsigned len, DOLProcess* p) { + return ((Fifo*)fifo)->read(buf, len); +} + +/** + * + */ +unsigned write(void* fifo, void* buf, unsigned len, DOLProcess* p) { + return ((Fifo*)fifo)->write(buf, len); +} + +/** + * + */ +unsigned reserve(void* fifo, void** destination, unsigned len, DOLProcess* p) { + return ((WindowedFifo*)fifo)->reserve(destination, len); +} + +/** + * + */ +void release(void* fifo, DOLProcess* p) { + ((WindowedFifo*)fifo)->release(); +} + +/** + * + */ +unsigned capture(void* fifo, void** destination, unsigned len, DOLProcess* p) { + return ((WindowedFifo*)fifo)->capture(destination, len); +} + +/** + * + */ +void consume(void* fifo, DOLProcess* p) { + ((WindowedFifo*)fifo)->consume(); +} + +/** + * + */ +void DOL_detach(DOLProcess* p) { + static_cast((static_cast(p->wptr))->wrapper)->detach(); +} + + +void createPort(void** port, + void* base, + int number_of_indices, + int index0, int range0) { + *port = (void**)((void**)base)[index0]; +} + +void createPort(void** port, + void* base, + int number_of_indices, + int index0, int range0, + int index1, int range1) { + *port = (void**)((void**)base)[index0 * range1 + index1]; +} + +void createPort(void** port, + void* base, + int number_of_indices, + int index0, int range0, + int index1, int range1, + int index2, int range2) { + *port = (void**)((void**)base)[index0 * range1 * range2 + + index1 * range2 + index2]; +} + +void createPort(void** port, + void* base, + int number_of_indices, + int index0, int range0, + int index1, int range1, + int index2, int range2, + int index3, int range3) { + *port = (void**)((void**)base)[index0 * range1 * range2 * range3 + + index1 * range2 * range3 + + index2 * range3 + + index3]; +}