Merge "Enable support for External AP build"

This commit is contained in:
qctecmdr Service 2019-02-07 17:27:24 -08:00 committed by Gerrit - the friendly Code Review server
commit 15ea6ecb3f
4 changed files with 52 additions and 5 deletions

View file

@ -30,7 +30,10 @@
#define __LOC_PLA__ #define __LOC_PLA__
#ifdef __cplusplus #ifdef __cplusplus
#ifndef FEATURE_EXTERNAL_AP
#include <utils/SystemClock.h> #include <utils/SystemClock.h>
#endif /* FEATURE_EXTERNAL_AP */
#include <inttypes.h>
#include <sys/time.h> #include <sys/time.h>
#include <time.h> #include <time.h>
@ -47,10 +50,14 @@ inline int64_t uptimeMillis()
extern "C" { extern "C" {
#endif #endif
#ifndef FEATURE_EXTERNAL_AP
#include <cutils/properties.h> #include <cutils/properties.h>
#include <cutils/threads.h> #include <cutils/threads.h>
#include <cutils/sched_policy.h> #include <cutils/sched_policy.h>
#endif /* FEATURE_EXTERNAL_AP */
#include <pthread.h>
#include <sys/time.h> #include <sys/time.h>
#include <sys/types.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#ifndef OFF_TARGET #ifndef OFF_TARGET
@ -76,6 +83,16 @@ extern "C" {
#define LOC_PATH_XTWIFI_CONF_STR "/etc/xtwifi.conf" #define LOC_PATH_XTWIFI_CONF_STR "/etc/xtwifi.conf"
#define LOC_PATH_QUIPC_CONF_STR "/etc/quipc.conf" #define LOC_PATH_QUIPC_CONF_STR "/etc/quipc.conf"
#ifdef FEATURE_EXTERNAL_AP
#define PROPERTY_VALUE_MAX 92
inline int property_get(const char* key, char* value, const char* default_value)
{
strlcpy(value, default_value, PROPERTY_VALUE_MAX - 1);
return strlen(value);
}
#endif /* FEATURE_EXTERNAL_AP */
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif /*__cplusplus */ #endif /*__cplusplus */

View file

@ -30,10 +30,28 @@
#define __LOC_SHARED_LOCK__ #define __LOC_SHARED_LOCK__
#include <stddef.h> #include <stddef.h>
#ifndef FEATURE_EXTERNAL_AP
#include <cutils/atomic.h> #include <cutils/atomic.h>
#endif /* FEATURE_EXTERNAL_AP */
#include <pthread.h> #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 // 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 // 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, // itself when the last client calls its drop() method. To add a cient,

View file

@ -83,8 +83,10 @@ void MsgTask::sendMsg(const LocMsg* msg) const {
} }
void MsgTask::prerun() { void MsgTask::prerun() {
#ifndef FEATURE_EXTERNAL_AP
// make sure we do not run in background scheduling group // make sure we do not run in background scheduling group
set_sched_policy(gettid(), SP_FOREGROUND); set_sched_policy(gettid(), SP_FOREGROUND);
#endif /* FEATURE_EXTERNAL_AP */
} }
bool MsgTask::run() { bool MsgTask::run() {

View file

@ -28,10 +28,20 @@ AC_PROG_LN_S
AC_PROG_MAKE_SET AC_PROG_MAKE_SET
PKG_PROG_PKG_CONFIG PKG_PROG_PKG_CONFIG
# Checks for libraries. AC_ARG_WITH([external_ap],
PKG_CHECK_MODULES([CUTILS], [libcutils]) AC_HELP_STRING([--with-external_ap=@<:@dir@:>@],
AC_SUBST([CUTILS_CFLAGS]) [Using External Application Processor]),
AC_SUBST([CUTILS_LIBS]) [],
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_ARG_WITH([core_includes],
AC_HELP_STRING([--with-core-includes=@<:@dir@:>@], AC_HELP_STRING([--with-core-includes=@<:@dir@:>@],