##// 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
@@ -1,117 +1,120
1 cmake_minimum_required (VERSION 2.6)
1 cmake_minimum_required (VERSION 2.6)
2 project (fsw)
2 project (fsw)
3
3
4 include(sparc-rtems)
4 include(sparc-rtems)
5 include(cppcheck)
5 include(cppcheck)
6
6
7 include_directories("../header"
7 include_directories("../header"
8 "../header/lfr_common_headers"
8 "../header/lfr_common_headers"
9 "../header/processing"
9 "../header/processing"
10 "../LFR_basic-parameters"
10 "../LFR_basic-parameters"
11 "../src")
11 "../src")
12
12
13 set(SOURCES wf_handler.c
13 set(SOURCES wf_handler.c
14 tc_handler.c
14 tc_handler.c
15 fsw_misc.c
15 fsw_misc.c
16 fsw_init.c
16 fsw_init.c
17 fsw_globals.c
17 fsw_globals.c
18 fsw_spacewire.c
18 fsw_spacewire.c
19 tc_load_dump_parameters.c
19 tc_load_dump_parameters.c
20 tm_lfr_tc_exe.c
20 tm_lfr_tc_exe.c
21 tc_acceptance.c
21 tc_acceptance.c
22 processing/fsw_processing.c
22 processing/fsw_processing.c
23 processing/avf0_prc0.c
23 processing/avf0_prc0.c
24 processing/avf1_prc1.c
24 processing/avf1_prc1.c
25 processing/avf2_prc2.c
25 processing/avf2_prc2.c
26 lfr_cpu_usage_report.c
26 lfr_cpu_usage_report.c
27 ${LFR_BP_SRC}
27 ${LFR_BP_SRC}
28 ../header/wf_handler.h
28 ../header/wf_handler.h
29 ../header/tc_handler.h
29 ../header/tc_handler.h
30 ../header/grlib_regs.h
30 ../header/grlib_regs.h
31 ../header/fsw_misc.h
31 ../header/fsw_misc.h
32 ../header/fsw_init.h
32 ../header/fsw_init.h
33 ../header/fsw_spacewire.h
33 ../header/fsw_spacewire.h
34 ../header/tc_load_dump_parameters.h
34 ../header/tc_load_dump_parameters.h
35 ../header/tm_lfr_tc_exe.h
35 ../header/tm_lfr_tc_exe.h
36 ../header/tc_acceptance.h
36 ../header/tc_acceptance.h
37 ../header/processing/fsw_processing.h
37 ../header/processing/fsw_processing.h
38 ../header/processing/avf0_prc0.h
38 ../header/processing/avf0_prc0.h
39 ../header/processing/avf1_prc1.h
39 ../header/processing/avf1_prc1.h
40 ../header/processing/avf2_prc2.h
40 ../header/processing/avf2_prc2.h
41 ../header/fsw_params_wf_handler.h
41 ../header/fsw_params_wf_handler.h
42 ../header/lfr_cpu_usage_report.h
42 ../header/lfr_cpu_usage_report.h
43 ../header/lfr_common_headers/ccsds_types.h
43 ../header/lfr_common_headers/ccsds_types.h
44 ../header/lfr_common_headers/fsw_params.h
44 ../header/lfr_common_headers/fsw_params.h
45 ../header/lfr_common_headers/fsw_params_nb_bytes.h
45 ../header/lfr_common_headers/fsw_params_nb_bytes.h
46 ../header/lfr_common_headers/fsw_params_processing.h
46 ../header/lfr_common_headers/fsw_params_processing.h
47 ../header/lfr_common_headers/tm_byte_positions.h
47 ../header/lfr_common_headers/tm_byte_positions.h
48 ../LFR_basic-parameters/basic_parameters.h
48 ../LFR_basic-parameters/basic_parameters.h
49 ../LFR_basic-parameters/basic_parameters_params.h
49 ../LFR_basic-parameters/basic_parameters_params.h
50 ../header/GscMemoryLPP.hpp
50 ../header/GscMemoryLPP.hpp
51 )
51 )
52
52
53
53
54 option(FSW_verbose "Enable verbose LFR" OFF)
54 option(FSW_verbose "Enable verbose LFR" OFF)
55 option(FSW_boot_messages "Enable LFR boot messages" OFF)
55 option(FSW_boot_messages "Enable LFR boot messages" OFF)
56 option(FSW_debug_messages "Enable LFR debug messages" OFF)
56 option(FSW_debug_messages "Enable LFR debug messages" OFF)
57 option(FSW_cpu_usage_report "Enable LFR cpu usage report" OFF)
57 option(FSW_cpu_usage_report "Enable LFR cpu usage report" OFF)
58 option(FSW_stack_report "Enable LFR stack report" OFF)
58 option(FSW_stack_report "Enable LFR stack report" OFF)
59 option(FSW_vhdl_dev "?" OFF)
59 option(FSW_vhdl_dev "?" OFF)
60 option(FSW_lpp_dpu_destid "Set to debug at LPP" OFF)
60 option(FSW_lpp_dpu_destid "Set to debug at LPP" OFF)
61 option(FSW_debug_watchdog "Enable debug watchdog" OFF)
61 option(FSW_debug_watchdog "Enable debug watchdog" OFF)
62 option(FSW_debug_tch "?" OFF)
62 option(FSW_debug_tch "?" OFF)
63
63
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)
71 endif()
71 endif()
72 if(FSW_boot_messages)
72 if(FSW_boot_messages)
73 add_definitions(-DBOOT_MESSAGES)
73 add_definitions(-DBOOT_MESSAGES)
74 endif()
74 endif()
75 if(FSW_debug_messages)
75 if(FSW_debug_messages)
76 add_definitions(-DDEBUG_MESSAGES)
76 add_definitions(-DDEBUG_MESSAGES)
77 endif()
77 endif()
78 if(FSW_cpu_usage_report)
78 if(FSW_cpu_usage_report)
79 add_definitions(-DPRINT_TASK_STATISTICS)
79 add_definitions(-DPRINT_TASK_STATISTICS)
80 endif()
80 endif()
81 if(FSW_stack_report)
81 if(FSW_stack_report)
82 add_definitions(-DPRINT_STACK_REPORT)
82 add_definitions(-DPRINT_STACK_REPORT)
83 endif()
83 endif()
84 if(FSW_vhdl_dev)
84 if(FSW_vhdl_dev)
85 add_definitions(-DVHDL_DEV)
85 add_definitions(-DVHDL_DEV)
86 endif()
86 endif()
87 if(FSW_lpp_dpu_destid)
87 if(FSW_lpp_dpu_destid)
88 add_definitions(-DLPP_DPU_DESTID)
88 add_definitions(-DLPP_DPU_DESTID)
89 endif()
89 endif()
90 if(FSW_debug_watchdog)
90 if(FSW_debug_watchdog)
91 add_definitions(-DDEBUG_WATCHDOG)
91 add_definitions(-DDEBUG_WATCHDOG)
92 endif()
92 endif()
93 if(FSW_debug_tch)
93 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)
100 add_definitions(-DSW_VERSION_N1=${SW_VERSION_N1})
102 add_definitions(-DSW_VERSION_N1=${SW_VERSION_N1})
101 add_definitions(-DSW_VERSION_N2=${SW_VERSION_N2})
103 add_definitions(-DSW_VERSION_N2=${SW_VERSION_N2})
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)
108 check_b2bst(fsw ${CMAKE_CURRENT_BINARY_DIR})
111 check_b2bst(fsw ${CMAKE_CURRENT_BINARY_DIR})
109 endif()
112 endif()
110
113
111 if(NOT FSW_lpp_dpu_destid)
114 if(NOT FSW_lpp_dpu_destid)
112 build_srec(fsw ${CMAKE_CURRENT_BINARY_DIR} "${SW_VERSION_N1}-${SW_VERSION_N2}-${SW_VERSION_N3}-${SW_VERSION_N4}")
115 build_srec(fsw ${CMAKE_CURRENT_BINARY_DIR} "${SW_VERSION_N1}-${SW_VERSION_N2}-${SW_VERSION_N3}-${SW_VERSION_N4}")
113 endif()
116 endif()
114
117
115
118
116 add_test_cppcheck(fsw STYLE UNUSED_FUNCTIONS POSSIBLE_ERROR MISSING_INCLUDE)
119 add_test_cppcheck(fsw STYLE UNUSED_FUNCTIONS POSSIBLE_ERROR MISSING_INCLUDE)
117
120
@@ -1,96 +1,96
1 /** Global variables of the LFR flight software.
1 /** Global variables of the LFR flight software.
2 *
2 *
3 * @file
3 * @file
4 * @author P. LEROY
4 * @author P. LEROY
5 *
5 *
6 * Among global variables, there are:
6 * Among global variables, there are:
7 * - RTEMS names and id.
7 * - RTEMS names and id.
8 * - APB configuration registers.
8 * - APB configuration registers.
9 * - waveforms global buffers, used by the waveform picker hardware module to store data.
9 * - waveforms global buffers, used by the waveform picker hardware module to store data.
10 * - spectral matrices buffesr, used by the hardware module to store data.
10 * - spectral matrices buffesr, used by the hardware module to store data.
11 * - variable related to LFR modes parameters.
11 * - variable related to LFR modes parameters.
12 * - the global HK packet buffer.
12 * - the global HK packet buffer.
13 * - the global dump parameter buffer.
13 * - the global dump parameter buffer.
14 *
14 *
15 */
15 */
16
16
17 #include <rtems.h>
17 #include <rtems.h>
18 #include <grspw.h>
18 #include <grspw.h>
19
19
20 #include "ccsds_types.h"
20 #include "ccsds_types.h"
21 #include "grlib_regs.h"
21 #include "grlib_regs.h"
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
35 rtems_id HK_id = RTEMS_ID_NONE;// id of the HK rate monotonic period
35 rtems_id HK_id = RTEMS_ID_NONE;// id of the HK rate monotonic period
36 rtems_name name_avgv_rate_monotonic = 0; // name of the AVGV rate monotonic
36 rtems_name name_avgv_rate_monotonic = 0; // name of the AVGV rate monotonic
37 rtems_id AVGV_id = RTEMS_ID_NONE;// id of the AVGV rate monotonic period
37 rtems_id AVGV_id = RTEMS_ID_NONE;// id of the AVGV rate monotonic period
38 int fdSPW = 0;
38 int fdSPW = 0;
39 int fdUART = 0;
39 int fdUART = 0;
40 unsigned char lfrCurrentMode = 0;
40 unsigned char lfrCurrentMode = 0;
41 unsigned char pa_bia_status_info = 0;
41 unsigned char pa_bia_status_info = 0;
42 unsigned char thisIsAnASMRestart = 0;
42 unsigned char thisIsAnASMRestart = 0;
43 unsigned char oneTcLfrUpdateTimeReceived = 0;
43 unsigned char oneTcLfrUpdateTimeReceived = 0;
44
44
45 // WAVEFORMS GLOBAL VARIABLES // 2048 * 3 * 4 + 2 * 4 = 24576 + 8 bytes = 24584
45 // WAVEFORMS GLOBAL VARIABLES // 2048 * 3 * 4 + 2 * 4 = 24576 + 8 bytes = 24584
46 // 97 * 256 = 24832 => delta = 248 bytes = 62 words
46 // 97 * 256 = 24832 => delta = 248 bytes = 62 words
47 // WAVEFORMS GLOBAL VARIABLES // 2688 * 3 * 4 + 2 * 4 = 32256 + 8 bytes = 32264
47 // WAVEFORMS GLOBAL VARIABLES // 2688 * 3 * 4 + 2 * 4 = 32256 + 8 bytes = 32264
48 // 127 * 256 = 32512 => delta = 248 bytes = 62 words
48 // 127 * 256 = 32512 => delta = 248 bytes = 62 words
49 // F0 F1 F2 F3
49 // F0 F1 F2 F3
50 volatile int wf_buffer_f0[ NB_RING_NODES_F0 * WFRM_BUFFER ] __attribute__((aligned(0x100))) = {0};
50 volatile int wf_buffer_f0[ NB_RING_NODES_F0 * WFRM_BUFFER ] __attribute__((aligned(0x100))) = {0};
51 volatile int wf_buffer_f1[ NB_RING_NODES_F1 * WFRM_BUFFER ] __attribute__((aligned(0x100))) = {0};
51 volatile int wf_buffer_f1[ NB_RING_NODES_F1 * WFRM_BUFFER ] __attribute__((aligned(0x100))) = {0};
52 volatile int wf_buffer_f2[ NB_RING_NODES_F2 * WFRM_BUFFER ] __attribute__((aligned(0x100))) = {0};
52 volatile int wf_buffer_f2[ NB_RING_NODES_F2 * WFRM_BUFFER ] __attribute__((aligned(0x100))) = {0};
53 volatile int wf_buffer_f3[ NB_RING_NODES_F3 * WFRM_BUFFER ] __attribute__((aligned(0x100))) = {0};
53 volatile int wf_buffer_f3[ NB_RING_NODES_F3 * WFRM_BUFFER ] __attribute__((aligned(0x100))) = {0};
54
54
55 //***********************************
55 //***********************************
56 // SPECTRAL MATRICES GLOBAL VARIABLES
56 // SPECTRAL MATRICES GLOBAL VARIABLES
57
57
58 // alignment constraints for the spectral matrices buffers => the first data after the time (8 bytes) shall be aligned on 0x00
58 // alignment constraints for the spectral matrices buffers => the first data after the time (8 bytes) shall be aligned on 0x00
59 volatile int sm_f0[ NB_RING_NODES_SM_F0 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100))) = {0};
59 volatile int sm_f0[ NB_RING_NODES_SM_F0 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100))) = {0};
60 volatile int sm_f1[ NB_RING_NODES_SM_F1 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100))) = {0};
60 volatile int sm_f1[ NB_RING_NODES_SM_F1 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100))) = {0};
61 volatile int sm_f2[ NB_RING_NODES_SM_F2 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100))) = {0};
61 volatile int sm_f2[ NB_RING_NODES_SM_F2 * TOTAL_SIZE_SM ] __attribute__((aligned(0x100))) = {0};
62
62
63 // APB CONFIGURATION REGISTERS
63 // APB CONFIGURATION REGISTERS
64 time_management_regs_t *time_management_regs = (time_management_regs_t*) REGS_ADDR_TIME_MANAGEMENT;
64 time_management_regs_t *time_management_regs = (time_management_regs_t*) REGS_ADDR_TIME_MANAGEMENT;
65 gptimer_regs_t *gptimer_regs = (gptimer_regs_t *) REGS_ADDR_GPTIMER;
65 gptimer_regs_t *gptimer_regs = (gptimer_regs_t *) REGS_ADDR_GPTIMER;
66 waveform_picker_regs_0_1_18_t *waveform_picker_regs = (waveform_picker_regs_0_1_18_t*) REGS_ADDR_WAVEFORM_PICKER;
66 waveform_picker_regs_0_1_18_t *waveform_picker_regs = (waveform_picker_regs_0_1_18_t*) REGS_ADDR_WAVEFORM_PICKER;
67 spectral_matrix_regs_t *spectral_matrix_regs = (spectral_matrix_regs_t*) REGS_ADDR_SPECTRAL_MATRIX;
67 spectral_matrix_regs_t *spectral_matrix_regs = (spectral_matrix_regs_t*) REGS_ADDR_SPECTRAL_MATRIX;
68
68
69 // MODE PARAMETERS
69 // MODE PARAMETERS
70 Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet = {0};
70 Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet = {0};
71 struct param_local_str param_local = {0};
71 struct param_local_str param_local = {0};
72 unsigned int lastValidEnterModeTime = {0};
72 unsigned int lastValidEnterModeTime = {0};
73
73
74 // HK PACKETS
74 // HK PACKETS
75 Packet_TM_LFR_HK_t housekeeping_packet = {0};
75 Packet_TM_LFR_HK_t housekeeping_packet = {0};
76 // message queues occupancy
76 // message queues occupancy
77 unsigned char hk_lfr_q_sd_fifo_size_max = 0;
77 unsigned char hk_lfr_q_sd_fifo_size_max = 0;
78 unsigned char hk_lfr_q_rv_fifo_size_max = 0;
78 unsigned char hk_lfr_q_rv_fifo_size_max = 0;
79 unsigned char hk_lfr_q_p0_fifo_size_max = 0;
79 unsigned char hk_lfr_q_p0_fifo_size_max = 0;
80 unsigned char hk_lfr_q_p1_fifo_size_max = 0;
80 unsigned char hk_lfr_q_p1_fifo_size_max = 0;
81 unsigned char hk_lfr_q_p2_fifo_size_max = 0;
81 unsigned char hk_lfr_q_p2_fifo_size_max = 0;
82 // sequence counters are incremented by APID (PID + CAT) and destination ID
82 // sequence counters are incremented by APID (PID + CAT) and destination ID
83 unsigned short sequenceCounters_SCIENCE_NORMAL_BURST __attribute__((aligned(0x4))) = 0;
83 unsigned short sequenceCounters_SCIENCE_NORMAL_BURST __attribute__((aligned(0x4))) = 0;
84 unsigned short sequenceCounters_SCIENCE_SBM1_SBM2 __attribute__((aligned(0x4))) = 0;
84 unsigned short sequenceCounters_SCIENCE_SBM1_SBM2 __attribute__((aligned(0x4))) = 0;
85 unsigned short sequenceCounters_TC_EXE[SEQ_CNT_NB_DEST_ID] __attribute__((aligned(0x4))) = {0};
85 unsigned short sequenceCounters_TC_EXE[SEQ_CNT_NB_DEST_ID] __attribute__((aligned(0x4))) = {0};
86 unsigned short sequenceCounters_TM_DUMP[SEQ_CNT_NB_DEST_ID] __attribute__((aligned(0x4))) = {0};
86 unsigned short sequenceCounters_TM_DUMP[SEQ_CNT_NB_DEST_ID] __attribute__((aligned(0x4))) = {0};
87 unsigned short sequenceCounterHK __attribute__((aligned(0x4))) = {0};
87 unsigned short sequenceCounterHK __attribute__((aligned(0x4))) = {0};
88 spw_stats grspw_stats __attribute__((aligned(0x4))) = {0};
88 spw_stats grspw_stats __attribute__((aligned(0x4))) = {0};
89
89
90 // TC_LFR_UPDATE_INFO
90 // TC_LFR_UPDATE_INFO
91 rw_f_t rw_f;
91 rw_f_t rw_f;
92
92
93 // TC_LFR_LOAD_FILTER_PAR
93 // TC_LFR_LOAD_FILTER_PAR
94 filterPar_t filterPar = {0};
94 filterPar_t filterPar = {0};
95
95
96 fbins_masks_t fbins_masks = {0};
96 fbins_masks_t fbins_masks = {0};
@@ -1,1007 +1,1009
1 /** This is the RTEMS initialization module.
1 /** This is the RTEMS initialization module.
2 *
2 *
3 * @file
3 * @file
4 * @author P. LEROY
4 * @author P. LEROY
5 *
5 *
6 * This module contains two very different information:
6 * This module contains two very different information:
7 * - specific instructions to configure the compilation of the RTEMS executive
7 * - specific instructions to configure the compilation of the RTEMS executive
8 * - functions related to the fligth softwre initialization, especially the INIT RTEMS task
8 * - functions related to the fligth softwre initialization, especially the INIT RTEMS task
9 *
9 *
10 */
10 */
11
11
12 //*************************
12 //*************************
13 // GPL reminder to be added
13 // GPL reminder to be added
14 //*************************
14 //*************************
15
15
16 #include <rtems.h>
16 #include <rtems.h>
17
17
18
18
19 /* configuration information */
19 /* configuration information */
20
20
21 #define CONFIGURE_INIT
21 #define CONFIGURE_INIT
22
22
23 #include <bsp.h> /* for device driver prototypes */
23 #include <bsp.h> /* for device driver prototypes */
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"
67 #include "fsw_config.c"
50 #include "fsw_config.c"
68 #include "GscMemoryLPP.hpp"
51 #include "GscMemoryLPP.hpp"
69
52
70 void initCache()
53 void initCache()
71 {
54 {
72 // ASI 2 contains a few control registers that have not been assigned as ancillary state registers.
55 // ASI 2 contains a few control registers that have not been assigned as ancillary state registers.
73 // These should only be read and written using 32-bit LDA/STA instructions.
56 // These should only be read and written using 32-bit LDA/STA instructions.
74 // All cache registers are accessed through load/store operations to the alternate address space (LDA/STA), using ASI = 2.
57 // All cache registers are accessed through load/store operations to the alternate address space (LDA/STA), using ASI = 2.
75 // The table below shows the register addresses:
58 // The table below shows the register addresses:
76 // 0x00 Cache control register
59 // 0x00 Cache control register
77 // 0x04 Reserved
60 // 0x04 Reserved
78 // 0x08 Instruction cache configuration register
61 // 0x08 Instruction cache configuration register
79 // 0x0C Data cache configuration register
62 // 0x0C Data cache configuration register
80
63
81 // Cache Control Register Leon3 / Leon3FT
64 // Cache Control Register Leon3 / Leon3FT
82 // 31..30 29 28 27..24 23 22 21 20..19 18 17 16
65 // 31..30 29 28 27..24 23 22 21 20..19 18 17 16
83 // RFT PS TB DS FD FI FT ST IB
66 // RFT PS TB DS FD FI FT ST IB
84 // 15 14 13..12 11..10 9..8 7..6 5 4 3..2 1..0
67 // 15 14 13..12 11..10 9..8 7..6 5 4 3..2 1..0
85 // IP DP ITE IDE DTE DDE DF IF DCS ICS
68 // IP DP ITE IDE DTE DDE DF IF DCS ICS
86
69
87 unsigned int cacheControlRegister;
70 unsigned int cacheControlRegister;
88
71
89 CCR_resetCacheControlRegister();
72 CCR_resetCacheControlRegister();
90 ASR16_resetRegisterProtectionControlRegister();
73 ASR16_resetRegisterProtectionControlRegister();
91
74
92 cacheControlRegister = CCR_getValue();
75 cacheControlRegister = CCR_getValue();
93 PRINTF1("(0) CCR - Cache Control Register = %x\n", cacheControlRegister);
76 PRINTF1("(0) CCR - Cache Control Register = %x\n", cacheControlRegister);
94 PRINTF1("(0) ASR16 = %x\n", *asr16Ptr);
77 PRINTF1("(0) ASR16 = %x\n", *asr16Ptr);
95
78
96 CCR_enableInstructionCache(); // ICS bits
79 CCR_enableInstructionCache(); // ICS bits
97 CCR_enableDataCache(); // DCS bits
80 CCR_enableDataCache(); // DCS bits
98 CCR_enableInstructionBurstFetch(); // IB bit
81 CCR_enableInstructionBurstFetch(); // IB bit
99
82
100 faultTolerantScheme();
83 faultTolerantScheme();
101
84
102 cacheControlRegister = CCR_getValue();
85 cacheControlRegister = CCR_getValue();
103 PRINTF1("(1) CCR - Cache Control Register = %x\n", cacheControlRegister);
86 PRINTF1("(1) CCR - Cache Control Register = %x\n", cacheControlRegister);
104 PRINTF1("(1) ASR16 Register protection control register = %x\n", *asr16Ptr);
87 PRINTF1("(1) ASR16 Register protection control register = %x\n", *asr16Ptr);
105
88
106 PRINTF("\n");
89 PRINTF("\n");
107 }
90 }
108
91
109 rtems_task Init( rtems_task_argument ignored )
92 rtems_task Init( rtems_task_argument ignored )
110 {
93 {
111 /** This is the RTEMS INIT taks, it is the first task launched by the system.
94 /** This is the RTEMS INIT taks, it is the first task launched by the system.
112 *
95 *
113 * @param unused is the starting argument of the RTEMS task
96 * @param unused is the starting argument of the RTEMS task
114 *
97 *
115 * The INIT task create and run all other RTEMS tasks.
98 * The INIT task create and run all other RTEMS tasks.
116 *
99 *
117 */
100 */
118
101
119 //***********
102 //***********
120 // INIT CACHE
103 // INIT CACHE
121
104
122 unsigned char *vhdlVersion;
105 unsigned char *vhdlVersion;
123
106
124 reset_lfr();
107 reset_lfr();
125
108
126 reset_local_time();
109 reset_local_time();
127
110
128 rtems_cpu_usage_reset();
111 rtems_cpu_usage_reset();
129
112
130 rtems_status_code status;
113 rtems_status_code status;
131 rtems_status_code status_spw;
114 rtems_status_code status_spw;
132 rtems_isr_entry old_isr_handler;
115 rtems_isr_entry old_isr_handler;
133
116
134 old_isr_handler = NULL;
117 old_isr_handler = NULL;
135
118
136 // UART settings
119 // UART settings
137 enable_apbuart_transmitter();
120 enable_apbuart_transmitter();
138 set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE);
121 set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE);
139
122
140 DEBUG_PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n")
123 DEBUG_PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n")
141
124
142
125
143 PRINTF("\n\n\n\n\n")
126 PRINTF("\n\n\n\n\n")
144
127
145 initCache();
128 initCache();
146
129
147 PRINTF("*************************\n")
130 PRINTF("*************************\n")
148 PRINTF("** LFR Flight Software **\n")
131 PRINTF("** LFR Flight Software **\n")
149
132
150 PRINTF1("** %d-", SW_VERSION_N1)
133 PRINTF1("** %d-", SW_VERSION_N1)
151 PRINTF1("%d-" , SW_VERSION_N2)
134 PRINTF1("%d-" , SW_VERSION_N2)
152 PRINTF1("%d-" , SW_VERSION_N3)
135 PRINTF1("%d-" , SW_VERSION_N3)
153 PRINTF1("%d **\n", SW_VERSION_N4)
136 PRINTF1("%d **\n", SW_VERSION_N4)
154
137
155 vhdlVersion = (unsigned char *) (REGS_ADDR_VHDL_VERSION);
138 vhdlVersion = (unsigned char *) (REGS_ADDR_VHDL_VERSION);
156 PRINTF("** VHDL **\n")
139 PRINTF("** VHDL **\n")
157 PRINTF1("** %d-", vhdlVersion[1])
140 PRINTF1("** %d-", vhdlVersion[1])
158 PRINTF1("%d-" , vhdlVersion[2])
141 PRINTF1("%d-" , vhdlVersion[2])
159 PRINTF1("%d **\n", vhdlVersion[3])
142 PRINTF1("%d **\n", vhdlVersion[3])
160 PRINTF("*************************\n")
143 PRINTF("*************************\n")
161 PRINTF("\n\n")
144 PRINTF("\n\n")
162
145
163 init_parameter_dump();
146 init_parameter_dump();
164 init_kcoefficients_dump();
147 init_kcoefficients_dump();
165 init_local_mode_parameters();
148 init_local_mode_parameters();
166 init_housekeeping_parameters();
149 init_housekeeping_parameters();
167 init_k_coefficients_prc0();
150 init_k_coefficients_prc0();
168 init_k_coefficients_prc1();
151 init_k_coefficients_prc1();
169 init_k_coefficients_prc2();
152 init_k_coefficients_prc2();
170 pa_bia_status_info = INIT_CHAR;
153 pa_bia_status_info = INIT_CHAR;
171
154
172 // initialize all reaction wheels frequencies to NaN
155 // initialize all reaction wheels frequencies to NaN
173 rw_f.cp_rpw_sc_rw1_f1 = NAN;
156 rw_f.cp_rpw_sc_rw1_f1 = NAN;
174 rw_f.cp_rpw_sc_rw1_f2 = NAN;
157 rw_f.cp_rpw_sc_rw1_f2 = NAN;
175 rw_f.cp_rpw_sc_rw1_f3 = NAN;
158 rw_f.cp_rpw_sc_rw1_f3 = NAN;
176 rw_f.cp_rpw_sc_rw1_f4 = NAN;
159 rw_f.cp_rpw_sc_rw1_f4 = NAN;
177 rw_f.cp_rpw_sc_rw2_f1 = NAN;
160 rw_f.cp_rpw_sc_rw2_f1 = NAN;
178 rw_f.cp_rpw_sc_rw2_f2 = NAN;
161 rw_f.cp_rpw_sc_rw2_f2 = NAN;
179 rw_f.cp_rpw_sc_rw2_f3 = NAN;
162 rw_f.cp_rpw_sc_rw2_f3 = NAN;
180 rw_f.cp_rpw_sc_rw2_f4 = NAN;
163 rw_f.cp_rpw_sc_rw2_f4 = NAN;
181 rw_f.cp_rpw_sc_rw3_f1 = NAN;
164 rw_f.cp_rpw_sc_rw3_f1 = NAN;
182 rw_f.cp_rpw_sc_rw3_f2 = NAN;
165 rw_f.cp_rpw_sc_rw3_f2 = NAN;
183 rw_f.cp_rpw_sc_rw3_f3 = NAN;
166 rw_f.cp_rpw_sc_rw3_f3 = NAN;
184 rw_f.cp_rpw_sc_rw3_f4 = NAN;
167 rw_f.cp_rpw_sc_rw3_f4 = NAN;
185 rw_f.cp_rpw_sc_rw4_f1 = NAN;
168 rw_f.cp_rpw_sc_rw4_f1 = NAN;
186 rw_f.cp_rpw_sc_rw4_f2 = NAN;
169 rw_f.cp_rpw_sc_rw4_f2 = NAN;
187 rw_f.cp_rpw_sc_rw4_f3 = NAN;
170 rw_f.cp_rpw_sc_rw4_f3 = NAN;
188 rw_f.cp_rpw_sc_rw4_f4 = NAN;
171 rw_f.cp_rpw_sc_rw4_f4 = NAN;
189
172
190 // initialize filtering parameters
173 // initialize filtering parameters
191 filterPar.spare_sy_lfr_pas_filter_enabled = DEFAULT_SY_LFR_PAS_FILTER_ENABLED;
174 filterPar.spare_sy_lfr_pas_filter_enabled = DEFAULT_SY_LFR_PAS_FILTER_ENABLED;
192 filterPar.sy_lfr_sc_rw_delta_f = DEFAULT_SY_LFR_SC_RW_DELTA_F;
175 filterPar.sy_lfr_sc_rw_delta_f = DEFAULT_SY_LFR_SC_RW_DELTA_F;
193 filterPar.sy_lfr_pas_filter_tbad = DEFAULT_SY_LFR_PAS_FILTER_TBAD;
176 filterPar.sy_lfr_pas_filter_tbad = DEFAULT_SY_LFR_PAS_FILTER_TBAD;
194 filterPar.sy_lfr_pas_filter_shift = DEFAULT_SY_LFR_PAS_FILTER_SHIFT;
177 filterPar.sy_lfr_pas_filter_shift = DEFAULT_SY_LFR_PAS_FILTER_SHIFT;
195 filterPar.modulus_in_finetime = DEFAULT_MODULUS;
178 filterPar.modulus_in_finetime = DEFAULT_MODULUS;
196 filterPar.tbad_in_finetime = DEFAULT_TBAD;
179 filterPar.tbad_in_finetime = DEFAULT_TBAD;
197 filterPar.offset_in_finetime = DEFAULT_OFFSET;
180 filterPar.offset_in_finetime = DEFAULT_OFFSET;
198 filterPar.shift_in_finetime = DEFAULT_SHIFT;
181 filterPar.shift_in_finetime = DEFAULT_SHIFT;
199 update_last_valid_transition_date( DEFAULT_LAST_VALID_TRANSITION_DATE );
182 update_last_valid_transition_date( DEFAULT_LAST_VALID_TRANSITION_DATE );
200
183
201 // waveform picker initialization
184 // waveform picker initialization
202 WFP_init_rings();
185 WFP_init_rings();
203 LEON_Clear_interrupt( IRQ_SPARC_GPTIMER_WATCHDOG ); // initialize the waveform rings
186 LEON_Clear_interrupt( IRQ_SPARC_GPTIMER_WATCHDOG ); // initialize the waveform rings
204 WFP_reset_current_ring_nodes();
187 WFP_reset_current_ring_nodes();
205 reset_waveform_picker_regs();
188 reset_waveform_picker_regs();
206
189
207 // spectral matrices initialization
190 // spectral matrices initialization
208 SM_init_rings(); // initialize spectral matrices rings
191 SM_init_rings(); // initialize spectral matrices rings
209 SM_reset_current_ring_nodes();
192 SM_reset_current_ring_nodes();
210 reset_spectral_matrix_regs();
193 reset_spectral_matrix_regs();
211
194
212 // configure calibration
195 // configure calibration
213 configureCalibration( false ); // true means interleaved mode, false is for normal mode
196 configureCalibration( false ); // true means interleaved mode, false is for normal mode
214
197
215 updateLFRCurrentMode( LFR_MODE_STANDBY );
198 updateLFRCurrentMode( LFR_MODE_STANDBY );
216
199
217 BOOT_PRINTF1("in INIT *** lfrCurrentMode is %d\n", lfrCurrentMode)
200 BOOT_PRINTF1("in INIT *** lfrCurrentMode is %d\n", lfrCurrentMode)
218
201
219 create_names(); // create all names
202 create_names(); // create all names
220
203
221 status = create_timecode_timer(); // create the timer used by timecode_irq_handler
204 status = create_timecode_timer(); // create the timer used by timecode_irq_handler
222 if (status != RTEMS_SUCCESSFUL)
205 if (status != RTEMS_SUCCESSFUL)
223 {
206 {
224 PRINTF1("in INIT *** ERR in create_timer_timecode, code %d", status)
207 PRINTF1("in INIT *** ERR in create_timer_timecode, code %d", status)
225 }
208 }
226
209
227 status = create_message_queues(); // create message queues
210 status = create_message_queues(); // create message queues
228 if (status != RTEMS_SUCCESSFUL)
211 if (status != RTEMS_SUCCESSFUL)
229 {
212 {
230 PRINTF1("in INIT *** ERR in create_message_queues, code %d", status)
213 PRINTF1("in INIT *** ERR in create_message_queues, code %d", status)
231 }
214 }
232
215
233 status = create_all_tasks(); // create all tasks
216 status = create_all_tasks(); // create all tasks
234 if (status != RTEMS_SUCCESSFUL)
217 if (status != RTEMS_SUCCESSFUL)
235 {
218 {
236 PRINTF1("in INIT *** ERR in create_all_tasks, code %d\n", status)
219 PRINTF1("in INIT *** ERR in create_all_tasks, code %d\n", status)
237 }
220 }
238
221
239 // **************************
222 // **************************
240 // <SPACEWIRE INITIALIZATION>
223 // <SPACEWIRE INITIALIZATION>
241 status_spw = spacewire_open_link(); // (1) open the link
224 status_spw = spacewire_open_link(); // (1) open the link
242 if ( status_spw != RTEMS_SUCCESSFUL )
225 if ( status_spw != RTEMS_SUCCESSFUL )
243 {
226 {
244 PRINTF1("in INIT *** ERR spacewire_open_link code %d\n", status_spw )
227 PRINTF1("in INIT *** ERR spacewire_open_link code %d\n", status_spw )
245 }
228 }
246
229
247 if ( status_spw == RTEMS_SUCCESSFUL ) // (2) configure the link
230 if ( status_spw == RTEMS_SUCCESSFUL ) // (2) configure the link
248 {
231 {
249 status_spw = spacewire_configure_link( fdSPW );
232 status_spw = spacewire_configure_link( fdSPW );
250 if ( status_spw != RTEMS_SUCCESSFUL )
233 if ( status_spw != RTEMS_SUCCESSFUL )
251 {
234 {
252 PRINTF1("in INIT *** ERR spacewire_configure_link code %d\n", status_spw )
235 PRINTF1("in INIT *** ERR spacewire_configure_link code %d\n", status_spw )
253 }
236 }
254 }
237 }
255
238
256 if ( status_spw == RTEMS_SUCCESSFUL) // (3) start the link
239 if ( status_spw == RTEMS_SUCCESSFUL) // (3) start the link
257 {
240 {
258 status_spw = spacewire_start_link( fdSPW );
241 status_spw = spacewire_start_link( fdSPW );
259 if ( status_spw != RTEMS_SUCCESSFUL )
242 if ( status_spw != RTEMS_SUCCESSFUL )
260 {
243 {
261 PRINTF1("in INIT *** ERR spacewire_start_link code %d\n", status_spw )
244 PRINTF1("in INIT *** ERR spacewire_start_link code %d\n", status_spw )
262 }
245 }
263 }
246 }
264 // </SPACEWIRE INITIALIZATION>
247 // </SPACEWIRE INITIALIZATION>
265 // ***************************
248 // ***************************
266
249
267 status = start_all_tasks(); // start all tasks
250 status = start_all_tasks(); // start all tasks
268 if (status != RTEMS_SUCCESSFUL)
251 if (status != RTEMS_SUCCESSFUL)
269 {
252 {
270 PRINTF1("in INIT *** ERR in start_all_tasks, code %d", status)
253 PRINTF1("in INIT *** ERR in start_all_tasks, code %d", status)
271 }
254 }
272
255
273 // start RECV and SEND *AFTER* SpaceWire Initialization, due to the timeout of the start call during the initialization
256 // start RECV and SEND *AFTER* SpaceWire Initialization, due to the timeout of the start call during the initialization
274 status = start_recv_send_tasks();
257 status = start_recv_send_tasks();
275 if ( status != RTEMS_SUCCESSFUL )
258 if ( status != RTEMS_SUCCESSFUL )
276 {
259 {
277 PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status )
260 PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status )
278 }
261 }
279
262
280 // suspend science tasks, they will be restarted later depending on the mode
263 // suspend science tasks, they will be restarted later depending on the mode
281 status = suspend_science_tasks(); // suspend science tasks (not done in stop_current_mode if current mode = STANDBY)
264 status = suspend_science_tasks(); // suspend science tasks (not done in stop_current_mode if current mode = STANDBY)
282 if (status != RTEMS_SUCCESSFUL)
265 if (status != RTEMS_SUCCESSFUL)
283 {
266 {
284 PRINTF1("in INIT *** in suspend_science_tasks *** ERR code: %d\n", status)
267 PRINTF1("in INIT *** in suspend_science_tasks *** ERR code: %d\n", status)
285 }
268 }
286
269
287 // configure IRQ handling for the waveform picker unit
270 // configure IRQ handling for the waveform picker unit
288 status = rtems_interrupt_catch( waveforms_isr,
271 status = rtems_interrupt_catch( waveforms_isr,
289 IRQ_SPARC_WAVEFORM_PICKER,
272 IRQ_SPARC_WAVEFORM_PICKER,
290 &old_isr_handler) ;
273 &old_isr_handler) ;
291 // configure IRQ handling for the spectral matrices unit
274 // configure IRQ handling for the spectral matrices unit
292 status = rtems_interrupt_catch( spectral_matrices_isr,
275 status = rtems_interrupt_catch( spectral_matrices_isr,
293 IRQ_SPARC_SPECTRAL_MATRIX,
276 IRQ_SPARC_SPECTRAL_MATRIX,
294 &old_isr_handler) ;
277 &old_isr_handler) ;
295
278
296 // if the spacewire link is not up then send an event to the SPIQ task for link recovery
279 // if the spacewire link is not up then send an event to the SPIQ task for link recovery
297 if ( status_spw != RTEMS_SUCCESSFUL )
280 if ( status_spw != RTEMS_SUCCESSFUL )
298 {
281 {
299 status = rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT );
282 status = rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT );
300 if ( status != RTEMS_SUCCESSFUL ) {
283 if ( status != RTEMS_SUCCESSFUL ) {
301 PRINTF1("in INIT *** ERR rtems_event_send to SPIQ code %d\n", status )
284 PRINTF1("in INIT *** ERR rtems_event_send to SPIQ code %d\n", status )
302 }
285 }
303 }
286 }
304
287
305 BOOT_PRINTF("delete INIT\n")
288 BOOT_PRINTF("delete INIT\n")
306
289
307 set_hk_lfr_sc_potential_flag( true );
290 set_hk_lfr_sc_potential_flag( true );
308
291
309 // start the timer to detect a missing spacewire timecode
292 // start the timer to detect a missing spacewire timecode
310 // the timeout is larger because the spw IP needs to receive several valid timecodes before generating a tickout
293 // the timeout is larger because the spw IP needs to receive several valid timecodes before generating a tickout
311 // if a tickout is generated, the timer is restarted
294 // if a tickout is generated, the timer is restarted
312 status = rtems_timer_fire_after( timecode_timer_id, TIMECODE_TIMER_TIMEOUT_INIT, timecode_timer_routine, NULL );
295 status = rtems_timer_fire_after( timecode_timer_id, TIMECODE_TIMER_TIMEOUT_INIT, timecode_timer_routine, NULL );
313
296
314 grspw_timecode_callback = &timecode_irq_handler;
297 grspw_timecode_callback = &timecode_irq_handler;
315
298
316 status = rtems_task_delete(RTEMS_SELF);
299 status = rtems_task_delete(RTEMS_SELF);
317
300
318 }
301 }
319
302
320 void init_local_mode_parameters( void )
303 void init_local_mode_parameters( void )
321 {
304 {
322 /** This function initialize the param_local global variable with default values.
305 /** This function initialize the param_local global variable with default values.
323 *
306 *
324 */
307 */
325
308
326 unsigned int i;
309 unsigned int i;
327
310
328 // LOCAL PARAMETERS
311 // LOCAL PARAMETERS
329
312
330 BOOT_PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max)
313 BOOT_PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max)
331 BOOT_PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max)
314 BOOT_PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max)
332
315
333 // init sequence counters
316 // init sequence counters
334
317
335 for(i = 0; i<SEQ_CNT_NB_DEST_ID; i++)
318 for(i = 0; i<SEQ_CNT_NB_DEST_ID; i++)
336 {
319 {
337 sequenceCounters_TC_EXE[i] = INIT_CHAR;
320 sequenceCounters_TC_EXE[i] = INIT_CHAR;
338 sequenceCounters_TM_DUMP[i] = INIT_CHAR;
321 sequenceCounters_TM_DUMP[i] = INIT_CHAR;
339 }
322 }
340 sequenceCounters_SCIENCE_NORMAL_BURST = INIT_CHAR;
323 sequenceCounters_SCIENCE_NORMAL_BURST = INIT_CHAR;
341 sequenceCounters_SCIENCE_SBM1_SBM2 = INIT_CHAR;
324 sequenceCounters_SCIENCE_SBM1_SBM2 = INIT_CHAR;
342 sequenceCounterHK = TM_PACKET_SEQ_CTRL_STANDALONE << TM_PACKET_SEQ_SHIFT;
325 sequenceCounterHK = TM_PACKET_SEQ_CTRL_STANDALONE << TM_PACKET_SEQ_SHIFT;
343 }
326 }
344
327
345 void reset_local_time( void )
328 void reset_local_time( void )
346 {
329 {
347 time_management_regs->ctrl = time_management_regs->ctrl | VAL_SOFTWARE_RESET; // [0010] software reset, coarse time = 0x80000000
330 time_management_regs->ctrl = time_management_regs->ctrl | VAL_SOFTWARE_RESET; // [0010] software reset, coarse time = 0x80000000
348 }
331 }
349
332
350 void create_names( void ) // create all names for tasks and queues
333 void create_names( void ) // create all names for tasks and queues
351 {
334 {
352 /** This function creates all RTEMS names used in the software for tasks and queues.
335 /** This function creates all RTEMS names used in the software for tasks and queues.
353 *
336 *
354 * @return RTEMS directive status codes:
337 * @return RTEMS directive status codes:
355 * - RTEMS_SUCCESSFUL - successful completion
338 * - RTEMS_SUCCESSFUL - successful completion
356 *
339 *
357 */
340 */
358
341
359 // task names
342 // task names
360 Task_name[TASKID_AVGV] = rtems_build_name( 'A', 'V', 'G', 'V' );
343 Task_name[TASKID_AVGV] = rtems_build_name( 'A', 'V', 'G', 'V' );
361 Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' );
344 Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' );
362 Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' );
345 Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' );
363 Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' );
346 Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' );
364 Task_name[TASKID_LOAD] = rtems_build_name( 'L', 'O', 'A', 'D' );
347 Task_name[TASKID_LOAD] = rtems_build_name( 'L', 'O', 'A', 'D' );
365 Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' );
348 Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' );
366 Task_name[TASKID_SWBD] = rtems_build_name( 'S', 'W', 'B', 'D' );
349 Task_name[TASKID_SWBD] = rtems_build_name( 'S', 'W', 'B', 'D' );
367 Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' );
350 Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' );
368 Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' );
351 Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' );
369 Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' );
352 Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' );
370 Task_name[TASKID_PRC0] = rtems_build_name( 'P', 'R', 'C', '0' );
353 Task_name[TASKID_PRC0] = rtems_build_name( 'P', 'R', 'C', '0' );
371 Task_name[TASKID_CWF3] = rtems_build_name( 'C', 'W', 'F', '3' );
354 Task_name[TASKID_CWF3] = rtems_build_name( 'C', 'W', 'F', '3' );
372 Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' );
355 Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' );
373 Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' );
356 Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' );
374 Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' );
357 Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' );
375 Task_name[TASKID_LINK] = rtems_build_name( 'L', 'I', 'N', 'K' );
358 Task_name[TASKID_LINK] = rtems_build_name( 'L', 'I', 'N', 'K' );
376 Task_name[TASKID_AVF1] = rtems_build_name( 'A', 'V', 'F', '1' );
359 Task_name[TASKID_AVF1] = rtems_build_name( 'A', 'V', 'F', '1' );
377 Task_name[TASKID_PRC1] = rtems_build_name( 'P', 'R', 'C', '1' );
360 Task_name[TASKID_PRC1] = rtems_build_name( 'P', 'R', 'C', '1' );
378 Task_name[TASKID_AVF2] = rtems_build_name( 'A', 'V', 'F', '2' );
361 Task_name[TASKID_AVF2] = rtems_build_name( 'A', 'V', 'F', '2' );
379 Task_name[TASKID_PRC2] = rtems_build_name( 'P', 'R', 'C', '2' );
362 Task_name[TASKID_PRC2] = rtems_build_name( 'P', 'R', 'C', '2' );
380 Task_name[TASKID_SCRB] = rtems_build_name( 'S', 'C', 'R', 'B' );
363 Task_name[TASKID_SCRB] = rtems_build_name( 'S', 'C', 'R', 'B' );
381 Task_name[TASKID_CALI] = rtems_build_name( 'C', 'A', 'L', 'I' );
364 Task_name[TASKID_CALI] = rtems_build_name( 'C', 'A', 'L', 'I' );
382
365
383 // rate monotonic period names
366 // rate monotonic period names
384 name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' );
367 name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' );
385 name_avgv_rate_monotonic = rtems_build_name( 'A', 'V', 'G', 'V' );
368 name_avgv_rate_monotonic = rtems_build_name( 'A', 'V', 'G', 'V' );
386
369
387 misc_name[QUEUE_RECV] = rtems_build_name( 'Q', '_', 'R', 'V' );
370 misc_name[QUEUE_RECV] = rtems_build_name( 'Q', '_', 'R', 'V' );
388 misc_name[QUEUE_SEND] = rtems_build_name( 'Q', '_', 'S', 'D' );
371 misc_name[QUEUE_SEND] = rtems_build_name( 'Q', '_', 'S', 'D' );
389 misc_name[QUEUE_PRC0] = rtems_build_name( 'Q', '_', 'P', '0' );
372 misc_name[QUEUE_PRC0] = rtems_build_name( 'Q', '_', 'P', '0' );
390 misc_name[QUEUE_PRC1] = rtems_build_name( 'Q', '_', 'P', '1' );
373 misc_name[QUEUE_PRC1] = rtems_build_name( 'Q', '_', 'P', '1' );
391 misc_name[QUEUE_PRC2] = rtems_build_name( 'Q', '_', 'P', '2' );
374 misc_name[QUEUE_PRC2] = rtems_build_name( 'Q', '_', 'P', '2' );
392
375
393 timecode_timer_name = rtems_build_name( 'S', 'P', 'T', 'C' );
376 timecode_timer_name = rtems_build_name( 'S', 'P', 'T', 'C' );
394 }
377 }
395
378
396 int create_all_tasks( void ) // create all tasks which run in the software
379 int create_all_tasks( void ) // create all tasks which run in the software