Bluetooth: RFCOMM: Move BT_RFCOMM_BUF_SIZE to rfcomm.h
The buffer `BT_RFCOMM_BUF_SIZE` is used to define the TX buffer size of TX pool. In current implementation, the TX buffer size of RFCOMM cannot be calculated due to the macro `BT_RFCOMM_BUF_SIZE` is defined in internal header file `rfcomm_internal.h`. Move the macro `BT_RFCOMM_BUF_SIZE` form internal header file `rfcomm_internal.h` to interface `rfcomm.h`. Signed-off-by: Lyle Zhu <lyle.zhu@nxp.com>
This commit is contained in:
parent
e8b29aae35
commit
c4090998d3
@ -19,11 +19,27 @@
|
||||
|
||||
#include <zephyr/bluetooth/buf.h>
|
||||
#include <zephyr/bluetooth/conn.h>
|
||||
#include <zephyr/bluetooth/l2cap.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** RFCOMM Maximum Header Size. The length could be 2 bytes, it depends on information length. */
|
||||
#define BT_RFCOMM_HDR_MAX_SIZE 4
|
||||
/** RFCOMM FCS Size */
|
||||
#define BT_RFCOMM_FCS_SIZE 1
|
||||
|
||||
/** @brief Helper to calculate needed buffer size for RFCOMM PDUs.
|
||||
* Useful for creating buffer pools.
|
||||
*
|
||||
* @param mtu Needed RFCOMM PDU MTU.
|
||||
*
|
||||
* @return Needed buffer size to match the requested RFCOMM PDU MTU.
|
||||
*/
|
||||
#define BT_RFCOMM_BUF_SIZE(mtu) \
|
||||
BT_L2CAP_BUF_SIZE(BT_RFCOMM_HDR_MAX_SIZE + BT_RFCOMM_FCS_SIZE + (mtu))
|
||||
|
||||
/* RFCOMM channels (1-30): pre-allocated for profiles to avoid conflicts */
|
||||
enum {
|
||||
BT_RFCOMM_CHAN_HFP_HF = 1,
|
||||
|
||||
@ -133,15 +133,6 @@ struct bt_rfcomm_rpn {
|
||||
#define BT_RFCOMM_CHECK_MTU(mtu) (!!((mtu) >= BT_RFCOMM_SIG_MIN_MTU && \
|
||||
(mtu) <= BT_RFCOMM_SIG_MAX_MTU))
|
||||
|
||||
/* Helper to calculate needed outgoing buffer size.
|
||||
* Length in rfcomm header can be two bytes depending on user data length.
|
||||
* One byte in the tail should be reserved for FCS.
|
||||
*/
|
||||
#define BT_RFCOMM_BUF_SIZE(mtu) (BT_BUF_RESERVE + \
|
||||
BT_HCI_ACL_HDR_SIZE + BT_L2CAP_HDR_SIZE + \
|
||||
sizeof(struct bt_rfcomm_hdr) + 1 + (mtu) + \
|
||||
BT_RFCOMM_FCS_SIZE)
|
||||
|
||||
#define BT_RFCOMM_GET_DLCI(addr) (((addr) & 0xfc) >> 2)
|
||||
#define BT_RFCOMM_GET_FRAME_TYPE(ctrl) ((ctrl) & 0xef)
|
||||
#define BT_RFCOMM_GET_MSG_TYPE(type) (((type) & 0xfc) >> 2)
|
||||
@ -192,7 +183,6 @@ struct bt_rfcomm_rpn {
|
||||
|
||||
/* Length can be 2 bytes depending on data size */
|
||||
#define BT_RFCOMM_HDR_SIZE (sizeof(struct bt_rfcomm_hdr) + 1)
|
||||
#define BT_RFCOMM_FCS_SIZE 1
|
||||
|
||||
#define BT_RFCOMM_FCS_LEN_UIH 2
|
||||
#define BT_RFCOMM_FCS_LEN_NON_UIH 3
|
||||
|
||||
Loading…
Reference in New Issue
Block a user