##// END OF EJS Templates
Sync
paul -
r139:5ea3df9587c6 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: Mon May 26 15:36:46 2014
3 # Generated by qmake (2.01a) (Qt 4.8.6) on: Thu May 29 09:32:56 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
@@ -10,7 +10,7
10 10
11 11 CC = sparc-rtems-gcc
12 12 CXX = sparc-rtems-g++
13 DEFINES = -DSW_VERSION_N1=1 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=7 -DPRINT_MESSAGES_ON_CONSOLE
13 DEFINES = -DSW_VERSION_N1=1 -DSW_VERSION_N2=0 -DSW_VERSION_N3=0 -DSW_VERSION_N4=8 -DPRINT_MESSAGES_ON_CONSOLE -DDEBUG_MESSAGES
14 14 CFLAGS = -pipe -O3 -Wall $(DEFINES)
15 15 CXXFLAGS = -pipe -O3 -Wall $(DEFINES)
16 16 INCPATH = -I/usr/lib64/qt4/mkspecs/linux-g++ -I. -I../src -I../header -I../header/processing -I../src/LFR_basic-parameters
@@ -1,7 +1,7
1 1 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 CONFIG += console verbose
4 CONFIG += console verbose debug_messages
5 5 CONFIG -= qt
6 6
7 7 include(./sparc.pri)
@@ -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-26T15:34:26. -->
3 <!-- Written by QtCreator 3.0.1, 2014-05-29T15:54:19. -->
4 4 <qtcreator>
5 5 <data>
6 6 <variable>ProjectExplorer.Project.ActiveTarget</variable>
@@ -118,7 +118,7 typedef struct ring_node
118 118 #define REGS_ADDR_GRGPIO 0x80000b00
119 119
120 120 #define REGS_ADDR_SPECTRAL_MATRIX 0x80000f00
121 #define REGS_ADDR_WAVEFORM_PICKER 0x80000f40
121 #define REGS_ADDR_WAVEFORM_PICKER 0x80000f50
122 122
123 123 #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff
124 124 #define APBUART_CTRL_REG_MASK_TE 0x00000002
@@ -82,19 +82,28 typedef struct{
82 82 typedef struct {
83 83 volatile int config; // 0x00
84 84 volatile int status; // 0x04
85 volatile int matrixF0_Address0; // 0x08
86 volatile int matrixFO_Address1; // 0x0C
87 volatile int matrixF1_Address; // 0x10
88 volatile int matrixF2_Address; // 0x14
89 volatile int coarse_time_F0_0; // 0x18
90 volatile int coarse_time_F0_1; // 0x1C
91 volatile int coarse_time_F1; // 0x20
92 volatile int coarse_time_F2; // 0x24
93 volatile int fine_time_FO_0; // 0x28
94 volatile int fine_time_F0_1; // 0x2C
95 volatile int fine_time_F1; // 0x30
96 volatile int fine_time_F2; // 0x34
97 volatile int debug; // 0x38
85 volatile int f0_0_address; // 0x08
86 volatile int f0_1_address; // 0x0C
87 //
88 volatile int f1_0_address; // 0x10
89 volatile int f1_1_address; // 0x14
90 volatile int f2_0_address; // 0x18
91 volatile int f2_1_address; // 0x1C
92 //
93 volatile int f0_0_coarse_time; // 0x20
94 volatile int f0_0_fine_time; // 0x24
95 volatile int f0_1_coarse_time; // 0x28
96 volatile int f0_1_fine_time; // 0x2C
97 //
98 volatile int f1_0_coarse_time; // 0x30
99 volatile int f1_0_fine_time; // 0x34
100 volatile int f1_1_coarse_time; // 0x38
101 volatile int f1_1_time_time; // 0x3C
102 //
103 volatile int f2_0_coarse_time; // 0x40
104 volatile int f2_0_fine_time; // 0x44
105 volatile int f2_1_coarse_time; // 0x48
106 volatile int f2_1_time_time; // 0x4C
98 107 } spectral_matrix_regs_t;
99 108
100 109 #endif // GRLIB_REGS_H_INCLUDED
@@ -98,6 +98,9 void BP_send( char *data,
98 98 // general functions
99 99 void reset_spectral_matrix_regs( void );
100 100 void set_time(unsigned char *time, unsigned char *timeInBuffer );
101 unsigned long long int get_acquisition_time( unsigned char *timePtr );
102 void close_matrix_actions(unsigned int *nb_sm, unsigned int nb_sm_before_avf, rtems_id task_id,
103 ring_node_sm *node_for_averaging, ring_node_sm *ringNode);
101 104
102 105 extern rtems_status_code get_message_queue_id_prc1( rtems_id *queue_id );
103 106 extern rtems_status_code get_message_queue_id_prc2( rtems_id *queue_id );
@@ -51,9 +51,9 rtems_task swbd_task( rtems_task_argumen
51 51
52 52 //******************
53 53 // general functions
54 void init_waveform_rings( void );
54 void WFP_init_rings( void );
55 55 void init_waveform_ring( ring_node waveform_ring[], unsigned char nbNodes, volatile int wfrm[] );
56 void reset_current_ring_nodes( void );
56 void WFP_reset_current_ring_nodes( void );
57 57 //
58 58 int init_header_snapshot_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_SWF_t *headerSWF );
59 59 int init_header_continuous_wf_table( unsigned int sid, Header_TM_LFR_SCIENCE_CWF_t *headerCWF );
@@ -32,6 +32,7
32 32 #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32
33 33 #define CONFIGURE_INIT_TASK_PRIORITY 1 // instead of 100
34 34 #define CONFIGURE_INIT_TASK_MODE (RTEMS_DEFAULT_MODES | RTEMS_NO_PREEMPT)
35 #define CONFIGURE_INIT_TASK_ATTRIBUTES (RTEMS_DEFAULT_ATTRIBUTES | RTEMS_FLOATING_POINT)
35 36 #define CONFIGURE_MAXIMUM_DRIVERS 16
36 37 #define CONFIGURE_MAXIMUM_PERIODS 5
37 38 #define CONFIGURE_MAXIMUM_TIMERS 5 // STAT (1s), send SWF (0.3s), send CWF3 (1s)
@@ -98,12 +99,15 rtems_task Init( rtems_task_argument ign
98 99 init_local_mode_parameters();
99 100 init_housekeeping_parameters();
100 101
101 init_waveform_rings(); // initialize the waveform rings
102 SM_init_rings(); // initialize spectral matrices rings
102 // waveform picker initialization
103 WFP_init_rings(); // initialize the waveform rings
104 WFP_reset_current_ring_nodes();
105 reset_waveform_picker_regs();
103 106
104 reset_wfp_burst_enable();
105 reset_wfp_status();
106 set_wfp_data_shaping();
107 // spectral matrices initialization
108 SM_init_rings(); // initialize spectral matrices rings
109 SM_reset_current_ring_nodes();
110 reset_spectral_matrix_regs();
107 111
108 112 updateLFRCurrentMode();
109 113
@@ -32,58 +32,92 ring_node_sm *ring_node_for_averaging_sm
32 32
33 33 rtems_isr spectral_matrices_isr( rtems_vector_number vector )
34 34 {
35 unsigned char status;
36 unsigned long long int time_0;
37 unsigned long long int time_1;
38 // STATUS REGISTER
39 // input_fifo_write(2) *** input_fifo_write(1) *** input_fifo_write(0)
40 // 10 9 8
41 // buffer_full ** bad_component_err ** f2_1 ** f2_0 ** f1_1 ** f1_0 ** f0_1 ** f0_0
42 // 7 6 5 4 3 2 1 0
43
35 44 //***
36 45 // F0
37 if ( (spectral_matrix_regs->status & 0x1) == 0x01) // check the status_ready_matrix_f0 bit
46 status = spectral_matrix_regs->status & 0x03; // [0011] get the status_ready_matrix_f0_x bits
47 switch(status)
38 48 {
39 nb_sm_f0 = nb_sm_f0 + 1;
40 if (nb_sm_f0 == NB_SM_BEFORE_AVF0 )
49 case 0:
50 break;
51 case 3:
52 time_0 = get_acquisition_time( (unsigned char *) spectral_matrix_regs->f0_0_coarse_time );
53 time_1 = get_acquisition_time( (unsigned char *) spectral_matrix_regs->f0_1_coarse_time );
54 if ( time_0 < time_1 )
41 55 {
42 ring_node_for_averaging_sm_f0 = current_ring_node_sm_f0;
56 close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0], ring_node_for_averaging_sm_f0, current_ring_node_sm_f0->previous);
57 current_ring_node_sm_f0 = current_ring_node_sm_f0->next;
58 spectral_matrix_regs->f0_0_address = current_ring_node_sm_f0->buffer_address;
59 close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0], ring_node_for_averaging_sm_f0, current_ring_node_sm_f0->previous);
43 60 current_ring_node_sm_f0 = current_ring_node_sm_f0->next;
44 spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address;
45 if (rtems_event_send( Task_id[TASKID_AVF0], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
46 {
47 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
48 }
49 nb_sm_f0 = 0;
61 spectral_matrix_regs->f0_1_address = current_ring_node_sm_f0->buffer_address;
62 }
63 else
64 {
65 close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0], ring_node_for_averaging_sm_f0, current_ring_node_sm_f0->previous);
66 current_ring_node_sm_f0 = current_ring_node_sm_f0->next;
67 spectral_matrix_regs->f0_1_address = current_ring_node_sm_f0->buffer_address;
68 close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0], ring_node_for_averaging_sm_f0, current_ring_node_sm_f0->previous);
69 current_ring_node_sm_f0 = current_ring_node_sm_f0->next;
70 spectral_matrix_regs->f0_0_address = current_ring_node_sm_f0->buffer_address;
50 71 }
51 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffe; // 1110
72 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffc; // [1100]
73 break;
74 case 1:
75 close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0], ring_node_for_averaging_sm_f0, current_ring_node_sm_f0->previous);
76 current_ring_node_sm_f0 = current_ring_node_sm_f0->next;
77 spectral_matrix_regs->f0_0_address = current_ring_node_sm_f0->buffer_address;
78 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffe; // [1110]
79 break;
80 case 2:
81 close_matrix_actions( &nb_sm_f0, NB_SM_BEFORE_AVF0, Task_id[TASKID_AVF0], ring_node_for_averaging_sm_f0, current_ring_node_sm_f0->previous);
82 current_ring_node_sm_f0 = current_ring_node_sm_f0->next;
83 spectral_matrix_regs->f0_1_address = current_ring_node_sm_f0->buffer_address;
84 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffd; // [1101]
85 break;
52 86 }
53 87
54 88 //***
55 89 // F1
56 if ( (spectral_matrix_regs->status & 0x4) == 0x04) // check the status_ready_matrix_f1 bit
57 {
58 nb_sm_f1 = nb_sm_f1 + 1;
59 if (nb_sm_f1 == NB_SM_BEFORE_AVF1 )
60 {
61 ring_node_for_averaging_sm_f1 = current_ring_node_sm_f1;
62 current_ring_node_sm_f1 = current_ring_node_sm_f1->next;
63 spectral_matrix_regs->matrixF1_Address = current_ring_node_sm_f1->buffer_address;
64 if (rtems_event_send( Task_id[TASKID_AVF1], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
65 {
66 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
67 }
68 nb_sm_f1 = 0;
69 }
70 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffb; // 1011
71 }
90 // if ( (spectral_matrix_regs->status & 0x4) == 0x04) // check the status_ready_matrix_f1 bit
91 // {
92 // nb_sm_f1 = nb_sm_f1 + 1;
93 // if (nb_sm_f1 == NB_SM_BEFORE_AVF1 )
94 // {
95 // ring_node_for_averaging_sm_f1 = current_ring_node_sm_f1;
96 // current_ring_node_sm_f1 = current_ring_node_sm_f1->next;
97 // spectral_matrix_regs->f1_0_address = current_ring_node_sm_f1->buffer_address;
98 // if (rtems_event_send( Task_id[TASKID_AVF1], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
99 // {
100 // rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
101 // }
102 // nb_sm_f1 = 0;
103 // }
104 // spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffb; // 1011
105 // }
72 106
73 107 //***
74 108 // F2
75 if ( (spectral_matrix_regs->status & 0x8) == 0x08) // check the status_ready_matrix_f2 bit
76 {
109 // if ( (spectral_matrix_regs->status & 0x8) == 0x08) // check the status_ready_matrix_f2 bit
110 // {
77 111
78 ring_node_for_averaging_sm_f2 = current_ring_node_sm_f2;
79 current_ring_node_sm_f2 = current_ring_node_sm_f2->next;
80 spectral_matrix_regs->matrixF2_Address = current_ring_node_sm_f2->buffer_address;
81 if (rtems_event_send( Task_id[TASKID_AVF2], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
82 {
83 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
84 }
85 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffff7; // 0111
86 }
112 // ring_node_for_averaging_sm_f2 = current_ring_node_sm_f2;
113 // current_ring_node_sm_f2 = current_ring_node_sm_f2->next;
114 // spectral_matrix_regs->f2_0_address = current_ring_node_sm_f2->buffer_address;
115 // if (rtems_event_send( Task_id[TASKID_AVF2], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
116 // {
117 // rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
118 // }
119 // spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffff7; // 0111
120 // }
87 121
88 122 //************************
89 123 // reset status error bits
@@ -219,8 +253,8 void SM_init_rings( void )
219 253 DEBUG_PRINTF1("asm_ring_f1 @%x\n", (unsigned int) sm_ring_f1)
220 254 DEBUG_PRINTF1("asm_ring_f2 @%x\n", (unsigned int) sm_ring_f2)
221 255
222 spectral_matrix_regs->matrixF0_Address0 = sm_ring_f0[0].buffer_address;
223 DEBUG_PRINTF1("spectral_matrix_regs->matrixF0_Address0 @%x\n", spectral_matrix_regs->matrixF0_Address0)
256 spectral_matrix_regs->f0_0_address = sm_ring_f0[0].buffer_address;
257 DEBUG_PRINTF1("spectral_matrix_regs->matrixF0_Address0 @%x\n", spectral_matrix_regs->f0_0_address)
224 258 }
225 259
226 260 void SM_generic_init_ring( ring_node_sm *ring, unsigned char nbNodes, volatile int sm_f[] )
@@ -266,9 +300,9 void ASM_generic_init_ring( ring_node_as
266 300
267 301 void SM_reset_current_ring_nodes( void )
268 302 {
269 current_ring_node_sm_f0 = sm_ring_f0;
270 current_ring_node_sm_f1 = sm_ring_f1;
271 current_ring_node_sm_f2 = sm_ring_f2;
303 current_ring_node_sm_f0 = sm_ring_f0[0].next;
304 current_ring_node_sm_f1 = sm_ring_f1[0].next;
305 current_ring_node_sm_f2 = sm_ring_f2[0].next;
272 306
273 307 ring_node_for_averaging_sm_f0 = sm_ring_f0;
274 308 ring_node_for_averaging_sm_f1 = sm_ring_f1;
@@ -488,10 +522,12 void reset_spectral_matrix_regs( void )
488 522 spectral_matrix_regs->config = 0x00;
489 523 spectral_matrix_regs->status = 0x00;
490 524
491 spectral_matrix_regs->matrixF0_Address0 = current_ring_node_sm_f0->buffer_address;
492 spectral_matrix_regs->matrixFO_Address1 = current_ring_node_sm_f0->buffer_address;
493 spectral_matrix_regs->matrixF1_Address = current_ring_node_sm_f1->buffer_address;
494 spectral_matrix_regs->matrixF2_Address = current_ring_node_sm_f2->buffer_address;
525 spectral_matrix_regs->f0_0_address = current_ring_node_sm_f0->previous->buffer_address;
526 spectral_matrix_regs->f0_1_address = current_ring_node_sm_f0->buffer_address;
527 spectral_matrix_regs->f1_0_address = current_ring_node_sm_f1->previous->buffer_address;
528 spectral_matrix_regs->f1_1_address = current_ring_node_sm_f1->buffer_address;
529 spectral_matrix_regs->f2_0_address = current_ring_node_sm_f2->previous->buffer_address;
530 spectral_matrix_regs->f2_1_address = current_ring_node_sm_f2->buffer_address;
495 531 }
496 532
497 533 void set_time( unsigned char *time, unsigned char * timeInBuffer )
@@ -510,3 +546,33 void set_time( unsigned char *time, unsi
510 546 time[4] = timeInBuffer[6];
511 547 time[5] = timeInBuffer[7];
512 548 }
549
550 unsigned long long int get_acquisition_time( unsigned char *timePtr )
551 {
552 unsigned long long int acquisitionTimeAslong;
553 acquisitionTimeAslong = 0x00;
554 acquisitionTimeAslong = ( (unsigned long long int) (timePtr[0] & 0x7f) << 40 ) // [0111 1111] mask the synchronization bit
555 + ( (unsigned long long int) timePtr[1] << 32 )
556 + ( timePtr[2] << 24 )
557 + ( timePtr[3] << 16 )
558 + ( timePtr[4] << 8 )
559 + ( timePtr[5] );
560 return acquisitionTimeAslong;
561 }
562
563 void close_matrix_actions( unsigned int *nb_sm, unsigned int nb_sm_before_avf, rtems_id task_id,
564 ring_node_sm *node_for_averaging, ring_node_sm *ringNode )
565 {
566 *nb_sm = *nb_sm + 1;
567 if (*nb_sm == nb_sm_before_avf)
568 {
569 node_for_averaging = ringNode;
570 if (rtems_event_send( task_id, RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
571 {
572 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
573 }
574 *nb_sm = 0;
575 }
576 }
577
578
@@ -532,8 +532,8 int enter_mode( unsigned char mode, unsi
532 532 #endif
533 533 status = restart_science_tasks( mode );
534 534 launch_waveform_picker( mode, transitionCoarseTime );
535 //launch_spectral_matrix( );
536 launch_spectral_matrix_simu( );
535 launch_spectral_matrix( );
536 // launch_spectral_matrix_simu( );
537 537 }
538 538 else if ( mode == LFR_MODE_STANDBY )
539 539 {
@@ -748,7 +748,7 int suspend_science_tasks()
748 748
749 749 void launch_waveform_picker( unsigned char mode, unsigned int transitionCoarseTime )
750 750 {
751 reset_current_ring_nodes();
751 WFP_reset_current_ring_nodes();
752 752 reset_waveform_picker_regs();
753 753 set_wfp_burst_enable_register( mode );
754 754
@@ -448,7 +448,7 rtems_task swbd_task(rtems_task_argument
448 448 //******************
449 449 // general functions
450 450
451 void init_waveform_rings( void )
451 void WFP_init_rings( void )
452 452 {
453 453 // F0 RING
454 454 init_waveform_ring( waveform_ring_f0, NB_RING_NODES_F0, wf_snap_f0 );
@@ -485,7 +485,7 void init_waveform_ring(ring_node wavefo
485 485 }
486 486 }
487 487
488 void reset_current_ring_nodes( void )
488 void WFP_reset_current_ring_nodes( void )
489 489 {
490 490 current_ring_node_f0 = waveform_ring_f0;
491 491 ring_node_to_send_swf_f0 = waveform_ring_f0;
General Comments 0
You need to be logged in to leave comments. Login now