diff options
| author | Etan Cohen <etancohen@google.com> | 2015-03-31 10:41:53 -0700 |
|---|---|---|
| committer | Etan Cohen <etancohen@google.com> | 2015-03-31 10:41:53 -0700 |
| commit | e1a9e52ff59d36bd1bb5b7b3a02fafba6394edfe (patch) | |
| tree | 0a82ebb8b0be6acf27f7cbf38a44c9f70425e141 /utils | |
| parent | dd05445e57161ac40ae8b37252ae9f453bb31e85 (diff) | |
| parent | f7f839985b3931682363d2ef3b7c5cae55a842ee (diff) | |
| download | android_system_bt-e1a9e52ff59d36bd1bb5b7b3a02fafba6394edfe.tar.gz android_system_bt-e1a9e52ff59d36bd1bb5b7b3a02fafba6394edfe.tar.bz2 android_system_bt-e1a9e52ff59d36bd1bb5b7b3a02fafba6394edfe.zip | |
Merge commit 'f7f839985b3931682363d2ef3b7c5cae55a842ee' into merge
Change-Id: Iaaec1ea0bf3009b7e32a9a60f697631a3f56e889
Diffstat (limited to 'utils')
| -rw-r--r-- | utils/Android.mk | 5 | ||||
| -rw-r--r-- | utils/include/bt_utils.h | 4 | ||||
| -rw-r--r-- | utils/src/bt_utils.c | 74 |
3 files changed, 41 insertions, 42 deletions
diff --git a/utils/Android.mk b/utils/Android.mk index c7c59f1ab..8e3fe39ce 100644 --- a/utils/Android.mk +++ b/utils/Android.mk @@ -4,7 +4,10 @@ include $(CLEAR_VARS) LOCAL_C_INCLUDES := \ $(LOCAL_PATH)/include \ - $(LOCAL_PATH)/../gki/ulinux \ + $(LOCAL_PATH)/../btcore/include \ + $(LOCAL_PATH)/../osi/include \ + $(LOCAL_PATH)/../stack/include \ + $(LOCAL_PATH)/../ \ $(bdroid_C_INCLUDES) LOCAL_CFLAGS += $(bdroid_CFLAGS) -std=c99 diff --git a/utils/include/bt_utils.h b/utils/include/bt_utils.h index f2bd2edd9..fa397f9e1 100644 --- a/utils/include/bt_utils.h +++ b/utils/include/bt_utils.h @@ -19,6 +19,8 @@ #ifndef BT_UTILS_H #define BT_UTILS_H +static const char BT_UTILS_MODULE[] = "bt_utils_module"; + /******************************************************************************* ** Type definitions ********************************************************************************/ @@ -38,8 +40,6 @@ typedef enum { ** Functions ********************************************************************************/ -void bt_utils_init(); -void bt_utils_cleanup(); void raise_priority_a2dp(tHIGH_PRIORITY_TASK high_task); void adjust_priority_a2dp(int start); #define UNUSED(x) (void)(x) diff --git a/utils/src/bt_utils.c b/utils/src/bt_utils.c index ab618b092..1d1dcdd55 100644 --- a/utils/src/bt_utils.c +++ b/utils/src/bt_utils.c @@ -25,6 +25,8 @@ * ***********************************************************************************/ +#define LOG_TAG "bt_utils" + #include <cutils/properties.h> #include <cutils/sched_policy.h> #include <errno.h> @@ -35,13 +37,10 @@ #include <unistd.h> #include <utils/ThreadDefs.h> -#define LOG_TAG "BT_UTILS" - -#include <utils/Log.h> - -#include "data_types.h" +#include "bt_types.h" #include "bt_utils.h" - +#include "btcore/include/module.h" +#include "osi/include/log.h" /******************************************************************************* ** Type definitions for callback functions @@ -53,41 +52,38 @@ static int g_TaskIdx; static int g_TaskIDs[TASK_HIGH_MAX]; #define INVALID_TASK_ID (-1) -/***************************************************************************** -** -** Function bt_utils_init -** -** Description Initialize bluedroid util -** -** Returns void -** -*******************************************************************************/ -void bt_utils_init() { - int i; - pthread_mutexattr_t lock_attr; +static future_t *init(void) { + int i; + pthread_mutexattr_t lock_attr; - for(i = 0; i < TASK_HIGH_MAX; i++) { - g_DoSchedulingGroupOnce[i] = PTHREAD_ONCE_INIT; - g_DoSchedulingGroup[i] = TRUE; - g_TaskIDs[i] = INVALID_TASK_ID; - } - pthread_mutexattr_init(&lock_attr); - pthread_mutex_init(&gIdxLock, &lock_attr); + for(i = 0; i < TASK_HIGH_MAX; i++) { + g_DoSchedulingGroupOnce[i] = PTHREAD_ONCE_INIT; + g_DoSchedulingGroup[i] = TRUE; + g_TaskIDs[i] = INVALID_TASK_ID; + } + + pthread_mutexattr_init(&lock_attr); + pthread_mutex_init(&gIdxLock, &lock_attr); + return NULL; } -/***************************************************************************** -** -** Function bt_utils_cleanup -** -** Description Clean up bluedroid util -** -** Returns void -** -*******************************************************************************/ -void bt_utils_cleanup() { - pthread_mutex_destroy(&gIdxLock); +static future_t *clean_up(void) { + pthread_mutex_destroy(&gIdxLock); + return NULL; } +const module_t bt_utils_module = { + .name = BT_UTILS_MODULE, + .init = init, + .start_up = NULL, + .shut_down = NULL, + .clean_up = clean_up, + .dependencies = { + NULL + } +}; + + /***************************************************************************** ** ** Function check_do_scheduling_group @@ -134,7 +130,7 @@ void raise_priority_a2dp(tHIGH_PRIORITY_TASK high_task) { pthread_mutex_unlock(&gIdxLock); if (rc) { - ALOGW("failed to change sched policy, tid %d, err: %d", tid, errno); + LOG_WARN("failed to change sched policy, tid %d, err: %d", tid, errno); } // always use urgent priority for HCI worker thread until we can adjust @@ -145,7 +141,7 @@ void raise_priority_a2dp(tHIGH_PRIORITY_TASK high_task) { priority = ANDROID_PRIORITY_URGENT_AUDIO; if (setpriority(PRIO_PROCESS, tid, priority) < 0) { - ALOGW("failed to change priority tid: %d to %d", tid, priority); + LOG_WARN("failed to change priority tid: %d to %d", tid, priority); } } @@ -172,7 +168,7 @@ void adjust_priority_a2dp(int start) { { if (setpriority(PRIO_PROCESS, tid, priority) < 0) { - ALOGW("failed to change priority tid: %d to %d", tid, priority); + LOG_WARN("failed to change priority tid: %d to %d", tid, priority); } } } |
