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 ******************************************************************************* 23 * @file 24 * ithread.h 25 * 26 * @brief 27 * Wrapper functions for thread operations. Library uses these functions during 28 * multi-thread execution. These calls can be mapped to POSIX, win threads, ... 29 * basing on platform 30 * 31 * @author 32 * ittiam 33 * 34 * @remarks 35 * none 36 * 37 ******************************************************************************* 38 */ 39 40 #ifndef _ITHREAD_H_ 41 #define _ITHREAD_H_ 42 43 /*****************************************************************************/ 44 /* Function Declarations */ 45 /*****************************************************************************/ 46 UWORD32 ithread_get_handle_size(void); 47 48 UWORD32 ithread_get_mutex_lock_size(void); 49 50 WORD32 ithread_create(void *thread_handle, void *attribute, void *strt, void *argument); 51 52 void ithread_exit(void *val_ptr); 53 54 WORD32 ithread_join(void *thread_id, void ** val_ptr); 55 56 WORD32 ithread_get_mutex_struct_size(void); 57 58 WORD32 ithread_mutex_init(void *mutex); 59 60 WORD32 ithread_mutex_destroy(void *mutex); 61 62 WORD32 ithread_mutex_lock(void *mutex); 63 64 WORD32 ithread_mutex_unlock(void *mutex); 65 66 void ithread_yield(void); 67 68 void ithread_sleep(UWORD32 u4_time); 69 70 void ithread_msleep(UWORD32 u4_time_ms); 71 72 void ithread_usleep(UWORD32 u4_time_us); 73 74 UWORD32 ithread_get_sem_struct_size(void); 75 76 WORD32 ithread_sem_init(void *sem,WORD32 pshared,UWORD32 value); 77 78 WORD32 ithread_sem_post(void *sem); 79 80 WORD32 ithread_sem_wait(void *sem); 81 82 WORD32 ithread_sem_destroy(void *sem); 83 84 WORD32 ithread_set_affinity(WORD32 core_id); 85 86 void ithread_set_name(CHAR *pc_thread_name); 87 88 WORD32 ithread_get_cond_struct_size(void); 89 90 WORD32 ithread_cond_init(void *cond); 91 92 WORD32 ithread_cond_destroy(void *cond); 93 94 WORD32 ithread_cond_wait(void *cond, void *mutex); 95 96 WORD32 ithread_cond_signal(void *cond); 97 98 #endif /* _ITHREAD_H_ */ 99