diff --git a/header/grlib_regs.h b/header/grlib_regs.h --- a/header/grlib_regs.h +++ b/header/grlib_regs.h @@ -175,9 +175,12 @@ typedef struct{ // unsigned int buffer_length; // 0x8c = buffer length in burst 2688 / 16 = 168 // - volatile int v; // 0x90 - volatile int e1; // 0x94 - volatile int e2; // 0x98 + volatile int16_t v_dummy; // 0x90 + volatile int16_t v; // 0x90 + volatile int16_t e1_dummy; // 0x94 + volatile int16_t e1; // 0x94 + volatile int16_t e2_dummy; // 0x98 + volatile int16_t e2; // 0x98 } waveform_picker_regs_0_1_18_t; //********************* diff --git a/sparc/sparc-rtems.cmake b/sparc/sparc-rtems.cmake --- a/sparc/sparc-rtems.cmake +++ b/sparc/sparc-rtems.cmake @@ -5,5 +5,6 @@ set(CMAKE_CXX_COMPILER /opt/rtems-4.10/b set(CMAKE_LINKER /opt/rtems-4.10/bin/sparc-rtems-g++) SET(CMAKE_EXE_LINKER_FLAGS "-static") set(CMAKE_C_FLAGS_RELEASE "-O3 -mfix-b2bst") +#set(CMAKE_C_FLAGS_RELEASE "-O3") set(CMAKE_C_LINK_EXECUTABLE " -o ") include_directories("/opt/rtems-4.10/sparc-rtems/leon3/lib/include") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -64,7 +64,7 @@ option(FSW_debug_tch "?" OFF) set(SW_VERSION_N1 "3" CACHE STRING "Choose N1 FSW Version." FORCE) set(SW_VERSION_N2 "2" CACHE STRING "Choose N2 FSW Version." FORCE) set(SW_VERSION_N3 "0" CACHE STRING "Choose N3 FSW Version." FORCE) -set(SW_VERSION_N4 "8" CACHE STRING "Choose N4 FSW Version." FORCE) +set(SW_VERSION_N4 "9" CACHE STRING "Choose N4 FSW Version." FORCE) if(FSW_verbose) add_definitions(-DPRINT_MESSAGES_ON_CONSOLE) diff --git a/src/fsw_misc.c b/src/fsw_misc.c --- a/src/fsw_misc.c +++ b/src/fsw_misc.c @@ -347,24 +347,6 @@ rtems_task hous_task(rtems_task_argument return; } -int32_t getIntFromShort( int reg ) -{ - int16_t ret_as_int16; - int32_t ret_as_int32; - char *regPtr; - char *ret_as_int16_ptr; - - regPtr = (char*) ® - ret_as_int16_ptr = (char*) &ret_as_int16; - - ret_as_int16_ptr[BYTE_0] = regPtr[BYTE_3]; - ret_as_int16_ptr[BYTE_1] = regPtr[BYTE_4]; - - ret_as_int32 = (int32_t) ret_as_int16; - - return ret_as_int32; -} - rtems_task avgv_task(rtems_task_argument argument) { #define MOVING_AVERAGE 16 @@ -375,9 +357,9 @@ rtems_task avgv_task(rtems_task_argument static int old_v = 0; static int old_e1 = 0; static int old_e2 = 0; - int current_v; - int current_e1; - int current_e2; + int32_t current_v; + int32_t current_e1; + int32_t current_e2; int32_t average_v; int32_t average_e1; int32_t average_e2; @@ -430,14 +412,14 @@ rtems_task avgv_task(rtems_task_argument current_v = waveform_picker_regs->v; current_e1 = waveform_picker_regs->e1; current_e2 = waveform_picker_regs->e2; -// if ( (current_v != old_v) -// && (current_e1 != old_e1) -// && (current_e2 != old_e2)) -// { + if ( (current_v != old_v) + || (current_e1 != old_e1) + || (current_e2 != old_e2)) + { // get new values - newValue_v = getIntFromShort( current_v ); - newValue_e1 = getIntFromShort( current_e1 ); - newValue_e2 = getIntFromShort( current_e2 ); + newValue_v = current_v; + newValue_e1 = current_e1; + newValue_e2 = current_e2; // compute the moving average average_v = average_v + newValue_v - v[k]; @@ -457,11 +439,12 @@ rtems_task avgv_task(rtems_task_argument { k++; } + //update int16 values hk_lfr_sc_v_f3_as_int16 = (int16_t) (average_v / MOVING_AVERAGE ); hk_lfr_sc_e1_f3_as_int16 = (int16_t) (average_e1 / MOVING_AVERAGE ); hk_lfr_sc_e2_f3_as_int16 = (int16_t) (average_e2 / MOVING_AVERAGE ); -// } + } old_v = current_v; old_e1 = current_e1; old_e2 = current_e2;