Bluetooth: controller: split: Move PKT_US into pdu.h
Move the definition of PKT_US into pdu.h so that it can be used by Advertising Extensions implementations too. Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This commit is contained in:
parent
5d6c4a6cb5
commit
ba9b065c13
2 changed files with 50 additions and 48 deletions
|
@ -52,6 +52,56 @@
|
|||
/* Standard allows 2 us timing uncertainty inside the event */
|
||||
#define EVENT_MAFS_MAX_US (EVENT_MAFS_US + 2)
|
||||
|
||||
/*
|
||||
* Macros to return correct Data Channel PDU time
|
||||
* Note: formula is valid for 1M, 2M and Coded S8
|
||||
* see BT spec Version 5.1 Vol 6. Part B, chapters 2.1 and 2.2
|
||||
* for packet formats and thus lengths
|
||||
*
|
||||
* Payload overhead size is the Data Channel PDU Header + the MIC
|
||||
*/
|
||||
#define PAYLOAD_OVERHEAD_SIZE (2 + 4)
|
||||
|
||||
#define PHY_1M BIT(0)
|
||||
#define PHY_2M BIT(1)
|
||||
#define PHY_CODED BIT(2)
|
||||
|
||||
#if defined(CONFIG_BT_CTLR_PHY_CODED)
|
||||
#define CODED_PHY_PREAMBLE_TIME_US 80
|
||||
#define CODED_PHY_ACCESS_ADDRESS_TIME_US 256
|
||||
#define CODED_PHY_CI_TIME_US 16
|
||||
#define CODED_PHY_TERM1_TIME_US 24
|
||||
#define CODED_PHY_CRC_SIZE 24
|
||||
#define CODED_PHY_TERM2_SIZE 3
|
||||
|
||||
#define FEC_BLOCK1_TIME_US (CODED_PHY_ACCESS_ADDRESS_TIME_US + \
|
||||
CODED_PHY_CI_TIME_US + \
|
||||
CODED_PHY_TERM1_TIME_US)
|
||||
#define FEC_BLOCK2_TIME_US(octets) ((((PAYLOAD_OVERHEAD_SIZE + \
|
||||
(octets)) * 8) + \
|
||||
CODED_PHY_CRC_SIZE + \
|
||||
CODED_PHY_TERM2_SIZE) * 8)
|
||||
|
||||
#define PKT_US(octets, phy) (((phy) & PHY_CODED) ? \
|
||||
(CODED_PHY_PREAMBLE_TIME_US + \
|
||||
FEC_BLOCK1_TIME_US + \
|
||||
FEC_BLOCK2_TIME_US(octets)) : \
|
||||
(((PREAMBLE_SIZE(phy) + \
|
||||
ACCESS_ADDR_SIZE + \
|
||||
PAYLOAD_OVERHEAD_SIZE + \
|
||||
(octets) + \
|
||||
CRC_SIZE) * 8) / \
|
||||
BIT(((phy) & 0x03) >> 1)))
|
||||
|
||||
#else /* !CONFIG_BT_CTLR_PHY_CODED */
|
||||
#define PKT_US(octets, phy) ((((PREAMBLE_SIZE(phy)) + \
|
||||
ACCESS_ADDR_SIZE + \
|
||||
PAYLOAD_OVERHEAD_SIZE + \
|
||||
(octets) + \
|
||||
CRC_SIZE) * 8) / \
|
||||
BIT(((phy) & 0x03) >> 1))
|
||||
#endif /* !CONFIG_BT_CTLR_PHY_CODED */
|
||||
|
||||
/* Extra bytes for enqueued node_rx metadata: rssi (always), resolving
|
||||
* index, directed adv report, and mesh channel and instant.
|
||||
*/
|
||||
|
|
|
@ -7,54 +7,6 @@
|
|||
/* Macro to convert time in us to connection interval units */
|
||||
#define RADIO_CONN_EVENTS(x, y) ((uint16_t)(((x) + (y) - 1) / (y)))
|
||||
|
||||
/*
|
||||
* Macros to return correct Data Channel PDU time
|
||||
* Note: formula is valid for 1M, 2M and Coded S8
|
||||
* see BT spec Version 5.1 Vol 6. Part B, chapters 2.1 and 2.2
|
||||
* for packet formats and thus lengths
|
||||
*
|
||||
* Payload overhead size is the Data Channel PDU Header + the MIC
|
||||
*/
|
||||
#define PAYLOAD_OVERHEAD_SIZE (2 + 4)
|
||||
|
||||
#define PHY_1M BIT(0)
|
||||
#define PHY_2M BIT(1)
|
||||
#define PHY_CODED BIT(2)
|
||||
#if defined(CONFIG_BT_CTLR_PHY_CODED)
|
||||
#define CODED_PHY_PREAMBLE_TIME_US (80)
|
||||
#define CODED_PHY_ACCESS_ADDRESS_TIME_US (256)
|
||||
#define CODED_PHY_CI_TIME_US (16)
|
||||
#define CODED_PHY_TERM1_TIME_US (24)
|
||||
#define CODED_PHY_CRC_SIZE (24)
|
||||
#define CODED_PHY_TERM2_SIZE (3)
|
||||
|
||||
#define FEC_BLOCK1_TIME_US (CODED_PHY_ACCESS_ADDRESS_TIME_US + \
|
||||
CODED_PHY_CI_TIME_US + \
|
||||
CODED_PHY_TERM1_TIME_US)
|
||||
#define FEC_BLOCK2_TIME_US(octets) ((((PAYLOAD_OVERHEAD_SIZE + \
|
||||
(octets)) * 8) + \
|
||||
CODED_PHY_CRC_SIZE + \
|
||||
CODED_PHY_TERM2_SIZE) * 8)
|
||||
|
||||
#define PKT_US(octets, phy) (((phy) & PHY_CODED) ? \
|
||||
(CODED_PHY_PREAMBLE_TIME_US + \
|
||||
FEC_BLOCK1_TIME_US + \
|
||||
FEC_BLOCK2_TIME_US(octets)) : \
|
||||
(((PREAMBLE_SIZE(phy) + \
|
||||
ACCESS_ADDR_SIZE + \
|
||||
PAYLOAD_OVERHEAD_SIZE + \
|
||||
(octets) + \
|
||||
CRC_SIZE) * 8) / \
|
||||
BIT(((phy) & 0x03) >> 1)))
|
||||
#else /* !CONFIG_BT_CTLR_PHY_CODED */
|
||||
#define PKT_US(octets, phy) ((((PREAMBLE_SIZE(phy)) + \
|
||||
ACCESS_ADDR_SIZE + \
|
||||
PAYLOAD_OVERHEAD_SIZE + \
|
||||
(octets) + \
|
||||
CRC_SIZE) * 8) / \
|
||||
BIT(((phy) & 0x03) >> 1))
|
||||
#endif /* !CONFIG_BT_CTLR_PHY_CODED */
|
||||
|
||||
struct ll_conn *ll_conn_acquire(void);
|
||||
void ll_conn_release(struct ll_conn *conn);
|
||||
uint16_t ll_conn_handle_get(struct ll_conn *conn);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue