##// END OF EJS Templates
rev 1.0.0.4
paul -
r110:321cef60967c VHDLib206
parent child
Show More
@@ -1,6 +1,6
1 #############################################################################
1 #############################################################################
2 # Makefile for building: bin/fsw
2 # Makefile for building: bin/fsw
3 # Generated by qmake (2.01a) (Qt 4.8.5) on: Thu Mar 27 13:16:57 2014
3 # Generated by qmake (2.01a) (Qt 4.8.5) on: Thu Mar 27 14:01:46 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=3 -DPRINT_MESSAGES_ON_CONSOLE
13 DEFINES = -DSW_VERSION_N1=1 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=4 -DVHDL_DEV -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
@@ -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 *** vhdl_dev *** debug_tch
3 # CONFIG options = verbose *** boot_messages *** debug_messages *** cpu_usage_report *** stack_report *** vhdl_dev *** debug_tch
4 CONFIG += console verbose
4 CONFIG += console verbose vhdl_dev
5 CONFIG -= qt
5 CONFIG -= qt
6
6
7 include(./sparc.pri)
7 include(./sparc.pri)
@@ -11,7 +11,7 SWVERSION=-1-0
11 DEFINES += SW_VERSION_N1=1 # major
11 DEFINES += SW_VERSION_N1=1 # major
12 DEFINES += SW_VERSION_N2=0 # minor
12 DEFINES += SW_VERSION_N2=0 # minor
13 DEFINES += SW_VERSION_N3=0 # patch
13 DEFINES += SW_VERSION_N3=0 # patch
14 DEFINES += SW_VERSION_N4=3 # internal
14 DEFINES += SW_VERSION_N4=4 # internal
15
15
16 contains( CONFIG, debug_tch ) {
16 contains( CONFIG, debug_tch ) {
17 DEFINES += DEBUG_TCH
17 DEFINES += DEBUG_TCH
@@ -1,6 +1,6
1 <?xml version="1.0" encoding="UTF-8"?>
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE QtCreatorProject>
2 <!DOCTYPE QtCreatorProject>
3 <!-- Written by QtCreator 3.0.1, 2014-03-27T07:16:29. -->
3 <!-- Written by QtCreator 3.0.1, 2014-03-28T07:03:40. -->
4 <qtcreator>
4 <qtcreator>
5 <data>
5 <data>
6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
@@ -32,9 +32,8 rtems_task hous_task( rtems_task_argumen
32 rtems_task dumb_task( rtems_task_argument unused );
32 rtems_task dumb_task( rtems_task_argument unused );
33
33
34 void init_housekeeping_parameters( void );
34 void init_housekeeping_parameters( void );
35
36 void increment_seq_counter( unsigned char *packet_sequence_control);
35 void increment_seq_counter( unsigned char *packet_sequence_control);
37
38 void getTime( unsigned char *time);
36 void getTime( unsigned char *time);
37 void send_dumb_hk( void );
39
38
40 #endif // FSW_MISC_H_INCLUDED
39 #endif // FSW_MISC_H_INCLUDED
@@ -92,14 +92,17 rtems_task Init( rtems_task_argument ign
92 PRINTF("*************************\n")
92 PRINTF("*************************\n")
93 PRINTF("\n\n")
93 PRINTF("\n\n")
94
94
95 reset_wfp_burst_enable(); // stop the waveform picker if it was running
96 init_waveform_rings(); // initialize the waveform rings
97 init_sm_rings();
98
99 init_parameter_dump();
95 init_parameter_dump();
100 init_local_mode_parameters();
96 init_local_mode_parameters();
101 init_housekeeping_parameters();
97 init_housekeeping_parameters();
102
98
99 init_waveform_rings(); // initialize the waveform rings
100 init_sm_rings(); // initialize spectral matrices rings
101
102 reset_wfp_burst_enable();
103 reset_wfp_status();
104 set_wfp_data_shaping();
105
103 updateLFRCurrentMode();
106 updateLFRCurrentMode();
104
107
105 BOOT_PRINTF1("in INIT *** lfrCurrentMode is %d\n", lfrCurrentMode)
108 BOOT_PRINTF1("in INIT *** lfrCurrentMode is %d\n", lfrCurrentMode)
@@ -161,7 +164,7 rtems_task Init( rtems_task_argument ign
161 PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status )
164 PRINTF1("in INIT *** ERR start_recv_send_tasks code %d\n", status )
162 }
165 }
163
166
164 // suspend science tasks. they will be restarted later depending on the mode
167 // suspend science tasks, they will be restarted later depending on the mode
165 status = suspend_science_tasks(); // suspend science tasks (not done in stop_current_mode if current mode = STANDBY)
168 status = suspend_science_tasks(); // suspend science tasks (not done in stop_current_mode if current mode = STANDBY)
166 if (status != RTEMS_SUCCESSFUL)
169 if (status != RTEMS_SUCCESSFUL)
167 {
170 {
@@ -196,6 +199,8 rtems_task Init( rtems_task_argument ign
196
199
197 BOOT_PRINTF("delete INIT\n")
200 BOOT_PRINTF("delete INIT\n")
198
201
202 send_dumb_hk();
203
199 status = rtems_task_delete(RTEMS_SELF);
204 status = rtems_task_delete(RTEMS_SELF);
200
205
201 }
206 }
@@ -221,7 +221,7 rtems_task hous_task(rtems_task_argument
221 spacewire_update_statistics();
221 spacewire_update_statistics();
222
222
223 // SEND PACKET
223 // SEND PACKET
224 status = rtems_message_queue_send( queue_id, &housekeeping_packet,
224 status = rtems_message_queue_urgent( queue_id, &housekeeping_packet,
225 PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES);
225 PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES);
226 if (status != RTEMS_SUCCESSFUL) {
226 if (status != RTEMS_SUCCESSFUL) {
227 PRINTF1("in HOUS *** ERR send: %d\n", status)
227 PRINTF1("in HOUS *** ERR send: %d\n", status)
@@ -363,3 +363,52 void getTime( unsigned char *time)
363 time[5] = (unsigned char) (time_management_regs->fine_time);
363 time[5] = (unsigned char) (time_management_regs->fine_time);
364 }
364 }
365
365
366 void send_dumb_hk( void )
367 {
368 Packet_TM_LFR_HK_t dummy_hk_packet;
369 unsigned char *parameters;
370 unsigned int i;
371 rtems_id queue_id;
372
373 dummy_hk_packet.targetLogicalAddress = CCSDS_DESTINATION_ID;
374 dummy_hk_packet.protocolIdentifier = CCSDS_PROTOCOLE_ID;
375 dummy_hk_packet.reserved = DEFAULT_RESERVED;
376 dummy_hk_packet.userApplication = CCSDS_USER_APP;
377 dummy_hk_packet.packetID[0] = (unsigned char) (TM_PACKET_ID_HK >> 8);
378 dummy_hk_packet.packetID[1] = (unsigned char) (TM_PACKET_ID_HK);
379 dummy_hk_packet.packetSequenceControl[0] = TM_PACKET_SEQ_CTRL_STANDALONE;
380 dummy_hk_packet.packetSequenceControl[1] = TM_PACKET_SEQ_CNT_DEFAULT;
381 dummy_hk_packet.packetLength[0] = (unsigned char) (PACKET_LENGTH_HK >> 8);
382 dummy_hk_packet.packetLength[1] = (unsigned char) (PACKET_LENGTH_HK );
383 dummy_hk_packet.spare1_pusVersion_spare2 = DEFAULT_SPARE1_PUSVERSION_SPARE2;
384 dummy_hk_packet.serviceType = TM_TYPE_HK;
385 dummy_hk_packet.serviceSubType = TM_SUBTYPE_HK;
386 dummy_hk_packet.destinationID = TM_DESTINATION_ID_GROUND;
387 dummy_hk_packet.sid = SID_HK;
388
389 // init status word
390 dummy_hk_packet.lfr_status_word[0] = 0xff;
391 dummy_hk_packet.lfr_status_word[1] = 0xff;
392 // init software version
393 dummy_hk_packet.lfr_sw_version[0] = SW_VERSION_N1;
394 dummy_hk_packet.lfr_sw_version[1] = SW_VERSION_N2;
395 dummy_hk_packet.lfr_sw_version[2] = SW_VERSION_N3;
396 dummy_hk_packet.lfr_sw_version[3] = SW_VERSION_N4;
397 // init fpga version
398 parameters = (unsigned char *) (REGS_ADDR_WAVEFORM_PICKER + 0xd0);
399 dummy_hk_packet.lfr_fpga_version[0] = parameters[1]; // n1
400 dummy_hk_packet.lfr_fpga_version[1] = parameters[2]; // n2
401 dummy_hk_packet.lfr_fpga_version[2] = parameters[3]; // n3
402
403 parameters = (unsigned char *) &dummy_hk_packet.hk_lfr_cpu_load;
404
405 for (i=0; i<100; i++)
406 {
407 parameters[i] = 0xff;
408 }
409
410 get_message_queue_id_send( &queue_id );
411
412 rtems_message_queue_urgent( queue_id, &dummy_hk_packet,
413 PACKET_LENGTH_HK + CCSDS_TC_TM_PACKET_OFFSET + CCSDS_PROTOCOLE_EXTRA_BYTES);
414 }
@@ -164,6 +164,7 int action_enter_mode(ccsdsTelecommandPa
164 requestedMode = TC->dataAndCRC[1];
164 requestedMode = TC->dataAndCRC[1];
165
165
166 status = check_mode_value( requestedMode );
166 status = check_mode_value( requestedMode );
167
167 if ( status != LFR_SUCCESSFUL )
168 if ( status != LFR_SUCCESSFUL )
168 {
169 {
169 send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_LFR_MODE, requestedMode );
170 send_tm_lfr_tc_exe_inconsistent( TC, queue_id, BYTE_POS_CP_LFR_MODE, requestedMode );
@@ -412,11 +413,11 int stop_current_mode( void )
412 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt
413 LEON_Clear_interrupt( IRQ_WAVEFORM_PICKER ); // clear waveform picker interrupt
413 LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt
414 LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX ); // clear spectral matrix interrupt
414
415
415 // (3) reset registers
416 // (3) reset waveform picker registers
416 // waveform picker
417 reset_wfp_burst_enable(); // reset burst and enable bits
417 reset_wfp_burst_enable(); // reset burst and enable bits
418 reset_wfp_status(); // reset all the status bits
418 reset_wfp_status(); // reset all the status bits
419 // spectral matrices
419
420 // (4) reset spectral matrices registers
420 set_irq_on_new_ready_matrix( 0 ); // stop the spectral matrices
421 set_irq_on_new_ready_matrix( 0 ); // stop the spectral matrices
421 set_run_matrix_spectral( 0 ); // run_matrix_spectral is set to 0
422 set_run_matrix_spectral( 0 ); // run_matrix_spectral is set to 0
422 reset_extractSWF(); // reset the extractSWF flag to false
423 reset_extractSWF(); // reset the extractSWF flag to false
@@ -642,7 +643,7 void launch_spectral_matrix( unsigned ch
642 struct grgpio_regs_str *grgpio_regs = (struct grgpio_regs_str *) REGS_ADDR_GRGPIO;
643 struct grgpio_regs_str *grgpio_regs = (struct grgpio_regs_str *) REGS_ADDR_GRGPIO;
643 grgpio_regs->io_port_direction_register =
644 grgpio_regs->io_port_direction_register =
644 grgpio_regs->io_port_direction_register | 0x01; // [0001 1000], 0 = output disabled, 1 = output enabled
645 grgpio_regs->io_port_direction_register | 0x01; // [0001 1000], 0 = output disabled, 1 = output enabled
645 grgpio_regs->io_port_output_register = grgpio_regs->io_port_output_register | 0x01; // set the bit 0 to 1
646 grgpio_regs->io_port_output_register = grgpio_regs->io_port_output_register | 0x00; // set the bit 0 to 1
646 set_irq_on_new_ready_matrix( 1 );
647 set_irq_on_new_ready_matrix( 1 );
647 LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX );
648 LEON_Clear_interrupt( IRQ_SPECTRAL_MATRIX );
648 LEON_Unmask_interrupt( IRQ_SPECTRAL_MATRIX );
649 LEON_Unmask_interrupt( IRQ_SPECTRAL_MATRIX );
@@ -1013,13 +1013,13 void build_snapshot_from_ring( ring_node
1013 deltaT_F2 = 262144; // (2048. / 256. / 2.) * 65536. = 262144;
1013 deltaT_F2 = 262144; // (2048. / 256. / 2.) * 65536. = 262144;
1014 sampleOffset_asLong = 0x00;
1014 sampleOffset_asLong = 0x00;
1015
1015
1016 // get the f0 acquisition time
1016 // (1) get the f0 acquisition time
1017 build_acquisition_time( &acquisitionTimeF0_asLong, current_ring_node_f0 );
1017 build_acquisition_time( &acquisitionTimeF0_asLong, current_ring_node_f0 );
1018
1018
1019 // compute the central reference time
1019 // (2) compute the central reference time
1020 centerTime_asLong = acquisitionTimeF0_asLong + deltaT_F0;
1020 centerTime_asLong = acquisitionTimeF0_asLong + deltaT_F0;
1021
1021
1022 // compute the acquisition time of the current snapshot
1022 // (3) compute the acquisition time of the current snapshot
1023 switch(frequencyChannel)
1023 switch(frequencyChannel)
1024 {
1024 {
1025 case 1: // 1 is for F1 = 4096 Hz
1025 case 1: // 1 is for F1 = 4096 Hz
@@ -1042,7 +1042,7 void build_snapshot_from_ring( ring_node
1042 }
1042 }
1043
1043
1044 //****************************************************************************
1044 //****************************************************************************
1045 // 1) search the ring_node with the acquisition time <= acquisitionTime_asLong
1045 // (4) search the ring_node with the acquisition time <= acquisitionTime_asLong
1046 for (i=0; i<nb_ring_nodes; i++)
1046 for (i=0; i<nb_ring_nodes; i++)
1047 {
1047 {
1048 PRINTF1("%d ... ", i)
1048 PRINTF1("%d ... ", i)
@@ -1055,18 +1055,16 void build_snapshot_from_ring( ring_node
1055 ring_node_to_send = ring_node_to_send->previous;
1055 ring_node_to_send = ring_node_to_send->previous;
1056 }
1056 }
1057
1057
1058 //*************************************************
1058 // (5) compute the number of samples to take in the current buffer
1059 // (2) once the buffer is found, build the snapshot
1060
1061 // compute the number of samples to take in the current buffer
1062 sampleOffset_asLong = ((acquisitionTime_asLong - bufferAcquisitionTime_asLong) * frequency_asLong ) >> 16;
1059 sampleOffset_asLong = ((acquisitionTime_asLong - bufferAcquisitionTime_asLong) * frequency_asLong ) >> 16;
1063 nbSamplesPart1_asLong = NB_SAMPLES_PER_SNAPSHOT - sampleOffset_asLong;
1060 nbSamplesPart1_asLong = NB_SAMPLES_PER_SNAPSHOT - sampleOffset_asLong;
1061 PRINTF2("sampleOffset_asLong = %lld, nbSamplesPart1_asLong = %lld\n", sampleOffset_asLong, nbSamplesPart1_asLong)
1064
1062
1065 // compute the final acquisition time
1063 // (6) compute the final acquisition time
1066 acquisitionTime_asLong = bufferAcquisitionTime_asLong +
1064 acquisitionTime_asLong = bufferAcquisitionTime_asLong +
1067 sampleOffset_asLong * nbTicksPerSample_asLong;
1065 sampleOffset_asLong * nbTicksPerSample_asLong;
1068
1066
1069 // copy the acquisition time at the beginning of the extrated snapshot
1067 // (7) copy the acquisition time at the beginning of the extrated snapshot
1070 ptr1 = (unsigned char*) &acquisitionTime_asLong;
1068 ptr1 = (unsigned char*) &acquisitionTime_asLong;
1071 ptr2 = (unsigned char*) wf_snap_extracted;
1069 ptr2 = (unsigned char*) wf_snap_extracted;
1072 ptr2[0] = ptr1[ 2 + 2 ];
1070 ptr2[0] = ptr1[ 2 + 2 ];
@@ -1157,13 +1155,13 void reset_waveform_picker_regs(void)
1157 *
1155 *
1158 */
1156 */
1159
1157
1160 // waveform_picker_regs->data_shaping = 0x01; // 0x00 *** R1 R0 SP1 SP0 BW
1158 set_wfp_data_shaping(); // 0x00 *** R1 R0 SP1 SP0 BW
1161 waveform_picker_regs->run_burst_enable = 0x00; // 0x04 *** [run *** burst f2, f1, f0 *** enable f3, f2, f1, f0 ]
1159 reset_wfp_burst_enable(); // 0x04 *** [run *** burst f2, f1, f0 *** enable f3, f2, f1, f0 ]
1162 waveform_picker_regs->addr_data_f0 = current_ring_node_f0->buffer_address; // 0x08
1160 waveform_picker_regs->addr_data_f0 = current_ring_node_f0->buffer_address; // 0x08
1163 waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; // 0x0c
1161 waveform_picker_regs->addr_data_f1 = current_ring_node_f1->buffer_address; // 0x0c
1164 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; // 0x10
1162 waveform_picker_regs->addr_data_f2 = current_ring_node_f2->buffer_address; // 0x10
1165 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_a); // 0x14
1163 waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3_a); // 0x14
1166 waveform_picker_regs->status = 0x00; // 0x18
1164 reset_wfp_status(); // 0x18
1167 //
1165 //
1168 set_wfp_delta_snapshot(); // 0x1c
1166 set_wfp_delta_snapshot(); // 0x1c
1169 set_wfp_delta_f0_f0_2(); // 0x20, 0x24
1167 set_wfp_delta_f0_f0_2(); // 0x20, 0x24
General Comments 0
You need to be logged in to leave comments. Login now