##// END OF EJS Templates
Integration of basic parameters functions in the flight software...
paul -
r179:f0fdfd2b8c4c VHDL_0_1_28
parent child
Show More
@@ -0,0 +1,191
1 # This file was generated by an application wizard of Qt Creator.
2 # The code below handles deployment to Android and Maemo, aswell as copying
3 # of the application data to shadow build directories on desktop.
4 # It is recommended not to modify this file, since newer versions of Qt Creator
5 # may offer an updated version of it.
6
7 defineTest(qtcAddDeployment) {
8 for(deploymentfolder, DEPLOYMENTFOLDERS) {
9 item = item$${deploymentfolder}
10 greaterThan(QT_MAJOR_VERSION, 4) {
11 itemsources = $${item}.files
12 } else {
13 itemsources = $${item}.sources
14 }
15 $$itemsources = $$eval($${deploymentfolder}.source)
16 itempath = $${item}.path
17 $$itempath= $$eval($${deploymentfolder}.target)
18 export($$itemsources)
19 export($$itempath)
20 DEPLOYMENT += $$item
21 }
22
23 MAINPROFILEPWD = $$PWD
24
25 android-no-sdk {
26 for(deploymentfolder, DEPLOYMENTFOLDERS) {
27 item = item$${deploymentfolder}
28 itemfiles = $${item}.files
29 $$itemfiles = $$eval($${deploymentfolder}.source)
30 itempath = $${item}.path
31 $$itempath = /data/user/qt/$$eval($${deploymentfolder}.target)
32 export($$itemfiles)
33 export($$itempath)
34 INSTALLS += $$item
35 }
36
37 target.path = /data/user/qt
38
39 export(target.path)
40 INSTALLS += target
41 } else:android {
42 for(deploymentfolder, DEPLOYMENTFOLDERS) {
43 item = item$${deploymentfolder}
44 itemfiles = $${item}.files
45 $$itemfiles = $$eval($${deploymentfolder}.source)
46 itempath = $${item}.path
47 $$itempath = /assets/$$eval($${deploymentfolder}.target)
48 export($$itemfiles)
49 export($$itempath)
50 INSTALLS += $$item
51 }
52
53 x86 {
54 target.path = /libs/x86
55 } else: armeabi-v7a {
56 target.path = /libs/armeabi-v7a
57 } else {
58 target.path = /libs/armeabi
59 }
60
61 export(target.path)
62 INSTALLS += target
63 } else:win32 {
64 copyCommand =
65 for(deploymentfolder, DEPLOYMENTFOLDERS) {
66 source = $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source)
67 source = $$replace(source, /, \\)
68 sourcePathSegments = $$split(source, \\)
69 target = $$OUT_PWD/$$eval($${deploymentfolder}.target)/$$last(sourcePathSegments)
70 target = $$replace(target, /, \\)
71 target ~= s,\\\\\\.?\\\\,\\,
72 !isEqual(source,$$target) {
73 !isEmpty(copyCommand):copyCommand += &&
74 isEqual(QMAKE_DIR_SEP, \\) {
75 copyCommand += $(COPY_DIR) \"$$source\" \"$$target\"
76 } else {
77 source = $$replace(source, \\\\, /)
78 target = $$OUT_PWD/$$eval($${deploymentfolder}.target)
79 target = $$replace(target, \\\\, /)
80 copyCommand += test -d \"$$target\" || mkdir -p \"$$target\" && cp -r \"$$source\" \"$$target\"
81 }
82 }
83 }
84 !isEmpty(copyCommand) {
85 copyCommand = @echo Copying application data... && $$copyCommand
86 copydeploymentfolders.commands = $$copyCommand
87 first.depends = $(first) copydeploymentfolders
88 export(first.depends)
89 export(copydeploymentfolders.commands)
90 QMAKE_EXTRA_TARGETS += first copydeploymentfolders
91 }
92 } else:ios {
93 copyCommand =
94 for(deploymentfolder, DEPLOYMENTFOLDERS) {
95 source = $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source)
96 source = $$replace(source, \\\\, /)
97 target = $CODESIGNING_FOLDER_PATH/$$eval($${deploymentfolder}.target)
98 target = $$replace(target, \\\\, /)
99 sourcePathSegments = $$split(source, /)
100 targetFullPath = $$target/$$last(sourcePathSegments)
101 targetFullPath ~= s,/\\.?/,/,
102 !isEqual(source,$$targetFullPath) {
103 !isEmpty(copyCommand):copyCommand += &&
104 copyCommand += mkdir -p \"$$target\"
105 copyCommand += && cp -r \"$$source\" \"$$target\"
106 }
107 }
108 !isEmpty(copyCommand) {
109 copyCommand = echo Copying application data... && $$copyCommand
110 !isEmpty(QMAKE_POST_LINK): QMAKE_POST_LINK += ";"
111 QMAKE_POST_LINK += "$$copyCommand"
112 export(QMAKE_POST_LINK)
113 }
114 } else:unix {
115 maemo5 {
116 desktopfile.files = $${TARGET}.desktop
117 desktopfile.path = /usr/share/applications/hildon
118 icon.files = $${TARGET}64.png
119 icon.path = /usr/share/icons/hicolor/64x64/apps
120 } else:!isEmpty(MEEGO_VERSION_MAJOR) {
121 desktopfile.files = $${TARGET}_harmattan.desktop
122 desktopfile.path = /usr/share/applications
123 icon.files = $${TARGET}80.png
124 icon.path = /usr/share/icons/hicolor/80x80/apps
125 } else { # Assumed to be a Desktop Unix
126 copyCommand =
127 for(deploymentfolder, DEPLOYMENTFOLDERS) {
128 source = $$MAINPROFILEPWD/$$eval($${deploymentfolder}.source)
129 source = $$replace(source, \\\\, /)
130 macx {
131 target = $$OUT_PWD/$${TARGET}.app/Contents/Resources/$$eval($${deploymentfolder}.target)
132 } else {
133 target = $$OUT_PWD/$$eval($${deploymentfolder}.target)
134 }
135 target = $$replace(target, \\\\, /)
136 sourcePathSegments = $$split(source, /)
137 targetFullPath = $$target/$$last(sourcePathSegments)
138 targetFullPath ~= s,/\\.?/,/,
139 !isEqual(source,$$targetFullPath) {
140 !isEmpty(copyCommand):copyCommand += &&
141 copyCommand += $(MKDIR) \"$$target\"
142 copyCommand += && $(COPY_DIR) \"$$source\" \"$$target\"
143 }
144 }
145 !isEmpty(copyCommand) {
146 copyCommand = @echo Copying application data... && $$copyCommand
147 copydeploymentfolders.commands = $$copyCommand
148 first.depends = $(first) copydeploymentfolders
149 export(first.depends)
150 export(copydeploymentfolders.commands)
151 QMAKE_EXTRA_TARGETS += first copydeploymentfolders
152 }
153 }
154 !isEmpty(target.path) {
155 installPrefix = $${target.path}
156 } else {
157 installPrefix = /opt/$${TARGET}
158 }
159 for(deploymentfolder, DEPLOYMENTFOLDERS) {
160 item = item$${deploymentfolder}
161 itemfiles = $${item}.files
162 $$itemfiles = $$eval($${deploymentfolder}.source)
163 itempath = $${item}.path
164 $$itempath = $${installPrefix}/$$eval($${deploymentfolder}.target)
165 export($$itemfiles)
166 export($$itempath)
167 INSTALLS += $$item
168 }
169
170 !isEmpty(desktopfile.path) {
171 export(icon.files)
172 export(icon.path)
173 export(desktopfile.files)
174 export(desktopfile.path)
175 INSTALLS += icon desktopfile
176 }
177
178 isEmpty(target.path) {
179 target.path = $${installPrefix}/bin
180 export(target.path)
181 }
182 INSTALLS += target
183 }
184
185 export (ICON)
186 export (INSTALLS)
187 export (DEPLOYMENT)
188 export (LIBS)
189 export (QMAKE_EXTRA_TARGETS)
190 }
191
@@ -0,0 +1,13
1 TEMPLATE = app
2 CONFIG += console
3 CONFIG -= app_bundle
4 CONFIG -= qt
5
6 SOURCES += main.c
7
8 include(deployment.pri)
9 qtcAddDeployment()
10
11 HEADERS += \
12 functions.h
13
@@ -0,0 +1,65
1 #define NB_VALUES_PER_SM 25
2 #define NB_BINS_PER_SM 128
3
4 #define NB_BINS_COMPRESSED_SM_F0 11
5 #define ASM_F0_INDICE_START 17 // 88 bins
6 #define ASM_F0_INDICE_STOP 104 // 2 packets of 44 bins
7 #define NB_BINS_TO_AVERAGE_ASM_F0 8
8
9 void ASM_reorganize_and_divide( float *averaged_spec_mat, float *averaged_spec_mat_reorganized, float divider )
10 {
11 int frequencyBin;
12 int asmComponent;
13 unsigned int offsetASM;
14 unsigned int offsetASMReorganized;
15
16 // BUILD DATA
17 for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++)
18 {
19 for( frequencyBin = 0; frequencyBin < NB_BINS_PER_SM; frequencyBin++ )
20 {
21 offsetASMReorganized =
22 frequencyBin * NB_VALUES_PER_SM
23 + asmComponent;
24 offsetASM =
25 asmComponent * NB_BINS_PER_SM
26 + frequencyBin;
27 averaged_spec_mat_reorganized[offsetASMReorganized ] =
28 averaged_spec_mat[ offsetASM ] / divider;
29 }
30 }
31 }
32
33 void ASM_compress_reorganize_and_divide(float *averaged_spec_mat, float *compressed_spec_mat , float divider,
34 unsigned char nbBinsCompressedMatrix, unsigned char nbBinsToAverage, unsigned char ASMIndexStart )
35 {
36 int frequencyBin;
37 int asmComponent;
38 int offsetASM;
39 int offsetCompressed;
40 int k;
41
42 // BUILD DATA
43 for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++)
44 {
45 for( frequencyBin = 0; frequencyBin < nbBinsCompressedMatrix; frequencyBin++ )
46 {
47 offsetCompressed = // NO TIME OFFSET
48 frequencyBin * NB_VALUES_PER_SM
49 + asmComponent;
50 offsetASM = // NO TIME OFFSET
51 asmComponent * NB_BINS_PER_SM
52 + ASMIndexStart
53 + frequencyBin * nbBinsToAverage;
54 compressed_spec_mat[ offsetCompressed ] = 0;
55 for ( k = 0; k < nbBinsToAverage; k++ )
56 {
57 compressed_spec_mat[offsetCompressed ] =
58 ( compressed_spec_mat[ offsetCompressed ]
59 + averaged_spec_mat[ offsetASM + k ] );
60 }
61 compressed_spec_mat[ offsetCompressed ] =
62 compressed_spec_mat[ offsetCompressed ] / (divider * nbBinsToAverage);
63 }
64 }
65 }
@@ -0,0 +1,64
1 #include <stdio.h>
2
3 #include "functions.h"
4
5 int main(void)
6 {
7 printf("Hello World!\n");
8
9 unsigned int asmComponent;
10 unsigned int frequencyBin;
11 unsigned int offset_input_ASM;
12
13 float input_ASM [ NB_VALUES_PER_SM * NB_BINS_PER_SM ];
14 float output_ASM [ NB_VALUES_PER_SM * NB_BINS_PER_SM ];
15 float output_ASM_compressed [ NB_VALUES_PER_SM * NB_BINS_COMPRESSED_SM_F0 ];
16
17 //*******
18 // TEST 1
19
20 offset_input_ASM = 0;
21
22 for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++)
23 {
24 for (frequencyBin = 0; frequencyBin < NB_BINS_PER_SM; frequencyBin++)
25 {
26 offset_input_ASM = asmComponent * NB_BINS_PER_SM + frequencyBin;
27 input_ASM[ offset_input_ASM ] = asmComponent;
28 }
29 }
30
31 ASM_reorganize_and_divide( input_ASM, output_ASM,
32 1 ); // divider
33
34 ASM_compress_reorganize_and_divide( input_ASM, output_ASM_compressed,
35 1, // divider
36 NB_BINS_COMPRESSED_SM_F0,
37 NB_BINS_TO_AVERAGE_ASM_F0,
38 ASM_F0_INDICE_START);
39
40 //*******
41 // TEST 2
42 offset_input_ASM = 0;
43
44 for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++)
45 {
46 for (frequencyBin = 0; frequencyBin < NB_BINS_PER_SM; frequencyBin++)
47 {
48 offset_input_ASM = asmComponent * NB_BINS_PER_SM + frequencyBin;
49 input_ASM[ offset_input_ASM ] = asmComponent * NB_BINS_PER_SM + frequencyBin;
50 }
51 }
52
53 ASM_reorganize_and_divide( input_ASM, output_ASM,
54 1 ); // divider
55
56 ASM_compress_reorganize_and_divide( input_ASM, output_ASM_compressed,
57 10, // divider
58 NB_BINS_COMPRESSED_SM_F0,
59 NB_BINS_TO_AVERAGE_ASM_F0,
60 ASM_F0_INDICE_START);
61
62 return 0;
63 }
64
@@ -1,2 +1,2
1 19349b3a5e90c2bacc9d369aa948c68aa9e8d5f0 LFR_basic-parameters
1 a309a930a482e851061936696121f4a1cf7005de LFR_basic-parameters
2 da5613aff4446e5c98b3c56bc32ce7008b3e2340 header/lfr_common_headers
2 2b5dc338fb623046072d6eb98c26ad884e17f95e header/lfr_common_headers
@@ -12,7 +12,7 SWVERSION=-1-0
12 DEFINES += SW_VERSION_N1=2 # major
12 DEFINES += SW_VERSION_N1=2 # major
13 DEFINES += SW_VERSION_N2=0 # minor
13 DEFINES += SW_VERSION_N2=0 # minor
14 DEFINES += SW_VERSION_N3=2 # patch
14 DEFINES += SW_VERSION_N3=2 # patch
15 DEFINES += SW_VERSION_N4=0 # internal
15 DEFINES += SW_VERSION_N4=1 # internal
16
16
17 # <GCOV>
17 # <GCOV>
18 #QMAKE_CFLAGS_RELEASE += -fprofile-arcs -ftest-coverage
18 #QMAKE_CFLAGS_RELEASE += -fprofile-arcs -ftest-coverage
@@ -28,6 +28,7 contains( CONFIG, lpp_dpu_destid ) {
28 contains( CONFIG, debug_tch ) {
28 contains( CONFIG, debug_tch ) {
29 DEFINES += DEBUG_TCH
29 DEFINES += DEBUG_TCH
30 }
30 }
31 DEFINES += LSB_FIRST_TCH
31
32
32 contains( CONFIG, vhdl_dev ) {
33 contains( CONFIG, vhdl_dev ) {
33 DEFINES += VHDL_DEV
34 DEFINES += VHDL_DEV
@@ -64,7 +65,7 INCLUDEPATH += \
64 $${PWD}/../header \
65 $${PWD}/../header \
65 $${PWD}/../header/lfr_common_headers \
66 $${PWD}/../header/lfr_common_headers \
66 $${PWD}/../header/processing \
67 $${PWD}/../header/processing \
67 $${PWD}/../src/LFR_basic-parameters
68 $${PWD}/../LFR_basic-parameters
68
69
69 SOURCES += \
70 SOURCES += \
70 ../src/wf_handler.c \
71 ../src/wf_handler.c \
@@ -81,7 +82,7 SOURCES += \
81 ../src/processing/avf1_prc1.c \
82 ../src/processing/avf1_prc1.c \
82 ../src/processing/avf2_prc2.c \
83 ../src/processing/avf2_prc2.c \
83 ../src/lfr_cpu_usage_report.c \
84 ../src/lfr_cpu_usage_report.c \
84 ../src/LFR_basic-parameters/basic_parameters.c
85 ../LFR_basic-parameters/basic_parameters.c
85
86
86 HEADERS += \
87 HEADERS += \
87 ../header/wf_handler.h \
88 ../header/wf_handler.h \
@@ -99,12 +100,12 HEADERS += \
99 ../header/processing/avf2_prc2.h \
100 ../header/processing/avf2_prc2.h \
100 ../header/fsw_params_wf_handler.h \
101 ../header/fsw_params_wf_handler.h \
101 ../header/lfr_cpu_usage_report.h \
102 ../header/lfr_cpu_usage_report.h \
102 ../src/LFR_basic-parameters/basic_parameters.h \
103 ../src/LFR_basic-parameters/basic_parameters_params.h \
104 ../header/lfr_common_headers/ccsds_types.h \
103 ../header/lfr_common_headers/ccsds_types.h \
105 ../header/lfr_common_headers/fsw_params.h \
104 ../header/lfr_common_headers/fsw_params.h \
106 ../header/lfr_common_headers/fsw_params_nb_bytes.h \
105 ../header/lfr_common_headers/fsw_params_nb_bytes.h \
107 ../header/lfr_common_headers/fsw_params_processing.h \
106 ../header/lfr_common_headers/fsw_params_processing.h \
108 ../header/lfr_common_headers/TC_types.h \
107 ../header/lfr_common_headers/TC_types.h \
109 ../header/lfr_common_headers/tm_byte_positions.h
108 ../header/lfr_common_headers/tm_byte_positions.h \
109 ../LFR_basic-parameters/basic_parameters.h \
110 ../LFR_basic-parameters/basic_parameters_params.h
110
111
@@ -90,6 +90,10 typedef struct{
90 volatile unsigned int f3_1_fine_time; // 0x88
90 volatile unsigned int f3_1_fine_time; // 0x88
91 //
91 //
92 unsigned int buffer_length; // 0x8c = buffer length in burst 2688 / 16 = 168
92 unsigned int buffer_length; // 0x8c = buffer length in burst 2688 / 16 = 168
93 //
94 volatile unsigned int v; // 0x90
95 volatile unsigned int e1; // 0x94
96 volatile unsigned int e2; // 0x98
93 } waveform_picker_regs_0_1_18_t;
97 } waveform_picker_regs_0_1_18_t;
94
98
95 typedef struct {
99 typedef struct {
@@ -111,7 +115,7 typedef struct {
111 volatile unsigned int f1_0_coarse_time; // 0x30
115 volatile unsigned int f1_0_coarse_time; // 0x30
112 volatile unsigned int f1_0_fine_time; // 0x34
116 volatile unsigned int f1_0_fine_time; // 0x34
113 volatile unsigned int f1_1_coarse_time; // 0x38
117 volatile unsigned int f1_1_coarse_time; // 0x38
114 volatile unsigned int f1_1_time_time; // 0x3C
118 volatile unsigned int f1_1_fine_time; // 0x3C
115 //
119 //
116 volatile unsigned int f2_0_coarse_time; // 0x40
120 volatile unsigned int f2_0_coarse_time; // 0x40
117 volatile unsigned int f2_0_fine_time; // 0x44
121 volatile unsigned int f2_0_fine_time; // 0x44
@@ -27,10 +27,11 rtems_task prc0_task( rtems_task_argumen
27 // FUNCTIONS
27 // FUNCTIONS
28
28
29 void reset_nb_sm_f0( unsigned char lfrMode );
29 void reset_nb_sm_f0( unsigned char lfrMode );
30 void init_k_coefficients_f0( void );
31 void test_TCH( void );
30
32
31 //*******
33 //*******
32 // EXTERN
34 // EXTERN
33 extern ring_node *ring_node_for_averaging_sm_f0;
34 extern rtems_status_code get_message_queue_id_prc0( rtems_id *queue_id );
35 extern rtems_status_code get_message_queue_id_prc0( rtems_id *queue_id );
35
36
36 #endif // AVF0_PRC0_H_INCLUDED
37 #endif // AVF0_PRC0_H_INCLUDED
@@ -2,6 +2,7
2 #define AVF1_PRC1_H
2 #define AVF1_PRC1_H
3
3
4 #include "fsw_processing.h"
4 #include "fsw_processing.h"
5 #include "basic_parameters.h"
5
6
6 typedef struct {
7 typedef struct {
7 unsigned int norm_bp1;
8 unsigned int norm_bp1;
@@ -24,10 +25,10 rtems_task prc1_task( rtems_task_argumen
24 // FUNCTIONS
25 // FUNCTIONS
25
26
26 void reset_nb_sm_f1( unsigned char lfrMode );
27 void reset_nb_sm_f1( unsigned char lfrMode );
28 void init_k_coefficients_f1( void );
27
29
28 //*******
30 //*******
29 // EXTERN
31 // EXTERN
30 extern struct ring_node *ring_node_for_averaging_sm_f1;
31 extern rtems_status_code get_message_queue_id_prc1( rtems_id *queue_id );
32 extern rtems_status_code get_message_queue_id_prc1( rtems_id *queue_id );
32
33
33 #endif // AVF1_PRC1_H
34 #endif // AVF1_PRC1_H
@@ -2,6 +2,7
2 #define AVF2_PRC2_H
2 #define AVF2_PRC2_H
3
3
4 #include "fsw_processing.h"
4 #include "fsw_processing.h"
5 #include "basic_parameters.h"
5
6
6 typedef struct {
7 typedef struct {
7 unsigned int norm_bp1;
8 unsigned int norm_bp1;
@@ -18,11 +19,11 rtems_task prc2_task( rtems_task_argumen
18 // FUNCTIONS
19 // FUNCTIONS
19
20
20 void reset_nb_sm_f2( void );
21 void reset_nb_sm_f2( void );
21 void SM_average_f2(float *averaged_spec_mat_f2, ring_node *ring_node, unsigned int nbAverageNormF2 );
22 void SM_average_f2(float *averaged_spec_mat_f2, ring_node *ring_node, unsigned int nbAverageNormF2 , asm_msg *msgForMATR);
23 void init_k_coefficients_f2( void );
22
24
23 //*******
25 //*******
24 // EXTERN
26 // EXTERN
25 extern struct ring_node *ring_node_for_averaging_sm_f2;
26 extern rtems_status_code get_message_queue_id_prc2( rtems_id *queue_id );
27 extern rtems_status_code get_message_queue_id_prc2( rtems_id *queue_id );
27
28
28 #endif // AVF2_PRC2_H
29 #endif // AVF2_PRC2_H
@@ -21,7 +21,25 typedef struct ring_node_asm
21
21
22 typedef struct
22 typedef struct
23 {
23 {
24 Header_TM_LFR_SCIENCE_BP_t header;
24 unsigned char targetLogicalAddress;
25 unsigned char protocolIdentifier;
26 unsigned char reserved;
27 unsigned char userApplication;
28 unsigned char packetID[2];
29 unsigned char packetSequenceControl[2];
30 unsigned char packetLength[2];
31 // DATA FIELD HEADER
32 unsigned char spare1_pusVersion_spare2;
33 unsigned char serviceType;
34 unsigned char serviceSubType;
35 unsigned char destinationID;
36 unsigned char time[6];
37 // AUXILIARY HEADER
38 unsigned char sid;
39 unsigned char biaStatusInfo;
40 unsigned char acquisitionTime[6];
41 unsigned char pa_lfr_bp_blk_nr[2];
42 // SOURCE DATA
25 unsigned char data[ 30 * 22 ]; // MAX size is 22 * 30 [TM_LFR_SCIENCE_BURST_BP2_F1]
43 unsigned char data[ 30 * 22 ]; // MAX size is 22 * 30 [TM_LFR_SCIENCE_BURST_BP2_F1]
26 } bp_packet;
44 } bp_packet;
27
45
@@ -36,8 +54,10 typedef struct
36 ring_node_asm *norm;
54 ring_node_asm *norm;
37 ring_node_asm *burst_sbm;
55 ring_node_asm *burst_sbm;
38 rtems_event_set event;
56 rtems_event_set event;
39 unsigned int coarseTime;
57 unsigned int coarseTimeNORM;
40 unsigned int fineTime;
58 unsigned int fineTimeNORM;
59 unsigned int coarseTimeSBM;
60 unsigned int fineTimeSBM;
41 } asm_msg;
61 } asm_msg;
42
62
43 extern volatile int sm_f0[ ];
63 extern volatile int sm_f0[ ];
@@ -49,11 +69,13 extern struct param_local_str param_loca
49
69
50 // registers
70 // registers
51 extern time_management_regs_t *time_management_regs;
71 extern time_management_regs_t *time_management_regs;
52 extern spectral_matrix_regs_t *spectral_matrix_regs;
72 extern volatile spectral_matrix_regs_t *spectral_matrix_regs;
53
73
54 extern rtems_name misc_name[5];
74 extern rtems_name misc_name[5];
55 extern rtems_id Task_id[20]; /* array of task ids */
75 extern rtems_id Task_id[20]; /* array of task ids */
56
76
77 //
78 ring_node * getRingNodeForAveraging( unsigned char frequencyChannel);
57 // ISR
79 // ISR
58 rtems_isr spectral_matrices_isr( rtems_vector_number vector );
80 rtems_isr spectral_matrices_isr( rtems_vector_number vector );
59 rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector );
81 rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector );
@@ -71,7 +93,7 void ASM_generic_init_ring(ring_node_asm
71 // Basic Parameters
93 // Basic Parameters
72
94
73 void BP_reset_current_ring_nodes( void );
95 void BP_reset_current_ring_nodes( void );
74 void BP_init_header( Header_TM_LFR_SCIENCE_BP_t *header,
96 void BP_init_header(bp_packet *header,
75 unsigned int apid, unsigned char sid,
97 unsigned int apid, unsigned char sid,
76 unsigned int packetLength , unsigned char blkNr);
98 unsigned int packetLength , unsigned char blkNr);
77 void BP_init_header_with_spare( Header_TM_LFR_SCIENCE_BP_with_spare_t *header,
99 void BP_init_header_with_spare( Header_TM_LFR_SCIENCE_BP_with_spare_t *header,
@@ -87,8 +109,6 void reset_sm_status( void );
87 void reset_spectral_matrix_regs( void );
109 void reset_spectral_matrix_regs( void );
88 void set_time(unsigned char *time, unsigned char *timeInBuffer );
110 void set_time(unsigned char *time, unsigned char *timeInBuffer );
89 unsigned long long int get_acquisition_time( unsigned char *timePtr );
111 unsigned long long int get_acquisition_time( unsigned char *timePtr );
90 void close_matrix_actions( unsigned int *nb_sm, unsigned int nb_sm_before_avf, rtems_id avf_task_id,
91 ring_node *node_for_averaging, ring_node *ringNode, unsigned long long int time );
92 unsigned char getSID( rtems_event_set event );
112 unsigned char getSID( rtems_event_set event );
93
113
94 extern rtems_status_code get_message_queue_id_prc1( rtems_id *queue_id );
114 extern rtems_status_code get_message_queue_id_prc1( rtems_id *queue_id );
@@ -97,11 +117,12 extern rtems_status_code get_message_que
97 //***************************************
117 //***************************************
98 // DEFINITIONS OF STATIC INLINE FUNCTIONS
118 // DEFINITIONS OF STATIC INLINE FUNCTIONS
99 static inline void SM_average(float *averaged_spec_mat_NORM, float *averaged_spec_mat_SBM,
119 static inline void SM_average(float *averaged_spec_mat_NORM, float *averaged_spec_mat_SBM,
100 ring_node *ring_node_tab[],
120 ring_node *ring_node_tab[],
101 unsigned int nbAverageNORM, unsigned int nbAverageSBM );
121 unsigned int nbAverageNORM, unsigned int nbAverageSBM,
122 asm_msg *msgForMATR );
102 static inline void SM_average_debug( float *averaged_spec_mat_NORM, float *averaged_spec_mat_SBM,
123 static inline void SM_average_debug( float *averaged_spec_mat_NORM, float *averaged_spec_mat_SBM,
103 ring_node *ring_node_tab[],
124 ring_node *ring_node_tab[],
104 unsigned int nbAverageNORM, unsigned int nbAverageSBM );
125 unsigned int nbAverageNORM, unsigned int nbAverageSBM );
105 static inline void ASM_reorganize_and_divide(float *averaged_spec_mat, float *averaged_spec_mat_reorganized,
126 static inline void ASM_reorganize_and_divide(float *averaged_spec_mat, float *averaged_spec_mat_reorganized,
106 float divider );
127 float divider );
107 static inline void ASM_compress_reorganize_and_divide(float *averaged_spec_mat, float *compressed_spec_mat,
128 static inline void ASM_compress_reorganize_and_divide(float *averaged_spec_mat, float *compressed_spec_mat,
@@ -110,8 +131,9 static inline void ASM_compress_reorgani
110 static inline void ASM_convert(volatile float *input_matrix, char *output_matrix);
131 static inline void ASM_convert(volatile float *input_matrix, char *output_matrix);
111
132
112 void SM_average( float *averaged_spec_mat_NORM, float *averaged_spec_mat_SBM,
133 void SM_average( float *averaged_spec_mat_NORM, float *averaged_spec_mat_SBM,
113 ring_node *ring_node_tab[],
134 ring_node *ring_node_tab[],
114 unsigned int nbAverageNORM, unsigned int nbAverageSBM )
135 unsigned int nbAverageNORM, unsigned int nbAverageSBM,
136 asm_msg *msgForMATR )
115 {
137 {
116 float sum;
138 float sum;
117 unsigned int i;
139 unsigned int i;
@@ -131,6 +153,10 void SM_average( float *averaged_spec_ma
131 {
153 {
132 averaged_spec_mat_NORM[ i ] = sum;
154 averaged_spec_mat_NORM[ i ] = sum;
133 averaged_spec_mat_SBM[ i ] = sum;
155 averaged_spec_mat_SBM[ i ] = sum;
156 msgForMATR->coarseTimeNORM = ring_node_tab[0]->coarseTime;
157 msgForMATR->fineTimeNORM = ring_node_tab[0]->fineTime;
158 msgForMATR->coarseTimeSBM = ring_node_tab[0]->coarseTime;
159 msgForMATR->fineTimeSBM = ring_node_tab[0]->fineTime;
134 }
160 }
135 else if ( (nbAverageNORM != 0) && (nbAverageSBM != 0) )
161 else if ( (nbAverageNORM != 0) && (nbAverageSBM != 0) )
136 {
162 {
@@ -141,6 +167,8 void SM_average( float *averaged_spec_ma
141 {
167 {
142 averaged_spec_mat_NORM[ i ] = ( averaged_spec_mat_NORM[ i ] + sum );
168 averaged_spec_mat_NORM[ i ] = ( averaged_spec_mat_NORM[ i ] + sum );
143 averaged_spec_mat_SBM[ i ] = sum;
169 averaged_spec_mat_SBM[ i ] = sum;
170 msgForMATR->coarseTimeSBM = ring_node_tab[0]->coarseTime;
171 msgForMATR->fineTimeSBM = ring_node_tab[0]->fineTime;
144 }
172 }
145 else
173 else
146 {
174 {
@@ -186,21 +214,22 void ASM_reorganize_and_divide( float *a
186 {
214 {
187 int frequencyBin;
215 int frequencyBin;
188 int asmComponent;
216 int asmComponent;
189 unsigned int offsetAveragedSpecMatReorganized;
217 unsigned int offsetASM;
190 unsigned int offsetAveragedSpecMat;
218 unsigned int offsetASMReorganized;
191
219
220 // BUILD DATA
192 for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++)
221 for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++)
193 {
222 {
194 for( frequencyBin = 0; frequencyBin < NB_BINS_PER_SM; frequencyBin++ )
223 for( frequencyBin = 0; frequencyBin < NB_BINS_PER_SM; frequencyBin++ )
195 {
224 {
196 offsetAveragedSpecMatReorganized =
225 offsetASMReorganized =
197 frequencyBin * NB_VALUES_PER_SM
226 frequencyBin * NB_VALUES_PER_SM
198 + asmComponent;
227 + asmComponent;
199 offsetAveragedSpecMat =
228 offsetASM =
200 asmComponent * NB_BINS_PER_SM
229 asmComponent * NB_BINS_PER_SM
201 + frequencyBin;
230 + frequencyBin;
202 averaged_spec_mat_reorganized[offsetAveragedSpecMatReorganized ] =
231 averaged_spec_mat_reorganized[offsetASMReorganized ] =
203 averaged_spec_mat[ offsetAveragedSpecMat ] / divider;
232 averaged_spec_mat[ offsetASM ] / divider;
204 }
233 }
205 }
234 }
206 }
235 }
@@ -214,7 +243,7 void ASM_compress_reorganize_and_divide(
214 int offsetCompressed;
243 int offsetCompressed;
215 int k;
244 int k;
216
245
217 // build data
246 // BUILD DATA
218 for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++)
247 for (asmComponent = 0; asmComponent < NB_VALUES_PER_SM; asmComponent++)
219 {
248 {
220 for( frequencyBin = 0; frequencyBin < nbBinsCompressedMatrix; frequencyBin++ )
249 for( frequencyBin = 0; frequencyBin < nbBinsCompressedMatrix; frequencyBin++ )
@@ -231,8 +260,10 void ASM_compress_reorganize_and_divide(
231 {
260 {
232 compressed_spec_mat[offsetCompressed ] =
261 compressed_spec_mat[offsetCompressed ] =
233 ( compressed_spec_mat[ offsetCompressed ]
262 ( compressed_spec_mat[ offsetCompressed ]
234 + averaged_spec_mat[ offsetASM + k ] ) / (divider * nbBinsToAverage);
263 + averaged_spec_mat[ offsetASM + k ] );
235 }
264 }
265 compressed_spec_mat[ offsetCompressed ] =
266 compressed_spec_mat[ offsetCompressed ] / (divider * nbBinsToAverage);
236 }
267 }
237 }
268 }
238 }
269 }
@@ -108,6 +108,9 rtems_task Init( rtems_task_argument ign
108 init_parameter_dump();
108 init_parameter_dump();
109 init_local_mode_parameters();
109 init_local_mode_parameters();
110 init_housekeeping_parameters();
110 init_housekeeping_parameters();
111 init_k_coefficients_f0();
112 init_k_coefficients_f1();
113 init_k_coefficients_f2();
111
114
112 // waveform picker initialization
115 // waveform picker initialization
113 WFP_init_rings(); // initialize the waveform rings
116 WFP_init_rings(); // initialize the waveform rings
@@ -215,6 +218,8 rtems_task Init( rtems_task_argument ign
215
218
216 BOOT_PRINTF("delete INIT\n")
219 BOOT_PRINTF("delete INIT\n")
217
220
221 // test_TCH();
222
218 status = rtems_task_delete(RTEMS_SELF);
223 status = rtems_task_delete(RTEMS_SELF);
219
224
220 }
225 }
@@ -225,7 +225,7 rtems_task hous_task(rtems_task_argument
225
225
226 spacewire_update_statistics();
226 spacewire_update_statistics();
227
227
228 // get_v_e1_e2_f3( housekeeping_packet.hk_lfr_sc_v_f3 );
228 get_v_e1_e2_f3( housekeeping_packet.hk_lfr_sc_v_f3 );
229 get_cpu_load( (unsigned char *) &housekeeping_packet.hk_lfr_cpu_load );
229 get_cpu_load( (unsigned char *) &housekeeping_packet.hk_lfr_cpu_load );
230
230
231 // SEND PACKET
231 // SEND PACKET
@@ -443,107 +443,20 void send_dumb_hk( void )
443
443
444 void get_v_e1_e2_f3( unsigned char *spacecraft_potential )
444 void get_v_e1_e2_f3( unsigned char *spacecraft_potential )
445 {
445 {
446 unsigned long long int localTime_asLong;
446 unsigned char* v_ptr;
447 unsigned long long int f3_0_AcquisitionTime_asLong;
447 unsigned char* e1_ptr;
448 unsigned long long int f3_1_AcquisitionTime_asLong;
448 unsigned char* e2_ptr;
449 unsigned long long int deltaT;
450 unsigned long long int deltaT_f3_0;
451 unsigned long long int deltaT_f3_1;
452 unsigned char *bufferPtr;
453
454 unsigned int offset_in_samples;
455 unsigned int offset_in_bytes;
456 unsigned char f3;
457
458 bufferPtr = NULL;
459 deltaT = 0;
460 deltaT_f3_0 = 0xffffffff;
461 deltaT_f3_1 = 0xffffffff;
462 f3 = 16; // v, e1 and e2 will be picked up each second, f3 = 16 Hz
463
464 if (lfrCurrentMode == LFR_MODE_STANDBY)
465 {
466 spacecraft_potential[0] = 0x00;
467 spacecraft_potential[1] = 0x00;
468 spacecraft_potential[2] = 0x00;
469 spacecraft_potential[3] = 0x00;
470 spacecraft_potential[4] = 0x00;
471 spacecraft_potential[5] = 0x00;
472 }
473 else
474 {
475 localTime_asLong = get_acquisition_time( (unsigned char *) &time_management_regs->coarse_time );
476 f3_0_AcquisitionTime_asLong = get_acquisition_time( (unsigned char *) &waveform_picker_regs->f3_0_coarse_time );
477 f3_1_AcquisitionTime_asLong = get_acquisition_time( (unsigned char *) &waveform_picker_regs->f3_1_coarse_time );
478 printf("localTime 0x%llx, f3_0 0x%llx, f3_1 0x%llx\n",
479 localTime_asLong,
480 f3_0_AcquisitionTime_asLong,
481 f3_1_AcquisitionTime_asLong);
482
483 if ( localTime_asLong >= f3_0_AcquisitionTime_asLong )
484 {
485 deltaT_f3_0 = localTime_asLong - f3_0_AcquisitionTime_asLong;
486 }
487
488 if ( localTime_asLong > f3_1_AcquisitionTime_asLong )
489 {
490 deltaT_f3_1 = localTime_asLong - f3_1_AcquisitionTime_asLong;
491 }
492
449
493 if ( (deltaT_f3_0 != 0xffffffff) && (deltaT_f3_1 != 0xffffffff) )
450 v_ptr = (unsigned char *) &waveform_picker_regs->v;
494 {
451 e1_ptr = (unsigned char *) &waveform_picker_regs->e1;
495 if ( deltaT_f3_0 > deltaT_f3_1 )
452 e2_ptr = (unsigned char *) &waveform_picker_regs->e2;
496 {
497 deltaT = deltaT_f3_1;
498 bufferPtr = (unsigned char*) waveform_picker_regs->addr_data_f3_1;
499 }
500 else
501 {
502 deltaT = deltaT_f3_0;
503 bufferPtr = (unsigned char*) waveform_picker_regs->addr_data_f3_0;