##// END OF EJS Templates
Commit before working on the ERR 4 due to message queue...
paul -
r34:c3c11207c46d default
parent child
Show More
@@ -1,6 +1,6
1 #############################################################################
1 #############################################################################
2 # Makefile for building: bin/fsw
2 # Makefile for building: bin/fsw
3 # Generated by qmake (2.01a) (Qt 4.8.5) on: Mon Sep 30 15:28:56 2013
3 # Generated by qmake (2.01a) (Qt 4.8.5) on: Fri Oct 4 15:16:59 2013
4 # Project: fsw-qt.pro
4 # Project: fsw-qt.pro
5 # Template: app
5 # Template: app
6 # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
6 # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
@@ -10,7 +10,7
10
10
11 CC = sparc-rtems-gcc
11 CC = sparc-rtems-gcc
12 CXX = sparc-rtems-g++
12 CXX = sparc-rtems-g++
13 DEFINES = -DSW_VERSION_N1=0 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=13 -DPRINT_MESSAGES_ON_CONSOLE
13 DEFINES = -DSW_VERSION_N1=0 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=13 -DPRINT_MESSAGES_ON_CONSOLE -DPRINT_TASK_STATISTICS -DPRINT_STACK_REPORT
14 CFLAGS = -pipe -O3 -Wall $(DEFINES)
14 CFLAGS = -pipe -O3 -Wall $(DEFINES)
15 CXXFLAGS = -pipe -O3 -Wall $(DEFINES)
15 CXXFLAGS = -pipe -O3 -Wall $(DEFINES)
16 INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header
16 INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
@@ -1,7 +1,7
1 TEMPLATE = app
1 TEMPLATE = app
2 # CONFIG += console v8 sim
2 # CONFIG += console v8 sim
3 # CONFIG options = verbose *** cpu_usage_report *** gsa
3 # CONFIG options = verbose *** cpu_usage_report *** gsa *** stack_report
4 CONFIG += console verbose
4 CONFIG += console verbose stack_report cpu_usage_report
5 CONFIG -= qt
5 CONFIG -= qt
6
6
7 include(./sparc.pri)
7 include(./sparc.pri)
@@ -21,6 +21,10 contains( CONFIG, cpu_usage_report ) {
21 DEFINES += PRINT_TASK_STATISTICS
21 DEFINES += PRINT_TASK_STATISTICS
22 }
22 }
23
23
24 contains( CONFIG, stack_report ) {
25 DEFINES += PRINT_STACK_REPORT
26 }
27
24 TARGET = fsw
28 TARGET = fsw
25 contains( CONFIG, gsa ) {
29 contains( CONFIG, gsa ) {
26 DEFINES += GSA
30 DEFINES += GSA
@@ -1,6 +1,6
1 <?xml version="1.0" encoding="UTF-8"?>
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE QtCreatorProject>
2 <!DOCTYPE QtCreatorProject>
3 <!-- Written by QtCreator 2.8.0, 2013-10-01T07:01:25. -->
3 <!-- Written by QtCreator 2.8.0, 2013-10-04T15:45:21. -->
4 <qtcreator>
4 <qtcreator>
5 <data>
5 <data>
6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
@@ -15,14 +15,14
15
15
16 #define DEFAULT_SPARE1_PUSVERSION_SPARE2 0x10
16 #define DEFAULT_SPARE1_PUSVERSION_SPARE2 0x10
17 #define DEFAULT_RESERVED 0x00
17 #define DEFAULT_RESERVED 0x00
18 #define DEFAULT_HKBIA 0x1f
18 #define DEFAULT_HKBIA 0x1e // 0001 1110
19
19
20 // PACKET ID
20 // PACKET ID
21 #define TM_PACKET_ID_TC_EXE 0x0cc1 // PID 76 CAT 1
21 #define TM_PACKET_ID_TC_EXE 0x0cc1 // PID 76 CAT 1
22 #define TM_PACKET_ID_HK 0x0cc4 // PID 76 CAT 4
22 #define TM_PACKET_ID_HK 0x0cc4 // PID 76 CAT 4
23 #define TM_PACKET_ID_PARAMETER_DUMP 0x0cc9 // PID 76 CAT 9
23 #define TM_PACKET_ID_PARAMETER_DUMP 0x0cc9 // PID 76 CAT 9
24 #define TM_PACKET_ID_SCIENCE_NORMAL 0x0ccc // PID 76 CAT 12
24 #define TM_PACKET_ID_SCIENCE_NORMAL_BURST 0x0ccc // PID 76 CAT 12
25 #define TM_PACKET_ID_SCIENCE_BURST_SBM1_SBM2 0x0cfc // PID 79 CAT 12
25 #define TM_PACKET_ID_SCIENCE_SBM1_SBM2 0x0cfc // PID 79 CAT 12
26 #define TM_PACKET_PID_DEFAULT 76
26 #define TM_PACKET_PID_DEFAULT 76
27 #define TM_PACKET_PID_BURST_SBM1_SBM2 79
27 #define TM_PACKET_PID_BURST_SBM1_SBM2 79
28 #define TM_PACKET_CAT_TC_EXE 1
28 #define TM_PACKET_CAT_TC_EXE 1
@@ -23,7 +23,9 extern int sched_yield( void );
23 extern int errno;
23 extern int errno;
24 extern rtems_id Task_id[ ]; /* array of task ids */
24 extern rtems_id Task_id[ ]; /* array of task ids */
25 extern rtems_name Task_name[ ]; /* array of task names */
25 extern rtems_name Task_name[ ]; /* array of task names */
26 extern rtems_name misc_name[ ]; /* arry of miscellaneous names for rtems objects */
26 extern rtems_name misc_id[ ];
27 extern rtems_name misc_name[ ]; /* array of miscellaneous names for rtems objects */
28 extern unsigned int maxCount;
27 extern int fdSPW; // grspw file descriptor
29 extern int fdSPW; // grspw file descriptor
28 extern int fdUART; // uart file descriptor
30 extern int fdUART; // uart file descriptor
29 extern unsigned char lfrCurrentMode;
31 extern unsigned char lfrCurrentMode;
@@ -38,18 +40,20 rtems_task Init( rtems_task_argument arg
38 rtems_task recv_task(rtems_task_argument argument);
40 rtems_task recv_task(rtems_task_argument argument);
39 rtems_task stat_task(rtems_task_argument argument);
41 rtems_task stat_task(rtems_task_argument argument);
40 rtems_task wfrm_task(rtems_task_argument argument);
42 rtems_task wfrm_task(rtems_task_argument argument);
43
44 // OTHER functions
41 int create_names( void );
45 int create_names( void );
42 int create_all_tasks( void );
46 int create_all_tasks( void );
43 int start_all_tasks( void );
47 int start_all_tasks( void );
44 int create_message_queue( void );
48 //
45 int create_message_queues( void );
49 int create_message_queues( void );
46
50 //
47 // OTHER functions
48 void init_parameter_dump( void );
51 void init_parameter_dump( void );
49 void init_local_mode_parameters( void );
52 void init_local_mode_parameters( void );
50 void init_housekeeping_parameters( void );
53 void init_housekeeping_parameters( void );
51
54
52 extern int rtems_cpu_usage_report( void );
55 extern int rtems_cpu_usage_report( void );
53 extern int rtems_cpu_usage_reset( void );
56 extern int rtems_cpu_usage_reset( void );
57 extern void rtems_stack_checker_report_usage( void );
54
58
55 #endif // FSW_RTEMS_CONFIG_H_INCLUDED
59 #endif // FSW_RTEMS_CONFIG_H_INCLUDED
@@ -24,6 +24,7
24 #define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2
24 #define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2
25 #define RTEMS_EVENT_MODE_SBM1 RTEMS_EVENT_3
25 #define RTEMS_EVENT_MODE_SBM1 RTEMS_EVENT_3
26 #define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4
26 #define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4
27 #define RTEMS_EVENT_MODE_SBM2_WFRM RTEMS_EVENT_5
27
28
28 //****************************
29 //****************************
29 // LFR DEFAULT MODE PARAMETERS
30 // LFR DEFAULT MODE PARAMETERS
@@ -114,28 +115,32
114 #define TASKID_CWF1 14
115 #define TASKID_CWF1 14
115 #define TASKID_SEND 15
116 #define TASKID_SEND 15
116
117
117 //*********************************************************************
118 // ALL TASKS THAT USE THE SPACEWIRE DIRVER SHALL HAVE THE SAME PRIORITY
119 // OR CHANGE THE SEMAPHORE CREATION IN THE DRIVER...
120 #define TASK_PRIORITY_SPIQ 5
118 #define TASK_PRIORITY_SPIQ 5
121 #define TASK_PRIORITY_SMIQ 10
119 #define TASK_PRIORITY_SMIQ 10
122 #define TASK_PRIORITY_SEND 11
120 //
123 #define TASK_PRIORITY_RECV 12
121 #define TASK_PRIORITY_SEND 30
124 #define TASK_PRIORITY_ACTN 12
122 //
125 #define TASK_PRIORITY_CWF1 14
123 #define TASK_PRIORITY_RECV 40
126 #define TASK_PRIORITY_HOUS 15
124 #define TASK_PRIORITY_ACTN 40
127 #define TASK_PRIORITY_CWF2 15
125 //
128 #define TASK_PRIORITY_WFRM 15
126 #define TASK_PRIORITY_HOUS 40
129 #define TASK_PRIORITY_CWF3 15
127 #define TASK_PRIORITY_CWF1 40
130 #define TASK_PRIORITY_AVF0 50
128 #define TASK_PRIORITY_CWF2 40
131 #define TASK_PRIORITY_BPF0 50
129 #define TASK_PRIORITY_WFRM 40
132 #define TASK_PRIORITY_MATR 250
130 #define TASK_PRIORITY_CWF3 40
133 #define TASK_PRIORITY_STAT 251
131 //
134 #define TASK_PRIORITY_DUMB 251
132 #define TASK_PRIORITY_AVF0 60
133 #define TASK_PRIORITY_BPF0 60
134 #define TASK_PRIORITY_MATR 100
135 #define TASK_PRIORITY_STAT 200
136 #define TASK_PRIORITY_DUMB 200
135
137
136 #define ACTION_MSG_QUEUE_COUNT 10
138 #define ACTION_MSG_QUEUE_COUNT 10
137 #define ACTION_MSG_PKTS_COUNT 50
139 #define ACTION_MSG_PKTS_COUNT 50
138 #define ACTION_MSG_PKTS_SIZE
140 #define ACTION_MSG_PKTS_SIZE 24 // hlen *hdr dlen *data sent options
141
142 #define QUEUE_QUEU 0
143 #define QUEUE_PKTS 1
139
144
140 //*******
145 //*******
141 // MACROS
146 // MACROS
@@ -15,6 +15,8
15
15
16 extern volatile int spec_mat_f0_0[ ];
16 extern volatile int spec_mat_f0_0[ ];
17 extern volatile int spec_mat_f0_1[ ];
17 extern volatile int spec_mat_f0_1[ ];
18 extern volatile int spec_mat_f0_a[ ];
19 extern volatile int spec_mat_f0_b[ ];
18 extern volatile int spec_mat_f0_c[ ];
20 extern volatile int spec_mat_f0_c[ ];
19 extern volatile int spec_mat_f0_d[ ];
21 extern volatile int spec_mat_f0_d[ ];
20 extern volatile int spec_mat_f0_e[ ];
22 extern volatile int spec_mat_f0_e[ ];
@@ -41,6 +43,7 extern spectral_matrix_regs_t *spectral_
41
43
42 // ISR
44 // ISR
43 rtems_isr spectral_matrices_isr( rtems_vector_number vector );
45 rtems_isr spectral_matrices_isr( rtems_vector_number vector );
46 rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector );
44
47
45 // RTEMS TASKS
48 // RTEMS TASKS
46 rtems_task spw_bppr_task(rtems_task_argument argument);
49 rtems_task spw_bppr_task(rtems_task_argument argument);
@@ -12,15 +12,9
12 #include "fsw_init.h"
12 #include "fsw_init.h"
13 #include "fsw_misc.h"
13 #include "fsw_misc.h"
14
14
15 extern int fdSPW;
16 extern unsigned char lfrCurrentMode;
17 extern rtems_name misc_name[ ];
18 extern rtems_name misc_id[ ];
19 extern rtems_id Task_id[ ]; // array of task ids
20 // MODE PARAMETERS
15 // MODE PARAMETERS
21 extern struct param_sbm1_str param_sbm1;
16 extern struct param_sbm1_str param_sbm1;
22 extern struct param_sbm2_str param_sbm2;
17 extern struct param_sbm2_str param_sbm2;
23 extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
24 extern time_management_regs_t *time_management_regs;
18 extern time_management_regs_t *time_management_regs;
25 extern waveform_picker_regs_t *waveform_picker_regs;
19 extern waveform_picker_regs_t *waveform_picker_regs;
26 extern gptimer_regs_t *gptimer_regs;
20 extern gptimer_regs_t *gptimer_regs;
@@ -31,7 +31,6 extern volatile int wf_snap_f2_norm[ ];
31 extern volatile int wf_cont_f3[ ];
31 extern volatile int wf_cont_f3[ ];
32 extern volatile int wf_cont_f3_bis[ ];
32 extern volatile int wf_cont_f3_bis[ ];
33 extern waveform_picker_regs_t *waveform_picker_regs;
33 extern waveform_picker_regs_t *waveform_picker_regs;
34 extern unsigned char lfrCurrentMode;
35
34
36 rtems_isr waveforms_isr( rtems_vector_number vector );
35 rtems_isr waveforms_isr( rtems_vector_number vector );
37 rtems_isr waveforms_simulator_isr( rtems_vector_number vector );
36 rtems_isr waveforms_simulator_isr( rtems_vector_number vector );
@@ -44,12 +43,12 rtems_task cwf1_task(rtems_task_argument
44 // general functions
43 // general functions
45 void init_waveforms( void );
44 void init_waveforms( void );
46 //
45 //
47 int init_header_snapshot_wf_table( unsigned int sid );
46 int init_header_snapshot_wf_table(unsigned int sid , Header_TM_LFR_SCIENCE_SWF_t *headerSWF);
48 int init_header_continuous_wf_table(unsigned int sid , Header_TM_LFR_SCIENCE_CWF_t *headerCWF);
47 int init_header_continuous_wf_table(unsigned int sid , Header_TM_LFR_SCIENCE_CWF_t *headerCWF);
49 //
48 //
50 void reset_waveforms( void );
49 void reset_waveforms( void );
51
50
52 int send_waveform_SWF(volatile int *waveform, unsigned int sid);
51 int send_waveform_SWF(volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF);
53 int send_waveform_CWF(volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF);
52 int send_waveform_CWF(volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF);
54
53
55 //**************
54 //**************
@@ -10,6 +10,7 rtems_name misc_name[5];
10 rtems_name misc_id[5];
10 rtems_name misc_id[5];
11 rtems_id Task_id[20]; /* array of task ids */
11 rtems_id Task_id[20]; /* array of task ids */
12 rtems_name Task_name[20]; /* array of task names */
12 rtems_name Task_name[20]; /* array of task names */
13 unsigned int maxCount;
13 int fdSPW = 0;
14 int fdSPW = 0;
14 int fdUART = 0;
15 int fdUART = 0;
15 unsigned char lfrCurrentMode;
16 unsigned char lfrCurrentMode;
@@ -40,6 +41,8 volatile int wf_cont_f3_bis[ NB_SAMPLES_
40 // SPECTRAL MATRICES GLOBAL VARIABLES
41 // SPECTRAL MATRICES GLOBAL VARIABLES
41 volatile int spec_mat_f0_0[ SM_HEADER + TOTAL_SIZE_SM ];
42 volatile int spec_mat_f0_0[ SM_HEADER + TOTAL_SIZE_SM ];
42 volatile int spec_mat_f0_1[ SM_HEADER + TOTAL_SIZE_SM ];
43 volatile int spec_mat_f0_1[ SM_HEADER + TOTAL_SIZE_SM ];
44 volatile int spec_mat_f0_a[ SM_HEADER + TOTAL_SIZE_SM ];
45 volatile int spec_mat_f0_b[ SM_HEADER + TOTAL_SIZE_SM ];
43 volatile int spec_mat_f0_c[ SM_HEADER + TOTAL_SIZE_SM ];
46 volatile int spec_mat_f0_c[ SM_HEADER + TOTAL_SIZE_SM ];
44 volatile int spec_mat_f0_d[ SM_HEADER + TOTAL_SIZE_SM ];
47 volatile int spec_mat_f0_d[ SM_HEADER + TOTAL_SIZE_SM ];
45 volatile int spec_mat_f0_e[ SM_HEADER + TOTAL_SIZE_SM ];
48 volatile int spec_mat_f0_e[ SM_HEADER + TOTAL_SIZE_SM ];
@@ -19,10 +19,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
22 #define CONFIGURE_INIT_TASK_PRIORITY 5 // instead of 100
22 #define CONFIGURE_INIT_TASK_PRIORITY 1 // instead of 100
23 #define CONFIGURE_INIT_TASK_MODE (RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT)
23 #define CONFIGURE_MAXIMUM_DRIVERS 16
24 #define CONFIGURE_MAXIMUM_DRIVERS 16
24 #define CONFIGURE_MAXIMUM_PERIODS 5
25 #define CONFIGURE_MAXIMUM_PERIODS 5
26 #define CONFIGURE_MAXIMUM_TIMERS 5
25 #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 2
27 #define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 2
28 #ifdef PRINT_STACK_REPORT
29 #define CONFIGURE_STACK_CHECKER_ENABLED
30 #endif
26
31
27 #include <rtems/confdefs.h>
32 #include <rtems/confdefs.h>
28
33
@@ -62,12 +67,15 rtems_task Init( rtems_task_argument ign
62 init_parameter_dump();
67 init_parameter_dump();
63 init_local_mode_parameters();
68 init_local_mode_parameters();
64 init_housekeeping_parameters();
69 init_housekeeping_parameters();
70
71 create_names(); // create all names
72
65 create_message_queues();
73 create_message_queues();
66
74
67 create_names(); // create all names
68 create_all_tasks(); // create all tasks
75 create_all_tasks(); // create all tasks
69
76
70 start_all_tasks(); // start all tasks
77 start_all_tasks(); // start all tasks
78
71 stop_current_mode(); // go in STANDBY mode
79 stop_current_mode(); // go in STANDBY mode
72
80
73 grspw_timecode_callback = &timecode_irq_handler;
81 grspw_timecode_callback = &timecode_irq_handler;
@@ -75,15 +83,19 rtems_task Init( rtems_task_argument ign
75 spacewire_configure_link();
83 spacewire_configure_link();
76
84
77 #ifdef GSA
85 #ifdef GSA
86 // mask IRQ lines
87 LEON_Mask_interrupt( IRQ_SM );
88 LEON_Mask_interrupt( IRQ_WF );
78 // Spectral Matrices simulator
89 // Spectral Matrices simulator
79 configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR, CLKDIV_SM_SIMULATOR,
90 configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR, CLKDIV_SM_SIMULATOR,
80 IRQ_SPARC_SM, spectral_matrices_isr );
91 IRQ_SPARC_SM, spectral_matrices_isr );
81 // WaveForms
92 // WaveForms
82 configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR, CLKDIV_WF_SIMULATOR,
93 configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR, CLKDIV_WF_SIMULATOR,
83 IRQ_SPARC_WF, waveforms_simulator_isr );
94 IRQ_SPARC_WF, waveforms_simulator_isr );
84 LEON_Mask_interrupt( IRQ_SM );
85 LEON_Mask_interrupt( IRQ_WF );
86 #else
95 #else
96 // mask IRQ lines
97 LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER );
98 LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX );
87 // reset configuration registers
99 // reset configuration registers
88 reset_waveform_picker_regs();
100 reset_waveform_picker_regs();
89 reset_spectral_matrix_regs();
101 reset_spectral_matrix_regs();
@@ -92,19 +104,21 rtems_task Init( rtems_task_argument ign
92 IRQ_SPARC_WAVEFORM_PICKER,
104 IRQ_SPARC_WAVEFORM_PICKER,
93 &old_isr_handler) ;
105 &old_isr_handler) ;
94 // configure IRQ handling for the spectral matrix unit
106 // configure IRQ handling for the spectral matrix unit
95 status = rtems_interrupt_catch( spectral_matrices_isr,
107 // status = rtems_interrupt_catch( spectral_matrices_isr,
96 IRQ_SPARC_SPECTRAL_MATRIX,
108 // IRQ_SPARC_SPECTRAL_MATRIX,
97 &old_isr_handler) ;
109 // &old_isr_handler) ;
98 // mask IRQ lines
110 // Spectral Matrices simulator
99 LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER );
111 configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR, CLKDIV_SM_SIMULATOR,
100 LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX );
112 IRQ_SPARC_SM, spectral_matrices_isr_simu );
101 #endif
113 #endif
102
114
115 PRINTF("delete INIT\n")
116
103 status = rtems_task_delete(RTEMS_SELF);
117 status = rtems_task_delete(RTEMS_SELF);
104
118
105 }
119 }
106
120
107 void init_parameter_dump(void)
121 void init_parameter_dump( void )
108 {
122 {
109 parameter_dump_packet.targetLogicalAddress = CCSDS_DESTINATION_ID;
123 parameter_dump_packet.targetLogicalAddress = CCSDS_DESTINATION_ID;
110 parameter_dump_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID;
124 parameter_dump_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID;
@@ -161,7 +175,7 void init_parameter_dump(void)
161 parameter_dump_packet.sy_lfr_s2_bp_p1 = (unsigned char) DEFAULT_SY_LFR_S2_BP_P1;
175 parameter_dump_packet.sy_lfr_s2_bp_p1 = (unsigned char) DEFAULT_SY_LFR_S2_BP_P1;
162 }
176 }
163
177
164 void init_local_mode_parameters(void)
178 void init_local_mode_parameters( void )
165 {
179 {
166 // LOCAL PARAMETERS
180 // LOCAL PARAMETERS
167 set_local_sbm1_nb_cwf_max();
181 set_local_sbm1_nb_cwf_max();
@@ -176,7 +190,7 void init_local_mode_parameters(void)
176 reset_local_sbm2_nb_cwf_sent();
190 reset_local_sbm2_nb_cwf_sent();
177 }
191 }
178
192
179 void init_housekeeping_parameters(void)
193 void init_housekeeping_parameters( void )
180 {
194 {
181 unsigned int i = 0;
195 unsigned int i = 0;
182 unsigned int j = 0;
196 unsigned int j = 0;
@@ -232,6 +246,9 int create_names( void )
232 // rate monotonic period name
246 // rate monotonic period name
233 HK_name = rtems_build_name( 'H', 'O', 'U', 'S' );
247 HK_name = rtems_build_name( 'H', 'O', 'U', 'S' );
234
248
249 misc_name[QUEUE_QUEU] = rtems_build_name( 'Q', 'U', 'E', 'U' );
250 misc_name[QUEUE_PKTS] = rtems_build_name( 'P', 'K', 'T', 'S' );
251
235 return 0;
252 return 0;
236 }
253 }
237
254
@@ -241,91 +258,91 int create_all_tasks( void )
241
258
242 // RECV
259 // RECV
243 status = rtems_task_create(
260 status = rtems_task_create(
244 Task_name[TASKID_RECV], TASK_PRIORITY_RECV, RTEMS_MINIMUM_STACK_SIZE * 2,
261 Task_name[TASKID_RECV], TASK_PRIORITY_RECV, RTEMS_MINIMUM_STACK_SIZE,
245 RTEMS_DEFAULT_MODES,
262 RTEMS_DEFAULT_MODES,
246 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV]
263 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_RECV]
247 );
264 );
248 // ACTN
265 // ACTN
249 status = rtems_task_create(
266 status = rtems_task_create(
250 Task_name[TASKID_ACTN], TASK_PRIORITY_ACTN, RTEMS_MINIMUM_STACK_SIZE * 2,
267 Task_name[TASKID_ACTN], TASK_PRIORITY_ACTN, RTEMS_MINIMUM_STACK_SIZE,
251 RTEMS_DEFAULT_MODES,
268 RTEMS_DEFAULT_MODES,
252 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_ACTN]
269 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_ACTN]
253 );
270 );
254 // SPIQ
271 // SPIQ
255 status = rtems_task_create(
272 status = rtems_task_create(
256 Task_name[TASKID_SPIQ], TASK_PRIORITY_SPIQ, RTEMS_MINIMUM_STACK_SIZE * 2,
273 Task_name[TASKID_SPIQ], TASK_PRIORITY_SPIQ, RTEMS_MINIMUM_STACK_SIZE,
257 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
274 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
258 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ]
275 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SPIQ]
259 );
276 );
260 // SMIQ
277 // SMIQ
261 status = rtems_task_create(
278 status = rtems_task_create(
262 Task_name[TASKID_SMIQ], TASK_PRIORITY_SMIQ, RTEMS_MINIMUM_STACK_SIZE * 2,
279 Task_name[TASKID_SMIQ], TASK_PRIORITY_SMIQ, RTEMS_MINIMUM_STACK_SIZE,
263 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
280 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
264 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SMIQ]
281 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SMIQ]
265 );
282 );
266 // STAT
283 // STAT
267 status = rtems_task_create(
284 status = rtems_task_create(
268 Task_name[TASKID_STAT], TASK_PRIORITY_STAT, RTEMS_MINIMUM_STACK_SIZE * 2,
285 Task_name[TASKID_STAT], TASK_PRIORITY_STAT, RTEMS_MINIMUM_STACK_SIZE,
269 RTEMS_DEFAULT_MODES,
286 RTEMS_DEFAULT_MODES,
270 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_STAT]
287 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_STAT]
271 );
288 );
272 // AVF0
289 // AVF0
273 status = rtems_task_create(
290 status = rtems_task_create(
274 Task_name[TASKID_AVF0], TASK_PRIORITY_AVF0, RTEMS_MINIMUM_STACK_SIZE * 2,
291 Task_name[TASKID_AVF0], TASK_PRIORITY_AVF0, RTEMS_MINIMUM_STACK_SIZE,
275 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
292 RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
276 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0]
293 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVF0]
277 );
294 );
278 // BPF0
295 // BPF0
279 status = rtems_task_create(
296 status = rtems_task_create(
280 Task_name[TASKID_BPF0], TASK_PRIORITY_BPF0, RTEMS_MINIMUM_STACK_SIZE * 2,
297 Task_name[TASKID_BPF0], TASK_PRIORITY_BPF0, RTEMS_MINIMUM_STACK_SIZE,
281 RTEMS_DEFAULT_MODES,
298 RTEMS_DEFAULT_MODES,
282 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_BPF0]
299 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_BPF0]
283 );
300 );
284 // WFRM
301 // WFRM
285 status = rtems_task_create(
302 status = rtems_task_create(
286 Task_name[TASKID_WFRM], TASK_PRIORITY_WFRM, RTEMS_MINIMUM_STACK_SIZE * 2,
303 Task_name[TASKID_WFRM], TASK_PRIORITY_WFRM, RTEMS_MINIMUM_STACK_SIZE,
287 RTEMS_DEFAULT_MODES,
304 RTEMS_DEFAULT_MODES,
288 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_WFRM]
305 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_WFRM]
289 );
306 );
290 // DUMB
307 // DUMB
291 status = rtems_task_create(
308 status = rtems_task_create(
292 Task_name[TASKID_DUMB], TASK_PRIORITY_DUMB, RTEMS_MINIMUM_STACK_SIZE * 2,
309 Task_name[TASKID_DUMB], TASK_PRIORITY_DUMB, RTEMS_MINIMUM_STACK_SIZE,
293 RTEMS_DEFAULT_MODES,
310 RTEMS_DEFAULT_MODES,
294 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB]
311 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_DUMB]
295 );
312 );
296 // HOUS
313 // HOUS
297 status = rtems_task_create(
314 status = rtems_task_create(
298 Task_name[TASKID_HOUS], TASK_PRIORITY_HOUS, RTEMS_MINIMUM_STACK_SIZE * 2,
315 Task_name[TASKID_HOUS], TASK_PRIORITY_HOUS, RTEMS_MINIMUM_STACK_SIZE,
299 RTEMS_DEFAULT_MODES,
316 RTEMS_DEFAULT_MODES,
300 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_HOUS]
317 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_HOUS]
301 );
318 );
302 // MATR
319 // MATR
303 status = rtems_task_create(
320 status = rtems_task_create(
304 Task_name[TASKID_MATR], TASK_PRIORITY_MATR, RTEMS_MINIMUM_STACK_SIZE * 2,
321 Task_name[TASKID_MATR], TASK_PRIORITY_MATR, RTEMS_MINIMUM_STACK_SIZE,
305 RTEMS_DEFAULT_MODES,
322 RTEMS_DEFAULT_MODES,
306 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_MATR]
323 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_MATR]
307 );
324 );
308 // CWF3
325 // CWF3
309 status = rtems_task_create(
326 status = rtems_task_create(
310 Task_name[TASKID_CWF3], TASK_PRIORITY_CWF3, RTEMS_MINIMUM_STACK_SIZE * 2,
327 Task_name[TASKID_CWF3], TASK_PRIORITY_CWF3, RTEMS_MINIMUM_STACK_SIZE,
311 RTEMS_DEFAULT_MODES,
328 RTEMS_DEFAULT_MODES,
312 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF3]
329 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF3]
313 );
330 );
314 // CWF2
331 // CWF2
315 status = rtems_task_create(
332 status = rtems_task_create(
316 Task_name[TASKID_CWF2], TASK_PRIORITY_CWF2, RTEMS_MINIMUM_STACK_SIZE * 2,
333 Task_name[TASKID_CWF2], TASK_PRIORITY_CWF2, RTEMS_MINIMUM_STACK_SIZE,
317 RTEMS_DEFAULT_MODES,
334 RTEMS_DEFAULT_MODES,
318 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF2]
335 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF2]
319 );
336 );
320 // CWF1
337 // CWF1
321 status = rtems_task_create(
338 status = rtems_task_create(
322 Task_name[TASKID_CWF1], TASK_PRIORITY_CWF1, RTEMS_MINIMUM_STACK_SIZE * 2,
339 Task_name[TASKID_CWF1], TASK_PRIORITY_CWF1, RTEMS_MINIMUM_STACK_SIZE,
323 RTEMS_DEFAULT_MODES,
340 RTEMS_DEFAULT_MODES,
324 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF1]
341 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF1]
325 );
342 );
326 // SEND
343 // SEND
327 status = rtems_task_create(
344 status = rtems_task_create(
328 Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE * 2,
345 Task_name[TASKID_SEND], TASK_PRIORITY_SEND, RTEMS_MINIMUM_STACK_SIZE,
329 RTEMS_DEFAULT_MODES,
346 RTEMS_DEFAULT_MODES,
330 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SEND]
347 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_SEND]
331 );
348 );
@@ -418,19 +435,16 int create_message_queues( void )
418 {
435 {
419 rtems_status_code status;
436 rtems_status_code status;
420
437
421 misc_name[0] = rtems_build_name( 'Q', 'U', 'E', 'U' );
438 status = rtems_message_queue_create( misc_name[QUEUE_QUEU], ACTION_MSG_QUEUE_COUNT, CCSDS_TC_PKT_MAX_SIZE,
422 misc_name[1] = rtems_build_name( 'P', 'K', 'T', 'S' );
439 RTEMS_FIFO | RTEMS_LOCAL, &misc_id[QUEUE_QUEU] );
423
424 status = rtems_message_queue_create( misc_name[0], ACTION_MSG_QUEUE_COUNT, CCSDS_TC_PKT_MAX_SIZE,
425 RTEMS_FIFO | RTEMS_LOCAL, &misc_id[0] );
426 if (status!=RTEMS_SUCCESSFUL) {
440 if (status!=RTEMS_SUCCESSFUL) {
427 PRINTF("in create_message_queues *** error creating QUEU\n")
441 PRINTF("in create_message_queues *** ERR creating QUEU\n")
428 }
442 }
429
443
430 status = rtems_message_queue_create( misc_name[1], ACTION_MSG_PKTS_COUNT, sizeof(spw_ioctl_pkt_send),
444 status = rtems_message_queue_create( misc_name[QUEUE_PKTS], ACTION_MSG_PKTS_COUNT, ACTION_MSG_PKTS_SIZE,
431 RTEMS_FIFO | RTEMS_LOCAL, &misc_id[1] );
445 RTEMS_FIFO | RTEMS_LOCAL, &misc_id[QUEUE_PKTS] );
432 if (status!=RTEMS_SUCCESSFUL) {
446 if (status!=RTEMS_SUCCESSFUL) {
433 PRINTF("in create_message_queues *** error creating PKTS\n")
447 PRINTF("in create_message_queues *** ERR creating PKTS\n")
434 }
448 }
435
449
436 return 0;
450 return 0;
@@ -162,7 +162,7 rtems_task hous_task(rtems_task_argument
162
162
163 spw_ioctl_send.hlen = 0;
163 spw_ioctl_send.hlen = 0;
164 spw_ioctl_send.hdr = NULL;
164 spw_ioctl_send.hdr = NULL;
165 spw_ioctl_send.dlen = sizeof(spw_ioctl_send);
165 spw_ioctl_send.dlen = PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES;
166 spw_ioctl_send.data = (char*) &housekeeping_packet;
166 spw_ioctl_send.data = (char*) &housekeeping_packet;
167 spw_ioctl_send.options = 0;
167 spw_ioctl_send.options = 0;
168
168
@@ -215,8 +215,7 rtems_task hous_task(rtems_task_argument
215 update_spacewire_statistics();
215 update_spacewire_statistics();
216
216
217 // SEND PACKET
217 // SEND PACKET
218 //result = write( fdSPW, &housekeeping_packet, LEN_TM_LFR_HK);
218 status = rtems_message_queue_send( misc_id[QUEUE_PKTS], &spw_ioctl_send, sizeof(spw_ioctl_send));
219 status = rtems_message_queue_send( misc_id[1], &spw_ioctl_send, sizeof(spw_ioctl_send));
220 if (status != RTEMS_SUCCESSFUL) {
219 if (status != RTEMS_SUCCESSFUL) {
221 PRINTF1("in HOUS *** ERR %d\n", (int) status)
220 PRINTF1("in HOUS *** ERR %d\n", (int) status)
222 }
221 }
@@ -233,22 +232,45 rtems_task hous_task(rtems_task_argument
233 rtems_task send_task( rtems_task_argument argument)
232 rtems_task send_task( rtems_task_argument argument)
234 {
233 {
235 rtems_status_code status; // RTEMS status code
234 rtems_status_code status; // RTEMS status code
236 spw_ioctl_pkt_send spw_ioctl_send_CWF; // incoming spw_ioctl_pkt_send structure
235 spw_ioctl_pkt_send spw_ioctl_send; // incoming spw_ioctl_pkt_send structure
237 size_t size; // size of the incoming TC packet
236 size_t size; // size of the incoming TC packet
237 u_int32_t count;
238
238
239 PRINTF("in SEND *** \n")
239 PRINTF("in SEND *** \n")
240
240
241 while(1)
241 while(1)
242 {
242 {
243 status = rtems_message_queue_receive(misc_id[1], (char*) &spw_ioctl_send_CWF, &size,
243 status = rtems_message_queue_receive(misc_id[QUEUE_PKTS], (char*) &spw_ioctl_send, &size,
244 RTEMS_WAIT, RTEMS_NO_TIMEOUT);
244 RTEMS_WAIT, RTEMS_NO_TIMEOUT);
245 if (status!=RTEMS_SUCCESSFUL) PRINTF1("ERR *** in task ACTN *** error receiving a message, code %d \n", status)
245 if (status!=RTEMS_SUCCESSFUL)
246 {
247 PRINTF1("in SEND *** (1) ERR = %d \n", status)
248 }
246 else
249 else
247 {
250 {
248 status = write_spw(&spw_ioctl_send_CWF);
251 status = write_spw(&spw_ioctl_send);
249 if (status != RTEMS_SUCCESSFUL) {
252 if (status != RTEMS_SUCCESSFUL) {
250 PRINTF("in SEND *** TRAFFIC JAM\n")
253 PRINTF("in SEND *** TRAFFIC JAM\n")
251 }
254 }
252 }
255 }
256
257 status = rtems_message_queue_get_number_pending( misc_id[QUEUE_PKTS], &count );
258 if (status != RTEMS_SUCCESSFUL)
259 {
260 PRINTF1("in SEND *** (2) ERR = %d \n", status)
261 }
262 else
263 {
264 if (count > maxCount)
265 {
266 maxCount = count;
267 }
268 }
253 }
269 }
254 }
270 }
271
272
273
274
275
276
@@ -81,8 +81,16 rtems_isr spectral_matrices_isr( rtems_v
81 }
81 }
82 }
82 }
83
83
84 rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector )
85 {
86 if (rtems_event_send( Task_id[TASKID_SMIQ], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
87 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_4 );
88 }
89 }
90
84 //************
91 //************
85 // RTEMS TASKS
92 // RTEMS TASKS
93
86 rtems_task smiq_task(rtems_task_argument argument) // process the Spectral Matrices IRQ
94 rtems_task smiq_task(rtems_task_argument argument) // process the Spectral Matrices IRQ
87 {
95 {
88 rtems_event_set event_out;
96 rtems_event_set event_out;
@@ -93,8 +101,8 rtems_task smiq_task(rtems_task_argument
93 while(1){
101 while(1){
94 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
102 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
95 nb_interrupt_f0 = nb_interrupt_f0 + 1;
103 nb_interrupt_f0 = nb_interrupt_f0 + 1;
96 if (nb_interrupt_f0 == param_local.local_nb_interrupt_f0_MAX ){
104 if (nb_interrupt_f0 == NB_SM_TO_RECEIVE_BEFORE_AVF0 ){
97 if (rtems_event_send( Task_id[TASKID_MATR], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
105 if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
98 {
106 {
99 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
107 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
100 }
108 }
@@ -103,6 +111,26 rtems_task smiq_task(rtems_task_argument
103 }
111 }
104 }
112 }
105
113
114 //rtems_task smiq_task(rtems_task_argument argument) // process the Spectral Matrices IRQ
115 //{
116 // rtems_event_set event_out;
117 // unsigned int nb_interrupt_f0 = 0;
118
119 // PRINTF("in SMIQ *** \n")
120
121 // while(1){
122 // rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
123 // nb_interrupt_f0 = nb_interrupt_f0 + 1;
124 // if (nb_interrupt_f0 == param_local.local_nb_interrupt_f0_MAX ){
125 // if (rtems_event_send( Task_id[TASKID_MATR], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
126 // {
127 // rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
128 // }
129 // nb_interrupt_f0 = 0;
130 // }
131 // }
132 //}
133
106 rtems_task spw_bppr_task(rtems_task_argument argument)
134 rtems_task spw_bppr_task(rtems_task_argument argument)
107 {
135 {
108 rtems_status_code status;
136 rtems_status_code status;
@@ -140,7 +168,7 rtems_task spw_bppr_task(rtems_task_argu
140
168
141 rtems_task avf0_task(rtems_task_argument argument)
169 rtems_task avf0_task(rtems_task_argument argument)
142 {
170 {
143 //int i;
171 int i;
144 static int nb_average;
172 static int nb_average;
145 rtems_event_set event_out;
173 rtems_event_set event_out;
146 rtems_status_code status;
174 rtems_status_code status;
@@ -151,7 +179,7 rtems_task avf0_task(rtems_task_argument
151
179
152 while(1){
180 while(1){
153 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
181 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
154 /*for(i=0; i<TOTAL_SIZE_SM; i++){
182 for(i=0; i<TOTAL_SIZE_SM; i++){
155 averaged_spec_mat_f0[i] = averaged_spec_mat_f0[i] + spec_mat_f0_a[i]
183 averaged_spec_mat_f0[i] = averaged_spec_mat_f0[i] + spec_mat_f0_a[i]
156 + spec_mat_f0_b[i]
184 + spec_mat_f0_b[i]
157 + spec_mat_f0_c[i]
185 + spec_mat_f0_c[i]
@@ -160,7 +188,7 rtems_task avf0_task(rtems_task_argument
160 + spec_mat_f0_f[i]
188 + spec_mat_f0_f[i]
161 + spec_mat_f0_g[i]
189 + spec_mat_f0_g[i]
162 + spec_mat_f0_h[i];
190 + spec_mat_f0_h[i];
163 }*/
191 }
164 nb_average = nb_average + NB_SM_TO_RECEIVE_BEFORE_AVF0;
192 nb_average = nb_average + NB_SM_TO_RECEIVE_BEFORE_AVF0;
165 if (nb_average == NB_AVERAGE_NORMAL_f0) {
193 if (nb_average == NB_AVERAGE_NORMAL_f0) {
166 nb_average = 0;
194 nb_average = 0;
@@ -454,8 +482,8 void init_header_asm( Header_TM_LFR_SCIE
454 header->protocolIdentifier = CCSDS_PROTOCOLE_ID;
482 header->protocolIdentifier = CCSDS_PROTOCOLE_ID;
455 header->reserved = 0x00;
483 header->reserved = 0x00;
456 header->userApplication = CCSDS_USER_APP;
484 header->userApplication = CCSDS_USER_APP;
457 header->packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL >> 8);
485 header->packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8);
458 header->packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL);
486 header->packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST);
459 header->packetSequenceControl[0] = 0xc0;
487 header->packetSequenceControl[0] = 0xc0;
460 header->packetSequenceControl[1] = 0x00;
488 header->packetSequenceControl[1] = 0x00;
461 header->packetLength[0] = 0x00;
489 header->packetLength[0] = 0x00;
@@ -137,7 +137,7 int TC_acceptance(ccsdsTelecommandPacket
137 status = write( fdSPW, (char *) &packet, PACKET_LENGTH_TC_EXE_CORRUPTED + CCSDS_TC_TM_PACKET_OFFSET + 4);
137 status = write( fdSPW, (char *) &packet, PACKET_LENGTH_TC_EXE_CORRUPTED + CCSDS_TC_TM_PACKET_OFFSET + 4);
138 }
138 }
139 else { // send valid TC to the action launcher
139 else { // send valid TC to the action launcher
140 status = rtems_message_queue_send( misc_id[0], TC, tc_len_recv + CCSDS_TC_TM_PACKET_OFFSET + 3);
140 status = rtems_message_queue_send( misc_id[QUEUE_QUEU], TC, tc_len_recv + CCSDS_TC_TM_PACKET_OFFSET + 3);
141 ret = -1;
141 ret = -1;
142 }
142 }
143 return ret;
143 return ret;
@@ -335,12 +335,12 unsigned char TM_build_header( enum TM_T
335 TMHeader->serviceSubType = TM_SUBTYPE_HK; // subtype
335 TMHeader->serviceSubType = TM_SUBTYPE_HK; // subtype
336 break;
336 break;
337 case(TM_LFR_SCI):
337 case(TM_LFR_SCI):
338 TMHeader->packetID[1] = (unsigned char) TM_PACKET_ID_SCIENCE_NORMAL;
338 TMHeader->packetID[1] = (unsigned char) TM_PACKET_ID_SCIENCE_NORMAL_BURST;
339 TMHeader->serviceType = TM_TYPE_LFR_SCIENCE; // type
339 TMHeader->serviceType = TM_TYPE_LFR_SCIENCE; // type
340 TMHeader->serviceSubType = TM_SUBTYPE_SCIENCE; // subtype
340 TMHeader->serviceSubType = TM_SUBTYPE_SCIENCE; // subtype
341 break;
341 break;
342 case(TM_LFR_SCI_SBM):
342 case(TM_LFR_SCI_SBM):
343 TMHeader->packetID[1] = (unsigned char) TM_PACKET_ID_SCIENCE_BURST_SBM1_SBM2;
343 TMHeader->packetID[1] = (unsigned char) TM_PACKET_ID_SCIENCE_SBM1_SBM2;
344 TMHeader->serviceType = TM_TYPE_LFR_SCIENCE; // type
344 TMHeader->serviceType = TM_TYPE_LFR_SCIENCE; // type
345 TMHeader->serviceSubType = TM_SUBTYPE_SCIENCE; // subtype
345 TMHeader->serviceSubType = TM_SUBTYPE_SCIENCE; // subtype
346 break;
346 break;
@@ -389,7 +389,6 rtems_task recv_task( rtems_task_argumen
389 //}
389 //}
390 }
390 }
391 else {
391 else {
392 PRINTF1("Got pck of length %d\n", len+1)
393 if ( (len+1) < CCSDS_TC_PKT_MIN_SIZE ) {
392 if ( (len+1) < CCSDS_TC_PKT_MIN_SIZE ) {
394 PRINTF("In RECV *** packet lenght too short\n")
393 PRINTF("In RECV *** packet lenght too short\n")
395 }
394 }
@@ -422,7 +421,7 rtems_task actn_task( rtems_task_argumen
422
421
423 while(1)
422 while(1)
424 {
423 {
425 status = rtems_message_queue_receive(misc_id[0], (char*) &TC, &size,
424 status = rtems_message_queue_receive(misc_id[QUEUE_QUEU], (char*) &TC, &size,
426 RTEMS_WAIT, RTEMS_NO_TIMEOUT);
425 RTEMS_WAIT, RTEMS_NO_TIMEOUT);
427 if (status!=RTEMS_SUCCESSFUL) PRINTF1("ERR *** in task ACTN *** error receiving a message, code %d \n", status)
426 if (status!=RTEMS_SUCCESSFUL) PRINTF1("ERR *** in task ACTN *** error receiving a message, code %d \n", status)
428 else
427 else
@@ -545,28 +544,43 int action_load_common_par(ccsdsTelecomm
545 int action_load_normal_par(ccsdsTelecommandPacket_t *TC)
544 int action_load_normal_par(ccsdsTelecommandPacket_t *TC)
546 {
545 {
547 int result;
546 int result;
548 unsigned char lfrMode;
547 unsigned int tmp;
549
548
550 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
549 result = LFR_SUCCESSFUL;
551
550
552 if ( lfrMode == LFR_MODE_NORMAL ) {
551 if ( lfrCurrentMode == LFR_MODE_NORMAL ) {
553 send_tm_lfr_tc_exe_not_executable( TC );
552 send_tm_lfr_tc_exe_not_executable( TC );
554 result = LFR_DEFAULT;
553 result = LFR_DEFAULT;
555 }
554 }
556 else {
555 else {
556 // sy_lfr_n_swf_l
557 parameter_dump_packet.sy_lfr_n_swf_l[0] = TC->dataAndCRC[0];
557 parameter_d