]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - drivers/net/npe/include/IxOsalBackwardOssl.h
imx6 SION bit has to be on for the pins that are used as ENET_REF_CLK
[karo-tx-uboot.git] / drivers / net / npe / include / IxOsalBackwardOssl.h
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.0
11  * 
12  * -- Copyright Notice --
13  * 
14  * @par
15  * Copyright 2001-2005, Intel Corporation.
16  * All rights reserved.
17  * 
18  * @par
19  * SPDX-License-Identifier:     BSD-3-Clause
20  * @par
21  * -- End of Copyright Notice --
22  */
23
24 #ifndef IX_OSAL_BACKWARD_OSSL_H
25 #define IX_OSAL_BACKWARD_OSSL_H
26
27
28 typedef IxOsalThread ix_ossl_thread_t;
29
30 typedef IxOsalSemaphore ix_ossl_sem_t;
31
32 typedef IxOsalMutex ix_ossl_mutex_t;
33
34 typedef 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
42 typedef IX_STATUS ix_error;
43
44 typedef UINT32 ix_ossl_thread_priority;
45
46 typedef UINT32 ix_uint32;
47
48
49 #define IX_OSSL_ERROR_SUCCESS IX_SUCCESS
50
51 #define IX_ERROR_SUCCESS IX_SUCCESS
52
53
54 typedef enum
55 {
56     IX_OSSL_SEM_UNAVAILABLE = 0,
57     IX_OSSL_SEM_AVAILABLE
58 } ix_ossl_sem_state;
59
60
61 typedef enum
62 {
63     IX_OSSL_MUTEX_UNLOCK = 0,
64     IX_OSSL_MUTEX_LOCK
65 } ix_ossl_mutex_state;
66
67
68 typedef 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
100 PUBLIC IX_STATUS
101 ixOsalOsIxp400BackwardOsslThreadCreate (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
113 PUBLIC 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
120 PUBLIC IX_STATUS
121 ixOsalOsIxp400BackwardOsslThreadSetPriority (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
135 PUBLIC IX_STATUS ixOsalOsIxp400BackwardOsslTickGet (int *pticks);
136
137 #define ix_ossl_tick_get(pticks) \
138                 ixOsalOsIxp400BackwardOsslTickGet(pticks)
139
140 PUBLIC 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
152 PUBLIC IX_STATUS
153 ixOsalOsIxp400BackwardOsslSemaphoreWait (IxOsalSemaphore semaphore,
154                                          INT32 timeout);
155
156
157 /*
158 ix_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
169 PUBLIC IX_STATUS
170 ixOsalOsIxp400BackwardOsslSemaphorePost (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
177 PUBLIC IX_STATUS ixOsalOsIxp400BackwardSemaphoreDestroy (IxOsalSemaphore sid);
178
179 #define ix_ossl_sem_fini(sid) \
180                 ixOsalOsIxp400BackwardSemaphoreDestroy(sid)
181
182
183 PUBLIC IX_STATUS
184 ixOsalOsIxp400BackwardOsslMutexInit (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
193 PUBLIC IX_STATUS
194 ixOsalOsIxp400BackwardOsslMutexLock (IxOsalMutex mid, INT32 timeout);
195
196 /*
197 ix_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
206 PUBLIC 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
212 PUBLIC 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
220 PUBLIC IX_STATUS ixOsalOsIxp400BackwardOsslSleepTick (UINT32 ticks);
221
222 #define ix_ossl_sleep_tick(sleeptime_ticks) \
223                 ixOsalOsIxp400BackwardOsslSleepTick(sleeptime_ticks)
224
225
226 PUBLIC IX_STATUS ixOsalOsIxp400BackwardOsslTimeGet (IxOsalTimeval * pTv);
227
228 #define ix_ossl_time_get(pTv)    \
229                 ixOsalOsIxp400BackwardOsslTimeGet(pTv)
230
231
232 typedef 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 */