source: SVN/cambria/redboot/packages/devs/eth/intel/npe/common/current/include/IxOsalBackwardOssl.h @ 1

Last change on this file since 1 was 1, checked in by Tim Harvey, 2 years ago

restored latest version of files from server backup

Signed-off-by: Tim Harvey <tharvey@…>

File size: 7.2 KB
Line 
1/**
2 * This file is intended to provide backward
3 * compatibility for main osService/OSSL
4 * APIs.
5 *
6 * It shall be phased out gradually and users
7 * are strongly recommended to use IX_OSAL API.
8 *
9 * @par
10 * IXP400 SW Release version 2.3
11 *
12 * -- Copyright Notice --
13 *
14 * @par
15 * Copyright (c) 2001-2005, Intel Corporation.
16 * All rights reserved.
17 *
18 * @par
19 * Redistribution and use in source and binary forms, with or without
20 * modification, are permitted provided that the following conditions
21 * are met:
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.
30 *
31 *
32 * @par
33 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
34 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
35 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
36 * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
37 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
38 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
39 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
40 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
41 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
42 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
43 * SUCH DAMAGE.
44 *
45 *
46 * @par
47 * -- End of Copyright Notice --
48 */
49
50#ifndef IX_OSAL_BACKWARD_OSSL_H
51#define IX_OSAL_BACKWARD_OSSL_H
52
53
54typedef IxOsalThread ix_ossl_thread_t;
55
56typedef IxOsalSemaphore ix_ossl_sem_t;
57
58typedef IxOsalMutex ix_ossl_mutex_t;
59
60typedef IxOsalTimeval ix_ossl_time_t;
61
62
63/* Map sub-fields for ix_ossl_time_t */
64#define tv_sec secs
65#define tv_nec nsecs
66
67
68typedef IX_STATUS ix_error;
69
70typedef UINT32 ix_ossl_thread_priority;
71
72typedef UINT32 ix_uint32;
73
74
75#define IX_OSSL_ERROR_SUCCESS IX_SUCCESS
76
77#define IX_ERROR_SUCCESS IX_SUCCESS
78
79
80typedef enum
81{
82    IX_OSSL_SEM_UNAVAILABLE = 0,
83    IX_OSSL_SEM_AVAILABLE
84} ix_ossl_sem_state;
85
86
87typedef enum
88{
89    IX_OSSL_MUTEX_UNLOCK = 0,
90    IX_OSSL_MUTEX_LOCK
91} ix_ossl_mutex_state;
92
93
94typedef IxOsalVoidFnVoidPtr ix_ossl_thread_entry_point_t;
95
96
97#define IX_OSSL_THREAD_PRI_HIGH         90
98#define IX_OSSL_THREAD_PRI_MEDIUM       160
99#define IX_OSSL_THREAD_PRI_LOW          240
100
101
102#define IX_OSSL_WAIT_FOREVER    IX_OSAL_WAIT_FOREVER
103
104#define IX_OSSL_WAIT_NONE       IX_OSAL_WAIT_NONE
105
106#define BILLION  IX_OSAL_BILLION
107
108#define IX_OSSL_TIME_EQ(a,b)  IX_OSAL_TIME_EQ(a,b)
109
110#define IX_OSSL_TIME_GT(a,b)  IX_OSAL_TIME_GT(a,b)
111
112#define IX_OSSL_TIME_LT(a,b)  IX_OSAL_TIME_LT(a,b)
113
114#define IX_OSSL_TIME_ADD(a,b)  IX_OSAL_TIME_ADD(a,b)
115
116#define IX_OSSL_TIME_SUB(a,b)  IX_OSAL_TIME_SUB(a,b)
117
118
119/* a is tick, b is timeval */
120#define IX_OSSL_TIME_CONVERT_TO_TICK(a,b)  \
121                 (a) = IX_OSAL_TIMEVAL_TO_TICKS(b)
122
123
124
125
126PUBLIC IX_STATUS
127ixOsalOsIxp400BackwardOsslThreadCreate (IxOsalVoidFnVoidPtr entryPoint,
128                                        void *arg, IxOsalThread * ptrThread);
129
130#define ix_ossl_thread_create(entryPoint, arg, ptrTid) \
131                ixOsalOsIxp400BackwardOsslThreadCreate(entryPoint, arg, ptrTid)
132
133
134/* void ix_ossl_thread_exit(ix_error retError, void* retObj) */
135#define ix_ossl_thread_exit(retError, retObj)   \
136                ixOsalThreadExit()
137
138
139PUBLIC IX_STATUS ixOsalOsIxp400BackwardOsslThreadKill (IxOsalThread tid);
140
141/* ix_error ix_ossl_thread_kill(tid) */
142#define ix_ossl_thread_kill(tid) \
143                ixOsalOsIxp400BackwardOsslThreadKill(tid)
144
145
146PUBLIC IX_STATUS
147ixOsalOsIxp400BackwardOsslThreadSetPriority (IxOsalThread tid,
148                                             UINT32 priority);
149
150
151/*
152 * ix_error ix_ossl_thread_set_priority(ix_ossl_thread_t tid,
153 *                             ix_ossl_thread_priority priority
154 *                             );
155 */
156
157#define ix_ossl_thread_set_priority(tid, priority) \
158                ixOsalOsIxp400BackwardOsslThreadSetPriority(tid, priority)
159
160
161PUBLIC IX_STATUS ixOsalOsIxp400BackwardOsslTickGet (int *pticks);
162
163#define ix_ossl_tick_get(pticks) \
164                ixOsalOsIxp400BackwardOsslTickGet(pticks)
165
166PUBLIC IX_STATUS ixOsalOsIxp400BackwardOsslThreadDelay (int ticks);
167
168#define ix_ossl_thread_delay(ticks) ixOsalOsIxp400BackwardOsslThreadDelay(ticks)
169
170
171
172/* ix_error ix_ossl_sem_init(int start_value, ix_ossl_sem_t* sid); */
173/* Note sid is a pointer to semaphore */
174#define ix_ossl_sem_init(value, sid) \
175                ixOsalSemaphoreInit(sid, value)
176
177
178PUBLIC IX_STATUS
179ixOsalOsIxp400BackwardOsslSemaphoreWait (IxOsalSemaphore semaphore,
180                                         INT32 timeout);
181
182
183/*
184ix_error ix_ossl_sem_take(
185                          ix_ossl_sem_t sid,
186                          ix_uint32 timeout
187                         );
188*/
189
190#define ix_ossl_sem_take( sid, timeout) \
191                ixOsalOsIxp400BackwardOsslSemaphoreWait(sid, timeout)
192
193
194
195PUBLIC IX_STATUS
196ixOsalOsIxp400BackwardOsslSemaphorePost (IxOsalSemaphore sid);
197
198/*ix_error ix_ossl_sem_give(ix_ossl_sem_t sid); */
199#define ix_ossl_sem_give(sid) \
200                ixOsalOsIxp400BackwardOsslSemaphorePost(sid);
201
202
203PUBLIC IX_STATUS ixOsalOsIxp400BackwardSemaphoreDestroy (IxOsalSemaphore sid);
204
205#define ix_ossl_sem_fini(sid) \
206                ixOsalOsIxp400BackwardSemaphoreDestroy(sid)
207
208
209PUBLIC IX_STATUS
210ixOsalOsIxp400BackwardOsslMutexInit (ix_ossl_mutex_state start_state,
211                                     IxOsalMutex * pMutex);
212
213
214/* ix_error ix_ossl_mutex_init(ix_ossl_mutex_state start_state, ix_ossl_mutex_t* mid); */
215#define ix_ossl_mutex_init(start_state, pMutex) \
216                ixOsalOsIxp400BackwardOsslMutexInit(start_state, pMutex)
217
218
219PUBLIC IX_STATUS
220ixOsalOsIxp400BackwardOsslMutexLock (IxOsalMutex mid, INT32 timeout);
221
222/*
223ix_error ix_ossl_mutex_lock(
224                            ix_ossl_mutex_t mid,
225                            ix_uint32 timeout
226                           );
227*/
228#define ix_ossl_mutex_lock(mid, timeout) \
229                ixOsalOsIxp400BackwardOsslMutexLock(mid, timout)
230
231
232PUBLIC IX_STATUS ixOsalOsIxp400BackwardOsslMutexUnlock (IxOsalMutex mid);
233
234/* ix_error ix_ossl_mutex_unlock(ix_ossl_mutex_t mid); */
235#define ix_ossl_mutex_unlock(mid) \
236                ixOsalOsIxp400BackwardOsslMutexUnlock(mid)
237
238PUBLIC IX_STATUS ixOsalOsIxp400BackwardOsslMutexDestroy (IxOsalMutex mid);
239
240#define ix_ossl_mutex_fini(mid) \
241                ixOsalOsIxp400BackwardOsslMutexDestroy(mid);
242
243#define ix_ossl_sleep(sleeptime_ms) \
244                ixOsalSleep(sleeptime_ms)
245
246PUBLIC IX_STATUS ixOsalOsIxp400BackwardOsslSleepTick (UINT32 ticks);
247
248#define ix_ossl_sleep_tick(sleeptime_ticks) \
249                ixOsalOsIxp400BackwardOsslSleepTick(sleeptime_ticks)
250
251
252PUBLIC IX_STATUS ixOsalOsIxp400BackwardOsslTimeGet (IxOsalTimeval * pTv);
253
254#define ix_ossl_time_get(pTv)    \
255                ixOsalOsIxp400BackwardOsslTimeGet(pTv)
256
257
258typedef UINT32 ix_ossl_size_t;
259
260#define ix_ossl_malloc(arg_size) \
261                ixOsalMemAlloc(arg_size)
262
263#define ix_ossl_free(arg_pMemory) \
264                ixOsalMemFree(arg_pMemory)
265
266
267#define ix_ossl_memcpy(arg_pDest, arg_pSrc,arg_Count) \
268                ixOsalMemCopy(arg_pDest, arg_pSrc,arg_Count)
269
270#define ix_ossl_memset(arg_pDest, arg_pChar, arg_Count) \
271                ixOsalMemSet(arg_pDest, arg_pChar, arg_Count)
272
273
274#endif /* IX_OSAL_BACKWARD_OSSL_H */
Note: See TracBrowser for help on using the repository browser.