@@ -1,6 +1,6 | |||
|
1 | 1 | <?xml version="1.0" encoding="UTF-8"?> |
|
2 | 2 | <!DOCTYPE QtCreatorProject> |
|
3 |
<!-- Written by QtCreator 2.8.1, 2013-11-12T1 |
|
|
3 | <!-- Written by QtCreator 2.8.1, 2013-11-12T12:44:53. --> | |
|
4 | 4 | <qtcreator> |
|
5 | 5 | <data> |
|
6 | 6 | <variable>ProjectExplorer.Project.ActiveTarget</variable> |
@@ -30,6 +30,10 extern Packet_TM_LFR_HK_t housekeeping_p | |||
|
30 | 30 | extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet; |
|
31 | 31 | extern struct param_local_str param_local; |
|
32 | 32 | |
|
33 | extern unsigned short sequenceCounters_SCIENCE_NORMAL_BURST; | |
|
34 | extern unsigned short sequenceCounters_SCIENCE_SBM1_SBM2; | |
|
35 | extern unsigned short sequenceCounters_TC_EXE[]; | |
|
36 | ||
|
33 | 37 | extern rtems_name misc_name[5]; |
|
34 | 38 | extern rtems_name Task_name[20]; /* array of task ids */ |
|
35 | 39 | extern rtems_id Task_id[20]; /* array of task ids */ |
@@ -68,7 +72,6 void set_wfp_burst_enable_register( unsi | |||
|
68 | 72 | void reset_wfp_run_burst_enable(); |
|
69 | 73 | void reset_wfp_status(); |
|
70 | 74 | void reset_new_waveform_picker_regs(); |
|
71 | void reset_new_waveform_picker_regs_alt(); | |
|
72 | 75 | |
|
73 | 76 | //***************** |
|
74 | 77 | // local parameters |
@@ -78,4 +81,6 void set_local_nb_interrupt_f0_MAX(); | |||
|
78 | 81 | void reset_local_sbm1_nb_cwf_sent(); |
|
79 | 82 | void reset_local_sbm2_nb_cwf_sent(); |
|
80 | 83 | |
|
84 | void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid ); | |
|
85 | ||
|
81 | 86 | #endif // WF_HANDLER_H_INCLUDED |
@@ -82,7 +82,9 struct param_local_str param_local; | |||
|
82 | 82 | // HK PACKETS |
|
83 | 83 | Packet_TM_LFR_HK_t housekeeping_packet; |
|
84 | 84 | // sequence counters are incremented by APID (PID + CAT) and destination ID |
|
85 | unsigned short sequenceCounters[SEQ_CNT_NB_PID][SEQ_CNT_NB_CAT][SEQ_CNT_NB_DEST_ID]; | |
|
85 | unsigned short sequenceCounters_SCIENCE_NORMAL_BURST; | |
|
86 | unsigned short sequenceCounters_SCIENCE_SBM1_SBM2; | |
|
87 | unsigned short sequenceCounters_TC_EXE[SEQ_CNT_NB_DEST_ID]; | |
|
86 | 88 | spw_stats spacewire_stats; |
|
87 | 89 | spw_stats spacewire_stats_backup; |
|
88 | 90 |
@@ -194,36 +194,25 rtems_task Init( rtems_task_argument ign | |||
|
194 | 194 | void init_local_mode_parameters( void ) |
|
195 | 195 | { |
|
196 | 196 | /** This function initialize the param_local global variable with default values. |
|
197 |
|
|
|
198 |
|
|
|
199 | ||
|
197 | * | |
|
198 | */ | |
|
200 | 199 | unsigned int i; |
|
201 | unsigned int j; | |
|
202 | unsigned int k; | |
|
203 | ||
|
204 | 200 | // LOCAL PARAMETERS |
|
205 | 201 | set_local_sbm1_nb_cwf_max(); |
|
206 | 202 | set_local_sbm2_nb_cwf_max(); |
|
207 | 203 | set_local_nb_interrupt_f0_MAX(); |
|
208 | ||
|
209 | 204 | BOOT_PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max) |
|
210 | 205 | BOOT_PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max) |
|
211 | 206 | BOOT_PRINTF1("nb_interrupt_f0_MAX = %d\n", param_local.local_nb_interrupt_f0_MAX) |
|
212 | ||
|
213 | 207 | reset_local_sbm1_nb_cwf_sent(); |
|
214 | 208 | reset_local_sbm2_nb_cwf_sent(); |
|
215 | ||
|
216 | 209 | // init sequence counters |
|
217 |
for |
|
|
210 | for(i = 0; i<SEQ_CNT_NB_DEST_ID; i++) | |
|
218 | 211 | { |
|
219 | for(j = 0; j<SEQ_CNT_NB_CAT; j++) | |
|
220 | { | |
|
221 | for(k = 0; k<SEQ_CNT_NB_DEST_ID; k++) | |
|
222 | { | |
|
223 | sequenceCounters[i][j][k] = 0x00; | |
|
224 | } | |
|
225 | } | |
|
212 | sequenceCounters_TC_EXE[i] = 0x00; | |
|
226 | 213 | } |
|
214 | sequenceCounters_SCIENCE_NORMAL_BURST = 0x00; | |
|
215 | sequenceCounters_SCIENCE_SBM1_SBM2 = 0x00; | |
|
227 | 216 | } |
|
228 | 217 | |
|
229 | 218 | void create_names( void ) // create all names for tasks and queues |
@@ -735,6 +735,8 int send_waveform_SWF( volatile int *wav | |||
|
735 | 735 | else { |
|
736 | 736 | spw_ioctl_send_SWF.dlen = 340 * NB_BYTES_SWF_BLK; |
|
737 | 737 | } |
|
738 | // SET PACKET SEQUENCE COUNTER | |
|
739 | increment_seq_counter_source_id( headerSWF[ i ].packetSequenceControl, sid ); | |
|
738 | 740 | // SET PACKET TIME |
|
739 | 741 | headerSWF[ i ].acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
740 | 742 | headerSWF[ i ].acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
@@ -798,6 +800,8 int send_waveform_CWF(volatile int *wave | |||
|
798 | 800 | else { |
|
799 | 801 | spw_ioctl_send_CWF.dlen = 340 * NB_BYTES_SWF_BLK; |
|
800 | 802 | } |
|
803 | // SET PACKET SEQUENCE COUNTER | |
|
804 | increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, sid ); | |
|
801 | 805 | // SET PACKET TIME |
|
802 | 806 | coarseTime = time_management_regs->coarse_time; |
|
803 | 807 | fineTime = time_management_regs->fine_time; |
@@ -890,6 +894,8 int send_waveform_CWF3_light(volatile in | |||
|
890 | 894 | else { |
|
891 | 895 | spw_ioctl_send_CWF.dlen = 340 * NB_BYTES_CWF3_LIGHT_BLK; |
|
892 | 896 | } |
|
897 | // SET PACKET SEQUENCE COUNTER | |
|
898 | increment_seq_counter_source_id( headerCWF[ i ].packetSequenceControl, SID_NORM_CWF_F3 ); | |
|
893 | 899 | // SET PACKET TIME |
|
894 | 900 | coarseTime = time_management_regs->coarse_time; |
|
895 | 901 | fineTime = time_management_regs->fine_time; |
@@ -1054,6 +1060,27 void reset_wfp_status() | |||
|
1054 | 1060 | |
|
1055 | 1061 | void reset_new_waveform_picker_regs() |
|
1056 | 1062 | { |
|
1063 | /** This function resets the waveform picker module registers. | |
|
1064 | * | |
|
1065 | * The registers affected by this function are located at the following offset addresses: | |
|
1066 | * - 0x00 data_shaping | |
|
1067 | * - 0x04 run_burst_enable | |
|
1068 | * - 0x08 addr_data_f0 | |
|
1069 | * - 0x0C addr_data_f1 | |
|
1070 | * - 0x10 addr_data_f2 | |
|
1071 | * - 0x14 addr_data_f3 | |
|
1072 | * - 0x18 status | |
|
1073 | * - 0x1C delta_snapshot | |
|
1074 | * - 0x20 delta_f0 | |
|
1075 | * - 0x24 delta_f0_2 | |
|
1076 | * - 0x28 delta_f1 | |
|
1077 | * - 0x2c delta_f2 | |
|
1078 | * - 0x30 nb_data_by_buffer | |
|
1079 | * - 0x34 nb_snapshot_param | |
|
1080 | * - 0x38 start_date | |
|
1081 | * | |
|
1082 | */ | |
|
1083 | ||
|
1057 | 1084 | new_waveform_picker_regs->data_shaping = 0x01; // 0x00 *** R1 R0 SP1 SP0 BW |
|
1058 | 1085 | new_waveform_picker_regs->run_burst_enable = 0x00; // 0x04 *** [run *** burst f2, f1, f0 *** enable f3, f2, f1, f0 ] |
|
1059 | 1086 | new_waveform_picker_regs->addr_data_f0 = (int) (wf_snap_f0); // 0x08 |
@@ -1073,25 +1100,6 void reset_new_waveform_picker_regs() | |||
|
1073 | 1100 | new_waveform_picker_regs->start_date = 0x00; // 0x38 |
|
1074 | 1101 | } |
|
1075 | 1102 | |
|
1076 | void reset_new_waveform_picker_regs_alt() | |
|
1077 | { | |
|
1078 | new_waveform_picker_regs->data_shaping = 0x01; // 0x00 *** R1 R0 SP1 SP0 BW | |
|
1079 | new_waveform_picker_regs->run_burst_enable = 0x00; // 0x04 *** [run *** burst f2, f1, f0 *** enable f3, f2, f1, f0 ] | |
|
1080 | new_waveform_picker_regs->addr_data_f0 = (int) (wf_snap_f0); // 0x08 | |
|
1081 | new_waveform_picker_regs->addr_data_f1 = (int) (wf_snap_f1); // 0x0c | |
|
1082 | new_waveform_picker_regs->addr_data_f2 = (int) (wf_snap_f2); // 0x10 | |
|
1083 | new_waveform_picker_regs->addr_data_f3 = (int) (wf_cont_f3); // 0x14 | |
|
1084 | new_waveform_picker_regs->status = 0x00; // 0x18 | |
|
1085 | new_waveform_picker_regs->delta_snapshot = 0x1000; // 0x1c 16 * 256 = 4096 | |
|
1086 | new_waveform_picker_regs->delta_f0 = 0x19; // 0x20 *** 1013 | |
|
1087 | new_waveform_picker_regs->delta_f0_2 = 0x7; // 0x24 *** 7 | |
|
1088 | new_waveform_picker_regs->delta_f1 = 0x19; // 0x28 *** 960 | |
|
1089 | new_waveform_picker_regs->delta_f2 = 0x400; // 0x2c *** 4 * 256 = 1024 | |
|
1090 | new_waveform_picker_regs->nb_data_by_buffer = 0x32; // 0x30 *** 16 * 3 + 2 | |
|
1091 | new_waveform_picker_regs->snapshot_param = 0xf; // 0x34 *** 16 -1 | |
|
1092 | new_waveform_picker_regs->start_date = 0x00; // 0x38 | |
|
1093 | } | |
|
1094 | ||
|
1095 | 1103 | //***************** |
|
1096 | 1104 | // local parameters |
|
1097 | 1105 | void set_local_sbm1_nb_cwf_max() |
@@ -1175,3 +1183,43 rtems_id get_pkts_queue_id( void ) | |||
|
1175 | 1183 | } |
|
1176 | 1184 | return queue_id; |
|
1177 | 1185 | } |
|
1186 | ||
|
1187 | void increment_seq_counter_source_id( unsigned char *packet_sequence_control, unsigned int sid ) | |
|
1188 | { | |
|
1189 | unsigned short *sequence_cnt; | |
|
1190 | unsigned short segmentation_grouping_flag; | |
|
1191 | unsigned short new_packet_sequence_control; | |
|
1192 | ||
|
1193 | if ( (sid ==SID_NORM_SWF_F0) || (sid ==SID_NORM_SWF_F1) || (sid ==SID_NORM_SWF_F2) | |
|
1194 | || (sid ==SID_NORM_CWF_F3) || (sid ==SID_BURST_CWF_F2) ) | |
|
1195 | { | |
|
1196 | sequence_cnt = &sequenceCounters_SCIENCE_NORMAL_BURST; | |
|
1197 | } | |
|
1198 | else if ( (sid ==SID_SBM1_CWF_F1) || (sid ==SID_SBM2_CWF_F2) ) | |
|
1199 | { | |
|
1200 | sequence_cnt = &sequenceCounters_SCIENCE_SBM1_SBM2; | |
|
1201 | } | |
|
1202 | else | |
|
1203 | { | |
|
1204 | sequence_cnt = &sequenceCounters_TC_EXE[ UNKNOWN ]; | |
|
1205 | PRINTF1("in increment_seq_counter_source_id *** ERR apid_destid %d not known\n", sid) | |
|
1206 | } | |
|
1207 | ||
|
1208 | segmentation_grouping_flag = (packet_sequence_control[ 0 ] & 0xc0) << 8; | |
|
1209 | *sequence_cnt = (*sequence_cnt) & 0x3fff; | |
|
1210 | ||
|
1211 | new_packet_sequence_control = segmentation_grouping_flag | *sequence_cnt ; | |
|
1212 | ||
|
1213 | packet_sequence_control[0] = (unsigned char) (new_packet_sequence_control >> 8); | |
|
1214 | packet_sequence_control[1] = (unsigned char) (new_packet_sequence_control ); | |
|
1215 | ||
|
1216 | // increment the sequence counter for the next packet | |
|
1217 | if ( *sequence_cnt < SEQ_CNT_MAX) | |
|
1218 | { | |
|
1219 | *sequence_cnt = *sequence_cnt + 1; | |
|
1220 | } | |
|
1221 | else | |
|
1222 | { | |
|
1223 | *sequence_cnt = 0; | |
|
1224 | } | |
|
1225 | } |
General Comments 0
You need to be logged in to leave comments.
Login now