diff options
author | qctecmdr Service <qctecmdr@qualcomm.com> | 2019-02-07 17:27:24 -0800 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2019-02-07 17:27:24 -0800 |
commit | 15ea6ecb3fbfc6705d085494d974bd2dc35dce6c (patch) | |
tree | dd9be0af05e26a05794d866fcd89bdced2bd4512 /utils | |
parent | 8e04d01cd2e35bfea1dc7d1f5f689e7780a90f1f (diff) | |
parent | dc0efb480067db854d27ef439c1fb598769ba361 (diff) | |
download | gps-15ea6ecb3fbfc6705d085494d974bd2dc35dce6c.tar.gz |
Merge "Enable support for External AP build"
Diffstat (limited to 'utils')
-rw-r--r-- | utils/LocSharedLock.h | 20 | ||||
-rw-r--r-- | utils/MsgTask.cpp | 2 | ||||
-rw-r--r-- | utils/configure.ac | 18 |
3 files changed, 35 insertions, 5 deletions
diff --git a/utils/LocSharedLock.h b/utils/LocSharedLock.h index 7fe6237..a7af35e 100644 --- a/utils/LocSharedLock.h +++ b/utils/LocSharedLock.h @@ -30,10 +30,28 @@ #define __LOC_SHARED_LOCK__ #include <stddef.h> +#ifndef FEATURE_EXTERNAL_AP #include <cutils/atomic.h> +#endif /* FEATURE_EXTERNAL_AP */ #include <pthread.h> -// This is a utility created for use cases such that there are more than +#ifdef FEATURE_EXTERNAL_AP +#include <atomic> + +inline int32_t android_atomic_inc(volatile int32_t *addr) +{ + volatile std::atomic_int_least32_t* a = (volatile std::atomic_int_least32_t*)addr; + return std::atomic_fetch_add_explicit(a, 1, std::memory_order_release); +} + +inline int32_t android_atomic_dec(volatile int32_t *addr) +{ + volatile std::atomic_int_least32_t* a = (volatile std::atomic_int_least32_t*)addr; + return std::atomic_fetch_sub_explicit(a, 1, std::memory_order_release); +} + +#endif /* FEATURE_EXTERNAL_AP */ + // This is a utility created for use cases such that there are more than // one client who need to share the same lock, but it is not predictable // which of these clients is to last to go away. This shared lock deletes // itself when the last client calls its drop() method. To add a cient, diff --git a/utils/MsgTask.cpp b/utils/MsgTask.cpp index ad95a83..73a77fd 100644 --- a/utils/MsgTask.cpp +++ b/utils/MsgTask.cpp @@ -83,8 +83,10 @@ void MsgTask::sendMsg(const LocMsg* msg) const { } void MsgTask::prerun() { +#ifndef FEATURE_EXTERNAL_AP // make sure we do not run in background scheduling group set_sched_policy(gettid(), SP_FOREGROUND); +#endif /* FEATURE_EXTERNAL_AP */ } bool MsgTask::run() { diff --git a/utils/configure.ac b/utils/configure.ac index 639f8c4..fd16494 100644 --- a/utils/configure.ac +++ b/utils/configure.ac @@ -28,10 +28,20 @@ AC_PROG_LN_S AC_PROG_MAKE_SET PKG_PROG_PKG_CONFIG -# Checks for libraries. -PKG_CHECK_MODULES([CUTILS], [libcutils]) -AC_SUBST([CUTILS_CFLAGS]) -AC_SUBST([CUTILS_LIBS]) +AC_ARG_WITH([external_ap], + AC_HELP_STRING([--with-external_ap=@<:@dir@:>@], + [Using External Application Processor]), + [], + with_external_ap=no) + +if test "x$with_external_ap" != "xno"; then + CPPFLAGS="${CPPFLAGS} -DFEATURE_EXTERNAL_AP" +else + # Checks for libraries. + PKG_CHECK_MODULES([CUTILS], [libcutils]) + AC_SUBST([CUTILS_CFLAGS]) + AC_SUBST([CUTILS_LIBS]) +fi AC_ARG_WITH([core_includes], AC_HELP_STRING([--with-core-includes=@<:@dir@:>@], |