##// END OF EJS Templates
sync before modifying the snapshot resynchronization
paul -
r246:9f992c214f6f R3a
parent child
Show More
@@ -2,7 +2,7 TEMPLATE = app
2 2 # CONFIG += console v8 sim
3 3 # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report *** vhdl_dev *** debug_tch
4 4 # lpp_dpu_destid
5 CONFIG += console verbose lpp_dpu_destid cpu_usage_report stack_report
5 CONFIG += console verbose lpp_dpu_destid
6 6 CONFIG -= qt
7 7
8 8 include(./sparc.pri)
@@ -54,6 +54,10 contains( CONFIG, boot_messages ) {
54 54 DEFINES += BOOT_MESSAGES
55 55 }
56 56
57 contains( CONFIG, debug_watchdog ) {
58 DEFINES += DEBUG_WATCHDOG
59 }
60
57 61 #doxygen.target = doxygen
58 62 #doxygen.commands = doxygen ../doc/Doxyfile
59 63 #QMAKE_EXTRA_TARGETS += doxygen
@@ -215,10 +215,12 rtems_task load_task(rtems_task_argument
215 215 j = j + 1;
216 216 PRINTF1("%d\n", j)
217 217 }
218 #ifdef DEBUG_WATCHDOG
218 219 if (j == 3 )
219 220 {
220 221 status = rtems_task_delete(RTEMS_SELF);
221 222 }
223 #endif
222 224 }
223 225 }
224 226
@@ -283,20 +283,20 rtems_isr waveforms_isr( rtems_vector_nu
283 283 // STANDBY
284 284 case LFR_MODE_STANDBY:
285 285 break;
286 //**************************
287 // LFR NORMAL, SBM1 and SBM2
286 //**************************
287 // LFR NORMAL, SBM1 and SBM2
288 288 case LFR_MODE_NORMAL:
289 289 case LFR_MODE_SBM1:
290 290 case LFR_MODE_SBM2:
291 291 waveform_isr_normal_sbm1_sbm2();
292 292 break;
293 //******
294 // BURST
293 //******
294 // BURST
295 295 case LFR_MODE_BURST:
296 296 waveforms_isr_burst();
297 297 break;
298 //********
299 // DEFAULT
298 //********
299 // DEFAULT
300 300 default:
301 301 break;
302 302 }
@@ -333,12 +333,12 rtems_task wfrm_task(rtems_task_argument
333 333 status = get_message_queue_id_send( &queue_id );
334 334 if (status != RTEMS_SUCCESSFUL)
335 335 {
336 PRINTF1("in WFRM *** ERR get_message_queue_id_send %d\n", status)
336 PRINTF1("in WFRM *** ERR get_message_queue_id_send %d\n", status);
337 337 }
338 338
339 BOOT_PRINTF("in WFRM ***\n")
339 BOOT_PRINTF("in WFRM ***\n");
340 340
341 while(1){
341 while(1){
342 342 // wait for an RTEMS_EVENT
343 343 rtems_event_receive(RTEMS_EVENT_MODE_NORMAL,
344 344 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
@@ -349,15 +349,15 rtems_task wfrm_task(rtems_task_argument
349 349 }
350 350 else
351 351 { // reset delta_snapshot to the nominal value
352 PRINTF("no resynchronisation, reset delta_snapshot to the nominal value\n")
353 set_wfp_delta_snapshot();
352 PRINTF("no resynchronisation, reset delta_snapshot to the nominal value\n");
353 set_wfp_delta_snapshot();
354 354 resynchronisationEngaged = false;
355 355 }
356 356 //
357 357 if (event_out == RTEMS_EVENT_MODE_NORMAL)
358 358 {
359 DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_SBM2\n")
360 ring_node_to_send_swf_f0->sid = SID_NORM_SWF_F0;
359 DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_SBM2\n");
360 ring_node_to_send_swf_f0->sid = SID_NORM_SWF_F0;
361 361 ring_node_swf1_extracted_ptr->sid = SID_NORM_SWF_F1;
362 362 ring_node_swf2_extracted_ptr->sid = SID_NORM_SWF_F2;
363 363 status = rtems_message_queue_send( queue_id, &ring_node_to_send_swf_f0, sizeof( ring_node* ) );
@@ -459,7 +459,7 rtems_task cwf2_task(rtems_task_argument
459 459
460 460 BOOT_PRINTF("in CWF2 ***\n")
461 461
462 while(1){
462 while(1){
463 463 // wait for an RTEMS_EVENT
464 464 rtems_event_receive( RTEMS_EVENT_MODE_NORM_S1_S2 | RTEMS_EVENT_MODE_BURST,
465 465 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
@@ -818,11 +818,11 void build_snapshot_from_ring( ring_node
818 818 // (4) search the ring_node with the acquisition time <= acquisitionTime_asLong
819 819 for (i=0; i<nb_ring_nodes; i++)
820 820 {
821 PRINTF1("%d ... ", i)
821 //PRINTF1("%d ... ", i);
822 822 bufferAcquisitionTime_asLong = get_acquisition_time( (unsigned char *) &ring_node_to_send->coarseTime );
823 823 if (bufferAcquisitionTime_asLong <= acquisitionTime_asLong)
824 824 {
825 PRINTF1("buffer found with acquisition time = %llx\n", bufferAcquisitionTime_asLong)
825 //PRINTF1("buffer found with acquisition time = %llx\n", bufferAcquisitionTime_asLong);
826 826 break;
827 827 }
828 828 ring_node_to_send = ring_node_to_send->previous;
@@ -831,7 +831,7 void build_snapshot_from_ring( ring_node
831 831 // (5) compute the number of samples to take in the current buffer
832 832 sampleOffset_asLong = ((acquisitionTime_asLong - bufferAcquisitionTime_asLong) * frequency_asLong ) >> 16;
833 833 nbSamplesPart1_asLong = NB_SAMPLES_PER_SNAPSHOT - sampleOffset_asLong;
834 PRINTF2("sampleOffset_asLong = %lld, nbSamplesPart1_asLong = %lld\n", sampleOffset_asLong, nbSamplesPart1_asLong)
834 //PRINTF2("sampleOffset_asLong = %lld, nbSamplesPart1_asLong = %lld\n", sampleOffset_asLong, nbSamplesPart1_asLong);
835 835
836 836 // (6) compute the final acquisition time
837 837 acquisitionTime_asLong = bufferAcquisitionTime_asLong +
@@ -882,9 +882,10 void snapshot_resynchronization( unsigne
882 882 unsigned long long int deltaPreviousTick;
883 883 unsigned long long int deltaNextTick;
884 884 unsigned int deltaTickInF2;
885 double deltaPrevious;
886 double deltaNext;
885 double deltaPrevious_ms;
886 double deltaNext_ms;
887 887
888 // get acquisition time in fine time ticks
888 889 acquisitionTime = get_acquisition_time( timePtr );
889 890
890 891 // compute center time
@@ -895,24 +896,26 void snapshot_resynchronization( unsigne
895 896 deltaPreviousTick = centerTime - previousTick;
896 897 deltaNextTick = nextTick - centerTime;
897 898
898 deltaPrevious = ((double) deltaPreviousTick) / 65536. * 1000.;
899 deltaNext = ((double) deltaNextTick) / 65536. * 1000.;
899 deltaPrevious_ms = ((double) deltaPreviousTick) / 65536. * 1000.;
900 deltaNext_ms = ((double) deltaNextTick) / 65536. * 1000.;
900 901
901 PRINTF2("delta previous = %f ms, delta next = %f ms\n", deltaPrevious, deltaNext)
902 PRINTF2("delta previous = %llu, delta next = %llu\n", deltaPreviousTick, deltaNextTick)
902 PRINTF2("delta previous = %f ms, delta next = %f ms\n", deltaPrevious_ms, deltaNext_ms);
903 PRINTF2("delta previous = %llu fine time ticks, delta next = %llu fine time ticks\n", deltaPreviousTick, deltaNextTick);
903 904
904 // which tick is the closest
905 if (deltaPreviousTick > deltaNextTick)
905 // which tick is the closest
906 if (deltaPreviousTick > deltaNextTick)
906 907 {
907 deltaTickInF2 = floor( (deltaNext * 256. / 1000.) ); // the division by 2 is important here
908 waveform_picker_regs->delta_snapshot = waveform_picker_regs->delta_snapshot + deltaTickInF2;
909 PRINTF1("correction of = + %u\n", deltaTickInF2)
908 // deltaNext is in [ms]
909 deltaTickInF2 = floor( (deltaNext_ms * 256. / 1000.) );
910 waveform_picker_regs->delta_snapshot = waveform_picker_regs->delta_snapshot + 1 * deltaTickInF2;
911 PRINTF2("correction of = + %u, delta_snapshot = %d\n", deltaTickInF2, waveform_picker_regs->delta_snapshot);
910 912 }
911 913 else
912 914 {
913 deltaTickInF2 = floor( (deltaPrevious * 256. / 1000.) ); // the division by 2 is important here
914 waveform_picker_regs->delta_snapshot = waveform_picker_regs->delta_snapshot - deltaTickInF2;
915 PRINTF1("correction of = - %u\n", deltaTickInF2)
915 // deltaPrevious is in [ms]
916 deltaTickInF2 = floor( (deltaPrevious_ms * 256. / 1000.) );
917 waveform_picker_regs->delta_snapshot = waveform_picker_regs->delta_snapshot - 1 * deltaTickInF2;
918 PRINTF2("correction of = - %u, delta_snapshot = %d\n", deltaTickInF2, waveform_picker_regs->delta_snapshot);
916 919 }
917 920 }
918 921
General Comments 0
You need to be logged in to leave comments. Login now