Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Enable android build #38

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 1 addition & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -28,11 +28,6 @@ public
*.tmp_proj
*.aps
*.vssettings
*.tlog
*.recipe
*.log
*.idb
*.pdb
.vs
x64
Win32
@@ -81,5 +76,4 @@ ppm_compiler
/ESIF/Products/ESIF_UI/Sources/solution/esif_ui_solution/bin/esif_ui_solution.dll
/ESIF/Products/IPF_UI/Sources/solution/ipf_ui_solution/bin
/ESIF/Products/IPF_UI/index.html
/IPF/Linux
/DPTF/Windows/Solution/.klocwork/
/IPF/Linux
4 changes: 3 additions & 1 deletion Android.mk
Original file line number Diff line number Diff line change
@@ -23,5 +23,7 @@ INTEL_DPTF_ROOT_PATH:= $(call my-dir)
include $(INTEL_DPTF_ROOT_PATH)/ESIF/Products/ESIF_UF/Androidx86/jni/Android.mk
include $(INTEL_DPTF_ROOT_PATH)/ESIF/Products/ESIF_CMP/Android/Android.mk
include $(INTEL_DPTF_ROOT_PATH)/ESIF/Products/ESIF_WS/Android/Android.mk
include $(INTEL_DPTF_ROOT_PATH)/ESIF/Products/UPE_IOC/Android/Android.mk
#include $(INTEL_DPTF_ROOT_PATH)/ESIF/Products/UPE_IOC/Android/Android.mk
#include $(INTEL_DPTF_ROOT_PATH)/ESIF/Products/UPE_JAVA/Android/Android.mk
#include $(INTEL_DPTF_ROOT_PATH)/ESIF/Products/JHS/Android.mk
include $(INTEL_DPTF_ROOT_PATH)/DPTF/Androidx86/jni/Android.mk
4 changes: 2 additions & 2 deletions Common/Ver.h
Original file line number Diff line number Diff line change
@@ -20,5 +20,5 @@

#define VER_MAJOR 1
#define VER_MINOR 0
#define VER_HOTFIX 11100
#define VER_BUILD 29358
#define VER_HOTFIX 11001
#define VER_BUILD 28546
131 changes: 131 additions & 0 deletions Common/esif_ccb.h
Original file line number Diff line number Diff line change
@@ -53,13 +53,33 @@

#pragma once

#if !defined(ESIF_ATTR_KERNEL) && !defined(ESIF_ATTR_USER)
/* User Mode Build */
#define ESIF_ATTR_USER
#endif

#if defined(_WIN32)
#if !defined(ESIF_ATTR_OS_WINDOWS)
/* Windows OS */
#define ESIF_ATTR_OS_WINDOWS
#endif
#else
#if !defined(ESIF_ATTR_OS_LINUX) && !defined(ESIF_ATTR_OS_CHROME) && !defined(ESIF_ATTR_OS_ANDROID)
/* Linux Derived OS */
#define ESIF_ATTR_OS_LINUX
#endif
#endif

#ifdef ESIF_ATTR_OS_CHROME
/* Linux Derived OS */
#define ESIF_ATTR_OS_LINUX
#define ESIF_ATTR_OS "Chrome" /* OS Is Chromium */
#endif
#ifdef ESIF_ATTR_OS_ANDROID
/* Linux Derived OS */
#define ESIF_ATTR_OS_LINUX
#define ESIF_ATTR_OS "Android" /* OS Is Android */
#endif
#if defined(ESIF_ATTR_OS_LINUX) && !defined(_GNU_SOURCE)
/* -std=gnu99 support */
#define _GNU_SOURCE
@@ -70,13 +90,110 @@
#endif

/* OS Agnostic */
#ifdef ESIF_ATTR_USER
#include <stdio.h>
#include <stdlib.h>
#else
#include <stddef.h>
#endif

#ifdef ESIF_ATTR_OS_WINDOWS

