summaryrefslogtreecommitdiff
path: root/gcc/ada/s-osinte-vxworks.ads
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2005-09-05 07:49:24 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2005-09-05 07:49:24 +0000
commit8ffbc40148d6b02adac96d583313108c57e79936 (patch)
treea091e4233d93343ea43e47ffdbf8c63f0f990846 /gcc/ada/s-osinte-vxworks.ads
parent872263e868a7e9473a51782ee5dfbca6041763aa (diff)
downloadgcc-8ffbc40148d6b02adac96d583313108c57e79936.tar.gz
2005-09-01 Arnaud Charlet <charlet@adacore.com>
Jose Ruiz <ruiz@adacore.com> * s-taprop-vxworks.adb: Move with clauses outside Warnings Off now that dependent units are Preelaborate. (Initialize): Call Interrupt_Managemeent.Initialize to ensure proper initialization of this unit. (Specific): Add new procedures Initialize and Delete so that this package can be used for VxWorks 5.x and 6.x (ATCB_Key, ATCB_Key_Address): Moved to Specific package body to hide differences between VxWorks 5.x and 6.x Minor reformatting. (Timed_Delay): Remove calls to Defer/Undefer_Abort, now performed by caller. Use only Preelaborate-compatible constructs. * s-tpopsp-vxworks.adb (ATBC_Key, ATCB_Key_Addr): Moved from Primitives.Operations. (Delete, Initialize): New procedures. * s-osinte-vxworks.adb: Body used to handle differences between VxWorks 5.x and 6.x (kill, Set_Time_Slice, VX_FP_TASK): New functions. * s-osinte-vxworks.ads: Minor reformatting. Add VxWworks 6.x specific functions (only called from VxWorks 6 files). (VX_FP_TASK): Now a function, to handle differences between VxWorks 5 and 6. (Set_Time_Slice): New function, replacing kerneltimeSlice to share code between Vxworks 5 and 6. (taskLock, taskUnlock): Removeed, no longer used. * adaint.c: The wait.h header is not located in the sys directory on VxWorks when using RTPs. (__gnat_set_env_value): Use setenv instead of putenv on VxWorks when using RTPs. (__gnat_dup): dup is available on Vxworks when using RTPs. (__gnat_dup2): dup2 is available on Vxworks when using RTPs. * cal.c: Use the header time.h for Vxworks 6.0 when using RTPs. * expect.c: The wait.h header is not located in the sys directory on VxWorks when using RTPs. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@103852 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/s-osinte-vxworks.ads')
-rw-r--r--gcc/ada/s-osinte-vxworks.ads84
1 files changed, 46 insertions, 38 deletions
diff --git a/gcc/ada/s-osinte-vxworks.ads b/gcc/ada/s-osinte-vxworks.ads
index aa874b98a30..82b4bcee604 100644
--- a/gcc/ada/s-osinte-vxworks.ads
+++ b/gcc/ada/s-osinte-vxworks.ads
@@ -46,11 +46,11 @@ with System.VxWorks;
package System.OS_Interface is
pragma Preelaborate;
- subtype int is Interfaces.C.int;
- subtype short is Short_Integer;
- type long is new Long_Integer;
- type unsigned_long is mod 2 ** long'Size;
- type size_t is mod 2 ** Standard'Address_Size;
+ subtype int is Interfaces.C.int;
+ subtype short is Short_Integer;
+ type long is new Long_Integer;
+ type unsigned_long is mod 2 ** long'Size;
+ type size_t is mod 2 ** Standard'Address_Size;
-----------
-- Errno --
@@ -153,12 +153,11 @@ package System.OS_Interface is
subtype Thread_Id is t_id;
function kill (pid : t_id; sig : Signal) return int;
- pragma Import (C, kill, "kill");
+ pragma Inline (kill);
- -- VxWorks doesn't have getpid; taskIdSelf is the equivalent
- -- routine.
function getpid return t_id;
pragma Import (C, getpid, "taskIdSelf");
+ -- VxWorks doesn't have getpid; taskIdSelf is the equivalent routine.
----------
-- Time --
@@ -183,7 +182,7 @@ package System.OS_Interface is
pragma Inline (To_Timespec);
function To_Clock_Ticks (D : Duration) return int;
- -- Convert a duration value (in seconds) into clock ticks.
+ -- Convert a duration value (in seconds) into clock ticks
function clock_gettime
(clock_id : clockid_t; tp : access timespec) return int;
@@ -230,6 +229,15 @@ package System.OS_Interface is
function taskIsSuspended (tid : t_id) return int;
pragma Import (C, taskIsSuspended, "taskIsSuspended");
+ function taskDelay (ticks : int) return int;
+ procedure taskDelay (ticks : int);
+ pragma Import (C, taskDelay, "taskDelay");
+
+ function sysClkRateGet return int;
+ pragma Import (C, sysClkRateGet, "sysClkRateGet");
+
+ -- VxWorks 5.x specific functions
+
function taskVarAdd
(tid : t_id; pVar : access System.Address) return int;
pragma Import (C, taskVarAdd, "taskVarAdd");
@@ -249,20 +257,26 @@ package System.OS_Interface is
pVar : access System.Address) return int;
pragma Import (C, taskVarGet, "taskVarGet");
- function taskDelay (ticks : int) return int;
- procedure taskDelay (ticks : int);
- pragma Import (C, taskDelay, "taskDelay");
+ -- VxWorks 6.x specific functions
- function sysClkRateGet return int;
- pragma Import (C, sysClkRateGet, "sysClkRateGet");
+ function tlsKeyCreate return int;
+ pragma Import (C, tlsKeyCreate, "tlsKeyCreate");
+
+ function tlsValueGet (key : int) return System.Address;
+ pragma Import (C, tlsValueGet, "tlsValueGet");
+
+ function tlsValueSet (key : int; value : System.Address) return STATUS;
+ pragma Import (C, tlsValueSet, "tlsValueSet");
-- Option flags for taskSpawn
VX_UNBREAKABLE : constant := 16#0002#;
- VX_FP_TASK : constant := 16#0008#;
VX_FP_PRIVATE_ENV : constant := 16#0080#;
VX_NO_STACK_FILL : constant := 16#0100#;
+ function VX_FP_TASK return int;
+ pragma Inline (VX_FP_TASK);
+
function taskSpawn
(name : System.Address; -- Pointer to task name
priority : int;
@@ -284,8 +298,10 @@ package System.OS_Interface is
procedure taskDelete (tid : t_id);
pragma Import (C, taskDelete, "taskDelete");
- function kernelTimeSlice (ticks : int) return int;
- pragma Import (C, kernelTimeSlice, "kernelTimeSlice");
+ function Set_Time_Slice (ticks : int) return int;
+ pragma Inline (Set_Time_Slice);
+ -- Calls kernelTimeSlice under VxWorks 5.x
+ -- Do nothing under VxWorks 6.x
function taskPriorityGet (tid : t_id; pPriority : access int) return int;
pragma Import (C, taskPriorityGet, "taskPriorityGet");
@@ -293,7 +309,7 @@ package System.OS_Interface is
function taskPrioritySet (tid : t_id; newPriority : int) return int;
pragma Import (C, taskPrioritySet, "taskPrioritySet");
- -- Semaphore creation flags.
+ -- Semaphore creation flags
SEM_Q_FIFO : constant := 0;
SEM_Q_PRIORITY : constant := 1;
@@ -305,17 +321,16 @@ package System.OS_Interface is
SEM_EMPTY : constant := 0;
SEM_FULL : constant := 1;
- -- Semaphore take (semTake) time constants.
+ -- Semaphore take (semTake) time constants
WAIT_FOREVER : constant := -1;
NO_WAIT : constant := 0;
- -- Error codes (errno). The lower level 16 bits are the
- -- error code, with the upper 16 bits representing the
- -- module number in which the error occurred. By convention,
- -- the module number is 0 for UNIX errors. VxWorks reserves
- -- module numbers 1-500, with the remaining module numbers
- -- being available for user applications.
+ -- Error codes (errno). The lower level 16 bits are the error code, with
+ -- the upper 16 bits representing the module number in which the error
+ -- occurred. By convention, the module number is 0 for UNIX errors. VxWorks
+ -- reserves module numbers 1-500, with the remaining module numbers being
+ -- available for user applications.
M_objLib : constant := 61 * 2**16;
-- semTake() failure with ticks = NO_WAIT
@@ -326,39 +341,32 @@ package System.OS_Interface is
type SEM_ID is new System.Address;
-- typedef struct semaphore *SEM_ID;
- -- We use two different kinds of VxWorks semaphores: mutex
- -- and binary semaphores. A null ID is returned when
- -- a semaphore cannot be created.
+ -- We use two different kinds of VxWorks semaphores: mutex and binary
+ -- semaphores. A null ID is returned when a semaphore cannot be created.
function semBCreate (options : int; initial_state : int) return SEM_ID;
+ pragma Import (C, semBCreate, "semBCreate");
-- Create a binary semaphore. Return ID, or 0 if memory could not
-- be allocated.
- pragma Import (C, semBCreate, "semBCreate");
function semMCreate (options : int) return SEM_ID;
pragma Import (C, semMCreate, "semMCreate");
function semDelete (Sem : SEM_ID) return int;
- -- Delete a semaphore
pragma Import (C, semDelete, "semDelete");
+ -- Delete a semaphore
function semGive (Sem : SEM_ID) return int;
pragma Import (C, semGive, "semGive");
function semTake (Sem : SEM_ID; timeout : int) return int;
+ pragma Import (C, semTake, "semTake");
-- Attempt to take binary semaphore. Error is returned if operation
-- times out
- pragma Import (C, semTake, "semTake");
function semFlush (SemID : SEM_ID) return STATUS;
- -- Release all threads blocked on the semaphore
pragma Import (C, semFlush, "semFlush");
-
- function taskLock return int;
- pragma Import (C, taskLock, "taskLock");
-
- function taskUnlock return int;
- pragma Import (C, taskUnlock, "taskUnlock");
+ -- Release all threads blocked on the semaphore
private
type sigset_t is new long;