xref: /aosp_15_r20/system/nfc/src/gki/ulinux/gki_int.h (revision 7eba2f3b06c51ae21384f6a4f14577b668a869b3)
1*7eba2f3bSAndroid Build Coastguard Worker /******************************************************************************
2*7eba2f3bSAndroid Build Coastguard Worker  *
3*7eba2f3bSAndroid Build Coastguard Worker  *  Copyright (C) 1999-2012 Broadcom Corporation
4*7eba2f3bSAndroid Build Coastguard Worker  *
5*7eba2f3bSAndroid Build Coastguard Worker  *  Licensed under the Apache License, Version 2.0 (the "License");
6*7eba2f3bSAndroid Build Coastguard Worker  *  you may not use this file except in compliance with the License.
7*7eba2f3bSAndroid Build Coastguard Worker  *  You may obtain a copy of the License at:
8*7eba2f3bSAndroid Build Coastguard Worker  *
9*7eba2f3bSAndroid Build Coastguard Worker  *  http://www.apache.org/licenses/LICENSE-2.0
10*7eba2f3bSAndroid Build Coastguard Worker  *
11*7eba2f3bSAndroid Build Coastguard Worker  *  Unless required by applicable law or agreed to in writing, software
12*7eba2f3bSAndroid Build Coastguard Worker  *  distributed under the License is distributed on an "AS IS" BASIS,
13*7eba2f3bSAndroid Build Coastguard Worker  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14*7eba2f3bSAndroid Build Coastguard Worker  *  See the License for the specific language governing permissions and
15*7eba2f3bSAndroid Build Coastguard Worker  *  limitations under the License.
16*7eba2f3bSAndroid Build Coastguard Worker  *
17*7eba2f3bSAndroid Build Coastguard Worker  ******************************************************************************/
18*7eba2f3bSAndroid Build Coastguard Worker #ifndef GKI_INT_H
19*7eba2f3bSAndroid Build Coastguard Worker #define GKI_INT_H
20*7eba2f3bSAndroid Build Coastguard Worker 
21*7eba2f3bSAndroid Build Coastguard Worker #include <pthread.h>
22*7eba2f3bSAndroid Build Coastguard Worker 
23*7eba2f3bSAndroid Build Coastguard Worker #include "gki_common.h"
24*7eba2f3bSAndroid Build Coastguard Worker 
25*7eba2f3bSAndroid Build Coastguard Worker /**********************************************************************
26*7eba2f3bSAndroid Build Coastguard Worker ** OS specific definitions
27*7eba2f3bSAndroid Build Coastguard Worker */
28*7eba2f3bSAndroid Build Coastguard Worker #ifdef ANDROID
29*7eba2f3bSAndroid Build Coastguard Worker #include <sys/times.h>
30*7eba2f3bSAndroid Build Coastguard Worker #endif
31*7eba2f3bSAndroid Build Coastguard Worker 
32*7eba2f3bSAndroid Build Coastguard Worker typedef struct {
33*7eba2f3bSAndroid Build Coastguard Worker   pthread_mutex_t GKI_mutex;
34*7eba2f3bSAndroid Build Coastguard Worker   pthread_t thread_id[GKI_MAX_TASKS];
35*7eba2f3bSAndroid Build Coastguard Worker   pthread_mutex_t thread_evt_mutex[GKI_MAX_TASKS];
36*7eba2f3bSAndroid Build Coastguard Worker   pthread_cond_t thread_evt_cond[GKI_MAX_TASKS];
37*7eba2f3bSAndroid Build Coastguard Worker   pthread_mutex_t thread_timeout_mutex[GKI_MAX_TASKS];
38*7eba2f3bSAndroid Build Coastguard Worker   pthread_cond_t thread_timeout_cond[GKI_MAX_TASKS];
39*7eba2f3bSAndroid Build Coastguard Worker   int no_timer_suspend; /* 1: no suspend, 0 stop calling GKI_timer_update() */
40*7eba2f3bSAndroid Build Coastguard Worker   pthread_mutex_t gki_timer_mutex;
41*7eba2f3bSAndroid Build Coastguard Worker   pthread_cond_t gki_timer_cond;
42*7eba2f3bSAndroid Build Coastguard Worker   pthread_mutex_t gki_end_mutex;
43*7eba2f3bSAndroid Build Coastguard Worker   pthread_cond_t gki_end_cond;
44*7eba2f3bSAndroid Build Coastguard Worker   int end_flag;
45*7eba2f3bSAndroid Build Coastguard Worker } tGKI_OS;
46*7eba2f3bSAndroid Build Coastguard Worker 
47*7eba2f3bSAndroid Build Coastguard Worker /* condition to exit or continue GKI_run() timer loop */
48*7eba2f3bSAndroid Build Coastguard Worker #define GKI_TIMER_TICK_RUN_COND 1
49*7eba2f3bSAndroid Build Coastguard Worker #define GKI_TIMER_TICK_STOP_COND 0
50*7eba2f3bSAndroid Build Coastguard Worker #define GKI_TIMER_TICK_EXIT_COND 2
51*7eba2f3bSAndroid Build Coastguard Worker 
52*7eba2f3bSAndroid Build Coastguard Worker extern void gki_system_tick_start_stop_cback(bool start);
53*7eba2f3bSAndroid Build Coastguard Worker 
54*7eba2f3bSAndroid Build Coastguard Worker /* Contains common control block as well as OS specific variables */
55*7eba2f3bSAndroid Build Coastguard Worker typedef struct {
56*7eba2f3bSAndroid Build Coastguard Worker   tGKI_OS os;
57*7eba2f3bSAndroid Build Coastguard Worker   tGKI_COM_CB com;
58*7eba2f3bSAndroid Build Coastguard Worker } tGKI_CB;
59*7eba2f3bSAndroid Build Coastguard Worker 
60*7eba2f3bSAndroid Build Coastguard Worker extern tGKI_CB gki_cb;
61*7eba2f3bSAndroid Build Coastguard Worker 
62*7eba2f3bSAndroid Build Coastguard Worker #endif
63