##// END OF EJS Templates
spacecraft potential extraction upgraded
paul -
r130:811e6b78e458 VHDLib206
parent child
Show More
@@ -1,6 +1,6
1 1 #############################################################################
2 2 # Makefile for building: bin/fsw
3 # Generated by qmake (2.01a) (Qt 4.8.6) on: Tue May 6 08:24:43 2014
3 # Generated by qmake (2.01a) (Qt 4.8.6) on: Tue May 6 15:49:26 2014
4 4 # Project: fsw-qt.pro
5 5 # Template: app
6 6 # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
@@ -1,6 +1,6
1 1 <?xml version="1.0" encoding="UTF-8"?>
2 2 <!DOCTYPE QtCreatorProject>
3 <!-- Written by QtCreator 3.0.1, 2014-05-06T09:36:02. -->
3 <!-- Written by QtCreator 3.0.1, 2014-05-12T06:56:36. -->
4 4 <qtcreator>
5 5 <data>
6 6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
@@ -439,59 +439,61 void send_dumb_hk( void )
439 439
440 440 void get_v_e1_e2_f3( unsigned char *v, unsigned char *e1, unsigned char *e2, bool init_buffer_addr )
441 441 {
442 static int *current_addr_data_f3 = NULL;
443 int *new_addr_data_f3;
444 unsigned char *ptr;
442 unsigned int coarseTime;
443 unsigned int acquisitionTime;
444 unsigned int deltaT = 0;
445 unsigned char *bufferPtr;
445 446
446 static unsigned int counter = 0;
447 447 unsigned int offset_in_samples;
448 unsigned int offset_in_words;
449 unsigned char delta = 16; // v, e1 and e2 will be picked up each second, f3 = 16 Hz
448 unsigned int offset_in_bytes;
449 unsigned char f3 = 16; // v, e1 and e2 will be picked up each second, f3 = 16 Hz
450 450
451 new_addr_data_f3 = (int *) waveform_picker_regs->addr_data_f3;
452
453 if (init_buffer_addr == true) // when the waveform_picker is launched
451 if (lfrCurrentMode == LFR_MODE_STANDBY)
454 452 {
455 current_addr_data_f3 = NULL;
453 v[0] = 0x00;
454 v[1] = 0x00;
455 e1[0] = 0x00;
456 e1[1] = 0x00;
457 e2[0] = 0x00;
458 e2[1] = 0x00;
456 459 }
457 460 else
458 461 {
459 if (lfrCurrentMode == LFR_MODE_STANDBY)
462 coarseTime = time_management_regs->coarse_time & 0x7fffffff;
463 bufferPtr = (unsigned char*) waveform_picker_regs->addr_data_f3;
464 acquisitionTime = (unsigned int) ( ( bufferPtr[2] & 0x7f ) << 24 )
465 + (unsigned int) ( bufferPtr[3] << 16 )
466 + (unsigned int) ( bufferPtr[0] << 8 )
467 + (unsigned int) ( bufferPtr[1] );
468 if ( coarseTime > acquisitionTime )
460 469 {
461 v[0] = 0x00;
462 v[1] = 0x00;
463 e1[0] = 0x00;
464 e1[1] = 0x00;
465 e2[0] = 0x00;
466 e2[1] = 0x00;
470 deltaT = coarseTime - acquisitionTime;
471 offset_in_samples = (deltaT-1) * f3 ;
472 }
473 else if( coarseTime == acquisitionTime )
474 {
475 offset_in_samples = 0;
467 476 }
468 477 else
469 478 {
470 if ( new_addr_data_f3 != current_addr_data_f3 )
471 {
472 counter = 0;
473 offset_in_samples = 0;
474 current_addr_data_f3 = new_addr_data_f3;
475 }
476 else
477 {
478 counter = counter + 1;
479 offset_in_samples = counter * delta;
480 if ( offset_in_samples > NB_SAMPLES_PER_SNAPSHOT )
481 {
482 offset_in_samples = NB_SAMPLES_PER_SNAPSHOT -1;
483 PRINTF1("ERR *** in get_v_e1_e2_f3 *** trying to read out the buffer, counter = %d\n", counter)
484 }
485 }
486 offset_in_words = TIME_OFFSET + offset_in_samples * NB_WORDS_SWF_BLK;
487 ptr = (unsigned char*) &current_addr_data_f3[ offset_in_words ];
488 v[0] = ptr[0];
489 v[1] = ptr[1];
490 e1[0] = ptr[2];
491 e1[1] = ptr[3];
492 e2[0] = ptr[4];
493 e2[1] = ptr[5];
479 offset_in_samples = 0;
480 PRINTF2("ERR *** in get_v_e1_e2_f3 *** coarseTime = %x, acquisitionTime = %x\n", coarseTime, acquisitionTime)
481 }
482
483 if ( offset_in_samples > (NB_SAMPLES_PER_SNAPSHOT - 1) )
484 {
485 PRINTF1("ERR *** in get_v_e1_e2_f3 *** trying to read out the buffer, counter = %d\n", offset_in_samples)
486 offset_in_samples = NB_SAMPLES_PER_SNAPSHOT -1;
494 487 }
488 PRINTF1("f3 data @ %x *** ", waveform_picker_regs->addr_data_f3 )
489 PRINTF2("deltaT = %d, offset_in_samples = %d\n", deltaT, offset_in_samples )
490 offset_in_bytes = TIME_OFFSET_IN_BYTES + offset_in_samples * NB_WORDS_SWF_BLK * 4;
491 v[0] = bufferPtr[ offset_in_bytes + 0];
492 v[1] = bufferPtr[ offset_in_bytes + 1];
493 e1[0] = bufferPtr[ offset_in_bytes + 2];
494 e1[1] = bufferPtr[ offset_in_bytes + 3];
495 e2[0] = bufferPtr[ offset_in_bytes + 4];
496 e2[1] = bufferPtr[ offset_in_bytes + 5];
495 497 }
496 498 }
497 499
@@ -751,7 +751,6 void launch_waveform_picker( unsigned ch
751 751 reset_current_ring_nodes();
752 752 reset_waveform_picker_regs();
753 753 set_wfp_burst_enable_register( mode );
754 get_v_e1_e2_f3( NULL, NULL, NULL, true );
755 754
756 755 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER );
757 756 LEON_Unmask_interrupt( IRQ_WAVEFORM_PICKER );
@@ -81,6 +81,7 rtems_isr waveforms_isr( rtems_vector_nu
81 81 if (rtems_event_send( Task_id[TASKID_CWF3], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL) {
82 82 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2 );
83 83 }
84 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_2);
84 85 waveform_picker_regs->status = waveform_picker_regs->status & 0xfffff777; // reset f3 bits to 0, [1111 0111 0111 0111]
85 86 }
86 87 }
@@ -1214,7 +1215,7 void set_wfp_burst_enable_register( unsi
1214 1215 case(LFR_MODE_BURST):
1215 1216 waveform_picker_regs->run_burst_enable = 0x40; // [0100 0000] f2 burst enabled
1216 1217 // waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x04; // [0100] enable f2
1217 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x06; // [0110] enable f3 AND f2
1218 waveform_picker_regs->run_burst_enable = waveform_picker_regs->run_burst_enable | 0x0c; // [1100] enable f3 AND f2
1218 1219 break;
1219 1220 case(LFR_MODE_SBM1):
1220 1221 waveform_picker_regs->run_burst_enable = 0x20; // [0010 0000] f1 burst enabled
1 NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now