##// END OF EJS Templates
cpu_load added to the housekeeping packets
paul -
r134:25c2cda0d9a4 VHDLib206
parent child
Show More
@@ -0,0 +1,6
1 #ifndef LFR_CPU_USAGE_REPORT_H
2 #define LFR_CPU_USAGE_REPORT_H
3
4 unsigned char lfr_rtems_cpu_usage_report( void );
5
6 #endif // LFR_CPU_USAGE_REPORT_H
@@ -1,6 +1,6
1 1 #############################################################################
2 2 # Makefile for building: bin/fsw
3 # Generated by qmake (2.01a) (Qt 4.8.6) on: Thu May 15 08:30:40 2014
3 # Generated by qmake (2.01a) (Qt 4.8.6) on: Fri May 16 07:58:47 2014
4 4 # Project: fsw-qt.pro
5 5 # Template: app
6 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 11 CC = sparc-rtems-gcc
12 12 CXX = sparc-rtems-g++
13 DEFINES = -DSW_VERSION_N1=1 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=7 -DPRINT_MESSAGES_ON_CONSOLE -DPRINT_TASK_STATISTICS
13 DEFINES = -DSW_VERSION_N1=1 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=7 -DPRINT_MESSAGES_ON_CONSOLE
14 14 CFLAGS = -pipe -O3 -Wall $(DEFINES)
15 15 CXXFLAGS = -pipe -O3 -Wall $(DEFINES)
16 16 INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header -I../header/processing -I../src/basic_parameters
@@ -56,7 +56,8 SOURCES = ../src/wf_handler.c \
56 56 ../src/processing/fsw_processing.c \
57 57 ../src/processing/avf0_prc0.c \
58 58 ../src/processing/avf1_prc1.c \
59 ../src/processing/avf2_prc2.c
59 ../src/processing/avf2_prc2.c \
60 ../src/lfr_cpu_usage_report.c
60 61 OBJECTS = obj/wf_handler.o \
61 62 obj/tc_handler.o \
62 63 obj/fsw_misc.o \
@@ -70,7 +71,8 OBJECTS = obj/wf_handler.o \
70 71 obj/fsw_processing.o \
71 72 obj/avf0_prc0.o \
72 73 obj/avf1_prc1.o \
73 obj/avf2_prc2.o
74 obj/avf2_prc2.o \
75 obj/lfr_cpu_usage_report.o
74 76 DIST = /usr/lib64/qt4/mkspecs/common/unix.conf \
75 77 /usr/lib64/qt4/mkspecs/common/linux.conf \
76 78 /usr/lib64/qt4/mkspecs/common/gcc-base.conf \
@@ -258,6 +260,9 obj/avf1_prc1.o: ../src/processing/avf1_
258 260 obj/avf2_prc2.o: ../src/processing/avf2_prc2.c
259 261 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/avf2_prc2.o ../src/processing/avf2_prc2.c
260 262
263 obj/lfr_cpu_usage_report.o: ../src/lfr_cpu_usage_report.c
264 $(CC) -c $(CFLAGS) $(INCPATH) -o obj/lfr_cpu_usage_report.o ../src/lfr_cpu_usage_report.c
265
261 266 ####### Install
262 267
263 268 install: FORCE
@@ -1,7 +1,7
1 1 TEMPLATE = app
2 2 # CONFIG += console v8 sim
3 3 # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report *** vhdl_dev *** debug_tch
4 CONFIG += console verbose cpu_usage_report
4 CONFIG += console verbose
5 5 CONFIG -= qt
6 6
7 7 include(./sparc.pri)
@@ -67,7 +67,8 SOURCES += \
67 67 ../src/processing/fsw_processing.c \
68 68 ../src/processing/avf0_prc0.c \
69 69 ../src/processing/avf1_prc1.c \
70 ../src/processing/avf2_prc2.c
70 ../src/processing/avf2_prc2.c \
71 ../src/lfr_cpu_usage_report.c
71 72
72 73 HEADERS += \
73 74 ../header/wf_handler.h \
@@ -88,5 +89,6 HEADERS += \
88 89 ../header/processing/avf0_prc0.h \
89 90 ../header/processing/avf1_prc1.h \
90 91 ../header/processing/avf2_prc2.h \
91 ../header/fsw_params_wf_handler.h
92 ../header/fsw_params_wf_handler.h \
93 ../header/lfr_cpu_usage_report.h
92 94
@@ -1,6 +1,6
1 1 <?xml version="1.0" encoding="UTF-8"?>
2 2 <!DOCTYPE QtCreatorProject>
3 <!-- Written by QtCreator 3.0.1, 2014-05-15T06:56:44. -->
3 <!-- Written by QtCreator 3.0.1, 2014-05-16T15:09:51. -->
4 4 <qtcreator>
5 5 <data>
6 6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
@@ -476,7 +476,7 typedef struct {
476 476 unsigned char sid;
477 477 unsigned char biaStatusInfo;
478 478 unsigned char acquisitionTime[6];
479 unsigned char source_data_spare[2];
479 unsigned char source_data_spare;
480 480 unsigned char pa_lfr_bp_blk_nr[2];
481 481 } Header_TM_LFR_SCIENCE_BP_with_spare_t;
482 482
@@ -539,8 +539,8 typedef struct {
539 539 unsigned char lfr_fpga_version[3];
540 540 // ressource statistics
541 541 unsigned char hk_lfr_cpu_load;
542 unsigned char hk_lfr_load_max;
543 unsigned char hk_lfr_load_aver;
542 unsigned char hk_lfr_cpu_load_max;
543 unsigned char hk_lfr_cpu_load_aver;
544 544 // tc statistics
545 545 unsigned char hk_lfr_update_info_tc_cnt[2];
546 546 unsigned char hk_lfr_update_time_tc_cnt[2];
@@ -7,6 +7,7
7 7
8 8 #include "fsw_params.h"
9 9 #include "fsw_spacewire.h"
10 #include "lfr_cpu_usage_report.h"
10 11
11 12 rtems_name name_hk_rate_monotonic; // name of the HK rate monotonic
12 13 rtems_id HK_id; // id of the HK rate monotonic period
@@ -36,9 +37,11 void increment_seq_counter( unsigned cha
36 37 void getTime( unsigned char *time);
37 38 unsigned long long int getTimeAsUnsignedLongLongInt( );
38 39 void send_dumb_hk( void );
39 void get_v_e1_e2_f3 (unsigned char *v, unsigned char *e1, unsigned char *e2);
40 void get_v_e1_e2_f3 (unsigned char *spacecraft_potential);
41 void get_cpu_load( unsigned char *resource_statistics );
40 42
41 43 extern int sched_yield( void );
44 extern int rtems_cpu_usage_reset();
42 45 extern ring_node *current_ring_node_f3;
43 46 extern ring_node *ring_node_to_send_cwf_f3;
44 47
@@ -10,6 +10,8
10 10 #include "wf_handler.h"
11 11 #include "fsw_processing.h"
12 12
13 #include "lfr_cpu_usage_report.h"
14
13 15 // MODE PARAMETERS
14 16 extern unsigned int maxCount;
15 17
@@ -72,6 +72,8 rtems_task Init( rtems_task_argument ign
72 72
73 73 reset_local_time();
74 74
75 rtems_cpu_usage_reset();
76
75 77 rtems_status_code status;
76 78 rtems_status_code status_spw;
77 79 rtems_isr_entry old_isr_handler;
@@ -221,8 +221,8 rtems_task hous_task(rtems_task_argument
221 221
222 222 spacewire_update_statistics();
223 223
224 get_v_e1_e2_f3(
225 housekeeping_packet.hk_lfr_sc_v_f3, housekeeping_packet.hk_lfr_sc_e1_f3, housekeeping_packet.hk_lfr_sc_e2_f3 );
224 get_v_e1_e2_f3( housekeeping_packet.hk_lfr_sc_v_f3 );
225 get_cpu_load( (unsigned char *) &housekeeping_packet.hk_lfr_cpu_load );
226 226
227 227 // SEND PACKET
228 228 status = rtems_message_queue_urgent( queue_id, &housekeeping_packet,
@@ -436,7 +436,7 void send_dumb_hk( void )
436 436 PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES);
437 437 }
438 438
439 void get_v_e1_e2_f3( unsigned char *v, unsigned char *e1, unsigned char *e2 )
439 void get_v_e1_e2_f3( unsigned char *spacecraft_potential )
440 440 {
441 441 unsigned int coarseTime;
442 442 unsigned int acquisitionTime;
@@ -449,12 +449,12 void get_v_e1_e2_f3( unsigned char *v, u
449 449
450 450 if (lfrCurrentMode == LFR_MODE_STANDBY)
451 451 {
452 v[0] = 0x00;
453 v[1] = 0x00;
454 e1[0] = 0x00;
455 e1[1] = 0x00;
456 e2[0] = 0x00;
457 e2[1] = 0x00;
452 spacecraft_potential[0] = 0x00;
453 spacecraft_potential[1] = 0x00;
454 spacecraft_potential[2] = 0x00;
455 spacecraft_potential[3] = 0x00;
456 spacecraft_potential[4] = 0x00;
457 spacecraft_potential[5] = 0x00;
458 458 }
459 459 else
460 460 {
@@ -486,16 +486,38 void get_v_e1_e2_f3( unsigned char *v, u
486 486 offset_in_samples = NB_SAMPLES_PER_SNAPSHOT -1;
487 487 }
488 488 offset_in_bytes = TIME_OFFSET_IN_BYTES + offset_in_samples * NB_WORDS_SWF_BLK * 4;
489 v[0] = bufferPtr[ offset_in_bytes + 0];
490 v[1] = bufferPtr[ offset_in_bytes + 1];
491 e1[0] = bufferPtr[ offset_in_bytes + 2];
492 e1[1] = bufferPtr[ offset_in_bytes + 3];
493 e2[0] = bufferPtr[ offset_in_bytes + 4];
494 e2[1] = bufferPtr[ offset_in_bytes + 5];
489 spacecraft_potential[0] = bufferPtr[ offset_in_bytes + 0];
490 spacecraft_potential[1] = bufferPtr[ offset_in_bytes + 1];
491 spacecraft_potential[2] = bufferPtr[ offset_in_bytes + 2];
492 spacecraft_potential[3] = bufferPtr[ offset_in_bytes + 3];
493 spacecraft_potential[4] = bufferPtr[ offset_in_bytes + 4];
494 spacecraft_potential[5] = bufferPtr[ offset_in_bytes + 5];
495 495 }
496 496 }
497 497
498 void get_cpu_load( unsigned char *resource_statistics )
499 {
500 unsigned char cpu_load;
501
502 cpu_load = lfr_rtems_cpu_usage_report();
503
504 // HK_LFR_CPU_LOAD
505 resource_statistics[0] = cpu_load;
506
507 // HK_LFR_CPU_LOAD_MAX
508 if (cpu_load > resource_statistics[1])
509 {
510 resource_statistics[1] = cpu_load;
511 }
512
513 // CPU_LOAD_AVE
514 resource_statistics[2] = 0;
515
516 #ifndef PRINT_TASK_STATISTICS
517 rtems_cpu_usage_reset();
518 #endif
519
520 }
521
498 522
499 523
500
501
@@ -264,7 +264,7 rtems_task prc0_task( rtems_task_argumen
264 264 // BP1_set( compressed_sm_norm_f0, NB_BINS_COMPRESSED_SM_SBM_F0, bp1_sbm_f0 );
265 265 // 3) send the BP1 set
266 266 set_time( packet_sbm_bp1_f0.header.time, (unsigned char *) &incomingMsg->coarseTime );
267 set_time( packet_sbm_bp1_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime );
267 set_time( packet_sbm_bp1_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime );
268 268 BP_send( (char *) &packet_sbm_bp1_f0, queue_id,
269 269 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F0 + PACKET_LENGTH_DELTA,
270 270 SID_SBM1_BP1_F0);
@@ -275,7 +275,7 rtems_task prc0_task( rtems_task_argumen
275 275
276 276 // 2) send the BP2 set
277 277 set_time( packet_sbm_bp2_f0.header.time, (unsigned char *) &incomingMsg->coarseTime );
278 set_time( packet_sbm_bp2_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime );
278 set_time( packet_sbm_bp2_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime );
279 279 BP_send( (char *) &packet_sbm_bp2_f0, queue_id,
280 280 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F0 + PACKET_LENGTH_DELTA,
281 281 SID_SBM1_BP2_F0);
@@ -298,7 +298,7 rtems_task prc0_task( rtems_task_argumen
298 298 // BP1_set( compressed_sm_norm_f0, NB_BINS_COMPRESSED_SM_F0, bp1_norm_f0 );
299 299 // 3) send the BP1 set
300 300 set_time( packet_norm_bp1_f0.header.time, (unsigned char *) &incomingMsg->coarseTime );
301 set_time( packet_norm_bp1_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime );
301 set_time( packet_norm_bp1_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime );
302 302 BP_send( (char *) &packet_norm_bp1_f0, queue_id,
303 303 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F0 + PACKET_LENGTH_DELTA,
304 304 SID_NORM_BP1_F0 );
@@ -308,7 +308,7 rtems_task prc0_task( rtems_task_argumen
308 308
309 309 // 2) send the BP2 set
310 310 set_time( packet_norm_bp2_f0.header.time, (unsigned char *) &incomingMsg->coarseTime );
311 set_time( packet_norm_bp2_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime );
311 set_time( packet_norm_bp2_f0.header.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime );
312 312 BP_send( (char *) &packet_norm_bp2_f0, queue_id,
313 313 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F0 + PACKET_LENGTH_DELTA,
314 314 SID_NORM_BP2_F0);
@@ -249,7 +249,7 rtems_task prc1_task( rtems_task_argumen
249 249
250 250 // 3) send the BP1 set
251 251 set_time( packet_sbm_bp1.header.time, (unsigned char *) &incomingMsg->coarseTime );
252 set_time( packet_sbm_bp1.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime );
252 set_time( packet_sbm_bp1.header.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime );
253 253 BP_send( (char *) &packet_sbm_bp1, queue_id_send,
254 254 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP1_F1 + PACKET_LENGTH_DELTA,
255 255 SID_SBM2_BP1_F1 );
@@ -260,7 +260,7 rtems_task prc1_task( rtems_task_argumen
260 260
261 261 // 2) send the BP2 set
262 262 set_time( packet_sbm_bp2.header.time, (unsigned char *) &incomingMsg->coarseTime );
263 set_time( packet_sbm_bp2.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime );
263 set_time( packet_sbm_bp2.header.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime );
264 264 BP_send( (char *) &packet_sbm_bp2, queue_id_send,
265 265 PACKET_LENGTH_TM_LFR_SCIENCE_SBM_BP2_F1 + PACKET_LENGTH_DELTA,
266 266 SID_SBM2_BP2_F1 );
@@ -293,7 +293,7 rtems_task prc1_task( rtems_task_argumen
293 293
294 294 // 2) send the BP2 set
295 295 set_time( packet_norm_bp2.header.time, (unsigned char *) &incomingMsg->coarseTime );
296 set_time( packet_norm_bp2.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime );
296 set_time( packet_norm_bp2.header.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime );
297 297 BP_send( (char *) &packet_norm_bp2, queue_id_send,
298 298 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F1 + PACKET_LENGTH_DELTA,
299 299 SID_NORM_BP2_F1 );
@@ -187,7 +187,7 rtems_task prc2_task( rtems_task_argumen
187 187
188 188 // 3) send the BP1 set
189 189 set_time( packet_norm_bp1_f2.header.time, (unsigned char *) &incomingMsg->coarseTime );
190 set_time( packet_norm_bp1_f2.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime );
190 set_time( packet_norm_bp1_f2.header.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime );
191 191 BP_send( (char *) &packet_norm_bp1_f2, queue_id,
192 192 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP1_F2 + PACKET_LENGTH_DELTA,
193 193 SID_NORM_BP1_F2 );
@@ -197,7 +197,7 rtems_task prc2_task( rtems_task_argumen
197 197
198 198 // 2) send the BP2 set
199 199 set_time( packet_norm_bp2_f2.header.time, (unsigned char *) &incomingMsg->coarseTime );
200 set_time( packet_norm_bp2_f2.header.acquisitionTime, (unsigned char *) &incomingMsg->fineTime );
200 set_time( packet_norm_bp2_f2.header.acquisitionTime, (unsigned char *) &incomingMsg->coarseTime );
201 201 BP_send( (char *) &packet_norm_bp2_f2, queue_id,
202 202 PACKET_LENGTH_TM_LFR_SCIENCE_NORM_BP2_F2 + PACKET_LENGTH_DELTA,
203 203 SID_NORM_BP2_F2 );
@@ -317,12 +317,12 void ASM_send(Header_TM_LFR_SCIENCE_ASM_
317 317 header->time[4] = (unsigned char) (time_management_regs->fine_time>>8);
318 318 header->time[5] = (unsigned char) (time_management_regs->fine_time);
319 319 //
320 header->acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24);
321 header->acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16);
322 header->acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8);
323 header->acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time);
324 header->acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8);
325 header->acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time);
320 header->acquisitionTime[0] = header->time[0];
321 header->acquisitionTime[1] = header->time[1];
322 header->acquisitionTime[2] = header->time[2];
323 header->acquisitionTime[3] = header->time[3];
324 header->acquisitionTime[4] = header->time[4];
325 header->acquisitionTime[5] = header->time[5];
326 326
327 327 // (4) SEND PACKET
328 328 status = rtems_message_queue_send( queue_id, spw_ioctl_send, ACTION_MSG_SPW_IOCTL_SEND_SIZE);
@@ -395,6 +395,7 void BP_init_header_with_spare(Header_TM
395 395 header->time[0] = 0x00;
396 396 header->time[0] = 0x00;
397 397 header->time[0] = 0x00;
398 header->source_data_spare = 0x00;
398 399 header->pa_lfr_bp_blk_nr[0] = 0x00; // BLK_NR MSB
399 400 header->pa_lfr_bp_blk_nr[1] = blkNr; // BLK_NR LSB
400 401 }
@@ -532,7 +532,7 int enter_mode( unsigned char mode, unsi
532 532 #endif
533 533 status = restart_science_tasks( mode );
534 534 launch_waveform_picker( mode, transitionCoarseTime );
535 // launch_spectral_matrix( );
535 launch_spectral_matrix( );
536 536 launch_spectral_matrix_simu( );
537 537 }
538 538 else if ( mode == LFR_MODE_STANDBY )
General Comments 0
You need to be logged in to leave comments. Login now