• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /******************************************************************************
2  *
3  * Copyright (C) 2018 The Android Open Source Project
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at:
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *****************************************************************************
18  * Originally developed and contributed by Ittiam Systems Pvt. Ltd, Bangalore
19 */
20 
21 /*****************************************************************************/
22 /*                                                                           */
23 /*  File Name         : osal.h                                               */
24 /*                                                                           */
25 /*  Description       : This file contains all the necessary OSAL Constants, */
26 /*                      Enums, Structures and API declarations.              */
27 /*                                                                           */
28 /*  List of Functions : None                                                 */
29 /*                                                                           */
30 /*  Issues / Problems : None                                                 */
31 /*                                                                           */
32 /*  Revision History  :                                                      */
33 /*                                                                           */
34 /*         DD MM YYYY   Author(s)       Changes (Describe the changes made)  */
35 /*         03 03 2006   Ittiam          Draft                                */
36 /*                                                                           */
37 /*****************************************************************************/
38 
39 #ifndef OSAL_H
40 #define OSAL_H
41 
42 /* C linkage specifiers for C++ declarations. */
43 #ifdef __cplusplus
44 extern "C"
45 {
46 #endif /* __cplusplus */
47 
48 /*****************************************************************************/
49 /* Constants                                                                 */
50 /*****************************************************************************/
51 
52 /* OSAL handle size */
53 #define OSAL_HANDLE_SIZE 40
54 
55 /* Number of select entries */
56 #define OSAL_SELECT_MAX 20
57 
58 /* OSAL Return Status */
59 #define OSAL_SUCCESS 0
60 #define OSAL_ERROR -1
61 #define OSAL_NOT_SUPPORTED -2
62 #define OSAL_TIMEOUT -3
63 
64 /* OSAL thread priority levels.                                              */
65 /*     OSAL_PRIORITY_1         represents    MINIMUM,                        */
66 /*     OSAL_PRIORITY_10        represents    MAXIMUM,                        */
67 /*     OSAL_PRIORITY_DEFAULT   represnts     DEFAULT SYSTEM PRIROTIY LEVEL   */
68 #define OSAL_PRIORITY_DEFAULT 0
69 #define OSAL_PRIORITY_1 1
70 #define OSAL_PRIORITY_2 2
71 #define OSAL_PRIORITY_3 3
72 #define OSAL_PRIORITY_4 4
73 #define OSAL_PRIORITY_5 5
74 #define OSAL_PRIORITY_6 6
75 #define OSAL_PRIORITY_7 7
76 #define OSAL_PRIORITY_8 8
77 #define OSAL_PRIORITY_9 9
78 #define OSAL_PRIORITY_10 10
79 
80 /* OSAL socket option levels */
81 #define OSAL_SOL_SOCKET 10000
82 #define OSAL_IPPROTO_IP 10001
83 
84 /* OSAL socket options */
85 #define OSAL_BROADCAST 1000
86 #define OSAL_REUSEADDR 1001
87 #define OSAL_KEEPALIVE 1002
88 #define OSAL_LINGER 1003
89 #define OSAL_OOBINLINE 1004
90 #define OSAL_SNDBUF 1005
91 #define OSAL_RCVBUF 1006
92 #define OSAL_RCVTIMEO 1007
93 #define OSAL_SNDTIMEO 1008
94 #define OSAL_ADD_MEMBERSHIP 1009
95 #define OSAL_DROP_MEMBERSHIP 1010
96 #define OSAL_TTL 1011
97 #define OSAL_DSCP 1012
98 #define OSAL_MULTICAST_TTL 1013
99 #define OSAL_ADDSRC_MEMBERSHIP 1014
100 #define OSAL_DROPSRC_MEMBERSHIP 1015
101 
102     /*****************************************************************************/
103     /* Enums                                                                     */
104     /*****************************************************************************/
105 
106     /* Protocols supported. */
107     typedef enum
108     {
109         OSAL_TCP, /* Address family = AF_INET, Type = SOCK_STREAM, Protocol = 0 */
110         OSAL_UDP /* Address family = AF_INET, Type = SOCK_DGRAM,  Protocol = 0 */
111     } OSAL_PROTOCOL_T;
112 
113     /* File Descriptor types. Used to specify the type of activity to check on   */
114     /* a socket.                                                                 */
115     typedef enum
116     {
117         OSAL_READ_FD,
118         OSAL_WRITE_FD,
119         OSAL_EXCEPT_FD
120     } OSAL_FD_TYPE_T;
121 
122     /* Scheduling policies supported */
123     typedef enum
124     {
125         OSAL_SCHED_RR,
126         OSAL_SCHED_FIFO,
127         OSAL_SCHED_OTHER
128     } OSAL_SCHED_POLICY_TYPE_T;
129 
130     /*****************************************************************************/
131     /* Structures                                                                */
132     /*****************************************************************************/
133 
134     /* Structure to initialize OSAL */
135     typedef struct
136     {
137         /* Handle of memory manager being used. NULL is a valid argument.*/
138         void *mmr_handle;
139 
140         /* Call back API to be called during allocation */
141         void *(*osal_alloc)(void *mmr_handle, UWORD32 size);
142 
143         /* Call back API for freeing */
144         void (*osal_free)(void *mmr_handle, void *mem);
145     } osal_cb_funcs_t;
146 
147     /* The structure (osal_mbox_attr_t) contains the attributes of the thread    */
148     /* which are passed to osal_mbox_create() API. The created Mail box has      */
149     /* attributes specified using the structure variable.                        */
150     typedef struct
151     {
152         void *thread_handle; /* Thread to be associated with mail box.      */
153         STRWORD8 *name; /* NULL terminated string name for mail box   */
154         UWORD32 msg_size; /* Length of each message.                     */
155         UWORD32 mbx_len; /* Maximum number of messages.                 */
156     } osal_mbox_attr_t;
157 
158     /* The structure (osal_sem_attr_t) contains the attributes of the semaphore  */
159     /* which are passed to osal_sem_create() API. The Semaphore attributes like  */
160     /* initial value of semaphore.                                               */
161     typedef struct
162     {
163         WORD32 value;
164     } osal_sem_attr_t;
165 
166     /* The Structure (osal_thread_attr_t) contains the attributes of the thread  */
167     /* which are passed to osal_thread_create() API. The created thread has      */
168     /* attributes specified using the structure variable.                        */
169     typedef struct
170     {
171         /* Function from where thread execution starts */
172         void *thread_func;
173 
174         /* Parameters for thread function. */
175         void *thread_param;
176 
177         /* Stack size in bytes. For default value, set to '0' */
178         UWORD32 stack_size;
179 
180         /* This attribute specifies a pre-allocated block of size 'stack_size'   */
181         /* to be used for the task's private stack. For default value, set to    */
182         /* 'NULL'.                                                               */
183         void *stack_addr;
184 
185         /* NULL terminated string name for thread. For default value, set to     */
186         /* 'NULL'.                                                               */
187         WORD8 *name;
188 
189         /* Flag determining whether to use OSAL Thread priority mapping or not.  */
190         /* Value set to 1 - use OSAL thread priority mapping.                    */
191         /* Value set to 0 - Direct value set as thread priority                  */
192         WORD32 priority_map_flag;
193 
194         /* Priority range shall be considered + ve values for increasing         */
195         /* priority and negative values for decreasing priority. The range shall */
196         /* be mapped to specific OS range internally through OSAL. For default   */
197         /* value, set to '0'.                                                    */
198         WORD32 priority;
199 
200         /* Exit return value on which thread shall exit */
201         WORD32 exit_code;
202 
203         /* Scheduling policy of the thread */
204         OSAL_SCHED_POLICY_TYPE_T sched_policy;
205 
206         /* Mask to specify on which cores the thread can run */
207         ULWORD64 core_affinity_mask;
208 
209         /* Specifies on which group of processors the thread can run */
210         WORD16 group_num;
211 
212     } osal_thread_attr_t;
213 
214     /* The structure (osal_socket_attr_t) contains the attributes of the socket  */
215     /* which are to be specified during socket creation.                         */
216     typedef struct
217     {
218         OSAL_PROTOCOL_T protocol;
219     } osal_socket_attr_t;
220 
221     /* The structure (osal_sockaddr_t) is used to uniquely determine a socket in */
222     /* the network. The socket can be addressed using IP address and port number.*/
223     typedef struct
224     {
225         WORD8 ip_addr[16];
226         UWORD16 port;
227     } osal_sockaddr_t;
228 
229     /* The structure contains the select engine thread parameters like thread    */
230     /* name thread priority etc.                                                 */
231     typedef struct
232     {
233         /* Flag determining whether to use OSAL Thread priority mapping or not.  */
234         /* Value set to 1 - use OSAL thread priority mapping.                    */
235         /* Value set to 0 - Direct value set as thread priority                  */
236         WORD32 priority_map_flag;
237 
238         /* Priority range shall be considered + ve values for increasing         */
239         /* priority and negative values for decreasing priority. The range shall */
240         /* be mapped to specific OS range internally through OSAL. For default   */
241         /* value, set to '0'.                                                    */
242         WORD32 priority;
243 
244         /* NULL terminated string name for thread. For default value, set to     */
245         /* 'NULL'.                                                               */
246         WORD8 *name;
247 
248         /* Timeout for thread sleep in micro seconds */
249         UWORD32 select_timeout;
250 
251         /* Timeout for SELECT system called by osal library in micro seconds */
252         UWORD32 select_poll_interval;
253     } osal_select_engine_attr_t;
254 
255     /* The structure used to register sockets to select engine. This structure   */
256     /* has to be updated for each socket handle and select register has to be    */
257     /* done. Currently registration is supported one at a time.                  */
258     /* Note: Function 'init' is assumed to return the socket handle.             */
259     typedef struct osal_select_entry_t
260     {
261         /* Socket handle to be registered. */
262         void *socket_handle;
263 
264         /* Activity to select for. */
265         OSAL_FD_TYPE_T type;
266 
267         /* Call back called before doing select. The function init is assumed to */
268         /* return the socket handle. In case of NULL being returning by this     */
269         /* function, The socket will be unregistered                             */
270         void *(*init)(void *);
271 
272         /* Argument to init function */
273         void *init_param;
274 
275         /* Call back function on select success */
276         WORD32 (*call_back)(void *socket_handle, void *call_back_param);
277 
278         /* Call back function parameters */
279         void *call_back_param;
280 
281         /* Call back called when the socket is unregistered. If set to NULL,     */
282         /* this will not be called. The socket that has been registered is the   */
283         /* first argument, the second argument will be terminate_param           */
284         void (*terminate)(void *, void *);
285 
286         /* Argument to terminate callback */
287         void *terminate_param;
288 
289         /* Exit code of the call back function. */
290         WORD32 exit_code;
291 
292         /* Identifier. Do not initialize this. */
293         WORD32 id;
294     } osal_select_entry_t;
295 
296     /* File descriptor structure. Used in osal_socket_select() API call.         */
297     /* Currently maximum number of sockets that can be set is fixed to           */
298     /* SELECT_MAX                                                                */
299     /* Note : To initialize osal_fd_set structure variable, call API             */
300     /*        osal_socket_fd_zero() for Initialization. If initialization is not */
301     /*        done, behaviour of osal_socket_select() and fd_set API's is        */
302     /*        undefined.                                                         */
303     typedef struct
304     {
305         void *array[OSAL_SELECT_MAX]; /* Array for holding the socket descriptors*/
306         WORD32 count; /* Number of socket descriptors in array   */
307     } osal_fd_set_t;
308 
309     /* Timeout value for osal_socket_select() API. */
310     typedef struct
311     {
312         WORD32 tv_sec; /* Time in seconds.                            */
313         WORD32 tv_usec; /* Time in micro seconds.                      */
314     } osal_timeval_t;
315 
316     /* Attributes for setting Linger option for socket */
317     typedef struct
318     {
319         UWORD16 l_onoff;
320         UWORD16 l_linger;
321     } osal_sockopt_linger_t;
322 
323     /* Attributes for Joining or dropping from a multicast group */
324     typedef struct
325     {
326         WORD8 imr_multiaddr[16];
327         WORD8 imr_interface[16];
328         WORD8 imr_srcaddr[16];
329     } osal_ip_mreq_t;
330 
331     /*****************************************************************************/
332     /* Extern OSAL Initialization Function Declarations                          */
333     /*****************************************************************************/
334 
335     /* Allocates memory for the OSAL instance handle. It also allocates memory   */
336     /* for storing debug information.                                            */
337     extern WORD32 osal_init(IN void *osal_handle);
338 
339     /* Releases all the resources held by the OSAL handle */
340     extern WORD32 osal_close(IN void *osal_handle);
341 
342     /* This function registers MMR call backs for OSAL */
343     extern WORD32 osal_register_callbacks(IN void *osal_handle, IN osal_cb_funcs_t *cb_funcs);
344 
345     /*****************************************************************************/
346     /* Extern Mail Box Function Declarations                                     */
347     /*****************************************************************************/
348 
349     /* Allocates memory for mail box handle. Creates a mail box which is         */
350     /* associated with the thread and updates the mail box, which returned for   */
351     /* further actions to be performed on the mail box.                          */
352     extern void *osal_mbox_create(IN void *osal_handle, IN osal_mbox_attr_t *attr);
353 
354     /* Closes the mail box and frees the memory allocated for mail box handle. */
355     extern WORD32 osal_mbox_destroy(IN void *mbox_handle);
356 
357     /* Posts a message to the mail box */
358     extern WORD32 osal_mbox_post(IN void *mbox_handle, IN void *buf, IN UWORD32 len);
359 
360     /* Gets the message form the specified mail box. If there are not messages   */
361     /* in mail box, it waits infinitely till a message arrives.                  */
362     extern WORD32 osal_mbox_get(IN void *mbox_handle, OUT void *buf, IN UWORD32 len);
363 
364     /* Gets the message from the specified mail box within the timeout period.   */
365     /* If no messages are present in specified time, error code is returned. The */
366     /* error can be got from osal_get_last_error() API                           */
367     extern WORD32
368         osal_mbox_get_timed(IN void *mbox_handle, OUT void *buf, IN UWORD32 len, IN UWORD32 timeout);
369 
370     /*****************************************************************************/
371     /* Extern Custom Mail Box Function Declarations                               */
372     /*****************************************************************************/
373 
374     /* Allocates memory for mail box handle. Creates a mail box which is         */
375     /* associated with the thread and updates the mail box, which returned for   */
376     /* further actions to be performed on the mail box.                          */
377     extern void *osal_custom_mbox_create(IN void *osal_handle, IN osal_mbox_attr_t *attr);
378 
379     /* Closes the mail box and frees the memory allocated for mail box handle. */
380     extern WORD32 osal_custom_mbox_destroy(IN void *mbox_handle);
381 
382     /* Posts a message to the mail box */
383     extern WORD32 osal_custom_mbox_post(IN void *cust_mbox_handle, IN void *buf, IN UWORD32 len);
384 
385     /* Gets the message form the specified mail box. If there are not messages   */
386     /* in mail box, it waits infinitely till a message arrives.                  */
387     extern WORD32 osal_custom_mbox_get(IN void *cust_mbox_handle, OUT void *buf, IN UWORD32 len);
388 
389     /* Gets the message from the specified mail box within the timeout period.   */
390     /* If no messages are present in specified time, error code is returned. The */
391     /* error can be got from osal_get_last_error() API                           */
392     extern WORD32 osal_custom_mbox_get_timed(
393         IN void *cust_mbox_handle, OUT void *buf, IN UWORD32 len, IN UWORD32 timeout);
394 
395     /*****************************************************************************/
396     /* Extern Mutex Function Declarations                                        */
397     /*****************************************************************************/
398 
399     /* Creates a mutex and returns the to mutex */
400     extern void *osal_mutex_create(IN void *osal_handle);
401 
402     /* Closes the mutex. */
403     extern WORD32 osal_mutex_destroy(IN void *mutex_handle);
404 
405     /* Waits infinitely till mutex lock is got. */
406     extern WORD32 osal_mutex_lock(IN void *mutex_handle);
407 
408     /* Releases the lock held on the mutex. */
409     extern WORD32 osal_mutex_unlock(IN void *mutex_handle);
410 
411     /*****************************************************************************/
412     /* Extern Semaphore Function Declarations                                    */
413     /*****************************************************************************/
414 
415     /* Creates a semaphore and returns the handle to semaphore. */
416     extern void *osal_sem_create(IN void *osal_handle, IN osal_sem_attr_t *attr);
417 
418     /* Closes the semaphore. */
419     extern WORD32 osal_sem_destroy(IN void *sem_handle);
420 
421     /* Waits infinitely till semaphore is zero. */
422     extern WORD32 osal_sem_wait(IN void *sem_handle);
423 
424     /* Increments the value of semaphore by one. */
425     extern WORD32 osal_sem_post(IN void *sem_handle);
426 
427     /* Returns the current value of semaphore. */
428     extern WORD32 osal_sem_count(IN void *sem_handle, OUT WORD32 *count);
429 
430     /*****************************************************************************/
431     /* Extern Conditional Variable Function Declarations                         */
432     /*****************************************************************************/
433 
434     /* Creates a conditional variable and returns the handle to it. */
435     extern void *osal_cond_var_create(IN void *osal_handle);
436 
437     /* Destroys the conditional variable. */
438     extern WORD32 osal_cond_var_destroy(IN void *cond_var_handle);
439 
440     /* Waits infinitely till conditional variable receives signal. */
441     extern WORD32 osal_cond_var_wait(IN void *cond_var_handle, IN void *mutex_handle);
442 
443     /* Signals on conditional variable. */
444     extern WORD32 osal_cond_var_signal(IN void *cond_var_handle);
445 
446     /*****************************************************************************/
447     /* Extern Thread Function Declarations                                       */
448     /*****************************************************************************/
449 
450     /* Creates a thread with specified parameters */
451     extern void *osal_thread_create(IN void *osal_handle, IN osal_thread_attr_t *attr);
452 
453     /* Closes or halts the execution of thread specified by the handle. */
454     extern WORD32 osal_thread_destroy(IN void *thread_handle);
455 
456     /* Makes the thread sleep for specified number of milliseconds */
457     extern WORD32 osal_thread_sleep(IN UWORD32 milli_seconds);
458 
459     /* Yields the execution of thread. */
460     extern WORD32 osal_thread_yield(void);
461 
462     /* Suspends the execution of thread until osal_thread_resume API is called. */
463     extern WORD32 osal_thread_suspend(IN void *thread_handle);
464 
465     /* Resumes the execution of thread which was suspended by                    */
466     /* osal_thread_suspend API call.                                             */
467     extern WORD32 osal_thread_resume(IN void *thread_handle);
468 
469     /* Waits infinitely till the thread, whose handle is passed, completes       */
470     /* execution.                                                                */
471     extern WORD32 osal_thread_wait(IN void *thread_handle);
472 
473     /* Returns current thread handle */
474     extern void *osal_get_thread_handle(IN void *osal_handle);
475 
476     /*****************************************************************************/
477     /* Extern Network Socket Function Declarations                               */
478     /*****************************************************************************/
479 
480     /* Initializes network resources */
481     extern WORD32 osal_network_init(void);
482 
483     /* Un-initializes all the network resources */
484     extern WORD32 osal_network_close(void);
485 
486     /* Creates the socket and returns the socket descriptor. */
487     extern void *osal_socket_create(IN void *osal_handle, IN osal_socket_attr_t *attr);
488 
489     /* Closes the open socket. */
490     extern WORD32 osal_socket_destroy(IN void *socket_handle);
491 
492     /* Binds to the specified port number on the local machine. Socket_create    */
493     /* API has to be called before calling socket_bind.                          */
494     extern WORD32 osal_socket_bind(IN void *socket_handle, IN osal_sockaddr_t *addr);
495 
496     /* Starts listening at the specified port for any incoming connections.      */
497     /* Socket descriptor should be bound before calling socket_listen            */
498     extern WORD32 osal_socket_listen(IN void *socket_handle, IN WORD32 backlog);
499 
500     /* Accepts incoming connection. If listen queue is empty it blocks till a    */
501     /* successful connection is made.                                            */
502     extern void *osal_socket_accept(IN void *socket_handle, OUT osal_sockaddr_t *addr);
503 
504     /* Makes a connection request to the remote address specified. */
505     extern WORD32 osal_socket_connect(IN void *socket_handle, IN osal_sockaddr_t *addr);
506 
507     /* Sends the specified number of bytes of data */
508     extern WORD32 osal_socket_send(
509         IN void *socket_handle, IN const WORD8 *buf, IN WORD32 len, IN WORD32 flags);
510 
511     /* Receives data over TCP connection. */
512     extern WORD32
513         osal_socket_recv(IN void *socket_handle, OUT WORD8 *buf, IN WORD32 len, IN WORD32 flags);
514 
515     /* Sends data over a datagram protocol */
516     extern WORD32 osal_socket_sendto(
517         IN void *socket_handle,
518         IN const WORD8 *buf,
519         IN WORD32 len,
520         IN WORD32 flags,
521         IN osal_sockaddr_t *to);
522 
523     /* Receives packet over a UDP connection */
524     extern WORD32 osal_socket_recvfrom(
525         IN void *socket_handle,
526         OUT WORD8 *buf,
527         IN WORD32 len,
528         IN WORD32 flags,
529         OUT osal_sockaddr_t *from);
530 
531     /* Polls the specified sockets for specified activity */
532     extern WORD32 osal_socket_select(
533         INOUT osal_fd_set_t *readfds,
534         INOUT osal_fd_set_t *writefds,
535         INOUT osal_fd_set_t *exceptfds,
536         INOUT osal_timeval_t *timeout);
537 
538     /* Gets the socket options */
539     extern WORD32 osal_socket_getsockopt(
540         IN void *socket_handle,
541         IN WORD32 level,
542         IN WORD32 optname,
543         OUT WORD8 *optval,
544         INOUT WORD32 *optlen);
545 
546     /* Sets the socket options to specified values */
547     extern WORD32 osal_socket_setsockopt(
548         IN void *socket_handle,
549         IN WORD32 level,
550         IN WORD32 optname,
551         IN const WORD8 *optval,
552         IN WORD32 optlen);
553 
554     /* Adds the specified socket handle to the file descriptor set */
555     extern WORD32 osal_socket_fd_set(IN void *socket_handle, OUT osal_fd_set_t *set);
556 
557     /* Checks the file descriptor set for the presence of socket handle. */
558     extern WORD32 osal_socket_fd_isset(IN void *socket_handle, IN osal_fd_set_t *set);
559 
560     /* Resets the file descriptor set */
561     extern void osal_socket_fd_zero(INOUT osal_fd_set_t *set);
562 
563     /* Removes the specified socket handle from the file descriptor set */
564     extern WORD32 osal_socket_fd_clr(IN void *socket_handle, OUT osal_fd_set_t *set);
565 
566     /* To convert short integer from host byte order to network byte order */
567     extern UWORD16 osal_htons(IN UWORD16 hostshort);
568 
569     /* To convert long integer from host to network byte order */
570     extern UWORD32 osal_htonl(IN UWORD32 hostlong);
571 
572     /* To convert short integer from network to host byte order */
573     extern UWORD16 osal_ntohs(IN UWORD16 netshort);
574 
575     /* To convert long integer from network to host byte order */
576     extern UWORD32 osal_ntohl(IN UWORD32 netlong);
577 
578     /*****************************************************************************/
579     /* Extern Select Engine Function Declarations                                */
580     /*****************************************************************************/
581 
582     /* Initializes the select engine. */
583     extern void *
584         osal_select_engine_init(IN void *osal_handle, IN osal_select_engine_attr_t *se_attr);
585 
586     /* Closes the select engine. */
587     extern WORD32 osal_select_engine_close(IN void *select_engine);
588 
589     /* Registers the socket handle specified in the entry. */
590     extern WORD32
591         osal_select_engine_register(IN void *select_engine, IN osal_select_entry_t *entry);
592 
593     /* Un-registers the specified socket handle. */
594     extern WORD32 osal_select_engine_unregister(
595         IN void *select_engine, IN void *socket_handle, IN OSAL_FD_TYPE_T fd_type);
596     /*****************************************************************************/
597     /* Extern Other Function Declarations                                        */
598     /*****************************************************************************/
599 
600     /* Returns time in milliseconds */
601     extern UWORD32 osal_get_time(void);
602 
603     /* For time in micro-second resolution */
604     extern WORD32 osal_get_time_usec(UWORD32 *sec, UWORD32 *usec);
605 
606     /* Returns the last error code. 0 is no error */
607     extern UWORD32 osal_get_last_error(void);
608 
609     /* Prints the last error code. 0 is no error */
610     extern void osal_print_last_error(IN const STRWORD8 *string);
611 
612     /* Gets the version of library in NULL terminated string form. */
613     extern WORD8 *osal_get_version(void);
614 
615     /* Gets the tid of the thread in whose context this call was made */
616     extern WORD32 osal_get_current_tid(void);
617 
618 /* C linkage specifiers for C++ declarations. */
619 #ifdef __cplusplus
620 }
621 #endif /* __cplusplus */
622 
623 #endif /* OSAL_H */
624