##// END OF EJS Templates
Changed UART speed from 38400 to 115200 bauds
jeandet -
r74:7053a75ef0a5 Next draft
parent child
Show More
@@ -1,446 +1,446
1 #ifndef FSW_PARAMS_H_INCLUDED
1 #ifndef FSW_PARAMS_H_INCLUDED
2 #define FSW_PARAMS_H_INCLUDED
2 #define FSW_PARAMS_H_INCLUDED
3
3
4 #include "fsw_params_processing.h"
4 #include "fsw_params_processing.h"
5 #include "fsw_params_nb_bytes.h"
5 #include "fsw_params_nb_bytes.h"
6 #include "tm_byte_positions.h"
6 #include "tm_byte_positions.h"
7 #include "ccsds_types.h"
7 #include "ccsds_types.h"
8 #include "stdint.h"
8 #include "stdint.h"
9
9
10 /*
10 /*
11 * RTEMS CONFIG
11 * RTEMS CONFIG
12 *
12 *
13 */
13 */
14 #define GRSPW_DEVICE_NAME "/dev/grspw0"
14 #define GRSPW_DEVICE_NAME "/dev/grspw0"
15
15
16 #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
16 #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
17 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
17 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
18
18
19 #define CONFIGURE_MAXIMUM_TASKS 23 // number of tasks concurrently active including INIT
19 #define CONFIGURE_MAXIMUM_TASKS 23 // number of tasks concurrently active including INIT
20 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
20 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
21 #define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE)
21 #define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE)
22 #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32
22 #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32
23 #define CONFIGURE_INIT_TASK_PRIORITY 1 // instead of 100
23 #define CONFIGURE_INIT_TASK_PRIORITY 1 // instead of 100
24 #define CONFIGURE_INIT_TASK_MODE (RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT)
24 #define CONFIGURE_INIT_TASK_MODE (RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT)
25 #define CONFIGURE_INIT_TASK_ATTRIBUTES (RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT)
25 #define CONFIGURE_INIT_TASK_ATTRIBUTES (RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT)
26 #define CONFIGURE_MAXIMUM_DRIVERS 16
26 #define CONFIGURE_MAXIMUM_DRIVERS 16
27 #define CONFIGURE_MAXIMUM_PERIODS 6 // [hous] [load] [avgv]
27 #define CONFIGURE_MAXIMUM_PERIODS 6 // [hous] [load] [avgv]
28 #define CONFIGURE_MAXIMUM_TIMERS 6 // [spiq] [link] [spacewire_reset_link]
28 #define CONFIGURE_MAXIMUM_TIMERS 6 // [spiq] [link] [spacewire_reset_link]
29 #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 5
29 #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 5
30 #ifdef PRINT_STACK_REPORT
30 #ifdef PRINT_STACK_REPORT
31 #define CONFIGURE_STACK_CHECKER_ENABLED
31 #define CONFIGURE_STACK_CHECKER_ENABLED
32 #endif
32 #endif
33
33
34
34
35 //*******
35 //*******
36 // MACROS
36 // MACROS
37 #ifdef PRINT_MESSAGES_ON_CONSOLE
37 #ifdef PRINT_MESSAGES_ON_CONSOLE
38 #define PRINTF(x) printf(x);
38 #define PRINTF(x) printf(x);
39 #define PRINTF1(x,y) printf(x,y);
39 #define PRINTF1(x,y) printf(x,y);
40 #define PRINTF2(x,y,z) printf(x,y,z);
40 #define PRINTF2(x,y,z) printf(x,y,z);
41 #else
41 #else
42 #define PRINTF(x) ;
42 #define PRINTF(x) ;
43 #define PRINTF1(x,y) ;
43 #define PRINTF1(x,y) ;
44 #define PRINTF2(x,y,z) ;
44 #define PRINTF2(x,y,z) ;
45 #endif
45 #endif
46
46
47 #ifdef BOOT_MESSAGES
47 #ifdef BOOT_MESSAGES
48 #define BOOT_PRINTF(x) printf(x);
48 #define BOOT_PRINTF(x) printf(x);
49 #define BOOT_PRINTF1(x,y) printf(x,y);
49 #define BOOT_PRINTF1(x,y) printf(x,y);
50 #define BOOT_PRINTF2(x,y,z) printf(x,y,z);
50 #define BOOT_PRINTF2(x,y,z) printf(x,y,z);
51 #else
51 #else
52 #define BOOT_PRINTF(x) ;
52 #define BOOT_PRINTF(x) ;
53 #define BOOT_PRINTF1(x,y) ;
53 #define BOOT_PRINTF1(x,y) ;
54 #define BOOT_PRINTF2(x,y,z) ;
54 #define BOOT_PRINTF2(x,y,z) ;
55 #endif
55 #endif
56
56
57 #ifdef DEBUG_MESSAGES
57 #ifdef DEBUG_MESSAGES
58 #define DEBUG_PRINTF(x) printf(x);
58 #define DEBUG_PRINTF(x) printf(x);
59 #define DEBUG_PRINTF1(x,y) printf(x,y);
59 #define DEBUG_PRINTF1(x,y) printf(x,y);
60 #define DEBUG_PRINTF2(x,y,z) printf(x,y,z);
60 #define DEBUG_PRINTF2(x,y,z) printf(x,y,z);
61 #else
61 #else
62 #define DEBUG_PRINTF(x) ;
62 #define DEBUG_PRINTF(x) ;
63 #define DEBUG_PRINTF1(x,y) ;
63 #define DEBUG_PRINTF1(x,y) ;
64 #define DEBUG_PRINTF2(x,y,z) ;
64 #define DEBUG_PRINTF2(x,y,z) ;
65 #endif
65 #endif
66
66
67 #define CONST_65536 65536 // 2^16
67 #define CONST_65536 65536 // 2^16
68 #define CONST_2048 2048 // 2^11
68 #define CONST_2048 2048 // 2^11
69 #define CONST_512 512 // 2^9
69 #define CONST_512 512 // 2^9
70 #define CONST_256 256 // 2^8
70 #define CONST_256 256 // 2^8
71 #ifndef UINT8_MAX
71 #ifndef UINT8_MAX
72 #define UINT8_MAX 255
72 #define UINT8_MAX 255
73 #endif
73 #endif
74
74
75 #define FLOAT_LSBYTE 3
75 #define FLOAT_LSBYTE 3
76 #define BITS_PER_BYTE 8
76 #define BITS_PER_BYTE 8
77 #define INIT_FLOAT 0.
77 #define INIT_FLOAT 0.
78 #define INIT_CHAR 0x00
78 #define INIT_CHAR 0x00
79 #define INIT_INT 0
79 #define INIT_INT 0
80 #define INT8_ALL_F 0xff
80 #define INT8_ALL_F 0xff
81 #define INT16_ALL_F 0xffff
81 #define INT16_ALL_F 0xffff
82 #define INT32_ALL_F 0xffffffff
82 #define INT32_ALL_F 0xffffffff
83 #define INT32_ALL_0 0x00000000
83 #define INT32_ALL_0 0x00000000
84 #define SHIFT_1_BYTE 8
84 #define SHIFT_1_BYTE 8
85 #define SHIFT_2_BYTES 16
85 #define SHIFT_2_BYTES 16
86 #define SHIFT_3_BYTES 24
86 #define SHIFT_3_BYTES 24
87 #define SHIFT_4_BYTES 32
87 #define SHIFT_4_BYTES 32
88 #define SHIFT_5_BYTES 40
88 #define SHIFT_5_BYTES 40
89 #define SHIFT_2_BITS 2
89 #define SHIFT_2_BITS 2
90 #define SHIFT_3_BITS 3
90 #define SHIFT_3_BITS 3
91 #define SHIFT_4_BITS 4
91 #define SHIFT_4_BITS 4
92 #define SHIFT_5_BITS 5
92 #define SHIFT_5_BITS 5
93 #define SHIFT_7_BITS 7
93 #define SHIFT_7_BITS 7
94 #define BYTE_0 0
94 #define BYTE_0 0
95 #define BYTE_1 1
95 #define BYTE_1 1
96 #define BYTE_2 2
96 #define BYTE_2 2
97 #define BYTE_3 3
97 #define BYTE_3 3
98 #define BYTE_4 4
98 #define BYTE_4 4
99 #define BYTE_5 5
99 #define BYTE_5 5
100 #define BYTE_6 6
100 #define BYTE_6 6
101 #define BYTE_7 7
101 #define BYTE_7 7
102 #define BYTE0_MASK 0xff00
102 #define BYTE0_MASK 0xff00
103 #define BYTE1_MASK 0x00ff
103 #define BYTE1_MASK 0x00ff
104
104
105 enum lfr_transition_type_t{
105 enum lfr_transition_type_t{
106 TRANSITION_NOT_SPECIFIC,
106 TRANSITION_NOT_SPECIFIC,
107 TRANSITION_NORM_TO_S1,
107 TRANSITION_NORM_TO_S1,
108 TRANSITION_NORM_TO_S2,
108 TRANSITION_NORM_TO_S2,
109 TRANSITION_S1_TO_NORM,
109 TRANSITION_S1_TO_NORM,
110 TRANSITION_S2_TO_NORM,
110 TRANSITION_S2_TO_NORM,
111 TRANSITION_S1_TO_S2,
111 TRANSITION_S1_TO_S2,
112 TRANSITION_S2_TO_S1
112 TRANSITION_S2_TO_S1
113 };
113 };
114
114
115 typedef struct ring_node
115 typedef struct ring_node
116 {
116 {
117 struct ring_node *previous;
117 struct ring_node *previous;
118 struct ring_node *next;
118 struct ring_node *next;
119 unsigned int sid;
119 unsigned int sid;
120 unsigned int coarseTime;
120 unsigned int coarseTime;
121 unsigned int fineTime;
121 unsigned int fineTime;
122 int buffer_address;
122 int buffer_address;
123 unsigned int status;
123 unsigned int status;
124 } ring_node;
124 } ring_node;
125
125
126 //************************
126 //************************
127 // flight software version
127 // flight software version
128 // this parameters is handled by the Qt project options
128 // this parameters is handled by the Qt project options
129
129
130 #define NB_PACKETS_PER_GROUP_OF_CWF 8 // 8 packets containing 336 blk
130 #define NB_PACKETS_PER_GROUP_OF_CWF 8 // 8 packets containing 336 blk
131 #define NB_PACKETS_PER_GROUP_OF_CWF_LIGHT 4 // 4 packets containing 672 blk
131 #define NB_PACKETS_PER_GROUP_OF_CWF_LIGHT 4 // 4 packets containing 672 blk
132 #define NB_SAMPLES_PER_SNAPSHOT 2688 // 336 * 8 = 672 * 4 = 2688
132 #define NB_SAMPLES_PER_SNAPSHOT 2688 // 336 * 8 = 672 * 4 = 2688
133 #define TIME_OFFSET 2
133 #define TIME_OFFSET 2
134 #define NB_BYTES_SWF_BLK (2 * 6)
134 #define NB_BYTES_SWF_BLK (2 * 6)
135 #define NB_WORDS_SWF_BLK 3
135 #define NB_WORDS_SWF_BLK 3
136 #define NB_BYTES_CWF3_LIGHT_BLK 6
136 #define NB_BYTES_CWF3_LIGHT_BLK 6
137 #define NB_RING_NODES_F0 3 // AT LEAST 3
137 #define NB_RING_NODES_F0 3 // AT LEAST 3
138 #define NB_RING_NODES_F1 5 // AT LEAST 3
138 #define NB_RING_NODES_F1 5 // AT LEAST 3
139 #define NB_RING_NODES_F2 5 // AT LEAST 3
139 #define NB_RING_NODES_F2 5 // AT LEAST 3
140 #define NB_RING_NODES_F3 3 // AT LEAST 3
140 #define NB_RING_NODES_F3 3 // AT LEAST 3
141
141
142 //**********
142 //**********
143 // LFR MODES
143 // LFR MODES
144 #define LFR_MODE_STANDBY 0
144 #define LFR_MODE_STANDBY 0
145 #define LFR_MODE_NORMAL 1
145 #define LFR_MODE_NORMAL 1
146 #define LFR_MODE_BURST 2
146 #define LFR_MODE_BURST 2
147 #define LFR_MODE_SBM1 3
147 #define LFR_MODE_SBM1 3
148 #define LFR_MODE_SBM2 4
148 #define LFR_MODE_SBM2 4
149
149
150 #define TDS_MODE_LFM 5
150 #define TDS_MODE_LFM 5
151 #define TDS_MODE_STANDBY 0
151 #define TDS_MODE_STANDBY 0
152 #define TDS_MODE_NORMAL 1
152 #define TDS_MODE_NORMAL 1
153 #define TDS_MODE_BURST 2
153 #define TDS_MODE_BURST 2
154 #define TDS_MODE_SBM1 3
154 #define TDS_MODE_SBM1 3
155 #define TDS_MODE_SBM2 4
155 #define TDS_MODE_SBM2 4
156
156
157 #define THR_MODE_STANDBY 0
157 #define THR_MODE_STANDBY 0
158 #define THR_MODE_NORMAL 1
158 #define THR_MODE_NORMAL 1
159 #define THR_MODE_BURST 2
159 #define THR_MODE_BURST 2
160
160
161 #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1
161 #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1
162 #define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2
162 #define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2
163 #define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4
163 #define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4
164 #define RTEMS_EVENT_MODE_NORM_S1_S2 RTEMS_EVENT_5
164 #define RTEMS_EVENT_MODE_NORM_S1_S2 RTEMS_EVENT_5
165 #define RTEMS_EVENT_NORM_BP1_F0 RTEMS_EVENT_6
165 #define RTEMS_EVENT_NORM_BP1_F0 RTEMS_EVENT_6
166 #define RTEMS_EVENT_NORM_BP2_F0 RTEMS_EVENT_7
166 #define RTEMS_EVENT_NORM_BP2_F0 RTEMS_EVENT_7
167 #define RTEMS_EVENT_NORM_ASM_F0 RTEMS_EVENT_8 // ASM only in NORM mode
167 #define RTEMS_EVENT_NORM_ASM_F0 RTEMS_EVENT_8 // ASM only in NORM mode
168 #define RTEMS_EVENT_NORM_BP1_F1 RTEMS_EVENT_9
168 #define RTEMS_EVENT_NORM_BP1_F1 RTEMS_EVENT_9
169 #define RTEMS_EVENT_NORM_BP2_F1 RTEMS_EVENT_10
169 #define RTEMS_EVENT_NORM_BP2_F1 RTEMS_EVENT_10
170 #define RTEMS_EVENT_NORM_ASM_F1 RTEMS_EVENT_11 // ASM only in NORM mode
170 #define RTEMS_EVENT_NORM_ASM_F1 RTEMS_EVENT_11 // ASM only in NORM mode
171 #define RTEMS_EVENT_NORM_BP1_F2 RTEMS_EVENT_12
171 #define RTEMS_EVENT_NORM_BP1_F2 RTEMS_EVENT_12
172 #define RTEMS_EVENT_NORM_BP2_F2 RTEMS_EVENT_13
172 #define RTEMS_EVENT_NORM_BP2_F2 RTEMS_EVENT_13
173 #define RTEMS_EVENT_NORM_ASM_F2 RTEMS_EVENT_14 // ASM only in NORM mode
173 #define RTEMS_EVENT_NORM_ASM_F2 RTEMS_EVENT_14 // ASM only in NORM mode
174 #define RTEMS_EVENT_SBM_BP1_F0 RTEMS_EVENT_15
174 #define RTEMS_EVENT_SBM_BP1_F0 RTEMS_EVENT_15
175 #define RTEMS_EVENT_SBM_BP2_F0 RTEMS_EVENT_16
175 #define RTEMS_EVENT_SBM_BP2_F0 RTEMS_EVENT_16
176 #define RTEMS_EVENT_SBM_BP1_F1 RTEMS_EVENT_17
176 #define RTEMS_EVENT_SBM_BP1_F1 RTEMS_EVENT_17
177 #define RTEMS_EVENT_SBM_BP2_F1 RTEMS_EVENT_18
177 #define RTEMS_EVENT_SBM_BP2_F1 RTEMS_EVENT_18
178 #define RTEMS_EVENT_BURST_BP1_F0 RTEMS_EVENT_19
178 #define RTEMS_EVENT_BURST_BP1_F0 RTEMS_EVENT_19
179 #define RTEMS_EVENT_BURST_BP2_F0 RTEMS_EVENT_20
179 #define RTEMS_EVENT_BURST_BP2_F0 RTEMS_EVENT_20
180 #define RTEMS_EVENT_BURST_BP1_F1 RTEMS_EVENT_21
180 #define RTEMS_EVENT_BURST_BP1_F1 RTEMS_EVENT_21
181 #define RTEMS_EVENT_BURST_BP2_F1 RTEMS_EVENT_22
181 #define RTEMS_EVENT_BURST_BP2_F1 RTEMS_EVENT_22
182 #define RTEMS_EVENT_SWF_RESYNCH RTEMS_EVENT_23
182 #define RTEMS_EVENT_SWF_RESYNCH RTEMS_EVENT_23
183 #define RTEMS_EVENT_CAL_SWEEP_WAKE RTEMS_EVENT_24
183 #define RTEMS_EVENT_CAL_SWEEP_WAKE RTEMS_EVENT_24
184
184
185 //********************************************
185 //********************************************
186 //********************************************
186 //********************************************
187 // LFR PARAMETERS: DEFAULT, MIN AND MAX VALUES
187 // LFR PARAMETERS: DEFAULT, MIN AND MAX VALUES
188
188
189 #define DEFAULT_LAST_VALID_TRANSITION_DATE 0xffffffff
189 #define DEFAULT_LAST_VALID_TRANSITION_DATE 0xffffffff
190
190
191 // COMMON
191 // COMMON
192 #define DEFAULT_SY_LFR_COMMON0 0x00
192 #define DEFAULT_SY_LFR_COMMON0 0x00
193 #define DEFAULT_SY_LFR_COMMON1 0x20 // default value bw sp0 sp1 r0 r1 r2 = 1 0 0 0 0 0
193 #define DEFAULT_SY_LFR_COMMON1 0x20 // default value bw sp0 sp1 r0 r1 r2 = 1 0 0 0 0 0
194
194
195 // NORM
195 // NORM
196 #define DFLT_SY_LFR_N_SWF_L 2048 // nb sample
196 #define DFLT_SY_LFR_N_SWF_L 2048 // nb sample
197 #define DFLT_SY_LFR_N_SWF_P 300 // sec
197 #define DFLT_SY_LFR_N_SWF_P 300 // sec
198 #define MIN_SY_LFR_N_SWF_P 22 // sec
198 #define MIN_SY_LFR_N_SWF_P 22 // sec
199 #define DFLT_SY_LFR_N_ASM_P 3600 // sec
199 #define DFLT_SY_LFR_N_ASM_P 3600 // sec
200 #define DFLT_SY_LFR_N_BP_P0 4 // sec
200 #define DFLT_SY_LFR_N_BP_P0 4 // sec
201 #define DFLT_SY_LFR_N_BP_P1 20 // sec
201 #define DFLT_SY_LFR_N_BP_P1 20 // sec
202 #define DFLT_SY_LFR_N_CWF_LONG_F3 0 // 0 => production of light continuous waveforms at f3
202 #define DFLT_SY_LFR_N_CWF_LONG_F3 0 // 0 => production of light continuous waveforms at f3
203
203
204 // BURST
204 // BURST
205 #define DEFAULT_SY_LFR_B_BP_P0 1 // sec
205 #define DEFAULT_SY_LFR_B_BP_P0 1 // sec
206 #define DEFAULT_SY_LFR_B_BP_P1 5 // sec
206 #define DEFAULT_SY_LFR_B_BP_P1 5 // sec
207
207
208 // SBM1
208 // SBM1
209 #define S1_BP_P0_SCALE 0.25
209 #define S1_BP_P0_SCALE 0.25
210 #define DEFAULT_SY_LFR_S1_BP_P0 1 // 0.25 sec
210 #define DEFAULT_SY_LFR_S1_BP_P0 1 // 0.25 sec
211 #define DEFAULT_SY_LFR_S1_BP_P1 1 // sec
211 #define DEFAULT_SY_LFR_S1_BP_P1 1 // sec
212
212
213 // SBM2
213 // SBM2
214 #define DEFAULT_SY_LFR_S2_BP_P0 1 // sec
214 #define DEFAULT_SY_LFR_S2_BP_P0 1 // sec
215 #define DEFAULT_SY_LFR_S2_BP_P1 5 // sec
215 #define DEFAULT_SY_LFR_S2_BP_P1 5 // sec
216
216
217 // STATUS WORD
217 // STATUS WORD
218 #define DEFAULT_STATUS_WORD_BYTE0 0x0d // [0000] [1] [101] mode 4 bits / SPW enabled 1 bit / state is run 3 bits
218 #define DEFAULT_STATUS_WORD_BYTE0 0x0d // [0000] [1] [101] mode 4 bits / SPW enabled 1 bit / state is run 3 bits
219
219
220 #define DEFAULT_STATUS_WORD_BYTE1 0x00
220 #define DEFAULT_STATUS_WORD_BYTE1 0x00
221 // TC_LFR_LOAD_FILTER_PAR
221 // TC_LFR_LOAD_FILTER_PAR
222 #define MIN_PAS_FILTER_MODULUS 4
222 #define MIN_PAS_FILTER_MODULUS 4
223 #define MAX_PAS_FILTER_MODULUS 8
223 #define MAX_PAS_FILTER_MODULUS 8
224 #define MIN_PAS_FILTER_TBAD 0.0
224 #define MIN_PAS_FILTER_TBAD 0.0
225 #define MAX_PAS_FILTER_TBAD 4.0
225 #define MAX_PAS_FILTER_TBAD 4.0
226 #define MIN_PAS_FILTER_OFFSET 0
226 #define MIN_PAS_FILTER_OFFSET 0
227 #define MAX_PAS_FILTER_OFFSET 7
227 #define MAX_PAS_FILTER_OFFSET 7
228 #define MIN_PAS_FILTER_SHIFT 0.0
228 #define MIN_PAS_FILTER_SHIFT 0.0
229 #define MAX_PAS_FILTER_SHIFT 1.0
229 #define MAX_PAS_FILTER_SHIFT 1.0
230 #define MIN_SY_LFR_SC_RW_DELTA_F 0
230 #define MIN_SY_LFR_SC_RW_DELTA_F 0
231 #define MIN_SY_LFR_RW_F 0
231 #define MIN_SY_LFR_RW_F 0
232 //
232 //
233 #define SY_LFR_DPU_CONNECT_TIMEOUT 100 // 100 * 10 ms = 1 s
233 #define SY_LFR_DPU_CONNECT_TIMEOUT 100 // 100 * 10 ms = 1 s
234 #define SY_LFR_DPU_CONNECT_ATTEMPT 3
234 #define SY_LFR_DPU_CONNECT_ATTEMPT 3
235 //****************************
235 //****************************
236
236
237 //*****************************
237 //*****************************
238 // APB REGISTERS BASE ADDRESSES
238 // APB REGISTERS BASE ADDRESSES
239 #define REGS_ADDR_APBUART 0x80000100
239 #define REGS_ADDR_APBUART 0x80000100
240 #define REGS_ADDR_GPTIMER 0x80000300
240 #define REGS_ADDR_GPTIMER 0x80000300
241 #define REGS_ADDR_GRSPW 0x80000500
241 #define REGS_ADDR_GRSPW 0x80000500
242 #define APB_OFFSET_GRSPW_STATUS_REGISTER 0x04
242 #define APB_OFFSET_GRSPW_STATUS_REGISTER 0x04
243 #define APB_OFFSET_GRSPW_TIME_REGISTER 0x14
243 #define APB_OFFSET_GRSPW_TIME_REGISTER 0x14
244 #define REGS_ADDR_TIME_MANAGEMENT 0x80000600
244 #define REGS_ADDR_TIME_MANAGEMENT 0x80000600
245
245
246 #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00
246 #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00
247 #define REGS_ADDR_WAVEFORM_PICKER 0x80000f54 // PDB >= 0.1.28
247 #define REGS_ADDR_WAVEFORM_PICKER 0x80000f54 // PDB >= 0.1.28
248 #define APB_OFFSET_VHDL_REV 0xb0
248 #define APB_OFFSET_VHDL_REV 0xb0
249 #define REGS_ADDR_VHDL_VERSION 0x80000ff0
249 #define REGS_ADDR_VHDL_VERSION 0x80000ff0
250
250
251 #define APBUART_CTRL_REG_MASK_TE 0x00000002
251 #define APBUART_CTRL_REG_MASK_TE 0x00000002
252 // scaler value = system_clock_frequency / ( baud_rate * 8 ) - 1
252 // scaler value = system_clock_frequency / ( baud_rate * 8 ) - 1
253 #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400
253 #define APBUART_SCALER_RELOAD_VALUE 0x0000001B // 25 MHz => about 115200
254
254
255 //**********
255 //**********
256 // IRQ LINES
256 // IRQ LINES
257 #define IRQ_GPTIMER_WATCHDOG 9
257 #define IRQ_GPTIMER_WATCHDOG 9
258 #define IRQ_SPARC_GPTIMER_WATCHDOG 0x19 // see sparcv8.pdf p.76 for interrupt levels
258 #define IRQ_SPARC_GPTIMER_WATCHDOG 0x19 // see sparcv8.pdf p.76 for interrupt levels
259 #define IRQ_WAVEFORM_PICKER 14
259 #define IRQ_WAVEFORM_PICKER 14
260 #define IRQ_SPARC_WAVEFORM_PICKER 0x1e // see sparcv8.pdf p.76 for interrupt levels
260 #define IRQ_SPARC_WAVEFORM_PICKER 0x1e // see sparcv8.pdf p.76 for interrupt levels
261 #define IRQ_SPECTRAL_MATRIX 6
261 #define IRQ_SPECTRAL_MATRIX 6
262 #define IRQ_SPARC_SPECTRAL_MATRIX 0x16 // see sparcv8.pdf p.76 for interrupt levels
262 #define IRQ_SPARC_SPECTRAL_MATRIX 0x16 // see sparcv8.pdf p.76 for interrupt levels
263
263
264 //*****
264 //*****
265 // TIME
265 // TIME
266 #define CLKDIV_WATCHDOG (10000000 - 1) // 10.0s => 10 000 000
266 #define CLKDIV_WATCHDOG (10000000 - 1) // 10.0s => 10 000 000
267 #define TIMER_WATCHDOG 1
267 #define TIMER_WATCHDOG 1
268 #define WATCHDOG_PERIOD 100 // 1s
268 #define WATCHDOG_PERIOD 100 // 1s
269 #define HK_PERIOD 100 // 100 * 10ms => 1s
269 #define HK_PERIOD 100 // 100 * 10ms => 1s
270 #define AVGV_PERIOD 6 // 6 * 10ms => 60ms (1 / 16 = 62.5ms)
270 #define AVGV_PERIOD 6 // 6 * 10ms => 60ms (1 / 16 = 62.5ms)
271 #define SY_LFR_TIME_SYN_TIMEOUT_in_ticks 200 // 200 * 10 ms = 2 s
271 #define SY_LFR_TIME_SYN_TIMEOUT_in_ticks 200 // 200 * 10 ms = 2 s
272 #define HK_SYNC_WAIT 10 // 10 * 10 ms = 100 ms
272 #define HK_SYNC_WAIT 10 // 10 * 10 ms = 100 ms
273 #define SPW_LINK_WAIT 10 // 10 * 10 ms = 100 ms
273 #define SPW_LINK_WAIT 10 // 10 * 10 ms = 100 ms
274 #define TIMECODE_TIMER_TIMEOUT 120 // 120 * 10 ms = 1.2 s
274 #define TIMECODE_TIMER_TIMEOUT 120 // 120 * 10 ms = 1.2 s
275 #define TIMECODE_TIMER_TIMEOUT_INIT 200 // 200 * 10 ms = 2.0 s
275 #define TIMECODE_TIMER_TIMEOUT_INIT 200 // 200 * 10 ms = 2.0 s
276 #define TIMECODE_MASK 0x3f // 0011 1111
276 #define TIMECODE_MASK 0x3f // 0011 1111
277
277
278 //**********
278 //**********
279 // LPP CODES
279 // LPP CODES
280 #define LFR_SUCCESSFUL 0
280 #define LFR_SUCCESSFUL 0
281 #define LFR_DEFAULT 1
281 #define LFR_DEFAULT 1
282 #define LFR_EXE_ERROR 2
282 #define LFR_EXE_ERROR 2
283
283
284 //******
284 //******
285 // RTEMS
285 // RTEMS
286 #define STACK_SIZE_MULT 2
286 #define STACK_SIZE_MULT 2
287
287
288 #define TASKID_AVGV 0
288 #define TASKID_AVGV 0
289 #define TASKID_RECV 1
289 #define TASKID_RECV 1
290 #define TASKID_ACTN 2
290 #define TASKID_ACTN 2
291 #define TASKID_SPIQ 3
291 #define TASKID_SPIQ 3
292 #define TASKID_LOAD 4
292 #define TASKID_LOAD 4
293 #define TASKID_AVF0 5
293 #define TASKID_AVF0 5
294 #define TASKID_SWBD 6
294 #define TASKID_SWBD 6
295 #define TASKID_WFRM 7
295 #define TASKID_WFRM 7
296 #define TASKID_DUMB 8
296 #define TASKID_DUMB 8
297 #define TASKID_HOUS 9
297 #define TASKID_HOUS 9
298 #define TASKID_PRC0 10
298 #define TASKID_PRC0 10
299 #define TASKID_CWF3 11
299 #define TASKID_CWF3 11
300 #define TASKID_CWF2 12
300 #define TASKID_CWF2 12
301 #define TASKID_CWF1 13
301 #define TASKID_CWF1 13
302 #define TASKID_SEND 14
302 #define TASKID_SEND 14
303 #define TASKID_LINK 15
303 #define TASKID_LINK 15
304 #define TASKID_AVF1 16
304 #define TASKID_AVF1 16
305 #define TASKID_PRC1 17
305 #define TASKID_PRC1 17
306 #define TASKID_AVF2 18
306 #define TASKID_AVF2 18
307 #define TASKID_PRC2 19
307 #define TASKID_PRC2 19
308 #define TASKID_SCRB 20
308 #define TASKID_SCRB 20
309 #define TASKID_CALI 21
309 #define TASKID_CALI 21
310
310
311 #define TASK_PRIORITY_SPIQ 5
311 #define TASK_PRIORITY_SPIQ 5
312 #define TASK_PRIORITY_LINK 20
312 #define TASK_PRIORITY_LINK 20
313 #define TASK_PRIORITY_AVGV 25
313 #define TASK_PRIORITY_AVGV 25
314 #define TASK_PRIORITY_HOUS 30
314 #define TASK_PRIORITY_HOUS 30
315 #define TASK_PRIORITY_CWF1 35 // CWF1 and CWF2 are never running together
315 #define TASK_PRIORITY_CWF1 35 // CWF1 and CWF2 are never running together
316 #define TASK_PRIORITY_CWF2 35 //
316 #define TASK_PRIORITY_CWF2 35 //
317 #define TASK_PRIORITY_SWBD 37 // SWBD has a lower priority than WFRM, this is to extract the snapshot before sending it
317 #define TASK_PRIORITY_SWBD 37 // SWBD has a lower priority than WFRM, this is to extract the snapshot before sending it
318 #define TASK_PRIORITY_WFRM 40
318 #define TASK_PRIORITY_WFRM 40
319 #define TASK_PRIORITY_CWF3 40 // there is a printf in this function, be careful with its priority wrt CWF1
319 #define TASK_PRIORITY_CWF3 40 // there is a printf in this function, be careful with its priority wrt CWF1
320 #define TASK_PRIORITY_SEND 45
320 #define TASK_PRIORITY_SEND 45
321 #define TASK_PRIORITY_RECV 50
321 #define TASK_PRIORITY_RECV 50
322 #define TASK_PRIORITY_CALI 50
322 #define TASK_PRIORITY_CALI 50
323 #define TASK_PRIORITY_ACTN 50
323 #define TASK_PRIORITY_ACTN 50
324 #define TASK_PRIORITY_AVF0 60
324 #define TASK_PRIORITY_AVF0 60
325 #define TASK_PRIORITY_AVF1 70
325 #define TASK_PRIORITY_AVF1 70
326 #define TASK_PRIORITY_PRC0 100
326 #define TASK_PRIORITY_PRC0 100
327 #define TASK_PRIORITY_PRC1 100
327 #define TASK_PRIORITY_PRC1 100
328 #define TASK_PRIORITY_AVF2 110
328 #define TASK_PRIORITY_AVF2 110
329 #define TASK_PRIORITY_PRC2 110
329 #define TASK_PRIORITY_PRC2 110
330 #define TASK_PRIORITY_LOAD 190
330 #define TASK_PRIORITY_LOAD 190
331 #define TASK_PRIORITY_DUMB 200
331 #define TASK_PRIORITY_DUMB 200
332 #define TASK_PRIORITY_SCRB 210
332 #define TASK_PRIORITY_SCRB 210
333
333
334 #define MSG_QUEUE_COUNT_RECV 10
334 #define MSG_QUEUE_COUNT_RECV 10
335 #define MSG_QUEUE_COUNT_SEND 50
335 #define MSG_QUEUE_COUNT_SEND 50
336 #define MSG_QUEUE_COUNT_PRC0 10
336 #define MSG_QUEUE_COUNT_PRC0 10
337 #define MSG_QUEUE_COUNT_PRC1 10
337 #define MSG_QUEUE_COUNT_PRC1 10
338 #define MSG_QUEUE_COUNT_PRC2 5
338 #define MSG_QUEUE_COUNT_PRC2 5
339 #define MSG_QUEUE_SIZE_SEND 812 // 808 + 4 => TM_LFR_SCIENCE_BURST_BP2_F1
339 #define MSG_QUEUE_SIZE_SEND 812 // 808 + 4 => TM_LFR_SCIENCE_BURST_BP2_F1
340 #define MSG_QUEUE_SIZE_PRC0 36 // two pointers, one rtems_event + 6 integers
340 #define MSG_QUEUE_SIZE_PRC0 36 // two pointers, one rtems_event + 6 integers
341 #define MSG_QUEUE_SIZE_PRC1 36 // two pointers, one rtems_event + 6 integers
341 #define MSG_QUEUE_SIZE_PRC1 36 // two pointers, one rtems_event + 6 integers
342 #define MSG_QUEUE_SIZE_PRC2 36 // two pointers, one rtems_event + 6 integers
342 #define MSG_QUEUE_SIZE_PRC2 36 // two pointers, one rtems_event + 6 integers
343
343
344 #define QUEUE_RECV 0
344 #define QUEUE_RECV 0
345 #define QUEUE_SEND 1
345 #define QUEUE_SEND 1
346 #define QUEUE_PRC0 2
346 #define QUEUE_PRC0 2
347 #define QUEUE_PRC1 3
347 #define QUEUE_PRC1 3
348 #define QUEUE_PRC2 4
348 #define QUEUE_PRC2 4
349
349
350 struct param_local_str{
350 struct param_local_str{
351 unsigned int local_sbm1_nb_cwf_sent;
351 unsigned int local_sbm1_nb_cwf_sent;
352 unsigned int local_sbm1_nb_cwf_max;
352 unsigned int local_sbm1_nb_cwf_max;
353 unsigned int local_sbm2_nb_cwf_sent;
353 unsigned int local_sbm2_nb_cwf_sent;
354 unsigned int local_sbm2_nb_cwf_max;
354 unsigned int local_sbm2_nb_cwf_max;
355 };
355 };
356
356
357 //************
357 //************
358 // FBINS MASKS
358 // FBINS MASKS
359
359
360 #define BYTES_PER_FBINS_MASK 16
360 #define BYTES_PER_FBINS_MASK 16
361
361
362 typedef struct {
362 typedef struct {
363 unsigned char merged_fbins_mask_f0[BYTES_PER_FBINS_MASK];
363 unsigned char merged_fbins_mask_f0[BYTES_PER_FBINS_MASK];
364 unsigned char merged_fbins_mask_f1[BYTES_PER_FBINS_MASK];
364 unsigned char merged_fbins_mask_f1[BYTES_PER_FBINS_MASK];
365 unsigned char merged_fbins_mask_f2[BYTES_PER_FBINS_MASK];
365 unsigned char merged_fbins_mask_f2[BYTES_PER_FBINS_MASK];
366 } fbins_masks_t;
366 } fbins_masks_t;
367
367
368 #define DEFAULT_SY_LFR_PAS_FILTER_ENABLED 0
368 #define DEFAULT_SY_LFR_PAS_FILTER_ENABLED 0
369 #define DEFAULT_SY_LFR_PAS_FILTER_MODULUS 4
369 #define DEFAULT_SY_LFR_PAS_FILTER_MODULUS 4
370 #define DEFAULT_SY_LFR_PAS_FILTER_TBAD 1.0f
370 #define DEFAULT_SY_LFR_PAS_FILTER_TBAD 1.0f
371 #define DEFAULT_SY_LFR_PAS_FILTER_OFFSET 0
371 #define DEFAULT_SY_LFR_PAS_FILTER_OFFSET 0
372 #define DEFAULT_SY_LFR_PAS_FILTER_SHIFT 0.5f
372 #define DEFAULT_SY_LFR_PAS_FILTER_SHIFT 0.5f
373 #define DEFAULT_MODULUS 262144 // 65536 * 4
373 #define DEFAULT_MODULUS 262144 // 65536 * 4
374 #define DEFAULT_TBAD 65536 // 65536
374 #define DEFAULT_TBAD 65536 // 65536
375 #define DEFAULT_OFFSET 0 // 65536 * 0
375 #define DEFAULT_OFFSET 0 // 65536 * 0
376 #define DEFAULT_SHIFT 32768 // 65536 / 2
376 #define DEFAULT_SHIFT 32768 // 65536 / 2
377 #define DEFAULT_SY_LFR_SC_RW_DELTA_F 0.045f
377 #define DEFAULT_SY_LFR_SC_RW_DELTA_F 0.045f
378 #define DEFAULT_SY_LFR_RW_K1 1.f
378 #define DEFAULT_SY_LFR_RW_K1 1.f
379 #define DEFAULT_SY_LFR_RW_K2 8.f
379 #define DEFAULT_SY_LFR_RW_K2 8.f
380 #define DEFAULT_SY_LFR_RW_K3 24.f
380 #define DEFAULT_SY_LFR_RW_K3 24.f
381 #define DEFAULT_SY_LFR_RW_K4 48.f
381 #define DEFAULT_SY_LFR_RW_K4 48.f
382
382
383 typedef struct{
383 typedef struct{
384 unsigned char spare_sy_lfr_pas_filter_enabled;
384 unsigned char spare_sy_lfr_pas_filter_enabled;
385 float sy_lfr_pas_filter_tbad;
385 float sy_lfr_pas_filter_tbad;
386 float sy_lfr_pas_filter_shift;
386 float sy_lfr_pas_filter_shift;
387 uint64_t modulus_in_finetime;
387 uint64_t modulus_in_finetime;
388 uint64_t tbad_in_finetime;
388 uint64_t tbad_in_finetime;
389 uint64_t offset_in_finetime;
389 uint64_t offset_in_finetime;
390 uint64_t shift_in_finetime;
390 uint64_t shift_in_finetime;
391 float sy_lfr_sc_rw_delta_f;
391 float sy_lfr_sc_rw_delta_f;
392 // rw1_k
392 // rw1_k
393 float sy_lfr_rw1_k1;
393 float sy_lfr_rw1_k1;
394 float sy_lfr_rw1_k2;
394 float sy_lfr_rw1_k2;
395 float sy_lfr_rw1_k3;
395 float sy_lfr_rw1_k3;
396 float sy_lfr_rw1_k4;
396 float sy_lfr_rw1_k4;
397 // rw2_k
397 // rw2_k
398 float sy_lfr_rw2_k1;
398 float sy_lfr_rw2_k1;
399 float sy_lfr_rw2_k2;
399 float sy_lfr_rw2_k2;
400 float sy_lfr_rw2_k3;
400 float sy_lfr_rw2_k3;
401 float sy_lfr_rw2_k4;
401 float sy_lfr_rw2_k4;
402 // rw3_k
402 // rw3_k
403 float sy_lfr_rw3_k1;
403 float sy_lfr_rw3_k1;
404 float sy_lfr_rw3_k2;
404 float sy_lfr_rw3_k2;
405 float sy_lfr_rw3_k3;
405 float sy_lfr_rw3_k3;
406 float sy_lfr_rw3_k4;
406 float sy_lfr_rw3_k4;
407 // rw4_k
407 // rw4_k
408 float sy_lfr_rw4_k1;
408 float sy_lfr_rw4_k1;
409 float sy_lfr_rw4_k2;
409 float sy_lfr_rw4_k2;
410 float sy_lfr_rw4_k3;
410 float sy_lfr_rw4_k3;
411 float sy_lfr_rw4_k4;
411 float sy_lfr_rw4_k4;
412 } filterPar_t;
412 } filterPar_t;
413
413
414 typedef struct{
414 typedef struct{
415 // rw1_f
415 // rw1_f
416 float cp_rpw_sc_rw1_f1;
416 float cp_rpw_sc_rw1_f1;
417 float cp_rpw_sc_rw1_f2;
417 float cp_rpw_sc_rw1_f2;
418 float cp_rpw_sc_rw1_f3;
418 float cp_rpw_sc_rw1_f3;
419 float cp_rpw_sc_rw1_f4;
419 float cp_rpw_sc_rw1_f4;
420 // rw2_f
420 // rw2_f
421 float cp_rpw_sc_rw2_f1;
421 float cp_rpw_sc_rw2_f1;
422 float cp_rpw_sc_rw2_f2;
422 float cp_rpw_sc_rw2_f2;
423 float cp_rpw_sc_rw2_f3;
423 float cp_rpw_sc_rw2_f3;
424 float cp_rpw_sc_rw2_f4;
424 float cp_rpw_sc_rw2_f4;
425 // rw3_f
425 // rw3_f
426 float cp_rpw_sc_rw3_f1;
426 float cp_rpw_sc_rw3_f1;
427 float cp_rpw_sc_rw3_f2;
427 float cp_rpw_sc_rw3_f2;
428 float cp_rpw_sc_rw3_f3;
428 float cp_rpw_sc_rw3_f3;
429 float cp_rpw_sc_rw3_f4;
429 float cp_rpw_sc_rw3_f4;
430 // rw4_f
430 // rw4_f
431 float cp_rpw_sc_rw4_f1;
431 float cp_rpw_sc_rw4_f1;
432 float cp_rpw_sc_rw4_f2;
432 float cp_rpw_sc_rw4_f2;
433 float cp_rpw_sc_rw4_f3;
433 float cp_rpw_sc_rw4_f3;
434 float cp_rpw_sc_rw4_f4;
434 float cp_rpw_sc_rw4_f4;
435 } rw_f_t;
435 } rw_f_t;
436
436
437 #define MATRIX_IS_POLLUTED 0
437 #define MATRIX_IS_POLLUTED 0
438 #define MATRIX_IS_NOT_POLLUTED 1
438 #define MATRIX_IS_NOT_POLLUTED 1
439 #define ACQUISITION_DURATION_F0 683 // 256 / 24576 * 65536
439 #define ACQUISITION_DURATION_F0 683 // 256 / 24576 * 65536
440 #define ACQUISITION_DURATION_F1 4096 // 256 / 4096 * 65536
440 #define ACQUISITION_DURATION_F1 4096 // 256 / 4096 * 65536
441 #define ACQUISITION_DURATION_F2 65536 // 256 / 256 * 65536
441 #define ACQUISITION_DURATION_F2 65536 // 256 / 256 * 65536
442 #define HALF_ACQUISITION_DURATION_F0 341 // 256 / 24576 * 65536 / 2
442 #define HALF_ACQUISITION_DURATION_F0 341 // 256 / 24576 * 65536 / 2
443 #define HALF_ACQUISITION_DURATION_F1 2048 // 256 / 4096 * 65536 / 2
443 #define HALF_ACQUISITION_DURATION_F1 2048 // 256 / 4096 * 65536 / 2
444 #define HALF_ACQUISITION_DURATION_F2 32768 // 256 / 256 * 65536 / 2
444 #define HALF_ACQUISITION_DURATION_F2 32768 // 256 / 256 * 65536 / 2
445
445
446 #endif // FSW_PARAMS_H_INCLUDED
446 #endif // FSW_PARAMS_H_INCLUDED
General Comments 0
You need to be logged in to leave comments. Login now