1 
2 
3 #define THRFLAG_NOT_ACTIVE 0
4 #define THRFLAG_INIT 1
5 #define THRFLAG_ACTIVE 2
6 #define THRFLAG_IDLE 4
7 #define THRFLAG_RESET 5
8 #define THRFLAG_SEM_WAIT 7
9 #define THRFLAG_AWAIT_INPUT 10
10 #define THRFLAG_SEMCLEAR 11
11 #define THRFLAG_RETURNED 12
12 #define THRFLAG_INPUT_WAIT 13
13 
14 #define THRFLAG_PORTAUDIO_STARTSTOP 100
15 #define THRFLAG_OPEN_RX_SNDIN 101
16 #define THRFLAG_CLOSE_RX_SNDIN 102
17 #define THRFLAG_OPEN_RX_SNDOUT 103
18 #define THRFLAG_CLOSE_RX_SNDOUT 104
19 #define THRFLAG_OPEN_TX_SNDIN 105
20 #define THRFLAG_CLOSE_TX_SNDIN 106
21 #define THRFLAG_OPEN_TX_SNDOUT 107
22 #define THRFLAG_CLOSE_TX_SNDOUT 108
23 #define THRFLAG_SET_RX_IO 109
24 #define THRFLAG_TX_SETUP 110
25 #define THRFLAG_PORTAUDIO_STOP 111
26 #define THRFLAG_SET_SDRIP_ATT 112
27 #define THRFLAG_SET_SDRIP_FREQUENCY 113
28 #define THRFLAG_CALIBRATE_BLADERF_RX 114
29 #define THRFLAG_SET_NETAFEDRI_ATT 115
30 #define THRFLAG_SET_NETAFEDRI_FREQUENCY 116
31 #define THRFLAG_KILL -1
32 
33 #define THREAD_RX_ADINPUT 0
34 #define THREAD_RX_RAW_NETINPUT 1
35 #define THREAD_RX_FFT1_NETINPUT 2
36 #define THREAD_RX_FILE_INPUT 3
37 #define THREAD_SDR14_INPUT 4
38 #define THREAD_RX_OUTPUT 5
39 #define THREAD_SCREEN 6
40 #define THREAD_TX_INPUT 7
41 #define THREAD_TX_OUTPUT 8
42 #define THREAD_WIDEBAND_DSP 9
43 #define THREAD_NARROWBAND_DSP 10
44 #define THREAD_USER_COMMAND 11
45 #define THREAD_TXTEST 12
46 #define THREAD_POWTIM 13
47 #define THREAD_RX_ADTEST 14
48 #define THREAD_CAL_IQBALANCE 15
49 #define THREAD_CAL_INTERVAL 16
50 #define THREAD_CAL_FILTERCORR 17
51 #define THREAD_TUNE 18
52 #define THREAD_LIR_SERVER 19
53 #define THREAD_PERSEUS_INPUT 20
54 #define THREAD_RADAR 21
55 #define THREAD_SECOND_FFT 22
56 #define THREAD_TIMF2 23
57 #define THREAD_BLOCKING_RXOUT 24
58 #define THREAD_SYSCALL 25
59 #define THREAD_SDRIP_INPUT 26
60 #define THREAD_EXCALIBUR_INPUT 27
61 #define THREAD_HWARE_COMMAND 28
62 #define THREAD_EXTIO_INPUT 29
63 #define THREAD_WRITE_RAW_FILE 30
64 #define THREAD_RTL2832_INPUT 31
65 #define THREAD_RTL_STARTER 32
66 #define THREAD_MIRISDR_INPUT 33
67 #define THREAD_BLADERF_INPUT 34
68 #define THREAD_PCIE9842_INPUT 35
69 #define THREAD_OPENHPSDR_INPUT 36
70 #define THREAD_MIRISDR_STARTER 37
71 #define THREAD_BLADERF_STARTER 38
72 #define THREAD_NETAFEDRI_INPUT 39
73 #define THREAD_DO_FFT1C 40
74 #define THREAD_FFT1B1 41
75 #define THREAD_FFT1B2 42
76 #define THREAD_FFT1B3 43
77 #define THREAD_FFT1B4 44
78 #define THREAD_FFT1B5 45
79 #define THREAD_FFT1B6 46
80 #define THREAD_MAX 47
81 
82 
83 #define MAX_FFT1_THREADS (THREAD_FFT1B6-THREAD_FFT1B1+1)
84 
85 extern signed char thread_command_flag[THREAD_MAX];
86 extern signed char thread_status_flag[THREAD_MAX];
87 extern int thread_waitsem[THREAD_MAX];
88 extern char mouse_thread_flag;
89 extern float thread_workload[THREAD_MAX];
90 extern double thread_tottim1[THREAD_MAX];
91 extern double thread_cputim1[THREAD_MAX];
92 extern double thread_tottim2[THREAD_MAX];
93 extern double thread_cputim2[THREAD_MAX];
94 #if RUSAGE_OLD != TRUE
95 extern int thread_pid[THREAD_MAX];
96 #endif
97 
98 extern char *thread_names[THREAD_MAX];
99 extern int rx_input_thread;
100 extern int threads_running;
101 extern int ampinfo_reset;
102 
103 
104 #define EVENT_TIMF1 0
105 #define EVENT_FFT1_READY 1
106 #define EVENT_RX_START_DA 2
107 #define EVENT_BASEB 3
108 #define EVENT_TIMF2 4
109 #define EVENT_FFT2 5
110 #define EVENT_SCREEN 6
111 #define EVENT_PERSEUS_INPUT 7
112 #define EVENT_DO_FFT1C 8
113 #define EVENT_DO_FFT1B1 9
114 #define EVENT_DO_FFT1B2 10
115 #define EVENT_DO_FFT1B3 11
116 #define EVENT_DO_FFT1B4 12
117 #define EVENT_DO_FFT1B5 13
118 #define EVENT_DO_FFT1B6 14
119 //  - - - - - - - - - - - - -
120 #define EVENT_BLOCKING_RXOUT 15
121 #define EVENT_PORTAUDIO_RXREADY 16
122 #define EVENT_WRITE_RAW_FILE 17
123 #define EVENT_SYSCALL 18
124 #define EVENT_KILL_ALL 19
125 #define EVENT_MOUSE 20
126 #define EVENT_TX_INPUT 21
127 #define EVENT_KEYBOARD 22
128 #define EVENT_EXTIO_RXREADY 23
129 #define EVENT_REFRESH_SCREEN 24
130 #define EVENT_HWARE1_RXREADY 25
131 #define EVENT_MANAGE_EXTIO 26
132 #define MAX_LIREVENT 27
133 #define EVENT_AUTOINIT_MAX EVENT_BLOCKING_RXOUT
134 
135 
136 #define MUTEX_PARPORT 0
137 #define MUTEX_FFT1SLOWSUM 1
138 #define MAX_LIRMUTEX 2
139 
140 void linrad_thread_create(int no);
141 void linrad_thread_stop_and_join(int no);
142 
143 #if RUSAGE_OLD == TRUE
144 double lir_get_thread_time(void);
145 #else
146 double lir_get_thread_time(int no);
147 #endif
148 double lir_get_cpu_time(void);
149 
150