File: /home/oboss/Users/gec/sources/PUS_Services/Large_Data_Transfer/large_data_transfer.ads
1 --% Compilation Unit: Large_Data_Transfer
2 --
3 --% Category: Generic Package Declaration
4 --
5 --% Release: $Name: $
6 --
7 --% Version: $Revision: 1.4 $
8 --
9 --% Author: $Author: jhl $
10 --
11 --% Revision Log:
12 -- $Log: large_data_transfer.ads,v $
13 -- Revision 1.4 2003/11/14 14:40:59 jhl
14 -- Corrected large data transfer after ECSS migration:
15 -- - Now using Mission_Parameters.Destination_ID
16 --
17 -- Revision 1.3 2003/10/13 11:05:45 jhl
18 -- Removed with's not needed.
19 --
20 -- Revision 1.2 2003/10/09 11:05:35 jhl
21 -- Added Service 13 And 19
22 --
23 -- Revision 1.1.2.3 2003/10/06 14:02:30 jhl
24 -- Large Data Transfer Post Review third update
25 --
26 -- Revision 1.1.2.2 2003/10/03 09:47:57 jhl
27 -- Large Data Transfer post review first update
28 --
29 -- Revision 1.1.2.1 2003/10/01 11:54:52 jhl
30 -- Initial version of service 13 Event Action, and 19 Large Data Transfer.
31 --
32 -- Revision 2.0 2003/04/04 10:08:58 gec
33 -- Initial release serving as baseline for OBOSS-III project.
34 --
35 -- Revision 1.1.1.1 2003/04/04 07:19:20 gec
36 -- Imported using TkCVS
37 --
38 --
39 --
40 --% Project: OBOSS
41 --
42 --% Copyright (C) 2003 by Terma A/S
43 -- Proprietary and intellectual rights of Terma A/S, Denmark,
44 -- are involved in the subject-matter of this material and
45 -- all manufacturing, reproduction, use, disclosure, and
46 -- sales rights pertaining to such subject-matter are
47 -- expressly reserved. This material is submitted for a
48 -- specific purpose as agreed, and the recipient by
49 -- accepting this material agrees that this material will
50 -- not be used, copied, or reproduced in whole or in part
51 -- nor its contents revealed in any manner or to any person,
52 -- except to meet the purpose for which it was submitted and
53 -- subject to the terms of the agreement.
54 --
55 --% Target Dependencies:
56 -- None
57 --% Compiler Dependencies:
58 -- None
59
60
61 --~-----------------------------------------------------------------------------
62
63 with Mission_Parameters;
64
65 -- with's for internal PUS Packets
66 with PUS;
67
68 -- With's for service types and subtypes
69 with PUS_Data_Types;
70 with External_PUS_Data_Types;
71 with Large_Data_Transfer_Mission_Parameters;
72 with External_Large_Data_Transfer_Types;
73 with Large_Data_Transfer_Types;
74
75 -- With's for common parsing functionality
76 with Large_Data_Transfer_Parser;
77
78 -- With's for TC verification
79 with Verification_Types;
80
81 -- With's for Bit_Size and Byte_Size
82 with Basic_Types;
83
84 -- With's for the application process packet depositor
85 with Packet_Depositor;
86 with Packet_Depositor.SDU_Support;
87
88 -- With's for making event reports
89 with Event_Reporting_Types;
90 with Source_Data_Stream;
91
92 -- Access operators on Bit_Size
93 use type Basic_Types.Bit_Size;
94
95 generic
96
97 --% Generic Parameter Constraints:
98 --> None
99
100 -- Application ID of application process to which this service is
101 --+ associated.
102 Application_Process_ID : in Mission_Parameters.APID;
103
104 -- The package depositor for the application process this Large Data
105 --+ Transfer is a service in.
106 -- the LDT will serve as the packet depositor for all services in the
107 --+ application process.
108 with package The_Depositor is new Packet_Depositor(<>);
109
110 -- Maximum length of sequence number list in a "Repeat Parts" TC/TM.
111 -- The TC parser defines what happens if a TC with list length 0 is
112 --+ received.
113 Sequence_Number_List_Length : in Positive;
114
115 package Large_Data_Transfer is
116
117 --% Library Package:
118 -- Common data types and default procedures for the Large Data Transfer
119 --+ PUS service (Service Type 14).
120 --% Active Tasks:
121 --> None
122 --% Passive Tasks:
123 --> None
124
125 --
126 -- Ranges and types for sequence number lists in TC/TM packets
127 --
128
129 -- Type for sequence number:
130
131 -- Sequence number is also named "Part" or "Part Sequence Number".
132 -- Specific subtypes are declared for this later.
133
134 -- Sequence number list range
135 subtype Sequence_Number_List_Range is
136 Positive range 1 .. Sequence_Number_List_Length;
137
138 -- Sequence number list
139 type Sequence_Number_List is array (Sequence_Number_List_Range) of
140 Large_Data_Transfer_Types.Sequence_Number;
141
142 --
143 -- Calculation of the maximum number of SDU parts in any up/down linked
144 --+ Service Data Unit (SDU)
145 --
146
147 -- Redeclaration of useful constant, the part byte length.
148 Part_Byte_Length : constant :=
149 External_Large_Data_Transfer_Types.
150 SDU_Part_Byte_Size;
151
152 -- Max number of parts in any SDU (uplinked or downlinked):
153 Max_SDU_Parts : constant :=
154 (Large_Data_Transfer_Mission_Parameters.
155 Max_SDU_Byte_Size - 1) / Part_Byte_Length + 1;
156
157 --
158 -- Ranges and types for SDU byte array
159 --
160
161 subtype Optional_SDU_Byte_Range is
162 Natural range
163 0 .. Large_Data_Transfer_Mission_Parameters.Max_SDU_Byte_Size;
164
165 subtype SDU_Byte_Range is
166 Optional_SDU_Byte_Range range 1 .. Optional_SDU_Byte_Range'Last;
167
168 --
169 -- Ranges and types for SDU part arrays
170 --
171
172 subtype Optional_Part_Byte_Range is Natural range 0 .. Part_Byte_Length;
173
174 --
175 -- Ranges and types for SDU part (sequence) numbers
176 --
177
178 subtype Optional_Part_Range is
179 Large_Data_Transfer_Types.Sequence_Number range 0 .. Max_SDU_Parts;
180
181 subtype Part_Range is
182 Optional_Part_Range range 1 .. Optional_Part_Range'Last;
183
184 -- According to ECSS-E-70-41E:
185 --
186 -- The part sequence number of the first part to send/receive is always
187 --+ one:
188 First_Part_Sequence_Number : constant := Part_Range'First;
189
190 --
191 -- Default sub-programs and types for receiving and sending sub-service
192 --
193 -- These need to be public, as they are needed in the specification of
194 -- instantiations of children of this package.
195 --
196
197 --% Subprogram:
198 -- Default timeout handler for the Large Data Transfer receiving
199 --+ sub-service.
200 --
201 -- This subprogram NEED NOT be overridden in the instantiation of
202 --+ Large_Data_Transfer.Service.
203 --
204 -- This subprogram performs no actions.
205 --% Parameter Constraints:
206 --> None
207 --% Exceptions Raised:
208 --> None
209
210 type Receiver_Timeout is
211 record
212 Ldt_APID : Mission_Parameters.APID; -- LDT application process
213 --+ ID
214 SDU_Sender_APID : Mission_Parameters.APID; -- Sender of of SDU
215 --+ application process ID
216 end record;
217
218 procedure Default_Receiver_Timeout_Handler
219 (Timeout : in Receiver_Timeout);
220
221 --% Subprogram:
222 -- Default timeout handler for the Large Data Transfer sending
223 --+ sub-service.
224 --
225 -- This subprogram NEED NOT be overridden in the instantiation of
226 --+ Large_Data_Transfer.Service.
227 --
228 -- This subprogram performs no actions.
229 --% Parameter Constraints:
230 --> None
231 --% Exceptions Raised:
232 --> None
233
234 type Sender_Timeout is
235 record
236 Ldt_APID : Mission_Parameters.APID; -- LDT application
237 --+ process ID
238 SDU_Receiver_APID : Mission_Parameters.APID; -- Receiver of SDU
239 --+ application process ID
240 Service_Name : PUS_Data_Types.Service_Name; -- Service name of
241 --+ originating service sending
242 --+ SDU TM
243 end record;
244
245 procedure Default_Sender_Timeout_Handler
246 (Timeout : in Sender_Timeout);
247
248 -- Receiving sub-service default error reporting subprograms
249
250 --% Subprogram:
251 -- Default handler for TC PUS Packets in the Large Data Transfer
252 --+ receiving sub-service.
253 --
254 -- This subprogram shall be overridden in the instantiation of
255 --+ Large_Data_Transfer.Service if the sending sub-service is to be used.
256 --+
257 --
258 -- If this subprogram is ever called, an event error report is generated.
259 --+
260 --
261 -- TC_Packet is disposed by handler.
262 --% Parameter Constraints:
263 --> None
264 --% Exceptions Raised:
265 --> TC_Acknowledger.Illegal_Packet_Type - Operation has been invoked on a
266 --+ telemetry packet.
267 --> PUS_State.No_Streams_Available - Heap of source streams has been
268 --+ exhausted
269 --> PUS_State.No_Packets_Available - Heap of PUS packets has been
270 --+ exhausted
271
272 procedure Receiver_Not_Supported_Handle_TC_Packet
273 (TC_Packet : in PUS.PUS_Packet);
274
275 --% Subprogram:
276 -- Default handler for TC PUS Packets in the Large Data Transfer sending
277 --+ sub-service.
278 --
279 -- This subprogram shall be overridden in the instantiation of
280 --+ Large_Data_Transfer.Service if the sending sub-service is to be used.
281 --+
282 --
283 -- If this subprogram is ever called, an unknwon command TC verification
284 --+ acceptance failure is generated on the TC.
285 --
286 -- TC_Packet is disposed by handler.
287 --% Parameter Constraints:
288 --> None
289 --% Exceptions Raised:
290 --> TC_Acknowledger.Illegal_Packet_Type - Operation has been invoked on a
291 --+ telemetry packet.
292 --> PUS_State.No_Streams_Available - Heap of source streams has been
293 --+ exhausted
294 --> PUS_State.No_Packets_Available - Heap of PUS packets has been
295 --+ exhausted
296
297 procedure Sender_Not_Supported_Handle_TC_Packet
298 (TC_Packet : in PUS.PUS_Packet);
299
300 -- Sending sub-service default error reporting subprograms
301
302 --% Subprogram:
303 -- Default handler for depositing TM PUS Packets to the Large Data
304 --+ Transfer sending sub-service.
305 --
306 -- This subprogram shall be overridden in the instantiation of
307 --+ Large_Data_Transfer.Service if the sending sub-service is to be used.
308 --+
309 --
310 -- If this subprogram is ever called, an unknwon command TC verification
311 --+ acceptance failure is generated on the TC.
312 --
313 --% Parameter Constraints:
314 --> None
315 --% Exceptions Raised:
316 --> Satellite_Clock.Time_Not_CUC_Representable - Implementation flaw
317 --+ indicating that mission time format is inconsistent.
318 --> Source_Data_Stream.Write_Stream_Exhausted - Source_Data_Bit_Size is
319 --+ smaller than required for generation of telecommand verification
320 --+ packet.
321
322 function Sender_Not_Supported_Deposit_TM_Packet
323 (TM_Packet : in PUS.PUS_Packet)
324 return Boolean;
325
326 private
327
328 -- Package instantiations with types and functionality, for use in private
329 --+ generic children
330
331 --% Library Package:
332 -- Instantiation of the SDU support for from the package depositor
333 package The_SDU_Depositor is new The_Depositor.SDU_Support;
334
335 --% Library Package:
336 -- Instantiation of the SDU support for from the package depositor
337 package The_Parser is new
338 Large_Data_Transfer_Parser
339 (List_Range => Sequence_Number_List_Range,
340 List => Sequence_Number_List);
341
342 --% Subprogram:
343 -- Functionality for generating and sending a TC verification packet
344 --% Parameter Constraints:
345 --> TC - Must be a TC PUS Packet
346 --% Exceptions Raised:
347 --> TC_Acknowledger.Illegal_Packet_Type - Operation has been invoked on a
348 --+ telemetry packet.
349 --> PUS_State.No_Streams_Available - Heap of source streams has been
350 --+ exhausted
351 --> PUS_State.No_Packets_Available - Heap of PUS packets has been
352 --+ exhausted
353
354 procedure TC_Stage_Verification
355 (TC : in PUS.PUS_Packet;
356 Stage : in PUS_Data_Types.Ack_Stages;
357 Status : in Verification_Types.Verification_Status);
358
359 --% Subprogram:
360 -- Generate an event report with report id and additional parameters in
361 --+ source data stream
362 --
363 -- If Parameters read stream is not allocated Void is returned.
364 --% Parameter Constraints:
365 --> None
366 --% Exceptions Raised:
367 --> Satellite_Clock.Time_Not_CUC_Representable - Implementation flaw
368 --+ indicating that mission time format is inconsistent.
369 --> Source_Data_Stream.Write_Stream_Exhausted - Source_Data_Bit_Size is
370 --+ smaller than required for generation of telecommand verification
371 --+ packet.
372
373 function Make_Event_Report
374 (Generator : in Mission_Parameters.APID;
375 Receiver : in Mission_Parameters.Destination_ID;
376 Level : in Event_Reporting_Types.Reporting_Level;
377 Report_ID : in Event_Reporting_Types.Report_ID;
378 Parameters : in Source_Data_Stream.Read_Stream)
379 return PUS.Optional_PUS_Packet;
380
381 end Large_Data_Transfer;
382
383 --~-----------------------------------------------------------------------------
384