##// END OF EJS Templates
Sync
paul -
r147:8abc460aa11b 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.6) on: Thu Jun 12 08:10:29 2014
3 # Generated by qmake (2.01a) (Qt 4.8.6) on: Thu Jun 12 15:33:39 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
@@ -30,20 +30,14 ring_node_sm *ring_node_for_averaging_sm
30 //***********************************************************
30 //***********************************************************
31 // Interrupt Service Routine for spectral matrices processing
31 // Interrupt Service Routine for spectral matrices processing
32
32
33 rtems_isr spectral_matrices_isr( rtems_vector_number vector )
33 void spectral_matrices_isr_f0( void )
34 {
34 {
35 unsigned char status;
35 unsigned char status;
36 unsigned long long int time_0;
36 unsigned long long int time_0;
37 unsigned long long int time_1;
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
38
44 //***
45 // F0
46 status = spectral_matrix_regs->status & 0x03; // [0011] get the status_ready_matrix_f0_x bits
39 status = spectral_matrix_regs->status & 0x03; // [0011] get the status_ready_matrix_f0_x bits
40
47 switch(status)
41 switch(status)
48 {
42 {
49 case 0:
43 case 0:
@@ -69,64 +63,124 rtems_isr spectral_matrices_isr( rtems_v
69 current_ring_node_sm_f0 = current_ring_node_sm_f0->next;
63 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;
64 spectral_matrix_regs->f0_0_address = current_ring_node_sm_f0->buffer_address;
71 }
65 }
72 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffc; // [1100]
66 spectral_matrix_regs->status = spectral_matrix_regs->status & 0x03; // [0011]
73 break;
67 break;
74 case 1:
68 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);
69 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;
70 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;
71 spectral_matrix_regs->f0_0_address = current_ring_node_sm_f0->buffer_address;
78 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffe; // [1110]
72 spectral_matrix_regs->status = spectral_matrix_regs->status & 0x01; // [0001]
79 break;
73 break;
80 case 2:
74 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);
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);
82 current_ring_node_sm_f0 = current_ring_node_sm_f0->next;
76 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;
77 spectral_matrix_regs->f0_1_address = current_ring_node_sm_f0->buffer_address;
84 spectral_matrix_regs->status = spectral_matrix_regs->status & 0xfffffffd; // [1101]
78 spectral_matrix_regs->status = spectral_matrix_regs->status & 0x02; // [0010]
79 break;
80 }
81 }
82
83 void spectral_matrices_isr_f1( void )
84 {
85 unsigned char status;
86 unsigned long long int time_0;
87 unsigned long long int time_1;
88
89 status = (spectral_matrix_regs->status & 0x0c) >> 2; // [1100] get the status_ready_matrix_f0_x bits
90
91 switch(status)
92 {
93 case 0:
94 break;
95 case 3:
96 time_0 = get_acquisition_time( (unsigned char *) spectral_matrix_regs->f1_0_coarse_time );
97 time_1 = get_acquisition_time( (unsigned char *) spectral_matrix_regs->f1_1_coarse_time );
98 if ( time_0 < time_1 )
99 {
100 close_matrix_actions( &nb_sm_f1, NB_SM_BEFORE_AVF1, Task_id[TASKID_AVF1], ring_node_for_averaging_sm_f1, current_ring_node_sm_f1->previous);
101 current_ring_node_sm_f1 = current_ring_node_sm_f1->next;
102 spectral_matrix_regs->f1_0_address = current_ring_node_sm_f1->buffer_address;
103 close_matrix_actions( &nb_sm_f1, NB_SM_BEFORE_AVF1, Task_id[TASKID_AVF1], ring_node_for_averaging_sm_f1, current_ring_node_sm_f1->previous);
104 current_ring_node_sm_f1 = current_ring_node_sm_f1->next;
105 spectral_matrix_regs->f1_1_address = current_ring_node_sm_f1->buffer_address;
106 }
107 else
108 {
109 close_matrix_actions( &nb_sm_f1, NB_SM_BEFORE_AVF1, Task_id[TASKID_AVF1], ring_node_for_averaging_sm_f1, current_ring_node_sm_f1->previous);
110 current_ring_node_sm_f1 = current_ring_node_sm_f1->next;
111 spectral_matrix_regs->f1_1_address = current_ring_node_sm_f1->buffer_address;
112 close_matrix_actions( &nb_sm_f1, NB_SM_BEFORE_AVF1, Task_id[TASKID_AVF1], ring_node_for_averaging_sm_f1, current_ring_node_sm_f1->previous);
113 current_ring_node_sm_f1 = current_ring_node_sm_f1->next;
114 spectral_matrix_regs->f1_0_address = current_ring_node_sm_f1->buffer_address;
115 }
116 spectral_matrix_regs->status = spectral_matrix_regs->status & 0x0c; // [1100]
117 break;
118 case 1:
119 close_matrix_actions( &nb_sm_f1, NB_SM_BEFORE_AVF1, Task_id[TASKID_AVF1], ring_node_for_averaging_sm_f1, current_ring_node_sm_f1->previous);
120 current_ring_node_sm_f1 = current_ring_node_sm_f1->next;
121 spectral_matrix_regs->f1_0_address = current_ring_node_sm_f1->buffer_address;
122 spectral_matrix_regs->status = spectral_matrix_regs->status & 0x07; // [0100]
123 break;
124 case 2:
125 close_matrix_actions( &nb_sm_f1, NB_SM_BEFORE_AVF1, Task_id[TASKID_AVF1], ring_node_for_averaging_sm_f1, current_ring_node_sm_f1->previous);
126 current_ring_node_sm_f1 = current_ring_node_sm_f1->next;
127 spectral_matrix_regs->f1_1_address = current_ring_node_sm_f1->buffer_address;
128 spectral_matrix_regs->status = spectral_matrix_regs->status & 0x08; // [1000]
129 break;
130 }
131 }
132
133 void spectral_matrices_isr_f2( void )
134 {
135 unsigned char status;
136
137 status = (spectral_matrix_regs->status & 0x30) >> 4; // [0011 0000] get the status_ready_matrix_f0_x bits
138
139 ring_node_for_averaging_sm_f2 = current_ring_node_sm_f2->previous;
140
141 current_ring_node_sm_f2 = current_ring_node_sm_f2->next;
142
143 switch(status)
144 {
145 case 0:
146 case 3:
147 break;
148 case 1:
149 spectral_matrix_regs->f2_0_address = current_ring_node_sm_f2->buffer_address;
150 spectral_matrix_regs->status = spectral_matrix_regs->status & 0x10; // [0001 0000]
151 break;
152 case 2:
153 spectral_matrix_regs->f2_1_address = current_ring_node_sm_f2->buffer_address;
154 spectral_matrix_regs->status = spectral_matrix_regs->status & 0x20; // [0010 0000]
85 break;
155 break;
86 }
156 }
87
157
88 //***
158 if (rtems_event_send( Task_id[TASKID_AVF2], RTEMS_EVENT_0 ) != RTEMS_SUCCESSFUL)
89 // F1
159 {
90 // if ( (spectral_matrix_regs->status & 0x4) == 0x04) // check the status_ready_matrix_f1 bit
160 rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_3 );
91 // {
161 }
92 // nb_sm_f1 = nb_sm_f1 + 1;
162 }
93 // if (nb_sm_f1 == NB_SM_BEFORE_AVF1 )
163
94 // {
164 void spectral_matrix_isr_error_handler( void )
95 // ring_node_for_averaging_sm_f1 = current_ring_node_sm_f1;
165 {
96 // current_ring_node_sm_f1 = current_ring_node_sm_f1->next;
166 spectral_matrix_regs->status = 0x7c0; // [0111 1100 0000]
97 // spectral_matrix_regs->f1_0_address = current_ring_node_sm_f1->buffer_address;
167 }
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 // }
106
168
107 //***
169 rtems_isr spectral_matrices_isr( rtems_vector_number vector )
108 // F2
170 {
109 // if ( (spectral_matrix_regs->status & 0x8) == 0x08) // check the status_ready_matrix_f2 bit
171 // STATUS REGISTER
110 // {
172 // input_fifo_write(2) *** input_fifo_write(1) *** input_fifo_write(0)
173 // 10 9 8
174 // buffer_full ** bad_component_err ** f2_1 ** f2_0 ** f1_1 ** f1_0 ** f0_1 ** f0_0
175 // 7 6 5 4 3 2 1 0
111
176
112 // ring_node_for_averaging_sm_f2 = current_ring_node_sm_f2;
177 spectral_matrices_isr_f0();
113 // current_ring_node_sm_f2 = current_ring_node_sm_f2->next;
178
114 // spectral_matrix_regs->f2_0_address = current_ring_node_sm_f2->buffer_address;
179 spectral_matrices_isr_f1();
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 // }
121
180
122 //************************
181 spectral_matrices_isr_f2();
123 // reset status error bits
124 // if ( (spectral_matrix_regs->status & 0x3e0) != 0x00) // [0011 1110 0000] check the status bits
125 // {
126 // rtems_event_send( Task_id[TASKID_DUMB], RTEMS_EVENT_8 );
127 // spectral_matrix_regs->status = spectral_matrix_regs->status | 0xfffffc1f; // [1100 0001 1111]
128 // }
129
182
183 spectral_matrix_isr_error_handler();
130 }
184 }
131
185
132 rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector )
186 rtems_isr spectral_matrices_isr_simu( rtems_vector_number vector )
@@ -533,7 +533,7 int enter_mode( unsigned char mode, unsi
533 status = restart_science_tasks( mode );
533 status = restart_science_tasks( mode );
534 launch_waveform_picker( mode, transitionCoarseTime );
534 launch_waveform_picker( mode, transitionCoarseTime );
535 // launch_spectral_matrix( );
535 // launch_spectral_matrix( );
536 launch_spectral_matrix_simu( );
536 // launch_spectral_matrix_simu( );
537 }
537 }
538 else if ( mode == LFR_MODE_STANDBY )
538 else if ( mode == LFR_MODE_STANDBY )
539 {
539 {
@@ -928,8 +928,8 void compute_acquisition_time( unsigned
928 localAcquisitionTime[1] = (unsigned char) ( coarseTime >> 16 );
928 localAcquisitionTime[1] = (unsigned char) ( coarseTime >> 16 );
929 localAcquisitionTime[2] = (unsigned char) ( coarseTime >> 8 );
929 localAcquisitionTime[2] = (unsigned char) ( coarseTime >> 8 );
930 localAcquisitionTime[3] = (unsigned char) ( coarseTime );
930 localAcquisitionTime[3] = (unsigned char) ( coarseTime );
931 localAcquisitionTime[4] = (unsigned char) ( fineTime >> 24 );
931 localAcquisitionTime[4] = (unsigned char) ( fineTime >> 8 );
932 localAcquisitionTime[5] = (unsigned char) ( fineTime >> 16 );
932 localAcquisitionTime[5] = (unsigned char) ( fineTime );
933
933
934 acquisitionTimeAsLong = ( (unsigned long long int) localAcquisitionTime[0] << 40 )
934 acquisitionTimeAsLong = ( (unsigned long long int) localAcquisitionTime[0] << 40 )
935 + ( (unsigned long long int) localAcquisitionTime[1] << 32 )
935 + ( (unsigned long long int) localAcquisitionTime[1] << 32 )
@@ -998,6 +998,7 void build_snapshot_from_ring( ring_node
998 unsigned long long int bufferAcquisitionTime_asLong;
998 unsigned long long int bufferAcquisitionTime_asLong;
999 unsigned char *ptr1;
999 unsigned char *ptr1;
1000 unsigned char *ptr2;
1000 unsigned char *ptr2;
1001 unsigned char *timeCharPtr;
1001 unsigned char nb_ring_nodes;
1002 unsigned char nb_ring_nodes;
1002 unsigned long long int frequency_asLong;
1003 unsigned long long int frequency_asLong;
1003 unsigned long long int nbTicksPerSample_asLong;
1004 unsigned long long int nbTicksPerSample_asLong;
@@ -1058,7 +1059,7 void build_snapshot_from_ring( ring_node
1058 // (5) compute the number of samples to take in the current buffer
1059 // (5) compute the number of samples to take in the current buffer
1059 sampleOffset_asLong = ((acquisitionTime_asLong - bufferAcquisitionTime_asLong) * frequency_asLong ) >> 16;
1060 sampleOffset_asLong = ((acquisitionTime_asLong - bufferAcquisitionTime_asLong) * frequency_asLong ) >> 16;
1060 nbSamplesPart1_asLong = NB_SAMPLES_PER_SNAPSHOT - sampleOffset_asLong;
1061 nbSamplesPart1_asLong = NB_SAMPLES_PER_SNAPSHOT - sampleOffset_asLong;
1061 PRINTF2("sampleOffset_asLong = %lld, nbSamplesPart1_asLong = %lld\n", sampleOffset_asLong, nbSamplesPart1_asLong)
1062 PRINTF2("sampleOffset_asLong = %llx, nbSamplesPart1_asLong = %llx\n", sampleOffset_asLong, nbSamplesPart1_asLong)
1062
1063
1063 // (6) compute the final acquisition time
1064 // (6) compute the final acquisition time
1064 acquisitionTime_asLong = bufferAcquisitionTime_asLong +
1065 acquisitionTime_asLong = bufferAcquisitionTime_asLong +
@@ -1067,16 +1068,21 void build_snapshot_from_ring( ring_node
1067 // (7) copy the acquisition time at the beginning of the extrated snapshot
1068 // (7) copy the acquisition time at the beginning of the extrated snapshot
1068 ptr1 = (unsigned char*) &acquisitionTime_asLong;
1069 ptr1 = (unsigned char*) &acquisitionTime_asLong;
1069 ptr2 = (unsigned char*) wf_snap_extracted;
1070 ptr2 = (unsigned char*) wf_snap_extracted;
1070 ptr2[0] = ptr1[ 2 + 2 ];
1071 ptr2[0] = ptr1[ 0 + 2 ];
1071 ptr2[1] = ptr1[ 3 + 2 ];
1072 ptr2[1] = ptr1[ 1 + 2 ];
1072 ptr2[2] = ptr1[ 0 + 2 ];
1073 ptr2[2] = ptr1[ 2 + 2 ];
1073 ptr2[3] = ptr1[ 1 + 2 ];
1074 ptr2[3] = ptr1[ 3 + 2 ];
1074 ptr2[4] = ptr1[ 4 + 2 ];
1075 ptr2[6] = ptr1[ 4 + 2 ];
1075 ptr2[5] = ptr1[ 5 + 2 ];
1076 ptr2[7] = ptr1[ 5 + 2 ];
1076
1077
1077 // re set the synchronization bit
1078 // re set the synchronization bit
1079 timeCharPtr = (unsigned char*) ring_node_to_send->buffer_address;
1080 ptr2[0] = ptr2[0] | (timeCharPtr[0] & 0x80); // [1000 0000]
1078
1081
1079
1082 if ( (nbSamplesPart1_asLong >= NB_SAMPLES_PER_SNAPSHOT) | (nbSamplesPart1_asLong < 0) )
1083 {
1084 nbSamplesPart1_asLong = 0;
1085 }
1080 // copy the part 1 of the snapshot in the extracted buffer
1086 // copy the part 1 of the snapshot in the extracted buffer
1081 for ( i = 0; i < (nbSamplesPart1_asLong * NB_WORDS_SWF_BLK); i++ )
1087 for ( i = 0; i < (nbSamplesPart1_asLong * NB_WORDS_SWF_BLK); i++ )
1082 {
1088 {
@@ -1118,8 +1124,8 void build_acquisition_time( unsigned lo
1118 + ( (unsigned long long int) acquisitionTimeCharPtr[1] << 32 )
1124 + ( (unsigned long long int) acquisitionTimeCharPtr[1] << 32 )
1119 + ( acquisitionTimeCharPtr[2] << 24 )
1125 + ( acquisitionTimeCharPtr[2] << 24 )
1120 + ( acquisitionTimeCharPtr[3] << 16 )
1126 + ( acquisitionTimeCharPtr[3] << 16 )
1121 + ( acquisitionTimeCharPtr[4] << 8 )
1127 + ( acquisitionTimeCharPtr[6] << 8 )
1122 + ( acquisitionTimeCharPtr[5] );
1128 + ( acquisitionTimeCharPtr[7] );
1123 }
1129 }
1124
1130
1125 //**************
1131 //**************
General Comments 0
You need to be logged in to leave comments. Login now