@@ -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 2.8.1, 2013-11-12T1 |
|
3 | <!-- Written by QtCreator 2.8.1, 2013-11-12T12:44:53. --> | |
4 | <qtcreator> |
|
4 | <qtcreator> | |
5 | <data> |
|
5 | <data> | |
6 | <variable>ProjectExplorer.Project.ActiveTarget</variable> |
|
6 | <variable>ProjectExplorer.Project.ActiveTarget</variable> |
@@ -30,6 +30,10 extern Packet_TM_LFR_HK_t housekeeping_p | |||||
30 | extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet; |
|
30 | extern Packet_TM_LFR_PARAMETER_DUMP_t parameter_dump_packet; | |
31 | extern struct param_local_str param_local; |
|
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 | extern rtems_name misc_name[5]; |
|
37 | extern rtems_name misc_name[5]; | |
34 | extern rtems_name Task_name[20]; /* array of task ids */ |
|
38 | extern rtems_name Task_name[20]; /* array of task ids */ | |
35 | extern rtems_id Task_id[20]; /* array of task ids */ |
|
39 | extern rtems_id Task_id[20]; /* array of task ids */ | |
@@ -68,7 +72,6 void set_wfp_burst_enable_register( unsi | |||||
68 | void reset_wfp_run_burst_enable(); |
|
72 | void reset_wfp_run_burst_enable(); | |
69 | void reset_wfp_status(); |
|
73 | void reset_wfp_status(); | |
70 | void reset_new_waveform_picker_regs(); |
|
74 | void reset_new_waveform_picker_regs(); | |
71 | void reset_new_waveform_picker_regs_alt(); |
|
|||
72 |
|
75 | |||
73 | //***************** |
|
76 | //***************** | |
74 | // local parameters |
|
77 | // local parameters | |
@@ -78,4 +81,6 void set_local_nb_interrupt_f0_MAX(); | |||||
78 | void reset_local_sbm1_nb_cwf_sent(); |
|
81 | void reset_local_sbm1_nb_cwf_sent(); | |
79 | void reset_local_sbm2_nb_cwf_sent(); |
|
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 | #endif // WF_HANDLER_H_INCLUDED |
|
86 | #endif // WF_HANDLER_H_INCLUDED |
@@ -82,7 +82,9 struct param_local_str param_local; | |||||
82 | // HK PACKETS |
|
82 | // HK PACKETS | |
83 | Packet_TM_LFR_HK_t housekeeping_packet; |
|
83 | Packet_TM_LFR_HK_t housekeeping_packet; | |
84 | // sequence counters are incremented by APID (PID + CAT) and destination ID |
|
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 | spw_stats spacewire_stats; |
|
88 | spw_stats spacewire_stats; | |
87 | spw_stats spacewire_stats_backup; |
|
89 | spw_stats spacewire_stats_backup; | |
88 |
|
90 |
@@ -196,34 +196,23 void init_local_mode_parameters( void ) | |||||
196 | /** This function initialize the param_local global variable with default values. |
|
196 | /** This function initialize the param_local global variable with default values. | |
197 |
|
|
197 | * | |
198 |
|
|
198 | */ | |
199 |
|
||||
200 | unsigned int i; |
|
199 | unsigned int i; | |
201 | unsigned int j; |
|
|||
202 | unsigned int k; |
|
|||
203 |
|
||||
204 | // LOCAL PARAMETERS |
|
200 | // LOCAL PARAMETERS | |
205 | set_local_sbm1_nb_cwf_max(); |
|
201 | set_local_sbm1_nb_cwf_max(); | |
206 | set_local_sbm2_nb_cwf_max(); |
|
202 | set_local_sbm2_nb_cwf_max(); | |
207 | set_local_nb_interrupt_f0_MAX(); |
|
203 | set_local_nb_interrupt_f0_MAX(); | |
208 |
|
||||
209 | BOOT_PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max) |
|
204 | BOOT_PRINTF1("local_sbm1_nb_cwf_max %d \n", param_local.local_sbm1_nb_cwf_max) | |
210 | BOOT_PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max) |
|
205 | BOOT_PRINTF1("local_sbm2_nb_cwf_max %d \n", param_local.local_sbm2_nb_cwf_max) | |
211 | BOOT_PRINTF1("nb_interrupt_f0_MAX = %d\n", param_local.local_nb_interrupt_f0_MAX) |
|
206 | BOOT_PRINTF1("nb_interrupt_f0_MAX = %d\n", param_local.local_nb_interrupt_f0_MAX) | |
212 |
|
||||
213 | reset_local_sbm1_nb_cwf_sent(); |
|
207 | reset_local_sbm1_nb_cwf_sent(); | |
214 | reset_local_sbm2_nb_cwf_sent(); |
|
208 | reset_local_sbm2_nb_cwf_sent(); | |
215 |
|
||||
216 | // init sequence counters |
|
209 | // init sequence counters | |
217 |
for |
|
210 | for(i = 0; i<SEQ_CNT_NB_DEST_ID; i++) | |
218 | { |
|
|||
219 | for(j = 0; j<SEQ_CNT_NB_CAT; j++) |
|
|||
220 |
|
|
211 | { | |
221 | for(k = 0; k<SEQ_CNT_NB_DEST_ID; k++) |
|
212 | sequenceCounters_TC_EXE[i] = 0x00; | |
222 | { |
|
|||
223 | sequenceCounters[i][j][k] = 0x00; |
|
|||
224 | } |
|
213 | } | |
225 | } |
|
214 | sequenceCounters_SCIENCE_NORMAL_BURST = 0x00; | |
226 | } |
|
215 | sequenceCounters_SCIENCE_SBM1_SBM2 = 0x00; | |
227 | } |
|
216 | } | |
228 |
|
217 | |||
229 | void create_names( void ) // create all names for tasks and queues |
|
218 | void create_names( void ) // create all names for tasks and queues |
@@ -735,6 +735,8 int send_waveform_SWF( volatile int *wav | |||||
735 | else { |
|
735 | else { | |
736 | spw_ioctl_send_SWF.dlen = 340 * NB_BYTES_SWF_BLK; |
|
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 | // SET PACKET TIME |
|
740 | // SET PACKET TIME | |
739 | headerSWF[ i ].acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24); |
|
741 | headerSWF[ i ].acquisitionTime[0] = (unsigned char) (time_management_regs->coarse_time>>24); | |
740 | headerSWF[ i ].acquisitionTime[1] = (unsigned char) (time_management_regs->coarse_time>>16); |
|
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 | else { |
|
800 | else { | |
799 | spw_ioctl_send_CWF.dlen = 340 * NB_BYTES_SWF_BLK; |
|
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 | // SET PACKET TIME |
|
805 | // SET PACKET TIME | |
802 | coarseTime = time_management_regs->coarse_time; |
|
806 | coarseTime = time_management_regs->coarse_time; | |
803 | fineTime = time_management_regs->fine_time; |
|
807 | fineTime = time_management_regs->fine_time; | |
@@ -890,6 +894,8 int send_waveform_CWF3_light(volatile in | |||||
890 | else { |
|
894 | else { | |
891 | spw_ioctl_send_CWF.dlen = 340 * NB_BYTES_CWF3_LIGHT_BLK; |
|
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 | // SET PACKET TIME |
|
899 | // SET PACKET TIME | |
894 | coarseTime = time_management_regs->coarse_time; |
|
900 | coarseTime = time_management_regs->coarse_time; | |
895 | fineTime = time_management_regs->fine_time; |
|
901 | fineTime = time_management_regs->fine_time; | |
@@ -1054,6 +1060,27 void reset_wfp_status() | |||||
1054 |
|
1060 | |||
1055 | void reset_new_waveform_picker_regs() |
|
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 | new_waveform_picker_regs->data_shaping = 0x01; // 0x00 *** R1 R0 SP1 SP0 BW |
|
1084 | new_waveform_picker_regs->data_shaping = 0x01; // 0x00 *** R1 R0 SP1 SP0 BW | |
1058 | new_waveform_picker_regs->run_burst_enable = 0x00; // 0x04 *** [run *** burst f2, f1, f0 *** enable f3, f2, f1, f0 ] |
|
1085 | new_waveform_picker_regs->run_burst_enable = 0x00; // 0x04 *** [run *** burst f2, f1, f0 *** enable f3, f2, f1, f0 ] | |
1059 | new_waveform_picker_regs->addr_data_f0 = (int) (wf_snap_f0); // 0x08 |
|
1086 | new_waveform_picker_regs->addr_data_f0 = (int) (wf_snap_f0); // 0x08 | |
@@ -1073,25 +1100,6 void reset_new_waveform_picker_regs() | |||||
1073 | new_waveform_picker_regs->start_date = 0x00; // 0x38 |
|
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 | // local parameters |
|
1104 | // local parameters | |
1097 | void set_local_sbm1_nb_cwf_max() |
|
1105 | void set_local_sbm1_nb_cwf_max() | |
@@ -1175,3 +1183,43 rtems_id get_pkts_queue_id( void ) | |||||
1175 | } |
|
1183 | } | |
1176 | return queue_id; |
|
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