@@ -0,0 +1,26 | |||||
|
1 | #ifndef FSW_PARAMS_PROCESSING_H | |||
|
2 | #define FSW_PARAMS_PROCESSING_H | |||
|
3 | ||||
|
4 | #define NB_BINS_PER_SM 128 | |||
|
5 | #define NB_VALUES_PER_SM 25 | |||
|
6 | #define TOTAL_SIZE_SM (NB_BINS_PER_SM * NB_VALUES_PER_SM) | |||
|
7 | ||||
|
8 | #define NB_BINS_COMPRESSED_SM_F0 11 | |||
|
9 | #define NB_BINS_COMPRESSED_SM_F1 13 | |||
|
10 | #define NB_BINS_COMPRESSED_SM_F2 12 | |||
|
11 | #define TOTAL_SIZE_COMPRESSED_MATRIX_f0 (NB_BINS_COMPRESSED_SM_F0 * NB_VALUES_PER_SM) | |||
|
12 | #define NB_AVERAGE_NORMAL_f0 96*4 | |||
|
13 | #define NB_SM_TO_RECEIVE_BEFORE_AVF0 8 | |||
|
14 | ||||
|
15 | struct BP1_str{ | |||
|
16 | volatile unsigned char PE[2]; | |||
|
17 | volatile unsigned char PB[2]; | |||
|
18 | volatile unsigned char V0; | |||
|
19 | volatile unsigned char V1; | |||
|
20 | volatile unsigned char V2_ELLIP_DOP; | |||
|
21 | volatile unsigned char SZ; | |||
|
22 | volatile unsigned char VPHI; | |||
|
23 | }; | |||
|
24 | typedef struct BP1_str BP1_t; | |||
|
25 | ||||
|
26 | #endif // FSW_PARAMS_PROCESSING_H |
@@ -1,6 +1,6 | |||||
1 | ############################################################################# |
|
1 | ############################################################################# | |
2 | # Makefile for building: bin/fsw |
|
2 | # Makefile for building: bin/fsw-gsa | |
3 |
# Generated by qmake (2.01a) (Qt 4.8.4) on: |
|
3 | # Generated by qmake (2.01a) (Qt 4.8.4) on: Thu Jul 25 10:29:57 2013 | |
4 | # Project: fsw-qt.pro |
|
4 | # Project: fsw-qt.pro | |
5 | # Template: app |
|
5 | # Template: app | |
6 | # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro |
|
6 | # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro | |
@@ -10,7 +10,7 | |||||
10 |
|
10 | |||
11 | CC = sparc-rtems-gcc |
|
11 | CC = sparc-rtems-gcc | |
12 | CXX = sparc-rtems-g++ |
|
12 | CXX = sparc-rtems-g++ | |
13 |
DEFINES = -DSW_VERSION_N1=0 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4= |
|
13 | DEFINES = -DSW_VERSION_N1=0 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=11 -DPRINT_MESSAGES_ON_CONSOLE -DGSA | |
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 | |
@@ -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-gsa | |
82 | DESTDIR = bin/ |
|
82 | DESTDIR = bin/ | |
83 | TARGET = bin/fsw |
|
83 | TARGET = bin/fsw-gsa | |
84 |
|
84 | |||
85 | first: all |
|
85 | first: all | |
86 | ####### Implicit rules |
|
86 | ####### Implicit rules | |
@@ -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-gsa1.0.0 || $(MKDIR) obj/fsw-gsa1.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-gsa1.0.0/ && (cd `dirname obj/fsw-gsa1.0.0` && $(TAR) fsw-gsa1.0.0.tar fsw-gsa1.0.0 && $(COMPRESS) fsw-gsa1.0.0.tar) && $(MOVE) `dirname obj/fsw-gsa1.0.0`/fsw-gsa1.0.0.tar.gz . && $(DEL_FILE) -r obj/fsw-gsa1.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 |
1 | NO CONTENT: modified file, binary diff hidden |
|
NO CONTENT: modified file, binary diff hidden |
@@ -1,17 +1,17 | |||||
1 | TEMPLATE = app |
|
1 | TEMPLATE = app | |
2 | # CONFIG += console v8 sim |
|
2 | # CONFIG += console v8 sim | |
3 | # CONFIG options = verbose *** cpu_usage_report *** gsa |
|
3 | # CONFIG options = verbose *** cpu_usage_report *** gsa | |
4 | CONFIG += console verbose |
|
4 | CONFIG += console verbose gsa | |
5 | CONFIG -= qt |
|
5 | CONFIG -= qt | |
6 |
|
6 | |||
7 | include(./sparc.pri) |
|
7 | include(./sparc.pri) | |
8 |
|
8 | |||
9 | # flight software version |
|
9 | # flight software version | |
10 |
SWVERSION=-0- |
|
10 | SWVERSION=-0-11 | |
11 | DEFINES += SW_VERSION_N1=0 |
|
11 | DEFINES += SW_VERSION_N1=0 | |
12 | DEFINES += SW_VERSION_N2=0 |
|
12 | DEFINES += SW_VERSION_N2=0 | |
13 | DEFINES += SW_VERSION_N3=0 |
|
13 | DEFINES += SW_VERSION_N3=0 | |
14 |
DEFINES += SW_VERSION_N4= |
|
14 | DEFINES += SW_VERSION_N4=11 | |
15 |
|
15 | |||
16 | contains( CONFIG, verbose ) { |
|
16 | contains( CONFIG, verbose ) { | |
17 | DEFINES += PRINT_MESSAGES_ON_CONSOLE |
|
17 | DEFINES += PRINT_MESSAGES_ON_CONSOLE | |
@@ -47,5 +47,6 HEADERS += \ | |||||
47 | ../header/fsw_params.h \ |
|
47 | ../header/fsw_params.h \ | |
48 | ../header/fsw_misc.h \ |
|
48 | ../header/fsw_misc.h \ | |
49 | ../header/fsw_init.h \ |
|
49 | ../header/fsw_init.h \ | |
50 | ../header/ccsds_types.h |
|
50 | ../header/ccsds_types.h \ | |
|
51 | ../header/fsw_params_processing.h | |||
51 |
|
52 |
@@ -1,6 +1,6 | |||||
1 | <?xml version="1.0" encoding="UTF-8"?> |
|
1 | <?xml version="1.0" encoding="UTF-8"?> | |
2 | <!DOCTYPE QtCreatorProject> |
|
2 | <!DOCTYPE QtCreatorProject> | |
3 |
<!-- Written by QtCreator 2.7.0, 2013-07- |
|
3 | <!-- Written by QtCreator 2.7.0, 2013-07-25T07:26:34. --> | |
4 | <qtcreator> |
|
4 | <qtcreator> | |
5 | <data> |
|
5 | <data> | |
6 | <variable>ProjectExplorer.Project.ActiveTarget</variable> |
|
6 | <variable>ProjectExplorer.Project.ActiveTarget</variable> |
@@ -1,7 +1,7 | |||||
1 |
|
||||
2 |
|
|
1 | #ifndef CCSDS_H_INCLUDED | |
3 | #define CCSDS_H_INCLUDED |
|
2 | #define CCSDS_H_INCLUDED | |
4 |
|
3 | |||
|
4 | #define CCSDS_PROTOCOLE_EXTRA_BYTES 4 | |||
5 | #define CCSDS_TELEMETRY_HEADER_LENGTH 16+4 |
|
5 | #define CCSDS_TELEMETRY_HEADER_LENGTH 16+4 | |
6 | #define CCSDS_TM_PKT_MAX_SIZE 4412 |
|
6 | #define CCSDS_TM_PKT_MAX_SIZE 4412 | |
7 | #define CCSDS_TELECOMMAND_HEADER_LENGTH 10+4 |
|
7 | #define CCSDS_TELECOMMAND_HEADER_LENGTH 10+4 | |
@@ -25,12 +25,6 | |||||
25 | #define TM_PACKET_SEQ_CTRL_LAST 2 |
|
25 | #define TM_PACKET_SEQ_CTRL_LAST 2 | |
26 | #define TM_PACKET_SEQ_CTRL_STANDALONE 3 |
|
26 | #define TM_PACKET_SEQ_CTRL_STANDALONE 3 | |
27 |
|
27 | |||
28 | // FAILURE CODES |
|
|||
29 | #define FAILURE_CODE_INCONSISTENT 5 // 0x00 0x05 |
|
|||
30 | #define FAILURE_CODE_NOT_EXECUTABLE 42000 // 0xa4 0x10 |
|
|||
31 | #define FAILURE_CODE_NOT_IMPLEMENTED 42002 // 0xa4 0x12 |
|
|||
32 | #define FAILURE_CODE_ERROR 42003 // 0xa4 0x13 |
|
|||
33 | #define FAILURE_CODE_CORRUPTED 42005 // 0xa4 0x15 |
|
|||
34 | // |
|
28 | // | |
35 | #define TM_DESTINATION_ID_GROUND 0 |
|
29 | #define TM_DESTINATION_ID_GROUND 0 | |
36 | #define TM_DESTINATION_ID_MISSION_TIMELINE 110 |
|
30 | #define TM_DESTINATION_ID_MISSION_TIMELINE 110 | |
@@ -108,6 +102,12 | |||||
108 | #define TM_SUBTYPE_SCIENCE 3 |
|
102 | #define TM_SUBTYPE_SCIENCE 3 | |
109 | #define TM_SUBTYPE_LFR_SCIENCE 3 |
|
103 | #define TM_SUBTYPE_LFR_SCIENCE 3 | |
110 |
|
104 | |||
|
105 | // FAILURE CODES | |||
|
106 | #define FAILURE_CODE_INCONSISTENT 5 // 0x00 0x05 | |||
|
107 | #define FAILURE_CODE_NOT_EXECUTABLE 42000 // 0xa4 0x10 | |||
|
108 | #define FAILURE_CODE_NOT_IMPLEMENTED 42002 // 0xa4 0x12 | |||
|
109 | #define FAILURE_CODE_ERROR 42003 // 0xa4 0x13 | |||
|
110 | #define FAILURE_CODE_CORRUPTED 42005 // 0xa4 0x15 | |||
111 | // TM SID |
|
111 | // TM SID | |
112 | #define SID_DEFAULT 0 |
|
112 | #define SID_DEFAULT 0 | |
113 | #define SID_EXE_INC 5 |
|
113 | #define SID_EXE_INC 5 | |
@@ -149,6 +149,9 | |||||
149 | #define LENGTH_TM_LFR_TC_EXE_MAX 32 |
|
149 | #define LENGTH_TM_LFR_TC_EXE_MAX 32 | |
150 | #define LENGTH_TM_LFR_HK 126 |
|
150 | #define LENGTH_TM_LFR_HK 126 | |
151 |
|
151 | |||
|
152 | // HEADER_LENGTH | |||
|
153 | #define TM_HEADER_LEN 16 | |||
|
154 | #define HEADER_LENGTH_TM_LFR_SCIENCE_ASM 28 | |||
152 | // PACKET_LENGTH |
|
155 | // PACKET_LENGTH | |
153 | #define PACKET_LENGTH_TC_EXE_SUCCESS (20 - CCSDS_TC_TM_PACKET_OFFSET) |
|
156 | #define PACKET_LENGTH_TC_EXE_SUCCESS (20 - CCSDS_TC_TM_PACKET_OFFSET) | |
154 | #define PACKET_LENGTH_TC_EXE_INCONSISTENT (26 - CCSDS_TC_TM_PACKET_OFFSET) |
|
157 | #define PACKET_LENGTH_TC_EXE_INCONSISTENT (26 - CCSDS_TC_TM_PACKET_OFFSET) | |
@@ -158,7 +161,7 | |||||
158 | #define PACKET_LENGTH_TC_EXE_CORRUPTED (32 - CCSDS_TC_TM_PACKET_OFFSET) |
|
161 | #define PACKET_LENGTH_TC_EXE_CORRUPTED (32 - CCSDS_TC_TM_PACKET_OFFSET) | |
159 | #define PACKET_LENGTH_HK (126 - CCSDS_TC_TM_PACKET_OFFSET) |
|
162 | #define PACKET_LENGTH_HK (126 - CCSDS_TC_TM_PACKET_OFFSET) | |
160 | #define PACKET_LENGTH_PARAMETER_DUMP (34 - CCSDS_TC_TM_PACKET_OFFSET) |
|
163 | #define PACKET_LENGTH_PARAMETER_DUMP (34 - CCSDS_TC_TM_PACKET_OFFSET) | |
161 | #define TM_HEADER_LEN 16 |
|
164 | #define PACKET_LENGTH_TM_LFR_SCIENCE_ASM (TOTAL_SIZE_SM + HEADER_LENGTH_TM_LFR_SCIENCE_ASM - CCSDS_TC_TM_PACKET_OFFSET) | |
162 |
|
165 | |||
163 | #define SPARE1_PUSVERSION_SPARE2 0x10 |
|
166 | #define SPARE1_PUSVERSION_SPARE2 0x10 | |
164 |
|
167 | |||
@@ -264,6 +267,31 struct Header_TM_LFR_SCIENCE_CWF_str | |||||
264 | }; |
|
267 | }; | |
265 | typedef struct Header_TM_LFR_SCIENCE_CWF_str Header_TM_LFR_SCIENCE_CWF_t; |
|
268 | typedef struct Header_TM_LFR_SCIENCE_CWF_str Header_TM_LFR_SCIENCE_CWF_t; | |
266 |
|
269 | |||
|
270 | struct Header_TM_LFR_SCIENCE_ASM_str | |||
|
271 | { | |||
|
272 | volatile unsigned char targetLogicalAddress; | |||
|
273 | volatile unsigned char protocolIdentifier; | |||
|
274 | volatile unsigned char reserved; | |||
|
275 | volatile unsigned char userApplication; | |||
|
276 | volatile unsigned char packetID[2]; | |||
|
277 | volatile unsigned char packetSequenceControl[2]; | |||
|
278 | volatile unsigned char packetLength[2]; | |||
|
279 | // DATA FIELD HEADER | |||
|
280 | volatile unsigned char spare1_pusVersion_spare2; | |||
|
281 | volatile unsigned char serviceType; | |||
|
282 | volatile unsigned char serviceSubType; | |||
|
283 | volatile unsigned char destinationID; | |||
|
284 | volatile unsigned char time[6]; | |||
|
285 | // AUXILIARY HEADER | |||
|
286 | volatile unsigned char sid; | |||
|
287 | volatile unsigned char biaStatusInfo; | |||
|
288 | volatile unsigned char cntASM; | |||
|
289 | volatile unsigned char nrASM; | |||
|
290 | volatile unsigned char acquisitionTime[6]; | |||
|
291 | volatile unsigned char blkNr[2]; | |||
|
292 | }; | |||
|
293 | typedef struct Header_TM_LFR_SCIENCE_ASM_str Header_TM_LFR_SCIENCE_ASM_t; | |||
|
294 | ||||
267 | struct ccsdsTelecommandPacket_str |
|
295 | struct ccsdsTelecommandPacket_str | |
268 | { |
|
296 | { | |
269 | //unsigned char targetLogicalAddress; // removed by the grspw module |
|
297 | //unsigned char targetLogicalAddress; // removed by the grspw module |
@@ -17,6 +17,9 extern spw_stats spacewire_stats_backup; | |||||
17 |
|
17 | |||
18 | int configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider, |
|
18 | int configure_timer(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider, | |
19 | unsigned char interrupt_level, rtems_isr (*timer_isr)() ); |
|
19 | unsigned char interrupt_level, rtems_isr (*timer_isr)() ); | |
|
20 | int timer_start( gptimer_regs_t *gptimer_regs, unsigned char timer ); | |||
|
21 | int timer_stop( gptimer_regs_t *gptimer_regs, unsigned char timer ); | |||
|
22 | int timer_set_clock_divider(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider); | |||
20 | void update_spacewire_statistics(); |
|
23 | void update_spacewire_statistics(); | |
21 |
|
24 | |||
22 | // SERIAL LINK |
|
25 | // SERIAL LINK |
@@ -1,6 +1,8 | |||||
1 | #ifndef FSW_RTEMS_CONFIG_H_INCLUDED |
|
1 | #ifndef FSW_RTEMS_CONFIG_H_INCLUDED | |
2 | #define FSW_RTEMS_CONFIG_H_INCLUDED |
|
2 | #define FSW_RTEMS_CONFIG_H_INCLUDED | |
3 |
|
3 | |||
|
4 | #include <fsw_params_processing.h> | |||
|
5 | ||||
4 | #define GRSPW_DEVICE_NAME "/dev/grspw0" |
|
6 | #define GRSPW_DEVICE_NAME "/dev/grspw0" | |
5 | #define UART_DEVICE_NAME "/dev/console" |
|
7 | #define UART_DEVICE_NAME "/dev/console" | |
6 |
|
8 | |||
@@ -30,7 +32,7 | |||||
30 | // NORM |
|
32 | // NORM | |
31 | #define DEFAULT_SY_LFR_N_SWF_L 2048 // nb sample |
|
33 | #define DEFAULT_SY_LFR_N_SWF_L 2048 // nb sample | |
32 | #define DEFAULT_SY_LFR_N_SWF_P 16 // sec |
|
34 | #define DEFAULT_SY_LFR_N_SWF_P 16 // sec | |
33 |
#define DEFAULT_SY_LFR_N_ASM_P |
|
35 | #define DEFAULT_SY_LFR_N_ASM_P 16 // sec | |
34 | #define DEFAULT_SY_LFR_N_BP_P0 4 // sec |
|
36 | #define DEFAULT_SY_LFR_N_BP_P0 4 // sec | |
35 | #define DEFAULT_SY_LFR_N_BP_P1 20 // sec |
|
37 | #define DEFAULT_SY_LFR_N_BP_P1 20 // sec | |
36 | // BURST |
|
38 | // BURST | |
@@ -49,8 +51,12 | |||||
49 | #define REGS_ADDR_GPTIMER 0x80000300 |
|
51 | #define REGS_ADDR_GPTIMER 0x80000300 | |
50 | #define REGS_ADDR_GRSPW 0x80000500 |
|
52 | #define REGS_ADDR_GRSPW 0x80000500 | |
51 | #define REGS_ADDR_TIME_MANAGEMENT 0x80000600 |
|
53 | #define REGS_ADDR_TIME_MANAGEMENT 0x80000600 | |
52 |
#define REGS_ADDR_SPECTRAL_MATRI |
|
54 | #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00 | |
53 | #define REGS_ADDR_WAVEFORM_PICKER 0x80000f20 |
|
55 | ||
|
56 | #ifdef GSA | |||
|
57 | #else | |||
|
58 | #define REGS_ADDR_WAVEFORM_PICKER 0x80000f20 | |||
|
59 | #endif | |||
54 |
|
60 | |||
55 | #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff |
|
61 | #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff | |
56 | #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400 (0x50) |
|
62 | #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400 (0x50) | |
@@ -67,11 +73,13 | |||||
67 | #define IRQ_SPARC_TIME2 0x1d // see sparcv8.pdf p.76 for interrupt levels |
|
73 | #define IRQ_SPARC_TIME2 0x1d // see sparcv8.pdf p.76 for interrupt levels | |
68 | #define IRQ_WAVEFORM_PICKER 14 |
|
74 | #define IRQ_WAVEFORM_PICKER 14 | |
69 | #define IRQ_SPARC_WAVEFORM_PICKER 0x1e // see sparcv8.pdf p.76 for interrupt levels |
|
75 | #define IRQ_SPARC_WAVEFORM_PICKER 0x1e // see sparcv8.pdf p.76 for interrupt levels | |
|
76 | #define IRQ_SPECTRAL_MATRIX 6 | |||
|
77 | #define IRQ_SPARC_SPECTRAL_MATRIX 0x16 // see sparcv8.pdf p.76 for interrupt levels | |||
70 |
|
78 | |||
71 | //***** |
|
79 | //***** | |
72 | // TIME |
|
80 | // TIME | |
73 |
#define CLKDIV_SM_SIMULATOR |
|
81 | #define CLKDIV_SM_SIMULATOR (10000 - 1) // 10 ms | |
74 | #define CLKDIV_WF_SIMULATOR 9999999 |
|
82 | #define CLKDIV_WF_SIMULATOR (10000000 - 1) // 10 000 000 * 1 us = 10 s | |
75 | #define TIMER_SM_SIMULATOR 1 |
|
83 | #define TIMER_SM_SIMULATOR 1 | |
76 | #define TIMER_WF_SIMULATOR 2 |
|
84 | #define TIMER_WF_SIMULATOR 2 | |
77 | #define HK_PERIOD 100 // 100 * 10ms => 1sec |
|
85 | #define HK_PERIOD 100 // 100 * 10ms => 1sec | |
@@ -93,6 +101,7 | |||||
93 | #define TASKID_WFRM 8 |
|
101 | #define TASKID_WFRM 8 | |
94 | #define TASKID_DUMB 9 |
|
102 | #define TASKID_DUMB 9 | |
95 | #define TASKID_HOUS 10 |
|
103 | #define TASKID_HOUS 10 | |
|
104 | #define TASKID_MATR 11 | |||
96 |
|
105 | |||
97 | #define ACTION_MSG_QUEUE_COUNT 10 |
|
106 | #define ACTION_MSG_QUEUE_COUNT 10 | |
98 |
|
107 |
@@ -1,33 +1,17 | |||||
1 | #ifndef FSW_RTEMS_PROCESSING_H_INCLUDED |
|
1 | #ifndef FSW_RTEMS_PROCESSING_H_INCLUDED | |
2 | #define FSW_RTEMS_PROCESSING_H_INCLUDED |
|
2 | #define FSW_RTEMS_PROCESSING_H_INCLUDED | |
3 |
|
||||
4 | #define NB_BINS_spec_mat 128 |
|
|||
5 | #define NB_VALUES_PER_spec_mat 25 |
|
|||
6 | #define TOTAL_SIZE_SPEC_MAT NB_BINS_spec_mat * NB_VALUES_PER_spec_mat |
|
|||
7 | #define NB_BINS_COMPRESSED_MATRIX_f0 11 |
|
|||
8 | #define SIZE_COMPRESSED_spec_mat_f1 13 |
|
|||
9 | #define SIZE_COMPRESSED_spec_mat_f2 12 |
|
|||
10 | #define TOTAL_SIZE_COMPRESSED_MATRIX_f0 NB_BINS_COMPRESSED_MATRIX_f0 * NB_VALUES_PER_spec_mat |
|
|||
11 | #define NB_AVERAGE_NORMAL_f0 96*4 |
|
|||
12 | #define NB_SM_TO_RECEIVE_BEFORE_AVF0 8 |
|
|||
13 |
|
3 | |||
14 | #include <rtems.h> |
|
4 | #include <rtems.h> | |
15 |
#include <gr |
|
5 | #include <grspw.h> | |
|
6 | #include <leon.h> | |||
|
7 | ||||
|
8 | #include <fsw_init.h> | |||
16 | #include <fsw_params.h> |
|
9 | #include <fsw_params.h> | |
17 |
#include <s |
|
10 | #include <grlib_regs.h> | |
|
11 | #include <ccsds_types.h> | |||
|
12 | ||||
|
13 | #include <stdio.h> | |||
18 | #include <stdlib.h> |
|
14 | #include <stdlib.h> | |
19 | #include <leon.h> |
|
|||
20 |
|
||||
21 | struct BP1_str{ |
|
|||
22 | volatile unsigned char PE[2]; |
|
|||
23 | volatile unsigned char PB[2]; |
|
|||
24 | volatile unsigned char V0; |
|
|||
25 | volatile unsigned char V1; |
|
|||
26 | volatile unsigned char V2_ELLIP_DOP; |
|
|||
27 | volatile unsigned char SZ; |
|
|||
28 | volatile unsigned char VPHI; |
|
|||
29 | }; |
|
|||
30 | typedef struct BP1_str BP1_t; |
|
|||
31 |
|
15 | |||
32 | extern volatile int spec_mat_f0_a[ ]; |
|
16 | extern volatile int spec_mat_f0_a[ ]; | |
33 | extern volatile int spec_mat_f0_b[ ]; |
|
17 | extern volatile int spec_mat_f0_b[ ]; | |
@@ -37,30 +21,35 extern volatile int spec_mat_f0_e[ ]; | |||||
37 | extern volatile int spec_mat_f0_f[ ]; |
|
21 | extern volatile int spec_mat_f0_f[ ]; | |
38 | extern volatile int spec_mat_f0_g[ ]; |
|
22 | extern volatile int spec_mat_f0_g[ ]; | |
39 | extern volatile int spec_mat_f0_h[ ]; |
|
23 | extern volatile int spec_mat_f0_h[ ]; | |
40 | extern float averaged_spec_mat_f0[ ]; |
|
|||
41 | extern float compressed_spec_mat_f0[ ]; |
|
|||
42 | extern unsigned char LFR_BP1_F0[ ]; |
|
|||
43 |
|
||||
44 | extern BP1_t data_BP1[ ]; |
|
|||
45 |
|
24 | |||
46 | extern rtems_id Task_id[ ]; /* array of task ids */ |
|
25 | extern rtems_id Task_id[ ]; /* array of task ids */ | |
47 |
|
26 | |||
48 | extern spectral_matrices_regs_t *spectral_matrices_regs; |
|
27 | extern time_management_regs_t *time_management_regs; | |
49 |
|
28 | extern spectral_matrix_regs_t *spectral_matrix_regs; | ||
|
29 | ||||
50 | // ISR |
|
30 | // ISR | |
51 | rtems_isr spectral_matrices_isr( rtems_vector_number vector ); |
|
31 | rtems_isr spectral_matrices_isr( rtems_vector_number vector ); | |
52 |
|
32 | |||
53 | // RTEMS TASKS |
|
33 | // RTEMS TASKS | |
54 | rtems_task spw_bppr_task(rtems_task_argument argument); |
|
34 | rtems_task spw_bppr_task(rtems_task_argument argument); | |
55 | rtems_task avf0_task(rtems_task_argument argument); |
|
35 | rtems_task avf0_task(rtems_task_argument argument); | |
56 | rtems_task bpf0_task(rtems_task_argument argument); |
|
36 | rtems_task bpf0_task(rtems_task_argument argument); | |
57 | rtems_task smiq_task(rtems_task_argument argument); // added to test the spectral matrix simulator |
|
37 | rtems_task smiq_task(rtems_task_argument argument); // added to test the spectral matrix simulator | |
|
38 | rtems_task matr_task(rtems_task_argument argument); | |||
58 |
|
39 | |||
59 | rtems_task spw_bppr_task_rate_monotonic(rtems_task_argument argument); |
|
40 | rtems_task spw_bppr_task_rate_monotonic(rtems_task_argument argument); | |
60 | void matrix_average(volatile int *spec_mat, float *averaged_spec_mat); |
|
41 | ||
61 | void matrix_compression(float *averaged_spec_mat, unsigned char fChannel, float *compressed_spec_mat); |
|
42 | void matrix_average(volatile int *spec_mat, volatile float *averaged_spec_mat); | |
62 | void matrix_reset(float *averaged_spec_mat); |
|
43 | void matrix_compression(volatile float *averaged_spec_mat, unsigned char fChannel, float *compressed_spec_mat); | |
|
44 | void matrix_reset(volatile float *averaged_spec_mat); | |||
63 | void BP1_set(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat, unsigned char * LFR_BP1); |
|
45 | void BP1_set(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat, unsigned char * LFR_BP1); | |
64 | void BP2_set(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat); |
|
46 | void BP2_set(float * compressed_spec_mat, unsigned char nb_bins_compressed_spec_mat); | |
|
47 | // | |||
|
48 | void init_header_asm( Header_TM_LFR_SCIENCE_ASM_t *header); | |||
|
49 | void send_spectral_matrix(Header_TM_LFR_SCIENCE_ASM_t *header, char *spectral_matrix, | |||
|
50 | unsigned int sid, spw_ioctl_pkt_send *spw_ioctl_send); | |||
|
51 | void convert_averaged_spectral_matrix(volatile float *input_matrix, char *output_matrix); | |||
|
52 | void init_averaged_spectral_matrix(); | |||
|
53 | void reset_spectral_matrix_regs(); | |||
65 |
|
54 | |||
66 | #endif // FSW_RTEMS_PROCESSING_H_INCLUDED |
|
55 | #endif // FSW_RTEMS_PROCESSING_H_INCLUDED |
@@ -37,13 +37,6 struct gptimer_regs_str | |||||
37 | }; |
|
37 | }; | |
38 | typedef struct gptimer_regs_str gptimer_regs_t; |
|
38 | typedef struct gptimer_regs_str gptimer_regs_t; | |
39 |
|
39 | |||
40 | struct spectral_matrices_regs_str{ |
|
|||
41 | volatile int ctrl; |
|
|||
42 | volatile int address0; |
|
|||
43 | volatile int address1; |
|
|||
44 | }; |
|
|||
45 | typedef struct spectral_matrices_regs_str spectral_matrices_regs_t; |
|
|||
46 |
|
||||
47 | struct time_management_regs_str{ |
|
40 | struct time_management_regs_str{ | |
48 | volatile int ctrl; // bit 0 forces the load of the coarse_time_load value and resets the fine_time |
|
41 | volatile int ctrl; // bit 0 forces the load of the coarse_time_load value and resets the fine_time | |
49 | volatile int coarse_time_load; |
|
42 | volatile int coarse_time_load; | |
@@ -68,4 +61,14 struct waveform_picker_regs_str{ | |||||
68 | }; |
|
61 | }; | |
69 | typedef struct waveform_picker_regs_str waveform_picker_regs_t; |
|
62 | typedef struct waveform_picker_regs_str waveform_picker_regs_t; | |
70 |
|
63 | |||
|
64 | struct spectral_matrix_regs_str{ | |||
|
65 | volatile int config; | |||
|
66 | volatile int status; | |||
|
67 | volatile int matrixF0_Address0; | |||
|
68 | volatile int matrixFO_Address1; | |||
|
69 | volatile int matrixF1_Address; | |||
|
70 | volatile int matrixF2_Address; | |||
|
71 | }; | |||
|
72 | typedef struct spectral_matrix_regs_str spectral_matrix_regs_t; | |||
|
73 | ||||
71 | #endif // GRLIBREGS_H_INCLUDED |
|
74 | #endif // GRLIBREGS_H_INCLUDED |
@@ -48,7 +48,7 void send_waveform_CWF( Header_TM_LFR_SC | |||||
48 | void set_wfp_data_shaping(unsigned char data_shaping); |
|
48 | void set_wfp_data_shaping(unsigned char data_shaping); | |
49 | void set_wfp_delta_snapshot(unsigned int delta_snapshot); |
|
49 | void set_wfp_delta_snapshot(unsigned int delta_snapshot); | |
50 | void reset_wfp_burst_enable(); |
|
50 | void reset_wfp_burst_enable(); | |
51 | void reset_wfp_regs(); |
|
51 | void reset_waveform_picker_regs(); | |
52 | // |
|
52 | // | |
53 | int build_value(int value1, int value0); |
|
53 | int build_value(int value1, int value0); | |
54 |
|
54 |
@@ -1,7 +1,9 | |||||
1 | #include <fsw_processing.h> |
|
1 | //#include <fsw_processing.h> | |
2 | #include <rtems.h> |
|
2 | #include <rtems.h> | |
3 | #include <grspw.h> |
|
3 | #include <grspw.h> | |
4 | #include <ccsds_types.h> |
|
4 | #include <ccsds_types.h> | |
|
5 | #include <grlib_regs.h> | |||
|
6 | #include <fsw_params.h> | |||
5 |
|
7 | |||
6 | // RTEMS GLOBAL VARIABLES |
|
8 | // RTEMS GLOBAL VARIABLES | |
7 | rtems_name misc_name[5]; |
|
9 | rtems_name misc_name[5]; | |
@@ -11,12 +13,14 rtems_name Task_name[15]; /* array | |||||
11 | int fdSPW = 0; |
|
13 | int fdSPW = 0; | |
12 | int fdUART = 0; |
|
14 | int fdUART = 0; | |
13 |
|
15 | |||
14 | spectral_matrices_regs_t *spectral_matrices_regs = NULL; |
|
|||
15 |
|
||||
16 | // APB CONFIGURATION REGISTERS |
|
16 | // APB CONFIGURATION REGISTERS | |
17 | time_management_regs_t *time_management_regs = (time_management_regs_t*) REGS_ADDR_TIME_MANAGEMENT; |
|
17 | time_management_regs_t *time_management_regs = (time_management_regs_t*) REGS_ADDR_TIME_MANAGEMENT; | |
18 | waveform_picker_regs_t *waveform_picker_regs = (waveform_picker_regs_t*) REGS_ADDR_WAVEFORM_PICKER; |
|
|||
19 | gptimer_regs_t *gptimer_regs = (gptimer_regs_t *) REGS_ADDR_GPTIMER; |
|
18 | gptimer_regs_t *gptimer_regs = (gptimer_regs_t *) REGS_ADDR_GPTIMER; | |
|
19 | #ifdef GSA | |||
|
20 | #else | |||
|
21 | waveform_picker_regs_t *waveform_picker_regs = (waveform_picker_regs_t*) REGS_ADDR_WAVEFORM_PICKER; | |||
|
22 | #endif | |||
|
23 | spectral_matrix_regs_t *spectral_matrix_regs = (spectral_matrix_regs_t*) REGS_ADDR_SPECTRAL_MATRIX; | |||
20 |
|
24 | |||
21 | // WAVEFORMS GLOBAL VARIABLES // 2048 * 3 * 4 + 2 * 4 = 24576 + 8 bytes |
|
25 | // WAVEFORMS GLOBAL VARIABLES // 2048 * 3 * 4 + 2 * 4 = 24576 + 8 bytes | |
22 | volatile int wf_snap_f0[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET]; |
|
26 | volatile int wf_snap_f0[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET]; | |
@@ -27,17 +31,21 volatile int wf_snap_f2_bis[ NB_SAMPLES_ | |||||
27 | volatile int wf_cont_f3[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET]; |
|
31 | volatile int wf_cont_f3[ NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK + TIME_OFFSET]; | |
28 |
|
32 | |||
29 | // SPECTRAL MATRICES GLOBAL VARIABLES |
|
33 | // SPECTRAL MATRICES GLOBAL VARIABLES | |
30 |
volatile int spec_mat_f0_a[ TOTAL_SIZE_S |
|
34 | volatile int spec_mat_f0_a[ TOTAL_SIZE_SM ]; | |
31 |
volatile int spec_mat_f0_b[ TOTAL_SIZE_S |
|
35 | volatile int spec_mat_f0_b[ TOTAL_SIZE_SM ]; | |
32 |
volatile int spec_mat_f0_c[ TOTAL_SIZE_S |
|
36 | volatile int spec_mat_f0_c[ TOTAL_SIZE_SM ]; | |
33 |
volatile int spec_mat_f0_d[ TOTAL_SIZE_S |
|
37 | volatile int spec_mat_f0_d[ TOTAL_SIZE_SM ]; | |
34 |
volatile int spec_mat_f0_e[ TOTAL_SIZE_S |
|
38 | volatile int spec_mat_f0_e[ TOTAL_SIZE_SM ]; | |
35 |
volatile int spec_mat_f0_f[ TOTAL_SIZE_S |
|
39 | volatile int spec_mat_f0_f[ TOTAL_SIZE_SM ]; | |
36 |
volatile int spec_mat_f0_g[ TOTAL_SIZE_S |
|
40 | volatile int spec_mat_f0_g[ TOTAL_SIZE_SM ]; | |
37 |
volatile int spec_mat_f0_h[ TOTAL_SIZE_S |
|
41 | volatile int spec_mat_f0_h[ TOTAL_SIZE_SM ]; | |
38 | // |
|
42 | // | |
39 |
|
|
43 | volatile int spec_mat_f1_a[ TOTAL_SIZE_SM ]; | |
40 | float compressed_spec_mat_f0[ TOTAL_SIZE_COMPRESSED_MATRIX_f0 ]; |
|
44 | volatile int spec_mat_f2_a[ TOTAL_SIZE_SM ]; | |
|
45 | // | |||
|
46 | volatile int spec_mat_f0_a_bis[ TOTAL_SIZE_SM ]; | |||
|
47 | volatile int spec_mat_f1_a_bis[ TOTAL_SIZE_SM ]; | |||
|
48 | volatile int spec_mat_f2_a_bis[ TOTAL_SIZE_SM ]; | |||
41 |
|
49 | |||
42 | // MODE PARAMETERS |
|
50 | // MODE PARAMETERS | |
43 | Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet; |
|
51 | Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet; | |
@@ -50,7 +58,4 unsigned short sequenceCounters[SEQ_CNT_ | |||||
50 | spw_stats spacewire_stats; |
|
58 | spw_stats spacewire_stats; | |
51 | spw_stats spacewire_stats_backup; |
|
59 | spw_stats spacewire_stats_backup; | |
52 |
|
60 | |||
53 | // BASIC PARAMETERS GLOBAL VARIABLES |
|
|||
54 | unsigned char LFR_BP1_F0[ NB_BINS_COMPRESSED_MATRIX_f0 * 9 ]; |
|
|||
55 | BP1_t data_BP1[ NB_BINS_COMPRESSED_MATRIX_f0 ]; |
|
|||
56 |
|
61 |
@@ -55,7 +55,7 char *lstates[6] = {"Error-reset", | |||||
55 | rtems_task Init( rtems_task_argument ignored ) |
|
55 | rtems_task Init( rtems_task_argument ignored ) | |
56 | { |
|
56 | { | |
57 | rtems_status_code status; |
|
57 | rtems_status_code status; | |
58 | rtems_isr_entry old_isr_handler; |
|
58 | rtems_isr_entry old_isr_handler; | |
59 |
|
59 | |||
60 | PRINTF("\n\n\n\n\n") |
|
60 | PRINTF("\n\n\n\n\n") | |
61 | PRINTF("***************************\n") |
|
61 | PRINTF("***************************\n") | |
@@ -91,48 +91,26 rtems_task Init( rtems_task_argument ign | |||||
91 |
|
91 | |||
92 | #ifdef GSA |
|
92 | #ifdef GSA | |
93 | // simulator |
|
93 | // simulator | |
94 | PRINTF("GSA is defined *** fsw-gsa is running \n") |
|
|||
95 | configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR, CLKDIV_WF_SIMULATOR, |
|
94 | configure_timer((gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_WF_SIMULATOR, CLKDIV_WF_SIMULATOR, | |
96 | IRQ_SPARC_WF, waveforms_simulator_isr ); |
|
95 | IRQ_SPARC_WF, waveforms_simulator_isr ); | |
|
96 | LEON_Mask_interrupt( IRQ_WF ); | |||
97 | #else |
|
97 | #else | |
98 |
// configure the |
|
98 | // configure the waveform picker | |
99 | reset_wfp_regs(); |
|
99 | reset_waveform_picker_regs(); | |
100 | // configure the waveform picker interrupt service routine |
|
|||
101 | status = rtems_interrupt_catch( waveforms_isr, |
|
100 | status = rtems_interrupt_catch( waveforms_isr, | |
102 | IRQ_SPARC_WAVEFORM_PICKER, |
|
101 | IRQ_SPARC_WAVEFORM_PICKER, | |
103 | &old_isr_handler) ; |
|
102 | &old_isr_handler) ; | |
104 | LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); |
|
103 | LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); | |
|
104 | // configure the spectral matrix | |||
|
105 | reset_spectral_matrix_regs(); | |||
|
106 | status = rtems_interrupt_catch( waveforms_isr, | |||
|
107 | IRQ_SPARC_SPECTRAL_MATRIX, | |||
|
108 | &old_isr_handler) ; | |||
|
109 | LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); | |||
105 | #endif |
|
110 | #endif | |
106 |
|
111 | |||
107 | //********** |
|
112 | //********** | |
108 |
|
113 | |||
109 | //***************************************** |
|
|||
110 | // irq handling of the time management unit |
|
|||
111 | status = rtems_interrupt_catch( commutation_isr1, |
|
|||
112 | IRQ_SPARC_TIME1, |
|
|||
113 | &old_isr_handler) ; // see sparcv8.pdf p.76 for interrupt levels |
|
|||
114 | if (status==RTEMS_SUCCESSFUL) { |
|
|||
115 | PRINTF("OK *** commutation_isr1 *** rtems_interrupt_catch successfullly configured\n") |
|
|||
116 | } |
|
|||
117 |
|
||||
118 | status = rtems_interrupt_catch( commutation_isr2, |
|
|||
119 | IRQ_SPARC_TIME2, |
|
|||
120 | &old_isr_handler) ; // see sparcv8.pdf p.76 for interrupt levels |
|
|||
121 | if (status==RTEMS_SUCCESSFUL) { |
|
|||
122 | PRINTF("OK *** commutation_isr2 *** rtems_interrupt_catch successfullly configured\n") |
|
|||
123 | } |
|
|||
124 |
|
||||
125 | LEON_Unmask_interrupt( IRQ_TIME1 ); |
|
|||
126 | LEON_Unmask_interrupt( IRQ_TIME2 ); |
|
|||
127 |
|
||||
128 | #ifdef GSA |
|
|||
129 | if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL) { |
|
|||
130 | PRINTF("in INIT *** Error sending event to WFRM\n") |
|
|||
131 | } |
|
|||
132 | #endif |
|
|||
133 |
|
||||
134 | LEON_Force_interrupt(IRQ_WF); |
|
|||
135 |
|
||||
136 | status = rtems_task_delete(RTEMS_SELF); |
|
114 | status = rtems_task_delete(RTEMS_SELF); | |
137 |
|
115 | |||
138 | } |
|
116 | } | |
@@ -261,6 +239,7 int create_names( void ) | |||||
261 | Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' ); |
|
239 | Task_name[TASKID_WFRM] = rtems_build_name( 'W', 'F', 'R', 'M' ); | |
262 | Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' ); |
|
240 | Task_name[TASKID_DUMB] = rtems_build_name( 'D', 'U', 'M', 'B' ); | |
263 | Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' ); |
|
241 | Task_name[TASKID_HOUS] = rtems_build_name( 'H', 'O', 'U', 'S' ); | |
|
242 | Task_name[TASKID_MATR] = rtems_build_name( 'M', 'A', 'T', 'R' ); | |||
264 |
|
243 | |||
265 | // rate monotonic period name |
|
244 | // rate monotonic period name | |
266 | HK_name = rtems_build_name( 'H', 'O', 'U', 'S' ); |
|
245 | HK_name = rtems_build_name( 'H', 'O', 'U', 'S' ); | |
@@ -332,6 +311,12 int create_all_tasks( void ) | |||||
332 | RTEMS_DEFAULT_MODES, |
|
311 | RTEMS_DEFAULT_MODES, | |
333 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_HOUS] |
|
312 | RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_HOUS] | |
334 | ); |
|
313 | ); | |
|
314 | // MATR | |||
|
315 | status = rtems_task_create( | |||
|
316 | Task_name[TASKID_MATR], 250, RTEMS_MINIMUM_STACK_SIZE * 2, | |||
|
317 | RTEMS_DEFAULT_MODES, | |||
|
318 | RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_MATR] | |||
|
319 | ); | |||
335 |
|
320 | |||
336 | return 0; |
|
321 | return 0; | |
337 | } |
|
322 | } | |
@@ -390,6 +375,11 int start_all_tasks( void ) | |||||
390 | PRINTF("In INIT *** Error starting TASK_HOUS\n") |
|
375 | PRINTF("In INIT *** Error starting TASK_HOUS\n") | |
391 | } |
|
376 | } | |
392 |
|
377 | |||
|
378 | status = rtems_task_start( Task_id[TASKID_MATR], matr_task, 1 ); | |||
|
379 | if (status!=RTEMS_SUCCESSFUL) { | |||
|
380 | PRINTF("In INIT *** Error starting TASK_MATR\n") | |||
|
381 | } | |||
|
382 | ||||
393 | return 0; |
|
383 | return 0; | |
394 | } |
|
384 | } | |
395 |
|
385 |
@@ -14,9 +14,18 int configure_timer(gptimer_regs_t *gpti | |||||
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) | |
|
18 | { | |||
|
19 | PRINTF("In configure_timer *** rtems_interrupt_catch successfullly configured\n") | |||
|
20 | } | |||
18 |
|
21 | |||
19 | gptimer_regs->timer[timer].reload = clock_divider; // base clock frequency is 1 MHz |
|
22 | timer_set_clock_divider( gptimer_regs, timer, clock_divider); | |
|
23 | ||||
|
24 | return 1; | |||
|
25 | } | |||
|
26 | ||||
|
27 | int timer_start(gptimer_regs_t *gptimer_regs, unsigned char timer) | |||
|
28 | { | |||
20 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any |
|
29 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any | |
21 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000004; // LD load value from the reload register |
|
30 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000004; // LD load value from the reload register | |
22 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000001; // EN enable the timer |
|
31 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000001; // EN enable the timer | |
@@ -26,6 +35,22 int configure_timer(gptimer_regs_t *gpti | |||||
26 | return 1; |
|
35 | return 1; | |
27 | } |
|
36 | } | |
28 |
|
37 | |||
|
38 | int timer_stop(gptimer_regs_t *gptimer_regs, unsigned char timer) | |||
|
39 | { | |||
|
40 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xfffffffe; // EN enable the timer | |||
|
41 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl & 0xffffffef; // IE interrupt enable | |||
|
42 | gptimer_regs->timer[timer].ctrl = gptimer_regs->timer[timer].ctrl | 0x00000010; // clear pending IRQ if any | |||
|
43 | ||||
|
44 | return 1; | |||
|
45 | } | |||
|
46 | ||||
|
47 | int timer_set_clock_divider(gptimer_regs_t *gptimer_regs, unsigned char timer, unsigned int clock_divider) | |||
|
48 | { | |||
|
49 | gptimer_regs->timer[timer].reload = clock_divider; // base clock frequency is 1 MHz | |||
|
50 | ||||
|
51 | return 1; | |||
|
52 | } | |||
|
53 | ||||
29 | void update_spacewire_statistics() |
|
54 | void update_spacewire_statistics() | |
30 | { |
|
55 | { | |
31 | rtems_status_code status; |
|
56 | rtems_status_code status; | |
@@ -189,9 +214,20 rtems_task hous_task(rtems_task_argument | |||||
189 |
|
214 | |||
190 | update_spacewire_statistics(); |
|
215 | update_spacewire_statistics(); | |
191 |
|
216 | |||
|
217 | // SEND PACKET | |||
192 | result = write ( fdSPW, &housekeeping_packet, LEN_TM_LFR_HK); |
|
218 | result = write ( fdSPW, &housekeeping_packet, LEN_TM_LFR_HK); | |
193 |
if ( |
|
219 | if (status == -1) { | |
194 | PRINTF("ERR *** in HOUS *** HK send\n"); |
|
220 | while (true) { | |
|
221 | if (status != RTEMS_SUCCESSFUL) { | |||
|
222 | result = write ( fdSPW, &housekeeping_packet, LEN_TM_LFR_HK); | |||
|
223 | PRINTF("x") | |||
|
224 | sched_yield(); | |||
|
225 | } | |||
|
226 | else { | |||
|
227 | PRINTF("\n") | |||
|
228 | break; | |||
|
229 | } | |||
|
230 | } | |||
195 | } |
|
231 | } | |
196 | } |
|
232 | } | |
197 | } |
|
233 | } |
@@ -3,6 +3,12 | |||||
3 |
|
3 | |||
4 | #include <fsw_processing_globals.c> |
|
4 | #include <fsw_processing_globals.c> | |
5 |
|
5 | |||
|
6 | unsigned char LFR_BP1_F0[ NB_BINS_COMPRESSED_SM_F0 * 9 ]; | |||
|
7 | BP1_t data_BP1[ NB_BINS_COMPRESSED_SM_F0 ]; | |||
|
8 | float averaged_spec_mat_f0[ TOTAL_SIZE_SM ]; | |||
|
9 | char averaged_spec_mat_f0_char[ TOTAL_SIZE_SM * 2 ]; | |||
|
10 | float compressed_spec_mat_f0[ TOTAL_SIZE_COMPRESSED_MATRIX_f0 ]; | |||
|
11 | ||||
6 | //*********************************************************** |
|
12 | //*********************************************************** | |
7 | // Interrupt Service Routine for spectral matrices processing |
|
13 | // Interrupt Service Routine for spectral matrices processing | |
8 | rtems_isr spectral_matrices_isr( rtems_vector_number vector ) |
|
14 | rtems_isr spectral_matrices_isr( rtems_vector_number vector ) | |
@@ -17,15 +23,19 rtems_isr spectral_matrices_isr( rtems_v | |||||
17 | rtems_task smiq_task(rtems_task_argument argument) // process the Spectral Matrices IRQ |
|
23 | rtems_task smiq_task(rtems_task_argument argument) // process the Spectral Matrices IRQ | |
18 | { |
|
24 | { | |
19 | rtems_event_set event_out; |
|
25 | rtems_event_set event_out; | |
20 |
unsigned |
|
26 | unsigned int nb_interrupt_f0 = 0; | |
|
27 | unsigned int nb_interrupt_f0_MAX = 0; | |||
|
28 | ||||
|
29 | nb_interrupt_f0_MAX = ( (parameter_dump_packet.sy_lfr_n_asm_p[0]) * 256 | |||
|
30 | + parameter_dump_packet.sy_lfr_n_asm_p[1] ) * 100; | |||
21 |
|
31 | |||
22 | PRINTF("in SMIQ *** \n") |
|
32 | PRINTF("in SMIQ *** \n") | |
23 |
|
33 | |||
24 | while(1){ |
|
34 | while(1){ | |
25 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 |
|
35 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 | |
26 | nb_interrupt_f0 = nb_interrupt_f0 + 1; |
|
36 | nb_interrupt_f0 = nb_interrupt_f0 + 1; | |
27 |
if (nb_interrupt_f0 == |
|
37 | if (nb_interrupt_f0 == nb_interrupt_f0_MAX ){ | |
28 |
if (rtems_event_send( Task_id[TASKID_ |
|
38 | if (rtems_event_send( Task_id[TASKID_MATR], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) | |
29 | { |
|
39 | { | |
30 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); |
|
40 | rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 ); | |
31 | } |
|
41 | } | |
@@ -42,24 +52,20 rtems_task spw_bppr_task(rtems_task_argu | |||||
42 | //static int nb_average_f1 = 0; |
|
52 | //static int nb_average_f1 = 0; | |
43 | //static int nb_average_f2 = 0; |
|
53 | //static int nb_average_f2 = 0; | |
44 |
|
54 | |||
45 | spectral_matrices_regs = (struct spectral_matrices_regs_str *) REGS_ADDR_SPECTRAL_MATRICES; |
|
|||
46 | spectral_matrices_regs->address0 = (volatile int) spec_mat_f0_a; |
|
|||
47 | spectral_matrices_regs->address1 = (volatile int) spec_mat_f0_b; |
|
|||
48 |
|
||||
49 | printf("in BPPR ***\n"); |
|
55 | printf("in BPPR ***\n"); | |
50 |
|
56 | |||
51 | while(true){ // wait for an event to begin with the processing |
|
57 | while(true){ // wait for an event to begin with the processing | |
52 | status = rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); |
|
58 | status = rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); | |
53 | if (status == RTEMS_SUCCESSFUL) { |
|
59 | if (status == RTEMS_SUCCESSFUL) { | |
54 |
if ((spectral_matri |
|
60 | if ((spectral_matrix_regs->status & 0x00000001)==1) { | |
55 | matrix_average(spec_mat_f0_a, averaged_spec_mat_f0); |
|
61 | matrix_average(spec_mat_f0_a, averaged_spec_mat_f0); | |
56 |
spectral_matri |
|
62 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffe; | |
57 | //printf("f0_a\n"); |
|
63 | //printf("f0_a\n"); | |
58 | Nb_average_f0++; |
|
64 | Nb_average_f0++; | |
59 | } |
|
65 | } | |
60 |
if (((spectral_matri |
|
66 | if (((spectral_matrix_regs->status>>1) & 0x00000001)==1) { | |
61 | matrix_average(spec_mat_f0_b, compressed_spec_mat_f0); |
|
67 | matrix_average(spec_mat_f0_b, compressed_spec_mat_f0); | |
62 |
spectral_matri |
|
68 | spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffd; | |
63 | //printf("f0_b\n"); |
|
69 | //printf("f0_b\n"); | |
64 | Nb_average_f0++; |
|
70 | Nb_average_f0++; | |
65 | } |
|
71 | } | |
@@ -73,23 +79,20 rtems_task spw_bppr_task(rtems_task_argu | |||||
73 | } |
|
79 | } | |
74 | } |
|
80 | } | |
75 |
|
81 | |||
76 |
rtems_task avf0_task(rtems_task_argument argument) |
|
82 | rtems_task avf0_task(rtems_task_argument argument) | |
77 | int i; |
|
83 | { | |
|
84 | //int i; | |||
78 | static int nb_average; |
|
85 | static int nb_average; | |
79 | rtems_event_set event_out; |
|
86 | rtems_event_set event_out; | |
80 | rtems_status_code status; |
|
87 | rtems_status_code status; | |
81 |
|
88 | |||
82 | spectral_matrices_regs = (struct spectral_matrices_regs_str *) REGS_ADDR_SPECTRAL_MATRICES; |
|
|||
83 | spectral_matrices_regs->address0 = (volatile int) spec_mat_f0_a; |
|
|||
84 | spectral_matrices_regs->address1 = (volatile int) spec_mat_f0_b; |
|
|||
85 |
|
||||
86 | nb_average = 0; |
|
89 | nb_average = 0; | |
87 |
|
90 | |||
88 | PRINTF("in AVFO *** \n") |
|
91 | PRINTF("in AVFO *** \n") | |
89 |
|
92 | |||
90 | while(1){ |
|
93 | while(1){ | |
91 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 |
|
94 | rtems_event_receive(RTEMS_EVENT_0, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out); // wait for an RTEMS_EVENT0 | |
92 |
for(i=0; i<TOTAL_SIZE_S |
|
95 | /*for(i=0; i<TOTAL_SIZE_SM; i++){ | |
93 | averaged_spec_mat_f0[i] = averaged_spec_mat_f0[i] + spec_mat_f0_a[i] |
|
96 | averaged_spec_mat_f0[i] = averaged_spec_mat_f0[i] + spec_mat_f0_a[i] | |