source: rtems/c/src/ada/rtems.ads @ bb2b825

4.115
Last change on this file since bb2b825 was 9b4422a2, checked in by Joel Sherrill <joel.sherrill@…>, on 05/03/12 at 15:09:24

Remove All CVS Id Strings Possible Using a Script

Script does what is expected and tries to do it as
smartly as possible.

+ remove occurrences of two blank comment lines

next to each other after Id string line removed.

+ remove entire comment blocks which only exited to

contain CVS Ids

+ If the processing left a blank line at the top of

a file, it was removed.

  • Property mode set to 100644
File size: 19.2 KB
Line 
1--  RTEMS / Specification
2--
3--  DESCRIPTION:
4--
5--  This package provides the interface to the RTEMS API.
6--
7--  DEPENDENCIES:
8--
9--  NOTES:
10--    RTEMS initialization and configuration are called from
11--    the BSP side, therefore should never be called from ADA.
12--
13--  COPYRIGHT (c) 1997-2011.
14--  On-Line Applications Research Corporation (OAR).
15--
16--  The license and distribution terms for this file may in
17--  the file LICENSE in this distribution or at
18--  http://www.rtems.com/license/LICENSE.
19--
20
21with System;
22with System.Storage_Elements; use System.Storage_Elements;
23with Interfaces;
24with Interfaces.C;
25
26package RTEMS is
27pragma Elaborate_Body (RTEMS);
28
29   Structure_Alignment : constant := 8;
30
31   --
32   --  RTEMS Base Types
33   --
34
35   subtype Unsigned8  is Interfaces.Unsigned_8;
36   subtype Unsigned16 is Interfaces.Unsigned_16;
37   subtype Unsigned32 is Interfaces.Unsigned_32;
38   subtype Signed32   is Interfaces.Integer_32;
39
40   type Unsigned32_Pointer     is access all RTEMS.Unsigned32;
41   type Unsigned16_Pointer     is access all RTEMS.Unsigned16;
42   type Unsigned8_Pointer      is access all RTEMS.Unsigned8;
43   type Signed32_Pointer       is access all RTEMS.Signed32;
44
45   subtype Boolean             is RTEMS.Unsigned8;
46   subtype Address             is System.Address;
47   subtype Single              is Interfaces.C.C_float;
48   subtype Double              is Interfaces.C.Double;
49
50   --
51   --  The following define the size of each of the base types in
52   --  both bits and system units.
53   --
54
55   Unsigned8_Bits   : constant := 7;
56   Unsigned16_Bits  : constant := 15;
57   Unsigned32_Bits  : constant := 31;
58   Boolean_Bits     : constant := 7;
59   Address_Bits     : constant := 31;
60   Single_Bits      : constant := 31;
61   Double_Bits      : constant := 63;
62
63   Unsigned8_Units  : constant := 1;
64   Unsigned16_Units : constant := 2;
65   Unsigned32_Units : constant := 4;
66   Boolean_Units    : constant := 1;
67   Address_Units    : constant := 4;
68   Single_Units     : constant := 4;
69   Double_Units     : constant := 8;
70
71   Null_Address     : constant RTEMS.Address :=
72      System.Storage_Elements.To_Address(0);
73
74   True  : constant RTEMS.Boolean := 1;
75   False : constant RTEMS.Boolean := 0;
76
77   --
78   --  More Types
79   --
80
81   subtype Name                is RTEMS.Unsigned32;
82   subtype ID                  is RTEMS.Unsigned32;
83   subtype Interval            is RTEMS.Unsigned32;
84   subtype Attribute           is RTEMS.Unsigned32;
85   subtype Mode                is RTEMS.Unsigned32;
86   subtype Option              is RTEMS.Unsigned32;
87   subtype Notepad_Index       is RTEMS.Unsigned32 range 0 .. 15;
88
89   subtype Event_Set           is RTEMS.Unsigned32;
90   subtype Signal_Set          is RTEMS.Unsigned32;
91   subtype Device_Major_Number is RTEMS.Unsigned32;
92   subtype Device_Minor_Number is RTEMS.Unsigned32;
93   subtype ISR_Level           is RTEMS.Unsigned32;
94
95   subtype Node                is RTEMS.Unsigned32;
96
97   type Driver_Name_t is
98      record
99         Device_Name        : RTEMS.Address;
100         Device_Name_Length : RTEMS.Unsigned32;
101         Major              : RTEMS.Device_Major_Number;
102         Minor              : RTEMS.Device_Minor_Number;
103
104      end record;
105
106
107   --
108   --  Task Related Types
109   --
110
111   subtype TCB                 is RTEMS.Unsigned32;
112   type    TCB_Pointer         is access all RTEMS.TCB;
113
114   --
115   --  Time of Day Type
116   --
117
118   type Time_Of_Day is
119      record
120         Year    : RTEMS.Unsigned32; -- year, A.D.
121         Month   : RTEMS.Unsigned32; -- month, 1 .. 12
122         Day     : RTEMS.Unsigned32; -- day, 1 .. 31
123         Hour    : RTEMS.Unsigned32; -- hour, 0 .. 23
124         Minute  : RTEMS.Unsigned32; -- minute, 0 .. 59
125         Second  : RTEMS.Unsigned32; -- second, 0 .. 59
126         Ticks   : RTEMS.Unsigned32; -- elapsed ticks between seconds
127      end record;
128
129   type Time_T is new Interfaces.C.Long;
130
131   type Timespec is record
132      TV_Sec  : Time_T;
133      TV_Nsec : Interfaces.C.Long;
134   end record;
135   pragma Convention (C, Timespec);
136
137   type Time_Value is
138      record
139         Seconds      : RTEMS.Unsigned32;
140         Microseconds : RTEMS.Unsigned32;
141      end record;
142
143   --
144   --  Ident Options
145   --
146
147   Search_All_Nodes   : constant RTEMS.Node := 0;
148   Search_Other_Nodes : constant RTEMS.Node := 16#7FFFFFFE#;
149   Search_Local_Node  : constant RTEMS.Node := 16#7FFFFFFF#;
150   Who_Am_I           : constant RTEMS.Node := 0;
151
152   --
153   --  Options
154   --
155
156   Default_Options    : constant RTEMS.Option    := 16#0000#;
157
158   Wait      : constant RTEMS.Option := 16#0000#;
159   No_Wait   : constant RTEMS.Option := 16#0001#;
160
161   Event_All : constant RTEMS.Option := 16#0000#;
162   Event_Any : constant RTEMS.Option := 16#0002#;
163
164   --
165   --  Mode constants
166   --
167
168   Default_Modes      : constant RTEMS.Mode      := 16#0000#;
169
170   All_Mode_Masks     : constant RTEMS.Mode := 16#0000_ffff#;
171   Current_Mode       : constant RTEMS.Mode := 16#0000_0000#;
172   Preempt_Mask       : constant RTEMS.Mode := 16#0000_0100#;
173   Timeslice_Mask     : constant RTEMS.Mode := 16#0000_0200#;
174   ASR_Mask           : constant RTEMS.Mode := 16#0000_0400#;
175   Interrupt_Mask     : RTEMS.Mode;
176   Preempt            : constant RTEMS.Mode := 16#0000_0000#;
177   No_Preempt         : constant RTEMS.Mode := 16#0000_0100#;
178   No_Timeslice       : constant RTEMS.Mode := 16#0000_0000#;
179   Timeslice          : constant RTEMS.Mode := 16#0000_0200#;
180   ASR                : constant RTEMS.Mode := 16#0000_0000#;
181   No_ASR             : constant RTEMS.Mode := 16#0000_0400#;
182
183   pragma Import (C, Interrupt_Mask, "rtems_interrupt_mask");
184
185   --
186   --  Attribute constants
187   --
188
189   Default_Attributes      : constant RTEMS.Attribute := 16#00000000#;
190   No_Floating_Point       : constant RTEMS.Attribute := 16#00000000#;
191   Floating_Point          : constant RTEMS.Attribute := 16#00000001#;
192   Local                   : constant RTEMS.Attribute := 16#00000000#;
193   Global                  : constant RTEMS.Attribute := 16#00000002#;
194   FIFO                    : constant RTEMS.Attribute := 16#00000000#;
195   Priority                : constant RTEMS.Attribute := 16#00000004#;
196   Counting_Semaphore      : constant RTEMS.Attribute := 16#00000000#;
197   Binary_Semaphore        : constant RTEMS.Attribute := 16#00000010#;
198   Simple_Binary_Semaphore : constant RTEMS.Attribute := 16#00000020#;
199   No_Inherit_Priority     : constant RTEMS.Attribute := 16#00000000#;
200   Inherit_Priority        : constant RTEMS.Attribute := 16#00000040#;
201   No_Priority_Ceiling     : constant RTEMS.Attribute := 16#00000000#;
202   Priority_Ceiling        : constant RTEMS.Attribute := 16#00000080#;
203
204   function Interrupt_Level (
205      Level : in     RTEMS.Unsigned32
206   ) return RTEMS.Mode;
207   pragma Import (C, Interrupt_Level, "rtems_interrupt_level_body");
208
209   Minimum_Stack_Size : RTEMS.Unsigned32;
210   pragma Import (C, Minimum_Stack_Size, "rtems_minimum_stack_size");
211
212   --
213   --  Notepad index constants
214   --
215
216   Notepad_0  : constant RTEMS.Unsigned32 := 0;
217   Notepad_1  : constant RTEMS.Unsigned32 := 1;
218   Notepad_2  : constant RTEMS.Unsigned32 := 2;
219   Notepad_3  : constant RTEMS.Unsigned32 := 3;
220   Notepad_4  : constant RTEMS.Unsigned32 := 4;
221   Notepad_5  : constant RTEMS.Unsigned32 := 5;
222   Notepad_6  : constant RTEMS.Unsigned32 := 6;
223   Notepad_7  : constant RTEMS.Unsigned32 := 7;
224   Notepad_8  : constant RTEMS.Unsigned32 := 8;
225   Notepad_9  : constant RTEMS.Unsigned32 := 9;
226   Notepad_10 : constant RTEMS.Unsigned32 := 10;
227   Notepad_11 : constant RTEMS.Unsigned32 := 11;
228   Notepad_12 : constant RTEMS.Unsigned32 := 12;
229   Notepad_13 : constant RTEMS.Unsigned32 := 13;
230   Notepad_14 : constant RTEMS.Unsigned32 := 14;
231   Notepad_15 : constant RTEMS.Unsigned32 := 15;
232
233   --
234   --  Miscellaneous
235   --
236
237   No_Timeout                    : constant RTEMS.Interval := 0;
238   Self                          : constant RTEMS.ID       := 0;
239   Yield_Processor               : constant RTEMS.Interval := 0;
240   Rate_Monotonic_Period_Status  : constant RTEMS.Interval := 0;
241
242
243   --
244   --  Extension Callouts and Table
245   --
246
247   type Thread_Create_Extension is access function (
248      Current_Task : in     RTEMS.TCB_Pointer;
249      New_Task     : in     RTEMS.TCB_Pointer
250   ) return RTEMS.Boolean;
251   pragma Convention (C, Thread_Create_Extension);
252
253   type Thread_Start_Extension is access procedure (
254      Current_Task : in     RTEMS.TCB_Pointer;
255      Started_Task : in     RTEMS.TCB_Pointer
256   );
257   pragma Convention (C, Thread_Start_Extension);
258
259   type Thread_Restart_Extension is access procedure (
260      Current_Task   : in     RTEMS.TCB_Pointer;
261      Restarted_Task : in     RTEMS.TCB_Pointer
262   );
263   pragma Convention (C, Thread_Restart_Extension);
264
265   type Thread_Delete_Extension is access procedure (
266      Current_Task : in     RTEMS.TCB_Pointer;
267      Deleted_Task : in     RTEMS.TCB_Pointer
268   );
269   pragma Convention (C, Thread_Delete_Extension);
270
271   type Thread_Switch_Extension is access procedure (
272      Current_Task : in     RTEMS.TCB_Pointer;
273      Heir_Task    : in     RTEMS.TCB_Pointer
274   );
275   pragma Convention (C, Thread_Switch_Extension);
276
277   type Thread_Post_Switch_Extension is access procedure (
278      Current_Task : in     RTEMS.TCB_Pointer
279   );
280   pragma Convention (C, Thread_Post_Switch_Extension);
281
282   type Thread_Begin_Extension is access procedure (
283      Current_Task : in     RTEMS.TCB_Pointer
284   );
285   pragma Convention (C, Thread_Begin_Extension);
286
287   type Thread_Exitted_Extension is access procedure (
288      Current_Task : in     RTEMS.TCB_Pointer
289   );
290   pragma Convention (C, Thread_Exitted_Extension);
291
292   type Fatal_Error_Extension is access procedure (
293      Error : in     RTEMS.Unsigned32
294   );
295   pragma Convention (C, Fatal_Error_Extension);
296
297   type Extensions_Table is
298      record
299         Thread_Create      : RTEMS.Thread_Create_Extension;
300         Thread_Start       : RTEMS.Thread_Start_Extension;
301         Thread_Restart     : RTEMS.Thread_Restart_Extension;
302         Thread_Delete      : RTEMS.Thread_Delete_Extension;
303         Thread_Switch      : RTEMS.Thread_Switch_Extension;
304         Thread_Post_Switch : RTEMS.Thread_Post_Switch_Extension;
305         Thread_Begin       : RTEMS.Thread_Begin_Extension;
306         Thread_Exitted     : RTEMS.Thread_Exitted_Extension;
307         Fatal              : RTEMS.Fatal_Error_Extension;
308      end record;
309
310   type Extensions_Table_Pointer is access all Extensions_Table;
311
312   --
313   --  The following type define a pointer to a signal service routine.
314   --
315
316   type ASR_Handler is access procedure (
317      Signals : in     RTEMS.Signal_Set
318   );
319   pragma Convention (C, ASR_Handler);
320
321   --
322   --  Method Completions Status Codes
323   --
324
325   type Status_Codes is (
326      Successful,               -- successful completion
327      Task_Exitted,             -- returned from a task
328      MP_Not_Configured,        -- multiprocessing not configured
329      Invalid_Name,             -- invalid object name
330      Invalid_ID,               -- invalid object id
331      Too_Many,                 -- too many
332      Timeout,                  -- timed out waiting
333      Object_Was_Deleted,       -- object deleted while waiting
334      Invalid_Size,             -- specified size was invalid
335      Invalid_Address,          -- address specified is invalid
336      Invalid_Number,           -- number was invalid
337      Not_Defined,              -- item has not been initialized
338      Resource_In_Use,          -- resources still outstanding
339      Unsatisfied,              -- request not satisfied
340      Incorrect_State,          -- task is in wrong state
341      Already_Suspended,        -- task already in state
342      Illegal_On_Self,          -- illegal on calling task
343      Illegal_On_Remote_Object, -- illegal for remote object
344      Called_From_ISR,          -- called from wrong environment
345      Invalid_Priority,         -- invalid task priority
346      Invalid_Clock,            -- invalid date/time
347      Invalid_Node,             -- invalid node id
348      Not_Configured,           -- directive not configured
349      Not_Owner_Of_Resource,    -- not owner of resource
350      Not_Implemented,          -- directive not implemented
351      Internal_Error,           -- RTEMS inconsistency detected
352      No_Memory,                -- no memory left in heap
353      IO_Error,                 -- driver IO error
354      Proxy_Blocking            -- internal multiprocessing only
355   );
356
357   for Status_Codes'Size use 32;
358
359   for Status_Codes use (
360      Successful                  =>  0,
361      Task_Exitted                =>  1,
362      MP_Not_Configured           =>  2,
363      Invalid_Name                =>  3,
364      Invalid_ID                  =>  4,
365      Too_Many                    =>  5,
366      Timeout                     =>  6,
367      Object_Was_Deleted          =>  7,
368      Invalid_Size                =>  8,
369      Invalid_Address             =>  9,
370      Invalid_NumbeR              => 10,
371      Not_Defined                 => 11,
372      Resource_In_Use             => 12,
373      Unsatisfied                 => 13,
374      Incorrect_State             => 14,
375      Already_Suspended           => 15,
376      Illegal_On_Self             => 16,
377      Illegal_On_Remote_Object    => 17,
378      Called_From_ISR             => 18,
379      Invalid_Priority            => 19,
380      Invalid_Clock               => 20,
381      Invalid_Node                => 21,
382      Not_Configured              => 22,
383      Not_Owner_Of_Resource       => 23,
384      Not_ImplementeD             => 24,
385      Internal_Error              => 25,
386      No_Memory                   => 26,
387      IO_Error                    => 27,
388      Proxy_Blocking              => 28
389   );
390
391   --
392   --  RTEMS Events
393   --
394
395   Pending_Events : constant RTEMS.Event_Set := 16#0000_0000#;
396   All_Events     : constant RTEMS.Event_Set := 16#FFFF_FFFF#;
397   Event_0        : constant RTEMS.Event_Set := 16#0000_0001#;
398   Event_1        : constant RTEMS.Event_Set := 16#0000_0002#;
399   Event_2        : constant RTEMS.Event_Set := 16#0000_0004#;
400   Event_3        : constant RTEMS.Event_Set := 16#0000_0008#;
401   Event_4        : constant RTEMS.Event_Set := 16#0000_0010#;
402   Event_5        : constant RTEMS.Event_Set := 16#0000_0020#;
403   Event_6        : constant RTEMS.Event_Set := 16#0000_0040#;
404   Event_7        : constant RTEMS.Event_Set := 16#0000_0080#;
405   Event_8        : constant RTEMS.Event_Set := 16#0000_0100#;
406   Event_9        : constant RTEMS.Event_Set := 16#0000_0200#;
407   Event_10       : constant RTEMS.Event_Set := 16#0000_0400#;
408   Event_11       : constant RTEMS.Event_Set := 16#0000_0800#;
409   Event_12       : constant RTEMS.Event_Set := 16#0000_1000#;
410   Event_13       : constant RTEMS.Event_Set := 16#0000_2000#;
411   Event_14       : constant RTEMS.Event_Set := 16#0000_4000#;
412   Event_15       : constant RTEMS.Event_Set := 16#0000_8000#;
413   Event_16       : constant RTEMS.Event_Set := 16#0001_0000#;
414   Event_17       : constant RTEMS.Event_Set := 16#0002_0000#;
415   Event_18       : constant RTEMS.Event_Set := 16#0004_0000#;
416   Event_19       : constant RTEMS.Event_Set := 16#0008_0000#;
417   Event_20       : constant RTEMS.Event_Set := 16#0010_0000#;
418   Event_21       : constant RTEMS.Event_Set := 16#0020_0000#;
419   Event_22       : constant RTEMS.Event_Set := 16#0040_0000#;
420   Event_23       : constant RTEMS.Event_Set := 16#0080_0000#;
421   Event_24       : constant RTEMS.Event_Set := 16#0100_0000#;
422   Event_25       : constant RTEMS.Event_Set := 16#0200_0000#;
423   Event_26       : constant RTEMS.Event_Set := 16#0400_0000#;
424   Event_27       : constant RTEMS.Event_Set := 16#0800_0000#;
425   Event_28       : constant RTEMS.Event_Set := 16#1000_0000#;
426   Event_29       : constant RTEMS.Event_Set := 16#2000_0000#;
427   Event_30       : constant RTEMS.Event_Set := 16#4000_0000#;
428   Event_31       : constant RTEMS.Event_Set := 16#8000_0000#;
429
430   --
431   --  RTEMS Signals
432   --
433
434   All_Signals : constant RTEMS.Signal_Set := 16#7FFFFFFF#;
435   Signal_0    : constant RTEMS.Signal_Set := 16#00000001#;
436   Signal_1    : constant RTEMS.Signal_Set := 16#00000002#;
437   Signal_2    : constant RTEMS.Signal_Set := 16#00000004#;
438   Signal_3    : constant RTEMS.Signal_Set := 16#00000008#;
439   Signal_4    : constant RTEMS.Signal_Set := 16#00000010#;
440   Signal_5    : constant RTEMS.Signal_Set := 16#00000020#;
441   Signal_6    : constant RTEMS.Signal_Set := 16#00000040#;
442   Signal_7    : constant RTEMS.Signal_Set := 16#00000080#;
443   Signal_8    : constant RTEMS.Signal_Set := 16#00000100#;
444   Signal_9    : constant RTEMS.Signal_Set := 16#00000200#;
445   Signal_10   : constant RTEMS.Signal_Set := 16#00000400#;
446   Signal_11   : constant RTEMS.Signal_Set := 16#00000800#;
447   Signal_12   : constant RTEMS.Signal_Set := 16#00001000#;
448   Signal_13   : constant RTEMS.Signal_Set := 16#00002000#;
449   Signal_14   : constant RTEMS.Signal_Set := 16#00004000#;
450   Signal_15   : constant RTEMS.Signal_Set := 16#00008000#;
451   Signal_16   : constant RTEMS.Signal_Set := 16#00010000#;
452   Signal_17   : constant RTEMS.Signal_Set := 16#00020000#;
453   Signal_18   : constant RTEMS.Signal_Set := 16#00040000#;
454   Signal_19   : constant RTEMS.Signal_Set := 16#00080000#;
455   Signal_20   : constant RTEMS.Signal_Set := 16#00100000#;
456   Signal_21   : constant RTEMS.Signal_Set := 16#00200000#;
457   Signal_22   : constant RTEMS.Signal_Set := 16#00400000#;
458   Signal_23   : constant RTEMS.Signal_Set := 16#00800000#;
459   Signal_24   : constant RTEMS.Signal_Set := 16#01000000#;
460   Signal_25   : constant RTEMS.Signal_Set := 16#02000000#;
461   Signal_26   : constant RTEMS.Signal_Set := 16#04000000#;
462   Signal_27   : constant RTEMS.Signal_Set := 16#08000000#;
463   Signal_28   : constant RTEMS.Signal_Set := 16#10000000#;
464   Signal_29   : constant RTEMS.Signal_Set := 16#20000000#;
465   Signal_30   : constant RTEMS.Signal_Set := 16#40000000#;
466   Signal_31   : constant RTEMS.Signal_Set := 16#80000000#;
467
468   --
469   --  Utility Functions
470   --
471
472   function From_Ada_Boolean (
473      Ada_Boolean : Standard.Boolean
474   ) return RTEMS.Boolean;
475
476   function To_Ada_Boolean (
477      RTEMS_Boolean : RTEMS.Boolean
478   ) return Standard.Boolean;
479
480   function Milliseconds_To_Microseconds (
481      Milliseconds : RTEMS.Unsigned32
482   ) return RTEMS.Unsigned32;
483
484   function Microseconds_To_Ticks (
485      Microseconds : RTEMS.Unsigned32
486   ) return RTEMS.Interval;
487
488   function Milliseconds_To_Ticks (
489      Milliseconds : RTEMS.Unsigned32
490   ) return RTEMS.Interval;
491
492   procedure Name_To_Characters (
493      Name : in     RTEMS.Name;
494      C1   :    out Character;
495      C2   :    out Character;
496      C3   :    out Character;
497      C4   :    out Character
498   );
499
500   function Get_Node (
501      ID : in     RTEMS.ID
502   ) return RTEMS.Unsigned32;
503
504   function Get_Index (
505      ID : in     RTEMS.ID
506   ) return RTEMS.Unsigned32;
507
508   function Are_Statuses_Equal (
509      Status  : in     RTEMS.Status_Codes;
510      Desired : in     RTEMS.Status_Codes
511   ) return Standard.Boolean;
512
513   function Is_Status_Successful (
514      Status  : in     RTEMS.Status_Codes
515   ) return Standard.Boolean;
516
517   function Subtract (
518      Left   : in     RTEMS.Address;
519      Right  : in     RTEMS.Address
520   ) return RTEMS.Unsigned32;
521
522   function Are_Equal (
523      Left   : in     RTEMS.Address;
524      Right  : in     RTEMS.Address
525   ) return Standard.Boolean;
526
527   --
528   --  RTEMS API
529   --
530
531   function Build_Name (
532      C1 : in     Character;
533      C2 : in     Character;
534      C3 : in     Character;
535      C4 : in     Character
536   ) return RTEMS.Name;
537
538   --
539   --  Initialization Manager -- Shutdown Only
540   --
541   procedure Shutdown_Executive (
542      Status : in     RTEMS.Unsigned32
543   );
544
545end RTEMS;
546
Note: See TracBrowser for help on using the repository browser.