1/****************************************************************************** 2 * 3 * Copyright (C) 1999-2012 Broadcom Corporation 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#ifndef GKI_INT_H 19#define GKI_INT_H 20 21#include "gki_common.h" 22#include <pthread.h> 23#include <sys/prctl.h> 24 25/********************************************************************** 26** OS specific definitions 27*/ 28/* The base priority used for pthread based GKI task. below value is to keep it retro compatible. 29 * It is recommended to use (GKI_MAX_TASKS+3), this will assign real time priorities GKI_MAX_TASKS- 30 * task_id -2 to the thread */ 31#ifndef GKI_LINUX_BASE_PRIORITY 32#define GKI_LINUX_BASE_PRIORITY 30 33#endif 34 35/* The base policy used for pthread based GKI task. the sched defines are defined here to avoid undefined values due 36 * to missing header file, see pthread functions! Overall it is recommend however to use SCHED_NOMRAL */ 37#define GKI_SCHED_NORMAL 0 38#define GKI_SCHED_FIFO 1 39#define GKI_SCHED_RR 2 40#ifndef GKI_LINUX_BASE_POLICY 41#define GKI_LINUX_BASE_POLICY GKI_SCHED_NORMAL 42#endif 43 44/* GKI timer bases should use GKI_SCHED_FIFO to ensure the least jitter possible */ 45#ifndef GKI_LINUX_TIMER_POLICY 46#define GKI_LINUX_TIMER_POLICY GKI_SCHED_FIFO 47#endif 48 49/* the GKI_timer_update() thread should have the highest real time priority to ensue correct 50 * timer expiry. 51 */ 52#ifndef GKI_LINUX_TIMER_TICK_PRIORITY 53#define GKI_LINUX_TIMER_TICK_PRIORITY GKI_LINUX_BASE_PRIORITY+2 54#endif 55 56typedef struct 57{ 58 pthread_mutex_t GKI_mutex; 59 pthread_t thread_id[GKI_MAX_TASKS]; 60 pthread_mutex_t thread_evt_mutex[GKI_MAX_TASKS]; 61 pthread_cond_t thread_evt_cond[GKI_MAX_TASKS]; 62 pthread_mutex_t thread_timeout_mutex[GKI_MAX_TASKS]; 63 pthread_cond_t thread_timeout_cond[GKI_MAX_TASKS]; 64#if (GKI_DEBUG == TRUE) 65 pthread_mutex_t GKI_trace_mutex; 66#endif 67} tGKI_OS; 68 69extern void gki_system_tick_start_stop_cback(BOOLEAN start); 70 71/* Contains common control block as well as OS specific variables */ 72typedef struct 73{ 74 tGKI_OS os; 75 tGKI_COM_CB com; 76} tGKI_CB; 77 78 79#ifdef __cplusplus 80extern "C" { 81#endif 82 83#if GKI_DYNAMIC_MEMORY == FALSE 84GKI_API extern tGKI_CB gki_cb; 85#else 86GKI_API extern tGKI_CB *gki_cb_ptr; 87#define gki_cb (*gki_cb_ptr) 88#endif 89 90#ifdef __cplusplus 91} 92#endif 93 94#endif 95