2 * This file is intended to provide backward
3 * compatibility for main osService/OSSL
6 * It shall be phased out gradually and users
7 * are strongly recommended to use IX_OSAL API.
10 * IXP400 SW Release version 2.0
12 * -- Copyright Notice --
15 * Copyright 2001-2005, Intel Corporation.
16 * All rights reserved.
19 * Redistribution and use in source and binary forms, with or without
20 * modification, are permitted provided that the following conditions
22 * 1. Redistributions of source code must retain the above copyright
23 * notice, this list of conditions and the following disclaimer.
24 * 2. Redistributions in binary form must reproduce the above copyright
25 * notice, this list of conditions and the following disclaimer in the
26 * documentation and/or other materials provided with the distribution.
27 * 3. Neither the name of the Intel Corporation nor the names of its contributors
28 * may be used to endorse or promote products derived from this software
29 * without specific prior written permission.
32 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
33 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
34 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
35 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
36 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
37 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
38 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
39 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
40 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
41 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
45 * -- End of Copyright Notice --
48 #ifndef IX_OSAL_BACKWARD_OSSL_H
49 #define IX_OSAL_BACKWARD_OSSL_H
52 typedef IxOsalThread ix_ossl_thread_t
;
54 typedef IxOsalSemaphore ix_ossl_sem_t
;
56 typedef IxOsalMutex ix_ossl_mutex_t
;
58 typedef IxOsalTimeval ix_ossl_time_t
;
61 /* Map sub-fields for ix_ossl_time_t */
66 typedef IX_STATUS ix_error
;
68 typedef UINT32 ix_ossl_thread_priority
;
70 typedef UINT32 ix_uint32
;
73 #define IX_OSSL_ERROR_SUCCESS IX_SUCCESS
75 #define IX_ERROR_SUCCESS IX_SUCCESS
80 IX_OSSL_SEM_UNAVAILABLE
= 0,
87 IX_OSSL_MUTEX_UNLOCK
= 0,
89 } ix_ossl_mutex_state
;
92 typedef IxOsalVoidFnVoidPtr ix_ossl_thread_entry_point_t
;
95 #define IX_OSSL_THREAD_PRI_HIGH 90
96 #define IX_OSSL_THREAD_PRI_MEDIUM 160
97 #define IX_OSSL_THREAD_PRI_LOW 240
100 #define IX_OSSL_WAIT_FOREVER IX_OSAL_WAIT_FOREVER
102 #define IX_OSSL_WAIT_NONE IX_OSAL_WAIT_NONE
104 #define BILLION IX_OSAL_BILLION
106 #define IX_OSSL_TIME_EQ(a,b) IX_OSAL_TIME_EQ(a,b)
108 #define IX_OSSL_TIME_GT(a,b) IX_OSAL_TIME_GT(a,b)
110 #define IX_OSSL_TIME_LT(a,b) IX_OSAL_TIME_LT(a,b)
112 #define IX_OSSL_TIME_ADD(a,b) IX_OSAL_TIME_ADD(a,b)
114 #define IX_OSSL_TIME_SUB(a,b) IX_OSAL_TIME_SUB(a,b)
117 /* a is tick, b is timeval */
118 #define IX_OSSL_TIME_CONVERT_TO_TICK(a,b) \
119 (a) = IX_OSAL_TIMEVAL_TO_TICKS(b)
125 ixOsalOsIxp400BackwardOsslThreadCreate (IxOsalVoidFnVoidPtr entryPoint
,
126 void *arg
, IxOsalThread
* ptrThread
);
128 #define ix_ossl_thread_create(entryPoint, arg, ptrTid) \
129 ixOsalOsIxp400BackwardOsslThreadCreate(entryPoint, arg, ptrTid)
132 /* void ix_ossl_thread_exit(ix_error retError, void* retObj) */
133 #define ix_ossl_thread_exit(retError, retObj) \
137 PUBLIC IX_STATUS
ixOsalOsIxp400BackwardOsslThreadKill (IxOsalThread tid
);
139 /* ix_error ix_ossl_thread_kill(tid) */
140 #define ix_ossl_thread_kill(tid) \
141 ixOsalOsIxp400BackwardOsslThreadKill(tid)
145 ixOsalOsIxp400BackwardOsslThreadSetPriority (IxOsalThread tid
,
150 * ix_error ix_ossl_thread_set_priority(ix_ossl_thread_t tid,
151 * ix_ossl_thread_priority priority
155 #define ix_ossl_thread_set_priority(tid, priority) \
156 ixOsalOsIxp400BackwardOsslThreadSetPriority(tid, priority)
159 PUBLIC IX_STATUS
ixOsalOsIxp400BackwardOsslTickGet (int *pticks
);
161 #define ix_ossl_tick_get(pticks) \
162 ixOsalOsIxp400BackwardOsslTickGet(pticks)
164 PUBLIC IX_STATUS
ixOsalOsIxp400BackwardOsslThreadDelay (int ticks
);
166 #define ix_ossl_thread_delay(ticks) ixOsalOsIxp400BackwardOsslThreadDelay(ticks)
170 /* ix_error ix_ossl_sem_init(int start_value, ix_ossl_sem_t* sid); */
171 /* Note sid is a pointer to semaphore */
172 #define ix_ossl_sem_init(value, sid) \
173 ixOsalSemaphoreInit(sid, value)
177 ixOsalOsIxp400BackwardOsslSemaphoreWait (IxOsalSemaphore semaphore
,
182 ix_error ix_ossl_sem_take(
188 #define ix_ossl_sem_take( sid, timeout) \
189 ixOsalOsIxp400BackwardOsslSemaphoreWait(sid, timeout)
194 ixOsalOsIxp400BackwardOsslSemaphorePost (IxOsalSemaphore sid
);
196 /*ix_error ix_ossl_sem_give(ix_ossl_sem_t sid); */
197 #define ix_ossl_sem_give(sid) \
198 ixOsalOsIxp400BackwardOsslSemaphorePost(sid);
201 PUBLIC IX_STATUS
ixOsalOsIxp400BackwardSemaphoreDestroy (IxOsalSemaphore sid
);
203 #define ix_ossl_sem_fini(sid) \
204 ixOsalOsIxp400BackwardSemaphoreDestroy(sid)
208 ixOsalOsIxp400BackwardOsslMutexInit (ix_ossl_mutex_state start_state
,
209 IxOsalMutex
* pMutex
);
212 /* ix_error ix_ossl_mutex_init(ix_ossl_mutex_state start_state, ix_ossl_mutex_t* mid); */
213 #define ix_ossl_mutex_init(start_state, pMutex) \
214 ixOsalOsIxp400BackwardOsslMutexInit(start_state, pMutex)
218 ixOsalOsIxp400BackwardOsslMutexLock (IxOsalMutex mid
, INT32 timeout
);
221 ix_error ix_ossl_mutex_lock(
226 #define ix_ossl_mutex_lock(mid, timeout) \
227 ixOsalOsIxp400BackwardOsslMutexLock(mid, timout)
230 PUBLIC IX_STATUS
ixOsalOsIxp400BackwardOsslMutexUnlock (IxOsalMutex mid
);
232 /* ix_error ix_ossl_mutex_unlock(ix_ossl_mutex_t mid); */
233 #define ix_ossl_mutex_unlock(mid) \
234 ixOsalOsIxp400BackwardOsslMutexUnlock(mid)
236 PUBLIC IX_STATUS
ixOsalOsIxp400BackwardOsslMutexDestroy (IxOsalMutex mid
);
238 #define ix_ossl_mutex_fini(mid) \
239 ixOsalOsIxp400BackwardOsslMutexDestroy(mid);
241 #define ix_ossl_sleep(sleeptime_ms) \
242 ixOsalSleep(sleeptime_ms)
244 PUBLIC IX_STATUS
ixOsalOsIxp400BackwardOsslSleepTick (UINT32 ticks
);
246 #define ix_ossl_sleep_tick(sleeptime_ticks) \
247 ixOsalOsIxp400BackwardOsslSleepTick(sleeptime_ticks)
250 PUBLIC IX_STATUS
ixOsalOsIxp400BackwardOsslTimeGet (IxOsalTimeval
* pTv
);
252 #define ix_ossl_time_get(pTv) \
253 ixOsalOsIxp400BackwardOsslTimeGet(pTv)
256 typedef UINT32 ix_ossl_size_t
;
258 #define ix_ossl_malloc(arg_size) \
259 ixOsalMemAlloc(arg_size)
261 #define ix_ossl_free(arg_pMemory) \
262 ixOsalMemFree(arg_pMemory)
265 #define ix_ossl_memcpy(arg_pDest, arg_pSrc,arg_Count) \
266 ixOsalMemCopy(arg_pDest, arg_pSrc,arg_Count)
268 #define ix_ossl_memset(arg_pDest, arg_pChar, arg_Count) \
269 ixOsalMemSet(arg_pDest, arg_pChar, arg_Count)
272 #endif /* IX_OSAL_BACKWARD_OSSL_H */