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

ix_ossl.h

00001 
00143 #ifndef _IX_OSSL_H
00144 #ifndef __doxygen_hide
00145 #define _IX_OSSL_H
00146 #endif /* __doxygen_hide */
00147 
00148 #ifdef __cplusplus
00149 extern "C"{
00150 #endif
00151 
00152 /* Header file includes */
00153 #ifdef __vxworks
00154 #include <private/timerLibP.h> /* needed for IX_OSSL_TIME_* macros */
00155 #endif
00156 
00157 #include "ix_os_type.h"
00158 #include "ix_types.h"
00159 #include "ix_error.h"
00160 #include "ix_symbols.h"
00161 #include "os_datatypes.h"
00162 
00163 /* Following header file is required for transactor/workbench OSAPI functions */
00164 /* #include "os_api.h"*/ 
00165 
00193 /* OSSL Data Structures */
00194 
00201 typedef os_thread_t         ix_ossl_thread_t; 
00202 
00209 typedef os_sem_t            ix_ossl_sem_t;
00210 
00217 typedef os_mutex_t  ix_ossl_mutex_t;
00218 
00226 typedef struct
00227 {
00228     unsigned long tv_sec; 
00229     unsigned long tv_nsec; 
00230 } ix_ossl_time_t;
00231 
00232 
00233 
00234 
00235 /* OSSL function types */
00236 
00249 typedef ix_error (*ix_ossl_thread_entry_point_t)(
00250                                                   void* arg, 
00251                                                   void** ptrRetObj
00252                                                 );
00253 
00264 typedef struct
00265 {
00266     ix_ossl_thread_entry_point_t threadMain; 
00267     void* threadArg;     
00268 } ix_ossl_thread_main_info_t;
00269 
00270 
00271 /* Enumerations are defined here */
00272 
00279 typedef enum
00280 {
00281     IX_OSSL_ERROR_SUCCESS =  0, 
00282     IX_OSSL_ERROR_INVALID_ARGUMENTS = OS_INVALID_ATTR, 
00283     IX_OSSL_ERROR_INVALID_OPERATION,            
00284     IX_OSSL_ERROR_THREAD_CALL_FAILURE,          
00285     IX_OSSL_ERROR_INVALID_PID,                  
00286     IX_OSSL_ERROR_INVALID_TID,                  
00287     IX_OSSL_ERROR_OS_CALL_FAILURE = OS_FAILURE, 
00288     IX_OSSL_ERROR_TIMEOUT = OS_TIMEDOUT,        
00289     IX_OSSL_ERROR_NOMEM = OS_NOMEM,             
00290     IX_OSSL_ERROR_NOSYS = OS_NOSYS              
00291 } ix_ossl_error_code;
00292 
00293 
00300 typedef enum
00301 {
00302     IX_OSSL_SEM_UNAVAILABLE = OS_SEM_UNVAILABLE,  
00303     IX_OSSL_SEM_AVAILABLE = OS_SEM_AVAILABLE      
00304 } ix_ossl_sem_state;
00305 
00306 
00307 
00314 typedef enum
00315 {
00316     IX_OSSL_MUTEX_UNLOCK = OS_MUTEX_UNLOCK,    
00317     IX_OSSL_MUTEX_LOCK = OS_MUTEX_LOCK         
00318 } ix_ossl_mutex_state;
00319 
00320 
00327 typedef enum
00328 {
00329     IX_OSSL_THREAD_PRI_HIGH = OS_THREAD_PRI_HIGH,     
00330     IX_OSSL_THREAD_PRI_MEDIUM = OS_THREAD_PRI_MEDIUM, 
00331     IX_OSSL_THREAD_PRI_LOW = OS_THREAD_PRI_LOW        
00332 } ix_ossl_thread_priority;
00333 
00334 
00335 /* Pre-processor Symbols */
00336 
00344 #define IX_OSSL_ERROR_SUCCESS     (ix_error)0UL 
00345 
00353 #if defined __linux
00354 #define IX_OSSL_ERROR_FAILURE     (ix_error)1
00355 #endif
00356 
00357 
00365 #define IX_OSSL_WAIT_FOREVER    OS_WAIT_FOREVER /* (-1)UL */
00366 
00374 #define IX_OSSL_WAIT_NONE       OS_WAIT_NONE     /* 0 */
00375 
00398 #define BILLION         1000000000
00399 
00400 
00406 #ifdef __linux
00407 #define TICKS_PER_NSEC  (BILLION/HZ)
00408 #endif
00409 
00410 
00422 #define IX_OSSL_TIME_EQ(a,b) \
00423         ((a).tv_sec == (b).tv_sec && (a).tv_nsec == (b).tv_nsec)
00424 
00437 #define IX_OSSL_TIME_GT(a,b)  \
00438         ((a).tv_sec  > (b).tv_sec ||    \
00439         ((a).tv_sec == (b).tv_sec && (a).tv_nsec > (b).tv_nsec))
00440 
00452 #define IX_OSSL_TIME_LT(a,b) \
00453         ((a).tv_sec  < (b).tv_sec ||    \
00454         ((a).tv_sec == (b).tv_sec && (a).tv_nsec < (b).tv_nsec))
00455 
00467 #define IX_OSSL_TIME_ISZERO(a) \
00468         ((a).tv_sec == 0 && (a).tv_nsec == 0)
00469 
00479 #define IX_OSSL_TIME_SET(a,b) \
00480         (a).tv_sec = (b).tv_sec; (a).tv_nsec = (b).tv_nsec
00481 
00491 #define IX_OSSL_TIME_ADD(a,b)       \
00492         (a).tv_sec += (b).tv_sec;   \
00493         (a).tv_nsec += (b).tv_nsec; \
00494         if ((a).tv_nsec >= BILLION) \
00495     { \
00496         (a).tv_sec++; \
00497         (a).tv_nsec -= BILLION; }
00498 
00508 #define IX_OSSL_TIME_SUB(a,b)           \
00509         if ((a).tv_nsec >= (b).tv_nsec) \
00510         { \
00511           (a).tv_sec -= (b).tv_sec; \
00512           (a).tv_nsec -= (b).tv_nsec; \
00513         } \
00514         else \
00515         { \
00516           (a).tv_sec -= ((b).tv_sec + 1); \
00517           (a).tv_nsec += BILLION - (b).tv_nsec; \
00518         }
00519 
00529 #define IX_OSSL_TIME_NORMALIZE(a)   \
00530         if ((a).tv_nsec >= BILLION) \
00531         { (a).tv_sec++; (a).tv_nsec -= BILLION; }   \
00532     else if ((a).tv_nsec < 0)   \
00533         { (a).tv_sec--; (a).tv_nsec += BILLION; }
00534 
00547 #define IX_OSSL_TIME_VALID(a) \
00548         ((a).tv_nsec >= 0 && (a).tv_nsec < BILLION)
00549     
00550 
00559 #define IX_OSSL_TIME_ZERO(a)    \
00560         (a).tv_sec = 0; (a).tv_nsec = 0
00561 
00572 #ifdef __linux
00573 #define IX_OSSL_TIME_CONVERT_TO_TICK(a,b)   \
00574               (a) = (b).tv_sec * HZ + \
00575           (b).tv_nsec / TICKS_PER_NSEC + \
00576           (((b).tv_nsec % TICKS_PER_NSEC > (TICKS_PER_NSEC/2)) ? 1 : 0)
00577 #else
00578 #define IX_OSSL_TIME_CONVERT_TO_TICK(a,b)   \
00579               TV_CONVERT_TO_TICK(a,b)
00580 #endif
00581 
00582 
00583 
00584 /*  OSSL  functions */
00585 
00605 IX_EXPORT_FUNCTION 
00606 ix_error ix_ossl_thread_create(
00607                                 ix_ossl_thread_entry_point_t entryPoint,
00608                                 void* arg,
00609                                 ix_ossl_thread_t* ptrTid
00610                               );
00611 
00622 IX_EXPORT_FUNCTION
00623 ix_error ix_ossl_thread_get_id(ix_ossl_thread_t* ptrTid);
00624 
00625 
00643 IX_EXPORT_FUNCTION
00644 void* ix_ossl_thread_main_wrapper(void* ptrThreadInfo);
00645 
00646 
00665 IX_EXPORT_FUNCTION
00666 void ix_ossl_thread_exit(ix_error retError, void* retObj);
00667 
00686 IX_EXPORT_FUNCTION 
00687 ix_error ix_ossl_thread_kill(ix_ossl_thread_t tid);
00688 
00689 
00690 
00706 IX_EXPORT_FUNCTION
00707 ix_error ix_ossl_thread_set_priority(
00708                                      ix_ossl_thread_t tid,
00709                                      ix_ossl_thread_priority priority
00710                                     );
00711 
00712 
00725 IX_EXPORT_FUNCTION
00726 ix_error ix_ossl_thread_delay(
00727                               int ticks
00728                  );
00729 
00730 
00751 IX_EXPORT_FUNCTION
00752 int  os_thread_create(
00753                       void * (*start_routine)(void *),
00754                       ix_ossl_thread_main_info_t *ptrThreadInfo,
00755                       ix_ossl_thread_t* ptrTid,
00756                       os_error* osError
00757                      );
00758 
00759 
00769 IX_EXPORT_FUNCTION
00770 int os_thread_get_id(ix_ossl_thread_t* ptrTid);
00771 
00772 
00785 IX_EXPORT_FUNCTION
00786 int os_thread_exit(void* ptrRetObj);
00787 
00788 
00799 IX_EXPORT_FUNCTION
00800 int  os_thread_kill(ix_ossl_thread_t tid, os_error* osError);
00801 
00802 
00817 IX_EXPORT_FUNCTION
00818 ix_error os_thread_set_priority(
00819                                 ix_ossl_thread_t* tid,
00820                                 ix_ossl_thread_priority priority,
00821                                 os_error* osError
00822                                );
00823 
00824 
00834 IX_EXPORT_FUNCTION
00835 ix_error ix_ossl_tick_get(
00836               int *pticks
00837               );
00838 
00839 
00850 IX_EXPORT_FUNCTION
00851 int os_sleep(ix_uint32 sleeptime_ms, os_error* osError);
00852 
00853 
00865 IX_EXPORT_FUNCTION
00866 int os_sleep_tick(ix_uint32 sleeptime_ticks, os_error *osError);
00867 
00868 
00882 IX_EXPORT_FUNCTION
00883 int os_time_get(ix_ossl_time_t *ptime, os_error *osError);
00884 
00885 
00902 IX_EXPORT_FUNCTION 
00903 ix_error ix_ossl_sem_init(int start_value, ix_ossl_sem_t* sid);
00904 
00923 IX_EXPORT_FUNCTION 
00924 ix_error ix_ossl_sem_take(
00925                           ix_ossl_sem_t sid,
00926                           ix_uint32 timeout
00927                          );
00928 
00940 IX_EXPORT_FUNCTION 
00941 ix_error ix_ossl_sem_give(ix_ossl_sem_t sid);
00942 
00943 
00959 IX_EXPORT_FUNCTION 
00960 ix_error ix_ossl_sem_flush(ix_ossl_sem_t sid, int* result);
00961 
00962 
00975 IX_EXPORT_FUNCTION
00976 ix_error ix_ossl_sem_fini(ix_ossl_sem_t sid);
00977 
00978 
00990 IX_EXPORT_FUNCTION
00991 int  os_thread_sema_create(
00992                            int value,
00993                            ix_ossl_sem_t* sid,
00994                            os_error* osError
00995                           );
00996 
00997 
01009 IX_EXPORT_FUNCTION
01010 int  os_thread_sema_P(
01011                       ix_ossl_sem_t* sid,
01012                       ix_uint32 timeout,
01013                       os_error* osError
01014                      );
01015 
01016 
01027 IX_EXPORT_FUNCTION
01028 int  os_thread_sema_V(ix_ossl_sem_t* sid, os_error* osError);
01029 
01030 
01040 IX_EXPORT_FUNCTION
01041 int  os_thread_sema_destroy(ix_ossl_sem_t* sid, os_error* osError);
01042 
01043 
01063 IX_EXPORT_FUNCTION 
01064 ix_error ix_ossl_mutex_init(ix_ossl_mutex_state start_state, ix_ossl_mutex_t* mid);
01065 
01066 
01084 IX_EXPORT_FUNCTION 
01085 ix_error ix_ossl_mutex_lock(
01086                             ix_ossl_mutex_t mid, 
01087                             ix_uint32 timeout
01088                            );
01089 
01090 
01103 IX_EXPORT_FUNCTION 
01104 ix_error ix_ossl_mutex_unlock(ix_ossl_mutex_t mid);
01105 
01106 
01118 IX_EXPORT_FUNCTION
01119 ix_error ix_ossl_mutex_fini(ix_ossl_mutex_t mid);
01120 
01121 
01137 IX_EXPORT_FUNCTION
01138 int  os_thread_mutex_create(
01139                             ix_ossl_mutex_state start_state,
01140                             ix_ossl_mutex_t* mid,
01141                             os_error* osError
01142                            );
01143 
01144 
01161 IX_EXPORT_FUNCTION
01162 int  os_thread_mutex_lock(
01163                           ix_ossl_mutex_t* mutex,
01164                           ix_uint32 timeout,
01165                           os_error* osError
01166                          );
01167 
01168 
01183 IX_EXPORT_FUNCTION
01184 int  os_thread_mutex_unlock(ix_ossl_mutex_t* mutex, os_error* osError);
01185 
01186 
01198 IX_EXPORT_FUNCTION
01199 int  os_thread_mutex_destroy(ix_ossl_mutex_t* mutex, os_error* osError);
01200 
01201 
01217 ix_error ix_ossl_sleep(ix_uint32 sleeptime_ms);
01218 
01219 
01230 IX_EXPORT_FUNCTION 
01231 ix_error ix_ossl_sleep_tick(ix_uint32 sleeptime_ticks);
01232 
01233 
01248 IX_EXPORT_FUNCTION 
01249 ix_error ix_ossl_time_get(ix_ossl_time_t*  ptime);
01250 
01251 
01252 
01264 typedef unsigned int ix_ossl_size_t;
01265 
01266 
01267 
01286 IX_EXPORT_FUNCTION 
01287 void* ix_ossl_malloc(
01288                       ix_ossl_size_t arg_Size
01289                     );
01290 
01291 
01292 
01293 
01308 IX_EXPORT_FUNCTION 
01309 void ix_ossl_free(
01310                    void* arg_pMemory
01311                  );
01312 
01313 
01314 
01315 
01330 IX_EXPORT_FUNCTION 
01331 void* ix_ossl_memcpy(
01332                       void* arg_pDest, 
01333                       const void* arg_pSrc,
01334                       ix_ossl_size_t arg_Count 
01335                     );
01336 
01337 
01338 
01352 IX_EXPORT_FUNCTION 
01353 void* ix_ossl_memset(
01354                       void* arg_pDest, 
01355                       int arg_pChar,
01356                       ix_ossl_size_t arg_Count 
01357                     );
01358 
01359 
01360 
01377 IX_EXPORT_FUNCTION 
01378 ix_error ix_ossl_message_log_init(void);
01379 
01380 
01395 IX_EXPORT_FUNCTION 
01396 ix_error ix_ossl_message_log(
01397                               char* arg_pFmtString, 
01398                               ...
01399                             );
01400 
01401 
01402 #ifdef __cplusplus
01403 }
01404 #endif
01405  
01406 #endif /* _IX_OSSL_H */
01407 
Automatically generated from sources. © Intel Corp. 2003