/* Windows OS */
#pragma strict_gs_check(on)

#ifdef ESIF_ATTR_USER
#define _WINSOCKAPI_ /* Override for Winsock */
#include <windows.h>

/* Avoids Serialization Warnings*/
#define ESIF_SERIAL_FENCE() _mm_lfence()

#else
#include <ntddk.h>
#define INVALID_HANDLE_VALUE ((HANDLE)(LONG_PTR)-1) /* Invalid ESIF Handle */
#endif

/* Add Linux Base Types for Windows */
typedef unsigned char u8; /* A BYTE */
typedef unsigned short u16; /* A WORD */
typedef unsigned int u32; /* A DWORD */
typedef unsigned long long u64; /* A QWORD */

typedef char *esif_string; /* NULL-teriminated ANSI string */
typedef HANDLE esif_os_handle_t;/* opaque OS Handle (not a pointer) */
typedef u64 esif_handle_t; /* opaque ESIF 64-bit handle (may NOT be a pointer) */
typedef u64 esif_context_t; /* opaque ESIF 64-bit context (may be a pointer) */

#define ESIF_ATTR_OS "Windows" /* OS Is Windows */
#define ESIF_INLINE __inline /* Inline Function Directive */
#define ESIF_FUNC __FUNCTION__ /* Current Function Name */
#define ESIF_CALLCONV __cdecl /* SDK Calling Convention */
#define ESIF_PATH_SEP "\\" /* Path Separator String */
#define ESIF_EXPORT __declspec(dllexport) /* Used for Exported Symbols */
#define ESIF_INVALID_HANDLE ((esif_handle_t)(-1)) /* Invalid ESIF Handle */

#define ESIF_HANDLE_DEFAULT ((esif_handle_t)(0)) /* Reserved ESIF handle */
#define ESIF_HANDLE_PRIMARY_PARTICIPANT ((esif_handle_t)(1)) /* Reserved ESIF primary participant handle */
#define ESIF_HANDLE_MATCH_ANY_EVENT ((esif_handle_t)(-2)) /* Reserved ESIF handle */

#define ESIF_WS_LIBRARY_NAME "ipf_ws" /* Legacy Library/App Name for deprecated in-process web server*/

#define esif_ccb_isfullpath(fname) (fname[0] == '\\' || (isalpha(fname[0]) && fname[1] == ':'))

#ifdef __cplusplus
#define ESIF_ELEMENT(x) /* C99 Designated Initializers unsupported in C++ */
#else
#define ESIF_ELEMENT(x) x = /* Support C99 Designated Initializers */
#endif

/* Avoids "conditional constant is an expression" warnings for do...while(0) loops */
#define ESIF_CONSTEXPR(expr) __pragma(warning(push)) __pragma(warning(disable:4127)) (expr) __pragma(warning(pop))

/* Sleep Interface */
#define esif_ccb_sleep(sec) Sleep(sec * 1000)
#define esif_ccb_sleep_msec(msec) Sleep(msec)

/* Deduce Platform based on predefined compiler flags */
#ifdef _WIN64
#define ESIF_ATTR_64BIT
#endif

/* Deduce Debug Build for Windows. Non-Windows can define this in Makefile */
#ifdef _DEBUG
#define ESIF_ATTR_DEBUG
#endif

#ifdef ESIF_ATTR_DEBUG
#ifdef ESIF_ATTR_USER
#define ESIF_ASSERT(x) \
do { \
if ESIF_CONSTEXPR(!(x)) \
DebugBreak(); \
} while ESIF_CONSTEXPR(0)

#else /* !ESIF_ATTR_USER */
#define ESIF_ASSERT(x) ASSERT(x)
#endif /* !ESIF_ATTR_USER */
#else /* !ESIF_ATTR_DEBUG */
#define ESIF_ASSERT(x) (0)
#endif /* !ESIF_ATTR_DEBUG */


