##// END OF EJS Templates
fifo occupation reported in the HK packet
paul -
r197:d5570d7e57e2 R3
parent child
Show More
@@ -0,0 +1,75
1 TEMPLATE = app
2 # CONFIG += console v8 sim
3 # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report *** vhdl_dev *** debug_tch
4 # lpp_dpu_destid
5 CONFIG += console verbose lpp_dpu_destid cpu_usage_report
6 CONFIG -= qt
7
8 include(./sparc.pri)
9
10 # eqm debug software version
11 SWVERSION=-1-0
12 DEFINES += SW_VERSION_N1=0 # major
13 DEFINES += SW_VERSION_N2=0 # minor
14 DEFINES += SW_VERSION_N3=0 # patch
15 DEFINES += SW_VERSION_N4=0 # internal
16
17 # <GCOV>
18 #QMAKE_CFLAGS_RELEASE += -fprofile-arcs -ftest-coverage
19 #LIBS += -lgcov /opt/GCOV/01A/lib/overload.o -lc
20 # </GCOV>
21
22 # <CHANGE BEFORE FLIGHT>
23 contains( CONFIG, lpp_dpu_destid ) {
24 DEFINES += LPP_DPU_DESTID
25 }
26 # </CHANGE BEFORE FLIGHT>
27
28 contains( CONFIG, debug_tch ) {
29 DEFINES += DEBUG_TCH
30 }
31 DEFINES += MSB_FIRST_TCH
32
33 contains( CONFIG, vhdl_dev ) {
34 DEFINES += VHDL_DEV
35 }
36
37 contains( CONFIG, verbose ) {
38 DEFINES += PRINT_MESSAGES_ON_CONSOLE
39 }
40
41 contains( CONFIG, debug_messages ) {
42 DEFINES += DEBUG_MESSAGES
43 }
44
45 contains( CONFIG, cpu_usage_report ) {
46 DEFINES += PRINT_TASK_STATISTICS
47 }
48
49 contains( CONFIG, stack_report ) {
50 DEFINES += PRINT_STACK_REPORT
51 }
52
53 contains( CONFIG, boot_messages ) {
54 DEFINES += BOOT_MESSAGES
55 }
56
57 #doxygen.target = doxygen
58 #doxygen.commands = doxygen ../doc/Doxyfile
59 #QMAKE_EXTRA_TARGETS += doxygen
60
61 TARGET = eqm
62
63 INCLUDEPATH += ./header \
64 ../header/lfr_common_headers
65
66 SOURCES += \
67 src/main.c \
68 src/grspw.c
69
70 HEADERS += \
71 ../header/lfr_common_headers/fsw_params.h \
72 header/grspw.h
73
74
75
@@ -0,0 +1,8
1 #ifndef GRSPW_H_INCLUDED
2 #define GRSPW_H_INCLUDED
3
4 int grspw_set_ie( unsigned char value, unsigned int *ctrlReg );
5 int grspw_set_tq( unsigned char value, unsigned int *ctrlReg );
6 int grspw_set_tr( unsigned char value, unsigned int *ctrlReg );
7
8 #endif // GRSPW_H_INCLUDED
@@ -0,0 +1,97
1 CONFIG += console
2 CONFIG -= qt
3 QMAKE_CC=sparc-elf-gcc
4 message(C compiler forced to: $$QMAKE_CC)
5 QMAKE_CXX=sparc-elf-g++
6 message(C++ compiler forced to: $$QMAKE_CXX)
7 QMAKE_AR=sparc-elf-ar rcs
8 message(Archiver forced to: $$QMAKE_AR)
9 QMAKE_LINK=sparc-elf-g++
10 message(Linker forced to: $$QMAKE_LINK)
11 QMAKE_LINK_SHLIB=sparc-rtems-g++
12 QMAKE_OBJCOPY= sparc-elf-objcopy
13 QMAKE_STRIP=sparc-elf-strip
14 QMAKE_GDB=sparc-elf-gdb
15
16 INCLUDEPATH += /opt/sparc-elf-4.4.2
17
18 QMAKE_CFLAGS_DEBUG= -g
19 QMAKE_CFLAGS_RELEASE=""
20 QMAKE_CXXFLAGS_DEBUG= -g
21 QMAKE_CXXFLAGS_RELEASE=""
22 QMAKE_LFLAGS_RELEASE=""
23 QMAKE_LFLAGS_DEBUG= -g
24 QMAKE_CXXFLAGS_DEPS =
25 QMAKE_CXXFLAGS_WARN_ON = -Wall
26 QMAKE_CXXFLAGS_WARN_OFF = -w
27 QMAKE_CXXFLAGS_RELEASE =
28 QMAKE_CXXFLAGS_DEBUG =
29 QMAKE_CXXFLAGS_YACC =
30 QMAKE_CXXFLAGS_THREAD =
31 QMAKE_CXXFLAGS_RTTI_ON =
32 QMAKE_CXXFLAGS_RTTI_OFF =
33 QMAKE_CXXFLAGS_EXCEPTIONS_ON =
34 QMAKE_CXXFLAGS_EXCEPTIONS_OFF =
35 QMAKE_CFLAGS_WARN_ON = -Wall
36 QMAKE_CFLAGS_WARN_OFF = -w
37 QMAKE_CFLAGS_RELEASE =
38 QMAKE_CFLAGS_YACC =
39 QMAKE_LFLAGS_EXCEPTIONS_ON =
40 QMAKE_LFLAGS_EXCEPTIONS_OFF =
41 QMAKE_LFLAGS_RELEASE =
42 QMAKE_LFLAGS_CONSOLE =
43 QMAKE_LFLAGS_WINDOWS =
44 QMAKE_LFLAGS_DLL =
45 QMAKE_INCDIR_QT =
46 QMAKE_INCDIR =
47 QMAKE_CFLAGS_SHLIB =
48 QMAKE_CFLAGS_STATIC_LIB =
49 QMAKE_CXXFLAGS_SHLIB =
50 QMAKE_CXXFLAGS_STATIC_LIB =
51 QMAKE_LIBS=""
52 INCLUDEPATH=""
53 DEFINES=""
54
55 contains( TEMPLATE, app ) {
56 OBJECTS_DIR=obj
57 DESTDIR=bin
58 }
59
60 #QMAKE_CFLAGS_RELEASE += -O0
61 #QMAKE_CFLAGS_DEBUG += -O0
62 #QMAKE_CXXFLAGS_RELEASE += -O0
63 #QMAKE_CXXFLAGS_DEBUG += -O0
64 QMAKE_CFLAGS_RELEASE += -O3
65 QMAKE_CFLAGS_DEBUG += -O3
66 QMAKE_CXXFLAGS_RELEASE += -O3
67 QMAKE_CXXFLAGS_DEBUG += -O3
68
69 #QMAKE_CFLAGS_RELEASE+= -O3 -std=c99
70 #QMAKE_CFLAGS_DEBUG+= -O3 -std=c99
71 #QMAKE_CXXFLAGS_RELEASE+= -O3 -std=c99
72 #QMAKE_CXXFLAGS_DEBUG+= -O3 -std=c99
73
74 contains( TEMPLATE, app ) {
75 grmon.target = grmon
76 grmon.commands = cd $$DESTDIR && C:/opt/grmon-eval-2.0.29b/win32/bin/grmon.exe -uart COM4 -u
77 QMAKE_EXTRA_TARGETS += grmon
78 }
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
@@ -0,0 +1,70
1 #include "grspw.h"
2
3 int grspw_set_ie( unsigned char value, unsigned int *ctrlReg )
4 {
5 // IE = bit 3
6 // Interrupt Enable
7
8 int ret = 0;
9
10 if (value == 0)
11 {
12 *ctrlReg = *ctrlReg & 0xfffffff7;
13 }
14 else if (value == 1)
15 {
16 *ctrlReg = *ctrlReg | 0x00000008;
17 }
18 else
19 {
20 ret = -1;
21 }
22
23 return ret;
24 }
25
26 int grspw_set_tq( unsigned char value, unsigned int *ctrlReg )
27 {
28 // TQ = bit 8
29 // Tick-out IRQ
30
31 int ret = 0;
32
33 if (value == 0)
34 {
35 *ctrlReg = *ctrlReg & 0xfffffeff;
36 }
37 else if (value == 1)
38 {
39 *ctrlReg = *ctrlReg | 0x00000100;
40 }
41 else
42 {
43 ret = -1;
44 }
45
46 return ret;
47 }
48
49 int grspw_set_tr( unsigned char value, unsigned int *ctrlReg )
50 {
51 // TR = bit 11
52 // Enable timecode reception
53
54 int ret = 0;
55
56 if (value == 0)
57 {
58 *ctrlReg = *ctrlReg & 0xfffff7ff;
59 }
60 else if (value == 1)
61 {
62 *ctrlReg = *ctrlReg | 0x00000800;
63 }
64 else
65 {
66 ret = -1;
67 }
68
69 return ret;
70 }
@@ -0,0 +1,81
1 #include <stdio.h>
2
3 #include "grspw.h"
4 #include "fsw_params.h"
5
6 #define DSU_TIME_TAG_COUNTER 0x90000008
7
8 //**********
9 // IRQ LINES
10 #define IRQ_GRSPW 11
11 #define IRQ_SPARC_GRSPW 0x1b // see sparcv8.pdf p.76 for interrupt levels
12
13 extern void *catch_interrupt(void func(), int irq);
14 int *lreg = (int *) 0x80000000;
15
16 #define ICLEAR 0x20c
17 #define IMASK 0x240
18 #define IFORCE 0x208
19
20 void enable_irq (int irq)
21 {
22 lreg[ICLEAR/4] = (1 << irq); // clear any pending irq
23 lreg[IMASK/4] |= (1 << irq); // unmaks irq
24 }
25
26 void disable_irq (int irq) { lreg[IMASK/4] &= ~(1 << irq); } // mask irq
27
28 void force_irq (int irq) { lreg[IFORCE/4] = (1 << irq); } // force irq
29
30 /* NOTE: NEVER put printf() or other stdio routines in interrupt handlers,
31 they are not re-entrant. This (bad) example is just a demo */
32
33 unsigned char processTimecode = 0;
34
35 void irqhandler(int irq)
36 {
37 processTimecode = 1;
38 }
39
40 int main( void )
41 {
42 unsigned int *grspwCtrlReg;
43 unsigned int k;
44 volatile unsigned int *reg;
45 float aux;
46 unsigned int counter = 0;
47
48 printf("hello world!\n");
49
50 grspwCtrlReg = (unsigned int*) REGS_ADDR_GRSPW;
51 grspw_set_ie( 1, grspwCtrlReg );
52 grspw_set_tq( 1, grspwCtrlReg );
53 grspw_set_tr( 1, grspwCtrlReg );
54
55 catch_interrupt(irqhandler, IRQ_GRSPW);
56 enable_irq( IRQ_GRSPW );
57 force_irq( IRQ_GRSPW );
58
59 reg = (volatile unsigned int *) DSU_TIME_TAG_COUNTER;
60
61 while(1)
62 {
63 if (processTimecode == 1)
64 {
65 counter ++;
66 printf("timecode counter = %d\n", counter);
67 processTimecode = 0;
68 }
69 else
70 {
71 printf(".");
72 }
73
74 // for (k=0; k<100000;k++)
75 // {
76 // aux = aux + *reg ;
77 // }
78 }
79
80 return 0;
81 }
@@ -0,0 +1,17
1 # LOAD FSW USING LINK 1
2 SpwPlugin0.StarDundeeSelectLinkNumber( 1 )
3
4 APB_UART_PLUGIN0.setFifoDebugEnabled( 0 )
5
6 dsu3plugin0.openFile("/opt/DEV_PLE/EQM/bin/eqm")
7 dsu3plugin0.loadFile()
8
9 dsu3plugin0.run()
10
11 APB_UART_PLUGIN0.setFifoDebugEnabled( 1 )
12
13 # START SENDING TIMECODES AT 1 Hz
14 SpwPlugin0.StarDundeeStartTimecodes( 1 )
15
16 # it is possible to change the time code frequency
17 #RMAPPlugin0.changeTimecodeFrequency(2)
@@ -0,0 +1,34
1 import time
2
3 proxy.loadSysDriver("SpwPlugin","SpwPlugin0")
4 SpwPlugin0.selectBridge("STAR-Dundee Spw USB Brick")
5
6 proxy.loadSysDriverToParent("dsu3plugin","SpwPlugin0")
7 proxy.loadSysDriverToParent("LFRControlPlugin","SpwPlugin0")
8
9 proxy.loadSysDriverToParent("APB_UART_PLUGIN","SpwPlugin0")
10 APB_UART_PLUGIN0.setFifoDebugEnabled( 1 )
11
12 availableBrickCount = SpwPlugin0.StarDundeeGetAvailableBrickCount()
13 print str(availableBrickCount) + " SpaceWire brick(s) found"
14
15 SpwPlugin0.StarDundeeSelectBrick(1)
16 SpwPlugin0.StarDundeeSetBrickAsARouter(1)
17 SpwPlugin0.StarDundeeSelectLinkNumber( 1 )
18 SpwPlugin0.connectBridge()
19
20 #SpwPlugin0.TCPServerSetIP("127.0.0.1")
21 SpwPlugin0.TCPServerConnect()
22
23 # OPEN SPACEWIRE SERVER
24 #LFRControlPlugin0.SetSpwServerIP(129,104,27,164)
25 LFRControlPlugin0.TCPServerConnect()
26
27 # OPEN TM ECHO BRIDGE SERVER
28 LFRControlPlugin0.TMEchoBridgeOpenPort()
29
30 # START SENDING TIMECODES AT 1 Hz
31 SpwPlugin0.StarDundeeStartTimecodes( 1 )
32
33 # it is possible to change the time code frequency
34 #RMAPPlugin0.changeTimecodeFrequency(2)
@@ -0,0 +1,34
1 #!/usr/bin/lppmon -e
2
3 import time
4
5 proxy.loadSysDriver("SpwPlugin","SpwPlugin0")
6 SpwPlugin0.selectBridge("STAR-Dundee Spw USB Brick")
7
8 proxy.loadSysDriverToParent("dsu3plugin","SpwPlugin0")
9 proxy.loadSysDriverToParent("LFRControlPlugin","SpwPlugin0")
10
11 proxy.loadSysDriverToParent("APB_UART_PLUGIN","SpwPlugin0")
12 APB_UART_PLUGIN0.setFifoDebugEnabled( 0 )
13
14 availableBrickCount = SpwPlugin0.StarDundeeGetAvailableBrickCount()
15 print "availableBrickCount = ", availableBrickCount
16
17 SpwPlugin0.StarDundeeSelectBrick(1)
18 SpwPlugin0.StarDundeeSetBrickAsARouter(1)
19 SpwPlugin0.connectBridge()
20
21 #SpwPlugin0.TCPServerSetIP("127.0.0.1")
22 SpwPlugin0.TCPServerConnect()
23
24 #LFRControlPlugin0.SetSpwServerIP(129,104,27,164)
25 LFRControlPlugin0.TCPServerConnect()
26
27 dsu3plugin0.openFile("/opt/DEV_PLE/EQM/bin/eqm")
28 dsu3plugin0.loadFile()
29 dsu3plugin0.run()
30
31 APB_UART_PLUGIN0.setFifoDebugEnabled( 1 )
32
33 LFRControlPlugin0.TMEchoBridgeOpenPort()
34
@@ -0,0 +1,13
1 # LOAD FSW USING LINK 1
2 SpwPlugin0.StarDundeeSelectLinkNumber( 1 )
3
4 dsu3plugin0.openFile("/opt/LFR/LFR-FSW/2.0.2.3/fsw")
5 dsu3plugin0.loadFile()
6
7 dsu3plugin0.run()
8
9 # START SENDING TIMECODES AT 1 Hz
10 SpwPlugin0.StarDundeeStartTimecodes( 1 )
11
12 # it is possible to change the time code frequency
13 #RMAPPlugin0.changeTimecodeFrequency(2)
@@ -0,0 +1,5
1 dsu3plugin0.openFile("/opt/DEV_PLE/FSW-qt/bin/fsw")
2 dsu3plugin0.loadFile()
3
4 dsu3plugin0.run()
5
@@ -0,0 +1,83
1 #from PyQt4 import QtGui
2 #from PyQt4 import QtCore
3 #from PyQt4 import Qt
4 import sys
5 def elfSize(FileName,section):
6 bashCommand = "/usr/bin/size "+ FileName
7 import subprocess
8 process = subprocess.Popen(bashCommand.split(), stdout=subprocess.PIPE)
9 result = process.communicate()[0].split("\n")
10 header = result[0].lstrip()
11 line1 = result[1].lstrip()
12 hcolumns=header.split()
13 columns=line1.split()
14 for i in range(0,len(hcolumns)):
15 if(hcolumns[i].find(section) != -1):
16 return int(columns[i])
17 return 0;
18
19
20 def elfAddress(FileName,section):
21 bashCommand = "readelf -S " + FileName
22 import subprocess
23 process = subprocess.Popen(bashCommand.split(), stdout=subprocess.PIPE)
24 result = process.communicate()[0].split()
25 for i in range(0,len(result)):
26 if(result[i].find('.'+section) != -1):
27 return int("0x"+result[i+2],16)
28 return 0;
29
30 def compare(data1,data2):
31 if len(data1)!=len(data2):
32 return [-1,-1]
33 for i in range(len(data1)):
34 if data1[i]!=data2[i]:
35 return [-1,i]
36 return [1,-1]
37
38 def cycles(rootPlugin,textAddress,textSize,orgiData,count):
39 for i in range(count):
40 rootPlugin.dumpMemory(textAddress,textSize/4,"/opt/dump"+str(i)+".srec","srec")
41 data = rootPlugin.Read(textAddress,textSize/4)
42 result = compare(data,orgiData)
43 if(result[0]==1):
44 print("test number "+str(i)+" = success")
45 else:
46 print("test number "+str(i)+" = error @0x" + hex(textAddress + result[1]))
47
48
49 #app = QtGui.QApplication(sys.argv)
50 fileName = QtGui.QFileDialog.getOpenFileName()
51
52 if PySocExplorer.ElfFile.isElf(fileName):
53 proxy.loadSysDriver("SpwPlugin","SpwPlugin0")
54 SpwPlugin0.selectBridge("STAR-Dundee Spw USB Brick")
55
56 proxy.loadSysDriverToParent("dsu3plugin","SpwPlugin0")
57 proxy.loadSysDriverToParent("LFRControlPlugin","SpwPlugin0")
58 SpwPlugin0.TCPServerConnect()
59 LFRControlPlugin0.TCPServerConnect()
60 proxy.loadSysDriverToParent("APB_UART_PLUGIN","SpwPlugin0")
61 availableBrickCount = SpwPlugin0.StarDundeeGetAvailableBrickCount()
62 print(str(availableBrickCount) + " SpaceWire brick(s) found")
63
64 SpwPlugin0.StarDundeeSelectBrick(1)
65 SpwPlugin0.StarDundeeSetBrickAsARouter(1)
66 SpwPlugin0.connectBridge()
67 APB_UART_PLUGIN0.setUARTPortNane("/dev/ttyUSB1")
68 APB_UART_PLUGIN0.setUARTPortSpeed(38400)
69 APB_UART_PLUGIN0.openUart()
70 textSize= elfSize(fileName,"text")
71 textAddress= elfAddress(fileName,"text")
72 print "Found text section@" + hex(textAddress)+ " of " + str(textSize) +" bytes"
73 print "loading software"
74 dsu3plugin0.openFile(fileName)
75 dsu3plugin0.loadFile()
76 SpwPlugin0.dumpMemory(textAddress,textSize/4,"/opt/dumpOrig.srec","srec")
77 dsu3plugin0.run()
78 orgiData = SpwPlugin0.Read(textAddress,textSize/4)
79 orgiData = SpwPlugin0.Read(textAddress,textSize/4)
80
81
82
83
@@ -16,8 +16,6
16 #include "avf1_prc1.h"
16 #include "avf1_prc1.h"
17 #include "avf2_prc2.h"
17 #include "avf2_prc2.h"
18
18
19 #include "GscMemoryLPP.hpp"
20
21 extern rtems_name Task_name[20]; /* array of task names */
19 extern rtems_name Task_name[20]; /* array of task names */
22 extern rtems_id Task_id[20]; /* array of task ids */
20 extern rtems_id Task_id[20]; /* array of task ids */
23
21
@@ -35,6 +33,8 rtems_status_code get_message_queue_id_r
35 rtems_status_code get_message_queue_id_prc0( rtems_id *queue_id );
33 rtems_status_code get_message_queue_id_prc0( rtems_id *queue_id );
36 rtems_status_code get_message_queue_id_prc1( rtems_id *queue_id );
34 rtems_status_code get_message_queue_id_prc1( rtems_id *queue_id );
37 rtems_status_code get_message_queue_id_prc2( rtems_id *queue_id );
35 rtems_status_code get_message_queue_id_prc2( rtems_id *queue_id );
36 void update_queue_max_count( rtems_id queue_id, unsigned char*fifo_size_max );
37 void init_ring(ring_node ring[], unsigned char nbNodes, volatile int buffer[], unsigned int bufferSize );
38 //
38 //
39 int start_recv_send_tasks( void );
39 int start_recv_send_tasks( void );
40 //
40 //
@@ -45,4 +45,10 extern ring_node *ring_node_to_send_cwf_
45 extern ring_node waveform_ring_f3[];
45 extern ring_node waveform_ring_f3[];
46 extern unsigned short sequenceCounterHK;
46 extern unsigned short sequenceCounterHK;
47
47
48 extern unsigned char hk_lfr_q_sd_fifo_size_max;
49 extern unsigned char hk_lfr_q_rv_fifo_size_max;
50 extern unsigned char hk_lfr_q_p0_fifo_size_max;
51 extern unsigned char hk_lfr_q_p1_fifo_size_max;
52 extern unsigned char hk_lfr_q_p2_fifo_size_max;
53
48 #endif // FSW_MISC_H_INCLUDED
54 #endif // FSW_MISC_H_INCLUDED
@@ -11,6 +11,7
11
11
12 #include "fsw_params.h"
12 #include "fsw_params.h"
13 #include "tc_handler.h"
13 #include "tc_handler.h"
14 #include "fsw_init.h"
14
15
15 extern spw_stats spacewire_stats;
16 extern spw_stats spacewire_stats;
16 extern spw_stats spacewire_stats_backup;
17 extern spw_stats spacewire_stats_backup;
@@ -3,6 +3,7
3
3
4 #include "fsw_processing.h"
4 #include "fsw_processing.h"
5 #include "basic_parameters.h"
5 #include "basic_parameters.h"
6 #include "fsw_init.h"
6
7
7 typedef struct {
8 typedef struct {
8 unsigned int norm_bp1;
9 unsigned int norm_bp1;
@@ -3,6 +3,7
3
3
4 #include "fsw_processing.h"
4 #include "fsw_processing.h"
5 #include "basic_parameters.h"
5 #include "basic_parameters.h"
6 #include "fsw_init.h"
6
7
7 typedef struct {
8 typedef struct {
8 unsigned int norm_bp1;
9 unsigned int norm_bp1;
@@ -3,6 +3,7
3
3
4 #include "fsw_processing.h"
4 #include "fsw_processing.h"
5 #include "basic_parameters.h"
5 #include "basic_parameters.h"
6 #include "fsw_init.h"
6
7
7 typedef struct {
8 typedef struct {
8 unsigned int norm_bp1;
9 unsigned int norm_bp1;
@@ -10,7 +10,6
10 #include <grlib_regs.h>
10 #include <grlib_regs.h>
11
11
12 #include "fsw_params.h"
12 #include "fsw_params.h"
13 #include "fsw_spacewire.h"
14
13
15 typedef struct ring_node_asm
14 typedef struct ring_node_asm
16 {
15 {
@@ -72,7 +71,7 typedef struct
72 unsigned char data[ 117 ]; // 13 bins * 9 Bytes only for TM_LFR_SCIENCE_NORMAL_BP1_F0 and F1
71 unsigned char data[ 117 ]; // 13 bins * 9 Bytes only for TM_LFR_SCIENCE_NORMAL_BP1_F0 and F1
73 } bp_packet_with_spare;
72 } bp_packet_with_spare;
74
73
75 typedef struct
74 typedef struct asm_msg
76 {
75 {
77 ring_node_asm *norm;
76 ring_node_asm *norm;
78 ring_node_asm *burst_sbm;
77 ring_node_asm *burst_sbm;
@@ -12,9 +12,6
12
12
13 #include "lfr_cpu_usage_report.h"
13 #include "lfr_cpu_usage_report.h"
14
14
15 // MODE PARAMETERS
16 extern unsigned int maxCount;
17
18 //****
15 //****
19 // ISR
16 // ISR
20 rtems_isr commutation_isr1( rtems_vector_number vector );
17 rtems_isr commutation_isr1( rtems_vector_number vector );
@@ -7,8 +7,7
7 #include <math.h>
7 #include <math.h>
8 #include <fsw_params.h>
8 #include <fsw_params.h>
9
9
10 #include "fsw_spacewire.h"
10 #include "fsw_init.h"
11 #include "fsw_misc.h"
12 #include "fsw_params_wf_handler.h"
11 #include "fsw_params_wf_handler.h"
13
12
14 #define pi 3.14159265359
13 #define pi 3.14159265359
@@ -11,7 +11,7 print str(availableBrickCount) + " Space
11
11
12 SpwPlugin0.StarDundeeSelectBrick(1)
12 SpwPlugin0.StarDundeeSelectBrick(1)
13 SpwPlugin0.StarDundeeSetBrickAsARouter(1)
13 SpwPlugin0.StarDundeeSetBrickAsARouter(1)
14 SpwPlugin0.StarDundeeSelectLinkNumber( 2 )
14 SpwPlugin0.StarDundeeSelectLinkNumber( 1 )
15 SpwPlugin0.connectBridge()
15 SpwPlugin0.connectBridge()
16
16
17 #SpwPlugin0.TCPServerSetIP("127.0.0.1")
17 #SpwPlugin0.TCPServerSetIP("127.0.0.1")
@@ -26,7 +26,6
26 rtems_name misc_name[5];
26 rtems_name misc_name[5];
27 rtems_name Task_name[20]; /* array of task names */
27 rtems_name Task_name[20]; /* array of task names */
28 rtems_id Task_id[20]; /* array of task ids */
28 rtems_id Task_id[20]; /* array of task ids */
29 unsigned int maxCount;
30 int fdSPW = 0;
29 int fdSPW = 0;
31 int fdUART = 0;
30 int fdUART = 0;
32 unsigned char lfrCurrentMode;
31 unsigned char lfrCurrentMode;
@@ -61,6 +60,12 struct param_local_str param_local;
61
60
62 // HK PACKETS
61 // HK PACKETS
63 Packet_TM_LFR_HK_t housekeeping_packet;
62 Packet_TM_LFR_HK_t housekeeping_packet;
63 // message queues occupancy
64 unsigned char hk_lfr_q_sd_fifo_size_max;
65 unsigned char hk_lfr_q_rv_fifo_size_max;
66 unsigned char hk_lfr_q_p0_fifo_size_max;
67 unsigned char hk_lfr_q_p1_fifo_size_max;
68 unsigned char hk_lfr_q_p2_fifo_size_max;
64 // sequence counters are incremented by APID (PID + CAT) and destination ID
69 // sequence counters are incremented by APID (PID + CAT) and destination ID
65 unsigned short sequenceCounters_SCIENCE_NORMAL_BURST;
70 unsigned short sequenceCounters_SCIENCE_NORMAL_BURST;
66 unsigned short sequenceCounters_SCIENCE_SBM1_SBM2;
71 unsigned short sequenceCounters_SCIENCE_SBM1_SBM2;
@@ -60,6 +60,7
60
60
61 #include "fsw_init.h"
61 #include "fsw_init.h"
62 #include "fsw_config.c"
62 #include "fsw_config.c"
63 #include "GscMemoryLPP.hpp"
63
64
64 void initCache()
65 void initCache()
65 {
66 {
@@ -812,3 +813,57 rtems_status_code get_message_queue_id_p
812
813
813 return status;
814 return status;
814 }
815 }
816
817 void update_queue_max_count( rtems_id queue_id, unsigned char*fifo_size_max )
818 {
819 u_int32_t count;
820 rtems_status_code status;
821
822 status = rtems_message_queue_get_number_pending( queue_id, &count );
823
824 count = count + 1;
825
826 if (status != RTEMS_SUCCESSFUL)
827 {
828 PRINTF1("in update_queue_max_count *** ERR = %d\n", status)
829 }
830 else
831 {
832 if (count > *fifo_size_max)
833 {
834 *fifo_size_max = count;
835 }
836 }
837 }
838
839 void init_ring(ring_node ring[], unsigned char nbNodes, volatile int buffer[], unsigned int bufferSize )
840 {
841 unsigned char i;
842
843 //***************
844 // BUFFER ADDRESS
845 for(i=0; i<nbNodes; i++)
846 {
847 ring[i].coarseTime = 0x00;
848 ring[i].fineTime = 0x00;
849 ring[i].sid = 0x00;
850 ring[i].status = 0x00;
851 ring[i].buffer_address = (int) &buffer[ i * bufferSize ];
852 }
853
854 //*****
855 // NEXT
856 ring[ nbNodes - 1 ].next = (ring_node*) &ring[ 0 ];
857 for(i=0; i<nbNodes-1; i++)
858 {
859 ring[i].next = (ring_node*) &ring[ i + 1 ];
860 }
861
862 //*********
863 // PREVIOUS
864 ring[ 0 ].previous = (ring_node*) &ring[ nbNodes - 1 ];
865 for(i=1; i<nbNodes; i++)
866 {
867 ring[i].previous = (ring_node*) &ring[ i - 1 ];
868 }
869 }
@@ -161,22 +161,6 rtems_task hous_task(rtems_task_argument
161 }
161 }
162 }
162 }
163
163
164 housekeeping_packet.targetLogicalAddress = CCSDS_DESTINATION_ID;
165 housekeeping_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID;
166 housekeeping_packet.reserved = DEFAULT_RESERVED;
167 housekeeping_packet.userApplication = CCSDS_USER_APP;
168 housekeeping_packet.packetID[0] = (unsigned char) (APID_TM_HK >> 8);
169 housekeeping_packet.packetID[1] = (unsigned char) (APID_TM_HK);
170 housekeeping_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
171 housekeeping_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
172 housekeeping_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8);
173 housekeeping_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK );
174 housekeeping_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
175 housekeeping_packet.serviceType = TM_TYPE_HK;
176 housekeeping_packet.serviceSubType = TM_SUBTYPE_HK;
177 housekeeping_packet.destinationID = TM_DESTINATION_ID_GROUND;
178 housekeeping_packet.sid = SID_HK;
179
180 status = rtems_rate_monotonic_cancel(HK_id);
164 status = rtems_rate_monotonic_cancel(HK_id);
181 if( status != RTEMS_SUCCESSFUL ) {
165 if( status != RTEMS_SUCCESSFUL ) {
182 PRINTF1( "ERR *** in HOUS *** rtems_rate_monotonic_cancel(HK_id) ***code: %d\n", status )
166 PRINTF1( "ERR *** in HOUS *** rtems_rate_monotonic_cancel(HK_id) ***code: %d\n", status )
@@ -225,6 +209,12 rtems_task hous_task(rtems_task_argument
225
209
226 spacewire_update_statistics();
210 spacewire_update_statistics();
227
211
212 housekeeping_packet.hk_lfr_q_sd_fifo_size_max = hk_lfr_q_sd_fifo_size_max;
213 housekeeping_packet.hk_lfr_q_rv_fifo_size_max = hk_lfr_q_rv_fifo_size_max;
214 housekeeping_packet.hk_lfr_q_p0_fifo_size_max = hk_lfr_q_p0_fifo_size_max;
215 housekeeping_packet.hk_lfr_q_p1_fifo_size_max = hk_lfr_q_p1_fifo_size_max;
216 housekeeping_packet.hk_lfr_q_p2_fifo_size_max = hk_lfr_q_p2_fifo_size_max;
217
228 housekeeping_packet.sy_lfr_common_parameters_spare = parameter_dump_packet.sy_lfr_common_parameters_spare;
218 housekeeping_packet.sy_lfr_common_parameters_spare = parameter_dump_packet.sy_lfr_common_parameters_spare;
229 housekeeping_packet.sy_lfr_common_parameters = parameter_dump_packet.sy_lfr_common_parameters;
219 housekeeping_packet.sy_lfr_common_parameters = parameter_dump_packet.sy_lfr_common_parameters;
230 get_temperatures( housekeeping_packet.hk_lfr_temp_scm );
220 get_temperatures( housekeeping_packet.hk_lfr_temp_scm );
@@ -314,12 +304,33 void init_housekeeping_parameters( void
314
304
315 unsigned int i = 0;
305 unsigned int i = 0;
316 unsigned char *parameters;
306 unsigned char *parameters;
307 unsigned char sizeOfHK;
317
308
318 parameters = (unsigned char*) &housekeeping_packet.lfr_status_word;
309 sizeOfHK = sizeof( Packet_TM_LFR_HK_t );
319 for(i = 0; i< SIZE_HK_PARAMETERS; i++)
310
311 parameters = (unsigned char*) &housekeeping_packet;
312
313 for(i = 0; i< sizeOfHK; i++)
320 {
314 {
321 parameters[i] = 0x00;
315 parameters[i] = 0x00;
322 }
316 }
317
318 housekeeping_packet.targetLogicalAddress = CCSDS_DESTINATION_ID;
319 housekeeping_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID;
320 housekeeping_packet.reserved = DEFAULT_RESERVED;
321 housekeeping_packet.userApplication = CCSDS_USER_APP;
322 housekeeping_packet.packetID[0] = (unsigned char) (APID_TM_HK >> 8);
323 housekeeping_packet.packetID[1] = (unsigned char) (APID_TM_HK);
324 housekeeping_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
325 housekeeping_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
326 housekeeping_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8);
327 housekeeping_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK );
328 housekeeping_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
329 housekeeping_packet.serviceType = TM_TYPE_HK;
330 housekeeping_packet.serviceSubType = TM_SUBTYPE_HK;
331 housekeeping_packet.destinationID = TM_DESTINATION_ID_GROUND;
332 housekeeping_packet.sid = SID_HK;
333
323 // init status word
334 // init status word
324 housekeeping_packet.lfr_status_word[0] = DEFAULT_STATUS_WORD_BYTE0;
335 housekeeping_packet.lfr_status_word[0] = DEFAULT_STATUS_WORD_BYTE0;
325 housekeeping_packet.lfr_status_word[1] = DEFAULT_STATUS_WORD_BYTE1;
336 housekeeping_packet.lfr_status_word[1] = DEFAULT_STATUS_WORD_BYTE1;
@@ -333,6 +344,12 void init_housekeeping_parameters( void
333 housekeeping_packet.lfr_fpga_version[0] = parameters[1]; // n1
344 housekeeping_packet.lfr_fpga_version[0] = parameters[1]; // n1
334 housekeeping_packet.lfr_fpga_version[1] = parameters[2]; // n2
345 housekeeping_packet.lfr_fpga_version[1] = parameters[2]; // n2
335 housekeeping_packet.lfr_fpga_version[2] = parameters[3]; // n3
346 housekeeping_packet.lfr_fpga_version[2] = parameters[3]; // n3
347
348 housekeeping_packet.hk_lfr_q_sd_fifo_size = MSG_QUEUE_COUNT_SEND;
349 housekeeping_packet.hk_lfr_q_rv_fifo_size = MSG_QUEUE_COUNT_RECV;
350 housekeeping_packet.hk_lfr_q_p0_fifo_size = MSG_QUEUE_COUNT_PRC0;
351 housekeeping_packet.hk_lfr_q_p1_fifo_size = MSG_QUEUE_COUNT_PRC1;
352 housekeeping_packet.hk_lfr_q_p2_fifo_size = MSG_QUEUE_COUNT_PRC2;
336 }
353 }
337
354
338 void increment_seq_counter( unsigned short *packetSequenceControl )
355 void increment_seq_counter( unsigned short *packetSequenceControl )
@@ -71,7 +71,7 rtems_task spiq_task(rtems_task_argument
71 status = spacewire_stop_and_start_link( fdSPW ); // start the link
71 status = spacewire_stop_and_start_link( fdSPW ); // start the link
72 if ( status != RTEMS_SUCCESSFUL)
72 if ( status != RTEMS_SUCCESSFUL)
73 {
73 {
74 PRINTF1("in SPIQ *** ERR spacewire_start_link %d\n", status)
74 PRINTF1("in SPIQ *** ERR spacewire_stop_and_start_link %d\n", status)
75 }
75 }
76 }
76 }
77
77
@@ -89,10 +89,6 rtems_task spiq_task(rtems_task_argument
89 }
89 }
90 else // [3.b] the link is not in run state, go in STANDBY mode
90 else // [3.b] the link is not in run state, go in STANDBY mode
91 {
91 {
92 status = stop_current_mode();
93 if ( status != RTEMS_SUCCESSFUL ) {
94 PRINTF1("in SPIQ *** ERR stop_current_mode *** code %d\n", status)
95 }
96 status = enter_mode( LFR_MODE_STANDBY, 0 );
92 status = enter_mode( LFR_MODE_STANDBY, 0 );
97 if ( status != RTEMS_SUCCESSFUL ) {
93 if ( status != RTEMS_SUCCESSFUL ) {
98 PRINTF1("in SPIQ *** ERR enter_standby_mode *** code %d\n", status)
94 PRINTF1("in SPIQ *** ERR enter_standby_mode *** code %d\n", status)
@@ -191,6 +187,9 rtems_task recv_task( rtems_task_argumen
191 }
187 }
192 }
188 }
193 }
189 }
190
191 update_queue_max_count( queue_recv_id, &hk_lfr_q_rv_fifo_size_max );
192
194 }
193 }
195 }
194 }
196
195
@@ -215,8 +214,7 rtems_task send_task( rtems_task_argumen
215 char *charPtr;
214 char *charPtr;
216 spw_ioctl_pkt_send *spw_ioctl_send;
215 spw_ioctl_pkt_send *spw_ioctl_send;
217 size_t size; // size of the incoming TC packet
216 size_t size; // size of the incoming TC packet
218 u_int32_t count;
217 rtems_id queue_send_id;
219 rtems_id queue_id;
220 unsigned int sid;
218 unsigned int sid;
221
219
222 incomingRingNodePtr = NULL;
220 incomingRingNodePtr = NULL;
@@ -228,7 +226,7 rtems_task send_task( rtems_task_argumen
228 init_header_swf( &headerSWF );
226 init_header_swf( &headerSWF );
229 init_header_asm( &headerASM );
227 init_header_asm( &headerASM );
230
228
231 status = get_message_queue_id_send( &queue_id );
229 status = get_message_queue_id_send( &queue_send_id );
232 if (status != RTEMS_SUCCESSFUL)
230 if (status != RTEMS_SUCCESSFUL)
233 {
231 {
234 PRINTF1("in HOUS *** ERR get_message_queue_id_send %d\n", status)
232 PRINTF1("in HOUS *** ERR get_message_queue_id_send %d\n", status)
@@ -238,7 +236,7 rtems_task send_task( rtems_task_argumen
238
236
239 while(1)
237 while(1)
240 {
238 {
241 status = rtems_message_queue_receive( queue_id, incomingData, &size,
239 status = rtems_message_queue_receive( queue_send_id, incomingData, &size,
242 RTEMS_WAIT, RTEMS_NO_TIMEOUT );
240 RTEMS_WAIT, RTEMS_NO_TIMEOUT );
243
241
244 if (status!=RTEMS_SUCCESSFUL)
242 if (status!=RTEMS_SUCCESSFUL)
@@ -315,18 +313,8 rtems_task send_task( rtems_task_argumen
315 }
313 }
316 }
314 }
317
315
318 status = rtems_message_queue_get_number_pending( queue_id, &count );
316 update_queue_max_count( queue_send_id, &hk_lfr_q_sd_fifo_size_max );
319 if (status != RTEMS_SUCCESSFUL)
317
320 {
321 PRINTF1("in SEND *** (3) ERR = %d\n", status)
322 }
323 else
324 {
325 if (count > maxCount)
326 {
327 maxCount = count;
328 }
329 }
330 }
318 }
331 }
319 }
332
320
@@ -352,6 +352,9 rtems_task prc0_task( rtems_task_argumen
352 // change asm ring node
352 // change asm ring node
353 current_ring_node_to_send_asm_f0 = current_ring_node_to_send_asm_f0->next;
353 current_ring_node_to_send_asm_f0 = current_ring_node_to_send_asm_f0->next;
354 }
354 }
355
356 update_queue_max_count( queue_id_q_p0, &hk_lfr_q_p0_fifo_size_max );
357
355 }
358 }
356 }
359 }
357
360
@@ -347,6 +347,8 rtems_task prc1_task( rtems_task_argumen
347 current_ring_node_to_send_asm_f1 = current_ring_node_to_send_asm_f1->next;
347 current_ring_node_to_send_asm_f1 = current_ring_node_to_send_asm_f1->next;
348 }
348 }
349
349
350 update_queue_max_count( queue_id_q_p1, &hk_lfr_q_p1_fifo_size_max );
351
350 }
352 }
351 }
353 }
352
354
@@ -246,6 +246,8 rtems_task prc2_task( rtems_task_argumen
246 current_ring_node_to_send_asm_f2 = current_ring_node_to_send_asm_f2->next;
246 current_ring_node_to_send_asm_f2 = current_ring_node_to_send_asm_f2->next;
247 }
247 }
248
248
249 update_queue_max_count( queue_id_q_p2, &hk_lfr_q_p2_fifo_size_max );
250
249 }
251 }
250 }
252 }
251
253
@@ -9,6 +9,7
9
9
10 #include "fsw_processing.h"
10 #include "fsw_processing.h"
11 #include "fsw_processing_globals.c"
11 #include "fsw_processing_globals.c"
12 #include "fsw_init.h"
12
13
13 unsigned int nb_sm_f0;
14 unsigned int nb_sm_f0;
14 unsigned int nb_sm_f0_aux_f1;
15 unsigned int nb_sm_f0_aux_f1;
@@ -533,7 +533,6 int enter_mode( unsigned char mode, unsi
533 {
533 {
534 #ifdef PRINT_TASK_STATISTICS
534 #ifdef PRINT_TASK_STATISTICS
535 rtems_cpu_usage_reset();
535 rtems_cpu_usage_reset();
536 maxCount = 0;
537 #endif
536 #endif
538 status = restart_science_tasks( mode );
537 status = restart_science_tasks( mode );
539 launch_spectral_matrix( );
538 launch_spectral_matrix( );
@@ -550,7 +549,6 int enter_mode( unsigned char mode, unsi
550 PRINTF("stack report selected\n")
549 PRINTF("stack report selected\n")
551 rtems_stack_checker_report_usage();
550 rtems_stack_checker_report_usage();
552 #endif
551 #endif
553 PRINTF1("maxCount = %d\n", maxCount)
554 }
552 }
555 else
553 else
556 {
554 {
@@ -673,81 +671,121 int suspend_science_tasks()
673 printf("in suspend_science_tasks\n");
671 printf("in suspend_science_tasks\n");
674
672
675 status = rtems_task_suspend( Task_id[TASKID_AVF0] ); // suspend AVF0
673 status = rtems_task_suspend( Task_id[TASKID_AVF0] ); // suspend AVF0
676 if (status != RTEMS_SUCCESSFUL)
674 if ((status != RTEMS_SUCCESSFUL) && (status != RTEMS_ALREADY_SUSPENDED))
677 {
675 {
678 PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status)
676 PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status)
679 }
677 }
678 else
679 {
680 status = RTEMS_SUCCESSFUL;
681 }
680 if (status == RTEMS_SUCCESSFUL) // suspend PRC0
682 if (status == RTEMS_SUCCESSFUL) // suspend PRC0
681 {
683 {
682 status = rtems_task_suspend( Task_id[TASKID_PRC0] );
684 status = rtems_task_suspend( Task_id[TASKID_PRC0] );
683 if (status != RTEMS_SUCCESSFUL)
685 if ((status != RTEMS_SUCCESSFUL) && (status != RTEMS_ALREADY_SUSPENDED))
684 {
686 {
685 PRINTF1("in suspend_science_task *** PRC0 ERR %d\n", status)
687 PRINTF1("in suspend_science_task *** PRC0 ERR %d\n", status)
686 }
688 }
689 else
690 {
691 status = RTEMS_SUCCESSFUL;
692 }
687 }
693 }
688 if (status == RTEMS_SUCCESSFUL) // suspend AVF1
694 if (status == RTEMS_SUCCESSFUL) // suspend AVF1
689 {
695 {
690 status = rtems_task_suspend( Task_id[TASKID_AVF1] );
696 status = rtems_task_suspend( Task_id[TASKID_AVF1] );
691 if (status != RTEMS_SUCCESSFUL)
697 if ((status != RTEMS_SUCCESSFUL) && (status != RTEMS_ALREADY_SUSPENDED))
692 {
698 {
693 PRINTF1("in suspend_science_task *** AVF1 ERR %d\n", status)
699 PRINTF1("in suspend_science_task *** AVF1 ERR %d\n", status)
694 }
700 }
701 else
702 {
703 status = RTEMS_SUCCESSFUL;
704 }
695 }
705 }
696 if (status == RTEMS_SUCCESSFUL) // suspend PRC1
706 if (status == RTEMS_SUCCESSFUL) // suspend PRC1
697 {
707 {
698 status = rtems_task_suspend( Task_id[TASKID_PRC1] );
708 status = rtems_task_suspend( Task_id[TASKID_PRC1] );
699 if (status != RTEMS_SUCCESSFUL)
709 if ((status != RTEMS_SUCCESSFUL) && (status != RTEMS_ALREADY_SUSPENDED))
700 {
710 {
701 PRINTF1("in suspend_science_task *** PRC1 ERR %d\n", status)
711 PRINTF1("in suspend_science_task *** PRC1 ERR %d\n", status)
702 }
712 }
713 else
714 {
715 status = RTEMS_SUCCESSFUL;
716 }
703 }
717 }
704 if (status == RTEMS_SUCCESSFUL) // suspend AVF2
718 if (status == RTEMS_SUCCESSFUL) // suspend AVF2
705 {
719 {
706 status = rtems_task_suspend( Task_id[TASKID_AVF2] );
720 status = rtems_task_suspend( Task_id[TASKID_AVF2] );
707 if (status != RTEMS_SUCCESSFUL)
721 if ((status != RTEMS_SUCCESSFUL) && (status != RTEMS_ALREADY_SUSPENDED))
708 {
722 {
709 PRINTF1("in suspend_science_task *** AVF2 ERR %d\n", status)
723 PRINTF1("in suspend_science_task *** AVF2 ERR %d\n", status)
710 }
724 }
725 else
726 {
727 status = RTEMS_SUCCESSFUL;
728 }
711 }
729 }
712 if (status == RTEMS_SUCCESSFUL) // suspend PRC2
730 if (status == RTEMS_SUCCESSFUL) // suspend PRC2
713 {
731 {
714 status = rtems_task_suspend( Task_id[TASKID_PRC2] );
732 status = rtems_task_suspend( Task_id[TASKID_PRC2] );
715 if (status != RTEMS_SUCCESSFUL)
733 if ((status != RTEMS_SUCCESSFUL) && (status != RTEMS_ALREADY_SUSPENDED))
716 {
734 {
717 PRINTF1("in suspend_science_task *** PRC2 ERR %d\n", status)
735 PRINTF1("in suspend_science_task *** PRC2 ERR %d\n", status)
718 }
736 }
737 else
738 {
739 status = RTEMS_SUCCESSFUL;
740 }
719 }
741 }
720 if (status == RTEMS_SUCCESSFUL) // suspend WFRM
742 if (status == RTEMS_SUCCESSFUL) // suspend WFRM
721 {
743 {
722 status = rtems_task_suspend( Task_id[TASKID_WFRM] );
744 status = rtems_task_suspend( Task_id[TASKID_WFRM] );
723 if (status != RTEMS_SUCCESSFUL)
745 if ((status != RTEMS_SUCCESSFUL) && (status != RTEMS_ALREADY_SUSPENDED))
724 {
746 {
725 PRINTF1("in suspend_science_task *** WFRM ERR %d\n", status)
747 PRINTF1("in suspend_science_task *** WFRM ERR %d\n", status)
726 }
748 }
749 else
750 {
751 status = RTEMS_SUCCESSFUL;
752 }
727 }
753 }
728 if (status == RTEMS_SUCCESSFUL) // suspend CWF3
754 if (status == RTEMS_SUCCESSFUL) // suspend CWF3
729 {
755 {
730 status = rtems_task_suspend( Task_id[TASKID_CWF3] );
756 status = rtems_task_suspend( Task_id[TASKID_CWF3] );
731 if (status != RTEMS_SUCCESSFUL)
757 if ((status != RTEMS_SUCCESSFUL) && (status != RTEMS_ALREADY_SUSPENDED))
732 {
758 {
733 PRINTF1("in suspend_science_task *** CWF3 ERR %d\n", status)
759 PRINTF1("in suspend_science_task *** CWF3 ERR %d\n", status)
734 }
760 }
761 else
762 {
763 status = RTEMS_SUCCESSFUL;
764 }
735 }
765 }
736 if (status == RTEMS_SUCCESSFUL) // suspend CWF2
766 if (status == RTEMS_SUCCESSFUL) // suspend CWF2
737 {
767 {
738 status = rtems_task_suspend( Task_id[TASKID_CWF2] );
768 status = rtems_task_suspend( Task_id[TASKID_CWF2] );
739 if (status != RTEMS_SUCCESSFUL)
769 if ((status != RTEMS_SUCCESSFUL) && (status != RTEMS_ALREADY_SUSPENDED))
740 {
770 {
741 PRINTF1("in suspend_science_task *** CWF2 ERR %d\n", status)
771 PRINTF1("in suspend_science_task *** CWF2 ERR %d\n", status)
742 }
772 }
773 else
774 {
775 status = RTEMS_SUCCESSFUL;
776 }
743 }
777 }
744 if (status == RTEMS_SUCCESSFUL) // suspend CWF1
778 if (status == RTEMS_SUCCESSFUL) // suspend CWF1
745 {
779 {
746 status = rtems_task_suspend( Task_id[TASKID_CWF1] );
780 status = rtems_task_suspend( Task_id[TASKID_CWF1] );
747 if (status != RTEMS_SUCCESSFUL)
781 if ((status != RTEMS_SUCCESSFUL) && (status != RTEMS_ALREADY_SUSPENDED))
748 {
782 {
749 PRINTF1("in suspend_science_task *** CWF1 ERR %d\n", status)
783 PRINTF1("in suspend_science_task *** CWF1 ERR %d\n", status)
750 }
784 }
785 else
786 {
787 status = RTEMS_SUCCESSFUL;
788 }
751 }
789 }
752
790
753 return status;
791 return status;
@@ -697,6 +697,8 rtems_task cwf1_task(rtems_task_argument
697 ring_node_to_send_cwf = getRingNodeToSendCWF( 1 );
697 ring_node_to_send_cwf = getRingNodeToSendCWF( 1 );
698 ring_node_to_send_cwf_f1->sid = SID_SBM1_CWF_F1;
698 ring_node_to_send_cwf_f1->sid = SID_SBM1_CWF_F1;
699 status = rtems_message_queue_send( queue_id, &ring_node_to_send_cwf, sizeof( ring_node* ) );
699 status = rtems_message_queue_send( queue_id, &ring_node_to_send_cwf, sizeof( ring_node* ) );
700 if (status != 0)
701 printf("cwf sending failed\n");
700 // launch snapshot extraction if needed
702 // launch snapshot extraction if needed
701 if (extractSWF == true)
703 if (extractSWF == true)
702 {
704 {
@@ -778,38 +780,6 void WFP_init_rings( void )
778
780
779 }
781 }
780
782
781 void init_ring(ring_node ring[], unsigned char nbNodes, volatile int buffer[], unsigned int bufferSize )
782 {
783 unsigned char i;
784
785 //***************
786 // BUFFER ADDRESS
787 for(i=0; i<nbNodes; i++)
788 {
789 ring[i].coarseTime = 0x00;
790 ring[i].fineTime = 0x00;
791 ring[i].sid = 0x00;
792 ring[i].status = 0x00;
793 ring[i].buffer_address = (int) &buffer[ i * bufferSize ];
794 }
795
796 //*****
797 // NEXT
798 ring[ nbNodes - 1 ].next = (ring_node*) &ring[ 0 ];
799 for(i=0; i<nbNodes-1; i++)
800 {
801 ring[i].next = (ring_node*) &ring[ i + 1 ];
802 }
803
804 //*********
805 // PREVIOUS
806 ring[ 0 ].previous = (ring_node*) &ring[ nbNodes - 1 ];
807 for(i=1; i<nbNodes; i++)
808 {
809 ring[i].previous = (ring_node*) &ring[ i - 1 ];
810 }
811 }
812
813 void WFP_reset_current_ring_nodes( void )
783 void WFP_reset_current_ring_nodes( void )
814 {
784 {
815 current_ring_node_f0 = waveform_ring_f0[0].next;
785 current_ring_node_f0 = waveform_ring_f0[0].next;
General Comments 0
You need to be logged in to leave comments. Login now