##// END OF EJS Templates
Several TC actions added...
paul@pc-solar1.lab-lpp.local -
r11:84136ad726a3 default
parent child
Show More
@@ -10,7 +10,7
10 <Option output="bin/Debug/fsw" prefix_auto="1" extension_auto="1" />
10 <Option output="bin/Debug/fsw" prefix_auto="1" extension_auto="1" />
11 <Option object_output="obj/Debug/" />
11 <Option object_output="obj/Debug/" />
12 <Option type="1" />
12 <Option type="1" />
13 <Option compiler="sparcrtems446" />
13 <Option compiler="sparcrtemsgcc446" />
14 <Compiler>
14 <Compiler>
15 <Add option="-fexpensive-optimizations" />
15 <Add option="-fexpensive-optimizations" />
16 <Add option="-O3" />
16 <Add option="-O3" />
@@ -142,7 +142,7 1359464346 /opt/DEV_PLE/header/fsw_main.
142 <wf_handler.h>
142 <wf_handler.h>
143 <grlib_regs.h>
143 <grlib_regs.h>
144
144
145 1359616894 /opt/DEV_PLE/header/fsw_params.h
145 1359959307 /opt/DEV_PLE/header/fsw_params.h
146
146
147 1359614518 /opt/DEV_PLE/header/fsw_misc.h
147 1359614518 /opt/DEV_PLE/header/fsw_misc.h
148 <rtems.h>
148 <rtems.h>
@@ -153,14 +153,14 1359614518 /opt/DEV_PLE/header/fsw_misc.
153 <grspw.h>
153 <grspw.h>
154 <ccsds_types.h>
154 <ccsds_types.h>
155
155
156 1359440704 /opt/DEV_PLE/header/grlib_regs.h
156 1359959822 /opt/DEV_PLE/header/grlib_regs.h
157
157
158 1359614517 /opt/DEV_PLE/header/fsw_processing.h
158 1359614517 /opt/DEV_PLE/header/fsw_processing.h
159 <rtems.h>
159 <rtems.h>
160 <grlib_regs.h>
160 <grlib_regs.h>
161 <fsw_params.h>
161 <fsw_params.h>
162
162
163 1359643450 /opt/DEV_PLE/header/tc_handler.h
163 1359959377 /opt/DEV_PLE/header/tc_handler.h
164 <rtems.h>
164 <rtems.h>
165 <stdio.h>
165 <stdio.h>
166 <unistd.h>
166 <unistd.h>
@@ -185,18 +185,18 1359614518 source:/opt/DEV_PLE/src/fsw_m
185 <fsw_misc.h>
185 <fsw_misc.h>
186 <fsw_params.h>
186 <fsw_params.h>
187
187
188 1359643720 source:/opt/DEV_PLE/src/tc_handler.c
188 1359715931 source:/opt/DEV_PLE/src/tc_handler.c
189 <tc_handler.h>
189 <tc_handler.h>
190 <fsw_params.h>
190 <fsw_params.h>
191
191
192 1359614518 source:/opt/DEV_PLE/src/wf_handler.c
192 1359715982 source:/opt/DEV_PLE/src/wf_handler.c
193 <wf_handler.h>
193 <wf_handler.h>
194
194
195 1359615705 source:/opt/DEV_PLE/src/fsw_globals.c
195 1359959319 source:/opt/DEV_PLE/src/fsw_globals.c
196 <fsw_processing.h>
196 <fsw_processing.h>
197 <rtems.h>
197 <rtems.h>
198
198
199 1359622160 source:/opt/DEV_PLE/src/fsw_init.c
199 1359959173 source:/opt/DEV_PLE/src/fsw_init.c
200 <rtems.h>
200 <rtems.h>
201 <bsp.h>
201 <bsp.h>
202 <rtems/confdefs.h>
202 <rtems/confdefs.h>
@@ -204,7 +204,7 1359622160 source:/opt/DEV_PLE/src/fsw_i
204 <fsw_init.h>
204 <fsw_init.h>
205 <fsw_config.c>
205 <fsw_config.c>
206
206
207 1359615705 /opt/DEV_PLE/header/fsw_init.h
207 1359714779 /opt/DEV_PLE/header/fsw_init.h
208 <errno.h>
208 <errno.h>
209 <fcntl.h>
209 <fcntl.h>
210 <stdio.h>
210 <stdio.h>
@@ -218,7 +218,7 1359615705 /opt/DEV_PLE/header/fsw_init.
218 <wf_handler.h>
218 <wf_handler.h>
219 <grlib_regs.h>
219 <grlib_regs.h>
220
220
221 1359614518 source:/opt/DEV_PLE/src/fsw_processing.c
221 1359715903 source:/opt/DEV_PLE/src/fsw_processing.c
222 <fsw_processing.h>
222 <fsw_processing.h>
223 <math.h>
223 <math.h>
224 <stdio.h>
224 <stdio.h>
@@ -1,43 +1,46
1 <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
1 <?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
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="5">
4 <File name="../header/ccsds_types.h" open="1" top="0" tabpos="3">
5 <Cursor position="4079" topLine="120" />
5 <Cursor position="3403" topLine="101" />
6 </File>
6 </File>
7 <File name="../header/fsw_init.h" open="0" top="0" tabpos="3">
7 <File name="../header/fsw_init.h" open="0" top="0" tabpos="3">
8 <Cursor position="1128" topLine="26" />
8 <Cursor position="899" topLine="0" />
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="114" topLine="0" />
11 <Cursor position="114" topLine="0" />
12 </File>
12 </File>
13 <File name="../header/fsw_params.h" open="0" top="0" tabpos="0">
13 <File name="../header/fsw_params.h" open="0" top="0" tabpos="0">
14 <Cursor position="1374" topLine="49" />
14 <Cursor position="2405" topLine="52" />
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="576" topLine="0" />
17 <Cursor position="576" topLine="0" />
18 </File>
18 </File>
19 <File name="../header/grlib_regs.h" open="0" top="0" tabpos="0">
20 <Cursor position="1072" topLine="0" />
21 </File>
19 <File name="../header/tc_handler.h" open="0" top="0" tabpos="4">
22 <File name="../header/tc_handler.h" open="0" top="0" tabpos="4">
20 <Cursor position="437" topLine="35" />
23 <Cursor position="481" topLine="0" />
21 </File>
24 </File>
22 <File name="../header/wf_handler.h" open="0" top="0" tabpos="0">
25 <File name="../header/wf_handler.h" open="0" top="0" tabpos="0">
23 <Cursor position="212" topLine="0" />
26 <Cursor position="212" topLine="0" />
24 </File>
27 </File>
25 <File name="../src/fsw_globals.c" open="0" top="0" tabpos="4">
28 <File name="../src/fsw_globals.c" open="0" top="0" tabpos="4">
26 <Cursor position="1271" topLine="18" />
29 <Cursor position="1531" topLine="1" />
27 </File>
30 </File>
28 <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">
29 <Cursor position="1814" topLine="48" />
32 <Cursor position="9387" topLine="83" />
30 </File>
33 </File>
31 <File name="../src/fsw_misc.c" open="0" top="0" tabpos="0">
34 <File name="../src/fsw_misc.c" open="0" top="0" tabpos="0">
32 <Cursor position="20" topLine="0" />
35 <Cursor position="20" topLine="0" />
33 </File>
36 </File>
34 <File name="../src/fsw_processing.c" open="0" top="0" tabpos="2">
37 <File name="../src/fsw_processing.c" open="0" top="0" tabpos="3">
35 <Cursor position="1175" topLine="46" />
38 <Cursor position="1797" topLine="73" />
36 </File>
39 </File>
37 <File name="../src/tc_handler.c" open="1" top="1" tabpos="2">
40 <File name="../src/tc_handler.c" open="1" top="1" tabpos="2">
38 <Cursor position="13133" topLine="89" />
41 <Cursor position="10603" topLine="21" />
39 </File>
42 </File>
40 <File name="../src/wf_handler.c" open="0" top="0" tabpos="0">
43 <File name="../src/wf_handler.c" open="0" top="0" tabpos="0">
41 <Cursor position="3936" topLine="62" />
44 <Cursor position="542" topLine="0" />
42 </File>
45 </File>
43 </CodeBlocks_layout_file>
46 </CodeBlocks_layout_file>
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
@@ -23,7 +23,12 extern rtems_name Task_name[ ]; /* a
23 extern rtems_name misc_name[ ]; /* arry of miscellaneous names for rtems objects */
23 extern rtems_name misc_name[ ]; /* arry of miscellaneous names for rtems objects */
24 extern int fdSPW; // grspw file descriptor
24 extern int fdSPW; // grspw file descriptor
25 extern int fdUART; // uart file descriptor
25 extern int fdUART; // uart file descriptor
26 // MODE PARAMETERS
26 extern struct param_norm_str param_norm;
27 extern struct param_norm_str param_norm;
28 extern struct param_burst_str param_burst;
29 extern struct param_sbm1_str param_sbm1;
30 extern struct param_sbm2_str param_sbm2;
31 extern unsigned char param_common[];
27
32
28 // RTEMS TASKS
33 // RTEMS TASKS
29 rtems_task Init( rtems_task_argument argument); /* forward declaration needed */
34 rtems_task Init( rtems_task_argument argument); /* forward declaration needed */
@@ -4,11 +4,20
4 #define GRSPW_DEVICE_NAME "/dev/grspw0"
4 #define GRSPW_DEVICE_NAME "/dev/grspw0"
5 #define UART_DEVICE_NAME "/dev/console"
5 #define UART_DEVICE_NAME "/dev/console"
6
6
7 //**********
8 // LFR MODES
9 #define LFR_MODE_STANDBY 0
10 #define LFR_MODE_NORMAL 1
11 #define LFR_MODE_BURST 2
12 #define LFR_MODE_SBM1 3
13 #define LFR_MODE_SBM2 4
14
7 //*****************************
15 //*****************************
8 // APB REGISTERS BASE ADDRESSES
16 // APB REGISTERS BASE ADDRESSES
9 #define REGS_ADDR_APBUART 0x80000100
17 #define REGS_ADDR_APBUART 0x80000100
10 #define REGS_ADDR_GPTIMER 0x80000300
18 #define REGS_ADDR_GPTIMER 0x80000300
11 #define REGS_ADDR_GRSPW 0x80000500
19 #define REGS_ADDR_GRSPW 0x80000500
20 #define REGS_ADDR_TIME_MANAGEMENT 0x80000600
12 #define REGS_ADDR_SPECTRAL_MATRICES 0x80000700
21 #define REGS_ADDR_SPECTRAL_MATRICES 0x80000700
13
22
14 #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff
23 #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff
@@ -60,6 +69,21 struct param_norm_str{
60 unsigned char sy_lfr_n_bp_p1; // time between two products BP2 set
69 unsigned char sy_lfr_n_bp_p1; // time between two products BP2 set
61 };
70 };
62
71
72 struct param_burst_str{
73 unsigned char sy_lfr_b_bp_p0; // timebetween two products BP1 set
74 unsigned char sy_lfr_b_bp_p1; // time between two products BP2 set
75 };
76
77 struct param_sbm1_str{
78 unsigned char sy_lfr_s1_bp_p0; // timebetween two products BP1 set
79 unsigned char sy_lfr_s1_bp_p1; // time between two products BP2 set
80 };
81
82 struct param_sbm2_str{
83 unsigned char sy_lfr_s2_bp_p0; // timebetween two products BP1 set
84 unsigned char sy_lfr_s2_bp_p1; // time between two products BP2 set
85 };
86
63 extern volatile int wf_snap_f0[ ]; // 24576 bytes
87 extern volatile int wf_snap_f0[ ]; // 24576 bytes
64 extern volatile int wf_snap_f1[ ]; // 24576 bytes
88 extern volatile int wf_snap_f1[ ]; // 24576 bytes
65 extern volatile int wf_snap_f2[ ]; // 24576 bytes
89 extern volatile int wf_snap_f2[ ]; // 24576 bytes
@@ -37,4 +37,12 struct spectral_matrices_regs_str{
37 };
37 };
38 typedef struct spectral_matrices_regs_str spectral_matrices_regs_t;
38 typedef struct spectral_matrices_regs_str spectral_matrices_regs_t;
39
39
40 struct time_management_regs_str{
41 volatile int ctrl; // bit 0 forces the load of the coarse_time_load value and resets the fine_time
42 volatile int coarse_time_load;
43 volatile int coarse_time;
44 volatile int fine_time;
45 };
46 typedef struct time_management_regs_str time_management_regs_t;
47
40 #endif // GRLIBREGS_H_INCLUDED
48 #endif // GRLIBREGS_H_INCLUDED
@@ -2,6 +2,7
2 #define TC_HANDLER_H_INCLUDED
2 #define TC_HANDLER_H_INCLUDED
3
3
4 #include <rtems.h>
4 #include <rtems.h>
5 #include <bsp.h> // for the LEON_Unmask_interrupt function
5 #include <stdio.h>
6 #include <stdio.h>
6 #include <unistd.h> // for the read call
7 #include <unistd.h> // for the read call
7 #include <sys/ioctl.h> // for the ioctl call
8 #include <sys/ioctl.h> // for the ioctl call
@@ -13,7 +14,12 extern int fdSPW;
13 extern rtems_name misc_name[ ];
14 extern rtems_name misc_name[ ];
14 extern rtems_name misc_id[ ];
15 extern rtems_name misc_id[ ];
15 extern rtems_id Task_id[ ]; // array of task ids
16 extern rtems_id Task_id[ ]; // array of task ids
17 // MODE PARAMETERS
16 extern struct param_norm_str param_norm;
18 extern struct param_norm_str param_norm;
19 extern struct param_sbm1_str param_sbm1;
20 extern struct param_sbm2_str param_sbm2;
21 extern time_management_regs_t *time_management_regs;
22 extern unsigned char param_common[];
17
23
18 unsigned char currentTC_LEN_RCV[2]; // SHALL be equal to the current TC packet estimated packet length field
24 unsigned char currentTC_LEN_RCV[2]; // SHALL be equal to the current TC packet estimated packet length field
19 unsigned char currentTC_COMPUTED_CRC[2];
25 unsigned char currentTC_COMPUTED_CRC[2];
@@ -24,7 +30,7 unsigned char currentTC_processedFlag;
24 //**********************
30 //**********************
25 // GENERAL USE FUNCTIONS
31 // GENERAL USE FUNCTIONS
26 unsigned int lookUpTableForCRC[256];
32 unsigned int lookUpTableForCRC[256];
27 void InitLookUpTableForCRC();
33 void initLookUpTableForCRC();
28 void GetCRCAsTwoBytes(unsigned char* data, unsigned char* crcAsTwoBytes, unsigned int sizeOfData);
34 void GetCRCAsTwoBytes(unsigned char* data, unsigned char* crcAsTwoBytes, unsigned int sizeOfData);
29
35
30 //*********************
36 //*********************
@@ -45,8 +51,11 int create_message_queue();
45 //***********
51 //***********
46 // TC ACTIONS
52 // TC ACTIONS
47 int action_default(ccsdsTelecommandPacket_t *TC);
53 int action_default(ccsdsTelecommandPacket_t *TC);
54 int send_tm_lfr_tc_exe_success(ccsdsTelecommandPacket_t *TC);
55 //
48 int action_load_norm(ccsdsTelecommandPacket_t *TC);
56 int action_load_norm(ccsdsTelecommandPacket_t *TC);
49 int action_enter(ccsdsTelecommandPacket_t *TC);
57 int action_enter(ccsdsTelecommandPacket_t *TC);
58 int action_updt_time(ccsdsTelecommandPacket_t *TC);
50
59
51 #endif // TC_HANDLER_H_INCLUDED
60 #endif // TC_HANDLER_H_INCLUDED
52
61
@@ -9,6 +9,9 rtems_name Task_name[10]; /* array
9 int fdSPW;
9 int fdSPW;
10 int fdUART;
10 int fdUART;
11
11
12 // APB CONFIGURATION REGISTERS
13 time_management_regs_t *time_management_regs = (time_management_regs_t*) REGS_ADDR_TIME_MANAGEMENT;
14
12 // WAVEFORMS GLOBAL VARIABLES
15 // WAVEFORMS GLOBAL VARIABLES
13 volatile int wf_snap_f0[ NB_SAMPLES_PER_SNAPSHOT * NB_BYTES_SWF_BLK ]; // 24576 bytes
16 volatile int wf_snap_f0[ NB_SAMPLES_PER_SNAPSHOT * NB_BYTES_SWF_BLK ]; // 24576 bytes
14 volatile int wf_snap_f1[ NB_SAMPLES_PER_SNAPSHOT * NB_BYTES_SWF_BLK ]; // 24576 bytes
17 volatile int wf_snap_f1[ NB_SAMPLES_PER_SNAPSHOT * NB_BYTES_SWF_BLK ]; // 24576 bytes
@@ -28,8 +31,12 volatile int spec_mat_f0_h[ TOTAL_SIZE_S
28 float averaged_spec_mat_f0[ TOTAL_SIZE_SPEC_MAT ];
31 float averaged_spec_mat_f0[ TOTAL_SIZE_SPEC_MAT ];
29 float compressed_spec_mat_f0[ TOTAL_SIZE_COMPRESSED_MATRIX_f0 ];
32 float compressed_spec_mat_f0[ TOTAL_SIZE_COMPRESSED_MATRIX_f0 ];
30
33
31 // NORMAL MODE PARAMETERS
34 // MODE PARAMETERS
32 struct param_norm_str param_norm;
35 struct param_norm_str param_norm;
36 struct param_burst_str param_burst;
37 struct param_sbm1_str param_sbm1;
38 struct param_sbm2_str param_sbm2;
39 unsigned char param_common[2];
33
40
34 // BASIC PARAMETERS GLOBAL VARIABLES
41 // BASIC PARAMETERS GLOBAL VARIABLES
35 unsigned char LFR_BP1_F0[ NB_BINS_COMPRESSED_MATRIX_f0 * 9 ];
42 unsigned char LFR_BP1_F0[ NB_BINS_COMPRESSED_MATRIX_f0 * 9 ];
@@ -60,23 +60,18 rtems_task Init( rtems_task_argument ign
60
60
61 //send_console_outputs_on_serial_port();
61 //send_console_outputs_on_serial_port();
62
62
63 InitLookUpTableForCRC(); // in tc_handler.h
63 initLookUpTableForCRC(); // in tc_handler.h
64 init_default_mode_parameters();
64 init_default_mode_parameters();
65 create_message_queue();
65 create_message_queue();
66 create_all_tasks();
66 create_all_tasks();
67 start_all_tasks();
67 start_all_tasks();
68
68
69 configure_spw_link();
69 configure_spw_link();
70 // configure timer for spectral matrices simulation
71 configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR, CLKDIV_SM_SIMULATOR,
70 configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR, CLKDIV_SM_SIMULATOR,
72 IRQ_SPARC_SM, spectral_matrices_isr );
71 IRQ_SPARC_SM, spectral_matrices_isr );
73 // configure timer for waveforms simulation
74 configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR, CLKDIV_WF_SIMULATOR,
72 configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR, CLKDIV_WF_SIMULATOR,
75 IRQ_SPARC_WF, waveforms_isr );
73 IRQ_SPARC_WF, waveforms_isr );
76
74
77 LEON_Unmask_interrupt( IRQ_SM );
78 LEON_Unmask_interrupt( IRQ_WF );
79
80 status = rtems_task_delete(RTEMS_SELF);
75 status = rtems_task_delete(RTEMS_SELF);
81 }
76 }
82
77
@@ -102,11 +97,24 rtems_task spiq_task(rtems_task_argument
102
97
103 void init_default_mode_parameters()
98 void init_default_mode_parameters()
104 {
99 {
100 // COMMON PARAMETERS
101 param_common[0] = 0x00;
102 param_common[1] = 0x10; // default value 0 0 0 1 0 0 0 0
103 // NORMAL MODE
105 param_norm.sy_lfr_n_swf_l = 2048; // nb sample
104 param_norm.sy_lfr_n_swf_l = 2048; // nb sample
106 param_norm.sy_lfr_n_swf_p = 300; // sec
105 param_norm.sy_lfr_n_swf_p = 300; // sec
107 param_norm.sy_lfr_n_asm_p = 3600; // sec
106 param_norm.sy_lfr_n_asm_p = 3600; // sec
108 param_norm.sy_lfr_n_bp_p0 = 4; // sec
107 param_norm.sy_lfr_n_bp_p0 = 4; // sec
109 param_norm.sy_lfr_n_bp_p1 = 20; // sec
108 param_norm.sy_lfr_n_bp_p1 = 20; // sec
109 // BURST MODE
110 param_burst.sy_lfr_b_bp_p0 = 1; // sec
111 param_burst.sy_lfr_b_bp_p1 = 5; // sec
112 // SBM1 MODE
113 param_sbm1.sy_lfr_s1_bp_p0 = 1; // sec
114 param_sbm1.sy_lfr_s1_bp_p1 = 1; // sec
115 // SBM2 MODE
116 param_sbm2.sy_lfr_s2_bp_p0 = 1; // sec
117 param_sbm2.sy_lfr_s2_bp_p0 = 5; // sec
110 }
118 }
111
119
112 int create_all_tasks()
120 int create_all_tasks()
@@ -239,7 +247,7 int configure_spw_link()
239 if (status!=RTEMS_SUCCESSFUL) PRINTF("In RECV *** Error SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ\n")
247 if (status!=RTEMS_SUCCESSFUL) PRINTF("In RECV *** Error SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ\n")
240
248
241 status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL, 1); // sets the link-error interrupt bit
249 status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL, 1); // sets the link-error interrupt bit
242 if (status!=RTEMS_SUCCESSFUL) PRINTF("In RECV *** Error SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ\n")
250 if (status!=RTEMS_SUCCESSFUL) PRINTF("In RECV *** Error SPACEWIRE_IOCTRL_SET_TXBLOCK_ON_FULL\n")
243 //
251 //
244 //status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_DESTKEY, CCSDS_DESTINATION_ID); // sets the destination key
252 //status = ioctl(fdSPW, SPACEWIRE_IOCTRL_SET_DESTKEY, CCSDS_DESTINATION_ID); // sets the destination key
245 //if (status!=RTEMS_SUCCESSFUL) PRINTF("In RECV *** Error SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ\n")
253 //if (status!=RTEMS_SUCCESSFUL) PRINTF("In RECV *** Error SPACEWIRE_IOCTRL_SET_LINK_ERR_IRQ\n")
@@ -63,6 +63,8 rtems_task smiq_task(rtems_task_argument
63 gptimer_regs = (gptimer_regs_t *) REGS_ADDR_GPTIMER;
63 gptimer_regs = (gptimer_regs_t *) REGS_ADDR_GPTIMER;
64 unsigned char nb_interrupt_f0 = 0;
64 unsigned char nb_interrupt_f0 = 0;
65
65
66 PRINTF("In SMIQ *** \n")
67
66 while(1){
68 while(1){
67 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
69 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
68 nb_interrupt_f0 = nb_interrupt_f0 + 1;
70 nb_interrupt_f0 = nb_interrupt_f0 + 1;
@@ -368,6 +370,8 rtems_task avf0_task(rtems_task_argument
368 rtems_task bpf0_task(rtems_task_argument argument){
370 rtems_task bpf0_task(rtems_task_argument argument){
369 rtems_event_set event_out;
371 rtems_event_set event_out;
370
372
373 PRINTF("In BPFO *** \n")
374
371 while(1){
375 while(1){
372 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
376 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
373 matrix_compression(averaged_spec_mat_f0, 0, compressed_spec_mat_f0);
377 matrix_compression(averaged_spec_mat_f0, 0, compressed_spec_mat_f0);
@@ -18,7 +18,7 unsigned int Crc_opt( unsigned char D, u
18 return(((Chk << 8) & 0xff00)^lookUpTableForCRC [(((Chk >> 8)^D) & 0x00ff)]);
18 return(((Chk << 8) & 0xff00)^lookUpTableForCRC [(((Chk >> 8)^D) & 0x00ff)]);
19 }
19 }
20
20
21 void InitLookUpTableForCRC()
21 void initLookUpTableForCRC()
22 {
22 {
23 unsigned int i, tmp;
23 unsigned int i, tmp;
24 for (i=0; i<256; i++)
24 for (i=0; i<256; i++)
@@ -72,13 +72,13 int TC_checker(ccsdsTelecommandPacket_t
72 // PREPARE TM SENDING
72 // PREPARE TM SENDING
73 spw_ioctl_send.hlen = TM_HEADER_LEN + 4; // + 4 is for the protocole extra header
73 spw_ioctl_send.hlen = TM_HEADER_LEN + 4; // + 4 is for the protocole extra header
74 spw_ioctl_send.hdr = (char*) &TM_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;
75 spw_ioctl_send.dlen = 16;
76 spw_ioctl_send.data = data;
76 spw_ioctl_send.data = data;
77 // SEND PACKET
77 // SEND PACKET
78 write_spw(&spw_ioctl_send);
78 write_spw(&spw_ioctl_send);
79 }
79 }
80 else { // send valid TC to the action launcher
80 else { // send valid TC to the action launcher
81 status = rtems_message_queue_send( misc_id[0], TC, tc_len_recv + CCSDS_TC_TM_PACKET_OFFSET);
81 status = rtems_message_queue_send( misc_id[0], TC, tc_len_recv + CCSDS_TC_TM_PACKET_OFFSET + 3);
82 return -1;
82 return -1;
83 }
83 }
84 return -1;
84 return -1;
@@ -212,18 +212,12 unsigned char TM_build_header( enum TM_T
212 default:
212 default:
213 return 0;
213 return 0;
214 }
214 }
215 /*TMHeader->dataFieldHeader[4] = (unsigned char) (coarseTime>>24);
215 TMHeader->dataFieldHeader[4] = (unsigned char) (time_management_regs->coarse_time>>24);
216 TMHeader->dataFieldHeader[5] = (unsigned char) (coarseTime>>16);
216 TMHeader->dataFieldHeader[5] = (unsigned char) (time_management_regs->coarse_time>>16);
217 TMHeader->dataFieldHeader[6] = (unsigned char) (coarseTime>>8);
217 TMHeader->dataFieldHeader[6] = (unsigned char) (time_management_regs->coarse_time>>8);
218 TMHeader->dataFieldHeader[7] = (unsigned char) (coarseTime);
218 TMHeader->dataFieldHeader[7] = (unsigned char) (time_management_regs->coarse_time);
219 TMHeader->dataFieldHeader[8] = (unsigned char) (fineTime>>8);
219 TMHeader->dataFieldHeader[8] = (unsigned char) (time_management_regs->fine_time>>8);
220 TMHeader->dataFieldHeader[9] = (unsigned char) (fineTime);*/
220 TMHeader->dataFieldHeader[9] = (unsigned char) (time_management_regs->fine_time);
221 TMHeader->dataFieldHeader[4] = 0xaa;
222 TMHeader->dataFieldHeader[5] = 0xbb;
223 TMHeader->dataFieldHeader[6] = 0xcc;
224 TMHeader->dataFieldHeader[7] = 0xdd;
225 TMHeader->dataFieldHeader[8] = 0xee;
226 TMHeader->dataFieldHeader[9] = 0xff;
227 return 1;
221 return 1;
228 }
222 }
229
223
@@ -310,11 +304,14 rtems_task recv_task( rtems_task_argumen
310
304
311 rtems_task actn_task( rtems_task_argument unused )
305 rtems_task actn_task( rtems_task_argument unused )
312 {
306 {
307 int result = 0;
313 rtems_status_code status; // RTEMS status code
308 rtems_status_code status; // RTEMS status code
314 ccsdsTelecommandPacket_t TC; // TC sent to the ACTN task
309 ccsdsTelecommandPacket_t TC; // TC sent to the ACTN task
315 size_t size; // size of the incoming TC packet
310 size_t size; // size of the incoming TC packet
316 unsigned char subtype = 0; // subtype of the current TC packet
311 unsigned char subtype = 0; // subtype of the current TC packet
317
312
313 PRINTF("In ACTN *** \n")
314
318 while(1)
315 while(1)
319 {
316 {
320 status = rtems_message_queue_receive(misc_id[0], (char*) &TC, &size,
317 status = rtems_message_queue_receive(misc_id[0], (char*) &TC, &size,
@@ -326,32 +323,56 rtems_task actn_task( rtems_task_argumen
326 switch(subtype)
323 switch(subtype)
327 {
324 {
328 case TC_SUBTYPE_RESET:
325 case TC_SUBTYPE_RESET:
329 break;
326 result = action_default( &TC );
330 case TC_SUBTYPE_LOAD_COMM:
331 break;
327 break;
328 //
329 case TC_SUBTYPE_LOAD_COMM:
330 result = action_default( &TC );
331 break;
332 //
332 case TC_SUBTYPE_LOAD_NORM:
333 case TC_SUBTYPE_LOAD_NORM:
333 action_load_norm( &TC );
334 result = action_load_norm( &TC );
335 send_tm_lfr_tc_exe_success( &TC );
334 break;
336 break;
337 //
335 case TC_SUBTYPE_LOAD_BURST:
338 case TC_SUBTYPE_LOAD_BURST:
339 result = action_default( &TC );
336 break;
340 break;
341 //
337 case TC_SUBTYPE_LOAD_SBM1:
342 case TC_SUBTYPE_LOAD_SBM1:
343 result = action_default( &TC );
338 break;
344 break;
345 //
339 case TC_SUBTYPE_LOAD_SBM2:
346 case TC_SUBTYPE_LOAD_SBM2:
347 result = action_default( &TC );
340 break;
348 break;
349 //
341 case TC_SUBTYPE_DUMP:
350 case TC_SUBTYPE_DUMP:
342 action_default( &TC );
351 result = action_default( &TC );
343 break;
352 break;
353 //
344 case TC_SUBTYPE_ENTER:
354 case TC_SUBTYPE_ENTER:
345 action_enter( &TC );
355 result = action_enter( &TC );
356 send_tm_lfr_tc_exe_success( &TC );
346 break;
357 break;
358 //
347 case TC_SUBTYPE_UPDT_INFO:
359 case TC_SUBTYPE_UPDT_INFO:
360 result = action_default( &TC );
348 break;
361 break;
362 //
349 case TC_SUBTYPE_EN_CAL:
363 case TC_SUBTYPE_EN_CAL:
364 result = action_default( &TC );
350 break;
365 break;
366 //
351 case TC_SUBTYPE_DIS_CAL:
367 case TC_SUBTYPE_DIS_CAL:
368 result = action_default( &TC );
352 break;
369 break;
370 //
353 case TC_SUBTYPE_UPDT_TIME:
371 case TC_SUBTYPE_UPDT_TIME:
372 result = action_updt_time( &TC );
373 send_tm_lfr_tc_exe_success( &TC );
354 break;
374 break;
375 //
355 default:
376 default:
356 break;
377 break;
357 }
378 }
@@ -384,7 +405,7 int action_default(ccsdsTelecommandPacke
384 // filling the strture for the spcawire transmission
405 // filling the strture for the spcawire transmission
385 spw_ioctl_send.hlen = TM_HEADER_LEN + 4; // + 4 is for the protocole extra header
406 spw_ioctl_send.hlen = TM_HEADER_LEN + 4; // + 4 is for the protocole extra header
386 spw_ioctl_send.hdr = (char*) &TM_header;
407 spw_ioctl_send.hdr = (char*) &TM_header;
387 spw_ioctl_send.dlen = TM_LEN_NOT_IMP + CCSDS_TC_TM_PACKET_OFFSET - TM_HEADER_LEN;
408 spw_ioctl_send.dlen = 8;
388 spw_ioctl_send.data = data;
409 spw_ioctl_send.data = data;
389 // SEND DATA
410 // SEND DATA
390 write_spw(&spw_ioctl_send);
411 write_spw(&spw_ioctl_send);
@@ -394,6 +415,25 int action_default(ccsdsTelecommandPacke
394
415
395 int action_enter(ccsdsTelecommandPacket_t *TC)
416 int action_enter(ccsdsTelecommandPacket_t *TC)
396 {
417 {
418 unsigned char lfr_mode = TC->dataAndCRC[1];
419 printf("enter mode %d\n", lfr_mode);
420 switch(lfr_mode)
421 {
422 case(LFR_MODE_STANDBY):
423 LEON_Mask_interrupt( IRQ_WF );
424 LEON_Mask_interrupt( IRQ_SM );
425 break;
426 case(LFR_MODE_NORMAL):
427 LEON_Unmask_interrupt( IRQ_WF );
428 LEON_Unmask_interrupt( IRQ_SM );
429 break;
430 case(LFR_MODE_BURST):
431 break;
432 case(LFR_MODE_SBM1):
433 break;
434 case(LFR_MODE_SBM2):
435 break;
436 }
397 return 0;
437 return 0;
398 }
438 }
399
439
@@ -404,11 +444,46 int action_load_norm(ccsdsTelecommandPac
404 param_norm.sy_lfr_n_asm_p = TC->dataAndCRC[4] * 256 + TC->dataAndCRC[5];
444 param_norm.sy_lfr_n_asm_p = TC->dataAndCRC[4] * 256 + TC->dataAndCRC[5];
405 param_norm.sy_lfr_n_bp_p0 = TC->dataAndCRC[6];
445 param_norm.sy_lfr_n_bp_p0 = TC->dataAndCRC[6];
406 param_norm.sy_lfr_n_bp_p1 = TC->dataAndCRC[7];
446 param_norm.sy_lfr_n_bp_p1 = TC->dataAndCRC[7];
407 printf("sy_lfr_n_ => swf_l %d, swf_p %d, asm_p %d, bsp_p0 %d, bsp_p1 %d\n",
447 /*printf("sy_lfr_n_ => swf_l %d, swf_p %d, asm_p %d, bsp_p0 %d, bsp_p1 %d\n",
408 param_norm.sy_lfr_n_swf_l, param_norm.sy_lfr_n_swf_p,
448 param_norm.sy_lfr_n_swf_l, param_norm.sy_lfr_n_swf_p,
409 param_norm.sy_lfr_n_asm_p, param_norm.sy_lfr_n_bp_p0, param_norm.sy_lfr_n_bp_p1);
449 param_norm.sy_lfr_n_asm_p, param_norm.sy_lfr_n_bp_p0, param_norm.sy_lfr_n_bp_p1);*/
450 return 0;
451 }
452
453 int action_updt_time(ccsdsTelecommandPacket_t *TC)
454 {
455 time_management_regs->coarse_time_load = (TC->dataAndCRC[0] << 24)
456 + (TC->dataAndCRC[1] << 16)
457 + (TC->dataAndCRC[2] << 8)
458 + TC->dataAndCRC[3];
459 time_management_regs->ctrl = time_management_regs->ctrl | 1;
460 return 0;
461 }
462
463 int send_tm_lfr_tc_exe_success(ccsdsTelecommandPacket_t *TC)
464 {
465 TMHeader_t TM_header;
466 char data[4];
467 spw_ioctl_pkt_send spw_ioctl_send;
468
469 TM_build_header( TM_LFR_TC_EXE_OK, TM_LEN_EXE,
470 time_management_regs->coarse_time, time_management_regs->fine_time, &TM_header);
471
472 data[0] = TC->packetID[0];
473 data[1] = TC->packetID[1];
474 data[2] = TC->packetSequenceControl[0];
475 data[3] = TC->packetSequenceControl[1];
476
477 // filling the structure for the spacewire transmission
478 spw_ioctl_send.hlen = TM_HEADER_LEN + 3; // + 4 is for the protocole extra header
479 spw_ioctl_send.hdr = (char*) &TM_header;
480 spw_ioctl_send.dlen = 3;
481 spw_ioctl_send.data = data;
482
483 // SEND DATA
484 write_spw(&spw_ioctl_send);
485
410 return 0;
486 return 0;
411 }
487 }
412
488
413
489
414
@@ -48,6 +48,8 rtems_task wfrm_task(rtems_task_argument
48 spw_ioctl_send.hlen = TM_HEADER_LEN + 4 + 6; // + 4 is for the protocole extra header, + 6 is for the auxiliary header
48 spw_ioctl_send.hlen = TM_HEADER_LEN + 4 + 6; // + 4 is for the protocole extra header, + 6 is for the auxiliary header
49 spw_ioctl_send.hdr = (char*) &header;
49 spw_ioctl_send.hdr = (char*) &header;
50
50
51 PRINTF("In WFRM *** \n")
52
51 while(1){
53 while(1){
52 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
54 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
53 for (i=0; i<7; i++) // send F0
55 for (i=0; i<7; i++) // send F0
General Comments 0
You need to be logged in to leave comments. Login now