summaryrefslogtreecommitdiff
path: root/osi
diff options
context:
space:
mode:
authorPavlin Radoslavov <pavlin@google.com>2016-01-21 18:04:36 -0800
committerPavlin Radoslavov <pavlin@google.com>2016-01-22 02:57:21 +0000
commit10978011f286d20f10eb949e3557ad00a62c8424 (patch)
treeb4b26247127d0bdfd8315d93ab35f9fbba30c2cb /osi
parentd61f8d97564a7104901246957a794dbde7ed7adf (diff)
downloadandroid-system-bt-10978011f286d20f10eb949e3557ad00a62c8424.tar.gz
android-system-bt-10978011f286d20f10eb949e3557ad00a62c8424.tar.xz
A workaround for kernels missing CLOCK_BOOTTIME_ALARM
If the kernel doesn't have support for CLOCK_BOOTTIME_ALARM, then timer_create(CLOCK_BOOTTIME_ALARM) will fail. Added #ifdef KERNEL_MISSING_CLOCK_BOOTTIME_ALARM guard to get around the issue. Platforms that don't have CLOCK_BOOTTIME_ALARM should have the following lines in the device's "bdroid_buildcfg.h" file: /* Defined if the kernel does not have support for CLOCK_BOOTTIME_ALARM */ #define KERNEL_MISSING_CLOCK_BOOTTIME_ALARM TRUE Bug: 26611369 Change-Id: I455dbbc20f43b21a83998cd60cac8dea0a73080d
Diffstat (limited to 'osi')
-rw-r--r--osi/Android.mk6
-rw-r--r--osi/src/alarm.c7
2 files changed, 11 insertions, 2 deletions
diff --git a/osi/Android.mk b/osi/Android.mk
index 789a17f..1f906af 100644
--- a/osi/Android.mk
+++ b/osi/Android.mk
@@ -73,9 +73,11 @@ btosiCommonTestSrc := \
btosiCommonIncludes := \
$(LOCAL_PATH)/.. \
- $(LOCAL_PATH)/../utils/include
+ $(LOCAL_PATH)/../utils/include \
+ $(LOCAL_PATH)/../stack/include $(bdroid_C_INCLUDES)
-btosiCommonCFlags := -std=c99 -Wall -Werror -UNDEBUG -fvisibility=hidden
+btosiCommonCFlags := -std=c99 -Wall -Werror -UNDEBUG -fvisibility=hidden \
+ $(bdroid_CFLAGS)
# libosi static library for target
# ========================================================
diff --git a/osi/src/alarm.c b/osi/src/alarm.c
index a2328da..0b36830 100644
--- a/osi/src/alarm.c
+++ b/osi/src/alarm.c
@@ -16,6 +16,8 @@
*
******************************************************************************/
+#include "include/bt_target.h"
+
#define LOG_TAG "bt_osi_alarm"
#include "osi/include/alarm.h"
@@ -93,7 +95,12 @@ struct alarm_t {
// unit tests to run faster. It should not be modified by production code.
int64_t TIMER_INTERVAL_FOR_WAKELOCK_IN_MS = 3000;
static const clockid_t CLOCK_ID = CLOCK_BOOTTIME;
+
+#if defined(KERNEL_MISSING_CLOCK_BOOTTIME_ALARM) && (KERNEL_MISSING_CLOCK_BOOTTIME_ALARM == TRUE)
+static const clockid_t CLOCK_ID_ALARM = CLOCK_BOOTTIME;
+#else
static const clockid_t CLOCK_ID_ALARM = CLOCK_BOOTTIME_ALARM;
+#endif
// This mutex ensures that the |alarm_set|, |alarm_cancel|, and alarm callback
// functions execute serially and not concurrently. As a result, this mutex