5 #include "ProcessWrapper.h"
\r
7 #include "WindowedFifo.h"
\r
10 typedef struct _process_data {
\r
12 ProcessWrapper *wrapper;
\r
16 #define DOL_read(port, buf, size, process) \
\r
17 PT_WAIT_UNTIL((pt*)(p->wptr), read(port, buf, size, process) == size);
\r
19 #define DOL_write(port, buf, size, process) \
\r
20 PT_WAIT_UNTIL((pt*)(p->wptr), write(port, buf, size, process) == size);
\r
22 #define DOL_reserve(port, buf, size, process) \
\r
23 PT_WAIT_UNTIL((pt*)(p->wptr), reserve(port, (void**)buf, size, process) == size);
\r
25 #define DOL_release(port, process) \
\r
26 release(port, process);
\r
28 #define DOL_capture(port, buf, size, process) \
\r
29 PT_WAIT_UNTIL((pt*)(p->wptr), capture(port, (void**)buf, size, process) == size);
\r
31 #define DOL_consume(port, process) \
\r
32 consume(port, process);
\r
34 void DOL_detach(DOLProcess* p);
\r
36 //macros to deal with iterated ports
\r
38 * macro to create a variable to store a port name
\r
40 * @param name name of the variable
\r
42 #define CREATEPORTVAR(name) static Fifo *name
\r
45 * Create the port name of an iterated port based on its basename and the
\r
48 * @param port buffer where the result is stored (created using
\r
50 * @param base basename of the port
\r
51 * @param number_of_indices number of dimensions of the port
\r
52 * @param index_range_pairs index and range values for each dimension
\r
55 #define CREATEPORT(port, base, number_of_indices, index_range_pairs...) \
\r
56 createPort((void**)(&port), base, number_of_indices, index_range_pairs)
\r
58 #define GETINDEX(dimension) \
\r
59 static_cast<ProcessWrapper *>((static_cast<process_data *>(p->wptr))->wrapper)->getIndex(dimension)
\r
61 void createPort(void** port, void* base, int number_of_indices, int index0, int range0);
\r
62 void createPort(void** port, void* base, int number_of_indices, int index0, int range0, int index1, int range1);
\r
63 void createPort(void** port, void* base, int number_of_indices, int index0, int range0, int index1, int range1, int index2, int range2);
\r
64 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
66 //fifo access functions
\r
67 unsigned write(void* fifo, void* buf, unsigned len, DOLProcess* p);
\r
68 unsigned read(void* fifo, void* buf, unsigned len, DOLProcess* p);
\r
70 //windowed fifo access functions
\r
71 unsigned reserve(void* fifo, void** destination, unsigned len, DOLProcess* p);
\r
72 void release(void* fifo, DOLProcess* p);
\r
73 unsigned capture(void* fifo, void** destination, unsigned len, DOLProcess* p);
\r
74 void consume(void* fifo, DOLProcess* p);
\r