##// END OF EJS Templates
minor typos
paul -
r284:c97e85c97b15 R3_plus draft
parent child
Show More
@@ -1,2 +1,2
1 3081d1f9bb20b2b64a192585337a292a9804e0c5 LFR_basic-parameters
1 3081d1f9bb20b2b64a192585337a292a9804e0c5 LFR_basic-parameters
2 81c3289ebd2a13e3b3147acdf60e34678378f905 header/lfr_common_headers
2 d867fbc1a62231ed43bdda3e91b3f45f45806c3d header/lfr_common_headers
@@ -1,926 +1,927
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 20
29 #define CONFIGURE_MAXIMUM_TASKS 20
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
37 #define CONFIGURE_MAXIMUM_PERIODS 5
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 #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
50 #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
51 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GPTIMER
51 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GPTIMER
52 #endif
52 #endif
53 #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
53 #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
54 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_APBUART
54 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_APBUART
55 #endif
55 #endif
56 #endif
56 #endif
57 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRSPW /* GRSPW Driver */
57 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRSPW /* GRSPW Driver */
58 #include <drvmgr/drvmgr_confdefs.h>
58 #include <drvmgr/drvmgr_confdefs.h>
59 #endif
59 #endif
60
60
61 #include "fsw_init.h"
61 #include "fsw_init.h"
62 #include "fsw_config.c"
62 #include "fsw_config.c"
63 #include "GscMemoryLPP.hpp"
63 #include "GscMemoryLPP.hpp"
64
64
65 void initCache()
65 void initCache()
66 {
66 {
67 // ASI 2 contains a few control registers that have not been assigned as ancillary state registers.
67 // ASI 2 contains a few control registers that have not been assigned as ancillary state registers.
68 // These should only be read and written using 32-bit LDA/STA instructions.
68 // These should only be read and written using 32-bit LDA/STA instructions.
69 // All cache registers are accessed through load/store operations to the alternate address space (LDA/STA), using ASI = 2.
69 // All cache registers are accessed through load/store operations to the alternate address space (LDA/STA), using ASI = 2.
70 // The table below shows the register addresses:
70 // The table below shows the register addresses:
71 // 0x00 Cache control register
71 // 0x00 Cache control register
72 // 0x04 Reserved
72 // 0x04 Reserved
73 // 0x08 Instruction cache configuration register
73 // 0x08 Instruction cache configuration register
74 // 0x0C Data cache configuration register
74 // 0x0C Data cache configuration register
75
75
76 // Cache Control Register Leon3 / Leon3FT
76 // Cache Control Register Leon3 / Leon3FT
77 // 31..30 29 28 27..24 23 22 21 20..19 18 17 16
77 // 31..30 29 28 27..24 23 22 21 20..19 18 17 16
78 // RFT PS TB DS FD FI FT ST IB
78 // RFT PS TB DS FD FI FT ST IB
79 // 15 14 13..12 11..10 9..8 7..6 5 4 3..2 1..0
79 // 15 14 13..12 11..10 9..8 7..6 5 4 3..2 1..0
80 // IP DP ITE IDE DTE DDE DF IF DCS ICS
80 // IP DP ITE IDE DTE DDE DF IF DCS ICS
81
81
82 unsigned int cacheControlRegister;
82 unsigned int cacheControlRegister;
83
83
84 CCR_resetCacheControlRegister();
84 CCR_resetCacheControlRegister();
85 ASR16_resetRegisterProtectionControlRegister();
85 ASR16_resetRegisterProtectionControlRegister();
86
86
87 cacheControlRegister = CCR_getValue();
87 cacheControlRegister = CCR_getValue();
88 PRINTF1("(0) CCR - Cache Control Register = %x\n", cacheControlRegister);
88 PRINTF1("(0) CCR - Cache Control Register = %x\n", cacheControlRegister);
89 PRINTF1("(0) ASR16 = %x\n", *asr16Ptr);
89 PRINTF1("(0) ASR16 = %x\n", *asr16Ptr);
90
90
91 CCR_enableInstructionCache(); // ICS bits
91 CCR_enableInstructionCache(); // ICS bits
92 CCR_enableDataCache(); // DCS bits
92 CCR_enableDataCache(); // DCS bits
93 CCR_enableInstructionBurstFetch(); // IB bit
93 CCR_enableInstructionBurstFetch(); // IB bit
94
94
95 faultTolerantScheme();
95 faultTolerantScheme();
96
96
97 cacheControlRegister = CCR_getValue();
97 cacheControlRegister = CCR_getValue();
98 PRINTF1("(1) CCR - Cache Control Register = %x\n", cacheControlRegister);
98 PRINTF1("(1) CCR - Cache Control Register = %x\n", cacheControlRegister);
99 PRINTF1("(1) ASR16 Register protection control register = %x\n", *asr16Ptr);
99 PRINTF1("(1) ASR16 Register protection control register = %x\n", *asr16Ptr);
100
100
101 PRINTF("\n");
101 PRINTF("\n");
102 }
102 }
103
103
104 rtems_task Init( rtems_task_argument ignored )
104 rtems_task Init( rtems_task_argument ignored )
105 {
105 {
106 /** This is the RTEMS INIT taks, it is the first task launched by the system.
106 /** This is the RTEMS INIT taks, it is the first task launched by the system.
107 *
107 *
108 * @param unused is the starting argument of the RTEMS task
108 * @param unused is the starting argument of the RTEMS task
109 *
109 *
110 * The INIT task create and run all other RTEMS tasks.
110 * The INIT task create and run all other RTEMS tasks.
111 *
111 *
112 */
112 */
113
113
114 //***********
114 //***********
115 // INIT CACHE
115 // INIT CACHE
116
116
117 unsigned char *vhdlVersion;
117 unsigned char *vhdlVersion;
118
118
119 reset_lfr();
119 reset_lfr();
120
120
121 reset_local_time();
121 reset_local_time();
122
122
123 rtems_cpu_usage_reset();
123 rtems_cpu_usage_reset();
124
124
125 rtems_status_code status;
125 rtems_status_code status;
126 rtems_status_code status_spw;
126 rtems_status_code status_spw;
127 rtems_isr_entry old_isr_handler;
127 rtems_isr_entry old_isr_handler;
128
128
129 // UART settings
129 // UART settings
130 enable_apbuart_transmitter();
130 enable_apbuart_transmitter();
131 set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE);
131 set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE);
132
132
133 DEBUG_PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n")
133 DEBUG_PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n")
134
134
135
135
136 PRINTF("\n\n\n\n\n")
136 PRINTF("\n\n\n\n\n")
137
137
138 initCache();
138 initCache();
139
139
140 PRINTF("*************************\n")
140 PRINTF("*************************\n")
141 PRINTF("** LFR Flight Software **\n")
141 PRINTF("** LFR Flight Software **\n")
142 PRINTF1("** %d.", SW_VERSION_N1)
142 PRINTF1("** %d.", SW_VERSION_N1)
143 PRINTF1("%d." , SW_VERSION_N2)
143 PRINTF1("%d." , SW_VERSION_N2)
144 PRINTF1("%d." , SW_VERSION_N3)
144 PRINTF1("%d." , SW_VERSION_N3)
145 PRINTF1("%d **\n", SW_VERSION_N4)
145 PRINTF1("%d **\n", SW_VERSION_N4)
146
146
147 vhdlVersion = (unsigned char *) (REGS_ADDR_VHDL_VERSION);
147 vhdlVersion = (unsigned char *) (REGS_ADDR_VHDL_VERSION);
148 PRINTF("** VHDL **\n")
148 PRINTF("** VHDL **\n")
149 PRINTF1("** %d.", vhdlVersion[1])
149 PRINTF1("** %d.", vhdlVersion[1])
150 PRINTF1("%d." , vhdlVersion[2])
150 PRINTF1("%d." , vhdlVersion[2])
151 PRINTF1("%d **\n", vhdlVersion[3])
151 PRINTF1("%d **\n", vhdlVersion[3])
152 PRINTF("*************************\n")
152 PRINTF("*************************\n")
153 PRINTF("\n\n")
153 PRINTF("\n\n")
154
154
155 init_parameter_dump();
155 init_parameter_dump();
156 init_kcoefficients_dump();
156 init_kcoefficients_dump();
157 init_local_mode_parameters();
157 init_local_mode_parameters();
158 init_housekeeping_parameters();
158 init_housekeeping_parameters();
159 init_k_coefficients_prc0();
159 init_k_coefficients_prc0();
160 init_k_coefficients_prc1();
160 init_k_coefficients_prc1();
161 init_k_coefficients_prc2();
161 init_k_coefficients_prc2();
162 pa_bia_status_info = 0x00;
162 pa_bia_status_info = 0x00;
163 cp_rpw_sc_rw_f_flags = 0x00;
163 cp_rpw_sc_rw_f_flags = 0x00;
164 cp_rpw_sc_rw1_f1 = 0.0;
164 cp_rpw_sc_rw1_f1 = 0.0;
165 cp_rpw_sc_rw1_f2 = 0.0;
165 cp_rpw_sc_rw1_f2 = 0.0;
166 cp_rpw_sc_rw2_f1 = 0.0;
166 cp_rpw_sc_rw2_f1 = 0.0;
167 cp_rpw_sc_rw2_f2 = 0.0;
167 cp_rpw_sc_rw2_f2 = 0.0;
168 cp_rpw_sc_rw3_f1 = 0.0;
168 cp_rpw_sc_rw3_f1 = 0.0;
169 cp_rpw_sc_rw3_f2 = 0.0;
169 cp_rpw_sc_rw3_f2 = 0.0;
170 cp_rpw_sc_rw4_f1 = 0.0;
170 cp_rpw_sc_rw4_f1 = 0.0;
171 cp_rpw_sc_rw4_f2 = 0.0;
171 cp_rpw_sc_rw4_f2 = 0.0;
172 update_last_valid_transition_date( DEFAULT_LAST_VALID_TRANSITION_DATE );
172 update_last_valid_transition_date( DEFAULT_LAST_VALID_TRANSITION_DATE );
173
173
174 // waveform picker initialization
174 // waveform picker initialization
175 WFP_init_rings(); LEON_Clear_interrupt( IRQ_SPARC_GPTIMER_WATCHDOG ); // initialize the waveform rings
175 WFP_init_rings();
176 LEON_Clear_interrupt( IRQ_SPARC_GPTIMER_WATCHDOG ); // initialize the waveform rings
176 WFP_reset_current_ring_nodes();
177 WFP_reset_current_ring_nodes();
177 reset_waveform_picker_regs();
178 reset_waveform_picker_regs();
178
179
179 // spectral matrices initialization
180 // spectral matrices initialization
180 SM_init_rings(); // initialize spectral matrices rings
181 SM_init_rings(); // initialize spectral matrices rings
181 SM_reset_current_ring_nodes();
182 SM_reset_current_ring_nodes();
182 reset_spectral_matrix_regs();
183 reset_spectral_matrix_regs();
183
184
184 // configure calibration
185 // configure calibration
185 configureCalibration( false ); // true means interleaved mode, false is for normal mode
186 configureCalibration( false ); // true means interleaved mode, false is for normal mode
186
187
187 updateLFRCurrentMode( LFR_MODE_STANDBY );
188 updateLFRCurrentMode( LFR_MODE_STANDBY );
188
189
189 BOOT_PRINTF1("in INIT *** lfrCurrentMode is %d\n", lfrCurrentMode)
190 BOOT_PRINTF1("in INIT *** lfrCurrentMode is %d\n", lfrCurrentMode)
190
191
191 create_names(); // create all names
192 create_names(); // create all names
192
193
193 status = create_timecode_timer(); // create the timer used by timecode_irq_handler
194 status = create_timecode_timer(); // create the timer used by timecode_irq_handler
194 if (status != RTEMS_SUCCESSFUL)
195 if (status != RTEMS_SUCCESSFUL)
195 {
196 {
196 PRINTF1("in INIT *** ERR in create_timer_timecode, code %d", status)
197 PRINTF1("in INIT *** ERR in create_timer_timecode, code %d", status)
197 }
198 }
198
199
199 status = create_message_queues(); // create message queues
200 status = create_message_queues(); // create message queues
200 if (status != RTEMS_SUCCESSFUL)
201 if (status != RTEMS_SUCCESSFUL)
201 {
202 {
202 PRINTF1("in INIT *** ERR in create_message_queues, code %d", status)
203 PRINTF1("in INIT *** ERR in create_message_queues, code %d", status)
203 }
204 }
204
205
205 status = create_all_tasks(); // create all tasks
206 status = create_all_tasks(); // create all tasks
206 if (status != RTEMS_SUCCESSFUL)
207 if (status != RTEMS_SUCCESSFUL)
207 {
208 {
208 PRINTF1("in INIT *** ERR in create_all_tasks, code %d\n", status)
209 PRINTF1("in INIT *** ERR in create_all_tasks, code %d\n", status)
209 }
210 }
210
211
211 // **************************
212 // **************************
212 // <SPACEWIRE INITIALIZATION>
213 // <SPACEWIRE INITIALIZATION>
213 status_spw = spacewire_open_link(); // (1) open the link
214 status_spw = spacewire_open_link(); // (1) open the link
214 if ( status_spw != RTEMS_SUCCESSFUL )
215 if ( status_spw != RTEMS_SUCCESSFUL )
215 {
216 {
216 PRINTF1("in INIT *** ERR spacewire_open_link code %d\n", status_spw )
217 PRINTF1("in INIT *** ERR spacewire_open_link code %d\n", status_spw )
217 }
218 }
218
219
219 if ( status_spw == RTEMS_SUCCESSFUL ) // (2) configure the link
220 if ( status_spw == RTEMS_SUCCESSFUL ) // (2) configure the link
220 {
221 {
221 status_spw = spacewire_configure_link( fdSPW );
222 status_spw = spacewire_configure_link( fdSPW );
222 if ( status_spw != RTEMS_SUCCESSFUL )
223 if ( status_spw != RTEMS_SUCCESSFUL )
223 {
224 {
224 PRINTF1("in INIT *** ERR spacewire_configure_link code %d\n", status_spw )
225 PRINTF1("in INIT *** ERR spacewire_configure_link code %d\n", status_spw )
225 }
226 }
226 }
227 }
227
228
228 if ( status_spw == RTEMS_SUCCESSFUL) // (3) start the link
229 if ( status_spw == RTEMS_SUCCESSFUL) // (3) start the link
229 {
230 {
230 status_spw = spacewire_start_link( fdSPW );
231 status_spw = spacewire_start_link( fdSPW );
231 if ( status_spw != RTEMS_SUCCESSFUL )
232 if ( status_spw != RTEMS_SUCCESSFUL )
232 {
233 {
233 PRINTF1("in INIT *** ERR spacewire_start_link code %d\n", status_spw )
234 PRINTF1("in INIT *** ERR spacewire_start_link code %d\n", status_spw )
234 }
235 }
235 }
236 }
236 // </SPACEWIRE INITIALIZATION>
237 // </SPACEWIRE INITIALIZATION>
237 // ***************************
238 // ***************************
238
239
239 status = start_all_tasks(); // start all tasks
240 status = start_all_tasks(); // start all tasks
240 if (status != RTEMS_SUCCESSFUL)
241 if (status != RTEMS_SUCCESSFUL)
241 {
242 {
242 PRINTF1("in INIT *** ERR in start_all_tasks, code %d", status)
243 PRINTF1("in INIT *** ERR in start_all_tasks, code %d", status)
243 }
244 }
244
245
245 // start RECV and SEND *AFTER* SpaceWire Initialization, due to the timeout of the start call during the initialization
246 // start RECV and SEND *AFTER* SpaceWire Initialization, due to the timeout of the start call during the initialization
246 status = start_recv_send_tasks();
247 status = start_recv_send_tasks();
247 if ( status != RTEMS_SUCCESSFUL )
248 if ( status != RTEMS_SUCCESSFUL )
248 {
249 {
249 PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status )
250 PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status )
250 }
251 }
251
252
252 // suspend science tasks, they will be restarted later depending on the mode
253 // suspend science tasks, they will be restarted later depending on the mode
253 status = suspend_science_tasks(); // suspend science tasks (not done in stop_current_mode if current mode = STANDBY)
254 status = suspend_science_tasks(); // suspend science tasks (not done in stop_current_mode if current mode = STANDBY)
254 if (status != RTEMS_SUCCESSFUL)
255 if (status != RTEMS_SUCCESSFUL)
255 {
256 {
256 PRINTF1("in INIT *** in suspend_science_tasks *** ERR code: %d\n", status)
257 PRINTF1("in INIT *** in suspend_science_tasks *** ERR code: %d\n", status)
257 }
258 }
258
259
259 // configure IRQ handling for the waveform picker unit
260 // configure IRQ handling for the waveform picker unit
260 status = rtems_interrupt_catch( waveforms_isr,
261 status = rtems_interrupt_catch( waveforms_isr,
261 IRQ_SPARC_WAVEFORM_PICKER,
262 IRQ_SPARC_WAVEFORM_PICKER,
262 &old_isr_handler) ;
263 &old_isr_handler) ;
263 // configure IRQ handling for the spectral matrices unit
264 // configure IRQ handling for the spectral matrices unit
264 status = rtems_interrupt_catch( spectral_matrices_isr,
265 status = rtems_interrupt_catch( spectral_matrices_isr,
265 IRQ_SPARC_SPECTRAL_MATRIX,
266 IRQ_SPARC_SPECTRAL_MATRIX,
266 &old_isr_handler) ;
267 &old_isr_handler) ;
267
268
268 // if the spacewire link is not up then send an event to the SPIQ task for link recovery
269 // if the spacewire link is not up then send an event to the SPIQ task for link recovery
269 if ( status_spw != RTEMS_SUCCESSFUL )
270 if ( status_spw != RTEMS_SUCCESSFUL )
270 {
271 {
271 status = rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT );
272 status = rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT );
272 if ( status != RTEMS_SUCCESSFUL ) {
273 if ( status != RTEMS_SUCCESSFUL ) {
273 PRINTF1("in INIT *** ERR rtems_event_send to SPIQ code %d\n", status )
274 PRINTF1("in INIT *** ERR rtems_event_send to SPIQ code %d\n", status )
274 }
275 }
275 }
276 }
276
277
277 BOOT_PRINTF("delete INIT\n")
278 BOOT_PRINTF("delete INIT\n")
278
279
279 set_hk_lfr_sc_potential_flag( true );
280 set_hk_lfr_sc_potential_flag( true );
280
281
281 // start the timer to detect a missing spacewire timecode
282 // start the timer to detect a missing spacewire timecode
282 // the timeout is larger because the spw IP needs to receive several valid timecodes before generating a tickout
283 // the timeout is larger because the spw IP needs to receive several valid timecodes before generating a tickout
283 // if a tickout is generated, the timer is restarted
284 // if a tickout is generated, the timer is restarted
284 status = rtems_timer_fire_after( timecode_timer_id, TIMECODE_TIMER_TIMEOUT_INIT, timecode_timer_routine, NULL );
285 status = rtems_timer_fire_after( timecode_timer_id, TIMECODE_TIMER_TIMEOUT_INIT, timecode_timer_routine, NULL );
285
286
286 grspw_timecode_callback = &timecode_irq_handler;
287 grspw_timecode_callback = &timecode_irq_handler;
287
288
288 status = rtems_task_delete(RTEMS_SELF);
289 status = rtems_task_delete(RTEMS_SELF);
289
290
290 }
291 }
291
292
292 void init_local_mode_parameters( void )
293 void init_local_mode_parameters( void )
293 {
294 {
294 /** This function initialize the param_local global variable with default values.
295 /** This function initialize the param_local global variable with default values.
295 *
296 *
296 */
297 */
297
298
298 unsigned int i;
299 unsigned int i;
299
300
300 // LOCAL PARAMETERS
301 // LOCAL PARAMETERS
301
302
302 BOOT_PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max)
303 BOOT_PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max)
303 BOOT_PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max)
304 BOOT_PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max)
304 BOOT_PRINTF1("nb_interrupt_f0_MAX = %d\n", param_local.local_nb_interrupt_f0_MAX)
305 BOOT_PRINTF1("nb_interrupt_f0_MAX = %d\n", param_local.local_nb_interrupt_f0_MAX)
305
306
306 // init sequence counters
307 // init sequence counters
307
308
308 for(i = 0; i<SEQ_CNT_NB_DEST_ID; i++)
309 for(i = 0; i<SEQ_CNT_NB_DEST_ID; i++)
309 {
310 {
310 sequenceCounters_TC_EXE[i] = 0x00;
311 sequenceCounters_TC_EXE[i] = 0x00;
311 sequenceCounters_TM_DUMP[i] = 0x00;
312 sequenceCounters_TM_DUMP[i] = 0x00;
312 }
313 }
313 sequenceCounters_SCIENCE_NORMAL_BURST = 0x00;
314 sequenceCounters_SCIENCE_NORMAL_BURST = 0x00;
314 sequenceCounters_SCIENCE_SBM1_SBM2 = 0x00;
315 sequenceCounters_SCIENCE_SBM1_SBM2 = 0x00;
315 sequenceCounterHK = TM_PACKET_SEQ_CTRL_STANDALONE << 8;
316 sequenceCounterHK = TM_PACKET_SEQ_CTRL_STANDALONE << 8;
316 }
317 }
317
318
318 void reset_local_time( void )
319 void reset_local_time( void )
319 {
320 {
320 time_management_regs->ctrl = time_management_regs->ctrl | 0x02; // [0010] software reset, coarse time = 0x80000000
321 time_management_regs->ctrl = time_management_regs->ctrl | 0x02; // [0010] software reset, coarse time = 0x80000000
321 }
322 }
322
323
323 void create_names( void ) // create all names for tasks and queues
324 void create_names( void ) // create all names for tasks and queues
324 {
325 {
325 /** This function creates all RTEMS names used in the software for tasks and queues.
326 /** This function creates all RTEMS names used in the software for tasks and queues.
326 *
327 *
327 * @return RTEMS directive status codes:
328 * @return RTEMS directive status codes:
328 * - RTEMS_SUCCESSFUL - successful completion
329 * - RTEMS_SUCCESSFUL - successful completion
329 *
330 *
330 */
331 */
331
332
332 // task names
333 // task names
333 Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' );
334 Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' );
334 Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' );
335 Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' );
335 Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' );
336 Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' );
336 Task_name[TASKID_LOAD] = rtems_build_name( 'L', 'O', 'A', 'D' );
337 Task_name[TASKID_LOAD] = rtems_build_name( 'L', 'O', 'A', 'D' );
337 Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' );
338 Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' );
338 Task_name[TASKID_SWBD] = rtems_build_name( 'S', 'W', 'B', 'D' );
339 Task_name[TASKID_SWBD] = rtems_build_name( 'S', 'W', 'B', 'D' );
339 Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' );
340 Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' );
340 Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' );
341 Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' );
341 Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' );
342 Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' );
342 Task_name[TASKID_PRC0] = rtems_build_name( 'P', 'R', 'C', '0' );
343 Task_name[TASKID_PRC0] = rtems_build_name( 'P', 'R', 'C', '0' );
343 Task_name[TASKID_CWF3] = rtems_build_name( 'C', 'W', 'F', '3' );
344 Task_name[TASKID_CWF3] = rtems_build_name( 'C', 'W', 'F', '3' );
344 Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' );
345 Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' );
345 Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' );
346 Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' );
346 Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' );
347 Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' );
347 Task_name[TASKID_LINK] = rtems_build_name( 'L', 'I', 'N', 'K' );
348 Task_name[TASKID_LINK] = rtems_build_name( 'L', 'I', 'N', 'K' );
348 Task_name[TASKID_AVF1] = rtems_build_name( 'A', 'V', 'F', '1' );
349 Task_name[TASKID_AVF1] = rtems_build_name( 'A', 'V', 'F', '1' );
349 Task_name[TASKID_PRC1] = rtems_build_name( 'P', 'R', 'C', '1' );
350 Task_name[TASKID_PRC1] = rtems_build_name( 'P', 'R', 'C', '1' );
350 Task_name[TASKID_AVF2] = rtems_build_name( 'A', 'V', 'F', '2' );
351 Task_name[TASKID_AVF2] = rtems_build_name( 'A', 'V', 'F', '2' );
351 Task_name[TASKID_PRC2] = rtems_build_name( 'P', 'R', 'C', '2' );
352 Task_name[TASKID_PRC2] = rtems_build_name( 'P', 'R', 'C', '2' );
352
353
353 // rate monotonic period names
354 // rate monotonic period names
354 name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' );
355 name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' );
355
356
356 misc_name[QUEUE_RECV] = rtems_build_name( 'Q', '_', 'R', 'V' );
357 misc_name[QUEUE_RECV] = rtems_build_name( 'Q', '_', 'R', 'V' );
357 misc_name[QUEUE_SEND] = rtems_build_name( 'Q', '_', 'S', 'D' );
358 misc_name[QUEUE_SEND] = rtems_build_name( 'Q', '_', 'S', 'D' );
358 misc_name[QUEUE_PRC0] = rtems_build_name( 'Q', '_', 'P', '0' );
359 misc_name[QUEUE_PRC0] = rtems_build_name( 'Q', '_', 'P', '0' );
359 misc_name[QUEUE_PRC1] = rtems_build_name( 'Q', '_', 'P', '1' );
360 misc_name[QUEUE_PRC1] = rtems_build_name( 'Q', '_', 'P', '1' );
360 misc_name[QUEUE_PRC2] = rtems_build_name( 'Q', '_', 'P', '2' );
361 misc_name[QUEUE_PRC2] = rtems_build_name( 'Q', '_', 'P', '2' );
361
362
362 timecode_timer_name = rtems_build_name( 'S', 'P', 'T', 'C' );
363 timecode_timer_name = rtems_build_name( 'S', 'P', 'T', 'C' );
363 }
364 }
364
365
365 int create_all_tasks( void ) // create all tasks which run in the software
366 int create_all_tasks( void ) // create all tasks which run in the software
366 {
367 {
367 /** This function creates all RTEMS tasks used in the software.
368 /** This function creates all RTEMS tasks used in the software.
368 *
369 *
369 * @return RTEMS directive status codes:
370 * @return RTEMS directive status codes:
370 * - RTEMS_SUCCESSFUL - task created successfully
371 * - RTEMS_SUCCESSFUL - task created successfully
371 * - RTEMS_INVALID_ADDRESS - id is NULL
372 * - RTEMS_INVALID_ADDRESS - id is NULL
372 * - RTEMS_INVALID_NAME - invalid task name
373 * - RTEMS_INVALID_NAME - invalid task name
373 * - RTEMS_INVALID_PRIORITY - invalid task priority
374 * - RTEMS_INVALID_PRIORITY - invalid task priority
374 * - RTEMS_MP_NOT_CONFIGURED - multiprocessing not configured
375 * - RTEMS_MP_NOT_CONFIGURED - multiprocessing not configured
375 * - RTEMS_TOO_MANY - too many tasks created
376 * - RTEMS_TOO_MANY - too many tasks created
376 * - RTEMS_UNSATISFIED - not enough memory for stack/FP context
377 * - RTEMS_UNSATISFIED - not enough memory for stack/FP context
377 * - RTEMS_TOO_MANY - too many global objects
378 * - RTEMS_TOO_MANY - too many global objects
378 *
379 *
379 */
380 */
380
381
381 rtems_status_code status;
382 rtems_status_code status;
382
383
383 //**********
384 //**********
384 // SPACEWIRE
385 // SPACEWIRE
385 // RECV
386 // RECV
386 status = rtems_task_create(
387 status = rtems_task_create(
387 Task_name[TASKID_RECV], TASK_PRIORITY_RECV, RTEMS_MINIMUM_STACK_SIZE,
388 Task_name[TASKID_RECV], TASK_PRIORITY_RECV, RTEMS_MINIMUM_STACK_SIZE,
388 RTEMS_DEFAULT_MODES,
389 RTEMS_DEFAULT_MODES,
389 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV]
390 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV]
390 );
391 );
391 if (status == RTEMS_SUCCESSFUL) // SEND
392 if (status == RTEMS_SUCCESSFUL) // SEND
392 {
393 {
393 status = rtems_task_create(
394 status = rtems_task_create(
394 Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE * 2,
395 Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE * 2,
395 RTEMS_DEFAULT_MODES,
396 RTEMS_DEFAULT_MODES,
396 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_SEND]
397 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_SEND]
397 );
398 );
398 }
399 }
399 if (status == RTEMS_SUCCESSFUL) // LINK
400 if (status == RTEMS_SUCCESSFUL) // LINK
400 {
401 {
401 status = rtems_task_create(
402 status = rtems_task_create(
402 Task_name[TASKID_LINK], TASK_PRIORITY_LINK, RTEMS_MINIMUM_STACK_SIZE,
403 Task_name[TASKID_LINK], TASK_PRIORITY_LINK, RTEMS_MINIMUM_STACK_SIZE,
403 RTEMS_DEFAULT_MODES,
404 RTEMS_DEFAULT_MODES,
404 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_LINK]
405 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_LINK]
405 );
406 );
406 }
407 }
407 if (status == RTEMS_SUCCESSFUL) // ACTN
408 if (status == RTEMS_SUCCESSFUL) // ACTN
408 {
409 {
409 status = rtems_task_create(
410 status = rtems_task_create(
410 Task_name[TASKID_ACTN], TASK_PRIORITY_ACTN, RTEMS_MINIMUM_STACK_SIZE,
411 Task_name[TASKID_ACTN], TASK_PRIORITY_ACTN, RTEMS_MINIMUM_STACK_SIZE,
411 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
412 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
412 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_ACTN]
413 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_ACTN]
413 );
414 );
414 }
415 }
415 if (status == RTEMS_SUCCESSFUL) // SPIQ
416 if (status == RTEMS_SUCCESSFUL) // SPIQ
416 {
417 {
417 status = rtems_task_create(
418 status = rtems_task_create(
418 Task_name[TASKID_SPIQ], TASK_PRIORITY_SPIQ, RTEMS_MINIMUM_STACK_SIZE,
419 Task_name[TASKID_SPIQ], TASK_PRIORITY_SPIQ, RTEMS_MINIMUM_STACK_SIZE,
419 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
420 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
420 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ]
421 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ]
421 );
422 );
422 }
423 }
423
424
424 //******************
425 //******************
425 // SPECTRAL MATRICES
426 // SPECTRAL MATRICES
426 if (status == RTEMS_SUCCESSFUL) // AVF0
427 if (status == RTEMS_SUCCESSFUL) // AVF0
427 {
428 {
428 status = rtems_task_create(
429 status = rtems_task_create(
429 Task_name[TASKID_AVF0], TASK_PRIORITY_AVF0, RTEMS_MINIMUM_STACK_SIZE,
430 Task_name[TASKID_AVF0], TASK_PRIORITY_AVF0, RTEMS_MINIMUM_STACK_SIZE,
430 RTEMS_DEFAULT_MODES,
431 RTEMS_DEFAULT_MODES,
431 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0]
432 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0]
432 );
433 );
433 }
434 }
434 if (status == RTEMS_SUCCESSFUL) // PRC0
435 if (status == RTEMS_SUCCESSFUL) // PRC0
435 {
436 {
436 status = rtems_task_create(
437 status = rtems_task_create(
437 Task_name[TASKID_PRC0], TASK_PRIORITY_PRC0, RTEMS_MINIMUM_STACK_SIZE * 2,
438 Task_name[TASKID_PRC0], TASK_PRIORITY_PRC0, RTEMS_MINIMUM_STACK_SIZE * 2,
438 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
439 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
439 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC0]
440 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC0]
440 );
441 );
441 }
442 }
442 if (status == RTEMS_SUCCESSFUL) // AVF1
443 if (status == RTEMS_SUCCESSFUL) // AVF1
443 {
444 {
444 status = rtems_task_create(
445 status = rtems_task_create(
445 Task_name[TASKID_AVF1], TASK_PRIORITY_AVF1, RTEMS_MINIMUM_STACK_SIZE,
446 Task_name[TASKID_AVF1], TASK_PRIORITY_AVF1, RTEMS_MINIMUM_STACK_SIZE,
446 RTEMS_DEFAULT_MODES,
447 RTEMS_DEFAULT_MODES,
447 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF1]
448 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF1]
448 );
449 );
449 }
450 }
450 if (status == RTEMS_SUCCESSFUL) // PRC1
451 if (status == RTEMS_SUCCESSFUL) // PRC1
451 {
452 {
452 status = rtems_task_create(
453 status = rtems_task_create(
453 Task_name[TASKID_PRC1], TASK_PRIORITY_PRC1, RTEMS_MINIMUM_STACK_SIZE * 2,
454 Task_name[TASKID_PRC1], TASK_PRIORITY_PRC1, RTEMS_MINIMUM_STACK_SIZE * 2,
454 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
455 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
455 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC1]
456 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC1]
456 );
457 );
457 }
458 }
458 if (status == RTEMS_SUCCESSFUL) // AVF2
459 if (status == RTEMS_SUCCESSFUL) // AVF2
459 {
460 {
460 status = rtems_task_create(
461 status = rtems_task_create(
461 Task_name[TASKID_AVF2], TASK_PRIORITY_AVF2, RTEMS_MINIMUM_STACK_SIZE,
462 Task_name[TASKID_AVF2], TASK_PRIORITY_AVF2, RTEMS_MINIMUM_STACK_SIZE,
462 RTEMS_DEFAULT_MODES,
463 RTEMS_DEFAULT_MODES,
463 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF2]
464 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF2]
464 );
465 );
465 }
466 }
466 if (status == RTEMS_SUCCESSFUL) // PRC2
467 if (status == RTEMS_SUCCESSFUL) // PRC2
467 {
468 {
468 status = rtems_task_create(
469 status = rtems_task_create(
469 Task_name[TASKID_PRC2], TASK_PRIORITY_PRC2, RTEMS_MINIMUM_STACK_SIZE * 2,
470 Task_name[TASKID_PRC2], TASK_PRIORITY_PRC2, RTEMS_MINIMUM_STACK_SIZE * 2,
470 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
471 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
471 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC2]
472 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC2]
472 );
473 );
473 }
474 }
474
475
475 //****************
476 //****************
476 // WAVEFORM PICKER
477 // WAVEFORM PICKER
477 if (status == RTEMS_SUCCESSFUL) // WFRM
478 if (status == RTEMS_SUCCESSFUL) // WFRM
478 {
479 {
479 status = rtems_task_create(
480 status = rtems_task_create(
480 Task_name[TASKID_WFRM], TASK_PRIORITY_WFRM, RTEMS_MINIMUM_STACK_SIZE,
481 Task_name[TASKID_WFRM], TASK_PRIORITY_WFRM, RTEMS_MINIMUM_STACK_SIZE,
481 RTEMS_DEFAULT_MODES,
482 RTEMS_DEFAULT_MODES,
482 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_WFRM]
483 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_WFRM]
483 );
484 );
484 }
485 }
485 if (status == RTEMS_SUCCESSFUL) // CWF3
486 if (status == RTEMS_SUCCESSFUL) // CWF3
486 {
487 {
487 status = rtems_task_create(
488 status = rtems_task_create(
488 Task_name[TASKID_CWF3], TASK_PRIORITY_CWF3, RTEMS_MINIMUM_STACK_SIZE,
489 Task_name[TASKID_CWF3], TASK_PRIORITY_CWF3, RTEMS_MINIMUM_STACK_SIZE,
489 RTEMS_DEFAULT_MODES,
490 RTEMS_DEFAULT_MODES,
490 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF3]
491 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF3]
491 );
492 );
492 }
493 }
493 if (status == RTEMS_SUCCESSFUL) // CWF2
494 if (status == RTEMS_SUCCESSFUL) // CWF2
494 {
495 {
495 status = rtems_task_create(
496 status = rtems_task_create(
496 Task_name[TASKID_CWF2], TASK_PRIORITY_CWF2, RTEMS_MINIMUM_STACK_SIZE,
497 Task_name[TASKID_CWF2], TASK_PRIORITY_CWF2, RTEMS_MINIMUM_STACK_SIZE,
497 RTEMS_DEFAULT_MODES,
498 RTEMS_DEFAULT_MODES,
498 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF2]
499 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF2]
499 );
500 );
500 }
501 }
501 if (status == RTEMS_SUCCESSFUL) // CWF1
502 if (status == RTEMS_SUCCESSFUL) // CWF1
502 {
503 {
503 status = rtems_task_create(
504 status = rtems_task_create(
504 Task_name[TASKID_CWF1], TASK_PRIORITY_CWF1, RTEMS_MINIMUM_STACK_SIZE,
505 Task_name[TASKID_CWF1], TASK_PRIORITY_CWF1, RTEMS_MINIMUM_STACK_SIZE,
505 RTEMS_DEFAULT_MODES,
506 RTEMS_DEFAULT_MODES,
506 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF1]
507 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF1]
507 );
508 );
508 }
509 }
509 if (status == RTEMS_SUCCESSFUL) // SWBD
510 if (status == RTEMS_SUCCESSFUL) // SWBD
510 {
511 {
511 status = rtems_task_create(
512 status = rtems_task_create(
512 Task_name[TASKID_SWBD], TASK_PRIORITY_SWBD, RTEMS_MINIMUM_STACK_SIZE,
513 Task_name[TASKID_SWBD], TASK_PRIORITY_SWBD, RTEMS_MINIMUM_STACK_SIZE,
513 RTEMS_DEFAULT_MODES,
514 RTEMS_DEFAULT_MODES,
514 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_SWBD]
515 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_SWBD]
515 );
516 );
516 }
517 }
517
518
518 //*****
519 //*****
519 // MISC
520 // MISC
520 if (status == RTEMS_SUCCESSFUL) // LOAD
521 if (status == RTEMS_SUCCESSFUL) // LOAD
521 {
522 {
522 status = rtems_task_create(
523 status = rtems_task_create(
523 Task_name[TASKID_LOAD], TASK_PRIORITY_LOAD, RTEMS_MINIMUM_STACK_SIZE,
524 Task_name[TASKID_LOAD], TASK_PRIORITY_LOAD, RTEMS_MINIMUM_STACK_SIZE,
524 RTEMS_DEFAULT_MODES,
525 RTEMS_DEFAULT_MODES,
525 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_LOAD]
526 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_LOAD]
526 );
527 );
527 }
528 }
528 if (status == RTEMS_SUCCESSFUL) // DUMB
529 if (status == RTEMS_SUCCESSFUL) // DUMB
529 {
530 {
530 status = rtems_task_create(
531 status = rtems_task_create(
531 Task_name[TASKID_DUMB], TASK_PRIORITY_DUMB, RTEMS_MINIMUM_STACK_SIZE,
532 Task_name[TASKID_DUMB], TASK_PRIORITY_DUMB, RTEMS_MINIMUM_STACK_SIZE,
532 RTEMS_DEFAULT_MODES,
533 RTEMS_DEFAULT_MODES,
533 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB]
534 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB]
534 );
535 );
535 }
536 }
536 if (status == RTEMS_SUCCESSFUL) // HOUS
537 if (status == RTEMS_SUCCESSFUL) // HOUS
537 {
538 {
538 status = rtems_task_create(
539 status = rtems_task_create(
539 Task_name[TASKID_HOUS], TASK_PRIORITY_HOUS, RTEMS_MINIMUM_STACK_SIZE,
540 Task_name[TASKID_HOUS], TASK_PRIORITY_HOUS, RTEMS_MINIMUM_STACK_SIZE,
540 RTEMS_DEFAULT_MODES,
541 RTEMS_DEFAULT_MODES,
541 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_HOUS]
542 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_HOUS]
542 );
543 );
543 }
544 }
544
545
545 return status;
546 return status;
546 }
547 }
547
548
548 int start_recv_send_tasks( void )
549 int start_recv_send_tasks( void )
549 {
550 {
550 rtems_status_code status;
551 rtems_status_code status;
551
552
552 status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 );
553 status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 );
553 if (status!=RTEMS_SUCCESSFUL) {
554 if (status!=RTEMS_SUCCESSFUL) {
554 BOOT_PRINTF("in INIT *** Error starting TASK_RECV\n")
555 BOOT_PRINTF("in INIT *** Error starting TASK_RECV\n")
555 }
556 }
556
557
557 if (status == RTEMS_SUCCESSFUL) // SEND
558 if (status == RTEMS_SUCCESSFUL) // SEND
558 {
559 {
559 status = rtems_task_start( Task_id[TASKID_SEND], send_task, 1 );
560 status = rtems_task_start( Task_id[TASKID_SEND], send_task, 1 );
560 if (status!=RTEMS_SUCCESSFUL) {
561 if (status!=RTEMS_SUCCESSFUL) {
561 BOOT_PRINTF("in INIT *** Error starting TASK_SEND\n")
562 BOOT_PRINTF("in INIT *** Error starting TASK_SEND\n")
562 }
563 }
563 }
564 }
564
565
565 return status;
566 return status;
566 }
567 }
567
568
568 int start_all_tasks( void ) // start all tasks except SEND RECV and HOUS
569 int start_all_tasks( void ) // start all tasks except SEND RECV and HOUS
569 {
570 {
570 /** This function starts all RTEMS tasks used in the software.
571 /** This function starts all RTEMS tasks used in the software.
571 *
572 *
572 * @return RTEMS directive status codes:
573 * @return RTEMS directive status codes:
573 * - RTEMS_SUCCESSFUL - ask started successfully
574 * - RTEMS_SUCCESSFUL - ask started successfully
574 * - RTEMS_INVALID_ADDRESS - invalid task entry point
575 * - RTEMS_INVALID_ADDRESS - invalid task entry point
575 * - RTEMS_INVALID_ID - invalid task id
576 * - RTEMS_INVALID_ID - invalid task id
576 * - RTEMS_INCORRECT_STATE - task not in the dormant state
577 * - RTEMS_INCORRECT_STATE - task not in the dormant state
577 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot start remote task
578 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot start remote task
578 *
579 *
579 */
580 */
580 // starts all the tasks fot eh flight software
581 // starts all the tasks fot eh flight software
581
582
582 rtems_status_code status;
583 rtems_status_code status;
583
584
584 //**********
585 //**********
585 // SPACEWIRE
586 // SPACEWIRE
586 status = rtems_task_start( Task_id[TASKID_SPIQ], spiq_task, 1 );
587 status = rtems_task_start( Task_id[TASKID_SPIQ], spiq_task, 1 );
587 if (status!=RTEMS_SUCCESSFUL) {
588 if (status!=RTEMS_SUCCESSFUL) {
588 BOOT_PRINTF("in INIT *** Error starting TASK_SPIQ\n")
589 BOOT_PRINTF("in INIT *** Error starting TASK_SPIQ\n")
589 }
590 }
590
591
591 if (status == RTEMS_SUCCESSFUL) // LINK
592 if (status == RTEMS_SUCCESSFUL) // LINK
592 {
593 {
593 status = rtems_task_start( Task_id[TASKID_LINK], link_task, 1 );
594 status = rtems_task_start( Task_id[TASKID_LINK], link_task, 1 );
594 if (status!=RTEMS_SUCCESSFUL) {
595 if (status!=RTEMS_SUCCESSFUL) {
595 BOOT_PRINTF("in INIT *** Error starting TASK_LINK\n")
596 BOOT_PRINTF("in INIT *** Error starting TASK_LINK\n")
596 }
597 }
597 }
598 }
598
599
599 if (status == RTEMS_SUCCESSFUL) // ACTN
600 if (status == RTEMS_SUCCESSFUL) // ACTN
600 {
601 {
601 status = rtems_task_start( Task_id[TASKID_ACTN], actn_task, 1 );
602 status = rtems_task_start( Task_id[TASKID_ACTN], actn_task, 1 );
602 if (status!=RTEMS_SUCCESSFUL) {
603 if (status!=RTEMS_SUCCESSFUL) {
603 BOOT_PRINTF("in INIT *** Error starting TASK_ACTN\n")
604 BOOT_PRINTF("in INIT *** Error starting TASK_ACTN\n")
604 }
605 }
605