##// END OF EJS Templates
Current version with modes NORMAL and SBM1 operational
paul@pc-solar1.lab-lpp.local -
r21:a92d7ea3b165 default
parent child
Show More
@@ -1,6 +1,6
1 #############################################################################
1 #############################################################################
2 # Makefile for building: bin/fsw
2 # Makefile for building: bin/fsw$(SW_VERSION)
3 # Generated by qmake (2.01a) (Qt 4.8.4) on: Thu May 23 15:08:17 2013
3 # Generated by qmake (2.01a) (Qt 4.8.4) on: Fri Jun 14 07:50:58 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 = -DPRINT_MESSAGES_ON_CONSOLE
13 DEFINES = -DSW_VERSION_N1=0 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=4 -DPRINT_MESSAGES_ON_CONSOLE
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
@@ -62,7 +62,7 DIST = /usr/lib64/qt4/mkspecs/c
62 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
62 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
63 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
63 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
64 /usr/lib64/qt4/mkspecs/qconfig.pri \
64 /usr/lib64/qt4/mkspecs/qconfig.pri \
65 /usr/lib64/qt4/mkspecs/modules/qt_webkit_version.pri \
65 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
66 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
66 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
67 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
67 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
68 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
68 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
@@ -78,9 +78,9 DIST = /usr/lib64/qt4/mkspecs/c
78 /usr/lib64/qt4/mkspecs/features/lex.prf \
78 /usr/lib64/qt4/mkspecs/features/lex.prf \
79 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \
79 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \
80 fsw-qt.pro
80 fsw-qt.pro
81 QMAKE_TARGET = fsw
81 QMAKE_TARGET = fsw$(SW_VERSION)
82 DESTDIR = bin/
82 DESTDIR = bin/
83 TARGET = bin/fsw
83 TARGET = bin/fsw$(SW_VERSION)
84
84
85 first: all
85 first: all
86 ####### Implicit rules
86 ####### Implicit rules
@@ -117,7 +117,7 Makefile: fsw-qt.pro /usr/lib64/qt4/mks
117 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
117 /usr/lib64/qt4/mkspecs/common/g++-base.conf \
118 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
118 /usr/lib64/qt4/mkspecs/common/g++-unix.conf \
119 /usr/lib64/qt4/mkspecs/qconfig.pri \
119 /usr/lib64/qt4/mkspecs/qconfig.pri \
120 /usr/lib64/qt4/mkspecs/modules/qt_webkit_version.pri \
120 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri \
121 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
121 /usr/lib64/qt4/mkspecs/features/qt_functions.prf \
122 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
122 /usr/lib64/qt4/mkspecs/features/qt_config.prf \
123 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
123 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf \
@@ -140,7 +140,7 Makefile: fsw-qt.pro /usr/lib64/qt4/mks
140 /usr/lib64/qt4/mkspecs/common/g++-base.conf:
140 /usr/lib64/qt4/mkspecs/common/g++-base.conf:
141 /usr/lib64/qt4/mkspecs/common/g++-unix.conf:
141 /usr/lib64/qt4/mkspecs/common/g++-unix.conf:
142 /usr/lib64/qt4/mkspecs/qconfig.pri:
142 /usr/lib64/qt4/mkspecs/qconfig.pri:
143 /usr/lib64/qt4/mkspecs/modules/qt_webkit_version.pri:
143 /usr/lib64/qt4/mkspecs/modules/qt_webkit.pri:
144 /usr/lib64/qt4/mkspecs/features/qt_functions.prf:
144 /usr/lib64/qt4/mkspecs/features/qt_functions.prf:
145 /usr/lib64/qt4/mkspecs/features/qt_config.prf:
145 /usr/lib64/qt4/mkspecs/features/qt_config.prf:
146 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf:
146 /usr/lib64/qt4/mkspecs/features/exclusive_builds.prf:
@@ -159,8 +159,8 qmake: FORCE
159 @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
159 @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
160
160
161 dist:
161 dist:
162 @$(CHK_DIR_EXISTS) obj/fsw1.0.0 || $(MKDIR) obj/fsw1.0.0
162 @$(CHK_DIR_EXISTS) obj/fsw$(SW_VERSION)1.0.0 || $(MKDIR) obj/fsw$(SW_VERSION)1.0.0
163 $(COPY_FILE) --parents $(SOURCES) $(DIST) obj/fsw1.0.0/ && (cd `dirname obj/fsw1.0.0` && $(TAR) fsw1.0.0.tar fsw1.0.0 && $(COMPRESS) fsw1.0.0.tar) && $(MOVE) `dirname obj/fsw1.0.0`/fsw1.0.0.tar.gz . && $(DEL_FILE) -r obj/fsw1.0.0
163 $(COPY_FILE) --parents $(SOURCES) $(DIST) obj/fsw$(SW_VERSION)1.0.0/ && (cd `dirname obj/fsw$(SW_VERSION)1.0.0` && $(TAR) fsw$(SW_VERSION)1.0.0.tar fsw$(SW_VERSION)1.0.0 && $(COMPRESS) fsw$(SW_VERSION)1.0.0.tar) && $(MOVE) `dirname obj/fsw$(SW_VERSION)1.0.0`/fsw$(SW_VERSION)1.0.0.tar.gz . && $(DEL_FILE) -r obj/fsw$(SW_VERSION)1.0.0
164
164
165
165
166 clean:compiler_clean
166 clean:compiler_clean
1 NO CONTENT: modified file, binary diff hidden
NO CONTENT: modified file, binary diff hidden
@@ -6,6 +6,13 CONFIG -= qt
6
6
7 include(./sparc.pri)
7 include(./sparc.pri)
8
8
9 # flight software version
10 SW_VERSION=-0-5
11 DEFINES += SW_VERSION_N1=0
12 DEFINES += SW_VERSION_N2=0
13 DEFINES += SW_VERSION_N3=0
14 DEFINES += SW_VERSION_N4=5
15
9 contains( CONFIG, verbose ) {
16 contains( CONFIG, verbose ) {
10 DEFINES += PRINT_MESSAGES_ON_CONSOLE
17 DEFINES += PRINT_MESSAGES_ON_CONSOLE
11 }
18 }
@@ -14,10 +21,10 contains( CONFIG, cpu_usage_report ) {
14 DEFINES += PRINT_TASK_STATISTICS
21 DEFINES += PRINT_TASK_STATISTICS
15 }
22 }
16
23
17 TARGET = fsw
24 TARGET = fsw$(SW_VERSION)
18 contains( CONFIG, gsa ) {
25 contains( CONFIG, gsa ) {
19 DEFINES += GSA
26 DEFINES += GSA
20 TARGET = fsw-gsa
27 TARGET = fsw-gsa$(SW_VERSION)
21 }
28 }
22
29
23 INCLUDEPATH += \
30 INCLUDEPATH += \
@@ -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 Qt Creator 2.4.1, 2013-06-04T15:59:14. -->
3 <!-- Written by Qt Creator 2.4.1, 2013-06-17T15:56:28. -->
4 <qtcreator>
4 <qtcreator>
5 <data>
5 <data>
6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
@@ -20,6 +20,7
20
20
21 #define SIZE_TM_LFR_TC_EXE_NOT_IMPLEMENTED 24
21 #define SIZE_TM_LFR_TC_EXE_NOT_IMPLEMENTED 24
22 #define SIZE_TM_LFR_TC_EXE_CORRUPTED 32
22 #define SIZE_TM_LFR_TC_EXE_CORRUPTED 32
23 #define SIZE_HK_PARAMETERS 112
23
24
24 #define ILLEGAL_APID 0
25 #define ILLEGAL_APID 0
25 #define WRONG_LEN_PACKET 1
26 #define WRONG_LEN_PACKET 1
@@ -64,6 +65,7
64
65
65 // TM TYPES
66 // TM TYPES
66 #define TM_TYPE_LFR_SCIENCE 21
67 #define TM_TYPE_LFR_SCIENCE 21
68 #define TM_TYPE_HK 3
67
69
68 // TM SUBTYPES
70 // TM SUBTYPES
69 #define TM_SUBTYPE_EXE_OK 7
71 #define TM_SUBTYPE_EXE_OK 7
@@ -72,6 +74,7
72 #define TM_SUBTYPE_SCIENCE 3
74 #define TM_SUBTYPE_SCIENCE 3
73 #define TM_SUBTYPE_LFR_SCIENCE 3
75 #define TM_SUBTYPE_LFR_SCIENCE 3
74
76
77 // TM SID
75 #define SID_DEFAULT 0
78 #define SID_DEFAULT 0
76 #define SID_HK 1
79 #define SID_HK 1
77 #define SID_EXE_INC 5
80 #define SID_EXE_INC 5
@@ -147,20 +150,6 struct TMHeader_str
147 };
150 };
148 typedef struct TMHeader_str TMHeader_t;
151 typedef struct TMHeader_str TMHeader_t;
149
152
150 struct Packet_TM_LFR_HK_str
151 {
152 volatile unsigned char targetLogicalAddress;
153 volatile unsigned char protocolIdentifier;
154 volatile unsigned char reserved;
155 volatile unsigned char userApplication;
156 volatile unsigned char packetID[2];
157 volatile unsigned char packetSequenceControl[2];
158 volatile unsigned char packetLength[2];
159 volatile unsigned char dataFieldHeader[10];
160 volatile unsigned char data[LENGTH_TM_LFR_HK - 10 + 1];
161 };
162 typedef struct Packet_TM_LFR_HK_str Packet_TM_LFR_HK_t;
163
164 struct Packet_TM_LFR_TC_EXE_str
153 struct Packet_TM_LFR_TC_EXE_str
165 {
154 {
166 volatile unsigned char targetLogicalAddress;
155 volatile unsigned char targetLogicalAddress;
@@ -218,7 +207,20 struct ccsdsTelecommandPacket_str
218 };
207 };
219 typedef struct ccsdsTelecommandPacket_str ccsdsTelecommandPacket_t;
208 typedef struct ccsdsTelecommandPacket_str ccsdsTelecommandPacket_t;
220
209
221 struct hk_packet_str{
210 struct Packet_TM_LFR_HK_str
211 {
212 volatile unsigned char targetLogicalAddress;
213 volatile unsigned char protocolIdentifier;
214 volatile unsigned char reserved;
215 volatile unsigned char userApplication;
216 volatile unsigned char packetID[2];
217 volatile unsigned char packetSequenceControl[2];
218 volatile unsigned char packetLength[2];
219 volatile unsigned char dataFieldHeader[10];
220 volatile unsigned char sid;
221
222 //**************
223 // HK PARAMETERS
222 unsigned char lfr_status_word[2];
224 unsigned char lfr_status_word[2];
223 unsigned char lfr_sw_version[4];
225 unsigned char lfr_sw_version[4];
224 // tc statistics
226 // tc statistics
@@ -300,8 +302,7 struct hk_packet_str{
300 unsigned char hk_lfr_cpu_data_exception;
302 unsigned char hk_lfr_cpu_data_exception;
301 unsigned char hk_lfr_cpu_div_exception;
303 unsigned char hk_lfr_cpu_div_exception;
302 unsigned char hk_lfr_cpu_arith_overflow;
304 unsigned char hk_lfr_cpu_arith_overflow;
303
304 };
305 };
305 typedef struct hk_packet_str hk_packet_t;
306 typedef struct Packet_TM_LFR_HK_str Packet_TM_LFR_HK_t;
306
307
307 #endif // CCSDS_H_INCLUDED
308 #endif // CCSDS_H_INCLUDED
@@ -1,60 +1,64
1 #ifndef FSW_RTEMS_H_INCLUDED
1 #ifndef FSW_RTEMS_H_INCLUDED
2 #define FSW_RTEMS_H_INCLUDED
2 #define FSW_RTEMS_H_INCLUDED
3
3
4 #include <errno.h>
4 #include <errno.h>
5 #include <fcntl.h>
5 #include <fcntl.h>
6 #include <stdio.h>
6 #include <stdio.h>
7 #include <stdlib.h>
7 #include <stdlib.h>
8
8
9 #include <grspw.h>
9 #include <grspw.h>
10 #include <apbuart.h>
10 #include <apbuart.h>
11
11
12 #include <fsw_params.h>
12 #include <fsw_params.h>
13 #include <fsw_misc.h>
13 #include <fsw_misc.h>
14 #include <fsw_processing.h>
14 #include <fsw_processing.h>
15 #include <tc_handler.h>
15 #include <tc_handler.h>
16 #include <wf_handler.h>
16 #include <wf_handler.h>
17 #include <grlib_regs.h>
17 #include <grlib_regs.h>
18
18 #include <ccsds_types.h>
19
19 extern int sched_yield( void );
20 extern int sched_yield( void );
20 extern int errno;
21 extern int errno;
21 extern rtems_id Task_id[ ]; /* array of task ids */
22 extern rtems_id Task_id[ ]; /* array of task ids */
22 extern rtems_name Task_name[ ]; /* array of task names */
23 extern rtems_name Task_name[ ]; /* array of task names */
23 extern rtems_name misc_name[ ]; /* arry of miscellaneous names for rtems objects */
24 extern rtems_name misc_name[ ]; /* arry of miscellaneous names for rtems objects */
24 extern int fdSPW; // grspw file descriptor
25 extern int fdSPW; // grspw file descriptor
25 extern int fdUART; // uart file descriptor
26 extern int fdUART; // uart file descriptor
26
27
27 void timecode_irq_handler(void *pDev, void *regs, int minor, unsigned int tc);
28 void timecode_irq_handler(void *pDev, void *regs, int minor, unsigned int tc);
28
29
29 // MODE PARAMETERS
30 // MODE PARAMETERS
30 extern struct param_norm_str param_norm;
31 extern struct param_common_str param_common;
31 extern struct param_burst_str param_burst;
32 extern struct param_norm_str param_norm;
32 extern struct param_sbm1_str param_sbm1;
33 extern struct param_burst_str param_burst;
33 extern struct param_sbm2_str param_sbm2;
34 extern struct param_sbm1_str param_sbm1;
34 extern unsigned char param_common[];
35 extern struct param_sbm2_str param_sbm2;
35
36 extern Packet_TM_LFR_HK_t housekeeping_packet;
37 extern unsigned short sequenceCounters[SEQ_CNT_NB_PID][SEQ_CNT_NB_CAT][SEQ_CNT_NB_DEST_ID];
38
36 // RTEMS TASKS
39 // RTEMS TASKS
37 rtems_task Init( rtems_task_argument argument); /* forward declaration needed */
40 rtems_task Init( rtems_task_argument argument); /* forward declaration needed */
38 rtems_task recv_task(rtems_task_argument argument);
41 rtems_task recv_task(rtems_task_argument argument);
39 rtems_task spiq_task(rtems_task_argument argument);
42 rtems_task spiq_task(rtems_task_argument argument);
40 rtems_task stat_task(rtems_task_argument argument);
43 rtems_task stat_task(rtems_task_argument argument);
41 rtems_task wfrm_task(rtems_task_argument argument);
44 rtems_task wfrm_task(rtems_task_argument argument);
42 int create_names( void );
45 int create_names( void );
43 int create_all_tasks( void );
46 int create_all_tasks( void );
44 int start_all_tasks( void );
47 int start_all_tasks( void );
45 int create_message_queue( void );
48 int create_message_queue( void );
46
49
47 // OTHER functions
50 // OTHER functions
48 void init_default_mode_parameters( void );
51 void init_default_mode_parameters( void );
49
52 void init_housekeeping_parameters( void );
50 int configure_spw_link( void );
53
51 void configure_spacewire_set_NP(unsigned char val, unsigned int regAddr); // No Port force
54 int configure_spw_link( void );
52 void configure_spacewire_set_RE(unsigned char val, unsigned int regAddr); // RMAP Enable
55 void configure_spacewire_set_NP(unsigned char val, unsigned int regAddr); // No Port force
56 void configure_spacewire_set_RE(unsigned char val, unsigned int regAddr); // RMAP Enable
53
57
54 extern int rtems_cpu_usage_report( void );
58 extern int rtems_cpu_usage_report( void );
55 extern int rtems_cpu_usage_reset( void );
59 extern int rtems_cpu_usage_reset( void );
56
60
57 rtems_status_code write_spw(spw_ioctl_pkt_send* spw_ioctl_send);
61 rtems_status_code write_spw(spw_ioctl_pkt_send* spw_ioctl_send);
58 void (*grspw_timecode_callback) (void *pDev, void *regs, int minor, unsigned int tc);
62 void (*grspw_timecode_callback) (void *pDev, void *regs, int minor, unsigned int tc);
59
63
60 #endif // FSW_RTEMS_CONFIG_H_INCLUDED
64 #endif // FSW_RTEMS_CONFIG_H_INCLUDED
@@ -4,6 +4,10
4 #define GRSPW_DEVICE_NAME "/dev/grspw0"
4 #define GRSPW_DEVICE_NAME "/dev/grspw0"
5 #define UART_DEVICE_NAME "/dev/console"
5 #define UART_DEVICE_NAME "/dev/console"
6
6
7 //************************
8 // flight software version
9 // this parameters is handled by the Qt project options
10
7 //**********
11 //**********
8 // LFR MODES
12 // LFR MODES
9 #define LFR_MODE_STANDBY 0
13 #define LFR_MODE_STANDBY 0
@@ -12,6 +16,12
12 #define LFR_MODE_SBM1 3
16 #define LFR_MODE_SBM1 3
13 #define LFR_MODE_SBM2 4
17 #define LFR_MODE_SBM2 4
14
18
19 #define RTEMS_EVENT_MODE_STANDBY RTEMS_EVENT_0
20 #define RTEMS_EVENT_MODE_NORMAL RTEMS_EVENT_1
21 #define RTEMS_EVENT_MODE_BURST RTEMS_EVENT_2
22 #define RTEMS_EVENT_MODE_SBM1 RTEMS_EVENT_3
23 #define RTEMS_EVENT_MODE_SBM2 RTEMS_EVENT_4
24
15 //*****************************
25 //*****************************
16 // APB REGISTERS BASE ADDRESSES
26 // APB REGISTERS BASE ADDRESSES
17 #define REGS_ADDR_APBUART 0x80000100
27 #define REGS_ADDR_APBUART 0x80000100
@@ -45,6 +55,11
45 #define TIMER_WF_SIMULATOR 2
55 #define TIMER_WF_SIMULATOR 2
46 #define HK_PERIOD 100 // 100 * 10ms => 1sec
56 #define HK_PERIOD 100 // 100 * 10ms => 1sec
47
57
58 //**********
59 // LPP CODES
60 #define LFR_SUCCESSFUL 0
61 #define LFR_DEFAULT 1
62
48 //******
63 //******
49 // RTEMS
64 // RTEMS
50 #define TASKID_RECV 1
65 #define TASKID_RECV 1
@@ -78,6 +93,37
78 #define NB_BYTES_SWF_BLK 2 * 6
93 #define NB_BYTES_SWF_BLK 2 * 6
79 #define NB_WORDS_SWF_BLK 3
94 #define NB_WORDS_SWF_BLK 3
80
95
96 //******************
97 // SEQUENCE COUNTERS
98 #define SEQ_CNT_NB_PID 2
99 #define SEQ_CNT_NB_CAT 4
100 #define SEQ_CNT_NB_DEST_ID 11
101 // pid
102 #define SEQ_CNT_PID_76 0
103 #define SEQ_CNT_PID_79 1
104 //cat
105 #define SEQ_CNT_CAT_1 0
106 #define SEQ_CNT_CAT_4 1
107 #define SEQ_CNT_CAT_9 2
108 #define SEQ_CNT_CAT_12 3
109 // destination id
110 #define SEQ_CNT_DST_ID_GROUND 0
111 #define SEQ_CNT_DST_ID_MISSION_TIMELINE 1
112 #define SEQ_CNT_DST_ID_TC_SEQUENCES 2
113 #define SEQ_CNT_DST_ID_RECOVERY_ACTION_CMD 3
114 #define SEQ_CNT_DST_ID_BACKUP_MISSION_TIMELINE 4
115 #define SEQ_CNT_DST_ID_DIRECT_CMD 5
116 #define SEQ_CNT_DST_ID_SPARE_GRD_SRC1 6
117 #define SEQ_CNT_DST_ID_SPARE_GRD_SRC2 7
118 #define SEQ_CNT_DST_ID_OBCP 8
119 #define SEQ_CNT_DST_ID_SYSTEM_CONTROL 9
120 #define SEQ_CNT_DST_ID_AOCS 10
121
122 struct param_common_str{
123 unsigned char sy_lfr_common0;
124 unsigned char sy_lfr_common1;
125 };
126
81 struct param_norm_str{
127 struct param_norm_str{
82 unsigned int sy_lfr_n_swf_l; // length of the snapshots
128 unsigned int sy_lfr_n_swf_l; // length of the snapshots
83 unsigned int sy_lfr_n_swf_p; // time between two snapshots
129 unsigned int sy_lfr_n_swf_p; // time between two snapshots
@@ -15,13 +15,14 extern rtems_name misc_name[ ];
15 extern rtems_name misc_id[ ];
15 extern rtems_name misc_id[ ];
16 extern rtems_id Task_id[ ]; // array of task ids
16 extern rtems_id Task_id[ ]; // array of task ids
17 // MODE PARAMETERS
17 // MODE PARAMETERS
18 extern struct param_common_str param_common;
18 extern struct param_norm_str param_norm;
19 extern struct param_norm_str param_norm;
19 extern struct param_sbm1_str param_sbm1;
20 extern struct param_sbm1_str param_sbm1;
20 extern struct param_sbm2_str param_sbm2;
21 extern struct param_sbm2_str param_sbm2;
22 extern Packet_TM_LFR_HK_t housekeeping_packet;
21 extern time_management_regs_t *time_management_regs;
23 extern time_management_regs_t *time_management_regs;
22 extern waveform_picker_regs_t *waveform_picker_regs;
24 extern waveform_picker_regs_t *waveform_picker_regs;
23 extern gptimer_regs_t *gptimer_regs;
25 extern gptimer_regs_t *gptimer_regs;
24 extern unsigned char param_common[];
25
26
26 //****
27 //****
27 // ISR
28 // ISR
@@ -58,10 +59,15 int send_tm_lfr_tc_exe_success(ccsdsTele
58 int stop_current_mode();
59 int stop_current_mode();
59 int enter_normal_mode();
60 int enter_normal_mode();
60 int enter_sbm1_mode();
61 int enter_sbm1_mode();
62 int action_load_comm(ccsdsTelecommandPacket_t *TC);
61 int action_load_norm(ccsdsTelecommandPacket_t *TC);
63 int action_load_norm(ccsdsTelecommandPacket_t *TC);
62 int action_enter(ccsdsTelecommandPacket_t *TC);
64 int action_enter(ccsdsTelecommandPacket_t *TC);
63 int action_updt_time(ccsdsTelecommandPacket_t *TC);
65 int action_updt_time(ccsdsTelecommandPacket_t *TC);
64 //
66 //
67 void update_last_TC_exe(ccsdsTelecommandPacket_t *TC);
68 void update_last_TC_rej(ccsdsTelecommandPacket_t *TC);
69 void close_action(ccsdsTelecommandPacket_t *TC, int result);
70 //
65 rtems_status_code restart_if_needed(rtems_id id);
71 rtems_status_code restart_if_needed(rtems_id id);
66 rtems_status_code suspend_if_needed(rtems_id id);
72 rtems_status_code suspend_if_needed(rtems_id id);
67
73
@@ -24,6 +24,7 extern volatile int wf_cont_f3[ ];
24 extern waveform_picker_regs_t *waveform_picker_regs;
24 extern waveform_picker_regs_t *waveform_picker_regs;
25
25
26 rtems_isr waveforms_isr( rtems_vector_number vector );
26 rtems_isr waveforms_isr( rtems_vector_number vector );
27 rtems_isr waveforms_isr_alternative( rtems_vector_number vector );
27 rtems_isr waveforms_simulator_isr( rtems_vector_number vector );
28 rtems_isr waveforms_simulator_isr( rtems_vector_number vector );
28 rtems_task wfrm_task(rtems_task_argument argument);
29 rtems_task wfrm_task(rtems_task_argument argument);
29
30
@@ -33,6 +34,7 void init_waveforms( void );
33 void reset_waveforms( void );
34 void reset_waveforms( void );
34 void send_waveform( ExtendedTMHeader_t *header, volatile int *waveform, unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send);
35 void send_waveform( ExtendedTMHeader_t *header, volatile int *waveform, unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send);
35 void init_waveform_picker_regs();
36 void init_waveform_picker_regs();
37 void set_data_shaping_parameters(unsigned char parameters);
36 int build_value(int value1, int value0);
38 int build_value(int value1, int value0);
37
39
38 #endif // WF_HANDLER_H_INCLUDED
40 #endif // WF_HANDLER_H_INCLUDED
@@ -38,15 +38,15 float averaged_spec_mat_f0[ TOTAL_SIZE_S
38 float compressed_spec_mat_f0[ TOTAL_SIZE_COMPRESSED_MATRIX_f0 ];
38 float compressed_spec_mat_f0[ TOTAL_SIZE_COMPRESSED_MATRIX_f0 ];
39
39
40 // MODE PARAMETERS
40 // MODE PARAMETERS
41 struct param_common_str param_common;
41 struct param_norm_str param_norm;
42 struct param_norm_str param_norm;
42 struct param_burst_str param_burst;
43 struct param_burst_str param_burst;
43 struct param_sbm1_str param_sbm1;
44 struct param_sbm1_str param_sbm1;
44 struct param_sbm2_str param_sbm2;
45 struct param_sbm2_str param_sbm2;
45 unsigned char param_common[2];
46
46
47 // HK PACKETS
47 // HK PACKETS
48 Packet_TM_LFR_HK_t housekeeping_packet;
48 Packet_TM_LFR_HK_t housekeeping_packet;
49 hk_packet_t housekeeping_parameters;
49 unsigned short sequenceCounters[SEQ_CNT_NB_PID][SEQ_CNT_NB_CAT][SEQ_CNT_NB_DEST_ID];
50
50
51 // BASIC PARAMETERS GLOBAL VARIABLES
51 // BASIC PARAMETERS GLOBAL VARIABLES
52 unsigned char LFR_BP1_F0[ NB_BINS_COMPRESSED_MATRIX_f0 * 9 ];
52 unsigned char LFR_BP1_F0[ NB_BINS_COMPRESSED_MATRIX_f0 * 9 ];
@@ -68,6 +68,7 rtems_task Init( rtems_task_argument ign
68
68
69 initLookUpTableForCRC(); // in tc_handler.h
69 initLookUpTableForCRC(); // in tc_handler.h
70 init_default_mode_parameters();
70 init_default_mode_parameters();
71 init_housekeeping_parameters();
71 create_message_queue();
72 create_message_queue();
72
73
73 create_names();
74 create_names();
@@ -160,11 +161,11 rtems_task spiq_task(rtems_task_argument
160 }
161 }
161 }
162 }
162
163
163 void init_default_mode_parameters()
164 void init_default_mode_parameters(void)
164 {
165 {
165 // COMMON PARAMETERS
166 // COMMON PARAMETERS
166 param_common[0] = 0x00;
167 param_common.sy_lfr_common0 = 0x00;
167 param_common[1] = 0x10; // default value 0 0 0 1 0 0 0 0
168 param_common.sy_lfr_common1 = 0x10; // default value 0 0 0 1 0 0 0 0
168 // NORMAL MODE
169 // NORMAL MODE
169 param_norm.sy_lfr_n_swf_l = 2048; // nb sample
170 param_norm.sy_lfr_n_swf_l = 2048; // nb sample
170 param_norm.sy_lfr_n_swf_p = 300; // sec
171 param_norm.sy_lfr_n_swf_p = 300; // sec
@@ -182,6 +183,39 void init_default_mode_parameters()
182 param_sbm2.sy_lfr_s2_bp_p0 = 5; // sec
183 param_sbm2.sy_lfr_s2_bp_p0 = 5; // sec
183 }
184 }
184
185
186 void init_housekeeping_parameters(void)
187 {
188 unsigned int i = 0;
189 unsigned int j = 0;
190 unsigned int k = 0;
191 char *parameters;
192
193 parameters = (char*) &housekeeping_packet.lfr_status_word;
194 for(i = 0; i< SIZE_HK_PARAMETERS; i++)
195 {
196 parameters[i] = 0x00;
197 }
198 // init status word
199 housekeeping_packet.lfr_status_word[0] = 0x00;
200 housekeeping_packet.lfr_status_word[1] = 0x00;
201 // init software version
202 housekeeping_packet.lfr_sw_version[0] = SW_VERSION_N1;
203 housekeeping_packet.lfr_sw_version[1] = SW_VERSION_N2;
204 housekeeping_packet.lfr_sw_version[2] = SW_VERSION_N3;
205 housekeeping_packet.lfr_sw_version[3] = SW_VERSION_N4;
206 // init sequence counters
207 for (i = 0; i<SEQ_CNT_NB_PID; i++)
208 {
209 for(j = 0; j<SEQ_CNT_NB_CAT; j++)
210 {
211 for(k = 0; k<SEQ_CNT_NB_DEST_ID; k++)
212 {
213 sequenceCounters[i][j][k] = 0x00;
214 }
215 }
216 }
217 }
218
185 int create_names( void )
219 int create_names( void )
186 {
220 {
187 // task names
221 // task names
@@ -10,10 +10,10 extern Packet_TM_LFR_HK_t housekeeping_p
10 int configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider,
10 int configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider,
11 unsigned char interrupt_level, rtems_isr (*timer_isr)() )
11 unsigned char interrupt_level, rtems_isr (*timer_isr)() )
12 { // configure the timer for the waveforms simulation
12 { // configure the timer for the waveforms simulation
13 rtems_status_code status;
13 rtems_status_code status;
14 rtems_isr_entry old_isr_handler;
14 rtems_isr_entry old_isr_handler;
15
15
16 status = rtems_interrupt_catch( timer_isr, interrupt_level, &old_isr_handler) ; // see sparcv8.pdf p.76 for interrupt levels
16 status = rtems_interrupt_catch( timer_isr, interrupt_level, &old_isr_handler) ; // see sparcv8.pdf p.76 for interrupt levels
17 //if (status==RTEMS_SUCCESSFUL) PRINTF("In configure_timer_for_wf_simulation *** rtems_interrupt_catch successfullly configured\n")
17 //if (status==RTEMS_SUCCESSFUL) PRINTF("In configure_timer_for_wf_simulation *** rtems_interrupt_catch successfullly configured\n")
18
18
19 gptimer_regs->timer[timer].reload = clock_divider; // base clock frequency is 1 MHz
19 gptimer_regs->timer[timer].reload = clock_divider; // base clock frequency is 1 MHz
@@ -26,31 +26,31 int configure_timer(gptimer_regs_t *gpti
26 return 1;
26 return 1;
27 }
27 }
28
28
29 void print_statistics(spw_stats *stats)
29 void print_statistics(spw_stats *stats)
30 {
30 {
31 //printf(" ******** STATISTICS ******** \n");
31 //printf(" ******** STATISTICS ******** \n");
32 printf("Transmit link errors: %i\n", stats->tx_link_err);
32 printf("Transmit link errors: %i\n", stats->tx_link_err);
33 printf("Receiver RMAP header CRC errors: %i\n", stats->rx_rmap_header_crc_err);
33 printf("Receiver RMAP header CRC errors: %i\n", stats->rx_rmap_header_crc_err);
34 printf("Receiver RMAP data CRC errors: %i\n", stats->rx_rmap_data_crc_err);
34 printf("Receiver RMAP data CRC errors: %i\n", stats->rx_rmap_data_crc_err);
35 printf("Receiver EEP errors: %i\n", stats->rx_eep_err);
35 printf("Receiver EEP errors: %i\n", stats->rx_eep_err);
36 printf("Receiver truncation errors: %i\n", stats->rx_truncated);
36 printf("Receiver truncation errors: %i\n", stats->rx_truncated);
37 printf("Parity errors: %i\n", stats->parity_err);
37 printf("Parity errors: %i\n", stats->parity_err);
38 printf("Escape errors: %i\n", stats->escape_err);
38 printf("Escape errors: %i\n", stats->escape_err);
39 printf("Credit errors: %i\n", stats->credit_err);
39 printf("Credit errors: %i\n", stats->credit_err);
40 printf("Disconnect errors: %i\n", stats->disconnect_err);
40 printf("Disconnect errors: %i\n", stats->disconnect_err);
41 printf("Write synchronization errors: %i\n", stats->write_sync_err);
41 printf("Write synchronization errors: %i\n", stats->write_sync_err);
42 printf("Early EOP/EEP: %i\n", stats->early_ep);
42 printf("Early EOP/EEP: %i\n", stats->early_ep);
43 printf("Invalid Node Address: %i\n", stats->invalid_address);
43 printf("Invalid Node Address: %i\n", stats->invalid_address);
44 printf("Packets transmitted: %i\n", stats->packets_sent);
44 printf("Packets transmitted: %i\n", stats->packets_sent);
45 printf("Packets received: %i\n", stats->packets_received);
45 printf("Packets received: %i\n", stats->packets_received);
46 }
46 }
47
47
48 int send_console_outputs_on_serial_port( void ) // Send the console outputs on the serial port
48 int send_console_outputs_on_serial_port( void ) // Send the console outputs on the serial port
49 {
49 {
50 struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART;
50 struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) REGS_ADDR_APBUART;
51
51
52 apbuart_regs->ctrl = apbuart_regs->ctrl & APBUART_CTRL_REG_MASK_DB;
52 apbuart_regs->ctrl = apbuart_regs->ctrl & APBUART_CTRL_REG_MASK_DB;
53 PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n")
53 PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n")
54
54
55 return 0;
55 return 0;
56 }
56 }
@@ -58,9 +58,9 int send_console_outputs_on_serial_port(
58 int set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value)
58 int set_apbuart_scaler_reload_register(unsigned int regs, unsigned int value)
59 {
59 {
60 struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) regs;
60 struct apbuart_regs_str *apbuart_regs = (struct apbuart_regs_str *) regs;
61
61
62 apbuart_regs->scaler = value;
62 apbuart_regs->scaler = value;
63 PRINTF1("OK *** COM port scaler reload register set to %x\n", value)
63 PRINTF1("OK *** COM port scaler reload register set to %x\n", value)
64
64
65 return 0;
65 return 0;
66 }
66 }
@@ -69,66 +69,66 int set_apbuart_scaler_reload_register(u
69 // RTEMS TASKS
69 // RTEMS TASKS
70
70
71 rtems_task stat_task(rtems_task_argument argument)
71 rtems_task stat_task(rtems_task_argument argument)
72 {
72 {
73 int i;
73 int i;
74 int j;
74 int j;
75 i = 0;
75 i = 0;
76 j = 0;
76 j = 0;
77 PRINTF("in STAT *** \n")
77 PRINTF("in STAT *** \n")
78 while(1){
78 while(1){
79 rtems_task_wake_after(1000);
79 rtems_task_wake_after(1000);
80 PRINTF1("%d\n", j)
80 PRINTF1("%d\n", j)
81 if (i == 2) {
81 if (i == 2) {
82 #ifdef PRINT_TASK_STATISTICS
82 #ifdef PRINT_TASK_STATISTICS
83 rtems_cpu_usage_report();
83 rtems_cpu_usage_report();
84 rtems_cpu_usage_reset();
84 rtems_cpu_usage_reset();
85 #endif
85 #endif
86 i = 0;
86 i = 0;
87 }
87 }
88 else i++;
88 else i++;
89 j++;
89 j++;
90 }
90 }
91 }
91 }
92
92
93 rtems_task hous_task(rtems_task_argument argument)
93 rtems_task hous_task(rtems_task_argument argument)
94 {
94 {
95 int result;
95 int result;
96 rtems_status_code status;
96 rtems_status_code status;
97
97
98 PRINTF("in HOUS ***\n")
98 PRINTF("in HOUS ***\n")
99
99
100 if (rtems_rate_monotonic_ident( HK_name, &HK_id)!=RTEMS_SUCCESSFUL) {
100 if (rtems_rate_monotonic_ident( HK_name, &HK_id) != RTEMS_SUCCESSFUL) {
101 status = rtems_rate_monotonic_create( HK_name, &HK_id );
101 status = rtems_rate_monotonic_create( HK_name, &HK_id );
102 if( status != RTEMS_SUCCESSFUL ) {
102 if( status != RTEMS_SUCCESSFUL ) {
103 PRINTF1( "rtems_rate_monotonic_create failed with status of %d\n", status )
103 PRINTF1( "rtems_rate_monotonic_create failed with status of %d\n", status )
104 }
104 }
105 }
105 }
106
106
107 housekeeping_packet.targetLogicalAddress = CCSDS_DESTINATION_ID;
107 housekeeping_packet.targetLogicalAddress = CCSDS_DESTINATION_ID;
108 housekeeping_packet.protocolIdentifier = 0x02;
108 housekeeping_packet.protocolIdentifier = 0x02;
109 housekeeping_packet.reserved = 0x00;
109 housekeeping_packet.reserved = 0x00;
110 housekeeping_packet.userApplication = 0x00;
110 housekeeping_packet.userApplication = 0x00;
111 housekeeping_packet.packetID[0] = 0x0c;
111 housekeeping_packet.packetID[0] = 0x0c;
112 housekeeping_packet.packetID[1] = 0xc4;
112 housekeeping_packet.packetID[1] = 0xc4;
113 housekeeping_packet.packetSequenceControl[0] = 0xc0;
113 housekeeping_packet.packetSequenceControl[0] = 0xc0;
114 housekeeping_packet.packetSequenceControl[1] = 0x00;
114 housekeeping_packet.packetSequenceControl[1] = 0x00;
115 housekeeping_packet.packetLength[0] = 0x00;
115 housekeeping_packet.packetLength[0] = 0x00;
116 housekeeping_packet.packetLength[1] = 0x77;
116 housekeeping_packet.packetLength[1] = 0x77;
117 housekeeping_packet.dataFieldHeader[0] = 0x10;
117 housekeeping_packet.dataFieldHeader[0] = 0x10;
118 housekeeping_packet.dataFieldHeader[1] = 0x03;
118 housekeeping_packet.dataFieldHeader[1] = TM_TYPE_HK;
119 housekeeping_packet.dataFieldHeader[2] = 0x19;
119 housekeeping_packet.dataFieldHeader[2] = TM_SUBTYPE_HK;
120 housekeeping_packet.dataFieldHeader[3] = 0x00;
120 housekeeping_packet.dataFieldHeader[3] = CCSDS_DESTINATION_ID_GROUND;
121
121
122 status = rtems_rate_monotonic_cancel(HK_id);
122 status = rtems_rate_monotonic_cancel(HK_id);
123 if( status != RTEMS_SUCCESSFUL )
123 if( status != RTEMS_SUCCESSFUL )
124 PRINTF1( "ERR *** in HOUS *** rtems_rate_monotonic_cancel(HK_id) ***code: %d\n", status )
124 PRINTF1( "ERR *** in HOUS *** rtems_rate_monotonic_cancel(HK_id) ***code: %d\n", status )
125 else
125 else
126 PRINTF("OK *** in HOUS *** rtems_rate_monotonic_cancel(HK_id)\n")
126 PRINTF("OK *** in HOUS *** rtems_rate_monotonic_cancel(HK_id)\n")
127
127
128 while(1){ // launch the rate monotonic task
128 while(1){ // launch the rate monotonic task
129 status = rtems_rate_monotonic_period( HK_id, HK_PERIOD );
129 status = rtems_rate_monotonic_period( HK_id, HK_PERIOD );
130 if ( status != RTEMS_SUCCESSFUL ){
130 if ( status != RTEMS_SUCCESSFUL ){
131 PRINTF1( "ERR *** in HOUS *** rtems_rate_monotonic_period *** code %d\n", status);
131 PRINTF1( "ERR *** in HOUS *** rtems_rate_monotonic_period *** code %d\n", status);
132 }
132 }
133 else
133 else
134 {
134 {
@@ -138,19 +138,19 rtems_task hous_task(rtems_task_argument
138 housekeeping_packet.dataFieldHeader[7] = (unsigned char) (time_management_regs->coarse_time);
138 housekeeping_packet.dataFieldHeader[7] = (unsigned char) (time_management_regs->coarse_time);
139 housekeeping_packet.dataFieldHeader[8] = (unsigned char) (time_management_regs->fine_time>>8);
139 housekeeping_packet.dataFieldHeader[8] = (unsigned char) (time_management_regs->fine_time>>8);
140 housekeeping_packet.dataFieldHeader[9] = (unsigned char) (time_management_regs->fine_time);
140 housekeeping_packet.dataFieldHeader[9] = (unsigned char) (time_management_regs->fine_time);
141 housekeeping_packet.data[0] = CCSDS_DESTINATION_ID_DPU;
141 housekeeping_packet.sid = CCSDS_DESTINATION_ID_DPU;
142 result = write ( fdSPW, &housekeeping_packet, LEN_TM_LFR_HK);
142 result = write ( fdSPW, &housekeeping_packet, LEN_TM_LFR_HK);
143 if (result==-1)
143 if (result==-1)
144 {
144 {
145 PRINTF("ERR *** in HOUS *** HK send\n");
145 PRINTF("ERR *** in HOUS *** HK send\n");
146 }
146 }
147 }
147 }
148 }
148 }
149
149
150 PRINTF("in HOUS *** deleting task\n")
150 PRINTF("in HOUS *** deleting task\n")
151
151
152 status = rtems_task_delete( RTEMS_SELF ); // should not return
152 status = rtems_task_delete( RTEMS_SELF ); // should not return
153 printf( "rtems_task_delete returned with status of %d.\n", status );
153 printf( "rtems_task_delete returned with status of %d.\n", status );
154 exit( 1 );
154 exit( 1 );
155 }
155 }
156
156
@@ -1,9 +1,9
1 #include <tc_handler.h>
1 #include <tc_handler.h>
2 #include <fsw_params.h>
2 #include <fsw_params.h>
3
3
4 char *DumbMessages[5] = {"default",
4 char *DumbMessages[5] = {"in DUMB *** default",
5 "timecode_irq_handler",
5 "in DUMB *** timecode_irq_handler",
6 "waveforms_isr",
6 "in DUMB *** waveforms_isr",
7 "",
7 "",
8 ""
8 ""
9 };
9 };
@@ -485,6 +485,7 rtems_task recv_task( rtems_task_argumen
485 rtems_task actn_task( rtems_task_argument unused )
485 rtems_task actn_task( rtems_task_argument unused )
486 {
486 {
487 int result = 0;
487 int result = 0;
488 unsigned int val;
488 rtems_status_code status; // RTEMS status code
489 rtems_status_code status; // RTEMS status code
489 ccsdsTelecommandPacket_t TC; // TC sent to the ACTN task
490 ccsdsTelecommandPacket_t TC; // TC sent to the ACTN task
490 size_t size; // size of the incoming TC packet
491 size_t size; // size of the incoming TC packet
@@ -507,37 +508,47 rtems_task actn_task( rtems_task_argumen
507 break;
508 break;
508 //
509 //
509 case TC_SUBTYPE_LOAD_COMM:
510 case TC_SUBTYPE_LOAD_COMM:
510 result = action_default( &TC );
511 result = action_load_comm( &TC );
512 close_action( &TC, result );
511 break;
513 break;
512 //
514 //
513 case TC_SUBTYPE_LOAD_NORM:
515 case TC_SUBTYPE_LOAD_NORM:
514 result = action_load_norm( &TC );
516 result = action_load_norm( &TC );
515 send_tm_lfr_tc_exe_success( &TC );
517 close_action( &TC, result );
516 break;
518 break;
517 //
519 //
518 case TC_SUBTYPE_LOAD_BURST:
520 case TC_SUBTYPE_LOAD_BURST:
519 result = action_default( &TC );
521 result = action_default( &TC );
522 close_action( &TC, result );
520 break;
523 break;
521 //
524 //
522 case TC_SUBTYPE_LOAD_SBM1:
525 case TC_SUBTYPE_LOAD_SBM1:
523 result = action_default( &TC );
526 result = action_default( &TC );
527 close_action( &TC, result );
524 break;
528 break;
525 //
529 //
526 case TC_SUBTYPE_LOAD_SBM2:
530 case TC_SUBTYPE_LOAD_SBM2:
527 result = action_default( &TC );
531 result = action_default( &TC );
532 close_action( &TC, result );
528 break;
533 break;
529 //
534 //
530 case TC_SUBTYPE_DUMP:
535 case TC_SUBTYPE_DUMP:
531 result = action_default( &TC );
536 result = action_default( &TC );
537 close_action( &TC, result );
532 break;
538 break;
533 //
539 //
534 case TC_SUBTYPE_ENTER:
540 case TC_SUBTYPE_ENTER:
535 result = action_enter( &TC );
541 result = action_enter( &TC );
536 send_tm_lfr_tc_exe_success( &TC );
542 close_action( &TC, result );
537 break;
543 break;
538 //
544 //
539 case TC_SUBTYPE_UPDT_INFO:
545 case TC_SUBTYPE_UPDT_INFO:
540 result = action_default( &TC );
546 result = action_default( &TC );
547 val = housekeeping_packet.hk_lfr_update_info_tc_cnt[0] * 256
548 + housekeeping_packet.hk_lfr_update_info_tc_cnt[1];