##// END OF EJS Templates
modulus, tbad, offset, shift are stored in finetime (uint64_t)...
paul -
r355:c502a62ca98f R3++ draft
parent child
Show More
@@ -1,2 +1,2
1 3081d1f9bb20b2b64a192585337a292a9804e0c5 LFR_basic-parameters
1 3081d1f9bb20b2b64a192585337a292a9804e0c5 LFR_basic-parameters
2 26659466eb11170e587645c796142ac8a7fd0add header/lfr_common_headers
2 e904b329ff977514bf36af92617afefd22fd06ab header/lfr_common_headers
@@ -1,972 +1,974
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 6 // [hous] [load] [avgv]
37 #define CONFIGURE_MAXIMUM_PERIODS 6 // [hous] [load] [avgv]
38 #define CONFIGURE_MAXIMUM_TIMERS 6 // [spiq] [link] [spacewire_reset_link]
38 #define CONFIGURE_MAXIMUM_TIMERS 6 // [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 old_isr_handler = NULL;
133 old_isr_handler = NULL;
134
134
135 // UART settings
135 // UART settings
136 enable_apbuart_transmitter();
136 enable_apbuart_transmitter();
137 set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE);
137 set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE);
138
138
139 DEBUG_PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n")
139 DEBUG_PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n")
140
140
141
141
142 PRINTF("\n\n\n\n\n")
142 PRINTF("\n\n\n\n\n")
143
143
144 initCache();
144 initCache();
145
145
146 PRINTF("*************************\n")
146 PRINTF("*************************\n")
147 PRINTF("** LFR Flight Software **\n")
147 PRINTF("** LFR Flight Software **\n")
148
148
149 PRINTF1("** %d-", SW_VERSION_N1)
149 PRINTF1("** %d-", SW_VERSION_N1)
150 PRINTF1("%d-" , SW_VERSION_N2)
150 PRINTF1("%d-" , SW_VERSION_N2)
151 PRINTF1("%d-" , SW_VERSION_N3)
151 PRINTF1("%d-" , SW_VERSION_N3)
152 PRINTF1("%d **\n", SW_VERSION_N4)
152 PRINTF1("%d **\n", SW_VERSION_N4)
153
153
154 vhdlVersion = (unsigned char *) (REGS_ADDR_VHDL_VERSION);
154 vhdlVersion = (unsigned char *) (REGS_ADDR_VHDL_VERSION);
155 PRINTF("** VHDL **\n")
155 PRINTF("** VHDL **\n")
156 PRINTF1("** %d-", vhdlVersion[1])
156 PRINTF1("** %d-", vhdlVersion[1])
157 PRINTF1("%d-" , vhdlVersion[2])
157 PRINTF1("%d-" , vhdlVersion[2])
158 PRINTF1("%d **\n", vhdlVersion[3])
158 PRINTF1("%d **\n", vhdlVersion[3])
159 PRINTF("*************************\n")
159 PRINTF("*************************\n")
160 PRINTF("\n\n")
160 PRINTF("\n\n")
161
161
162 init_parameter_dump();
162 init_parameter_dump();
163 init_kcoefficients_dump();
163 init_kcoefficients_dump();
164 init_local_mode_parameters();
164 init_local_mode_parameters();
165 init_housekeeping_parameters();
165 init_housekeeping_parameters();
166 init_k_coefficients_prc0();
166 init_k_coefficients_prc0();
167 init_k_coefficients_prc1();
167 init_k_coefficients_prc1();
168 init_k_coefficients_prc2();
168 init_k_coefficients_prc2();
169 pa_bia_status_info = INIT_CHAR;
169 pa_bia_status_info = INIT_CHAR;
170
170
171 // initialize all reaction wheels frequencies to NaN
171 // initialize all reaction wheels frequencies to NaN
172 rw_f.cp_rpw_sc_rw1_f1 = NAN;
172 rw_f.cp_rpw_sc_rw1_f1 = NAN;
173 rw_f.cp_rpw_sc_rw1_f2 = NAN;
173 rw_f.cp_rpw_sc_rw1_f2 = NAN;
174 rw_f.cp_rpw_sc_rw1_f3 = NAN;
174 rw_f.cp_rpw_sc_rw1_f3 = NAN;
175 rw_f.cp_rpw_sc_rw1_f4 = NAN;
175 rw_f.cp_rpw_sc_rw1_f4 = NAN;
176 rw_f.cp_rpw_sc_rw2_f1 = NAN;
176 rw_f.cp_rpw_sc_rw2_f1 = NAN;
177 rw_f.cp_rpw_sc_rw2_f2 = NAN;
177 rw_f.cp_rpw_sc_rw2_f2 = NAN;
178 rw_f.cp_rpw_sc_rw2_f3 = NAN;
178 rw_f.cp_rpw_sc_rw2_f3 = NAN;
179 rw_f.cp_rpw_sc_rw2_f4 = NAN;
179 rw_f.cp_rpw_sc_rw2_f4 = NAN;
180 rw_f.cp_rpw_sc_rw3_f1 = NAN;
180 rw_f.cp_rpw_sc_rw3_f1 = NAN;
181 rw_f.cp_rpw_sc_rw3_f2 = NAN;
181 rw_f.cp_rpw_sc_rw3_f2 = NAN;
182 rw_f.cp_rpw_sc_rw3_f3 = NAN;
182 rw_f.cp_rpw_sc_rw3_f3 = NAN;
183 rw_f.cp_rpw_sc_rw3_f4 = NAN;
183 rw_f.cp_rpw_sc_rw3_f4 = NAN;
184 rw_f.cp_rpw_sc_rw4_f1 = NAN;
184 rw_f.cp_rpw_sc_rw4_f1 = NAN;
185 rw_f.cp_rpw_sc_rw4_f2 = NAN;
185 rw_f.cp_rpw_sc_rw4_f2 = NAN;
186 rw_f.cp_rpw_sc_rw4_f3 = NAN;
186 rw_f.cp_rpw_sc_rw4_f3 = NAN;
187 rw_f.cp_rpw_sc_rw4_f4 = NAN;
187 rw_f.cp_rpw_sc_rw4_f4 = NAN;
188
188
189 // initialize filtering parameters
189 // initialize filtering parameters
190 filterPar.spare_sy_lfr_pas_filter_enabled = DEFAULT_SY_LFR_PAS_FILTER_ENABLED;
190 filterPar.spare_sy_lfr_pas_filter_enabled = DEFAULT_SY_LFR_PAS_FILTER_ENABLED;
191 filterPar.sy_lfr_pas_filter_modulus = DEFAULT_SY_LFR_PAS_FILTER_MODULUS;
191 filterPar.sy_lfr_sc_rw_delta_f = DEFAULT_SY_LFR_SC_RW_DELTA_F;
192 filterPar.sy_lfr_pas_filter_tbad = DEFAULT_SY_LFR_PAS_FILTER_TBAD;
192 filterPar.sy_lfr_pas_filter_tbad = DEFAULT_SY_LFR_PAS_FILTER_TBAD;
193 filterPar.sy_lfr_pas_filter_offset = DEFAULT_SY_LFR_PAS_FILTER_OFFSET;
194 filterPar.sy_lfr_pas_filter_shift = DEFAULT_SY_LFR_PAS_FILTER_SHIFT;
193 filterPar.sy_lfr_pas_filter_shift = DEFAULT_SY_LFR_PAS_FILTER_SHIFT;
195 filterPar.sy_lfr_sc_rw_delta_f = DEFAULT_SY_LFR_SC_RW_DELTA_F;
194 filterPar.modulus_in_finetime = DEFAULT_MODULUS;
195 filterPar.tbad_in_finetime = DEFAULT_TBAD;
196 filterPar.offset_in_finetime = DEFAULT_OFFSET;
197 filterPar.shift_in_finetime = DEFAULT_SHIFT;
196 update_last_valid_transition_date( DEFAULT_LAST_VALID_TRANSITION_DATE );
198 update_last_valid_transition_date( DEFAULT_LAST_VALID_TRANSITION_DATE );
197
199
198 // waveform picker initialization
200 // waveform picker initialization
199 WFP_init_rings();
201 WFP_init_rings();
200 LEON_Clear_interrupt( IRQ_SPARC_GPTIMER_WATCHDOG ); // initialize the waveform rings
202 LEON_Clear_interrupt( IRQ_SPARC_GPTIMER_WATCHDOG ); // initialize the waveform rings
201 WFP_reset_current_ring_nodes();
203 WFP_reset_current_ring_nodes();
202 reset_waveform_picker_regs();
204 reset_waveform_picker_regs();
203
205
204 // spectral matrices initialization
206 // spectral matrices initialization
205 SM_init_rings(); // initialize spectral matrices rings
207 SM_init_rings(); // initialize spectral matrices rings
206 SM_reset_current_ring_nodes();
208 SM_reset_current_ring_nodes();
207 reset_spectral_matrix_regs();
209 reset_spectral_matrix_regs();
208
210
209 // configure calibration
211 // configure calibration
210 configureCalibration( false ); // true means interleaved mode, false is for normal mode
212 configureCalibration( false ); // true means interleaved mode, false is for normal mode
211
213
212 updateLFRCurrentMode( LFR_MODE_STANDBY );
214 updateLFRCurrentMode( LFR_MODE_STANDBY );
213
215
214 BOOT_PRINTF1("in INIT *** lfrCurrentMode is %d\n", lfrCurrentMode)
216 BOOT_PRINTF1("in INIT *** lfrCurrentMode is %d\n", lfrCurrentMode)
215
217
216 create_names(); // create all names
218 create_names(); // create all names
217
219
218 status = create_timecode_timer(); // create the timer used by timecode_irq_handler
220 status = create_timecode_timer(); // create the timer used by timecode_irq_handler
219 if (status != RTEMS_SUCCESSFUL)
221 if (status != RTEMS_SUCCESSFUL)
220 {
222 {
221 PRINTF1("in INIT *** ERR in create_timer_timecode, code %d", status)
223 PRINTF1("in INIT *** ERR in create_timer_timecode, code %d", status)
222 }
224 }
223
225
224 status = create_message_queues(); // create message queues
226 status = create_message_queues(); // create message queues
225 if (status != RTEMS_SUCCESSFUL)
227 if (status != RTEMS_SUCCESSFUL)
226 {
228 {
227 PRINTF1("in INIT *** ERR in create_message_queues, code %d", status)
229 PRINTF1("in INIT *** ERR in create_message_queues, code %d", status)
228 }
230 }
229
231
230 status = create_all_tasks(); // create all tasks
232 status = create_all_tasks(); // create all tasks
231 if (status != RTEMS_SUCCESSFUL)
233 if (status != RTEMS_SUCCESSFUL)
232 {
234 {
233 PRINTF1("in INIT *** ERR in create_all_tasks, code %d\n", status)
235 PRINTF1("in INIT *** ERR in create_all_tasks, code %d\n", status)
234 }
236 }
235
237
236 // **************************
238 // **************************
237 // <SPACEWIRE INITIALIZATION>
239 // <SPACEWIRE INITIALIZATION>
238 status_spw = spacewire_open_link(); // (1) open the link
240 status_spw = spacewire_open_link(); // (1) open the link
239 if ( status_spw != RTEMS_SUCCESSFUL )
241 if ( status_spw != RTEMS_SUCCESSFUL )
240 {
242 {
241 PRINTF1("in INIT *** ERR spacewire_open_link code %d\n", status_spw )
243 PRINTF1("in INIT *** ERR spacewire_open_link code %d\n", status_spw )
242 }
244 }
243
245
244 if ( status_spw == RTEMS_SUCCESSFUL ) // (2) configure the link
246 if ( status_spw == RTEMS_SUCCESSFUL ) // (2) configure the link
245 {
247 {
246 status_spw = spacewire_configure_link( fdSPW );
248 status_spw = spacewire_configure_link( fdSPW );
247 if ( status_spw != RTEMS_SUCCESSFUL )
249 if ( status_spw != RTEMS_SUCCESSFUL )
248 {
250 {
249 PRINTF1("in INIT *** ERR spacewire_configure_link code %d\n", status_spw )
251 PRINTF1("in INIT *** ERR spacewire_configure_link code %d\n", status_spw )
250 }
252 }
251 }
253 }
252
254
253 if ( status_spw == RTEMS_SUCCESSFUL) // (3) start the link
255 if ( status_spw == RTEMS_SUCCESSFUL) // (3) start the link
254 {
256 {
255 status_spw = spacewire_start_link( fdSPW );
257 status_spw = spacewire_start_link( fdSPW );
256 if ( status_spw != RTEMS_SUCCESSFUL )
258 if ( status_spw != RTEMS_SUCCESSFUL )
257 {
259 {
258 PRINTF1("in INIT *** ERR spacewire_start_link code %d\n", status_spw )
260 PRINTF1("in INIT *** ERR spacewire_start_link code %d\n", status_spw )
259 }
261 }
260 }
262 }
261 // </SPACEWIRE INITIALIZATION>
263 // </SPACEWIRE INITIALIZATION>
262 // ***************************
264 // ***************************
263
265
264 status = start_all_tasks(); // start all tasks
266 status = start_all_tasks(); // start all tasks
265 if (status != RTEMS_SUCCESSFUL)
267 if (status != RTEMS_SUCCESSFUL)
266 {
268 {
267 PRINTF1("in INIT *** ERR in start_all_tasks, code %d", status)
269 PRINTF1("in INIT *** ERR in start_all_tasks, code %d", status)
268 }
270 }
269
271
270 // start RECV and SEND *AFTER* SpaceWire Initialization, due to the timeout of the start call during the initialization
272 // start RECV and SEND *AFTER* SpaceWire Initialization, due to the timeout of the start call during the initialization
271 status = start_recv_send_tasks();
273 status = start_recv_send_tasks();
272 if ( status != RTEMS_SUCCESSFUL )
274 if ( status != RTEMS_SUCCESSFUL )
273 {
275 {
274 PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status )
276 PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status )
275 }
277 }
276
278
277 // suspend science tasks, they will be restarted later depending on the mode
279 // suspend science tasks, they will be restarted later depending on the mode
278 status = suspend_science_tasks(); // suspend science tasks (not done in stop_current_mode if current mode = STANDBY)
280 status = suspend_science_tasks(); // suspend science tasks (not done in stop_current_mode if current mode = STANDBY)
279 if (status != RTEMS_SUCCESSFUL)
281 if (status != RTEMS_SUCCESSFUL)
280 {
282 {
281 PRINTF1("in INIT *** in suspend_science_tasks *** ERR code: %d\n", status)
283 PRINTF1("in INIT *** in suspend_science_tasks *** ERR code: %d\n", status)
282 }
284 }
283
285
284 // configure IRQ handling for the waveform picker unit
286 // configure IRQ handling for the waveform picker unit
285 status = rtems_interrupt_catch( waveforms_isr,
287 status = rtems_interrupt_catch( waveforms_isr,
286 IRQ_SPARC_WAVEFORM_PICKER,
288 IRQ_SPARC_WAVEFORM_PICKER,
287 &old_isr_handler) ;
289 &old_isr_handler) ;
288 // configure IRQ handling for the spectral matrices unit
290 // configure IRQ handling for the spectral matrices unit
289 status = rtems_interrupt_catch( spectral_matrices_isr,
291 status = rtems_interrupt_catch( spectral_matrices_isr,
290 IRQ_SPARC_SPECTRAL_MATRIX,
292 IRQ_SPARC_SPECTRAL_MATRIX,
291 &old_isr_handler) ;
293 &old_isr_handler) ;
292
294
293 // if the spacewire link is not up then send an event to the SPIQ task for link recovery
295 // if the spacewire link is not up then send an event to the SPIQ task for link recovery
294 if ( status_spw != RTEMS_SUCCESSFUL )
296 if ( status_spw != RTEMS_SUCCESSFUL )
295 {
297 {
296 status = rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT );
298 status = rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT );
297 if ( status != RTEMS_SUCCESSFUL ) {
299 if ( status != RTEMS_SUCCESSFUL ) {
298 PRINTF1("in INIT *** ERR rtems_event_send to SPIQ code %d\n", status )
300 PRINTF1("in INIT *** ERR rtems_event_send to SPIQ code %d\n", status )
299 }
301 }
300 }
302 }
301
303
302 BOOT_PRINTF("delete INIT\n")
304 BOOT_PRINTF("delete INIT\n")
303
305
304 set_hk_lfr_sc_potential_flag( true );
306 set_hk_lfr_sc_potential_flag( true );
305
307
306 // start the timer to detect a missing spacewire timecode
308 // start the timer to detect a missing spacewire timecode
307 // the timeout is larger because the spw IP needs to receive several valid timecodes before generating a tickout
309 // the timeout is larger because the spw IP needs to receive several valid timecodes before generating a tickout
308 // if a tickout is generated, the timer is restarted
310 // if a tickout is generated, the timer is restarted
309 status = rtems_timer_fire_after( timecode_timer_id, TIMECODE_TIMER_TIMEOUT_INIT, timecode_timer_routine, NULL );
311 status = rtems_timer_fire_after( timecode_timer_id, TIMECODE_TIMER_TIMEOUT_INIT, timecode_timer_routine, NULL );
310
312
311 grspw_timecode_callback = &timecode_irq_handler;
313 grspw_timecode_callback = &timecode_irq_handler;
312
314
313 status = rtems_task_delete(RTEMS_SELF);
315 status = rtems_task_delete(RTEMS_SELF);
314
316
315 }
317 }
316
318
317 void init_local_mode_parameters( void )
319 void init_local_mode_parameters( void )
318 {
320 {
319 /** This function initialize the param_local global variable with default values.
321 /** This function initialize the param_local global variable with default values.
320 *
322 *
321 */
323 */
322
324
323 unsigned int i;
325 unsigned int i;
324
326
325 // LOCAL PARAMETERS
327 // LOCAL PARAMETERS
326
328
327 BOOT_PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max)
329 BOOT_PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max)
328 BOOT_PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max)
330 BOOT_PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max)
329
331
330 // init sequence counters
332 // init sequence counters
331
333
332 for(i = 0; i<SEQ_CNT_NB_DEST_ID; i++)
334 for(i = 0; i<SEQ_CNT_NB_DEST_ID; i++)
333 {
335 {
334 sequenceCounters_TC_EXE[i] = INIT_CHAR;
336 sequenceCounters_TC_EXE[i] = INIT_CHAR;
335 sequenceCounters_TM_DUMP[i] = INIT_CHAR;
337 sequenceCounters_TM_DUMP[i] = INIT_CHAR;
336 }
338 }
337 sequenceCounters_SCIENCE_NORMAL_BURST = INIT_CHAR;
339 sequenceCounters_SCIENCE_NORMAL_BURST = INIT_CHAR;
338 sequenceCounters_SCIENCE_SBM1_SBM2 = INIT_CHAR;
340 sequenceCounters_SCIENCE_SBM1_SBM2 = INIT_CHAR;
339 sequenceCounterHK = TM_PACKET_SEQ_CTRL_STANDALONE << TM_PACKET_SEQ_SHIFT;
341 sequenceCounterHK = TM_PACKET_SEQ_CTRL_STANDALONE << TM_PACKET_SEQ_SHIFT;
340 }
342 }
341
343
342 void reset_local_time( void )
344 void reset_local_time( void )
343 {
345 {
344 time_management_regs->ctrl = time_management_regs->ctrl | VAL_SOFTWARE_RESET; // [0010] software reset, coarse time = 0x80000000
346 time_management_regs->ctrl = time_management_regs->ctrl | VAL_SOFTWARE_RESET; // [0010] software reset, coarse time = 0x80000000
345 }
347 }
346
348
347 void create_names( void ) // create all names for tasks and queues
349 void create_names( void ) // create all names for tasks and queues
348 {
350 {
349 /** This function creates all RTEMS names used in the software for tasks and queues.
351 /** This function creates all RTEMS names used in the software for tasks and queues.
350 *
352 *
351 * @return RTEMS directive status codes:
353 * @return RTEMS directive status codes:
352 * - RTEMS_SUCCESSFUL - successful completion
354 * - RTEMS_SUCCESSFUL - successful completion
353 *
355 *
354 */
356 */
355
357
356 // task names
358 // task names
357 Task_name[TASKID_AVGV] = rtems_build_name( 'A', 'V', 'G', 'V' );
359 Task_name[TASKID_AVGV] = rtems_build_name( 'A', 'V', 'G', 'V' );
358 Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' );
360 Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' );
359 Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' );
361 Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' );
360 Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' );
362 Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' );
361 Task_name[TASKID_LOAD] = rtems_build_name( 'L', 'O', 'A', 'D' );
363 Task_name[TASKID_LOAD] = rtems_build_name( 'L', 'O', 'A', 'D' );
362 Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' );
364 Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' );
363 Task_name[TASKID_SWBD] = rtems_build_name( 'S', 'W', 'B', 'D' );
365 Task_name[TASKID_SWBD] = rtems_build_name( 'S', 'W', 'B', 'D' );
364 Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' );
366 Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' );
365 Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' );
367 Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' );
366 Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' );
368 Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' );
367 Task_name[TASKID_PRC0] = rtems_build_name( 'P', 'R', 'C', '0' );
369 Task_name[TASKID_PRC0] = rtems_build_name( 'P', 'R', 'C', '0' );
368 Task_name[TASKID_CWF3] = rtems_build_name( 'C', 'W', 'F', '3' );
370 Task_name[TASKID_CWF3] = rtems_build_name( 'C', 'W', 'F', '3' );
369 Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' );
371 Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' );
370 Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' );
372 Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' );
371 Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' );
373 Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' );
372 Task_name[TASKID_LINK] = rtems_build_name( 'L', 'I', 'N', 'K' );
374 Task_name[TASKID_LINK] = rtems_build_name( 'L', 'I', 'N', 'K' );
373 Task_name[TASKID_AVF1] = rtems_build_name( 'A', 'V', 'F', '1' );
375 Task_name[TASKID_AVF1] = rtems_build_name( 'A', 'V', 'F', '1' );
374 Task_name[TASKID_PRC1] = rtems_build_name( 'P', 'R', 'C', '1' );
376 Task_name[TASKID_PRC1] = rtems_build_name( 'P', 'R', 'C', '1' );
375 Task_name[TASKID_AVF2] = rtems_build_name( 'A', 'V', 'F', '2' );
377 Task_name[TASKID_AVF2] = rtems_build_name( 'A', 'V', 'F', '2' );
376 Task_name[TASKID_PRC2] = rtems_build_name( 'P', 'R', 'C', '2' );
378 Task_name[TASKID_PRC2] = rtems_build_name( 'P', 'R', 'C', '2' );
377
379
378 // rate monotonic period names
380 // rate monotonic period names
379 name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' );
381 name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' );
380 name_avgv_rate_monotonic = rtems_build_name( 'A', 'V', 'G', 'V' );
382 name_avgv_rate_monotonic = rtems_build_name( 'A', 'V', 'G', 'V' );
381
383
382 misc_name[QUEUE_RECV] = rtems_build_name( 'Q', '_', 'R', 'V' );
384 misc_name[QUEUE_RECV] = rtems_build_name( 'Q', '_', 'R', 'V' );
383 misc_name[QUEUE_SEND] = rtems_build_name( 'Q', '_', 'S', 'D' );
385 misc_name[QUEUE_SEND] = rtems_build_name( 'Q', '_', 'S', 'D' );
384 misc_name[QUEUE_PRC0] = rtems_build_name( 'Q', '_', 'P', '0' );
386 misc_name[QUEUE_PRC0] = rtems_build_name( 'Q', '_', 'P', '0' );
385 misc_name[QUEUE_PRC1] = rtems_build_name( 'Q', '_', 'P', '1' );
387 misc_name[QUEUE_PRC1] = rtems_build_name( 'Q', '_', 'P', '1' );
386 misc_name[QUEUE_PRC2] = rtems_build_name( 'Q', '_', 'P', '2' );
388 misc_name[QUEUE_PRC2] = rtems_build_name( 'Q', '_', 'P', '2' );
387
389
388 timecode_timer_name = rtems_build_name( 'S', 'P', 'T', 'C' );
390 timecode_timer_name = rtems_build_name( 'S', 'P', 'T', 'C' );
389 }
391 }
390
392
391 int create_all_tasks( void ) // create all tasks which run in the software
393 int create_all_tasks( void ) // create all tasks which run in the software
392 {
394 {
393 /** This function creates all RTEMS tasks used in the software.
395 /** This function creates all RTEMS tasks used in the software.
394 *
396 *
395 * @return RTEMS directive status codes:
397 * @return RTEMS directive status codes:
396 * - RTEMS_SUCCESSFUL - task created successfully
398 * - RTEMS_SUCCESSFUL - task created successfully
397 * - RTEMS_INVALID_ADDRESS - id is NULL
399 * - RTEMS_INVALID_ADDRESS - id is NULL
398 * - RTEMS_INVALID_NAME - invalid task name
400 * - RTEMS_INVALID_NAME - invalid task name
399 * - RTEMS_INVALID_PRIORITY - invalid task priority
401 * - RTEMS_INVALID_PRIORITY - invalid task priority
400 * - RTEMS_MP_NOT_CONFIGURED - multiprocessing not configured
402 * - RTEMS_MP_NOT_CONFIGURED - multiprocessing not configured
401 * - RTEMS_TOO_MANY - too many tasks created
403 * - RTEMS_TOO_MANY - too many tasks created
402 * - RTEMS_UNSATISFIED - not enough memory for stack/FP context
404 * - RTEMS_UNSATISFIED - not enough memory for stack/FP context
403 * - RTEMS_TOO_MANY - too many global objects
405 * - RTEMS_TOO_MANY - too many global objects
404 *
406 *
405 */
407 */
406
408
407 rtems_status_code status;
409 rtems_status_code status;
408
410
409 //**********
411 //**********
410 // SPACEWIRE
412 // SPACEWIRE
411 // RECV
413 // RECV
412 status = rtems_task_create(
414 status = rtems_task_create(
413 Task_name[TASKID_RECV], TASK_PRIORITY_RECV, RTEMS_MINIMUM_STACK_SIZE,
415 Task_name[TASKID_RECV], TASK_PRIORITY_RECV, RTEMS_MINIMUM_STACK_SIZE,
414 RTEMS_DEFAULT_MODES,
416 RTEMS_DEFAULT_MODES,
415 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV]
417 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV]
416 );
418 );
417 if (status == RTEMS_SUCCESSFUL) // SEND
419 if (status == RTEMS_SUCCESSFUL) // SEND
418 {
420 {
419 status = rtems_task_create(
421 status = rtems_task_create(
420 Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE * STACK_SIZE_MULT,
422 Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE * STACK_SIZE_MULT,
421 RTEMS_DEFAULT_MODES,
423 RTEMS_DEFAULT_MODES,
422 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_SEND]
424 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_SEND]
423 );
425 );
424 }
426 }
425 if (status == RTEMS_SUCCESSFUL) // LINK
427 if (status == RTEMS_SUCCESSFUL) // LINK
426 {
428 {
427 status = rtems_task_create(
429 status = rtems_task_create(
428 Task_name[TASKID_LINK], TASK_PRIORITY_LINK, RTEMS_MINIMUM_STACK_SIZE,
430 Task_name[TASKID_LINK], TASK_PRIORITY_LINK, RTEMS_MINIMUM_STACK_SIZE,
429 RTEMS_DEFAULT_MODES,
431 RTEMS_DEFAULT_MODES,
430 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_LINK]
432 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_LINK]
431 );
433 );
432 }
434 }
433 if (status == RTEMS_SUCCESSFUL) // ACTN
435 if (status == RTEMS_SUCCESSFUL) // ACTN
434 {
436 {
435 status = rtems_task_create(
437 status = rtems_task_create(
436 Task_name[TASKID_ACTN], TASK_PRIORITY_ACTN, RTEMS_MINIMUM_STACK_SIZE,
438 Task_name[TASKID_ACTN], TASK_PRIORITY_ACTN, RTEMS_MINIMUM_STACK_SIZE,
437 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
439 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
438 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_ACTN]
440 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_ACTN]
439 );
441 );
440 }
442 }
441 if (status == RTEMS_SUCCESSFUL) // SPIQ
443 if (status == RTEMS_SUCCESSFUL) // SPIQ
442 {
444 {
443 status = rtems_task_create(
445 status = rtems_task_create(
444 Task_name[TASKID_SPIQ], TASK_PRIORITY_SPIQ, RTEMS_MINIMUM_STACK_SIZE,
446 Task_name[TASKID_SPIQ], TASK_PRIORITY_SPIQ, RTEMS_MINIMUM_STACK_SIZE,
445 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
447 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
446 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ]
448 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ]
447 );
449 );
448 }
450 }
449
451
450 //******************
452 //******************
451 // SPECTRAL MATRICES
453 // SPECTRAL MATRICES
452 if (status == RTEMS_SUCCESSFUL) // AVF0
454 if (status == RTEMS_SUCCESSFUL) // AVF0
453 {
455 {
454 status = rtems_task_create(
456 status = rtems_task_create(
455 Task_name[TASKID_AVF0], TASK_PRIORITY_AVF0, RTEMS_MINIMUM_STACK_SIZE,
457 Task_name[TASKID_AVF0], TASK_PRIORITY_AVF0, RTEMS_MINIMUM_STACK_SIZE,
456 RTEMS_DEFAULT_MODES,
458 RTEMS_DEFAULT_MODES,
457 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0]
459 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0]
458 );
460 );
459 }
461 }
460 if (status == RTEMS_SUCCESSFUL) // PRC0
462 if (status == RTEMS_SUCCESSFUL) // PRC0
461 {
463 {
462 status = rtems_task_create(
464 status = rtems_task_create(
463 Task_name[TASKID_PRC0], TASK_PRIORITY_PRC0, RTEMS_MINIMUM_STACK_SIZE * STACK_SIZE_MULT,
465 Task_name[TASKID_PRC0], TASK_PRIORITY_PRC0, RTEMS_MINIMUM_STACK_SIZE * STACK_SIZE_MULT,
464 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
466 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
465 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC0]
467 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC0]
466 );
468 );
467 }
469 }
468 if (status == RTEMS_SUCCESSFUL) // AVF1
470 if (status == RTEMS_SUCCESSFUL) // AVF1
469 {
471 {
470 status = rtems_task_create(
472 status = rtems_task_create(
471 Task_name[TASKID_AVF1], TASK_PRIORITY_AVF1, RTEMS_MINIMUM_STACK_SIZE,
473 Task_name[TASKID_AVF1], TASK_PRIORITY_AVF1, RTEMS_MINIMUM_STACK_SIZE,
472 RTEMS_DEFAULT_MODES,
474 RTEMS_DEFAULT_MODES,
473 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF1]
475 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF1]
474 );
476 );
475 }
477 }
476 if (status == RTEMS_SUCCESSFUL) // PRC1
478 if (status == RTEMS_SUCCESSFUL) // PRC1
477 {
479 {
478 status = rtems_task_create(
480 status = rtems_task_create(
479 Task_name[TASKID_PRC1], TASK_PRIORITY_PRC1, RTEMS_MINIMUM_STACK_SIZE * STACK_SIZE_MULT,
481 Task_name[TASKID_PRC1], TASK_PRIORITY_PRC1, RTEMS_MINIMUM_STACK_SIZE * STACK_SIZE_MULT,
480 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
482 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
481 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC1]
483 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC1]
482 );
484 );
483 }
485 }
484 if (status == RTEMS_SUCCESSFUL) // AVF2
486 if (status == RTEMS_SUCCESSFUL) // AVF2
485 {
487 {
486 status = rtems_task_create(
488 status = rtems_task_create(
487 Task_name[TASKID_AVF2], TASK_PRIORITY_AVF2, RTEMS_MINIMUM_STACK_SIZE,
489 Task_name[TASKID_AVF2], TASK_PRIORITY_AVF2, RTEMS_MINIMUM_STACK_SIZE,
488 RTEMS_DEFAULT_MODES,
490 RTEMS_DEFAULT_MODES,
489 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF2]
491 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF2]
490 );
492 );
491 }
493 }
492 if (status == RTEMS_SUCCESSFUL) // PRC2
494 if (status == RTEMS_SUCCESSFUL) // PRC2
493 {
495 {
494 status = rtems_task_create(
496 status = rtems_task_create(
495 Task_name[TASKID_PRC2], TASK_PRIORITY_PRC2, RTEMS_MINIMUM_STACK_SIZE * STACK_SIZE_MULT,
497 Task_name[TASKID_PRC2], TASK_PRIORITY_PRC2, RTEMS_MINIMUM_STACK_SIZE * STACK_SIZE_MULT,
496 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
498 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
497 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC2]
499 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_PRC2]
498 );
500 );
499 }
501 }
500
502
501 //****************
503 //****************
502 // WAVEFORM PICKER
504 // WAVEFORM PICKER
503 if (status == RTEMS_SUCCESSFUL) // WFRM
505 if (status == RTEMS_SUCCESSFUL) // WFRM
504 {
506 {
505 status = rtems_task_create(
507 status = rtems_task_create(
506 Task_name[TASKID_WFRM], TASK_PRIORITY_WFRM, RTEMS_MINIMUM_STACK_SIZE,
508 Task_name[TASKID_WFRM], TASK_PRIORITY_WFRM, RTEMS_MINIMUM_STACK_SIZE,
507 RTEMS_DEFAULT_MODES,
509 RTEMS_DEFAULT_MODES,
508 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_WFRM]
510 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_WFRM]
509 );
511 );
510 }
512 }
511 if (status == RTEMS_SUCCESSFUL) // CWF3
513 if (status == RTEMS_SUCCESSFUL) // CWF3
512 {
514 {
513 status = rtems_task_create(
515 status = rtems_task_create(
514 Task_name[TASKID_CWF3], TASK_PRIORITY_CWF3, RTEMS_MINIMUM_STACK_SIZE,
516 Task_name[TASKID_CWF3], TASK_PRIORITY_CWF3, RTEMS_MINIMUM_STACK_SIZE,
515 RTEMS_DEFAULT_MODES,
517 RTEMS_DEFAULT_MODES,
516 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF3]
518 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF3]
517 );
519 );
518 }
520 }
519 if (status == RTEMS_SUCCESSFUL) // CWF2
521 if (status == RTEMS_SUCCESSFUL) // CWF2
520 {
522 {
521 status = rtems_task_create(
523 status = rtems_task_create(
522 Task_name[TASKID_CWF2], TASK_PRIORITY_CWF2, RTEMS_MINIMUM_STACK_SIZE,
524 Task_name[TASKID_CWF2], TASK_PRIORITY_CWF2, RTEMS_MINIMUM_STACK_SIZE,
523 RTEMS_DEFAULT_MODES,
525 RTEMS_DEFAULT_MODES,
524 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF2]
526 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF2]
525 );
527 );
526 }
528 }
527 if (status == RTEMS_SUCCESSFUL) // CWF1
529 if (status == RTEMS_SUCCESSFUL) // CWF1
528 {
530 {
529 status = rtems_task_create(
531 status = rtems_task_create(
530 Task_name[TASKID_CWF1], TASK_PRIORITY_CWF1, RTEMS_MINIMUM_STACK_SIZE,
532 Task_name[TASKID_CWF1], TASK_PRIORITY_CWF1, RTEMS_MINIMUM_STACK_SIZE,
531 RTEMS_DEFAULT_MODES,
533 RTEMS_DEFAULT_MODES,
532 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF1]
534 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF1]
533 );
535 );
534 }
536 }
535 if (status == RTEMS_SUCCESSFUL) // SWBD
537 if (status == RTEMS_SUCCESSFUL) // SWBD
536 {
538 {
537 status = rtems_task_create(
539 status = rtems_task_create(
538 Task_name[TASKID_SWBD], TASK_PRIORITY_SWBD, RTEMS_MINIMUM_STACK_SIZE,
540 Task_name[TASKID_SWBD], TASK_PRIORITY_SWBD, RTEMS_MINIMUM_STACK_SIZE,
539 RTEMS_DEFAULT_MODES,
541 RTEMS_DEFAULT_MODES,
540 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_SWBD]
542 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_SWBD]
541 );
543 );
542 }
544 }
543
545
544 //*****
546 //*****
545 // MISC
547 // MISC
546 if (status == RTEMS_SUCCESSFUL) // LOAD
548 if (status == RTEMS_SUCCESSFUL) // LOAD
547 {
549 {
548 status = rtems_task_create(
550 status = rtems_task_create(
549 Task_name[TASKID_LOAD], TASK_PRIORITY_LOAD, RTEMS_MINIMUM_STACK_SIZE,
551 Task_name[TASKID_LOAD], TASK_PRIORITY_LOAD, RTEMS_MINIMUM_STACK_SIZE,
550 RTEMS_DEFAULT_MODES,
552 RTEMS_DEFAULT_MODES,
551 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_LOAD]
553 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_LOAD]
552 );
554 );
553 }
555 }
554 if (status == RTEMS_SUCCESSFUL) // DUMB
556 if (status == RTEMS_SUCCESSFUL) // DUMB
555 {
557 {
556 status = rtems_task_create(
558 status = rtems_task_create(
557 Task_name[TASKID_DUMB], TASK_PRIORITY_DUMB, RTEMS_MINIMUM_STACK_SIZE,
559 Task_name[TASKID_DUMB], TASK_PRIORITY_DUMB, RTEMS_MINIMUM_STACK_SIZE,
558 RTEMS_DEFAULT_MODES,
560 RTEMS_DEFAULT_MODES,
559 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB]
561 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB]
560 );
562 );
561 }
563 }
562 if (status == RTEMS_SUCCESSFUL) // HOUS
564 if (status == RTEMS_SUCCESSFUL) // HOUS
563 {
565 {
564 status = rtems_task_create(
566 status = rtems_task_create(
565 Task_name[TASKID_HOUS], TASK_PRIORITY_HOUS, RTEMS_MINIMUM_STACK_SIZE,
567 Task_name[TASKID_HOUS], TASK_PRIORITY_HOUS, RTEMS_MINIMUM_STACK_SIZE,
566 RTEMS_DEFAULT_MODES,
568 RTEMS_DEFAULT_MODES,
567 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_HOUS]
569 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_HOUS]
568 );
570 );
569 }
571 }
570 if (status == RTEMS_SUCCESSFUL) // AVGV
572 if (status == RTEMS_SUCCESSFUL) // AVGV
571 {
573 {
572 status = rtems_task_create(
574 status = rtems_task_create(
573 Task_name[TASKID_AVGV], TASK_PRIORITY_AVGV, RTEMS_MINIMUM_STACK_SIZE,
575 Task_name[TASKID_AVGV], TASK_PRIORITY_AVGV, RTEMS_MINIMUM_STACK_SIZE,
574 RTEMS_DEFAULT_MODES,
576 RTEMS_DEFAULT_MODES,
575 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVGV]
577 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVGV]
576 );
578 );
577 }
579 }
578
580
579 return status;
581 return status;
580 }
582 }
581
583
582 int start_recv_send_tasks( void )
584 int start_recv_send_tasks( void )
583 {
585 {
584 rtems_status_code status;
586 rtems_status_code status;
585
587
586 status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 );
588 status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 );
587 if (status!=RTEMS_SUCCESSFUL) {
589 if (status!=RTEMS_SUCCESSFUL) {
588 BOOT_PRINTF("in INIT *** Error starting TASK_RECV\n")
590 BOOT_PRINTF("in INIT *** Error starting TASK_RECV\n")
589 }
591 }
590
592
591 if (status == RTEMS_SUCCESSFUL) // SEND
593 if (status == RTEMS_SUCCESSFUL) // SEND
592 {
594 {
593 status = rtems_task_start( Task_id[TASKID_SEND], send_task, 1 );
595 status = rtems_task_start( Task_id[TASKID_SEND], send_task, 1 );
594 if (status!=RTEMS_SUCCESSFUL) {
596 if (status!=RTEMS_SUCCESSFUL) {
595 BOOT_PRINTF("in INIT *** Error starting TASK_SEND\n")
597 BOOT_PRINTF("in INIT *** Error starting TASK_SEND\n")
596 }
598 }
597 }
599 }
598
600
599 return status;
601 return status;
600 }
602