##// END OF EJS Templates
rev 1.0.0.1
paul -
r98:b527b5cbc22e VHDLib206
parent child
Show More
@@ -1,6 +1,6
1 #############################################################################
1 #############################################################################
2 # Makefile for building: bin/fsw-vhdl-dev
2 # Makefile for building: bin/fsw
3 # Generated by qmake (2.01a) (Qt 4.8.5) on: Thu Feb 13 07:43:27 2014
3 # Generated by qmake (2.01a) (Qt 4.8.5) on: Mon Feb 17 07:55:25 2014
4 # Project: fsw-qt.pro
4 # Project: fsw-qt.pro
5 # Template: app
5 # Template: app
6 # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
6 # Command: /usr/bin/qmake-qt4 -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
@@ -10,7 +10,7
10
10
11 CC = sparc-rtems-gcc
11 CC = sparc-rtems-gcc
12 CXX = sparc-rtems-g++
12 CXX = sparc-rtems-g++
13 DEFINES = -DSW_VERSION_N1=1 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=1 -DPRINT_MESSAGES_ON_CONSOLE -DDEBUG_MESSAGES -DPRINT_TASK_STATISTICS -DVHDL_DEV
13 DEFINES = -DSW_VERSION_N1=1 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=1 -DPRINT_MESSAGES_ON_CONSOLE
14 CFLAGS = -pipe -O3 -Wall $(DEFINES)
14 CFLAGS = -pipe -O3 -Wall $(DEFINES)
15 CXXFLAGS = -pipe -O3 -Wall $(DEFINES)
15 CXXFLAGS = -pipe -O3 -Wall $(DEFINES)
16 INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header -I../../LFR_basic-parameters
16 INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header -I../../LFR_basic-parameters
@@ -89,9 +89,9 DIST = /usr/lib64/qt4/mkspecs/c
89 /usr/lib64/qt4/mkspecs/features/lex.prf \
89 /usr/lib64/qt4/mkspecs/features/lex.prf \
90 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \
90 /usr/lib64/qt4/mkspecs/features/include_source_dir.prf \
91 fsw-qt.pro
91 fsw-qt.pro
92 QMAKE_TARGET = fsw-vhdl-dev
92 QMAKE_TARGET = fsw
93 DESTDIR = bin/
93 DESTDIR = bin/
94 TARGET = bin/fsw-vhdl-dev
94 TARGET = bin/fsw
95
95
96 first: all
96 first: all
97 ####### Implicit rules
97 ####### Implicit rules
@@ -172,8 +172,8 qmake: FORCE
172 @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
172 @$(QMAKE) -spec /usr/lib64/qt4/mkspecs/linux-g++ -o Makefile fsw-qt.pro
173
173
174 dist:
174 dist:
175 @$(CHK_DIR_EXISTS) obj/fsw-vhdl-dev1.0.0 || $(MKDIR) obj/fsw-vhdl-dev1.0.0
175 @$(CHK_DIR_EXISTS) obj/fsw1.0.0 || $(MKDIR) obj/fsw1.0.0
176 $(COPY_FILE) --parents $(SOURCES) $(DIST) obj/fsw-vhdl-dev1.0.0/ && (cd `dirname obj/fsw-vhdl-dev1.0.0` && $(TAR) fsw-vhdl-dev1.0.0.tar fsw-vhdl-dev1.0.0 && $(COMPRESS) fsw-vhdl-dev1.0.0.tar) && $(MOVE) `dirname obj/fsw-vhdl-dev1.0.0`/fsw-vhdl-dev1.0.0.tar.gz . && $(DEL_FILE) -r obj/fsw-vhdl-dev1.0.0
176 $(COPY_FILE) --parents $(SOURCES) $(DIST) obj/fsw1.0.0/ && (cd `dirname obj/fsw1.0.0` && $(TAR) fsw1.0.0.tar fsw1.0.0 && $(COMPRESS) fsw1.0.0.tar) && $(MOVE) `dirname obj/fsw1.0.0`/fsw1.0.0.tar.gz . && $(DEL_FILE) -r obj/fsw1.0.0
177
177
178
178
179 clean:compiler_clean
179 clean:compiler_clean
@@ -7,7 +7,7 proxy.loadSysDriverToParent("dsu3plugin"
7 BUTTON_selectGRESB.click()
7 BUTTON_selectGRESB.click()
8
8
9 BUTTON_rmapOpenCommunication.click()
9 BUTTON_rmapOpenCommunication.click()
10 dsu3plugin0.openFile("/opt/DEV_PLE/FSW-qt/bin/fsw-vhdl-dev")
10 dsu3plugin0.openFile("/opt/DEV_PLE/FSW-qt/bin/fsw")
11 dsu3plugin0.loadFile()
11 dsu3plugin0.loadFile()
12 dsu3plugin0.run()
12 dsu3plugin0.run()
13
13
@@ -1,6 +1,6
1 #!/usr/bin/lppmon -e
1 #!/usr/bin/lppmon -e
2
2
3 dsu3plugin0.openFile("/opt/DEV_PLE/FSW-qt/bin/fsw-vhdl-dev")
3 dsu3plugin0.openFile("/opt/DEV_PLE/FSW-qt/bin/fsw")
4 dsu3plugin0.loadFile()
4 dsu3plugin0.loadFile()
5 dsu3plugin0.run()
5 dsu3plugin0.run()
6
6
@@ -1,7 +1,7
1 TEMPLATE = app
1 TEMPLATE = app
2 # CONFIG += console v8 sim
2 # CONFIG += console v8 sim
3 # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report *** gsa *** vhdl_dev
3 # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report
4 CONFIG += console verbose debug_messages vhdl_dev cpu_usage_report
4 CONFIG += console verbose
5 CONFIG -= qt
5 CONFIG -= qt
6
6
7 include(./sparc.pri)
7 include(./sparc.pri)
@@ -38,16 +38,6 contains( CONFIG, boot_messages ) {
38 #QMAKE_EXTRA_TARGETS += doxygen
38 #QMAKE_EXTRA_TARGETS += doxygen
39
39
40 TARGET = fsw
40 TARGET = fsw
41 contains( CONFIG, gsa ) {
42 DEFINES += GSA
43 TARGET = fsw-gsa
44 }
45
46 TARGET = fsw
47 contains( CONFIG, vhdl_dev ) {
48 DEFINES += VHDL_DEV
49 TARGET = fsw-vhdl-dev
50 }
51
41
52 INCLUDEPATH += \
42 INCLUDEPATH += \
53 ../src \
43 ../src \
@@ -29,8 +29,9 typedef struct ring_node_sm
29 // flight software version
29 // flight software version
30 // this parameters is handled by the Qt project options
30 // this parameters is handled by the Qt project options
31
31
32 //#define NB_SAMPLES_PER_SNAPSHOT 2048
32 #define NB_PACKETS_PER_GROUP_OF_CWF 8 // 8 packets containing 336 blk
33 #define NB_SAMPLES_PER_SNAPSHOT 2352 // 336 * 7 = 2352
33 #define NB_PACKETS_PER_GROUP_OF_CWF_LIGHT 4 // 4 packets containing 672 blk
34 #define NB_SAMPLES_PER_SNAPSHOT 2688 // 336 * 8 = 672 * 4 = 2688
34 #define TIME_OFFSET 2
35 #define TIME_OFFSET 2
35 #define TIME_OFFSET_IN_BYTES 8
36 #define TIME_OFFSET_IN_BYTES 8
36 #define WAVEFORM_EXTENDED_HEADER_OFFSET 22
37 #define WAVEFORM_EXTENDED_HEADER_OFFSET 22
@@ -75,6 +76,7 typedef struct ring_node_sm
75 #define SY_LFR_N_ASM_P 3600 // sec
76 #define SY_LFR_N_ASM_P 3600 // sec
76 #define SY_LFR_N_BP_P0 4 // sec
77 #define SY_LFR_N_BP_P0 4 // sec
77 #define SY_LFR_N_BP_P1 20 // sec
78 #define SY_LFR_N_BP_P1 20 // sec
79 #define SY_LFR_N_CWF_LONG_F3 0 // 0 => production of light continuous waveforms at f3
78 #define MIN_DELTA_SNAPSHOT 16 // sec
80 #define MIN_DELTA_SNAPSHOT 16 // sec
79 // BURST
81 // BURST
80 #define DEFAULT_SY_LFR_B_BP_P0 1 // sec
82 #define DEFAULT_SY_LFR_B_BP_P0 1 // sec
@@ -103,11 +105,7 typedef struct ring_node_sm
103 #define REGS_ADDR_GRSPW 0x80000500
105 #define REGS_ADDR_GRSPW 0x80000500
104 #define REGS_ADDR_TIME_MANAGEMENT 0x80000600
106 #define REGS_ADDR_TIME_MANAGEMENT 0x80000600
105 #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00
107 #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00
106
107 #ifdef GSA
108 #else
109 #define REGS_ADDR_WAVEFORM_PICKER 0x80000f20
108 #define REGS_ADDR_WAVEFORM_PICKER 0x80000f20
110 #endif
111
109
112 #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff
110 #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff
113 #define APBUART_CTRL_REG_MASK_TE 0x00000002
111 #define APBUART_CTRL_REG_MASK_TE 0x00000002
@@ -33,13 +33,8 int action_update_time(ccsdsTelecommandP
33
33
34 // mode transition
34 // mode transition
35 int transition_validation(unsigned char requestedMode);
35 int transition_validation(unsigned char requestedMode);
36 int stop_current_mode();
36 int stop_current_mode( void );
37 int enter_mode(unsigned char mode);
37 int enter_mode(unsigned char mode);
38 int enter_standby_mode();
39 int enter_normal_mode();
40 int enter_burst_mode();
41 int enter_sbm1_mode();
42 int enter_sbm2_mode();
43 int restart_science_tasks();
38 int restart_science_tasks();
44 int suspend_science_tasks();
39 int suspend_science_tasks();
45 void launch_waveform_picker( unsigned char mode );
40 void launch_waveform_picker( unsigned char mode );
@@ -27,11 +27,7 extern volatile int wf_cont_f3_a[ ];
27 extern volatile int wf_cont_f3_b[ ];
27 extern volatile int wf_cont_f3_b[ ];
28 extern char wf_cont_f3_light[ ];
28 extern char wf_cont_f3_light[ ];
29
29
30 #ifdef VHDL_DEV
31 extern waveform_picker_regs_new_t *waveform_picker_regs;
30 extern waveform_picker_regs_new_t *waveform_picker_regs;
32 #else
33 extern waveform_picker_regs_t *waveform_picker_regs;
34 #endif
35 extern time_management_regs_t *time_management_regs;
31 extern time_management_regs_t *time_management_regs;
36 extern Packet_TM_LFR_HK_t housekeeping_packet;
32 extern Packet_TM_LFR_HK_t housekeeping_packet;
37 extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
33 extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet;
@@ -66,7 +62,8 int send_waveform_CWF( volatile int *wa
66 int send_waveform_CWF3( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
62 int send_waveform_CWF3( volatile int *waveform, unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
67 int send_waveform_CWF3_light( volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
63 int send_waveform_CWF3_light( volatile int *waveform, Header_TM_LFR_SCIENCE_CWF_t *headerCWF, rtems_id queue_id );
68 //
64 //
69 void compute_acquisition_time(unsigned int *coarseTime, unsigned int *fineTime, unsigned int sid, unsigned char pa_lfr_pkt_nr );
65 void compute_acquisition_time(unsigned int coarseTime, unsigned int fineTime,
66 unsigned int sid, unsigned char pa_lfr_pkt_nr, unsigned char *acquisitionTime );
70 //
67 //
71 rtems_id get_pkts_queue_id( void );
68 rtems_id get_pkts_queue_id( void );
72
69
@@ -51,12 +51,7 volatile int sm_f2[ NB_RING_NODES_ASM_F2
51 // APB CONFIGURATION REGISTERS
51 // APB CONFIGURATION REGISTERS
52 time_management_regs_t *time_management_regs = (time_management_regs_t*) REGS_ADDR_TIME_MANAGEMENT;
52 time_management_regs_t *time_management_regs = (time_management_regs_t*) REGS_ADDR_TIME_MANAGEMENT;
53 gptimer_regs_t *gptimer_regs = (gptimer_regs_t *) REGS_ADDR_GPTIMER;
53 gptimer_regs_t *gptimer_regs = (gptimer_regs_t *) REGS_ADDR_GPTIMER;
54
55 #ifdef VHDL_DEV
56 waveform_picker_regs_new_t *waveform_picker_regs = (waveform_picker_regs_new_t*) REGS_ADDR_WAVEFORM_PICKER;
54 waveform_picker_regs_new_t *waveform_picker_regs = (waveform_picker_regs_new_t*) REGS_ADDR_WAVEFORM_PICKER;
57 #else
58 waveform_picker_regs_t *waveform_picker_regs = (waveform_picker_regs_t*) REGS_ADDR_WAVEFORM_PICKER;
59 #endif
60 spectral_matrix_regs_t *spectral_matrix_regs = (spectral_matrix_regs_t*) REGS_ADDR_SPECTRAL_MATRIX;
55 spectral_matrix_regs_t *spectral_matrix_regs = (spectral_matrix_regs_t*) REGS_ADDR_SPECTRAL_MATRIX;
61
56
62 // MODE PARAMETERS
57 // MODE PARAMETERS
@@ -79,16 +79,17 rtems_task Init( rtems_task_argument ign
79 send_console_outputs_on_apbuart_port();
79 send_console_outputs_on_apbuart_port();
80 set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE);
80 set_apbuart_scaler_reload_register(REGS_ADDR_APBUART, APBUART_SCALER_RELOAD_VALUE);
81 enable_apbuart_transmitter();
81 enable_apbuart_transmitter();
82 PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n")
82 DEBUG_PRINTF("\n\n\n\n\nIn INIT *** Now the console is on port COM1\n")
83
83
84 BOOT_PRINTF("\n\n\n\n\n")
84 PRINTF("\n\n\n\n\n")
85 BOOT_PRINTF("***************************\n")
85 PRINTF("*************************\n")
86 BOOT_PRINTF("** START Flight Software **\n")
86 PRINTF("** LFR Flight Software **\n")
87 #ifdef VHDL_DEV
87 PRINTF1("** %d.", SW_VERSION_N1)
88 PRINTF("/!\\ this is the VHDL_DEV flight software /!\\ \n")
88 PRINTF1("%d.", SW_VERSION_N2)
89 #endif
89 PRINTF1("%d.", SW_VERSION_N3)
90 BOOT_PRINTF("***************************\n")
90 PRINTF1("%d\n", SW_VERSION_N4)
91 BOOT_PRINTF("\n\n")
91 PRINTF("*************************\n")
92 PRINTF("\n\n")
92
93
93 reset_wfp_burst_enable(); // stop the waveform picker if it was running
94 reset_wfp_burst_enable(); // stop the waveform picker if it was running
94 init_waveform_rings(); // initialize the waveform rings
95 init_waveform_rings(); // initialize the waveform rings
@@ -364,7 +365,7 int create_all_tasks( void ) // create a
364 status = rtems_task_create(
365 status = rtems_task_create(
365 Task_name[TASKID_CWF3], TASK_PRIORITY_CWF3, RTEMS_MINIMUM_STACK_SIZE,
366 Task_name[TASKID_CWF3], TASK_PRIORITY_CWF3, RTEMS_MINIMUM_STACK_SIZE,
366 RTEMS_DEFAULT_MODES,
367 RTEMS_DEFAULT_MODES,
367 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF3]
368 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF3]
368 );
369 );
369 }
370 }
370 if (status == RTEMS_SUCCESSFUL) // CWF2
371 if (status == RTEMS_SUCCESSFUL) // CWF2
@@ -372,7 +373,7 int create_all_tasks( void ) // create a
372 status = rtems_task_create(
373 status = rtems_task_create(
373 Task_name[TASKID_CWF2], TASK_PRIORITY_CWF2, RTEMS_MINIMUM_STACK_SIZE,
374 Task_name[TASKID_CWF2], TASK_PRIORITY_CWF2, RTEMS_MINIMUM_STACK_SIZE,
374 RTEMS_DEFAULT_MODES,
375 RTEMS_DEFAULT_MODES,
375 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF2]
376 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF2]
376 );
377 );
377 }
378 }
378 if (status == RTEMS_SUCCESSFUL) // CWF1
379 if (status == RTEMS_SUCCESSFUL) // CWF1
@@ -380,7 +381,7 int create_all_tasks( void ) // create a
380 status = rtems_task_create(
381 status = rtems_task_create(
381 Task_name[TASKID_CWF1], TASK_PRIORITY_CWF1, RTEMS_MINIMUM_STACK_SIZE,
382 Task_name[TASKID_CWF1], TASK_PRIORITY_CWF1, RTEMS_MINIMUM_STACK_SIZE,
382 RTEMS_DEFAULT_MODES,
383 RTEMS_DEFAULT_MODES,
383 RTEMS_DEFAULT_ATTRIBUTES, &Task_id[TASKID_CWF1]
384 RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT, &Task_id[TASKID_CWF1]
384 );
385 );
385 }
386 }
386 if (status == RTEMS_SUCCESSFUL) // SEND
387 if (status == RTEMS_SUCCESSFUL) // SEND
@@ -87,7 +87,7 rtems_task spiq_task(rtems_task_argument
87 if ( status != RTEMS_SUCCESSFUL ) {
87 if ( status != RTEMS_SUCCESSFUL ) {
88 PRINTF1("in SPIQ *** ERR stop_current_mode *** code %d\n", status)
88 PRINTF1("in SPIQ *** ERR stop_current_mode *** code %d\n", status)
89 }
89 }
90 status = enter_standby_mode();
90 status = enter_mode( LFR_MODE_STANDBY );
91 if ( status != RTEMS_SUCCESSFUL ) {
91 if ( status != RTEMS_SUCCESSFUL ) {
92 PRINTF1("in SPIQ *** ERR enter_standby_mode *** code %d\n", status)
92 PRINTF1("in SPIQ *** ERR enter_standby_mode *** code %d\n", status)
93 }
93 }
@@ -379,7 +379,7 int transition_validation(unsigned char
379 return status;
379 return status;
380 }
380 }
381
381
382 int stop_current_mode()
382 int stop_current_mode(void)
383 {
383 {
384 /** This function stops the current mode by masking interrupt lines and suspending science tasks.
384 /** This function stops the current mode by masking interrupt lines and suspending science tasks.
385 *
385 *
@@ -438,46 +438,25 int enter_mode(unsigned char mode )
438 housekeeping_packet.lfr_status_word[0] = (unsigned char) ((mode << 4) + 0x0d);
438 housekeeping_packet.lfr_status_word[0] = (unsigned char) ((mode << 4) + 0x0d);
439 updateLFRCurrentMode();
439 updateLFRCurrentMode();
440
440
441 switch(mode){
441 if ( (mode == LFR_MODE_NORMAL) || (mode == LFR_MODE_BURST)
442 case LFR_MODE_STANDBY:
442 || (mode == LFR_MODE_SBM1) || (mode == LFR_MODE_SBM2) )
443 status = enter_standby_mode( );
443 {
444 break;
444 status = restart_science_tasks();
445 case LFR_MODE_NORMAL:
445 launch_waveform_picker( mode );
446 status = enter_normal_mode( );
446 // launch_spectral_matrix( mode );
447 break;
447 }
448 case LFR_MODE_BURST:
448 else if ( mode == LFR_MODE_STANDBY )
449 status = enter_burst_mode( );
449 {
450 break;
450 status = stop_current_mode();
451 case LFR_MODE_SBM1:
451 }
452 status = enter_sbm1_mode( );
452 else
453 break;
453 {
454 case LFR_MODE_SBM2:
455 status = enter_sbm2_mode( );
456 break;
457 default:
458 status = RTEMS_UNSATISFIED;
454 status = RTEMS_UNSATISFIED;
459 }
455 }
460
456
461 if (status != RTEMS_SUCCESSFUL)
457 if (mode == LFR_MODE_STANDBY)
462 {
458 {
463 PRINTF("in enter_mode *** ERR\n")
464 status = RTEMS_UNSATISFIED;
465 }
466
467 return status;
468 }
469
470 int enter_standby_mode()
471 {
472 /** This function is used to enter the STANDBY mode.
473 *
474 * @return RTEMS directive status codes:
475 * - RTEMS_SUCCESSFUL - the mode has been entered successfully
476 *
477 */
478
479 PRINTF1("maxCount = %d\n", maxCount)
459 PRINTF1("maxCount = %d\n", maxCount)
480
481 #ifdef PRINT_TASK_STATISTICS
460 #ifdef PRINT_TASK_STATISTICS
482 rtems_cpu_usage_report();
461 rtems_cpu_usage_report();
483 #endif
462 #endif
@@ -485,82 +464,14 int enter_standby_mode()
485 #ifdef PRINT_STACK_REPORT
464 #ifdef PRINT_STACK_REPORT
486 rtems_stack_checker_report_usage();
465 rtems_stack_checker_report_usage();
487 #endif
466 #endif
488
489 return LFR_SUCCESSFUL;
490 }
491
492 int enter_normal_mode()
493 {
494 rtems_status_code status;
495
496 status = restart_science_tasks();
497
498 launch_waveform_picker( LFR_MODE_NORMAL );
499 // launch_spectral_matrix( LFR_MODE_NORMAL );
500
501 return status;
502 }
503
504 int enter_burst_mode()
505 {
506 /** This function is used to enter the STANDBY mode.
507 *
508 * @return RTEMS directive status codes:
509 * - RTEMS_SUCCESSFUL - the mode has been entered successfully
510 * - RTEMS_INVALID_ID - task id invalid
511 * - RTEMS_INCORRECT_STATE - task never started
512 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
513 *
514 */
515
516 rtems_status_code status;
517
518 status = restart_science_tasks();
519
520 launch_waveform_picker( LFR_MODE_BURST );
521
522 return status;
523 }
467 }
524
468
525 int enter_sbm1_mode()
469 if (status != RTEMS_SUCCESSFUL)
526 {
470 {
527 /** This function is used to enter the SBM1 mode.
471 PRINTF1("in enter_mode *** ERR = %d\n", status)
528 *
472 status = RTEMS_UNSATISFIED;
529 * @return RTEMS directive status codes:
530 * - RTEMS_SUCCESSFUL - the mode has been entered successfully
531 * - RTEMS_INVALID_ID - task id invalid
532 * - RTEMS_INCORRECT_STATE - task never started
533 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
534 *
535 */
536
537 rtems_status_code status;
538
539 status = restart_science_tasks();
540
541 launch_waveform_picker( LFR_MODE_SBM1 );
542
543 return status;
544 }
473 }
545
474
546 int enter_sbm2_mode()
547 {
548 /** This function is used to enter the SBM2 mode.
549 *
550 * @return RTEMS directive status codes:
551 * - RTEMS_SUCCESSFUL - the mode has been entered successfully
552 * - RTEMS_INVALID_ID - task id invalid
553 * - RTEMS_INCORRECT_STATE - task never started
554 * - RTEMS_ILLEGAL_ON_REMOTE_OBJECT - cannot restart remote task
555 *
556 */
557
558 rtems_status_code status;
559
560 status = restart_science_tasks();
561
562 launch_waveform_picker( LFR_MODE_SBM2 );
563
564 return status;
475 return status;
565 }
476 }
566
477
@@ -73,7 +73,7 int action_load_normal_par(ccsdsTelecomm
73 }
73 }
74
74
75 //***************
75 //***************
76 // SY_LFR_N_ASM_P
76 // sy_lfr_n_asm_p
77 if (flag == LFR_SUCCESSFUL)
77 if (flag == LFR_SUCCESSFUL)
78 {
78 {
79 result = set_sy_lfr_n_asm_p( TC, queue_id );
79 result = set_sy_lfr_n_asm_p( TC, queue_id );
@@ -84,7 +84,7 int action_load_normal_par(ccsdsTelecomm
84 }
84 }
85
85
86 //***************
86 //***************
87 // SY_LFR_N_BP_P0
87 // sy_lfr_n_bp_p0
88 if (flag == LFR_SUCCESSFUL)
88 if (flag == LFR_SUCCESSFUL)
89 {
89 {
90 result = set_sy_lfr_n_bp_p0( TC, queue_id );
90 result = set_sy_lfr_n_bp_p0( TC, queue_id );
@@ -457,6 +457,7 void init_parameter_dump( void )
457 parameter_dump_packet.sy_lfr_n_asm_p[1] = (unsigned char) (SY_LFR_N_ASM_P );
457 parameter_dump_packet.sy_lfr_n_asm_p[1] = (unsigned char) (SY_LFR_N_ASM_P );
458 parameter_dump_packet.sy_lfr_n_bp_p0 = (unsigned char) SY_LFR_N_BP_P0;
458 parameter_dump_packet.sy_lfr_n_bp_p0 = (unsigned char) SY_LFR_N_BP_P0;
459 parameter_dump_packet.sy_lfr_n_bp_p1 = (unsigned char) SY_LFR_N_BP_P1;
459 parameter_dump_packet.sy_lfr_n_bp_p1 = (unsigned char) SY_LFR_N_BP_P1;
460 parameter_dump_packet.sy_lfr_n_cwf_long_f3 = (unsigned char) SY_LFR_N_CWF_LONG_F3;
460
461
461 //*****************
462 //*****************
462 // BURST PARAMETERS
463 // BURST PARAMETERS
@@ -16,11 +16,11 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F0
16 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F1[7];
16 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F1[7];
17 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F2[7];
17 Header_TM_LFR_SCIENCE_SWF_t headerSWF_F2[7];
18 // CWF
18 // CWF
19 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F1[7];
19 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F1[ NB_PACKETS_PER_GROUP_OF_CWF ];
20 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_BURST[7];
20 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_BURST[ NB_PACKETS_PER_GROUP_OF_CWF ];
21 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_SBM2[7];
21 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F2_SBM2[ NB_PACKETS_PER_GROUP_OF_CWF ];
22 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3[7];
22 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3[ NB_PACKETS_PER_GROUP_OF_CWF ];
23 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3_light[7];
23 Header_TM_LFR_SCIENCE_CWF_t headerCWF_F3_light[ NB_PACKETS_PER_GROUP_OF_CWF_LIGHT ];
24
24
25 //**************
25 //**************
26 // waveform ring
26 // waveform ring
@@ -429,7 +429,14 rtems_task cwf3_task(rtems_task_argument
429 // wait for an RTEMS_EVENT
429 // wait for an RTEMS_EVENT
430 rtems_event_receive( RTEMS_EVENT_0,
430 rtems_event_receive( RTEMS_EVENT_0,
431 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
431 RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out);
432 PRINTF("send CWF F3 \n")
432 if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01)
433 {
434 PRINTF("send CWF_LONG_F3\n")
435 }
436 else
437 {
438 PRINTF("send CWF_F3 (light)\n")
439 }
433 if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3_a) {
440 if (waveform_picker_regs->addr_data_f3 == (int) wf_cont_f3_a) {
434 if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01)
441 if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01)
435 {
442 {
@@ -442,7 +449,7 rtems_task cwf3_task(rtems_task_argument
442 }
449 }
443 else
450 else
444 {
451 {
445 if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x00)
452 if ( (parameter_dump_packet.sy_lfr_n_cwf_long_f3 & 0x01) == 0x01)
446 {
453 {
447 send_waveform_CWF( wf_cont_f3_a, SID_NORM_CWF_LONG_F3, headerCWF_F3, queue_id );
454 send_waveform_CWF( wf_cont_f3_a, SID_NORM_CWF_LONG_F3, headerCWF_F3, queue_id );
448 }
455 }
@@ -688,7 +695,7 int init_header_continuous_wf_table( uns
688 {
695 {
689 unsigned int i;
696 unsigned int i;
690
697
691 for (i=0; i<7; i++)
698 for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF; i++)
692 {
699 {
693 headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
700 headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
694 headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
701 headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
@@ -732,7 +739,7 int init_header_continuous_cwf3_light_ta
732 {
739 {
733 unsigned int i;
740 unsigned int i;
734
741
735 for (i=0; i<7; i++)
742 for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF_LIGHT; i++)
736 {
743 {
737 headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
744 headerCWF[ i ].targetLogicalAddress = CCSDS_DESTINATION_ID;
738 headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
745 headerCWF[ i ].protocolIdentifier = CCSDS_PROTOCOLE_ID;
@@ -794,16 +801,15 int send_waveform_SWF( volatile int *wav
794
801
795 ret = LFR_DEFAULT;
802 ret = LFR_DEFAULT;
796
803
797 PRINTF1("sid = %d, ", sid)
804 DEBUG_PRINTF1("sid = %d, ", sid)
798 PRINTF2("coarse = %x, fine = %x\n", waveform[0], waveform[1])
805 DEBUG_PRINTF2("coarse = %x, fine = %x\n", waveform[0], waveform[1])
806
807 coarseTime = waveform[0];
808 fineTime = waveform[1];
799
809
800 for (i=0; i<7; i++) // send waveform
810 for (i=0; i<7; i++) // send waveform
801 {
811 {
802 #ifdef VHDL_DEV
803 spw_ioctl_send_SWF.data = (char*) &waveform[ (i * BLK_NR_304 * NB_WORDS_SWF_BLK) + TIME_OFFSET];
812 spw_ioctl_send_SWF.data = (char*) &waveform[ (i * BLK_NR_304 * NB_WORDS_SWF_BLK) + TIME_OFFSET];
804 #else
805 spw_ioctl_send_SWF.data = (char*) &waveform[ (i * BLK_NR_304 * NB_WORDS_SWF_BLK) ];
806 #endif
807 spw_ioctl_send_SWF.hdr = (char*) &headerSWF[ i ];
813 spw_ioctl_send_SWF.hdr = (char*) &headerSWF[ i ];
808 // BUILD THE DATA
814 // BUILD THE DATA
809 if (i==6) {
815 if (i==6) {
@@ -815,25 +821,8 int send_waveform_SWF( volatile int *wav
815 // SET PACKET SEQUENCE COUNTER
821 // SET PACKET SEQUENCE COUNTER
816 increment_seq_counter_source_id( headerSWF[ i ].packetSequenceControl, sid );
822 increment_seq_counter_source_id( headerSWF[ i ].packetSequenceControl, sid );
817 // SET PACKET TIME
823 // SET PACKET TIME
818 #ifdef VHDL_DEV
824 compute_acquisition_time( coarseTime, fineTime, sid, i, headerSWF[ i ].acquisitionTime );
819 coarseTime = waveform[0];
825 //
820 fineTime = waveform[1];
821 compute_acquisition_time( &coarseTime, &fineTime, sid, i);
822
823 headerSWF[ i ].acquisitionTime[0] = (unsigned char) (coarseTime >> 24 );
824 headerSWF[ i ].acquisitionTime[1] = (unsigned char) (coarseTime >> 16 );
825 headerSWF[ i ].acquisitionTime[2] = (unsigned char) (coarseTime >> 8 );
826 headerSWF[ i ].acquisitionTime[3] = (unsigned char) (coarseTime );
827 headerSWF[ i ].acquisitionTime[4] = (unsigned char) (fineTime >> 8 );
828 headerSWF[ i ].acquisitionTime[5] = (unsigned char) (fineTime );
829 #else
830 headerSWF[ i ].acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24);
831 headerSWF[ i ].acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16);
832 headerSWF[ i ].acquisitionTime[2] = (unsigned char) (time_management_regs->coarse_time>>8);
833 headerSWF[ i ].acquisitionTime[3] = (unsigned char) (time_management_regs->coarse_time);
834 headerSWF[ i ].acquisitionTime[4] = (unsigned char) (time_management_regs->fine_time>>8);
835 headerSWF[ i ].acquisitionTime[5] = (unsigned char) (time_management_regs->fine_time);
836 #endif
837 headerSWF[ i ].time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
826 headerSWF[ i ].time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
838 headerSWF[ i ].time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
827 headerSWF[ i ].time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
839 headerSWF[ i ].time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
828 headerSWF[ i ].time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
@@ -846,7 +835,7 int send_waveform_SWF( volatile int *wav
846 printf("%d-%d, ERR %d\n", sid, i, (int) status);
835 printf("%d-%d, ERR %d\n", sid, i, (int) status);
847 ret = LFR_DEFAULT;
836 ret = LFR_DEFAULT;
848 }
837 }
849 // rtems_task_wake_after(TIME_BETWEEN_TWO_SWF_PACKETS); // 300 ms between each packet => 7 * 3 = 21 packets => 6.3 seconds
838 rtems_task_wake_after(TIME_BETWEEN_TWO_SWF_PACKETS); // 300 ms between each packet => 7 * 3 = 21 packets => 6.3 seconds
850 }
839 }
851
840
852 return ret;
841 return ret;
@@ -869,8 +858,8 int send_waveform_CWF(volatile int *wave
869
858
870 unsigned int i;
859 unsigned int i;
871 int ret;
860 int ret;
872 unsigned char *coarseTimePtr;
861 unsigned int coarseTime;
873 unsigned char *fineTimePtr;
862 unsigned int fineTime;
874 rtems_status_code status;
863 rtems_status_code status;
875 spw_ioctl_pkt_send spw_ioctl_send_CWF;
864 spw_ioctl_pkt_send spw_ioctl_send_CWF;
876
865
@@ -879,47 +868,26 int send_waveform_CWF(volatile int *wave
879
868
880 ret = LFR_DEFAULT;
869 ret = LFR_DEFAULT;
881
870
882 for (i=0; i<7; i++) // send waveform
871 coarseTime = waveform[0];
872 fineTime = waveform[1];
873
874 for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF; i++) // send waveform
883 {
875 {
884 int coarseTime = 0x00;
885 int fineTime = 0x00;
886 #ifdef VHDL_DEV
887 spw_ioctl_send_CWF.data = (char*) &waveform[ (i * BLK_NR_CWF * NB_WORDS_SWF_BLK) + TIME_OFFSET];
876 spw_ioctl_send_CWF.data = (char*) &waveform[ (i * BLK_NR_CWF * NB_WORDS_SWF_BLK) + TIME_OFFSET];
888 #else
889 spw_ioctl_send_CWF.data = (char*) &waveform[ (i * BLK_NR_CWF * NB_WORDS_SWF_BLK) ];
890 #endif
891 spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ];
877 spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ];
892 // BUILD THE DATA
878 // BUILD THE DATA
893 spw_ioctl_send_CWF.dlen = BLK_NR_CWF * NB_BYTES_SWF_BLK;
879 spw_ioctl_send_CWF.dlen = BLK_NR_CWF * NB_BYTES_SWF_BLK;
894 // SET PACKET SEQUENCE COUNTER
880 // SET PACKET SEQUENCE COUNTER
895 increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, sid );
881 increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, sid );
896 // SET PACKET TIME
882 // SET PACKET TIME
897 #ifdef VHDL_DEV
883 compute_acquisition_time( coarseTime, fineTime, sid, i, headerCWF[ i ].acquisitionTime);
898 coarseTimePtr = (unsigned char *) &waveform;
884 //
899 fineTimePtr = (unsigned char *) &waveform[1];
885 headerCWF[ i ].time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
900 headerCWF[ i ].acquisitionTime[0] = coarseTimePtr[2];
886 headerCWF[ i ].time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
901 headerCWF[ i ].acquisitionTime[1] = coarseTimePtr[3];
887 headerCWF[ i ].time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
902 headerCWF[ i ].acquisitionTime[2] = coarseTimePtr[0];
888 headerCWF[ i ].time[3] = (unsigned char) (time_management_regs->coarse_time);
903 headerCWF[ i ].acquisitionTime[3] = coarseTimePtr[1];
889 headerCWF[ i ].time[4] = (unsigned char) (time_management_regs->fine_time>>8);
904 headerCWF[ i ].acquisitionTime[4] = fineTimePtr[0];
890 headerCWF[ i ].time[5] = (unsigned char) (time_management_regs->fine_time);
905 headerCWF[ i ].acquisitionTime[5] = fineTimePtr[1];
906 #else
907 coarseTime = time_management_regs->coarse_time;
908 fineTime = time_management_regs->fine_time;
909 headerCWF[ i ].acquisitionTime[0] = (unsigned char) (coarseTime>>24);
910 headerCWF[ i ].acquisitionTime[1] = (unsigned char) (coarseTime>>16);
911 headerCWF[ i ].acquisitionTime[2] = (unsigned char) (coarseTime>>8);
912 headerCWF[ i ].acquisitionTime[3] = (unsigned char) (coarseTime);
913 headerCWF[ i ].acquisitionTime[4] = (unsigned char) (fineTime>>8);
914 headerCWF[ i ].acquisitionTime[5] = (unsigned char) (fineTime);
915 #endif
916
917 headerCWF[ i ].time[0] = (unsigned char) (coarseTime>>24);
918 headerCWF[ i ].time[1] = (unsigned char) (coarseTime>>16);
919 headerCWF[ i ].time[2] = (unsigned char) (coarseTime>>8);
920 headerCWF[ i ].time[3] = (unsigned char) (coarseTime);
921 headerCWF[ i ].time[4] = (unsigned char) (fineTime>>8);
922 headerCWF[ i ].time[5] = (unsigned char) (fineTime);
923 // SEND PACKET
891 // SEND PACKET
924 if (sid == SID_NORM_CWF_LONG_F3)
892 if (sid == SID_NORM_CWF_LONG_F3)
925 {
893 {
@@ -959,8 +927,8 int send_waveform_CWF3_light(volatile in
959
927
960 unsigned int i;
928 unsigned int i;
961 int ret;
929 int ret;
962 unsigned char *coarseTimePtr;
930 unsigned int coarseTime;
963 unsigned char *fineTimePtr;
931 unsigned int fineTime;
964 rtems_status_code status;
932 rtems_status_code status;
965 spw_ioctl_pkt_send spw_ioctl_send_CWF;
933 spw_ioctl_pkt_send spw_ioctl_send_CWF;
966 char *sample;
934 char *sample;
@@ -974,7 +942,6 int send_waveform_CWF3_light(volatile in
974 // BUILD CWF3_light DATA
942 // BUILD CWF3_light DATA
975 for ( i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++)
943 for ( i=0; i< NB_SAMPLES_PER_SNAPSHOT; i++)
976 {
944 {
977 #ifdef VHDL_DEV
978 sample = (char*) &waveform[ (i * NB_WORDS_SWF_BLK) + TIME_OFFSET ];
945 sample = (char*) &waveform[ (i * NB_WORDS_SWF_BLK) + TIME_OFFSET ];
979 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + TIME_OFFSET_IN_BYTES ] = sample[ 0 ];
946 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + TIME_OFFSET_IN_BYTES ] = sample[ 0 ];
980 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 1 + TIME_OFFSET_IN_BYTES ] = sample[ 1 ];
947 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 1 + TIME_OFFSET_IN_BYTES ] = sample[ 1 ];
@@ -982,61 +949,30 int send_waveform_CWF3_light(volatile in
982 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 3 + TIME_OFFSET_IN_BYTES ] = sample[ 3 ];
949 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 3 + TIME_OFFSET_IN_BYTES ] = sample[ 3 ];
983 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 4 + TIME_OFFSET_IN_BYTES ] = sample[ 4 ];
950 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 4 + TIME_OFFSET_IN_BYTES ] = sample[ 4 ];
984 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 5 + TIME_OFFSET_IN_BYTES ] = sample[ 5 ];
951 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 5 + TIME_OFFSET_IN_BYTES ] = sample[ 5 ];
985 #else
986 sample = (char*) &waveform[ i * NB_WORDS_SWF_BLK ];
987 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) ] = sample[ 0 ];
988 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 1 ] = sample[ 1 ];
989 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 2 ] = sample[ 2 ];
990 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 3 ] = sample[ 3 ];
991 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 4 ] = sample[ 4 ];
992 wf_cont_f3_light[ (i * NB_BYTES_CWF3_LIGHT_BLK) + 5 ] = sample[ 5 ];
993 #endif
994 }
952 }
995
953
954 coarseTime = waveform[0];
955 fineTime = waveform[1];
956
996 //*********************
957 //*********************
997 // SEND CWF3_light DATA
958 // SEND CWF3_light DATA
998
959 for (i=0; i<NB_PACKETS_PER_GROUP_OF_CWF_LIGHT; i++) // send waveform
999 for (i=0; i<7; i++) // send waveform
1000 {
960 {
1001 int coarseTime = 0x00;
1002 int fineTime = 0x00;
1003
1004 #ifdef VHDL_DEV
1005 spw_ioctl_send_CWF.data = (char*) &wf_cont_f3_light[ (i * BLK_NR_CWF_SHORT_F3 * NB_BYTES_CWF3_LIGHT_BLK) + TIME_OFFSET_IN_BYTES];
961 spw_ioctl_send_CWF.data = (char*) &wf_cont_f3_light[ (i * BLK_NR_CWF_SHORT_F3 * NB_BYTES_CWF3_LIGHT_BLK) + TIME_OFFSET_IN_BYTES];
1006 #else
1007 spw_ioctl_send_CWF.data = (char*) &wf_cont_f3_light[ (i * BLK_NR_CWF_SHORT_F3 * NB_BYTES_CWF3_LIGHT_BLK) ];
1008 #endif
1009 spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ];
962 spw_ioctl_send_CWF.hdr = (char*) &headerCWF[ i ];
1010 // BUILD THE DATA
963 // BUILD THE DATA
1011 spw_ioctl_send_CWF.dlen = BLK_NR_CWF_SHORT_F3 * NB_BYTES_CWF3_LIGHT_BLK;
964 spw_ioctl_send_CWF.dlen = BLK_NR_CWF_SHORT_F3 * NB_BYTES_CWF3_LIGHT_BLK;
1012 // SET PACKET SEQUENCE COUNTER
965 // SET PACKET SEQUENCE COUNTER
1013 increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, SID_NORM_CWF_F3 );
966 increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, SID_NORM_CWF_F3 );
1014 // SET PACKET TIME
967 // SET PACKET TIME
1015 #ifdef VHDL_DEV
968 compute_acquisition_time( coarseTime, fineTime, SID_NORM_CWF_F3, i, headerCWF[ i ].acquisitionTime );
1016 coarseTimePtr = (unsigned char *) &waveform;
969 //
1017 fineTimePtr = (unsigned char *) &waveform[1];
970 headerCWF[ i ].time[0] = (unsigned char) (time_management_regs->coarse_time>>24);
1018 headerCWF[ i ].acquisitionTime[0] = coarseTimePtr[2];
971 headerCWF[ i ].time[1] = (unsigned char) (time_management_regs->coarse_time>>16);
1019 headerCWF[ i ].acquisitionTime[1] = coarseTimePtr[3];
972 headerCWF[ i ].time[2] = (unsigned char) (time_management_regs->coarse_time>>8);
1020 headerCWF[ i ].acquisitionTime[2] = coarseTimePtr[0];
973 headerCWF[ i ].time[3] = (unsigned char) (time_management_regs->coarse_time);
1021 headerCWF[ i ].acquisitionTime[3] = coarseTimePtr[1];
974 headerCWF[ i ].time[4] = (unsigned char) (time_management_regs->fine_time>>8);
1022 headerCWF[ i ].acquisitionTime[4] = fineTimePtr[0];
975 headerCWF[ i ].time[5] = (unsigned char) (time_management_regs->fine_time);
1023 headerCWF[ i ].acquisitionTime[5] = fineTimePtr[1];
1024 #else
1025 coarseTime = time_management_regs->coarse_time;
1026 fineTime = time_management_regs->fine_time;
1027 headerCWF[ i ].acquisitionTime[0] = (unsigned char) (coarseTime>>24);
1028 headerCWF[ i ].acquisitionTime[1] = (unsigned char) (coarseTime>>16);
1029 headerCWF[ i ].acquisitionTime[2] = (unsigned char) (coarseTime>>8);
1030 headerCWF[ i ].acquisitionTime[3] = (unsigned char) (coarseTime);
1031 headerCWF[ i ].acquisitionTime[4] = (unsigned char) (fineTime>>8);
1032 headerCWF[ i ].acquisitionTime[5] = (unsigned char) (fineTime);
1033 #endif
1034 headerCWF[ i ].time[0] = (unsigned char) (coarseTime>>24);
1035 headerCWF[ i ].time[1] = (unsigned char) (coarseTime>>16);
1036 headerCWF[ i ].time[2] = (unsigned char) (coarseTime>>8);
1037 headerCWF[ i ].time[3] = (unsigned char) (coarseTime);
1038 headerCWF[ i ].time[4] = (unsigned char) (fineTime>>8);
1039 headerCWF[ i ].time[5] = (unsigned char) (fineTime);
1040 // SEND PACKET
976 // SEND PACKET
1041 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
977 status = rtems_message_queue_send( queue_id, &spw_ioctl_send_CWF, sizeof(spw_ioctl_send_CWF));
1042 if (status != RTEMS_SUCCESSFUL) {
978 if (status != RTEMS_SUCCESSFUL) {
@@ -1049,38 +985,55 int send_waveform_CWF3_light(volatile in
1049 return ret;
985 return ret;
1050 }
986 }
1051
987
1052 void compute_acquisition_time( unsigned int *coarseTime, unsigned int *fineTime, unsigned int sid, unsigned char pa_lfr_pkt_nr )
988 void compute_acquisition_time( unsigned int coarseTime, unsigned int fineTime,
989 unsigned int sid, unsigned char pa_lfr_pkt_nr, unsigned char * acquisitionTime )
1053 {
990 {
1054 unsigned long long int acquisitionTimeAsLong;
991 unsigned long long int acquisitionTimeAsLong;
1055 unsigned char acquisitionTime[6];
992 unsigned char localAcquisitionTime[6];
1056 float deltaT = 0.;
993 double deltaT = 0.;
1057
994
1058 acquisitionTime[0] = (unsigned char) ( *coarseTime >> 8 );
995 localAcquisitionTime[0] = (unsigned char) ( coarseTime >> 8 );
1059 acquisitionTime[1] = (unsigned char) ( *coarseTime );
996 localAcquisitionTime[1] = (unsigned char) ( coarseTime );
1060 acquisitionTime[2] = (unsigned char) ( *coarseTime >> 24 );
997 localAcquisitionTime[2] = (unsigned char) ( coarseTime >> 24 );
1061 acquisitionTime[3] = (unsigned char) ( *coarseTime >> 16 );
998 localAcquisitionTime[3] = (unsigned char) ( coarseTime >> 16 );
1062 acquisitionTime[4] = (unsigned char) ( *fineTime >> 24 );
999 localAcquisitionTime[4] = (unsigned char) ( fineTime >> 24 );
1063 acquisitionTime[5] = (unsigned char) ( *fineTime >> 16 );
1000 localAcquisitionTime[5] = (unsigned char) ( fineTime >> 16 );
1064
1001
1065 acquisitionTimeAsLong = ( (unsigned long long int) acquisitionTime[0] << 40 )
1002 acquisitionTimeAsLong = ( (unsigned long long int) localAcquisitionTime[0] << 40 )
1066 + ( (unsigned long long int) acquisitionTime[1] << 32 )
1003 + ( (unsigned long long int) localAcquisitionTime[1] << 32 )
1067 + ( acquisitionTime[2] << 24 )
1004 + ( localAcquisitionTime[2] << 24 )
1068 + ( acquisitionTime[3] << 16 )
1005 + ( localAcquisitionTime[3] << 16 )
1069 + ( acquisitionTime[4] << 8 )
1006 + ( localAcquisitionTime[4] << 8 )
1070 + ( acquisitionTime[5] );
1007 + ( localAcquisitionTime[5] );
1071
1008
1072 switch( sid )
1009 switch( sid )
1073 {
1010 {
1074 case SID_NORM_SWF_F0:
1011 case SID_NORM_SWF_F0:
1075 deltaT = ( (float ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 24576. ;
1012 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 24576. ;
1076 break;
1013 break;
1077
1014
1078 case SID_NORM_SWF_F1:
1015 case SID_NORM_SWF_F1:
1079 deltaT = ( (float ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 4096. ;
1016 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 4096. ;
1017 break;
1018
1019 case SID_SBM1_CWF_F1:
1020 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 4096. ;
1080 break;
1021 break;
1081
1022
1082 case SID_NORM_SWF_F2:
1023 case SID_NORM_SWF_F2:
1083 deltaT = ( (float ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 256. ;
1024 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_304 * 65536. / 256. ;
1025 break;
1026
1027 case SID_SBM2_CWF_F2:
1028 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 256. ;
1029 break;
1030
1031 case SID_NORM_CWF_F3:
1032 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF_SHORT_F3 * 65536. / 16. ;
1033 break;
1034
1035 case SID_NORM_CWF_LONG_F3:
1036 deltaT = ( (double ) (pa_lfr_pkt_nr) ) * BLK_NR_CWF * 65536. / 16. ;
1084 break;
1037 break;
1085
1038
1086 default:
1039 default:
@@ -1089,9 +1042,13 void compute_acquisition_time( unsigned
1089 }
1042 }
1090
1043
1091 acquisitionTimeAsLong = acquisitionTimeAsLong + (unsigned long long int) deltaT;
1044 acquisitionTimeAsLong = acquisitionTimeAsLong + (unsigned long long int) deltaT;
1092
1045 //
1093 *coarseTime = (unsigned int) (acquisitionTimeAsLong >> 16);
1046 acquisitionTime[0] = (unsigned char) (acquisitionTimeAsLong >> 40);
1094 *fineTime = (unsigned int) (acquisitionTimeAsLong & 0xffff);
1047 acquisitionTime[1] = (unsigned char) (acquisitionTimeAsLong >> 32);
1048 acquisitionTime[2] = (unsigned char) (acquisitionTimeAsLong >> 24);
1049 acquisitionTime[3] = (unsigned char) (acquisitionTimeAsLong >> 16);
1050 acquisitionTime[4] = (unsigned char) (acquisitionTimeAsLong >> 8 );
1051 acquisitionTime[5] = (unsigned char) (acquisitionTimeAsLong );
1095 }
1052 }
1096
1053
1097 //**************
1054 //**************
@@ -1104,11 +1061,7 void reset_wfp_burst_enable(void)
1104 *
1061 *
1105 */
1062 */
1106
1063
1107 #ifdef VHDL_DEV
1108 waveform_picker_regs->run_burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
1064 waveform_picker_regs->run_burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
1109 #else
1110 waveform_picker_regs->burst_enable = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
1111 #endif
1112 }
1065 }
1113
1066
1114 void reset_wfp_status( void )
1067 void reset_wfp_status( void )
@@ -1119,10 +1072,7 void reset_wfp_status( void )
1119 *
1072 *
1120 */
1073 */
1121
1074
1122 #ifdef GSA
1123 #else
1124 waveform_picker_regs->status = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
1075 waveform_picker_regs->status = 0x00; // burst f2, f1, f0 enable f3, f2, f1, f0
1125 #endif
1126 }
1076 }
1127
1077
1128 void reset_waveform_picker_regs(void)
1078 void reset_waveform_picker_regs(void)
@@ -1166,11 +1116,11 void reset_waveform_picker_regs(void)
1166 DEBUG_PRINTF1("delta_f0_2 %x\n", waveform_picker_regs->delta_f0_2)
1116 DEBUG_PRINTF1("delta_f0_2 %x\n", waveform_picker_regs->delta_f0_2)
1167 DEBUG_PRINTF1("delta_f1 %x\n", waveform_picker_regs->delta_f1)
1117 DEBUG_PRINTF1("delta_f1 %x\n", waveform_picker_regs->delta_f1)
1168 DEBUG_PRINTF1("delta_f2 %x\n", waveform_picker_regs->delta_f2)
1118 DEBUG_PRINTF1("delta_f2 %x\n", waveform_picker_regs->delta_f2)
1169 // 2352 = 7 * 336
1119 // 2688 = 8 * 336
1170 waveform_picker_regs->nb_data_by_buffer = 0x92f; // 0x30 *** 2352 - 1 => nb samples -1
1120 waveform_picker_regs->nb_data_by_buffer = 0xa7f; // 0x30 *** 2688 - 1 => nb samples -1
1171 waveform_picker_regs->snapshot_param = 0x930; // 0x34 *** 2352 => nb samples
1121 waveform_picker_regs->snapshot_param = 0xa80; // 0x34 *** 2688 => nb samples
1172 waveform_picker_regs->start_date = 0x00; // 0x38
1122 waveform_picker_regs->start_date = 0x00; // 0x38
1173 waveform_picker_regs->nb_word_in_buffer = 0x1b92; // 0x3c *** 2352 * 3 + 2 = 7058
1123 waveform_picker_regs->nb_word_in_buffer = 0x1f82; // 0x3c *** 2688 * 3 + 2 = 8066
1174 }
1124 }
1175
1125
1176 void set_wfp_data_shaping( void )
1126 void set_wfp_data_shaping( void )
General Comments 0
You need to be logged in to leave comments. Login now