##// END OF EJS Templates
Switched to cmake, more portable and better conf options!
jeandet -
r301:04a96444cae4 R3_plus draft
parent child
Show More
@@ -0,0 +1,29
1 cmake_minimum_required (VERSION 2.6)
2 project (LFR_FSW)
3
4 if(NOT CMAKE_BUILD_TYPE)
5 set(CMAKE_BUILD_TYPE "Release" CACHE STRING
6 "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE)
7 endif(NOT CMAKE_BUILD_TYPE)
8
9 set(LFR_BP_SRC ${CMAKE_CURRENT_SOURCE_DIR}/LFR_basic-parameters/basic_parameters.c)
10
11 SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/sparc/")
12
13 include_directories("header"
14 "header/lfr_common_headers"
15 "header/processing"
16 "LFR_basic-parameters"
17 "src")
18
19 add_subdirectory(src)
20
21
22
23 option(test "Build all tests." ON) # Makes boolean 'test' available.
24
25
26 if (test)
27
28
29 endif()
@@ -0,0 +1,8
1 set(CMAKE_SYSTEM_NAME rtems)
2
3 set(CMAKE_C_COMPILER /opt/rtems-4.10/bin/sparc-rtems-gcc)
4 set(CMAKE_CXX_COMPILER /opt/rtems-4.10/bin/sparc-rtems-g++)
5 set(CMAKE_LINKER /opt/rtems-4.10/bin/sparc-rtems-g++)
6 SET(CMAKE_EXE_LINKER_FLAGS "-static")
7 set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_LINKER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
8 include_directories("/opt/rtems-4.10/sparc-rtems/leon3/lib/include")
@@ -0,0 +1,72
1 cmake_minimum_required (VERSION 2.6)
2 project (FSW)
3
4 include(sparc-rtems)
5
6
7 set(SOURCES wf_handler.c
8 tc_handler.c
9 fsw_misc.c
10 fsw_init.c
11 fsw_globals.c
12 fsw_spacewire.c
13 tc_load_dump_parameters.c
14 tm_lfr_tc_exe.c
15 tc_acceptance.c
16 processing/fsw_processing.c
17 processing/avf0_prc0.c
18 processing/avf1_prc1.c
19 processing/avf2_prc2.c
20 lfr_cpu_usage_report.c
21 ${LFR_BP_SRC}
22 )
23
24
25 option(verbose "Enable verbose LFR" ON)
26 option(boot_messages "Enable LFR boot messages" ON)
27 option(debug_messages "Enable LFR debug messages" ON)
28 option(cpu_usage_report "Enable LFR cpu usage report" OFF)
29 option(stack_report "Enable LFR stack report" OFF)
30 option(vhdl_dev "?" OFF)
31 option(lpp_dpu_destid "Set to debug at LPP" ON)
32 option(debug_watchdog "Enable debug watchdog" OFF)
33 option(debug_tch "?" OFF)
34
35
36 if (verbose)
37 add_definitions(-DPRINT_MESSAGES_ON_CONSOLE)
38 endif()
39 if (boot_messages)
40 add_definitions(-DBOOT_MESSAGES)
41 endif()
42 if (debug_messages)
43 add_definitions(-DDEBUG_MESSAGES)
44 endif()
45 if (cpu_usage_report)
46 add_definitions(-DPRINT_TASK_STATISTICS)
47 endif()
48 if (stack_report)
49 add_definitions(-DPRINT_STACK_REPORT)
50 endif()
51 if (vhdl_dev)
52 add_definitions(-DVHDL_DEV)
53 endif()
54 if (lpp_dpu_destid)
55 add_definitions(-DLPP_DPU_DESTID)
56 endif()
57 if (debug_watchdog)
58 add_definitions(-DDEBUG_WATCHDOG)
59 endif()
60 if (debug_tch)
61 add_definitions(-DDEBUG_TCH)
62 endif()
63
64 add_definitions(-DMSB_FIRST_TCH)
65
66 add_definitions(-DSWVERSION=-1-0)
67 add_definitions(-DSW_VERSION_N1=3)
68 add_definitions(-DSW_VERSION_N2=1)
69 add_definitions(-DSW_VERSION_N3=0)
70 add_definitions(-DSW_VERSION_N4=4)
71
72 add_executable(FSW ${SOURCES})
@@ -1,22 +1,23
1 syntax: glob
1 syntax: glob
2 *.pdf
2 *.pdf
3 *~
3 *~
4 *.o
4 *.o
5 *.gcno
5 *.gcno
6 *.gcda
6 *.gcda
7 *.html
7 *.html
8 *.zip
8 *.zip
9 tests/*.err
9 tests/*.err
10 doc
10 doc
11 *.srec
11 *.srec
12 FSW-qt/bin/fsw
12 FSW-qt/bin/fsw
13 timegen-qt/bin/timegen
13 timegen-qt/bin/timegen
14 src/LFR_basic-parameters
14 src/LFR_basic-parameters
15 *.pro.user.*
15 *.pro.user.*
16 FSW-qt/bin/spectralmatrix/asm_f0_test_20140403_case1.txt
16 FSW-qt/bin/spectralmatrix/asm_f0_test_20140403_case1.txt
17 FSW-qt/bin/spectralmatrix/asm_f0_test_20140403_case2.txt
17 FSW-qt/bin/spectralmatrix/asm_f0_test_20140403_case2.txt
18 FSW-qt/bin/spectralmatrix/asm_f0_test_paul_1.txt
18 FSW-qt/bin/spectralmatrix/asm_f0_test_paul_1.txt
19 run2/src
19 run2/src
20 run2/trace
20 run2/trace
21 run3/src
21 run3/src
22 run3/trace
22 run3/trace
23 *CMakeLists.txt.user
@@ -1,955 +1,955
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 /* configuration information */
18 /* configuration information */
19
19
20 #define CONFIGURE_INIT
20 #define CONFIGURE_INIT
21
21
22 #include <bsp.h> /* for device driver prototypes */
22 #include <bsp.h> /* for device driver prototypes */
23
23
24 /* configuration information */
24 /* configuration information */
25
25
26 #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
26 #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
27 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
27 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
28
28
29 #define CONFIGURE_MAXIMUM_TASKS 21 // number of tasks concurrently active including INIT
29 #define CONFIGURE_MAXIMUM_TASKS 21 // number of tasks concurrently active including INIT
30 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
30 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
31 #define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE)
31 #define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE)
32 #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32
32 #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32
33 #define CONFIGURE_INIT_TASK_PRIORITY 1 // instead of 100
33 #define CONFIGURE_INIT_TASK_PRIORITY 1 // instead of 100
34 #define CONFIGURE_INIT_TASK_MODE (RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT)
34 #define CONFIGURE_INIT_TASK_MODE (RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT)
35 #define CONFIGURE_INIT_TASK_ATTRIBUTES (RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT)
35 #define CONFIGURE_INIT_TASK_ATTRIBUTES (RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT)
36 #define CONFIGURE_MAXIMUM_DRIVERS 16
36 #define CONFIGURE_MAXIMUM_DRIVERS 16
37 #define CONFIGURE_MAXIMUM_PERIODS 5 // [hous] [load] [avgv]
37 #define CONFIGURE_MAXIMUM_PERIODS 5 // [hous] [load] [avgv]
38 #define CONFIGURE_MAXIMUM_TIMERS 5 // [spiq] [link] [spacewire_reset_link]
38 #define CONFIGURE_MAXIMUM_TIMERS 5 // [spiq] [link] [spacewire_reset_link]
39 #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 5
39 #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 5
40 #ifdef PRINT_STACK_REPORT
40 #ifdef PRINT_STACK_REPORT
41 #define CONFIGURE_STACK_CHECKER_ENABLED
41 #define CONFIGURE_STACK_CHECKER_ENABLED
42 #endif
42 #endif
43
43
44 #include <rtems/confdefs.h>
44 #include <rtems/confdefs.h>
45
45
46 /* If --drvmgr was enabled during the configuration of the RTEMS kernel */
46 /* If --drvmgr was enabled during the configuration of the RTEMS kernel */
47 #ifdef RTEMS_DRVMGR_STARTUP
47 #ifdef RTEMS_DRVMGR_STARTUP
48 #ifdef LEON3
48 #ifdef LEON3
49 /* Add Timer and UART Driver */
49 /* Add Timer and UART Driver */
50
50
51 #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
51 #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
52 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GPTIMER
52 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GPTIMER
53 #endif
53 #endif
54
54
55 #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
55 #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
56 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_APBUART
56 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_APBUART
57 #endif
57 #endif
58
58
59 #endif
59 #endif
60 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRSPW /* GRSPW Driver */
60 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRSPW /* GRSPW Driver */
61
61
62 #include <drvmgr/drvmgr_confdefs.h>
62 #include <drvmgr/drvmgr_confdefs.h>
63 #endif
63 #endif
64
64
65 #include "fsw_init.h"
65 #include "fsw_init.h"
66 #include "fsw_config.c"
66 #include "fsw_config.c"
67 #include "GscMemoryLPP.hpp"
67 #include "GscMemoryLPP.hpp"
68
68
69 void initCache()
69 void initCache()
70 {
70 {
71 // ASI 2 contains a few control registers that have not been assigned as ancillary state registers.
71 // ASI 2 contains a few control registers that have not been assigned as ancillary state registers.
72 // These should only be read and written using 32-bit LDA/STA instructions.
72 // These should only be read and written using 32-bit LDA/STA instructions.
73 // All cache registers are accessed through load/store operations to the alternate address space (LDA/STA), using ASI = 2.
73 // All cache registers are accessed through load/store operations to the alternate address space (LDA/STA), using ASI = 2.
74 // The table below shows the register addresses:
74 // The table below shows the register addresses:
75 // 0x00 Cache control register
75 // 0x00 Cache control register
76 // 0x04 Reserved
76 // 0x04 Reserved
77 // 0x08 Instruction cache configuration register
77 // 0x08 Instruction cache configuration register
78 // 0x0C Data cache configuration register
78 // 0x0C Data cache configuration register
79
79
80 // Cache Control Register Leon3 / Leon3FT
80 // Cache Control Register Leon3 / Leon3FT
81 // 31..30 29 28 27..24 23 22 21 20..19 18 17 16
81 // 31..30 29 28 27..24 23 22 21 20..19 18 17 16
82 // RFT PS TB DS FD FI FT ST IB
82 // RFT PS TB DS FD FI FT ST IB
83 // 15 14 13..12 11..10 9..8 7..6 5 4 3..2 1..0
83 // 15 14 13..12 11..10 9..8 7..6 5 4 3..2 1..0
84 // IP DP ITE IDE DTE DDE DF IF DCS ICS
84 // IP DP ITE IDE DTE DDE DF IF DCS ICS
85
85
86 unsigned int cacheControlRegister;
86 unsigned int cacheControlRegister;
87
87
88 CCR_resetCacheControlRegister();
88 CCR_resetCacheControlRegister();
89 ASR16_resetRegisterProtectionControlRegister();
89 ASR16_resetRegisterProtectionControlRegister();
90
90
91 cacheControlRegister = CCR_getValue();
91 cacheControlRegister = CCR_getValue();
92 PRINTF1("(0) CCR - Cache Control Register = %x\n", cacheControlRegister);
92 PRINTF1("(0) CCR - Cache Control Register = %x\n", cacheControlRegister);
93 PRINTF1("(0) ASR16 = %x\n", *asr16Ptr);
93 PRINTF1("(0) ASR16 = %x\n", *asr16Ptr);
94
94
95 CCR_enableInstructionCache(); // ICS bits
95 CCR_enableInstructionCache(); // ICS bits
96 CCR_enableDataCache(); // DCS bits
96 CCR_enableDataCache(); // DCS bits
97 CCR_enableInstructionBurstFetch(); // IB bit
97 CCR_enableInstructionBurstFetch(); // IB bit
98
98
99 faultTolerantScheme();
99 faultTolerantScheme();
100
100
101 cacheControlRegister = CCR_getValue();
101 cacheControlRegister = CCR_getValue();
102 PRINTF1("(1) CCR - Cache Control Register = %x\n", cacheControlRegister);
102 PRINTF1("(1) CCR - Cache Control Register = %x\n", cacheControlRegister);
103 PRINTF1("(1) ASR16 Register protection control register = %x\n", *asr16Ptr);
103 PRINTF1("(1) ASR16 Register protection control register = %x\n", *asr16Ptr);
104
104
105 PRINTF("\n");
105 PRINTF("\n");
106 }
106 }
107
107
108 rtems_task Init( rtems_task_argument ignored )
108 rtems_task Init( rtems_task_argument ignored )
109 {
109 {
110 /** This is the RTEMS INIT taks, it is the first task launched by the system.
110 /** This is the RTEMS INIT taks, it is the first task launched by the system.
111 *
111 *
112 * @param unused is the starting argument of the RTEMS task
112 * @param unused is the starting argument of the RTEMS task
113 *
113 *
114 * The INIT task create and run all other RTEMS tasks.
114 * The INIT task create and run all other RTEMS tasks.
115 *
115 *
116 */
116 */
117
117
118 //***********
118 //***********
119 // INIT CACHE
119 // INIT CACHE
120
120
121 unsigned char *vhdlVersion;
121 unsigned char *vhdlVersion;
122
122
123 reset_lfr();
123 reset_lfr();
124
124
125 reset_local_time();
125 reset_local_time();
126
126
127 rtems_cpu_usage_reset();
127 rtems_cpu_usage_reset();
128
128
129 rtems_status_code status;
129 rtems_status_code status;
130 rtems_status_code status_spw;
130 rtems_status_code status_spw;
131 rtems_isr_entry old_isr_handler;
131 rtems_isr_entry old_isr_handler;
132
132
133 // UART settings
133 // UART settings
134 enable_apbuart_transmitter();
134 enable_apbuart_transmitter();
135 set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE);
135 set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE);
136
136
137 DEBUG_PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n")
137 DEBUG_PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n")
138
138
139
139
140 PRINTF("\n\n\n\n\n")
140 PRINTF("\n\n\n\n\n")
141
141
142 initCache();
142 initCache();
143
143
144 PRINTF("*************************\n")
144 PRINTF("*************************\n")
145 PRINTF("** LFR Flight Software **\n")
145 PRINTF("** LFR Flight Software **\n")
146 PRINTF1("** %d-", SW_VERSION_N1)
146 PRINTF1("** %d-", SW_VERSION_N1)
147 PRINTF1("%d-" , SW_VERSION_N2)
147 PRINTF1("%d-" , SW_VERSION_N2)
148 PRINTF1("%d-" , SW_VERSION_N3)
148 PRINTF1("%d-" , SW_VERSION_N3)
149 PRINTF1("%d **\n", SW_VERSION_N4)
149 PRINTF1("%d **\n", SW_VERSION_N4)
150
150
151 vhdlVersion = (unsigned char *) (REGS_ADDR_VHDL_VERSION);
151 vhdlVersion = (unsigned char *) (REGS_ADDR_VHDL_VERSION);
152 PRINTF("** VHDL **\n")
152 PRINTF("** VHDL **\n")
153 PRINTF1("** %d.", vhdlVersion[1])
153 PRINTF1("** %d.", vhdlVersion[1])
154 PRINTF1("%d." , vhdlVersion[2])
154 PRINTF1("%d." , vhdlVersion[2])
155 PRINTF1("%d **\n", vhdlVersion[3])
155 PRINTF1("%d **\n", vhdlVersion[3])
156 PRINTF("*************************\n")
156 PRINTF("*************************\n")
157 PRINTF("\n\n")
157 PRINTF("\n\n")
158
158
159 init_parameter_dump();
159 init_parameter_dump();
160 init_kcoefficients_dump();
160 init_kcoefficients_dump();
161 init_local_mode_parameters();
161 init_local_mode_parameters();
162 init_housekeeping_parameters();
162 init_housekeeping_parameters();
163 init_k_coefficients_prc0();
163 init_k_coefficients_prc0();
164 init_k_coefficients_prc1();
164 init_k_coefficients_prc1();
165 init_k_coefficients_prc2();
165 init_k_coefficients_prc2();
166 pa_bia_status_info = 0x00;
166 pa_bia_status_info = 0x00;
167 cp_rpw_sc_rw_f_flags = 0x00;
167 cp_rpw_sc_rw_f_flags = 0x00;
168 cp_rpw_sc_rw1_f1 = 0.0;
168 cp_rpw_sc_rw1_f1 = 0.0;
169 cp_rpw_sc_rw1_f2 = 0.0;
169 cp_rpw_sc_rw1_f2 = 0.0;
170 cp_rpw_sc_rw2_f1 = 0.0;
170 cp_rpw_sc_rw2_f1 = 0.0;
171 cp_rpw_sc_rw2_f2 = 0.0;
171 cp_rpw_sc_rw2_f2 = 0.0;
172 cp_rpw_sc_rw3_f1 = 0.0;
172 cp_rpw_sc_rw3_f1 = 0.0;
173 cp_rpw_sc_rw3_f2 = 0.0;
173 cp_rpw_sc_rw3_f2 = 0.0;
174 cp_rpw_sc_rw4_f1 = 0.0;
174 cp_rpw_sc_rw4_f1 = 0.0;
175 cp_rpw_sc_rw4_f2 = 0.0;
175 cp_rpw_sc_rw4_f2 = 0.0;
176 // initialize filtering parameters
176 // initialize filtering parameters
177 filterPar.spare_sy_lfr_pas_filter_enabled = DEFAULT_SY_LFR_PAS_FILTER_ENABLED;
177 filterPar.spare_sy_lfr_pas_filter_enabled = DEFAULT_SY_LFR_PAS_FILTER_ENABLED;
178 filterPar.sy_lfr_pas_filter_modulus = DEFAULT_SY_LFR_PAS_FILTER_MODULUS;
178 filterPar.sy_lfr_pas_filter_modulus = DEFAULT_SY_LFR_PAS_FILTER_MODULUS;
179 filterPar.sy_lfr_pas_filter_tbad = DEFAULT_SY_LFR_PAS_FILTER_TBAD;
179 filterPar.sy_lfr_pas_filter_tbad = DEFAULT_SY_LFR_PAS_FILTER_TBAD;
180 filterPar.sy_lfr_pas_filter_offset = DEFAULT_SY_LFR_PAS_FILTER_OFFSET;
180 filterPar.sy_lfr_pas_filter_offset = DEFAULT_SY_LFR_PAS_FILTER_OFFSET;
181 filterPar.sy_lfr_pas_filter_shift = DEFAULT_SY_LFR_PAS_FILTER_SHIFT;
181 filterPar.sy_lfr_pas_filter_shift = DEFAULT_SY_LFR_PAS_FILTER_SHIFT;
182 filterPar.sy_lfr_sc_rw_delta_f = DEFAULT_SY_LFR_SC_RW_DELTA_F;
182 filterPar.sy_lfr_sc_rw_delta_f = DEFAULT_SY_LFR_SC_RW_DELTA_F;
183 update_last_valid_transition_date( DEFAULT_LAST_VALID_TRANSITION_DATE );
183 update_last_valid_transition_date( DEFAULT_LAST_VALID_TRANSITION_DATE );
184
184
185 // waveform picker initialization
185 // waveform picker initialization
186 WFP_init_rings();
186 WFP_init_rings();
187 LEON_Clear_interrupt( IRQ_SPARC_GPTIMER_WATCHDOG ); // initialize the waveform rings
187 LEON_Clear_interrupt( IRQ_SPARC_GPTIMER_WATCHDOG ); // initialize the waveform rings
188 WFP_reset_current_ring_nodes();
188 WFP_reset_current_ring_nodes();
189 reset_waveform_picker_regs();
189 reset_waveform_picker_regs();
190
190
191 // spectral matrices initialization
191 // spectral matrices initialization
192 SM_init_rings(); // initialize spectral matrices rings
192 SM_init_rings(); // initialize spectral matrices rings
193 SM_reset_current_ring_nodes();
193 SM_reset_current_ring_nodes();
194 reset_spectral_matrix_regs();
194 reset_spectral_matrix_regs();
195
195
196 // configure calibration
196 // configure calibration
197 configureCalibration( false ); // true means interleaved mode, false is for normal mode
197 configureCalibration( false ); // true means interleaved mode, false is for normal mode
198
198
199 updateLFRCurrentMode( LFR_MODE_STANDBY );
199 updateLFRCurrentMode( LFR_MODE_STANDBY );
200
200
201 BOOT_PRINTF1("in INIT *** lfrCurrentMode is %d\n", lfrCurrentMode)
201 BOOT_PRINTF1("in INIT *** lfrCurrentMode is %d\n", lfrCurrentMode)
202
202
203 create_names(); // create all names
203 create_names(); // create all names
204
204
205 status = create_timecode_timer(); // create the timer used by timecode_irq_handler
205 status = create_timecode_timer(); // create the timer used by timecode_irq_handler
206 if (status != RTEMS_SUCCESSFUL)
206 if (status != RTEMS_SUCCESSFUL)
207 {
207 {
208 PRINTF1("in INIT *** ERR in create_timer_timecode, code %d", status)
208 PRINTF1("in INIT *** ERR in create_timer_timecode, code %d", status)
209 }
209 }
210
210
211 status = create_message_queues(); // create message queues
211 status = create_message_queues(); // create message queues
212 if (status != RTEMS_SUCCESSFUL)
212 if (status != RTEMS_SUCCESSFUL)
213 {
213 {
214 PRINTF1("in INIT *** ERR in create_message_queues, code %d", status)
214 PRINTF1("in INIT *** ERR in create_message_queues, code %d", status)
215 }
215 }
216
216
217 status = create_all_tasks(); // create all tasks
217 status = create_all_tasks(); // create all tasks
218 if (status != RTEMS_SUCCESSFUL)
218 if (status != RTEMS_SUCCESSFUL)
219 {
219 {
220 PRINTF1("in INIT *** ERR in create_all_tasks, code %d\n", status)
220 PRINTF1("in INIT *** ERR in create_all_tasks, code %d\n", status)
221 }
221 }
222
222
223 // **************************
223 // **************************
224 // <SPACEWIRE INITIALIZATION>
224 // <SPACEWIRE INITIALIZATION>
225 status_spw = spacewire_open_link(); // (1) open the link
225 status_spw = spacewire_open_link(); // (1) open the link
226 if ( status_spw != RTEMS_SUCCESSFUL )
226 if ( status_spw != RTEMS_SUCCESSFUL )
227 {
227 {
228 PRINTF1("in INIT *** ERR spacewire_open_link code %d\n", status_spw )
228 PRINTF1("in INIT *** ERR spacewire_open_link code %d\n", status_spw )
229 }
229 }
230
230
231 if ( status_spw == RTEMS_SUCCESSFUL ) // (2) configure the link
231 if ( status_spw == RTEMS_SUCCESSFUL ) // (2) configure the link
232 {
232 {
233 status_spw = spacewire_configure_link( fdSPW );
233 status_spw = spacewire_configure_link( fdSPW );
234 if ( status_spw != RTEMS_SUCCESSFUL )
234 if ( status_spw != RTEMS_SUCCESSFUL )
235 {
235 {
236 PRINTF1("in INIT *** ERR spacewire_configure_link code %d\n", status_spw )
236 PRINTF1("in INIT *** ERR spacewire_configure_link code %d\n", status_spw )
237 }
237 }
238 }
238 }
239
239
240 if ( status_spw == RTEMS_SUCCESSFUL) // (3) start the link
240 if ( status_spw == RTEMS_SUCCESSFUL) // (3) start the link
241 {
241 {
242 status_spw = spacewire_start_link( fdSPW );
242 status_spw = spacewire_start_link( fdSPW );
243 if ( status_spw != RTEMS_SUCCESSFUL )
243 if ( status_spw != RTEMS_SUCCESSFUL )
244 {
244 {
245 PRINTF1("in INIT *** ERR spacewire_start_link code %d\n", status_spw )
245 PRINTF1("in INIT *** ERR spacewire_start_link code %d\n", status_spw )
246 }
246 }
247 }
247 }
248 // </SPACEWIRE INITIALIZATION>
248 // </SPACEWIRE INITIALIZATION>
249 // ***************************
249 // ***************************
250
250
251 status = start_all_tasks(); // start all tasks
251 status = start_all_tasks(); // start all tasks
252 if (status != RTEMS_SUCCESSFUL)
252 if (status != RTEMS_SUCCESSFUL)
253 {
253 {
254 PRINTF1("in INIT *** ERR in start_all_tasks, code %d", status)
254 PRINTF1("in INIT *** ERR in start_all_tasks, code %d", status)
255 }
255 }
256
256
257 // start RECV and SEND *AFTER* SpaceWire Initialization, due to the timeout of the start call during the initialization
257 // start RECV and SEND *AFTER* SpaceWire Initialization, due to the timeout of the start call during the initialization
258 status = start_recv_send_tasks();
258 status = start_recv_send_tasks();
259 if ( status != RTEMS_SUCCESSFUL )
259 if ( status != RTEMS_SUCCESSFUL )
260 {
260 {
261 PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status )
261 PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status )
262 }
262 }
263
263
264 // suspend science tasks, they will be restarted later depending on the mode
264 // suspend science tasks, they will be restarted later depending on the mode
265 status = suspend_science_tasks(); // suspend science tasks (not done in stop_current_mode if current mode = STANDBY)
265 status = suspend_science_tasks(); // suspend science tasks (not done in stop_current_mode if current mode = STANDBY)
266 if (status != RTEMS_SUCCESSFUL)
266 if (status != RTEMS_SUCCESSFUL)
267 {
267 {
268 PRINTF1("in INIT *** in suspend_science_tasks *** ERR code: %d\n", status)
268 PRINTF1("in INIT *** in suspend_science_tasks *** ERR code: %d\n", status)
269 }
269 }
270
270
271 // configure IRQ handling for the waveform picker unit
271 // configure IRQ handling for the waveform picker unit
272 status = rtems_interrupt_catch( waveforms_isr,
272 status = rtems_interrupt_catch( waveforms_isr,
273 IRQ_SPARC_WAVEFORM_PICKER,
273 IRQ_SPARC_WAVEFORM_PICKER,
274 &old_isr_handler) ;
274 &old_isr_handler) ;
275 // configure IRQ handling for the spectral matrices unit
275 // configure IRQ handling for the spectral matrices unit
276 status = rtems_interrupt_catch( spectral_matrices_isr,
276 status = rtems_interrupt_catch( spectral_matrices_isr,
277 IRQ_SPARC_SPECTRAL_MATRIX,
277 IRQ_SPARC_SPECTRAL_MATRIX,
278 &old_isr_handler) ;
278 &old_isr_handler) ;
279
279
280 // if the spacewire link is not up then send an event to the SPIQ task for link recovery
280 // if the spacewire link is not up then send an event to the SPIQ task for link recovery
281 if ( status_spw != RTEMS_SUCCESSFUL )
281 if ( status_spw != RTEMS_SUCCESSFUL )
282 {
282 {
283 status = rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT );
283 status = rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT );
284 if ( status != RTEMS_SUCCESSFUL ) {
284 if ( status != RTEMS_SUCCESSFUL ) {
285 PRINTF1("in INIT *** ERR rtems_event_send to SPIQ code %d\n", status )
285 PRINTF1("in INIT *** ERR rtems_event_send to SPIQ code %d\n", status )
286 }
286 }
287 }
287 }
288
288
289 BOOT_PRINTF("delete INIT\n")
289 BOOT_PRINTF("delete INIT\n")
290
290
291 set_hk_lfr_sc_potential_flag( true );
291 set_hk_lfr_sc_potential_flag( true );
292
292
293 // start the timer to detect a missing spacewire timecode
293 // start the timer to detect a missing spacewire timecode
294 // the timeout is larger because the spw IP needs to receive several valid timecodes before generating a tickout
294 // the timeout is larger because the spw IP needs to receive several valid timecodes before generating a tickout
295 // if a tickout is generated, the timer is restarted
295 // if a tickout is generated, the timer is restarted
296 status = rtems_timer_fire_after( timecode_timer_id, TIMECODE_TIMER_TIMEOUT_INIT, timecode_timer_routine, NULL );
296 status = rtems_timer_fire_after( timecode_timer_id, TIMECODE_TIMER_TIMEOUT_INIT, timecode_timer_routine, NULL );
297
297
298 grspw_timecode_callback = &timecode_irq_handler;
298 grspw_timecode_callback = &timecode_irq_handler;
299
299
300 status = rtems_task_delete(RTEMS_SELF);
300 status = rtems_task_delete(RTEMS_SELF);
301
301
302 }
302 }
303
303
304 void init_local_mode_parameters( void )
304 void init_local_mode_parameters( void )
305 {
305 {
306 /** This function initialize the param_local global variable with default values.
306 /** This function initialize the param_local global variable with default values.
307 *
307 *
308 */
308 */
309
309
310 unsigned int i;
310 unsigned int i;
311
311
312 // LOCAL PARAMETERS
312 // LOCAL PARAMETERS
313
313
314 BOOT_PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max)
314 BOOT_PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max)
315 BOOT_PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max)
315 BOOT_PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max)
316 BOOT_PRINTF1("nb_interrupt_f0_MAX = %d\n", param_local.local_nb_interrupt_f0_MAX)
316 //BOOT_PRINTF1("nb_interrupt_f0_MAX = %d\n", param_local.local_nb_interrupt_f0_MAX)
317
317
318 // init sequence counters
318 // init sequence counters
319
319
320 for(i = 0; i<SEQ_CNT_NB_DEST_ID; i++)
320 for(i = 0; i<SEQ_CNT_NB_DEST_ID; i++)
321 {
321 {
322 sequenceCounters_TC_EXE[i] = 0x00;
322 sequenceCounters_TC_EXE[i] = 0x00;
323 sequenceCounters_TM_DUMP[i] = 0x00;
323 sequenceCounters_TM_DUMP[i] = 0x00;
324 }
324 }
325 sequenceCounters_SCIENCE_NORMAL_BURST = 0x00;
325 sequenceCounters_SCIENCE_NORMAL_BURST = 0x00;
326 sequenceCounters_SCIENCE_SBM1_SBM2 = 0x00;
326 sequenceCounters_SCIENCE_SBM1_SBM2 = 0x00;
327 sequenceCounterHK = TM_PACKET_SEQ_CTRL_STANDALONE << 8;
327 sequenceCounterHK = TM_PACKET_SEQ_CTRL_STANDALONE << 8;
328 }
328 }
329
329
330 void reset_local_time( void )
330 void reset_local_time( void )
331 {
331 {
332 time_management_regs->ctrl = time_management_regs->ctrl | 0x02; // [0010] software reset, coarse time = 0x80000000
332 time_management_regs->ctrl = time_management_regs->ctrl | 0x02; // [0010] software reset, coarse time = 0x80000000
333 }
333 }
334
334
335 void create_names( void ) // create all names for tasks and queues
335 void create_names( void ) // create all names for tasks and queues
336 {
336 {
337 /** This function creates all RTEMS names used in the software for tasks and queues.
337 /** This function creates all RTEMS names used in the software for tasks and queues.
338 *
338 *
339 * @return RTEMS directive status codes:
339 * @return RTEMS directive status codes:
340 * - RTEMS_SUCCESSFUL - successful completion
340 * - RTEMS_SUCCESSFUL - successful completion
341 *
341 *
342 */
342 */
343
343
344 // task names
344 // task names
345 Task_name[TASKID_AVGV] = rtems_build_name( 'A', 'V', 'G', 'V' );
345 Task_name[TASKID_AVGV] = rtems_build_name( 'A', 'V', 'G', 'V' );
346 Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' );
346 Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' );
347 Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' );
347 Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' );
348 Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' );
348 Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' );
349 Task_name[TASKID_LOAD] = rtems_build_name( 'L', 'O', 'A', 'D' );
349 Task_name[TASKID_LOAD] = rtems_build_name( 'L', 'O', 'A', 'D' );
350 Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' );
350 Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' );
351 Task_name[TASKID_SWBD] = rtems_build_name( 'S', 'W', 'B', 'D' );
351 Task_name[TASKID_SWBD] = rtems_build_name( 'S', 'W', 'B', 'D' );
352 Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' );
352 Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' );
353 Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' );
353 Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' );
354 Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' );
354 Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' );
355 Task_name[TASKID_PRC0] = rtems_build_name( 'P', 'R', 'C', '0' );
355 Task_name[TASKID_PRC0] = rtems_build_name( 'P', 'R', 'C', '0' );
356 Task_name[TASKID_CWF3] = rtems_build_name( 'C', 'W', 'F', '3' );
356 Task_name[TASKID_CWF3] = rtems_build_name( 'C', 'W', 'F', '3' );
357 Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' );
357 Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' );
358 Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' );
358 Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' );
359 Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' );
359 Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' );
360 Task_name[TASKID_LINK] = rtems_build_name( 'L', 'I', 'N', 'K' );
360 Task_name[TASKID_LINK] = rtems_build_name( 'L', 'I', 'N', 'K' );
361 Task_name[TASKID_AVF1] = rtems_build_name( 'A', 'V', 'F', '1' );
361 Task_name[TASKID_AVF1] = rtems_build_name( 'A', 'V', 'F', '1' );
362 Task_name[TASKID_PRC1] = rtems_build_name( 'P', 'R', 'C', '1' );
362 Task_name[TASKID_PRC1] = rtems_build_name( 'P', 'R', 'C', '1' );
363 Task_name[TASKID_AVF2] = rtems_build_name( 'A', 'V', 'F', '2' );
363 Task_name[TASKID_AVF2] = rtems_build_name( 'A', 'V', 'F', '2' );
364 Task_name[TASKID_PRC2] = rtems_build_name( 'P', 'R', 'C', '2' );
364 Task_name[TASKID_PRC2] = rtems_build_name( 'P', 'R', 'C', '2' );
365
365
366 // rate monotonic period names
366 // rate monotonic period names
367 name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' );
367 name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' );
368 name_avgv_rate_monotonic = rtems_build_name( 'A', 'V', 'G', 'V' );
368 name_avgv_rate_monotonic = rtems_build_name( 'A', 'V', 'G', 'V' );
369
369
370 misc_name[QUEUE_RECV] = rtems_build_name( 'Q', '_', 'R', 'V' );
370 misc_name[QUEUE_RECV] = rtems_build_name( 'Q', '_', 'R', 'V' );
371 misc_name[QUEUE_SEND] = rtems_build_name( 'Q', '_', 'S', 'D' );
371 misc_name[QUEUE_SEND] = rtems_build_name( 'Q', '_', 'S', 'D' );
372 misc_name[QUEUE_PRC0] = rtems_build_name( 'Q', '_', 'P', '0' );
372 misc_name[QUEUE_PRC0] = rtems_build_name( 'Q', '_', 'P', '0' );
373 misc_name[QUEUE_PRC1] = rtems_build_name( 'Q', '_', 'P', '1' );
373 misc_name[QUEUE_PRC1] = rtems_build_name( 'Q', '_', 'P', '1' );
374 misc_name[QUEUE_PRC2] = rtems_build_name( 'Q', '_', 'P', '2' );
374 misc_name[QUEUE_PRC2] = rtems_build_name( 'Q', '_', 'P', '2' );
375
375
376 timecode_timer_name = rtems_build_name( 'S', 'P', 'T', 'C' );
376 timecode_timer_name = rtems_build_name( 'S', 'P', 'T', 'C' );
377 }
377 }
378
378
379 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
380 {
380 {
381 /** This function creates all RTEMS tasks used in the software.
381 /** This function creates all RTEMS tasks used in the software.
382 *
382 *
383 * @return RTEMS directive status codes:
383 * @return RTEMS directive status codes:
384 * - RTEMS_SUCCESSFUL - task created successfully
384 * - RTEMS_SUCCESSFUL - task created successfully
385 * - RTEMS_INVALID_ADDRESS - id is NULL
385 * - RTEMS_INVALID_ADDRESS - id is NULL
386 * - RTEMS_INVALID_NAME - invalid task name
386 * - RTEMS_INVALID_NAME - invalid task name
387 * - RTEMS_INVALID_PRIORITY - invalid task priority
387 * - RTEMS_INVALID_PRIORITY - invalid task priority
388 * - RTEMS_MP_NOT_CONFIGURED - multiprocessing not configured
388 * - RTEMS_MP_NOT_CONFIGURED - multiprocessing not configured
389 * - RTEMS_TOO_MANY - too many tasks created
389 * - RTEMS_TOO_MANY - too many tasks created
390 * - RTEMS_UNSATISFIED - not enough memory for stack/FP context
390 * - RTEMS_UNSATISFIED - not enough memory for stack/FP context
391 * - RTEMS_TOO_MANY - too many global objects
391 * - RTEMS_TOO_MANY - too many global objects
392 *
392 *
393 */
393 */
394
394
395 rtems_status_code status;
395 rtems_status_code status;
396
396
397 //**********
397 //**********
398 // SPACEWIRE
398 // SPACEWIRE
399 // RECV
399 // RECV
400 status = rtems_task_create(
400 status = rtems_task_create(
401 Task_name[TASKID_RECV], TASK_PRIORITY_RECV, RTEMS_MINIMUM_STACK_SIZE,
401 Task_name[TASKID_RECV], TASK_PRIORITY_RECV, RTEMS_MINIMUM_STACK_SIZE,
402 RTEMS_DEFAULT_MODES,
402 RTEMS_DEFAULT_MODES,
403 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV]
403 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV]
404 );
404 );
405 if (status == RTEMS_SUCCESSFUL) // SEND
405 if (status == RTEMS_SUCCESSFUL) // SEND
406 {
406 {
407 status = rtems_task_create(
407 status = rtems_task_create(
408 Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE * 2,
408 Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE * 2,
409 RTEMS_DEFAULT_MODES,
409 RTEMS_DEFAULT_MODES,
410 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_SEND]
410 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_SEND]
411 );
411 );
412 }
412 }
413 if (status == RTEMS_SUCCESSFUL) // LINK
413 if (status == RTEMS_SUCCESSFUL) // LINK
414 {
414 {
415 status = rtems_task_create(
415 status = rtems_task_create(
416 Task_name[TASKID_LINK], TASK_PRIORITY_LINK, RTEMS_MINIMUM_STACK_SIZE,
416 Task_name[TASKID_LINK], TASK_PRIORITY_LINK, RTEMS_MINIMUM_STACK_SIZE,
417 RTEMS_DEFAULT_MODES,
417 RTEMS_DEFAULT_MODES,
418 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_LINK]
418 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_LINK]
419 );
419 );
420 }
420 }
421 if (status == RTEMS_SUCCESSFUL) // ACTN
421 if (status == RTEMS_SUCCESSFUL) // ACTN
422 {
422 {
423 status = rtems_task_create(
423 status = rtems_task_create(
424 Task_name[TASKID_ACTN], TASK_PRIORITY_ACTN, RTEMS_MINIMUM_STACK_SIZE,
424 Task_name[TASKID_ACTN], TASK_PRIORITY_ACTN, RTEMS_MINIMUM_STACK_SIZE,
425 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
425 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
426 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_ACTN]
426 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_ACTN]
427 );
427 );
428 }
428 }
429 if (status == RTEMS_SUCCESSFUL) // SPIQ
429 if (status == RTEMS_SUCCESSFUL) // SPIQ
430 {
430 {
431 status = rtems_task_create(
431 status = rtems_task_create(
432 Task_name[TASKID_SPIQ], TASK_PRIORITY_SPIQ, RTEMS_MINIMUM_STACK_SIZE,
432 Task_name[TASKID_SPIQ], TASK_PRIORITY_SPIQ, RTEMS_MINIMUM_STACK_SIZE,
433 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
433 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
434 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ]
434 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ]
435 );
435 );
436 }
436 }
437
437
438 //******************
438 //******************
439 // SPECTRAL MATRICES
439 // SPECTRAL MATRICES
440 if (status == RTEMS_SUCCESSFUL) // AVF0
440 if (status == RTEMS_SUCCESSFUL) // AVF0
441 {
441 {
442 status = rtems_task_create(
442 status = rtems_task_create(
443 Task_name[TASKID_AVF0], TASK_PRIORITY_AVF0, RTEMS_MINIMUM_STACK_SIZE,
443 Task_name[TASKID_AVF0], TASK_PRIORITY_AVF0, RTEMS_MINIMUM_STACK_SIZE,
444 RTEMS_DEFAULT_MODES,
444 RTEMS_DEFAULT_MODES,
445 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0]
445 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0]
446 );
446 );
447 }
447 }
448 if (status == RTEMS_SUCCESSFUL) // PRC0
448 if (status == RTEMS_SUCCESSFUL) // PRC0
449 {
449 {
450 status = rtems_task_create(
450 status = rtems_task_create(
451 Task_name[TASKID_PRC0], TASK_PRIORITY_PRC0, RTEMS_MINIMUM_STACK_SIZE * 2,
451 Task_name[TASKID_PRC0], TASK_PRIORITY_PRC0, RTEMS_MINIMUM_STACK_SIZE * 2,
452 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
452 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
453 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC0]
453 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC0]
454 );
454 );
455 }
455 }
456 if (status == RTEMS_SUCCESSFUL) // AVF1
456 if (status == RTEMS_SUCCESSFUL) // AVF1
457 {
457 {
458 status = rtems_task_create(
458 status = rtems_task_create(
459 Task_name[TASKID_AVF1], TASK_PRIORITY_AVF1, RTEMS_MINIMUM_STACK_SIZE,
459 Task_name[TASKID_AVF1], TASK_PRIORITY_AVF1, RTEMS_MINIMUM_STACK_SIZE,
460 RTEMS_DEFAULT_MODES,
460 RTEMS_DEFAULT_MODES,
461 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF1]
461 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF1]
462 );
462 );
463 }
463 }
464 if (status == RTEMS_SUCCESSFUL) // PRC1
464 if (status == RTEMS_SUCCESSFUL) // PRC1
465 {
465 {
466 status = rtems_task_create(
466 status = rtems_task_create(
467 Task_name[TASKID_PRC1], TASK_PRIORITY_PRC1, RTEMS_MINIMUM_STACK_SIZE * 2,
467 Task_name[TASKID_PRC1], TASK_PRIORITY_PRC1, RTEMS_MINIMUM_STACK_SIZE * 2,
468 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
468 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
469 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC1]
469 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC1]
470 );
470 );
471 }
471 }
472 if (status == RTEMS_SUCCESSFUL) // AVF2
472 if (status == RTEMS_SUCCESSFUL) // AVF2
473 {
473 {
474 status = rtems_task_create(
474 status = rtems_task_create(
475 Task_name[TASKID_AVF2], TASK_PRIORITY_AVF2, RTEMS_MINIMUM_STACK_SIZE,
475 Task_name[TASKID_AVF2], TASK_PRIORITY_AVF2, RTEMS_MINIMUM_STACK_SIZE,
476 RTEMS_DEFAULT_MODES,
476 RTEMS_DEFAULT_MODES,
477 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF2]
477 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF2]
478 );
478 );
479 }
479 }
480 if (status == RTEMS_SUCCESSFUL) // PRC2
480 if (status == RTEMS_SUCCESSFUL) // PRC2
481 {
481 {
482 status = rtems_task_create(
482 status = rtems_task_create(
483 Task_name[TASKID_PRC2], TASK_PRIORITY_PRC2, RTEMS_MINIMUM_STACK_SIZE * 2,
483 Task_name[TASKID_PRC2], TASK_PRIORITY_PRC2, RTEMS_MINIMUM_STACK_SIZE * 2,
484 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
484 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
485 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC2]
485 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC2]
486 );
486 );
487 }
487 }
488
488
489 //****************
489 //****************
490 // WAVEFORM PICKER
490 // WAVEFORM PICKER
491 if (status == RTEMS_SUCCESSFUL) // WFRM
491 if (status == RTEMS_SUCCESSFUL) // WFRM
492 {
492 {
493 status = rtems_task_create(
493 status = rtems_task_create(
494 Task_name[TASKID_WFRM], TASK_PRIORITY_WFRM, RTEMS_MINIMUM_STACK_SIZE,
494 Task_name[TASKID_WFRM], TASK_PRIORITY_WFRM, RTEMS_MINIMUM_STACK_SIZE,
495 RTEMS_DEFAULT_MODES,
495 RTEMS_DEFAULT_MODES,
496 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_WFRM]
496 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_WFRM]
497 );
497 );
498 }
498 }
499 if (status == RTEMS_SUCCESSFUL) // CWF3
499 if (status == RTEMS_SUCCESSFUL) // CWF3
500 {
500 {
501 status = rtems_task_create(
501 status = rtems_task_create(
502 Task_name[TASKID_CWF3], TASK_PRIORITY_CWF3, RTEMS_MINIMUM_STACK_SIZE,
502 Task_name[TASKID_CWF3], TASK_PRIORITY_CWF3, RTEMS_MINIMUM_STACK_SIZE,
503 RTEMS_DEFAULT_MODES,
503 RTEMS_DEFAULT_MODES,
504 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF3]
504 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF3]
505 );
505 );
506 }
506 }
507 if (status == RTEMS_SUCCESSFUL) // CWF2
507 if (status == RTEMS_SUCCESSFUL) // CWF2
508 {
508 {
509 status = rtems_task_create(
509 status = rtems_task_create(
510 Task_name[TASKID_CWF2], TASK_PRIORITY_CWF2, RTEMS_MINIMUM_STACK_SIZE,
510 Task_name[TASKID_CWF2], TASK_PRIORITY_CWF2, RTEMS_MINIMUM_STACK_SIZE,
511 RTEMS_DEFAULT_MODES,
511 RTEMS_DEFAULT_MODES,
512 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF2]
512 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF2]
513 );
513 );
514 }
514 }
515 if (status == RTEMS_SUCCESSFUL) // CWF1
515 if (status == RTEMS_SUCCESSFUL) // CWF1
516 {
516 {
517 status = rtems_task_create(
517 status = rtems_task_create(
518 Task_name[TASKID_CWF1], TASK_PRIORITY_CWF1, RTEMS_MINIMUM_STACK_SIZE,
518 Task_name[TASKID_CWF1], TASK_PRIORITY_CWF1, RTEMS_MINIMUM_STACK_SIZE,
519 RTEMS_DEFAULT_MODES,
519 RTEMS_DEFAULT_MODES,
520 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF1]
520 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF1]
521 );
521 );
522 }
522 }
523 if (status == RTEMS_SUCCESSFUL) // SWBD
523 if (status == RTEMS_SUCCESSFUL) // SWBD
524 {
524 {
525 status = rtems_task_create(
525 status = rtems_task_create(
526 Task_name[TASKID_SWBD], TASK_PRIORITY_SWBD, RTEMS_MINIMUM_STACK_SIZE,
526 Task_name[TASKID_SWBD], TASK_PRIORITY_SWBD, RTEMS_MINIMUM_STACK_SIZE,
527 RTEMS_DEFAULT_MODES,
527 RTEMS_DEFAULT_MODES,
528 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_SWBD]
528 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_SWBD]
529 );
529 );
530 }
530 }
531
531
532 //*****
532 //*****
533 // MISC
533 // MISC
534 if (status == RTEMS_SUCCESSFUL) // LOAD
534 if (status == RTEMS_SUCCESSFUL) // LOAD
535 {
535 {
536 status = rtems_task_create(
536 status = rtems_task_create(
537 Task_name[TASKID_LOAD], TASK_PRIORITY_LOAD, RTEMS_MINIMUM_STACK_SIZE,
537 Task_name[TASKID_LOAD], TASK_PRIORITY_LOAD, RTEMS_MINIMUM_STACK_SIZE,
538 RTEMS_DEFAULT_MODES,
538 RTEMS_DEFAULT_MODES,
539 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_LOAD]
539 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_LOAD]
540 );
540 );
541 }
541 }
542 if (status == RTEMS_SUCCESSFUL) // DUMB
542 if (status == RTEMS_SUCCESSFUL) // DUMB
543 {
543 {
544 status = rtems_task_create(
544 status = rtems_task_create(
545 Task_name[TASKID_DUMB], TASK_PRIORITY_DUMB, RTEMS_MINIMUM_STACK_SIZE,
545 Task_name[TASKID_DUMB], TASK_PRIORITY_DUMB, RTEMS_MINIMUM_STACK_SIZE,
546 RTEMS_DEFAULT_MODES,
546 RTEMS_DEFAULT_MODES,
547 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB]
547 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB]
548 );
548 );
549 }
549 }
550 if (status == RTEMS_SUCCESSFUL) // HOUS
550 if (status == RTEMS_SUCCESSFUL) // HOUS
551 {
551 {
552 status = rtems_task_create(
552 status = rtems_task_create(
553 Task_name[TASKID_HOUS], TASK_PRIORITY_HOUS, RTEMS_MINIMUM_STACK_SIZE,
553 Task_name[TASKID_HOUS], TASK_PRIORITY_HOUS, RTEMS_MINIMUM_STACK_SIZE,
554 RTEMS_DEFAULT_MODES,
554 RTEMS_DEFAULT_MODES,
555 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_HOUS]
555 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_HOUS]
556 );
556 );
557 }
557 }
558 if (status == RTEMS_SUCCESSFUL) // AVGV
558 if (status == RTEMS_SUCCESSFUL) // AVGV
559 {
559 {
560 status = rtems_task_create(
560 status = rtems_task_create(
561 Task_name[TASKID_AVGV], TASK_PRIORITY_AVGV, RTEMS_MINIMUM_STACK_SIZE,
561 Task_name[TASKID_AVGV], TASK_PRIORITY_AVGV, RTEMS_MINIMUM_STACK_SIZE,
562 RTEMS_DEFAULT_MODES,
562 RTEMS_DEFAULT_MODES,
563 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVGV]
563 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVGV]
564 );
564 );
565 }
565 }
566
566
567 return status;
567 return status;
568 }
568 }
569
569
570 int start_recv_send_tasks( void )
570 int start_recv_send_tasks( void )
571 {
571 {
572 rtems_status_code status;
572 rtems_status_code status;
573
573
574 status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 );
574 status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 );
575 if (status!=RTEMS_SUCCESSFUL) {
575 if (status!=RTEMS_SUCCESSFUL) {
576 BOOT_PRINTF("in INIT *** Error starting TASK_RECV\n")
576 BOOT_PRINTF("in INIT *** Error starting TASK_RECV\n")
577 }
577 }
578
578
579 if (status == RTEMS_SUCCESSFUL) // SEND
579 if (status == RTEMS_SUCCESSFUL) // SEND
580 {
580 {
581 status = rtems_task_start( Task_id[TASKID_SEND], send_task, 1 );
581 status = rtems_task_start( Task_id[TASKID_SEND], send_task, 1 );
582 if (status!=RTEMS_SUCCESSFUL) {
582 if (status!=RTEMS_SUCCESSFUL) {
583 BOOT_PRINTF("in INIT *** Error starting TASK_SEND\n")
583 BOOT_PRINTF("in INIT *** Error starting TASK_SEND\n")
584 }
584 }
585 }
585 }
586
586
587 return status;
587 return status;
588 }
588 }
589
589
590 int start_all_tasks( void ) // start all tasks except SEND RECV and HOUS
590 int start_all_tasks( void ) // start all tasks except SEND RECV and HOUS
591 {
591 {
592 /** This function starts all RTEMS tasks used in the software.
592 /** This function starts all RTEMS tasks used in the software.
593 *
593 *
594 * @return RTEMS directive status codes:
594 * @return RTEMS directive status codes:
595 * - RTEMS_SUCCESSFUL - ask started successfully
595 * - RTEMS_SUCCESSFUL - ask started successfully
596 * - RTEMS_INVALID_ADDRESS - invalid task entry point
596 * - RTEMS_INVALID_ADDRESS - invalid task entry point
597 * - RTEMS_INVALID_ID - invalid task id
597 * - RTEMS_INVALID_ID - invalid task id
598 * - RTEMS_INCORRECT_STATE - task not in the dormant state
598 * - RTEMS_INCORRECT_STATE - task not in the dormant state
599 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot start remote task
599 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot start remote task
600 *
600 *
601 */
601 */
602 // starts all the tasks fot eh flight software
602 // starts all the tasks fot eh flight software
603
603
604 rtems_status_code status;
604 rtems_status_code status;
605
605
606 //**********
606 //**********
607 // SPACEWIRE
607 // SPACEWIRE
608 status = rtems_task_start( Task_id[TASKID_SPIQ], spiq_task, 1 );
608 status = rtems_task_start( Task_id[TASKID_SPIQ], spiq_task, 1 );
609 if (status!=RTEMS_SUCCESSFUL) {
609 if (status!=RTEMS_SUCCESSFUL) {
610 BOOT_PRINTF("in INIT *** Error starting TASK_SPIQ\n")
610 BOOT_PRINTF("in INIT *** Error starting TASK_SPIQ\n")
611 }
611 }
612
612
613 if (status == RTEMS_SUCCESSFUL) // LINK
613 if (status == RTEMS_SUCCESSFUL) // LINK
614 {
614 {
615 status = rtems_task_start( Task_id[TASKID_LINK], link_task, 1 );
615 status = rtems_task_start( Task_id[TASKID_LINK], link_task, 1 );
616 if (status!=RTEMS_SUCCESSFUL) {
616 if (status!=RTEMS_SUCCESSFUL) {
617 BOOT_PRINTF("in INIT *** Error starting TASK_LINK\n")
617 BOOT_PRINTF("in INIT *** Error starting TASK_LINK\n")
618 }
618 }
619 }
619 }
620
620
621 if (status == RTEMS_SUCCESSFUL) // ACTN
621 if (status == RTEMS_SUCCESSFUL) // ACTN
622 {
622 {
623 status = rtems_task_start( Task_id[TASKID_ACTN], actn_task, 1 );
623 status = rtems_task_start( Task_id[TASKID_ACTN], actn_task, 1 );
624 if (status!=RTEMS_SUCCESSFUL) {
624 if (status!=RTEMS_SUCCESSFUL) {
625 BOOT_PRINTF("in INIT *** Error starting TASK_ACTN\n")
625 BOOT_PRINTF("in INIT *** Error starting TASK_ACTN\n")
626 }
626 }
627 }
627 }
628
628
629 //******************
629 //******************
630 // SPECTRAL MATRICES
630 // SPECTRAL MATRICES
631 if (status == RTEMS_SUCCESSFUL) // AVF0
631 if (status == RTEMS_SUCCESSFUL) // AVF0
632 {
632 {
633 status = rtems_task_start( Task_id[TASKID_AVF0], avf0_task, LFR_MODE_STANDBY );
633 status = rtems_task_start( Task_id[TASKID_AVF0], avf0_task, LFR_MODE_STANDBY );
634 if (status!=RTEMS_SUCCESSFUL) {
634 if (status!=RTEMS_SUCCESSFUL) {
635 BOOT_PRINTF("in INIT *** Error starting TASK_AVF0\n")
635 BOOT_PRINTF("in INIT *** Error starting TASK_AVF0\n")
636 }
636 }
637 }
637 }
638 if (status == RTEMS_SUCCESSFUL) // PRC0
638 if (status == RTEMS_SUCCESSFUL) // PRC0
639 {
639 {
640 status = rtems_task_start( Task_id[TASKID_PRC0], prc0_task, LFR_MODE_STANDBY );
640 status = rtems_task_start( Task_id[TASKID_PRC0], prc0_task, LFR_MODE_STANDBY );
641 if (status!=RTEMS_SUCCESSFUL) {
641 if (status!=RTEMS_SUCCESSFUL) {
642 BOOT_PRINTF("in INIT *** Error starting TASK_PRC0\n")
642 BOOT_PRINTF("in INIT *** Error starting TASK_PRC0\n")
643 }
643 }
644 }
644 }
645 if (status == RTEMS_SUCCESSFUL) // AVF1
645 if (status == RTEMS_SUCCESSFUL) // AVF1
646 {
646 {
647 status = rtems_task_start( Task_id[TASKID_AVF1], avf1_task, LFR_MODE_STANDBY );
647 status = rtems_task_start( Task_id[TASKID_AVF1], avf1_task, LFR_MODE_STANDBY );
648 if (status!=RTEMS_SUCCESSFUL) {
648 if (status!=RTEMS_SUCCESSFUL) {
649 BOOT_PRINTF("in INIT *** Error starting TASK_AVF1\n")
649 BOOT_PRINTF("in INIT *** Error starting TASK_AVF1\n")
650 }
650 }
651 }
651 }
652 if (status == RTEMS_SUCCESSFUL) // PRC1
652 if (status == RTEMS_SUCCESSFUL) // PRC1
653 {
653 {
654 status = rtems_task_start( Task_id[TASKID_PRC1], prc1_task, LFR_MODE_STANDBY );
654 status = rtems_task_start( Task_id[TASKID_PRC1], prc1_task, LFR_MODE_STANDBY );
655 if (status!=RTEMS_SUCCESSFUL) {
655 if (status!=RTEMS_SUCCESSFUL) {
656 BOOT_PRINTF("in INIT *** Error starting TASK_PRC1\n")
656 BOOT_PRINTF("in INIT *** Error starting TASK_PRC1\n")
657 }
657 }
658 }
658 }
659 if (status == RTEMS_SUCCESSFUL) // AVF2
659 if (status == RTEMS_SUCCESSFUL) // AVF2
660 {
660 {
661 status = rtems_task_start( Task_id[TASKID_AVF2], avf2_task, 1 );
661 status = rtems_task_start( Task_id[TASKID_AVF2], avf2_task, 1 );
662 if (status!=RTEMS_SUCCESSFUL) {
662 if (status!=RTEMS_SUCCESSFUL) {
663 BOOT_PRINTF("in INIT *** Error starting TASK_AVF2\n")
663 BOOT_PRINTF("in INIT *** Error starting TASK_AVF2\n")
664 }
664 }
665 }
665 }
666 if (status == RTEMS_SUCCESSFUL) // PRC2
666 if (status == RTEMS_SUCCESSFUL) // PRC2
667 {
667 {
668 status = rtems_task_start( Task_id[TASKID_PRC2], prc2_task, 1 );
668 status = rtems_task_start( Task_id[TASKID_PRC2], prc2_task, 1 );
669 if (status!=RTEMS_SUCCESSFUL) {
669 if (status!=RTEMS_SUCCESSFUL) {
670 BOOT_PRINTF("in INIT *** Error starting TASK_PRC2\n")
670 BOOT_PRINTF("in INIT *** Error starting TASK_PRC2\n")
671 }
671 }
672 }
672 }
673
673
674 //****************
674 //****************
675 // WAVEFORM PICKER
675 // WAVEFORM PICKER
676 if (status == RTEMS_SUCCESSFUL) // WFRM
676 if (status == RTEMS_SUCCESSFUL) // WFRM
677 {
677 {
678 status = rtems_task_start( Task_id[TASKID_WFRM], wfrm_task, 1 );
678 status = rtems_task_start( Task_id[TASKID_WFRM], wfrm_task, 1 );
679 if (status!=RTEMS_SUCCESSFUL) {
679 if (status!=RTEMS_SUCCESSFUL) {
680 BOOT_PRINTF("in INIT *** Error starting TASK_WFRM\n")
680 BOOT_PRINTF("in INIT *** Error starting TASK_WFRM\n")
681 }
681 }
682 }
682 }
683 if (status == RTEMS_SUCCESSFUL) // CWF3
683 if (status == RTEMS_SUCCESSFUL) // CWF3
684 {
684 {
685 status = rtems_task_start( Task_id[TASKID_CWF3], cwf3_task, 1 );
685 status = rtems_task_start( Task_id[TASKID_CWF3], cwf3_task, 1 );
686 if (status!=RTEMS_SUCCESSFUL) {
686 if (status!=RTEMS_SUCCESSFUL) {
687 BOOT_PRINTF("in INIT *** Error starting TASK_CWF3\n")
687 BOOT_PRINTF("in INIT *** Error starting TASK_CWF3\n")
688 }
688 }
689 }
689 }
690 if (status == RTEMS_SUCCESSFUL) // CWF2
690 if (status == RTEMS_SUCCESSFUL) // CWF2
691 {
691 {
692 status = rtems_task_start( Task_id[TASKID_CWF2], cwf2_task, 1 );
692 status = rtems_task_start( Task_id[TASKID_CWF2], cwf2_task, 1 );
693 if (status!=RTEMS_SUCCESSFUL) {
693 if (status!=RTEMS_SUCCESSFUL) {
694 BOOT_PRINTF("in INIT *** Error starting TASK_CWF2\n")
694 BOOT_PRINTF("in INIT *** Error starting TASK_CWF2\n")
695 }
695 }
696 }
696 }
697 if (status == RTEMS_SUCCESSFUL) // CWF1
697 if (status == RTEMS_SUCCESSFUL) // CWF1
698 {
698 {
699 status = rtems_task_start( Task_id[TASKID_CWF1], cwf1_task, 1 );
699 status = rtems_task_start( Task_id[TASKID_CWF1], cwf1_task, 1 );
700 if (status!=RTEMS_SUCCESSFUL) {
700 if (status!=RTEMS_SUCCESSFUL) {
701 BOOT_PRINTF("in INIT *** Error starting TASK_CWF1\n")
701 BOOT_PRINTF("in INIT *** Error starting TASK_CWF1\n")
702 }
702 }
703 }
703 }
704 if (status == RTEMS_SUCCESSFUL) // SWBD
704 if (status == RTEMS_SUCCESSFUL) // SWBD
705 {
705 {
706 status = rtems_task_start( Task_id[TASKID_SWBD], swbd_task, 1 );
706 status = rtems_task_start( Task_id[TASKID_SWBD], swbd_task, 1 );
707 if (status!=RTEMS_SUCCESSFUL) {
707 if (status!=RTEMS_SUCCESSFUL) {
708 BOOT_PRINTF("in INIT *** Error starting TASK_SWBD\n")
708 BOOT_PRINTF("in INIT *** Error starting TASK_SWBD\n")
709 }
709 }
710 }
710 }
711
711
712 //*****
712 //*****
713 // MISC
713 // MISC
714 if (status == RTEMS_SUCCESSFUL) // HOUS
714 if (status == RTEMS_SUCCESSFUL) // HOUS
715 {
715 {
716 status = rtems_task_start( Task_id[TASKID_HOUS], hous_task, 1 );
716 status = rtems_task_start( Task_id[TASKID_HOUS], hous_task, 1 );
717 if (status!=RTEMS_SUCCESSFUL) {
717 if (status!=RTEMS_SUCCESSFUL) {
718 BOOT_PRINTF("in INIT *** Error starting TASK_HOUS\n")
718 BOOT_PRINTF("in INIT *** Error starting TASK_HOUS\n")
719 }
719 }
720 }
720 }
721 if (status == RTEMS_SUCCESSFUL) // AVGV
721 if (status == RTEMS_SUCCESSFUL) // AVGV
722 {
722 {
723 status = rtems_task_start( Task_id[TASKID_AVGV], avgv_task, 1 );
723 status = rtems_task_start( Task_id[TASKID_AVGV], avgv_task, 1 );
724 if (status!=RTEMS_SUCCESSFUL) {
724 if (status!=RTEMS_SUCCESSFUL) {
725 BOOT_PRINTF("in INIT *** Error starting TASK_AVGV\n")
725 BOOT_PRINTF("in INIT *** Error starting TASK_AVGV\n")
726 }
726 }
727 }
727 }
728 if (status == RTEMS_SUCCESSFUL) // DUMB
728 if (status == RTEMS_SUCCESSFUL) // DUMB
729 {
729 {
730 status = rtems_task_start( Task_id[TASKID_DUMB], dumb_task, 1 );
730 status = rtems_task_start( Task_id[TASKID_DUMB], dumb_task, 1 );
731 if (status!=RTEMS_SUCCESSFUL) {
731 if (status!=RTEMS_SUCCESSFUL) {
732 BOOT_PRINTF("in INIT *** Error starting TASK_DUMB\n")
732 BOOT_PRINTF("in INIT *** Error starting TASK_DUMB\n")
733 }
733 }
734 }
734 }
735 if (status == RTEMS_SUCCESSFUL) // LOAD
735 if (status == RTEMS_SUCCESSFUL) // LOAD
736 {
736 {
737 status = rtems_task_start( Task_id[TASKID_LOAD], load_task, 1 );
737 status = rtems_task_start( Task_id[TASKID_LOAD], load_task, 1 );
738 if (status!=RTEMS_SUCCESSFUL) {
738 if (status!=RTEMS_SUCCESSFUL) {
739 BOOT_PRINTF("in INIT *** Error starting TASK_LOAD\n")
739 BOOT_PRINTF("in INIT *** Error starting TASK_LOAD\n")
740 }
740 }
741 }
741 }
742
742
743 return status;
743 return status;
744 }
744 }
745
745
746 rtems_status_code create_message_queues( void ) // create the two message queues used in the software
746 rtems_status_code create_message_queues( void ) // create the two message queues used in the software
747 {
747 {
748 rtems_status_code status_recv;
748 rtems_status_code status_recv;
749 rtems_status_code status_send;
749 rtems_status_code status_send;
750 rtems_status_code status_q_p0;
750 rtems_status_code status_q_p0;
751 rtems_status_code status_q_p1;
751 rtems_status_code status_q_p1;
752 rtems_status_code status_q_p2;
752 rtems_status_code status_q_p2;
753 rtems_status_code ret;
753 rtems_status_code ret;
754 rtems_id queue_id;
754 rtems_id queue_id;
755
755
756 //****************************************
756 //****************************************
757 // create the queue for handling valid TCs
757 // create the queue for handling valid TCs
758 status_recv = rtems_message_queue_create( misc_name[QUEUE_RECV],
758 status_recv = rtems_message_queue_create( misc_name[QUEUE_RECV],
759 MSG_QUEUE_COUNT_RECV, CCSDS_TC_PKT_MAX_SIZE,
759 MSG_QUEUE_COUNT_RECV, CCSDS_TC_PKT_MAX_SIZE,
760 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
760 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
761 if ( status_recv != RTEMS_SUCCESSFUL ) {
761 if ( status_recv != RTEMS_SUCCESSFUL ) {
762 PRINTF1("in create_message_queues *** ERR creating QUEU queue, %d\n", status_recv)
762 PRINTF1("in create_message_queues *** ERR creating QUEU queue, %d\n", status_recv)
763 }
763 }
764
764
765 //************************************************
765 //************************************************
766 // create the queue for handling TM packet sending
766 // create the queue for handling TM packet sending
767 status_send = rtems_message_queue_create( misc_name[QUEUE_SEND],
767 status_send = rtems_message_queue_create( misc_name[QUEUE_SEND],
768 MSG_QUEUE_COUNT_SEND, MSG_QUEUE_SIZE_SEND,
768 MSG_QUEUE_COUNT_SEND, MSG_QUEUE_SIZE_SEND,
769 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
769 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
770 if ( status_send != RTEMS_SUCCESSFUL ) {
770 if ( status_send != RTEMS_SUCCESSFUL ) {
771 PRINTF1("in create_message_queues *** ERR creating PKTS queue, %d\n", status_send)
771 PRINTF1("in create_message_queues *** ERR creating PKTS queue, %d\n", status_send)
772 }
772 }
773
773
774 //*****************************************************************************
774 //*****************************************************************************
775 // create the queue for handling averaged spectral matrices for processing @ f0
775 // create the queue for handling averaged spectral matrices for processing @ f0
776 status_q_p0 = rtems_message_queue_create( misc_name[QUEUE_PRC0],
776 status_q_p0 = rtems_message_queue_create( misc_name[QUEUE_PRC0],
777 MSG_QUEUE_COUNT_PRC0, MSG_QUEUE_SIZE_PRC0,
777 MSG_QUEUE_COUNT_PRC0, MSG_QUEUE_SIZE_PRC0,
778 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
778 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
779 if ( status_q_p0 != RTEMS_SUCCESSFUL ) {
779 if ( status_q_p0 != RTEMS_SUCCESSFUL ) {
780 PRINTF1("in create_message_queues *** ERR creating Q_P0 queue, %d\n", status_q_p0)
780 PRINTF1("in create_message_queues *** ERR creating Q_P0 queue, %d\n", status_q_p0)
781 }
781 }
782
782
783 //*****************************************************************************
783 //*****************************************************************************
784 // create the queue for handling averaged spectral matrices for processing @ f1
784 // create the queue for handling averaged spectral matrices for processing @ f1
785 status_q_p1 = rtems_message_queue_create( misc_name[QUEUE_PRC1],
785 status_q_p1 = rtems_message_queue_create( misc_name[QUEUE_PRC1],
786 MSG_QUEUE_COUNT_PRC1, MSG_QUEUE_SIZE_PRC1,
786 MSG_QUEUE_COUNT_PRC1, MSG_QUEUE_SIZE_PRC1,
787 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
787 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
788 if ( status_q_p1 != RTEMS_SUCCESSFUL ) {
788 if ( status_q_p1 != RTEMS_SUCCESSFUL ) {
789 PRINTF1("in create_message_queues *** ERR creating Q_P1 queue, %d\n", status_q_p1)
789 PRINTF1("in create_message_queues *** ERR creating Q_P1 queue, %d\n", status_q_p1)
790 }
790 }
791
791
792 //*****************************************************************************
792 //*****************************************************************************
793 // create the queue for handling averaged spectral matrices for processing @ f2
793 // create the queue for handling averaged spectral matrices for processing @ f2
794 status_q_p2 = rtems_message_queue_create( misc_name[QUEUE_PRC2],
794 status_q_p2 = rtems_message_queue_create( misc_name[QUEUE_PRC2],
795 MSG_QUEUE_COUNT_PRC2, MSG_QUEUE_SIZE_PRC2,
795 MSG_QUEUE_COUNT_PRC2, MSG_QUEUE_SIZE_PRC2,
796 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
796 RTEMS_FIFO | RTEMS_LOCAL, &queue_id );
797 if ( status_q_p2 != RTEMS_SUCCESSFUL ) {
797 if ( status_q_p2 != RTEMS_SUCCESSFUL ) {
798 PRINTF1("in create_message_queues *** ERR creating Q_P2 queue, %d\n", status_q_p2)
798 PRINTF1("in create_message_queues *** ERR creating Q_P2 queue, %d\n", status_q_p2)
799 }
799 }
800
800
801 if ( status_recv != RTEMS_SUCCESSFUL )
801 if ( status_recv != RTEMS_SUCCESSFUL )
802 {
802 {
803 ret = status_recv;
803 ret = status_recv;
804 }
804 }
805 else if( status_send != RTEMS_SUCCESSFUL )
805 else if( status_send != RTEMS_SUCCESSFUL )
806 {
806 {
807 ret = status_send;
807 ret = status_send;
808 }
808 }
809 else if( status_q_p0 != RTEMS_SUCCESSFUL )
809 else if( status_q_p0 != RTEMS_SUCCESSFUL )
810 {
810 {
811 ret = status_q_p0;
811 ret = status_q_p0;
812 }
812 }
813 else if( status_q_p1 != RTEMS_SUCCESSFUL )
813 else if( status_q_p1 != RTEMS_SUCCESSFUL )
814 {
814 {
815 ret = status_q_p1;
815 ret = status_q_p1;
816 }
816 }
817 else
817 else
818 {
818 {
819 ret = status_q_p2;
819 ret = status_q_p2;
820 }
820 }
821
821
822 return ret;
822 return ret;
823 }
823 }
824
824
825 rtems_status_code create_timecode_timer( void )
825 rtems_status_code create_timecode_timer( void )
826 {
826 {
827 rtems_status_code status;
827 rtems_status_code status;
828
828
829 status = rtems_timer_create( timecode_timer_name, &timecode_timer_id );
829 status = rtems_timer_create( timecode_timer_name, &timecode_timer_id );
830
830
831 if ( status != RTEMS_SUCCESSFUL )
831 if ( status != RTEMS_SUCCESSFUL )
832 {
832 {
833 PRINTF1("in create_timer_timecode *** ERR creating SPTC timer, %d\n", status)
833 PRINTF1("in create_timer_timecode *** ERR creating SPTC timer, %d\n", status)
834 }
834 }
835 else
835 else
836 {
836 {
837 PRINTF("in create_timer_timecode *** OK creating SPTC timer\n")
837 PRINTF("in create_timer_timecode *** OK creating SPTC timer\n")
838 }
838 }
839
839
840 return status;
840 return status;
841 }
841 }
842
842
843 rtems_status_code get_message_queue_id_send( rtems_id *queue_id )
843 rtems_status_code get_message_queue_id_send( rtems_id *queue_id )
844 {
844 {
845 rtems_status_code status;
845 rtems_status_code status;
846 rtems_name queue_name;
846 rtems_name queue_name;
847
847
848 queue_name = rtems_build_name( 'Q', '_', 'S', 'D' );
848 queue_name = rtems_build_name( 'Q', '_', 'S', 'D' );
849
849
850 status = rtems_message_queue_ident( queue_name, 0, queue_id );
850 status = rtems_message_queue_ident( queue_name, 0, queue_id );
851
851
852 return status;
852 return status;
853 }
853 }
854
854
855 rtems_status_code get_message_queue_id_recv( rtems_id *queue_id )
855 rtems_status_code get_message_queue_id_recv( rtems_id *queue_id )
856 {
856 {
857 rtems_status_code status;
857 rtems_status_code status;
858 rtems_name queue_name;
858 rtems_name queue_name;
859
859
860 queue_name = rtems_build_name( 'Q', '_', 'R', 'V' );
860 queue_name = rtems_build_name( 'Q', '_', 'R', 'V' );
861
861
862 status = rtems_message_queue_ident( queue_name, 0, queue_id );
862 status = rtems_message_queue_ident( queue_name, 0, queue_id );
863
863
864 return status;
864 return status;
865 }
865 }
866
866
867 rtems_status_code get_message_queue_id_prc0( rtems_id *queue_id )
867 rtems_status_code get_message_queue_id_prc0( rtems_id *queue_id )
868 {
868 {
869 rtems_status_code status;
869 rtems_status_code status;
870 rtems_name queue_name;
870 rtems_name queue_name;
871
871
872 queue_name = rtems_build_name( 'Q', '_', 'P', '0' );
872 queue_name = rtems_build_name( 'Q', '_', 'P', '0' );
873
873
874 status = rtems_message_queue_ident( queue_name, 0, queue_id );
874 status = rtems_message_queue_ident( queue_name, 0, queue_id );
875
875
876 return status;
876 return status;
877 }
877 }
878
878
879 rtems_status_code get_message_queue_id_prc1( rtems_id *queue_id )
879 rtems_status_code get_message_queue_id_prc1( rtems_id *queue_id )
880 {
880 {
881 rtems_status_code status;
881 rtems_status_code status;
882 rtems_name queue_name;
882 rtems_name queue_name;
883
883
884 queue_name = rtems_build_name( 'Q', '_', 'P', '1' );
884 queue_name = rtems_build_name( 'Q', '_', 'P', '1' );
885
885
886 status = rtems_message_queue_ident( queue_name, 0, queue_id );
886 status = rtems_message_queue_ident( queue_name, 0, queue_id );
887
887
888 return status;
888 return status;
889 }
889 }
890
890
891 rtems_status_code get_message_queue_id_prc2( rtems_id *queue_id )
891 rtems_status_code get_message_queue_id_prc2( rtems_id *queue_id )
892 {
892 {
893 rtems_status_code status;
893 rtems_status_code status;
894 rtems_name queue_name;
894 rtems_name queue_name;
895
895
896 queue_name = rtems_build_name( 'Q', '_', 'P', '2' );
896 queue_name = rtems_build_name( 'Q', '_', 'P', '2' );
897
897
898 status = rtems_message_queue_ident( queue_name, 0, queue_id );
898 status = rtems_message_queue_ident( queue_name, 0, queue_id );
899
899
900 return status;
900 return status;
901 }
901 }
902
902
903 void update_queue_max_count( rtems_id queue_id, unsigned char*fifo_size_max )
903 void update_queue_max_count( rtems_id queue_id, unsigned char*fifo_size_max )
904 {
904 {
905 u_int32_t count;
905 u_int32_t count;
906 rtems_status_code status;
906 rtems_status_code status;
907
907
908 status = rtems_message_queue_get_number_pending( queue_id, &count );
908 status = rtems_message_queue_get_number_pending( queue_id, &count );
909
909
910 count = count + 1;
910 count = count + 1;
911
911
912 if (status != RTEMS_SUCCESSFUL)
912 if (status != RTEMS_SUCCESSFUL)
913 {
913 {
914 PRINTF1("in update_queue_max_count *** ERR = %d\n", status)
914 PRINTF1("in update_queue_max_count *** ERR = %d\n", status)
915 }
915 }
916 else
916 else
917 {
917 {
918 if (count > *fifo_size_max)
918 if (count > *fifo_size_max)
919 {
919 {
920 *fifo_size_max = count;
920 *fifo_size_max = count;
921 }
921 }
922 }
922 }
923 }
923 }
924
924
925 void init_ring(ring_node ring[], unsigned char nbNodes, volatile int buffer[], unsigned int bufferSize )
925 void init_ring(ring_node ring[], unsigned char nbNodes, volatile int buffer[], unsigned int bufferSize )
926 {
926 {
927 unsigned char i;
927 unsigned char i;
928
928
929 //***************
929 //***************
930 // BUFFER ADDRESS
930 // BUFFER ADDRESS
931 for(i=0; i<nbNodes; i++)
931 for(i=0; i<nbNodes; i++)
932 {
932 {
933 ring[i].coarseTime = 0xffffffff;
933 ring[i].coarseTime = 0xffffffff;
934 ring[i].fineTime = 0xffffffff;
934 ring[i].fineTime = 0xffffffff;
935 ring[i].sid = 0x00;
935 ring[i].sid = 0x00;
936 ring[i].status = 0x00;
936 ring[i].status = 0x00;
937 ring[i].buffer_address = (int) &buffer[ i * bufferSize ];
937 ring[i].buffer_address = (int) &buffer[ i * bufferSize ];
938 }
938 }
939
939
940 //*****
940 //*****
941 // NEXT
941 // NEXT
942 ring[ nbNodes - 1 ].next = (ring_node*) &ring[ 0 ];
942 ring[ nbNodes - 1 ].next = (ring_node*) &ring[ 0 ];
943 for(i=0; i<nbNodes-1; i++)
943 for(i=0; i<nbNodes-1; i++)
944 {
944 {
945 ring[i].next = (ring_node*) &ring[ i + 1 ];
945 ring[i].next = (ring_node*) &ring[ i + 1 ];
946 }
946 }
947
947
948 //*********
948 //*********
949 // PREVIOUS
949 // PREVIOUS
950 ring[ 0 ].previous = (ring_node*) &ring[ nbNodes - 1 ];
950 ring[ 0 ].previous = (ring_node*) &ring[ nbNodes - 1 ];
951 for(i=1; i<nbNodes; i++)
951 for(i=1; i<nbNodes; i++)
952 {
952 {
953 ring[i].previous = (ring_node*) &ring[ i - 1 ];
953 ring[i].previous = (ring_node*) &ring[ i - 1 ];
954 }
954 }
955 }
955 }
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now