7 #include "../pt/pt.h"
\r
8 #include "proc_wrapper.h"
\r
11 #include "WindowedFifo.h"
\r
14 typedef struct _process_data {
\r
16 proc_wrapper *wrapper;
\r
20 #define DOL_read(port, buf, size, process) \
\r
21 PT_WAIT_UNTIL((pt*)(p->wptr), read(port, buf, size, process) == size);
\r
23 #define DOL_write(port, buf, size, process) \
\r
24 PT_WAIT_UNTIL((pt*)(p->wptr), write(port, buf, size, process) == size);
\r
26 #define DOL_reserve(port, buf, size, process) \
\r
27 PT_WAIT_UNTIL((pt*)(p->wptr), reserve(port, (void**)buf, size, process) == size);
\r
29 //should stall only if the return size is 0!!! (but how, one has to give a return value...)
\r
31 #define DOL_release(port, process) \
\r
32 release(port, process);
\r
34 #define DOL_capture(port, buf, size, process) \
\r
35 PT_WAIT_UNTIL((pt*)(p->wptr), capture(port, (void**)buf, size, process) == size);
\r
37 //should stall only if the return size is 0!!! (but how, one has to give a return value...)
\r
39 #define DOL_consume(port, process) \
\r
40 consume(port, process);
\r
43 void DOL_detach(DOLProcess* p);
\r
45 unsigned write(void* fifo, void* buf, unsigned len, DOLProcess* p);
\r
47 unsigned read(void* fifo, void* buf, unsigned len, DOLProcess* p);
\r
49 unsigned reserve(void* fifo, void** destination, unsigned len, DOLProcess* p);
\r
51 void release(void* fifo, DOLProcess* p);
\r
53 unsigned capture(void* fifo, void** destination, unsigned len, DOLProcess* p);
\r
55 void consume(void* fifo, DOLProcess* p);
\r
58 //macros to deal with iterated ports
\r
60 * macro to create a variable to store a port name
\r
62 * @param name name of the variable
\r
64 #define CREATEPORTVAR(name) static Fifo *name
\r
67 * Create the port name of an iterated port based on its basename and the
\r
70 * @param port buffer where the result is stored (created using
\r
72 * @param base basename of the port
\r
73 * @param number_of_indices number of dimensions of the port
\r
74 * @param index_range_pairs index and range values for each dimension
\r
77 #define CREATEPORT(port, base, number_of_indices, index_range_pairs...) \
\r
78 createPort((void**)(&port), base, number_of_indices, index_range_pairs)
\r
80 #define GETINDEX(dimension) \
\r
81 static_cast<proc_wrapper *>((static_cast<process_data *>(p->wptr))->wrapper)->getIndex(dimension)
\r
83 void createPort(void** port, void* base, int number_of_indices, int index0, int range0);
\r
84 void createPort(void** port, void* base, int number_of_indices, int index0, int range0, int index1, int range1);
\r
85 void createPort(void** port, void* base, int number_of_indices, int index0, int range0, int index1, int range1, int index2, int range2);
\r
86 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);
\r