1 #include "dolSupport.h"
\r
2 #include "ProcessWrapper.h"
\r
7 unsigned write(void *port, void *buf, unsigned len, DOLProcess *process)
\r
9 Fifo *fifo = static_cast<Fifo *>(port);
\r
10 char *str = static_cast<char*>(buf);
\r
11 #ifdef INCLUDE_PROFILER
\r
12 (static_cast<ProcessWrapper *>(process->wptr))->addToProfile(
\r
15 fifo->write((void*)str, len);
\r
16 #ifdef INCLUDE_TRACE
\r
17 strcpy((static_cast<ProcessWrapper *>(process->wptr))->channel_name,
\r
27 unsigned read(void *port, void *buf, unsigned len, DOLProcess *process) {
\r
28 Fifo *fifo = static_cast<Fifo *>(port);
\r
29 char *str = static_cast<char*>(buf);
\r
30 #ifdef INCLUDE_PROFILER
\r
31 (static_cast<ProcessWrapper *>(process->wptr))->addToProfile(
\r
34 fifo->read((void*)str, len);
\r
35 #ifdef INCLUDE_TRACE
\r
36 strcpy((static_cast<ProcessWrapper *>(process->wptr))->channel_name,
\r
46 int wtest(void *port, unsigned len, DOLProcess *process) {
\r
47 Fifo *fifo = static_cast<Fifo *>(port);
\r
48 return (fifo->unused() >= len) ? 1 : 0;
\r
55 int rtest(void *port, unsigned len, DOLProcess *process) {
\r
56 Fifo *fifo = static_cast<Fifo *>(port);
\r
57 return (fifo->used() >= len) ? 1 : 0;
\r
64 unsigned reserve(void* fifo, void** destination, unsigned len, DOLProcess* p) {
\r
65 return ((WindowedFifo*)fifo)->reserve(destination, len);
\r
71 void release(void* fifo, DOLProcess* p) {
\r
72 ((WindowedFifo*)fifo)->release();
\r
78 unsigned capture(void* fifo, void** destination, unsigned len, DOLProcess* p) {
\r
79 return ((WindowedFifo*)fifo)->capture(destination, len);
\r
85 void consume(void* fifo, DOLProcess* p) {
\r
86 ((WindowedFifo*)fifo)->consume();
\r
93 void DOL_detach(DOLProcess* p) {
\r
94 static_cast<ProcessWrapper *>(p->wptr)->detach();
\r
101 void createPort(void** port,
\r
103 int number_of_indices,
\r
104 int index0, int range0) {
\r
105 *port = (void**)((void**)base)[index0];
\r
112 void createPort(void** port,
\r
114 int number_of_indices,
\r
115 int index0, int range0,
\r
116 int index1, int range1) {
\r
117 *port = (void**)((void**)base)[index0 * range1 + index1];
\r
124 void createPort(void** port,
\r
126 int number_of_indices,
\r
127 int index0, int range0,
\r
128 int index1, int range1,
\r
129 int index2, int range2) {
\r
130 *port = (void**)((void**)base)[index0 * range1 * range2
\r
131 + index1 * range2 + index2];
\r
138 void createPort(void** port,
\r
140 int number_of_indices,
\r
141 int index0, int range0,
\r
142 int index1, int range1,
\r
143 int index2, int range2,
\r
144 int index3, int range3) {
\r
145 *port = (void**)((void**)base)[index0 * range1 * range2 * range3
\r
146 + index1 * range2 * range3
\r