Main Page   Modules   Alphabetical List   Data Structures   File List   Data Fields   Globals  

os_datatypes.h

00001 
00070 #ifndef _OS_DATATYPES_H
00071 #define _OS_DATATYPES_H
00072 
00073 #ifdef __vxworks
00074 
00075 #include "time.h"
00076 #include "vxWorks.h"
00077 #include "semaphore.h"
00078 
00079 typedef unsigned int os_thread_t;
00080 typedef unsigned int os_sem_t;
00081 typedef unsigned int os_mutex_t;
00082 
00083 
00084 
00085 typedef struct os_s_timespec_t
00086     {                   /* interval = sec*10**9 + nsec */
00087     time_t  sec;            /* seconds */
00088     long    nsec;           /* nanoseconds (0 - 1,000,000,000) */
00089     }timespec_t;
00090 
00091 
00092 typedef enum os_e_thread_priority{
00093   OS_THREAD_PRI_LOW = 240,
00094   OS_THREAD_PRI_MEDIUM = 160,
00095   OS_THREAD_PRI_HIGH = 90
00096 } os_thread_priority;
00097 
00098 
00105 typedef enum  os_e_sem_state
00106 {
00107     OS_SEM_UNVAILABLE =SEM_EMPTY,
00108     OS_SEM_AVAILABLE =SEM_FULL
00109 } os_sem_state;
00110 
00111     
00118 typedef enum os_e_mutex_state
00119 {
00120     OS_MUTEX_UNLOCK = FALSE ,
00121     OS_MUTEX_LOCK   = TRUE
00122 } os_mutex_state;
00123 
00124 typedef enum os_e_error_codes{
00125 
00126     OS_FAILURE = 1 ,            /* os call failed */ 
00127     OS_RESOURCE_SHORTAGE ,      /* EAGAIN: The system lacked the necessary
00128                                                resources to */
00129     OS_INVALID_ATTR ,           /* EINVAL: The value specified by the attribute is 
00130                                          not valid */ 
00131     OS_INVALID_PRIVLG ,         /* EPERM: The caller does not have the appropriate
00132                                              permission to set the required parameters */
00133     OS_RESOURCE_DEADLOCK ,      /* EDEADLK: */
00134     OS_INVALID_THREADID ,       /* ESRCH:  */
00135     OS_NOMEM ,                  /* ENOMEM: */
00136     OS_RESOURCE_BUSY ,          /* EBUSY:  Device or Resource Busy */
00137     OS_NOSYS,                   /* ENOSYS: */
00138     OS_TIMEDOUT ,               /* ETIMEDOUT: */
00139     OS_INVALID_MUTEX,           /* EINVAL : Invalid Mutex */
00140     OS_SEMA_NOSPC ,             /* ENOSPC */
00141     OS_ERR_INTR  =  14,         /* EINTR */
00142     OS_INVALID_OPERATION = 15,
00143     OS_INVALID_ADDR = 16        /* EFAULT */
00144 } os_error_code;
00145 
00146 typedef struct os_s_error{
00147   os_error_code  errnum;
00148   char errname   [25];
00149 } os_error;
00150 
00151 
00152 
00153 #define OS_WAIT_FOREVER WAIT_FOREVER
00154 #define OS_WAIT_NONE    NO_WAIT 
00155 
00156 #elif __linux
00157 
00158 #include <linux/types.h>
00159 #include <asm/semaphore.h>
00160 
00161 #define OS_WAIT_FOREVER     (-1UL)
00162 #define OS_WAIT_NONE        0
00163 
00164 typedef enum os_e_mutex_state {
00165      OS_MUTEX_UNLOCK = 0,
00166      OS_MUTEX_LOCK = 1
00167 } os_mutex_state;
00168  
00169 typedef enum os_e_sem_state {
00170      OS_SEM_UNVAILABLE = 0,
00171      OS_SEM_AVAILABLE = 1
00172  } os_sem_state;
00173 
00174 typedef enum os_e_thread_priority {
00175      OS_THREAD_PRI_HIGH = 90,
00176      OS_THREAD_PRI_MEDIUM = 160,
00177      OS_THREAD_PRI_LOW = 240 
00178 } os_thread_priority;
00179 
00180 
00181 typedef unsigned int os_thread_t;
00182 typedef struct semaphore *os_sem_t;
00183 typedef struct semaphore *os_mutex_t;
00184 
00185 typedef enum os_e_error_codes{
00186 
00187     OS_FAILURE = 1 ,            /* os call failed */
00188    OS_RESOURCE_SHORTAGE ,      /* EAGAIN: The system lacked the necessary
00189                                                                resources to */
00190     OS_INVALID_ATTR ,           /* EINVAL: The value specified by the attribute is
00191                                                  not valid */
00192     OS_INVALID_PRIVLG ,         /* EPERM: The caller does not have the appropriate
00193                                                          permission to set the required parameters */
00194     OS_RESOURCE_DEADLOCK ,      /* EDEADLK: */
00195     OS_INVALID_THREADID ,       /* ESRCH:  */
00196     OS_NOMEM ,                  /* ENOMEM: */
00197     OS_RESOURCE_BUSY ,          /* EBUSY:  Device or Resource Busy */
00198     OS_NOSYS,                   /* ENOSYS: */
00199     OS_TIMEDOUT ,               /* ETIMEDOUT: */
00200     OS_INVALID_MUTEX,           /* EINVAL : Invalid Mutex */
00201     OS_SEMA_NOSPC ,             /* ENOSPC */
00202     OS_ERR_INTR  =  14,         /* EINTR */
00203     OS_INVALID_OPERATION = 15,
00204     OS_INVALID_ADDR = 16        /* EFAULT */
00205 } os_error_code;
00206 
00207 typedef struct os_s_error{
00208   os_error_code  errnum;
00209   char errname   [25];
00210 } os_error;
00211 
00212 #endif /*__vworks*/
00213 
00214 #endif /* _OS_DATATYPES_H */
00215 
Automatically generated from sources. © Intel Corp. 2003