1 #ifndef __RTEMS_PROCESS_WRAPPER_H__
2 #define __RTEMS_PROCESS_WRAPPER_H__
11 #ifdef MPARM_SCRATCHPAD_QUEUE
12 #include "scratch_queue.h"
16 #define printf(format ...) { char stringBuffer[80]; sprintf(stringBuffer, format); SHOW_DEBUG(stringBuffer); }
19 typedef struct _process_wrapper {
20 DOLProcess *dol_process;
25 #ifdef WORKLOAD_EXTRACT
29 #ifdef MPARM_SCRATCHPAD_QUEUE
32 SCRATCH_QUEUE_PRODUCER** out_queue_id;
33 SCRATCH_QUEUE_CONSUMER** in_queue_id;
34 int number_of_in_ports;
35 int number_of_out_ports;
41 } RtemsProcessWrapper;
43 // define queue memory in consumer scratchpad
44 //#define QUEUE_IN_CONSUMER
47 * Gets an index of a string, where the index must be separated by
48 * a character specified in tokens.
49 * Returns -1, when an error occurs.
52 * getIndex("name_1_2", "_", 0) will return 1.
53 * getIndex("name_1_2", "_", 1) will return 2.
55 * @param string string to parse
56 * @param tokens delimiter of indices
57 * @param indexNumber position of index (starting at 0)
59 int getIndex(const char* string, char* tokens, int indexNumber);
62 * Create the port name of an iterated port based on its basename and the
65 * @param port buffer where the result is stored (created using
67 * @param base basename of the port
68 * @param number_of_indices number of dimensions of the port
69 * @param index_range_pairs index and range values for each dimension
71 int *createPort(int *port, int base, int number_of_indices, int index_range_pairs, ...);
74 #define GETINDEX(dimension) \
75 ((RtemsProcessWrapper*)(p->wptr))->index[dimension]
77 #define CREATEPORTVAR(name) \
80 #define CREATEPORT(port, base, number_of_indices, index_range_pairs...) \
81 createPort(&port, base, number_of_indices, index_range_pairs)
83 #ifdef PERFORMANCE_EXTRACT
84 #include "Performance_Extraction.h"
88 extern unsigned int active_processes;
89 inline void Cleanup() {
90 register rtems_interrupt_level level;
91 rtems_interrupt_disable(level);
94 if(active_processes==0) {
95 #ifdef PERFORMANCE_EXTRACT
96 performance_extraction.write_to_xml_file("calibration");
98 printf("All processes detached.");
99 rtems_interrupt_enable(level);
102 rtems_interrupt_enable(level);