blob: c9deb544ce6fbcaeefc88580c06e367b4c69d5d6 [file] [log] [blame]
Wolfgang Denk4646d2a2006-05-30 15:56:48 +02001/**
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.0
11 *
12 * -- Copyright Notice --
13 *
14 * @par
15 * Copyright 2001-2005, Intel Corporation.
16 * All rights reserved.
17 *
18 * @par
Wolfgang Denkc57eadc2013-07-28 22:12:47 +020019 * SPDX-License-Identifier: BSD-3-Clause
Wolfgang Denk4646d2a2006-05-30 15:56:48 +020020 * @par
21 * -- End of Copyright Notice --
22 */
23
24#ifndef IX_OSAL_BACKWARD_OSSL_H
25#define IX_OSAL_BACKWARD_OSSL_H
26
27
28typedef IxOsalThread ix_ossl_thread_t;
29
30typedef IxOsalSemaphore ix_ossl_sem_t;
31
32typedef IxOsalMutex ix_ossl_mutex_t;
33
34typedef IxOsalTimeval ix_ossl_time_t;
35
36
37/* Map sub-fields for ix_ossl_time_t */
38#define tv_sec secs
39#define tv_nec nsecs
40
41
42typedef IX_STATUS ix_error;
43
44typedef UINT32 ix_ossl_thread_priority;
45
46typedef UINT32 ix_uint32;
47
48
49#define IX_OSSL_ERROR_SUCCESS IX_SUCCESS
50
51#define IX_ERROR_SUCCESS IX_SUCCESS
52
53
54typedef enum
55{
56 IX_OSSL_SEM_UNAVAILABLE = 0,
57 IX_OSSL_SEM_AVAILABLE
58} ix_ossl_sem_state;
59
60
61typedef enum
62{
63 IX_OSSL_MUTEX_UNLOCK = 0,
64 IX_OSSL_MUTEX_LOCK
65} ix_ossl_mutex_state;
66
67
68typedef IxOsalVoidFnVoidPtr ix_ossl_thread_entry_point_t;
69
70
71#define IX_OSSL_THREAD_PRI_HIGH 90
72#define IX_OSSL_THREAD_PRI_MEDIUM 160
73#define IX_OSSL_THREAD_PRI_LOW 240
74
75
76#define IX_OSSL_WAIT_FOREVER IX_OSAL_WAIT_FOREVER
77
78#define IX_OSSL_WAIT_NONE IX_OSAL_WAIT_NONE
79
80#define BILLION IX_OSAL_BILLION
81
82#define IX_OSSL_TIME_EQ(a,b) IX_OSAL_TIME_EQ(a,b)
83
84#define IX_OSSL_TIME_GT(a,b) IX_OSAL_TIME_GT(a,b)
85
86#define IX_OSSL_TIME_LT(a,b) IX_OSAL_TIME_LT(a,b)
87
88#define IX_OSSL_TIME_ADD(a,b) IX_OSAL_TIME_ADD(a,b)
89
90#define IX_OSSL_TIME_SUB(a,b) IX_OSAL_TIME_SUB(a,b)
91
92
93/* a is tick, b is timeval */
94#define IX_OSSL_TIME_CONVERT_TO_TICK(a,b) \
95 (a) = IX_OSAL_TIMEVAL_TO_TICKS(b)
96
97
98
99
100PUBLIC IX_STATUS
101ixOsalOsIxp400BackwardOsslThreadCreate (IxOsalVoidFnVoidPtr entryPoint,
102 void *arg, IxOsalThread * ptrThread);
103
104#define ix_ossl_thread_create(entryPoint, arg, ptrTid) \
105 ixOsalOsIxp400BackwardOsslThreadCreate(entryPoint, arg, ptrTid)
106
107
108/* void ix_ossl_thread_exit(ix_error retError, void* retObj) */
109#define ix_ossl_thread_exit(retError, retObj) \
110 ixOsalThreadExit()
111
112
113PUBLIC IX_STATUS ixOsalOsIxp400BackwardOsslThreadKill (IxOsalThread tid);
114
115/* ix_error ix_ossl_thread_kill(tid) */
116#define ix_ossl_thread_kill(tid) \
117 ixOsalOsIxp400BackwardOsslThreadKill(tid)
118
119
120PUBLIC IX_STATUS
121ixOsalOsIxp400BackwardOsslThreadSetPriority (IxOsalThread tid,
122 UINT32 priority);
123
124
125/*
126 * ix_error ix_ossl_thread_set_priority(ix_ossl_thread_t tid,
127 * ix_ossl_thread_priority priority
128 * );
129 */
130
131#define ix_ossl_thread_set_priority(tid, priority) \
132 ixOsalOsIxp400BackwardOsslThreadSetPriority(tid, priority)
133
134
135PUBLIC IX_STATUS ixOsalOsIxp400BackwardOsslTickGet (int *pticks);
136
137#define ix_ossl_tick_get(pticks) \
138 ixOsalOsIxp400BackwardOsslTickGet(pticks)
139
140PUBLIC IX_STATUS ixOsalOsIxp400BackwardOsslThreadDelay (int ticks);
141
142#define ix_ossl_thread_delay(ticks) ixOsalOsIxp400BackwardOsslThreadDelay(ticks)
143
144
145
146/* ix_error ix_ossl_sem_init(int start_value, ix_ossl_sem_t* sid); */
147/* Note sid is a pointer to semaphore */
148#define ix_ossl_sem_init(value, sid) \
149 ixOsalSemaphoreInit(sid, value)
150
151
152PUBLIC IX_STATUS
153ixOsalOsIxp400BackwardOsslSemaphoreWait (IxOsalSemaphore semaphore,
154 INT32 timeout);
155
156
157/*
158ix_error ix_ossl_sem_take(
159 ix_ossl_sem_t sid,
160 ix_uint32 timeout
161 );
162*/
163
164#define ix_ossl_sem_take( sid, timeout) \
165 ixOsalOsIxp400BackwardOsslSemaphoreWait(sid, timeout)
166
167
168
169PUBLIC IX_STATUS
170ixOsalOsIxp400BackwardOsslSemaphorePost (IxOsalSemaphore sid);
171
172/*ix_error ix_ossl_sem_give(ix_ossl_sem_t sid); */
173#define ix_ossl_sem_give(sid) \
174 ixOsalOsIxp400BackwardOsslSemaphorePost(sid);
175
176
177PUBLIC IX_STATUS ixOsalOsIxp400BackwardSemaphoreDestroy (IxOsalSemaphore sid);
178
179#define ix_ossl_sem_fini(sid) \
180 ixOsalOsIxp400BackwardSemaphoreDestroy(sid)
181
182
183PUBLIC IX_STATUS
184ixOsalOsIxp400BackwardOsslMutexInit (ix_ossl_mutex_state start_state,
185 IxOsalMutex * pMutex);
186
187
188/* ix_error ix_ossl_mutex_init(ix_ossl_mutex_state start_state, ix_ossl_mutex_t* mid); */
189#define ix_ossl_mutex_init(start_state, pMutex) \
190 ixOsalOsIxp400BackwardOsslMutexInit(start_state, pMutex)
191
192
193PUBLIC IX_STATUS
194ixOsalOsIxp400BackwardOsslMutexLock (IxOsalMutex mid, INT32 timeout);
195
196/*
197ix_error ix_ossl_mutex_lock(
198 ix_ossl_mutex_t mid,
199 ix_uint32 timeout
200 );
201*/
202#define ix_ossl_mutex_lock(mid, timeout) \
203 ixOsalOsIxp400BackwardOsslMutexLock(mid, timout)
204
205
206PUBLIC IX_STATUS ixOsalOsIxp400BackwardOsslMutexUnlock (IxOsalMutex mid);
207
208/* ix_error ix_ossl_mutex_unlock(ix_ossl_mutex_t mid); */
209#define ix_ossl_mutex_unlock(mid) \
210 ixOsalOsIxp400BackwardOsslMutexUnlock(mid)
211
212PUBLIC IX_STATUS ixOsalOsIxp400BackwardOsslMutexDestroy (IxOsalMutex mid);
213
214#define ix_ossl_mutex_fini(mid) \
215 ixOsalOsIxp400BackwardOsslMutexDestroy(mid);
216
217#define ix_ossl_sleep(sleeptime_ms) \
218 ixOsalSleep(sleeptime_ms)
219
220PUBLIC IX_STATUS ixOsalOsIxp400BackwardOsslSleepTick (UINT32 ticks);
221
222#define ix_ossl_sleep_tick(sleeptime_ticks) \
223 ixOsalOsIxp400BackwardOsslSleepTick(sleeptime_ticks)
224
225
226PUBLIC IX_STATUS ixOsalOsIxp400BackwardOsslTimeGet (IxOsalTimeval * pTv);
227
228#define ix_ossl_time_get(pTv) \
229 ixOsalOsIxp400BackwardOsslTimeGet(pTv)
230
231
232typedef UINT32 ix_ossl_size_t;
233
234#define ix_ossl_malloc(arg_size) \
235 ixOsalMemAlloc(arg_size)
236
237#define ix_ossl_free(arg_pMemory) \
238 ixOsalMemFree(arg_pMemory)
239
240
241#define ix_ossl_memcpy(arg_pDest, arg_pSrc,arg_Count) \
242 ixOsalMemCopy(arg_pDest, arg_pSrc,arg_Count)
243
244#define ix_ossl_memset(arg_pDest, arg_pChar, arg_Count) \
245 ixOsalMemSet(arg_pDest, arg_pChar, arg_Count)
246
247
248#endif /* IX_OSAL_BACKWARD_OSSL_H */