# HG changeset patch
# User paul
# Date 2014-11-06 15:05:00
# Node ID 13f27d43af3293d85afa8bb522b097895e2e4331
# Parent 3efd0a6e1344b9328263116511fc3c85518bd737
The flight software is now compatible with the VHDL 0.1.32
Still some bugs at startup, may be due to the VHDL
diff --git a/FSW-qt/Makefile b/FSW-qt/Makefile
--- a/FSW-qt/Makefile
+++ b/FSW-qt/Makefile
@@ -1,6 +1,6 @@
#############################################################################
# Makefile for building: bin/fsw
-# Generated by qmake (2.01a) (Qt 4.8.6) on: Fri Oct 24 13:25:08 2014
+# Generated by qmake (2.01a) (Qt 4.8.6) on: Thu Nov 6 16:03:39 2014
# Project: fsw-qt.pro
# Template: app
# Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
@@ -10,13 +10,13 @@
CC = sparc-rtems-gcc
CXX = sparc-rtems-g++
-DEFINES = -DSW_VERSION_N1=2 -DSW_VERSION_N2=0 -DSW_VERSION_N3=1 -DSW_VERSION_N4=1 -DLPP_DPU_DESTID -DPRINT_MESSAGES_ON_CONSOLE
-CFLAGS = -pipe -O3 -fprofile-arcs -ftest-coverage -Wall $(DEFINES)
+DEFINES = -DSW_VERSION_N1=2 -DSW_VERSION_N2=0 -DSW_VERSION_N3=1 -DSW_VERSION_N4=1 -DLPP_DPU_DESTID -DPRINT_MESSAGES_ON_CONSOLE -DPRINT_TASK_STATISTICS
+CFLAGS = -pipe -O3 -Wall $(DEFINES)
CXXFLAGS = -pipe -O3 -Wall $(DEFINES)
INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header -I../header/processing -I../src/LFR_basic-parameters
LINK = sparc-rtems-g++
LFLAGS =
-LIBS = $(SUBLIBS) -lgcov /opt/GCOV/01A/lib/overload.o -lc
+LIBS = $(SUBLIBS)
AR = sparc-rtems-ar rcs
RANLIB =
QMAKE = /usr/bin/qmake-qt4
diff --git a/FSW-qt/fsw-qt.pro b/FSW-qt/fsw-qt.pro
--- a/FSW-qt/fsw-qt.pro
+++ b/FSW-qt/fsw-qt.pro
@@ -2,7 +2,7 @@ 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
+CONFIG += console verbose lpp_dpu_destid cpu_usage_report
CONFIG -= qt
include(./sparc.pri)
@@ -15,9 +15,8 @@ DEFINES += SW_VERSION_N3=1 # patch
DEFINES += SW_VERSION_N4=1 # internal
#
-QMAKE_CFLAGS_RELEASE += -fprofile-arcs -ftest-coverage
-#QMAKE_LFLAGS_RELEASE +=
-LIBS += -lgcov /opt/GCOV/01A/lib/overload.o -lc
+#QMAKE_CFLAGS_RELEASE += -fprofile-arcs -ftest-coverage
+#LIBS += -lgcov /opt/GCOV/01A/lib/overload.o -lc
#
#
diff --git a/FSW-qt/fsw-qt.pro.user b/FSW-qt/fsw-qt.pro.user
--- a/FSW-qt/fsw-qt.pro.user
+++ b/FSW-qt/fsw-qt.pro.user
@@ -1,6 +1,6 @@
-
+
EnvironmentId
diff --git a/header/fsw_misc.h b/header/fsw_misc.h
--- a/header/fsw_misc.h
+++ b/header/fsw_misc.h
@@ -33,13 +33,15 @@ void increment_seq_counter(unsigned shor
void getTime( unsigned char *time);
unsigned long long int getTimeAsUnsignedLongLongInt( );
void send_dumb_hk( void );
-void get_v_e1_e2_f3 (unsigned char *spacecraft_potential);
+void get_v_e1_e2_f3(unsigned char *spacecraft_potential);
+void get_v_e1_e2_f3_alt(unsigned char *spacecraft_potential);
void get_cpu_load( unsigned char *resource_statistics );
extern int sched_yield( void );
extern void rtems_cpu_usage_reset();
extern ring_node *current_ring_node_f3;
extern ring_node *ring_node_to_send_cwf_f3;
+extern ring_node waveform_ring_f3[];
extern unsigned short sequenceCounterHK;
#endif // FSW_MISC_H_INCLUDED
diff --git a/header/fsw_params.h b/header/fsw_params.h
--- a/header/fsw_params.h
+++ b/header/fsw_params.h
@@ -13,11 +13,11 @@
typedef struct ring_node
{
struct ring_node *previous;
+ struct ring_node *next;
+ unsigned int coarseTime;
+ unsigned int fineTime;
int buffer_address;
- struct ring_node *next;
unsigned int status;
- unsigned coarseTime;
- unsigned int fineTime;
} ring_node;
//************************
diff --git a/header/grlib_regs.h b/header/grlib_regs.h
--- a/header/grlib_regs.h
+++ b/header/grlib_regs.h
@@ -39,7 +39,9 @@ typedef struct {
} gptimer_regs_t;
typedef struct {
- volatile int ctrl; // bit 0 forces the load of the coarse_time_load value and resets the fine_time
+ volatile int ctrl; // bit 0 forces the load of the coarse_time_load value and resets the fine_time
+ // bit 1 is the soft reset for the time management module
+ // bit 2 is the soft reset for the waveform picker and the spectral matrix modules, set to 1 after HW reset
volatile int coarse_time_load;
volatile int coarse_time;
volatile int fine_time;
@@ -68,24 +70,24 @@ typedef struct{
int start_date; // 0x48
//
volatile unsigned int f0_0_coarse_time; // 0x4c
- volatile unsigned int f0_0_fine_time; // 0x50
- volatile unsigned int f0_1_coarse_time; // 0x54
- volatile unsigned int f0_1_fine_time; // 0x58
+ volatile unsigned int f0_0_fine_time; // 0x50
+ volatile unsigned int f0_1_coarse_time; // 0x54
+ volatile unsigned int f0_1_fine_time; // 0x58
//
- volatile unsigned int f1_0_coarse_time; // 0x5c
- volatile unsigned int f1_0_fine_time; // 0x60
- volatile unsigned int f1_1_coarse_time; // 0x64
- volatile unsigned int f1_1_fine_time; // 0x68
+ volatile unsigned int f1_0_coarse_time; // 0x5c
+ volatile unsigned int f1_0_fine_time; // 0x60
+ volatile unsigned int f1_1_coarse_time; // 0x64
+ volatile unsigned int f1_1_fine_time; // 0x68
//
- volatile unsigned int f2_0_coarse_time; // 0x6c
- volatile unsigned int f2_0_fine_time; // 0x70
- volatile unsigned int f2_1_coarse_time; // 0x74
- volatile unsigned int f2_1_fine_time; // 0x78
+ volatile unsigned int f2_0_coarse_time; // 0x6c
+ volatile unsigned int f2_0_fine_time; // 0x70
+ volatile unsigned int f2_1_coarse_time; // 0x74
+ volatile unsigned int f2_1_fine_time; // 0x78
//
- volatile unsigned int f3_0_coarse_time; // 0x7c
- volatile unsigned int f3_0_fine_time; // 0x80
- volatile unsigned int f3_1_coarse_time; // 0x84
- volatile unsigned int f3_1_fine_time; // 0x88
+ volatile unsigned int f3_0_coarse_time; // 0x7c
+ volatile unsigned int f3_0_fine_time; // 0x80
+ volatile unsigned int f3_1_coarse_time; // 0x84
+ volatile unsigned int f3_1_fine_time; // 0x88
//
unsigned int buffer_length; // 0x8c = buffer length in burst 2688 / 16 = 168
} waveform_picker_regs_0_1_18_t;
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
@@ -96,6 +96,7 @@ void BP_send( char *data,
//******************
// general functions
+void reset_sm_status( void );
void reset_spectral_matrix_regs( void );
void set_time(unsigned char *time, unsigned char *timeInBuffer );
unsigned long long int get_acquisition_time( unsigned char *timePtr );
diff --git a/header/tc_handler.h b/header/tc_handler.h
--- a/header/tc_handler.h
+++ b/header/tc_handler.h
@@ -39,16 +39,18 @@ int check_mode_transition( unsigned char
int check_transition_date( unsigned int transitionCoarseTime );
int stop_current_mode( void );
int enter_mode( unsigned char mode , unsigned int transitionCoarseTime );
-int restart_science_tasks(unsigned char lfrRequestedMode );
+int restart_science_tasks( unsigned char lfrRequestedMode );
int suspend_science_tasks();
-void launch_waveform_picker(unsigned char mode , unsigned int transitionCoarseTime);
+void launch_waveform_picker( unsigned char mode , unsigned int transitionCoarseTime );
void launch_spectral_matrix( void );
void launch_spectral_matrix_simu( void );
-void set_irq_on_new_ready_matrix(unsigned char value );
-void set_run_matrix_spectral( unsigned char value );
+void set_sm_irq_onNewMatrix( unsigned char value );
+void set_sm_irq_onError( unsigned char value );
// other functions
void updateLFRCurrentMode();
+void set_lfr_soft_reset( unsigned char value );
+void reset_lfr( void );
void update_last_TC_exe( ccsdsTelecommandPacket_t *TC , unsigned char *time );
void update_last_TC_rej(ccsdsTelecommandPacket_t *TC , unsigned char *time );
void close_action( ccsdsTelecommandPacket_t *TC, int result, rtems_id queue_id );
diff --git a/header/wf_handler.h b/header/wf_handler.h
--- a/header/wf_handler.h
+++ b/header/wf_handler.h
@@ -59,10 +59,10 @@ int init_header_snapshot_wf_table(
int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF );
int init_header_continuous_cwf3_light_table( Header_TM_LFR_SCIENCE_CWF_t *headerCWF );
//
-int send_waveform_SWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id );
-int send_waveform_CWF( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
-int send_waveform_CWF3( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
-int send_waveform_CWF3_light( volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
+int send_waveform_SWF( ring_node *ring_node_to_send, unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id );
+int send_waveform_CWF( ring_node *ring_node_to_send, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
+int send_waveform_CWF3_light( ring_node *ring_node_to_send, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
+int send_ring_node_CWF( ring_node *ring_node_to_send );
//
void compute_acquisition_time(unsigned int coarseTime, unsigned int fineTime,
unsigned int sid, unsigned char pa_lfr_pkt_nr, unsigned char *acquisitionTime );
@@ -75,7 +75,8 @@ rtems_id get_pkts_queue_id( void );
// wfp registers
// RESET
void reset_wfp_burst_enable( void );
-void reset_wfp_status(void);
+void reset_wfp_status( void );
+void reset_wfp_buffer_addresses( void );
void reset_waveform_picker_regs( void );
// SET
void set_wfp_data_shaping(void);
diff --git a/src/fsw_init.c b/src/fsw_init.c
--- a/src/fsw_init.c
+++ b/src/fsw_init.c
@@ -73,6 +73,8 @@ rtems_task Init( rtems_task_argument ign
unsigned char *vhdlVersion;
+ reset_lfr();
+
reset_local_time();
rtems_cpu_usage_reset();
@@ -245,7 +247,7 @@ void init_local_mode_parameters( void )
void reset_local_time( void )
{
- time_management_regs->ctrl = 0x02; // software reset, coarse time = 0x80000000
+ time_management_regs->ctrl = time_management_regs->ctrl | 0x02; // [0010] software reset, coarse time = 0x80000000
}
void create_names( void ) // create all names for tasks and queues
@@ -464,7 +466,7 @@ int create_all_tasks( void ) // create a
status = rtems_task_create(
Task_name[TASKID_HOUS], TASK_PRIORITY_HOUS, RTEMS_MINIMUM_STACK_SIZE,
RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT,
- RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_HOUS]
+ RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_HOUS]
);
}
diff --git a/src/fsw_misc.c b/src/fsw_misc.c
--- a/src/fsw_misc.c
+++ b/src/fsw_misc.c
@@ -225,7 +225,7 @@ rtems_task hous_task(rtems_task_argument
spacewire_update_statistics();
- get_v_e1_e2_f3( housekeeping_packet.hk_lfr_sc_v_f3 );
+// get_v_e1_e2_f3_alt( housekeeping_packet.hk_lfr_sc_v_f3 );
get_cpu_load( (unsigned char *) &housekeeping_packet.hk_lfr_cpu_load );
// SEND PACKET
@@ -484,12 +484,12 @@ void get_v_e1_e2_f3( unsigned char *spac
else
{
offset_in_samples = 0;
- PRINTF2("ERR *** in get_v_e1_e2_f3 *** coarseTime = %x, acquisitionTime = %x\n", coarseTime, acquisitionTime)
+// PRINTF2("ERR *** in get_v_e1_e2_f3 *** coarseTime = %x, acquisitionTime = %x\n", coarseTime, acquisitionTime)
}
if ( offset_in_samples > (NB_SAMPLES_PER_SNAPSHOT - 1) )
{
- PRINTF1("ERR *** in get_v_e1_e2_f3 *** trying to read out of the buffer, counter = %d\n", offset_in_samples)
+// PRINTF1("ERR *** in get_v_e1_e2_f3 *** trying to read out of the buffer, counter = %d\n", offset_in_samples)
offset_in_samples = NB_SAMPLES_PER_SNAPSHOT -1;
}
offset_in_bytes = TIME_OFFSET_IN_BYTES + offset_in_samples * NB_WORDS_SWF_BLK * 4;
@@ -502,6 +502,111 @@ void get_v_e1_e2_f3( unsigned char *spac
}
}
+void get_v_e1_e2_f3_alt( unsigned char *spacecraft_potential )
+{
+ unsigned long long int localTime_asLong;
+ unsigned long long int f3_0_AcquisitionTime_asLong;
+ unsigned long long int f3_1_AcquisitionTime_asLong;
+ unsigned long long int deltaT;
+ unsigned long long int deltaT_f3_0;
+ unsigned long long int deltaT_f3_1;
+ unsigned char *bufferPtr;
+
+ unsigned int offset_in_samples;
+ unsigned int offset_in_bytes;
+ unsigned char f3;
+
+ bufferPtr = NULL;
+ deltaT = 0;
+ deltaT_f3_0 = 0xffffffff;
+ deltaT_f3_1 = 0xffffffff;
+ f3 = 16; // v, e1 and e2 will be picked up each second, f3 = 16 Hz
+
+ if (lfrCurrentMode == LFR_MODE_STANDBY)
+ {
+ spacecraft_potential[0] = 0x00;
+ spacecraft_potential[1] = 0x00;
+ spacecraft_potential[2] = 0x00;
+ spacecraft_potential[3] = 0x00;
+ spacecraft_potential[4] = 0x00;
+ spacecraft_potential[5] = 0x00;
+ }
+ else
+ {
+ localTime_asLong = get_acquisition_time( (unsigned char *) &time_management_regs->coarse_time );
+ f3_0_AcquisitionTime_asLong = get_acquisition_time( (unsigned char *) &waveform_picker_regs->f3_0_coarse_time );
+ f3_1_AcquisitionTime_asLong = get_acquisition_time( (unsigned char *) &waveform_picker_regs->f3_1_coarse_time );
+ printf("localTime 0x%llx, f3_0 0x%llx, f3_1 0x%llx\n",
+ localTime_asLong,
+ f3_0_AcquisitionTime_asLong,
+ f3_1_AcquisitionTime_asLong);
+
+ if ( localTime_asLong >= f3_0_AcquisitionTime_asLong )
+ {
+ deltaT_f3_0 = localTime_asLong - f3_0_AcquisitionTime_asLong;
+ }
+
+ if ( localTime_asLong > f3_1_AcquisitionTime_asLong )
+ {
+ deltaT_f3_1 = localTime_asLong - f3_1_AcquisitionTime_asLong;
+ }
+
+ if ( (deltaT_f3_0 != 0xffffffff) && (deltaT_f3_1 != 0xffffffff) )
+ {
+ if ( deltaT_f3_0 > deltaT_f3_1 )
+ {
+ deltaT = deltaT_f3_1;
+ bufferPtr = (unsigned char*) waveform_picker_regs->addr_data_f3_1;
+ }
+ else
+ {
+ deltaT = deltaT_f3_0;
+ bufferPtr = (unsigned char*) waveform_picker_regs->addr_data_f3_0;
+ }
+ }
+ else if ( (deltaT_f3_0 == 0xffffffff) && (deltaT_f3_1 != 0xffffffff) )
+ {
+ deltaT = deltaT_f3_1;
+ bufferPtr = (unsigned char*) waveform_picker_regs->addr_data_f3_1;
+ }
+ else if ( (deltaT_f3_0 != 0xffffffff) && (deltaT_f3_1 == 0xffffffff) )
+ {
+ deltaT = deltaT_f3_0;
+ bufferPtr = (unsigned char*) waveform_picker_regs->addr_data_f3_1;
+ }
+ else
+ {
+ deltaT = 0xffffffff;
+ }
+
+ if ( deltaT == 0xffffffff )
+ {
+ spacecraft_potential[0] = 0x00;
+ spacecraft_potential[1] = 0x00;
+ spacecraft_potential[2] = 0x00;
+ spacecraft_potential[3] = 0x00;
+ spacecraft_potential[4] = 0x00;
+ spacecraft_potential[5] = 0x00;
+ }
+ else
+ {
+ offset_in_samples = ( (double) deltaT ) / 65536. * f3;
+ if ( offset_in_samples > (NB_SAMPLES_PER_SNAPSHOT - 1) )
+ {
+ PRINTF1("ERR *** in get_v_e1_e2_f3 *** trying to read out of the buffer, counter = %d\n", offset_in_samples)
+ offset_in_samples = NB_SAMPLES_PER_SNAPSHOT - 1;
+ }
+ offset_in_bytes = offset_in_samples * NB_WORDS_SWF_BLK * 4;
+ spacecraft_potential[0] = bufferPtr[ offset_in_bytes + 0];
+ spacecraft_potential[1] = bufferPtr[ offset_in_bytes + 1];
+ spacecraft_potential[2] = bufferPtr[ offset_in_bytes + 2];
+ spacecraft_potential[3] = bufferPtr[ offset_in_bytes + 3];
+ spacecraft_potential[4] = bufferPtr[ offset_in_bytes + 4];
+ spacecraft_potential[5] = bufferPtr[ offset_in_bytes + 5];
+ }
+ }
+}
+
void get_cpu_load( unsigned char *resource_statistics )
{
unsigned char cpu_load;
diff --git a/src/fsw_spacewire.c b/src/fsw_spacewire.c
--- a/src/fsw_spacewire.c
+++ b/src/fsw_spacewire.c
@@ -228,7 +228,7 @@ rtems_task send_task( rtems_task_argumen
}
else
{
- if ( incomingData[0] == CCSDS_DESTINATION_ID) // the incoming message is a ccsds packet
+ if ( incomingData[0] == CCSDS_DESTINATION_ID ) // the incoming message is a ccsds packet
{
status = write( fdSPW, incomingData, size );
if (status == -1){
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
@@ -577,6 +577,17 @@ void BP_send(char *data, rtems_id queue_
//******************
// general functions
+void reset_sm_status( void )
+{
+ // error
+ // 10 --------------- 9 ---------------- 8 ---------------- 7 ---------
+ // input_fif0_write_2 input_fifo_write_1 input_fifo_write_0 buffer_full
+ // ---------- 5 -- 4 -- 3 -- 2 -- 1 -- 0 --
+ // ready bits f2_1 f2_0 f1_1 f1_1 f0_1 f0_0
+
+ spectral_matrix_regs->status = 0x7ff; // [0111 1111 1111]
+}
+
void reset_spectral_matrix_regs( void )
{
/** This function resets the spectral matrices module registers.
@@ -592,8 +603,11 @@ void reset_spectral_matrix_regs( void )
*
*/
- spectral_matrix_regs->config = 0x00;
- spectral_matrix_regs->status = 0x00;
+ set_sm_irq_onError( 0 );
+
+ set_sm_irq_onNewMatrix( 0 );
+
+ reset_sm_status();
spectral_matrix_regs->f0_0_address = current_ring_node_sm_f0->previous->buffer_address;
spectral_matrix_regs->f0_1_address = current_ring_node_sm_f0->buffer_address;
diff --git a/src/tc_handler.c b/src/tc_handler.c
--- a/src/tc_handler.c
+++ b/src/tc_handler.c
@@ -466,19 +466,23 @@ int stop_current_mode( void )
LEON_Mask_interrupt( IRQ_WAVEFORM_PICKER ); // mask waveform picker interrupt
LEON_Mask_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt
- // (2) clear interruptions
- LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt
- LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt
+ // reset lfr VHDL module
+ reset_lfr();
- // (3) reset waveform picker registers
+ // (2) reset waveform picker registers
reset_wfp_burst_enable(); // reset burst and enable bits
reset_wfp_status(); // reset all the status bits
- // (4) reset spectral matrices registers
- set_irq_on_new_ready_matrix( 0 ); // stop the spectral matrices
- set_run_matrix_spectral( 0 ); // run_matrix_spectral is set to 0
+ // (3) reset spectral matrices registers
+ set_sm_irq_onNewMatrix( 0 ); // stop the spectral matrices
+ reset_sm_status();
+
reset_extractSWF(); // reset the extractSWF flag to false
+ // (4) clear interruptions
+ LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt
+ LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt
+
//
LEON_Mask_interrupt( IRQ_SM_SIMULATOR ); // mask spectral matrix interrupt simulator
timer_stop( (gptimer_regs_t*) REGS_ADDR_GPTIMER, TIMER_SM_SIMULATOR );
@@ -748,13 +752,14 @@ int suspend_science_tasks()
void launch_waveform_picker( unsigned char mode, unsigned int transitionCoarseTime )
{
WFP_reset_current_ring_nodes();
+
reset_waveform_picker_regs();
+
set_wfp_burst_enable_register( mode );
LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
- waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x80; // [1000 0000]
if (transitionCoarseTime == 0)
{
waveform_picker_regs->start_date = time_management_regs->coarse_time;
@@ -770,17 +775,16 @@ void launch_waveform_picker( unsigned ch
void launch_spectral_matrix( void )
{
SM_reset_current_ring_nodes();
+
reset_spectral_matrix_regs();
+
reset_nb_sm();
- struct grgpio_regs_str *grgpio_regs = (struct grgpio_regs_str *) REGS_ADDR_GRGPIO;
- grgpio_regs->io_port_direction_register =
- grgpio_regs->io_port_direction_register | 0x01; // [0000 0001], 0 = output disabled, 1 = output enabled
- grgpio_regs->io_port_output_register = grgpio_regs->io_port_output_register & 0xfffffffe; // set the bit 0 to 0
- set_irq_on_new_ready_matrix( 1 );
+ set_sm_irq_onNewMatrix( 1 );
+
LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX );
LEON_Unmask_interrupt( IRQ_SPECTRAL_MATRIX );
- set_run_matrix_spectral( 1 );
+
}
void launch_spectral_matrix_simu( void )
@@ -795,7 +799,7 @@ void launch_spectral_matrix_simu( void )
LEON_Unmask_interrupt( IRQ_SM_SIMULATOR );
}
-void set_irq_on_new_ready_matrix( unsigned char value )
+void set_sm_irq_onNewMatrix( unsigned char value )
{
if (value == 1)
{
@@ -807,15 +811,15 @@ void set_irq_on_new_ready_matrix( unsign
}
}
-void set_run_matrix_spectral( unsigned char value )
+void set_sm_irq_onError( unsigned char value )
{
if (value == 1)
{
- spectral_matrix_regs->config = spectral_matrix_regs->config | 0x4; // [0100] set run_matrix spectral to 1
+ spectral_matrix_regs->config = spectral_matrix_regs->config | 0x02;
}
else
{
- spectral_matrix_regs->config = spectral_matrix_regs->config & 0xfffffffb; // [1011] set run_matrix spectral to 0
+ spectral_matrix_regs->config = spectral_matrix_regs->config & 0xfffffffd; // 1101
}
}
@@ -947,3 +951,21 @@ void updateLFRCurrentMode()
lfrCurrentMode = (housekeeping_packet.lfr_status_word[0] & 0xf0) >> 4;
}
+void set_lfr_soft_reset( unsigned char value )
+{
+ if (value == 1)
+ {
+ time_management_regs->ctrl = time_management_regs->ctrl | 0x00000004; // [0100]
+ }
+ else
+ {
+ time_management_regs->ctrl = time_management_regs->ctrl & 0xfffffffb; // [1011]
+ }
+}
+
+void reset_lfr( void )
+{
+ set_lfr_soft_reset( 1 );
+
+ set_lfr_soft_reset( 0 );
+}
diff --git a/src/wf_handler.c b/src/wf_handler.c
--- a/src/wf_handler.c
+++ b/src/wf_handler.c
@@ -22,20 +22,24 @@ Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2
Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3[ NB_PACKETS_PER_GROUP_OF_CWF ];
Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3_light[ NB_PACKETS_PER_GROUP_OF_CWF_LIGHT ];
-//**************
-// waveform ring
+//***************
+// waveform rings
+// F0
ring_node waveform_ring_f0[NB_RING_NODES_F0];
-ring_node waveform_ring_f1[NB_RING_NODES_F1];
-ring_node waveform_ring_f2[NB_RING_NODES_F2];
-ring_node waveform_ring_f3[NB_RING_NODES_F3];
ring_node *current_ring_node_f0;
ring_node *ring_node_to_send_swf_f0;
+// F1
+ring_node waveform_ring_f1[NB_RING_NODES_F1];
ring_node *current_ring_node_f1;
ring_node *ring_node_to_send_swf_f1;
ring_node *ring_node_to_send_cwf_f1;
+// F2
+ring_node waveform_ring_f2[NB_RING_NODES_F2];
ring_node *current_ring_node_f2;
ring_node *ring_node_to_send_swf_f2;
ring_node *ring_node_to_send_cwf_f2;
+// F3
+ring_node waveform_ring_f3[NB_RING_NODES_F3];
ring_node *current_ring_node_f3;
ring_node *ring_node_to_send_cwf_f3;
@@ -44,7 +48,8 @@ bool swf_f0_ready = false;
bool swf_f1_ready = false;
bool swf_f2_ready = false;
-int wf_snap_extracted[ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) + TIME_OFFSET ];
+int wf_snap_extracted[ (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK) ];
+ring_node ring_node_wf_snap_extracted;
//*********************
// Interrupt SubRoutine
@@ -57,60 +62,6 @@ void reset_extractSWF( void )
swf_f2_ready = false;
}
-void change_f0_buffer( void )
-{
- ring_node_to_send_swf_f0 = current_ring_node_f0;
- current_ring_node_f0 = current_ring_node_f0->next;
- if ( (waveform_picker_regs->status & 0x01) == 0x01)
- {
- ring_node_to_send_swf_f0->coarseTime = waveform_picker_regs->f0_0_coarse_time;
- ring_node_to_send_swf_f0->fineTime = waveform_picker_regs->f0_0_fine_time;
- waveform_picker_regs->addr_data_f0_0 = current_ring_node_f0->buffer_address;
- }
- else if ( (waveform_picker_regs->status & 0x02) == 0x02)
- {
- ring_node_to_send_swf_f0->coarseTime = waveform_picker_regs->f0_1_coarse_time;
- ring_node_to_send_swf_f0->fineTime = waveform_picker_regs->f0_1_fine_time;
- waveform_picker_regs->addr_data_f0_1 = current_ring_node_f0->buffer_address;
- }
-}
-
-void change_f1_buffer( ring_node *ring_node_to_send )
-{
- ring_node_to_send = current_ring_node_f1;
- current_ring_node_f1 = current_ring_node_f1->next;
- if ( (waveform_picker_regs->status & 0x04) == 0x04)
- {
- ring_node_to_send->coarseTime = waveform_picker_regs->f1_0_coarse_time;
- ring_node_to_send->fineTime = waveform_picker_regs->f1_0_fine_time;
- waveform_picker_regs->addr_data_f1_0 = current_ring_node_f1->buffer_address;
- }
- else if ( (waveform_picker_regs->status & 0x08) == 0x08)
- {
- ring_node_to_send->coarseTime = waveform_picker_regs->f1_1_coarse_time;
- ring_node_to_send->fineTime = waveform_picker_regs->f1_1_fine_time;
- waveform_picker_regs->addr_data_f1_1 = current_ring_node_f1->buffer_address;
- }
-}
-
-void change_f2_buffer( ring_node *ring_node_to_send )
-{
- ring_node_to_send = current_ring_node_f2;
- current_ring_node_f2 = current_ring_node_f2->next;
- if ( (waveform_picker_regs->status & 0x10) == 0x10)
- {
- ring_node_to_send->coarseTime = waveform_picker_regs->f2_0_coarse_time;
- ring_node_to_send->fineTime = waveform_picker_regs->f2_0_fine_time;
- waveform_picker_regs->addr_data_f2_0 = current_ring_node_f2->buffer_address;
- }
- else if ( (waveform_picker_regs->status & 0x20) == 0x20)
- {
- ring_node_to_send->coarseTime = waveform_picker_regs->f2_1_coarse_time;
- ring_node_to_send->fineTime = waveform_picker_regs->f2_1_fine_time;
- waveform_picker_regs->addr_data_f2_1 = current_ring_node_f2->buffer_address;
- }
-}
-
void waveforms_isr_f3( void )
{
rtems_status_code spare_status;
@@ -118,29 +69,27 @@ void waveforms_isr_f3( void )
if ( (lfrCurrentMode == LFR_MODE_NORMAL) || (lfrCurrentMode == LFR_MODE_BURST) // in BURST the data are used to place v, e1 and e2 in the HK packet
|| (lfrCurrentMode == LFR_MODE_SBM1) || (lfrCurrentMode == LFR_MODE_SBM2) )
{ // in modes other than STANDBY and BURST, send the CWF_F3 data
- if ((waveform_picker_regs->status & 0x40) == 0x40){ // [0100 0000] f3 buffer 0 is full
- // (1) change the receiving buffer for the waveform picker
- ring_node_to_send_cwf_f3 = current_ring_node_f3;
- current_ring_node_f3 = current_ring_node_f3->next;
- waveform_picker_regs->addr_data_f3_0 = current_ring_node_f3->buffer_address;
- // (2) send an event for the waveforms transmission
+ //***
+ // F3
+ if ( (waveform_picker_regs->status & 0xc0) != 0x00 ) { // [1100 0000] check the f3 full bits
+ ring_node_to_send_cwf_f3 = current_ring_node_f3->previous;
+ current_ring_node_f3 = current_ring_node_f3->next;
+ if ((waveform_picker_regs->status & 0x40) == 0x40){ // [0100 0000] f3 buffer 0 is full
+ ring_node_to_send_cwf_f3->coarseTime = waveform_picker_regs->f3_0_coarse_time;
+ ring_node_to_send_cwf_f3->fineTime = waveform_picker_regs->f3_0_fine_time;
+ waveform_picker_regs->addr_data_f3_0 = current_ring_node_f3->buffer_address;
+ waveform_picker_regs->status = waveform_picker_regs->status & 0x00008840; // [1000 1000 0100 0000]
+ }
+ else if ((waveform_picker_regs->status & 0x80) == 0x80){ // [1000 0000] f3 buffer 1 is full
+ ring_node_to_send_cwf_f3->coarseTime = waveform_picker_regs->f3_1_coarse_time;
+ ring_node_to_send_cwf_f3->fineTime = waveform_picker_regs->f3_1_fine_time;
+ waveform_picker_regs->addr_data_f3_1 = current_ring_node_f3->buffer_address;
+ waveform_picker_regs->status = waveform_picker_regs->status & 0x00008880; // [1000 1000 1000 0000]
+ }
if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
- spare_status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
+ spare_status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 );
}
rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2);
- waveform_picker_regs->status = waveform_picker_regs->status & 0xffff77bf; // reset f3 bits to 0, [0111 0111 1011 1111]
- }
- else if ((waveform_picker_regs->status & 0x80) == 0x80){ // [1000 0000] f3 buffer 1 is full
- // (1) change the receiving buffer for the waveform picker
- ring_node_to_send_cwf_f3 = current_ring_node_f3;
- current_ring_node_f3 = current_ring_node_f3->next;
- waveform_picker_regs->addr_data_f3_1 = current_ring_node_f3->buffer_address;
- // (2) send an event for the waveforms transmission
- if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
- spare_status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
- }
- rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2);
- waveform_picker_regs->status = waveform_picker_regs->status & 0xffff777f; // reset f3 bits to 0, [0111 0111 0111 1111]
}
}
}
@@ -150,23 +99,72 @@ void waveforms_isr_normal( void )
rtems_status_code status;
if ( ( (waveform_picker_regs->status & 0x30) != 0x00 ) // [0011 0000] check the f2 full bits
- || ( (waveform_picker_regs->status & 0x0c) != 0x00 ) // [0000 1100] check the f1 full bits
- || ( (waveform_picker_regs->status & 0x03) != 0x00 )) // [0000 0011] check the f0 full bits
+ && ( (waveform_picker_regs->status & 0x0c) != 0x00 ) // [0000 1100] check the f1 full bits
+ && ( (waveform_picker_regs->status & 0x03) != 0x00 )) // [0000 0011] check the f0 full bits
{
- // change F0 ring node
- change_f0_buffer();
- // change F1 ring node
- change_f1_buffer( ring_node_to_send_swf_f1 );
- // change F2 ring node
- change_f2_buffer( ring_node_to_send_swf_f2 );
+ //***
+ // F0
+ ring_node_to_send_swf_f0 = current_ring_node_f0->previous;
+ current_ring_node_f0 = current_ring_node_f0->next;
+ if ( (waveform_picker_regs->status & 0x01) == 0x01)
+ {
+
+ ring_node_to_send_swf_f0->coarseTime = waveform_picker_regs->f0_0_coarse_time;
+ ring_node_to_send_swf_f0->fineTime = waveform_picker_regs->f0_0_fine_time;
+ waveform_picker_regs->addr_data_f0_0 = current_ring_node_f0->buffer_address;
+ waveform_picker_regs->status = waveform_picker_regs->status & 0x00001101; // [0001 0001 0000 0001]
+ }
+ else if ( (waveform_picker_regs->status & 0x02) == 0x02)
+ {
+ ring_node_to_send_swf_f0->coarseTime = waveform_picker_regs->f0_1_coarse_time;
+ ring_node_to_send_swf_f0->fineTime = waveform_picker_regs->f0_1_fine_time;
+ waveform_picker_regs->addr_data_f0_1 = current_ring_node_f0->buffer_address;
+ waveform_picker_regs->status = waveform_picker_regs->status & 0x00001102; // [0001 0001 0000 0010]
+ }
+
+ //***
+ // F1
+ ring_node_to_send_swf_f1 = current_ring_node_f1->previous;
+ current_ring_node_f1 = current_ring_node_f1->next;
+ if ( (waveform_picker_regs->status & 0x04) == 0x04)
+ {
+ ring_node_to_send_swf_f1->coarseTime = waveform_picker_regs->f1_0_coarse_time;
+ ring_node_to_send_swf_f1->fineTime = waveform_picker_regs->f1_0_fine_time;
+ waveform_picker_regs->addr_data_f1_0 = current_ring_node_f1->buffer_address;
+ waveform_picker_regs->status = waveform_picker_regs->status & 0x00002204; // [0010 0010 0000 0100] f1 bits = 0
+ }
+ else if ( (waveform_picker_regs->status & 0x08) == 0x08)
+ {
+ ring_node_to_send_swf_f1->coarseTime = waveform_picker_regs->f1_1_coarse_time;
+ ring_node_to_send_swf_f1->fineTime = waveform_picker_regs->f1_1_fine_time;
+ waveform_picker_regs->addr_data_f1_1 = current_ring_node_f1->buffer_address;
+ waveform_picker_regs->status = waveform_picker_regs->status & 0x00002208; // [0010 0010 0000 1000] f1 bits = 0
+ }
+
+ //***
+ // F2
+ ring_node_to_send_swf_f2 = current_ring_node_f2->previous;
+ current_ring_node_f2 = current_ring_node_f2->next;
+ if ( (waveform_picker_regs->status & 0x10) == 0x10)
+ {
+ ring_node_to_send_swf_f2->coarseTime = waveform_picker_regs->f2_0_coarse_time;
+ ring_node_to_send_swf_f2->fineTime = waveform_picker_regs->f2_0_fine_time;
+ waveform_picker_regs->addr_data_f2_0 = current_ring_node_f2->buffer_address;
+ waveform_picker_regs->status = waveform_picker_regs->status & 0x00004410; // [0100 0100 0001 0000]
+ }
+ else if ( (waveform_picker_regs->status & 0x20) == 0x20)
+ {
+ ring_node_to_send_swf_f2->coarseTime = waveform_picker_regs->f2_1_coarse_time;
+ ring_node_to_send_swf_f2->fineTime = waveform_picker_regs->f2_1_fine_time;
+ waveform_picker_regs->addr_data_f2_1 = current_ring_node_f2->buffer_address;
+ waveform_picker_regs->status = waveform_picker_regs->status & 0x00004420; // [0100 0100 0010 0000]
+ }
//
status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL );
if ( status != RTEMS_SUCCESSFUL)
{
- status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
+ status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 );
}
- // update status bits except f3 bits
- waveform_picker_regs->status = waveform_picker_regs->status & 0xffff00c0; // [1000 1000 1100 0000]
}
}
@@ -176,13 +174,26 @@ void waveforms_isr_burst( void )
if ( (waveform_picker_regs->status & 0x30) != 0 ){ // [0100] check the f2 full bit
// (1) change the receiving buffer for the waveform picker
- change_f2_buffer( ring_node_to_send_cwf_f2 );
+ ring_node_to_send_cwf_f2 = current_ring_node_f2->previous;
+ current_ring_node_f2 = current_ring_node_f2->next;
+ if ( (waveform_picker_regs->status & 0x10) == 0x10)
+ {
+ ring_node_to_send_cwf_f2->coarseTime = waveform_picker_regs->f2_0_coarse_time;
+ ring_node_to_send_cwf_f2->fineTime = waveform_picker_regs->f2_0_fine_time;
+ waveform_picker_regs->addr_data_f2_0 = current_ring_node_f2->buffer_address;
+ waveform_picker_regs->status = waveform_picker_regs->status & 0x00004410; // [0100 0100 0001 0000]
+ }
+ else if ( (waveform_picker_regs->status & 0x20) == 0x20)
+ {
+ ring_node_to_send_cwf_f2->coarseTime = waveform_picker_regs->f2_1_coarse_time;
+ ring_node_to_send_cwf_f2->fineTime = waveform_picker_regs->f2_1_fine_time;
+ waveform_picker_regs->addr_data_f2_1 = current_ring_node_f2->buffer_address;
+ waveform_picker_regs->status = waveform_picker_regs->status & 0x00004420; // [0100 0100 0010 0000]
+ }
// (2) send an event for the waveforms transmission
if (rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_BURST ) != RTEMS_SUCCESSFUL) {
- spare_status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
+ spare_status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 );
}
- // update f2 status bits only
- waveform_picker_regs->status = waveform_picker_regs->status & 0xffffbbcf; // [1011 1011 1100 1111] f2 bit = 0
}
}
@@ -193,29 +204,77 @@ void waveforms_isr_sbm1( void )
//***
// F1
- if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit
+ if ( (waveform_picker_regs->status & 0x0c) != 0x00 ) { // [0000 1100] check the f1 full bits
// (1) change the receiving buffer for the waveform picker
- change_f1_buffer( ring_node_to_send_cwf_f1 );
+ ring_node_to_send_cwf_f1 = current_ring_node_f1->previous;
+ current_ring_node_f1 = current_ring_node_f1->next;
+ if ( (waveform_picker_regs->status & 0x04) == 0x04)
+ {
+ ring_node_to_send_cwf_f1->coarseTime = waveform_picker_regs->f1_0_coarse_time;
+ ring_node_to_send_cwf_f1->fineTime = waveform_picker_regs->f1_0_fine_time;
+ waveform_picker_regs->addr_data_f1_0 = current_ring_node_f1->buffer_address;
+ waveform_picker_regs->status = waveform_picker_regs->status & 0x00002204; // [0010 0010 0000 0100] f1 bits = 0
+ }
+ else if ( (waveform_picker_regs->status & 0x08) == 0x08)
+ {
+ ring_node_to_send_cwf_f1->coarseTime = waveform_picker_regs->f1_1_coarse_time;
+ ring_node_to_send_cwf_f1->fineTime = waveform_picker_regs->f1_1_fine_time;
+ waveform_picker_regs->addr_data_f1_1 = current_ring_node_f1->buffer_address;
+ waveform_picker_regs->status = waveform_picker_regs->status & 0x00002208; // [0010 0010 0000 1000] f1 bits = 0
+ }
// (2) send an event for the the CWF1 task for transmission (and snapshot extraction if needed)
status = rtems_event_send( Task_id[TASKID_CWF1], RTEMS_EVENT_MODE_SBM1 );
- waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1 bits = 0
}
//***
// F0
- if ( (waveform_picker_regs->status & 0x03) != 0x00 ) { // [0000 0011] one f0 buffer is full
+ if ( (waveform_picker_regs->status & 0x03) != 0x00 ) { // [0000 0011] check the f0 full bits
swf_f0_ready = true;
- change_f0_buffer();
+ // change f0 buffer
+ ring_node_to_send_swf_f0 = current_ring_node_f0->previous;
+ current_ring_node_f0 = current_ring_node_f0->next;
+ if ( (waveform_picker_regs->status & 0x01) == 0x01)
+ {
+
+ ring_node_to_send_swf_f0->coarseTime = waveform_picker_regs->f0_0_coarse_time;
+ ring_node_to_send_swf_f0->fineTime = waveform_picker_regs->f0_0_fine_time;
+ waveform_picker_regs->addr_data_f0_0 = current_ring_node_f0->buffer_address;
+ waveform_picker_regs->status = waveform_picker_regs->status & 0x00001101; // [0001 0001 0000 0001]
+ }
+ else if ( (waveform_picker_regs->status & 0x02) == 0x02)
+ {
+ ring_node_to_send_swf_f0->coarseTime = waveform_picker_regs->f0_1_coarse_time;
+ ring_node_to_send_swf_f0->fineTime = waveform_picker_regs->f0_1_fine_time;
+ waveform_picker_regs->addr_data_f0_1 = current_ring_node_f0->buffer_address;
+ waveform_picker_regs->status = waveform_picker_regs->status & 0x00001102; // [0001 0001 0000 0010]
+ }
}
//***
// F2
- if ( (waveform_picker_regs->status & 0x04) == 0x04 ) { // [0100] check the f2 full bit
+ if ( (waveform_picker_regs->status & 0x30) != 0x00 ) { // [0011 0000] check the f2 full bits
swf_f2_ready = true;
- change_f2_buffer( ring_node_to_send_swf_f2 );
+ // change f2 buffer
+ ring_node_to_send_swf_f2 = current_ring_node_f2->previous;
+ current_ring_node_f2 = current_ring_node_f2->next;
+ if ( (waveform_picker_regs->status & 0x10) == 0x10)
+ {
+ ring_node_to_send_swf_f2->coarseTime = waveform_picker_regs->f2_0_coarse_time;
+ ring_node_to_send_swf_f2->fineTime = waveform_picker_regs->f2_0_fine_time;
+ waveform_picker_regs->addr_data_f2_0 = current_ring_node_f2->buffer_address;
+ waveform_picker_regs->status = waveform_picker_regs->status & 0x00004410; // [0100 0100 0001 0000]
+ }
+ else if ( (waveform_picker_regs->status & 0x20) == 0x20)
+ {
+ ring_node_to_send_swf_f2->coarseTime = waveform_picker_regs->f2_1_coarse_time;
+ ring_node_to_send_swf_f2->fineTime = waveform_picker_regs->f2_1_fine_time;
+ waveform_picker_regs->addr_data_f2_1 = current_ring_node_f2->buffer_address;
+ waveform_picker_regs->status = waveform_picker_regs->status & 0x00004420; // [0100 0100 0010 0000]
+ }
+ // start the snapshots transmission
if (rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_MODE_NORMAL ) != RTEMS_SUCCESSFUL)
{
- spare_status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
+ spare_status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_0 );
}
}
}
@@ -224,22 +283,74 @@ void waveforms_isr_sbm2( void )
{
rtems_status_code status;
- if ( (waveform_picker_regs->status & 0x04) == 0x04 ){ // [0100] check the f2 full bit
+ //***
+ // F2
+ if ( (waveform_picker_regs->status & 0x30) != 0x00 ) { // [0011 0000] check the f2 full bit
// (1) change the receiving buffer for the waveform picker
- change_f2_buffer( ring_node_to_send_cwf_f2 );
+ ring_node_to_send_cwf_f2 = current_ring_node_f2->previous;
+ current_ring_node_f2 = current_ring_node_f2->next;
+ if ( (waveform_picker_regs->status & 0x10) == 0x10)
+ {
+ ring_node_to_send_cwf_f2->coarseTime = waveform_picker_regs->f2_0_coarse_time;
+ ring_node_to_send_cwf_f2->fineTime = waveform_picker_regs->f2_0_fine_time;
+ waveform_picker_regs->addr_data_f2_0 = current_ring_node_f2->buffer_address;
+ waveform_picker_regs->status = waveform_picker_regs->status & 0x00004410; // [0100 0100 0001 0000]
+ }
+ else if ( (waveform_picker_regs->status & 0x20) == 0x20)
+ {
+ ring_node_to_send_cwf_f2->coarseTime = waveform_picker_regs->f2_1_coarse_time;
+ ring_node_to_send_cwf_f2->fineTime = waveform_picker_regs->f2_1_fine_time;
+ waveform_picker_regs->addr_data_f2_1 = current_ring_node_f2->buffer_address;
+ waveform_picker_regs->status = waveform_picker_regs->status & 0x00004420; // [0100 0100 0010 0000]
+ }
// (2) send an event for the waveforms transmission
status = rtems_event_send( Task_id[TASKID_CWF2], RTEMS_EVENT_MODE_SBM2 );
- waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffbbb; // [1111 1011 1011 1011] f2 bit = 0
}
- if ( (waveform_picker_regs->status & 0x01) == 0x01 ) { // [0001] check the f0 full bit
+
+ //***
+ // F0
+ if ( (waveform_picker_regs->status & 0x03) != 0x00 ) { // [0000 0011] check the f0 full bit
swf_f0_ready = true;
- change_f0_buffer();
- waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffeee; // [1111 1110 1110 1110] f0 bits = 0
+ // change f0 buffer
+ ring_node_to_send_swf_f0 = current_ring_node_f0->previous;
+ current_ring_node_f0 = current_ring_node_f0->next;
+ if ( (waveform_picker_regs->status & 0x01) == 0x01)
+ {
+
+ ring_node_to_send_swf_f0->coarseTime = waveform_picker_regs->f0_0_coarse_time;
+ ring_node_to_send_swf_f0->fineTime = waveform_picker_regs->f0_0_fine_time;
+ waveform_picker_regs->addr_data_f0_0 = current_ring_node_f0->buffer_address;
+ waveform_picker_regs->status = waveform_picker_regs->status & 0x00001101; // [0001 0001 0000 0001]
+ }
+ else if ( (waveform_picker_regs->status & 0x02) == 0x02)
+ {
+ ring_node_to_send_swf_f0->coarseTime = waveform_picker_regs->f0_1_coarse_time;
+ ring_node_to_send_swf_f0->fineTime = waveform_picker_regs->f0_1_fine_time;
+ waveform_picker_regs->addr_data_f0_1 = current_ring_node_f0->buffer_address;
+ waveform_picker_regs->status = waveform_picker_regs->status & 0x00001102; // [0001 0001 0000 0010]
+ }
}
- if ( (waveform_picker_regs->status & 0x02) == 0x02 ) { // [0010] check the f1 full bit
+
+ //***
+ // F1
+ if ( (waveform_picker_regs->status & 0x0c) != 0x00 ) { // [0000 1100] check the f1 full bit
swf_f1_ready = true;
- change_f1_buffer( ring_node_to_send_swf_f1 );
- waveform_picker_regs->status = waveform_picker_regs->status & 0xfffffddd; // [1111 1101 1101 1101] f1, f0 bits = 0
+ ring_node_to_send_swf_f1 = current_ring_node_f1->previous;
+ current_ring_node_f1 = current_ring_node_f1->next;
+ if ( (waveform_picker_regs->status & 0x04) == 0x04)
+ {
+ ring_node_to_send_swf_f1->coarseTime = waveform_picker_regs->f1_0_coarse_time;
+ ring_node_to_send_swf_f1->fineTime = waveform_picker_regs->f1_0_fine_time;
+ waveform_picker_regs->addr_data_f1_0 = current_ring_node_f1->buffer_address;
+ waveform_picker_regs->status = waveform_picker_regs->status & 0x00002204; // [0010 0010 0000 0100] f1 bits = 0
+ }
+ else if ( (waveform_picker_regs->status & 0x08) == 0x08)
+ {
+ ring_node_to_send_swf_f1->coarseTime = waveform_picker_regs->f1_1_coarse_time;
+ ring_node_to_send_swf_f1->fineTime = waveform_picker_regs->f1_1_fine_time;
+ waveform_picker_regs->addr_data_f1_1 = current_ring_node_f1->buffer_address;
+ waveform_picker_regs->status = waveform_picker_regs->status & 0x00002208; // [0010 0010 0000 1000] f1 bits = 0
+ }
}
}
@@ -266,9 +377,9 @@ rtems_isr waveforms_isr( rtems_vector_nu
waveforms_isr_f3();
- if ( (waveform_picker_regs->status & 0xff8) != 0x00) // [1000] check the error bits
+ if ( (waveform_picker_regs->status & 0xff00) != 0x00) // [1111 1111 0000 0000] check the error bits
{
- spare_status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
+ spare_status = rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_10 );
}
switch(lfrCurrentMode)
@@ -365,23 +476,23 @@ rtems_task wfrm_task(rtems_task_argument
if (event_out == RTEMS_EVENT_MODE_NORMAL)
{
DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_NORMAL\n")
- send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
- send_waveform_SWF((volatile int*) ring_node_to_send_swf_f1->buffer_address, SID_NORM_SWF_F1, headerSWF_F1, queue_id);
- send_waveform_SWF((volatile int*) ring_node_to_send_swf_f2->buffer_address, SID_NORM_SWF_F2, headerSWF_F2, queue_id);
+ send_waveform_SWF( ring_node_to_send_swf_f0, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
+ send_waveform_SWF( ring_node_to_send_swf_f1, SID_NORM_SWF_F1, headerSWF_F1, queue_id);
+ send_waveform_SWF( ring_node_to_send_swf_f2, SID_NORM_SWF_F2, headerSWF_F2, queue_id);
}
if (event_out == RTEMS_EVENT_MODE_SBM1)
{
DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_SBM1\n")
- send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
- send_waveform_SWF((volatile int*) wf_snap_extracted , SID_NORM_SWF_F1, headerSWF_F1, queue_id);
- send_waveform_SWF((volatile int*) ring_node_to_send_swf_f2->buffer_address, SID_NORM_SWF_F2, headerSWF_F2, queue_id);
+ send_waveform_SWF( ring_node_to_send_swf_f0, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
+ send_waveform_SWF( &ring_node_wf_snap_extracted, SID_NORM_SWF_F1, headerSWF_F1, queue_id);
+ send_waveform_SWF( ring_node_to_send_swf_f2, SID_NORM_SWF_F2, headerSWF_F2, queue_id);
}
if (event_out == RTEMS_EVENT_MODE_SBM2)
{
DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_SBM2\n")
- send_waveform_SWF((volatile int*) ring_node_to_send_swf_f0->buffer_address, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
- send_waveform_SWF((volatile int*) ring_node_to_send_swf_f1->buffer_address, SID_NORM_SWF_F1, headerSWF_F1, queue_id);
- send_waveform_SWF((volatile int*) wf_snap_extracted , SID_NORM_SWF_F2, headerSWF_F2, queue_id);
+ send_waveform_SWF( ring_node_to_send_swf_f0, SID_NORM_SWF_F0, headerSWF_F0, queue_id);
+ send_waveform_SWF( ring_node_to_send_swf_f1, SID_NORM_SWF_F1, headerSWF_F1, queue_id);
+ send_waveform_SWF( &ring_node_wf_snap_extracted, SID_NORM_SWF_F2, headerSWF_F2, queue_id);
}
}
}
@@ -422,15 +533,13 @@ rtems_task cwf3_task(rtems_task_argument
if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01)
{
PRINTF("send CWF_LONG_F3\n")
- send_waveform_CWF(
- (volatile int*) ring_node_to_send_cwf_f3->buffer_address,
+ send_waveform_CWF( ring_node_to_send_cwf_f3,
SID_NORM_CWF_LONG_F3, headerCWF_F3, queue_id );
}
else
{
PRINTF("send CWF_F3 (light)\n")
- send_waveform_CWF3_light(
- (volatile int*) ring_node_to_send_cwf_f3->buffer_address,
+ send_waveform_CWF3_light( ring_node_to_send_cwf_f3,
headerCWF_F3_light, queue_id );
}
@@ -475,11 +584,11 @@ rtems_task cwf2_task(rtems_task_argument
RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
if (event_out == RTEMS_EVENT_MODE_BURST)
{
- send_waveform_CWF( (volatile int *) ring_node_to_send_cwf_f2->buffer_address, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id );
+ send_waveform_CWF( ring_node_to_send_cwf_f2, SID_BURST_CWF_F2, headerCWF_F2_BURST, queue_id );
}
if (event_out == RTEMS_EVENT_MODE_SBM2)
{
- send_waveform_CWF( (volatile int *) ring_node_to_send_cwf_f2->buffer_address, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id );
+ send_waveform_CWF( ring_node_to_send_cwf_f2, SID_SBM2_CWF_F2, headerCWF_F2_SBM2, queue_id );
// launch snapshot extraction if needed
if (extractSWF == true)
{
@@ -529,7 +638,7 @@ rtems_task cwf1_task(rtems_task_argument
// wait for an RTEMS_EVENT
rtems_event_receive( RTEMS_EVENT_MODE_SBM1,
RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
- send_waveform_CWF( (volatile int*) ring_node_to_send_cwf_f1->buffer_address, SID_SBM1_CWF_F1, headerCWF_F1, queue_id );
+ send_waveform_CWF( ring_node_to_send_cwf_f1, SID_SBM1_CWF_F1, headerCWF_F1, queue_id );
// launch snapshot extraction if needed
if (extractSWF == true)
{
@@ -594,6 +703,8 @@ void WFP_init_rings( void )
// F3 RING
init_waveform_ring( waveform_ring_f3, NB_RING_NODES_F3, wf_cont_f3 );
+ ring_node_wf_snap_extracted.buffer_address = (int) wf_snap_extracted;
+
DEBUG_PRINTF1("waveform_ring_f0 @%x\n", (unsigned int) waveform_ring_f0)
DEBUG_PRINTF1("waveform_ring_f1 @%x\n", (unsigned int) waveform_ring_f1)
DEBUG_PRINTF1("waveform_ring_f2 @%x\n", (unsigned int) waveform_ring_f2)
@@ -622,19 +733,19 @@ void init_waveform_ring(ring_node wavefo
void WFP_reset_current_ring_nodes( void )
{
- current_ring_node_f0 = waveform_ring_f0;
- ring_node_to_send_swf_f0 = waveform_ring_f0;
+ current_ring_node_f0 = waveform_ring_f0;
+ ring_node_to_send_swf_f0 = waveform_ring_f0;
- current_ring_node_f1 = waveform_ring_f1;
- ring_node_to_send_cwf_f1 = waveform_ring_f1;
- ring_node_to_send_swf_f1 = waveform_ring_f1;
+ current_ring_node_f1 = waveform_ring_f1;
+ ring_node_to_send_cwf_f1 = waveform_ring_f1;
+ ring_node_to_send_swf_f1 = waveform_ring_f1;
- current_ring_node_f2 = waveform_ring_f2;
- ring_node_to_send_cwf_f2 = waveform_ring_f2;
- ring_node_to_send_swf_f2 = waveform_ring_f2;
+ current_ring_node_f2 = waveform_ring_f2;
+ ring_node_to_send_cwf_f2 = waveform_ring_f2;
+ ring_node_to_send_swf_f2 = waveform_ring_f2;
- current_ring_node_f3 = waveform_ring_f3;
- ring_node_to_send_cwf_f3 = waveform_ring_f3;
+ current_ring_node_f3 = waveform_ring_f3;
+ ring_node_to_send_cwf_f3 = waveform_ring_f3;
}
int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF)
@@ -780,7 +891,7 @@ int init_header_continuous_cwf3_light_ta
return return_value;
}
-int send_waveform_SWF( volatile int *waveform, unsigned int sid,
+int send_waveform_SWF( ring_node *ring_node_to_send, unsigned int sid,
Header_TM_LFR_SCIENCE_SWF_t *headerSWF, rtems_id queue_id )
{
/** This function sends SWF CCSDS packets (F2, F1 or F0).
@@ -801,18 +912,20 @@ int send_waveform_SWF( volatile int *wav
unsigned int fineTime;
rtems_status_code status;
spw_ioctl_pkt_send spw_ioctl_send_SWF;
+ int *dataPtr;
spw_ioctl_send_SWF.hlen = TM_HEADER_LEN + 4 + 12; // + 4 is for the protocole extra header, + 12 is for the auxiliary header
spw_ioctl_send_SWF.options = 0;
ret = LFR_DEFAULT;
- coarseTime = waveform[0];
- fineTime = waveform[1];
+ coarseTime = ring_node_to_send->coarseTime;
+ fineTime = ring_node_to_send->fineTime;
+ dataPtr = (int*) ring_node_to_send->buffer_address;
for (i=0; i<7; i++) // send waveform
{
- spw_ioctl_send_SWF.data = (char*) &waveform[ (i * BLK_NR_304 * NB_WORDS_SWF_BLK) + TIME_OFFSET];
+ spw_ioctl_send_SWF.data = (char*) &dataPtr[ (i * BLK_NR_304 * NB_WORDS_SWF_BLK) ];
spw_ioctl_send_SWF.hdr = (char*) &headerSWF[ i ];
// BUILD THE DATA
if (i==6) {
@@ -844,7 +957,7 @@ int send_waveform_SWF( volatile int *wav
return ret;
}
-int send_waveform_CWF(volatile int *waveform, unsigned int sid,
+int send_waveform_CWF(ring_node *ring_node_to_send, unsigned int sid,
Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id)
{
/** This function sends CWF CCSDS packets (F2, F1 or F0).
@@ -865,18 +978,20 @@ int send_waveform_CWF(volatile int *wave
unsigned int fineTime;
rtems_status_code status;
spw_ioctl_pkt_send spw_ioctl_send_CWF;
+ int *dataPtr;
spw_ioctl_send_CWF.hlen = TM_HEADER_LEN + 4 + 10; // + 4 is for the protocole extra header, + 10 is for the auxiliary header
spw_ioctl_send_CWF.options = 0;
ret = LFR_DEFAULT;
- coarseTime = waveform[0];
- fineTime = waveform[1];
+ coarseTime = ring_node_to_send->coarseTime;
+ fineTime = ring_node_to_send->fineTime;
+ dataPtr = (int*) ring_node_to_send->buffer_address;
for (i=0; icoarseTime;
+ fineTime = ring_node_to_send->fineTime;
+ dataPtr = (int*) ring_node_to_send->buffer_address;
+
//**********************
// BUILD CWF3_light DATA
for ( i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++)
{
- sample = (char*) &waveform[ (i * NB_WORDS_SWF_BLK) + TIME_OFFSET ];
- wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + TIME_OFFSET_IN_BYTES ] = sample[ 0 ];
- wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 1 + TIME_OFFSET_IN_BYTES ] = sample[ 1 ];
- wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 2 + TIME_OFFSET_IN_BYTES ] = sample[ 2 ];
- wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 3 + TIME_OFFSET_IN_BYTES ] = sample[ 3 ];
- wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 4 + TIME_OFFSET_IN_BYTES ] = sample[ 4 ];
- wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 5 + TIME_OFFSET_IN_BYTES ] = sample[ 5 ];
+ sample = (char*) &dataPtr[ (i * NB_WORDS_SWF_BLK) ];
+ wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) ] = sample[ 0 ];
+ wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 1 ] = sample[ 1 ];
+ wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 2 ] = sample[ 2 ];
+ wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 3 ] = sample[ 3 ];
+ wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 4 ] = sample[ 4 ];
+ wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 5 ] = sample[ 5 ];
}
- coarseTime = waveform[0];
- fineTime = waveform[1];
-
//*********************
// SEND CWF3_light DATA
for (i=0; ibuffer_address );
+ acquisitionTimeF0_asLong = get_acquisition_time( (unsigned char *) &ring_node_to_send->coarseTime );
// (2) compute the central reference time
centerTime_asLong = acquisitionTimeF0_asLong + deltaT_F0;
@@ -1120,7 +1247,7 @@ void build_snapshot_from_ring( ring_node
for (i=0; ibuffer_address );
+ bufferAcquisitionTime_asLong = get_acquisition_time( (unsigned char *) ring_node_to_send->coarseTime );
if (bufferAcquisitionTime_asLong <= acquisitionTime_asLong)
{
PRINTF1("buffer found with acquisition time = %llx\n", bufferAcquisitionTime_asLong)
@@ -1140,16 +1267,19 @@ void build_snapshot_from_ring( ring_node
// (7) copy the acquisition time at the beginning of the extrated snapshot
ptr1 = (unsigned char*) &acquisitionTime_asLong;
- ptr2 = (unsigned char*) wf_snap_extracted;
+ // fine time
+ ptr2 = (unsigned char*) &ring_node_wf_snap_extracted.fineTime;
+ ptr2[2] = ptr1[ 4 + 2 ];
+ ptr2[3] = ptr1[ 5 + 2 ];
+ // coarse time
+ ptr2 = (unsigned char*) &ring_node_wf_snap_extracted.coarseTime;
ptr2[0] = ptr1[ 0 + 2 ];
ptr2[1] = ptr1[ 1 + 2 ];
ptr2[2] = ptr1[ 2 + 2 ];
ptr2[3] = ptr1[ 3 + 2 ];
- ptr2[6] = ptr1[ 4 + 2 ];
- ptr2[7] = ptr1[ 5 + 2 ];
// re set the synchronization bit
- timeCharPtr = (unsigned char*) ring_node_to_send->buffer_address;
+ timeCharPtr = (unsigned char*) &ring_node_to_send->coarseTime;
ptr2[0] = ptr2[0] | (timeCharPtr[0] & 0x80); // [1000 0000]
if ( (nbSamplesPart1_asLong >= NB_SAMPLES_PER_SNAPSHOT) | (nbSamplesPart1_asLong < 0) )
@@ -1159,15 +1289,15 @@ void build_snapshot_from_ring( ring_node
// copy the part 1 of the snapshot in the extracted buffer
for ( i = 0; i < (nbSamplesPart1_asLong * NB_WORDS_SWF_BLK); i++ )
{
- wf_snap_extracted[i + TIME_OFFSET] =
- ((int*) ring_node_to_send->buffer_address)[i + (sampleOffset_asLong * NB_WORDS_SWF_BLK) + TIME_OFFSET];
+ wf_snap_extracted[i] =
+ ((int*) ring_node_to_send->buffer_address)[ i + (sampleOffset_asLong * NB_WORDS_SWF_BLK) ];
}
// copy the part 2 of the snapshot in the extracted buffer
ring_node_to_send = ring_node_to_send->next;
for ( i = (nbSamplesPart1_asLong * NB_WORDS_SWF_BLK); i < (NB_SAMPLES_PER_SNAPSHOT * NB_WORDS_SWF_BLK); i++ )
{
- wf_snap_extracted[i + TIME_OFFSET] =
- ((int*) ring_node_to_send->buffer_address)[(i-(nbSamplesPart1_asLong * NB_WORDS_SWF_BLK)) + TIME_OFFSET];
+ wf_snap_extracted[i] =
+ ((int*) ring_node_to_send->buffer_address)[ (i-(nbSamplesPart1_asLong * NB_WORDS_SWF_BLK)) ];
}
}
@@ -1216,7 +1346,7 @@ void snapshot_resynchronization( unsigne
//**************
// wfp registers
-void reset_wfp_burst_enable(void)
+void reset_wfp_burst_enable( void )
{
/** This function resets the waveform picker burst_enable register.
*
@@ -1224,7 +1354,8 @@ void reset_wfp_burst_enable(void)
*
*/
- waveform_picker_regs->run_burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
+ // [1000 000] burst f2, f1, f0 enable f3, f2, f1, f0
+ waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable & 0x80;
}
void reset_wfp_status( void )
@@ -1235,10 +1366,30 @@ void reset_wfp_status( void )
*
*/
- waveform_picker_regs->status = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
+ waveform_picker_regs->status = 0xffff;
}
-void reset_waveform_picker_regs(void)
+void reset_wfp_buffer_addresses( void )
+{
+ // F0
+ waveform_picker_regs->addr_data_f0_0 = current_ring_node_f0->buffer_address; // 0x08
+ current_ring_node_f0 = current_ring_node_f0->next;
+ waveform_picker_regs->addr_data_f0_1 = current_ring_node_f0->buffer_address; // 0x0c
+ // F1
+ waveform_picker_regs->addr_data_f1_0 = current_ring_node_f1->buffer_address; // 0x10
+ current_ring_node_f1 = current_ring_node_f1->next;
+ waveform_picker_regs->addr_data_f1_1 = current_ring_node_f1->buffer_address; // 0x14
+ // F2
+ waveform_picker_regs->addr_data_f2_0 = current_ring_node_f2->buffer_address; // 0x18
+ current_ring_node_f2 = current_ring_node_f2->next;
+ waveform_picker_regs->addr_data_f2_1 = current_ring_node_f2->buffer_address; // 0x1c
+ // F3
+ waveform_picker_regs->addr_data_f3_0 = current_ring_node_f3->buffer_address; // 0x20
+ current_ring_node_f3 = current_ring_node_f3->next;
+ waveform_picker_regs->addr_data_f3_1 = current_ring_node_f3->buffer_address; // 0x24
+}
+
+void reset_waveform_picker_regs( void )
{
/** This function resets the waveform picker module registers.
*
@@ -1263,31 +1414,34 @@ void reset_waveform_picker_regs(void)
*/
set_wfp_data_shaping(); // 0x00 *** R1 R0 SP1 SP0 BW
+
reset_wfp_burst_enable(); // 0x04 *** [run *** burst f2, f1, f0 *** enable f3, f2, f1, f0 ]
- waveform_picker_regs->addr_data_f0_0 = current_ring_node_f0->buffer_address; // 0x08
- waveform_picker_regs->addr_data_f0_1 = current_ring_node_f0->buffer_address; // 0x0c
- waveform_picker_regs->addr_data_f1_0 = current_ring_node_f1->buffer_address; // 0x10
- waveform_picker_regs->addr_data_f1_1 = current_ring_node_f1->buffer_address; // 0x14
- waveform_picker_regs->addr_data_f2_0 = current_ring_node_f2->buffer_address; // 0x18
- waveform_picker_regs->addr_data_f2_1 = current_ring_node_f2->buffer_address; // 0x1c
- waveform_picker_regs->addr_data_f3_0 = current_ring_node_f3->buffer_address; // 0x20
- waveform_picker_regs->addr_data_f3_1 = current_ring_node_f3->buffer_address; // 0x24
+
+ reset_wfp_buffer_addresses();
+
reset_wfp_status(); // 0x18
- //
- set_wfp_delta_snapshot(); // 0x1c
+
+ set_wfp_delta_snapshot(); // 0x1c *** 300 s => 0x12bff
+
set_wfp_delta_f0_f0_2(); // 0x20, 0x24
+
set_wfp_delta_f1(); // 0x28
+
set_wfp_delta_f2(); // 0x2c
- DEBUG_PRINTF1("delta_snapshot %x\n", waveform_picker_regs->delta_snapshot)
- DEBUG_PRINTF1("delta_f0 %x\n", waveform_picker_regs->delta_f0)
- DEBUG_PRINTF1("delta_f0_2 %x\n", waveform_picker_regs->delta_f0_2)
- DEBUG_PRINTF1("delta_f1 %x\n", waveform_picker_regs->delta_f1)
- DEBUG_PRINTF1("delta_f2 %x\n", waveform_picker_regs->delta_f2)
+
+ DEBUG_PRINTF1("delta_snapshot %x\n", waveform_picker_regs->delta_snapshot)
+ DEBUG_PRINTF1("delta_f0 %x\n", waveform_picker_regs->delta_f0)
+ DEBUG_PRINTF1("delta_f0_2 %x\n", waveform_picker_regs->delta_f0_2)
+ DEBUG_PRINTF1("delta_f1 %x\n", waveform_picker_regs->delta_f1)
+ DEBUG_PRINTF1("delta_f2 %x\n", waveform_picker_regs->delta_f2)
// 2688 = 8 * 336
- waveform_picker_regs->nb_data_by_buffer = 0xa7f; // 0x30 *** 2688 - 1 => nb samples -1
- waveform_picker_regs->snapshot_param = 0xa80; // 0x34 *** 2688 => nb samples
- waveform_picker_regs->start_date = 0x00; // 0x38
- waveform_picker_regs->buffer_length = 0x1f8; // buffer length in burst = 3 * 2688 / 16 = 504 = 0x1f8
+ waveform_picker_regs->nb_data_by_buffer = 0xa7f; // 0x30 *** 2688 - 1 => nb samples -1
+ waveform_picker_regs->snapshot_param = 0xa80; // 0x34 *** 2688 => nb samples
+ waveform_picker_regs->start_date = 0x7fffffff; // 0x38
+ //
+ // coarse time and fine time registers are not initialized, they are volatile
+ //
+ waveform_picker_regs->buffer_length = 0x1f8;// buffer length in burst = 3 * 2688 / 16 = 504 = 0x1f8
}
void set_wfp_data_shaping( void )
diff --git a/timegen-qt/timegen-qt.pro.user b/timegen-qt/timegen-qt.pro.user
--- a/timegen-qt/timegen-qt.pro.user
+++ b/timegen-qt/timegen-qt.pro.user
@@ -1,6 +1,6 @@
-
+
EnvironmentId