##// END OF EJS Templates
Implemented Calibrations Task...
jeandet -
r375:0ae79c717213 No PWD scrub with... draft
parent child
Show More
@@ -1,2 +1,2
1 1 3081d1f9bb20b2b64a192585337a292a9804e0c5 LFR_basic-parameters
2 db74b38fe91cd826fa49fa4eb6f93d626637ceb9 header/lfr_common_headers
2 1b9238c8848953d545d6ff9c9b8b15d19a597fb6 header/lfr_common_headers
@@ -137,6 +137,7 rtems_task hous_task( rtems_task_argumen
137 137 rtems_task avgv_task( rtems_task_argument argument );
138 138 rtems_task dumb_task( rtems_task_argument unused );
139 139 rtems_task scrubbing_task( rtems_task_argument unused );
140 rtems_task calibration_sweep_task( rtems_task_argument unused );
140 141
141 142 void init_housekeeping_parameters( void );
142 143 void increment_seq_counter(unsigned short *packetSequenceControl);
@@ -37,6 +37,8
37 37 #define CAL_NB_PTS 256
38 38 #define CAL_DATA_MASK 0xfff
39 39 #define CAL_F_DIVISOR 38 // 25 MHz => 160 256 (39 - 1)
40 #define CAL_F_DIVISOR_MIN 38
41 #define CAL_F_DIVISOR_MAX (38*2*2*2*2)
40 42 // INTERLEAVED MODE
41 43 #define CAL_FS_INTER 240384.615
42 44 #define CAL_NB_PTS_INTER 384
@@ -27,7 +27,7
27 27 #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
28 28 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
29 29
30 #define CONFIGURE_MAXIMUM_TASKS 22 // number of tasks concurrently active including INIT
30 #define CONFIGURE_MAXIMUM_TASKS 23 // number of tasks concurrently active including INIT
31 31 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
32 32 #define CONFIGURE_EXTRA_TASK_STACKS (3 * RTEMS_MINIMUM_STACK_SIZE)
33 33 #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32
@@ -378,6 +378,7 void create_names( void ) // create all
378 378 Task_name[TASKID_AVF2] = rtems_build_name( 'A', 'V', 'F', '2' );
379 379 Task_name[TASKID_PRC2] = rtems_build_name( 'P', 'R', 'C', '2' );
380 380 Task_name[TASKID_SCRB] = rtems_build_name( 'S', 'C', 'R', 'B' );
381 Task_name[TASKID_CALI] = rtems_build_name( 'C', 'A', 'L', 'I' );
381 382
382 383 // rate monotonic period names
383 384 name_hk_rate_monotonic = rtems_build_name( 'H', 'O', 'U', 'S' );
@@ -587,6 +588,14 int create_all_tasks( void ) // create a
587 588 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_AVGV]
588 589 );
589 590 }
591 if (status == RTEMS_SUCCESSFUL) // CALI
592 {
593 status = rtems_task_create(
594 Task_name[TASKID_CALI], TASK_PRIORITY_CALI, RTEMS_MINIMUM_STACK_SIZE,
595 RTEMS_DEFAULT_MODES,
596 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CALI]
597 );
598 }
590 599
591 600 return status;
592 601 }
@@ -770,6 +779,13 int start_all_tasks( void ) // start all
770 779 BOOT_PRINTF("in INIT *** Error starting TASK_LOAD\n")
771 780 }
772 781 }
782 if (status == RTEMS_SUCCESSFUL) // CALI
783 {
784 status = rtems_task_start( Task_id[TASKID_CALI], calibration_sweep_task, 1 );
785 if (status!=RTEMS_SUCCESSFUL) {
786 BOOT_PRINTF("in INIT *** Error starting TASK_LOAD\n")
787 }
788 }
773 789
774 790 return status;
775 791 }
@@ -523,7 +523,7 rtems_task dumb_task( rtems_task_argumen
523 523
524 524 rtems_task scrubbing_task( rtems_task_argument unused )
525 525 {
526 /** This RTEMS taks is to avoid entering IDLE task and also scrub memory to increase scubbing frequency.
526 /** This RTEMS taks is used to avoid entering IDLE task and also scrub memory to increase scubbing frequency.
527 527 *
528 528 * @param unused is the starting argument of the RTEMS task
529 529 *
@@ -542,6 +542,44 rtems_task scrubbing_task( rtems_task_ar
542 542 }
543 543 }
544 544
545 rtems_task calibration_sweep_task( rtems_task_argument unused )
546 {
547 /** This RTEMS taks is used to change calibration signal smapling frequency between snapshots.
548 *
549 * @param unused is the starting argument of the RTEMS task
550 *
551 * If calibration is enabled, this task will divide by two the calibration signal smapling frequency between snapshots.
552 * When minimum sampling frequency is reach it will jump to maximum sampling frequency to loop indefinitely.
553 *
554 */
555 rtems_event_set event_out;
556 BOOT_PRINTF("in calibration sweep *** \n");
557 rtems_interval ticks_per_seconds = rtems_clock_get_ticks_per_second();
558 while(1){
559 // Waiting for next F0 snapshot
560 rtems_event_receive(RTEMS_EVENT_CAL_SWEEP_WAKE, RTEMS_WAIT, RTEMS_NO_TIMEOUT, &event_out);
561 if(time_management_regs->calDACCtrl & BIT_CAL_ENABLE)
562 {
563 unsigned int delta_snapshot;
564 delta_snapshot = (parameter_dump_packet.sy_lfr_n_swf_p[0] * CONST_256)
565 + parameter_dump_packet.sy_lfr_n_swf_p[1];
566 // We are woken almost in the center of a snapshot -> let's wait for sy_lfr_n_swf_p / 2
567 rtems_task_wake_after( ticks_per_seconds * delta_snapshot / 2);
568 if(time_management_regs->calDivisor >= CAL_F_DIVISOR_MAX){
569 time_management_regs->calDivisor = CAL_F_DIVISOR_MIN;
570 }
571 else{
572 time_management_regs->calDivisor *= 2;
573 }
574 }
575
576
577
578 }
579
580 }
581
582
545 583 //*****************************
546 584 // init housekeeping parameters
547 585
@@ -204,6 +204,7 inline void waveform_isr_normal_sbm1_sbm
204 204 }
205 205 // send an event to the WFRM task for resynchro activities
206 206 status = rtems_event_send( Task_id[TASKID_WFRM], RTEMS_EVENT_SWF_RESYNCH );
207 status = rtems_event_send( Task_id[TASKID_CALI], RTEMS_EVENT_CAL_SWEEP_WAKE );
207 208 }
208 209
209 210 //***
General Comments 0
You need to be logged in to leave comments. Login now