##// END OF EJS Templates
ICD 4.1 taken into account
paul -
r283:c0251025dc7b R3_plus draft
parent child
Show More
@@ -1,2 +1,2
1 3081d1f9bb20b2b64a192585337a292a9804e0c5 LFR_basic-parameters
1 3081d1f9bb20b2b64a192585337a292a9804e0c5 LFR_basic-parameters
2 c3197ff831df5057bdd145a4efd94ded0618661f header/lfr_common_headers
2 81c3289ebd2a13e3b3147acdf60e34678378f905 header/lfr_common_headers
@@ -1,124 +1,123
1 TEMPLATE = app
1 TEMPLATE = app
2 # CONFIG += console v8 sim
2 # CONFIG += console v8 sim
3 # CONFIG options =
3 # CONFIG options =
4 # verbose
4 # verbose
5 # boot_messages
5 # boot_messages
6 # debug_messages
6 # debug_messages
7 # cpu_usage_report
7 # cpu_usage_report
8 # stack_report
8 # stack_report
9 # vhdl_dev
9 # vhdl_dev
10 # debug_tch
10 # debug_tch
11 # lpp_dpu_destid /!\ REMOVE BEFORE DELIVERY TO LESIA /!\
11 # lpp_dpu_destid /!\ REMOVE BEFORE DELIVERY TO LESIA /!\
12 # debug_watchdog
12 # debug_watchdog
13 CONFIG += console verbose lpp_dpu_destid
13 CONFIG += console verbose lpp_dpu_destid
14 CONFIG -= qt
14 CONFIG -= qt
15
15
16 include(./sparc.pri)
16 include(./sparc.pri)
17
17
18 # flight software version
18 # flight software version
19 SWVERSION=-1-0
19 SWVERSION=-1-0
20 DEFINES += SW_VERSION_N1=3 # major
20 DEFINES += SW_VERSION_N1=3 # major
21 DEFINES += SW_VERSION_N2=1 # minor
21 DEFINES += SW_VERSION_N2=1 # minor
22 DEFINES += SW_VERSION_N3=0 # patch
22 DEFINES += SW_VERSION_N3=0 # patch
23 DEFINES += SW_VERSION_N4=0 # internal
23 DEFINES += SW_VERSION_N4=0 # internal
24
24
25 # <GCOV>
25 # <GCOV>
26 #QMAKE_CFLAGS_RELEASE += -fprofile-arcs -ftest-coverage
26 #QMAKE_CFLAGS_RELEASE += -fprofile-arcs -ftest-coverage
27 #LIBS += -lgcov /opt/GCOV/01A/lib/overload.o -lc
27 #LIBS += -lgcov /opt/GCOV/01A/lib/overload.o -lc
28 # </GCOV>
28 # </GCOV>
29
29
30 # <CHANGE BEFORE FLIGHT>
30 # <CHANGE BEFORE FLIGHT>
31 contains( CONFIG, lpp_dpu_destid ) {
31 contains( CONFIG, lpp_dpu_destid ) {
32 DEFINES += LPP_DPU_DESTID
32 DEFINES += LPP_DPU_DESTID
33 }
33 }
34 # </CHANGE BEFORE FLIGHT>
34 # </CHANGE BEFORE FLIGHT>
35
35
36 contains( CONFIG, debug_tch ) {
36 contains( CONFIG, debug_tch ) {
37 DEFINES += DEBUG_TCH
37 DEFINES += DEBUG_TCH
38 }
38 }
39 DEFINES += MSB_FIRST_TCH
39 DEFINES += MSB_FIRST_TCH
40
40
41 contains( CONFIG, vhdl_dev ) {
41 contains( CONFIG, vhdl_dev ) {
42 DEFINES += VHDL_DEV
42 DEFINES += VHDL_DEV
43 }
43 }
44
44
45 contains( CONFIG, verbose ) {
45 contains( CONFIG, verbose ) {
46 DEFINES += PRINT_MESSAGES_ON_CONSOLE
46 DEFINES += PRINT_MESSAGES_ON_CONSOLE
47 }
47 }
48
48
49 contains( CONFIG, debug_messages ) {
49 contains( CONFIG, debug_messages ) {
50 DEFINES += DEBUG_MESSAGES
50 DEFINES += DEBUG_MESSAGES
51 }
51 }
52
52
53 contains( CONFIG, cpu_usage_report ) {
53 contains( CONFIG, cpu_usage_report ) {
54 DEFINES += PRINT_TASK_STATISTICS
54 DEFINES += PRINT_TASK_STATISTICS
55 }
55 }
56
56
57 contains( CONFIG, stack_report ) {
57 contains( CONFIG, stack_report ) {
58 DEFINES += PRINT_STACK_REPORT
58 DEFINES += PRINT_STACK_REPORT
59 }
59 }
60
60
61 contains( CONFIG, boot_messages ) {
61 contains( CONFIG, boot_messages ) {
62 DEFINES += BOOT_MESSAGES
62 DEFINES += BOOT_MESSAGES
63 }
63 }
64
64
65 contains( CONFIG, debug_watchdog ) {
65 contains( CONFIG, debug_watchdog ) {
66 DEFINES += DEBUG_WATCHDOG
66 DEFINES += DEBUG_WATCHDOG
67 }
67 }
68
68
69 #doxygen.target = doxygen
69 #doxygen.target = doxygen
70 #doxygen.commands = doxygen ../doc/Doxyfile
70 #doxygen.commands = doxygen ../doc/Doxyfile
71 #QMAKE_EXTRA_TARGETS += doxygen
71 #QMAKE_EXTRA_TARGETS += doxygen
72
72
73 TARGET = fsw
73 TARGET = fsw
74
74
75 INCLUDEPATH += \
75 INCLUDEPATH += \
76 $${PWD}/../src \
76 $${PWD}/../src \
77 $${PWD}/../header \
77 $${PWD}/../header \
78 $${PWD}/../header/lfr_common_headers \
78 $${PWD}/../header/lfr_common_headers \
79 $${PWD}/../header/processing \
79 $${PWD}/../header/processing \
80 $${PWD}/../LFR_basic-parameters
80 $${PWD}/../LFR_basic-parameters
81
81
82 SOURCES += \
82 SOURCES += \
83 ../src/wf_handler.c \
83 ../src/wf_handler.c \
84 ../src/tc_handler.c \
84 ../src/tc_handler.c \
85 ../src/fsw_misc.c \
85 ../src/fsw_misc.c \
86 ../src/fsw_init.c \
86 ../src/fsw_init.c \
87 ../src/fsw_globals.c \
87 ../src/fsw_globals.c \
88 ../src/fsw_spacewire.c \
88 ../src/fsw_spacewire.c \
89 ../src/tc_load_dump_parameters.c \
89 ../src/tc_load_dump_parameters.c \
90 ../src/tm_lfr_tc_exe.c \
90 ../src/tm_lfr_tc_exe.c \
91 ../src/tc_acceptance.c \
91 ../src/tc_acceptance.c \
92 ../src/processing/fsw_processing.c \
92 ../src/processing/fsw_processing.c \
93 ../src/processing/avf0_prc0.c \
93 ../src/processing/avf0_prc0.c \
94 ../src/processing/avf1_prc1.c \
94 ../src/processing/avf1_prc1.c \
95 ../src/processing/avf2_prc2.c \
95 ../src/processing/avf2_prc2.c \
96 ../src/lfr_cpu_usage_report.c \
96 ../src/lfr_cpu_usage_report.c \
97 ../LFR_basic-parameters/basic_parameters.c
97 ../LFR_basic-parameters/basic_parameters.c
98
98
99 HEADERS += \
99 HEADERS += \
100 ../header/wf_handler.h \
100 ../header/wf_handler.h \
101 ../header/tc_handler.h \
101 ../header/tc_handler.h \
102 ../header/grlib_regs.h \
102 ../header/grlib_regs.h \
103 ../header/fsw_misc.h \
103 ../header/fsw_misc.h \
104 ../header/fsw_init.h \
104 ../header/fsw_init.h \
105 ../header/fsw_spacewire.h \
105 ../header/fsw_spacewire.h \
106 ../header/tc_load_dump_parameters.h \
106 ../header/tc_load_dump_parameters.h \
107 ../header/tm_lfr_tc_exe.h \
107 ../header/tm_lfr_tc_exe.h \
108 ../header/tc_acceptance.h \
108 ../header/tc_acceptance.h \
109 ../header/processing/fsw_processing.h \
109 ../header/processing/fsw_processing.h \
110 ../header/processing/avf0_prc0.h \
110 ../header/processing/avf0_prc0.h \
111 ../header/processing/avf1_prc1.h \
111 ../header/processing/avf1_prc1.h \
112 ../header/processing/avf2_prc2.h \
112 ../header/processing/avf2_prc2.h \
113 ../header/fsw_params_wf_handler.h \
113 ../header/fsw_params_wf_handler.h \
114 ../header/lfr_cpu_usage_report.h \
114 ../header/lfr_cpu_usage_report.h \
115 ../header/lfr_common_headers/ccsds_types.h \
115 ../header/lfr_common_headers/ccsds_types.h \
116 ../header/lfr_common_headers/fsw_params.h \
116 ../header/lfr_common_headers/fsw_params.h \
117 ../header/lfr_common_headers/fsw_params_nb_bytes.h \
117 ../header/lfr_common_headers/fsw_params_nb_bytes.h \
118 ../header/lfr_common_headers/fsw_params_processing.h \
118 ../header/lfr_common_headers/fsw_params_processing.h \
119 ../header/lfr_common_headers/TC_types.h \
120 ../header/lfr_common_headers/tm_byte_positions.h \
119 ../header/lfr_common_headers/tm_byte_positions.h \
121 ../LFR_basic-parameters/basic_parameters.h \
120 ../LFR_basic-parameters/basic_parameters.h \
122 ../LFR_basic-parameters/basic_parameters_params.h \
121 ../LFR_basic-parameters/basic_parameters_params.h \
123 ../header/GscMemoryLPP.hpp
122 ../header/GscMemoryLPP.hpp
124
123
@@ -1,54 +1,63
1 #ifndef FSW_INIT_H_INCLUDED
1 #ifndef FSW_INIT_H_INCLUDED
2 #define FSW_INIT_H_INCLUDED
2 #define FSW_INIT_H_INCLUDED
3
3
4 #include <rtems.h>
4 #include <rtems.h>
5 #include <leon.h>
5 #include <leon.h>
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"
9 #include "fsw_processing.h"
10
10
11 #include "tc_handler.h"
11 #include "tc_handler.h"
12 #include "wf_handler.h"
12 #include "wf_handler.h"
13 #include "fsw_spacewire.h"
13 #include "fsw_spacewire.h"
14
14
15 #include "avf0_prc0.h"
15 #include "avf0_prc0.h"
16 #include "avf1_prc1.h"
16 #include "avf1_prc1.h"
17 #include "avf2_prc2.h"
17 #include "avf2_prc2.h"
18
18
19 extern rtems_name Task_name[20]; /* array of task names */
19 extern rtems_name Task_name[20]; /* array of task names */
20 extern rtems_id Task_id[20]; /* array of task ids */
20 extern rtems_id Task_id[20]; /* array of task ids */
21 extern rtems_name timecode_timer_name;
21 extern rtems_name timecode_timer_name;
22 extern rtems_id timecode_timer_id;
22 extern rtems_id timecode_timer_id;
23 extern unsigned char pa_bia_status_info;
23 extern unsigned char pa_bia_status_info;
24 extern unsigned char cp_rpw_sc_rw_f_flags;
25 extern float cp_rpw_sc_rw1_f1;
26 extern float cp_rpw_sc_rw1_f2;
27 extern float cp_rpw_sc_rw2_f1;
28 extern float cp_rpw_sc_rw2_f2;
29 extern float cp_rpw_sc_rw3_f1;
30 extern float cp_rpw_sc_rw3_f2;
31 extern float cp_rpw_sc_rw4_f1;
32 extern float cp_rpw_sc_rw4_f2;
24
33
25 // RTEMS TASKS
34 // RTEMS TASKS
26 rtems_task Init( rtems_task_argument argument);
35 rtems_task Init( rtems_task_argument argument);
27
36
28 // OTHER functions
37 // OTHER functions
29 void create_names( void );
38 void create_names( void );
30 int create_all_tasks( void );
39 int create_all_tasks( void );
31 int start_all_tasks( void );
40 int start_all_tasks( void );
32 //
41 //
33 rtems_status_code create_message_queues( void );
42 rtems_status_code create_message_queues( void );
34 rtems_status_code create_timecode_timer( void );
43 rtems_status_code create_timecode_timer( void );
35 rtems_status_code get_message_queue_id_send( rtems_id *queue_id );
44 rtems_status_code get_message_queue_id_send( rtems_id *queue_id );
36 rtems_status_code get_message_queue_id_recv( rtems_id *queue_id );
45 rtems_status_code get_message_queue_id_recv( rtems_id *queue_id );
37 rtems_status_code get_message_queue_id_prc0( rtems_id *queue_id );
46 rtems_status_code get_message_queue_id_prc0( rtems_id *queue_id );
38 rtems_status_code get_message_queue_id_prc1( rtems_id *queue_id );
47 rtems_status_code get_message_queue_id_prc1( rtems_id *queue_id );
39 rtems_status_code get_message_queue_id_prc2( rtems_id *queue_id );
48 rtems_status_code get_message_queue_id_prc2( rtems_id *queue_id );
40 void update_queue_max_count( rtems_id queue_id, unsigned char*fifo_size_max );
49 void update_queue_max_count( rtems_id queue_id, unsigned char*fifo_size_max );
41 void init_ring(ring_node ring[], unsigned char nbNodes, volatile int buffer[], unsigned int bufferSize );
50 void init_ring(ring_node ring[], unsigned char nbNodes, volatile int buffer[], unsigned int bufferSize );
42 //
51 //
43 int start_recv_send_tasks( void );
52 int start_recv_send_tasks( void );
44 //
53 //
45 void init_local_mode_parameters( void );
54 void init_local_mode_parameters( void );
46 void reset_local_time( void );
55 void reset_local_time( void );
47
56
48 extern void rtems_cpu_usage_report( void );
57 extern void rtems_cpu_usage_report( void );
49 extern void rtems_cpu_usage_reset( void );
58 extern void rtems_cpu_usage_reset( void );
50 extern void rtems_stack_checker_report_usage( void );
59 extern void rtems_stack_checker_report_usage( void );
51
60
52 extern int sched_yield( void );
61 extern int sched_yield( void );
53
62
54 #endif // FSW_INIT_H_INCLUDED
63 #endif // FSW_INIT_H_INCLUDED
@@ -1,332 +1,335
1 #ifndef FSW_PROCESSING_H_INCLUDED
1 #ifndef FSW_PROCESSING_H_INCLUDED
2 #define FSW_PROCESSING_H_INCLUDED
2 #define FSW_PROCESSING_H_INCLUDED
3
3
4 #include <rtems.h>
4 #include <rtems.h>
5 #include <grspw.h>
5 #include <grspw.h>
6 #include <math.h>
6 #include <math.h>
7 #include <stdlib.h> // abs() is in the stdlib
7 #include <stdlib.h> // abs() is in the stdlib
8 #include <stdio.h>
8 #include <stdio.h>
9 #include <math.h>
9 #include <math.h>
10 #include <grlib_regs.h>
10 #include <grlib_regs.h>
11
11
12 #include "fsw_params.h"
12 #include "fsw_params.h"
13
13
14 typedef struct ring_node_asm
14 typedef struct ring_node_asm
15 {
15 {
16 struct ring_node_asm *next;
16 struct ring_node_asm *next;
17 float matrix[ TOTAL_SIZE_SM ];
17 float matrix[ TOTAL_SIZE_SM ];
18 unsigned int status;
18 unsigned int status;
19 } ring_node_asm;
19 } ring_node_asm;
20
20
21 typedef struct
21 typedef struct
22 {
22 {
23 unsigned char targetLogicalAddress;
23 unsigned char targetLogicalAddress;
24 unsigned char protocolIdentifier;
24 unsigned char protocolIdentifier;
25 unsigned char reserved;
25 unsigned char reserved;
26 unsigned char userApplication;
26 unsigned char userApplication;
27 unsigned char packetID[2];
27 unsigned char packetID[2];
28 unsigned char packetSequenceControl[2];
28 unsigned char packetSequenceControl[2];
29 unsigned char packetLength[2];
29 unsigned char packetLength[2];
30 // DATA FIELD HEADER
30 // DATA FIELD HEADER
31 unsigned char spare1_pusVersion_spare2;
31 unsigned char spare1_pusVersion_spare2;
32 unsigned char serviceType;
32 unsigned char serviceType;
33 unsigned char serviceSubType;
33 unsigned char serviceSubType;
34 unsigned char destinationID;
34 unsigned char destinationID;
35 unsigned char time[6];
35 unsigned char time[6];
36 // AUXILIARY HEADER
36 // AUXILIARY HEADER
37 unsigned char sid;
37 unsigned char sid;
38 unsigned char biaStatusInfo;
38 unsigned char pa_bia_status_info;
39 unsigned char sy_lfr_common_parameters_spare;
39 unsigned char sy_lfr_common_parameters_spare;
40 unsigned char sy_lfr_common_parameters;
40 unsigned char sy_lfr_common_parameters;
41 unsigned char acquisitionTime[6];
41 unsigned char acquisitionTime[6];
42 unsigned char pa_lfr_bp_blk_nr[2];
42 unsigned char pa_lfr_bp_blk_nr[2];
43 // SOURCE DATA
43 // SOURCE DATA
44 unsigned char data[ 780 ]; // MAX size is 26 bins * 30 Bytes [TM_LFR_SCIENCE_BURST_BP2_F1]
44 unsigned char data[ 780 ]; // MAX size is 26 bins * 30 Bytes [TM_LFR_SCIENCE_BURST_BP2_F1]
45 } bp_packet;
45 } bp_packet;
46
46
47 typedef struct
47 typedef struct
48 {
48 {
49 unsigned char targetLogicalAddress;
49 unsigned char targetLogicalAddress;
50 unsigned char protocolIdentifier;
50 unsigned char protocolIdentifier;
51 unsigned char reserved;
51 unsigned char reserved;
52 unsigned char userApplication;
52 unsigned char userApplication;
53 unsigned char packetID[2];
53 unsigned char packetID[2];
54 unsigned char packetSequenceControl[2];
54 unsigned char packetSequenceControl[2];
55 unsigned char packetLength[2];
55 unsigned char packetLength[2];
56 // DATA FIELD HEADER
56 // DATA FIELD HEADER
57 unsigned char spare1_pusVersion_spare2;
57 unsigned char spare1_pusVersion_spare2;
58 unsigned char serviceType;
58 unsigned char serviceType;
59 unsigned char serviceSubType;
59 unsigned char serviceSubType;
60 unsigned char destinationID;
60 unsigned char destinationID;
61 unsigned char time[6];
61 unsigned char time[6];
62 // AUXILIARY HEADER
62 // AUXILIARY HEADER
63 unsigned char sid;
63 unsigned char sid;
64 unsigned char biaStatusInfo;
64 unsigned char pa_bia_status_info;
65 unsigned char sy_lfr_common_parameters_spare;
65 unsigned char sy_lfr_common_parameters_spare;
66 unsigned char sy_lfr_common_parameters;
66 unsigned char sy_lfr_common_parameters;
67 unsigned char acquisitionTime[6];
67 unsigned char acquisitionTime[6];
68 unsigned char source_data_spare;
68 unsigned char source_data_spare;
69 unsigned char pa_lfr_bp_blk_nr[2];
69 unsigned char pa_lfr_bp_blk_nr[2];
70 // SOURCE DATA
70 // SOURCE DATA
71 unsigned char data[ 143 ]; // 13 bins * 11 Bytes
71 unsigned char data[ 143 ]; // 13 bins * 11 Bytes
72 } bp_packet_with_spare; // only for TM_LFR_SCIENCE_NORMAL_BP1_F0 and F1
72 } bp_packet_with_spare; // only for TM_LFR_SCIENCE_NORMAL_BP1_F0 and F1
73
73
74 typedef struct asm_msg
74 typedef struct asm_msg
75 {
75 {
76 ring_node_asm *norm;
76 ring_node_asm *norm;
77 ring_node_asm *burst_sbm;
77 ring_node_asm *burst_sbm;
78 rtems_event_set event;
78 rtems_event_set event;
79 unsigned int coarseTimeNORM;
79 unsigned int coarseTimeNORM;
80 unsigned int fineTimeNORM;
80 unsigned int fineTimeNORM;
81 unsigned int coarseTimeSBM;
81 unsigned int coarseTimeSBM;
82 unsigned int fineTimeSBM;
82 unsigned int fineTimeSBM;
83 } asm_msg;
83 } asm_msg;
84
84
85 extern unsigned char thisIsAnASMRestart;
85 extern unsigned char thisIsAnASMRestart;
86
86
87 extern volatile int sm_f0[ ];
87 extern volatile int sm_f0[ ];
88 extern volatile int sm_f1[ ];
88 extern volatile int sm_f1[ ];
89 extern volatile int sm_f2[ ];
89 extern volatile int sm_f2[ ];
90
90
91 // parameters
91 // parameters
92 extern struct param_local_str param_local;
92 extern struct param_local_str param_local;
93 extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
93 extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
94 extern unsigned char rw_fbins_mask_f0[16];
95 extern unsigned char rw_fbins_mask_f1[16];
96 extern unsigned char rw_fbins_mask_f2[16];
94
97
95 // registers
98 // registers
96 extern time_management_regs_t *time_management_regs;
99 extern time_management_regs_t *time_management_regs;
97 extern volatile spectral_matrix_regs_t *spectral_matrix_regs;
100 extern volatile spectral_matrix_regs_t *spectral_matrix_regs;
98
101
99 extern rtems_name misc_name[5];
102 extern rtems_name misc_name[5];
100 extern rtems_id Task_id[20]; /* array of task ids */
103 extern rtems_id Task_id[20]; /* array of task ids */
101
104
102 ring_node * getRingNodeForAveraging( unsigned char frequencyChannel);
105 ring_node * getRingNodeForAveraging( unsigned char frequencyChannel);
103 // ISR
106 // ISR
104 rtems_isr spectral_matrices_isr( rtems_vector_number vector );
107 rtems_isr spectral_matrices_isr( rtems_vector_number vector );
105
108
106 //******************
109 //******************
107 // Spectral Matrices
110 // Spectral Matrices
108 void reset_nb_sm( void );
111 void reset_nb_sm( void );
109 // SM
112 // SM
110 void SM_init_rings( void );
113 void SM_init_rings( void );
111 void SM_reset_current_ring_nodes( void );
114 void SM_reset_current_ring_nodes( void );
112 // ASM
115 // ASM
113 void ASM_generic_init_ring(ring_node_asm *ring, unsigned char nbNodes );
116 void ASM_generic_init_ring(ring_node_asm *ring, unsigned char nbNodes );
114
117
115 //*****************
118 //*****************
116 // Basic Parameters
119 // Basic Parameters
117
120
118 void BP_reset_current_ring_nodes( void );
121 void BP_reset_current_ring_nodes( void );
119 void BP_init_header(bp_packet *packet,
122 void BP_init_header(bp_packet *packet,
120 unsigned int apid, unsigned char sid,
123 unsigned int apid, unsigned char sid,
121 unsigned int packetLength , unsigned char blkNr);
124 unsigned int packetLength , unsigned char blkNr);
122 void BP_init_header_with_spare(bp_packet_with_spare *packet,
125 void BP_init_header_with_spare(bp_packet_with_spare *packet,
123 unsigned int apid, unsigned char sid,
126 unsigned int apid, unsigned char sid,
124 unsigned int packetLength, unsigned char blkNr );
127 unsigned int packetLength, unsigned char blkNr );
125 void BP_send( char *data,
128 void BP_send( char *data,
126 rtems_id queue_id,
129 rtems_id queue_id,
127 unsigned int nbBytesToSend , unsigned int sid );
130 unsigned int nbBytesToSend , unsigned int sid );
128 void BP_send_s1_s2(char *data,
131 void BP_send_s1_s2(char *data,
129 rtems_id queue_id,
132 rtems_id queue_id,
130 unsigned int nbBytesToSend, unsigned int sid );
133 unsigned int nbBytesToSend, unsigned int sid );
131
134
132 //******************
135 //******************
133 // general functions
136 // general functions
134 void reset_sm_status( void );
137 void reset_sm_status( void );
135 void reset_spectral_matrix_regs( void );
138 void reset_spectral_matrix_regs( void );
136 void set_time(unsigned char *time, unsigned char *timeInBuffer );
139 void set_time(unsigned char *time, unsigned char *timeInBuffer );
137 unsigned long long int get_acquisition_time( unsigned char *timePtr );
140 unsigned long long int get_acquisition_time( unsigned char *timePtr );
138 unsigned char getSID( rtems_event_set event );
141 unsigned char getSID( rtems_event_set event );
139
142
140 extern rtems_status_code get_message_queue_id_prc1( rtems_id *queue_id );
143 extern rtems_status_code get_message_queue_id_prc1( rtems_id *queue_id );
141 extern rtems_status_code get_message_queue_id_prc2( rtems_id *queue_id );
144 extern rtems_status_code get_message_queue_id_prc2( rtems_id *queue_id );
142
145
143 //***************************************
146 //***************************************
144 // DEFINITIONS OF STATIC INLINE FUNCTIONS
147 // DEFINITIONS OF STATIC INLINE FUNCTIONS
145 static inline void SM_average(float *averaged_spec_mat_NORM, float *averaged_spec_mat_SBM,
148 static inline void SM_average(float *averaged_spec_mat_NORM, float *averaged_spec_mat_SBM,
146 ring_node *ring_node_tab[],
149 ring_node *ring_node_tab[],
147 unsigned int nbAverageNORM, unsigned int nbAverageSBM,
150 unsigned int nbAverageNORM, unsigned int nbAverageSBM,
148 asm_msg *msgForMATR );
151 asm_msg *msgForMATR );
149
152
150 static inline void SM_average_debug(float *averaged_spec_mat_NORM, float *averaged_spec_mat_SBM,
153 static inline void SM_average_debug(float *averaged_spec_mat_NORM, float *averaged_spec_mat_SBM,
151 ring_node *ring_node_tab[],
154 ring_node *ring_node_tab[],
152 unsigned int nbAverageNORM, unsigned int nbAverageSBM,
155 unsigned int nbAverageNORM, unsigned int nbAverageSBM,
153 asm_msg *msgForMATR );
156 asm_msg *msgForMATR );
154
157
155 void ASM_patch( float *inputASM, float *outputASM );
158 void ASM_patch( float *inputASM, float *outputASM );
156
159
157 void extractReImVectors(float *inputASM, float *outputASM, unsigned int asmComponent );
160 void extractReImVectors(float *inputASM, float *outputASM, unsigned int asmComponent );
158
161
159 static inline void ASM_reorganize_and_divide(float *averaged_spec_mat, float *averaged_spec_mat_reorganized,
162 static inline void ASM_reorganize_and_divide(float *averaged_spec_mat, float *averaged_spec_mat_reorganized,
160 float divider );
163 float divider );
161
164
162 static inline void ASM_compress_reorganize_and_divide(float *averaged_spec_mat, float *compressed_spec_mat,
165 static inline void ASM_compress_reorganize_and_divide(float *averaged_spec_mat, float *compressed_spec_mat,
163 float divider,
166 float divider,
164 unsigned char nbBinsCompressedMatrix, unsigned char nbBinsToAverage , unsigned char ASMIndexStart);
167 unsigned char nbBinsCompressedMatrix, unsigned char nbBinsToAverage , unsigned char ASMIndexStart);
165
168
166 static inline void ASM_convert(volatile float *input_matrix, char *output_matrix);
169 static inline void ASM_convert(volatile float *input_matrix, char *output_matrix);
167
170
168 void SM_average( float *averaged_spec_mat_NORM, float *averaged_spec_mat_SBM,
171 void SM_average( float *averaged_spec_mat_NORM, float *averaged_spec_mat_SBM,
169 ring_node *ring_node_tab[],
172 ring_node *ring_node_tab[],
170 unsigned int nbAverageNORM, unsigned int nbAverageSBM,
173 unsigned int nbAverageNORM, unsigned int nbAverageSBM,
171 asm_msg *msgForMATR )
174 asm_msg *msgForMATR )
172 {
175 {
173 float sum;
176 float sum;
174 unsigned int i;
177 unsigned int i;
175
178
176 for(i=0; i<TOTAL_SIZE_SM; i++)
179 for(i=0; i<TOTAL_SIZE_SM; i++)
177 {
180 {
178 sum = ( (int *) (ring_node_tab[0]->buffer_address) ) [ i ]
181 sum = ( (int *) (ring_node_tab[0]->buffer_address) ) [ i ]
179 + ( (int *) (ring_node_tab[1]->buffer_address) ) [ i ]
182 + ( (int *) (ring_node_tab[1]->buffer_address) ) [ i ]
180 + ( (int *) (ring_node_tab[2]->buffer_address) ) [ i ]
183 + ( (int *) (ring_node_tab[2]->buffer_address) ) [ i ]
181 + ( (int *) (ring_node_tab[3]->buffer_address) ) [ i ]
184 + ( (int *) (ring_node_tab[3]->buffer_address) ) [ i ]
182 + ( (int *) (ring_node_tab[4]->buffer_address) ) [ i ]
185 + ( (int *) (ring_node_tab[4]->buffer_address) ) [ i ]
183 + ( (int *) (ring_node_tab[5]->buffer_address) ) [ i ]
186 + ( (int *) (ring_node_tab[5]->buffer_address) ) [ i ]
184 + ( (int *) (ring_node_tab[6]->buffer_address) ) [ i ]
187 + ( (int *) (ring_node_tab[6]->buffer_address) ) [ i ]
185 + ( (int *) (ring_node_tab[7]->buffer_address) ) [ i ];
188 + ( (int *) (ring_node_tab[7]->buffer_address) ) [ i ];
186
189
187 if ( (nbAverageNORM == 0) && (nbAverageSBM == 0) )
190 if ( (nbAverageNORM == 0) && (nbAverageSBM == 0) )
188 {
191 {
189 averaged_spec_mat_NORM[ i ] = sum;
192 averaged_spec_mat_NORM[ i ] = sum;
190 averaged_spec_mat_SBM[ i ] = sum;
193 averaged_spec_mat_SBM[ i ] = sum;
191 msgForMATR->coarseTimeNORM = ring_node_tab[0]->coarseTime;
194 msgForMATR->coarseTimeNORM = ring_node_tab[0]->coarseTime;
192 msgForMATR->fineTimeNORM = ring_node_tab[0]->fineTime;
195 msgForMATR->fineTimeNORM = ring_node_tab[0]->fineTime;
193 msgForMATR->coarseTimeSBM = ring_node_tab[0]->coarseTime;
196 msgForMATR->coarseTimeSBM = ring_node_tab[0]->coarseTime;
194 msgForMATR->fineTimeSBM = ring_node_tab[0]->fineTime;
197 msgForMATR->fineTimeSBM = ring_node_tab[0]->fineTime;
195 }
198 }
196 else if ( (nbAverageNORM != 0) && (nbAverageSBM != 0) )
199 else if ( (nbAverageNORM != 0) && (nbAverageSBM != 0) )
197 {
200 {
198 averaged_spec_mat_NORM[ i ] = ( averaged_spec_mat_NORM[ i ] + sum );
201 averaged_spec_mat_NORM[ i ] = ( averaged_spec_mat_NORM[ i ] + sum );
199 averaged_spec_mat_SBM[ i ] = ( averaged_spec_mat_SBM[ i ] + sum );
202 averaged_spec_mat_SBM[ i ] = ( averaged_spec_mat_SBM[ i ] + sum );
200 }
203 }
201 else if ( (nbAverageNORM != 0) && (nbAverageSBM == 0) )
204 else if ( (nbAverageNORM != 0) && (nbAverageSBM == 0) )
202 {
205 {
203 averaged_spec_mat_NORM[ i ] = ( averaged_spec_mat_NORM[ i ] + sum );
206 averaged_spec_mat_NORM[ i ] = ( averaged_spec_mat_NORM[ i ] + sum );
204 averaged_spec_mat_SBM[ i ] = sum;
207 averaged_spec_mat_SBM[ i ] = sum;
205 msgForMATR->coarseTimeSBM = ring_node_tab[0]->coarseTime;
208 msgForMATR->coarseTimeSBM = ring_node_tab[0]->coarseTime;
206 msgForMATR->fineTimeSBM = ring_node_tab[0]->fineTime;
209 msgForMATR->fineTimeSBM = ring_node_tab[0]->fineTime;
207 }
210 }
208 else
211 else
209 {
212 {
210 averaged_spec_mat_NORM[ i ] = sum;
213 averaged_spec_mat_NORM[ i ] = sum;
211 averaged_spec_mat_SBM[ i ] = ( averaged_spec_mat_SBM[ i ] + sum );
214 averaged_spec_mat_SBM[ i ] = ( averaged_spec_mat_SBM[ i ] + sum );
212 msgForMATR->coarseTimeNORM = ring_node_tab[0]->coarseTime;
215 msgForMATR->coarseTimeNORM = ring_node_tab[0]->coarseTime;
213 msgForMATR->fineTimeNORM = ring_node_tab[0]->fineTime;
216 msgForMATR->fineTimeNORM = ring_node_tab[0]->fineTime;
214 // PRINTF2("ERR *** in SM_average *** unexpected parameters %d %d\n", nbAverageNORM, nbAverageSBM)
217 // PRINTF2("ERR *** in SM_average *** unexpected parameters %d %d\n", nbAverageNORM, nbAverageSBM)
215 }
218 }
216 }
219 }
217 }
220 }
218
221
219 void SM_average_debug( float *averaged_spec_mat_NORM, float *averaged_spec_mat_SBM,
222 void SM_average_debug( float *averaged_spec_mat_NORM, float *averaged_spec_mat_SBM,
220 ring_node *ring_node_tab[],
223 ring_node *ring_node_tab[],
221 unsigned int nbAverageNORM, unsigned int nbAverageSBM,
224 unsigned int nbAverageNORM, unsigned int nbAverageSBM,
222 asm_msg *msgForMATR )
225 asm_msg *msgForMATR )
223 {
226 {
224 float sum;
227 float sum;
225 unsigned int i;
228 unsigned int i;
226
229
227 for(i=0; i<TOTAL_SIZE_SM; i++)
230 for(i=0; i<TOTAL_SIZE_SM; i++)
228 {
231 {
229 sum = ( (int *) (ring_node_tab[0]->buffer_address) ) [ i ];
232 sum = ( (int *) (ring_node_tab[0]->buffer_address) ) [ i ];
230 averaged_spec_mat_NORM[ i ] = sum;
233 averaged_spec_mat_NORM[ i ] = sum;
231 averaged_spec_mat_SBM[ i ] = sum;
234 averaged_spec_mat_SBM[ i ] = sum;
232 msgForMATR->coarseTimeNORM = ring_node_tab[0]->coarseTime;
235 msgForMATR->coarseTimeNORM = ring_node_tab[0]->coarseTime;
233 msgForMATR->fineTimeNORM = ring_node_tab[0]->fineTime;
236 msgForMATR->fineTimeNORM = ring_node_tab[0]->fineTime;
234 msgForMATR->coarseTimeSBM = ring_node_tab[0]->coarseTime;
237 msgForMATR->coarseTimeSBM = ring_node_tab[0]->coarseTime;
235 msgForMATR->fineTimeSBM = ring_node_tab[0]->fineTime;
238 msgForMATR->fineTimeSBM = ring_node_tab[0]->fineTime;
236 }
239 }
237 }
240 }
238
241
239 void ASM_reorganize_and_divide( float *averaged_spec_mat, float *averaged_spec_mat_reorganized, float divider )
242 void ASM_reorganize_and_divide( float *averaged_spec_mat, float *averaged_spec_mat_reorganized, float divider )
240 {
243 {
241 int frequencyBin;
244 int frequencyBin;
242 int asmComponent;
245 int asmComponent;
243 unsigned int offsetASM;
246 unsigned int offsetASM;
244 unsigned int offsetASMReorganized;
247 unsigned int offsetASMReorganized;
245
248
246 // BUILD DATA
249 // BUILD DATA
247 for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++)
250 for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++)
248 {
251 {
249 for( frequencyBin = 0; frequencyBin < NB_BINS_PER_SM; frequencyBin++ )
252 for( frequencyBin = 0; frequencyBin < NB_BINS_PER_SM; frequencyBin++ )
250 {
253 {
251 offsetASMReorganized =
254 offsetASMReorganized =
252 frequencyBin * NB_VALUES_PER_SM
255 frequencyBin * NB_VALUES_PER_SM
253 + asmComponent;
256 + asmComponent;
254 offsetASM =
257 offsetASM =
255 asmComponent * NB_BINS_PER_SM
258 asmComponent * NB_BINS_PER_SM
256 + frequencyBin;
259 + frequencyBin;
257 averaged_spec_mat_reorganized[offsetASMReorganized ] =
260 averaged_spec_mat_reorganized[offsetASMReorganized ] =
258 averaged_spec_mat[ offsetASM ] / divider;
261 averaged_spec_mat[ offsetASM ] / divider;
259 }
262 }
260 }
263 }
261 }
264 }
262
265
263 void ASM_compress_reorganize_and_divide(float *averaged_spec_mat, float *compressed_spec_mat , float divider,
266 void ASM_compress_reorganize_and_divide(float *averaged_spec_mat, float *compressed_spec_mat , float divider,
264 unsigned char nbBinsCompressedMatrix, unsigned char nbBinsToAverage, unsigned char ASMIndexStart )
267 unsigned char nbBinsCompressedMatrix, unsigned char nbBinsToAverage, unsigned char ASMIndexStart )
265 {
268 {
266 int frequencyBin;
269 int frequencyBin;
267 int asmComponent;
270 int asmComponent;
268 int offsetASM;
271 int offsetASM;
269 int offsetCompressed;
272 int offsetCompressed;
270 int k;
273 int k;
271
274
272 // BUILD DATA
275 // BUILD DATA
273 for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++)
276 for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++)
274 {
277 {
275 for( frequencyBin = 0; frequencyBin < nbBinsCompressedMatrix; frequencyBin++ )
278 for( frequencyBin = 0; frequencyBin < nbBinsCompressedMatrix; frequencyBin++ )
276 {
279 {
277 offsetCompressed = // NO TIME OFFSET
280 offsetCompressed = // NO TIME OFFSET
278 frequencyBin * NB_VALUES_PER_SM
281 frequencyBin * NB_VALUES_PER_SM
279 + asmComponent;
282 + asmComponent;
280 offsetASM = // NO TIME OFFSET
283 offsetASM = // NO TIME OFFSET
281 asmComponent * NB_BINS_PER_SM
284 asmComponent * NB_BINS_PER_SM
282 + ASMIndexStart
285 + ASMIndexStart
283 + frequencyBin * nbBinsToAverage;
286 + frequencyBin * nbBinsToAverage;
284 compressed_spec_mat[ offsetCompressed ] = 0;
287 compressed_spec_mat[ offsetCompressed ] = 0;
285 for ( k = 0; k < nbBinsToAverage; k++ )
288 for ( k = 0; k < nbBinsToAverage; k++ )
286 {
289 {
287 compressed_spec_mat[offsetCompressed ] =
290 compressed_spec_mat[offsetCompressed ] =
288 ( compressed_spec_mat[ offsetCompressed ]
291 ( compressed_spec_mat[ offsetCompressed ]
289 + averaged_spec_mat[ offsetASM + k ] );
292 + averaged_spec_mat[ offsetASM + k ] );
290 }
293 }
291 compressed_spec_mat[ offsetCompressed ] =
294 compressed_spec_mat[ offsetCompressed ] =
292 compressed_spec_mat[ offsetCompressed ] / (divider * nbBinsToAverage);
295 compressed_spec_mat[ offsetCompressed ] / (divider * nbBinsToAverage);
293 }
296 }
294 }
297 }
295 }
298 }
296
299
297 void ASM_convert( volatile float *input_matrix, char *output_matrix)
300 void ASM_convert( volatile float *input_matrix, char *output_matrix)
298 {
301 {
299 unsigned int frequencyBin;
302 unsigned int frequencyBin;
300 unsigned int asmComponent;
303 unsigned int asmComponent;
301 char * pt_char_input;
304 char * pt_char_input;
302 char * pt_char_output;
305 char * pt_char_output;
303 unsigned int offsetInput;
306 unsigned int offsetInput;
304 unsigned int offsetOutput;
307 unsigned int offsetOutput;
305
308
306 pt_char_input = (char*) &input_matrix;
309 pt_char_input = (char*) &input_matrix;
307 pt_char_output = (char*) &output_matrix;
310 pt_char_output = (char*) &output_matrix;
308
311
309 // convert all other data
312 // convert all other data
310 for( frequencyBin=0; frequencyBin<NB_BINS_PER_SM; frequencyBin++)
313 for( frequencyBin=0; frequencyBin<NB_BINS_PER_SM; frequencyBin++)
311 {
314 {
312 for ( asmComponent=0; asmComponent<NB_VALUES_PER_SM; asmComponent++)
315 for ( asmComponent=0; asmComponent<NB_VALUES_PER_SM; asmComponent++)
313 {
316 {
314 offsetInput = (frequencyBin*NB_VALUES_PER_SM) + asmComponent ;
317 offsetInput = (frequencyBin*NB_VALUES_PER_SM) + asmComponent ;
315 offsetOutput = 2 * ( (frequencyBin*NB_VALUES_PER_SM) + asmComponent ) ;
318 offsetOutput = 2 * ( (frequencyBin*NB_VALUES_PER_SM) + asmComponent ) ;
316 pt_char_input = (char*) &input_matrix [ offsetInput ];
319 pt_char_input = (char*) &input_matrix [ offsetInput ];
317 pt_char_output = (char*) &output_matrix[ offsetOutput ];
320 pt_char_output = (char*) &output_matrix[ offsetOutput ];
318 pt_char_output[0] = pt_char_input[0]; // bits 31 downto 24 of the float
321 pt_char_output[0] = pt_char_input[0]; // bits 31 downto 24 of the float
319 pt_char_output[1] = pt_char_input[1]; // bits 23 downto 16 of the float
322 pt_char_output[1] = pt_char_input[1]; // bits 23 downto 16 of the float
320 }
323 }
321 }
324 }
322 }
325 }
323
326
324 void ASM_compress_reorganize_and_divide_mask(float *averaged_spec_mat, float *compressed_spec_mat,
327 void ASM_compress_reorganize_and_divide_mask(float *averaged_spec_mat, float *compressed_spec_mat,
325 float divider,
328 float divider,
326 unsigned char nbBinsCompressedMatrix, unsigned char nbBinsToAverage , unsigned char ASMIndexStart, unsigned char channel);
329 unsigned char nbBinsCompressedMatrix, unsigned char nbBinsToAverage , unsigned char ASMIndexStart, unsigned char channel);
327
330
328 int getFBinMask(int k, unsigned char channel);
331 int getFBinMask(int k, unsigned char channel);
329
332
330 void init_kcoeff_sbm_from_kcoeff_norm( float *input_kcoeff, float *output_kcoeff, unsigned char nb_bins_norm);
333 void init_kcoeff_sbm_from_kcoeff_norm( float *input_kcoeff, float *output_kcoeff, unsigned char nb_bins_norm);
331
334
332 #endif // FSW_PROCESSING_H_INCLUDED
335 #endif // FSW_PROCESSING_H_INCLUDED
@@ -1,76 +1,82
1 #ifndef TC_LOAD_DUMP_PARAMETERS_H
1 #ifndef TC_LOAD_DUMP_PARAMETERS_H
2 #define TC_LOAD_DUMP_PARAMETERS_H
2 #define TC_LOAD_DUMP_PARAMETERS_H
3
3
4 #include <rtems.h>
4 #include <rtems.h>
5 #include <stdio.h>
5 #include <stdio.h>
6
6
7 #include "fsw_params.h"
7 #include "fsw_params.h"
8 #include "wf_handler.h"
8 #include "wf_handler.h"
9 #include "tm_lfr_tc_exe.h"
9 #include "tm_lfr_tc_exe.h"
10 #include "fsw_misc.h"
10 #include "fsw_misc.h"
11 #include "basic_parameters_params.h"
11 #include "basic_parameters_params.h"
12 #include "avf0_prc0.h"
12 #include "avf0_prc0.h"
13
13
14 #define FLOAT_EQUAL_ZERO 0.001
14 #define FLOAT_EQUAL_ZERO 0.001
15
15
16 extern unsigned short sequenceCounterParameterDump;
16 extern unsigned short sequenceCounterParameterDump;
17 extern unsigned short sequenceCounters_TM_DUMP[];
17 extern unsigned short sequenceCounters_TM_DUMP[];
18 extern float k_coeff_intercalib_f0_norm[ ];
18 extern float k_coeff_intercalib_f0_norm[ ];
19 extern float k_coeff_intercalib_f0_sbm[ ];
19 extern float k_coeff_intercalib_f0_sbm[ ];
20 extern float k_coeff_intercalib_f1_norm[ ];
20 extern float k_coeff_intercalib_f1_norm[ ];
21 extern float k_coeff_intercalib_f1_sbm[ ];
21 extern float k_coeff_intercalib_f1_sbm[ ];
22 extern float k_coeff_intercalib_f2[ ];
22 extern float k_coeff_intercalib_f2[ ];
23 extern unsigned char rw_fbins_mask_f0[16];
24 extern unsigned char rw_fbins_mask_f1[16];
25 extern unsigned char rw_fbins_mask_f2[16];
23
26
24 int action_load_common_par( ccsdsTelecommandPacket_t *TC );
27 int action_load_common_par( ccsdsTelecommandPacket_t *TC );
25 int action_load_normal_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
28 int action_load_normal_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
26 int action_load_burst_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
29 int action_load_burst_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
27 int action_load_sbm1_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
30 int action_load_sbm1_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
28 int action_load_sbm2_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
31 int action_load_sbm2_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id , unsigned char *time);
29 int action_load_kcoefficients(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
32 int action_load_kcoefficients(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
30 int action_load_fbins_mask(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
33 int action_load_fbins_mask(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
31 int action_load_pas_filter_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
34 int action_load_filter_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
32 int action_dump_kcoefficients(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
35 int action_dump_kcoefficients(ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time);
33 int action_dump_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
36 int action_dump_par(ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
34
37
35 // NORMAL
38 // NORMAL
36 int check_normal_par_consistency( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
39 int check_normal_par_consistency( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
37 int set_sy_lfr_n_swf_l( ccsdsTelecommandPacket_t *TC );
40 int set_sy_lfr_n_swf_l( ccsdsTelecommandPacket_t *TC );
38 int set_sy_lfr_n_swf_p( ccsdsTelecommandPacket_t *TC );
41 int set_sy_lfr_n_swf_p( ccsdsTelecommandPacket_t *TC );
39 int set_sy_lfr_n_asm_p( ccsdsTelecommandPacket_t *TC );
42 int set_sy_lfr_n_asm_p( ccsdsTelecommandPacket_t *TC );
40 int set_sy_lfr_n_bp_p0( ccsdsTelecommandPacket_t *TC );
43 int