@@ -1,6 +1,6 | |||||
1 | ############################################################################# |
|
1 | ############################################################################# | |
2 | # Makefile for building: bin/fsw |
|
2 | # Makefile for building: bin/fsw | |
3 |
# Generated by qmake (2.01a) (Qt 4.8.6) on: |
|
3 | # Generated by qmake (2.01a) (Qt 4.8.6) on: Wed Sep 24 11:10:53 2014 | |
4 | # Project: fsw-qt.pro |
|
4 | # Project: fsw-qt.pro | |
5 | # Template: app |
|
5 | # Template: app | |
6 | # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro |
|
6 | # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro | |
@@ -10,7 +10,7 | |||||
10 |
|
10 | |||
11 | CC = sparc-rtems-gcc |
|
11 | CC = sparc-rtems-gcc | |
12 | CXX = sparc-rtems-g++ |
|
12 | CXX = sparc-rtems-g++ | |
13 |
DEFINES = -DSW_VERSION_N1=2 -DSW_VERSION_N2=0 -DSW_VERSION_N3=1 -DSW_VERSION_N4= |
|
13 | DEFINES = -DSW_VERSION_N1=2 -DSW_VERSION_N2=0 -DSW_VERSION_N3=1 -DSW_VERSION_N4=1 -DPRINT_MESSAGES_ON_CONSOLE | |
14 | CFLAGS = -pipe -O3 -Wall $(DEFINES) |
|
14 | CFLAGS = -pipe -O3 -Wall $(DEFINES) | |
15 | CXXFLAGS = -pipe -O3 -Wall $(DEFINES) |
|
15 | CXXFLAGS = -pipe -O3 -Wall $(DEFINES) | |
16 | INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header -I../header/processing -I../src/LFR_basic-parameters |
|
16 | INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header -I../header/processing -I../src/LFR_basic-parameters |
@@ -11,7 +11,7 SWVERSION=-1-0 | |||||
11 | DEFINES += SW_VERSION_N1=2 # major |
|
11 | DEFINES += SW_VERSION_N1=2 # major | |
12 | DEFINES += SW_VERSION_N2=0 # minor |
|
12 | DEFINES += SW_VERSION_N2=0 # minor | |
13 | DEFINES += SW_VERSION_N3=1 # patch |
|
13 | DEFINES += SW_VERSION_N3=1 # patch | |
14 |
DEFINES += SW_VERSION_N4= |
|
14 | DEFINES += SW_VERSION_N4=1 # internal | |
15 |
|
15 | |||
16 | contains( CONFIG, debug_tch ) { |
|
16 | contains( CONFIG, debug_tch ) { | |
17 | DEFINES += DEBUG_TCH |
|
17 | DEFINES += DEBUG_TCH |
@@ -1,8 +1,12 | |||||
1 | <?xml version="1.0" encoding="UTF-8"?> |
|
1 | <?xml version="1.0" encoding="UTF-8"?> | |
2 | <!DOCTYPE QtCreatorProject> |
|
2 | <!DOCTYPE QtCreatorProject> | |
3 |
<!-- Written by QtCreator 3. |
|
3 | <!-- Written by QtCreator 3.2.0, 2014-09-23T16:34:13. --> | |
4 | <qtcreator> |
|
4 | <qtcreator> | |
5 | <data> |
|
5 | <data> | |
|
6 | <variable>EnvironmentId</variable> | |||
|
7 | <value type="QByteArray">{2e58a81f-9962-4bba-ae6b-760177f0656c}</value> | |||
|
8 | </data> | |||
|
9 | <data> | |||
6 | <variable>ProjectExplorer.Project.ActiveTarget</variable> |
|
10 | <variable>ProjectExplorer.Project.ActiveTarget</variable> | |
7 | <value type="int">0</value> |
|
11 | <value type="int">0</value> | |
8 | </data> |
|
12 | </data> | |
@@ -29,9 +33,12 | |||||
29 | <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value> |
|
33 | <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value> | |
30 | <value type="int" key="EditorConfiguration.IndentSize">4</value> |
|
34 | <value type="int" key="EditorConfiguration.IndentSize">4</value> | |
31 | <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value> |
|
35 | <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value> | |
|
36 | <value type="int" key="EditorConfiguration.MarginColumn">80</value> | |||
|
37 | <value type="bool" key="EditorConfiguration.MouseHiding">true</value> | |||
32 | <value type="bool" key="EditorConfiguration.MouseNavigation">true</value> |
|
38 | <value type="bool" key="EditorConfiguration.MouseNavigation">true</value> | |
33 | <value type="int" key="EditorConfiguration.PaddingMode">1</value> |
|
39 | <value type="int" key="EditorConfiguration.PaddingMode">1</value> | |
34 | <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value> |
|
40 | <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value> | |
|
41 | <value type="bool" key="EditorConfiguration.ShowMargin">false</value> | |||
35 | <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value> |
|
42 | <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value> | |
36 | <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value> |
|
43 | <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value> | |
37 | <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value> |
|
44 | <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value> | |
@@ -191,11 +198,11 | |||||
191 | <value type="int">1</value> |
|
198 | <value type="int">1</value> | |
192 | </data> |
|
199 | </data> | |
193 | <data> |
|
200 | <data> | |
194 |
<variable>ProjectExplorer.Project.Updater. |
|
201 | <variable>ProjectExplorer.Project.Updater.FileVersion</variable> | |
195 | <value type="QByteArray">{2e58a81f-9962-4bba-ae6b-760177f0656c}</value> |
|
202 | <value type="int">16</value> | |
196 | </data> |
|
203 | </data> | |
197 | <data> |
|
204 | <data> | |
198 |
<variable> |
|
205 | <variable>Version</variable> | |
199 |
<value type="int">1 |
|
206 | <value type="int">16</value> | |
200 | </data> |
|
207 | </data> | |
201 | </qtcreator> |
|
208 | </qtcreator> |
@@ -1,6 +1,6 | |||||
1 | ############################################################################# |
|
1 | ############################################################################# | |
2 | # Makefile for building: bin/timegen |
|
2 | # Makefile for building: bin/timegen | |
3 |
# Generated by qmake (2.01a) (Qt 4.8. |
|
3 | # Generated by qmake (2.01a) (Qt 4.8.6) on: Wed Sep 24 10:50:53 2014 | |
4 | # Project: timegen.pro |
|
4 | # Project: timegen.pro | |
5 | # Template: app |
|
5 | # Template: app | |
6 | # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile timegen.pro |
|
6 | # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile timegen.pro |
@@ -6,7 +6,6 | |||||
6 |
|
6 | |||
7 | #include "fsw_params.h" |
|
7 | #include "fsw_params.h" | |
8 | #include "fsw_misc.h" |
|
8 | #include "fsw_misc.h" | |
9 | #include "fsw_processing.h" |
|
|||
10 | #include "wf_handler.h" |
|
9 | #include "wf_handler.h" | |
11 |
|
10 | |||
12 | #include "timegen_spacewire.h" |
|
11 | #include "timegen_spacewire.h" | |
@@ -14,6 +13,7 | |||||
14 |
|
13 | |||
15 | extern rtems_name Task_name[20]; /* array of task names */ |
|
14 | extern rtems_name Task_name[20]; /* array of task names */ | |
16 | extern rtems_id Task_id[20]; /* array of task ids */ |
|
15 | extern rtems_id Task_id[20]; /* array of task ids */ | |
|
16 | extern rtems_name misc_name[5]; | |||
17 |
|
17 | |||
18 | // RTEMS TASKS |
|
18 | // RTEMS TASKS | |
19 | rtems_task Init( rtems_task_argument argument); |
|
19 | rtems_task Init( rtems_task_argument argument); | |
@@ -32,8 +32,6 int start_recv_send_tasks( void ); | |||||
32 | void init_local_mode_parameters( void ); |
|
32 | void init_local_mode_parameters( void ); | |
33 | void reset_local_time( void ); |
|
33 | void reset_local_time( void ); | |
34 |
|
34 | |||
35 | extern int rtems_cpu_usage_report( void ); |
|
|||
36 | extern int rtems_cpu_usage_reset( void ); |
|
|||
37 | extern void rtems_stack_checker_report_usage( void ); |
|
35 | extern void rtems_stack_checker_report_usage( void ); | |
38 |
|
36 | |||
39 | extern int sched_yield( void ); |
|
37 | extern int sched_yield( void ); |
@@ -24,6 +24,8 unsigned int coarseTime; | |||||
24 |
|
24 | |||
25 | rtems_name rtems_name_updt; |
|
25 | rtems_name rtems_name_updt; | |
26 | rtems_id rtems_id_updt; |
|
26 | rtems_id rtems_id_updt; | |
|
27 | rtems_name rtems_name_act_; | |||
|
28 | rtems_id rtems_id_act_; | |||
27 |
|
29 | |||
28 | void timegen_timecode_irq_handler( void *pDev, void *regs, int minor, unsigned int tc ); |
|
30 | void timegen_timecode_irq_handler( void *pDev, void *regs, int minor, unsigned int tc ); | |
29 |
|
31 |
@@ -18,34 +18,12 rtems_isr commutation_isr2( rtems_vector | |||||
18 |
|
18 | |||
19 | //*********** |
|
19 | //*********** | |
20 | // RTEMS TASK |
|
20 | // RTEMS TASK | |
21 |
rtems_task act |
|
21 | rtems_task act__task( rtems_task_argument unused ); | |
22 |
|
22 | |||
23 | //*********** |
|
23 | //*********** | |
24 | // TC ACTIONS |
|
24 | // TC ACTIONS | |
25 |
int action_ |
|
25 | int timegen_action_enter_mode(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time); | |
26 |
int action_ |
|
26 | int timegen_action_update_time(ccsdsTelecommandPacket_t *TC); | |
27 | int action_update_info(ccsdsTelecommandPacket_t *TC, rtems_id queue_id); |
|
|||
28 | int action_enable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time); |
|
|||
29 | int action_disable_calibration(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time); |
|
|||
30 | int action_update_time(ccsdsTelecommandPacket_t *TC); |
|
|||
31 |
|
||||
32 | // mode transition |
|
|||
33 | int transition_validation(unsigned char requestedMode); |
|
|||
34 | int stop_current_mode( void ); |
|
|||
35 | int enter_mode(unsigned char mode); |
|
|||
36 | int restart_science_tasks(); |
|
|||
37 | int suspend_science_tasks(); |
|
|||
38 | void launch_waveform_picker( unsigned char mode ); |
|
|||
39 | void launch_spectral_matrix( unsigned char mode ); |
|
|||
40 | void set_irq_on_new_ready_matrix(unsigned char value ); |
|
|||
41 | void set_run_matrix_spectral( unsigned char value ); |
|
|||
42 | void launch_spectral_matrix_simu( unsigned char mode ); |
|
|||
43 |
|
||||
44 | // other functions |
|
|||
45 | void updateLFRCurrentMode(); |
|
|||
46 | void update_last_TC_exe(ccsdsTelecommandPacket_t *TC ); |
|
|||
47 | void update_last_TC_rej(ccsdsTelecommandPacket_t *TC ); |
|
|||
48 | void close_action(ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id ); |
|
|||
49 |
|
27 | |||
50 | extern rtems_status_code get_message_queue_id_send( rtems_id *queue_id ); |
|
28 | extern rtems_status_code get_message_queue_id_send( rtems_id *queue_id ); | |
51 | extern rtems_status_code get_message_queue_id_recv( rtems_id *queue_id ); |
|
29 | extern rtems_status_code get_message_queue_id_recv( rtems_id *queue_id ); |
@@ -155,13 +155,6 rtems_task Init( rtems_task_argument ign | |||||
155 | PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status ) |
|
155 | PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status ) | |
156 | } |
|
156 | } | |
157 |
|
157 | |||
158 | // suspend science tasks. they will be restarted later depending on the mode |
|
|||
159 | status = suspend_science_tasks(); // suspend science tasks (not done in stop_current_mode if current mode = STANDBY) |
|
|||
160 | if (status != RTEMS_SUCCESSFUL) |
|
|||
161 | { |
|
|||
162 | PRINTF1("in INIT *** in suspend_science_tasks *** ERR code: %d\n", status) |
|
|||
163 | } |
|
|||
164 |
|
||||
165 | // if the spacewire link is not up then send an event to the SPIQ task for link recovery |
|
158 | // if the spacewire link is not up then send an event to the SPIQ task for link recovery | |
166 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
159 | if ( status_spw != RTEMS_SUCCESSFUL ) | |
167 | { |
|
160 | { | |
@@ -177,31 +170,6 rtems_task Init( rtems_task_argument ign | |||||
177 |
|
170 | |||
178 | } |
|
171 | } | |
179 |
|
172 | |||
180 | void init_local_mode_parameters( void ) |
|
|||
181 | { |
|
|||
182 | /** This function initialize the param_local global variable with default values. |
|
|||
183 | * |
|
|||
184 | */ |
|
|||
185 |
|
||||
186 | unsigned int i; |
|
|||
187 |
|
||||
188 | // LOCAL PARAMETERS |
|
|||
189 | // set_local_nb_interrupt_f0_MAX(); |
|
|||
190 |
|
||||
191 | BOOT_PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max) |
|
|||
192 | BOOT_PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max) |
|
|||
193 | BOOT_PRINTF1("nb_interrupt_f0_MAX = %d\n", param_local.local_nb_interrupt_f0_MAX) |
|
|||
194 |
|
||||
195 | // init sequence counters |
|
|||
196 |
|
||||
197 | for(i = 0; i<SEQ_CNT_NB_DEST_ID; i++) |
|
|||
198 | { |
|
|||
199 | sequenceCounters_TC_EXE[i] = 0x00; |
|
|||
200 | } |
|
|||
201 | sequenceCounters_SCIENCE_NORMAL_BURST = 0x00; |
|
|||
202 | sequenceCounters_SCIENCE_SBM1_SBM2 = 0x00; |
|
|||
203 | } |
|
|||
204 |
|
||||
205 | void create_names( void ) // create all names for tasks and queues |
|
173 | void create_names( void ) // create all names for tasks and queues | |
206 | { |
|
174 | { | |
207 | /** This function creates all RTEMS names used in the software for tasks and queues. |
|
175 | /** This function creates all RTEMS names used in the software for tasks and queues. | |
@@ -213,27 +181,15 void create_names( void ) // create all | |||||
213 |
|
181 | |||
214 | // task names |
|
182 | // task names | |
215 | Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' ); |
|
183 | Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' ); | |
216 | Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' ); |
|
|||
217 | Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' ); |
|
184 | Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' ); | |
218 | Task_name[TASKID_SMIQ] = rtems_build_name( 'S', 'M', 'I', 'Q' ); |
|
|||
219 | Task_name[TASKID_STAT] = rtems_build_name( 'S', 'T', 'A', 'T' ); |
|
185 | Task_name[TASKID_STAT] = rtems_build_name( 'S', 'T', 'A', 'T' ); | |
220 | Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' ); |
|
|||
221 | Task_name[TASKID_SWBD] = rtems_build_name( 'S', 'W', 'B', 'D' ); |
|
|||
222 | Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' ); |
|
|||
223 | Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' ); |
|
186 | Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' ); | |
224 | Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' ); |
|
|||
225 | Task_name[TASKID_MATR] = rtems_build_name( 'M', 'A', 'T', 'R' ); |
|
|||
226 | Task_name[TASKID_CWF3] = rtems_build_name( 'C', 'W', 'F', '3' ); |
|
|||
227 | Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' ); |
|
|||
228 | Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' ); |
|
|||
229 | Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' ); |
|
187 | Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' ); | |
230 | Task_name[TASKID_WTDG] = rtems_build_name( 'W', 'T', 'D', 'G' ); |
|
188 | Task_name[TASKID_WTDG] = rtems_build_name( 'W', 'T', 'D', 'G' ); | |
231 |
|
189 | |||
232 | // TIMEGEN |
|
190 | // TIMEGEN | |
233 | rtems_name_updt = rtems_build_name( 'U', 'P', 'D', 'T' ); |
|
191 | rtems_name_updt = rtems_build_name( 'U', 'P', 'D', 'T' ); | |
234 |
|
192 | rtems_name_act_ = rtems_build_name( 'A', 'C', 'T', '_' ); | ||
235 | // rate monotonic period names |
|
|||
236 | name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' ); |
|
|||
237 |
|
193 | |||
238 | misc_name[QUEUE_RECV] = rtems_build_name( 'Q', '_', 'R', 'V' ); |
|
194 | misc_name[QUEUE_RECV] = rtems_build_name( 'Q', '_', 'R', 'V' ); | |
239 | misc_name[QUEUE_SEND] = rtems_build_name( 'Q', '_', 'S', 'D' ); |
|
195 | misc_name[QUEUE_SEND] = rtems_build_name( 'Q', '_', 'S', 'D' ); | |
@@ -281,12 +237,12 int create_all_tasks( void ) // create a | |||||
281 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_WTDG] |
|
237 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_WTDG] | |
282 | ); |
|
238 | ); | |
283 | } |
|
239 | } | |
284 |
if (status == RTEMS_SUCCESSFUL) // ACT |
|
240 | if (status == RTEMS_SUCCESSFUL) // ACT_ | |
285 | { |
|
241 | { | |
286 | status = rtems_task_create( |
|
242 | status = rtems_task_create( | |
287 |
|
|
243 | rtems_id_act_, TASK_PRIORITY_ACTN, RTEMS_MINIMUM_STACK_SIZE, | |
288 | RTEMS_DEFAULT_MODES, |
|
244 | RTEMS_DEFAULT_MODES, | |
289 |
RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, & |
|
245 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &rtems_id_act_ | |
290 | ); |
|
246 | ); | |
291 | } |
|
247 | } | |
292 | if (status == RTEMS_SUCCESSFUL) // SPIQ |
|
248 | if (status == RTEMS_SUCCESSFUL) // SPIQ | |
@@ -379,11 +335,11 int start_all_tasks( void ) // start all | |||||
379 | } |
|
335 | } | |
380 | } |
|
336 | } | |
381 |
|
337 | |||
382 |
if (status == RTEMS_SUCCESSFUL) // ACT |
|
338 | if (status == RTEMS_SUCCESSFUL) // ACT_ | |
383 | { |
|
339 | { | |
384 |
status = rtems_task_start( |
|
340 | status = rtems_task_start( rtems_id_act_, act__task, 1 ); | |
385 | if (status!=RTEMS_SUCCESSFUL) { |
|
341 | if (status!=RTEMS_SUCCESSFUL) { | |
386 |
BOOT_PRINTF("in INIT *** Error starting TASK_ACT |
|
342 | BOOT_PRINTF("in INIT *** Error starting TASK_ACT_\n") | |
387 | } |
|
343 | } | |
388 | } |
|
344 | } | |
389 |
|
345 | |||
@@ -425,7 +381,7 rtems_status_code create_message_queues( | |||||
425 |
|
381 | |||
426 | // create the queue for handling valid TCs |
|
382 | // create the queue for handling valid TCs | |
427 | status_recv = rtems_message_queue_create( misc_name[QUEUE_RECV], |
|
383 | status_recv = rtems_message_queue_create( misc_name[QUEUE_RECV], | |
428 |
|
|
384 | MSG_QUEUE_COUNT_RECV, CCSDS_TC_PKT_MAX_SIZE, | |
429 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); |
|
385 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); | |
430 | if ( status_recv != RTEMS_SUCCESSFUL ) { |
|
386 | if ( status_recv != RTEMS_SUCCESSFUL ) { | |
431 | PRINTF1("in create_message_queues *** ERR creating QUEU queue, %d\n", status_recv) |
|
387 | PRINTF1("in create_message_queues *** ERR creating QUEU queue, %d\n", status_recv) | |
@@ -433,7 +389,7 rtems_status_code create_message_queues( | |||||
433 |
|
389 | |||
434 | // create the queue for handling TM packet sending |
|
390 | // create the queue for handling TM packet sending | |
435 | status_send = rtems_message_queue_create( misc_name[QUEUE_SEND], |
|
391 | status_send = rtems_message_queue_create( misc_name[QUEUE_SEND], | |
436 |
|
|
392 | MSG_QUEUE_COUNT_SEND, MSG_QUEUE_SIZE_SEND, | |
437 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); |
|
393 | RTEMS_FIFO | RTEMS_LOCAL, &queue_id ); | |
438 | if ( status_send != RTEMS_SUCCESSFUL ) { |
|
394 | if ( status_send != RTEMS_SUCCESSFUL ) { | |
439 | PRINTF1("in create_message_queues *** ERR creating PKTS queue, %d\n", status_send) |
|
395 | PRINTF1("in create_message_queues *** ERR creating PKTS queue, %d\n", status_send) |
@@ -83,14 +83,6 rtems_task spiq_task(rtems_task_argument | |||||
83 | } |
|
83 | } | |
84 | else // [3.b] the link is not in run state, go in STANDBY mode |
|
84 | else // [3.b] the link is not in run state, go in STANDBY mode | |
85 | { |
|
85 | { | |
86 | status = stop_current_mode(); |
|
|||
87 | if ( status != RTEMS_SUCCESSFUL ) { |
|
|||
88 | PRINTF1("in SPIQ *** ERR stop_current_mode *** code %d\n", status) |
|
|||
89 | } |
|
|||
90 | status = enter_mode( LFR_MODE_STANDBY ); |
|
|||
91 | if ( status != RTEMS_SUCCESSFUL ) { |
|
|||
92 | PRINTF1("in SPIQ *** ERR enter_standby_mode *** code %d\n", status) |
|
|||
93 | } |
|
|||
94 | // wake the WTDG task up to wait for the link recovery |
|
86 | // wake the WTDG task up to wait for the link recovery | |
95 | status = rtems_event_send ( Task_id[TASKID_WTDG], RTEMS_EVENT_0 ); |
|
87 | status = rtems_event_send ( Task_id[TASKID_WTDG], RTEMS_EVENT_0 ); | |
96 | status = rtems_task_suspend( RTEMS_SELF ); |
|
88 | status = rtems_task_suspend( RTEMS_SELF ); | |
@@ -98,476 +90,6 rtems_task spiq_task(rtems_task_argument | |||||
98 | } |
|
90 | } | |
99 | } |
|
91 | } | |
100 |
|
92 | |||
101 | rtems_task recv_task( rtems_task_argument unused ) |
|
|||
102 | { |
|
|||
103 | /** This RTEMS task is dedicated to the reception of incoming TeleCommands. |
|
|||
104 | * |
|
|||
105 | * @param unused is the starting argument of the RTEMS task |
|
|||
106 | * |
|
|||
107 | * The RECV task blocks on a call to the read system call, waiting for incoming SpaceWire data. When unblocked: |
|
|||
108 | * 1. It reads the incoming data. |
|
|||
109 | * 2. Launches the acceptance procedure. |
|
|||
110 | * 3. If the Telecommand is valid, sends it to a dedicated RTEMS message queue. |
|
|||
111 | * |
|
|||
112 | */ |
|
|||
113 |
|
||||
114 | int len; |
|
|||
115 | ccsdsTelecommandPacket_t currentTC; |
|
|||
116 | unsigned char computed_CRC[ 2 ]; |
|
|||
117 | unsigned char currentTC_LEN_RCV[ 2 ]; |
|
|||
118 | unsigned char destinationID; |
|
|||
119 | unsigned int currentTC_LEN_RCV_AsUnsignedInt; |
|
|||
120 | unsigned int parserCode; |
|
|||
121 | unsigned char time[6]; |
|
|||
122 | rtems_status_code status; |
|
|||
123 | rtems_id queue_recv_id; |
|
|||
124 | rtems_id queue_send_id; |
|
|||
125 |
|
||||
126 | initLookUpTableForCRC(); // the table is used to compute Cyclic Redundancy Codes |
|
|||
127 |
|
||||
128 | status = get_message_queue_id_recv( &queue_recv_id ); |
|
|||
129 | if (status != RTEMS_SUCCESSFUL) |
|
|||
130 | { |
|
|||
131 | PRINTF1("in RECV *** ERR get_message_queue_id_recv %d\n", status) |
|
|||
132 | } |
|
|||
133 |
|
||||
134 | status = get_message_queue_id_send( &queue_send_id ); |
|
|||
135 | if (status != RTEMS_SUCCESSFUL) |
|
|||
136 | { |
|
|||
137 | PRINTF1("in RECV *** ERR get_message_queue_id_send %d\n", status) |
|
|||
138 | } |
|
|||
139 |
|
||||
140 | BOOT_PRINTF("in RECV *** \n") |
|
|||
141 |
|
||||
142 | while(1) |
|
|||
143 | { |
|
|||
144 | len = read( fdSPW, (char*) ¤tTC, CCSDS_TC_PKT_MAX_SIZE ); // the call to read is blocking |
|
|||
145 | if (len == -1){ // error during the read call |
|
|||
146 | PRINTF1("in RECV *** last read call returned -1, ERRNO %d\n", errno) |
|
|||
147 | } |
|
|||
148 | else { |
|
|||
149 | if ( (len+1) < CCSDS_TC_PKT_MIN_SIZE ) { |
|
|||
150 | PRINTF("in RECV *** packet lenght too short\n") |
|
|||
151 | } |
|
|||
152 | else { |
|
|||
153 | currentTC_LEN_RCV_AsUnsignedInt = (unsigned int) (len - CCSDS_TC_TM_PACKET_OFFSET - 3); // => -3 is for Prot ID, Reserved and User App bytes |
|
|||
154 | currentTC_LEN_RCV[ 0 ] = (unsigned char) (currentTC_LEN_RCV_AsUnsignedInt >> 8); |
|
|||
155 | currentTC_LEN_RCV[ 1 ] = (unsigned char) (currentTC_LEN_RCV_AsUnsignedInt ); |
|
|||
156 | // CHECK THE TC |
|
|||
157 | parserCode = tc_parser( ¤tTC, currentTC_LEN_RCV_AsUnsignedInt, computed_CRC ) ; |
|
|||
158 | if ( (parserCode == ILLEGAL_APID) || (parserCode == WRONG_LEN_PKT) |
|
|||
159 | || (parserCode == INCOR_CHECKSUM) || (parserCode == ILL_TYPE) |
|
|||
160 | || (parserCode == ILL_SUBTYPE) || (parserCode == WRONG_APP_DATA) |
|
|||
161 | || (parserCode == WRONG_SRC_ID) ) |
|
|||
162 | { // send TM_LFR_TC_EXE_CORRUPTED |
|
|||
163 | if ( !( (currentTC.serviceType==TC_TYPE_TIME) && (currentTC.serviceSubType==TC_SUBTYPE_UPDT_TIME) ) |
|
|||
164 | && |
|
|||
165 | !( (currentTC.serviceType==TC_TYPE_GEN) && (currentTC.serviceSubType==TC_SUBTYPE_UPDT_INFO)) |
|
|||
166 | ) |
|
|||
167 | { |
|
|||
168 | if ( parserCode == WRONG_SRC_ID ) |
|
|||
169 | { |
|
|||
170 | destinationID = SID_TC_GROUND; |
|
|||
171 | } |
|
|||
172 | else |
|
|||
173 | { |
|
|||
174 | destinationID = currentTC.sourceID; |
|
|||
175 | } |
|
|||
176 | getTime( time ); |
|
|||
177 | close_action( ¤tTC, LFR_DEFAULT, queue_send_id ); |
|
|||
178 | send_tm_lfr_tc_exe_corrupted( ¤tTC, queue_send_id, |
|
|||
179 | computed_CRC, currentTC_LEN_RCV, |
|
|||
180 | destinationID ); |
|
|||
181 | } |
|
|||
182 | } |
|
|||
183 | else |
|
|||
184 | { // send valid TC to the action launcher |
|
|||
185 | status = rtems_message_queue_send( queue_recv_id, ¤tTC, |
|
|||
186 | currentTC_LEN_RCV_AsUnsignedInt + CCSDS_TC_TM_PACKET_OFFSET + 3); |
|
|||
187 | } |
|
|||
188 | } |
|
|||
189 | } |
|
|||
190 | } |
|
|||
191 | } |
|
|||
192 |
|
||||
193 | rtems_task send_task( rtems_task_argument argument) |
|
|||
194 | { |
|
|||
195 | /** This RTEMS task is dedicated to the transmission of TeleMetry packets. |
|
|||
196 | * |
|
|||
197 | * @param unused is the starting argument of the RTEMS task |
|
|||
198 | * |
|
|||
199 | * The SEND task waits for a message to become available in the dedicated RTEMS queue. When a message arrives: |
|
|||
200 | * - if the first byte is equal to CCSDS_DESTINATION_ID, the message is sent as is using the write system call. |
|
|||
201 | * - if the first byte is not equal to CCSDS_DESTINATION_ID, the message is handled as a spw_ioctl_pkt_send. After |
|
|||
202 | * analyzis, the packet is sent either using the write system call or using the ioctl call SPACEWIRE_IOCTRL_SEND, depending on the |
|
|||
203 | * data it contains. |
|
|||
204 | * |
|
|||
205 | */ |
|
|||
206 |
|
||||
207 | rtems_status_code status; // RTEMS status code |
|
|||
208 | char incomingData[ACTION_MSG_PKTS_MAX_SIZE]; // incoming data buffer |
|
|||
209 | size_t size; // size of the incoming TC packet |
|
|||
210 | u_int32_t count; |
|
|||
211 | rtems_id queue_id; |
|
|||
212 |
|
||||
213 | status = get_message_queue_id_send( &queue_id ); |
|
|||
214 | if (status != RTEMS_SUCCESSFUL) |
|
|||
215 | { |
|
|||
216 | PRINTF1("in HOUS *** ERR get_message_queue_id_send %d\n", status) |
|
|||
217 | } |
|
|||
218 |
|
||||
219 | BOOT_PRINTF("in SEND *** \n") |
|
|||
220 |
|
||||
221 | while(1) |
|
|||
222 | { |
|
|||
223 | status = rtems_message_queue_receive( queue_id, incomingData, &size, |
|
|||
224 | RTEMS_WAIT, RTEMS_NO_TIMEOUT ); |
|
|||
225 |
|
||||
226 | if (status!=RTEMS_SUCCESSFUL) |
|
|||
227 | { |
|
|||
228 | PRINTF1("in SEND *** (1) ERR = %d\n", status) |
|
|||
229 | } |
|
|||
230 | else |
|
|||
231 | { |
|
|||
232 | status = write( fdSPW, incomingData, size ); |
|
|||
233 | if (status == -1){ |
|
|||
234 | PRINTF2("in SEND *** (2.a) ERRNO = %d, size = %d\n", errno, size) |
|
|||
235 | } |
|
|||
236 | } |
|
|||
237 |
|
||||
238 | status = rtems_message_queue_get_number_pending( queue_id, &count ); |
|
|||
239 | if (status != RTEMS_SUCCESSFUL) |
|
|||
240 | { |
|
|||
241 | PRINTF1("in SEND *** (3) ERR = %d\n", status) |
|
|||
242 | } |
|
|||
243 | else |
|
|||
244 | { |
|
|||
245 | if (count > maxCount) |
|
|||
246 | { |
|
|||
247 | maxCount = count; |
|
|||
248 | } |
|
|||
249 | } |
|
|||
250 | } |
|
|||
251 | } |
|
|||
252 |
|
||||
253 | rtems_task wtdg_task( rtems_task_argument argument ) |
|
|||
254 | { |
|
|||
255 | rtems_event_set event_out; |
|
|||
256 | rtems_status_code status; |
|
|||
257 | int linkStatus; |
|
|||
258 |
|
||||
259 | BOOT_PRINTF("in WTDG ***\n") |
|
|||
260 |
|
||||
261 | while(1) |
|
|||
262 | { |
|
|||
263 | // wait for an RTEMS_EVENT |
|
|||
264 | rtems_event_receive( RTEMS_EVENT_0, |
|
|||
265 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
|||
266 | PRINTF("in WTDG *** wait for the link\n") |
|
|||
267 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status |
|
|||
268 | while( linkStatus != 5) // wait for the link |
|
|||
269 | { |
|
|||
270 | rtems_task_wake_after( 10 ); |
|
|||
271 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_GET_LINK_STATUS, &linkStatus); // get the link status |
|
|||
272 | } |
|
|||
273 |
|
||||
274 | status = spacewire_stop_start_link( fdSPW ); |
|
|||
275 |
|
||||
276 | if (status != RTEMS_SUCCESSFUL) |
|
|||
277 | { |
|
|||
278 | PRINTF1("in WTDG *** ERR link not started %d\n", status) |
|
|||
279 | } |
|
|||
280 | else |
|
|||
281 | { |
|
|||
282 | PRINTF("in WTDG *** OK link started\n") |
|
|||
283 | } |
|
|||
284 |
|
||||
285 | // restart the SPIQ task |
|
|||
286 | status = rtems_task_restart( Task_id[TASKID_SPIQ], 1 ); |
|
|||
287 | if ( status != RTEMS_SUCCESSFUL ) { |
|
|||
288 | PRINTF("in SPIQ *** ERR restarting SPIQ Task\n") |
|
|||
289 | } |
|
|||
290 |
|
||||
291 | // restart RECV and SEND |
|
|||
292 | status = rtems_task_restart( Task_id[ TASKID_SEND ], 1 ); |
|
|||
293 | if ( status != RTEMS_SUCCESSFUL ) { |
|
|||
294 | PRINTF("in SPIQ *** ERR restarting SEND Task\n") |
|
|||
295 | } |
|
|||
296 | status = rtems_task_restart( Task_id[ TASKID_RECV ], 1 ); |
|
|||
297 | if ( status != RTEMS_SUCCESSFUL ) { |
|
|||
298 | PRINTF("in SPIQ *** ERR restarting RECV Task\n") |
|
|||
299 | } |
|
|||
300 | } |
|
|||
301 | } |
|
|||
302 |
|
||||
303 | //**************** |
|
|||
304 | // OTHER FUNCTIONS |
|
|||
305 | int spacewire_open_link( void ) |
|
|||
306 | { |
|
|||
307 | /** This function opens the SpaceWire link. |
|
|||
308 | * |
|
|||
309 | * @return a valid file descriptor in case of success, -1 in case of a failure |
|
|||
310 | * |
|
|||
311 | */ |
|
|||
312 | rtems_status_code status; |
|
|||
313 |
|
||||
314 | fdSPW = open(GRSPW_DEVICE_NAME, O_RDWR); // open the device. the open call resets the hardware |
|
|||
315 | if ( fdSPW < 0 ) { |
|
|||
316 | PRINTF1("ERR *** in configure_spw_link *** error opening "GRSPW_DEVICE_NAME" with ERR %d\n", errno) |
|
|||
317 | } |
|
|||
318 | else |
|
|||
319 | { |
|
|||
320 | status = RTEMS_SUCCESSFUL; |
|
|||
321 | } |
|
|||
322 |
|
||||
323 | return status; |
|
|||
324 | } |
|
|||
325 |
|
||||
326 | int spacewire_start_link( int fd ) |
|
|||
327 | { |
|
|||
328 | rtems_status_code status; |
|
|||
329 |
|
||||
330 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_START, -1); // returns successfuly if the link is started |
|
|||
331 | // -1 default hardcoded driver timeout |
|
|||
332 |
|
||||
333 | return status; |
|
|||
334 | } |
|
|||
335 |
|
||||
336 | int spacewire_stop_start_link( int fd ) |
|
|||
337 | { |
|
|||
338 | rtems_status_code status; |
|
|||
339 |
|
||||
340 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_STOP); // start fails if link pDev->running != 0 |
|
|||
341 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_START, -1); // returns successfuly if the link is started |
|
|||
342 | // -1 default hardcoded driver timeout |
|
|||
343 |
|
||||
344 | return status; |
|
|||
345 | } |
|
|||
346 |
|
||||
347 | int spacewire_configure_link( int fd ) |
|
|||
348 | { |
|
|||
349 | /** This function configures the SpaceWire link. |
|
|||
350 | * |
|
|||
351 | * @return GR-RTEMS-DRIVER directive status codes: |
|
|||
352 | * - 22 EINVAL - Null pointer or an out of range value was given as the argument. |
|
|||
353 | * - 16 EBUSY - Only used for SEND. Returned when no descriptors are avialble in non-blocking mode. |
|
|||
354 | * - 88 ENOSYS - Returned for SET_DESTKEY if RMAP command handler is not available or if a non-implemented call is used. |
|
|||
355 | * - 116 ETIMEDOUT - REturned for SET_PACKET_SIZE and START if the link could not be brought up. |
|
|||
356 | * - 12 ENOMEM - Returned for SET_PACKETSIZE if it was unable to allocate the new buffers. |
|
|||
357 | * - 5 EIO - Error when writing to grswp hardware registers. |
|
|||
358 | * - 2 ENOENT - No such file or directory |
|
|||
359 | */ |
|
|||
360 |
|
||||
361 | rtems_status_code status; |
|
|||
362 |
|
||||
363 | spacewire_set_NP(1, REGS_ADDR_GRSPW); // [N]o [P]ort force |
|
|||
364 | spacewire_set_RE(1, REGS_ADDR_GRSPW); // [R]MAP [E]nable, the dedicated call seems to break the no port force configuration |
|
|||
365 |
|
||||
366 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_RXBLOCK, 1); // sets the blocking mode for reception |
|
|||
367 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_RXBLOCK\n") |
|
|||
368 | // |
|
|||
369 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_EVENT_ID, Task_id[TASKID_SPIQ]); // sets the task ID to which an event is sent when a |
|
|||
370 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_EVENT_ID\n") // link-error interrupt occurs |
|
|||
371 | // |
|
|||
372 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_DISABLE_ERR, 0); // automatic link-disabling due to link-error interrupts |
|
|||
373 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_DISABLE_ERR\n") |
|
|||
374 | // |
|
|||
375 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ, 1); // sets the link-error interrupt bit |
|
|||
376 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ\n") |
|
|||
377 | // |
|
|||
378 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TXBLOCK, 0); // transmission blocks |
|
|||
379 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TXBLOCK\n") |
|
|||
380 | // |
|
|||
381 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL, 1); // transmission blocks when no transmission descriptor is available |
|
|||
382 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL\n") |
|
|||
383 | // |
|
|||
384 | status = ioctl(fd, SPACEWIRE_IOCTRL_SET_TCODE_CTRL, 0x0909); // [Time Rx : Time Tx : Link error : Tick-out IRQ] |
|
|||
385 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in SPIQ *** Error SPACEWIRE_IOCTRL_SET_TCODE_CTRL\n") |
|
|||
386 |
|
||||
387 | return status; |
|
|||
388 | } |
|
|||
389 |
|
||||
390 | int spacewire_reset_link( void ) |
|
|||
391 | { |
|
|||
392 | /** This function is executed by the SPIQ rtems_task wehn it has been awaken by an interruption raised by the SpaceWire driver. |
|
|||
393 | * |
|
|||
394 | * @return RTEMS directive status code: |
|
|||
395 | * - RTEMS_UNSATISFIED is returned is the link is not in the running state after 10 s. |
|
|||
396 | * - RTEMS_SUCCESSFUL is returned if the link is up before the timeout. |
|
|||
397 | * |
|
|||
398 | */ |
|
|||
399 |
|
||||
400 | rtems_status_code status_spw; |
|
|||
401 | int i; |
|
|||
402 |
|
||||
403 | for ( i=0; i<SY_LFR_DPU_CONNECT_ATTEMPT; i++ ) |
|
|||
404 | { |
|
|||
405 | PRINTF1("in spacewire_reset_link *** link recovery, try %d\n", i); |
|
|||
406 |
|
||||
407 | // CLOSING THE DRIVER AT THIS POINT WILL MAKE THE SEND TASK BLOCK THE SYSTEM |
|
|||
408 |
|
||||
409 | status_spw = spacewire_stop_start_link( fdSPW ); |
|
|||
410 | if ( status_spw != RTEMS_SUCCESSFUL ) |
|
|||
411 | { |
|
|||
412 | PRINTF1("in spacewire_reset_link *** ERR spacewire_start_link code %d\n", status_spw) |
|
|||
413 | } |
|
|||
414 |
|
||||
415 | if ( status_spw == RTEMS_SUCCESSFUL) |
|
|||
416 | { |
|
|||
417 | break; |
|
|||
418 | } |
|
|||
419 | } |
|
|||
420 |
|
||||
421 | return status_spw; |
|
|||
422 | } |
|
|||
423 |
|
||||
424 | void spacewire_set_NP( unsigned char val, unsigned int regAddr ) // [N]o [P]ort force |
|
|||
425 | { |
|
|||
426 | /** This function sets the [N]o [P]ort force bit of the GRSPW control register. |
|
|||
427 | * |
|
|||
428 | * @param val is the value, 0 or 1, used to set the value of the NP bit. |
|
|||
429 | * @param regAddr is the address of the GRSPW control register. |
|
|||
430 | * |
|
|||
431 | * NP is the bit 20 of the GRSPW control register. |
|
|||
432 | * |
|
|||
433 | */ |
|
|||
434 |
|
||||
435 | unsigned int *spwptr = (unsigned int*) regAddr; |
|
|||
436 |
|
||||
437 | if (val == 1) { |
|
|||
438 | *spwptr = *spwptr | 0x00100000; // [NP] set the No port force bit |
|
|||
439 | } |
|
|||
440 | if (val== 0) { |
|
|||
441 | *spwptr = *spwptr & 0xffdfffff; |
|
|||
442 | } |
|
|||
443 | } |
|
|||
444 |
|
||||
445 | void spacewire_set_RE( unsigned char val, unsigned int regAddr ) // [R]MAP [E]nable |
|
|||
446 | { |
|
|||
447 | /** This function sets the [R]MAP [E]nable bit of the GRSPW control register. |
|
|||
448 | * |
|
|||
449 | * @param val is the value, 0 or 1, used to set the value of the RE bit. |
|
|||
450 | * @param regAddr is the address of the GRSPW control register. |
|
|||
451 | * |
|
|||
452 | * RE is the bit 16 of the GRSPW control register. |
|
|||
453 | * |
|
|||
454 | */ |
|
|||
455 |
|
||||
456 | unsigned int *spwptr = (unsigned int*) regAddr; |
|
|||
457 |
|
||||
458 | if (val == 1) |
|
|||
459 | { |
|
|||
460 | *spwptr = *spwptr | 0x00010000; // [RE] set the RMAP Enable bit |
|
|||
461 | } |
|
|||
462 | if (val== 0) |
|
|||
463 | { |
|
|||
464 | *spwptr = *spwptr & 0xfffdffff; |
|
|||
465 | } |
|
|||
466 | } |
|
|||
467 |
|
||||
468 | void spacewire_compute_stats_offsets( void ) |
|
|||
469 | { |
|
|||
470 | /** This function computes the SpaceWire statistics offsets in case of a SpaceWire related interruption raising. |
|
|||
471 | * |
|
|||
472 | * The offsets keep a record of the statistics in case of a reset of the statistics. They are added to the current statistics |
|
|||
473 | * to keep the counters consistent even after a reset of the SpaceWire driver (the counter are set to zero by the driver when it |
|
|||
474 | * during the open systel call). |
|
|||
475 | * |
|
|||
476 | */ |
|
|||
477 |
|
||||
478 | spw_stats spacewire_stats_grspw; |
|
|||
479 | rtems_status_code status; |
|
|||
480 |
|
||||
481 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_GET_STATISTICS, &spacewire_stats_grspw ); |
|
|||
482 |
|
||||
483 | spacewire_stats_backup.packets_received = spacewire_stats_grspw.packets_received |
|
|||
484 | + spacewire_stats.packets_received; |
|
|||
485 | spacewire_stats_backup.packets_sent = spacewire_stats_grspw.packets_sent |
|
|||
486 | + spacewire_stats.packets_sent; |
|
|||
487 | spacewire_stats_backup.parity_err = spacewire_stats_grspw.parity_err |
|
|||
488 | + spacewire_stats.parity_err; |
|
|||
489 | spacewire_stats_backup.disconnect_err = spacewire_stats_grspw.disconnect_err |
|
|||
490 | + spacewire_stats.disconnect_err; |
|
|||
491 | spacewire_stats_backup.escape_err = spacewire_stats_grspw.escape_err |
|
|||
492 | + spacewire_stats.escape_err; |
|
|||
493 | spacewire_stats_backup.credit_err = spacewire_stats_grspw.credit_err |
|
|||
494 | + spacewire_stats.credit_err; |
|
|||
495 | spacewire_stats_backup.write_sync_err = spacewire_stats_grspw.write_sync_err |
|
|||
496 | + spacewire_stats.write_sync_err; |
|
|||
497 | spacewire_stats_backup.rx_rmap_header_crc_err = spacewire_stats_grspw.rx_rmap_header_crc_err |
|
|||
498 | + spacewire_stats.rx_rmap_header_crc_err; |
|
|||
499 | spacewire_stats_backup.rx_rmap_data_crc_err = spacewire_stats_grspw.rx_rmap_data_crc_err |
|
|||
500 | + spacewire_stats.rx_rmap_data_crc_err; |
|
|||
501 | spacewire_stats_backup.early_ep = spacewire_stats_grspw.early_ep |
|
|||
502 | + spacewire_stats.early_ep; |
|
|||
503 | spacewire_stats_backup.invalid_address = spacewire_stats_grspw.invalid_address |
|
|||
504 | + spacewire_stats.invalid_address; |
|
|||
505 | spacewire_stats_backup.rx_eep_err = spacewire_stats_grspw.rx_eep_err |
|
|||
506 | + spacewire_stats.rx_eep_err; |
|
|||
507 | spacewire_stats_backup.rx_truncated = spacewire_stats_grspw.rx_truncated |
|
|||
508 | + spacewire_stats.rx_truncated; |
|
|||
509 | } |
|
|||
510 |
|
||||
511 | void spacewire_update_statistics( void ) |
|
|||
512 | { |
|
|||
513 | rtems_status_code status; |
|
|||
514 | spw_stats spacewire_stats_grspw; |
|
|||
515 |
|
||||
516 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_GET_STATISTICS, &spacewire_stats_grspw ); |
|
|||
517 |
|
||||
518 | spacewire_stats.packets_received = spacewire_stats_backup.packets_received |
|
|||
519 | + spacewire_stats_grspw.packets_received; |
|
|||
520 | spacewire_stats.packets_sent = spacewire_stats_backup.packets_sent |
|
|||
521 | + spacewire_stats_grspw.packets_sent; |
|
|||
522 | spacewire_stats.parity_err = spacewire_stats_backup.parity_err |
|
|||
523 | + spacewire_stats_grspw.parity_err; |
|
|||
524 | spacewire_stats.disconnect_err = spacewire_stats_backup.disconnect_err |
|
|||
525 | + spacewire_stats_grspw.disconnect_err; |
|
|||
526 | spacewire_stats.escape_err = spacewire_stats_backup.escape_err |
|
|||
527 | + spacewire_stats_grspw.escape_err; |
|
|||
528 | spacewire_stats.credit_err = spacewire_stats_backup.credit_err |
|
|||
529 | + spacewire_stats_grspw.credit_err; |
|
|||
530 | spacewire_stats.write_sync_err = spacewire_stats_backup.write_sync_err |
|
|||
531 | + spacewire_stats_grspw.write_sync_err; |
|
|||
532 | spacewire_stats.rx_rmap_header_crc_err = spacewire_stats_backup.rx_rmap_header_crc_err |
|
|||
533 | + spacewire_stats_grspw.rx_rmap_header_crc_err; |
|
|||
534 | spacewire_stats.rx_rmap_data_crc_err = spacewire_stats_backup.rx_rmap_data_crc_err |
|
|||
535 | + spacewire_stats_grspw.rx_rmap_data_crc_err; |
|
|||
536 | spacewire_stats.early_ep = spacewire_stats_backup.early_ep |
|
|||
537 | + spacewire_stats_grspw.early_ep; |
|
|||
538 | spacewire_stats.invalid_address = spacewire_stats_backup.invalid_address |
|
|||
539 | + spacewire_stats_grspw.invalid_address; |
|
|||
540 | spacewire_stats.rx_eep_err = spacewire_stats_backup.rx_eep_err |
|
|||
541 | + spacewire_stats_grspw.rx_eep_err; |
|
|||