##// 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];
549 val++;
550 housekeeping_packet.hk_lfr_update_info_tc_cnt[0] = (unsigned char) (val >> 8);
551 housekeeping_packet.hk_lfr_update_info_tc_cnt[1] = (unsigned char) (val);
541 break;
552 break;
542 //
553 //
543 case TC_SUBTYPE_EN_CAL:
554 case TC_SUBTYPE_EN_CAL:
@@ -550,7 +561,11 rtems_task actn_task( rtems_task_argumen
550 //
561 //
551 case TC_SUBTYPE_UPDT_TIME:
562 case TC_SUBTYPE_UPDT_TIME:
552 result = action_updt_time( &TC );
563 result = action_updt_time( &TC );
553 send_tm_lfr_tc_exe_success( &TC );
564 val = housekeeping_packet.hk_lfr_update_time_tc_cnt[0] * 256
565 + housekeeping_packet.hk_lfr_update_time_tc_cnt[1];
566 val++;
567 housekeeping_packet.hk_lfr_update_time_tc_cnt[0] = (unsigned char) (val >> 8);
568 housekeeping_packet.hk_lfr_update_time_tc_cnt[1] = (unsigned char) (val);
554 break;
569 break;
555 //
570 //
556 default:
571 default:
@@ -571,7 +586,8 rtems_task dumb_task( rtems_task_argumen
571 PRINTF("in DUMB *** \n")
586 PRINTF("in DUMB *** \n")
572
587
573 while(1){
588 while(1){
574 rtems_event_receive(RTEMS_EVENT_1, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
589 rtems_event_receive(RTEMS_EVENT_0 | RTEMS_EVENT_1 | RTEMS_EVENT_2 | RTEMS_EVENT_3 | RTEMS_EVENT_4,
590 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT
575 indice = 0;
591 indice = 0;
576 shiftedIndice = (unsigned int) event_out;
592 shiftedIndice = (unsigned int) event_out;
577 while(!(shiftedIndice & 0x0001))
593 while(!(shiftedIndice & 0x0001))
@@ -609,11 +625,12 int action_default(ccsdsTelecommandPacke
609 PRINTF("ERR *** in action_default *** send TM packet\n");
625 PRINTF("ERR *** in action_default *** send TM packet\n");
610 }
626 }
611
627
612 return 0;
628 return LFR_DEFAULT;
613 }
629 }
614
630
615 int action_enter(ccsdsTelecommandPacket_t *TC)
631 int action_enter(ccsdsTelecommandPacket_t *TC)
616 {
632 {
633 rtems_status_code status;
617 unsigned char lfr_mode = TC->dataAndCRC[1];
634 unsigned char lfr_mode = TC->dataAndCRC[1];
618 printf("enter mode %d\n", lfr_mode);
635 printf("enter mode %d\n", lfr_mode);
619 switch(lfr_mode)
636 switch(lfr_mode)
@@ -621,46 +638,72 int action_enter(ccsdsTelecommandPacket_
621 //********
638 //********
622 // STANDBY
639 // STANDBY
623 case(LFR_MODE_STANDBY):
640 case(LFR_MODE_STANDBY):
624 stop_current_mode();
641 status = stop_current_mode();
642 if (status != RTEMS_SUCCESSFUL)
643 {
644 PRINTF("in action_enter *** error going back to STANDBY mode\n")
645 }
646 housekeeping_packet.lfr_status_word[0] = (unsigned char) ((LFR_MODE_STANDBY << 4) + 0x0d);
625 break;
647 break;
626
648
627 //******
649 //******
628 // NORMAL
650 // NORMAL
629 case(LFR_MODE_NORMAL):
651 case(LFR_MODE_NORMAL):
630 stop_current_mode();
652 status = stop_current_mode();
631 enter_normal_mode();
653 status = enter_normal_mode();
654 if (status == RTEMS_SUCCESSFUL)
655 {
656 housekeeping_packet.lfr_status_word[0] = (unsigned char) ((LFR_MODE_NORMAL << 4) + 0x0d);
657 }
632 break;
658 break;
633
659
634 //******
660 //******
635 // BURST
661 // BURST
636 case(LFR_MODE_BURST):
662 case(LFR_MODE_BURST):
637 stop_current_mode();
663 status = stop_current_mode();
664 if (status == RTEMS_SUCCESSFUL)
665 {
666 housekeeping_packet.lfr_status_word[0] = (unsigned char) ((LFR_MODE_BURST << 4) + 0x0d);
667 }
638 break;
668 break;
639
669
640 //*****
670 //*****
641 // SBM1
671 // SBM1
642 case(LFR_MODE_SBM1):
672 case(LFR_MODE_SBM1):
643 stop_current_mode();
673 status = stop_current_mode();
644 enter_sbm1_mode();
674 status = enter_sbm1_mode();
675 if (status == RTEMS_SUCCESSFUL)
676 {
677 housekeeping_packet.lfr_status_word[0] = (unsigned char) ((LFR_MODE_SBM1 << 4) + 0x0d);
678 }
645 break;
679 break;
646
680
647 //*****
681 //*****
648 // SBM2
682 // SBM2
649 case(LFR_MODE_SBM2):
683 case(LFR_MODE_SBM2):
650 stop_current_mode();
684 status = stop_current_mode();
685 if (status == RTEMS_SUCCESSFUL)
686 {
687 housekeeping_packet.lfr_status_word[0] = (unsigned char) ((LFR_MODE_SBM2 << 4) + 0x0d);
688 }
651 break;
689 break;
652
690
653 //********
691 //********
654 // DEFAULT
692 // DEFAULT
655 default:
693 default:
656 stop_current_mode();
694 status = stop_current_mode();
695 if (status == RTEMS_SUCCESSFUL)
696 {
697 housekeeping_packet.lfr_status_word[0] = (unsigned char) ((LFR_MODE_STANDBY << 4) + 0x0d);
698 }
657 break;
699 break;
658 }
700 }
659 return 0;
701 return status;
660 }
702 }
661
703
662 int stop_current_mode()
704 int stop_current_mode()
663 {
705 {
706 rtems_status_code status;
664 // mask all IRQ lines related to signal processing
707 // mask all IRQ lines related to signal processing
665 LEON_Mask_interrupt( IRQ_WF ); // mask waveform interrupt (coming from the timer VHDL IP)
708 LEON_Mask_interrupt( IRQ_WF ); // mask waveform interrupt (coming from the timer VHDL IP)
666 LEON_Mask_interrupt( IRQ_SM ); // mask spectral matrices interrupt (coming from the timer VHDL IP)
709 LEON_Mask_interrupt( IRQ_SM ); // mask spectral matrices interrupt (coming from the timer VHDL IP)
@@ -672,22 +715,31 int stop_current_mode()
672 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt
715 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt
673
716
674 // suspend several tasks
717 // suspend several tasks
675 suspend_if_needed( Task_id[TASKID_AVF0] );
718 status = suspend_if_needed( Task_id[TASKID_AVF0] );
676 suspend_if_needed( Task_id[TASKID_BPF0] );
719 if (status == RTEMS_SUCCESSFUL) {
677 suspend_if_needed( Task_id[TASKID_WFRM] );
720 status = suspend_if_needed( Task_id[TASKID_BPF0] );
721 if (status == RTEMS_SUCCESSFUL) {
722 status = suspend_if_needed( Task_id[TASKID_WFRM] );
723 }
724 }
678
725
679 // initialize the registers
726 // initialize the registers
680 waveform_picker_regs->burst_enable = 0x00; // initialize
727 waveform_picker_regs->burst_enable = 0x00; // initialize
681
728
682 return 0;
729 return status;
683 }
730 }
684
731
685 int enter_normal_mode()
732 int enter_normal_mode()
686 {
733 {
734 rtems_status_code status;
687
735
688 restart_if_needed( Task_id[TASKID_AVF0] );
736 status = restart_if_needed( Task_id[TASKID_AVF0] );
689 restart_if_needed( Task_id[TASKID_BPF0] );
737 if (status == RTEMS_SUCCESSFUL) {
690 restart_if_needed( Task_id[TASKID_WFRM] );
738 status = restart_if_needed( Task_id[TASKID_BPF0] );
739 if (status == RTEMS_SUCCESSFUL) {
740 status = restart_if_needed( Task_id[TASKID_WFRM] );
741 }
742 }
691
743
692 #ifdef GSA
744 #ifdef GSA
693 LEON_Unmask_interrupt( IRQ_WF );
745 LEON_Unmask_interrupt( IRQ_WF );
@@ -695,17 +747,24 int enter_normal_mode()
695 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
747 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
696 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
748 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
697 waveform_picker_regs->burst_enable = 0x07;
749 waveform_picker_regs->burst_enable = 0x07;
750 waveform_picker_regs->addr_data_f1 = (int) wf_snap_f1;
698 waveform_picker_regs->status = 0x00;
751 waveform_picker_regs->status = 0x00;
699 #endif
752 #endif
700 LEON_Unmask_interrupt( IRQ_SM );
753 LEON_Unmask_interrupt( IRQ_SM );
701 return 0;
754
755 return status;
702 }
756 }
703
757
704 int enter_sbm1_mode()
758 int enter_sbm1_mode()
705 {
759 {
706 restart_if_needed( Task_id[TASKID_AVF0] );
760 rtems_status_code status;
707 restart_if_needed( Task_id[TASKID_BPF0] );
761 status = restart_if_needed( Task_id[TASKID_AVF0] );
708 restart_if_needed( Task_id[TASKID_WFRM] );
762 if (status == RTEMS_SUCCESSFUL) {
763 status = restart_if_needed( Task_id[TASKID_BPF0] );
764 if (status == RTEMS_SUCCESSFUL) {
765 status = restart_if_needed( Task_id[TASKID_WFRM] );
766 }
767 }
709
768
710 #ifdef GSA
769 #ifdef GSA
711 #else
770 #else
@@ -716,7 +775,7 int enter_sbm1_mode()
716 waveform_picker_regs->status = 0x00;
775 waveform_picker_regs->status = 0x00;
717 #endif
776 #endif
718 //LEON_Unmask_interrupt( IRQ_SM );
777 //LEON_Unmask_interrupt( IRQ_SM );
719 return 0;
778 return status;
720 }
779 }
721
780
722 int action_load_norm(ccsdsTelecommandPacket_t *TC)
781 int action_load_norm(ccsdsTelecommandPacket_t *TC)
@@ -726,10 +785,18 int action_load_norm(ccsdsTelecommandPac
726 param_norm.sy_lfr_n_asm_p = (TC->dataAndCRC[4] * 256) + TC->dataAndCRC[5];
785 param_norm.sy_lfr_n_asm_p = (TC->dataAndCRC[4] * 256) + TC->dataAndCRC[5];
727 param_norm.sy_lfr_n_bp_p0 = TC->dataAndCRC[6];
786 param_norm.sy_lfr_n_bp_p0 = TC->dataAndCRC[6];
728 param_norm.sy_lfr_n_bp_p1 = TC->dataAndCRC[7];
787 param_norm.sy_lfr_n_bp_p1 = TC->dataAndCRC[7];
729 /*printf("sy_lfr_n_ => swf_l %d, swf_p %d, asm_p %d, bsp_p0 %d, bsp_p1 %d\n",
788
730 param_norm.sy_lfr_n_swf_l, param_norm.sy_lfr_n_swf_p,
789 return LFR_SUCCESSFUL;
731 param_norm.sy_lfr_n_asm_p, param_norm.sy_lfr_n_bp_p0, param_norm.sy_lfr_n_bp_p1);*/
790 }
732 return 0;
791
792 int action_load_comm(ccsdsTelecommandPacket_t *TC)
793 {
794 param_common.sy_lfr_common0 = TC->dataAndCRC[0];
795 param_common.sy_lfr_common1 = TC->dataAndCRC[1];
796
797 set_data_shaping_parameters(param_common.sy_lfr_common1);
798
799 return LFR_SUCCESSFUL;
733 }
800 }
734
801
735 int action_updt_time(ccsdsTelecommandPacket_t *TC)
802 int action_updt_time(ccsdsTelecommandPacket_t *TC)
@@ -800,6 +867,60 rtems_status_code suspend_if_needed(rtem
800 return status;
867 return status;
801 }
868 }
802
869
870 void update_last_TC_exe(ccsdsTelecommandPacket_t *TC)
871 {
872 housekeeping_packet.hk_lfr_last_exe_tc_id[0] = TC->packetID[0];
873 housekeeping_packet.hk_lfr_last_exe_tc_id[1] = TC->packetID[1];
874 housekeeping_packet.hk_lfr_last_exe_tc_type[0] = 0x00;
875 housekeeping_packet.hk_lfr_last_exe_tc_type[1] = TC->dataFieldHeader[1];
876 housekeeping_packet.hk_lfr_last_exe_tc_subtype[0] = 0x00;
877 housekeeping_packet.hk_lfr_last_exe_tc_subtype[1] = TC->dataFieldHeader[2];
878 housekeeping_packet.hk_lfr_last_exe_tc_time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
879 housekeeping_packet.hk_lfr_last_exe_tc_time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
880 housekeeping_packet.hk_lfr_last_exe_tc_time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
881 housekeeping_packet.hk_lfr_last_exe_tc_time[3] = (unsigned char) (time_management_regs->coarse_time);
882 housekeeping_packet.hk_lfr_last_exe_tc_time[4] = (unsigned char) (time_management_regs->fine_time>>8);
883 housekeeping_packet.hk_lfr_last_exe_tc_time[5] = (unsigned char) (time_management_regs->fine_time);
884 }
885
886 void update_last_TC_rej(ccsdsTelecommandPacket_t *TC)
887 {
888 housekeeping_packet.hk_lfr_last_rej_tc_id[0] = TC->packetID[0];
889 housekeeping_packet.hk_lfr_last_rej_tc_id[1] = TC->packetID[1];
890 housekeeping_packet.hk_lfr_last_rej_tc_type[0] = 0x00;
891 housekeeping_packet.hk_lfr_last_rej_tc_type[1] = TC->dataFieldHeader[1];
892 housekeeping_packet.hk_lfr_last_rej_tc_subtype[0] = 0x00;
893 housekeeping_packet.hk_lfr_last_rej_tc_subtype[1] = TC->dataFieldHeader[2];
894 housekeeping_packet.hk_lfr_last_rej_tc_time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
895 housekeeping_packet.hk_lfr_last_rej_tc_time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
896 housekeeping_packet.hk_lfr_last_rej_tc_time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
897 housekeeping_packet.hk_lfr_last_rej_tc_time[3] = (unsigned char) (time_management_regs->coarse_time);
898 housekeeping_packet.hk_lfr_last_rej_tc_time[4] = (unsigned char) (time_management_regs->fine_time>>8);
899 housekeeping_packet.hk_lfr_last_rej_tc_time[5] = (unsigned char) (time_management_regs->fine_time);
900 }
901
902 void close_action(ccsdsTelecommandPacket_t *TC, int result)
903 {
904 unsigned int val = 0;
905 if (result == LFR_SUCCESSFUL)
906 {
907 send_tm_lfr_tc_exe_success( TC );
908 update_last_TC_exe( TC );
909 val = housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[0] * 256 + housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[1];
910 val++;
911 housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[0] = (unsigned char) (val >> 8);
912 housekeeping_packet.hk_dpu_exe_tc_lfr_cnt[1] = (unsigned char) (val);
913 }
914 else
915 {
916 update_last_TC_rej( TC );
917 val = housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[0] * 256 + housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[1];
918 val++;
919 housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[0] = (unsigned char) (val >> 8);
920 housekeeping_packet.hk_dpu_rej_tc_lfr_cnt[1] = (unsigned char) (val);
921 }
922 }
923
803 //***************************
924 //***************************
804 // Interrupt Service Routines
925 // Interrupt Service Routines
805 rtems_isr commutation_isr1( rtems_vector_number vector )
926 rtems_isr commutation_isr1( rtems_vector_number vector )
@@ -1,10 +1,7
1 #include <wf_handler.h>
1 #include <wf_handler.h>
2
2
3 rtems_isr waveforms_isr( rtems_vector_number vector )
3 rtems_isr waveforms_isr_alternative( rtems_vector_number vector )
4 {
4 {
5 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ) != RTEMS_SUCCESSFUL) {
6 printf("In waveforms_isr *** Error sending event to WFRM\n");
7 }
8 if (waveform_picker_regs->burst_enable == 0x22) {
5 if (waveform_picker_regs->burst_enable == 0x22) {
9 if (waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1) {
6 if (waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1) {
10 waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1_bis);
7 waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1_bis);
@@ -12,8 +9,8 rtems_isr waveforms_isr( rtems_vector_nu
12 else {
9 else {
13 waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1);
10 waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1);
14 }
11 }
15 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
12 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_2 ) != RTEMS_SUCCESSFUL) {
16 printf("In waveforms_isr *** Error sending event to WFRM\n");
13 //rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
17 }
14 }
18 }
15 }
19 waveform_picker_regs->status = 0x00;
16 waveform_picker_regs->status = 0x00;
@@ -32,6 +29,81 rtems_isr waveforms_isr( rtems_vector_nu
32 }*/
29 }*/
33 }
30 }
34
31
32 rtems_isr waveforms_isr( rtems_vector_number vector )
33 {
34 unsigned char lfrMode;
35 lfrMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
36
37 switch(lfrMode)
38 {
39 //********
40 // STANDBY
41 case(LFR_MODE_STANDBY):
42 break;
43
44 //******
45 // NORMAL
46 case(LFR_MODE_NORMAL):
47 #ifdef GSA
48 PRINTF("in waveform_isr *** unexpected waveform picker interruption\n")
49 #else
50 if ( (waveform_picker_regs->burst_enable & 0x7) == 0x0 ){// if no channel is enable
51 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ) != RTEMS_SUCCESSFUL) {
52 PRINTF("in waveform_isr *** Error sending event to DUMB\n");
53 }
54 }
55 else {
56 if ( (waveform_picker_regs->status & 0x7) == 0x7 ){ // f2 f1 and f0 are full
57 waveform_picker_regs->burst_enable = 0x00;
58 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) {
59 if (rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 ) != RTEMS_SUCCESSFUL) {
60 PRINTF("in waveform_isr *** Error sending event to DUMB\n");
61 }
62 }
63 }
64 }
65 #endif
66 break;
67
68 //******
69 // BURST
70 case(LFR_MODE_BURST):
71 break;
72
73 //*****
74 // SBM1
75 case(LFR_MODE_SBM1):
76 #ifdef GSA
77 PRINTF("in waveform_isr *** unexpected waveform picker interruption\n")
78 #else
79 if (waveform_picker_regs->burst_enable == 0x22) {
80 if (waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1) {
81 waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1_bis);
82 }
83 else {
84 waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1);
85 }
86 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_SBM1 ) != RTEMS_SUCCESSFUL) {
87 PRINTF("in waveforms_isr *** Error sending event to WFRM\n")
88 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
89 }
90 }
91 waveform_picker_regs->status = 0x00;
92 #endif
93 break;
94
95 //*****
96 // SBM2
97 case(LFR_MODE_SBM2):
98 break;
99
100 //********
101 // DEFAULT
102 default:
103 break;
104 }
105 }
106
35 rtems_isr waveforms_simulator_isr( rtems_vector_number vector )
107 rtems_isr waveforms_simulator_isr( rtems_vector_number vector )
36 {
108 {
37 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
109 if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
@@ -76,9 +148,9 rtems_task wfrm_task(rtems_task_argument
76 PRINTF("in WFRM ***\n")
148 PRINTF("in WFRM ***\n")
77
149
78 while(1){
150 while(1){
79
151 // wait for an RTEMS_EVENT
80 rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0
152 rtems_event_receive(RTEMS_EVENT_0 | RTEMS_EVENT_1 | RTEMS_EVENT_2 | RTEMS_EVENT_3 | RTEMS_EVENT_4,
81 PRINTF("in WFRM *** send wfrm\n")
153 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
82 header.dataFieldHeader[4] = (unsigned char) (time_management_regs->coarse_time>>24);
154 header.dataFieldHeader[4] = (unsigned char) (time_management_regs->coarse_time>>24);
83 header.dataFieldHeader[5] = (unsigned char) (time_management_regs->coarse_time>>16);
155 header.dataFieldHeader[5] = (unsigned char) (time_management_regs->coarse_time>>16);
84 header.dataFieldHeader[6] = (unsigned char) (time_management_regs->coarse_time>>8);
156 header.dataFieldHeader[6] = (unsigned char) (time_management_regs->coarse_time>>8);
@@ -86,29 +158,48 rtems_task wfrm_task(rtems_task_argument
86 header.dataFieldHeader[8] = (unsigned char) (time_management_regs->fine_time>>8);
158 header.dataFieldHeader[8] = (unsigned char) (time_management_regs->fine_time>>8);
87 header.dataFieldHeader[9] = (unsigned char) (time_management_regs->fine_time);
159 header.dataFieldHeader[9] = (unsigned char) (time_management_regs->fine_time);
88
160
89 //***************
161 switch(event_out)
90 // send snapshots
162 {
91 // F0
163 //********
92 //send_waveform( &header, wf_snap_f0, SID_NORM_SWF_F0, &spw_ioctl_send);
164 // STANDBY
93 // F1
165 case(RTEMS_EVENT_MODE_STANDBY):
94 if (waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1) {
166 break;
95 send_waveform( &header, wf_snap_f1_bis, SID_NORM_SWF_F1, &spw_ioctl_send);
167
96 }
168 //*******
97 else {
169 // NORMAL
98 send_waveform( &header, wf_snap_f1, SID_NORM_SWF_F1, &spw_ioctl_send);
170 case(RTEMS_EVENT_MODE_NORMAL):
171 //***************
172 // send snapshots
173 // F0
174 send_waveform( &header, wf_snap_f0, SID_NORM_SWF_F0, &spw_ioctl_send);
175 // F1
176 send_waveform( &header, wf_snap_f1, SID_NORM_SWF_F1, &spw_ioctl_send);
177 // F2
178 send_waveform( &header, wf_snap_f2, SID_NORM_SWF_F2, &spw_ioctl_send);
179 #ifdef GSA
180 // irq processed, reset the related register of the timer unit
181 gptimer_regs->timer[2].ctrl = gptimer_regs->timer[2].ctrl | 0x00000010;
182 #else
183 // irq processed, reset the related register of the waveform picker
184 waveform_picker_regs->status = 0x00;
185 waveform_picker_regs->burst_enable = 0x07;
186 #endif
187 break;
188
189 //*****
190 // SBM1
191 case(RTEMS_EVENT_MODE_SBM1):
192 // F1
193 if (waveform_picker_regs->addr_data_f1 == (int) wf_snap_f1) {
194 send_waveform( &header, wf_snap_f1_bis, SID_NORM_SWF_F1, &spw_ioctl_send);
195 }
196 else {
197 send_waveform( &header, wf_snap_f1, SID_NORM_SWF_F1, &spw_ioctl_send);
198 }
199 break;
200 default:
201 break;
99 }
202 }
100 // F2
101 //send_waveform( &header, wf_snap_f2, SID_NORM_SWF_F2, &spw_ioctl_send);
102
103 #ifdef GSA
104 // irq processed, reset the related register of the timer unit
105 gptimer_regs->timer[2].ctrl = gptimer_regs->timer[2].ctrl | 0x00000010;
106 #else
107 // irq processed, reset the related register of the waveform picker
108 //waveform_picker_regs->status = 0x00;
109 //waveform_picker_regs->burst_enable = 0x07;
110 #endif
111
112 }
203 }
113 }
204 }
114
205
@@ -290,8 +381,8 int build_value(int value1, int value0)
290 }
381 }
291
382
292 void init_waveform_picker_regs()
383 void init_waveform_picker_regs()
293 { // 1 1 0 0 0 BW = 0 => BIAS_WORKS
384 {
294 waveform_picker_regs->data_shaping = 0x18; // R1 R0 SP1 SP0 BW
385 set_data_shaping_parameters(param_common.sy_lfr_common1);
295 waveform_picker_regs->burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
386 waveform_picker_regs->burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
296 waveform_picker_regs->addr_data_f0 = (int) (wf_snap_f0); //
387 waveform_picker_regs->addr_data_f0 = (int) (wf_snap_f0); //
297 waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1); //
388 waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1); //
@@ -310,3 +401,14 void init_waveform_picker_regs()
310 //waveform_picker_regs->nb_snapshot_param = 0xff; // max 3 octets, 256 - 1
401 //waveform_picker_regs->nb_snapshot_param = 0xff; // max 3 octets, 256 - 1
311 }
402 }
312
403
404 void set_data_shaping_parameters(unsigned char parameters)
405 {
406 // get the parameters for the data shaping [BW SP0 SP1 R0 R1] in sy_lfr_common1 and configure the register
407 // waveform picker : [R1 R0 SP1 SP0 BW]
408 waveform_picker_regs->data_shaping =
409 ( (parameters & 0x10) >> 4 ) // BW
410 + ( (parameters & 0x08) >> 2 ) // SP0
411 + ( (parameters & 0x04) ) // SP1
412 + ( (parameters & 0x02) << 2 ) // R0
413 + ( (parameters & 0x01) << 4 ); // R1
414 }
General Comments 0
You need to be logged in to leave comments. Login now