##// END OF EJS Templates

Compare Commits r371:88d90c878c97...r406:72f973a48116

Target:

Source:

Compare was calculated based on this common ancestor commit: 18e20227b986
Time Author Commit Description
35 commits hidden, click expand to show them.
Show file before | Show file after
@@ -0,0 +1,12
1 3236b2a1a6a04bc11754d3f995873876b5046183 3.2.0.17
2 ad411bb94578a052d1b4aa6b4c8a769fe2711072 3.2.0.18
3 a9b894b0ab6a8fa48f50ce3dd7200406b83e2a62 3.2.0.19
4 bd1252670981361939ed2a1c3febc94247019956 3.2.0.20
5 75028d90a6e75baf1aa7527b97013591d9fafd98 3.2.0.21
6 75028d90a6e75baf1aa7527b97013591d9fafd98 3.2.0.21
7 0000000000000000000000000000000000000000 3.2.0.21
8 0000000000000000000000000000000000000000 3.2.0.21
9 80625bfe25ced262a4ba0b0de08a15056797d15c 3.2.0.21
10 9d5e16586c2c299611cdf2e5115f7e5215f0ed3b 3.2.0.22
11 56ae035bb062f5b5e3ed35424d7ed20a4ffb01a7 3.2.0.23
12 f3243196bdc51bb43a2125ec79f8dfc4fad26992 3.2.0.24
Show file before | Show file after
@@ -0,0 +1,20
1 cmake_minimum_required(VERSION 3.5)
2 project(libgcov C)
3 include(sparc-rtems)
4 include(cppcheck)
5
6 set(LIB_GCOV_SOURCES
7 gcov-io.c
8 gcov-io.h
9 gcov-iov.h
10 libgcov.c
11 )
12 if(Coverage)
13 add_definitions(-DGCOV_USE_EXIT)
14 add_definitions(-DGCOV_ENABLED)
15 endif()
16 add_library(gcov STATIC ${LIB_GCOV_SOURCES})
17
18 add_custom_target(gcovr
19 COMMAND gcovr --exclude='.*gcov.*' --gcov-executable=${rtems_dir}/bin/sparc-rtems-gcov --object-directory ${CMAKE_BINARY_DIR} -r ${CMAKE_SOURCE_DIR} --html --html-details -o ${CMAKE_CURRENT_BINARY_DIR}/gcov.html && xdg-open ${CMAKE_CURRENT_BINARY_DIR}/gcov.html
20 )
Show file before | Show file after
@@ -0,0 +1,49
1 #!/usr/bin/env python3
2
3 __author__ = "Alexis Jeandet"
4 __copyright__ = "Copyright 2018, Laboratory of Plasma Physics"
5 __credits__ = []
6 __license__ = "GPLv2"
7 __version__ = "1.0.0"
8 __maintainer__ = "Alexis Jeandet"
9 __email__ = "alexis.jeandet@member.fsf.org"
10 __status__ = "Development"
11
12 import time
13 import sys
14 import os
15 import serial
16 import argparse
17 from datetime import datetime
18 import pathlib
19 from shutil import copyfile
20
21
22 parser = argparse.ArgumentParser()
23 parser.add_argument("-r", "--remove-prefix", help="Will remove given prefix path", default="")
24 parser.add_argument("-o", "--output-folder", help="Will prepend given path to gcda files", default="")
25 parser.add_argument("file", help="Gcov output file generated by record_lfr_console.py")
26 args = parser.parse_args()
27
28
29 def main():
30 with open(args.file, 'r') as gcov:
31 files = []
32 for line in gcov.readlines():
33 head, dest_file,data = line.split(',')
34 if dest_file not in files:
35 files.append(dest_file)
36 if head == '_GCOV_':
37 gcno_file = dest_file.replace(".gcda",".gcno")
38 dest_file = dest_file.replace(args.remove_prefix, args.output_folder)
39 pathlib.Path(os.path.dirname(dest_file)).mkdir(parents=True, exist_ok=True)
40 copyfile(gcno_file, gcno_file.replace(args.remove_prefix, args.output_folder))
41 print(f"Writing {dest_file}\n")
42 with open(dest_file,'wb') as gcda_file:
43 gcda_file.write(bytes([int(''.join(value),16) for value in zip(data[::2],data[1::2]) ]))
44 else:
45 raise
46
47
48 if __name__ == "__main__":
49 main()
Show file before | Show file after
@@ -0,0 +1,490
1 /* Test for GCC >= 3.4.4 && <= 4.4.6 */
2 //#if ( ( __GNUC__ > 3 ) || \
3 // ( __GNUC__ == 3 && __GNUC_MINOR__ > 4 )|| \
4 // ( __GNUC__ == 3 && __GNUC_MINOR__ == 4 && __GNUC_PATCHLEVEL__ >= 4 ) ) && \
5 // ( ( __GNUC__ < 4 ) || \
6 // ( __GNUC__ == 4 && __GNUC_MINOR__ < 4 )|| \
7 // ( __GNUC__ == 4 && __GNUC_MINOR__ == 4 && __GNUC_PATCHLEVEL__ <= 6 ) )
8 /*
9 * =====================================================================================
10 *
11 * Filename: gcov-io.c
12 *
13 * Description: This is the I/O file for embedded systems
14 *
15 * Version: 1.0
16 * Created: 03/04/08 09:51:59
17 * Revision: none
18 * Compiler: gcc
19 *
20 * Author: Aitor Viana Sanchez (avs), aitor.viana.sanchez@esa.int
21 * Company: European Space Agency (ESA-ESTEC)
22 *
23 * =====================================================================================
24 */
25
26 /* File format for coverage information
27 Copyright (C) 1996, 1997, 1998, 2000, 2002,
28 2003 Free Software Foundation, Inc.
29 Contributed by Bob Manson <manson@cygnus.com>.
30 Completely remangled by Nathan Sidwell <nathan@codesourcery.com>.
31
32 This file is part of GCC.
33
34 GCC is free software; you can redistribute it and/or modify it under
35 the terms of the GNU General Public License as published by the Free
36 Software Foundation; either version 2, or (at your option) any later
37 version.
38
39 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
40 WARRANTY; without even the implied warranty of MERCHANTABILITY or
41 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
42 for more details.
43
44 You should have received a copy of the GNU General Public License
45 along with GCC; see the file COPYING. If not, write to the Free
46 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
47 02111-1307, USA. */
48
49 #include <stdio.h>
50 #include <stdlib.h> /* for atexit() */
51 #include <string.h>
52 #include "gcov-io.h"
53
54 /* Routines declared in gcov-io.h. This file should be #included by
55 another source file, after having #included gcov-io.h. */
56
57
58 /* This function shall be defined somewhere else */
59 //int send_data(unsigned char * buffer, unsigned int size);
60
61 /*-----------------------------------------------------------------------------
62 * PRIVATE INTERFACE
63 *-----------------------------------------------------------------------------*/
64
65 static void gcov_write_block (unsigned);
66 static gcov_unsigned_t *gcov_write_words (unsigned);
67 GCOV_LINKAGE int gcov_send (void);
68 GCOV_LINKAGE int gcov_close(void);
69
70 extern struct gcov_info * gcov_list;
71 extern gcov_unsigned_t gcov_crc32;
72
73 int dev_id = 0;
74
75 /*
76 * === FUNCTION ======================================================================
77 * Name: from_file
78 * Description: This function just return the given parameter
79 * =====================================================================================
80 */
81 static inline gcov_unsigned_t from_file (gcov_unsigned_t value)
82 {
83 return value;
84 }
85
86 /*
87 * === FUNCTION ======================================================================
88 * Name: gcov_version
89 * Description: This function returns TRUE (1) if the gcov version is the
90 * version expected. The function returns FALSE (0) in any other case.
91 * =====================================================================================
92 */
93 static int gcov_version (struct gcov_info *ptr, gcov_unsigned_t version)
94 {
95 if (version != GCOV_VERSION)
96 {
97 char v[4], e[4];
98
99 GCOV_UNSIGNED2STRING (v, version);
100 GCOV_UNSIGNED2STRING (e, GCOV_VERSION);
101
102 printf ("profiling:%s:Version mismatch - expected %.4s got %.4s\n",
103 ptr->filename, e, v);
104
105 return 0;
106 }
107 return 1;
108 }
109
110
111 /*-----------------------------------------------------------------------------
112 * PUBLIC INTERFACE
113 *-----------------------------------------------------------------------------*/
114
115 /* Dump the coverage counts. We merge with existing counts when
116 possible, to avoid growing the .da files ad infinitum. We use this
117 program's checksum to make sure we only accumulate whole program
118 statistics to the correct summary. An object file might be embedded
119 in two separate programs, and we must keep the two program
120 summaries separate. */
121
122 /*
123 * === FUNCTION ======================================================================
124 * Name: gcov_exit
125 * Description: This function dumps the coverage couns. The merging with
126 * existing counts is not done in embedded systems.
127 * =====================================================================================
128 */
129 void gcov_exit (void)
130 {
131 struct gcov_info *gi_ptr;
132 struct gcov_summary this_program;
133 struct gcov_summary all;
134 struct gcov_ctr_summary *cs_ptr;
135 const struct gcov_ctr_info *ci_ptr;
136 unsigned t_ix;
137 gcov_unsigned_t c_num;
138 unsigned long coreId = 0;
139
140 /* retrieve the id of the CPU the program is running on */
141 #ifdef LEON3
142 __asm__ __volatile__("rd %%asr17,%0\n\t"
143 "srl %0,28,%0" :
144 "=&r" (coreId) : );
145 #endif
146
147 printf("_GCOVEXIT_BEGIN_,core%d\n", coreId); /* see also _GCOVEXIT_END_ */
148
149 if(gcov_list == (void*)0x0)
150 printf("%s: gcov_list == NULL\n", __func__);
151
152 memset (&all, 0, sizeof (all));
153 /* Find the totals for this execution. */
154 memset (&this_program, 0, sizeof (this_program));
155 for (gi_ptr = gcov_list; gi_ptr; gi_ptr = gi_ptr->next)
156 {
157
158 ci_ptr = gi_ptr->counts;
159 for (t_ix = 0; t_ix < GCOV_COUNTERS_SUMMABLE; t_ix++)
160 {
161 if (!((1 << t_ix) & gi_ptr->ctr_mask))
162 continue;
163
164 cs_ptr = &this_program.ctrs[t_ix];
165 cs_ptr->num += ci_ptr->num;
166 for (c_num = 0; c_num < ci_ptr->num; c_num++)
167 {
168 cs_ptr->sum_all += ci_ptr->values[c_num];
169 if (cs_ptr->run_max < ci_ptr->values[c_num])
170 cs_ptr->run_max = ci_ptr->values[c_num];
171 }
172 ci_ptr++;
173 }
174 }
175 /* Now merge each file. */
176 for (gi_ptr = gcov_list; gi_ptr; gi_ptr = gi_ptr->next)
177 {
178
179 struct gcov_summary program;
180 gcov_type *values[GCOV_COUNTERS];
181 const struct gcov_fn_info *fi_ptr;
182 unsigned fi_stride;
183 unsigned c_ix, f_ix, n_counts;
184
185 c_ix = 0;
186 for (t_ix = 0; t_ix < GCOV_COUNTERS; t_ix++)
187 if ((1 << t_ix) & gi_ptr->ctr_mask)
188 {
189 values[c_ix] = gi_ptr->counts[c_ix].values;
190 c_ix++;
191 }
192
193 /* Calculate the function_info stride. This depends on the
194 number of counter types being measured. */
195 fi_stride = sizeof (struct gcov_fn_info) + c_ix * sizeof (unsigned);
196 if (__alignof__ (struct gcov_fn_info) > sizeof (unsigned))
197 {
198 fi_stride += __alignof__ (struct gcov_fn_info) - 1;
199 fi_stride &= ~(__alignof__ (struct gcov_fn_info) - 1);
200 }
201
202 if (!gcov_open (gi_ptr->filename))
203 {
204 printf ("profiling:%s:Cannot open\n", gi_ptr->filename);
205 continue;
206 }
207
208 program.checksum = gcov_crc32;
209
210 /* Write out the data. */
211 gcov_write_tag_length (GCOV_DATA_MAGIC, GCOV_VERSION);
212 gcov_write_unsigned (gi_ptr->stamp);
213
214 /* Write execution counts for each function. */
215 for (f_ix = 0; f_ix < gi_ptr->n_functions; f_ix++)
216 {
217 fi_ptr = (const struct gcov_fn_info *)
218 ((const char *) gi_ptr->functions + f_ix * fi_stride);
219
220 /* Announce function. */
221 gcov_write_tag_length (GCOV_TAG_FUNCTION, GCOV_TAG_FUNCTION_LENGTH);
222 gcov_write_unsigned (fi_ptr->ident);
223 gcov_write_unsigned (fi_ptr->checksum);
224
225 c_ix = 0;
226 for (t_ix = 0; t_ix < GCOV_COUNTERS; t_ix++)
227 {
228 gcov_type *c_ptr;
229
230 if (!((1 << t_ix) & gi_ptr->ctr_mask))
231 continue;
232
233 n_counts = fi_ptr->n_ctrs[c_ix];
234
235 gcov_write_tag_length (GCOV_TAG_FOR_COUNTER (t_ix),
236 GCOV_TAG_COUNTER_LENGTH (n_counts));
237 c_ptr = values[c_ix];
238 while (n_counts--)
239 gcov_write_counter (*c_ptr++);
240
241 values[c_ix] = c_ptr;
242 c_ix++;
243 }
244 }
245
246 gcov_send();
247 gcov_close();
248
249 }
250
251 printf("_GCOVEXIT_END_,core%d\n", coreId);
252 }
253
254
255 /* Called before fork or exec - write out profile information gathered so
256 far and reset it to zero. This avoids duplication or loss of the
257 profile information gathered so far. */
258
259 void
260 __gcov_flush (void)
261 {
262 const struct gcov_info *gi_ptr;
263
264 gcov_exit ();
265 for (gi_ptr = gcov_list; gi_ptr; gi_ptr = gi_ptr->next)
266 {
267 unsigned t_ix;
268 const struct gcov_ctr_info *ci_ptr;
269
270 for (t_ix = 0, ci_ptr = gi_ptr->counts; t_ix != GCOV_COUNTERS; t_ix++)
271 if ((1 << t_ix) & gi_ptr->ctr_mask)
272 {
273 memset (ci_ptr->values, 0, sizeof (gcov_type) * ci_ptr->num);
274 ci_ptr++;
275 }
276 }
277 }
278
279
280
281 /* Open a gcov file. NAME is the name of the file to open and MODE
282 indicates whether a new file should be created, or an existing file
283 opened for modification. If MODE is >= 0 an existing file will be
284 opened, if possible, and if MODE is <= 0, a new file will be
285 created. Use MODE=0 to attempt to reopen an existing file and then
286 fall back on creating a new one. Return zero on failure, >0 on
287 opening an existing file and <0 on creating a new one. */
288 GCOV_LINKAGE int gcov_open(const char *name)
289 {
290 // gcov_var.start is cleared in the gcov_close function.
291 // If this variable is not cleared...ERROR
292 if( gcov_var.start != 0 )
293 return 0;
294
295 // Clear everything
296 gcov_var.start = 0;
297 gcov_var.offset = gcov_var.length = 0;
298 gcov_var.overread = -1u;
299 gcov_var.error = 0;
300
301
302 // copy the filename in the gcov_var structure
303 strcpy(gcov_var.filename, name);
304
305
306 // return 1 means everything is OK
307 return 1;
308 }
309
310 /* Close the current gcov file. Flushes data to disk. Returns nonzero
311 on failure or error flag set. */
312
313 GCOV_LINKAGE int gcov_send (void)
314 {
315 /*printf("%s: file %s\n", __func__, gcov_var.filename);*/
316 if (gcov_var.offset)
317 gcov_write_block (gcov_var.offset);
318
319 gcov_var.length = 0;
320 return gcov_var.error;
321 }
322
323 GCOV_LINKAGE int gcov_close(void)
324 {
325 memset(gcov_var.filename, 0, strlen(gcov_var.filename));
326
327 // Clear the start variable because will be tested in the gcov_open
328 // function
329 gcov_var.start = 0;
330
331 // Return the error, not sure whether the error is modifed.
332 return gcov_var.error;
333 }
334
335
336 static void gcov_write_block (unsigned size) {
337 unsigned char *buffer = (unsigned char*) gcov_var.buffer;
338 unsigned int i;
339
340 printf("_GCOV_,%s,", gcov_var.filename);
341 /* to speed up the printing process, we display bytes 4 by 4 */
342 for(i = 0; i < size; i++) {
343 printf("%02X%02X%02X%02X", (unsigned int)(buffer[0]),
344 (unsigned int)(buffer[1]),
345 (unsigned int)(buffer[2]),
346 (unsigned int)(buffer[3]));
347
348 buffer += sizeof(gcov_unsigned_t);
349 }
350 printf("\n");
351
352 gcov_var.start += size;
353 gcov_var.offset -= size;
354 }
355
356 /* Allocate space to write BYTES bytes to the gcov file. Return a
357 pointer to those bytes, or NULL on failure. */
358
359 static gcov_unsigned_t *gcov_write_words (unsigned words) {
360 gcov_unsigned_t *result;
361
362 GCOV_CHECK_WRITING ();
363 if (gcov_var.offset >= GCOV_BLOCK_SIZE)
364 {
365 gcov_write_block (GCOV_BLOCK_SIZE);
366 if (gcov_var.offset)
367 {
368 GCOV_CHECK (gcov_var.offset == 1);
369 memcpy (gcov_var.buffer, gcov_var.buffer + GCOV_BLOCK_SIZE, 4);
370 }
371 }
372 result = &gcov_var.buffer[gcov_var.offset];
373 gcov_var.offset += words;
374
375 return result;
376 }
377
378 /* Write unsigned VALUE to coverage file. Sets error flag
379 appropriately. */
380
381 GCOV_LINKAGE void
382 gcov_write_unsigned (gcov_unsigned_t value)
383 {
384 gcov_unsigned_t *buffer = gcov_write_words (1);
385
386 buffer[0] = value;
387 }
388
389 /* Write counter VALUE to coverage file. Sets error flag
390 appropriately. */
391
392 GCOV_LINKAGE void
393 gcov_write_counter (gcov_type value)
394 {
395 gcov_unsigned_t *buffer = gcov_write_words (2);
396
397 buffer[0] = (gcov_unsigned_t) value;
398 if (sizeof (value) > sizeof (gcov_unsigned_t))
399 buffer[1] = (gcov_unsigned_t) (value >> 32);
400 else
401 buffer[1] = 0;
402
403 }
404
405 /* Write a tag TAG and length LENGTH. */
406
407 GCOV_LINKAGE void
408 gcov_write_tag_length (gcov_unsigned_t tag, gcov_unsigned_t length)
409 {
410 gcov_unsigned_t *buffer = gcov_write_words (2);
411
412 buffer[0] = tag;
413 buffer[1] = length;
414 }
415
416 /* Write a summary structure to the gcov file. Return nonzero on
417 overflow. */
418
419 GCOV_LINKAGE void
420 gcov_write_summary (gcov_unsigned_t tag, const struct gcov_summary *summary)
421 {
422 unsigned ix;
423 const struct gcov_ctr_summary *csum;
424
425 gcov_write_tag_length (tag, GCOV_TAG_SUMMARY_LENGTH);
426 gcov_write_unsigned (summary->checksum);
427 for (csum = summary->ctrs, ix = GCOV_COUNTERS_SUMMABLE; ix--; csum++)
428 {
429 gcov_write_unsigned (csum->num);
430 gcov_write_unsigned (csum->runs);
431 gcov_write_counter (csum->sum_all);
432 gcov_write_counter (csum->run_max);
433 gcov_write_counter (csum->sum_max);
434 }
435 }
436
437 GCOV_LINKAGE gcov_type
438 gcov_read_counter (void)
439 {
440 return 0;
441 }
442
443 /* Add a new object file onto the bb chain. Invoked automatically
444 when running an object file's global ctors. */
445
446 void
447 __gcov_init (struct gcov_info *info)
448 {
449 if (!info->version)
450 return;
451 if (gcov_version (info, info->version))
452 {
453 const char *ptr = info->filename;
454 gcov_unsigned_t crc32 = gcov_crc32;
455
456 /* Added by LESIA*/
457 printf("Covered file: %s\n", info->filename);
458 /* End of Added by LESIA*/
459
460 do
461 {
462 unsigned ix;
463 gcov_unsigned_t value = *ptr << 24;
464
465 for (ix = 8; ix--; value <<= 1)
466 {
467 gcov_unsigned_t feedback;
468
469 feedback = (value ^ crc32) & 0x80000000 ? 0x04c11db7 : 0;
470 crc32 <<= 1;
471 crc32 ^= feedback;
472 }
473 }
474 while (*ptr++);
475
476 gcov_crc32 = crc32;
477
478 #ifdef GCOV_USE_EXIT
479 if (!gcov_list)
480 atexit (gcov_exit);
481 #endif
482
483 info->next = gcov_list;
484 gcov_list = info;
485 }
486 else
487 printf("%s: Version mismatch\n", "WARNING");
488 info->version = 0;
489 }
490 //#endif /* __GNUC__ __GNUC_MINOR__ __GNUC_PATCHLEVEL__ */
Show file before | Show file after
@@ -0,0 +1,485
1 /* Test for GCC >= 3.4.4 && <= 4.4.6 */
2 //#if ( ( __GNUC__ > 3 ) || \
3 // ( __GNUC__ == 3 && __GNUC_MINOR__ > 4 )|| \
4 // ( __GNUC__ == 3 && __GNUC_MINOR__ == 4 && __GNUC_PATCHLEVEL__ >= 4 ) ) && \
5 // ( ( __GNUC__ < 4 ) || \
6 // ( __GNUC__ == 4 && __GNUC_MINOR__ < 4 )|| \
7 // ( __GNUC__ == 4 && __GNUC_MINOR__ == 4 && __GNUC_PATCHLEVEL__ <= 6 ) )
8 //#include <stdlib.h>
9 //#include <stdio.h>
10 /* File format for coverage information
11 Copyright (C) 1996, 1997, 1998, 2000, 2002,
12 2003, 2004 Free Software Foundation, Inc.
13 Contributed by Bob Manson <manson@cygnus.com>.
14 Completely remangled by Nathan Sidwell <nathan@codesourcery.com>.
15
16 This file is part of GCC.
17
18 GCC is free software; you can redistribute it and/or modify it under
19 the terms of the GNU General Public License as published by the Free
20 Software Foundation; either version 2, or (at your option) any later
21 version.
22
23 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
24 WARRANTY; without even the implied warranty of MERCHANTABILITY or
25 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
26 for more details.
27
28 You should have received a copy of the GNU General Public License
29 along with GCC; see the file COPYING. If not, write to the Free
30 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
31 02111-1307, USA. */
32
33 /* As a special exception, if you link this library with other files,
34 some of which are compiled with GCC, to produce an executable,
35 this library does not by itself cause the resulting executable
36 to be covered by the GNU General Public License.
37 This exception does not however invalidate any other reasons why
38 the executable file might be covered by the GNU General Public License. */
39
40 /* Coverage information is held in two files. A notes file, which is
41 generated by the compiler, and a data file, which is generated
42 by the program under test. Both files use a similar structure. We
43 do not attempt to make these files backwards compatible with
44 previous versions, as you only need coverage information when
45 developing a program. We do hold version information, so that
46 mismatches can be detected, and we use a format that allows tools
47 to skip information they do not understand or are not interested
48 in.
49
50 Numbers are recorded in the 32 bit unsigned binary form of the
51 endianness of the machine generating the file. 64 bit numbers are
52 stored as two 32 bit numbers, the low part first. Strings are
53 padded with 1 to 4 NUL bytes, to bring the length up to a multiple
54 of 4. The number of 4 bytes is stored, followed by the padded
55 string. Zero length and NULL strings are simply stored as
56 a length of zero (they have no trailing NUL or padding).
57
58 int32: byte3 byte2 byte1 byte0 | byte0 byte1 byte2 byte3
59 int64: int32:low int32:high
60 string: int32:0 | int32:length char* char:0 padding
61 padding: | char:0 | char:0 char:0 | char:0 char:0 char:0
62 item: int32 | int64 | string
63
64 The basic format of the files is
65
66 file : int32:magic int32:version int32:stamp record*
67
68 The magic ident is different for the notes and the data files. The
69 magic ident is used to determine the endianness of the file, when
70 reading. The version is the same for both files and is derived
71 from gcc's version number. The stamp value is used to synchronize
72 note and data files and to synchronize merging within a data
73 file. It need not be an absolute time stamp, merely a ticker that
74 increments fast enough and cycles slow enough to distinguish
75 different compile/run/compile cycles.
76
77 Although the ident and version are formally 32 bit numbers, they
78 are derived from 4 character ASCII strings. The version number
79 consists of the single character major version number, a two
80 character minor version number (leading zero for versions less than
81 10), and a single character indicating the status of the release.
82 That will be 'e' experimental, 'p' prerelease and 'r' for release.
83 Because, by good fortune, these are in alphabetical order, string
84 collating can be used to compare version strings. Be aware that
85 the 'e' designation will (naturally) be unstable and might be
86 incompatible with itself. For gcc 3.4 experimental, it would be
87 '304e' (0x33303465). When the major version reaches 10, the
88 letters A-Z will be used. Assuming minor increments releases every
89 6 months, we have to make a major increment every 50 years.
90 Assuming major increments releases every 5 years, we're ok for the
91 next 155 years -- good enough for me.
92
93 A record has a tag, length and variable amount of data.
94
95 record: header data
96 header: int32:tag int32:length
97 data: item*
98
99 Records are not nested, but there is a record hierarchy. Tag
100 numbers reflect this hierarchy. Tags are unique across note and
101 data files. Some record types have a varying amount of data. The
102 LENGTH is the number of 4bytes that follow and is usually used to
103 determine how much data. The tag value is split into 4 8-bit
104 fields, one for each of four possible levels. The most significant
105 is allocated first. Unused levels are zero. Active levels are
106 odd-valued, so that the LSB of the level is one. A sub-level
107 incorporates the values of its superlevels. This formatting allows
108 you to determine the tag hierarchy, without understanding the tags
109 themselves, and is similar to the standard section numbering used
110 in technical documents. Level values [1..3f] are used for common
111 tags, values [41..9f] for the notes file and [a1..ff] for the data
112 file.
113
114 The basic block graph file contains the following records
115 note: unit function-graph*
116 unit: header int32:checksum string:source
117 function-graph: announce_function basic_blocks {arcs | lines}*
118 announce_function: header int32:ident int32:checksum
119 string:name string:source int32:lineno
120 basic_block: header int32:flags*
121 arcs: header int32:block_no arc*
122 arc: int32:dest_block int32:flags
123 lines: header int32:block_no line*
124 int32:0 string:NULL
125 line: int32:line_no | int32:0 string:filename
126
127 The BASIC_BLOCK record holds per-bb flags. The number of blocks
128 can be inferred from its data length. There is one ARCS record per
129 basic block. The number of arcs from a bb is implicit from the
130 data length. It enumerates the destination bb and per-arc flags.
131 There is one LINES record per basic block, it enumerates the source
132 lines which belong to that basic block. Source file names are
133 introduced by a line number of 0, following lines are from the new
134 source file. The initial source file for the function is NULL, but
135 the current source file should be remembered from one LINES record
136 to the next. The end of a block is indicated by an empty filename
137 - this does not reset the current source file. Note there is no
138 ordering of the ARCS and LINES records: they may be in any order,
139 interleaved in any manner. The current filename follows the order
140 the LINES records are stored in the file, *not* the ordering of the
141 blocks they are for.
142
143 The data file contains the following records.
144 data: {unit function-data* summary:object summary:program*}*
145 unit: header int32:checksum
146 function-data: announce_function arc_counts
147 announce_function: header int32:ident int32:checksum
148 arc_counts: header int64:count*
149 summary: int32:checksum {count-summary}GCOV_COUNTERS
150 count-summary: int32:num int32:runs int64:sum
151 int64:max int64:sum_max
152
153 The ANNOUNCE_FUNCTION record is the same as that in the note file,
154 but without the source location. The ARC_COUNTS gives the counter
155 values for those arcs that are instrumented. The SUMMARY records
156 give information about the whole object file and about the whole
157 program. The checksum is used for whole program summaries, and
158 disambiguates different programs which include the same
159 instrumented object file. There may be several program summaries,
160 each with a unique checksum. The object summary's checksum is zero.
161 Note that the data file might contain information from several runs
162 concatenated, or the data might be merged.
163
164 This file is included by both the compiler, gcov tools and the
165 runtime support library libgcov. IN_LIBGCOV and IN_GCOV are used to
166 distinguish which case is which. If IN_LIBGCOV is nonzero,
167 libgcov is being built. If IN_GCOV is nonzero, the gcov tools are
168 being built. Otherwise the compiler is being built. IN_GCOV may be
169 positive or negative. If positive, we are compiling a tool that
170 requires additional functions (see the code for knowledge of what
171 those functions are). */
172
173 #ifndef GCC_GCOV_IO_H
174 #define GCC_GCOV_IO_H
175
176 typedef unsigned int gcov_unsigned_t;
177 typedef unsigned int gcov_position_t;
178
179 typedef unsigned long long gcov_type;
180
181 /* No tengo ni idea de que es el SETLKW, asi que de momento el target
182 * no tiene de eso */
183
184 //#if defined (TARGET_HAS_F_SETLKW)
185 //#define GCOV_LOCKED 1
186 //#else
187 #define GCOV_LOCKED 0
188 //#endif
189 //#endif
190
191
192
193 /* In gcov we want function linkage to be static. In the compiler we want
194 it extern, so that they can be accessed from elsewhere. In libgcov we
195 need these functions to be extern, so prefix them with __gcov. In
196 libgcov they must also be hidden so that the instance in the executable
197 is not also used in a DSO. */
198
199 #define gcov_var __gcov_var
200 #define gcov_open __gcov_open
201 #define gcov_close __gcov_close
202 #define gcov_write_tag_length __gcov_write_tag_length
203 #define gcov_position __gcov_position
204 #define gcov_seek __gcov_seek
205 #define gcov_rewrite __gcov_rewrite
206 #define gcov_is_error __gcov_is_error
207 #define gcov_is_eof __gcov_is_eof
208 #define gcov_write_unsigned __gcov_write_unsigned
209 #define gcov_write_counter __gcov_write_counter
210 #define gcov_write_summary __gcov_write_summary
211 #define gcov_read_unsigned __gcov_read_unsigned
212 #define gcov_read_counter __gcov_read_counter
213 #define gcov_read_summary __gcov_read_summary
214
215 /* Esto no tengo ni repajolera idea de para que vale */
216
217 /* Poison these, so they don't accidentally slip in. */
218 //#pragma GCC poison gcov_write_string gcov_write_tag gcov_write_length
219 //#pragma GCC poison gcov_read_string gcov_sync gcov_time gcov_magic
220
221 #ifdef HAVE_GAS_HIDDEN
222 #define ATTRIBUTE_HIDDEN __attribute__ ((__visibility__ ("hidden")))
223 #else
224 #define ATTRIBUTE_HIDDEN
225 #endif
226
227 #ifndef GCOV_LINKAGE
228 #define GCOV_LINKAGE extern
229 //#define GCOV_LINKAGE
230 #endif
231
232 /* File suffixes. */
233 #define GCOV_DATA_SUFFIX ".gcda"
234 #define GCOV_NOTE_SUFFIX ".gcno"
235
236 /* File magic. Must not be palindromes. */
237 #define GCOV_DATA_MAGIC ((gcov_unsigned_t)0x67636461) /* "gcda" */
238 #define GCOV_NOTE_MAGIC ((gcov_unsigned_t)0x67636e6f) /* "gcno" */
239
240 /* gcov-iov.h is automatically generated by the makefile from
241 version.c, it looks like
242 #define GCOV_VERSION ((gcov_unsigned_t)0x89abcdef)
243 */
244 #include "gcov-iov.h"
245
246 /* Convert a magic or version number to a 4 character string. */
247 #define GCOV_UNSIGNED2STRING(ARRAY,VALUE) \
248 ((ARRAY)[0] = (char)((VALUE) >> 24), \
249 (ARRAY)[1] = (char)((VALUE) >> 16), \
250 (ARRAY)[2] = (char)((VALUE) >> 8), \
251 (ARRAY)[3] = (char)((VALUE) >> 0))
252
253 /* The record tags. Values [1..3f] are for tags which may be in either
254 file. Values [41..9f] for those in the note file and [a1..ff] for
255 the data file. */
256
257 #define GCOV_TAG_FUNCTION ((gcov_unsigned_t)0x01000000)
258 #define GCOV_TAG_FUNCTION_LENGTH (2)
259 #define GCOV_TAG_BLOCKS ((gcov_unsigned_t)0x01410000)
260 #define GCOV_TAG_BLOCKS_LENGTH(NUM) (NUM)
261 #define GCOV_TAG_BLOCKS_NUM(LENGTH) (LENGTH)
262 #define GCOV_TAG_ARCS ((gcov_unsigned_t)0x01430000)
263 #define GCOV_TAG_ARCS_LENGTH(NUM) (1 + (NUM) * 2)
264 #define GCOV_TAG_ARCS_NUM(LENGTH) (((LENGTH) - 1) / 2)
265 #define GCOV_TAG_LINES ((gcov_unsigned_t)0x01450000)
266 #define GCOV_TAG_COUNTER_BASE ((gcov_unsigned_t)0x01a10000)
267 #define GCOV_TAG_COUNTER_LENGTH(NUM) ((NUM) * 2)
268 #define GCOV_TAG_COUNTER_NUM(LENGTH) ((LENGTH) / 2)
269 #define GCOV_TAG_OBJECT_SUMMARY ((gcov_unsigned_t)0xa1000000)
270 #define GCOV_TAG_PROGRAM_SUMMARY ((gcov_unsigned_t)0xa3000000)
271 #define GCOV_TAG_SUMMARY_LENGTH \
272 (1 + GCOV_COUNTERS_SUMMABLE * (2 + 3 * 2))
273
274 /* Counters that are collected. */
275 #define GCOV_COUNTER_ARCS 0 /* Arc transitions. */
276 #define GCOV_COUNTERS_SUMMABLE 1 /* Counters which can be
277 summaried. */
278 #define GCOV_FIRST_VALUE_COUNTER 1 /* The first of counters used for value
279 profiling. They must form a consecutive
280 interval and their order must match
281 the order of HIST_TYPEs in
282 value-prof.h. */
283 #define GCOV_COUNTER_V_INTERVAL 1 /* Histogram of value inside an interval. */
284 #define GCOV_COUNTER_V_POW2 2 /* Histogram of exact power2 logarithm
285 of a value. */
286 #define GCOV_COUNTER_V_SINGLE 3 /* The most common value of expression. */
287 #define GCOV_COUNTER_V_DELTA 4 /* The most common difference between
288 consecutive values of expression. */
289 #define GCOV_LAST_VALUE_COUNTER 4 /* The last of counters used for value
290 profiling. */
291 #define GCOV_COUNTERS 5
292
293 /* Number of counters used for value profiling. */
294 #define GCOV_N_VALUE_COUNTERS \
295 (GCOV_LAST_VALUE_COUNTER - GCOV_FIRST_VALUE_COUNTER + 1)
296
297 /* A list of human readable names of the counters */
298 #define GCOV_COUNTER_NAMES {"arcs", "interval", "pow2", "single", "delta"}
299
300 /* Names of merge functions for counters. */
301 #define GCOV_MERGE_FUNCTIONS {"__gcov_merge_add", \
302 "__gcov_merge_add", \
303 "__gcov_merge_add", \
304 "__gcov_merge_single", \
305 "__gcov_merge_delta"}
306
307 /* Convert a counter index to a tag. */
308 #define GCOV_TAG_FOR_COUNTER(COUNT) \
309 (GCOV_TAG_COUNTER_BASE + ((gcov_unsigned_t)(COUNT) << 17))
310 /* Convert a tag to a counter. */
311 #define GCOV_COUNTER_FOR_TAG(TAG) \
312 ((unsigned)(((TAG) - GCOV_TAG_COUNTER_BASE) >> 17))
313 /* Check whether a tag is a counter tag. */
314 #define GCOV_TAG_IS_COUNTER(TAG) \
315 (!((TAG) & 0xFFFF) && GCOV_COUNTER_FOR_TAG (TAG) < GCOV_COUNTERS)
316
317 /* The tag level mask has 1's in the position of the inner levels, &
318 the lsb of the current level, and zero on the current and outer
319 levels. */
320 #define GCOV_TAG_MASK(TAG) (((TAG) - 1) ^ (TAG))
321
322 /* Return nonzero if SUB is an immediate subtag of TAG. */
323 #define GCOV_TAG_IS_SUBTAG(TAG,SUB) \
324 (GCOV_TAG_MASK (TAG) >> 8 == GCOV_TAG_MASK (SUB) \
325 && !(((SUB) ^ (TAG)) & ~GCOV_TAG_MASK(TAG)))
326
327 /* Return nonzero if SUB is at a sublevel to TAG. */
328 #define GCOV_TAG_IS_SUBLEVEL(TAG,SUB) \
329 (GCOV_TAG_MASK (TAG) > GCOV_TAG_MASK (SUB))
330
331 /* Basic block flags. */
332 #define GCOV_BLOCK_UNEXPECTED (1 << 1)
333
334 /* Arc flags. */
335 #define GCOV_ARC_ON_TREE (1 << 0)
336 #define GCOV_ARC_FAKE (1 << 1)
337 #define GCOV_ARC_FALLTHROUGH (1 << 2)
338
339 /* Structured records. */
340
341 /* Cumulative counter data. */
342 struct gcov_ctr_summary
343 {
344 gcov_unsigned_t num; /* number of counters. */
345 gcov_unsigned_t runs; /* number of program runs */
346 gcov_type sum_all; /* sum of all counters accumulated. */
347 gcov_type run_max; /* maximum value on a single run. */
348 gcov_type sum_max; /* sum of individual run max values. */
349 };
350
351
352 /* Object & program summary record. */
353 struct gcov_summary
354 {
355 gcov_unsigned_t checksum; /* checksum of program */
356 struct gcov_ctr_summary ctrs[GCOV_COUNTERS_SUMMABLE];
357 };
358
359 /* Structures embedded in coveraged program. The structures generated
360 by write_profile must match these. */
361
362 /* Information about a single function. This uses the trailing array
363 idiom. The number of counters is determined from the counter_mask
364 in gcov_info. We hold an array of function info, so have to
365 explicitly calculate the correct array stride. */
366 struct gcov_fn_info
367 {
368 gcov_unsigned_t ident; /* unique ident of function */
369 gcov_unsigned_t checksum; /* function checksum */
370 unsigned n_ctrs[0]; /* instrumented counters */
371 };
372
373 /* Type of function used to merge counters. */
374 typedef void (*gcov_merge_fn) (gcov_type *, gcov_unsigned_t);
375
376 /* Information about counters. */
377 struct gcov_ctr_info
378 {
379 gcov_unsigned_t num; /* number of counters. */
380 gcov_type *values; /* their values. */
381 gcov_merge_fn merge; /* The function used to merge them. */
382 };
383
384 /* Information about a single object file. */
385 struct gcov_info
386 {
387 gcov_unsigned_t version; /* expected version number */
388 struct gcov_info *next; /* link to next, used by libgcov */
389
390 gcov_unsigned_t stamp; /* uniquifying time stamp */
391 const char *filename; /* output file name */
392
393 unsigned n_functions; /* number of functions */
394 const struct gcov_fn_info *functions; /* table of functions */
395
396 unsigned ctr_mask; /* mask of counters instrumented. */
397 struct gcov_ctr_info counts[0]; /* count data. The number of bits
398 set in the ctr_mask field
399 determines how big this array
400 is. */
401 };
402
403 /* Register a new object file module. */
404 extern void __gcov_init (struct gcov_info *) ATTRIBUTE_HIDDEN;
405
406 /* Called before fork, to avoid double counting. */
407 extern void __gcov_flush (void) ATTRIBUTE_HIDDEN;
408
409 /* The merge function that just sums the counters. */
410 extern void __gcov_merge_add (gcov_type *, unsigned) ATTRIBUTE_HIDDEN;
411
412 /* The merge function to choose the most common value. */
413 extern void __gcov_merge_single (gcov_type *, unsigned) ATTRIBUTE_HIDDEN;
414
415 /* The merge function to choose the most common difference between
416 consecutive values. */
417 extern void __gcov_merge_delta (gcov_type *, unsigned) ATTRIBUTE_HIDDEN;
418
419 /* Optimum number of gcov_unsigned_t's read from or written to disk. */
420 // We limit GCOV_BLOCK_SIZE to 512 unsigned long because post processing with
421 // DOS batch cannot handle command lines bigger than 8191 characters, knowing
422 // that for each char, we print 4 characters (e.g "\x00")
423 #define GCOV_BLOCK_SIZE (1 << 11)
424 #define MAXFILENAME (1024)
425
426 GCOV_LINKAGE struct gcov_var
427 {
428 // FILE *file;
429 char filename[MAXFILENAME];
430 gcov_position_t start; /* Position of first byte of block */
431 unsigned offset; /* Read/write position within the block. */
432 unsigned length; /* Read limit in the block. */
433 unsigned overread; /* Number of words overread. */
434 int error; /* < 0 overflow, > 0 disk error. */
435 /* Holds one block plus 4 bytes, thus all coverage reads & writes
436 fit within this buffer and we always can transfer GCOV_BLOCK_SIZE
437 to and from the disk. libgcov never backtracks and only writes 4
438 or 8 byte objects. */
439 gcov_unsigned_t buffer[GCOV_BLOCK_SIZE + 1];
440 } gcov_var ATTRIBUTE_HIDDEN;
441
442 #if 1
443 /* Functions for reading and writing gcov files. In libgcov you can
444 open the file for reading then writing. Elsewhere you can open the
445 file either for reading or for writing. When reading a file you may
446 use the gcov_read_* functions, gcov_sync, gcov_position, &
447 gcov_error. When writing a file you may use the gcov_write
448 functions, gcov_seek & gcov_error. When a file is to be rewritten
449 you use the functions for reading, then gcov_rewrite then the
450 functions for writing. Your file may become corrupted if you break
451 these invariants. */
452 GCOV_LINKAGE int gcov_open (const char */*name*/) ATTRIBUTE_HIDDEN;
453 GCOV_LINKAGE int gcov_close (void) ATTRIBUTE_HIDDEN;
454
455 /* Available everywhere. */
456 /* static gcov_position_t gcov_position (void);
457 * static int gcov_is_error (void);
458 * static int gcov_is_eof (void);
459 */
460
461 GCOV_LINKAGE gcov_unsigned_t gcov_read_unsigned (void) ATTRIBUTE_HIDDEN;
462 GCOV_LINKAGE gcov_type gcov_read_counter (void) ATTRIBUTE_HIDDEN;
463 GCOV_LINKAGE void gcov_read_summary (struct gcov_summary *) ATTRIBUTE_HIDDEN;
464 #endif
465 /* Available only in libgcov */
466 GCOV_LINKAGE void gcov_write_counter (gcov_type) ATTRIBUTE_HIDDEN;
467 GCOV_LINKAGE void gcov_write_tag_length (gcov_unsigned_t,
468 gcov_unsigned_t) ATTRIBUTE_HIDDEN;
469 GCOV_LINKAGE void gcov_write_summary (gcov_unsigned_t /*tag*/,
470 const struct gcov_summary *) ATTRIBUTE_HIDDEN;
471
472 /* Available outside gcov */
473 GCOV_LINKAGE void gcov_write_unsigned (gcov_unsigned_t) ATTRIBUTE_HIDDEN;
474
475 /* Make sure the library is used correctly. */
476 #if ENABLE_CHECKING
477 #define GCOV_CHECK(expr) ((expr) ? (void)0 : (void)abort ())
478 #else
479 #define GCOV_CHECK(expr)
480 #endif
481 #define GCOV_CHECK_READING() GCOV_CHECK(gcov_var.mode > 0)
482 #define GCOV_CHECK_WRITING() GCOV_CHECK(gcov_var.mode < 0)
483
484 #endif /* GCC_GCOV_IO_H */
485 //#endif /* __GNUC__ __GNUC_MINOR__ __GNUC_PATCHLEVEL__ */
Show file before | Show file after
@@ -0,0 +1,13
1 /* Generated by the program `C:\home\obswteam\workspace\sparc-gcov-master\tools\version\gcov-iov.exe'
2 from `4.4 (4 4) and (*)'. */
3 #if ( __GNUC__ == 3 && __GNUC_MINOR__ == 4 )
4 #define GCOV_VERSION ((gcov_unsigned_t)0x3330342a) /* type 'gcov-iov 3.4 ""' */
5 #endif /* __GNUC__ __GNUC_MINOR__ */
6
7 #if ( __GNUC__ == 4 && __GNUC_MINOR__ == 4 )
8 #define GCOV_VERSION ((gcov_unsigned_t)0x3430342a) /* type 'gcov-iov 4.4 ""' */
9 #endif /* __GNUC__ __GNUC_MINOR__ */
10
11 #if ( __GNUC__ > 4 )
12 #define GCOV_VERSION ((gcov_unsigned_t)0x3430342a) /* type 'gcov-iov 4.4 ""' */
13 #endif /* __GNUC__ __GNUC_MINOR__ */
Show file before | Show file after
@@ -0,0 +1,38
1 #!/usr/bin/env python3
2
3 __author__ = "Alexis Jeandet"
4 __copyright__ = "Copyright 2018, Laboratory of Plasma Physics"
5 __credits__ = []
6 __license__ = "GPLv2"
7 __version__ = "1.0.0"
8 __maintainer__ = "Alexis Jeandet"
9 __email__ = "alexis.jeandet@member.fsf.org"
10 __status__ = "Development"
11
12 import argparse
13 import subprocess
14
15
16
17 parser = argparse.ArgumentParser()
18 parser.add_argument("-s", "--sources", help="Source path path", required=True)
19 parser.add_argument("-o", "--output-folder", help="Will generate html report into this folder", required=True)
20 parser.add_argument("-g", "--gcov-exe", help="Gcov executable", required=True)
21 parser.add_argument("path", help="Path where are located gcda and gcno files")
22
23 args = parser.parse_args()
24
25 def main():
26 p = subprocess.Popen(["gcovr",
27 "--gcov-executable=" + args.gcov_exe,
28 "--object-directory=" + args.path,
29 "-r=" + args.sources,
30 "--html",
31 "--html-details",
32 "-o=" + args.output_folder + "/gcov.html"
33 ],
34 stdout=subprocess.PIPE)
35
36
37 if __name__ == "__main__":
38 main()
Show file before | Show file after
@@ -0,0 +1,134
1 /* Test for GCC >= 3.4.4 && <= 4.4.6 */
2 /*#if ( ( __GNUC__ > 3 ) || \
3 ( __GNUC__ == 3 && __GNUC_MINOR__ > 4 )|| \
4 ( __GNUC__ == 3 && __GNUC_MINOR__ == 4 && __GNUC_PATCHLEVEL__ >= 4 ) ) && \
5 ( ( __GNUC__ < 4 ) || \
6 ( __GNUC__ == 4 && __GNUC_MINOR__ < 4 )|| \
7 ( __GNUC__ == 4 && __GNUC_MINOR__ == 4 && __GNUC_PATCHLEVEL__ <= 6 ) )
8 */
9 /* Routines required for instrumenting a program. */
10 /* Compile this one with gcc. */
11 /* Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
12 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
13
14 This file is part of GCC.
15
16 GCC is free software; you can redistribute it and/or modify it under
17 the terms of the GNU General Public License as published by the Free
18 Software Foundation; either version 2, or (at your option) any later
19 version.
20
21 In addition to the permissions in the GNU General Public License, the
22 Free Software Foundation gives you unlimited permission to link the
23 compiled version of this file into combinations with other programs,
24 and to distribute those combinations without any restriction coming
25 from the use of this file. (The General Public License restrictions
26 do apply in other respects; for example, they cover modification of
27 the file, and distribution when not linked into a combine
28 executable.)
29
30 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
31 WARRANTY; without even the implied warranty of MERCHANTABILITY or
32 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
33 for more details.
34
35 You should have received a copy of the GNU General Public License
36 along with GCC; see the file COPYING. If not, write to the Free
37 Software Foundation, 59 Temple Place - Suite 330, Boston, MA
38 02111-1307, USA. */
39
40 #define GCOV_LINKAGE /* nothing */
41
42 #include "gcov-io.h"
43
44 /* Chain of per-object gcov structures. */
45 struct gcov_info *gcov_list;
46
47 /* A program checksum allows us to distinguish program data for an
48 object file included in multiple programs. */
49 gcov_unsigned_t gcov_crc32;
50
51 /* The profile merging function that just adds the counters. It is given
52 an array COUNTERS of N_COUNTERS old counters and it reads the same number
53 of counters from the gcov file. */
54 void
55 __gcov_merge_add (gcov_type *counters, unsigned n_counters)
56 {
57 for (; n_counters; counters++, n_counters--)
58 *counters += gcov_read_counter ();
59 }
60 /* The profile merging function for choosing the most common value.
61 It is given an array COUNTERS of N_COUNTERS old counters and it
62 reads the same number of counters from the gcov file. The counters
63 are split into 3-tuples where the members of the tuple have
64 meanings:
65
66 -- the stored candidate on the most common value of the measured entity
67 -- counter
68 -- total number of evaluations of the value */
69 void
70 __gcov_merge_single (gcov_type *counters, unsigned n_counters)
71 {
72 unsigned i, n_measures;
73 gcov_type value, counter, all;
74
75 GCOV_CHECK (!(n_counters % 3));
76 n_measures = n_counters / 3;
77 for (i = 0; i < n_measures; i++, counters += 3)
78 {
79 value = gcov_read_counter ();
80 counter = gcov_read_counter ();
81 all = gcov_read_counter ();
82
83 if (counters[0] == value)
84 counters[1] += counter;
85 else if (counter > counters[1])
86 {
87 counters[0] = value;
88 counters[1] = counter - counters[1];
89 }
90 else
91 counters[1] -= counter;
92 counters[2] += all;
93 }
94 }
95
96 /* The profile merging function for choosing the most common
97 difference between two consecutive evaluations of the value. It is
98 given an array COUNTERS of N_COUNTERS old counters and it reads the
99 same number of counters from the gcov file. The counters are split
100 into 4-tuples where the members of the tuple have meanings:
101
102 -- the last value of the measured entity
103 -- the stored candidate on the most common difference
104 -- counter
105 -- total number of evaluations of the value */
106
107 void
108 __gcov_merge_delta (gcov_type *counters, unsigned n_counters)
109 {
110 unsigned i, n_measures;
111 gcov_type last, value, counter, all;
112
113 GCOV_CHECK (!(n_counters % 4));
114 n_measures = n_counters / 4;
115 for (i = 0; i < n_measures; i++, counters += 4)
116 {
117 last = gcov_read_counter ();
118 value = gcov_read_counter ();
119 counter = gcov_read_counter ();
120 all = gcov_read_counter ();
121
122 if (counters[1] == value)
123 counters[2] += counter;
124 else if (counter > counters[2])
125 {
126 counters[1] = value;
127 counters[2] = counter - counters[2];
128 }
129 else
130 counters[2] -= counter;
131 counters[3] += all;
132 }
133 }
134 //#endif /* __GNUC__ __GNUC_MINOR__ __GNUC_PATCHLEVEL__ */
Show file before | Show file after
@@ -0,0 +1,40
1 #!/usr/bin/env python3
2
3 __author__ = "Alexis Jeandet"
4 __copyright__ = "Copyright 2018, Laboratory of Plasma Physics"
5 __credits__ = []
6 __license__ = "GPLv2"
7 __version__ = "1.0.0"
8 __maintainer__ = "Alexis Jeandet"
9 __email__ = "alexis.jeandet@member.fsf.org"
10 __status__ = "Development"
11
12 import time
13 import sys
14 import os
15 import serial
16 import argparse
17 from datetime import datetime
18
19 parser = argparse.ArgumentParser()
20 parser.add_argument("-p", "--port", help="Serial port")
21 parser.add_argument("-s", "--speed", help="Baud rate")
22 args = parser.parse_args()
23
24
25
26 def main():
27 with open('gcov_out_'+str(datetime.now())+'.txt','w') as gcov:
28 with open('console_'+str(datetime.now())+'.txt','w') as console:
29 with serial.Serial(args.port, args.speed, timeout=None) as ser:
30 line = ser.readline().decode()
31 while '_GCOVEXIT_BEGIN_' not in line:
32 console.write(line)
33 line = ser.readline().decode()
34 line = ser.readline().decode()
35 while '_GCOVEXIT_END_' not in line:
36 gcov.write(line)
37 line = ser.readline().decode()
38
39 if __name__ == "__main__":
40 main()
@@ -1,4 +1,4
1 header/lfr_common_headers = https://hephaistos.lpp.polytechnique.fr/rhodecode/HG_REPOSITORIES/LPP/INSTRUMENTATION/SOLO_LFR/lfr_common_headers
1 header/lfr_common_headers = https://hephaistos.lpp.polytechnique.fr/rhodecode/HG_REPOSITORIES/LPP/INSTRUMENTATION/USERS/JEANDET/lfr_common_headers
2 2
3 3 LFR_basic-parameters = https://hephaistos.lpp.polytechnique.fr/rhodecode/HG_REPOSITORIES/LPP/INSTRUMENTATION/USERS/CHUST/LFR_basic-parameters
4 4
@@ -1,2 +1,2
1 3081d1f9bb20b2b64a192585337a292a9804e0c5 LFR_basic-parameters
2 e904b329ff977514bf36af92617afefd22fd06ab header/lfr_common_headers
1 29f7f58cbebc19532376c16541841ac4cb5f234c LFR_basic-parameters
2 f5b83fb540b1cfd5d87c68621fb53f238eb623ae header/lfr_common_headers
@@ -1,4 +1,4
1 cmake_minimum_required (VERSION 2.6)
1 cmake_minimum_required (VERSION 3.5)
2 2 project (LFR_FSW)
3 3
4 4 if(NOT CMAKE_BUILD_TYPE)
@@ -10,5 +10,5 set(LFR_BP_SRC ${CMAKE_CURRENT_SOURCE_DI
10 10
11 11 SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_LIST_DIR}/sparc")
12 12
13 add_subdirectory(libgcov)
13 14 add_subdirectory(src)
14 #add_subdirectory(timegen)
@@ -1,3 +1,27
1 /*------------------------------------------------------------------------------
2 -- Solar Orbiter's Low Frequency Receiver Flight Software (LFR FSW),
3 -- This file is a part of the LFR FSW
4 -- Copyright (C) 2012-2018, Plasma Physics Laboratory - CNRS
5 --
6 -- This program is free software; you can redistribute it and/or modify
7 -- it under the terms of the GNU General Public License as published by
8 -- the Free Software Foundation; either version 2 of the License, or
9 -- (at your option) any later version.
10 --
11 -- This program is distributed in the hope that it will be useful,
12 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
13 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 -- GNU General Public License for more details.
15 --
16 -- You should have received a copy of the GNU General Public License
17 -- along with this program; if not, write to the Free Software
18 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 -------------------------------------------------------------------------------*/
20 /*-- Author : Paul Leroy
21 -- Contact : Alexis Jeandet
22 -- Mail : alexis.jeandet@lpp.polytechnique.fr
23 ----------------------------------------------------------------------------*/
24
1 25 #ifndef GRSPW_H_INCLUDED
2 26 #define GRSPW_H_INCLUDED
3 27
@@ -44,7 +44,7
44 44 #define COUNTER_MASK_IURF 0xffffc7ff // 1111 1111 1111 1111 1100 0111 1111 1111
45 45
46 46 volatile unsigned int *asr16Ptr = (volatile unsigned int *) ASR16_REG_ADDRESS;
47
47 #ifdef ENABLE_DEAD_CODE
48 48 static inline void flushCache()
49 49 {
50 50 /**
@@ -57,6 +57,7 static inline void flushCache()
57 57
58 58 asm("flush");
59 59 }
60 #endif
60 61
61 62 //***************************
62 63 // CCR Cache control register
@@ -10,30 +10,16
10 10 #include "fsw_spacewire.h"
11 11 #include "lfr_cpu_usage_report.h"
12 12
13 #define LFR_RESET_CAUSE_UNKNOWN_CAUSE 0
14 13 #define WATCHDOG_LOOP_PRINTF 10
15 14 #define WATCHDOG_LOOP_DEBUG 3
16 15
17 #define DUMB_MESSAGE_NB 15
18 16 #define NB_RTEMS_EVENTS 32
19 17 #define EVENT_12 12
20 18 #define EVENT_13 13
21 19 #define EVENT_14 14
22 #define DUMB_MESSAGE_0 "in DUMB *** default"
23 20 #define DUMB_MESSAGE_1 "in DUMB *** timecode_irq_handler"
24 #define DUMB_MESSAGE_2 "in DUMB *** f3 buffer changed"
25 #define DUMB_MESSAGE_3 "in DUMB *** in SMIQ *** Error sending event to AVF0"
26 #define DUMB_MESSAGE_4 "in DUMB *** spectral_matrices_isr *** Error sending event to SMIQ"
27 #define DUMB_MESSAGE_5 "in DUMB *** waveforms_simulator_isr"
28 #define DUMB_MESSAGE_6 "VHDL SM *** two buffers f0 ready"
29 #define DUMB_MESSAGE_7 "ready for dump"
30 #define DUMB_MESSAGE_8 "VHDL ERR *** spectral matrix"
31 #define DUMB_MESSAGE_9 "tick"
32 #define DUMB_MESSAGE_10 "VHDL ERR *** waveform picker"
33 #define DUMB_MESSAGE_11 "VHDL ERR *** unexpected ready matrix values"
34 21 #define DUMB_MESSAGE_12 "WATCHDOG timer"
35 22 #define DUMB_MESSAGE_13 "TIMECODE timer"
36 #define DUMB_MESSAGE_14 "TIMECODE ISR"
37 23
38 24 enum lfr_reset_cause_t{
39 25 UNKNOWN_CAUSE,
@@ -115,7 +101,9 extern rtems_id AVGV_id;// id of the AVG
115 101
116 102 void timer_configure( unsigned char timer, unsigned int clock_divider,
117 103 unsigned char interrupt_level, rtems_isr (*timer_isr)() );
104 #ifdef ENABLE_DEAD_CODE
118 105 void timer_start( unsigned char timer );
106 #endif
119 107 void timer_stop( unsigned char timer );
120 108 void timer_set_clock_divider(unsigned char timer, unsigned int clock_divider);
121 109
@@ -136,12 +124,13 rtems_task load_task( rtems_task_argumen
136 124 rtems_task hous_task( rtems_task_argument argument );
137 125 rtems_task avgv_task( rtems_task_argument argument );
138 126 rtems_task dumb_task( rtems_task_argument unused );
127 rtems_task scrubbing_task( rtems_task_argument unused );
128 rtems_task calibration_sweep_task( rtems_task_argument unused );
139 129
140 130 void init_housekeeping_parameters( void );
141 131 void increment_seq_counter(unsigned short *packetSequenceControl);
142 132 void getTime( unsigned char *time);
143 133 unsigned long long int getTimeAsUnsignedLongLongInt( );
144 void send_dumb_hk( void );
145 134 void get_temperatures( unsigned char *temperatures );
146 135 void get_v_e1_e2_f3( unsigned char *spacecraft_potential );
147 136 void get_cpu_load( unsigned char *resource_statistics );
@@ -29,8 +29,9
29 29
30 30 unsigned char lfr_rtems_cpu_usage_report( void );
31 31
32 #define CONST_10 10
32 33 #define CONST_100 100
34 #define CONST_255 255
33 35 #define CONST_1000 1000
34 #define CONST_100000 100000
35 36
36 37 #endif // LFR_CPU_USAGE_REPORT_H
@@ -15,15 +15,6
15 15 #define MAX_SRC_DATA 780 // MAX size is 26 bins * 30 Bytes [TM_LFR_SCIENCE_BURST_BP2_F1]
16 16 #define MAX_SRC_DATA_WITH_SPARE 143 // 13 bins * 11 Bytes
17 17
18 #define NODE_0 0
19 #define NODE_1 1
20 #define NODE_2 2
21 #define NODE_3 3
22 #define NODE_4 4
23 #define NODE_5 5
24 #define NODE_6 6
25 #define NODE_7 7
26
27 18 typedef struct ring_node_asm
28 19 {
29 20 struct ring_node_asm *next;
@@ -37,6 +37,8
37 37 #define CAL_NB_PTS 256
38 38 #define CAL_DATA_MASK 0xfff
39 39 #define CAL_F_DIVISOR 38 // 25 MHz => 160 256 (39 - 1)
40 #define CAL_F_DIVISOR_MIN 38
41 #define CAL_F_DIVISOR_MAX (38*2*2*2*2)
40 42 // INTERLEAVED MODE
41 43 #define CAL_FS_INTER 240384.615
42 44 #define CAL_NB_PTS_INTER 384
@@ -49,11 +51,6
49 51 extern unsigned int lastValidEnterModeTime;
50 52 extern unsigned char oneTcLfrUpdateTimeReceived;
51 53
52 //****
53 // ISR
54 rtems_isr commutation_isr1( rtems_vector_number vector );
55 rtems_isr commutation_isr2( rtems_vector_number vector );
56
57 54 //***********
58 55 // RTEMS TASK
59 56 rtems_task actn_task( rtems_task_argument unused );
@@ -98,7 +95,9 void setCalibrationDivisor( unsigned int
98 95 void setCalibrationData( void );
99 96 void setCalibrationReload( bool state);
100 97 void setCalibrationEnable( bool state );
98 #ifdef ENABLE_DEAD_CODE
101 99 void setCalibrationInterleaved( bool state );
100 #endif
102 101 void setCalibration( bool state );
103 102 void configureCalibration( bool interleaved );
104 103 //
@@ -19,16 +19,6
19 19 #define DELTAF_F0 96.
20 20 #define DELTAF_F1 16.
21 21 #define DELTAF_F2 1.
22 #define DELTAF_DIV 2.
23
24 #define BIT_RW1_F1 0x80
25 #define BIT_RW1_F2 0x40
26 #define BIT_RW2_F1 0x20
27 #define BIT_RW2_F2 0x10
28 #define BIT_RW3_F1 0x08
29 #define BIT_RW3_F2 0x04
30 #define BIT_RW4_F1 0x02
31 #define BIT_RW4_F2 0x01
32 22
33 23 #define WHEEL_1 1
34 24 #define WHEEL_2 2
@@ -14,7 +14,9 int send_tm_lfr_tc_exe_success( ccsdsTel
14 14 int send_tm_lfr_tc_exe_inconsistent( ccsdsTelecommandPacket_t *TC, rtems_id queue_id,
15 15 unsigned char byte_position, unsigned char rcv_value );
16 16 int send_tm_lfr_tc_exe_not_executable( ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
17 #ifdef ENABLE_DEAD_CODE
17 18 int send_tm_lfr_tc_exe_not_implemented( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time );
19 #endif
18 20 int send_tm_lfr_tc_exe_error(ccsdsTelecommandPacket_t *TC, rtems_id queue_id );
19 21 int send_tm_lfr_tc_exe_corrupted( ccsdsTelecommandPacket_t *TC, rtems_id queue_id,
20 22 unsigned char *computed_CRC, unsigned char *currentTC_LEN_RCV, unsigned char destinationID );
@@ -24,7 +24,6
24 24 #define FREQ_F0 24576.
25 25 #define FREQ_F1 4096.
26 26 #define FREQ_F2 256.
27 #define FREQ_F3 16.
28 27
29 28 #define DELTAT_F0 2731 // (2048. / 24576. / 2.) * 65536. = 2730.667;
30 29 #define DELTAT_F1 16384 // (2048. / 4096. / 2.) * 65536. = 16384;
@@ -7,13 +7,20 set(CMAKE_LINKER ${rtems_dir}/bin/sparc
7 7 SET(CMAKE_EXE_LINKER_FLAGS "-static")
8 8 option(fix-b2bst "Activate -mfix-b2bst switch to mitigate \"LEON3FT Stale Cache Entry After Store with Data Tag Parity Error\" errata, GRLIB-TN-0009" ON)
9 9
10 option(Coverage "Enables code coverage" OFF)
11
12
13 set(CMAKE_C_FLAGS_RELEASE "-O2")
14 set(CMAKE_C_FLAGS_DEBUG "-O2 -g3 -fno-inline")
15
16
10 17 if(fix-b2bst)
11 set(CMAKE_C_FLAGS_RELEASE "-O3 -mfix-b2bst")
12 else()
13 set(CMAKE_C_FLAGS_RELEASE "-O3")
18 set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -mfix-b2bst")
19 set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -mfix-b2bst")
14 20 endif()
15 21
16 set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_LINKER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
22
23 set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_LINKER> <FLAGS> -Xlinker -Map=<TARGET>.map <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
17 24
18 25 include_directories("${rtems_dir}/sparc-rtems/leon3/lib/include")
19 26
@@ -23,3 +30,10 function (check_b2bst target bin)
23 30 COMMAND ${rtems_dir}/bin/sparc-rtems-objdump -d ${bin}/${target} | ${CMAKE_SOURCE_DIR}/sparc/leon3ft-b2bst-scan.tcl
24 31 )
25 32 endfunction()
33
34 function (build_srec target bin rev)
35 add_custom_command(TARGET ${target}
36 POST_BUILD
37 COMMAND ${rtems_dir}/bin/sparc-rtems-objcopy -j .data -F srec ${bin}/${target} RpwLfrApp_XXXX_data_rev-${rev}.srec && ${rtems_dir}/bin/sparc-rtems-objcopy -j .text -F srec ${bin}/${target} RpwLfrApp_XXXX_text_rev-${rev}.srec
38 )
39 endfunction()
@@ -1,4 +1,4
1 cmake_minimum_required (VERSION 2.6)
1 cmake_minimum_required (VERSION 3.5)
2 2 project (fsw)
3 3
4 4 include(sparc-rtems)
@@ -60,11 +60,13 option(FSW_vhdl_dev "?" OFF)
60 60 option(FSW_lpp_dpu_destid "Set to debug at LPP" OFF)
61 61 option(FSW_debug_watchdog "Enable debug watchdog" OFF)
62 62 option(FSW_debug_tch "?" OFF)
63 option(FSW_Instrument_Scrubbing "Enable scrubbing counter" OFF)
64 option(FSW_Enable_Dead_Code "Enable dead code compilation, this is used to hide by default unused code." OFF)
63 65
64 66 set(SW_VERSION_N1 "3" CACHE STRING "Choose N1 FSW Version." FORCE)
65 67 set(SW_VERSION_N2 "2" CACHE STRING "Choose N2 FSW Version." FORCE)
66 68 set(SW_VERSION_N3 "0" CACHE STRING "Choose N3 FSW Version." FORCE)
67 set(SW_VERSION_N4 "15" CACHE STRING "Choose N4 FSW Version." FORCE)
69 set(SW_VERSION_N4 "24" CACHE STRING "Choose N4 FSW Version." FORCE)
68 70
69 71 if(FSW_verbose)
70 72 add_definitions(-DPRINT_MESSAGES_ON_CONSOLE)
@@ -94,6 +96,13 if(FSW_debug_tch)
94 96 add_definitions(-DDEBUG_TCH)
95 97 endif()
96 98
99 if(FSW_Enable_Dead_Code)
100 add_definitions(-DENABLE_DEAD_CODE)
101 endif()
102
103
104
105
97 106 add_definitions(-DMSB_FIRST_TCH)
98 107
99 108 add_definitions(-DSWVERSION=-1-0)
@@ -104,9 +113,24 add_definitions(-DSW_VERSION_N4=${SW_VER
104 113
105 114 add_executable(fsw ${SOURCES})
106 115
116 if(FSW_Instrument_Scrubbing)
117 add_definitions(-DENABLE_SCRUBBING_COUNTER)
118 endif()
119
120 if(Coverage)
121 target_link_libraries(fsw gcov)
122 SET_TARGET_PROPERTIES(fsw PROPERTIES COMPILE_FLAGS "-fprofile-arcs -ftest-coverage")
123 endif()
124
125
107 126 if(fix-b2bst)
108 127 check_b2bst(fsw ${CMAKE_CURRENT_BINARY_DIR})
109 128 endif()
110 129
111 add_test_cppcheck(fsw STYLE UNUSED_FUNCTIONS POSSIBLE_ERROR MISSING_INCLUDE)
130 if(NOT FSW_lpp_dpu_destid)
131 build_srec(fsw ${CMAKE_CURRENT_BINARY_DIR} "${SW_VERSION_N1}-${SW_VERSION_N2}-${SW_VERSION_N3}-${SW_VERSION_N4}")
132 endif()
112 133
134
135 #add_test_cppcheck(fsw STYLE UNUSED_FUNCTIONS POSSIBLE_ERROR MISSING_INCLUDE)
136
@@ -1,3 +1,26
1 /*------------------------------------------------------------------------------
2 -- Solar Orbiter's Low Frequency Receiver Flight Software (LFR FSW),
3 -- This file is a part of the LFR FSW
4 -- Copyright (C) 2012-2018, Plasma Physics Laboratory - CNRS
5 --
6 -- This program is free software; you can redistribute it and/or modify
7 -- it under the terms of the GNU General Public License as published by
8 -- the Free Software Foundation; either version 2 of the License, or
9 -- (at your option) any later version.
10 --
11 -- This program is distributed in the hope that it will be useful,
12 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
13 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 -- GNU General Public License for more details.
15 --
16 -- You should have received a copy of the GNU General Public License
17 -- along with this program; if not, write to the Free Software
18 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 -------------------------------------------------------------------------------*/
20 /*-- Author : Paul Leroy
21 -- Contact : Alexis Jeandet
22 -- Mail : alexis.jeandet@lpp.polytechnique.fr
23 ----------------------------------------------------------------------------*/
1 24 /** Global variables of the LFR flight software.
2 25 *
3 26 * @file
@@ -22,13 +45,13
22 45 #include "fsw_params.h"
23 46 #include "fsw_params_wf_handler.h"
24 47
25 #define NB_OF_TASKS 20
48
26 49 #define NB_OF_MISC_NAMES 5
27 50
28 51 // RTEMS GLOBAL VARIABLES
29 52 rtems_name misc_name[NB_OF_MISC_NAMES] = {0};
30 rtems_name Task_name[NB_OF_TASKS] = {0}; /* array of task names */
31 rtems_id Task_id[NB_OF_TASKS] = {0}; /* array of task ids */
53 rtems_name Task_name[CONFIGURE_MAXIMUM_TASKS-1] = {0}; /* array of task names */
54 rtems_id Task_id[CONFIGURE_MAXIMUM_TASKS-1] = {0}; /* array of task ids */
32 55 rtems_name timecode_timer_name = 0;
33 56 rtems_id timecode_timer_id = RTEMS_ID_NONE;
34 57 rtems_name name_hk_rate_monotonic = 0; // name of the HK rate monotonic
@@ -1,3 +1,27
1 /*------------------------------------------------------------------------------
2 -- Solar Orbiter's Low Frequency Receiver Flight Software (LFR FSW),
3 -- This file is a part of the LFR FSW
4 -- Copyright (C) 2012-2018, Plasma Physics Laboratory - CNRS
5 --
6 -- This program is free software; you can redistribute it and/or modify
7 -- it under the terms of the GNU General Public License as published by
8 -- the Free Software Foundation; either version 2 of the License, or
9 -- (at your option) any later version.
10 --
11 -- This program is distributed in the hope that it will be useful,
12 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
13 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 -- GNU General Public License for more details.
15 --
16 -- You should have received a copy of the GNU General Public License
17 -- along with this program; if not, write to the Free Software
18 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 -------------------------------------------------------------------------------*/
20 /*-- Author : Paul Leroy
21 -- Contact : Alexis Jeandet
22 -- Mail : alexis.jeandet@lpp.polytechnique.fr
23 ----------------------------------------------------------------------------*/
24
1 25 /** This is the RTEMS initialization module.
2 26 *
3 27 * @file
@@ -9,11 +33,8
9 33 *
10 34 */
11 35
12 //*************************
13 // GPL reminder to be added
14 //*************************
36 #include <rtems.h>
15 37
16 #include <rtems.h>
17 38
18 39 /* configuration information */
19 40
@@ -23,23 +44,7
23 44
24 45 /* configuration information */
25 46
26 #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
27 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
28
29 #define CONFIGURE_MAXIMUM_TASKS 21 // number of tasks concurrently active including INIT
30 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
31 #define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE)
32 #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32
33 #define CONFIGURE_INIT_TASK_PRIORITY 1 // instead of 100
34 #define CONFIGURE_INIT_TASK_MODE (RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT)
35 #define CONFIGURE_INIT_TASK_ATTRIBUTES (RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT)
36 #define CONFIGURE_MAXIMUM_DRIVERS 16
37 #define CONFIGURE_MAXIMUM_PERIODS 6 // [hous] [load] [avgv]
38 #define CONFIGURE_MAXIMUM_TIMERS 6 // [spiq] [link] [spacewire_reset_link]
39 #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 5
40 #ifdef PRINT_STACK_REPORT
41 #define CONFIGURE_STACK_CHECKER_ENABLED
42 #endif
47 #include <fsw_params.h>
43 48
44 49 #include <rtems/confdefs.h>
45 50
@@ -58,7 +63,6
58 63
59 64 #endif
60 65 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRSPW /* GRSPW Driver */
61
62 66 #include <drvmgr/drvmgr_confdefs.h>
63 67 #endif
64 68
@@ -376,6 +380,8 void create_names( void ) // create all
376 380 Task_name[TASKID_PRC1] = rtems_build_name( 'P', 'R', 'C', '1' );
377 381 Task_name[TASKID_AVF2] = rtems_build_name( 'A', 'V', 'F', '2' );
378 382 Task_name[TASKID_PRC2] = rtems_build_name( 'P', 'R', 'C', '2' );
383 Task_name[TASKID_SCRB] = rtems_build_name( 'S', 'C', 'R', 'B' );
384 Task_name[TASKID_CALI] = rtems_build_name( 'C', 'A', 'L', 'I' );
379 385
380 386 // rate monotonic period names
381 387 name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' );
@@ -561,6 +567,14 int create_all_tasks( void ) // create a
561 567 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB]
562 568 );
563 569 }
570 if (status == RTEMS_SUCCESSFUL) // SCRUBBING TASK
571 {
572 status = rtems_task_create(
573 Task_name[TASKID_SCRB], TASK_PRIORITY_SCRB, RTEMS_MINIMUM_STACK_SIZE,
574 RTEMS_DEFAULT_MODES,
575 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_SCRB]
576 );
577 }
564 578 if (status == RTEMS_SUCCESSFUL) // HOUS
565 579 {
566 580 status = rtems_task_create(
@@ -577,6 +591,14 int create_all_tasks( void ) // create a
577 591 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVGV]
578 592 );
579 593 }
594 if (status == RTEMS_SUCCESSFUL) // CALI
595 {
596 status = rtems_task_create(
597 Task_name[TASKID_CALI], TASK_PRIORITY_CALI, RTEMS_MINIMUM_STACK_SIZE,
598 RTEMS_DEFAULT_MODES,
599 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CALI]
600 );
601 }
580 602
581 603 return status;
582 604 }
@@ -746,6 +768,13 int start_all_tasks( void ) // start all
746 768 BOOT_PRINTF("in INIT *** Error starting TASK_DUMB\n")
747 769 }
748 770 }
771 if (status == RTEMS_SUCCESSFUL) // SCRUBBING
772 {
773 status = rtems_task_start( Task_id[TASKID_SCRB], scrubbing_task, 1 );
774 if (status!=RTEMS_SUCCESSFUL) {
775 BOOT_PRINTF("in INIT *** Error starting TASK_DUMB\n")
776 }
777 }
749 778 if (status == RTEMS_SUCCESSFUL) // LOAD
750 779 {
751 780 status = rtems_task_start( Task_id[TASKID_LOAD], load_task, 1 );
@@ -753,11 +782,18 int start_all_tasks( void ) // start all
753 782 BOOT_PRINTF("in INIT *** Error starting TASK_LOAD\n")
754 783 }
755 784 }
785 if (status == RTEMS_SUCCESSFUL) // CALI
786 {
787 status = rtems_task_start( Task_id[TASKID_CALI], calibration_sweep_task, 1 );
788 if (status!=RTEMS_SUCCESSFUL) {
789 BOOT_PRINTF("in INIT *** Error starting TASK_LOAD\n")
790 }
791 }
756 792
757 793 return status;
758 794 }
759 795
760 rtems_status_code create_message_queues( void ) // create the two message queues used in the software
796 rtems_status_code create_message_queues( void ) // create the five message queues used in the software
761 797 {
762 798 rtems_status_code status_recv;
763 799 rtems_status_code status_send;
@@ -917,6 +953,11 rtems_status_code get_message_queue_id_p
917 953 return status;
918 954 }
919 955
956 /**
957 * @brief update_queue_max_count returns max(fifo_size_max, pending_messages + 1)
958 * @param queue_id
959 * @param fifo_size_max
960 */
920 961 void update_queue_max_count( rtems_id queue_id, unsigned char*fifo_size_max )
921 962 {
922 963 u_int32_t count;
@@ -941,6 +982,20 void update_queue_max_count( rtems_id qu
941 982 }
942 983 }
943 984
985 /**
986 * @brief init_ring initializes given ring buffer
987 * @param ring array of nodes to initialize
988 * @param nbNodes number of node in the ring buffer
989 * @param buffer memory space given to the ring buffer
990 * @param bufferSize size of the whole ring buffer memory space
991 *
992 * @details This function creates a circular buffer from a given number of nodes and a given memory space. It first sets all nodes attributes to thier defaults values
993 * and associates a portion of the given memory space with each node. Then it connects each nodes to build a circular buffer.
994 *
995 * Each node capacity will be bufferSize/nbNodes.
996 *
997 * https://en.wikipedia.org/wiki/Circular_buffer
998 */
944 999 void init_ring(ring_node ring[], unsigned char nbNodes, volatile int buffer[], unsigned int bufferSize )
945 1000 {
946 1001 unsigned char i;
@@ -1,3 +1,27
1 /*------------------------------------------------------------------------------
2 -- Solar Orbiter's Low Frequency Receiver Flight Software (LFR FSW),
3 -- This file is a part of the LFR FSW
4 -- Copyright (C) 2012-2018, Plasma Physics Laboratory - CNRS
5 --
6 -- This program is free software; you can redistribute it and/or modify
7 -- it under the terms of the GNU General Public License as published by
8 -- the Free Software Foundation; either version 2 of the License, or
9 -- (at your option) any later version.
10 --
11 -- This program is distributed in the hope that it will be useful,
12 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
13 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 -- GNU General Public License for more details.
15 --
16 -- You should have received a copy of the GNU General Public License
17 -- along with this program; if not, write to the Free Software
18 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 -------------------------------------------------------------------------------*/
20 /*-- Author : Paul Leroy
21 -- Contact : Alexis Jeandet
22 -- Mail : alexis.jeandet@lpp.polytechnique.fr
23 ----------------------------------------------------------------------------*/
24
1 25 /** General usage functions and RTEMS tasks.
2 26 *
3 27 * @file
@@ -42,6 +66,7 void timer_configure(unsigned char timer
42 66 timer_set_clock_divider( timer, clock_divider);
43 67 }
44 68
69 #ifdef ENABLE_DEAD_CODE
45 70 void timer_start(unsigned char timer)
46 71 {
47 72 /** This function starts a GPTIMER timer.
@@ -57,6 +82,7 void timer_start(unsigned char timer)
57 82 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | GPTIMER_RS;
58 83 gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | GPTIMER_IE;
59 84 }
85 #endif
60 86
61 87 void timer_stop(unsigned char timer)
62 88 {
@@ -85,7 +111,7 void timer_set_clock_divider(unsigned ch
85 111 gptimer_regs->timer[timer].reload = clock_divider; // base clock frequency is 1 MHz
86 112 }
87 113
88 // WATCHDOG
114 // WATCHDOG, this ISR should never be triggered.
89 115
90 116 rtems_isr watchdog_isr( rtems_vector_number vector )
91 117 {
@@ -183,8 +209,11 void set_apbuart_scaler_reload_register(
183 209 BOOT_PRINTF1("OK *** apbuart port scaler reload register set to 0x%x\n", value)
184 210 }
185 211
186 //************
187 // RTEMS TASKS
212 /**
213 * @brief load_task starts and keeps the watchdog alive.
214 * @param argument
215 * @return
216 */
188 217
189 218 rtems_task load_task(rtems_task_argument argument)
190 219 {
@@ -233,6 +262,11 rtems_task load_task(rtems_task_argument
233 262 }
234 263 }
235 264
265 /**
266 * @brief hous_task produces and sends HK each seconds
267 * @param argument
268 * @return
269 */
236 270 rtems_task hous_task(rtems_task_argument argument)
237 271 {
238 272 rtems_status_code status;
@@ -347,6 +381,12 rtems_task hous_task(rtems_task_argument
347 381 return;
348 382 }
349 383
384 /**
385 * @brief filter is a Direct-Form-II filter implementation, mostly used to filter electric field for HK
386 * @param x, new sample
387 * @param ctx, filter context, used to store previous input and output samples
388 * @return a new filtered sample
389 */
350 390 int filter( int x, filter_ctx* ctx )
351 391 {
352 392 static const int b[NB_COEFFS][NB_COEFFS]={ {B00, B01, B02}, {B10, B11, B12}, {B20, B21, B22} };
@@ -376,6 +416,11 int filter( int x, filter_ctx* ctx )
376 416 return x;
377 417 }
378 418
419 /**
420 * @brief avgv_task pruduces HK rate elctrical field from F3 data
421 * @param argument
422 * @return
423 */
379 424 rtems_task avgv_task(rtems_task_argument argument)
380 425 {
381 426 #define MOVING_AVERAGE 16
@@ -521,6 +566,74 rtems_task dumb_task( rtems_task_argumen
521 566 }
522 567 }
523 568
569 rtems_task scrubbing_task( rtems_task_argument unused )
570 {
571 /** This RTEMS taks is used to avoid entering IDLE task and also scrub memory to increase scubbing frequency.
572 *
573 * @param unused is the starting argument of the RTEMS task
574 *
575 * The scrubbing reads continuously memory when no other tasks are ready.
576 *
577 */
578
579 BOOT_PRINTF("in SCRUBBING *** \n");
580 volatile int i=0;
581 volatile float valuef = 1.;
582 volatile uint32_t* RAM=(uint32_t*)0x40000000;
583 volatile uint32_t value;
584 #ifdef ENABLE_SCRUBBING_COUNTER
585 housekeeping_packet.lfr_fpga_version[BYTE_0] = 0;
586 #endif
587 while(1){
588 i=(i+1)%(1024*1024);
589 valuef += 10.f*(float)RAM[i];
590 #ifdef ENABLE_SCRUBBING_COUNTER
591 if(i==0)
592 {
593 housekeeping_packet.lfr_fpga_version[BYTE_0] += 1;
594 }
595 #endif
596 }
597 }
598
599 rtems_task calibration_sweep_task( rtems_task_argument unused )
600 {
601 /** This RTEMS taks is used to change calibration signal smapling frequency between snapshots.
602 *
603 * @param unused is the starting argument of the RTEMS task
604 *
605 * If calibration is enabled, this task will divide by two the calibration signal smapling frequency between snapshots.
606 * When minimum sampling frequency is reach it will jump to maximum sampling frequency to loop indefinitely.
607 *
608 */
609 rtems_event_set event_out;
610 BOOT_PRINTF("in calibration sweep *** \n");
611 rtems_interval ticks_per_seconds = rtems_clock_get_ticks_per_second();
612 while(1){
613 // Waiting for next F0 snapshot
614 rtems_event_receive(RTEMS_EVENT_CAL_SWEEP_WAKE, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out);
615 if(time_management_regs->calDACCtrl & BIT_CAL_ENABLE)
616 {
617 unsigned int delta_snapshot;
618 delta_snapshot = (parameter_dump_packet.sy_lfr_n_swf_p[0] * CONST_256)
619 + parameter_dump_packet.sy_lfr_n_swf_p[1];
620 // We are woken almost in the center of a snapshot -> let's wait for sy_lfr_n_swf_p / 2
621 rtems_task_wake_after( ticks_per_seconds * delta_snapshot / 2);
622 if(time_management_regs->calDivisor >= CAL_F_DIVISOR_MAX){
623 time_management_regs->calDivisor = CAL_F_DIVISOR_MIN;
624 }
625 else{
626 time_management_regs->calDivisor *= 2;
627 }
628 }
629
630
631
632 }
633
634 }
635
636
524 637 //*****************************
525 638 // init housekeeping parameters
526 639
@@ -633,64 +746,6 unsigned long long int getTimeAsUnsigned
633 746 return time;
634 747 }
635 748
636 void send_dumb_hk( void )
637 {
638 Packet_TM_LFR_HK_t dummy_hk_packet;
639 unsigned char *parameters;
640 unsigned int i;
641 rtems_id queue_id;
642
643 queue_id = RTEMS_ID_NONE;
644
645 dummy_hk_packet.targetLogicalAddress = CCSDS_DESTINATION_ID;
646 dummy_hk_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID;
647 dummy_hk_packet.reserved = DEFAULT_RESERVED;
648 dummy_hk_packet.userApplication = CCSDS_USER_APP;
649 dummy_hk_packet.packetID[0] = (unsigned char) (APID_TM_HK >> SHIFT_1_BYTE);
650 dummy_hk_packet.packetID[1] = (unsigned char) (APID_TM_HK);
651 dummy_hk_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
652 dummy_hk_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
653 dummy_hk_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> SHIFT_1_BYTE);
654 dummy_hk_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK );
655 dummy_hk_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
656 dummy_hk_packet.serviceType = TM_TYPE_HK;
657 dummy_hk_packet.serviceSubType = TM_SUBTYPE_HK;
658 dummy_hk_packet.destinationID = TM_DESTINATION_ID_GROUND;
659 dummy_hk_packet.time[0] = (unsigned char) (time_management_regs->coarse_time >> SHIFT_3_BYTES);
660 dummy_hk_packet.time[1] = (unsigned char) (time_management_regs->coarse_time >> SHIFT_2_BYTES);
661 dummy_hk_packet.time[BYTE_2] = (unsigned char) (time_management_regs->coarse_time >> SHIFT_1_BYTE);
662 dummy_hk_packet.time[BYTE_3] = (unsigned char) (time_management_regs->coarse_time);
663 dummy_hk_packet.time[BYTE_4] = (unsigned char) (time_management_regs->fine_time >> SHIFT_1_BYTE);
664 dummy_hk_packet.time[BYTE_5] = (unsigned char) (time_management_regs->fine_time);
665 dummy_hk_packet.sid = SID_HK;
666
667 // init status word
668 dummy_hk_packet.lfr_status_word[0] = INT8_ALL_F;
669 dummy_hk_packet.lfr_status_word[1] = INT8_ALL_F;
670 // init software version
671 dummy_hk_packet.lfr_sw_version[0] = SW_VERSION_N1;
672 dummy_hk_packet.lfr_sw_version[1] = SW_VERSION_N2;
673 dummy_hk_packet.lfr_sw_version[BYTE_2] = SW_VERSION_N3;
674 dummy_hk_packet.lfr_sw_version[BYTE_3] = SW_VERSION_N4;
675 // init fpga version
676 parameters = (unsigned char *) (REGS_ADDR_WAVEFORM_PICKER + APB_OFFSET_VHDL_REV);
677 dummy_hk_packet.lfr_fpga_version[BYTE_0] = parameters[BYTE_1]; // n1
678 dummy_hk_packet.lfr_fpga_version[BYTE_1] = parameters[BYTE_2]; // n2
679 dummy_hk_packet.lfr_fpga_version[BYTE_2] = parameters[BYTE_3]; // n3
680
681 parameters = (unsigned char *) &dummy_hk_packet.hk_lfr_cpu_load;
682
683 for (i=0; i<(BYTE_POS_HK_REACTION_WHEELS_FREQUENCY - BYTE_POS_HK_LFR_CPU_LOAD); i++)
684 {
685 parameters[i] = INT8_ALL_F;
686 }
687
688 get_message_queue_id_send( &queue_id );
689
690 rtems_message_queue_send( queue_id, &dummy_hk_packet,
691 PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES);
692 }
693
694 749 void get_temperatures( unsigned char *temperatures )
695 750 {
696 751 unsigned char* temp_scm_ptr;
@@ -732,24 +787,41 void get_v_e1_e2_f3( unsigned char *spac
732 787 spacecraft_potential[BYTE_5] = e2_ptr[1];
733 788 }
734 789
790 /**
791 * @brief get_cpu_load, computes CPU load, CPU load average and CPU load max
792 * @param resource_statistics stores:
793 * - CPU load at index 0
794 * - CPU load max at index 1
795 * - CPU load average at index 2
796 *
797 * The CPU load average is computed on the last 60 values with a simple moving average.
798 */
735 799 void get_cpu_load( unsigned char *resource_statistics )
736 800 {
801 #define LOAD_AVG_SIZE 60
802 static unsigned char cpu_load_hist[LOAD_AVG_SIZE]={0};
803 static char old_avg_pos=0;
804 static unsigned int cpu_load_avg;
737 805 unsigned char cpu_load;
738 806
739 807 cpu_load = lfr_rtems_cpu_usage_report();
740 808
741 809 // HK_LFR_CPU_LOAD
742 resource_statistics[0] = cpu_load;
810 resource_statistics[BYTE_0] = cpu_load;
743 811
744 812 // HK_LFR_CPU_LOAD_MAX
745 if (cpu_load > resource_statistics[1])
813 if (cpu_load > resource_statistics[BYTE_1])
746 814 {
747 resource_statistics[1] = cpu_load;
815 resource_statistics[BYTE_1] = cpu_load;
748 816 }
749 817
818 cpu_load_avg = cpu_load_avg - (unsigned int)cpu_load_hist[(int)old_avg_pos] + (unsigned int)cpu_load;
819 cpu_load_hist[(int)old_avg_pos] = cpu_load;
820 old_avg_pos += 1;
821 old_avg_pos %= LOAD_AVG_SIZE;
750 822 // CPU_LOAD_AVE
751 resource_statistics[BYTE_2] = 0;
752
823 resource_statistics[BYTE_2] = (unsigned char)(cpu_load_avg / LOAD_AVG_SIZE);
824 // this will change the way LFR compute usage
753 825 #ifndef PRINT_TASK_STATISTICS
754 826 rtems_cpu_usage_reset();
755 827 #endif
@@ -840,6 +912,7 void increment_hk_counter( unsigned char
840 912 *counter = *counter + delta;
841 913 }
842 914
915 // Low severity error counters update
843 916 void hk_lfr_le_update( void )
844 917 {
845 918 static hk_lfr_le_t old_hk_lfr_le = {0};
@@ -910,6 +983,7 void hk_lfr_le_update( void )
910 983 housekeeping_packet.hk_lfr_le_cnt[1] = (unsigned char) (counter & BYTE1_MASK);
911 984 }
912 985
986 // Medium severity error counters update
913 987 void hk_lfr_me_update( void )
914 988 {
915 989 static hk_lfr_me_t old_hk_lfr_me = {0};
@@ -942,6 +1016,7 void hk_lfr_me_update( void )
942 1016 housekeeping_packet.hk_lfr_me_cnt[1] = (unsigned char) (counter & BYTE1_MASK);
943 1017 }
944 1018
1019 // High severity error counters update
945 1020 void hk_lfr_le_me_he_update()
946 1021 {
947 1022
@@ -1,3 +1,27
1 /*------------------------------------------------------------------------------
2 -- Solar Orbiter's Low Frequency Receiver Flight Software (LFR FSW),
3 -- This file is a part of the LFR FSW
4 -- Copyright (C) 2012-2018, Plasma Physics Laboratory - CNRS
5 --
6 -- This program is free software; you can redistribute it and/or modify
7 -- it under the terms of the GNU General Public License as published by
8 -- the Free Software Foundation; either version 2 of the License, or
9 -- (at your option) any later version.
10 --
11 -- This program is distributed in the hope that it will be useful,
12 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
13 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 -- GNU General Public License for more details.
15 --
16 -- You should have received a copy of the GNU General Public License
17 -- along with this program; if not, write to the Free Software
18 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 -------------------------------------------------------------------------------*/
20 /*-- Author : Paul Leroy
21 -- Contact : Alexis Jeandet
22 -- Mail : alexis.jeandet@lpp.polytechnique.fr
23 ----------------------------------------------------------------------------*/
24
1 25 /** Functions related to the SpaceWire interface.
2 26 *
3 27 * @file
@@ -285,7 +309,7 rtems_task send_task( rtems_task_argumen
285 309 {
286 310 spw_send_waveform_SWF( incomingRingNodePtr, &headerSWF );
287 311 }
288 else if ( (sid==SID_NORM_CWF_F3) )
312 else if (sid==SID_NORM_CWF_F3)
289 313 {
290 314 spw_send_waveform_CWF3_light( incomingRingNodePtr, &headerCWF );
291 315 }
@@ -620,23 +644,6 void spacewire_read_statistics( void )
620 644 // clear the counters
621 645 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_CLR_STATISTICS );
622 646
623 // typedef struct {
624 // unsigned int tx_link_err; // NOT IN HK
625 // unsigned int rx_rmap_header_crc_err; // NOT IN HK
626 // unsigned int rx_rmap_data_crc_err; // NOT IN HK
627 // unsigned int rx_eep_err;
628 // unsigned int rx_truncated;
629 // unsigned int parity_err;
630 // unsigned int escape_err;
631 // unsigned int credit_err;
632 // unsigned int write_sync_err;
633 // unsigned int disconnect_err;
634 // unsigned int early_ep;
635 // unsigned int invalid_address;
636 // unsigned int packets_sent;
637 // unsigned int packets_received;
638 // } spw_stats;
639
640 647 // rx_eep_err
641 648 grspw_stats.rx_eep_err = grspw_stats.rx_eep_err + current.rx_eep_err;
642 649 // rx_truncated
@@ -685,23 +692,6 void spacewire_get_last_error( void )
685 692 coarseTime = time_management_regs->coarse_time;
686 693 fineTime = time_management_regs->fine_time;
687 694
688 // typedef struct {
689 // unsigned int tx_link_err; // NOT IN HK
690 // unsigned int rx_rmap_header_crc_err; // NOT IN HK
691 // unsigned int rx_rmap_data_crc_err; // NOT IN HK
692 // unsigned int rx_eep_err;
693 // unsigned int rx_truncated;
694 // unsigned int parity_err;
695 // unsigned int escape_err;
696 // unsigned int credit_err;
697 // unsigned int write_sync_err;
698 // unsigned int disconnect_err;
699 // unsigned int early_ep;
700 // unsigned int invalid_address;
701 // unsigned int packets_sent;
702 // unsigned int packets_received;
703 // } spw_stats;
704
705 695 // tx_link_err *** no code associated to this field
706 696 // rx_rmap_header_crc_err *** LE *** in HK
707 697 if (previous.rx_rmap_header_crc_err != current.rx_rmap_header_crc_err)
@@ -1539,6 +1529,11 void spw_send_asm_f1( ring_node *ring_no
1539 1529 }
1540 1530 }
1541 1531
1532 /**
1533 * @brief spw_send_asm_f2 Sends an ASM packet at F2 over spacewire
1534 * @param ring_node_to_send node pointing to the actual buffer to send
1535 * @param header
1536 */
1542 1537 void spw_send_asm_f2( ring_node *ring_node_to_send,
1543 1538 Header_TM_LFR_SCIENCE_ASM_t *header )
1544 1539 {
@@ -1606,6 +1601,10 void spw_send_asm_f2( ring_node *ring_no
1606 1601 }
1607 1602 }
1608 1603
1604 /**
1605 * @brief spw_send_k_dump Sends k coefficients dump packet over spacewire
1606 * @param ring_node_to_send node pointing to the actual buffer to send
1607 */
1609 1608 void spw_send_k_dump( ring_node *ring_node_to_send )
1610 1609 {
1611 1610 rtems_status_code status;
@@ -12,10 +12,14
12 12 */
13 13
14 14 #include "lfr_cpu_usage_report.h"
15 #include "fsw_params.h"
16
17 extern rtems_id Task_id[];
15 18
16 19 unsigned char lfr_rtems_cpu_usage_report( void )
17 20 {
18 21 uint32_t api_index;
22 uint32_t information_index;
19 23 Thread_Control *the_thread;
20 24 Objects_Information *information;
21 25 uint32_t ival;
@@ -24,8 +28,9 unsigned char lfr_rtems_cpu_usage_report
24 28 Timestamp_Control uptime;
25 29 Timestamp_Control total;
26 30 Timestamp_Control ran;
31
27 32 #else
28 uint32_t total_units = 0;
33 #error "Can't compute CPU usage using ticks on LFR"
29 34 #endif
30 35
31 36 unsigned char cpu_load;
@@ -33,33 +38,6 unsigned char lfr_rtems_cpu_usage_report
33 38 ival = 0;
34 39 cpu_load = 0;
35 40
36 /*
37 * When not using nanosecond CPU usage resolution, we have to count
38 * the number of "ticks" we gave credit for to give the user a rough
39 * guideline as to what each number means proportionally.
40 */
41 #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
42 _TOD_Get_uptime( &uptime );
43 _Timestamp_Subtract( &CPU_usage_Uptime_at_last_reset, &uptime, &total );
44 #else
45 for ( api_index = 1 ; api_index <= OBJECTS_APIS_LAST ; api_index++ ) {
46 if ( !_Objects_Information_table[ api_index ] ) { }
47 else
48 {
49 information = _Objects_Information_table[ api_index ][ 1 ];
50 if ( information != NULL )
51 {
52 for ( i=1 ; i <= information->maximum ; i++ ) {
53 the_thread = (Thread_Control *)information->local_table[ i ];
54
55 if ( the_thread != NULL ) {
56 total_units += the_thread->cpu_time_used; }
57 }
58 }
59 }
60 }
61 #endif
62
63 41 for ( api_index = 1 ; api_index <= OBJECTS_APIS_LAST ; api_index++ )
64 42 {
65 43 if ( !_Objects_Information_table[ api_index ] ) { }
@@ -68,50 +46,23 unsigned char lfr_rtems_cpu_usage_report
68 46 information = _Objects_Information_table[ api_index ][ 1 ];
69 47 if ( information != NULL )
70 48 {
71 the_thread = (Thread_Control *)information->local_table[ 1 ];
49 for(information_index=1;information_index<=information->maximum;information_index++)
50 {
51 the_thread = (Thread_Control *)information->local_table[ information_index ];
72 52
73 53 if ( the_thread == NULL ) { }
74 else
54 else if(the_thread->Object.id == Task_id[TASKID_SCRB]) // Only measure scrubbing task load, CPU load is 100%-Scrubbing
75 55 {
76 #ifndef __RTEMS_USE_TICKS_FOR_STATISTICS__
77 /*
78 * If this is the currently executing thread, account for time
79 * since the last context switch.
80 */
56 _TOD_Get_uptime( &uptime );
57 _Timestamp_Subtract( &CPU_usage_Uptime_at_last_reset, &uptime, &total );
81 58 ran = the_thread->cpu_time_used;
82 if ( _Thread_Executing->Object.id == the_thread->Object.id )
83 {
84 Timestamp_Control used;
85 _Timestamp_Subtract(
86 &_Thread_Time_of_last_context_switch, &uptime, &used
87 );
88 _Timestamp_Add_to( &ran, &used );
89 }
90 59 _Timestamp_Divide( &ran, &total, &ival, &fval );
91
92 #else
93 if (total_units != 0)
94 {
95 uint64_t ival_64;
96
97 ival_64 = the_thread->cpu_time_used;
98 ival_64 *= CONST_100000;
99 ival = ival_64 / total_units;
100 }
101 else
102 {
103 ival = 0;
104 }
105
106 fval = ival % CONST_1000;
107 ival /= CONST_1000;
108 #endif
60 cpu_load = (unsigned char) (CONST_255 - ((((ival*CONST_10) + (fval/CONST_100))*CONST_256)/CONST_1000));
109 61 }
110 62 }
111 63 }
112 64 }
113 cpu_load = (unsigned char) (CONST_100 - ival);
114
65 }
115 66 return cpu_load;
116 67 }
117 68
@@ -1,3 +1,27
1 /*------------------------------------------------------------------------------
2 -- Solar Orbiter's Low Frequency Receiver Flight Software (LFR FSW),
3 -- This file is a part of the LFR FSW
4 -- Copyright (C) 2012-2018, Plasma Physics Laboratory - CNRS
5 --
6 -- This program is free software; you can redistribute it and/or modify
7 -- it under the terms of the GNU General Public License as published by
8 -- the Free Software Foundation; either version 2 of the License, or
9 -- (at your option) any later version.
10 --
11 -- This program is distributed in the hope that it will be useful,
12 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
13 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 -- GNU General Public License for more details.
15 --
16 -- You should have received a copy of the GNU General Public License
17 -- along with this program; if not, write to the Free Software
18 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 -------------------------------------------------------------------------------*/
20 /*-- Author : Paul Leroy
21 -- Contact : Alexis Jeandet
22 -- Mail : alexis.jeandet@lpp.polytechnique.fr
23 ----------------------------------------------------------------------------*/
24
1 25 /** Functions related to data processing.
2 26 *
3 27 * @file
@@ -1,3 +1,27
1 /*------------------------------------------------------------------------------
2 -- Solar Orbiter's Low Frequency Receiver Flight Software (LFR FSW),
3 -- This file is a part of the LFR FSW
4 -- Copyright (C) 2012-2018, Plasma Physics Laboratory - CNRS
5 --
6 -- This program is free software; you can redistribute it and/or modify
7 -- it under the terms of the GNU General Public License as published by
8 -- the Free Software Foundation; either version 2 of the License, or
9 -- (at your option) any later version.
10 --
11 -- This program is distributed in the hope that it will be useful,
12 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
13 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 -- GNU General Public License for more details.
15 --
16 -- You should have received a copy of the GNU General Public License
17 -- along with this program; if not, write to the Free Software
18 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 -------------------------------------------------------------------------------*/
20 /*-- Author : Paul Leroy
21 -- Contact : Alexis Jeandet
22 -- Mail : alexis.jeandet@lpp.polytechnique.fr
23 ----------------------------------------------------------------------------*/
24
1 25 /** Functions related to data processing.
2 26 *
3 27 * @file
@@ -1,3 +1,27
1 /*------------------------------------------------------------------------------
2 -- Solar Orbiter's Low Frequency Receiver Flight Software (LFR FSW),
3 -- This file is a part of the LFR FSW
4 -- Copyright (C) 2012-2018, Plasma Physics Laboratory - CNRS
5 --
6 -- This program is free software; you can redistribute it and/or modify
7 -- it under the terms of the GNU General Public License as published by
8 -- the Free Software Foundation; either version 2 of the License, or
9 -- (at your option) any later version.
10 --
11 -- This program is distributed in the hope that it will be useful,
12 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
13 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 -- GNU General Public License for more details.
15 --
16 -- You should have received a copy of the GNU General Public License
17 -- along with this program; if not, write to the Free Software
18 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 -------------------------------------------------------------------------------*/
20 /*-- Author : Paul Leroy
21 -- Contact : Alexis Jeandet
22 -- Mail : alexis.jeandet@lpp.polytechnique.fr
23 ----------------------------------------------------------------------------*/
24
1 25 /** Functions related to data processing.
2 26 *
3 27 * @file
@@ -1,3 +1,27
1 /*------------------------------------------------------------------------------
2 -- Solar Orbiter's Low Frequency Receiver Flight Software (LFR FSW),
3 -- This file is a part of the LFR FSW
4 -- Copyright (C) 2012-2018, Plasma Physics Laboratory - CNRS
5 --
6 -- This program is free software; you can redistribute it and/or modify
7 -- it under the terms of the GNU General Public License as published by
8 -- the Free Software Foundation; either version 2 of the License, or
9 -- (at your option) any later version.
10 --
11 -- This program is distributed in the hope that it will be useful,
12 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
13 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 -- GNU General Public License for more details.
15 --
16 -- You should have received a copy of the GNU General Public License
17 -- along with this program; if not, write to the Free Software
18 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 -------------------------------------------------------------------------------*/
20 /*-- Author : Paul Leroy
21 -- Contact : Alexis Jeandet
22 -- Mail : alexis.jeandet@lpp.polytechnique.fr
23 ----------------------------------------------------------------------------*/
24
1 25 /** Functions related to data processing.
2 26 *
3 27 * @file
@@ -583,6 +607,12 unsigned char getSID( rtems_event_set ev
583 607 return sid;
584 608 }
585 609
610 /**
611 * @brief extractReImVectors converts a given ASM component from interleaved to split representation
612 * @param inputASM
613 * @param outputASM
614 * @param asmComponent
615 */
586 616 void extractReImVectors( float *inputASM, float *outputASM, unsigned int asmComponent )
587 617 {
588 618 unsigned int i;
@@ -597,6 +627,12 void extractReImVectors( float *inputASM
597 627 }
598 628 }
599 629
630 /**
631 * @brief copyReVectors copies real part of a given ASM from inputASM to outputASM
632 * @param inputASM
633 * @param outputASM
634 * @param asmComponent
635 */
600 636 void copyReVectors( float *inputASM, float *outputASM, unsigned int asmComponent )
601 637 {
602 638 unsigned int i;
@@ -608,6 +644,13 void copyReVectors( float *inputASM, flo
608 644 }
609 645 }
610 646
647 /**
648 * @brief ASM_patch, converts ASM from interleaved to split representation
649 * @param inputASM
650 * @param outputASM
651 * @note inputASM and outputASM must be different, in other words this function can't do in place convertion
652 * @see extractReImVectors
653 */
611 654 void ASM_patch( float *inputASM, float *outputASM )
612 655 {
613 656 extractReImVectors( inputASM, outputASM, ASM_COMP_B1B2); // b1b2
@@ -718,6 +761,14 int getFBinMask( int index, unsigned cha
718 761 return fbin;
719 762 }
720 763
764 /**
765 * @brief isPolluted returns MATRIX_IS_POLLUTED if there is any overlap between t0:t1 and tbad0:tbad1 ranges
766 * @param t0 Start acquisition time
767 * @param t1 End of acquisition time
768 * @param tbad0 Start time of poluting signal
769 * @param tbad1 End time of poluting signal
770 * @return
771 */
721 772 unsigned char isPolluted( u_int64_t t0, u_int64_t t1, u_int64_t tbad0, u_int64_t tbad1 )
722 773 {
723 774 unsigned char polluted;
@@ -735,6 +786,13 unsigned char isPolluted( u_int64_t t0,
735 786 return polluted;
736 787 }
737 788
789 /**
790 * @brief acquisitionTimeIsValid checks if the given acquisition time is poluted by PAS
791 * @param coarseTime Coarse acquisition time of the given SM
792 * @param fineTime Fine acquisition time of the given ASM
793 * @param channel Frequency channel to check, will impact SM time footprint
794 * @return MATRIX_IS_POLLUTED if there is any time overlap between SM and PAS poluting signal
795 */
738 796 unsigned char acquisitionTimeIsValid( unsigned int coarseTime, unsigned int fineTime, unsigned char channel)
739 797 {
740 798 u_int64_t t0;
@@ -1,3 +1,26
1 /*------------------------------------------------------------------------------
2 -- Solar Orbiter's Low Frequency Receiver Flight Software (LFR FSW),
3 -- This file is a part of the LFR FSW
4 -- Copyright (C) 2012-2018, Plasma Physics Laboratory - CNRS
5 --
6 -- This program is free software; you can redistribute it and/or modify
7 -- it under the terms of the GNU General Public License as published by
8 -- the Free Software Foundation; either version 2 of the License, or
9 -- (at your option) any later version.
10 --
11 -- This program is distributed in the hope that it will be useful,
12 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
13 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 -- GNU General Public License for more details.
15 --
16 -- You should have received a copy of the GNU General Public License
17 -- along with this program; if not, write to the Free Software
18 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 -------------------------------------------------------------------------------*/
20 /*-- Author : Paul Leroy
21 -- Contact : Alexis Jeandet
22 -- Mail : alexis.jeandet@lpp.polytechnique.fr
23 ----------------------------------------------------------------------------*/
1 24 /** Functions related to TeleCommand acceptance.
2 25 *
3 26 * @file
@@ -199,10 +222,6 int tc_check_type( unsigned char packetT
199 222 {
200 223 status = CCSDS_TM_VALID;
201 224 }
202 else
203 {
204 status = ILL_TYPE;
205 }
206 225
207 226 return status;
208 227 }
@@ -1,3 +1,26
1 /*------------------------------------------------------------------------------
2 -- Solar Orbiter's Low Frequency Receiver Flight Software (LFR FSW),
3 -- This file is a part of the LFR FSW
4 -- Copyright (C) 2012-2018, Plasma Physics Laboratory - CNRS
5 --
6 -- This program is free software; you can redistribute it and/or modify
7 -- it under the terms of the GNU General Public License as published by
8 -- the Free Software Foundation; either version 2 of the License, or
9 -- (at your option) any later version.
10 --
11 -- This program is distributed in the hope that it will be useful,
12 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
13 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 -- GNU General Public License for more details.
15 --
16 -- You should have received a copy of the GNU General Public License
17 -- along with this program; if not, write to the Free Software
18 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 -------------------------------------------------------------------------------*/
20 /*-- Author : Paul Leroy
21 -- Contact : Alexis Jeandet
22 -- Mail : alexis.jeandet@lpp.polytechnique.fr
23 ----------------------------------------------------------------------------*/
1 24 /** Functions and tasks related to TeleCommand handling.
2 25 *
3 26 * @file
@@ -156,9 +179,17 int action_reset(ccsdsTelecommandPacket_
156 179 */
157 180
158 181 PRINTF("this is the end!!!\n");
182 #ifdef GCOV_ENABLED
183 #ifndef GCOV_USE_EXIT
184 extern void gcov_exit (void);
185 gcov_exit();
186 #endif
187 #endif
159 188 exit(0);
160 189
190 #ifdef ENABLE_DEAD_CODE
161 191 send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time );
192 #endif
162 193
163 194 return LFR_DEFAULT;
164 195 }
@@ -1404,6 +1435,7 void setCalibrationData( void )
1404 1435 }
1405 1436 }
1406 1437
1438 #ifdef ENABLE_DEAD_CODE
1407 1439 void setCalibrationDataInterleaved( void )
1408 1440 {
1409 1441 /** This function is used to store the values used to drive the DAC in order to generate the SCM calibration signal
@@ -1448,6 +1480,7 void setCalibrationDataInterleaved( void
1448 1480 + ( (dataPtr[1] & CAL_DATA_MASK_INTER) << CAL_DATA_SHIFT_INTER);
1449 1481 }
1450 1482 }
1483 #endif
1451 1484
1452 1485 void setCalibrationReload( bool state)
1453 1486 {
@@ -1474,6 +1507,7 void setCalibrationEnable( bool state )
1474 1507 }
1475 1508 }
1476 1509
1510 #ifdef ENABLE_DEAD_CODE
1477 1511 void setCalibrationInterleaved( bool state )
1478 1512 {
1479 1513 // this bit drives the multiplexer
@@ -1486,6 +1520,7 void setCalibrationInterleaved( bool sta
1486 1520 time_management_regs->calDACCtrl = time_management_regs->calDACCtrl & MASK_SET_INTERLEAVED; // [1101 1111]
1487 1521 }
1488 1522 }
1523 #endif
1489 1524
1490 1525 void setCalibration( bool state )
1491 1526 {
@@ -1506,6 +1541,7 void setCalibration( bool state )
1506 1541 void configureCalibration( bool interleaved )
1507 1542 {
1508 1543 setCalibration( false );
1544 #ifdef ENABLE_DEAD_CODE
1509 1545 if ( interleaved == true )
1510 1546 {
1511 1547 setCalibrationInterleaved( true );
@@ -1514,6 +1550,7 void configureCalibration( bool interlea
1514 1550 setCalibrationDataInterleaved();
1515 1551 }
1516 1552 else
1553 #endif
1517 1554 {
1518 1555 setCalibrationPrescaler( 0 ); // 25 MHz => 25 000 000
1519 1556 setCalibrationDivisor( CAL_F_DIVISOR ); // => 160 256 (39 - 1)
@@ -1619,22 +1656,6 void close_action(ccsdsTelecommandPacket
1619 1656 }
1620 1657 }
1621 1658
1622 //***************************
1623 // Interrupt Service Routines
1624 rtems_isr commutation_isr1( rtems_vector_number vector )
1625 {
1626 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
1627 PRINTF("In commutation_isr1 *** Error sending event to DUMB\n")
1628 }
1629 }
1630
1631 rtems_isr commutation_isr2( rtems_vector_number vector )
1632 {
1633 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
1634 PRINTF("In commutation_isr2 *** Error sending event to DUMB\n")
1635 }
1636 }
1637
1638 1659 //****************
1639 1660 // OTHER FUNCTIONS
1640 1661 void updateLFRCurrentMode( unsigned char requestedMode )
@@ -1,3 +1,27
1 /*------------------------------------------------------------------------------
2 -- Solar Orbiter's Low Frequency Receiver Flight Software (LFR FSW),
3 -- This file is a part of the LFR FSW
4 -- Copyright (C) 2012-2018, Plasma Physics Laboratory - CNRS
5 --
6 -- This program is free software; you can redistribute it and/or modify
7 -- it under the terms of the GNU General Public License as published by
8 -- the Free Software Foundation; either version 2 of the License, or
9 -- (at your option) any later version.
10 --
11 -- This program is distributed in the hope that it will be useful,
12 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
13 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 -- GNU General Public License for more details.
15 --
16 -- You should have received a copy of the GNU General Public License
17 -- along with this program; if not, write to the Free Software
18 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 -------------------------------------------------------------------------------*/
20 /*-- Author : Paul Leroy
21 -- Contact : Alexis Jeandet
22 -- Mail : alexis.jeandet@lpp.polytechnique.fr
23 ----------------------------------------------------------------------------*/
24
1 25 /** Functions to load and dump parameters in the LFR registers.
2 26 *
3 27 * @file
@@ -445,7 +469,6 int action_dump_kcoefficients(ccsdsTelec
445 469 {
446 470 kcoefficients_dump_1.kcoeff_blks[ (freq*KCOEFF_BLK_SIZE) + 1] = freq;
447 471 bin = freq;
448 // printKCoefficients( freq, bin, k_coeff_intercalib_f0_norm);
449 472 for ( coeff=0; coeff<NB_K_COEFF_PER_BIN; coeff++ )
450 473 {
451 474 kCoeffDumpPtr = (unsigned char*) &kcoefficients_dump_1.kcoeff_blks[
@@ -461,7 +484,6 int action_dump_kcoefficients(ccsdsTelec
461 484 {
462 485 kcoefficients_dump_1.kcoeff_blks[ (freq*KCOEFF_BLK_SIZE) + 1 ] = freq;
463 486 bin = freq - NB_BINS_COMPRESSED_SM_F0;
464 // printKCoefficients( freq, bin, k_coeff_intercalib_f1_norm);
465 487 for ( coeff=0; coeff<NB_K_COEFF_PER_BIN; coeff++ )
466 488 {
467 489 kCoeffDumpPtr = (unsigned char*) &kcoefficients_dump_1.kcoeff_blks[
@@ -477,7 +499,6 int action_dump_kcoefficients(ccsdsTelec
477 499 {
478 500 kcoefficients_dump_1.kcoeff_blks[ (freq * KCOEFF_BLK_SIZE) + 1 ] = freq;
479 501 bin = freq - (NB_BINS_COMPRESSED_SM_F0 + NB_BINS_COMPRESSED_SM_F1);
480 // printKCoefficients( freq, bin, k_coeff_intercalib_f2);
481 502 for ( coeff = 0; coeff <NB_K_COEFF_PER_BIN; coeff++ )
482 503 {
483 504 kCoeffDumpPtr = (unsigned char*) &kcoefficients_dump_1.kcoeff_blks[
@@ -512,7 +533,6 int action_dump_kcoefficients(ccsdsTelec
512 533 {
513 534 kcoefficients_dump_2.kcoeff_blks[ (freq*KCOEFF_BLK_SIZE) + 1 ] = KCOEFF_BLK_NR_PKT1 + freq;
514 535 bin = freq + KCOEFF_BLK_NR_PKT2;
515 // printKCoefficients( freq, bin, k_coeff_intercalib_f2);
516 536 for ( coeff=0; coeff<NB_K_COEFF_PER_BIN; coeff++ )
517 537 {
518 538 kCoeffDumpPtr = (unsigned char*) &kcoefficients_dump_2.kcoeff_blks[
@@ -1,3 +1,27
1 /*------------------------------------------------------------------------------
2 -- Solar Orbiter's Low Frequency Receiver Flight Software (LFR FSW),
3 -- This file is a part of the LFR FSW
4 -- Copyright (C) 2012-2018, Plasma Physics Laboratory - CNRS
5 --
6 -- This program is free software; you can redistribute it and/or modify
7 -- it under the terms of the GNU General Public License as published by
8 -- the Free Software Foundation; either version 2 of the License, or
9 -- (at your option) any later version.
10 --
11 -- This program is distributed in the hope that it will be useful,
12 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
13 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 -- GNU General Public License for more details.
15 --
16 -- You should have received a copy of the GNU General Public License
17 -- along with this program; if not, write to the Free Software
18 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 -------------------------------------------------------------------------------*/
20 /*-- Author : Paul Leroy
21 -- Contact : Alexis Jeandet
22 -- Mail : alexis.jeandet@lpp.polytechnique.fr
23 ----------------------------------------------------------------------------*/
24
1 25 /** Functions to send TM packets related to TC parsing and execution.
2 26 *
3 27 * @file
@@ -216,6 +240,7 int send_tm_lfr_tc_exe_not_executable( c
216 240 return status;
217 241 }
218 242
243 #ifdef DENABLE_DEAD_CODE
219 244 int send_tm_lfr_tc_exe_not_implemented( ccsdsTelecommandPacket_t *TC, rtems_id queue_id, unsigned char *time )
220 245 {
221 246 /** This function sends a TM_LFR_TC_EXE_NOT_IMPLEMENTED packet in the dedicated RTEMS message queue.
@@ -281,6 +306,7 int send_tm_lfr_tc_exe_not_implemented(
281 306
282 307 return status;
283 308 }
309 #endif
284 310
285 311 int send_tm_lfr_tc_exe_error( ccsdsTelecommandPacket_t *TC, rtems_id queue_id )
286 312 {
@@ -414,8 +440,6 int send_tm_lfr_tc_exe_corrupted(ccsdsTe
414 440 TM.pkt_len_rcv_value[1] = TC->packetLength[1];
415 441 TM.pkt_datafieldsize_cnt[0] = currentTC_LEN_RCV[0];
416 442 TM.pkt_datafieldsize_cnt[1] = currentTC_LEN_RCV[1];
417 // TM.rcv_crc[0] = packetDataField[ packetLength - 1 ];
418 // TM.rcv_crc[1] = packetDataField[ packetLength ];
419 443 TM.rcv_crc[0] = packetDataField[ estimatedPacketLength - 1 ];
420 444 TM.rcv_crc[1] = packetDataField[ estimatedPacketLength ];
421 445 TM.computed_crc[0] = computed_CRC[0];
@@ -1,3 +1,27
1 /*------------------------------------------------------------------------------
2 -- Solar Orbiter's Low Frequency Receiver Flight Software (LFR FSW),
3 -- This file is a part of the LFR FSW
4 -- Copyright (C) 2012-2018, Plasma Physics Laboratory - CNRS
5 --
6 -- This program is free software; you can redistribute it and/or modify
7 -- it under the terms of the GNU General Public License as published by
8 -- the Free Software Foundation; either version 2 of the License, or
9 -- (at your option) any later version.
10 --
11 -- This program is distributed in the hope that it will be useful,
12 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
13 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 -- GNU General Public License for more details.
15 --
16 -- You should have received a copy of the GNU General Public License
17 -- along with this program; if not, write to the Free Software
18 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 -------------------------------------------------------------------------------*/
20 /*-- Author : Paul Leroy
21 -- Contact : Alexis Jeandet
22 -- Mail : alexis.jeandet@lpp.polytechnique.fr
23 ----------------------------------------------------------------------------*/
24
1 25 /** Functions and tasks related to waveform packet generation.
2 26 *
3 27 * @file
@@ -204,6 +228,7 inline void waveform_isr_normal_sbm1_sbm
204 228 }
205 229 // send an event to the WFRM task for resynchro activities
206 230 status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_SWF_RESYNCH );
231 status = rtems_event_send( Task_id[TASKID_CALI], RTEMS_EVENT_CAL_SWEEP_WAKE );
207 232 }
208 233
209 234 //***
@@ -841,11 +866,9 void build_snapshot_from_ring( ring_node
841 866 node = 0;
842 867 while ( node < nb_ring_nodes)
843 868 {
844 //PRINTF1("%d ... ", node);
845 869 bufferAcquisitionTime_asLong = get_acquisition_time( (unsigned char *) &ring_node_to_send->coarseTime );
846 870 if (bufferAcquisitionTime_asLong <= acquisitionTime_asLong)
847 871 {
848 //PRINTF1("buffer found with acquisition time = %llx\n", bufferAcquisitionTime_asLong);
849 872 node = nb_ring_nodes;
850 873 }
851 874 else
@@ -858,7 +881,6 void build_snapshot_from_ring( ring_node
858 881 // (5) compute the number of samples to take in the current buffer
859 882 sampleOffset_asLong = ((acquisitionTime_asLong - bufferAcquisitionTime_asLong) * frequency_asLong ) >> SHIFT_2_BYTES;
860 883 nbSamplesPart1_asLong = NB_SAMPLES_PER_SNAPSHOT - sampleOffset_asLong;
861 //PRINTF2("sampleOffset_asLong = %lld, nbSamplesPart1_asLong = %lld\n", sampleOffset_asLong, nbSamplesPart1_asLong);
862 884
863 885 // (6) compute the final acquisition time
864 886 acquisitionTime_asLong = bufferAcquisitionTime_asLong +
@@ -881,7 +903,7 void build_snapshot_from_ring( ring_node
881 903 timeCharPtr = (unsigned char*) &ring_node_to_send->coarseTime;
882 904 ptr2[0] = ptr2[0] | (timeCharPtr[0] & SYNC_BIT); // [1000 0000]
883 905
884 if ( (nbSamplesPart1_asLong >= NB_SAMPLES_PER_SNAPSHOT) | (nbSamplesPart1_asLong < 0) )
906 if ( (nbSamplesPart1_asLong > NB_SAMPLES_PER_SNAPSHOT) | (nbSamplesPart1_asLong < 0) )
885 907 {
886 908 nbSamplesPart1_asLong = 0;
887 909 }
@@ -1341,3 +1363,4 void increment_seq_counter_source_id( un
1341 1363 // RESTORE THE MODE OF THE CALLING TASK
1342 1364 status = rtems_task_mode( initial_mode_set, RTEMS_PREEMPT_MASK, &current_mode_set );
1343 1365 }
1366
@@ -1,9 +1,32
1 /*------------------------------------------------------------------------------
2 -- Solar Orbiter's Low Frequency Receiver Flight Software (LFR FSW),
3 -- This file is a part of the LFR FSW
4 -- Copyright (C) 2012-2018, Plasma Physics Laboratory - CNRS
5 --
6 -- This program is free software; you can redistribute it and/or modify
7 -- it under the terms of the GNU General Public License as published by
8 -- the Free Software Foundation; either version 2 of the License, or
9 -- (at your option) any later version.
10 --
11 -- This program is distributed in the hope that it will be useful,
12 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
13 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 -- GNU General Public License for more details.
15 --
16 -- You should have received a copy of the GNU General Public License
17 -- along with this program; if not, write to the Free Software
18 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 -------------------------------------------------------------------------------*/
20 /*-- Author : Paul Leroy
21 -- Contact : Alexis Jeandet
22 -- Mail : alexis.jeandet@lpp.polytechnique.fr
23 ----------------------------------------------------------------------------*/
24
1 25 #define NB_VALUES_PER_SM 25
2 26 #define NB_BINS_PER_SM 128
3 27
4 28 #define NB_BINS_COMPRESSED_SM_F0 11
5 29 #define ASM_F0_INDICE_START 17 // 88 bins
6 #define ASM_F0_INDICE_STOP 104 // 2 packets of 44 bins
7 30 #define NB_BINS_TO_AVERAGE_ASM_F0 8
8 31
9 32 void ASM_reorganize_and_divide( float *averaged_spec_mat, float *averaged_spec_mat_reorganized, float divider )
Show file before | Show file after
1 NO CONTENT: file was removed
Show file before | Show file after
1 NO CONTENT: file was removed, binary diff hidden
Show file before | Show file after
1 NO CONTENT: file was removed
Show file before | Show file after
1 NO CONTENT: file was removed
This diff has been collapsed as it changes many lines, (665 lines changed) Show them Hide them
Show file before | Show file after
1 NO CONTENT: file was removed
Show file before | Show file after
1 NO CONTENT: file was removed
Show file before | Show file after
1 NO CONTENT: file was removed
Show file before | Show file after
1 NO CONTENT: file was removed
Show file before | Show file after
1 NO CONTENT: file was removed
Show file before | Show file after
1 NO CONTENT: file was removed
Show file before | Show file after
1 NO CONTENT: file was removed
Show file before | Show file after
1 NO CONTENT: file was removed
Show file before | Show file after
1 NO CONTENT: file was removed
Show file before | Show file after
1 NO CONTENT: file was removed
Show file before | Show file after
1 NO CONTENT: file was removed
Show file before | Show file after
1 NO CONTENT: file was removed
Show file before | Show file after
1 NO CONTENT: file was removed
Show file before | Show file after
1 NO CONTENT: file was removed
Show file before | Show file after
1 NO CONTENT: file was removed
Show file before | Show file after
1 NO CONTENT: file was removed
Show file before | Show file after
1 NO CONTENT: file was removed
Show file before | Show file after
1 NO CONTENT: file was removed
Show file before | Show file after
1 NO CONTENT: file was removed
Show file before | Show file after
1 NO CONTENT: file was removed
Show file before | Show file after
1 NO CONTENT: file was removed
Show file before | Show file after
1 NO CONTENT: file was removed
Show file before | Show file after
1 NO CONTENT: file was removed
Show file before | Show file after
1 NO CONTENT: file was removed
Show file before | Show file after
1 NO CONTENT: file was removed
This diff has been collapsed as it changes many lines, (728 lines changed) Show them Hide them
Show file before | Show file after
1 NO CONTENT: file was removed
Show file before | Show file after
1 NO CONTENT: file was removed
Show file before | Show file after
1 NO CONTENT: file was removed
Show file before | Show file after
1 NO CONTENT: file was removed
Show file before | Show file after
1 NO CONTENT: file was removed
This diff has been collapsed as it changes many lines, (696 lines changed) Show them Hide them
Show file before | Show file after
1 NO CONTENT: file was removed
Show file before | Show file after
1 NO CONTENT: file was removed
Show file before | Show file after
1 NO CONTENT: file was removed
This diff has been collapsed as it changes many lines, (772 lines changed) Show them Hide them
Show file before | Show file after
1 NO CONTENT: file was removed
This diff has been collapsed as it changes many lines, (510 lines changed) Show them Hide them
Show file before | Show file after
1 NO CONTENT: file was removed
This diff has been collapsed as it changes many lines, (1323 lines changed) Show them Hide them