Bela
Real-time, ultra-low-latency audio and sensor processing system for BeagleBone Black
 All Classes Files Functions Variables Typedefs Macros Groups
AuxTaskNonRT.h
1 /***** AuxTaskNonRT.h *****/
2 #ifndef __AuxTaskNonRT_H_INCLUDED__
3 #define __AuxTaskNonRT_H_INCLUDED__
4 
5 #ifdef XENOMAI_SKIN_native
6 #include <rtdk.h>
7 #include <native/task.h>
8 #include <native/pipe.h>
9 #endif
10 
11 #ifdef XENOMAI_SKIN_posix
12 #include <pthread.h>
13 #endif
14 
15 #define AUX_MAX_BUFFER_SIZE 500000
16 
18  public:
19  AuxTaskNonRT(){}
20 
21  void create(const char* _name, void(*_callback)());
22  void create(const char* _name, void(*_callback)(const char* str));
23  void create(const char* _name, void(*_callback)(void* buf, int size));
24  void create(const char* _name, void(*_callback)(void* ptr), void* _pointer);
25 
26  void schedule(void* ptr, size_t size);
27  void schedule(const char* str);
28  void schedule();
29 
30  void cleanup();
31 
32  private:
33 #ifdef XENOMAI_SKIN_native
34  RT_TASK task;
35  RT_PIPE pipe;
36 #endif
37 #ifdef XENOMAI_SKIN_posix
38  pthread_t thread;
39  int pipeSocket;
40 #endif
41 
42  const char* name;
43  int pipe_fd;
44  int mode;
45  void* pointer;
46 
47  void __create();
48  void openPipe();
49 
50  void (*empty_callback)();
51  void (*str_callback)(const char* buffer);
52  void (*buf_callback)(void* buf, int size);
53  void (*ptr_callback)(void* ptr);
54 
55  void empty_loop();
56  void str_loop();
57  void buf_loop();
58  void ptr_loop();
59 
60  static void loop(void* ptr);
61 };
62 
63 #endif
Definition: AuxTaskNonRT.h:17