1 /******************************************************************************
2  *
3  * Copyright (C) 2015 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 /*  File Name         : ithread.h                                            */
23 /*                                                                           */
24 /*  Description       : This file contains all the necessary structure and   */
25 /*                      enumeration definitions needed for the Application   */
26 /*                      Program Interface(API) of the                        */
27 /*                      Thread Abstraction Layer                             */
28 /*                                                                           */
29 /*  List of Functions :     ithread_get_handle_size                          */
30 /*                          ithread_get_mutex_lock_size                      */
31 /*                          ithread_create                                   */
32 /*                          ithread_join                                     */
33 /*                          ithread_get_mutex_struct_size                    */
34 /*                          ithread_mutex_init                               */
35 /*                          ithread_mutex_destroy                            */
36 /*                          ithread_mutex_lock                               */
37 /*                          ithread_mutex_unlock                             */
38 /*                          ithread_yield                                    */
39 /*                          ithread_sleep                                    */
40 /*                          ithread_msleep                                   */
41 /*                          ithread_usleep                                   */
42 /*                          ithread_get_sem_struct_size                      */
43 /*                          ithread_sem_init                                 */
44 /*                          ithread_sem_post                                 */
45 /*                          ithread_sem_wait                                 */
46 /*                          ithread_sem_destroy                              */
47 /*                          ithread_set_affinity                             */
48 /*                                                                           */
49 /*  Issues / Problems : None                                                 */
50 /*                                                                           */
51 /*  Revision History  :                                                      */
52 /*                                                                           */
53 /*         DD MM YYYY   Author(s)       Changes                              */
54 /*         06 09 2012   Harish          Initial Version                      */
55 /*                                                                           */
56 /*****************************************************************************/
57 
58 #ifndef _ITHREAD_H_
59 #define _ITHREAD_H_
60 
61 UWORD32 ithread_get_handle_size(void);
62 
63 UWORD32 ithread_get_mutex_lock_size(void);
64 
65 WORD32  ithread_create(void *thread_handle, void *attribute, void *strt, void *argument);
66 
67 WORD32  ithread_join(void *thread_id, void ** val_ptr);
68 
69 WORD32  ithread_get_mutex_struct_size(void);
70 
71 WORD32  ithread_mutex_init(void *mutex);
72 
73 WORD32  ithread_mutex_destroy(void *mutex);
74 
75 WORD32  ithread_mutex_lock(void *mutex);
76 
77 WORD32  ithread_mutex_unlock(void *mutex);
78 
79 void    ithread_yield(void);
80 
81 void    ithread_sleep(UWORD32 u4_time);
82 
83 void    ithread_msleep(UWORD32 u4_time_ms);
84 
85 void    ithread_usleep(UWORD32 u4_time_us);
86 
87 UWORD32 ithread_get_sem_struct_size(void);
88 
89 WORD32  ithread_sem_init(void *sem,WORD32 pshared,UWORD32 value);
90 
91 WORD32  ithread_sem_post(void *sem);
92 
93 WORD32  ithread_sem_wait(void *sem);
94 
95 WORD32  ithread_sem_destroy(void *sem);
96 
97 WORD32  ithread_set_affinity(WORD32 core_id);
98 
99 void    ithread_set_name(CHAR *pc_thread_name);
100 
101 #endif /* _ITHREAD_H_ */
102