##// END OF EJS Templates
fsw-0-20
paul -
r58:95058e78e811 default
parent child
Show More
@@ -1,211 +1,211
1 #ifndef FSW_PARAMS_H_INCLUDED
1 #ifndef FSW_PARAMS_H_INCLUDED
2 #define FSW_PARAMS_H_INCLUDED
2 #define FSW_PARAMS_H_INCLUDED
3
3
4 #include "grlib_regs.h"
4 #include "grlib_regs.h"
5 #include "fsw_params_processing.h"
5 #include "fsw_params_processing.h"
6 #include "tm_byte_positions.h"
6 #include "tm_byte_positions.h"
7 #include "ccsds_types.h"
7 #include "ccsds_types.h"
8
8
9 #define GRSPW_DEVICE_NAME "/dev/grspw0"
9 #define GRSPW_DEVICE_NAME "/dev/grspw0"
10 #define UART_DEVICE_NAME "/dev/console"
10 #define UART_DEVICE_NAME "/dev/console"
11
11
12 //************************
12 //************************
13 // flight software version
13 // flight software version
14 // this parameters is handled by the Qt project options
14 // this parameters is handled by the Qt project options
15
15
16 //**********
16 //**********
17 // LFR MODES
17 // LFR MODES
18 #define LFR_MODE_STANDBY 0
18 #define LFR_MODE_STANDBY 0
19 #define LFR_MODE_NORMAL 1
19 #define LFR_MODE_NORMAL 1
20 #define LFR_MODE_BURST 2
20 #define LFR_MODE_BURST 2
21 #define LFR_MODE_SBM1 3
21 #define LFR_MODE_SBM1 3
22 #define LFR_MODE_SBM2 4
22 #define LFR_MODE_SBM2 4
23 #define LFR_MODE_NORMAL_CWF_F3 5
23 #define LFR_MODE_NORMAL_CWF_F3 5
24
24
25 #define RTEMS_EVENT_MODE_STANDBY RTEMS_EVENT_0
25 #define RTEMS_EVENT_MODE_STANDBY RTEMS_EVENT_0
26 #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1
26 #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1
27 #define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2
27 #define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2
28 #define RTEMS_EVENT_MODE_SBM1 RTEMS_EVENT_3
28 #define RTEMS_EVENT_MODE_SBM1 RTEMS_EVENT_3
29 #define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4
29 #define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4
30 #define RTEMS_EVENT_MODE_SBM2_WFRM RTEMS_EVENT_5
30 #define RTEMS_EVENT_MODE_SBM2_WFRM RTEMS_EVENT_5
31
31
32 //****************************
32 //****************************
33 // LFR DEFAULT MODE PARAMETERS
33 // LFR DEFAULT MODE PARAMETERS
34 // COMMON
34 // COMMON
35 #define DEFAULT_SY_LFR_COMMON0 0x00
35 #define DEFAULT_SY_LFR_COMMON0 0x00
36 #define DEFAULT_SY_LFR_COMMON1 0x10 // default value 0 0 0 1 0 0 0 0
36 #define DEFAULT_SY_LFR_COMMON1 0x10 // default value 0 0 0 1 0 0 0 0
37 // NORM
37 // NORM
38 #define SY_LFR_N_SWF_L 2048 // nb sample
38 #define SY_LFR_N_SWF_L 2048 // nb sample
39 #define SY_LFR_N_SWF_P 300 // sec
39 #define SY_LFR_N_SWF_P 296 // sec
40 #define SY_LFR_N_ASM_P 3600 // sec
40 #define SY_LFR_N_ASM_P 3600 // sec
41 #define SY_LFR_N_BP_P0 4 // sec
41 #define SY_LFR_N_BP_P0 4 // sec
42 #define SY_LFR_N_BP_P1 20 // sec
42 #define SY_LFR_N_BP_P1 20 // sec
43 #define MIN_DELTA_SNAPSHOT 16 // sec
43 #define MIN_DELTA_SNAPSHOT 16 // sec
44 // BURST
44 // BURST
45 #define DEFAULT_SY_LFR_B_BP_P0 1 // sec
45 #define DEFAULT_SY_LFR_B_BP_P0 1 // sec
46 #define DEFAULT_SY_LFR_B_BP_P1 5 // sec
46 #define DEFAULT_SY_LFR_B_BP_P1 5 // sec
47 // SBM1
47 // SBM1
48 #define DEFAULT_SY_LFR_S1_BP_P0 1 // sec
48 #define DEFAULT_SY_LFR_S1_BP_P0 1 // sec
49 #define DEFAULT_SY_LFR_S1_BP_P1 1 // sec
49 #define DEFAULT_SY_LFR_S1_BP_P1 1 // sec
50 // SBM2
50 // SBM2
51 #define DEFAULT_SY_LFR_S2_BP_P0 1 // sec
51 #define DEFAULT_SY_LFR_S2_BP_P0 1 // sec
52 #define DEFAULT_SY_LFR_S2_BP_P1 5 // sec
52 #define DEFAULT_SY_LFR_S2_BP_P1 5 // sec
53 // ADDITIONAL PARAMETERS
53 // ADDITIONAL PARAMETERS
54 #define TIME_BETWEEN_TWO_SWF_PACKETS 30 // nb x 10 ms => 300 ms
54 #define TIME_BETWEEN_TWO_SWF_PACKETS 30 // nb x 10 ms => 300 ms
55 #define TIME_BETWEEN_TWO_CWF3_PACKETS 1000 // nb x 10 ms => 10 s
55 #define TIME_BETWEEN_TWO_CWF3_PACKETS 1000 // nb x 10 ms => 10 s
56 // STATUS WORD
56 // STATUS WORD
57 #define DEFAULT_STATUS_WORD_BYTE0 0x0d // [0000] [1] [101] mode 4 bits / SPW enabled 1 bit / state is run 3 bits
57 #define DEFAULT_STATUS_WORD_BYTE0 0x0d // [0000] [1] [101] mode 4 bits / SPW enabled 1 bit / state is run 3 bits
58 #define DEFAULT_STATUS_WORD_BYTE1 0x00
58 #define DEFAULT_STATUS_WORD_BYTE1 0x00
59 //
59 //
60 #define SY_LFR_DPU_CONNECT_TIMEOUT 100 // 100 * 10 ms = 1 s
60 #define SY_LFR_DPU_CONNECT_TIMEOUT 100 // 100 * 10 ms = 1 s
61 #define SY_LFR_DPU_CONNECT_ATTEMPT 3
61 #define SY_LFR_DPU_CONNECT_ATTEMPT 3
62 //****************************
62 //****************************
63
63
64 //*****************************
64 //*****************************
65 // APB REGISTERS BASE ADDRESSES
65 // APB REGISTERS BASE ADDRESSES
66 #define REGS_ADDR_APBUART 0x80000100
66 #define REGS_ADDR_APBUART 0x80000100
67 #define REGS_ADDR_GPTIMER 0x80000300
67 #define REGS_ADDR_GPTIMER 0x80000300
68 #define REGS_ADDR_GRSPW 0x80000500
68 #define REGS_ADDR_GRSPW 0x80000500
69 #define REGS_ADDR_TIME_MANAGEMENT 0x80000600
69 #define REGS_ADDR_TIME_MANAGEMENT 0x80000600
70 #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00
70 #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00
71
71
72 #ifdef GSA
72 #ifdef GSA
73 #else
73 #else
74 #define REGS_ADDR_WAVEFORM_PICKER 0x80000f20
74 #define REGS_ADDR_WAVEFORM_PICKER 0x80000f20
75 #endif
75 #endif
76
76
77 #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff
77 #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff
78 #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400 (0x50)
78 #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400 (0x50)
79
79
80 //**********
80 //**********
81 // IRQ LINES
81 // IRQ LINES
82 #define IRQ_SM 9
82 #define IRQ_SM 9
83 #define IRQ_SPARC_SM 0x19 // see sparcv8.pdf p.76 for interrupt levels
83 #define IRQ_SPARC_SM 0x19 // see sparcv8.pdf p.76 for interrupt levels
84 #define IRQ_WF 10
84 #define IRQ_WF 10
85 #define IRQ_SPARC_WF 0x1a // see sparcv8.pdf p.76 for interrupt levels
85 #define IRQ_SPARC_WF 0x1a // see sparcv8.pdf p.76 for interrupt levels
86 #define IRQ_TIME1 12
86 #define IRQ_TIME1 12
87 #define IRQ_SPARC_TIME1 0x1c // see sparcv8.pdf p.76 for interrupt levels
87 #define IRQ_SPARC_TIME1 0x1c // see sparcv8.pdf p.76 for interrupt levels
88 #define IRQ_TIME2 13
88 #define IRQ_TIME2 13
89 #define IRQ_SPARC_TIME2 0x1d // see sparcv8.pdf p.76 for interrupt levels
89 #define IRQ_SPARC_TIME2 0x1d // see sparcv8.pdf p.76 for interrupt levels
90 #define IRQ_WAVEFORM_PICKER 14
90 #define IRQ_WAVEFORM_PICKER 14
91 #define IRQ_SPARC_WAVEFORM_PICKER 0x1e // see sparcv8.pdf p.76 for interrupt levels
91 #define IRQ_SPARC_WAVEFORM_PICKER 0x1e // see sparcv8.pdf p.76 for interrupt levels
92 #define IRQ_SPECTRAL_MATRIX 6
92 #define IRQ_SPECTRAL_MATRIX 6
93 #define IRQ_SPARC_SPECTRAL_MATRIX 0x16 // see sparcv8.pdf p.76 for interrupt levels
93 #define IRQ_SPARC_SPECTRAL_MATRIX 0x16 // see sparcv8.pdf p.76 for interrupt levels
94
94
95 //*****
95 //*****
96 // TIME
96 // TIME
97 #define CLKDIV_SM_SIMULATOR (10000 - 1) // 10 ms
97 #define CLKDIV_SM_SIMULATOR (10000 - 1) // 10 ms
98 #define CLKDIV_WF_SIMULATOR (10000000 - 1) // 10 000 000 * 1 us = 10 s
98 #define CLKDIV_WF_SIMULATOR (10000000 - 1) // 10 000 000 * 1 us = 10 s
99 #define TIMER_SM_SIMULATOR 1
99 #define TIMER_SM_SIMULATOR 1
100 #define TIMER_WF_SIMULATOR 2
100 #define TIMER_WF_SIMULATOR 2
101 #define HK_PERIOD 100 // 100 * 10ms => 1sec
101 #define HK_PERIOD 100 // 100 * 10ms => 1sec
102
102
103 //**********
103 //**********
104 // LPP CODES
104 // LPP CODES
105 #define LFR_SUCCESSFUL 0
105 #define LFR_SUCCESSFUL 0
106 #define LFR_DEFAULT 1
106 #define LFR_DEFAULT 1
107
107
108 //******
108 //******
109 // RTEMS
109 // RTEMS
110 #define TASKID_RECV 1
110 #define TASKID_RECV 1
111 #define TASKID_ACTN 2
111 #define TASKID_ACTN 2
112 #define TASKID_SPIQ 3
112 #define TASKID_SPIQ 3
113 #define TASKID_SMIQ 4
113 #define TASKID_SMIQ 4
114 #define TASKID_STAT 5
114 #define TASKID_STAT 5
115 #define TASKID_AVF0 6
115 #define TASKID_AVF0 6
116 #define TASKID_BPF0 7
116 #define TASKID_BPF0 7
117 #define TASKID_WFRM 8
117 #define TASKID_WFRM 8
118 #define TASKID_DUMB 9
118 #define TASKID_DUMB 9
119 #define TASKID_HOUS 10
119 #define TASKID_HOUS 10
120 #define TASKID_MATR 11
120 #define TASKID_MATR 11
121 #define TASKID_CWF3 12
121 #define TASKID_CWF3 12
122 #define TASKID_CWF2 13
122 #define TASKID_CWF2 13
123 #define TASKID_CWF1 14
123 #define TASKID_CWF1 14
124 #define TASKID_SEND 15
124 #define TASKID_SEND 15
125 #define TASKID_WTDG 16
125 #define TASKID_WTDG 16
126
126
127 #define TASK_PRIORITY_SPIQ 5
127 #define TASK_PRIORITY_SPIQ 5
128 #define TASK_PRIORITY_SMIQ 10
128 #define TASK_PRIORITY_SMIQ 10
129 //
129 //
130 #define TASK_PRIORITY_WTDG 20
130 #define TASK_PRIORITY_WTDG 20
131 //
131 //
132 #define TASK_PRIORITY_HOUS 30
132 #define TASK_PRIORITY_HOUS 30
133 //
133 //
134 #define TASK_PRIORITY_CWF1 35 // CWF1 and CWF2 are never running together
134 #define TASK_PRIORITY_CWF1 35 // CWF1 and CWF2 are never running together
135 #define TASK_PRIORITY_CWF2 35 //
135 #define TASK_PRIORITY_CWF2 35 //
136 //
136 //
137 #define TASK_PRIORITY_WFRM 40
137 #define TASK_PRIORITY_WFRM 40
138 #define TASK_PRIORITY_CWF3 40 // there is a printf in this function, be careful with its priority wrt CWF1
138 #define TASK_PRIORITY_CWF3 40 // there is a printf in this function, be careful with its priority wrt CWF1
139 //
139 //
140 #define TASK_PRIORITY_SEND 45
140 #define TASK_PRIORITY_SEND 45
141 //
141 //
142 #define TASK_PRIORITY_RECV 50
142 #define TASK_PRIORITY_RECV 50
143 #define TASK_PRIORITY_ACTN 50
143 #define TASK_PRIORITY_ACTN 50
144 //
144 //
145 #define TASK_PRIORITY_AVF0 60
145 #define TASK_PRIORITY_AVF0 60
146 #define TASK_PRIORITY_BPF0 60
146 #define TASK_PRIORITY_BPF0 60
147 #define TASK_PRIORITY_MATR 100
147 #define TASK_PRIORITY_MATR 100
148 #define TASK_PRIORITY_STAT 200
148 #define TASK_PRIORITY_STAT 200
149 #define TASK_PRIORITY_DUMB 200
149 #define TASK_PRIORITY_DUMB 200
150
150
151 #define SEMQ_PRIORITY_CEILING 30
151 #define SEMQ_PRIORITY_CEILING 30
152
152
153 #define ACTION_MSG_QUEUE_COUNT 10
153 #define ACTION_MSG_QUEUE_COUNT 10
154 #define ACTION_MSG_PKTS_COUNT 50
154 #define ACTION_MSG_PKTS_COUNT 50
155 #define ACTION_MSG_PKTS_MAX_SIZE (PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES)
155 #define ACTION_MSG_PKTS_MAX_SIZE (PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES)
156 #define ACTION_MSG_SPW_IOCTL_SEND_SIZE 24 // hlen *hdr dlen *data sent options
156 #define ACTION_MSG_SPW_IOCTL_SEND_SIZE 24 // hlen *hdr dlen *data sent options
157
157
158 #define QUEUE_RECV 0
158 #define QUEUE_RECV 0
159 #define QUEUE_SEND 1
159 #define QUEUE_SEND 1
160
160
161 //*******
161 //*******
162 // MACROS
162 // MACROS
163 #ifdef PRINT_MESSAGES_ON_CONSOLE
163 #ifdef PRINT_MESSAGES_ON_CONSOLE
164 #define PRINTF(x) printf(x);
164 #define PRINTF(x) printf(x);
165 #define PRINTF1(x,y) printf(x,y);
165 #define PRINTF1(x,y) printf(x,y);
166 #define PRINTF2(x,y,z) printf(x,y,z);
166 #define PRINTF2(x,y,z) printf(x,y,z);
167 #else
167 #else
168 #define PRINTF(x) ;
168 #define PRINTF(x) ;
169 #define PRINTF1(x,y) ;
169 #define PRINTF1(x,y) ;
170 #define PRINTF2(x,y,z) ;
170 #define PRINTF2(x,y,z) ;
171 #endif
171 #endif
172
172
173 #ifdef BOOT_MESSAGES
173 #ifdef BOOT_MESSAGES
174 #define BOOT_PRINTF(x) printf(x);
174 #define BOOT_PRINTF(x) printf(x);
175 #define BOOT_PRINTF1(x,y) printf(x,y);
175 #define BOOT_PRINTF1(x,y) printf(x,y);
176 #define BOOT_PRINTF2(x,y,z) printf(x,y,z);
176 #define BOOT_PRINTF2(x,y,z) printf(x,y,z);
177 #else
177 #else
178 #define BOOT_PRINTF(x) ;
178 #define BOOT_PRINTF(x) ;
179 #define BOOT_PRINTF1(x,y) ;
179 #define BOOT_PRINTF1(x,y) ;
180 #define BOOT_PRINTF2(x,y,z) ;
180 #define BOOT_PRINTF2(x,y,z) ;
181 #endif
181 #endif
182
182
183 #ifdef DEBUG_MESSAGES
183 #ifdef DEBUG_MESSAGES
184 #define DEBUG_PRINTF(x) printf(x);
184 #define DEBUG_PRINTF(x) printf(x);
185 #define DEBUG_PRINTF1(x,y) printf(x,y);
185 #define DEBUG_PRINTF1(x,y) printf(x,y);
186 #define DEBUG_PRINTF2(x,y,z) printf(x,y,z);
186 #define DEBUG_PRINTF2(x,y,z) printf(x,y,z);
187 #else
187 #else
188 #define DEBUG_PRINTF(x) ;
188 #define DEBUG_PRINTF(x) ;
189 #define DEBUG_PRINTF1(x,y) ;
189 #define DEBUG_PRINTF1(x,y) ;
190 #define DEBUG_PRINTF2(x,y,z) ;
190 #define DEBUG_PRINTF2(x,y,z) ;
191 #endif
191 #endif
192
192
193 #define CPU_USAGE_REPORT_PERIOD 6 // * 10 s = period
193 #define CPU_USAGE_REPORT_PERIOD 6 // * 10 s = period
194
194
195 #define NB_SAMPLES_PER_SNAPSHOT 2048
195 #define NB_SAMPLES_PER_SNAPSHOT 2048
196 #define TIME_OFFSET 2
196 #define TIME_OFFSET 2
197 #define WAVEFORM_EXTENDED_HEADER_OFFSET 22
197 #define WAVEFORM_EXTENDED_HEADER_OFFSET 22
198 #define NB_BYTES_SWF_BLK (2 * 6)
198 #define NB_BYTES_SWF_BLK (2 * 6)
199 #define NB_WORDS_SWF_BLK 3
199 #define NB_WORDS_SWF_BLK 3
200 #define NB_BYTES_CWF3_LIGHT_BLK 6
200 #define NB_BYTES_CWF3_LIGHT_BLK 6
201 #define WFRM_INDEX_OF_LAST_PACKET 6 // waveforms are transmitted in groups of 2048 blocks, 6 packets of 340 and 1 of 8
201 #define WFRM_INDEX_OF_LAST_PACKET 6 // waveforms are transmitted in groups of 2048 blocks, 6 packets of 340 and 1 of 8
202
202
203 struct param_local_str{
203 struct param_local_str{
204 unsigned int local_sbm1_nb_cwf_sent;
204 unsigned int local_sbm1_nb_cwf_sent;
205 unsigned int local_sbm1_nb_cwf_max;
205 unsigned int local_sbm1_nb_cwf_max;
206 unsigned int local_sbm2_nb_cwf_sent;
206 unsigned int local_sbm2_nb_cwf_sent;
207 unsigned int local_sbm2_nb_cwf_max;
207 unsigned int local_sbm2_nb_cwf_max;
208 unsigned int local_nb_interrupt_f0_MAX;
208 unsigned int local_nb_interrupt_f0_MAX;
209 };
209 };
210
210
211 #endif // FSW_PARAMS_H_INCLUDED
211 #endif // FSW_PARAMS_H_INCLUDED
@@ -1,586 +1,586
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_MAXIMUM_DRIVERS 16
35 #define CONFIGURE_MAXIMUM_DRIVERS 16
36 #define CONFIGURE_MAXIMUM_PERIODS 5
36 #define CONFIGURE_MAXIMUM_PERIODS 5
37 #define CONFIGURE_MAXIMUM_TIMERS 5 // STAT (1s), send SWF (0.3s), send CWF3 (1s)
37 #define CONFIGURE_MAXIMUM_TIMERS 5 // STAT (1s), send SWF (0.3s), send CWF3 (1s)
38 #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 2
38 #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 2
39 #ifdef PRINT_STACK_REPORT
39 #ifdef PRINT_STACK_REPORT
40 #define CONFIGURE_STACK_CHECKER_ENABLED
40 #define CONFIGURE_STACK_CHECKER_ENABLED
41 #endif
41 #endif
42
42
43 #include <rtems/confdefs.h>
43 #include <rtems/confdefs.h>
44
44
45 /* If --drvmgr was enabled during the configuration of the RTEMS kernel */
45 /* If --drvmgr was enabled during the configuration of the RTEMS kernel */
46 #ifdef RTEMS_DRVMGR_STARTUP
46 #ifdef RTEMS_DRVMGR_STARTUP
47 #ifdef LEON3
47 #ifdef LEON3
48 /* Add Timer and UART Driver */
48 /* Add Timer and UART Driver */
49 #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
49 #ifdef CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
50 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GPTIMER
50 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GPTIMER
51 #endif
51 #endif
52 #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
52 #ifdef CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
53 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_APBUART
53 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_APBUART
54 #endif
54 #endif
55 #endif
55 #endif
56 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRSPW /* GRSPW Driver */
56 #define CONFIGURE_DRIVER_AMBAPP_GAISLER_GRSPW /* GRSPW Driver */
57 #include <drvmgr/drvmgr_confdefs.h>
57 #include <drvmgr/drvmgr_confdefs.h>
58 #endif
58 #endif
59
59
60 #include "fsw_init.h"
60 #include "fsw_init.h"
61 #include "fsw_config.c"
61 #include "fsw_config.c"
62
62
63 rtems_task Init( rtems_task_argument ignored )
63 rtems_task Init( rtems_task_argument ignored )
64 {
64 {
65 /** This is the RTEMS INIT taks, it the first task launched by the system.
65 /** This is the RTEMS INIT taks, it the first task launched by the system.
66 *
66 *
67 * @param unused is the starting argument of the RTEMS task
67 * @param unused is the starting argument of the RTEMS task
68 *
68 *
69 * The INIT task create and run all other RTEMS tasks.
69 * The INIT task create and run all other RTEMS tasks.
70 *
70 *
71 */
71 */
72
72
73
73
74 rtems_status_code status;
74 rtems_status_code status;
75 rtems_status_code status_spw;
75 rtems_status_code status_spw;
76 rtems_isr_entry old_isr_handler;
76 rtems_isr_entry old_isr_handler;
77
77
78 BOOT_PRINTF("\n\n\n\n\n")
78 BOOT_PRINTF("\n\n\n\n\n")
79 BOOT_PRINTF("***************************\n")
79 BOOT_PRINTF("***************************\n")
80 BOOT_PRINTF("** START Flight Software **\n")
80 BOOT_PRINTF("** START Flight Software **\n")
81 BOOT_PRINTF("***************************\n")
81 BOOT_PRINTF("***************************\n")
82 BOOT_PRINTF("\n\n")
82 BOOT_PRINTF("\n\n")
83
83
84 //send_console_outputs_on_apbuart_port();
84 //send_console_outputs_on_apbuart_port();
85 set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE);
85 set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE);
86
86
87 reset_wfp_burst_enable(); // stop the waveform picker if it was running
87 reset_wfp_burst_enable(); // stop the waveform picker if it was running
88
88
89 init_parameter_dump();
89 init_parameter_dump();
90 init_local_mode_parameters();
90 init_local_mode_parameters();
91 init_housekeeping_parameters();
91 init_housekeeping_parameters();
92
92
93 updateLFRCurrentMode();
93 updateLFRCurrentMode();
94
94
95 BOOT_PRINTF1("in INIT *** lfrCurrentMode is %d\n", lfrCurrentMode)
95 BOOT_PRINTF1("in INIT *** lfrCurrentMode is %d\n", lfrCurrentMode)
96
96
97 create_names(); // create all names
97 create_names(); // create all names
98
98
99 status = create_message_queues(); // create message queues
99 status = create_message_queues(); // create message queues
100 if (status != RTEMS_SUCCESSFUL)
100 if (status != RTEMS_SUCCESSFUL)
101 {
101 {
102 PRINTF1("in INIT *** ERR in create_message_queues, code %d", status)
102 PRINTF1("in INIT *** ERR in create_message_queues, code %d", status)
103 }
103 }
104
104
105 status = create_all_tasks(); // create all tasks
105 status = create_all_tasks(); // create all tasks
106 if (status != RTEMS_SUCCESSFUL)
106 if (status != RTEMS_SUCCESSFUL)
107 {
107 {
108 PRINTF1("in INIT *** ERR in create_all_tasks, code %d", status)
108 PRINTF1("in INIT *** ERR in create_all_tasks, code %d", status)
109 }
109 }
110
110
111 // **************************
111 // **************************
112 // <SPACEWIRE INITIALIZATION>
112 // <SPACEWIRE INITIALIZATION>
113 grspw_timecode_callback = &timecode_irq_handler;
113 grspw_timecode_callback = &timecode_irq_handler;
114
114
115 status_spw = spacewire_open_link(); // (1) open the link
115 status_spw = spacewire_open_link(); // (1) open the link
116 if ( status_spw != RTEMS_SUCCESSFUL )
116 if ( status_spw != RTEMS_SUCCESSFUL )
117 {
117 {
118 PRINTF1("in INIT *** ERR spacewire_open_link code %d\n", status_spw )
118 PRINTF1("in INIT *** ERR spacewire_open_link code %d\n", status_spw )
119 }
119 }
120
120
121 if ( status_spw == RTEMS_SUCCESSFUL ) // (2) configure the link
121 if ( status_spw == RTEMS_SUCCESSFUL ) // (2) configure the link
122 {
122 {
123 status_spw = spacewire_configure_link( fdSPW );
123 status_spw = spacewire_configure_link( fdSPW );
124 if ( status_spw != RTEMS_SUCCESSFUL )
124 if ( status_spw != RTEMS_SUCCESSFUL )
125 {
125 {
126 PRINTF1("in INIT *** ERR spacewire_configure_link code %d\n", status_spw )
126 PRINTF1("in INIT *** ERR spacewire_configure_link code %d\n", status_spw )
127 }
127 }
128 }
128 }
129
129
130 if ( status_spw == RTEMS_SUCCESSFUL) // (3) start the link
130 if ( status_spw == RTEMS_SUCCESSFUL) // (3) start the link
131 {
131 {
132 status_spw = spacewire_start_link( fdSPW );
132 status_spw = spacewire_start_link( fdSPW );
133 if ( status_spw != RTEMS_SUCCESSFUL )
133 if ( status_spw != RTEMS_SUCCESSFUL )
134 {
134 {
135 PRINTF1("in INIT *** ERR spacewire_start_link code %d\n", status_spw )
135 PRINTF1("in INIT *** ERR spacewire_start_link code %d\n", status_spw )
136 }
136 }
137 }
137 }
138 // </SPACEWIRE INITIALIZATION>
138 // </SPACEWIRE INITIALIZATION>
139 // ***************************
139 // ***************************
140
140
141 status = start_all_tasks(); // start all tasks
141 status = start_all_tasks(); // start all tasks
142 if (status != RTEMS_SUCCESSFUL)
142 if (status != RTEMS_SUCCESSFUL)
143 {
143 {
144 PRINTF1("in INIT *** ERR in start_all_tasks, code %d", status)
144 PRINTF1("in INIT *** ERR in start_all_tasks, code %d", status)
145 }
145 }
146
146
147 // start RECV and SEND *AFTER* SpaceWire Initialization, due to the timeout of the start call during the initialization
147 // start RECV and SEND *AFTER* SpaceWire Initialization, due to the timeout of the start call during the initialization
148 status = start_recv_send_tasks();
148 status = start_recv_send_tasks();
149 if ( status != RTEMS_SUCCESSFUL )
149 if ( status != RTEMS_SUCCESSFUL )
150 {
150 {
151 PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status )
151 PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status )
152 }
152 }
153
153
154 // suspend science tasks. they will be restarted later depending on the mode
154 // suspend science tasks. they will be restarted later depending on the mode
155 status = suspend_science_tasks(); // suspend science tasks (not done in stop_current_mode if current mode = STANDBY)
155 status = suspend_science_tasks(); // suspend science tasks (not done in stop_current_mode if current mode = STANDBY)
156 if (status != RTEMS_SUCCESSFUL)
156 if (status != RTEMS_SUCCESSFUL)
157 {
157 {
158 PRINTF1("in INIT *** in suspend_science_tasks *** ERR code: %d\n", status)
158 PRINTF1("in INIT *** in suspend_science_tasks *** ERR code: %d\n", status)
159 }
159 }
160
160
161 #ifdef GSA
161 #ifdef GSA
162 // mask IRQ lines
162 // mask IRQ lines
163 LEON_Mask_interrupt( IRQ_SM );
163 LEON_Mask_interrupt( IRQ_SM );
164 LEON_Mask_interrupt( IRQ_WF );
164 LEON_Mask_interrupt( IRQ_WF );
165 // Spectral Matrices simulator
165 // Spectral Matrices simulator
166 configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR, CLKDIV_SM_SIMULATOR,
166 configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR, CLKDIV_SM_SIMULATOR,
167 IRQ_SPARC_SM, spectral_matrices_isr );
167 IRQ_SPARC_SM, spectral_matrices_isr );
168 // WaveForms
168 // WaveForms
169 configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR, CLKDIV_WF_SIMULATOR,
169 configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR, CLKDIV_WF_SIMULATOR,
170 IRQ_SPARC_WF, waveforms_simulator_isr );
170 IRQ_SPARC_WF, waveforms_simulator_isr );
171 #else
171 #else
172 // configure IRQ handling for the waveform picker unit
172 // configure IRQ handling for the waveform picker unit
173 status = rtems_interrupt_catch( waveforms_isr,
173 status = rtems_interrupt_catch( waveforms_isr,
174 IRQ_SPARC_WAVEFORM_PICKER,
174 IRQ_SPARC_WAVEFORM_PICKER,
175 &old_isr_handler) ;
175 &old_isr_handler) ;
176 #endif
176 #endif
177
177
178 // if the spacewire link is not up then send an event to the SPIQ task for link recovery
178 // if the spacewire link is not up then send an event to the SPIQ task for link recovery
179 if ( status_spw != RTEMS_SUCCESSFUL )
179 if ( status_spw != RTEMS_SUCCESSFUL )
180 {
180 {
181 status = rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT );
181 status = rtems_event_send( Task_id[TASKID_SPIQ], SPW_LINKERR_EVENT );
182 if ( status != RTEMS_SUCCESSFUL ) {
182 if ( status != RTEMS_SUCCESSFUL ) {
183 PRINTF1("in INIT *** ERR rtems_event_send to SPIQ code %d\n", status )
183 PRINTF1("in INIT *** ERR rtems_event_send to SPIQ code %d\n", status )
184 }
184 }
185 }
185 }
186
186
187 BOOT_PRINTF("delete INIT\n")
187 BOOT_PRINTF("delete INIT\n")
188
188
189 status = rtems_task_delete(RTEMS_SELF);
189 status = rtems_task_delete(RTEMS_SELF);
190
190
191 }
191 }
192
192
193 void init_local_mode_parameters( void )
193 void init_local_mode_parameters( void )
194 {
194 {
195 /** This function initialize the param_local global variable with default values.
195 /** This function initialize the param_local global variable with default values.
196 *
196 *
197 */
197 */
198
198
199 unsigned int i;
199 unsigned int i;
200
200
201 // LOCAL PARAMETERS
201 // LOCAL PARAMETERS
202 set_local_sbm1_nb_cwf_max();
202 set_local_sbm1_nb_cwf_max();
203 set_local_sbm2_nb_cwf_max();
203 set_local_sbm2_nb_cwf_max();
204 set_local_nb_interrupt_f0_MAX();
204 set_local_nb_interrupt_f0_MAX();
205
205
206 BOOT_PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max)
206 BOOT_PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max)
207 BOOT_PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max)
207 BOOT_PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max)
208 BOOT_PRINTF1("nb_interrupt_f0_MAX = %d\n", param_local.local_nb_interrupt_f0_MAX)
208 BOOT_PRINTF1("nb_interrupt_f0_MAX = %d\n", param_local.local_nb_interrupt_f0_MAX)
209
209
210 reset_local_sbm1_nb_cwf_sent();
210 reset_local_sbm1_nb_cwf_sent();
211 reset_local_sbm2_nb_cwf_sent();
211 reset_local_sbm2_nb_cwf_sent();
212
212
213 // init sequence counters
213 // init sequence counters
214
214
215 for(i = 0; i<SEQ_CNT_NB_DEST_ID; i++)
215 for(i = 0; i<SEQ_CNT_NB_DEST_ID; i++)
216 {
216 {
217 sequenceCounters_TC_EXE[i] = 0x00;
217 sequenceCounters_TC_EXE[i] = 0x00;
218 }
218 }
219 sequenceCounters_SCIENCE_NORMAL_BURST = 0x00;
219 sequenceCounters_SCIENCE_NORMAL_BURST = 0x00;
220 sequenceCounters_SCIENCE_SBM1_SBM2 = 0x00;
220 sequenceCounters_SCIENCE_SBM1_SBM2 = 0x00;
221 }
221 }
222
222
223 void create_names( void ) // create all names for tasks and queues
223 void create_names( void ) // create all names for tasks and queues
224 {
224 {
225 /** This function creates all RTEMS names used in the software for tasks and queues.
225 /** This function creates all RTEMS names used in the software for tasks and queues.
226 *
226 *
227 * @return RTEMS directive status codes:
227 * @return RTEMS directive status codes:
228 * - RTEMS_SUCCESSFUL - successful completion
228 * - RTEMS_SUCCESSFUL - successful completion
229 *
229 *
230 */
230 */
231
231
232 // task names
232 // task names
233 Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' );
233 Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' );
234 Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' );
234 Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' );
235 Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' );
235 Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' );
236 Task_name[TASKID_SMIQ] = rtems_build_name( 'S', 'M', 'I', 'Q' );
236 Task_name[TASKID_SMIQ] = rtems_build_name( 'S', 'M', 'I', 'Q' );
237 Task_name[TASKID_STAT] = rtems_build_name( 'S', 'T', 'A', 'T' );
237 Task_name[TASKID_STAT] = rtems_build_name( 'S', 'T', 'A', 'T' );
238 Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' );
238 Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' );
239 Task_name[TASKID_BPF0] = rtems_build_name( 'B', 'P', 'F', '0' );
239 Task_name[TASKID_BPF0] = rtems_build_name( 'B', 'P', 'F', '0' );
240 Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' );
240 Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' );
241 Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' );
241 Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' );
242 Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' );
242 Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' );
243 Task_name[TASKID_MATR] = rtems_build_name( 'M', 'A', 'T', 'R' );
243 Task_name[TASKID_MATR] = rtems_build_name( 'M', 'A', 'T', 'R' );
244 Task_name[TASKID_CWF3] = rtems_build_name( 'C', 'W', 'F', '3' );
244 Task_name[TASKID_CWF3] = rtems_build_name( 'C', 'W', 'F', '3' );
245 Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' );
245 Task_name[TASKID_CWF2] = rtems_build_name( 'C', 'W', 'F', '2' );
246 Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' );
246 Task_name[TASKID_CWF1] = rtems_build_name( 'C', 'W', 'F', '1' );
247 Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' );
247 Task_name[TASKID_SEND] = rtems_build_name( 'S', 'E', 'N', 'D' );
248 Task_name[TASKID_WTDG] = rtems_build_name( 'W', 'T', 'D', 'G' );
248 Task_name[TASKID_WTDG] = rtems_build_name( 'W', 'T', 'D', 'G' );
249
249
250 // rate monotonic period names
250 // rate monotonic period names
251 name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' );
251 name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' );
252
252
253 misc_name[QUEUE_RECV] = rtems_build_name( 'Q', '_', 'R', 'V' );
253 misc_name[QUEUE_RECV] = rtems_build_name( 'Q', '_', 'R', 'V' );
254 misc_name[QUEUE_SEND] = rtems_build_name( 'Q', '_', 'S', 'D' );
254 misc_name[QUEUE_SEND] = rtems_build_name( 'Q', '_', 'S', 'D' );
255 }
255 }
256
256
257 int create_all_tasks( void ) // create all tasks which run in the software
257 int create_all_tasks( void ) // create all tasks which run in the software
258 {
258 {
259 /** This function creates all RTEMS tasks used in the software.
259 /** This function creates all RTEMS tasks used in the software.
260 *
260 *
261 * @return RTEMS directive status codes:
261 * @return RTEMS directive status codes:
262 * - RTEMS_SUCCESSFUL - task created successfully
262 * - RTEMS_SUCCESSFUL - task created successfully
263 * - RTEMS_INVALID_ADDRESS - id is NULL
263 * - RTEMS_INVALID_ADDRESS - id is NULL
264 * - RTEMS_INVALID_NAME - invalid task name
264 * - RTEMS_INVALID_NAME - invalid task name
265 * - RTEMS_INVALID_PRIORITY - invalid task priority
265 * - RTEMS_INVALID_PRIORITY - invalid task priority
266 * - RTEMS_MP_NOT_CONFIGURED - multiprocessing not configured
266 * - RTEMS_MP_NOT_CONFIGURED - multiprocessing not configured
267 * - RTEMS_TOO_MANY - too many tasks created
267 * - RTEMS_TOO_MANY - too many tasks created
268 * - RTEMS_UNSATISFIED - not enough memory for stack/FP context
268 * - RTEMS_UNSATISFIED - not enough memory for stack/FP context
269 * - RTEMS_TOO_MANY - too many global objects
269 * - RTEMS_TOO_MANY - too many global objects
270 *
270 *
271 */
271 */
272
272
273 rtems_status_code status;
273 rtems_status_code status;
274
274
275 // RECV
275 // RECV
276 status = rtems_task_create(
276 status = rtems_task_create(
277 Task_name[TASKID_RECV], TASK_PRIORITY_RECV, RTEMS_MINIMUM_STACK_SIZE,
277 Task_name[TASKID_RECV], TASK_PRIORITY_RECV, RTEMS_MINIMUM_STACK_SIZE,
278 RTEMS_DEFAULT_MODES,
278 RTEMS_DEFAULT_MODES,
279 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV]
279 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV]
280 );
280 );
281
281
282 if (status == RTEMS_SUCCESSFUL) // ACTN
282 if (status == RTEMS_SUCCESSFUL) // ACTN
283 {
283 {
284 status = rtems_task_create(
284 status = rtems_task_create(
285 Task_name[TASKID_ACTN], TASK_PRIORITY_ACTN, RTEMS_MINIMUM_STACK_SIZE,
285 Task_name[TASKID_ACTN], TASK_PRIORITY_ACTN, RTEMS_MINIMUM_STACK_SIZE,
286 RTEMS_DEFAULT_MODES,
286 RTEMS_DEFAULT_MODES,
287 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_ACTN]
287 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_ACTN]
288 );
288 );
289 }
289 }
290 if (status == RTEMS_SUCCESSFUL) // SPIQ
290 if (status == RTEMS_SUCCESSFUL) // SPIQ
291 {
291 {
292 status = rtems_task_create(
292 status = rtems_task_create(
293 Task_name[TASKID_SPIQ], TASK_PRIORITY_SPIQ, RTEMS_MINIMUM_STACK_SIZE,
293 Task_name[TASKID_SPIQ], TASK_PRIORITY_SPIQ, RTEMS_MINIMUM_STACK_SIZE,
294 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
294 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
295 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ]
295 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ]
296 );
296 );
297 }
297 }
298 if (status == RTEMS_SUCCESSFUL) // SMIQ
298 if (status == RTEMS_SUCCESSFUL) // SMIQ
299 {
299 {
300 status = rtems_task_create(
300 status = rtems_task_create(
301 Task_name[TASKID_SMIQ], TASK_PRIORITY_SMIQ, RTEMS_MINIMUM_STACK_SIZE,
301 Task_name[TASKID_SMIQ], TASK_PRIORITY_SMIQ, RTEMS_MINIMUM_STACK_SIZE,
302 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
302 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
303 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SMIQ]
303 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SMIQ]
304 );
304 );
305 }
305 }
306 if (status == RTEMS_SUCCESSFUL) // STAT
306 if (status == RTEMS_SUCCESSFUL) // STAT
307 {
307 {
308 status = rtems_task_create(
308 status = rtems_task_create(
309 Task_name[TASKID_STAT], TASK_PRIORITY_STAT, RTEMS_MINIMUM_STACK_SIZE,
309 Task_name[TASKID_STAT], TASK_PRIORITY_STAT, RTEMS_MINIMUM_STACK_SIZE,
310 RTEMS_DEFAULT_MODES,
310 RTEMS_DEFAULT_MODES,
311 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_STAT]
311 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_STAT]
312 );
312 );
313 }
313 }
314 if (status == RTEMS_SUCCESSFUL) // AVF0
314 if (status == RTEMS_SUCCESSFUL) // AVF0
315 {
315 {
316 status = rtems_task_create(
316 status = rtems_task_create(
317 Task_name[TASKID_AVF0], TASK_PRIORITY_AVF0, RTEMS_MINIMUM_STACK_SIZE,
317 Task_name[TASKID_AVF0], TASK_PRIORITY_AVF0, RTEMS_MINIMUM_STACK_SIZE,
318 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
318 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
319 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0]
319 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0]
320 );
320 );
321 }
321 }
322 if (status == RTEMS_SUCCESSFUL) // BPF0
322 if (status == RTEMS_SUCCESSFUL) // BPF0
323 {
323 {
324 status = rtems_task_create(
324 status = rtems_task_create(
325 Task_name[TASKID_BPF0], TASK_PRIORITY_BPF0, RTEMS_MINIMUM_STACK_SIZE,
325 Task_name[TASKID_BPF0], TASK_PRIORITY_BPF0, RTEMS_MINIMUM_STACK_SIZE,
326 RTEMS_DEFAULT_MODES,
326 RTEMS_DEFAULT_MODES,
327 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_BPF0]
327 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_BPF0]
328 );
328 );
329 }
329 }
330 if (status == RTEMS_SUCCESSFUL) // WFRM
330 if (status == RTEMS_SUCCESSFUL) // WFRM
331 {
331 {
332 status = rtems_task_create(
332 status = rtems_task_create(
333 Task_name[TASKID_WFRM], TASK_PRIORITY_WFRM, RTEMS_MINIMUM_STACK_SIZE,
333 Task_name[TASKID_WFRM], TASK_PRIORITY_WFRM, RTEMS_MINIMUM_STACK_SIZE,
334 RTEMS_DEFAULT_MODES,
334 RTEMS_DEFAULT_MODES,
335 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_WFRM]
335 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_WFRM]
336 );
336 );
337 }
337 }
338 if (status == RTEMS_SUCCESSFUL) // DUMB
338 if (status == RTEMS_SUCCESSFUL) // DUMB
339 {
339 {
340 status = rtems_task_create(
340 status = rtems_task_create(
341 Task_name[TASKID_DUMB], TASK_PRIORITY_DUMB, RTEMS_MINIMUM_STACK_SIZE,
341 Task_name[TASKID_DUMB], TASK_PRIORITY_DUMB, RTEMS_MINIMUM_STACK_SIZE,
342 RTEMS_DEFAULT_MODES,
342 RTEMS_DEFAULT_MODES,
343 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB]
343 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB]
344 );
344 );
345 }
345 }
346 if (status == RTEMS_SUCCESSFUL) // HOUS
346 if (status == RTEMS_SUCCESSFUL) // HOUS
347 {
347 {
348 status = rtems_task_create(
348 status = rtems_task_create(
349 Task_name[TASKID_HOUS], TASK_PRIORITY_HOUS, RTEMS_MINIMUM_STACK_SIZE,
349 Task_name[TASKID_HOUS], TASK_PRIORITY_HOUS, RTEMS_MINIMUM_STACK_SIZE,
350 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
350 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
351 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_HOUS]
351 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_HOUS]
352 );
352 );
353 }
353 }
354 if (status == RTEMS_SUCCESSFUL) // MATR
354 if (status == RTEMS_SUCCESSFUL) // MATR
355 {
355 {
356 status = rtems_task_create(
356 status = rtems_task_create(
357 Task_name[TASKID_MATR], TASK_PRIORITY_MATR, RTEMS_MINIMUM_STACK_SIZE,
357 Task_name[TASKID_MATR], TASK_PRIORITY_MATR, RTEMS_MINIMUM_STACK_SIZE,
358 RTEMS_DEFAULT_MODES,
358 RTEMS_DEFAULT_MODES,
359 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_MATR]
359 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_MATR]
360 );
360 );
361 }
361 }
362 if (status == RTEMS_SUCCESSFUL) // CWF3
362 if (status == RTEMS_SUCCESSFUL) // CWF3
363 {
363 {
364 status = rtems_task_create(
364 status = rtems_task_create(
365 Task_name[TASKID_CWF3], TASK_PRIORITY_CWF3, RTEMS_MINIMUM_STACK_SIZE,
365 Task_name[TASKID_CWF3], TASK_PRIORITY_CWF3, RTEMS_MINIMUM_STACK_SIZE,
366 RTEMS_DEFAULT_MODES,
366 RTEMS_DEFAULT_MODES,
367 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF3]
367 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF3]
368 );
368 );
369 }
369 }
370 if (status == RTEMS_SUCCESSFUL) // CWF2
370 if (status == RTEMS_SUCCESSFUL) // CWF2
371 {
371 {
372 status = rtems_task_create(
372 status = rtems_task_create(
373 Task_name[TASKID_CWF2], TASK_PRIORITY_CWF2, RTEMS_MINIMUM_STACK_SIZE,
373 Task_name[TASKID_CWF2], TASK_PRIORITY_CWF2, RTEMS_MINIMUM_STACK_SIZE,
374 RTEMS_DEFAULT_MODES,
374 RTEMS_DEFAULT_MODES,
375 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF2]
375 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF2]
376 );
376 );
377 }
377 }
378 if (status == RTEMS_SUCCESSFUL) // CWF1
378 if (status == RTEMS_SUCCESSFUL) // CWF1
379 {
379 {
380 status = rtems_task_create(
380 status = rtems_task_create(
381 Task_name[TASKID_CWF1], TASK_PRIORITY_CWF1, RTEMS_MINIMUM_STACK_SIZE,
381 Task_name[TASKID_CWF1], TASK_PRIORITY_CWF1, RTEMS_MINIMUM_STACK_SIZE,
382 RTEMS_DEFAULT_MODES,
382 RTEMS_DEFAULT_MODES,
383 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF1]
383 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF1]
384 );
384 );
385 }
385 }
386 if (status == RTEMS_SUCCESSFUL) // SEND
386 if (status == RTEMS_SUCCESSFUL) // SEND
387 {
387 {
388 status = rtems_task_create(
388 status = rtems_task_create(
389 Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE,
389 Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE,
390 RTEMS_DEFAULT_MODES,
390 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
391 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SEND]
391 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SEND]
392 );
392 );
393 }
393 }
394 if (status == RTEMS_SUCCESSFUL) // WTDG
394 if (status == RTEMS_SUCCESSFUL) // WTDG
395 {
395 {
396 status = rtems_task_create(
396 status = rtems_task_create(
397 Task_name[TASKID_WTDG], TASK_PRIORITY_WTDG, RTEMS_MINIMUM_STACK_SIZE,
397 Task_name[TASKID_WTDG], TASK_PRIORITY_WTDG, RTEMS_MINIMUM_STACK_SIZE,
398 RTEMS_DEFAULT_MODES,
398 RTEMS_DEFAULT_MODES,
399 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_WTDG]
399 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_WTDG]
400 );
400 );
401 }
401 }
402
402
403 return status;
403 return status;
404 }
404 }
405
405
406 int start_recv_send_tasks( void )
406 int start_recv_send_tasks( void )
407 {
407 {
408 rtems_status_code status;
408 rtems_status_code status;
409
409
410 status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 );
410 status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 );
411 if (status!=RTEMS_SUCCESSFUL) {
411 if (status!=RTEMS_SUCCESSFUL) {
412 BOOT_PRINTF("in INIT *** Error starting TASK_RECV\n")
412 BOOT_PRINTF("in INIT *** Error starting TASK_RECV\n")
413 }
413 }
414
414
415 if (status == RTEMS_SUCCESSFUL) // SEND
415 if (status == RTEMS_SUCCESSFUL) // SEND
416 {
416 {
417 status = rtems_task_start( Task_id[TASKID_SEND], send_task, 1 );
417 status = rtems_task_start( Task_id[TASKID_SEND], send_task, 1 );
418 if (status!=RTEMS_SUCCESSFUL) {
418 if (status!=RTEMS_SUCCESSFUL) {
419 BOOT_PRINTF("in INIT *** Error starting TASK_SEND\n")
419 BOOT_PRINTF("in INIT *** Error starting TASK_SEND\n")
420 }