Skip to content

Commit 5ce9c44

Browse files
committed
nimble/phy: nrf5x: Add Channel Sounding to PHY
1 parent c647c08 commit 5ce9c44

File tree

7 files changed

+508
-12
lines changed

7 files changed

+508
-12
lines changed

nimble/controller/include/controller/ble_phy.h

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,19 @@ struct os_mbuf;
6060
#define BLE_PHY_STATE_IDLE (0)
6161
#define BLE_PHY_STATE_RX (1)
6262
#define BLE_PHY_STATE_TX (2)
63+
#define BLE_PHY_STATE_TX_CS_TONE (3)
64+
#define BLE_PHY_STATE_RX_CS_TONE (4)
6365

6466
/* BLE PHY transitions */
6567
#define BLE_PHY_TRANSITION_NONE (0)
6668
#define BLE_PHY_TRANSITION_TO_TX (1)
6769
#define BLE_PHY_TRANSITION_TO_RX (2)
6870
#define BLE_PHY_TRANSITION_TO_TX_ISO_SUBEVENT (3)
6971
#define BLE_PHY_TRANSITION_TO_RX_ISO_SUBEVENT (4)
72+
#define BLE_PHY_TRANSITION_TO_TX_CS_SYNC (5)
73+
#define BLE_PHY_TRANSITION_TO_RX_CS_SYNC (6)
74+
#define BLE_PHY_TRANSITION_TO_TX_CS_TONE (7)
75+
#define BLE_PHY_TRANSITION_TO_RX_CS_TONE (8)
7076

7177
/* PHY error codes */
7278
#define BLE_PHY_ERR_RADIO_STATE (1)
@@ -79,6 +85,16 @@ struct os_mbuf;
7985
/* Maximun PDU length. Includes LL header of 2 bytes and 255 bytes payload. */
8086
#define BLE_PHY_MAX_PDU_LEN (257)
8187

88+
#if MYNEWT_VAL(BLE_CHANNEL_SOUNDING)
89+
#define BLE_PHY_CS_TIMER_NONE (0)
90+
#define BLE_PHY_CS_TIMER_START (1)
91+
#define BLE_PHY_CS_TIMER_CAPTURE (2)
92+
93+
#define BLE_PHY_CS_TONE_MODE_PM (0)
94+
#define BLE_PHY_CS_TONE_MODE_FM (1)
95+
#define BLE_PHY_CS_TONE_MODE_PM_FM (2)
96+
#endif
97+
8298
/* Wait for response timer */
8399
typedef void (*ble_phy_tx_end_func)(void *arg);
84100

@@ -232,6 +248,17 @@ static inline int ble_ll_phy_to_phy_mode(int phy, int phy_options)
232248
return phy_mode;
233249
}
234250

251+
#if MYNEWT_VAL(BLE_CHANNEL_SOUNDING)
252+
/* Get time of the last bit sent, for ToF measurement */
253+
void ble_phy_get_txend_time(uint32_t *cputime, uint32_t *rem_us, uint32_t *rem_ns);
254+
/* Get time of the last bit received, for ToF measurement */
255+
void ble_phy_get_rxend_time(uint32_t *cputime, uint32_t *rem_us, uint32_t *rem_ns);
256+
/* Configure the PHY for CS_SYNC transmission/reception */
257+
int ble_phy_cs_sync_configure(uint8_t chan, uint32_t access_addr);
258+
/* Configure the PHY for CS tone transmission/reception */
259+
int ble_phy_cs_tone_configure(uint8_t chan, uint8_t tone_mode, uint32_t duration_usecs);
260+
#endif
261+
235262
#if MYNEWT_VAL(BLE_LL_DTM)
236263
void ble_phy_enable_dtm(void);
237264
void ble_phy_disable_dtm(void);

0 commit comments

Comments
 (0)