diff --git a/EQM/eqm.pro b/EQM/eqm.pro
new file mode 100644
--- /dev/null
+++ b/EQM/eqm.pro
@@ -0,0 +1,75 @@
+TEMPLATE = app
+# CONFIG += console v8 sim
+# CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report *** vhdl_dev *** debug_tch
+# lpp_dpu_destid
+CONFIG += console verbose lpp_dpu_destid cpu_usage_report
+CONFIG -= qt
+
+include(./sparc.pri)
+
+# eqm debug software version
+SWVERSION=-1-0
+DEFINES += SW_VERSION_N1=0 # major
+DEFINES += SW_VERSION_N2=0 # minor
+DEFINES += SW_VERSION_N3=0 # patch
+DEFINES += SW_VERSION_N4=0 # internal
+
+#
+#QMAKE_CFLAGS_RELEASE += -fprofile-arcs -ftest-coverage
+#LIBS += -lgcov /opt/GCOV/01A/lib/overload.o -lc
+#
+
+#
+contains( CONFIG, lpp_dpu_destid ) {
+ DEFINES += LPP_DPU_DESTID
+}
+#
+
+contains( CONFIG, debug_tch ) {
+ DEFINES += DEBUG_TCH
+}
+DEFINES += MSB_FIRST_TCH
+
+contains( CONFIG, vhdl_dev ) {
+ DEFINES += VHDL_DEV
+}
+
+contains( CONFIG, verbose ) {
+ DEFINES += PRINT_MESSAGES_ON_CONSOLE
+}
+
+contains( CONFIG, debug_messages ) {
+ DEFINES += DEBUG_MESSAGES
+}
+
+contains( CONFIG, cpu_usage_report ) {
+ DEFINES += PRINT_TASK_STATISTICS
+}
+
+contains( CONFIG, stack_report ) {
+ DEFINES += PRINT_STACK_REPORT
+}
+
+contains( CONFIG, boot_messages ) {
+ DEFINES += BOOT_MESSAGES
+}
+
+#doxygen.target = doxygen
+#doxygen.commands = doxygen ../doc/Doxyfile
+#QMAKE_EXTRA_TARGETS += doxygen
+
+TARGET = eqm
+
+INCLUDEPATH += ./header \
+ ../header/lfr_common_headers
+
+SOURCES += \
+ src/main.c \
+ src/grspw.c
+
+HEADERS += \
+ ../header/lfr_common_headers/fsw_params.h \
+ header/grspw.h
+
+
+
diff --git a/EQM/header/grspw.h b/EQM/header/grspw.h
new file mode 100644
--- /dev/null
+++ b/EQM/header/grspw.h
@@ -0,0 +1,8 @@
+#ifndef GRSPW_H_INCLUDED
+#define GRSPW_H_INCLUDED
+
+int grspw_set_ie( unsigned char value, unsigned int *ctrlReg );
+int grspw_set_tq( unsigned char value, unsigned int *ctrlReg );
+int grspw_set_tr( unsigned char value, unsigned int *ctrlReg );
+
+#endif // GRSPW_H_INCLUDED
diff --git a/EQM/sparc.pri b/EQM/sparc.pri
new file mode 100644
--- /dev/null
+++ b/EQM/sparc.pri
@@ -0,0 +1,97 @@
+CONFIG += console
+CONFIG -= qt
+QMAKE_CC=sparc-elf-gcc
+message(C compiler forced to: $$QMAKE_CC)
+QMAKE_CXX=sparc-elf-g++
+message(C++ compiler forced to: $$QMAKE_CXX)
+QMAKE_AR=sparc-elf-ar rcs
+message(Archiver forced to: $$QMAKE_AR)
+QMAKE_LINK=sparc-elf-g++
+message(Linker forced to: $$QMAKE_LINK)
+QMAKE_LINK_SHLIB=sparc-rtems-g++
+QMAKE_OBJCOPY= sparc-elf-objcopy
+QMAKE_STRIP=sparc-elf-strip
+QMAKE_GDB=sparc-elf-gdb
+
+INCLUDEPATH += /opt/sparc-elf-4.4.2
+
+QMAKE_CFLAGS_DEBUG= -g
+QMAKE_CFLAGS_RELEASE=""
+QMAKE_CXXFLAGS_DEBUG= -g
+QMAKE_CXXFLAGS_RELEASE=""
+QMAKE_LFLAGS_RELEASE=""
+QMAKE_LFLAGS_DEBUG= -g
+QMAKE_CXXFLAGS_DEPS =
+QMAKE_CXXFLAGS_WARN_ON = -Wall
+QMAKE_CXXFLAGS_WARN_OFF = -w
+QMAKE_CXXFLAGS_RELEASE =
+QMAKE_CXXFLAGS_DEBUG =
+QMAKE_CXXFLAGS_YACC =
+QMAKE_CXXFLAGS_THREAD =
+QMAKE_CXXFLAGS_RTTI_ON =
+QMAKE_CXXFLAGS_RTTI_OFF =
+QMAKE_CXXFLAGS_EXCEPTIONS_ON =
+QMAKE_CXXFLAGS_EXCEPTIONS_OFF =
+QMAKE_CFLAGS_WARN_ON = -Wall
+QMAKE_CFLAGS_WARN_OFF = -w
+QMAKE_CFLAGS_RELEASE =
+QMAKE_CFLAGS_YACC =
+QMAKE_LFLAGS_EXCEPTIONS_ON =
+QMAKE_LFLAGS_EXCEPTIONS_OFF =
+QMAKE_LFLAGS_RELEASE =
+QMAKE_LFLAGS_CONSOLE =
+QMAKE_LFLAGS_WINDOWS =
+QMAKE_LFLAGS_DLL =
+QMAKE_INCDIR_QT =
+QMAKE_INCDIR =
+QMAKE_CFLAGS_SHLIB =
+QMAKE_CFLAGS_STATIC_LIB =
+QMAKE_CXXFLAGS_SHLIB =
+QMAKE_CXXFLAGS_STATIC_LIB =
+QMAKE_LIBS=""
+INCLUDEPATH=""
+DEFINES=""
+
+contains( TEMPLATE, app ) {
+ OBJECTS_DIR=obj
+ DESTDIR=bin
+}
+
+#QMAKE_CFLAGS_RELEASE += -O0
+#QMAKE_CFLAGS_DEBUG += -O0
+#QMAKE_CXXFLAGS_RELEASE += -O0
+#QMAKE_CXXFLAGS_DEBUG += -O0
+QMAKE_CFLAGS_RELEASE += -O3
+QMAKE_CFLAGS_DEBUG += -O3
+QMAKE_CXXFLAGS_RELEASE += -O3
+QMAKE_CXXFLAGS_DEBUG += -O3
+
+#QMAKE_CFLAGS_RELEASE+= -O3 -std=c99
+#QMAKE_CFLAGS_DEBUG+= -O3 -std=c99
+#QMAKE_CXXFLAGS_RELEASE+= -O3 -std=c99
+#QMAKE_CXXFLAGS_DEBUG+= -O3 -std=c99
+
+contains( TEMPLATE, app ) {
+ grmon.target = grmon
+ grmon.commands = cd $$DESTDIR && C:/opt/grmon-eval-2.0.29b/win32/bin/grmon.exe -uart COM4 -u
+ QMAKE_EXTRA_TARGETS += grmon
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/EQM/src/grspw.c b/EQM/src/grspw.c
new file mode 100644
--- /dev/null
+++ b/EQM/src/grspw.c
@@ -0,0 +1,70 @@
+#include "grspw.h"
+
+int grspw_set_ie( unsigned char value, unsigned int *ctrlReg )
+{
+ // IE = bit 3
+ // Interrupt Enable
+
+ int ret = 0;
+
+ if (value == 0)
+ {
+ *ctrlReg = *ctrlReg & 0xfffffff7;
+ }
+ else if (value == 1)
+ {
+ *ctrlReg = *ctrlReg | 0x00000008;
+ }
+ else
+ {
+ ret = -1;
+ }
+
+ return ret;
+}
+
+int grspw_set_tq( unsigned char value, unsigned int *ctrlReg )
+{
+ // TQ = bit 8
+ // Tick-out IRQ
+
+ int ret = 0;
+
+ if (value == 0)
+ {
+ *ctrlReg = *ctrlReg & 0xfffffeff;
+ }
+ else if (value == 1)
+ {
+ *ctrlReg = *ctrlReg | 0x00000100;
+ }
+ else
+ {
+ ret = -1;
+ }
+
+ return ret;
+}
+
+int grspw_set_tr( unsigned char value, unsigned int *ctrlReg )
+{
+ // TR = bit 11
+ // Enable timecode reception
+
+ int ret = 0;
+
+ if (value == 0)
+ {
+ *ctrlReg = *ctrlReg & 0xfffff7ff;
+ }
+ else if (value == 1)
+ {
+ *ctrlReg = *ctrlReg | 0x00000800;
+ }
+ else
+ {
+ ret = -1;
+ }
+
+ return ret;
+}
diff --git a/EQM/src/main.c b/EQM/src/main.c
new file mode 100644
--- /dev/null
+++ b/EQM/src/main.c
@@ -0,0 +1,81 @@
+#include
+
+#include "grspw.h"
+#include "fsw_params.h"
+
+#define DSU_TIME_TAG_COUNTER 0x90000008
+
+//**********
+// IRQ LINES
+#define IRQ_GRSPW 11
+#define IRQ_SPARC_GRSPW 0x1b // see sparcv8.pdf p.76 for interrupt levels
+
+extern void *catch_interrupt(void func(), int irq);
+int *lreg = (int *) 0x80000000;
+
+#define ICLEAR 0x20c
+#define IMASK 0x240
+#define IFORCE 0x208
+
+void enable_irq (int irq)
+{
+ lreg[ICLEAR/4] = (1 << irq); // clear any pending irq
+ lreg[IMASK/4] |= (1 << irq); // unmaks irq
+}
+
+void disable_irq (int irq) { lreg[IMASK/4] &= ~(1 << irq); } // mask irq
+
+void force_irq (int irq) { lreg[IFORCE/4] = (1 << irq); } // force irq
+
+/* NOTE: NEVER put printf() or other stdio routines in interrupt handlers,
+ they are not re-entrant. This (bad) example is just a demo */
+
+unsigned char processTimecode = 0;
+
+void irqhandler(int irq)
+{
+ processTimecode = 1;
+}
+
+int main( void )
+{
+ unsigned int *grspwCtrlReg;
+ unsigned int k;
+ volatile unsigned int *reg;
+ float aux;
+ unsigned int counter = 0;
+
+ printf("hello world!\n");
+
+ grspwCtrlReg = (unsigned int*) REGS_ADDR_GRSPW;
+ grspw_set_ie( 1, grspwCtrlReg );
+ grspw_set_tq( 1, grspwCtrlReg );
+ grspw_set_tr( 1, grspwCtrlReg );
+
+ catch_interrupt(irqhandler, IRQ_GRSPW);
+ enable_irq( IRQ_GRSPW );
+ force_irq( IRQ_GRSPW );
+
+ reg = (volatile unsigned int *) DSU_TIME_TAG_COUNTER;
+
+ while(1)
+ {
+ if (processTimecode == 1)
+ {
+ counter ++;
+ printf("timecode counter = %d\n", counter);
+ processTimecode = 0;
+ }
+ else
+ {
+ printf(".");
+ }
+
+// for (k=0; k<100000;k++)
+// {
+// aux = aux + *reg ;
+// }
+ }
+
+ return 0;
+}
diff --git a/header/fsw_init.h b/header/fsw_init.h
--- a/header/fsw_init.h
+++ b/header/fsw_init.h
@@ -16,8 +16,6 @@
#include "avf1_prc1.h"
#include "avf2_prc2.h"
-#include "GscMemoryLPP.hpp"
-
extern rtems_name Task_name[20]; /* array of task names */
extern rtems_id Task_id[20]; /* array of task ids */
@@ -35,6 +33,8 @@ rtems_status_code get_message_queue_id_r
rtems_status_code get_message_queue_id_prc0( rtems_id *queue_id );
rtems_status_code get_message_queue_id_prc1( rtems_id *queue_id );
rtems_status_code get_message_queue_id_prc2( rtems_id *queue_id );
+void update_queue_max_count( rtems_id queue_id, unsigned char*fifo_size_max );
+void init_ring(ring_node ring[], unsigned char nbNodes, volatile int buffer[], unsigned int bufferSize );
//
int start_recv_send_tasks( void );
//
diff --git a/header/fsw_misc.h b/header/fsw_misc.h
--- a/header/fsw_misc.h
+++ b/header/fsw_misc.h
@@ -45,4 +45,10 @@ extern ring_node *ring_node_to_send_cwf_
extern ring_node waveform_ring_f3[];
extern unsigned short sequenceCounterHK;
+extern unsigned char hk_lfr_q_sd_fifo_size_max;
+extern unsigned char hk_lfr_q_rv_fifo_size_max;
+extern unsigned char hk_lfr_q_p0_fifo_size_max;
+extern unsigned char hk_lfr_q_p1_fifo_size_max;
+extern unsigned char hk_lfr_q_p2_fifo_size_max;
+
#endif // FSW_MISC_H_INCLUDED
diff --git a/header/fsw_spacewire.h b/header/fsw_spacewire.h
--- a/header/fsw_spacewire.h
+++ b/header/fsw_spacewire.h
@@ -11,6 +11,7 @@
#include "fsw_params.h"
#include "tc_handler.h"
+#include "fsw_init.h"
extern spw_stats spacewire_stats;
extern spw_stats spacewire_stats_backup;
diff --git a/header/processing/avf0_prc0.h b/header/processing/avf0_prc0.h
--- a/header/processing/avf0_prc0.h
+++ b/header/processing/avf0_prc0.h
@@ -3,6 +3,7 @@
#include "fsw_processing.h"
#include "basic_parameters.h"
+#include "fsw_init.h"
typedef struct {
unsigned int norm_bp1;
diff --git a/header/processing/avf1_prc1.h b/header/processing/avf1_prc1.h
--- a/header/processing/avf1_prc1.h
+++ b/header/processing/avf1_prc1.h
@@ -3,6 +3,7 @@
#include "fsw_processing.h"
#include "basic_parameters.h"
+#include "fsw_init.h"
typedef struct {
unsigned int norm_bp1;
diff --git a/header/processing/avf2_prc2.h b/header/processing/avf2_prc2.h
--- a/header/processing/avf2_prc2.h
+++ b/header/processing/avf2_prc2.h
@@ -3,6 +3,7 @@
#include "fsw_processing.h"
#include "basic_parameters.h"
+#include "fsw_init.h"
typedef struct {
unsigned int norm_bp1;
diff --git a/header/processing/fsw_processing.h b/header/processing/fsw_processing.h
--- a/header/processing/fsw_processing.h
+++ b/header/processing/fsw_processing.h
@@ -10,7 +10,6 @@
#include
#include "fsw_params.h"
-#include "fsw_spacewire.h"
typedef struct ring_node_asm
{
@@ -72,7 +71,7 @@ typedef struct
unsigned char data[ 117 ]; // 13 bins * 9 Bytes only for TM_LFR_SCIENCE_NORMAL_BP1_F0 and F1
} bp_packet_with_spare;
-typedef struct
+typedef struct asm_msg
{
ring_node_asm *norm;
ring_node_asm *burst_sbm;
diff --git a/header/tc_handler.h b/header/tc_handler.h
--- a/header/tc_handler.h
+++ b/header/tc_handler.h
@@ -12,9 +12,6 @@
#include "lfr_cpu_usage_report.h"
-// MODE PARAMETERS
-extern unsigned int maxCount;
-
//****
// ISR
rtems_isr commutation_isr1( rtems_vector_number vector );
diff --git a/header/wf_handler.h b/header/wf_handler.h
--- a/header/wf_handler.h
+++ b/header/wf_handler.h
@@ -7,8 +7,7 @@
#include
#include
-#include "fsw_spacewire.h"
-#include "fsw_misc.h"
+#include "fsw_init.h"
#include "fsw_params_wf_handler.h"
#define pi 3.14159265359
diff --git a/python_scripts/EQM_reload_sw.py b/python_scripts/EQM_reload_sw.py
new file mode 100644
--- /dev/null
+++ b/python_scripts/EQM_reload_sw.py
@@ -0,0 +1,17 @@
+# LOAD FSW USING LINK 1
+SpwPlugin0.StarDundeeSelectLinkNumber( 1 )
+
+APB_UART_PLUGIN0.setFifoDebugEnabled( 0 )
+
+dsu3plugin0.openFile("/opt/DEV_PLE/EQM/bin/eqm")
+dsu3plugin0.loadFile()
+
+dsu3plugin0.run()
+
+APB_UART_PLUGIN0.setFifoDebugEnabled( 1 )
+
+# START SENDING TIMECODES AT 1 Hz
+SpwPlugin0.StarDundeeStartTimecodes( 1 )
+
+# it is possible to change the time code frequency
+#RMAPPlugin0.changeTimecodeFrequency(2)
diff --git a/python_scripts/EQM_setup.py b/python_scripts/EQM_setup.py
new file mode 100644
--- /dev/null
+++ b/python_scripts/EQM_setup.py
@@ -0,0 +1,34 @@
+import time
+
+proxy.loadSysDriver("SpwPlugin","SpwPlugin0")
+SpwPlugin0.selectBridge("STAR-Dundee Spw USB Brick")
+
+proxy.loadSysDriverToParent("dsu3plugin","SpwPlugin0")
+proxy.loadSysDriverToParent("LFRControlPlugin","SpwPlugin0")
+
+proxy.loadSysDriverToParent("APB_UART_PLUGIN","SpwPlugin0")
+APB_UART_PLUGIN0.setFifoDebugEnabled( 1 )
+
+availableBrickCount = SpwPlugin0.StarDundeeGetAvailableBrickCount()
+print str(availableBrickCount) + " SpaceWire brick(s) found"
+
+SpwPlugin0.StarDundeeSelectBrick(1)
+SpwPlugin0.StarDundeeSetBrickAsARouter(1)
+SpwPlugin0.StarDundeeSelectLinkNumber( 1 )
+SpwPlugin0.connectBridge()
+
+#SpwPlugin0.TCPServerSetIP("127.0.0.1")
+SpwPlugin0.TCPServerConnect()
+
+# OPEN SPACEWIRE SERVER
+#LFRControlPlugin0.SetSpwServerIP(129,104,27,164)
+LFRControlPlugin0.TCPServerConnect()
+
+# OPEN TM ECHO BRIDGE SERVER
+LFRControlPlugin0.TMEchoBridgeOpenPort()
+
+# START SENDING TIMECODES AT 1 Hz
+SpwPlugin0.StarDundeeStartTimecodes( 1 )
+
+# it is possible to change the time code frequency
+#RMAPPlugin0.changeTimecodeFrequency(2)
diff --git a/python_scripts/EQM_setup_and_sw.py b/python_scripts/EQM_setup_and_sw.py
new file mode 100644
--- /dev/null
+++ b/python_scripts/EQM_setup_and_sw.py
@@ -0,0 +1,34 @@
+#!/usr/bin/lppmon -e
+
+import time
+
+proxy.loadSysDriver("SpwPlugin","SpwPlugin0")
+SpwPlugin0.selectBridge("STAR-Dundee Spw USB Brick")
+
+proxy.loadSysDriverToParent("dsu3plugin","SpwPlugin0")
+proxy.loadSysDriverToParent("LFRControlPlugin","SpwPlugin0")
+
+proxy.loadSysDriverToParent("APB_UART_PLUGIN","SpwPlugin0")
+APB_UART_PLUGIN0.setFifoDebugEnabled( 0 )
+
+availableBrickCount = SpwPlugin0.StarDundeeGetAvailableBrickCount()
+print "availableBrickCount = ", availableBrickCount
+
+SpwPlugin0.StarDundeeSelectBrick(1)
+SpwPlugin0.StarDundeeSetBrickAsARouter(1)
+SpwPlugin0.connectBridge()
+
+#SpwPlugin0.TCPServerSetIP("127.0.0.1")
+SpwPlugin0.TCPServerConnect()
+
+#LFRControlPlugin0.SetSpwServerIP(129,104,27,164)
+LFRControlPlugin0.TCPServerConnect()
+
+dsu3plugin0.openFile("/opt/DEV_PLE/EQM/bin/eqm")
+dsu3plugin0.loadFile()
+dsu3plugin0.run()
+
+APB_UART_PLUGIN0.setFifoDebugEnabled( 1 )
+
+LFRControlPlugin0.TMEchoBridgeOpenPort()
+
diff --git a/python_scripts/LFRControlPlugin_reload_fsw 2-0-2-3.py b/python_scripts/LFRControlPlugin_reload_fsw 2-0-2-3.py
new file mode 100644
--- /dev/null
+++ b/python_scripts/LFRControlPlugin_reload_fsw 2-0-2-3.py
@@ -0,0 +1,13 @@
+# LOAD FSW USING LINK 1
+SpwPlugin0.StarDundeeSelectLinkNumber( 1 )
+
+dsu3plugin0.openFile("/opt/LFR/LFR-FSW/2.0.2.3/fsw")
+dsu3plugin0.loadFile()
+
+dsu3plugin0.run()
+
+# START SENDING TIMECODES AT 1 Hz
+SpwPlugin0.StarDundeeStartTimecodes( 1 )
+
+# it is possible to change the time code frequency
+#RMAPPlugin0.changeTimecodeFrequency(2)
diff --git a/python_scripts/LFRControlPlugin_setup.py b/python_scripts/LFRControlPlugin_setup.py
--- a/python_scripts/LFRControlPlugin_setup.py
+++ b/python_scripts/LFRControlPlugin_setup.py
@@ -11,7 +11,7 @@ print str(availableBrickCount) + " Space
SpwPlugin0.StarDundeeSelectBrick(1)
SpwPlugin0.StarDundeeSetBrickAsARouter(1)
-SpwPlugin0.StarDundeeSelectLinkNumber( 2 )
+SpwPlugin0.StarDundeeSelectLinkNumber( 1 )
SpwPlugin0.connectBridge()
#SpwPlugin0.TCPServerSetIP("127.0.0.1")
diff --git a/python_scripts/dsu3plugin0_reload_fsw.py b/python_scripts/dsu3plugin0_reload_fsw.py
new file mode 100644
--- /dev/null
+++ b/python_scripts/dsu3plugin0_reload_fsw.py
@@ -0,0 +1,5 @@
+dsu3plugin0.openFile("/opt/DEV_PLE/FSW-qt/bin/fsw")
+dsu3plugin0.loadFile()
+
+dsu3plugin0.run()
+
diff --git a/python_scripts/scrub.py b/python_scripts/scrub.py
new file mode 100644
--- /dev/null
+++ b/python_scripts/scrub.py
@@ -0,0 +1,83 @@
+#from PyQt4 import QtGui
+#from PyQt4 import QtCore
+#from PyQt4 import Qt
+import sys
+def elfSize(FileName,section):
+ bashCommand = "/usr/bin/size "+ FileName
+ import subprocess
+ process = subprocess.Popen(bashCommand.split(), stdout=subprocess.PIPE)
+ result = process.communicate()[0].split("\n")
+ header = result[0].lstrip()
+ line1 = result[1].lstrip()
+ hcolumns=header.split()
+ columns=line1.split()
+ for i in range(0,len(hcolumns)):
+ if(hcolumns[i].find(section) != -1):
+ return int(columns[i])
+ return 0;
+
+
+def elfAddress(FileName,section):
+ bashCommand = "readelf -S " + FileName
+ import subprocess
+ process = subprocess.Popen(bashCommand.split(), stdout=subprocess.PIPE)
+ result = process.communicate()[0].split()
+ for i in range(0,len(result)):
+ if(result[i].find('.'+section) != -1):
+ return int("0x"+result[i+2],16)
+ return 0;
+
+def compare(data1,data2):
+ if len(data1)!=len(data2):
+ return [-1,-1]
+ for i in range(len(data1)):
+ if data1[i]!=data2[i]:
+ return [-1,i]
+ return [1,-1]
+
+def cycles(rootPlugin,textAddress,textSize,orgiData,count):
+ for i in range(count):
+ rootPlugin.dumpMemory(textAddress,textSize/4,"/opt/dump"+str(i)+".srec","srec")
+ data = rootPlugin.Read(textAddress,textSize/4)
+ result = compare(data,orgiData)
+ if(result[0]==1):
+ print("test number "+str(i)+" = success")
+ else:
+ print("test number "+str(i)+" = error @0x" + hex(textAddress + result[1]))
+
+
+#app = QtGui.QApplication(sys.argv)
+fileName = QtGui.QFileDialog.getOpenFileName()
+
+if PySocExplorer.ElfFile.isElf(fileName):
+ proxy.loadSysDriver("SpwPlugin","SpwPlugin0")
+ SpwPlugin0.selectBridge("STAR-Dundee Spw USB Brick")
+
+ proxy.loadSysDriverToParent("dsu3plugin","SpwPlugin0")
+ proxy.loadSysDriverToParent("LFRControlPlugin","SpwPlugin0")
+ SpwPlugin0.TCPServerConnect()
+ LFRControlPlugin0.TCPServerConnect()
+ proxy.loadSysDriverToParent("APB_UART_PLUGIN","SpwPlugin0")
+ availableBrickCount = SpwPlugin0.StarDundeeGetAvailableBrickCount()
+ print(str(availableBrickCount) + " SpaceWire brick(s) found")
+
+ SpwPlugin0.StarDundeeSelectBrick(1)
+ SpwPlugin0.StarDundeeSetBrickAsARouter(1)
+ SpwPlugin0.connectBridge()
+ APB_UART_PLUGIN0.setUARTPortNane("/dev/ttyUSB1")
+ APB_UART_PLUGIN0.setUARTPortSpeed(38400)
+ APB_UART_PLUGIN0.openUart()
+ textSize= elfSize(fileName,"text")
+ textAddress= elfAddress(fileName,"text")
+ print "Found text section@" + hex(textAddress)+ " of " + str(textSize) +" bytes"
+ print "loading software"
+ dsu3plugin0.openFile(fileName)
+ dsu3plugin0.loadFile()
+ SpwPlugin0.dumpMemory(textAddress,textSize/4,"/opt/dumpOrig.srec","srec")
+ dsu3plugin0.run()
+ orgiData = SpwPlugin0.Read(textAddress,textSize/4)
+ orgiData = SpwPlugin0.Read(textAddress,textSize/4)
+
+
+
+
diff --git a/src/fsw_globals.c b/src/fsw_globals.c
--- a/src/fsw_globals.c
+++ b/src/fsw_globals.c
@@ -26,7 +26,6 @@
rtems_name misc_name[5];
rtems_name Task_name[20]; /* array of task names */
rtems_id Task_id[20]; /* array of task ids */
-unsigned int maxCount;
int fdSPW = 0;
int fdUART = 0;
unsigned char lfrCurrentMode;
@@ -61,6 +60,12 @@ struct param_local_str param_local;
// HK PACKETS
Packet_TM_LFR_HK_t housekeeping_packet;
+// message queues occupancy
+unsigned char hk_lfr_q_sd_fifo_size_max;
+unsigned char hk_lfr_q_rv_fifo_size_max;
+unsigned char hk_lfr_q_p0_fifo_size_max;
+unsigned char hk_lfr_q_p1_fifo_size_max;
+unsigned char hk_lfr_q_p2_fifo_size_max;
// sequence counters are incremented by APID (PID + CAT) and destination ID
unsigned short sequenceCounters_SCIENCE_NORMAL_BURST;
unsigned short sequenceCounters_SCIENCE_SBM1_SBM2;
diff --git a/src/fsw_init.c b/src/fsw_init.c
--- a/src/fsw_init.c
+++ b/src/fsw_init.c
@@ -60,6 +60,7 @@
#include "fsw_init.h"
#include "fsw_config.c"
+#include "GscMemoryLPP.hpp"
void initCache()
{
@@ -812,3 +813,57 @@ rtems_status_code get_message_queue_id_p
return status;
}
+
+void update_queue_max_count( rtems_id queue_id, unsigned char*fifo_size_max )
+{
+ u_int32_t count;
+ rtems_status_code status;
+
+ status = rtems_message_queue_get_number_pending( queue_id, &count );
+
+ count = count + 1;
+
+ if (status != RTEMS_SUCCESSFUL)
+ {
+ PRINTF1("in update_queue_max_count *** ERR = %d\n", status)
+ }
+ else
+ {
+ if (count > *fifo_size_max)
+ {
+ *fifo_size_max = count;
+ }
+ }
+}
+
+void init_ring(ring_node ring[], unsigned char nbNodes, volatile int buffer[], unsigned int bufferSize )
+{
+ unsigned char i;
+
+ //***************
+ // BUFFER ADDRESS
+ for(i=0; i> 8);
- housekeeping_packet.packetID[1] = (unsigned char) (APID_TM_HK);
- housekeeping_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
- housekeeping_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
- housekeeping_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8);
- housekeeping_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK );
- housekeeping_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
- housekeeping_packet.serviceType = TM_TYPE_HK;
- housekeeping_packet.serviceSubType = TM_SUBTYPE_HK;
- housekeeping_packet.destinationID = TM_DESTINATION_ID_GROUND;
- housekeeping_packet.sid = SID_HK;
-
status = rtems_rate_monotonic_cancel(HK_id);
if( status != RTEMS_SUCCESSFUL ) {
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
spacewire_update_statistics();
+ housekeeping_packet.hk_lfr_q_sd_fifo_size_max = hk_lfr_q_sd_fifo_size_max;
+ housekeeping_packet.hk_lfr_q_rv_fifo_size_max = hk_lfr_q_rv_fifo_size_max;
+ housekeeping_packet.hk_lfr_q_p0_fifo_size_max = hk_lfr_q_p0_fifo_size_max;
+ housekeeping_packet.hk_lfr_q_p1_fifo_size_max = hk_lfr_q_p1_fifo_size_max;
+ housekeeping_packet.hk_lfr_q_p2_fifo_size_max = hk_lfr_q_p2_fifo_size_max;
+
housekeeping_packet.sy_lfr_common_parameters_spare = parameter_dump_packet.sy_lfr_common_parameters_spare;
housekeeping_packet.sy_lfr_common_parameters = parameter_dump_packet.sy_lfr_common_parameters;
get_temperatures( housekeeping_packet.hk_lfr_temp_scm );
@@ -314,12 +304,33 @@ void init_housekeeping_parameters( void
unsigned int i = 0;
unsigned char *parameters;
+ unsigned char sizeOfHK;
- parameters = (unsigned char*) &housekeeping_packet.lfr_status_word;
- for(i = 0; i< SIZE_HK_PARAMETERS; i++)
+ sizeOfHK = sizeof( Packet_TM_LFR_HK_t );
+
+ parameters = (unsigned char*) &housekeeping_packet;
+
+ for(i = 0; i< sizeOfHK; i++)
{
parameters[i] = 0x00;
}
+
+ housekeeping_packet.targetLogicalAddress = CCSDS_DESTINATION_ID;
+ housekeeping_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID;
+ housekeeping_packet.reserved = DEFAULT_RESERVED;
+ housekeeping_packet.userApplication = CCSDS_USER_APP;
+ housekeeping_packet.packetID[0] = (unsigned char) (APID_TM_HK >> 8);
+ housekeeping_packet.packetID[1] = (unsigned char) (APID_TM_HK);
+ housekeeping_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
+ housekeeping_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
+ housekeeping_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8);
+ housekeeping_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK );
+ housekeeping_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
+ housekeeping_packet.serviceType = TM_TYPE_HK;
+ housekeeping_packet.serviceSubType = TM_SUBTYPE_HK;
+ housekeeping_packet.destinationID = TM_DESTINATION_ID_GROUND;
+ housekeeping_packet.sid = SID_HK;
+
// init status word
housekeeping_packet.lfr_status_word[0] = DEFAULT_STATUS_WORD_BYTE0;
housekeeping_packet.lfr_status_word[1] = DEFAULT_STATUS_WORD_BYTE1;
@@ -333,6 +344,12 @@ void init_housekeeping_parameters( void
housekeeping_packet.lfr_fpga_version[0] = parameters[1]; // n1
housekeeping_packet.lfr_fpga_version[1] = parameters[2]; // n2
housekeeping_packet.lfr_fpga_version[2] = parameters[3]; // n3
+
+ housekeeping_packet.hk_lfr_q_sd_fifo_size = MSG_QUEUE_COUNT_SEND;
+ housekeeping_packet.hk_lfr_q_rv_fifo_size = MSG_QUEUE_COUNT_RECV;
+ housekeeping_packet.hk_lfr_q_p0_fifo_size = MSG_QUEUE_COUNT_PRC0;
+ housekeeping_packet.hk_lfr_q_p1_fifo_size = MSG_QUEUE_COUNT_PRC1;
+ housekeeping_packet.hk_lfr_q_p2_fifo_size = MSG_QUEUE_COUNT_PRC2;
}
void increment_seq_counter( unsigned short *packetSequenceControl )
diff --git a/src/fsw_spacewire.c b/src/fsw_spacewire.c
--- a/src/fsw_spacewire.c
+++ b/src/fsw_spacewire.c
@@ -71,7 +71,7 @@ rtems_task spiq_task(rtems_task_argument
status = spacewire_stop_and_start_link( fdSPW ); // start the link
if ( status != RTEMS_SUCCESSFUL)
{
- PRINTF1("in SPIQ *** ERR spacewire_start_link %d\n", status)
+ PRINTF1("in SPIQ *** ERR spacewire_stop_and_start_link %d\n", status)
}
}
@@ -89,10 +89,6 @@ rtems_task spiq_task(rtems_task_argument
}
else // [3.b] the link is not in run state, go in STANDBY mode
{
- status = stop_current_mode();
- if ( status != RTEMS_SUCCESSFUL ) {
- PRINTF1("in SPIQ *** ERR stop_current_mode *** code %d\n", status)
- }
status = enter_mode( LFR_MODE_STANDBY, 0 );
if ( status != RTEMS_SUCCESSFUL ) {
PRINTF1("in SPIQ *** ERR enter_standby_mode *** code %d\n", status)
@@ -191,6 +187,9 @@ rtems_task recv_task( rtems_task_argumen
}
}
}
+
+ update_queue_max_count( queue_recv_id, &hk_lfr_q_rv_fifo_size_max );
+
}
}
@@ -215,8 +214,7 @@ rtems_task send_task( rtems_task_argumen
char *charPtr;
spw_ioctl_pkt_send *spw_ioctl_send;
size_t size; // size of the incoming TC packet
- u_int32_t count;
- rtems_id queue_id;
+ rtems_id queue_send_id;
unsigned int sid;
incomingRingNodePtr = NULL;
@@ -228,7 +226,7 @@ rtems_task send_task( rtems_task_argumen
init_header_swf( &headerSWF );
init_header_asm( &headerASM );
- status = get_message_queue_id_send( &queue_id );
+ status = get_message_queue_id_send( &queue_send_id );
if (status != RTEMS_SUCCESSFUL)
{
PRINTF1("in HOUS *** ERR get_message_queue_id_send %d\n", status)
@@ -238,7 +236,7 @@ rtems_task send_task( rtems_task_argumen
while(1)
{
- status = rtems_message_queue_receive( queue_id, incomingData, &size,
+ status = rtems_message_queue_receive( queue_send_id, incomingData, &size,
RTEMS_WAIT, RTEMS_NO_TIMEOUT );
if (status!=RTEMS_SUCCESSFUL)
@@ -315,18 +313,8 @@ rtems_task send_task( rtems_task_argumen
}
}
- status = rtems_message_queue_get_number_pending( queue_id, &count );
- if (status != RTEMS_SUCCESSFUL)
- {
- PRINTF1("in SEND *** (3) ERR = %d\n", status)
- }
- else
- {
- if (count > maxCount)
- {
- maxCount = count;
- }
- }
+ update_queue_max_count( queue_send_id, &hk_lfr_q_sd_fifo_size_max );
+
}
}
diff --git a/src/processing/avf0_prc0.c b/src/processing/avf0_prc0.c
--- a/src/processing/avf0_prc0.c
+++ b/src/processing/avf0_prc0.c
@@ -352,6 +352,9 @@ rtems_task prc0_task( rtems_task_argumen
// change asm ring node
current_ring_node_to_send_asm_f0 = current_ring_node_to_send_asm_f0->next;
}
+
+ update_queue_max_count( queue_id_q_p0, &hk_lfr_q_p0_fifo_size_max );
+
}
}
diff --git a/src/processing/avf1_prc1.c b/src/processing/avf1_prc1.c
--- a/src/processing/avf1_prc1.c
+++ b/src/processing/avf1_prc1.c
@@ -347,6 +347,8 @@ rtems_task prc1_task( rtems_task_argumen
current_ring_node_to_send_asm_f1 = current_ring_node_to_send_asm_f1->next;
}
+ update_queue_max_count( queue_id_q_p1, &hk_lfr_q_p1_fifo_size_max );
+
}
}
diff --git a/src/processing/avf2_prc2.c b/src/processing/avf2_prc2.c
--- a/src/processing/avf2_prc2.c
+++ b/src/processing/avf2_prc2.c
@@ -246,6 +246,8 @@ rtems_task prc2_task( rtems_task_argumen
current_ring_node_to_send_asm_f2 = current_ring_node_to_send_asm_f2->next;
}
+ update_queue_max_count( queue_id_q_p2, &hk_lfr_q_p2_fifo_size_max );
+
}
}
diff --git a/src/processing/fsw_processing.c b/src/processing/fsw_processing.c
--- a/src/processing/fsw_processing.c
+++ b/src/processing/fsw_processing.c
@@ -9,6 +9,7 @@
#include "fsw_processing.h"
#include "fsw_processing_globals.c"
+#include "fsw_init.h"
unsigned int nb_sm_f0;
unsigned int nb_sm_f0_aux_f1;
diff --git a/src/tc_handler.c b/src/tc_handler.c
--- a/src/tc_handler.c
+++ b/src/tc_handler.c
@@ -533,7 +533,6 @@ int enter_mode( unsigned char mode, unsi
{
#ifdef PRINT_TASK_STATISTICS
rtems_cpu_usage_reset();
- maxCount = 0;
#endif
status = restart_science_tasks( mode );
launch_spectral_matrix( );
@@ -550,7 +549,6 @@ int enter_mode( unsigned char mode, unsi
PRINTF("stack report selected\n")
rtems_stack_checker_report_usage();
#endif
- PRINTF1("maxCount = %d\n", maxCount)
}
else
{
@@ -673,81 +671,121 @@ int suspend_science_tasks()
printf("in suspend_science_tasks\n");
status = rtems_task_suspend( Task_id[TASKID_AVF0] ); // suspend AVF0
- if (status != RTEMS_SUCCESSFUL)
+ if ((status != RTEMS_SUCCESSFUL) && (status != RTEMS_ALREADY_SUSPENDED))
{
PRINTF1("in suspend_science_task *** AVF0 ERR %d\n", status)
}
+ else
+ {
+ status = RTEMS_SUCCESSFUL;
+ }
if (status == RTEMS_SUCCESSFUL) // suspend PRC0
{
status = rtems_task_suspend( Task_id[TASKID_PRC0] );
- if (status != RTEMS_SUCCESSFUL)
+ if ((status != RTEMS_SUCCESSFUL) && (status != RTEMS_ALREADY_SUSPENDED))
{
PRINTF1("in suspend_science_task *** PRC0 ERR %d\n", status)
}
+ else
+ {
+ status = RTEMS_SUCCESSFUL;
+ }
}
if (status == RTEMS_SUCCESSFUL) // suspend AVF1
{
status = rtems_task_suspend( Task_id[TASKID_AVF1] );
- if (status != RTEMS_SUCCESSFUL)
+ if ((status != RTEMS_SUCCESSFUL) && (status != RTEMS_ALREADY_SUSPENDED))
{
PRINTF1("in suspend_science_task *** AVF1 ERR %d\n", status)
}
+ else
+ {
+ status = RTEMS_SUCCESSFUL;
+ }
}
if (status == RTEMS_SUCCESSFUL) // suspend PRC1
{
status = rtems_task_suspend( Task_id[TASKID_PRC1] );
- if (status != RTEMS_SUCCESSFUL)
+ if ((status != RTEMS_SUCCESSFUL) && (status != RTEMS_ALREADY_SUSPENDED))
{
PRINTF1("in suspend_science_task *** PRC1 ERR %d\n", status)
}
+ else
+ {
+ status = RTEMS_SUCCESSFUL;
+ }
}
if (status == RTEMS_SUCCESSFUL) // suspend AVF2
{
status = rtems_task_suspend( Task_id[TASKID_AVF2] );
- if (status != RTEMS_SUCCESSFUL)
+ if ((status != RTEMS_SUCCESSFUL) && (status != RTEMS_ALREADY_SUSPENDED))
{
PRINTF1("in suspend_science_task *** AVF2 ERR %d\n", status)
}
+ else
+ {
+ status = RTEMS_SUCCESSFUL;
+ }
}
if (status == RTEMS_SUCCESSFUL) // suspend PRC2
{
status = rtems_task_suspend( Task_id[TASKID_PRC2] );
- if (status != RTEMS_SUCCESSFUL)
+ if ((status != RTEMS_SUCCESSFUL) && (status != RTEMS_ALREADY_SUSPENDED))
{
PRINTF1("in suspend_science_task *** PRC2 ERR %d\n", status)
}
+ else
+ {
+ status = RTEMS_SUCCESSFUL;
+ }
}
if (status == RTEMS_SUCCESSFUL) // suspend WFRM
{
status = rtems_task_suspend( Task_id[TASKID_WFRM] );
- if (status != RTEMS_SUCCESSFUL)
+ if ((status != RTEMS_SUCCESSFUL) && (status != RTEMS_ALREADY_SUSPENDED))
{
PRINTF1("in suspend_science_task *** WFRM ERR %d\n", status)
}
+ else
+ {
+ status = RTEMS_SUCCESSFUL;
+ }
}
if (status == RTEMS_SUCCESSFUL) // suspend CWF3
{
status = rtems_task_suspend( Task_id[TASKID_CWF3] );
- if (status != RTEMS_SUCCESSFUL)
+ if ((status != RTEMS_SUCCESSFUL) && (status != RTEMS_ALREADY_SUSPENDED))
{
PRINTF1("in suspend_science_task *** CWF3 ERR %d\n", status)
}
+ else
+ {
+ status = RTEMS_SUCCESSFUL;
+ }
}
if (status == RTEMS_SUCCESSFUL) // suspend CWF2
{
status = rtems_task_suspend( Task_id[TASKID_CWF2] );
- if (status != RTEMS_SUCCESSFUL)
+ if ((status != RTEMS_SUCCESSFUL) && (status != RTEMS_ALREADY_SUSPENDED))
{
PRINTF1("in suspend_science_task *** CWF2 ERR %d\n", status)
}
+ else
+ {
+ status = RTEMS_SUCCESSFUL;
+ }
}
if (status == RTEMS_SUCCESSFUL) // suspend CWF1
{
status = rtems_task_suspend( Task_id[TASKID_CWF1] );
- if (status != RTEMS_SUCCESSFUL)
+ if ((status != RTEMS_SUCCESSFUL) && (status != RTEMS_ALREADY_SUSPENDED))
{
PRINTF1("in suspend_science_task *** CWF1 ERR %d\n", status)
}
+ else
+ {
+ status = RTEMS_SUCCESSFUL;
+ }
}
return status;
diff --git a/src/wf_handler.c b/src/wf_handler.c
--- a/src/wf_handler.c
+++ b/src/wf_handler.c
@@ -697,6 +697,8 @@ rtems_task cwf1_task(rtems_task_argument
ring_node_to_send_cwf = getRingNodeToSendCWF( 1 );
ring_node_to_send_cwf_f1->sid = SID_SBM1_CWF_F1;
status = rtems_message_queue_send( queue_id, &ring_node_to_send_cwf, sizeof( ring_node* ) );
+ if (status != 0)
+ printf("cwf sending failed\n");
// launch snapshot extraction if needed
if (extractSWF == true)
{
@@ -778,38 +780,6 @@ void WFP_init_rings( void )
}
-void init_ring(ring_node ring[], unsigned char nbNodes, volatile int buffer[], unsigned int bufferSize )
-{
- unsigned char i;
-
- //***************
- // BUFFER ADDRESS
- for(i=0; i