00001
00047 #ifdef __vxworks
00048
00049 #include <vxWorks.h>
00050 #include <semLib.h>
00051
00052 #elif defined(__linux)
00053 #include <linux/types.h>
00054 #include <asm/semaphore.h>
00055 #else
00056
00057 #include <pthread.h>
00058
00059 #endif
00060
00061 #include "IxTypes.h"
00062
00063 #ifndef IxOsServices_H
00064
00065 #ifndef __doxygen_hide
00066 #define IxOsServices_H
00067 #endif
00068
00092 #if CPU!=SIMSPARCSOLARIS
00093 #define IXP425_USE_FAST_MUTEX
00094 #endif
00095
00100 typedef int IX_IRQ_STATUS;
00101
00105 #ifdef __vxworks
00106
00107 typedef SEM_ID IxMutex;
00108
00109 #elif defined(__linux)
00110 typedef struct semaphore *IxMutex;
00111 #else
00112
00113 typedef pthread_mutex_t IxMutex;
00114
00115 #endif
00116
00120 #ifdef __vxworks
00121
00122 #if CPU==SIMSPARCSOLARIS
00123
00124 typedef SEM_ID IxFastMutex;
00125
00126 #else
00127
00128 typedef int IxFastMutex;
00129
00130 #endif
00131
00132 #elif defined(__linux)
00133 #ifdef IXP425_USE_FAST_MUTEX
00134 typedef int IxFastMutex;
00135 #else
00136 typedef struct semaphore *IxFastMutex;
00137 #endif
00138 #else
00139
00140 typedef pthread_mutex_t IxFastMutex;
00141
00142 #endif
00143
00147 typedef enum
00148 {
00149 LOG_NONE = 0,
00151 LOG_USER = 1,
00152 LOG_FATAL = 2,
00153 LOG_ERROR = 3,
00154 LOG_WARNING = 4,
00155 LOG_MESSAGE = 5,
00156 LOG_DEBUG1 = 6,
00157 LOG_DEBUG2 = 7,
00158 LOG_DEBUG3 = 8,
00160 LOG_ALL
00161 } IxOsServTraceLevels;
00162
00181 PUBLIC IX_STATUS
00182 ixOsServIntBind(int level, void (*routine)(void *), void *parameter);
00183
00200 PUBLIC IX_STATUS
00201 ixOsServIntUnbind(int level);
00202
00203
00204
00222 PUBLIC int
00223 ixOsServIntLock(void);
00224
00238 PUBLIC void
00239 ixOsServIntUnlock(int lockKey);
00240
00261 PUBLIC int
00262 ixOsServIntLevelSet(int level);
00263
00279 PUBLIC IX_STATUS
00280 ixOsServMutexInit(IxMutex *mutex);
00281
00304 PUBLIC IX_STATUS
00305 ixOsServMutexLock(IxMutex *mutex);
00306
00323 PUBLIC IX_STATUS
00324 ixOsServMutexUnlock(IxMutex *mutex);
00325
00339 PUBLIC IX_STATUS
00340 ixOsServMutexDestroy(IxMutex *mutex);
00341
00357 PUBLIC IX_STATUS
00358 ixOsServFastMutexInit(IxFastMutex *mutex);
00359
00378 PUBLIC IX_STATUS
00379 ixOsServFastMutexTryLock(IxFastMutex *mutex);
00380
00397 PUBLIC IX_STATUS
00398 ixOsServFastMutexUnlock(IxFastMutex *mutex);
00399
00425 PUBLIC int
00426 ixOsServLog(int level, char *format, int arg1, int arg2, int arg3, int arg4, int arg5, int arg6);
00427
00448 PUBLIC int
00449 ixOsServLogLevelSet(int level);
00450
00464 PUBLIC void
00465 ixOsServSleep(int microseconds);
00466
00481 PUBLIC void
00482 ixOsServTaskSleep(int milliseconds);
00483
00495 PUBLIC unsigned int
00496 ixOsServTimestampGet(void);
00497
00509 PUBLIC void
00510 ixOsServUnload(void);
00511
00523 PUBLIC void
00524 ixOsServYield(void);
00525
00530 #endif