diff options
author | 2024-07-26 17:02:04 -0700 | |
---|---|---|
committer | 2024-07-30 14:54:22 -0700 | |
commit | bef7a499473d625afb9b1731a9fd32de6a8bcced (patch) | |
tree | 15ff6cf744bd5e9439d1c7cae304585be93d04ce | |
parent | 9524d040b40f775c7a9ad76ea4bc543a6d808a38 (diff) |
RFCOMM: move from bt_target to rfcdefs.h
Move all RFCOMM related defines from bt_target.h to rfcdefs.h
Bug: 355732703
Test: m com.android.btservices
Flag: EXEMPT mechanical refactor
Change-Id: Ie9031b491cd4d541ff5b7acb6ff3ee682584b20d
-rw-r--r-- | system/bta/include/bta_jv_api.h | 1 | ||||
-rw-r--r-- | system/bta/jv/bta_jv_act.cc | 1 | ||||
-rw-r--r-- | system/internal_include/bt_target.h | 91 | ||||
-rw-r--r-- | system/stack/include/rfcdefs.h | 57 | ||||
-rw-r--r-- | system/stack/rfcomm/port_api.cc | 2 | ||||
-rw-r--r-- | system/stack/rfcomm/rfc_ts_frames.cc | 1 |
6 files changed, 58 insertions, 95 deletions
diff --git a/system/bta/include/bta_jv_api.h b/system/bta/include/bta_jv_api.h index 3eabbad6db..20a25b74c8 100644 --- a/system/bta/include/bta_jv_api.h +++ b/system/bta/include/bta_jv_api.h @@ -34,6 +34,7 @@ #include "internal_include/bt_target.h" #include "stack/include/bt_hdr.h" #include "stack/include/l2c_api.h" +#include "stack/include/rfcdefs.h" #include "types/bluetooth/uuid.h" #include "types/raw_address.h" diff --git a/system/bta/jv/bta_jv_act.cc b/system/bta/jv/bta_jv_act.cc index 5c201230b5..ba74408304 100644 --- a/system/bta/jv/bta_jv_act.cc +++ b/system/bta/jv/bta_jv_act.cc @@ -50,6 +50,7 @@ #include "stack/include/gap_api.h" #include "stack/include/l2cdefs.h" #include "stack/include/port_api.h" +#include "stack/include/rfcdefs.h" #include "stack/include/sdp_api.h" #include "types/bluetooth/uuid.h" #include "types/raw_address.h" diff --git a/system/internal_include/bt_target.h b/system/internal_include/bt_target.h index 609dd68c6e..24e1cb32e0 100644 --- a/system/internal_include/bt_target.h +++ b/system/internal_include/bt_target.h @@ -17,8 +17,7 @@ * ******************************************************************************/ -#ifndef BT_TARGET_H -#define BT_TARGET_H +#pragma once #ifndef FALSE #define FALSE false @@ -39,10 +38,6 @@ #define BTUI_OPS_FORMATS (BTA_OP_VCARD21_MASK | BTA_OP_ANY_MASK) #endif -#ifndef BTA_RFC_MTU_SIZE -#define BTA_RFC_MTU_SIZE (L2CAP_MTU_SIZE - L2CAP_MIN_OFFSET - RFCOMM_DATA_OVERHEAD) -#endif - #ifndef BTA_PAN_INCLUDED #define BTA_PAN_INCLUDED TRUE #endif @@ -117,16 +112,6 @@ #define SDP_DATA_BUF_SIZE BT_DEFAULT_BUFFER_SIZE #endif -/* Sends RFCOMM command packets. */ -#ifndef RFCOMM_CMD_BUF_SIZE -#define RFCOMM_CMD_BUF_SIZE BT_SMALL_BUFFER_SIZE -#endif - -/* Sends RFCOMM data packets. */ -#ifndef RFCOMM_DATA_BUF_SIZE -#define RFCOMM_DATA_BUF_SIZE BT_DEFAULT_BUFFER_SIZE -#endif - /* Sends L2CAP packets to the peer and HCI messages to the controller. */ #ifndef L2CAP_CMD_BUF_SIZE #define L2CAP_CMD_BUF_SIZE BT_SMALL_BUFFER_SIZE @@ -489,72 +474,6 @@ /****************************************************************************** * - * RFCOMM - * - *****************************************************************************/ - -/* The maximum number of ports supported. */ -#ifndef MAX_RFC_PORTS -#define MAX_RFC_PORTS 30 -#endif - -/* The maximum simultaneous links to different devices. */ -#ifndef MAX_BD_CONNECTIONS -#define MAX_BD_CONNECTIONS 16 -#endif - -/* The port receive queue low watermark level, in bytes. */ -#ifndef PORT_RX_LOW_WM -#define PORT_RX_LOW_WM (BTA_RFC_MTU_SIZE * PORT_RX_BUF_LOW_WM) -#endif - -/* The port receive queue high watermark level, in bytes. */ -#ifndef PORT_RX_HIGH_WM -#define PORT_RX_HIGH_WM (BTA_RFC_MTU_SIZE * PORT_RX_BUF_HIGH_WM) -#endif - -/* The port receive queue critical watermark level, in bytes. */ -#ifndef PORT_RX_CRITICAL_WM -#define PORT_RX_CRITICAL_WM (BTA_RFC_MTU_SIZE * PORT_RX_BUF_CRITICAL_WM) -#endif - -/* The port receive queue low watermark level, in number of buffers. */ -#ifndef PORT_RX_BUF_LOW_WM -#define PORT_RX_BUF_LOW_WM 4 -#endif - -/* The port receive queue high watermark level, in number of buffers. */ -#ifndef PORT_RX_BUF_HIGH_WM -#define PORT_RX_BUF_HIGH_WM 10 -#endif - -/* The port receive queue critical watermark level, in number of buffers. */ -#ifndef PORT_RX_BUF_CRITICAL_WM -#define PORT_RX_BUF_CRITICAL_WM 15 -#endif - -/* The port transmit queue high watermark level, in bytes. */ -#ifndef PORT_TX_HIGH_WM -#define PORT_TX_HIGH_WM (BTA_RFC_MTU_SIZE * PORT_TX_BUF_HIGH_WM) -#endif - -/* The port transmit queue critical watermark level, in bytes. */ -#ifndef PORT_TX_CRITICAL_WM -#define PORT_TX_CRITICAL_WM (BTA_RFC_MTU_SIZE * PORT_TX_BUF_CRITICAL_WM) -#endif - -/* The port transmit queue high watermark level, in number of buffers. */ -#ifndef PORT_TX_BUF_HIGH_WM -#define PORT_TX_BUF_HIGH_WM 10 -#endif - -/* The port transmit queue high watermark level, in number of buffers. */ -#ifndef PORT_TX_BUF_CRITICAL_WM -#define PORT_TX_BUF_CRITICAL_WM 15 -#endif - -/****************************************************************************** - * * BNEP * *****************************************************************************/ @@ -766,11 +685,3 @@ #ifndef BTA_EIR_SERVER_NUM_CUSTOM_UUID #define BTA_EIR_SERVER_NUM_CUSTOM_UUID 8 #endif - -/****************************************************************************** - * - * Tracing: Include trace header file here. - * - *****************************************************************************/ - -#endif /* BT_TARGET_H */ diff --git a/system/stack/include/rfcdefs.h b/system/stack/include/rfcdefs.h index 7c5249c6ec..c778492a91 100644 --- a/system/stack/include/rfcdefs.h +++ b/system/stack/include/rfcdefs.h @@ -22,19 +22,35 @@ * ****************************************************************************/ -#ifndef RFCDEFS_H -#define RFCDEFS_H +#pragma once + /* * Server Channel Numbers (SCN) range between 1 and 30, inclusive */ #define RFCOMM_MAX_SCN 30 /* + * The maximum number of ports supported. + */ +#define MAX_RFC_PORTS 30 + +/* + * The maximum simultaneous links to different devices. + */ +#define MAX_BD_CONNECTIONS 16 + +/* * If nothing is negotiated MTU should be 127 */ #define RFCOMM_DEFAULT_MTU 127 /* + * RFCOMM buffer sizes + */ +#define RFCOMM_CMD_BUF_SIZE BT_SMALL_BUFFER_SIZE // command packet buffer size +#define RFCOMM_DATA_BUF_SIZE BT_DEFAULT_BUFFER_SIZE // data packet buffer size + +/* * Define used by RFCOMM TS frame types */ #define RFCOMM_SABME 0x2F // Start Asynchronous Balanced Mode (startup command) @@ -235,4 +251,39 @@ #define RFCOMM_MX_RLS 0x50 #define RFCOMM_MX_RLS_LEN 2 -#endif + +/* + * Define RFCOMM port rx and tx queue watermarks + */ +// MTU size used to calculate watermark levels +#define BTA_RFC_MTU_SIZE (L2CAP_MTU_SIZE - L2CAP_MIN_OFFSET - RFCOMM_DATA_OVERHEAD) + +// The port receive queue low watermark level, in number of buffers. +#define PORT_RX_BUF_LOW_WM 4 + +// The port receive queue high watermark level, in number of buffers. +#define PORT_RX_BUF_HIGH_WM 10 + +// The port receive queue critical watermark level, in number of buffers. +#define PORT_RX_BUF_CRITICAL_WM 15 + +// The port receive queue low watermark level, in bytes. +#define PORT_RX_LOW_WM (BTA_RFC_MTU_SIZE * PORT_RX_BUF_LOW_WM) + +// The port receive queue high watermark level, in bytes. +#define PORT_RX_HIGH_WM (BTA_RFC_MTU_SIZE * PORT_RX_BUF_HIGH_WM) + +// The port receive queue critical watermark level, in bytes. +#define PORT_RX_CRITICAL_WM (BTA_RFC_MTU_SIZE * PORT_RX_BUF_CRITICAL_WM) + +// The port transmit queue high watermark level, in number of buffers. +#define PORT_TX_BUF_HIGH_WM 10 + +// The port transmit queue high watermark level, in number of buffers. +#define PORT_TX_BUF_CRITICAL_WM 15 + +// The port transmit queue high watermark level, in bytes. +#define PORT_TX_HIGH_WM (BTA_RFC_MTU_SIZE * PORT_TX_BUF_HIGH_WM) + +// The port transmit queue critical watermark level, in bytes. +#define PORT_TX_CRITICAL_WM (BTA_RFC_MTU_SIZE * PORT_TX_BUF_CRITICAL_WM) diff --git a/system/stack/rfcomm/port_api.cc b/system/stack/rfcomm/port_api.cc index 1eed863a84..6bfc6c1330 100644 --- a/system/stack/rfcomm/port_api.cc +++ b/system/stack/rfcomm/port_api.cc @@ -31,7 +31,6 @@ #include <cstdint> -#include "internal_include/bt_target.h" #include "internal_include/bt_trace.h" #include "os/logging/log_adapter.h" #include "osi/include/allocator.h" @@ -40,6 +39,7 @@ #include "stack/include/bt_types.h" #include "stack/include/bt_uuid16.h" #include "stack/include/btm_log_history.h" +#include "stack/include/rfcdefs.h" #include "stack/rfcomm/rfc_int.h" #include "types/raw_address.h" diff --git a/system/stack/rfcomm/rfc_ts_frames.cc b/system/stack/rfcomm/rfc_ts_frames.cc index e73bab5cf6..3a44afd061 100644 --- a/system/stack/rfcomm/rfc_ts_frames.cc +++ b/system/stack/rfcomm/rfc_ts_frames.cc @@ -28,7 +28,6 @@ #include <cstdint> -#include "internal_include/bt_target.h" #include "os/logging/log_adapter.h" #include "osi/include/allocator.h" #include "stack/include/bt_hdr.h" |