##// END OF EJS Templates
3.2.0.9...
paul -
r359:18c114e265c0 R3++ draft
parent child
Show More
@@ -175,9 +175,12 typedef struct{
175 //
175 //
176 unsigned int buffer_length; // 0x8c = buffer length in burst 2688 / 16 = 168
176 unsigned int buffer_length; // 0x8c = buffer length in burst 2688 / 16 = 168
177 //
177 //
178 volatile int v; // 0x90
178 volatile int16_t v_dummy; // 0x90
179 volatile int e1; // 0x94
179 volatile int16_t v; // 0x90
180 volatile int e2; // 0x98
180 volatile int16_t e1_dummy; // 0x94
181 volatile int16_t e1; // 0x94
182 volatile int16_t e2_dummy; // 0x98
183 volatile int16_t e2; // 0x98
181 } waveform_picker_regs_0_1_18_t;
184 } waveform_picker_regs_0_1_18_t;
182
185
183 //*********************
186 //*********************
@@ -5,5 +5,6 set(CMAKE_CXX_COMPILER /opt/rtems-4.10/b
5 set(CMAKE_LINKER /opt/rtems-4.10/bin/sparc-rtems-g++)
5 set(CMAKE_LINKER /opt/rtems-4.10/bin/sparc-rtems-g++)
6 SET(CMAKE_EXE_LINKER_FLAGS "-static")
6 SET(CMAKE_EXE_LINKER_FLAGS "-static")
7 set(CMAKE_C_FLAGS_RELEASE "-O3 -mfix-b2bst")
7 set(CMAKE_C_FLAGS_RELEASE "-O3 -mfix-b2bst")
8 #set(CMAKE_C_FLAGS_RELEASE "-O3")
8 set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_LINKER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
9 set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_LINKER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
9 include_directories("/opt/rtems-4.10/sparc-rtems/leon3/lib/include")
10 include_directories("/opt/rtems-4.10/sparc-rtems/leon3/lib/include")
@@ -64,7 +64,7 option(FSW_debug_tch "?" OFF)
64 set(SW_VERSION_N1 "3" CACHE STRING "Choose N1 FSW Version." FORCE)
64 set(SW_VERSION_N1 "3" CACHE STRING "Choose N1 FSW Version." FORCE)
65 set(SW_VERSION_N2 "2" CACHE STRING "Choose N2 FSW Version." FORCE)
65 set(SW_VERSION_N2 "2" CACHE STRING "Choose N2 FSW Version." FORCE)
66 set(SW_VERSION_N3 "0" CACHE STRING "Choose N3 FSW Version." FORCE)
66 set(SW_VERSION_N3 "0" CACHE STRING "Choose N3 FSW Version." FORCE)
67 set(SW_VERSION_N4 "8" CACHE STRING "Choose N4 FSW Version." FORCE)
67 set(SW_VERSION_N4 "9" CACHE STRING "Choose N4 FSW Version." FORCE)
68
68
69 if(FSW_verbose)
69 if(FSW_verbose)
70 add_definitions(-DPRINT_MESSAGES_ON_CONSOLE)
70 add_definitions(-DPRINT_MESSAGES_ON_CONSOLE)
@@ -347,24 +347,6 rtems_task hous_task(rtems_task_argument
347 return;
347 return;
348 }
348 }
349
349
350 int32_t getIntFromShort( int reg )
351 {
352 int16_t ret_as_int16;
353 int32_t ret_as_int32;
354 char *regPtr;
355 char *ret_as_int16_ptr;
356
357 regPtr = (char*) &reg;
358 ret_as_int16_ptr = (char*) &ret_as_int16;
359
360 ret_as_int16_ptr[BYTE_0] = regPtr[BYTE_3];
361 ret_as_int16_ptr[BYTE_1] = regPtr[BYTE_4];
362
363 ret_as_int32 = (int32_t) ret_as_int16;
364
365 return ret_as_int32;
366 }
367
368 rtems_task avgv_task(rtems_task_argument argument)
350 rtems_task avgv_task(rtems_task_argument argument)
369 {
351 {
370 #define MOVING_AVERAGE 16
352 #define MOVING_AVERAGE 16
@@ -375,9 +357,9 rtems_task avgv_task(rtems_task_argument
375 static int old_v = 0;
357 static int old_v = 0;
376 static int old_e1 = 0;
358 static int old_e1 = 0;
377 static int old_e2 = 0;
359 static int old_e2 = 0;
378 int current_v;
360 int32_t current_v;
379 int current_e1;
361 int32_t current_e1;
380 int current_e2;
362 int32_t current_e2;
381 int32_t average_v;
363 int32_t average_v;
382 int32_t average_e1;
364 int32_t average_e1;
383 int32_t average_e2;
365 int32_t average_e2;
@@ -430,14 +412,14 rtems_task avgv_task(rtems_task_argument
430 current_v = waveform_picker_regs->v;
412 current_v = waveform_picker_regs->v;
431 current_e1 = waveform_picker_regs->e1;
413 current_e1 = waveform_picker_regs->e1;
432 current_e2 = waveform_picker_regs->e2;
414 current_e2 = waveform_picker_regs->e2;
433 // if ( (current_v != old_v)
415 if ( (current_v != old_v)
434 // && (current_e1 != old_e1)
416 || (current_e1 != old_e1)
435 // && (current_e2 != old_e2))
417 || (current_e2 != old_e2))
436 // {
418 {
437 // get new values
419 // get new values
438 newValue_v = getIntFromShort( current_v );
420 newValue_v = current_v;
439 newValue_e1 = getIntFromShort( current_e1 );
421 newValue_e1 = current_e1;
440 newValue_e2 = getIntFromShort( current_e2 );
422 newValue_e2 = current_e2;
441
423
442 // compute the moving average
424 // compute the moving average
443 average_v = average_v + newValue_v - v[k];
425 average_v = average_v + newValue_v - v[k];
@@ -457,11 +439,12 rtems_task avgv_task(rtems_task_argument
457 {
439 {
458 k++;
440 k++;
459 }
441 }
442
460 //update int16 values
443 //update int16 values
461 hk_lfr_sc_v_f3_as_int16 = (int16_t) (average_v / MOVING_AVERAGE );
444 hk_lfr_sc_v_f3_as_int16 = (int16_t) (average_v / MOVING_AVERAGE );
462 hk_lfr_sc_e1_f3_as_int16 = (int16_t) (average_e1 / MOVING_AVERAGE );
445 hk_lfr_sc_e1_f3_as_int16 = (int16_t) (average_e1 / MOVING_AVERAGE );
463 hk_lfr_sc_e2_f3_as_int16 = (int16_t) (average_e2 / MOVING_AVERAGE );
446 hk_lfr_sc_e2_f3_as_int16 = (int16_t) (average_e2 / MOVING_AVERAGE );
464 // }
447 }
465 old_v = current_v;
448 old_v = current_v;
466 old_e1 = current_e1;
449 old_e1 = current_e1;
467 old_e2 = current_e2;
450 old_e2 = current_e2;
General Comments 0
You need to be logged in to leave comments. Login now