From e4c255de001f2bcee86525c16ea9b18fe4c323ec Mon Sep 17 00:00:00 2001 From: Chris Manton Date: Fri, 29 Jan 2021 15:59:09 -0800 Subject: [PATCH] Move TRACE definitions into trace header file Towards meaningful code Bug: 163134718 Tag: #refactor Test: gd/cert/run Change-Id: Ic59357f9180baa416d8634f557a56948746c9d83 --- internal_include/bt_target.h | 8 ++++++ internal_include/bt_trace.h | 49 ++++++++++++++++++++++++++++++++++ stack/include/bt_types.h | 63 -------------------------------------------- 3 files changed, 57 insertions(+), 63 deletions(-) diff --git a/internal_include/bt_target.h b/internal_include/bt_target.h index 54cded1ed..b0c06f138 100644 --- a/internal_include/bt_target.h +++ b/internal_include/bt_target.h @@ -35,6 +35,14 @@ #include "bt_types.h" /* This must be defined AFTER buildcfg.h */ +#ifndef FALSE +#define FALSE false +#endif + +#ifndef TRUE +#define TRUE true +#endif + //------------------Added from bdroid_buildcfg.h--------------------- #ifndef L2CAP_EXTFEA_SUPPORTED_MASK #define L2CAP_EXTFEA_SUPPORTED_MASK \ diff --git a/internal_include/bt_trace.h b/internal_include/bt_trace.h index 29b236b36..50681ae24 100644 --- a/internal_include/bt_trace.h +++ b/internal_include/bt_trace.h @@ -24,6 +24,55 @@ extern "C" { #endif +/*****************************************************************************/ + +/* Define trace levels */ +typedef enum { + BT_TRACE_LEVEL_NONE = 0, /* No trace messages to be generated */ + BT_TRACE_LEVEL_ERROR = 1, /* Error condition trace messages */ + BT_TRACE_LEVEL_WARNING = 2, /* Warning condition trace messages */ + BT_TRACE_LEVEL_API = 3, /* API traces */ + BT_TRACE_LEVEL_EVENT = 4, /* Debug messages for events */ + BT_TRACE_LEVEL_DEBUG = 5, /* Full debug messages */ + BT_TRACE_LEVEL_VERBOSE = 6, /* Verbose debug messages */ +} tLEGACY_TRACE_LEVEL; + +#define TRACE_CTRL_GENERAL 0x00000000 + +#define TRACE_LAYER_MASK 0x00ff0000 +#define TRACE_GET_LAYER(x) ((((uint32_t)(x)) & TRACE_LAYER_MASK) >> 16) + +#define TRACE_LAYER_NONE 0x00000000 +#define TRACE_LAYER_HCI 0x00070000 +#define TRACE_LAYER_L2CAP 0x00080000 +#define TRACE_LAYER_RFCOMM 0x00090000 +#define TRACE_LAYER_SDP 0x000a0000 +#define TRACE_LAYER_BTM 0x000d0000 +#define TRACE_LAYER_BNEP 0x001b0000 +#define TRACE_LAYER_PAN 0x001c0000 +#define TRACE_LAYER_HID 0x001e0000 +#define TRACE_LAYER_AVP 0x00200000 +#define TRACE_LAYER_A2DP 0x00210000 +#define TRACE_LAYER_SMP 0x00260000 + +#define TRACE_LAYER_MAX_NUM 0x0031 + +#define TRACE_ORG_MASK 0x0000ff00 +#define TRACE_GET_ORG(x) ((((uint32_t)(x)) & TRACE_ORG_MASK) >> 8) + +#define TRACE_ORG_STACK 0x00000000 +#define TRACE_ORG_APPL 0x00000500 +#define TRACE_ORG_USER_SCR 0x00000800 + +#define TRACE_TYPE_MASK 0x000000ff +#define TRACE_GET_TYPE(x) (((uint32_t)(x)) & TRACE_TYPE_MASK) + +#define TRACE_TYPE_ERROR 0x00000000 +#define TRACE_TYPE_WARNING 0x00000001 +#define TRACE_TYPE_API 0x00000002 +#define TRACE_TYPE_EVENT 0x00000003 +#define TRACE_TYPE_DEBUG 0x00000004 + static const char BTE_LOGMSG_MODULE[] = "bte_logmsg_module"; /* BTE tracing IDs for debug purposes */ diff --git a/stack/include/bt_types.h b/stack/include/bt_types.h index c1ac7e8c6..7a0c9859f 100644 --- a/stack/include/bt_types.h +++ b/stack/include/bt_types.h @@ -25,22 +25,6 @@ #include #endif // __cplusplus -#ifndef FALSE -#define FALSE false -#endif - -#ifndef TRUE -#define TRUE true -#endif - -#ifdef __arm -#define PACKED __packed -#define INLINE __inline -#else -#define PACKED -#define INLINE -#endif - /* READ WELL !! * * This section defines global events. These are events that cross layers. @@ -688,51 +672,4 @@ inline std::string DeviceTypeText(tBT_DEVICE_TYPE type) { } #endif // __cplusplus -/*****************************************************************************/ - -/* Define trace levels */ -#define BT_TRACE_LEVEL_NONE 0 /* No trace messages to be generated */ -#define BT_TRACE_LEVEL_ERROR 1 /* Error condition trace messages */ -#define BT_TRACE_LEVEL_WARNING 2 /* Warning condition trace messages */ -#define BT_TRACE_LEVEL_API 3 /* API traces */ -#define BT_TRACE_LEVEL_EVENT 4 /* Debug messages for events */ -#define BT_TRACE_LEVEL_DEBUG 5 /* Full debug messages */ -#define BT_TRACE_LEVEL_VERBOSE 6 /* Verbose debug messages */ - -#define TRACE_CTRL_GENERAL 0x00000000 - -#define TRACE_LAYER_MASK 0x00ff0000 -#define TRACE_GET_LAYER(x) ((((uint32_t)(x)) & TRACE_LAYER_MASK) >> 16) - -#define TRACE_LAYER_NONE 0x00000000 -#define TRACE_LAYER_HCI 0x00070000 -#define TRACE_LAYER_L2CAP 0x00080000 -#define TRACE_LAYER_RFCOMM 0x00090000 -#define TRACE_LAYER_SDP 0x000a0000 -#define TRACE_LAYER_BTM 0x000d0000 -#define TRACE_LAYER_BNEP 0x001b0000 -#define TRACE_LAYER_PAN 0x001c0000 -#define TRACE_LAYER_HID 0x001e0000 -#define TRACE_LAYER_AVP 0x00200000 -#define TRACE_LAYER_A2DP 0x00210000 -#define TRACE_LAYER_SMP 0x00260000 - -#define TRACE_LAYER_MAX_NUM 0x0031 - -#define TRACE_ORG_MASK 0x0000ff00 -#define TRACE_GET_ORG(x) ((((uint32_t)(x)) & TRACE_ORG_MASK) >> 8) - -#define TRACE_ORG_STACK 0x00000000 -#define TRACE_ORG_APPL 0x00000500 -#define TRACE_ORG_USER_SCR 0x00000800 - -#define TRACE_TYPE_MASK 0x000000ff -#define TRACE_GET_TYPE(x) (((uint32_t)(x)) & TRACE_TYPE_MASK) - -#define TRACE_TYPE_ERROR 0x00000000 -#define TRACE_TYPE_WARNING 0x00000001 -#define TRACE_TYPE_API 0x00000002 -#define TRACE_TYPE_EVENT 0x00000003 -#define TRACE_TYPE_DEBUG 0x00000004 - #endif -- 2.11.0