@@ -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: |
|
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-0 |
|
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 0x1 |
|
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 |
|
24 | #define TM_PACKET_ID_SCIENCE_NORMAL_BURST 0x0ccc // PID 76 CAT 12 | |
25 |
#define TM_PACKET_ID_SCIENCE_ |
|
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_ |
|
121 | #define TASK_PRIORITY_SEND 30 | |
124 | #define TASK_PRIORITY_ACTN 12 |
|
122 | // | |
125 |
#define TASK_PRIORITY_ |
|
123 | #define TASK_PRIORITY_RECV 40 | |
126 |
#define TASK_PRIORITY_ |
|
124 | #define TASK_PRIORITY_ACTN 40 | |
127 | #define TASK_PRIORITY_CWF2 15 |
|
125 | // | |
128 |
#define TASK_PRIORITY_ |
|
126 | #define TASK_PRIORITY_HOUS 40 | |
129 |
#define TASK_PRIORITY_CWF |
|
127 | #define TASK_PRIORITY_CWF1 40 | |
130 |
#define TASK_PRIORITY_ |
|
128 | #define TASK_PRIORITY_CWF2 40 | |
131 |
#define TASK_PRIORITY_ |
|
129 | #define TASK_PRIORITY_WFRM 40 | |
132 |
#define TASK_PRIORITY_ |
|
130 | #define TASK_PRIORITY_CWF3 40 | |
133 | #define TASK_PRIORITY_STAT 251 |
|
131 | // | |
134 |
#define TASK_PRIORITY_ |
|
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( |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
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 *** |
|
441 | PRINTF("in create_message_queues *** ERR creating QUEU\n") | |
428 | } |
|
442 | } | |
429 |
|
443 | |||
430 |
status = rtems_message_queue_create( misc_name[ |
|
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[ |
|
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 *** |
|
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 |
|
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[ |
|
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 |
|
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_ |
|
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 |
|
|
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 |
|
|
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[ |
|
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_ |
|
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[ |
|
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 |
|
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_dump_packet.sy_lfr_n_swf_l[0] = TC->dataAndCRC[0]; | |
558 | parameter_dump_packet.sy_lfr_n_swf_l[1] = TC->dataAndCRC[1]; |
|
558 | parameter_dump_packet.sy_lfr_n_swf_l[1] = TC->dataAndCRC[1]; | |
559 |
|
559 | |||
560 | parameter_dump_packet.sy_lfr_n_swf_p[0] = TC->dataAndCRC[2]; |
|
560 | // sy_lfr_n_swf_p | |
561 | parameter_dump_packet.sy_lfr_n_swf_p[1] = TC->dataAndCRC[3]; |
|
561 | tmp = (unsigned int ) floor( | |
|
562 | (TC->dataAndCRC[2] * 256 | |||
|
563 | + TC->dataAndCRC[3])/8 | |||
|
564 | ) * 8; | |||
|
565 | if ( (tmp < 16) || (tmp>65528) ) | |||
|
566 | { | |||
|
567 | result = LFR_DEFAULT; | |||
|
568 | } | |||
|
569 | else | |||
|
570 | { | |||
|
571 | parameter_dump_packet.sy_lfr_n_swf_p[0] = (unsigned char) (tmp >> 8); | |||
|
572 | parameter_dump_packet.sy_lfr_n_swf_p[1] = (unsigned char) (tmp ); | |||
|
573 | } | |||
562 |
|
574 | |||
|
575 | // sy_lfr_n_asm_p | |||
563 | parameter_dump_packet.sy_lfr_n_asm_p[0] = TC->dataAndCRC[4]; |
|
576 | parameter_dump_packet.sy_lfr_n_asm_p[0] = TC->dataAndCRC[4]; | |
564 | parameter_dump_packet.sy_lfr_n_asm_p[1] = TC->dataAndCRC[5]; |
|
577 | parameter_dump_packet.sy_lfr_n_asm_p[1] = TC->dataAndCRC[5]; | |
565 |
|
578 | |||
|
579 | // sy_lfr_n_bp_p0 | |||
566 | parameter_dump_packet.sy_lfr_n_bp_p0 = TC->dataAndCRC[6]; |
|
580 | parameter_dump_packet.sy_lfr_n_bp_p0 = TC->dataAndCRC[6]; | |
|
581 | ||||
|
582 | // sy_lfr_n_bp_p1 | |||
567 | parameter_dump_packet.sy_lfr_n_bp_p1 = TC->dataAndCRC[7]; |
|
583 | parameter_dump_packet.sy_lfr_n_bp_p1 = TC->dataAndCRC[7]; | |
568 |
|
||||
569 | result = LFR_SUCCESSFUL; |
|
|||
570 | } |
|
584 | } | |
571 |
|
585 | |||
572 | return result; |
|
586 | return result; | |
@@ -670,6 +684,7 int action_enter_mode(ccsdsTelecommandPa | |||||
670 | if (requestedMode != LFR_MODE_STANDBY) |
|
684 | if (requestedMode != LFR_MODE_STANDBY) | |
671 | { |
|
685 | { | |
672 | rtems_cpu_usage_reset(); |
|
686 | rtems_cpu_usage_reset(); | |
|
687 | maxCount = 0; | |||
673 | } |
|
688 | } | |
674 | #endif |
|
689 | #endif | |
675 |
|
690 | |||
@@ -854,6 +869,7 int stop_current_mode() | |||||
854 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt |
|
869 | LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt | |
855 | LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // mask spectral matrix interrupt |
|
870 | LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // mask spectral matrix interrupt | |
856 | LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt |
|
871 | LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt | |
|
872 | LEON_Mask_interrupt( IRQ_SM ); | |||
857 | #endif |
|
873 | #endif | |
858 | //********************** |
|
874 | //********************** | |
859 | // suspend several tasks |
|
875 | // suspend several tasks | |
@@ -918,9 +934,17 int enter_mode(unsigned char mode, ccsds | |||||
918 | int enter_standby_mode() |
|
934 | int enter_standby_mode() | |
919 | { |
|
935 | { | |
920 | reset_waveform_picker_regs(); |
|
936 | reset_waveform_picker_regs(); | |
|
937 | ||||
|
938 | PRINTF1("maxCount = %d\n", maxCount) | |||
|
939 | ||||
921 | #ifdef PRINT_TASK_STATISTICS |
|
940 | #ifdef PRINT_TASK_STATISTICS | |
922 | rtems_cpu_usage_report(); |
|
941 | rtems_cpu_usage_report(); | |
923 | #endif |
|
942 | #endif | |
|
943 | ||||
|
944 | #ifdef PRINT_STACK_REPORT | |||
|
945 | rtems_stack_checker_report_usage(); | |||
|
946 | #endif | |||
|
947 | ||||
924 | return LFR_SUCCESSFUL; |
|
948 | return LFR_SUCCESSFUL; | |
925 | } |
|
949 | } | |
926 |
|
950 | |||
@@ -996,6 +1020,10 int enter_sbm1_mode() | |||||
996 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); |
|
1020 | LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER ); | |
997 | reset_waveform_picker_regs(); |
|
1021 | reset_waveform_picker_regs(); | |
998 | set_wfp_burst_enable_register(LFR_MODE_SBM1); |
|
1022 | set_wfp_burst_enable_register(LFR_MODE_SBM1); | |
|
1023 | // SM simulation | |||
|
1024 | timer_start( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR ); | |||
|
1025 | LEON_Clear_interrupt( IRQ_SM ); // the IRQ_SM seems to be incompatible with the IRQ_WF on the xilinx board | |||
|
1026 | LEON_Unmask_interrupt( IRQ_SM ); | |||
999 | #endif |
|
1027 | #endif | |
1000 |
|
1028 | |||
1001 | return status; |
|
1029 | return status; | |
@@ -1082,6 +1110,8 int send_tm_lfr_tc_exe_success(ccsdsTele | |||||
1082 | char data[4]; |
|
1110 | char data[4]; | |
1083 | spw_ioctl_pkt_send spw_ioctl_send; |
|
1111 | spw_ioctl_pkt_send spw_ioctl_send; | |
1084 |
|
1112 | |||
|
1113 | ret = LFR_SUCCESSFUL; | |||
|
1114 | ||||
1085 | TM_build_header( TM_LFR_TC_EXE_OK, PACKET_LENGTH_TC_EXE_SUCCESS, |
|
1115 | TM_build_header( TM_LFR_TC_EXE_OK, PACKET_LENGTH_TC_EXE_SUCCESS, | |
1086 | &TM_header, |
|
1116 | &TM_header, | |
1087 | TC->sourceID); // TC source ID |
|
1117 | TC->sourceID); // TC source ID | |
@@ -1100,7 +1130,7 int send_tm_lfr_tc_exe_success(ccsdsTele | |||||
1100 |
|
1130 | |||
1101 | // SEND DATA |
|
1131 | // SEND DATA | |
1102 | //status = ioctl( fdSPW, SPACEWIRE_IOCTRL_SEND, &spw_ioctl_send ); |
|
1132 | //status = ioctl( fdSPW, SPACEWIRE_IOCTRL_SEND, &spw_ioctl_send ); | |
1103 |
status = rtems_message_queue_ |
|
1133 | status = rtems_message_queue_urgent( misc_id[QUEUE_PKTS], &spw_ioctl_send, sizeof(spw_ioctl_send)); | |
1104 | if (status != RTEMS_SUCCESSFUL) { |
|
1134 | if (status != RTEMS_SUCCESSFUL) { | |
1105 | PRINTF("in send_tm_lfr_tc_exe_success *** ERR\n") |
|
1135 | PRINTF("in send_tm_lfr_tc_exe_success *** ERR\n") | |
1106 | ret = LFR_DEFAULT; |
|
1136 | ret = LFR_DEFAULT; | |
@@ -1111,11 +1141,14 int send_tm_lfr_tc_exe_success(ccsdsTele | |||||
1111 |
|
1141 | |||
1112 | int send_tm_lfr_tc_exe_not_executable(ccsdsTelecommandPacket_t *TC) |
|
1142 | int send_tm_lfr_tc_exe_not_executable(ccsdsTelecommandPacket_t *TC) | |
1113 | { |
|
1143 | { | |
|
1144 | int ret; | |||
1114 | rtems_status_code status; |
|
1145 | rtems_status_code status; | |
1115 | TMHeader_t TM_header; |
|
1146 | TMHeader_t TM_header; | |
1116 | char data[10]; |
|
1147 | char data[10]; | |
1117 | spw_ioctl_pkt_send spw_ioctl_send; |
|
1148 | spw_ioctl_pkt_send spw_ioctl_send; | |
1118 |
|
1149 | |||
|
1150 | ret = LFR_SUCCESSFUL; | |||
|
1151 | ||||
1119 | TM_build_header( TM_LFR_TC_EXE_ERR, PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE, |
|
1152 | TM_build_header( TM_LFR_TC_EXE_ERR, PACKET_LENGTH_TC_EXE_NOT_EXECUTABLE, | |
1120 | &TM_header, |
|
1153 | &TM_header, | |
1121 | TC->sourceID); // TC source ID |
|
1154 | TC->sourceID); // TC source ID | |
@@ -1139,18 +1172,26 int send_tm_lfr_tc_exe_not_executable(cc | |||||
1139 | spw_ioctl_send.options = 0; |
|
1172 | spw_ioctl_send.options = 0; | |
1140 |
|
1173 | |||
1141 | // SEND DATA |
|
1174 | // SEND DATA | |
1142 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_SEND, &spw_ioctl_send ); |
|
1175 | //status = ioctl( fdSPW, SPACEWIRE_IOCTRL_SEND, &spw_ioctl_send ); | |
|
1176 | status = rtems_message_queue_urgent( misc_id[QUEUE_PKTS], &spw_ioctl_send, sizeof(spw_ioctl_send)); | |||
|
1177 | if (status != RTEMS_SUCCESSFUL) { | |||
|
1178 | PRINTF("in send_tm_lfr_tc_exe_success *** ERR\n") | |||
|
1179 | ret = LFR_DEFAULT; | |||
|
1180 | } | |||
1143 |
|
1181 | |||
1144 | return LFR_SUCCESSFUL; |
|
1182 | return LFR_SUCCESSFUL; | |
1145 | } |
|
1183 | } | |
1146 |
|
1184 | |||
1147 | int send_tm_lfr_tc_exe_not_implemented(ccsdsTelecommandPacket_t *TC) |
|
1185 | int send_tm_lfr_tc_exe_not_implemented(ccsdsTelecommandPacket_t *TC) | |
1148 | { |
|
1186 | { | |
|
1187 | int ret; | |||
1149 | rtems_status_code status; |
|
1188 | rtems_status_code status; | |
1150 | TMHeader_t TM_header; |
|
1189 | TMHeader_t TM_header; | |
1151 | char data[8]; |
|
1190 | char data[8]; | |
1152 | spw_ioctl_pkt_send spw_ioctl_send; |
|
1191 | spw_ioctl_pkt_send spw_ioctl_send; | |
1153 |
|
1192 | |||
|
1193 | ret = LFR_SUCCESSFUL; | |||
|
1194 | ||||
1154 | TM_build_header( TM_LFR_TC_EXE_ERR, PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED, |
|
1195 | TM_build_header( TM_LFR_TC_EXE_ERR, PACKET_LENGTH_TC_EXE_NOT_IMPLEMENTED, | |
1155 | &TM_header, |
|
1196 | &TM_header, | |
1156 | TC->sourceID); // TC source ID |
|
1197 | TC->sourceID); // TC source ID | |
@@ -1172,13 +1213,19 int send_tm_lfr_tc_exe_not_implemented(c | |||||
1172 | spw_ioctl_send.options = 0; |
|
1213 | spw_ioctl_send.options = 0; | |
1173 |
|
1214 | |||
1174 | // SEND DATA |
|
1215 | // SEND DATA | |
1175 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_SEND, &spw_ioctl_send ); |
|
1216 | //status = ioctl( fdSPW, SPACEWIRE_IOCTRL_SEND, &spw_ioctl_send ); | |
|
1217 | status = rtems_message_queue_urgent( misc_id[QUEUE_PKTS], &spw_ioctl_send, sizeof(spw_ioctl_send)); | |||
|
1218 | if (status != RTEMS_SUCCESSFUL) { | |||
|
1219 | PRINTF("in send_tm_lfr_tc_exe_not_implemented *** ERR\n") | |||
|
1220 | ret = LFR_DEFAULT; | |||
|
1221 | } | |||
1176 |
|
1222 | |||
1177 | return LFR_SUCCESSFUL; |
|
1223 | return LFR_SUCCESSFUL; | |
1178 | } |
|
1224 | } | |
1179 |
|
1225 | |||
1180 | int send_tm_lfr_tc_exe_error(ccsdsTelecommandPacket_t *TC) |
|
1226 | int send_tm_lfr_tc_exe_error(ccsdsTelecommandPacket_t *TC) | |
1181 | { |
|
1227 | { | |
|
1228 | int ret; | |||
1182 | rtems_status_code status; |
|
1229 | rtems_status_code status; | |
1183 | TMHeader_t TM_header; |
|
1230 | TMHeader_t TM_header; | |
1184 | char data[8]; |
|
1231 | char data[8]; | |
@@ -1205,7 +1252,12 int send_tm_lfr_tc_exe_error(ccsdsTeleco | |||||
1205 | spw_ioctl_send.options = 0; |
|
1252 | spw_ioctl_send.options = 0; | |
1206 |
|
1253 | |||
1207 | // SEND DATA |
|
1254 | // SEND DATA | |
1208 | status = ioctl( fdSPW, SPACEWIRE_IOCTRL_SEND, &spw_ioctl_send ); |
|
1255 | //status = ioctl( fdSPW, SPACEWIRE_IOCTRL_SEND, &spw_ioctl_send ); | |
|
1256 | status = rtems_message_queue_urgent( misc_id[QUEUE_PKTS], &spw_ioctl_send, sizeof(spw_ioctl_send)); | |||
|
1257 | if (status != RTEMS_SUCCESSFUL) { | |||
|
1258 | PRINTF("in send_tm_lfr_tc_exe_error *** ERR\n") | |||
|
1259 | ret = LFR_DEFAULT; | |||
|
1260 | } | |||
1209 |
|
1261 | |||
1210 | return LFR_SUCCESSFUL; |
|
1262 | return LFR_SUCCESSFUL; | |
1211 | } |
|
1263 | } |
@@ -1,9 +1,13 | |||||
1 | #include <wf_handler.h> |
|
1 | #include <wf_handler.h> | |
2 |
|
2 | |||
3 | Header_TM_LFR_SCIENCE_SWF_t headerSWF_F0_F1_F2[3][7]; |
|
3 | // SWF | |
|
4 | Header_TM_LFR_SCIENCE_SWF_t headerSWF_F0[7]; | |||
|
5 | Header_TM_LFR_SCIENCE_SWF_t headerSWF_F1[7]; | |||
|
6 | Header_TM_LFR_SCIENCE_SWF_t headerSWF_F2[7]; | |||
|
7 | // CWF | |||
4 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F1[7]; |
|
8 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F1[7]; | |
5 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_BURST[7]; |
|
9 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_BURST[7]; | |
6 |
Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_SBM |
|
10 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_SBM2[7]; | |
7 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3[7]; |
|
11 | Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3[7]; | |
8 |
|
12 | |||
9 | unsigned char doubleSendCWF1 = 0; |
|
13 | unsigned char doubleSendCWF1 = 0; | |
@@ -127,7 +131,19 rtems_isr waveforms_isr( rtems_vector_nu | |||||
127 | #else |
|
131 | #else | |
128 | if ((waveform_picker_regs->status & 0x04) == 0x04){ // [0100] check the f2 full bit |
|
132 | if ((waveform_picker_regs->status & 0x04) == 0x04){ // [0100] check the f2 full bit | |
129 | // (1) change the receiving buffer for the waveform picker |
|
133 | // (1) change the receiving buffer for the waveform picker | |
130 | if ( waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2 ) { |
|
134 | if ( param_local.local_sbm2_nb_cwf_sent == (param_local.local_sbm2_nb_cwf_max-1) ) | |
|
135 | { | |||
|
136 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_norm); | |||
|
137 | } | |||
|
138 | else if ( waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2_norm ) { | |||
|
139 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2); | |||
|
140 | doubleSendCWF2 = 1; | |||
|
141 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM2_WFRM ) != RTEMS_SUCCESSFUL) { | |||
|
142 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |||
|
143 | } | |||
|
144 | reset_local_sbm2_nb_cwf_sent(); | |||
|
145 | } | |||
|
146 | else if ( waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2 ) { | |||
131 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_bis); |
|
147 | waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2_bis); | |
132 | } |
|
148 | } | |
133 | else { |
|
149 | else { | |
@@ -144,8 +160,6 rtems_isr waveforms_isr( rtems_vector_nu | |||||
144 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); |
|
160 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ); | |
145 | } |
|
161 | } | |
146 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffccc; // [1111 1100 1100 1100] f1, f0 bits = 0 |
|
162 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffccc; // [1111 1100 1100 1100] f1, f0 bits = 0 | |
147 | doubleSendCWF2 = 1; |
|
|||
148 | reset_local_sbm2_nb_cwf_sent(); |
|
|||
149 | } |
|
163 | } | |
150 | #endif |
|
164 | #endif | |
151 | break; |
|
165 | break; | |
@@ -183,9 +197,9 rtems_task wfrm_task(rtems_task_argument | |||||
183 | { |
|
197 | { | |
184 | rtems_event_set event_out; |
|
198 | rtems_event_set event_out; | |
185 |
|
199 | |||
186 | init_header_snapshot_wf_table( SID_NORM_SWF_F0 ); |
|
200 | init_header_snapshot_wf_table( SID_NORM_SWF_F0, headerSWF_F0 ); | |
187 | init_header_snapshot_wf_table( SID_NORM_SWF_F1 ); |
|
201 | init_header_snapshot_wf_table( SID_NORM_SWF_F1, headerSWF_F1 ); | |
188 | init_header_snapshot_wf_table( SID_NORM_SWF_F2 ); |
|
202 | init_header_snapshot_wf_table( SID_NORM_SWF_F2, headerSWF_F2 ); | |
189 |
|
203 | |||
190 | init_waveforms(); |
|
204 | init_waveforms(); | |
191 |
|
205 | |||
@@ -193,36 +207,41 rtems_task wfrm_task(rtems_task_argument | |||||
193 |
|
207 | |||
194 | while(1){ |
|
208 | while(1){ | |
195 | // wait for an RTEMS_EVENT |
|
209 | // wait for an RTEMS_EVENT | |
196 |
rtems_event_receive(RTEMS_EVENT_MODE_NORMAL | RTEMS_EVENT_MODE_SBM1 |
|
210 | rtems_event_receive(RTEMS_EVENT_MODE_NORMAL | RTEMS_EVENT_MODE_SBM1 | |
|
211 | | RTEMS_EVENT_MODE_SBM2 | RTEMS_EVENT_MODE_SBM2_WFRM, | |||
197 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
212 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); | |
198 |
|
213 | |||
199 | switch( event_out) { |
|
214 | switch( event_out) { | |
200 |
|
215 | |||
201 |
|
|
216 | case RTEMS_EVENT_MODE_NORMAL: | |
202 |
|
|
217 | send_waveform_SWF(wf_snap_f0, SID_NORM_SWF_F0, headerSWF_F0); | |
203 |
|
|
218 | send_waveform_SWF(wf_snap_f1, SID_NORM_SWF_F1, headerSWF_F1); | |
204 |
|
|
219 | send_waveform_SWF(wf_snap_f2, SID_NORM_SWF_F2, headerSWF_F2); | |
205 | #ifdef GSA |
|
220 | #ifdef GSA | |
206 |
|
|
221 | waveform_picker_regs->status = waveform_picker_regs->status & 0xf888; // [1111 1000 1000 1000] f2, f1, f0 bits =0 | |
207 | #endif |
|
|||
208 | break; |
|
|||
209 |
|
||||
210 | case RTEMS_EVENT_MODE_SBM1: |
|
|||
211 | send_waveform_SWF(wf_snap_f0, SID_NORM_SWF_F0); |
|
|||
212 | send_waveform_SWF(wf_snap_f1_norm, SID_NORM_SWF_F1); |
|
|||
213 | send_waveform_SWF(wf_snap_f2, SID_NORM_SWF_F2); |
|
|||
214 | #ifdef GSA |
|
|||
215 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffaaa; // [1111 1010 1010 1010] f2, f0 bits = 0 |
|
|||
216 | #endif |
|
222 | #endif | |
217 | break; |
|
223 | break; | |
218 |
|
224 | |||
219 |
|
|
225 | case RTEMS_EVENT_MODE_SBM1: | |
220 |
|
|
226 | send_waveform_SWF(wf_snap_f0, SID_NORM_SWF_F0, headerSWF_F0); | |
221 |
|
|
227 | send_waveform_SWF(wf_snap_f1_norm, SID_NORM_SWF_F1, headerSWF_F1); | |
|
228 | send_waveform_SWF(wf_snap_f2, SID_NORM_SWF_F2, headerSWF_F2); | |||
222 | #ifdef GSA |
|
229 | #ifdef GSA | |
223 |
|
|
230 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffaaa; // [1111 1010 1010 1010] f2, f0 bits = 0 | |
224 | #endif |
|
231 | #endif | |
225 |
|
|
232 | break; | |
|
233 | ||||
|
234 | case RTEMS_EVENT_MODE_SBM2: | |||
|
235 | send_waveform_SWF(wf_snap_f0, SID_NORM_SWF_F0, headerSWF_F0); | |||
|
236 | send_waveform_SWF(wf_snap_f1, SID_NORM_SWF_F1, headerSWF_F1); | |||
|
237 | #ifdef GSA | |||
|
238 | waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffccc; // [1111 1100 1100 1100] f1, f0 bits = 0 | |||
|
239 | #endif | |||
|
240 | break; | |||
|
241 | ||||
|
242 | case RTEMS_EVENT_MODE_SBM2_WFRM: | |||
|
243 | send_waveform_SWF(wf_snap_f2_norm, SID_NORM_SWF_F2, headerSWF_F2); | |||
|
244 | break; | |||
226 |
|
245 | |||
227 | default: |
|
246 | default: | |
228 | break; |
|
247 | break; | |
@@ -267,7 +286,7 rtems_task cwf2_task(rtems_task_argument | |||||
267 | rtems_event_set event_out; |
|
286 | rtems_event_set event_out; | |
268 |
|
287 | |||
269 | init_header_continuous_wf_table( SID_BURST_CWF_F2, headerCWF_F2_BURST ); |
|
288 | init_header_continuous_wf_table( SID_BURST_CWF_F2, headerCWF_F2_BURST ); | |
270 |
init_header_continuous_wf_table( SID_SBM2_CWF_F2, headerCWF_F2_SBM |
|
289 | init_header_continuous_wf_table( SID_SBM2_CWF_F2, headerCWF_F2_SBM2 ); | |
271 |
|
290 | |||
272 | PRINTF("in CWF2 ***\n") |
|
291 | PRINTF("in CWF2 ***\n") | |
273 |
|
292 | |||
@@ -292,12 +311,18 rtems_task cwf2_task(rtems_task_argument | |||||
292 | { |
|
311 | { | |
293 | #ifdef GSA |
|
312 | #ifdef GSA | |
294 | #else |
|
313 | #else | |
295 | if (waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) { |
|
314 | if (doubleSendCWF2 == 1) | |
296 | send_waveform_CWF( wf_snap_f2_bis, SID_SBM2_CWF_F2, headerCWF_F2_SBM1 ); |
|
315 | { | |
|
316 | doubleSendCWF2 = 0; | |||
|
317 | send_waveform_CWF( wf_snap_f2_norm, SID_SBM2_CWF_F2, headerCWF_F2_SBM2 ); | |||
|
318 | } | |||
|
319 | else if (waveform_picker_regs->addr_data_f2 == (int) wf_snap_f2) { | |||
|
320 | send_waveform_CWF( wf_snap_f2_bis, SID_SBM2_CWF_F2, headerCWF_F2_SBM2 ); | |||
297 | } |
|
321 | } | |
298 | else { |
|
322 | else { | |
299 |
send_waveform_CWF( wf_snap_f2, SID_SBM2_CWF_F2, headerCWF_F2_SBM |
|
323 | send_waveform_CWF( wf_snap_f2, SID_SBM2_CWF_F2, headerCWF_F2_SBM2 ); | |
300 | } |
|
324 | } | |
|
325 | param_local.local_sbm2_nb_cwf_sent ++; | |||
301 | #endif |
|
326 | #endif | |
302 | } |
|
327 | } | |
303 | else |
|
328 | else | |
@@ -378,77 +403,59 void init_waveforms( void ) | |||||
378 | } |
|
403 | } | |
379 | } |
|
404 | } | |
380 |
|
405 | |||
381 | int init_header_snapshot_wf_table( unsigned int sid) |
|
406 | int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF) | |
382 | { |
|
407 | { | |
383 | unsigned char i; |
|
408 | unsigned char i; | |
384 | unsigned char j; |
|
|||
385 |
|
||||
386 | j = 0; |
|
|||
387 |
|
||||
388 | switch(sid) |
|
|||
389 | { |
|
|||
390 | case SID_NORM_SWF_F0: |
|
|||
391 | j = 0; |
|
|||
392 | break; |
|
|||
393 | case SID_NORM_SWF_F1: |
|
|||
394 | j = 1; |
|
|||
395 | break; |
|
|||
396 | case SID_NORM_SWF_F2: |
|
|||
397 | j = 2; |
|
|||
398 | break; |
|
|||
399 | default: |
|
|||
400 | return LFR_DEFAULT; |
|
|||
401 | } |
|
|||
402 |
|
409 | |||
403 | for (i=0; i<7; i++) |
|
410 | for (i=0; i<7; i++) | |
404 | { |
|
411 | { | |
405 |
headerSWF |
|
412 | headerSWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID; | |
406 |
headerSWF |
|
413 | headerSWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
407 |
headerSWF |
|
414 | headerSWF[ i ].reserved = DEFAULT_RESERVED; | |
408 |
headerSWF |
|
415 | headerSWF[ i ].userApplication = CCSDS_USER_APP; | |
409 |
headerSWF |
|
416 | headerSWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8); | |
410 |
headerSWF |
|
417 | headerSWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST); | |
411 | if (i == 0) |
|
418 | if (i == 0) | |
412 | { |
|
419 | { | |
413 |
headerSWF |
|
420 | headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_FIRST; | |
414 |
headerSWF |
|
421 | headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_340 >> 8); | |
415 |
headerSWF |
|
422 | headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_340 ); | |
416 |
headerSWF |
|
423 | headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8); | |
417 |
headerSWF |
|
424 | headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 ); | |
418 | } |
|
425 | } | |
419 | else if (i == 6) |
|
426 | else if (i == 6) | |
420 | { |
|
427 | { | |
421 |
headerSWF |
|
428 | headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_LAST; | |
422 |
headerSWF |
|
429 | headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_8 >> 8); | |
423 |
headerSWF |
|
430 | headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_8 ); | |
424 |
headerSWF |
|
431 | headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_8 >> 8); | |
425 |
headerSWF |
|
432 | headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_8 ); | |
426 | } |
|
433 | } | |
427 | else |
|
434 | else | |
428 | { |
|
435 | { | |
429 |
headerSWF |
|
436 | headerSWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_CONTINUATION; | |
430 |
headerSWF |
|
437 | headerSWF[ i ].packetLength[0] = (unsigned char) (TM_LEN_SCI_SWF_340 >> 8); | |
431 |
headerSWF |
|
438 | headerSWF[ i ].packetLength[1] = (unsigned char) (TM_LEN_SCI_SWF_340 ); | |
432 |
headerSWF |
|
439 | headerSWF[ i ].blkNr[0] = (unsigned char) (BLK_NR_340 >> 8); | |
433 |
headerSWF |
|
440 | headerSWF[ i ].blkNr[1] = (unsigned char) (BLK_NR_340 ); | |
434 | } |
|
441 | } | |
435 |
headerSWF |
|
442 | headerSWF[ i ].packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT; | |
436 |
headerSWF |
|
443 | headerSWF[ i ].pktCnt = DEFAULT_PKTCNT; // PKT_CNT | |
437 |
headerSWF |
|
444 | headerSWF[ i ].pktNr = i+1; // PKT_NR | |
438 | // DATA FIELD HEADER |
|
445 | // DATA FIELD HEADER | |
439 |
headerSWF |
|
446 | headerSWF[ i ].spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2; | |
440 |
headerSWF |
|
447 | headerSWF[ i ].serviceType = TM_TYPE_LFR_SCIENCE; // service type | |
441 |
headerSWF |
|
448 | headerSWF[ i ].serviceSubType = TM_SUBTYPE_LFR_SCIENCE; // service subtype | |
442 |
headerSWF |
|
449 | headerSWF[ i ].destinationID = TM_DESTINATION_ID_GROUND; | |
443 | // AUXILIARY DATA HEADER |
|
450 | // AUXILIARY DATA HEADER | |
444 |
headerSWF |
|
451 | headerSWF[ i ].sid = sid; | |
445 |
headerSWF |
|
452 | headerSWF[ i ].hkBIA = DEFAULT_HKBIA; | |
446 |
headerSWF |
|
453 | headerSWF[ i ].time[0] = 0x00; | |
447 |
headerSWF |
|
454 | headerSWF[ i ].time[0] = 0x00; | |
448 |
headerSWF |
|
455 | headerSWF[ i ].time[0] = 0x00; | |
449 |
headerSWF |
|
456 | headerSWF[ i ].time[0] = 0x00; | |
450 |
headerSWF |
|
457 | headerSWF[ i ].time[0] = 0x00; | |
451 |
headerSWF |
|
458 | headerSWF[ i ].time[0] = 0x00; | |
452 | } |
|
459 | } | |
453 | return LFR_SUCCESSFUL; |
|
460 | return LFR_SUCCESSFUL; | |
454 | } |
|
461 | } | |
@@ -463,8 +470,16 int init_header_continuous_wf_table( uns | |||||
463 | headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; |
|
470 | headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID; | |
464 | headerCWF[ i ].reserved = DEFAULT_RESERVED; |
|
471 | headerCWF[ i ].reserved = DEFAULT_RESERVED; | |
465 | headerCWF[ i ].userApplication = CCSDS_USER_APP; |
|
472 | headerCWF[ i ].userApplication = CCSDS_USER_APP; | |
466 | headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_BURST_SBM1_SBM2 >> 8); |
|
473 | if (SID_SBM1_CWF_F1 || SID_SBM2_CWF_F2) | |
467 | headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_BURST_SBM1_SBM2); |
|
474 | { | |
|
475 | headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2 >> 8); | |||
|
476 | headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_SBM1_SBM2); | |||
|
477 | } | |||
|
478 | else | |||
|
479 | { | |||
|
480 | headerCWF[ i ].packetID[0] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST >> 8); | |||
|
481 | headerCWF[ i ].packetID[1] = (unsigned char) (TM_PACKET_ID_SCIENCE_NORMAL_BURST); | |||
|
482 | } | |||
468 | if (i == 0) |
|
483 | if (i == 0) | |
469 | { |
|
484 | { | |
470 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_FIRST; |
|
485 | headerCWF[ i ].packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_FIRST; | |
@@ -540,10 +555,9 void reset_waveforms( void ) | |||||
540 | } |
|
555 | } | |
541 | } |
|
556 | } | |
542 |
|
557 | |||
543 | int send_waveform_SWF( volatile int *waveform, unsigned int sid ) |
|
558 | int send_waveform_SWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF ) | |
544 | { |
|
559 | { | |
545 | unsigned int i; |
|
560 | unsigned int i; | |
546 | unsigned int j; |
|
|||
547 | int ret; |
|
561 | int ret; | |
548 | rtems_status_code status; |
|
562 | rtems_status_code status; | |
549 | spw_ioctl_pkt_send spw_ioctl_send_SWF; |
|
563 | spw_ioctl_pkt_send spw_ioctl_send_SWF; | |
@@ -551,29 +565,12 int send_waveform_SWF( volatile int *wav | |||||
551 | spw_ioctl_send_SWF.hlen = TM_HEADER_LEN + 4 + 12; // + 4 is for the protocole extra header, + 12 is for the auxiliary header |
|
565 | spw_ioctl_send_SWF.hlen = TM_HEADER_LEN + 4 + 12; // + 4 is for the protocole extra header, + 12 is for the auxiliary header | |
552 | spw_ioctl_send_SWF.options = 0; |
|
566 | spw_ioctl_send_SWF.options = 0; | |
553 |
|
567 | |||
554 | j = 0; |
|
|||
555 | ret = LFR_DEFAULT; |
|
568 | ret = LFR_DEFAULT; | |
556 |
|
569 | |||
557 | switch(sid) |
|
|||
558 | { |
|
|||
559 | case SID_NORM_SWF_F0: |
|
|||
560 | j = 0; |
|
|||
561 | break; |
|
|||
562 | case SID_NORM_SWF_F1: |
|
|||
563 | j = 1; |
|
|||
564 | break; |
|
|||
565 | case SID_NORM_SWF_F2: |
|
|||
566 | j = 2; |
|
|||
567 | break; |
|
|||
568 | default: |
|
|||
569 | ret = LFR_DEFAULT; |
|
|||
570 | break; |
|
|||
571 | } |
|
|||
572 |
|
||||
573 | for (i=0; i<7; i++) // send waveform |
|
570 | for (i=0; i<7; i++) // send waveform | |
574 | { |
|
571 | { | |
575 | spw_ioctl_send_SWF.data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) ]; |
|
572 | spw_ioctl_send_SWF.data = (char*) &waveform[ (i * 340 * NB_WORDS_SWF_BLK) ]; | |
576 |
spw_ioctl_send_SWF.hdr = (char*) &headerSWF |
|
573 | spw_ioctl_send_SWF.hdr = (char*) &headerSWF[ i ]; | |
577 | // BUILD THE DATA |
|
574 | // BUILD THE DATA | |
578 | if (i==6) { |
|
575 | if (i==6) { | |
579 | spw_ioctl_send_SWF.dlen = 8 * NB_BYTES_SWF_BLK; |
|
576 | spw_ioctl_send_SWF.dlen = 8 * NB_BYTES_SWF_BLK; | |
@@ -582,23 +579,22 int send_waveform_SWF( volatile int *wav | |||||
582 | spw_ioctl_send_SWF.dlen = 340 * NB_BYTES_SWF_BLK; |
|
579 | spw_ioctl_send_SWF.dlen = 340 * NB_BYTES_SWF_BLK; | |
583 | } |
|
580 | } | |
584 | // SET PACKET TIME |
|
581 | // SET PACKET TIME | |
585 |
headerSWF |
|
582 | headerSWF[ i ].time[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
586 |
headerSWF |
|
583 | headerSWF[ i ].time[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
587 |
headerSWF |
|
584 | headerSWF[ i ].time[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
588 |
headerSWF |
|
585 | headerSWF[ i ].time[3] = (unsigned char) (time_management_regs->coarse_time); | |
589 |
headerSWF |
|
586 | headerSWF[ i ].time[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
590 |
headerSWF |
|
587 | headerSWF[ i ].time[5] = (unsigned char) (time_management_regs->fine_time); | |
591 |
headerSWF |
|
588 | headerSWF[ i ].acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
592 |
headerSWF |
|
589 | headerSWF[ i ].acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16); | |
593 |
headerSWF |
|
590 | headerSWF[ i ].acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8); | |
594 |
headerSWF |
|
591 | headerSWF[ i ].acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time); | |
595 |
headerSWF |
|
592 | headerSWF[ i ].acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8); | |
596 |
headerSWF |
|
593 | headerSWF[ i ].acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time); | |
597 | // SEND PACKET |
|
594 | // SEND PACKET | |
598 | //status = write_spw(&spw_ioctl_send_SWF); |
|
595 | status = rtems_message_queue_send( misc_id[QUEUE_PKTS], &spw_ioctl_send_SWF, ACTION_MSG_PKTS_SIZE); | |
599 | status = rtems_message_queue_send( misc_id[1], &spw_ioctl_send_SWF, sizeof(spw_ioctl_send_SWF)); |
|
|||
600 | if (status != RTEMS_SUCCESSFUL) { |
|
596 | if (status != RTEMS_SUCCESSFUL) { | |
601 |
|
|
597 | printf("%d-%d, ERR %d\n", sid, i, (int) status); | |
602 | ret = LFR_DEFAULT; |
|
598 | ret = LFR_DEFAULT; | |
603 | } |
|
599 | } | |
604 | rtems_task_wake_after(TIME_BETWEEN_TWO_SWF_PACKETS); // 300 ms between each packet => 7 * 3 = 21 packets => 6.3 seconds |
|
600 | rtems_task_wake_after(TIME_BETWEEN_TWO_SWF_PACKETS); // 300 ms between each packet => 7 * 3 = 21 packets => 6.3 seconds | |
@@ -648,19 +644,22 int send_waveform_CWF( volatile int *wav | |||||
648 | headerCWF[ i ].acquisitionTime[4] = (unsigned char) (fineTime>>8); |
|
644 | headerCWF[ i ].acquisitionTime[4] = (unsigned char) (fineTime>>8); | |
649 | headerCWF[ i ].acquisitionTime[5] = (unsigned char) (fineTime); |
|
645 | headerCWF[ i ].acquisitionTime[5] = (unsigned char) (fineTime); | |
650 | // SEND PACKET |
|
646 | // SEND PACKET | |
651 | //status = write_spw(&spw_ioctl_send_CWF); |
|
647 | if (sid == SID_NORM_CWF_F3) | |
652 | status = rtems_message_queue_urgent( misc_id[1], &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); |
|
648 | { | |
653 | if (status != RTEMS_SUCCESSFUL) { |
|
649 | status = rtems_message_queue_send( misc_id[QUEUE_PKTS], &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); | |
654 | PRINTF2("sid %d, i = %d\n", sid, i) |
|
650 | if (status != RTEMS_SUCCESSFUL) { | |
655 | ret = LFR_DEFAULT; |
|
651 | printf("%d-%d, ERR %d\n", sid, i, (int) status); | |
|
652 | ret = LFR_DEFAULT; | |||
|
653 | } | |||
|
654 | rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS); | |||
656 | } |
|
655 | } | |
657 | else |
|
656 | else | |
658 | { |
|
657 | { | |
659 | sched_yield(); |
|
658 | status = rtems_message_queue_urgent( misc_id[QUEUE_PKTS], &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF)); | |
660 | } |
|
659 | if (status != RTEMS_SUCCESSFUL) { | |
661 | if (sid == SID_NORM_CWF_F3) |
|
660 | printf("%d-%d, ERR %d\n", sid, i, (int) status); | |
662 | { |
|
661 | ret = LFR_DEFAULT; | |
663 | rtems_task_wake_after(TIME_BETWEEN_TWO_CWF3_PACKETS); |
|
662 | } | |
664 | } |
|
663 | } | |
665 | } |
|
664 | } | |
666 |
|
665 | |||
@@ -786,19 +785,16 void reset_waveform_picker_regs() | |||||
786 | void set_local_sbm1_nb_cwf_max() |
|
785 | void set_local_sbm1_nb_cwf_max() | |
787 | { |
|
786 | { | |
788 | // (2 snapshots of 2048 points per seconds) * (period of the NORM snashots) - 8 s (duration of the f2 snapshot) |
|
787 | // (2 snapshots of 2048 points per seconds) * (period of the NORM snashots) - 8 s (duration of the f2 snapshot) | |
789 |
param_local.local_sbm1_nb_cwf_max = 2 * |
|
788 | param_local.local_sbm1_nb_cwf_max = 2 * | |
790 |
|
|
789 | (parameter_dump_packet.sy_lfr_n_swf_p[0] * 256 | |
791 |
|
|
790 | + parameter_dump_packet.sy_lfr_n_swf_p[1]) - 8; // 16 CWF1 parts during 1 SWF2 | |
792 | ) - 8; // 16 CWF1 parts during 1 SWF2 |
|
|||
793 | } |
|
791 | } | |
794 |
|
792 | |||
795 | void set_local_sbm2_nb_cwf_max() |
|
793 | void set_local_sbm2_nb_cwf_max() | |
796 | { |
|
794 | { | |
797 | // (period of the NORM snashots) / (8 seconds per snapshot at f2 = 256 Hz) |
|
795 | // (period of the NORM snashots) / (8 seconds per snapshot at f2 = 256 Hz) | |
798 | param_local.local_sbm2_nb_cwf_max = ( |
|
796 | param_local.local_sbm2_nb_cwf_max = (parameter_dump_packet.sy_lfr_n_swf_p[0] * 256 | |
799 |
|
|
797 | + parameter_dump_packet.sy_lfr_n_swf_p[1]) / 8; | |
800 | + parameter_dump_packet.sy_lfr_n_swf_p[1] |
|
|||
801 | )/ 8; |
|
|||
802 | } |
|
798 | } | |
803 |
|
799 | |||
804 | void set_local_nb_interrupt_f0_MAX() |
|
800 | void set_local_nb_interrupt_f0_MAX() |
General Comments 0
You need to be logged in to leave comments.
Login now