##// END OF EJS Templates
Removed all remaining unused macros and fixed bug...
jeandet -
r385:bd1252670981 3.2.0.20 No PWD scrub with... draft
parent child
Show More
@@ -1,2 +1,2
1 3081d1f9bb20b2b64a192585337a292a9804e0c5 LFR_basic-parameters
1 3081d1f9bb20b2b64a192585337a292a9804e0c5 LFR_basic-parameters
2 0adeb6c86feb96a126ce48641604949b87c70481 header/lfr_common_headers
2 042275d1388a0f360073a0d85bf50d128f4b8cfc header/lfr_common_headers
@@ -64,7 +64,7 option(FSW_debug_tch "?" OFF)
64 set(SW_VERSION_N1 "3" CACHE STRING "Choose N1 FSW Version." FORCE)
64 set(SW_VERSION_N1 "3" CACHE STRING "Choose N1 FSW Version." FORCE)
65 set(SW_VERSION_N2 "2" CACHE STRING "Choose N2 FSW Version." FORCE)
65 set(SW_VERSION_N2 "2" CACHE STRING "Choose N2 FSW Version." FORCE)
66 set(SW_VERSION_N3 "0" CACHE STRING "Choose N3 FSW Version." FORCE)
66 set(SW_VERSION_N3 "0" CACHE STRING "Choose N3 FSW Version." FORCE)
67 set(SW_VERSION_N4 "19" CACHE STRING "Choose N4 FSW Version." FORCE)
67 set(SW_VERSION_N4 "20" CACHE STRING "Choose N4 FSW Version." FORCE)
68
68
69 if(FSW_verbose)
69 if(FSW_verbose)
70 add_definitions(-DPRINT_MESSAGES_ON_CONSOLE)
70 add_definitions(-DPRINT_MESSAGES_ON_CONSOLE)
@@ -94,6 +94,8 if(FSW_debug_tch)
94 add_definitions(-DDEBUG_TCH)
94 add_definitions(-DDEBUG_TCH)
95 endif()
95 endif()
96
96
97
98
97 add_definitions(-DMSB_FIRST_TCH)
99 add_definitions(-DMSB_FIRST_TCH)
98
100
99 add_definitions(-DSWVERSION=-1-0)
101 add_definitions(-DSWVERSION=-1-0)
@@ -102,6 +104,7 add_definitions(-DSW_VERSION_N2=${SW_VER
102 add_definitions(-DSW_VERSION_N3=${SW_VERSION_N3})
104 add_definitions(-DSW_VERSION_N3=${SW_VERSION_N3})
103 add_definitions(-DSW_VERSION_N4=${SW_VERSION_N4})
105 add_definitions(-DSW_VERSION_N4=${SW_VERSION_N4})
104
106
107
105 add_executable(fsw ${SOURCES})
108 add_executable(fsw ${SOURCES})
106
109
107 if(fix-b2bst)
110 if(fix-b2bst)
@@ -22,13 +22,13
22 #include "fsw_params.h"
22 #include "fsw_params.h"
23 #include "fsw_params_wf_handler.h"
23 #include "fsw_params_wf_handler.h"
24
24
25 #define NB_OF_TASKS 20
25
26 #define NB_OF_MISC_NAMES 5
26 #define NB_OF_MISC_NAMES 5
27
27
28 // RTEMS GLOBAL VARIABLES
28 // RTEMS GLOBAL VARIABLES
29 rtems_name misc_name[NB_OF_MISC_NAMES] = {0};
29 rtems_name misc_name[NB_OF_MISC_NAMES] = {0};
30 rtems_name Task_name[NB_OF_TASKS] = {0}; /* array of task names */
30 rtems_name Task_name[CONFIGURE_MAXIMUM_TASKS-1] = {0}; /* array of task names */
31 rtems_id Task_id[NB_OF_TASKS] = {0}; /* array of task ids */
31 rtems_id Task_id[CONFIGURE_MAXIMUM_TASKS-1] = {0}; /* array of task ids */
32 rtems_name timecode_timer_name = 0;
32 rtems_name timecode_timer_name = 0;
33 rtems_id timecode_timer_id = RTEMS_ID_NONE;
33 rtems_id timecode_timer_id = RTEMS_ID_NONE;
34 rtems_name name_hk_rate_monotonic = 0; // name of the HK rate monotonic
34 rtems_name name_hk_rate_monotonic = 0; // name of the HK rate monotonic
@@ -24,43 +24,26
24
24
25 /* configuration information */
25 /* configuration information */
26
26
27 #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
27 #include <fsw_params.h>
28 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
29
30 #define CONFIGURE_MAXIMUM_TASKS 23 // number of tasks concurrently active including INIT
31 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
32 #define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE)
33 #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32
34 #define CONFIGURE_INIT_TASK_PRIORITY 1 // instead of 100
35 #define CONFIGURE_INIT_TASK_MODE (RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT)
36 #define CONFIGURE_INIT_TASK_ATTRIBUTES (RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT)
37 #define CONFIGURE_MAXIMUM_DRIVERS 16
38 #define CONFIGURE_MAXIMUM_PERIODS 6 // [hous] [load] [avgv]
39 #define CONFIGURE_MAXIMUM_TIMERS 6 // [spiq] [link] [spacewire_reset_link]
40 #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 5
41 #ifdef PRINT_STACK_REPORT
42 #define CONFIGURE_STACK_CHECKER_ENABLED
43 #endif
44
28
45 #include <rtems/confdefs.h>
29 #include <rtems/confdefs.h>
46
30
47 /* If --drvmgr was enabled during the configuration of the RTEMS kernel */
31 /* If --drvmgr was enabled during the configuration of the RTEMS kernel */
48 #ifdef RTEMS_DRVMGR_STARTUP
32 #ifdef RTEMS_DRVMGR_STARTUP
49 #ifdef LEON3
33 #ifdef LEON3
50 /* Add Timer and UART Driver */
34 /* Add Timer and UART Driver */
51
35
52 #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
36 #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
53 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GPTIMER
37 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GPTIMER
54 #endif
38 #endif
55
39
56 #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
40 #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
57 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_APBUART
41 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_APBUART
58 #endif
42 #endif
59
43
60 #endif
44 #endif
61 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRSPW /* GRSPW Driver */
45 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRSPW /* GRSPW Driver */
62
46 #include <drvmgr/drvmgr_confdefs.h>
63 #include <drvmgr/drvmgr_confdefs.h>
64 #endif
47 #endif
65
48
66 #include "fsw_init.h"
49 #include "fsw_init.h"
@@ -790,7 +773,7 int start_all_tasks( void ) // start all
790 return status;
773 return status;
791 }
774 }
792
775
793 rtems_status_code create_message_queues( void ) // create the two message queues used in the software
776 rtems_status_code create_message_queues( void ) // create the five message queues used in the software
794 {
777 {
795 rtems_status_code status_recv;
778 rtems_status_code status_recv;
796 rtems_status_code status_send;
779 rtems_status_code status_send;
@@ -950,6 +933,11 rtems_status_code get_message_queue_id_p
950 return status;
933 return status;
951 }
934 }
952
935
936 /**
937 * @brief update_queue_max_count returns max(fifo_size_max, pending_messages + 1)
938 * @param queue_id
939 * @param fifo_size_max
940 */
953 void update_queue_max_count( rtems_id queue_id, unsigned char*fifo_size_max )
941 void update_queue_max_count( rtems_id queue_id, unsigned char*fifo_size_max )
954 {
942 {
955 u_int32_t count;
943 u_int32_t count;
@@ -974,6 +962,20 void update_queue_max_count( rtems_id qu
974 }
962 }
975 }
963 }
976
964
965 /**
966 * @brief init_ring initializes given ring buffer
967 * @param ring array of nodes to initialize
968 * @param nbNodes number of node in the ring buffer
969 * @param buffer memory space given to the ring buffer
970 * @param bufferSize size of the whole ring buffer memory space
971 *
972 * @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
973 * and associates a portion of the given memory space with each node. Then it connects each nodes to build a circular buffer.
974 *
975 * Each node capacity will be bufferSize/nbNodes.
976 *
977 * https://en.wikipedia.org/wiki/Circular_buffer
978 */
977 void init_ring(ring_node ring[], unsigned char nbNodes, volatile int buffer[], unsigned int bufferSize )
979 void init_ring(ring_node ring[], unsigned char nbNodes, volatile int buffer[], unsigned int bufferSize )
978 {
980 {
979 unsigned char i;
981 unsigned char i;
@@ -281,11 +281,11 rtems_task send_task( rtems_task_argumen
281 {
281 {
282 spw_send_waveform_CWF( incomingRingNodePtr, &headerCWF );
282 spw_send_waveform_CWF( incomingRingNodePtr, &headerCWF );
283 }
283 }
284 else if ( (sid==SID_NORM_SWF_F0) || (sid== SID_NORM_SWF_F1) || (sid==SID_NORM_SWF_F2) )
284 else if ( (sid==SID_NORM_SWF_F0) || (sid==SID_NORM_SWF_F1) || (sid==SID_NORM_SWF_F2) )
285 {
285 {
286 spw_send_waveform_SWF( incomingRingNodePtr, &headerSWF );
286 spw_send_waveform_SWF( incomingRingNodePtr, &headerSWF );
287 }
287 }
288 else if ( (sid==SID_NORM_CWF_F3) )
288 else if (sid==SID_NORM_CWF_F3)
289 {
289 {
290 spw_send_waveform_CWF3_light( incomingRingNodePtr, &headerCWF );
290 spw_send_waveform_CWF3_light( incomingRingNodePtr, &headerCWF );
291 }
291 }
@@ -301,7 +301,7 rtems_task send_task( rtems_task_argumen
301 {
301 {
302 spw_send_asm_f2( incomingRingNodePtr, &headerASM );
302 spw_send_asm_f2( incomingRingNodePtr, &headerASM );
303 }
303 }
304 else if ( sid==TM_CODE_K_DUMP )
304 else if (sid==TM_CODE_K_DUMP)
305 {
305 {
306 spw_send_k_dump( incomingRingNodePtr );
306 spw_send_k_dump( incomingRingNodePtr );
307 }
307 }
@@ -620,23 +620,6 void spacewire_read_statistics( void )
620 // clear the counters
620 // clear the counters
621 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_CLR_STATISTICS );
621 status = ioctl( fdSPW, SPACEWIRE_IOCTRL_CLR_STATISTICS );
622
622
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 // rx_eep_err
623 // rx_eep_err
641 grspw_stats.rx_eep_err = grspw_stats.rx_eep_err + current.rx_eep_err;
624 grspw_stats.rx_eep_err = grspw_stats.rx_eep_err + current.rx_eep_err;
642 // rx_truncated
625 // rx_truncated
@@ -685,23 +668,6 void spacewire_get_last_error( void )
685 coarseTime = time_management_regs->coarse_time;
668 coarseTime = time_management_regs->coarse_time;
686 fineTime = time_management_regs->fine_time;
669 fineTime = time_management_regs->fine_time;
687
670
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 // tx_link_err *** no code associated to this field
671 // tx_link_err *** no code associated to this field
706 // rx_rmap_header_crc_err *** LE *** in HK
672 // rx_rmap_header_crc_err *** LE *** in HK
707 if (previous.rx_rmap_header_crc_err != current.rx_rmap_header_crc_err)
673 if (previous.rx_rmap_header_crc_err != current.rx_rmap_header_crc_err)
@@ -1539,6 +1505,11 void spw_send_asm_f1( ring_node *ring_no
1539 }
1505 }
1540 }
1506 }
1541
1507
1508 /**
1509 * @brief spw_send_asm_f2 Sends an ASM packet at F2 over spacewire
1510 * @param ring_node_to_send node pointing to the actual buffer to send
1511 * @param header
1512 */
1542 void spw_send_asm_f2( ring_node *ring_node_to_send,
1513 void spw_send_asm_f2( ring_node *ring_node_to_send,
1543 Header_TM_LFR_SCIENCE_ASM_t *header )
1514 Header_TM_LFR_SCIENCE_ASM_t *header )
1544 {
1515 {
@@ -1606,6 +1577,10 void spw_send_asm_f2( ring_node *ring_no
1606 }
1577 }
1607 }
1578 }
1608
1579
1580 /**
1581 * @brief spw_send_k_dump Sends k coefficients dump packet over spacewire
1582 * @param ring_node_to_send node pointing to the actual buffer to send
1583 */
1609 void spw_send_k_dump( ring_node *ring_node_to_send )
1584 void spw_send_k_dump( ring_node *ring_node_to_send )
1610 {
1585 {
1611 rtems_status_code status;
1586 rtems_status_code status;
@@ -445,7 +445,6 int action_dump_kcoefficients(ccsdsTelec
445 {
445 {
446 kcoefficients_dump_1.kcoeff_blks[ (freq*KCOEFF_BLK_SIZE) + 1] = freq;
446 kcoefficients_dump_1.kcoeff_blks[ (freq*KCOEFF_BLK_SIZE) + 1] = freq;
447 bin = freq;
447 bin = freq;
448 // printKCoefficients( freq, bin, k_coeff_intercalib_f0_norm);
449 for ( coeff=0; coeff<NB_K_COEFF_PER_BIN; coeff++ )
448 for ( coeff=0; coeff<NB_K_COEFF_PER_BIN; coeff++ )
450 {
449 {
451 kCoeffDumpPtr = (unsigned char*) &kcoefficients_dump_1.kcoeff_blks[
450 kCoeffDumpPtr = (unsigned char*) &kcoefficients_dump_1.kcoeff_blks[
@@ -461,7 +460,6 int action_dump_kcoefficients(ccsdsTelec
461 {
460 {
462 kcoefficients_dump_1.kcoeff_blks[ (freq*KCOEFF_BLK_SIZE) + 1 ] = freq;
461 kcoefficients_dump_1.kcoeff_blks[ (freq*KCOEFF_BLK_SIZE) + 1 ] = freq;
463 bin = freq - NB_BINS_COMPRESSED_SM_F0;
462 bin = freq - NB_BINS_COMPRESSED_SM_F0;
464 // printKCoefficients( freq, bin, k_coeff_intercalib_f1_norm);
465 for ( coeff=0; coeff<NB_K_COEFF_PER_BIN; coeff++ )
463 for ( coeff=0; coeff<NB_K_COEFF_PER_BIN; coeff++ )
466 {
464 {
467 kCoeffDumpPtr = (unsigned char*) &kcoefficients_dump_1.kcoeff_blks[
465 kCoeffDumpPtr = (unsigned char*) &kcoefficients_dump_1.kcoeff_blks[
@@ -477,7 +475,6 int action_dump_kcoefficients(ccsdsTelec
477 {
475 {
478 kcoefficients_dump_1.kcoeff_blks[ (freq * KCOEFF_BLK_SIZE) + 1 ] = freq;
476 kcoefficients_dump_1.kcoeff_blks[ (freq * KCOEFF_BLK_SIZE) + 1 ] = freq;
479 bin = freq - (NB_BINS_COMPRESSED_SM_F0 + NB_BINS_COMPRESSED_SM_F1);
477 bin = freq - (NB_BINS_COMPRESSED_SM_F0 + NB_BINS_COMPRESSED_SM_F1);
480 // printKCoefficients( freq, bin, k_coeff_intercalib_f2);
481 for ( coeff = 0; coeff <NB_K_COEFF_PER_BIN; coeff++ )
478 for ( coeff = 0; coeff <NB_K_COEFF_PER_BIN; coeff++ )
482 {
479 {
483 kCoeffDumpPtr = (unsigned char*) &kcoefficients_dump_1.kcoeff_blks[
480 kCoeffDumpPtr = (unsigned char*) &kcoefficients_dump_1.kcoeff_blks[
@@ -512,7 +509,6 int action_dump_kcoefficients(ccsdsTelec
512 {
509 {
513 kcoefficients_dump_2.kcoeff_blks[ (freq*KCOEFF_BLK_SIZE) + 1 ] = KCOEFF_BLK_NR_PKT1 + freq;
510 kcoefficients_dump_2.kcoeff_blks[ (freq*KCOEFF_BLK_SIZE) + 1 ] = KCOEFF_BLK_NR_PKT1 + freq;
514 bin = freq + KCOEFF_BLK_NR_PKT2;
511 bin = freq + KCOEFF_BLK_NR_PKT2;
515 // printKCoefficients( freq, bin, k_coeff_intercalib_f2);
516 for ( coeff=0; coeff<NB_K_COEFF_PER_BIN; coeff++ )
512 for ( coeff=0; coeff<NB_K_COEFF_PER_BIN; coeff++ )
517 {
513 {
518 kCoeffDumpPtr = (unsigned char*) &kcoefficients_dump_2.kcoeff_blks[
514 kCoeffDumpPtr = (unsigned char*) &kcoefficients_dump_2.kcoeff_blks[
General Comments 0
You need to be logged in to leave comments. Login now