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