#ifdef ESIF_ATTR_USER
/* Byte Ordering Utilities (Winsock2.h) */
#define esif_ccb_htons(val) htons(val)
#define esif_ccb_htonl(val) htonl(val)
#define esif_ccb_htonll(val) htonll(val)
#endif

#endif /* WINDOWS */

#ifdef ESIF_ATTR_OS_LINUX

/* All Linux Derived OS */

#ifdef ESIF_ATTR_USER
#include <unistd.h> /* POSIX API */

/* Common Windows Symbols */
@@ -89,6 +206,7 @@
#include <x86intrin.h>
#define ESIF_SERIAL_FENCE() _mm_lfence()

#endif

/* Add Linux Base Types */
typedef unsigned char u8;
@@ -120,8 +238,18 @@ typedef u64 esif_handle_t; /* opaque ESIF 64-bit handle (may not be a pointer) *
typedef u64 esif_context_t; /* opaque ESIF 64-bit context (may be a pointer) */

#ifdef ESIF_ATTR_DEBUG
# ifdef ESIF_ATTR_USER
# include <assert.h>
# define ESIF_ASSERT(x) assert(x)
# else
# define ESIF_ASSERT(x) \
do { \
if (x) \
break; \
printk(KERN_EMERG "!ESIF_ASSERT! [%s@%s#%d]: %s\n", ESIF_FUNC, __FILE__, __LINE__, #x); \
BUG(); \
} while (0)
# endif
#else
# define ESIF_ASSERT(x)
#endif
@@ -146,6 +274,7 @@ typedef u64 esif_context_t; /* opaque ESIF 64-bit context (may be a pointer) */
/* Used for constant expressions, such as do...while(0) loops */
#define ESIF_CONSTEXPR(expr) (expr)

#ifdef ESIF_ATTR_USER
/* Byte Ordering Utilities */
#include <arpa/inet.h> /* htonl */
#define esif_ccb_htons(val) htons(val)
@@ -157,7 +286,9 @@ static ESIF_INLINE u64 esif_ccb_htonll(u64 value)
u32 lo = htonl((u32)value);
return (((u64)lo) << 32) | hi;
}
#endif

#endif /* LINUX */

/*
* OS Agnostic
16 changes: 14 additions & 2 deletions Common/esif_ccb_atomic.h
Original file line number Diff line number Diff line change
@@ -53,16 +53,27 @@

#pragma once

#include "esif_ccb.h"

/*
* C/C++ OS-Agnostic Universal Implementation of atomic integer operations.
* Interface is based on native Linux atomic_t kernel type (atomic.h)
* Note: atomic_t is 32 or 64 bit, depending on OS/Platform so treat as opaque
*/

#if defined(ESIF_ATTR_KERNEL)

#if defined(ESIF_ATTR_OS_WINDOWS)
#include "esif_ccb_atomic_win_kern.h"
#elif defined(ESIF_ATTR_OS_LINUX)
#include "esif_ccb_atomic_lin_kern.h"
#endif

#elif defined(ESIF_ATTR_USER)

#if defined(ESIF_ATTR_OS_WINDOWS)
#include "esif_ccb_atomic_win_user.h"
#elif defined(ESIF_ATTR_OS_LINUX)
#include "esif_ccb_atomic_lin_user.h"
#endif

/* Disable User-Mode Atomic operations. Use at your own risk */
#if defined(ATOMIC_LIB_DISABLE)
@@ -75,3 +86,4 @@
# define atomic_sub(i, v) (*(v) -= (i))
#endif

#endif /* USER */
2 changes: 2 additions & 0 deletions Common/esif_ccb_atomic_lin_user.h
Original file line number Diff line number Diff line change
@@ -18,6 +18,7 @@

#pragma once

#if defined(ESIF_ATTR_OS_LINUX) && defined(ESIF_ATTR_USER)

/* Linux User: Use native x86/x64 type and __atomic builtin functions [gcc 4.7.0 or higher] */

