@@ -2,16 +2,16 | |||||
2 | <CodeBlocks_layout_file> |
|
2 | <CodeBlocks_layout_file> | |
3 | <ActiveTarget name="Debug" /> |
|
3 | <ActiveTarget name="Debug" /> | |
4 | <File name="../header/ccsds_types.h" open="0" top="0" tabpos="3"> |
|
4 | <File name="../header/ccsds_types.h" open="0" top="0" tabpos="3"> | |
5 |
<Cursor position="4 |
|
5 | <Cursor position="384" topLine="87" /> | |
6 | </File> |
|
6 | </File> | |
7 | <File name="../header/fsw_init.h" open="0" top="0" tabpos="6"> |
|
7 | <File name="../header/fsw_init.h" open="0" top="0" tabpos="6"> | |
8 |
<Cursor position="1 |
|
8 | <Cursor position="1133" topLine="22" /> | |
9 | </File> |
|
9 | </File> | |
10 | <File name="../header/fsw_misc.h" open="0" top="0" tabpos="0"> |
|
10 | <File name="../header/fsw_misc.h" open="0" top="0" tabpos="0"> | |
11 |
<Cursor position=" |
|
11 | <Cursor position="545" topLine="0" /> | |
12 | </File> |
|
12 | </File> | |
13 | <File name="../header/fsw_params.h" open="0" top="0" tabpos="2"> |
|
13 | <File name="../header/fsw_params.h" open="0" top="0" tabpos="2"> | |
14 |
<Cursor position=" |
|
14 | <Cursor position="1157" topLine="0" /> | |
15 | </File> |
|
15 | </File> | |
16 | <File name="../header/fsw_processing.h" open="0" top="0" tabpos="0"> |
|
16 | <File name="../header/fsw_processing.h" open="0" top="0" tabpos="0"> | |
17 | <Cursor position="628" topLine="7" /> |
|
17 | <Cursor position="628" topLine="7" /> | |
@@ -26,21 +26,21 | |||||
26 | <Cursor position="341" topLine="0" /> |
|
26 | <Cursor position="341" topLine="0" /> | |
27 | </File> |
|
27 | </File> | |
28 | <File name="../src/fsw_globals.c" open="0" top="0" tabpos="5"> |
|
28 | <File name="../src/fsw_globals.c" open="0" top="0" tabpos="5"> | |
29 |
<Cursor position=" |
|
29 | <Cursor position="184" topLine="0" /> | |
30 | </File> |
|
30 | </File> | |
31 | <File name="../src/fsw_init.c" open="1" top="0" tabpos="1"> |
|
31 | <File name="../src/fsw_init.c" open="1" top="0" tabpos="1"> | |
32 |
<Cursor position="12 |
|
32 | <Cursor position="12072" topLine="91" /> | |
33 | </File> |
|
33 | </File> | |
34 |
<File name="../src/fsw_misc.c" open=" |
|
34 | <File name="../src/fsw_misc.c" open="1" top="1" tabpos="2"> | |
35 |
<Cursor position=" |
|
35 | <Cursor position="4309" topLine="44" /> | |
36 | </File> |
|
36 | </File> | |
37 | <File name="../src/fsw_processing.c" open="0" top="0" tabpos="0"> |
|
37 | <File name="../src/fsw_processing.c" open="0" top="0" tabpos="0"> | |
38 |
<Cursor position=" |
|
38 | <Cursor position="20570" topLine="67" /> | |
39 | </File> |
|
39 | </File> | |
40 |
<File name="../src/tc_handler.c" open=" |
|
40 | <File name="../src/tc_handler.c" open="0" top="0" tabpos="2"> | |
41 |
<Cursor position="1 |
|
41 | <Cursor position="15292" topLine="0" /> | |
42 | </File> |
|
42 | </File> | |
43 | <File name="../src/wf_handler.c" open="0" top="0" tabpos="4"> |
|
43 | <File name="../src/wf_handler.c" open="0" top="0" tabpos="4"> | |
44 |
<Cursor position=" |
|
44 | <Cursor position="2540" topLine="42" /> | |
45 | </File> |
|
45 | </File> | |
46 | </CodeBlocks_layout_file> |
|
46 | </CodeBlocks_layout_file> |
1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
@@ -15,5 +15,6 int configure_timer(gptimer_regs_t *gpti | |||||
15 | void print_statistics(spw_stats *stats); |
|
15 | void print_statistics(spw_stats *stats); | |
16 | int send_console_outputs_on_serial_port(); |
|
16 | int send_console_outputs_on_serial_port(); | |
17 | rtems_task stat_task(rtems_task_argument argument); |
|
17 | rtems_task stat_task(rtems_task_argument argument); | |
|
18 | rtems_task hous_task(rtems_task_argument argument); | |||
18 |
|
19 | |||
19 | #endif // FSW_MISC_H_INCLUDED |
|
20 | #endif // FSW_MISC_H_INCLUDED |
@@ -33,15 +33,18 | |||||
33 | #define IRQ_TIME2 13 |
|
33 | #define IRQ_TIME2 13 | |
34 | #define IRQ_SPARC_TIME2 0x1d // see sparcv8.pdf p.76 for interrupt levels |
|
34 | #define IRQ_SPARC_TIME2 0x1d // see sparcv8.pdf p.76 for interrupt levels | |
35 |
|
35 | |||
|
36 | //***** | |||
|
37 | // TIME | |||
36 | #define CLKDIV_SM_SIMULATOR 9999 |
|
38 | #define CLKDIV_SM_SIMULATOR 9999 | |
37 | #define CLKDIV_WF_SIMULATOR 9999999 |
|
39 | #define CLKDIV_WF_SIMULATOR 9999999 | |
38 | #define TIMER_SM_SIMULATOR 1 |
|
40 | #define TIMER_SM_SIMULATOR 1 | |
39 | #define TIMER_WF_SIMULATOR 2 |
|
41 | #define TIMER_WF_SIMULATOR 2 | |
|
42 | #define HK_PERIOD 100 // 100 * 10ms => 1sec | |||
40 |
|
43 | |||
41 | //****** |
|
44 | //****** | |
42 | // RTEMS |
|
45 | // RTEMS | |
43 | #define TASKID_RECV 1 |
|
46 | #define TASKID_RECV 1 | |
44 |
#define TASKID_ACTN |
|
47 | #define TASKID_ACTN 2 | |
45 | #define TASKID_SPIQ 3 |
|
48 | #define TASKID_SPIQ 3 | |
46 | #define TASKID_SMIQ 4 |
|
49 | #define TASKID_SMIQ 4 | |
47 | #define TASKID_STAT 5 |
|
50 | #define TASKID_STAT 5 | |
@@ -49,9 +52,13 | |||||
49 | #define TASKID_BPF0 7 |
|
52 | #define TASKID_BPF0 7 | |
50 | #define TASKID_WFRM 8 |
|
53 | #define TASKID_WFRM 8 | |
51 | #define TASKID_DUMB 9 |
|
54 | #define TASKID_DUMB 9 | |
|
55 | #define TASKID_HOUS 10 | |||
52 |
|
56 | |||
53 | #define ACTION_MSG_QUEUE_COUNT 10 |
|
57 | #define ACTION_MSG_QUEUE_COUNT 10 | |
54 |
|
58 | |||
|
59 | // LENGTH (BYTES) | |||
|
60 | #define LENGTH_TM_LFR_HK 126 | |||
|
61 | ||||
55 | //******* |
|
62 | //******* | |
56 | // MACROS |
|
63 | // MACROS | |
57 | //#define PRINT_TASK_STATISTICS |
|
64 | //#define PRINT_TASK_STATISTICS |
@@ -1,11 +1,12 | |||||
1 | #include <fsw_processing.h> |
|
1 | #include <fsw_processing.h> | |
2 | #include <rtems.h> |
|
2 | #include <rtems.h> | |
|
3 | #include <ccsds_types.h> | |||
3 |
|
4 | |||
4 | // RTEMS GLOBAL VARIABLES |
|
5 | // RTEMS GLOBAL VARIABLES | |
5 | rtems_name misc_name[5]; |
|
6 | rtems_name misc_name[5]; | |
6 | rtems_name misc_id[5]; |
|
7 | rtems_name misc_id[5]; | |
7 |
rtems_id Task_id[1 |
|
8 | rtems_id Task_id[15]; /* array of task ids */ | |
8 |
rtems_name Task_name[1 |
|
9 | rtems_name Task_name[15]; /* array of task names */ | |
9 | int fdSPW; |
|
10 | int fdSPW; | |
10 | int fdUART; |
|
11 | int fdUART; | |
11 |
|
12 | |||
@@ -38,8 +39,11 struct param_sbm1_str param_sbm1; | |||||
38 | struct param_sbm2_str param_sbm2; |
|
39 | struct param_sbm2_str param_sbm2; | |
39 | unsigned char param_common[2]; |
|
40 | unsigned char param_common[2]; | |
40 |
|
41 | |||
|
42 | // HK PACKETS | |||
|
43 | TMHeader_t housekeeping_header; | |||
|
44 | char housekeeping_data[LENGTH_TM_LFR_HK - 10 + 1]; | |||
|
45 | ||||
41 | // BASIC PARAMETERS GLOBAL VARIABLES |
|
46 | // BASIC PARAMETERS GLOBAL VARIABLES | |
42 | unsigned char LFR_BP1_F0[ NB_BINS_COMPRESSED_MATRIX_f0 * 9 ]; |
|
47 | unsigned char LFR_BP1_F0[ NB_BINS_COMPRESSED_MATRIX_f0 * 9 ]; | |
43 |
|
||||
44 | BP1_t data_BP1[ NB_BINS_COMPRESSED_MATRIX_f0 ]; |
|
48 | BP1_t data_BP1[ NB_BINS_COMPRESSED_MATRIX_f0 ]; | |
45 |
|
49 |
@@ -15,7 +15,7 | |||||
15 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER |
|
15 | #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER | |
16 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER |
|
16 | #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER | |
17 |
|
17 | |||
18 |
#define CONFIGURE_MAXIMUM_TASKS 1 |
|
18 | #define CONFIGURE_MAXIMUM_TASKS 15 | |
19 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE |
|
19 | #define CONFIGURE_RTEMS_INIT_TASKS_TABLE | |
20 | #define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE) |
|
20 | #define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE) | |
21 | #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32 |
|
21 | #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32 | |
@@ -70,6 +70,7 rtems_task Init( rtems_task_argument ign | |||||
70 | grspw_timecode_callback = &timecode_irq_handler; |
|
70 | grspw_timecode_callback = &timecode_irq_handler; | |
71 |
|
71 | |||
72 | configure_spw_link(); |
|
72 | configure_spw_link(); | |
|
73 | ||||
73 | configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR, CLKDIV_SM_SIMULATOR, |
|
74 | configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR, CLKDIV_SM_SIMULATOR, | |
74 | IRQ_SPARC_SM, spectral_matrices_isr ); |
|
75 | IRQ_SPARC_SM, spectral_matrices_isr ); | |
75 | configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR, CLKDIV_WF_SIMULATOR, |
|
76 | configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR, CLKDIV_WF_SIMULATOR, | |
@@ -104,13 +105,18 rtems_task spiq_task(rtems_task_argument | |||||
104 | PRINTF("In SPIQ *** Waiting for SPW_LINKERR_EVENT\n") |
|
105 | PRINTF("In SPIQ *** Waiting for SPW_LINKERR_EVENT\n") | |
105 | rtems_event_receive(SPW_LINKERR_EVENT, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an SPW_LINKERR_EVENT |
|
106 | rtems_event_receive(SPW_LINKERR_EVENT, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an SPW_LINKERR_EVENT | |
106 |
|
107 | |||
107 |
if (rtems_task_suspend(Task_id[ |
|
108 | if (rtems_task_suspend(Task_id[TASKID_RECV])!=RTEMS_SUCCESSFUL) // suspend RECV task | |
108 | PRINTF("In SPIQ *** Error suspending RECV Task\n") |
|
109 | PRINTF("In SPIQ *** Error suspending RECV Task\n") | |
|
110 | if (rtems_task_suspend(Task_id[TASKID_HOUS])!=RTEMS_SUCCESSFUL) // suspend HOUS task | |||
|
111 | PRINTF("In SPIQ *** Error suspending HOUS Task\n") | |||
109 |
|
112 | |||
110 | configure_spw_link(); |
|
113 | configure_spw_link(); | |
111 |
|
114 | |||
112 |
if (rtems_task_restart(Task_id[ |
|
115 | if (rtems_task_restart(Task_id[TASKID_RECV], 1)!=RTEMS_SUCCESSFUL) // restart RECV task | |
113 | PRINTF("In SPIQ *** Error resume RECV Task\n") |
|
116 | PRINTF("In SPIQ *** Error resume RECV Task\n") | |
|
117 | if (rtems_task_restart(Task_id[TASKID_HOUS], 1)!=RTEMS_SUCCESSFUL) // restart HOUS task | |||
|
118 | PRINTF("In SPIQ *** Error resume HOUS Task\n") | |||
|
119 | ||||
114 | } |
|
120 | } | |
115 | } |
|
121 | } | |
116 |
|
122 | |||
@@ -140,69 +146,76 int create_all_tasks() | |||||
140 | { |
|
146 | { | |
141 | rtems_status_code status; |
|
147 | rtems_status_code status; | |
142 |
|
148 | |||
143 |
Task_name[ |
|
149 | Task_name[TASKID_RECV] = rtems_build_name( 'R', 'E', 'C', 'V' ); | |
144 |
Task_name[ |
|
150 | Task_name[TASKID_ACTN] = rtems_build_name( 'A', 'C', 'T', 'N' ); | |
145 |
Task_name[ |
|
151 | Task_name[TASKID_SPIQ] = rtems_build_name( 'S', 'P', 'I', 'Q' ); | |
146 |
Task_name[ |
|
152 | Task_name[TASKID_SMIQ] = rtems_build_name( 'S', 'M', 'I', 'Q' ); | |
147 |
Task_name[ |
|
153 | Task_name[TASKID_STAT] = rtems_build_name( 'S', 'T', 'A', 'T' ); | |
148 |
Task_name[ |
|
154 | Task_name[TASKID_AVF0] = rtems_build_name( 'A', 'V', 'F', '0' ); | |
149 |
Task_name[ |
|
155 | Task_name[TASKID_BPF0] = rtems_build_name( 'B', 'P', 'F', '0' ); | |
150 |
Task_name[ |
|
156 | Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' ); | |
151 |
Task_name[ |
|
157 | Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' ); | |
|
158 | Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' ); | |||
152 |
|
159 | |||
153 | // RECV |
|
160 | // RECV | |
154 | status = rtems_task_create( |
|
161 | status = rtems_task_create( | |
155 |
Task_name[ |
|
162 | Task_name[TASKID_RECV], 200, RTEMS_MINIMUM_STACK_SIZE * 2, | |
156 | RTEMS_DEFAULT_MODES, |
|
163 | RTEMS_DEFAULT_MODES, | |
157 |
RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ |
|
164 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV] | |
158 | ); |
|
165 | ); | |
159 | // ACTN |
|
166 | // ACTN | |
160 | status = rtems_task_create( |
|
167 | status = rtems_task_create( | |
161 |
Task_name[ |
|
168 | Task_name[TASKID_ACTN], 50, RTEMS_MINIMUM_STACK_SIZE * 2, | |
162 | RTEMS_DEFAULT_MODES, |
|
169 | RTEMS_DEFAULT_MODES, | |
163 |
RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ |
|
170 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_ACTN] | |
164 | ); |
|
171 | ); | |
165 | // SPIQ |
|
172 | // SPIQ | |
166 | status = rtems_task_create( |
|
173 | status = rtems_task_create( | |
167 |
Task_name[ |
|
174 | Task_name[TASKID_SPIQ], 50, RTEMS_MINIMUM_STACK_SIZE * 2, | |
168 | RTEMS_DEFAULT_MODES, |
|
175 | RTEMS_DEFAULT_MODES, | |
169 |
RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ |
|
176 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ] | |
170 | ); |
|
177 | ); | |
171 | // SMIQ |
|
178 | // SMIQ | |
172 | status = rtems_task_create( |
|
179 | status = rtems_task_create( | |
173 |
Task_name[ |
|
180 | Task_name[TASKID_SMIQ], 10, RTEMS_MINIMUM_STACK_SIZE * 2, | |
174 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
181 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, | |
175 |
RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ |
|
182 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SMIQ] | |
176 | ); |
|
183 | ); | |
177 | // STAT |
|
184 | // STAT | |
178 | status = rtems_task_create( |
|
185 | status = rtems_task_create( | |
179 |
Task_name[ |
|
186 | Task_name[TASKID_STAT], 150, RTEMS_MINIMUM_STACK_SIZE * 2, | |
180 | RTEMS_DEFAULT_MODES, |
|
187 | RTEMS_DEFAULT_MODES, | |
181 |
RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ |
|
188 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_STAT] | |
182 | ); |
|
189 | ); | |
183 | // AVF0 |
|
190 | // AVF0 | |
184 | status = rtems_task_create( |
|
191 | status = rtems_task_create( | |
185 |
Task_name[ |
|
192 | Task_name[TASKID_AVF0], 50, RTEMS_MINIMUM_STACK_SIZE * 2, | |
186 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, |
|
193 | RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT, | |
187 |
RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[ |
|
194 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0] | |
188 | ); |
|
195 | ); | |
189 | // BPF0 |
|
196 | // BPF0 | |
190 | status = rtems_task_create( |
|
197 | status = rtems_task_create( | |
191 |
Task_name[ |
|
198 | Task_name[TASKID_BPF0], 50, RTEMS_MINIMUM_STACK_SIZE * 2, | |
192 | RTEMS_DEFAULT_MODES, |
|
199 | RTEMS_DEFAULT_MODES, | |
193 |
RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[ |
|
200 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_BPF0] | |
194 | ); |
|
201 | ); | |
195 | // WFRM |
|
202 | // WFRM | |
196 | status = rtems_task_create( |
|
203 | status = rtems_task_create( | |
197 |
Task_name[ |
|
204 | Task_name[TASKID_WFRM], 100, RTEMS_MINIMUM_STACK_SIZE * 2, | |
198 | RTEMS_DEFAULT_MODES, |
|
205 | RTEMS_DEFAULT_MODES, | |
199 |
RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[ |
|
206 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_WFRM] | |
200 | ); |
|
207 | ); | |
201 | // DUMB |
|
208 | // DUMB | |
202 | status = rtems_task_create( |
|
209 | status = rtems_task_create( | |
203 |
Task_name[ |
|
210 | Task_name[TASKID_DUMB], 200, RTEMS_MINIMUM_STACK_SIZE * 2, | |
204 | RTEMS_DEFAULT_MODES, |
|
211 | RTEMS_DEFAULT_MODES, | |
205 |
RTEMS_DEFAULT_ATTRIBUTES, &Task_id[ |
|
212 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB] | |
|
213 | ); | |||
|
214 | // HOUS | |||
|
215 | status = rtems_task_create( | |||
|
216 | Task_name[TASKID_HOUS], 200, RTEMS_MINIMUM_STACK_SIZE * 2, | |||
|
217 | RTEMS_DEFAULT_MODES, | |||
|
218 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_HOUS] | |||
206 | ); |
|
219 | ); | |
207 |
|
220 | |||
208 | return 0; |
|
221 | return 0; | |
@@ -212,33 +225,36 int start_all_tasks() | |||||
212 | { |
|
225 | { | |
213 | rtems_status_code status; |
|
226 | rtems_status_code status; | |
214 |
|
227 | |||
215 |
status = rtems_task_start( Task_id[ |
|
228 | status = rtems_task_start( Task_id[TASKID_SPIQ], spiq_task, 1 ); | |
216 | if (status!=RTEMS_SUCCESSFUL) PRINTF("In INIT *** Error starting TASK_SPIQ\n") |
|
229 | if (status!=RTEMS_SUCCESSFUL) PRINTF("In INIT *** Error starting TASK_SPIQ\n") | |
217 |
|
230 | |||
218 |
status = rtems_task_start( Task_id[ |
|
231 | status = rtems_task_start( Task_id[TASKID_RECV], recv_task, 1 ); | |
219 | if (status!=RTEMS_SUCCESSFUL) PRINTF("In INIT *** Error starting TASK_RECV\n") |
|
232 | if (status!=RTEMS_SUCCESSFUL) PRINTF("In INIT *** Error starting TASK_RECV\n") | |
220 |
|
233 | |||
221 |
status = rtems_task_start( Task_id[ |
|
234 | status = rtems_task_start( Task_id[TASKID_ACTN], actn_task, 1 ); | |
222 | if (status!=RTEMS_SUCCESSFUL) PRINTF("In INIT *** Error starting TASK_ACTN\n") |
|
235 | if (status!=RTEMS_SUCCESSFUL) PRINTF("In INIT *** Error starting TASK_ACTN\n") | |
223 |
|
236 | |||
224 |
status = rtems_task_start( Task_id[ |
|
237 | status = rtems_task_start( Task_id[TASKID_SMIQ], smiq_task, 1 ); | |
225 | if (status!=RTEMS_SUCCESSFUL) PRINTF("In INIT *** Error starting TASK_BPPR\n") |
|
238 | if (status!=RTEMS_SUCCESSFUL) PRINTF("In INIT *** Error starting TASK_BPPR\n") | |
226 |
|
239 | |||
227 |
status = rtems_task_start( Task_id[ |
|
240 | status = rtems_task_start( Task_id[TASKID_STAT], stat_task, 1 ); | |
228 | if (status!=RTEMS_SUCCESSFUL) PRINTF("In INIT *** Error starting TASK_STAT\n") |
|
241 | if (status!=RTEMS_SUCCESSFUL) PRINTF("In INIT *** Error starting TASK_STAT\n") | |
229 |
|
242 | |||
230 |
status = rtems_task_start( Task_id[ |
|
243 | status = rtems_task_start( Task_id[TASKID_AVF0], avf0_task, 1 ); | |
231 | if (status!=RTEMS_SUCCESSFUL) PRINTF("In INIT *** Error starting TASK_AVF0\n") |
|
244 | if (status!=RTEMS_SUCCESSFUL) PRINTF("In INIT *** Error starting TASK_AVF0\n") | |
232 |
|
245 | |||
233 |
status = rtems_task_start( Task_id[ |
|
246 | status = rtems_task_start( Task_id[TASKID_BPF0], bpf0_task, 1 ); | |
234 | if (status!=RTEMS_SUCCESSFUL) PRINTF("In INIT *** Error starting TASK_BPF0\n") |
|
247 | if (status!=RTEMS_SUCCESSFUL) PRINTF("In INIT *** Error starting TASK_BPF0\n") | |
235 |
|
248 | |||
236 |
status = rtems_task_start( Task_id[ |
|
249 | status = rtems_task_start( Task_id[TASKID_WFRM], wfrm_task, 1 ); | |
237 | if (status!=RTEMS_SUCCESSFUL) PRINTF("In INIT *** Error starting TASK_WFRM\n") |
|
250 | if (status!=RTEMS_SUCCESSFUL) PRINTF("In INIT *** Error starting TASK_WFRM\n") | |
238 |
|
251 | |||
239 |
status = rtems_task_start( Task_id[ |
|
252 | status = rtems_task_start( Task_id[TASKID_DUMB], dumb_task, 1 ); | |
240 | if (status!=RTEMS_SUCCESSFUL) PRINTF("In INIT *** Error starting TASK_DUMB\n") |
|
253 | if (status!=RTEMS_SUCCESSFUL) PRINTF("In INIT *** Error starting TASK_DUMB\n") | |
241 |
|
254 | |||
|
255 | status = rtems_task_start( Task_id[TASKID_HOUS], hous_task, 1 ); | |||
|
256 | if (status!=RTEMS_SUCCESSFUL) PRINTF("In INIT *** Error starting TASK_HOUS\n") | |||
|
257 | ||||
242 | return 0; |
|
258 | return 0; | |
243 | } |
|
259 | } | |
244 |
|
260 | |||
@@ -269,7 +285,7 int configure_spw_link() | |||||
269 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_RXBLOCK, 1); // sets the blocking mode for reception |
|
285 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_RXBLOCK, 1); // sets the blocking mode for reception | |
270 | if (status!=RTEMS_SUCCESSFUL) PRINTF("In RECV *** Error SPACEWIRE_IOCTRL_SET_RXBLOCK\n") |
|
286 | if (status!=RTEMS_SUCCESSFUL) PRINTF("In RECV *** Error SPACEWIRE_IOCTRL_SET_RXBLOCK\n") | |
271 | // |
|
287 | // | |
272 |
status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_EVENT_ID, Task_id[ |
|
288 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_EVENT_ID, Task_id[TASKID_SPIQ]); // sets the task ID to which an event is sent when a | |
273 | if (status!=RTEMS_SUCCESSFUL) PRINTF("In RECV *** Error SPACEWIRE_IOCTRL_SET_EVENT_ID\n") // link-error interrupt occurs |
|
289 | if (status!=RTEMS_SUCCESSFUL) PRINTF("In RECV *** Error SPACEWIRE_IOCTRL_SET_EVENT_ID\n") // link-error interrupt occurs | |
274 | // |
|
290 | // | |
275 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_DISABLE_ERR, 1); // automatic link-disabling due to link-error interrupts |
|
291 | status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_DISABLE_ERR, 1); // automatic link-disabling due to link-error interrupts |
@@ -3,6 +3,8 | |||||
3 |
|
3 | |||
4 | extern rtems_id Task_id[]; /* array of task ids */ |
|
4 | extern rtems_id Task_id[]; /* array of task ids */ | |
5 | extern int fdSPW; |
|
5 | extern int fdSPW; | |
|
6 | extern TMHeader_t housekeeping_header; | |||
|
7 | extern char housekeeping_data[]; | |||
6 |
|
8 | |||
7 | int configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider, |
|
9 | int configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider, | |
8 | unsigned char interrupt_level, rtems_isr (*timer_isr)() ) |
|
10 | unsigned char interrupt_level, rtems_isr (*timer_isr)() ) | |
@@ -71,5 +73,66 rtems_task stat_task(rtems_task_argument | |||||
71 | else i++; |
|
73 | else i++; | |
72 | } |
|
74 | } | |
73 | } |
|
75 | } | |
|
76 | ||||
|
77 | rtems_task hous_task(rtems_task_argument argument) | |||
|
78 | { | |||
|
79 | rtems_status_code status; | |||
74 |
|
80 | |||
|
81 | spw_ioctl_pkt_send spw_ioctl_send; | |||
|
82 | ||||
|
83 | rtems_name name; | |||
|
84 | rtems_id period; | |||
|
85 | name = rtems_build_name( 'H', 'O', 'U', 'S' ); | |||
|
86 | status = rtems_rate_monotonic_create( name, &period ); | |||
|
87 | if( status != RTEMS_SUCCESSFUL ) { | |||
|
88 | printf( "rtems_rate_monotonic_create failed with status of %d\n", status ); | |||
|
89 | exit( 1 ); | |||
|
90 | } | |||
75 |
|
91 | |||
|
92 | // filling the structure for the spacewire transmission | |||
|
93 | spw_ioctl_send.hlen = TM_HEADER_LEN + 4; // + 4 is for the protocole extra header | |||
|
94 | spw_ioctl_send.hdr = (char*) &housekeeping_header; | |||
|
95 | spw_ioctl_send.dlen = LENGTH_TM_LFR_HK - 10 + 1; | |||
|
96 | spw_ioctl_send.data = housekeeping_data; | |||
|
97 | ||||
|
98 | housekeeping_header.targetLogicalAddress = CCSDS_DESTINATION_ID; | |||
|
99 | housekeeping_header.protocolIdentifier = 0x02; | |||
|
100 | housekeeping_header.reserved = 0x00; | |||
|
101 | housekeeping_header.userApplication = 0x00; | |||
|
102 | housekeeping_header.packetID[0] = 0x0c; | |||
|
103 | housekeeping_header.packetID[1] = 0xc4; | |||
|
104 | housekeeping_header.packetSequenceControl[0] = 0xc0; | |||
|
105 | housekeeping_header.packetSequenceControl[1] = 0x00; | |||
|
106 | housekeeping_header.packetLength[0] = 0x00; | |||
|
107 | housekeeping_header.packetLength[1] = 0x77; | |||
|
108 | housekeeping_header.dataFieldHeader[0] = 0x10; | |||
|
109 | housekeeping_header.dataFieldHeader[1] = 0x03; | |||
|
110 | housekeeping_header.dataFieldHeader[2] = 0x19; | |||
|
111 | housekeeping_header.dataFieldHeader[3] = 0x00; | |||
|
112 | ||||
|
113 | printf("In HOUS ***\n"); | |||
|
114 | ||||
|
115 | while(1){ // launch the rate monotonic task | |||
|
116 | if ( rtems_rate_monotonic_period( period, HK_PERIOD ) == RTEMS_TIMEOUT ){ | |||
|
117 | printf( "ERR *** in hous_task *** RTEMS_TIMEOUT\n" ); | |||
|
118 | break; | |||
|
119 | } | |||
|
120 | housekeeping_header.dataFieldHeader[4] = (unsigned char) (time_management_regs->coarse_time>>24); | |||
|
121 | housekeeping_header.dataFieldHeader[5] = (unsigned char) (time_management_regs->coarse_time>>16); | |||
|
122 | housekeeping_header.dataFieldHeader[6] = (unsigned char) (time_management_regs->coarse_time>>8); | |||
|
123 | housekeeping_header.dataFieldHeader[7] = (unsigned char) (time_management_regs->coarse_time); | |||
|
124 | housekeeping_header.dataFieldHeader[8] = (unsigned char) (time_management_regs->fine_time>>8); | |||
|
125 | housekeeping_header.dataFieldHeader[9] = (unsigned char) (time_management_regs->fine_time); | |||
|
126 | status = write_spw(&spw_ioctl_send); | |||
|
127 | } | |||
|
128 | ||||
|
129 | status = rtems_rate_monotonic_delete( period ); | |||
|
130 | if ( status != RTEMS_SUCCESSFUL ) { | |||
|
131 | printf( "rtems_rate_monotonic_delete failed with status of %d.\n", status ); | |||
|
132 | exit( 1 ); | |||
|
133 | } | |||
|
134 | status = rtems_task_delete( RTEMS_SELF ); // should not return | |||
|
135 | printf( "rtems_task_delete returned with status of %d.\n", status ); | |||
|
136 | exit( 1 ); | |||
|
137 | } | |||
|
138 |
General Comments 0
You need to be logged in to leave comments.
Login now