File: /home/oboss/Users/gec/sources/Basic_Services/External_PUS/external_pus_data_types.ads
1 --% Compilation Unit: External_PUS_Data_Types
2 --
3 --% Category: Package Declaration
4 --
5 --% Release: $Name: $
6 --
7 --% Version: $Revision: 2.4 $
8 --
9 --% Author: $Author: gec $
10 --
11 --% Revision Log:
12 -- $Log: external_pus_data_types.ads,v $
13 -- Revision 2.4 2003/11/14 14:43:59 gec
14 -- Updated erroneous value for CCSDS Secondary Header Flag in telecommand data field headers.
15 --
16 -- Revision 2.3 2003/11/13 14:57:32 gec
17 -- Merged ECSS Migration branch to main trunk.
18 --
19 -- Revision 2.2.4.5 2003/11/13 08:04:54 gec
20 -- Updated On-board Operations Scheduling service in accordance with
21 --+ ECSS-E-70-41A
22 --
23 -- Revision 2.2.4.4 2003/11/11 15:21:02 gec
24 -- Updated Function Management Service in accordance with ECSS-E-70-41A.
25 --
26 -- Revision 2.2.4.3 2003/11/10 13:38:18 gec
27 -- Updated Housekeeping & Diagnostics Reporting Service according to
28 --+ ECSS-E-70-41A.
29 --
30 -- Revision 2.2.4.2 2003/10/29 15:38:08 gec
31 -- Added support for management of telemetry packet subcounters.
32 --
33 -- Revision 2.2.4.1 2003/10/29 07:17:38 gec
34 -- Packet headers and data field headers updated to be compliant to ECSS
35 --+ Telemetry & Telecommand Packet Utilization standard.
36 --
37 -- Revision 2.2 2003/10/21 08:44:42 gec
38 -- Merged STADY_Recommendations branch onto trunk.
39 -- Contains numerous updates resulting from STADY fault descriptions.
40 --
41 -- Revision 2.0.2.1 2003/10/20 13:47:55 gec
42 -- Replaced magic numbers for external representation of service types in
43 --+ 'External_PUS_Data_Types' by named numbers and references to these.
44 --
45 -- Response to STADY fault description Fault 98.
46 --
47 -- Revision 2.0.4.1 2003/10/01 11:54:21 jhl
48 -- Initial version of service 13 Event Action, and 19 Large Data Transfer.
49 --
50 -- Revision 2.0 2003/04/04 08:50:00 gec
51 -- Initial release of source files serving as baseline for OBOSS-III
52 --+ project.
53 --
54 -- Revision 1.1.1.1 2003/04/04 08:13:01 gec
55 -- Imported using TkCVS
56 --
57 --
58 --
59 --% Project: OBOSS
60 --
61 --% Copyright (C) 2003 by Terma A/S
62 -- Proprietary and intellectual rights of Terma A/S, Denmark,
63 -- are involved in the subject-matter of this material and
64 -- all manufacturing, reproduction, use, disclosure, and
65 -- sales rights pertaining to such subject-matter are
66 -- expressly reserved. This material is submitted for a
67 -- specific purpose as agreed, and the recipient by
68 -- accepting this material agrees that this material will
69 -- not be used, copied, or reproduced in whole or in part
70 -- nor its contents revealed in any manner or to any person,
71 -- except to meet the purpose for which it was submitted and
72 -- subject to the terms of the agreement.
73 --
74 --% Target Dependencies:
75 -- None
76 --% Compiler Dependencies:
77 -- None
78
79 --~-----------------------------------------------------------------------------
80
81 with Basic_Types;
82 with Mission_Parameters;
83 with PUS;
84 with Source_Data_Stream;
85 with Storage_Configuration;
86 with Application_Process_Parameters;
87 with PUS_Data_Types;
88 with Parameter_Representation;
89 package External_PUS_Data_Types is
90
91 --% Library Package:
92 -- Definition of external PUS packet data types and operations
93 --% Active Tasks:
94 --> None
95 --% Passive Tasks:
96 --> None
97
98 use PUS_Data_Types;
99
100 -- Declaration of spare bit field used at various places
101 type Spare_Bits is new Basic_Types.Bit_String;
102 Spare_Bit_Value : constant Basic_Types.Bit := 0;
103
104 type External_Packet_Type is new PUS_Data_Types.Packet_Type;
105 External_Packet_Type_Size : constant := 1;
106 for External_Packet_Type use (TM_Packet_Type => 0,
107 TC_Packet_Type => 1);
108 for External_Packet_Type'Size use External_Packet_Type_Size;
109
110 Version_Number_Size : constant := 3;
111 type Version_Number is range 0 .. 2**Version_Number_Size - 1;
112 for Version_Number'Size use Version_Number_Size;
113 -- Version numbers for telecommand and telemetry source packets
114 TC_Version_Number : constant Version_Number := 0;
115 TM_Version_Number : constant Version_Number := 0;
116 TC_Packet_PUS_Version : constant Version_Number := 1;
117 TM_Source_Packet_PUS_Version : constant Version_Number := 1;
118
119 type Packet_ID is
120 record
121 Version : Version_Number;
122 Pck_Type : External_Packet_Type;
123 Data_Field_Header_Flag : Boolean := True;
124 Application_ID : Mission_Parameters.APID;
125 end record;
126
127 for Packet_ID use
128 record
129 Version at 0 range 0 .. 2;
130 Pck_Type at 0 range 3 .. 3;
131 Data_Field_Header_Flag at 0 range 4 .. 4;
132 Application_ID at 0 range 5 .. 15;
133 end record;
134
135 for Packet_ID'Size use 16;
136
137 type Sequence_Flags is range 0 .. 2#11#;
138 for Sequence_Flags'Size use 2;
139
140 type External_Sequence_Count is new PUS_Data_Types.Sequence_Count;
141 for External_Sequence_Count'Size use Sequence_Count_Size;
142
143 type External_Ack_Type is new PUS_Data_Types.Ack_Type;
144 for External_Ack_Type'Size use 4;
145
146 -- Definitions for external representation of service types.
147 Telecommand_Verification_Service_Type : constant := 1;
148 Device_Level_Commanding_Service_Type : constant := 2;
149 HK_And_Diagnostic_Reporting_Service_Type : constant := 3;
150 Event_Reporting_Service_Type : constant := 5;
151 Memory_Management_Service_Type : constant := 6;
152 Function_Management_Service_Type : constant := 8;
153 Onboard_Scheduling_Service_Type : constant := 11;
154 Onboard_Monitoring_Service_Type : constant := 12;
155 Large_Data_Transfer_Service_Type : constant := 13;
156 Onboard_Storage_And_Retrieval_Service_Type : constant := 15;
157 Onboard_Traffic_Management_Service_Type : constant := 16;
158 Event_Action_Service_Type : constant := 19;
159 Science_Data_Service_Type : constant := 128;
160
161 type External_Service_Type is new PUS_Data_Types.Service_Type;
162 for External_Service_Type use
163 (Telecommand_Verification =>
164 Telecommand_Verification_Service_Type,
165 Device_Level_Commanding =>
166 Device_Level_Commanding_Service_Type,
167 HK_And_Diagnostic_Reporting =>
168 HK_And_Diagnostic_Reporting_Service_Type,
169 Event_Reporting =>
170 Event_Reporting_Service_Type,
171 Memory_Management =>
172 Memory_Management_Service_Type,
173 Function_Management =>
174 Function_Management_Service_Type,
175 Onboard_Scheduling =>
176 Onboard_Scheduling_Service_Type,
177 Onboard_Monitoring =>
178 Onboard_Monitoring_Service_Type,
179 Large_Data_Transfer =>
180 Large_Data_Transfer_Service_Type,
181 Onboard_Storage_And_Retrieval =>
182 Onboard_Storage_And_Retrieval_Service_Type,
183 Onboard_Traffic_Management =>
184 Onboard_Traffic_Management_Service_Type,
185 Event_Action =>
186 Event_Action_Service_Type,
187 Science_Data =>
188 Science_Data_Service_Type);
189
190 subtype External_Service_Type_Rep is Parameter_Representation.Enumerated_8;
191
192 subtype External_Service_Subtype is PUS_Data_Types.Service_Subtype;
193
194 subtype External_Service_Subtype_Rep is
195 Parameter_Representation.Enumerated_8;
196
197 -- Constants defining all valid service-subtypes within the defined services
198 --+
199 -- Only a subset of the PUS subservices are supported!
200
201 -- Valid sub-services for the Device-Level Commanding Service
202 -- Service Type = 2
203 Distribute_On_Off_Commands : constant External_Service_Subtype := 1;
204 Distribute_Register_Load_Commands : constant External_Service_Subtype := 2;
205
206 -- Valid sub-services for the Housekeeping and Diagnostic Reporting Service
207 -- Service Type = 3
208 Define_New_HK : constant External_Service_Subtype := 1;
209 Define_New_Diag : constant External_Service_Subtype := 2;
210 Clear_HK_Defs : constant External_Service_Subtype := 3;
211 Clear_Diag_Defs : constant External_Service_Subtype := 4;
212 Enable_HK : constant External_Service_Subtype := 5;
213 Disable_HK : constant External_Service_Subtype := 6;
214 Enable_Diag : constant External_Service_Subtype := 7;
215 Disable_Diag : constant External_Service_Subtype := 8;
216 Report_HK_Defs : constant External_Service_Subtype := 9;
217 HK_Defs_Report :
218 constant External_Service_Subtype := 10;
219 Report_Diag_Defs :
220 constant External_Service_Subtype := 11;
221 Diag_Defs_Report :
222 constant External_Service_Subtype := 12;
223 Report_HK_Sampling_Time_Offsets :
224 constant External_Service_Subtype := 13;
225 Report_Diag_Sampling_Time_Offsets :
226 constant External_Service_Subtype := 14;
227 HK_Sampling_Time_Offsets_Report :
228 constant External_Service_Subtype := 15;
229 Diag_Sampling_Time_Offsets_Report :
230 constant External_Service_Subtype := 16;
231 Select_Periodic_HK_Mode :
232 constant External_Service_Subtype := 17;
233 Select_Periodic_Diag_Mode :
234 constant External_Service_Subtype := 18;
235 Select_Filtered_HK_Mode :
236 constant External_Service_Subtype := 19;
237 Select_Filtered_Diag_Mode :
238 constant External_Service_Subtype := 20;
239 Report_Unfiltered_HK :
240 constant External_Service_Subtype := 21;
241 Report_Unfiltered_Diag :
242 constant External_Service_Subtype := 22;
243 Unfiltered_HK_Report :
244 constant External_Service_Subtype := 23;
245 Unfiltered_Diag_Report :
246 constant External_Service_Subtype := 24;
247 HK_Report :
248 constant External_Service_Subtype := 25;
249 Diag_Report :
250 constant External_Service_Subtype := 26;
251
252 -- Valid sub-services for the Event Reporting Service
253 -- Service Type = 5
254 Event_Progress_Report : constant External_Service_Subtype := 1;
255 Event_Low_Severity : constant External_Service_Subtype := 2;
256 Event_Medium_Severity : constant External_Service_Subtype := 3;
257 Event_High_Severity : constant External_Service_Subtype := 4;
258
259 -- Valid sub-services for the Memory Management Service
260 -- Service Type = 6
261 Load_Memory_Using_Absolute_Address :
262 constant External_Service_Subtype := 2;
263 Dump_Memory_Using_Absolute_Address :
264 constant External_Service_Subtype := 5;
265 Check_Memory_Using_Absolute_Address :
266 constant External_Service_Subtype := 9;
267
268 -- Valid sub-services for the Function Management Service
269 -- Service Type = 8
270 Perform_Function : constant External_Service_Subtype := 1;
271
272 -- Valid sub-services for the On-Board Scheduling Service
273 -- Service Type = 11
274 OBS_Enable_Release : constant External_Service_Subtype := 1;
275 OBS_Disable_Release : constant External_Service_Subtype := 2;
276 OBS_Reset_Command_Schedule : constant External_Service_Subtype := 3;
277 OBS_Insert_Telecommands_In_Command_Schedule :
278 constant External_Service_Subtype := 4;
279 OBS_Delete_Telecommands : constant External_Service_Subtype := 5;
280 OBS_Delete_Telecommands_Over_Time_Period :
281 constant External_Service_Subtype := 6;
282 OBS_Report_Subset_Of_Command_Schedule_Detailed :
283 constant External_Service_Subtype := 9;
284 OBS_Report_Command_Schedule_Detailed_Over_Time :
285 constant External_Service_Subtype := 11;
286 OBS_Report_Subset_Of_Command_Schedule_Summary :
287 constant External_Service_Subtype := 12;
288 OBS_Report_Command_Schedule_Summary_Over_Time :
289 constant External_Service_Subtype := 14;
290 OBS_Report_Command_Schedule_Detailed :
291 constant External_Service_Subtype := 16;
292 OBS_Report_Command_Schedule_Summary :
293 constant External_Service_Subtype := 17;
294
295 -- Valid sub-services for the Onboard Monitoring Service
296 -- Service Type = 12
297 Enable_Monitoring_Of_Parameters : constant External_Service_Subtype := 1;
298 Disable_Monitoring_Of_Parameters : constant External_Service_Subtype := 2;
299 Clear_Monitoring_List : constant External_Service_Subtype := 4;
300 Add_Parameters_To_Monitoring_List : constant External_Service_Subtype := 5;
301 Delete_Parameters_From_Monitoring_List :
302 constant External_Service_Subtype := 6;
303 Modify_Parameter_Checking_Information :
304 constant External_Service_Subtype := 7;
305 Report_Current_Monitoring_List : constant External_Service_Subtype := 8;
306 Current_Monitoring_List_Report : constant External_Service_Subtype := 9;
307 Report_Current_Parameters_OOL_List :
308 constant External_Service_Subtype := 10;
309 Current_Parameters_OOL_List_Report :
310 constant External_Service_Subtype := 11;
311 Out_Of_Limit_Report : constant External_Service_Subtype := 12;
312
313 -- Valid sub-services for the Large Data Transfer Service
314 -- Service Type = 13
315 --
316 -- Sending sub-service
317 -- TM's
318 First_Downlink_Part_Report : constant External_Service_Subtype := 1;
319 Intermediate_Downlink_Part_Report : constant External_Service_Subtype := 2;
320 Last_Downlink_Part_Report : constant External_Service_Subtype := 3;
321 Repeated_Part_Report : constant External_Service_Subtype := 7;
322 Downlink_Abort_Report : constant External_Service_Subtype := 4;
323 -- TC's
324 Downlink_Reception_Acknowledgement :
325 constant External_Service_Subtype := 5;
326 Repeat_Parts :
327 constant External_Service_Subtype := 6;
328 Abort_Downlink :
329 constant External_Service_Subtype := 8;
330 -- Receiving sub-service
331 -- TC's
332 Accept_First_Uplink_Part : constant External_Service_Subtype := 9;
333 Accept_Intermediate_Uplink_Part : constant External_Service_Subtype := 10;
334 Accept_Last_Uplink_Part : constant External_Service_Subtype := 11;
335 Accept_Repeated_Part : constant External_Service_Subtype := 12;
336 Abort_Reception_Of_Uplinked_Data : constant External_Service_Subtype := 13;
337 -- TM's
338 Uplink_Reception_Acknowledgement_Report :
339 constant External_Service_Subtype := 14;
340 Unsuccessfully_Received_Parts_Report :
341 constant External_Service_Subtype := 15;
342 Reception_Abort_Report : constant External_Service_Subtype := 16;
343
344 -- Valid sub-services for the Onboard Storage and Retrieval
345 -- Service Type = 15
346 Osr_Enable_Storage : constant External_Service_Subtype := 1;
347 Osr_Disable_Storage : constant External_Service_Subtype := 2;
348 Osr_Add_Selection_Def : constant External_Service_Subtype := 3;
349 Osr_Remove_Selection_Def : constant External_Service_Subtype := 4;
350 Osr_Report_Selection_Def : constant External_Service_Subtype := 5;
351 Osr_Selection_Def_Report : constant External_Service_Subtype := 6;
352 Osr_Get_Packets_In_Range : constant External_Service_Subtype := 7;
353 Osr_Contents_Report : constant External_Service_Subtype := 8;
354 Osr_Get_Packets_In_Period : constant External_Service_Subtype := 9;
355 Osr_Delete_To_Packet : constant External_Service_Subtype := 10;
356 Osr_Delete_To_Time : constant External_Service_Subtype := 11;
357
358 -- Valid sub-services for the Event Action service
359 -- Service Type = 19
360 Add_Events : constant External_Service_Subtype := 1;
361 Delete_Events : constant External_Service_Subtype := 2;
362 Clear_Detection_List : constant External_Service_Subtype := 3;
363 Enable_Actions : constant External_Service_Subtype := 4;
364 Disable_Actions : constant External_Service_Subtype := 5;
365 Report_Detection_List : constant External_Service_Subtype := 6;
366 Detection_List_Report : constant External_Service_Subtype := 7;
367
368 -- Valid sub-services for the Science Data service
369 -- Service Type = 128
370 Image_Data : constant External_Service_Subtype := 128;
371
372 -- Unit_Type is used for representation of the first field, Unit Type, in a
373 --+ Service Data Unit (SDU)
374 type SDU_Unit_Type is new PUS_Data_Types.SDU_Unit_Type;
375
376 for SDU_Unit_Type use (Standard_Packet => 0,
377 Extended_Packet => 1);
378 for SDU_Unit_Type'Size use 8;
379
380 type External_Service_Name is
381 record
382 Service_Type_Val : External_Service_Type;
383 Service_Subtype_Val : External_Service_Subtype;
384 end record;
385
386 for External_Service_Name use
387 record
388 Service_Type_Val at 0 range 0 .. 7;
389 Service_Subtype_Val at 0 range 8 .. 15;
390 end record;
391
392 for External_Service_Name'Size use 16;
393
394 type Error_Control_Value is range 0 .. 2**16 - 1;
395 for Error_Control_Value'Size use 16;
396
397 TC_Sequence_Flags : constant := 2#11#;
398
399 type TC_Packet_Sequence_Control is
400 record
401 Flags : Sequence_Flags := TC_Sequence_Flags;
402 Sequence_Count : External_Sequence_Count;
403 end record;
404
405 for TC_Packet_Sequence_Control use
406 record
407 Flags at 0 range 0 .. 1;
408 Sequence_Count at 0 range 2 .. 2 + Sequence_Count_Size - 1;
409 end record;
410
411 for TC_Packet_Sequence_Control'Size use 16;
412
413 Packet_Header_Size : constant := 48;
414
415 Length_Size : constant := 16;
416 type Length_Type is range 0 .. 2**Length_Size - 1;
417 for Length_Type'Size use Length_Size;
418
419 type TC_Packet_Header is
420 record
421 ID : Packet_ID;
422 Sequence_Control : TC_Packet_Sequence_Control;
423 Packet_Length : Length_Type;
424 end record;
425
426 for TC_Packet_Header use
427 record
428 ID at 0 range 0 .. 15;
429 Sequence_Control at 0 range 16 .. 31;
430 Packet_Length at 0 range 32 .. 47;
431 end record;
432
433 for TC_Packet_Header'Size use Packet_Header_Size;
434
435 TC_Data_Field_Header_Size : constant := 40;
436
437 -- Definition of spare field
438 TC_Data_Field_Header_Spare_Field_Length : constant := 4;
439 subtype TC_Data_Field_Header_Spare_Field_Type is
440 Spare_Bits (1 .. TC_Data_Field_Header_Spare_Field_Length);
441 TC_Data_Field_Header_Spare_Field_Value :
442 constant TC_Data_Field_Header_Spare_Field_Type :=
443 (others => Spare_Bit_Value);
444
445 type TC_Data_Field_Header is
446 record
447 CCSDS_Secondary_Header_Flag : Boolean :=
448 False; -- Not standard CCSDS
449 TC_Packet_PUS_Version_Number : Version_Number :=
450 TC_Packet_PUS_Version;
451 Ack : External_Ack_Type;
452 Service : External_Service_Name;
453 Source_ID : Mission_Parameters.Source_ID;
454 Spare
455 : TC_Data_Field_Header_Spare_Field_Type
456 :=
457 TC_Data_Field_Header_Spare_Field_Value;
458 end record;
459
460 for TC_Data_Field_Header use
461 record
462 CCSDS_Secondary_Header_Flag at 0 range 0 .. 0;
463 TC_Packet_PUS_Version_Number at 0 range 1 .. 3;
464 Ack at 0 range 4 .. 7;
465 Service at 0 range 8 .. 23;
466 Source_ID at 0 range 24 .. 35;
467 Spare at 0 range 36 .. 39;
468 end record;
469
470 for TC_Data_Field_Header'Size use TC_Data_Field_Header_Size;
471
472 -- Apparently not used. Commented by JHL 20-08-2003
473 -- Large_Source_Data_Byte_Size : constant :=
474 -- Storage_Configuration.
475 -- Large_Source_Data_Size /
476 -- Basic_Types.Byte_Size;
477
478 type External_TC_Packet is
479 record
480 Image_Length : Natural := 0;
481 Packet_Header : TC_Packet_Header;
482 Data_Field_Header : TC_Data_Field_Header;
483 Source_Data : Source_Data_Stream.Write_Stream;
484 end record;
485
486
487 type External_Source_Sequence_Count is new PUS_Data_Types.Sequence_Count;
488 for External_Source_Sequence_Count'Size use
489 PUS_Data_Types.Sequence_Count_Size;
490
491 type Preamble_Type is new Natural range 0 .. 2#1111#;
492 type External_Time_Component_Rep_Spec is new
493 Basic_Types.Time_Component_Rep_Spec;
494 type External_Coarse_Time is new
495 Basic_Types.On_Board_Coarse_Time;
496 type External_Fine_Time is new
497 Basic_Types.On_Board_Fine_Time;
498 Preamble_Default : constant Preamble_Type := 2#0010#;
499
500 -- NOTE: Only CUC time is supported.
501
502 type External_Time is
503 record
504 Preamble : Preamble_Type :=
505 Preamble_Default;
506 Coarse_Time_Rep, Fine_Time_Rep : External_Time_Component_Rep_Spec;
507 Coarse_Time : External_Coarse_Time;
508 Fine_Time : External_Fine_Time;
509 end record;
510
511 for External_Time use
512 record
513 Preamble at 0 range 0 .. 3;
514 Coarse_Time_Rep at 0 range 4 .. 5;
515 Fine_Time_Rep at 0 range 6 .. 7;
516 Coarse_Time at 0 range 8 .. 39;
517 Fine_Time at 0 range 40 .. 63;
518 end record;
519
520 External_Time_Byte_Size : constant := 1 + 4 + 3;
521 External_Time_Size : constant :=
522 External_Time_Byte_Size *
523 Basic_Types.Byte_Size;
524 for External_Time'Size use External_Time_Size;
525
526
527 -- Definition of grouping flag field
528 type Grouping_Flags is range 0 .. 2#11#;
529 for Grouping_Flags'Size use 2;
530 TM_Grouping_Flags : constant := 2#11#;
531
532 type TM_Packet_Sequence_Control is
533 record
534 Flags : Grouping_Flags :=
535 TM_Grouping_Flags;
536 Sequence_Counter : External_Source_Sequence_Count;
537 end record;
538
539 for TM_Packet_Sequence_Control use
540 record
541 Flags at 0 range 0 .. 1;
542 Sequence_Counter at 0 range 2 .. 15;
543 end record;
544
545 for TM_Packet_Sequence_Control'Size use 16;
546
547 type TM_Packet_Header is
548 record
549 ID : Packet_ID;
550 Sequence_Control : TM_Packet_Sequence_Control;
551 Packet_Length : Length_Type;
552 end record;
553
554 for TM_Packet_Header use
555 record
556 ID at 0 range 0 .. 15;
557 Sequence_Control at 0 range 16 .. 31;
558 Packet_Length at 0 range 32 .. 47;
559 end record;
560
561 for TM_Packet_Header'Size use Packet_Header_Size;
562
563 TM_Data_Field_Header_Size : constant := 112;
564
565 -- Definition of packet subcounters
566 type External_Packet_Subcounter is new PUS_Data_Types.Packet_Subcount;
567 for External_Packet_Subcounter'Size use
568 PUS_Data_Types.Packet_Subcount_Size;
569
570 -- Definition of various spare fields
571 TM_Data_Field_Header_Spare_Field_1_Length : constant := 1;
572 TM_Data_Field_Header_Spare_Field_2_Length : constant := 4;
573 TM_Data_Field_Header_Spare_Field_3_Length : constant := 4;
574
575 subtype TM_Data_Field_Header_Spare_Field_1_Type is
576 Spare_Bits (1 .. TM_Data_Field_Header_Spare_Field_1_Length);
577 subtype TM_Data_Field_Header_Spare_Field_2_Type is
578 Spare_Bits (1 .. TM_Data_Field_Header_Spare_Field_2_Length);
579 subtype TM_Data_Field_Header_Spare_Field_3_Type is
580 Spare_Bits (1 .. TM_Data_Field_Header_Spare_Field_3_Length);
581
582 TM_Data_Field_Header_Spare_Field_1_Value :
583 constant TM_Data_Field_Header_Spare_Field_1_Type :=
584 (others => Spare_Bit_Value);
585 TM_Data_Field_Header_Spare_Field_2_Value :
586 constant TM_Data_Field_Header_Spare_Field_2_Type :=
587 (others => Spare_Bit_Value);
588 TM_Data_Field_Header_Spare_Field_3_Value :
589 constant TM_Data_Field_Header_Spare_Field_3_Type :=
590 (others => Spare_Bit_Value);
591
592 type TM_Data_Field_Header is
593 record
594 Spare_Field_1 :
595 TM_Data_Field_Header_Spare_Field_1_Type :=
596 TM_Data_Field_Header_Spare_Field_1_Value;
597 TM_Source_Packet_PUS_Version_Number :
598 Version_Number :=
599 TM_Source_Packet_PUS_Version;
600 Spare_Field_2 :
601 TM_Data_Field_Header_Spare_Field_2_Type :=
602 TM_Data_Field_Header_Spare_Field_2_Value;
603 Service :
604 External_Service_Name;
605 Packet_Subcounter :
606 External_Packet_Subcounter;
607 Destination_ID :
608 Mission_Parameters.Destination_ID;
609 -- Time field is folded in.
610 -- Cannot refer to External_Time type, as such a field must start on a
611 --+ storage_unit boundary
612 Time_Preamble :
613 Preamble_Type :=
614 Preamble_Default;
615 Time_Coarse_Time_Rep, Time_Fine_Time_Rep :
616 External_Time_Component_Rep_Spec;
617 Time_Coarse_Time :
618 External_Coarse_Time;
619 Time_Fine_Time :
620 External_Fine_Time;
621 Spare_Field_3 :
622 TM_Data_Field_Header_Spare_Field_3_Type :=
623 TM_Data_Field_Header_Spare_Field_3_Value;
624 end record;
625
626 for TM_Data_Field_Header use
627 record
628 Spare_Field_1 at 0 range 0 .. 0;
629 TM_Source_Packet_PUS_Version_Number
630 at 0 range 1 .. 3;
631 Spare_Field_2 at 0 range 4 .. 7;
632 Service at 0 range 8 .. 23;
633 Packet_Subcounter at 0 range 24 .. 31;
634 Destination_ID at 0 range 32 .. 43;
635 Time_Preamble at 0 range 44 .. 47;
636 Time_Coarse_Time_Rep at 0 range 48 .. 49;
637 Time_Fine_Time_Rep at 0 range 50 .. 51;
638 Time_Coarse_Time at 0 range 52 .. 83;
639 Time_Fine_Time at 0 range 84 .. 107;
640 Spare_Field_3 at 0 range 108 .. 111;
641 end record;
642
643 for TM_Data_Field_Header'Size use TM_Data_Field_Header_Size;
644
645
646 type External_TM_Packet is
647 record
648 Image_Length : Natural := 0;
649 Packet_Header : TM_Packet_Header;
650 Data_Field_Header : TM_Data_Field_Header;
651 Source_Data : Source_Data_Stream.Write_Stream;
652 end record;
653
654
655 --% Subprogram:
656 -- Conversion of an internal on-board time to its external
657 --+ representation
658 --% Parameter Constraints:
659 --> None
660 --% Exceptions Raised:
661 --> Non_Supported_Time_Code - Raised if T_Format does not specify the
662 --+ time as: present, having CUC format and with code 0 (i.e. full
663 --+ definition)
664
665 function Internal_To_External_Time
666 (T_Format
667 : in Application_Process_Parameters.Appl_Time_Code_Type;
668 T : in Basic_Types.On_Board_Time)
669 return External_Time;
670
671
672 --% Subprogram:
673 -- Conversion of an external time to its corresponding internal on-board
674 --+ time
675 --% Parameter Constraints:
676 --> None
677 --% Exceptions Raised:
678 --> Non_Supported_Time_Code - Raised if T_Format does not specify the
679 --+ time as: present, having CUC format and with code 0 (i.e. full
680 --+ definition)
681
682 function External_To_Internal_Time
683 (T_Format
684 : in Application_Process_Parameters.Appl_Time_Code_Type;
685 T : in External_Time)
686 return Basic_Types.On_Board_Time;
687
688
689 --% Subprogram:
690 -- Check whether an application id that may stem from an unchecked
691 --+ conversion actually belongs to the required type.
692 --% Parameter Constraints:
693 --> None
694 --% Exceptions Raised:
695 --> Illegal_Application_ID - Raised if the application id does not belong
696 --+ to the required type
697
698 procedure Check_Application_ID
699 (Application_ID : in Mission_Parameters.APID);
700
701 --% Subprogram:
702 -- Check whether a source id that may stem from an unchecked conversion
703 --+ actually belongs to the required type.
704 --% Parameter Constraints:
705 --> None
706 --% Exceptions Raised:
707 --> Illegal_Source_ID - Raised if the source id does not belong to the
708 --+ required type
709
710 procedure Check_Source_ID
711 (Source : in Mission_Parameters.Source_ID);
712
713
714 --% Subprogram:
715 -- Check whether a service type that may stem from an unchecked
716 --+ conversion actually belongs to the required type.
717 --% Parameter Constraints:
718 --> None
719 --% Exceptions Raised:
720 --> Non_Supported_Service_Type - Raised if the service type does not
721 --+ belong to the required type
722
723 procedure Check_Service_Type
724 (Service_Type_Val : in External_Service_Type);
725
726
727 --% Subprogram:
728 -- Read an external service type from a stream.
729 --% Parameter Constraints:
730 --> None
731 --% Exceptions Raised:
732 --> Non_Supported_Service_Type - When a valid service type cannot be read
733 --+ from the source data stream.
734 --> Source_Data_Stream.Read_Stream_Exhausted - When source data stream
735 --+ does not hold a sufficient number of bits for the required type.
736
737 procedure Get
738 (Src_Data : in out Source_Data_Stream.Read_Stream;
739 Service_Type_Val : out External_Service_Type);
740
741 --% Subprogram:
742 -- Writes an external service type to a stream.
743 --% Parameter Constraints:
744 --> None
745 --% Exceptions Raised:
746 --> Non_Supported_Service_Type - When a invalid service type is attempted
747 --+ written to a stream.
748 --> Source_Data_Stream.Write_Stream_Exhausted - When the stream does not
749 --+ have sufficient space for the required type.
750
751 procedure Put
752 (Src_Data : in out Source_Data_Stream.Write_Stream;
753 Service_Type_Val : in External_Service_Type);
754
755
756 --% Subprogram:
757 -- Read an external service subtype from a stream.
758 --% Parameter Constraints:
759 --> None
760 --% Exceptions Raised:
761 --> Source_Data_Stream.Read_Stream_Exhausted - When source data stream
762 --+ does not hold a sufficient number of bits for the required type.
763
764 procedure Get
765 (Src_Data : in out Source_Data_Stream.Read_Stream;
766 Service_Subtype_Val : out External_Service_Subtype);
767
768
769 --% Subprogram:
770 -- Writes an external service subtype to a stream.
771 --% Parameter Constraints:
772 --> None
773 --% Exceptions Raised:
774 --> Source_Data_Stream.Write_Stream_Exhausted - When the stream does not
775 --+ have sufficient space for the required type.
776
777 procedure Put
778 (Src_Data : in out Source_Data_Stream.Write_Stream;
779 Service_Subtype_Val : in External_Service_Subtype);
780
781
782 -- Indicates that a byte array that is to be interpreted as a PUS packet has
783 --+ a wrong length
784 Wrong_Byte_Array_Length : exception;
785
786 -- Indicates that the packet error control field of a PUS packet represented
787 --+ by a byte array is inconsistent with the remaining bytes
788 Checksum_Error : exception;
789
790 -- Indicates that the version number in a packet header is not correct
791 Wrong_Version_Number : exception;
792
793 -- Indicates that the data field header flag in a packet header does not
794 --+ indicate presence of a data field header.
795 Wrong_Data_Field_Header_Flag : exception;
796
797 -- Indicates that an application process identifier is not valid.
798 Illegal_Application_ID : exception;
799
800 -- Indicates that the source identifier in a telecommand packet header is
801 --+ not valid.
802 Illegal_Source_ID : exception;
803
804 -- Indicates that the sequence flags or segmentation flags in a packet
805 --+ header are not correct
806 Wrong_Sequence_Flags : exception;
807
808 -- Indicates that the CCSDS secondary header flag contains in a TC data
809 --+ field header is not correct
810 Wrong_CCSDS_Secondary_Header_Flag : exception;
811
812 -- Indicates that a spare field does not contain the expected value
813 Wrong_Spare_Field : exception;
814
815 -- Indicates that the version number in a packet data field header is not
816 --+ correct
817 Wrong_PUS_Version_Number : exception;
818
819 -- Indicates that a servive type is not among those currently supported.
820 Non_Supported_Service_Type : exception;
821
822 -- Indicates an attempt to use a time which is not specified as: present,
823 --+ having CUC format and with code 0 (i.e. full definition)
824 Non_Supported_Time_Code : exception;
825
826 -- Indicates an that a Service Data Unit has wrong unit type
827 Non_Supported_SDU_Unit_Type : exception;
828
829 -- Indicates that a source/destination field is not an application process
830 --+ identifier.
831 Illegal_Source_Destination : exception;
832
833 end External_PUS_Data_Types;
834
835 --~-----------------------------------------------------------------------------
836