@@ -68,3 +69,4 @@ typedef volatile atomic_basetype atomic_t;
#define atomic_sub(i, v) __atomic_fetch_sub(v, i, __ATOMIC_SEQ_CST)
#endif /* !DISABLE */

#endif /* LINUX USER */
14 changes: 12 additions & 2 deletions Common/esif_ccb_cpuid.h
Original file line number Diff line number Diff line change
@@ -53,8 +53,6 @@

#pragma once

#include "esif_ccb.h"

/*
* C/C++ OS-Agnostic Universal Implementation of the cpuid intrinsic.
*/
@@ -125,5 +123,17 @@ typedef struct esif_ccb_cpuid_s {

#pragma pack(pop)

#if defined(ESIF_ATTR_KERNEL)
#if defined(ESIF_ATTR_OS_WINDOWS)
#include "esif_ccb_cpuid_win_kern.h"
#elif defined(ESIF_ATTR_OS_LINUX)
#include "esif_ccb_cpuid_lin_kern.h"
#endif
#elif defined(ESIF_ATTR_USER)
#if defined(ESIF_ATTR_OS_WINDOWS)
#include "esif_ccb_cpuid_win_user.h"
#elif defined(ESIF_ATTR_OS_LINUX)
#include "esif_ccb_cpuid_lin_user.h"
#endif

#endif /* USER */
2 changes: 2 additions & 0 deletions Common/esif_ccb_cpuid_lin_user.h
Original file line number Diff line number Diff line change
@@ -18,6 +18,7 @@

#pragma once

#if defined(ESIF_ATTR_OS_LINUX) && defined(ESIF_ATTR_USER)

#include <cpuid.h>

@@ -30,3 +31,4 @@ static ESIF_INLINE void esif_ccb_cpuid(esif_ccb_cpuid_t *cpuidPtr)
&cpuidPtr->edx);
}

#endif /* LINUX USER */
25 changes: 25 additions & 0 deletions Common/esif_ccb_env.h
Original file line number Diff line number Diff line change
@@ -18,9 +18,32 @@

#pragma once

#if defined(ESIF_ATTR_USER)

#include "esif_ccb.h"

#if defined(ESIF_ATTR_OS_WINDOWS)

// Get Environment variable
static ESIF_INLINE char *esif_ccb_getenv(const char *name)
{
char *path = NULL;
size_t len = 0;

if (_dupenv_s(&path, &len, name) != 0)
path = NULL;
return path;
}

static ESIF_INLINE void esif_ccb_envfree(char *name)
{
if (name) {
free(name);
}
}


#elif defined(ESIF_ATTR_OS_LINUX)

#include <stdlib.h>

@@ -29,4 +52,6 @@

#define esif_ccb_envfree(arg) ((void)(0))

#endif /* LINUX */

#endif /* USER */
8 changes: 7 additions & 1 deletion Common/esif_ccb_file.h
Original file line number Diff line number Diff line change
@@ -18,8 +18,14 @@

#pragma once

#include "esif_ccb.h"
#if defined(ESIF_ATTR_USER)

#include "esif_ccb.h"

#if defined(ESIF_ATTR_OS_WINDOWS)
#include "esif_ccb_file_win_user.h"
#elif defined(ESIF_ATTR_OS_LINUX)
#include "esif_ccb_file_lin_user.h"
#endif

#endif /* USER */
2 changes: 2 additions & 0 deletions Common/esif_ccb_file_lin_user.h
Original file line number Diff line number Diff line change
@@ -18,6 +18,7 @@

#pragma once

#if defined(ESIF_ATTR_OS_LINUX) && defined(ESIF_ATTR_USER)

#include <errno.h>
#include <unistd.h>
@@ -290,3 +291,4 @@ static ESIF_INLINE void esif_ccb_file_enum_close(esif_ccb_file_enum_t find_handl
esif_ccb_free(find_handle);
}

#endif /* LINUX USER */
Loading