@@ -10,7 +10,7 | |||
|
10 | 10 | <Option output="bin/Debug/fsw" prefix_auto="1" extension_auto="1" /> |
|
11 | 11 | <Option object_output="obj/Debug/" /> |
|
12 | 12 | <Option type="1" /> |
|
13 | <Option compiler="sparcrtems446" /> | |
|
13 | <Option compiler="sparcrtemsgcc446" /> | |
|
14 | 14 | <Compiler> |
|
15 | 15 | <Add option="-fexpensive-optimizations" /> |
|
16 | 16 | <Add option="-O3" /> |
@@ -71,7 +71,7 1359377846 /opt/DEV_PLE/header/TC_handle | |||
|
71 | 71 | <stdio.h> |
|
72 | 72 | <ccsds_types.h> |
|
73 | 73 | |
|
74 |
1359 |
|
|
74 | 1359640245 /opt/DEV_PLE/header/ccsds_types.h | |
|
75 | 75 | |
|
76 | 76 | 1359365823 source:/opt/DEV_PLE/src/FSW-config.c |
|
77 | 77 | <drvmgr/ambapp_bus.h> |
@@ -142,12 +142,12 1359464346 /opt/DEV_PLE/header/fsw_main. | |||
|
142 | 142 | <wf_handler.h> |
|
143 | 143 | <grlib_regs.h> |
|
144 | 144 | |
|
145 |
1359 |
|
|
145 | 1359616894 /opt/DEV_PLE/header/fsw_params.h | |
|
146 | 146 | |
|
147 |
1359 |
|
|
147 | 1359614518 /opt/DEV_PLE/header/fsw_misc.h | |
|
148 | 148 | <rtems.h> |
|
149 | 149 | <stdio.h> |
|
150 |
<fsw_ |
|
|
150 | <fsw_init.h> | |
|
151 | 151 | <fsw_params.h> |
|
152 | 152 | <grlib_regs.h> |
|
153 | 153 | <grspw.h> |
@@ -155,38 +155,72 1359464293 /opt/DEV_PLE/header/fsw_misc. | |||
|
155 | 155 | |
|
156 | 156 | 1359440704 /opt/DEV_PLE/header/grlib_regs.h |
|
157 | 157 | |
|
158 |
13594 |
|
|
158 | 1359614517 /opt/DEV_PLE/header/fsw_processing.h | |
|
159 | 159 | <rtems.h> |
|
160 | 160 | <grlib_regs.h> |
|
161 | 161 | <fsw_params.h> |
|
162 | 162 | |
|
163 |
1359 |
|
|
163 | 1359643450 /opt/DEV_PLE/header/tc_handler.h | |
|
164 | <rtems.h> | |
|
164 | 165 | <stdio.h> |
|
166 | <unistd.h> | |
|
167 | <sys/ioctl.h> | |
|
165 | 168 | <ccsds_types.h> |
|
169 | <grspw.h> | |
|
170 | <fsw_init.h> | |
|
166 | 171 | |
|
167 |
1359 |
|
|
172 | 1359614518 /opt/DEV_PLE/header/wf_handler.h | |
|
168 | 173 | <rtems.h> |
|
169 | 174 | <fsw_params.h> |
|
170 | 175 | <grspw.h> |
|
171 | 176 | <grlib_regs.h> |
|
172 | 177 | <ccsds_types.h> |
|
173 | 178 | <stdio.h> |
|
174 |
<fsw_ |
|
|
179 | <fsw_init.h> | |
|
175 | 180 | |
|
176 | 181 | 1359365823 /opt/DEV_PLE/src/fsw_config.c |
|
177 | 182 | <drvmgr/ambapp_bus.h> |
|
178 | 183 | |
|
179 |
1359 |
|
|
184 | 1359614518 source:/opt/DEV_PLE/src/fsw_misc.c | |
|
180 | 185 | <fsw_misc.h> |
|
181 | 186 | <fsw_params.h> |
|
182 | 187 | |
|
183 |
1359 |
|
|
188 | 1359643720 source:/opt/DEV_PLE/src/tc_handler.c | |
|
184 | 189 | <tc_handler.h> |
|
185 | 190 | <fsw_params.h> |
|
186 | 191 | |
|
187 |
1359 |
|
|
192 | 1359614518 source:/opt/DEV_PLE/src/wf_handler.c | |
|
188 | 193 | <wf_handler.h> |
|
189 | 194 | |
|
190 |
1359 |
|
|
195 | 1359615705 source:/opt/DEV_PLE/src/fsw_globals.c | |
|
191 | 196 | <fsw_processing.h> |
|
197 | <rtems.h> | |
|
192 | 198 | |
|
199 | 1359622160 source:/opt/DEV_PLE/src/fsw_init.c | |
|
200 | <rtems.h> | |
|
201 | <bsp.h> | |
|
202 | <rtems/confdefs.h> | |
|
203 | <drvmgr/drvmgr_confdefs.h> | |
|
204 | <fsw_init.h> | |
|
205 | <fsw_config.c> | |
|
206 | ||
|
207 | 1359615705 /opt/DEV_PLE/header/fsw_init.h | |
|
208 | <errno.h> | |
|
209 | <fcntl.h> | |
|
210 | <stdio.h> | |
|
211 | <stdlib.h> | |
|
212 | <grspw.h> | |
|
213 | <apbuart.h> | |
|
214 | <fsw_params.h> | |
|
215 | <fsw_misc.h> | |
|
216 | <fsw_processing.h> | |
|
217 | <tc_handler.h> | |
|
218 | <wf_handler.h> | |
|
219 | <grlib_regs.h> | |
|
220 | ||
|
221 | 1359614518 source:/opt/DEV_PLE/src/fsw_processing.c | |
|
222 | <fsw_processing.h> | |
|
223 | <math.h> | |
|
224 | <stdio.h> | |
|
225 | <leon.h> | |
|
226 |
@@ -25,8 +25,13 | |||
|
25 | 25 | <File name="../src/fsw_globals.c" open="1" top="0" tabpos="4"> |
|
26 | 26 | <Cursor position="46" topLine="0" /> |
|
27 | 27 | </File> |
|
28 | <<<<<<< local | |
|
29 | <File name="../src/fsw_init.c" open="1" top="1" tabpos="0"> | |
|
30 | <Cursor position="1703" topLine="36" /> | |
|
31 | ======= | |
|
28 | 32 | <File name="../src/fsw_init.c" open="1" top="1" tabpos="2"> |
|
29 | 33 | <Cursor position="3361" topLine="60" /> |
|
34 | >>>>>>> other | |
|
30 | 35 | </File> |
|
31 | 36 | <File name="../src/fsw_misc.c" open="0" top="0" tabpos="0"> |
|
32 | 37 | <Cursor position="20" topLine="0" /> |
@@ -34,8 +39,13 | |||
|
34 | 39 | <File name="../src/fsw_processing.c" open="0" top="0" tabpos="2"> |
|
35 | 40 | <Cursor position="1175" topLine="46" /> |
|
36 | 41 | </File> |
|
42 | <<<<<<< local | |
|
43 | <File name="../src/tc_handler.c" open="0" top="0" tabpos="3"> | |
|
44 | <Cursor position="2672" topLine="26" /> | |
|
45 | ======= | |
|
37 | 46 | <File name="../src/tc_handler.c" open="1" top="0" tabpos="1"> |
|
38 | 47 | <Cursor position="11070" topLine="270" /> |
|
48 | >>>>>>> other | |
|
39 | 49 | </File> |
|
40 | 50 | <File name="../src/wf_handler.c" open="0" top="0" tabpos="0"> |
|
41 | 51 | <Cursor position="3936" topLine="62" /> |
|
1 | NO CONTENT: modified file, binary diff hidden |
@@ -4,7 +4,7 | |||
|
4 | 4 | #define CCSDS_TELEMETRY_HEADER_LENGTH 16+4 |
|
5 | 5 | #define CCSDS_TM_PKT_MAX_SIZE 4412 |
|
6 | 6 | #define CCSDS_TELECOMMAND_HEADER_LENGTH 10+4 |
|
7 | #define CCSDS_TC_PKT_MAX_SIZE 248 | |
|
7 | #define CCSDS_TC_PKT_MAX_SIZE 50 // size of the TC_LFR_UPDATE_INFO packet | |
|
8 | 8 | #define CCSDS_TC_TM_PACKET_OFFSET 7 |
|
9 | 9 | #define CCSDS_PROCESS_ID 76 |
|
10 | 10 | #define CCSDS_PACKET_CATEGORY 12 |
@@ -30,19 +30,20 | |||
|
30 | 30 | #define FAIL_DETECTED 40003 |
|
31 | 31 | #define NOT_ALLOWED 40004 |
|
32 | 32 | #define CORRUPTED 40005 |
|
33 | // | |
|
34 | #define SID_TC_RESET 3 | |
|
35 | #define SID_TC_LOAD_COMM 20 | |
|
36 |
#define |
|
|
37 |
#define |
|
|
38 |
#define |
|
|
39 |
#define |
|
|
40 | #define SID_TC_DUMP 30 | |
|
41 | #define SID_TC_ENTER 40 | |
|
42 | #define SID_TC_UPDT_INFO 50 | |
|
43 | #define SID_TC_EN_CAL 60 | |
|
44 |
#define |
|
|
45 | #define SID_TC_UPDT_TIME 129 | |
|
33 | ||
|
34 | // // TC SUBTYPES | |
|
35 | #define TC_SUBTYPE_RESET 3 | |
|
36 | #define TC_SUBTYPE_LOAD_COMM 20 | |
|
37 | #define TC_SUBTYPE_LOAD_NORM 21 | |
|
38 | #define TC_SUBTYPE_LOAD_BURST 24 | |
|
39 | #define TC_SUBTYPE_LOAD_SBM1 27 | |
|
40 | #define TC_SUBTYPE_LOAD_SBM2 28 | |
|
41 | #define TC_SUBTYPE_DUMP 30 | |
|
42 | #define TC_SUBTYPE_ENTER 40 | |
|
43 | #define TC_SUBTYPE_UPDT_INFO 50 | |
|
44 | #define TC_SUBTYPE_EN_CAL 60 | |
|
45 | #define TC_SUBTYPE_DIS_CAL 61 | |
|
46 | #define TC_SUBTYPE_UPDT_TIME 129 | |
|
46 | 47 | |
|
47 | 48 | #define SID_DEFAULT 0 |
|
48 | 49 | #define SID_EXE_INC 5 |
@@ -55,6 +56,28 | |||
|
55 | 56 | #define SID_NORM_SWF_F1 4 |
|
56 | 57 | #define SID_NORM_SWF_F2 5 |
|
57 | 58 | #define SID_NORM_CWF_F3 1 |
|
59 | #define SID_BURST_CWF_F2 2 | |
|
60 | #define SID_SBM1_CWF_F1 24 | |
|
61 | #define SID_SBM2_CWF_F2 25 | |
|
62 | #define SID_NORM_ASM_F0 11 | |
|
63 | #define SID_NORM_ASM_F1 12 | |
|
64 | #define SID_NORM_ASM_F2 13 | |
|
65 | #define SID_NORM_BP1_F0 14 | |
|
66 | #define SID_NORM_BP1_F1 15 | |
|
67 | #define SID_NORM_BP1_F2 16 | |
|
68 | #define SID_NORM_BP2_F0 19 | |
|
69 | #define SID_NORM_BP2_F1 20 | |
|
70 | #define SID_NORM_BP2_F2 21 | |
|
71 | #define SID_BURST_BP1_F0 17 | |
|
72 | #define SID_BURST_BP2_F0 22 | |
|
73 | #define SID_BURST_BP1_F1 18 | |
|
74 | #define SID_BURST_BP2_F1 23 | |
|
75 | #define SID_SBM1_BP1_F0 28 | |
|
76 | #define SID_SBM1_BP2_F0 31 | |
|
77 | #define SID_SBM2_BP1_F0 29 | |
|
78 | #define SID_SBM2_BP2_F0 32 | |
|
79 | #define SID_SBM1_BP1_F1 30 | |
|
80 | #define SID_SBM1_BP2_F1 33 | |
|
58 | 81 | |
|
59 | 82 | #define TM_LEN_EXE 20 - CCSDS_TC_TM_PACKET_OFFSET |
|
60 | 83 | #define TM_LEN_NOT_EXE 26 - CCSDS_TC_TM_PACKET_OFFSET |
@@ -18,14 +18,18 | |||
|
18 | 18 | |
|
19 | 19 | extern int sched_yield(); |
|
20 | 20 | extern int errno; |
|
21 | extern rtems_name misc_names[ ]; | |
|
21 | extern rtems_id Task_id[ ]; /* array of task ids */ | |
|
22 | extern rtems_name Task_name[ ]; /* array of task names */ | |
|
23 | extern rtems_name misc_name[ ]; /* arry of miscellaneous names for rtems objects */ | |
|
24 | extern int fdSPW; // grspw file descriptor | |
|
25 | extern int fdUART; // uart file descriptor | |
|
22 | 26 | |
|
23 | 27 | // RTEMS TASKS |
|
24 | 28 | rtems_task Init( rtems_task_argument argument); /* forward declaration needed */ |
|
25 |
rtems_task |
|
|
26 |
rtems_task |
|
|
27 |
rtems_task |
|
|
28 |
rtems_task |
|
|
29 | rtems_task recv_task(rtems_task_argument argument); | |
|
30 | rtems_task spiq_task(rtems_task_argument argument); | |
|
31 | rtems_task stat_task(rtems_task_argument argument); | |
|
32 | rtems_task wfrm_task(rtems_task_argument argument); | |
|
29 | 33 | int create_all_tasks(); |
|
30 | 34 | int start_all_tasks(); |
|
31 | 35 | int create_message_queue(); |
@@ -14,6 +14,6 int configure_timer(gptimer_regs_t *gpti | |||
|
14 | 14 | unsigned char interrupt_level, rtems_isr (*timer_isr)() ); |
|
15 | 15 | void print_statistics(spw_stats *stats); |
|
16 | 16 | int send_console_outputs_on_serial_port(); |
|
17 |
rtems_task |
|
|
17 | rtems_task stat_task(rtems_task_argument argument); | |
|
18 | 18 | |
|
19 | 19 | #endif // FSW_MISC_H_INCLUDED |
@@ -4,6 +4,8 | |||
|
4 | 4 | #define GRSPW_DEVICE_NAME "/dev/grspw0" |
|
5 | 5 | #define UART_DEVICE_NAME "/dev/console" |
|
6 | 6 | |
|
7 | //***************************** | |
|
8 | // APB REGISTERS BASE ADDRESSES | |
|
7 | 9 | #define REGS_ADDR_APBUART 0x80000100 |
|
8 | 10 | #define REGS_ADDR_GPTIMER 0x80000300 |
|
9 | 11 | #define REGS_ADDR_GRSPW 0x80000500 |
@@ -21,7 +23,10 | |||
|
21 | 23 | #define TIMER_SM_SIMULATOR 1 |
|
22 | 24 | #define TIMER_WF_SIMULATOR 2 |
|
23 | 25 | |
|
26 | //****** | |
|
27 | // RTEMS | |
|
24 | 28 | #define TASKID_RECV 1 |
|
29 | #define TASKID_ACTN 1 | |
|
25 | 30 | #define TASKID_SPIQ 3 |
|
26 | 31 | #define TASKID_SMIQ 4 |
|
27 | 32 | #define TASKID_STAT 5 |
@@ -29,6 +34,10 | |||
|
29 | 34 | #define TASKID_BPF0 7 |
|
30 | 35 | #define TASKID_WFRM 8 |
|
31 | 36 | |
|
37 | #define ACTION_MSG_QUEUE_COUNT 10 | |
|
38 | ||
|
39 | //******* | |
|
40 | // MACROS | |
|
32 | 41 | #define PRINT_MESSAGES_ON_CONSOLE // enable or disable the printf instructions |
|
33 | 42 | #ifdef PRINT_MESSAGES_ON_CONSOLE |
|
34 | 43 | #define PRINTF(x) printf(x); |
@@ -30,9 +30,9 typedef struct BP1_str BP1_t; | |||
|
30 | 30 | rtems_isr spectral_matrices_isr( rtems_vector_number vector ); |
|
31 | 31 | // RTEMS TASKS |
|
32 | 32 | rtems_task spw_bppr_task(rtems_task_argument argument); |
|
33 |
rtems_task |
|
|
34 |
rtems_task |
|
|
35 |
rtems_task |
|
|
33 | rtems_task avf0_task(rtems_task_argument argument); | |
|
34 | rtems_task bpf0_task(rtems_task_argument argument); | |
|
35 | rtems_task smiq_task(rtems_task_argument argument); // added to test the spectral matrix simulator | |
|
36 | 36 | // |
|
37 | 37 | rtems_task spw_bppr_task_rate_monotonic(rtems_task_argument argument); |
|
38 | 38 | void matrix_average(volatile int *spec_mat, float *averaged_spec_mat); |
@@ -7,8 +7,11 | |||
|
7 | 7 | #include <sys/ioctl.h> // for the ioctl call |
|
8 | 8 | #include <ccsds_types.h> |
|
9 | 9 | #include <grspw.h> |
|
10 | #include <fsw_init.h> | |
|
10 | 11 | |
|
11 | 12 | extern int fdSPW; |
|
13 | extern rtems_name misc_name[ ]; | |
|
14 | extern rtems_name misc_id[ ]; | |
|
12 | 15 | extern rtems_id Task_id[ ]; /* array of task ids */ |
|
13 | 16 | |
|
14 | 17 | unsigned char currentTC_LEN_RCV[2]; // SHALL be equal to the current TC packet estimated packet length field |
@@ -25,16 +28,21 void GetCRCAsTwoBytes(unsigned char* dat | |||
|
25 | 28 | |
|
26 | 29 | //********************* |
|
27 | 30 | // ACCEPTANCE FUNCTIONS |
|
28 |
unsigned char acceptTM(ccsdsTelecommandPacket_t * TMPacket, unsigned int |
|
|
31 | unsigned char acceptTM(ccsdsTelecommandPacket_t * TMPacket, unsigned int tc_len_recv); | |
|
29 | 32 | |
|
30 | 33 | unsigned char TM_build_header( enum TM_TYPE tm_type, unsigned int SID, unsigned int packetLength, |
|
31 | 34 | unsigned int coarseTime, unsigned int fineTime, TMHeader_t *TMHeader); |
|
32 | 35 | unsigned char TM_build_data(ccsdsTelecommandPacket_t *TC, char* data, unsigned int SID, unsigned char *computed_CRC); |
|
33 |
|
|
|
34 | TMHeader_t *TM_Header, unsigned int *hlen, char *data); | |
|
36 | int TC_checker(ccsdsTelecommandPacket_t *TC, unsigned int TC_LEN_RCV); | |
|
35 | 37 | |
|
36 | 38 | //*********** |
|
37 | 39 | // RTEMS TASK |
|
38 |
rtems_task |
|
|
40 | rtems_task recv_task( rtems_task_argument unused ); | |
|
41 | rtems_task actn_task( rtems_task_argument unused ); | |
|
42 | int create_message_queue(); | |
|
43 | ||
|
44 | //*********** | |
|
45 | // TC ACTIONS | |
|
46 | int default_action(ccsdsTelecommandPacket_t *TC); | |
|
39 | 47 | |
|
40 | 48 | #endif // TC_HANDLER_H_INCLUDED |
@@ -15,6 +15,6 extern rtems_id Task_id[]; /* ar | |||
|
15 | 15 | extern int fdSPW; |
|
16 | 16 | |
|
17 | 17 | rtems_isr waveforms_isr( rtems_vector_number vector ); |
|
18 |
rtems_task |
|
|
18 | rtems_task wfrm_task(rtems_task_argument argument); | |
|
19 | 19 | |
|
20 | 20 | #endif // WF_HANDLER_H_INCLUDED |
@@ -2,7 +2,12 | |||
|
2 | 2 | #include <rtems.h> |
|
3 | 3 | |
|
4 | 4 | // RTEMS GLOBAL VARIABLES |
|
5 |
rtems_name misc_name |
|
|
5 | rtems_name misc_name[5]; | |
|
6 | rtems_name misc_id[5]; | |
|
7 | rtems_id Task_id[10]; /* array of task ids */ | |
|
8 | rtems_name Task_name[10]; /* array of task names */ | |
|
9 | int fdSPW; | |
|
10 | int fdUART; | |
|
6 | 11 | |
|
7 | 12 | // WAVEFORMS GLOBAL VARIABLES |
|
8 | 13 | volatile int wf_snap_f0[ NB_SAMPLES_PER_SNAPSHOT * NB_BYTES_SWF_BLK ]; // 24576 bytes |
@@ -22,6 +22,7 | |||
|
22 | 22 | #define CONFIGURE_INIT_TASK_PRIORITY 100 |
|
23 | 23 | #define CONFIGURE_MAXIMUM_DRIVERS 16 |
|
24 | 24 | #define CONFIGURE_MAXIMUM_PERIODS 1 |
|
25 | #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 1 | |
|
25 | 26 | |
|
26 | 27 | #include <rtems/confdefs.h> |
|
27 | 28 | |
@@ -41,10 +42,7 | |||
|
41 | 42 | #endif |
|
42 | 43 | |
|
43 | 44 | #include <fsw_init.h> |
|
44 | #include <fsw_config.c> | |
|
45 | ||
|
46 | int fdSPW; | |
|
47 | int fdUART; | |
|
45 | #include <fsw_config.c> | |
|
48 | 46 | |
|
49 | 47 | char *link_status(int status); |
|
50 | 48 | |
@@ -55,9 +53,6 char *lstates[6] = {"Error-reset", | |||
|
55 | 53 | "Connecting", |
|
56 | 54 | "Run" |
|
57 | 55 | }; |
|
58 | ||
|
59 | rtems_id Task_id[10]; /* array of task ids */ | |
|
60 | rtems_name Task_name[10]; /* array of task names */ | |
|
61 | 56 | |
|
62 | 57 | rtems_task Init( rtems_task_argument ignored ) |
|
63 | 58 | { |
@@ -85,7 +80,7 rtems_task Init( rtems_task_argument ign | |||
|
85 | 80 | status = rtems_task_delete(RTEMS_SELF); |
|
86 | 81 | } |
|
87 | 82 | |
|
88 |
rtems_task |
|
|
83 | rtems_task spiq_task(rtems_task_argument unused) | |
|
89 | 84 | { |
|
90 | 85 | rtems_event_set event_out; |
|
91 | 86 | struct grspw_regs_str *grspw_regs; |
@@ -105,17 +100,12 rtems_task spw_spiq_task(rtems_task_argu | |||
|
105 | 100 | } |
|
106 | 101 | } |
|
107 | 102 | |
|
108 | int create_message_queue() | |
|
109 | { | |
|
110 | misc_names[0] = rtems_build_name( 'D', 'O', 'I', 'T' ); | |
|
111 | return 0; | |
|
112 | } | |
|
113 | ||
|
114 | 103 | int create_all_tasks() |
|
115 | 104 | { |
|
116 | 105 | rtems_status_code status; |
|
117 | 106 | |
|
118 | Task_name[1] = rtems_build_name( 'R', 'E', 'C', 'V' ); | |
|
107 | Task_name[1] = rtems_build_name( 'R', 'E', 'C', 'V' ); | |
|
108 | Task_name[2] = rtems_build_name( 'A', 'C', 'T', 'N' ); | |
|
119 | 109 | Task_name[3] = rtems_build_name( 'S', 'P', 'I', 'Q' ); |
|
120 | 110 | Task_name[4] = rtems_build_name( 'S', 'M', 'I', 'Q' ); |
|
121 | 111 | Task_name[5] = rtems_build_name( 'S', 'T', 'A', 'T' ); |
@@ -128,6 +118,12 int create_all_tasks() | |||
|
128 | 118 | Task_name[1], 200, RTEMS_MINIMUM_STACK_SIZE * 2, |
|
129 | 119 | RTEMS_DEFAULT_MODES, |
|
130 | 120 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[1] |
|
121 | ); | |
|
122 | // ACTN | |
|
123 | status = rtems_task_create( | |
|
124 | Task_name[2], 50, RTEMS_MINIMUM_STACK_SIZE * 2, | |
|
125 | RTEMS_DEFAULT_MODES, | |
|
126 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[2] | |
|
131 | 127 | ); |
|
132 | 128 | // SPIQ |
|
133 | 129 | status = rtems_task_create( |
@@ -173,26 +169,28 int start_all_tasks() | |||
|
173 | 169 | { |
|
174 | 170 | rtems_status_code status; |
|
175 | 171 | |
|
176 |
status = rtems_task_start( Task_id[3], |
|
|
172 | status = rtems_task_start( Task_id[3], spiq_task, 1 ); | |
|
177 | 173 | if (status!=RTEMS_SUCCESSFUL) PRINTF("In INIT *** Error starting TASK_SPIQ\n") |
|
178 | 174 | |
|
179 |
status = rtems_task_start( Task_id[1], |
|
|
180 | if (status!=RTEMS_SUCCESSFUL) PRINTF("In INIT *** Error starting TASK_RECV\n") | |
|
175 | status = rtems_task_start( Task_id[1], recv_task, 1 ); | |
|
176 | if (status!=RTEMS_SUCCESSFUL) PRINTF("In INIT *** Error starting TASK_RECV\n") | |
|
181 | 177 | |
|
182 |
|
|
|
183 | status = rtems_task_start( Task_id[4], spw_smiq_task, 1 ); | |
|
178 | status = rtems_task_start( Task_id[2], actn_task, 1 ); | |
|
179 | if (status!=RTEMS_SUCCESSFUL) PRINTF("In INIT *** Error starting TASK_ACTN\n") | |
|
180 | ||
|
181 | status = rtems_task_start( Task_id[4], smiq_task, 1 ); | |
|
184 | 182 | if (status!=RTEMS_SUCCESSFUL) PRINTF("In INIT *** Error starting TASK_BPPR\n") |
|
185 | 183 | |
|
186 |
status = rtems_task_start( Task_id[5], |
|
|
184 | status = rtems_task_start( Task_id[5], stat_task, 1 ); | |
|
187 | 185 | if (status!=RTEMS_SUCCESSFUL) PRINTF("In INIT *** Error starting TASK_STAT\n") |
|
188 | 186 | |
|
189 |
status = rtems_task_start( Task_id[6], |
|
|
187 | status = rtems_task_start( Task_id[6], avf0_task, 1 ); | |
|
190 | 188 | if (status!=RTEMS_SUCCESSFUL) PRINTF("In INIT *** Error starting TASK_AVF0\n") |
|
191 | 189 | |
|
192 |
status = rtems_task_start( Task_id[7], |
|
|
190 | status = rtems_task_start( Task_id[7], bpf0_task, 1 ); | |
|
193 | 191 | if (status!=RTEMS_SUCCESSFUL) PRINTF("In INIT *** Error starting TASK_BPF0\n") |
|
194 | 192 | |
|
195 |
status = rtems_task_start( Task_id[8], |
|
|
193 | status = rtems_task_start( Task_id[8], wfrm_task, 1 ); | |
|
196 | 194 | if (status!=RTEMS_SUCCESSFUL) PRINTF("In INIT *** Error starting TASK_WFRM\n") |
|
197 | 195 | |
|
198 | 196 | return 0; |
@@ -53,7 +53,7 int send_console_outputs_on_serial_port( | |||
|
53 | 53 | return 0; |
|
54 | 54 | } |
|
55 | 55 | |
|
56 |
rtems_task |
|
|
56 | rtems_task stat_task(rtems_task_argument argument) | |
|
57 | 57 | { |
|
58 | 58 | int i; |
|
59 | 59 | i = 0; |
@@ -56,7 +56,7 rtems_isr spectral_matrices_isr( rtems_v | |||
|
56 | 56 | printf("In spectral_matrices_isr *** Error sending event to AVF0\n"); |
|
57 | 57 | } |
|
58 | 58 | |
|
59 |
rtems_task |
|
|
59 | rtems_task smiq_task(rtems_task_argument argument) // process the Spectral Matrices IRQ | |
|
60 | 60 | { |
|
61 | 61 | rtems_event_set event_out; |
|
62 | 62 | gptimer_regs_t *gptimer_regs; |
@@ -68,7 +68,7 rtems_task spw_smiq_task(rtems_task_argu | |||
|
68 | 68 | nb_interrupt_f0 = nb_interrupt_f0 + 1; |
|
69 | 69 | if (nb_interrupt_f0 == (NB_SM_TO_RECEIVE_BEFORE_AVF0-1) ){ |
|
70 | 70 | if (rtems_event_send( Task_id[6], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) |
|
71 |
printf("In s |
|
|
71 | printf("In smiq_task *** Error sending event to AVF0\n"); | |
|
72 | 72 | nb_interrupt_f0 = 0; |
|
73 | 73 | } |
|
74 | 74 | gptimer_regs->timer[1].ctrl = gptimer_regs->timer[1].ctrl | 0x00000010; |
@@ -329,7 +329,7 void BP2_set(float * compressed_spec_mat | |||
|
329 | 329 | } |
|
330 | 330 | } |
|
331 | 331 | |
|
332 |
rtems_task |
|
|
332 | rtems_task avf0_task(rtems_task_argument argument){ | |
|
333 | 333 | int i; |
|
334 | 334 | static int nb_average; |
|
335 | 335 | rtems_event_set event_out; |
@@ -365,7 +365,7 rtems_task spw_avf0_task(rtems_task_argu | |||
|
365 | 365 | } |
|
366 | 366 | } |
|
367 | 367 | |
|
368 |
rtems_task |
|
|
368 | rtems_task bpf0_task(rtems_task_argument argument){ | |
|
369 | 369 | rtems_event_set event_out; |
|
370 | 370 | |
|
371 | 371 | while(1){ |
@@ -51,43 +51,37 void GetCRCAsTwoBytes(unsigned char* dat | |||
|
51 | 51 | |
|
52 | 52 | //********************* |
|
53 | 53 | // ACCEPTANCE FUNCTIONS |
|
54 |
|
|
|
55 | TMHeader_t *TM_Header, unsigned int *hlen, char *data) | |
|
54 | int TC_checker(ccsdsTelecommandPacket_t *TC, unsigned int tc_len_recv) | |
|
56 | 55 | { |
|
56 | rtems_status_code status; | |
|
57 | spw_ioctl_pkt_send spw_ioctl_send; | |
|
58 | TMHeader_t TM_header; | |
|
57 | 59 | unsigned int code = 0; |
|
58 | unsigned int data_length = 0; | |
|
59 | 60 | unsigned char computed_CRC[2]; |
|
60 | unsigned char subtype = 0; | |
|
61 | char data[ TM_LEN_EXE_CORR + CCSDS_TC_TM_PACKET_OFFSET - TM_HEADER_LEN ]; | |
|
61 | 62 | |
|
62 | subtype = TC->dataFieldHeader[2]; | |
|
63 | GetCRCAsTwoBytes( (unsigned char*) TC->packetID, computed_CRC, TC_LEN_RCV + 5 ); | |
|
64 | code = acceptTM( TC, TC_LEN_RCV ) ; | |
|
65 | //PRINTF1("in TC_checker *** %s\n", errorCCSDSMsg[code]); | |
|
63 | GetCRCAsTwoBytes( (unsigned char*) TC->packetID, computed_CRC, tc_len_recv + 5 ); | |
|
64 | code = acceptTM( TC, tc_len_recv ) ; | |
|
66 | 65 | if ( (code == 0) | (code == 1) | (code == 2) |
|
67 | 66 | | (code == 3) | (code == 4) | (code == 5) ) |
|
68 | 67 | { // generate TM_LFR_TC_EXE_CORRUPTED |
|
69 | 68 | // BUILD HEADER |
|
70 |
TM_build_header( TM_LFR_TC_EXE_ERR, SID_EXE_CORR, TM_LEN_EXE_CORR, 0, 0, |
|
|
69 | TM_build_header( TM_LFR_TC_EXE_ERR, SID_EXE_CORR, TM_LEN_EXE_CORR, 0, 0, &TM_header); | |
|
71 | 70 | // BUILD DATA |
|
72 | 71 | TM_build_data( TC, data, SID_EXE_CORR, computed_CRC); |
|
73 | data_length = TM_LEN_EXE_CORR + CCSDS_TC_TM_PACKET_OFFSET - TM_HEADER_LEN; | |
|
74 | } | |
|
75 | if (subtype == SID_TC_UPDT_TIME){ | |
|
76 | // BUILD HEADER | |
|
77 | TM_build_header( TM_LFR_TC_EXE_OK, SID_DEFAULT, TM_LEN_EXE, 0, 0, TM_Header); | |
|
78 |
// |
|
|
79 | TM_build_data( TC, data, SID_DEFAULT, computed_CRC); | |
|
80 | data_length = TM_LEN_NOT_IMP + CCSDS_TC_TM_PACKET_OFFSET - TM_HEADER_LEN; | |
|
72 | // PREPARE TM SENDING | |
|
73 | spw_ioctl_send.hlen = TM_HEADER_LEN + 4; // + 4 is for the protocole extra header | |
|
74 | spw_ioctl_send.hdr = (char*) &TM_header; | |
|
75 | spw_ioctl_send.dlen = TM_LEN_EXE_CORR + CCSDS_TC_TM_PACKET_OFFSET - TM_HEADER_LEN; | |
|
76 | spw_ioctl_send.data = data; | |
|
77 | // SEND PACKET | |
|
78 | write_spw(&spw_ioctl_send); | |
|
81 | 79 | } |
|
82 | 80 | else { // TM_LFR_TC_EXE_NOT_IMPLEMENTED |
|
83 | // BUILD HEADER | |
|
84 | TM_build_header( TM_LFR_TC_EXE_ERR, SID_NOT_IMP, TM_LEN_NOT_IMP, 0, 0, TM_Header); | |
|
85 | // BUILD DATA | |
|
86 | TM_build_data( TC, data, SID_NOT_IMP, computed_CRC); | |
|
87 | data_length = TM_LEN_NOT_IMP + CCSDS_TC_TM_PACKET_OFFSET - TM_HEADER_LEN; | |
|
81 | status = rtems_message_queue_send( misc_id[0], TC, tc_len_recv + CCSDS_TC_TM_PACKET_OFFSET); | |
|
82 | return -1; | |
|
88 | 83 | } |
|
89 | ||
|
90 | return data_length; | |
|
84 | return -1; | |
|
91 | 85 | } |
|
92 | 86 | |
|
93 | 87 | unsigned char acceptTM(ccsdsTelecommandPacket_t * TMPacket, unsigned int TC_LEN_RCV) |
@@ -276,29 +270,22 unsigned char TM_build_data(ccsdsTelecom | |||
|
276 | 270 | return 1; |
|
277 | 271 | } |
|
278 | 272 | |
|
279 | unsigned char actionLauncher(unsigned int sid) | |
|
280 | { | |
|
281 | return 0; | |
|
282 | } | |
|
283 | ||
|
284 | 273 | //*********** |
|
285 | 274 | // RTEMS TASK |
|
286 |
rtems_task |
|
|
287 | { | |
|
288 | rtems_status_code status; | |
|
275 | rtems_task recv_task( rtems_task_argument unused ) | |
|
276 | { | |
|
289 | 277 | int len = 0; |
|
290 | 278 | unsigned int i = 0; |
|
291 | 279 | unsigned int data_length = 0; |
|
292 | 280 | ccsdsTelecommandPacket_t currentTC; |
|
293 | spw_ioctl_pkt_send spw_ioctl_send; | |
|
294 | TMHeader_t TM_header; | |
|
295 | 281 | char data[100]; |
|
296 | 282 | |
|
297 | 283 | for(i=0; i<100; i++) data[i] = 0; |
|
298 | 284 | |
|
299 | 285 | PRINTF("In RECV *** \n") |
|
300 | 286 | |
|
301 |
while(1) |
|
|
287 | while(1) | |
|
288 | { | |
|
302 | 289 | len = read(fdSPW, (char*) ¤tTC, CCSDS_TC_PKT_MAX_SIZE); // the call to read is blocking |
|
303 | 290 | if (len == -1){ // error during the read call |
|
304 | 291 | PRINTF("In RECV *** last read call returned -1\n") |
@@ -313,19 +300,97 rtems_task spw_recv_task( rtems_task_arg | |||
|
313 | 300 | currentTC_LEN_RCV[1] = (unsigned char) len - CCSDS_TC_TM_PACKET_OFFSET - 3; // build the corresponding packet size field |
|
314 | 301 | currentTC_LEN_RCV_AsUnsignedInt = (unsigned int) len - CCSDS_TC_TM_PACKET_OFFSET - 3; // => -3 is for Prot ID, Reserved and User App bytes |
|
315 | 302 | // CHECK THE TC AND BUILD THE APPROPRIATE TM |
|
316 |
data_length = TC_checker(¤tTC, currentTC_LEN_RCV_AsUnsignedInt |
|
|
317 | &TM_header, &spw_ioctl_send.hlen, data); | |
|
318 | spw_ioctl_send.hlen = TM_HEADER_LEN + 4; // + 4 is for the protocole extra header | |
|
319 | spw_ioctl_send.hdr = (char*) &TM_header; | |
|
320 | spw_ioctl_send.dlen = data_length; | |
|
321 | spw_ioctl_send.data = data; | |
|
322 | //printf("hlen %d, dlen %d\n", spw_ioctl_send.hlen, spw_ioctl_send.dlen); | |
|
323 | // SEND PACKET | |
|
324 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_SEND, &spw_ioctl_send ); | |
|
325 | if (status!=RTEMS_SUCCESSFUL) printf("In TC_checker *** Error SPACEWIRE_IOCTRL_SEND\n"); | |
|
326 | //PRINTF1("In TC_checker *** packet of size %d sent\n", spw_ioctl_send.sent) | |
|
303 | data_length = TC_checker(¤tTC, currentTC_LEN_RCV_AsUnsignedInt); | |
|
304 | if (data_length!=-1) | |
|
305 | { | |
|
306 | } | |
|
327 | 307 | } |
|
328 | 308 | } |
|
329 | 309 | } |
|
330 | 310 | |
|
311 | rtems_task actn_task( rtems_task_argument unused ) | |
|
312 | { | |
|
313 | rtems_status_code status; // RTEMS status code | |
|
314 | ccsdsTelecommandPacket_t TC; // TC sent to the ACTN task | |
|
315 | size_t size; // size of the incoming TC packet | |
|
316 | unsigned char subtype = 0; // subtype of the current TC packet | |
|
331 | 317 | |
|
318 | while(1) | |
|
319 | { | |
|
320 | status = rtems_message_queue_receive(misc_id[0], (char*) &TC, &size, | |
|
321 | RTEMS_WAIT, RTEMS_NO_TIMEOUT); | |
|
322 | if (status!=RTEMS_SUCCESSFUL) PRINTF1("in task ACTN *** error receiving a message, code %d \n", status) | |
|
323 | else | |
|
324 | { | |
|
325 | subtype = TC.dataFieldHeader[2]; | |
|
326 | switch(subtype) | |
|
327 | { | |
|
328 | case TC_SUBTYPE_RESET: | |
|
329 | break; | |
|
330 | case TC_SUBTYPE_LOAD_COMM: | |
|
331 | break; | |
|
332 | case TC_SUBTYPE_LOAD_NORM: | |
|
333 | break; | |
|
334 | case TC_SUBTYPE_LOAD_BURST: | |
|
335 | break; | |
|
336 | case TC_SUBTYPE_LOAD_SBM1: | |
|
337 | break; | |
|
338 | case TC_SUBTYPE_LOAD_SBM2: | |
|
339 | break; | |
|
340 | case TC_SUBTYPE_DUMP: | |
|
341 | default_action( &TC ); | |
|
342 | break; | |
|
343 | case TC_SUBTYPE_ENTER: | |
|
344 | break; | |
|
345 | case TC_SUBTYPE_UPDT_INFO: | |
|
346 | break; | |
|
347 | case TC_SUBTYPE_EN_CAL: | |
|
348 | break; | |
|
349 | case TC_SUBTYPE_DIS_CAL: | |
|
350 | break; | |
|
351 | case TC_SUBTYPE_UPDT_TIME: | |
|
352 | break; | |
|
353 | default: | |
|
354 | break; | |
|
355 | } | |
|
356 | } | |
|
357 | } | |
|
358 | } | |
|
359 | ||
|
360 | int create_message_queue() | |
|
361 | { | |
|
362 | rtems_status_code status; | |
|
363 | misc_name[0] = rtems_build_name( 'Q', 'U', 'E', 'U' ); | |
|
364 | status = rtems_message_queue_create( misc_name[0], ACTION_MSG_QUEUE_COUNT, CCSDS_TC_PKT_MAX_SIZE, | |
|
365 | RTEMS_FIFO | RTEMS_LOCAL, &misc_id[0] ); | |
|
366 | if (status!=RTEMS_SUCCESSFUL) PRINTF("in create_message_queue *** error creating message queue\n") | |
|
367 | ||
|
368 | return 0; | |
|
369 | } | |
|
370 | ||
|
371 | //*********** | |
|
372 | // TC ACTIONS | |
|
373 | int default_action(ccsdsTelecommandPacket_t *TC) | |
|
374 | { | |
|
375 | char data[100]; // buffer for the generic TM packet | |
|
376 | TMHeader_t TM_header; // TM header | |
|
377 | spw_ioctl_pkt_send spw_ioctl_send; // structure to send the TM packet if any | |
|
378 | // BUILD HEADER | |
|
379 | TM_build_header( TM_LFR_TC_EXE_ERR, SID_NOT_IMP, TM_LEN_NOT_IMP, 0, 0, &TM_header); | |
|
380 | // BUILD DATA | |
|
381 | TM_build_data( TC, data, SID_NOT_IMP, NULL); | |
|
382 | // filling the strture for the spcawire transmission | |
|
383 | spw_ioctl_send.hlen = TM_HEADER_LEN + 4; // + 4 is for the protocole extra header | |
|
384 | spw_ioctl_send.hdr = (char*) &TM_header; | |
|
385 | spw_ioctl_send.dlen = TM_LEN_NOT_IMP + CCSDS_TC_TM_PACKET_OFFSET - TM_HEADER_LEN; | |
|
386 | spw_ioctl_send.data = data; | |
|
387 | // SEND DATA | |
|
388 | write_spw(&spw_ioctl_send); | |
|
389 | ||
|
390 | return 0; | |
|
391 | } | |
|
392 | ||
|
393 | ||
|
394 | ||
|
395 | ||
|
396 |
@@ -6,7 +6,7 rtems_isr waveforms_isr( rtems_vector_nu | |||
|
6 | 6 | printf("In spectral_matrices_isr *** Error sending event to WFRM\n"); |
|
7 | 7 | } |
|
8 | 8 | |
|
9 |
rtems_task |
|
|
9 | rtems_task wfrm_task(rtems_task_argument argument) | |
|
10 | 10 | { |
|
11 | 11 | unsigned int length; |
|
12 | 12 | unsigned int i = 0; |
General Comments 0
You need to be logged in to leave comments.
Login now