diff options
author | Paul Kocialkowski <contact@paulk.fr> | 2013-12-28 11:51:03 +0100 |
---|---|---|
committer | Jookia <166291@gmail.com> | 2016-11-05 16:19:31 +1100 |
commit | 16753d39744b496b3eeeea896eed7def57fdf67a (patch) | |
tree | 5670e235a25f12ca3b25dbfa1de731af0891b086 /sensors/akmdfs/AKFS_Common.h | |
parent | e5d2aee9fb44d1fa695c44d332443f6e0d3899c5 (diff) | |
download | device_samsung_i9100-16753d39744b496b3eeeea896eed7def57fdf67a.zip device_samsung_i9100-16753d39744b496b3eeeea896eed7def57fdf67a.tar.gz device_samsung_i9100-16753d39744b496b3eeeea896eed7def57fdf67a.tar.bz2 |
SMDK4210 Sensors
Cherry-picked!
Conflict: "initial L bringup" changes sensor API, follow suit.
Conflict: libsensors changes, doesn't matter, just delete it.
Diffstat (limited to 'sensors/akmdfs/AKFS_Common.h')
-rw-r--r-- | sensors/akmdfs/AKFS_Common.h | 141 |
1 files changed, 141 insertions, 0 deletions
diff --git a/sensors/akmdfs/AKFS_Common.h b/sensors/akmdfs/AKFS_Common.h new file mode 100644 index 0000000..7780801 --- /dev/null +++ b/sensors/akmdfs/AKFS_Common.h @@ -0,0 +1,141 @@ +/****************************************************************************** + * + * Copyright (C) 2012 Asahi Kasei Microdevices Corporation, Japan + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + ******************************************************************************/ +#ifndef AKFS_INC_COMMON_H +#define AKFS_INC_COMMON_H + +#ifdef WIN32 +#ifndef _WIN32_WINNT +#define _WIN32_WINNT 0x0501 +#endif + +#include <windows.h> +#include <stdio.h> +#include <stdlib.h> +#include <conio.h> +#include <stdarg.h> +#include <crtdbg.h> +#include "Android.h" + +#define DBG_LEVEL DBG_LEVEL4 +#define ENABLE_AKMDEBUG 1 + +#else +#include <stdio.h> /* frpintf */ +#include <stdlib.h> /* atoi */ +#include <string.h> /* memset */ +#include <unistd.h> +#include <stdarg.h> /* va_list */ +#include <utils/Log.h> /* ALOGV */ +#include <errno.h> /* errno */ + +#endif + +/*** Constant definition ******************************************************/ +#define AKM_TRUE 1 /*!< Represents true */ +#define AKM_FALSE 0 /*!< Represents false */ +#define AKM_SUCCESS 1 /*!< Represents success */ +#define AKM_FAIL 0 /*!< Represents fail */ + +#define DBG_LEVEL0 0 /* Critical */ +#define DBG_LEVEL1 1 /* Notice */ +#define DBG_LEVEL2 2 /* Information */ +#define DBG_LEVEL3 3 /* Debug */ +#define DBG_LEVEL4 4 /* Verbose */ + +#ifndef DBG_LEVEL +#define DBG_LEVEL DBG_LEVEL0 +#endif + +#define DATA_AREA01 0x0001 +#define DATA_AREA02 0x0002 +#define DATA_AREA03 0x0004 +#define DATA_AREA04 0x0008 +#define DATA_AREA05 0x0010 +#define DATA_AREA06 0x0020 +#define DATA_AREA07 0x0040 +#define DATA_AREA08 0x0080 +#define DATA_AREA09 0x0100 +#define DATA_AREA10 0x0200 +#define DATA_AREA11 0x0400 +#define DATA_AREA12 0x0800 +#define DATA_AREA13 0x1000 +#define DATA_AREA14 0x2000 +#define DATA_AREA15 0x4000 +#define DATA_AREA16 0x8000 + + +/* Debug area definition */ +#define AKMDATA_DUMP DATA_AREA01 /*<! Dump data */ +#define AKMDATA_BDATA DATA_AREA02 /*<! BDATA */ +#define AKMDATA_MAG DATA_AREA03 /*<! Magnetic Field */ +#define AKMDATA_ACC DATA_AREA04 /*<! Accelerometer */ +#define AKMDATA_ORI DATA_AREA05 /*<! Orientation */ +#define AKMDATA_GETINTERVAL DATA_AREA06 +#define AKMDATA_LOOP DATA_AREA07 +#define AKMDATA_DRV DATA_AREA08 + +#ifndef ENABLE_AKMDEBUG +#define ENABLE_AKMDEBUG 0 /* Eanble debug output when it is 1. */ +#endif + +#define OPMODE_CONSOLE 0x01 +#define OPMODE_FST 0x02 + +/***** Debug Level Output *************************************/ +#if ENABLE_AKMDEBUG +#define AKMDEBUG(level, format, ...) \ + (((level) <= DBG_LEVEL) \ + ? (fprintf(stdout, (format), ##__VA_ARGS__)) \ + : ((void)0)) +#else +#define AKMDEBUG(level, format, ...) +#endif + +/***** Dbg Zone Output ***************************************/ +#if ENABLE_AKMDEBUG +#define AKMDATA(flag, format, ...) \ + ((((int)flag) & g_dbgzone) \ + ? (fprintf(stdout, (format), ##__VA_ARGS__)) \ + : ((void)0)) +#else +#define AKMDATA(flag, format, ...) +#endif + +/***** Log output ********************************************/ +#ifdef AKM_LOG_ENABLE +#define AKM_LOG(format, ...) ALOGD((format), ##__VA_ARGS__) +#else +#define AKM_LOG(format, ...) +#endif + +/***** Error output *******************************************/ +#define AKMERROR \ + ALOGE("%s:%d Error.", __FUNCTION__, __LINE__) + +#define AKMERROR_STR(api) \ + ALOGE("%s:%d %s Error (%s).", \ + __FUNCTION__, __LINE__, (api), strerror(errno)) + +/*** Type declaration *********************************************************/ + +/*** Global variables *********************************************************/ + +/*** Prototype of function ****************************************************/ + +#endif /* AKMD_INC_AKCOMMON_H */ + |