@@ -2,6 +2,7 syntax: glob | |||||
2 |
|
2 | |||
3 | *~ |
|
3 | *~ | |
4 | *.o |
|
4 | *.o | |
|
5 | *.gcno | |||
5 | *.zip |
|
6 | *.zip | |
6 | tests/*.err |
|
7 | tests/*.err | |
7 | doc |
|
8 | doc |
@@ -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: T |
|
3 | # Generated by qmake (2.01a) (Qt 4.8.6) on: Tue Oct 7 15:14:40 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 |
@@ -14,9 +14,17 DEFINES += SW_VERSION_N2=0 # minor | |||||
14 | DEFINES += SW_VERSION_N3=1 # patch |
|
14 | DEFINES += SW_VERSION_N3=1 # patch | |
15 | DEFINES += SW_VERSION_N4=1 # internal |
|
15 | DEFINES += SW_VERSION_N4=1 # internal | |
16 |
|
16 | |||
|
17 | # <GCOV> | |||
|
18 | #QMAKE_CFLAGS_RELEASE += -fprofile-arcs -ftest-coverage | |||
|
19 | #QMAKE_LFLAGS_RELEASE += | |||
|
20 | #LIBS += -lgcov /opt/GCOV/01A/lib/overload.o -lc | |||
|
21 | # </GCOV> | |||
|
22 | ||||
|
23 | # <CHANGE BEFORE FLIGHT> | |||
17 | contains( CONFIG, lpp_dpu_destid ) { |
|
24 | contains( CONFIG, lpp_dpu_destid ) { | |
18 | DEFINES += LPP_DPU_DESTID |
|
25 | DEFINES += LPP_DPU_DESTID | |
19 | } |
|
26 | } | |
|
27 | # </CHANGE BEFORE FLIGHT> | |||
20 |
|
28 | |||
21 | contains( CONFIG, debug_tch ) { |
|
29 | contains( CONFIG, debug_tch ) { | |
22 | DEFINES += DEBUG_TCH |
|
30 | 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.2.0, 2014- |
|
3 | <!-- Written by QtCreator 3.2.0, 2014-10-06T16:01:42. --> | |
4 | <qtcreator> |
|
4 | <qtcreator> | |
5 | <data> |
|
5 | <data> | |
6 | <variable>EnvironmentId</variable> |
|
6 | <variable>EnvironmentId</variable> |
@@ -27,11 +27,11 typedef struct ring_node | |||||
27 | #define NB_SAMPLES_PER_SNAPSHOT 2688 // 336 * 8 = 672 * 4 = 2688 |
|
27 | #define NB_SAMPLES_PER_SNAPSHOT 2688 // 336 * 8 = 672 * 4 = 2688 | |
28 | #define TIME_OFFSET 2 |
|
28 | #define TIME_OFFSET 2 | |
29 | #define TIME_OFFSET_IN_BYTES 8 |
|
29 | #define TIME_OFFSET_IN_BYTES 8 | |
30 | #define WAVEFORM_EXTENDED_HEADER_OFFSET 22 |
|
30 | //#define WAVEFORM_EXTENDED_HEADER_OFFSET 22 | |
31 | #define NB_BYTES_SWF_BLK (2 * 6) |
|
31 | #define NB_BYTES_SWF_BLK (2 * 6) | |
32 | #define NB_WORDS_SWF_BLK 3 |
|
32 | #define NB_WORDS_SWF_BLK 3 | |
33 | #define NB_BYTES_CWF3_LIGHT_BLK 6 |
|
33 | #define NB_BYTES_CWF3_LIGHT_BLK 6 | |
34 | #define WFRM_INDEX_OF_LAST_PACKET 6 // waveforms are transmitted in groups of 2048 blocks, 6 packets of 340 and 1 of 8 |
|
34 | //#define WFRM_INDEX_OF_LAST_PACKET 6 // waveforms are transmitted in groups of 2048 blocks, 6 packets of 340 and 1 of 8 | |
35 | #define NB_RING_NODES_F0 3 // AT LEAST 3 |
|
35 | #define NB_RING_NODES_F0 3 // AT LEAST 3 | |
36 | #define NB_RING_NODES_F1 5 // AT LEAST 3 |
|
36 | #define NB_RING_NODES_F1 5 // AT LEAST 3 | |
37 | #define NB_RING_NODES_F2 5 // AT LEAST 3 |
|
37 | #define NB_RING_NODES_F2 5 // AT LEAST 3 | |
@@ -127,7 +127,8 typedef struct ring_node | |||||
127 |
|
127 | |||
128 | #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff |
|
128 | #define APBUART_CTRL_REG_MASK_DB 0xfffff7ff | |
129 | #define APBUART_CTRL_REG_MASK_TE 0x00000002 |
|
129 | #define APBUART_CTRL_REG_MASK_TE 0x00000002 | |
130 | #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400 (0x50) |
|
130 | // scaler value = system_clock_frequency / ( baud_rate * 8 ) - 1 | |
|
131 | #define APBUART_SCALER_RELOAD_VALUE 0x00000050 // 25 MHz => about 38400 | |||
131 |
|
132 | |||
132 | //********** |
|
133 | //********** | |
133 | // IRQ LINES |
|
134 | // IRQ LINES |
@@ -67,7 +67,7 int send_waveform_CWF3_light( volatile i | |||||
67 | void compute_acquisition_time(unsigned int coarseTime, unsigned int fineTime, |
|
67 | void compute_acquisition_time(unsigned int coarseTime, unsigned int fineTime, | |
68 | unsigned int sid, unsigned char pa_lfr_pkt_nr, unsigned char *acquisitionTime ); |
|
68 | unsigned int sid, unsigned char pa_lfr_pkt_nr, unsigned char *acquisitionTime ); | |
69 | void build_snapshot_from_ring(ring_node *ring_node_to_send , unsigned char frequencyChannel ); |
|
69 | void build_snapshot_from_ring(ring_node *ring_node_to_send , unsigned char frequencyChannel ); | |
70 | void build_acquisition_time( unsigned long long int * acquisitionTimeAslong, ring_node *current_ring_node ); |
|
70 | void snapshot_resynchronization( unsigned char *timePtr ); | |
71 | // |
|
71 | // | |
72 | rtems_id get_pkts_queue_id( void ); |
|
72 | rtems_id get_pkts_queue_id( void ); | |
73 |
|
73 |
@@ -145,6 +145,8 int action_reset(ccsdsTelecommandPacket_ | |||||
145 | * |
|
145 | * | |
146 | */ |
|
146 | */ | |
147 |
|
147 | |||
|
148 | printf("this is the end!!!\n"); | |||
|
149 | exit(0); | |||
148 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); |
|
150 | send_tm_lfr_tc_exe_not_implemented( TC, queue_id, time ); | |
149 | return LFR_DEFAULT; |
|
151 | return LFR_DEFAULT; | |
150 | } |
|
152 | } |
@@ -210,6 +210,9 rtems_task wfrm_task(rtems_task_argument | |||||
210 | rtems_event_set event_out; |
|
210 | rtems_event_set event_out; | |
211 | rtems_id queue_id; |
|
211 | rtems_id queue_id; | |
212 | rtems_status_code status; |
|
212 | rtems_status_code status; | |
|
213 | bool resynchronisationEngaged; | |||
|
214 | ||||
|
215 | resynchronisationEngaged = false; | |||
213 |
|
216 | |||
214 | init_header_snapshot_wf_table( SID_NORM_SWF_F0, headerSWF_F0 ); |
|
217 | init_header_snapshot_wf_table( SID_NORM_SWF_F0, headerSWF_F0 ); | |
215 | init_header_snapshot_wf_table( SID_NORM_SWF_F1, headerSWF_F1 ); |
|
218 | init_header_snapshot_wf_table( SID_NORM_SWF_F1, headerSWF_F1 ); | |
@@ -228,6 +231,19 rtems_task wfrm_task(rtems_task_argument | |||||
228 | rtems_event_receive(RTEMS_EVENT_MODE_NORMAL | RTEMS_EVENT_MODE_SBM1 |
|
231 | rtems_event_receive(RTEMS_EVENT_MODE_NORMAL | RTEMS_EVENT_MODE_SBM1 | |
229 | | RTEMS_EVENT_MODE_SBM2 | RTEMS_EVENT_MODE_SBM2_WFRM, |
|
232 | | RTEMS_EVENT_MODE_SBM2 | RTEMS_EVENT_MODE_SBM2_WFRM, | |
230 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); |
|
233 | RTEMS_WAIT | RTEMS_EVENT_ANY, RTEMS_NO_TIMEOUT, &event_out); | |
|
234 | if(resynchronisationEngaged == false) | |||
|
235 | { // engage resynchronisation | |||
|
236 | snapshot_resynchronization( (unsigned char *) ring_node_to_send_swf_f0->buffer_address); | |||
|
237 | resynchronisationEngaged = true; | |||
|
238 | } | |||
|
239 | else | |||
|
240 | { // reset delta_snapshot to the nominal value | |||
|
241 | PRINTF("no resynchronisation, reset delta_snapshot to the nominal value\n") | |||
|
242 | set_wfp_delta_snapshot(); | |||
|
243 | resynchronisationEngaged = false; | |||
|
244 | } | |||
|
245 | // | |||
|
246 | ||||
231 | if (event_out == RTEMS_EVENT_MODE_NORMAL) |
|
247 | if (event_out == RTEMS_EVENT_MODE_NORMAL) | |
232 | { |
|
248 | { | |
233 | DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_NORMAL\n") |
|
249 | DEBUG_PRINTF("WFRM received RTEMS_EVENT_MODE_NORMAL\n") | |
@@ -954,7 +970,7 void build_snapshot_from_ring( ring_node | |||||
954 | sampleOffset_asLong = 0x00; |
|
970 | sampleOffset_asLong = 0x00; | |
955 |
|
971 | |||
956 | // (1) get the f0 acquisition time |
|
972 | // (1) get the f0 acquisition time | |
957 | build_acquisition_time( &acquisitionTimeF0_asLong, current_ring_node_f0 ); |
|
973 | acquisitionTimeF0_asLong = get_acquisition_time( (unsigned char *) current_ring_node_f0->buffer_address ); | |
958 |
|
974 | |||
959 | // (2) compute the central reference time |
|
975 | // (2) compute the central reference time | |
960 | centerTime_asLong = acquisitionTimeF0_asLong + deltaT_F0; |
|
976 | centerTime_asLong = acquisitionTimeF0_asLong + deltaT_F0; | |
@@ -986,7 +1002,7 void build_snapshot_from_ring( ring_node | |||||
986 | for (i=0; i<nb_ring_nodes; i++) |
|
1002 | for (i=0; i<nb_ring_nodes; i++) | |
987 | { |
|
1003 | { | |
988 | PRINTF1("%d ... ", i) |
|
1004 | PRINTF1("%d ... ", i) | |
989 | build_acquisition_time( &bufferAcquisitionTime_asLong, ring_node_to_send ); |
|
1005 | bufferAcquisitionTime_asLong = get_acquisition_time( (unsigned char *) ring_node_to_send->buffer_address ); | |
990 | if (bufferAcquisitionTime_asLong <= acquisitionTime_asLong) |
|
1006 | if (bufferAcquisitionTime_asLong <= acquisitionTime_asLong) | |
991 | { |
|
1007 | { | |
992 | PRINTF1("buffer found with acquisition time = %llx\n", bufferAcquisitionTime_asLong) |
|
1008 | PRINTF1("buffer found with acquisition time = %llx\n", bufferAcquisitionTime_asLong) | |
@@ -1037,19 +1053,47 void build_snapshot_from_ring( ring_node | |||||
1037 | } |
|
1053 | } | |
1038 | } |
|
1054 | } | |
1039 |
|
1055 | |||
1040 | void build_acquisition_time( unsigned long long int *acquisitionTimeAslong, ring_node *current_ring_node ) |
|
1056 | void snapshot_resynchronization( unsigned char *timePtr ) | |
1041 | { |
|
1057 | { | |
1042 |
unsigned |
|
1058 | unsigned long long int acquisitionTime; | |
|
1059 | unsigned long long int centerTime; | |||
|
1060 | unsigned long long int previousTick; | |||
|
1061 | unsigned long long int nextTick; | |||
|
1062 | unsigned long long int deltaPreviousTick; | |||
|
1063 | unsigned long long int deltaNextTick; | |||
|
1064 | unsigned int deltaTickInF2; | |||
|
1065 | double deltaPrevious; | |||
|
1066 | double deltaNext; | |||
1043 |
|
1067 | |||
1044 | acquisitionTimeCharPtr = (unsigned char*) current_ring_node->buffer_address; |
|
1068 | acquisitionTime = get_acquisition_time( timePtr ); | |
|
1069 | ||||
|
1070 | // compute center time | |||
|
1071 | centerTime = acquisitionTime + 2731; // (2048. / 24576. / 2.) * 65536. = 2730.667; | |||
|
1072 | previousTick = centerTime - (centerTime & 0xffff); | |||
|
1073 | nextTick = previousTick + 65536; | |||
1045 |
|
1074 | |||
1046 | *acquisitionTimeAslong = 0x00; |
|
1075 | deltaPreviousTick = centerTime - previousTick; | |
1047 | *acquisitionTimeAslong = ( (unsigned long long int) (acquisitionTimeCharPtr[0] & 0x7f) << 40 ) // [0111 1111] mask the synchronization bit |
|
1076 | deltaNextTick = nextTick - centerTime; | |
1048 | + ( (unsigned long long int) acquisitionTimeCharPtr[1] << 32 ) |
|
1077 | ||
1049 | + ( (unsigned long long int) acquisitionTimeCharPtr[2] << 24 ) |
|
1078 | deltaPrevious = ((double) deltaPreviousTick) / 65536. * 1000.; | |
1050 | + ( (unsigned long long int) acquisitionTimeCharPtr[3] << 16 ) |
|
1079 | deltaNext = ((double) deltaNextTick) / 65536. * 1000.; | |
1051 | + ( (unsigned long long int) acquisitionTimeCharPtr[6] << 8 ) |
|
1080 | ||
1052 | + ( (unsigned long long int) acquisitionTimeCharPtr[7] ); |
|
1081 | printf("delta previous = %f ms, delta next = %f ms\n", deltaPrevious, deltaNext); | |
|
1082 | printf("delta previous = %llu, delta next = %llu\n", deltaPreviousTick, deltaNextTick); | |||
|
1083 | ||||
|
1084 | // which tick is the closest | |||
|
1085 | if (deltaPreviousTick > deltaNextTick) | |||
|
1086 | { | |||
|
1087 | deltaTickInF2 = floor( (deltaNext * 256. / 1000.) ); // the division by 2 is important here | |||
|
1088 | waveform_picker_regs->delta_snapshot = waveform_picker_regs->delta_snapshot + deltaTickInF2; | |||
|
1089 | printf("correction of = + %u\n", deltaTickInF2); | |||
|
1090 | } | |||
|
1091 | else | |||
|
1092 | { | |||
|
1093 | deltaTickInF2 = floor( (deltaPrevious * 256. / 1000.) ); // the division by 2 is important here | |||
|
1094 | waveform_picker_regs->delta_snapshot = waveform_picker_regs->delta_snapshot - deltaTickInF2; | |||
|
1095 | printf("correction of = - %u\n", deltaTickInF2); | |||
|
1096 | } | |||
1053 | } |
|
1097 | } | |
1054 |
|
1098 | |||
1055 | //************** |
|
1099 | //************** |
General Comments 0
You need to be logged in to leave comments.
Login now