You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by GitBox <gi...@apache.org> on 2020/07/07 13:18:50 UTC
[GitHub] [mynewt-nimble] sjanc opened a new pull request #841: nimble/drivers: Add support for nRF5340 radio
sjanc opened a new pull request #841:
URL: https://github.com/apache/mynewt-nimble/pull/841
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [mynewt-nimble] apache-mynewt-bot commented on pull request #841: nimble/drivers: Add support for nRF5340 radio
Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on pull request #841:
URL: https://github.com/apache/mynewt-nimble/pull/841#issuecomment-655396066
<!-- style-bot -->
## Style check summary
### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
#### nimble/drivers/nrf5340/src/ble_phy.c
<details>
```diff
@@ -63,23 +63,32 @@
#define DPPI_PUBLISH_RTC0_EVENTS_COMPARE_0 ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << RTC_PUBLISH_COMPARE_CHIDX_Pos) | \
(RTC_PUBLISH_COMPARE_EN_Enabled << RTC_PUBLISH_COMPARE_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_START(_enable) ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << TIMER_SUBSCRIBE_START_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_START(_enable) ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << \
+ TIMER_SUBSCRIBE_START_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_START_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE1(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE1(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << \
+ TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE2(_enable) ((DPPI_CH_RADIO_EVENTS_END << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE2(_enable) ((DPPI_CH_RADIO_EVENTS_END << \
+ TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE3(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE3(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << \
+ TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_SUBSCRIBE_RADIO_TASKS_DISABLE(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_3 << RADIO_SUBSCRIBE_DISABLE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_RADIO_TASKS_DISABLE(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_3 << \
+ RADIO_SUBSCRIBE_DISABLE_CHIDX_Pos) | \
((_enable) << RADIO_SUBSCRIBE_DISABLE_EN_Pos))
-#define DPPI_SUBSCRIBE_RADIO_TASKS_RXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_RXEN_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_RADIO_TASKS_RXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << \
+ RADIO_SUBSCRIBE_RXEN_CHIDX_Pos) | \
((_enable) << RADIO_SUBSCRIBE_RXEN_EN_Pos))
-#define DPPI_SUBSCRIBE_RADIO_TASKS_TXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_TXEN_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_RADIO_TASKS_TXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << \
+ RADIO_SUBSCRIBE_TXEN_CHIDX_Pos) | \
((_enable) << RADIO_SUBSCRIBE_TXEN_EN_Pos))
-#define DPPI_SUBSCRIBE_AAR_TASKS_START(_enable) ((DPPI_CH_RADIO_EVENTS_BCMATCH << AAR_SUBSCRIBE_START_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_AAR_TASKS_START(_enable) ((DPPI_CH_RADIO_EVENTS_BCMATCH << \
+ AAR_SUBSCRIBE_START_CHIDX_Pos) | \
((_enable) << AAR_SUBSCRIBE_START_EN_Pos))
-#define DPPI_SUBSCRIBE_CCM_TASKS_CRYPT(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << CCM_SUBSCRIBE_CRYPT_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_CCM_TASKS_CRYPT(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << \
+ CCM_SUBSCRIBE_CRYPT_CHIDX_Pos) | \
((_enable) << CCM_SUBSCRIBE_CRYPT_EN_Pos))
extern uint8_t g_nrf_num_irks;
@@ -104,23 +113,22 @@
/* NRF_RADIO_NS->PCNF0 configuration values */
#define NRF_PCNF0 (NRF_LFLEN_BITS << RADIO_PCNF0_LFLEN_Pos) | \
- (RADIO_PCNF0_S1INCL_Msk) | \
- (NRF_S0LEN << RADIO_PCNF0_S0LEN_Pos) | \
- (NRF_S1LEN_BITS << RADIO_PCNF0_S1LEN_Pos)
+ (RADIO_PCNF0_S1INCL_Msk) | \
+ (NRF_S0LEN << RADIO_PCNF0_S0LEN_Pos) | \
+ (NRF_S1LEN_BITS << RADIO_PCNF0_S1LEN_Pos)
#define NRF_PCNF0_1M (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_8bit << RADIO_PCNF0_PLEN_Pos)
+ (RADIO_PCNF0_PLEN_8bit << RADIO_PCNF0_PLEN_Pos)
#define NRF_PCNF0_2M (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_16bit << RADIO_PCNF0_PLEN_Pos)
+ (RADIO_PCNF0_PLEN_16bit << RADIO_PCNF0_PLEN_Pos)
#define NRF_PCNF0_CODED (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_LongRange << RADIO_PCNF0_PLEN_Pos) | \
- (NRF_CILEN_BITS << RADIO_PCNF0_CILEN_Pos) | \
- (NRF_TERMLEN_BITS << RADIO_PCNF0_TERMLEN_Pos)
+ (RADIO_PCNF0_PLEN_LongRange << RADIO_PCNF0_PLEN_Pos) | \
+ (NRF_CILEN_BITS << RADIO_PCNF0_CILEN_Pos) | \
+ (NRF_TERMLEN_BITS << RADIO_PCNF0_TERMLEN_Pos)
/* BLE PHY data structure */
-struct ble_phy_obj
-{
+struct ble_phy_obj {
uint8_t phy_stats_initialized;
- int8_t phy_txpwr_dbm;
+ int8_t phy_txpwr_dbm;
uint8_t phy_chan;
uint8_t phy_state;
uint8_t phy_transition;
@@ -133,7 +141,7 @@
uint8_t phy_tx_phy_mode;
uint8_t phy_rx_phy_mode;
uint8_t phy_bcc_offset;
- int8_t rx_pwr_compensation;
+ int8_t rx_pwr_compensation;
uint32_t phy_aar_scratch;
uint32_t phy_access_address;
struct ble_mbuf_hdr rxhdr;
@@ -155,7 +163,7 @@
/* RF center frequency for each channel index (offset from 2400 MHz) */
static const uint8_t g_ble_phy_chan_freq[BLE_PHY_NUM_CHANS] = {
- 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, /* 0-9 */
+ 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, /* 0-9 */
24, 28, 30, 32, 34, 36, 38, 40, 42, 44, /* 10-19 */
46, 48, 50, 52, 54, 56, 58, 60, 62, 64, /* 20-29 */
66, 68, 70, 72, 74, 76, 78, 2, 26, 80, /* 30-39 */
@@ -207,36 +215,36 @@
/* Statistics */
STATS_SECT_START(ble_phy_stats)
- STATS_SECT_ENTRY(phy_isrs)
- STATS_SECT_ENTRY(tx_good)
- STATS_SECT_ENTRY(tx_fail)
- STATS_SECT_ENTRY(tx_late)
- STATS_SECT_ENTRY(tx_bytes)
- STATS_SECT_ENTRY(rx_starts)
- STATS_SECT_ENTRY(rx_aborts)
- STATS_SECT_ENTRY(rx_valid)
- STATS_SECT_ENTRY(rx_crc_err)
- STATS_SECT_ENTRY(rx_late)
- STATS_SECT_ENTRY(radio_state_errs)
- STATS_SECT_ENTRY(rx_hw_err)
- STATS_SECT_ENTRY(tx_hw_err)
+STATS_SECT_ENTRY(phy_isrs)
+STATS_SECT_ENTRY(tx_good)
+STATS_SECT_ENTRY(tx_fail)
+STATS_SECT_ENTRY(tx_late)
+STATS_SECT_ENTRY(tx_bytes)
+STATS_SECT_ENTRY(rx_starts)
+STATS_SECT_ENTRY(rx_aborts)
+STATS_SECT_ENTRY(rx_valid)
+STATS_SECT_ENTRY(rx_crc_err)
+STATS_SECT_ENTRY(rx_late)
+STATS_SECT_ENTRY(radio_state_errs)
+STATS_SECT_ENTRY(rx_hw_err)
+STATS_SECT_ENTRY(tx_hw_err)
STATS_SECT_END
STATS_SECT_DECL(ble_phy_stats) ble_phy_stats;
STATS_NAME_START(ble_phy_stats)
- STATS_NAME(ble_phy_stats, phy_isrs)
- STATS_NAME(ble_phy_stats, tx_good)
- STATS_NAME(ble_phy_stats, tx_fail)
- STATS_NAME(ble_phy_stats, tx_late)
- STATS_NAME(ble_phy_stats, tx_bytes)
- STATS_NAME(ble_phy_stats, rx_starts)
- STATS_NAME(ble_phy_stats, rx_aborts)
- STATS_NAME(ble_phy_stats, rx_valid)
- STATS_NAME(ble_phy_stats, rx_crc_err)
- STATS_NAME(ble_phy_stats, rx_late)
- STATS_NAME(ble_phy_stats, radio_state_errs)
- STATS_NAME(ble_phy_stats, rx_hw_err)
- STATS_NAME(ble_phy_stats, tx_hw_err)
+STATS_NAME(ble_phy_stats, phy_isrs)
+STATS_NAME(ble_phy_stats, tx_good)
+STATS_NAME(ble_phy_stats, tx_fail)
+STATS_NAME(ble_phy_stats, tx_late)
+STATS_NAME(ble_phy_stats, tx_bytes)
+STATS_NAME(ble_phy_stats, rx_starts)
+STATS_NAME(ble_phy_stats, rx_aborts)
+STATS_NAME(ble_phy_stats, rx_valid)
+STATS_NAME(ble_phy_stats, rx_crc_err)
+STATS_NAME(ble_phy_stats, rx_late)
+STATS_NAME(ble_phy_stats, radio_state_errs)
+STATS_NAME(ble_phy_stats, rx_hw_err)
+STATS_NAME(ble_phy_stats, tx_hw_err)
STATS_NAME_END(ble_phy_stats)
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LE_ENCRYPTION)
@@ -254,8 +262,7 @@
static uint32_t nrf_encrypt_scratchpad[NRF_ENC_SCRATCH_WORDS];
-struct nrf_ccm_data
-{
+struct nrf_ccm_data {
uint8_t key[16];
uint64_t pkt_counter;
uint8_t dir_bit;
@@ -323,16 +330,16 @@
{
#if (BLE_LL_BT5_PHY_SUPPORTED == 1)
switch (g_ble_phy_data.phy_cur_phy_mode) {
- case BLE_PHY_MODE_1M:
- return BLE_PHY_1M;
- case BLE_PHY_MODE_2M:
- return BLE_PHY_2M;
- case BLE_PHY_MODE_CODED_125KBPS:
- case BLE_PHY_MODE_CODED_500KBPS:
- return BLE_PHY_CODED;
- default:
- assert(0);
- return -1;
+ case BLE_PHY_MODE_1M:
+ return BLE_PHY_1M;
+ case BLE_PHY_MODE_2M:
+ return BLE_PHY_2M;
+ case BLE_PHY_MODE_CODED_125KBPS:
+ case BLE_PHY_MODE_CODED_500KBPS:
+ return BLE_PHY_CODED;
+ default:
+ assert(0);
+ return -1;
}
#else
return BLE_PHY_1M;
@@ -399,10 +406,10 @@
" adds %[src], %[src], r4 \n"
" adds %[dst], %[dst], r4 \n"
: [dst] "+r" (dst), [src] "+r" (src),
- [len] "+r" (copy_len)
+ [len] "+r" (copy_len)
:
: "r3", "r4", "memory"
- );
+ );
if ((rem_len < 4) && (block_rem_len >= rem_len)) {
break;
@@ -424,7 +431,7 @@
: [len] "+r" (rem_len)
: [dst] "r" (dst), [src] "r" (src)
: "r3", "memory"
- );
+ );
/* Copy header */
memcpy(BLE_MBUF_HDR_PTR(rxpdu), &g_ble_phy_data.rxhdr,
@@ -715,7 +722,7 @@
NRF_CCM_NS->OUTPTR = (uint32_t)dptr;
NRF_CCM_NS->SCRATCHPTR = (uint32_t)&nrf_encrypt_scratchpad[0];
NRF_CCM_NS->MODE = CCM_MODE_LENGTH_Msk | CCM_MODE_MODE_Decryption |
- ble_phy_get_ccm_datarate();
+ ble_phy_get_ccm_datarate();
NRF_CCM_NS->CNFPTR = (uint32_t)&nrf_ccm_data;
NRF_CCM_NS->SHORTS = 0;
NRF_CCM_NS->EVENTS_ERROR = 0;
@@ -760,7 +767,7 @@
* to take this into account when setting up BCC.
*/
if (g_ble_phy_data.phy_cur_phy_mode == BLE_PHY_MODE_CODED_125KBPS ||
- g_ble_phy_data.phy_cur_phy_mode == BLE_PHY_MODE_CODED_500KBPS) {
+ g_ble_phy_data.phy_cur_phy_mode == BLE_PHY_MODE_CODED_500KBPS) {
g_ble_phy_data.phy_bcc_offset = 5;
} else {
g_ble_phy_data.phy_bcc_offset = 0;
@@ -777,10 +784,10 @@
NRF_RADIO_NS->EVENTS_RSSIEND = 0;
NRF_RADIO_NS->EVENTS_CRCOK = 0;
NRF_RADIO_NS->SHORTS = RADIO_SHORTS_END_DISABLE_Msk |
- RADIO_SHORTS_READY_START_Msk |
- RADIO_SHORTS_ADDRESS_BCSTART_Msk |
- RADIO_SHORTS_ADDRESS_RSSISTART_Msk |
- RADIO_SHORTS_DISABLED_RSSISTOP_Msk;
+ RADIO_SHORTS_READY_START_Msk |
+ RADIO_SHORTS_ADDRESS_BCSTART_Msk |
+ RADIO_SHORTS_ADDRESS_RSSISTART_Msk |
+ RADIO_SHORTS_DISABLED_RSSISTOP_Msk;
NRF_RADIO_NS->INTENSET = RADIO_INTENSET_ADDRESS_Msk;
}
@@ -888,10 +895,10 @@
* using CI field.
*/
if ((phy == BLE_PHY_MODE_CODED_125KBPS) ||
- (phy == BLE_PHY_MODE_CODED_500KBPS)) {
+ (phy == BLE_PHY_MODE_CODED_500KBPS)) {
phy = NRF_RADIO_NS->PDUSTAT & RADIO_PDUSTAT_CISTAT_Msk ?
- BLE_PHY_MODE_CODED_500KBPS :
- BLE_PHY_MODE_CODED_125KBPS;
+ BLE_PHY_MODE_CODED_500KBPS :
+ BLE_PHY_MODE_CODED_125KBPS;
}
#endif
@@ -1125,7 +1132,7 @@
NRF_RADIO_NS->EVENTS_BCMATCH = 0;
NRF_AAR_NS->SUBSCRIBE_START = DPPI_SUBSCRIBE_AAR_TASKS_START(1);
NRF_RADIO_NS->BCC = (BLE_LL_PDU_HDR_LEN + adva_offset + BLE_DEV_ADDR_LEN) * 8 +
- g_ble_phy_data.phy_bcc_offset;
+ g_ble_phy_data.phy_bcc_offset;
}
#endif
@@ -1252,16 +1259,16 @@
/* XXX: should maxlen be 251 for encryption? */
NRF_RADIO_NS->PCNF1 = NRF_MAXLEN |
- (RADIO_PCNF1_ENDIAN_Little << RADIO_PCNF1_ENDIAN_Pos) |
- (NRF_BALEN << RADIO_PCNF1_BALEN_Pos) |
- RADIO_PCNF1_WHITEEN_Msk;
+ (RADIO_PCNF1_ENDIAN_Little << RADIO_PCNF1_ENDIAN_Pos) |
+ (NRF_BALEN << RADIO_PCNF1_BALEN_Pos) |
+ RADIO_PCNF1_WHITEEN_Msk;
/* Enable radio fast ramp-up */
NRF_RADIO_NS->MODECNF0 |= (RADIO_MODECNF0_RU_Fast << RADIO_MODECNF0_RU_Pos) & RADIO_MODECNF0_RU_Msk;
/* Set logical address 1 for TX and RX */
- NRF_RADIO_NS->TXADDRESS = 0;
- NRF_RADIO_NS->RXADDRESSES = (1 << 0);
+ NRF_RADIO_NS->TXADDRESS = 0;
+ NRF_RADIO_NS->RXADDRESSES = (1 << 0);
/* Configure the CRC registers */
NRF_RADIO_NS->CRCCNF = (RADIO_CRCCNF_SKIPADDR_Skip << RADIO_CRCCNF_SKIPADDR_Pos) | RADIO_CRCCNF_LEN_Three;
@@ -1331,7 +1338,7 @@
"ble_phy");
assert(rc == 0);
- g_ble_phy_data.phy_stats_initialized = 1;
+ g_ble_phy_data.phy_stats_initialized = 1;
}
return 0;
@@ -1357,7 +1364,7 @@
*/
nrf_wait_disabled();
if ((NRF_RADIO_NS->STATE != RADIO_STATE_STATE_Disabled) &&
- ((NRF_RADIO_NS->STATE & 0x07) != RADIO_STATE_STATE_RxIdle)) {
+ ((NRF_RADIO_NS->STATE & 0x07) != RADIO_STATE_STATE_RxIdle)) {
ble_phy_disable();
STATS_INC(ble_phy_stats, radio_state_errs);
return BLE_PHY_ERR_RADIO_STATE;
@@ -1673,7 +1680,8 @@
*
* @return int Rounded power in dBm
*/
-int ble_phy_txpower_round(int dbm)
+int
+ble_phy_txpower_round(int dbm)
{
/* "Rail" power level if outside supported range */
@@ -1877,7 +1885,8 @@
}
/* Gets the current access address */
-uint32_t ble_phy_access_addr_get(void)
+uint32_t
+ble_phy_access_addr_get(void)
{
return g_ble_phy_data.phy_access_address;
}
@@ -1946,7 +1955,8 @@
#endif
#if MYNEWT_VAL(BLE_LL_DTM)
-void ble_phy_enable_dtm(void)
+void
+ble_phy_enable_dtm(void)
{
/* When DTM is enabled we need to disable whitening as per
* Bluetooth v5.0 Vol 6. Part F. 4.1.1
@@ -1954,7 +1964,8 @@
NRF_RADIO_NS->PCNF1 &= ~RADIO_PCNF1_WHITEEN_Msk;
}
-void ble_phy_disable_dtm(void)
+void
+ble_phy_disable_dtm(void)
{
/* Enable whitening */
NRF_RADIO_NS->PCNF1 |= RADIO_PCNF1_WHITEEN_Msk;
```
</details>
#### nimble/drivers/nrf5340/src/ble_phy_trace.c
<details>
```diff
@@ -38,7 +38,7 @@
ble_phy_trace_init(void)
{
ble_phy_trace_off =
- os_trace_module_register(&g_ble_phy_trace_mod, "ble_phy", 3,
+ os_trace_module_register(&g_ble_phy_trace_mod, "ble_phy", 3,
ble_phy_trace_module_send_desc);
}
#endif
```
</details>
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [mynewt-nimble] apache-mynewt-bot removed a comment on pull request #841: nimble/drivers: Add support for nRF5340 radio
Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot removed a comment on pull request #841:
URL: https://github.com/apache/mynewt-nimble/pull/841#issuecomment-680827632
<!-- style-bot -->
## Style check summary
### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
#### nimble/drivers/nrf5340/src/ble_phy.c
<details>
```diff
@@ -63,23 +63,32 @@
#define DPPI_PUBLISH_RTC0_EVENTS_COMPARE_0 ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << RTC_PUBLISH_COMPARE_CHIDX_Pos) | \
(RTC_PUBLISH_COMPARE_EN_Enabled << RTC_PUBLISH_COMPARE_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_START(_enable) ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << TIMER_SUBSCRIBE_START_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_START(_enable) ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << \
+ TIMER_SUBSCRIBE_START_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_START_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE1(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE1(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << \
+ TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE2(_enable) ((DPPI_CH_RADIO_EVENTS_END << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE2(_enable) ((DPPI_CH_RADIO_EVENTS_END << \
+ TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE3(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE3(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << \
+ TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_SUBSCRIBE_RADIO_TASKS_DISABLE(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_3 << RADIO_SUBSCRIBE_DISABLE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_RADIO_TASKS_DISABLE(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_3 << \
+ RADIO_SUBSCRIBE_DISABLE_CHIDX_Pos) | \
((_enable) << RADIO_SUBSCRIBE_DISABLE_EN_Pos))
-#define DPPI_SUBSCRIBE_RADIO_TASKS_RXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_RXEN_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_RADIO_TASKS_RXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << \
+ RADIO_SUBSCRIBE_RXEN_CHIDX_Pos) | \
((_enable) << RADIO_SUBSCRIBE_RXEN_EN_Pos))
-#define DPPI_SUBSCRIBE_RADIO_TASKS_TXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_TXEN_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_RADIO_TASKS_TXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << \
+ RADIO_SUBSCRIBE_TXEN_CHIDX_Pos) | \
((_enable) << RADIO_SUBSCRIBE_TXEN_EN_Pos))
-#define DPPI_SUBSCRIBE_AAR_TASKS_START(_enable) ((DPPI_CH_RADIO_EVENTS_BCMATCH << AAR_SUBSCRIBE_START_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_AAR_TASKS_START(_enable) ((DPPI_CH_RADIO_EVENTS_BCMATCH << \
+ AAR_SUBSCRIBE_START_CHIDX_Pos) | \
((_enable) << AAR_SUBSCRIBE_START_EN_Pos))
-#define DPPI_SUBSCRIBE_CCM_TASKS_CRYPT(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << CCM_SUBSCRIBE_CRYPT_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_CCM_TASKS_CRYPT(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << \
+ CCM_SUBSCRIBE_CRYPT_CHIDX_Pos) | \
((_enable) << CCM_SUBSCRIBE_CRYPT_EN_Pos))
extern uint8_t g_nrf_num_irks;
@@ -104,17 +113,17 @@
/* NRF_RADIO_NS->PCNF0 configuration values */
#define NRF_PCNF0 (NRF_LFLEN_BITS << RADIO_PCNF0_LFLEN_Pos) | \
- (RADIO_PCNF0_S1INCL_Msk) | \
- (NRF_S0LEN << RADIO_PCNF0_S0LEN_Pos) | \
- (NRF_S1LEN_BITS << RADIO_PCNF0_S1LEN_Pos)
+ (RADIO_PCNF0_S1INCL_Msk) | \
+ (NRF_S0LEN << RADIO_PCNF0_S0LEN_Pos) | \
+ (NRF_S1LEN_BITS << RADIO_PCNF0_S1LEN_Pos)
#define NRF_PCNF0_1M (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_8bit << RADIO_PCNF0_PLEN_Pos)
+ (RADIO_PCNF0_PLEN_8bit << RADIO_PCNF0_PLEN_Pos)
#define NRF_PCNF0_2M (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_16bit << RADIO_PCNF0_PLEN_Pos)
+ (RADIO_PCNF0_PLEN_16bit << RADIO_PCNF0_PLEN_Pos)
#define NRF_PCNF0_CODED (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_LongRange << RADIO_PCNF0_PLEN_Pos) | \
- (NRF_CILEN_BITS << RADIO_PCNF0_CILEN_Pos) | \
- (NRF_TERMLEN_BITS << RADIO_PCNF0_TERMLEN_Pos)
+ (RADIO_PCNF0_PLEN_LongRange << RADIO_PCNF0_PLEN_Pos) | \
+ (NRF_CILEN_BITS << RADIO_PCNF0_CILEN_Pos) | \
+ (NRF_TERMLEN_BITS << RADIO_PCNF0_TERMLEN_Pos)
/* BLE PHY data structure */
struct ble_phy_obj {
```
</details>
#### nimble/transport/nrf5340/src/nrf5340_ble_hci.c
<details>
```diff
@@ -195,7 +195,7 @@
if (buf) {
break;
}
- /* no break */
+ /* no break */
case BLE_HCI_TRANS_BUF_EVT_LO:
buf = os_memblock_get(&nrf5340_ble_hci_pool_evt_lo);
break;
```
</details>
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [mynewt-nimble] apache-mynewt-bot removed a comment on pull request #841: nimble/drivers: Add support for nRF5340 radio
Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot removed a comment on pull request #841:
URL: https://github.com/apache/mynewt-nimble/pull/841#issuecomment-696133538
<!-- style-bot -->
## Style check summary
### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
#### nimble/drivers/nrf5340/src/ble_phy.c
<details>
```diff
@@ -63,23 +63,32 @@
#define DPPI_PUBLISH_RTC0_EVENTS_COMPARE_0 ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << RTC_PUBLISH_COMPARE_CHIDX_Pos) | \
(RTC_PUBLISH_COMPARE_EN_Enabled << RTC_PUBLISH_COMPARE_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_START(_enable) ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << TIMER_SUBSCRIBE_START_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_START(_enable) ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << \
+ TIMER_SUBSCRIBE_START_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_START_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE1(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE1(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << \
+ TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE2(_enable) ((DPPI_CH_RADIO_EVENTS_END << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE2(_enable) ((DPPI_CH_RADIO_EVENTS_END << \
+ TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE3(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE3(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << \
+ TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_SUBSCRIBE_RADIO_TASKS_DISABLE(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_3 << RADIO_SUBSCRIBE_DISABLE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_RADIO_TASKS_DISABLE(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_3 << \
+ RADIO_SUBSCRIBE_DISABLE_CHIDX_Pos) | \
((_enable) << RADIO_SUBSCRIBE_DISABLE_EN_Pos))
-#define DPPI_SUBSCRIBE_RADIO_TASKS_RXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_RXEN_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_RADIO_TASKS_RXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << \
+ RADIO_SUBSCRIBE_RXEN_CHIDX_Pos) | \
((_enable) << RADIO_SUBSCRIBE_RXEN_EN_Pos))
-#define DPPI_SUBSCRIBE_RADIO_TASKS_TXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_TXEN_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_RADIO_TASKS_TXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << \
+ RADIO_SUBSCRIBE_TXEN_CHIDX_Pos) | \
((_enable) << RADIO_SUBSCRIBE_TXEN_EN_Pos))
-#define DPPI_SUBSCRIBE_AAR_TASKS_START(_enable) ((DPPI_CH_RADIO_EVENTS_BCMATCH << AAR_SUBSCRIBE_START_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_AAR_TASKS_START(_enable) ((DPPI_CH_RADIO_EVENTS_BCMATCH << \
+ AAR_SUBSCRIBE_START_CHIDX_Pos) | \
((_enable) << AAR_SUBSCRIBE_START_EN_Pos))
-#define DPPI_SUBSCRIBE_CCM_TASKS_CRYPT(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << CCM_SUBSCRIBE_CRYPT_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_CCM_TASKS_CRYPT(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << \
+ CCM_SUBSCRIBE_CRYPT_CHIDX_Pos) | \
((_enable) << CCM_SUBSCRIBE_CRYPT_EN_Pos))
extern uint8_t g_nrf_num_irks;
@@ -104,17 +113,17 @@
/* NRF_RADIO_NS->PCNF0 configuration values */
#define NRF_PCNF0 (NRF_LFLEN_BITS << RADIO_PCNF0_LFLEN_Pos) | \
- (RADIO_PCNF0_S1INCL_Msk) | \
- (NRF_S0LEN << RADIO_PCNF0_S0LEN_Pos) | \
- (NRF_S1LEN_BITS << RADIO_PCNF0_S1LEN_Pos)
+ (RADIO_PCNF0_S1INCL_Msk) | \
+ (NRF_S0LEN << RADIO_PCNF0_S0LEN_Pos) | \
+ (NRF_S1LEN_BITS << RADIO_PCNF0_S1LEN_Pos)
#define NRF_PCNF0_1M (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_8bit << RADIO_PCNF0_PLEN_Pos)
+ (RADIO_PCNF0_PLEN_8bit << RADIO_PCNF0_PLEN_Pos)
#define NRF_PCNF0_2M (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_16bit << RADIO_PCNF0_PLEN_Pos)
+ (RADIO_PCNF0_PLEN_16bit << RADIO_PCNF0_PLEN_Pos)
#define NRF_PCNF0_CODED (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_LongRange << RADIO_PCNF0_PLEN_Pos) | \
- (NRF_CILEN_BITS << RADIO_PCNF0_CILEN_Pos) | \
- (NRF_TERMLEN_BITS << RADIO_PCNF0_TERMLEN_Pos)
+ (RADIO_PCNF0_PLEN_LongRange << RADIO_PCNF0_PLEN_Pos) | \
+ (NRF_CILEN_BITS << RADIO_PCNF0_CILEN_Pos) | \
+ (NRF_TERMLEN_BITS << RADIO_PCNF0_TERMLEN_Pos)
/* BLE PHY data structure */
struct ble_phy_obj {
```
</details>
#### nimble/transport/nrf5340/src/nrf5340_ble_hci.c
<details>
```diff
@@ -216,7 +216,7 @@
if (buf) {
break;
}
- /* no break */
+ /* no break */
case BLE_HCI_TRANS_BUF_EVT_LO:
buf = os_memblock_get(&nrf5340_ble_hci_pool_evt_lo);
break;
```
</details>
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [mynewt-nimble] apache-mynewt-bot commented on pull request #841: nimble/drivers: Add support for nRF5340 radio
Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on pull request #841:
URL: https://github.com/apache/mynewt-nimble/pull/841#issuecomment-680827632
<!-- style-bot -->
## Style check summary
### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
#### nimble/drivers/nrf5340/src/ble_phy.c
<details>
```diff
@@ -63,23 +63,32 @@
#define DPPI_PUBLISH_RTC0_EVENTS_COMPARE_0 ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << RTC_PUBLISH_COMPARE_CHIDX_Pos) | \
(RTC_PUBLISH_COMPARE_EN_Enabled << RTC_PUBLISH_COMPARE_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_START(_enable) ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << TIMER_SUBSCRIBE_START_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_START(_enable) ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << \
+ TIMER_SUBSCRIBE_START_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_START_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE1(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE1(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << \
+ TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE2(_enable) ((DPPI_CH_RADIO_EVENTS_END << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE2(_enable) ((DPPI_CH_RADIO_EVENTS_END << \
+ TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE3(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE3(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << \
+ TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_SUBSCRIBE_RADIO_TASKS_DISABLE(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_3 << RADIO_SUBSCRIBE_DISABLE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_RADIO_TASKS_DISABLE(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_3 << \
+ RADIO_SUBSCRIBE_DISABLE_CHIDX_Pos) | \
((_enable) << RADIO_SUBSCRIBE_DISABLE_EN_Pos))
-#define DPPI_SUBSCRIBE_RADIO_TASKS_RXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_RXEN_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_RADIO_TASKS_RXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << \
+ RADIO_SUBSCRIBE_RXEN_CHIDX_Pos) | \
((_enable) << RADIO_SUBSCRIBE_RXEN_EN_Pos))
-#define DPPI_SUBSCRIBE_RADIO_TASKS_TXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_TXEN_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_RADIO_TASKS_TXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << \
+ RADIO_SUBSCRIBE_TXEN_CHIDX_Pos) | \
((_enable) << RADIO_SUBSCRIBE_TXEN_EN_Pos))
-#define DPPI_SUBSCRIBE_AAR_TASKS_START(_enable) ((DPPI_CH_RADIO_EVENTS_BCMATCH << AAR_SUBSCRIBE_START_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_AAR_TASKS_START(_enable) ((DPPI_CH_RADIO_EVENTS_BCMATCH << \
+ AAR_SUBSCRIBE_START_CHIDX_Pos) | \
((_enable) << AAR_SUBSCRIBE_START_EN_Pos))
-#define DPPI_SUBSCRIBE_CCM_TASKS_CRYPT(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << CCM_SUBSCRIBE_CRYPT_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_CCM_TASKS_CRYPT(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << \
+ CCM_SUBSCRIBE_CRYPT_CHIDX_Pos) | \
((_enable) << CCM_SUBSCRIBE_CRYPT_EN_Pos))
extern uint8_t g_nrf_num_irks;
@@ -104,17 +113,17 @@
/* NRF_RADIO_NS->PCNF0 configuration values */
#define NRF_PCNF0 (NRF_LFLEN_BITS << RADIO_PCNF0_LFLEN_Pos) | \
- (RADIO_PCNF0_S1INCL_Msk) | \
- (NRF_S0LEN << RADIO_PCNF0_S0LEN_Pos) | \
- (NRF_S1LEN_BITS << RADIO_PCNF0_S1LEN_Pos)
+ (RADIO_PCNF0_S1INCL_Msk) | \
+ (NRF_S0LEN << RADIO_PCNF0_S0LEN_Pos) | \
+ (NRF_S1LEN_BITS << RADIO_PCNF0_S1LEN_Pos)
#define NRF_PCNF0_1M (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_8bit << RADIO_PCNF0_PLEN_Pos)
+ (RADIO_PCNF0_PLEN_8bit << RADIO_PCNF0_PLEN_Pos)
#define NRF_PCNF0_2M (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_16bit << RADIO_PCNF0_PLEN_Pos)
+ (RADIO_PCNF0_PLEN_16bit << RADIO_PCNF0_PLEN_Pos)
#define NRF_PCNF0_CODED (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_LongRange << RADIO_PCNF0_PLEN_Pos) | \
- (NRF_CILEN_BITS << RADIO_PCNF0_CILEN_Pos) | \
- (NRF_TERMLEN_BITS << RADIO_PCNF0_TERMLEN_Pos)
+ (RADIO_PCNF0_PLEN_LongRange << RADIO_PCNF0_PLEN_Pos) | \
+ (NRF_CILEN_BITS << RADIO_PCNF0_CILEN_Pos) | \
+ (NRF_TERMLEN_BITS << RADIO_PCNF0_TERMLEN_Pos)
/* BLE PHY data structure */
struct ble_phy_obj {
```
</details>
#### nimble/transport/nrf5340/src/nrf5340_ble_hci.c
<details>
```diff
@@ -195,7 +195,7 @@
if (buf) {
break;
}
- /* no break */
+ /* no break */
case BLE_HCI_TRANS_BUF_EVT_LO:
buf = os_memblock_get(&nrf5340_ble_hci_pool_evt_lo);
break;
```
</details>
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [mynewt-nimble] apache-mynewt-bot removed a comment on pull request #841: nimble/drivers: Add support for nRF5340 radio
Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot removed a comment on pull request #841:
URL: https://github.com/apache/mynewt-nimble/pull/841#issuecomment-684536229
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [mynewt-nimble] apache-mynewt-bot commented on pull request #841: nimble/drivers: Add support for nRF5340 radio
Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on pull request #841:
URL: https://github.com/apache/mynewt-nimble/pull/841#issuecomment-696380747
<!-- style-bot -->
## Style check summary
### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
#### nimble/drivers/nrf5340/src/ble_phy.c
<details>
```diff
@@ -63,23 +63,32 @@
#define DPPI_PUBLISH_RTC0_EVENTS_COMPARE_0 ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << RTC_PUBLISH_COMPARE_CHIDX_Pos) | \
(RTC_PUBLISH_COMPARE_EN_Enabled << RTC_PUBLISH_COMPARE_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_START(_enable) ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << TIMER_SUBSCRIBE_START_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_START(_enable) ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << \
+ TIMER_SUBSCRIBE_START_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_START_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE1(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE1(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << \
+ TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE2(_enable) ((DPPI_CH_RADIO_EVENTS_END << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE2(_enable) ((DPPI_CH_RADIO_EVENTS_END << \
+ TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE3(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE3(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << \
+ TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_SUBSCRIBE_RADIO_TASKS_DISABLE(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_3 << RADIO_SUBSCRIBE_DISABLE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_RADIO_TASKS_DISABLE(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_3 << \
+ RADIO_SUBSCRIBE_DISABLE_CHIDX_Pos) | \
((_enable) << RADIO_SUBSCRIBE_DISABLE_EN_Pos))
-#define DPPI_SUBSCRIBE_RADIO_TASKS_RXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_RXEN_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_RADIO_TASKS_RXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << \
+ RADIO_SUBSCRIBE_RXEN_CHIDX_Pos) | \
((_enable) << RADIO_SUBSCRIBE_RXEN_EN_Pos))
-#define DPPI_SUBSCRIBE_RADIO_TASKS_TXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_TXEN_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_RADIO_TASKS_TXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << \
+ RADIO_SUBSCRIBE_TXEN_CHIDX_Pos) | \
((_enable) << RADIO_SUBSCRIBE_TXEN_EN_Pos))
-#define DPPI_SUBSCRIBE_AAR_TASKS_START(_enable) ((DPPI_CH_RADIO_EVENTS_BCMATCH << AAR_SUBSCRIBE_START_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_AAR_TASKS_START(_enable) ((DPPI_CH_RADIO_EVENTS_BCMATCH << \
+ AAR_SUBSCRIBE_START_CHIDX_Pos) | \
((_enable) << AAR_SUBSCRIBE_START_EN_Pos))
-#define DPPI_SUBSCRIBE_CCM_TASKS_CRYPT(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << CCM_SUBSCRIBE_CRYPT_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_CCM_TASKS_CRYPT(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << \
+ CCM_SUBSCRIBE_CRYPT_CHIDX_Pos) | \
((_enable) << CCM_SUBSCRIBE_CRYPT_EN_Pos))
extern uint8_t g_nrf_num_irks;
@@ -104,17 +113,17 @@
/* NRF_RADIO_NS->PCNF0 configuration values */
#define NRF_PCNF0 (NRF_LFLEN_BITS << RADIO_PCNF0_LFLEN_Pos) | \
- (RADIO_PCNF0_S1INCL_Msk) | \
- (NRF_S0LEN << RADIO_PCNF0_S0LEN_Pos) | \
- (NRF_S1LEN_BITS << RADIO_PCNF0_S1LEN_Pos)
+ (RADIO_PCNF0_S1INCL_Msk) | \
+ (NRF_S0LEN << RADIO_PCNF0_S0LEN_Pos) | \
+ (NRF_S1LEN_BITS << RADIO_PCNF0_S1LEN_Pos)
#define NRF_PCNF0_1M (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_8bit << RADIO_PCNF0_PLEN_Pos)
+ (RADIO_PCNF0_PLEN_8bit << RADIO_PCNF0_PLEN_Pos)
#define NRF_PCNF0_2M (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_16bit << RADIO_PCNF0_PLEN_Pos)
+ (RADIO_PCNF0_PLEN_16bit << RADIO_PCNF0_PLEN_Pos)
#define NRF_PCNF0_CODED (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_LongRange << RADIO_PCNF0_PLEN_Pos) | \
- (NRF_CILEN_BITS << RADIO_PCNF0_CILEN_Pos) | \
- (NRF_TERMLEN_BITS << RADIO_PCNF0_TERMLEN_Pos)
+ (RADIO_PCNF0_PLEN_LongRange << RADIO_PCNF0_PLEN_Pos) | \
+ (NRF_CILEN_BITS << RADIO_PCNF0_CILEN_Pos) | \
+ (NRF_TERMLEN_BITS << RADIO_PCNF0_TERMLEN_Pos)
/* BLE PHY data structure */
struct ble_phy_obj {
```
</details>
#### nimble/transport/nrf5340/src/nrf5340_ble_hci.c
<details>
```diff
@@ -216,7 +216,7 @@
if (buf) {
break;
}
- /* no break */
+ /* no break */
case BLE_HCI_TRANS_BUF_EVT_LO:
buf = os_memblock_get(&nrf5340_ble_hci_pool_evt_lo);
break;
```
</details>
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [mynewt-nimble] sjanc merged pull request #841: nimble/drivers: Add support for nRF5340 radio
Posted by GitBox <gi...@apache.org>.
sjanc merged pull request #841:
URL: https://github.com/apache/mynewt-nimble/pull/841
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [mynewt-nimble] apache-mynewt-bot commented on pull request #841: nimble/drivers: Add support for nRF5340 radio
Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on pull request #841:
URL: https://github.com/apache/mynewt-nimble/pull/841#issuecomment-656629100
<!-- style-bot -->
## Style check summary
### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
#### nimble/drivers/nrf5340/src/ble_phy.c
<details>
```diff
@@ -63,23 +63,32 @@
#define DPPI_PUBLISH_RTC0_EVENTS_COMPARE_0 ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << RTC_PUBLISH_COMPARE_CHIDX_Pos) | \
(RTC_PUBLISH_COMPARE_EN_Enabled << RTC_PUBLISH_COMPARE_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_START(_enable) ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << TIMER_SUBSCRIBE_START_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_START(_enable) ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << \
+ TIMER_SUBSCRIBE_START_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_START_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE1(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE1(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << \
+ TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE2(_enable) ((DPPI_CH_RADIO_EVENTS_END << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE2(_enable) ((DPPI_CH_RADIO_EVENTS_END << \
+ TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE3(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE3(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << \
+ TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_SUBSCRIBE_RADIO_TASKS_DISABLE(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_3 << RADIO_SUBSCRIBE_DISABLE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_RADIO_TASKS_DISABLE(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_3 << \
+ RADIO_SUBSCRIBE_DISABLE_CHIDX_Pos) | \
((_enable) << RADIO_SUBSCRIBE_DISABLE_EN_Pos))
-#define DPPI_SUBSCRIBE_RADIO_TASKS_RXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_RXEN_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_RADIO_TASKS_RXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << \
+ RADIO_SUBSCRIBE_RXEN_CHIDX_Pos) | \
((_enable) << RADIO_SUBSCRIBE_RXEN_EN_Pos))
-#define DPPI_SUBSCRIBE_RADIO_TASKS_TXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_TXEN_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_RADIO_TASKS_TXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << \
+ RADIO_SUBSCRIBE_TXEN_CHIDX_Pos) | \
((_enable) << RADIO_SUBSCRIBE_TXEN_EN_Pos))
-#define DPPI_SUBSCRIBE_AAR_TASKS_START(_enable) ((DPPI_CH_RADIO_EVENTS_BCMATCH << AAR_SUBSCRIBE_START_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_AAR_TASKS_START(_enable) ((DPPI_CH_RADIO_EVENTS_BCMATCH << \
+ AAR_SUBSCRIBE_START_CHIDX_Pos) | \
((_enable) << AAR_SUBSCRIBE_START_EN_Pos))
-#define DPPI_SUBSCRIBE_CCM_TASKS_CRYPT(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << CCM_SUBSCRIBE_CRYPT_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_CCM_TASKS_CRYPT(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << \
+ CCM_SUBSCRIBE_CRYPT_CHIDX_Pos) | \
((_enable) << CCM_SUBSCRIBE_CRYPT_EN_Pos))
extern uint8_t g_nrf_num_irks;
@@ -104,17 +113,17 @@
/* NRF_RADIO_NS->PCNF0 configuration values */
#define NRF_PCNF0 (NRF_LFLEN_BITS << RADIO_PCNF0_LFLEN_Pos) | \
- (RADIO_PCNF0_S1INCL_Msk) | \
- (NRF_S0LEN << RADIO_PCNF0_S0LEN_Pos) | \
- (NRF_S1LEN_BITS << RADIO_PCNF0_S1LEN_Pos)
+ (RADIO_PCNF0_S1INCL_Msk) | \
+ (NRF_S0LEN << RADIO_PCNF0_S0LEN_Pos) | \
+ (NRF_S1LEN_BITS << RADIO_PCNF0_S1LEN_Pos)
#define NRF_PCNF0_1M (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_8bit << RADIO_PCNF0_PLEN_Pos)
+ (RADIO_PCNF0_PLEN_8bit << RADIO_PCNF0_PLEN_Pos)
#define NRF_PCNF0_2M (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_16bit << RADIO_PCNF0_PLEN_Pos)
+ (RADIO_PCNF0_PLEN_16bit << RADIO_PCNF0_PLEN_Pos)
#define NRF_PCNF0_CODED (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_LongRange << RADIO_PCNF0_PLEN_Pos) | \
- (NRF_CILEN_BITS << RADIO_PCNF0_CILEN_Pos) | \
- (NRF_TERMLEN_BITS << RADIO_PCNF0_TERMLEN_Pos)
+ (RADIO_PCNF0_PLEN_LongRange << RADIO_PCNF0_PLEN_Pos) | \
+ (NRF_CILEN_BITS << RADIO_PCNF0_CILEN_Pos) | \
+ (NRF_TERMLEN_BITS << RADIO_PCNF0_TERMLEN_Pos)
/* BLE PHY data structure */
struct ble_phy_obj {
```
</details>
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [mynewt-nimble] sjanc merged pull request #841: nimble/drivers: Add support for nRF5340 radio
Posted by GitBox <gi...@apache.org>.
sjanc merged pull request #841:
URL: https://github.com/apache/mynewt-nimble/pull/841
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [mynewt-nimble] apache-mynewt-bot commented on pull request #841: nimble/drivers: Add support for nRF5340 radio
Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on pull request #841:
URL: https://github.com/apache/mynewt-nimble/pull/841#issuecomment-656584287
<!-- style-bot -->
## Style check summary
### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
#### nimble/drivers/nrf5340/src/ble_phy.c
<details>
```diff
@@ -63,23 +63,32 @@
#define DPPI_PUBLISH_RTC0_EVENTS_COMPARE_0 ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << RTC_PUBLISH_COMPARE_CHIDX_Pos) | \
(RTC_PUBLISH_COMPARE_EN_Enabled << RTC_PUBLISH_COMPARE_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_START(_enable) ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << TIMER_SUBSCRIBE_START_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_START(_enable) ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << \
+ TIMER_SUBSCRIBE_START_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_START_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE1(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE1(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << \
+ TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE2(_enable) ((DPPI_CH_RADIO_EVENTS_END << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE2(_enable) ((DPPI_CH_RADIO_EVENTS_END << \
+ TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE3(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE3(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << \
+ TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_SUBSCRIBE_RADIO_TASKS_DISABLE(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_3 << RADIO_SUBSCRIBE_DISABLE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_RADIO_TASKS_DISABLE(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_3 << \
+ RADIO_SUBSCRIBE_DISABLE_CHIDX_Pos) | \
((_enable) << RADIO_SUBSCRIBE_DISABLE_EN_Pos))
-#define DPPI_SUBSCRIBE_RADIO_TASKS_RXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_RXEN_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_RADIO_TASKS_RXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << \
+ RADIO_SUBSCRIBE_RXEN_CHIDX_Pos) | \
((_enable) << RADIO_SUBSCRIBE_RXEN_EN_Pos))
-#define DPPI_SUBSCRIBE_RADIO_TASKS_TXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_TXEN_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_RADIO_TASKS_TXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << \
+ RADIO_SUBSCRIBE_TXEN_CHIDX_Pos) | \
((_enable) << RADIO_SUBSCRIBE_TXEN_EN_Pos))
-#define DPPI_SUBSCRIBE_AAR_TASKS_START(_enable) ((DPPI_CH_RADIO_EVENTS_BCMATCH << AAR_SUBSCRIBE_START_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_AAR_TASKS_START(_enable) ((DPPI_CH_RADIO_EVENTS_BCMATCH << \
+ AAR_SUBSCRIBE_START_CHIDX_Pos) | \
((_enable) << AAR_SUBSCRIBE_START_EN_Pos))
-#define DPPI_SUBSCRIBE_CCM_TASKS_CRYPT(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << CCM_SUBSCRIBE_CRYPT_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_CCM_TASKS_CRYPT(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << \
+ CCM_SUBSCRIBE_CRYPT_CHIDX_Pos) | \
((_enable) << CCM_SUBSCRIBE_CRYPT_EN_Pos))
extern uint8_t g_nrf_num_irks;
@@ -104,17 +113,17 @@
/* NRF_RADIO_NS->PCNF0 configuration values */
#define NRF_PCNF0 (NRF_LFLEN_BITS << RADIO_PCNF0_LFLEN_Pos) | \
- (RADIO_PCNF0_S1INCL_Msk) | \
- (NRF_S0LEN << RADIO_PCNF0_S0LEN_Pos) | \
- (NRF_S1LEN_BITS << RADIO_PCNF0_S1LEN_Pos)
+ (RADIO_PCNF0_S1INCL_Msk) | \
+ (NRF_S0LEN << RADIO_PCNF0_S0LEN_Pos) | \
+ (NRF_S1LEN_BITS << RADIO_PCNF0_S1LEN_Pos)
#define NRF_PCNF0_1M (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_8bit << RADIO_PCNF0_PLEN_Pos)
+ (RADIO_PCNF0_PLEN_8bit << RADIO_PCNF0_PLEN_Pos)
#define NRF_PCNF0_2M (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_16bit << RADIO_PCNF0_PLEN_Pos)
+ (RADIO_PCNF0_PLEN_16bit << RADIO_PCNF0_PLEN_Pos)
#define NRF_PCNF0_CODED (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_LongRange << RADIO_PCNF0_PLEN_Pos) | \
- (NRF_CILEN_BITS << RADIO_PCNF0_CILEN_Pos) | \
- (NRF_TERMLEN_BITS << RADIO_PCNF0_TERMLEN_Pos)
+ (RADIO_PCNF0_PLEN_LongRange << RADIO_PCNF0_PLEN_Pos) | \
+ (NRF_CILEN_BITS << RADIO_PCNF0_CILEN_Pos) | \
+ (NRF_TERMLEN_BITS << RADIO_PCNF0_TERMLEN_Pos)
/* BLE PHY data structure */
struct ble_phy_obj {
@@ -409,7 +418,7 @@
: [len] "+r" (rem_len)
: [dst] "r" (dst), [src] "r" (src)
: "r3", "memory"
- );
+ );
/* Copy header */
memcpy(BLE_MBUF_HDR_PTR(rxpdu), &g_ble_phy_data.rxhdr,
@@ -1094,7 +1103,7 @@
NRF_RADIO_NS->EVENTS_BCMATCH = 0;
NRF_AAR_NS->SUBSCRIBE_START = DPPI_SUBSCRIBE_AAR_TASKS_START(1);
NRF_RADIO_NS->BCC = (BLE_LL_PDU_HDR_LEN + adva_offset + BLE_DEV_ADDR_LEN) * 8 +
- g_ble_phy_data.phy_bcc_offset;
+ g_ble_phy_data.phy_bcc_offset;
}
#endif
@@ -1314,7 +1323,7 @@
*/
nrf_wait_disabled();
if ((NRF_RADIO_NS->STATE != RADIO_STATE_STATE_Disabled) &&
- ((NRF_RADIO_NS->STATE & 0x07) != RADIO_STATE_STATE_RxIdle)) {
+ ((NRF_RADIO_NS->STATE & 0x07) != RADIO_STATE_STATE_RxIdle)) {
ble_phy_disable();
STATS_INC(ble_phy_stats, radio_state_errs);
return BLE_PHY_ERR_RADIO_STATE;
@@ -1734,7 +1743,8 @@
ble_phy_disable_irq_and_ppi();
}
-uint32_t ble_phy_access_addr_get(void)
+uint32_t
+ble_phy_access_addr_get(void)
{
return g_ble_phy_data.phy_access_address;
}
```
</details>
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [mynewt-nimble] apache-mynewt-bot removed a comment on pull request #841: nimble/drivers: Add support for nRF5340 radio
Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot removed a comment on pull request #841:
URL: https://github.com/apache/mynewt-nimble/pull/841#issuecomment-656629100
<!-- style-bot -->
## Style check summary
### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
#### nimble/drivers/nrf5340/src/ble_phy.c
<details>
```diff
@@ -63,23 +63,32 @@
#define DPPI_PUBLISH_RTC0_EVENTS_COMPARE_0 ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << RTC_PUBLISH_COMPARE_CHIDX_Pos) | \
(RTC_PUBLISH_COMPARE_EN_Enabled << RTC_PUBLISH_COMPARE_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_START(_enable) ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << TIMER_SUBSCRIBE_START_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_START(_enable) ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << \
+ TIMER_SUBSCRIBE_START_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_START_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE1(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE1(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << \
+ TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE2(_enable) ((DPPI_CH_RADIO_EVENTS_END << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE2(_enable) ((DPPI_CH_RADIO_EVENTS_END << \
+ TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE3(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE3(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << \
+ TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_SUBSCRIBE_RADIO_TASKS_DISABLE(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_3 << RADIO_SUBSCRIBE_DISABLE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_RADIO_TASKS_DISABLE(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_3 << \
+ RADIO_SUBSCRIBE_DISABLE_CHIDX_Pos) | \
((_enable) << RADIO_SUBSCRIBE_DISABLE_EN_Pos))
-#define DPPI_SUBSCRIBE_RADIO_TASKS_RXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_RXEN_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_RADIO_TASKS_RXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << \
+ RADIO_SUBSCRIBE_RXEN_CHIDX_Pos) | \
((_enable) << RADIO_SUBSCRIBE_RXEN_EN_Pos))
-#define DPPI_SUBSCRIBE_RADIO_TASKS_TXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_TXEN_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_RADIO_TASKS_TXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << \
+ RADIO_SUBSCRIBE_TXEN_CHIDX_Pos) | \
((_enable) << RADIO_SUBSCRIBE_TXEN_EN_Pos))
-#define DPPI_SUBSCRIBE_AAR_TASKS_START(_enable) ((DPPI_CH_RADIO_EVENTS_BCMATCH << AAR_SUBSCRIBE_START_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_AAR_TASKS_START(_enable) ((DPPI_CH_RADIO_EVENTS_BCMATCH << \
+ AAR_SUBSCRIBE_START_CHIDX_Pos) | \
((_enable) << AAR_SUBSCRIBE_START_EN_Pos))
-#define DPPI_SUBSCRIBE_CCM_TASKS_CRYPT(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << CCM_SUBSCRIBE_CRYPT_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_CCM_TASKS_CRYPT(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << \
+ CCM_SUBSCRIBE_CRYPT_CHIDX_Pos) | \
((_enable) << CCM_SUBSCRIBE_CRYPT_EN_Pos))
extern uint8_t g_nrf_num_irks;
@@ -104,17 +113,17 @@
/* NRF_RADIO_NS->PCNF0 configuration values */
#define NRF_PCNF0 (NRF_LFLEN_BITS << RADIO_PCNF0_LFLEN_Pos) | \
- (RADIO_PCNF0_S1INCL_Msk) | \
- (NRF_S0LEN << RADIO_PCNF0_S0LEN_Pos) | \
- (NRF_S1LEN_BITS << RADIO_PCNF0_S1LEN_Pos)
+ (RADIO_PCNF0_S1INCL_Msk) | \
+ (NRF_S0LEN << RADIO_PCNF0_S0LEN_Pos) | \
+ (NRF_S1LEN_BITS << RADIO_PCNF0_S1LEN_Pos)
#define NRF_PCNF0_1M (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_8bit << RADIO_PCNF0_PLEN_Pos)
+ (RADIO_PCNF0_PLEN_8bit << RADIO_PCNF0_PLEN_Pos)
#define NRF_PCNF0_2M (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_16bit << RADIO_PCNF0_PLEN_Pos)
+ (RADIO_PCNF0_PLEN_16bit << RADIO_PCNF0_PLEN_Pos)
#define NRF_PCNF0_CODED (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_LongRange << RADIO_PCNF0_PLEN_Pos) | \
- (NRF_CILEN_BITS << RADIO_PCNF0_CILEN_Pos) | \
- (NRF_TERMLEN_BITS << RADIO_PCNF0_TERMLEN_Pos)
+ (RADIO_PCNF0_PLEN_LongRange << RADIO_PCNF0_PLEN_Pos) | \
+ (NRF_CILEN_BITS << RADIO_PCNF0_CILEN_Pos) | \
+ (NRF_TERMLEN_BITS << RADIO_PCNF0_TERMLEN_Pos)
/* BLE PHY data structure */
struct ble_phy_obj {
```
</details>
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [mynewt-nimble] sjanc commented on a change in pull request #841: nimble/drivers: Add support for nRF5340 radio
Posted by GitBox <gi...@apache.org>.
sjanc commented on a change in pull request #841:
URL: https://github.com/apache/mynewt-nimble/pull/841#discussion_r451117495
##########
File path: nimble/drivers/nrf5340/src/ble_phy.c
##########
@@ -0,0 +1,2001 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <stdint.h>
+#include <string.h>
+#include <assert.h>
+#include <syscfg/syscfg.h>
+#include <os/os.h>
+#include <nimble/ble.h>
+#include <nimble/nimble_opt.h>
+#include <nimble/nimble_npl.h>
+#include <controller/ble_phy.h>
+
+#include <ble/xcvr.h>
+#include <controller/ble_phy_trace.h>
+#include <controller/ble_ll.h>
+#include <mcu/nrf5340_net_clock.h>
+#include <mcu/cmsis_nvic.h>
+
+/*
+ * NOTE: This code uses 1-6 DPPI channels so care should be taken when using
+ * DPPI somewhere else.
+ * TODO maybe we could reduce number of used channels if we reuse same channel
+ * for mutually exclusive events but for now make it simpler to debug.
+ */
+
+#define DPPI_CH_TIMER0_EVENTS_COMPARE_0 DPPIC_CHEN_CH0_Pos
+#define DPPI_CH_TIMER0_EVENTS_COMPARE_3 DPPIC_CHEN_CH1_Pos
+#define DPPI_CH_RADIO_EVENTS_END DPPIC_CHEN_CH2_Pos
+#define DPPI_CH_RADIO_EVENTS_BCMATCH DPPIC_CHEN_CH3_Pos
+#define DPPI_CH_RADIO_EVENTS_ADDRESS DPPIC_CHEN_CH4_Pos
+#define DPPI_CH_RTC0_EVENTS_COMPARE_0 DPPIC_CHEN_CH5_Pos
+
+#define DPPI_CH_ENABLE_ALL (DPPIC_CHEN_CH0_Msk | DPPIC_CHEN_CH1_Msk | DPPIC_CHEN_CH2_Msk | \
+ DPPIC_CHEN_CH3_Msk | DPPIC_CHEN_CH4_Msk | DPPIC_CHEN_CH5_Msk)
+
+#define DPPI_PUBLISH_TIMER0_EVENTS_COMPARE_0 ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << TIMER_PUBLISH_COMPARE_CHIDX_Pos) | \
+ (TIMER_PUBLISH_COMPARE_EN_Enabled << TIMER_PUBLISH_COMPARE_EN_Pos))
+#define DPPI_PUBLISH_TIMER0_EVENTS_COMPARE_3 ((DPPI_CH_TIMER0_EVENTS_COMPARE_3 << TIMER_PUBLISH_COMPARE_CHIDX_Pos) | \
+ (TIMER_PUBLISH_COMPARE_EN_Enabled << TIMER_PUBLISH_COMPARE_EN_Pos))
+#define DPPI_PUBLISH_RADIO_EVENTS_END ((DPPI_CH_RADIO_EVENTS_END << RADIO_PUBLISH_END_CHIDX_Pos) | \
+ (RADIO_PUBLISH_END_EN_Enabled << RADIO_PUBLISH_END_EN_Pos))
+#define DPPI_PUBLISH_RADIO_EVENTS_BCMATCH ((DPPI_CH_RADIO_EVENTS_BCMATCH << RADIO_PUBLISH_BCMATCH_CHIDX_Pos) | \
+ (RADIO_PUBLISH_BCMATCH_EN_Enabled << RADIO_PUBLISH_BCMATCH_EN_Pos))
+#define DPPI_PUBLISH_RADIO_EVENTS_ADDRESS ((DPPI_CH_RADIO_EVENTS_ADDRESS << RADIO_PUBLISH_ADDRESS_CHIDX_Pos) | \
+ (RADIO_PUBLISH_ADDRESS_EN_Enabled << RADIO_PUBLISH_ADDRESS_EN_Pos))
+#define DPPI_PUBLISH_RTC0_EVENTS_COMPARE_0 ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << RTC_PUBLISH_COMPARE_CHIDX_Pos) | \
+ (RTC_PUBLISH_COMPARE_EN_Enabled << RTC_PUBLISH_COMPARE_EN_Pos))
+
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_START ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << TIMER_SUBSCRIBE_START_CHIDX_Pos) | \
+ (TIMER_SUBSCRIBE_START_EN_Enabled << TIMER_SUBSCRIBE_START_EN_Pos))
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE1 ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+ (TIMER_SUBSCRIBE_CAPTURE_EN_Enabled << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE2 ((DPPI_CH_RADIO_EVENTS_END << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+ (TIMER_SUBSCRIBE_CAPTURE_EN_Enabled << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE3 ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+ (TIMER_SUBSCRIBE_CAPTURE_EN_Enabled << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
+#define DPPI_SUBSCRIBE_RADIO_TASKS_DISABLE ((DPPI_CH_TIMER0_EVENTS_COMPARE_3 << RADIO_SUBSCRIBE_DISABLE_CHIDX_Pos) | \
+ (RADIO_SUBSCRIBE_DISABLE_EN_Enabled << RADIO_SUBSCRIBE_DISABLE_EN_Pos))
+#define DPPI_SUBSCRIBE_RADIO_TASKS_RXEN ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_RXEN_CHIDX_Pos) | \
+ (RADIO_SUBSCRIBE_RXEN_EN_Enabled << RADIO_SUBSCRIBE_RXEN_EN_Pos))
+#define DPPI_SUBSCRIBE_RADIO_TASKS_TXEN ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_TXEN_CHIDX_Pos) | \
+ (RADIO_SUBSCRIBE_TXEN_EN_Enabled << RADIO_SUBSCRIBE_TXEN_EN_Pos))
+#define DPPI_SUBSCRIBE_AAR_TASKS_START ((DPPI_CH_RADIO_EVENTS_BCMATCH << AAR_SUBSCRIBE_START_CHIDX_Pos) | \
+ (AAR_SUBSCRIBE_START_EN_Enabled << AAR_SUBSCRIBE_START_EN_Pos))
+#define DPPI_SUBSCRIBE_CCM_TASKS_CRYPT ((DPPI_CH_RADIO_EVENTS_ADDRESS << CCM_SUBSCRIBE_CRYPT_CHIDX_Pos) | \
+ (CCM_SUBSCRIBE_CRYPT_EN_Enabled << CCM_SUBSCRIBE_CRYPT_EN_Pos))
+
+#define DPPI_UNSUBSCRIBE_TIMER0_TASKS_START ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << TIMER_SUBSCRIBE_START_CHIDX_Pos) | \
+ (TIMER_SUBSCRIBE_START_EN_Disabled << TIMER_SUBSCRIBE_START_EN_Pos))
+#define DPPI_UNSUBSCRIBE_TIMER0_TASKS_CAPTURE1 ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+ (TIMER_SUBSCRIBE_CAPTURE_EN_Disabled << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
+#define DPPI_UNSUBSCRIBE_TIMER0_TASKS_CAPTURE2 ((DPPI_CH_RADIO_EVENTS_END << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+ (TIMER_SUBSCRIBE_CAPTURE_EN_Disabled << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
+#define DPPI_UNSUBSCRIBE_TIMER0_TASKS_CAPTURE3 ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+ (TIMER_SUBSCRIBE_CAPTURE_EN_Disabled << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
+#define DPPI_UNSUBSCRIBE_RADIO_TASKS_DISABLE ((DPPI_CH_TIMER0_EVENTS_COMPARE_3 << RADIO_SUBSCRIBE_DISABLE_CHIDX_Pos) | \
+ (RADIO_SUBSCRIBE_DISABLE_EN_Disabled << RADIO_SUBSCRIBE_DISABLE_EN_Pos))
+#define DPPI_UNSUBSCRIBE_RADIO_TASKS_RXEN ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_RXEN_CHIDX_Pos) | \
+ (RADIO_SUBSCRIBE_RXEN_EN_Disabled << RADIO_SUBSCRIBE_RXEN_EN_Pos))
+#define DPPI_UNSUBSCRIBE_RADIO_TASKS_TXEN ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_TXEN_CHIDX_Pos) | \
+ (RADIO_SUBSCRIBE_TXEN_EN_Disabled << RADIO_SUBSCRIBE_TXEN_EN_Pos))
+#define DPPI_UNSUBSCRIBE_AAR_TASKS_START ((DPPI_CH_RADIO_EVENTS_BCMATCH << AAR_SUBSCRIBE_START_CHIDX_Pos) | \
+ (AAR_SUBSCRIBE_START_EN_Disabled << AAR_SUBSCRIBE_START_EN_Pos))
+#define DPPI_UNSUBSCRIBE_CCM_TASKS_CRYPT ((DPPI_CH_RADIO_EVENTS_ADDRESS << CCM_SUBSCRIBE_CRYPT_CHIDX_Pos) | \
+ (CCM_SUBSCRIBE_CRYPT_EN_Disabled << CCM_SUBSCRIBE_CRYPT_EN_Pos))
+
+extern uint8_t g_nrf_num_irks;
+extern uint32_t g_nrf_irk_list[];
+
+/* To disable all radio interrupts */
+#define NRF_RADIO_IRQ_MASK_ALL (0x34FF)
+
+/*
+ * We configure the nrf with a 1 byte S0 field, 8 bit length field, and
+ * zero bit S1 field. The preamble is 8 bits long.
+ */
+#define NRF_LFLEN_BITS (8)
+#define NRF_S0LEN (1)
+#define NRF_S1LEN_BITS (0)
+#define NRF_CILEN_BITS (2)
+#define NRF_TERMLEN_BITS (3)
+
+/* Maximum length of frames */
+#define NRF_MAXLEN (255)
+#define NRF_BALEN (3) /* For base address of 3 bytes */
+
+/* NRF_RADIO_NS->PCNF0 configuration values */
+#define NRF_PCNF0 (NRF_LFLEN_BITS << RADIO_PCNF0_LFLEN_Pos) | \
+ (RADIO_PCNF0_S1INCL_Msk) | \
+ (NRF_S0LEN << RADIO_PCNF0_S0LEN_Pos) | \
+ (NRF_S1LEN_BITS << RADIO_PCNF0_S1LEN_Pos)
+#define NRF_PCNF0_1M (NRF_PCNF0) | \
+ (RADIO_PCNF0_PLEN_8bit << RADIO_PCNF0_PLEN_Pos)
+#define NRF_PCNF0_2M (NRF_PCNF0) | \
+ (RADIO_PCNF0_PLEN_16bit << RADIO_PCNF0_PLEN_Pos)
+#define NRF_PCNF0_CODED (NRF_PCNF0) | \
+ (RADIO_PCNF0_PLEN_LongRange << RADIO_PCNF0_PLEN_Pos) | \
+ (NRF_CILEN_BITS << RADIO_PCNF0_CILEN_Pos) | \
+ (NRF_TERMLEN_BITS << RADIO_PCNF0_TERMLEN_Pos)
+
+/* BLE PHY data structure */
+struct ble_phy_obj
+{
+ uint8_t phy_stats_initialized;
+ int8_t phy_txpwr_dbm;
+ uint8_t phy_chan;
+ uint8_t phy_state;
+ uint8_t phy_transition;
+ uint8_t phy_transition_late;
+ uint8_t phy_rx_started;
+ uint8_t phy_encrypted;
+ uint8_t phy_privacy;
+ uint8_t phy_tx_pyld_len;
+ uint8_t phy_cur_phy_mode;
+ uint8_t phy_tx_phy_mode;
+ uint8_t phy_rx_phy_mode;
+ uint8_t phy_bcc_offset;
+ int8_t rx_pwr_compensation;
+ uint32_t phy_aar_scratch;
+ uint32_t phy_access_address;
+ struct ble_mbuf_hdr rxhdr;
+ void *txend_arg;
+ ble_phy_tx_end_func txend_cb;
+ uint32_t phy_start_cputime;
+};
+struct ble_phy_obj g_ble_phy_data;
+
+/* XXX: if 27 byte packets desired we can make this smaller */
+/* Global transmit/receive buffer */
+static uint32_t g_ble_phy_tx_buf[(BLE_PHY_MAX_PDU_LEN + 3) / 4];
+static uint32_t g_ble_phy_rx_buf[(BLE_PHY_MAX_PDU_LEN + 3) / 4];
+
+#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LE_ENCRYPTION)
+/* Make sure word-aligned for faster copies */
+static uint32_t g_ble_phy_enc_buf[(BLE_PHY_MAX_PDU_LEN + 3) / 4];
+#endif
+
+/* RF center frequency for each channel index (offset from 2400 MHz) */
+static const uint8_t g_ble_phy_chan_freq[BLE_PHY_NUM_CHANS] = {
+ 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, /* 0-9 */
+ 24, 28, 30, 32, 34, 36, 38, 40, 42, 44, /* 10-19 */
+ 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, /* 20-29 */
+ 66, 68, 70, 72, 74, 76, 78, 2, 26, 80, /* 30-39 */
+};
+
+#if (BLE_LL_BT5_PHY_SUPPORTED == 1)
+/* packet start offsets (in usecs) */
+static const uint16_t g_ble_phy_mode_pkt_start_off[BLE_PHY_NUM_MODE] = {
+ [BLE_PHY_MODE_1M] = 40,
+ [BLE_PHY_MODE_2M] = 24,
+ [BLE_PHY_MODE_CODED_125KBPS] = 376,
+ [BLE_PHY_MODE_CODED_500KBPS] = 376
+};
+#endif
+
+/* Various radio timings */
+/* Radio ramp-up times in usecs (fast mode) */
+#define BLE_PHY_T_TXENFAST (XCVR_TX_RADIO_RAMPUP_USECS)
+#define BLE_PHY_T_RXENFAST (XCVR_RX_RADIO_RAMPUP_USECS)
+
+/* delay between EVENTS_READY and start of tx */
+static const uint8_t g_ble_phy_t_txdelay[BLE_PHY_NUM_MODE] = {
+ [BLE_PHY_MODE_1M] = 4,
+ [BLE_PHY_MODE_2M] = 3,
+ [BLE_PHY_MODE_CODED_125KBPS] = 5,
+ [BLE_PHY_MODE_CODED_500KBPS] = 5
+};
+/* delay between EVENTS_END and end of txd packet */
+static const uint8_t g_ble_phy_t_txenddelay[BLE_PHY_NUM_MODE] = {
+ [BLE_PHY_MODE_1M] = 4,
+ [BLE_PHY_MODE_2M] = 3,
+ [BLE_PHY_MODE_CODED_125KBPS] = 9,
+ [BLE_PHY_MODE_CODED_500KBPS] = 3
+};
+/* delay between rxd access address (w/ TERM1 for coded) and EVENTS_ADDRESS */
+static const uint8_t g_ble_phy_t_rxaddrdelay[BLE_PHY_NUM_MODE] = {
+ [BLE_PHY_MODE_1M] = 6,
+ [BLE_PHY_MODE_2M] = 2,
+ [BLE_PHY_MODE_CODED_125KBPS] = 17,
+ [BLE_PHY_MODE_CODED_500KBPS] = 17
+};
+/* delay between end of rxd packet and EVENTS_END */
+static const uint8_t g_ble_phy_t_rxenddelay[BLE_PHY_NUM_MODE] = {
+ [BLE_PHY_MODE_1M] = 6,
+ [BLE_PHY_MODE_2M] = 2,
+ [BLE_PHY_MODE_CODED_125KBPS] = 27,
+ [BLE_PHY_MODE_CODED_500KBPS] = 22
+};
Review comment:
nope, those are currently copied from nrf52. I'll do proper measurements and tune those when passing GPIO control from app core is supported (note: zephyr is using same values (with 1 exception) for both 52840 and 5340)
##########
File path: nimble/drivers/nrf5340/src/ble_phy.c
##########
@@ -0,0 +1,2001 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <stdint.h>
+#include <string.h>
+#include <assert.h>
+#include <syscfg/syscfg.h>
+#include <os/os.h>
+#include <nimble/ble.h>
+#include <nimble/nimble_opt.h>
+#include <nimble/nimble_npl.h>
+#include <controller/ble_phy.h>
+
+#include <ble/xcvr.h>
+#include <controller/ble_phy_trace.h>
+#include <controller/ble_ll.h>
+#include <mcu/nrf5340_net_clock.h>
+#include <mcu/cmsis_nvic.h>
+
+/*
+ * NOTE: This code uses 1-6 DPPI channels so care should be taken when using
+ * DPPI somewhere else.
+ * TODO maybe we could reduce number of used channels if we reuse same channel
+ * for mutually exclusive events but for now make it simpler to debug.
+ */
+
+#define DPPI_CH_TIMER0_EVENTS_COMPARE_0 DPPIC_CHEN_CH0_Pos
+#define DPPI_CH_TIMER0_EVENTS_COMPARE_3 DPPIC_CHEN_CH1_Pos
+#define DPPI_CH_RADIO_EVENTS_END DPPIC_CHEN_CH2_Pos
+#define DPPI_CH_RADIO_EVENTS_BCMATCH DPPIC_CHEN_CH3_Pos
+#define DPPI_CH_RADIO_EVENTS_ADDRESS DPPIC_CHEN_CH4_Pos
+#define DPPI_CH_RTC0_EVENTS_COMPARE_0 DPPIC_CHEN_CH5_Pos
Review comment:
those are from nrfx not CMSIS, don't have strong opinion on those so can change them to plan numbers
##########
File path: nimble/drivers/nrf5340/src/ble_phy.c
##########
@@ -0,0 +1,2001 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <stdint.h>
+#include <string.h>
+#include <assert.h>
+#include <syscfg/syscfg.h>
+#include <os/os.h>
+#include <nimble/ble.h>
+#include <nimble/nimble_opt.h>
+#include <nimble/nimble_npl.h>
+#include <controller/ble_phy.h>
+
+#include <ble/xcvr.h>
+#include <controller/ble_phy_trace.h>
+#include <controller/ble_ll.h>
+#include <mcu/nrf5340_net_clock.h>
+#include <mcu/cmsis_nvic.h>
+
+/*
+ * NOTE: This code uses 1-6 DPPI channels so care should be taken when using
+ * DPPI somewhere else.
+ * TODO maybe we could reduce number of used channels if we reuse same channel
+ * for mutually exclusive events but for now make it simpler to debug.
+ */
+
+#define DPPI_CH_TIMER0_EVENTS_COMPARE_0 DPPIC_CHEN_CH0_Pos
+#define DPPI_CH_TIMER0_EVENTS_COMPARE_3 DPPIC_CHEN_CH1_Pos
+#define DPPI_CH_RADIO_EVENTS_END DPPIC_CHEN_CH2_Pos
+#define DPPI_CH_RADIO_EVENTS_BCMATCH DPPIC_CHEN_CH3_Pos
+#define DPPI_CH_RADIO_EVENTS_ADDRESS DPPIC_CHEN_CH4_Pos
+#define DPPI_CH_RTC0_EVENTS_COMPARE_0 DPPIC_CHEN_CH5_Pos
+
+#define DPPI_CH_ENABLE_ALL (DPPIC_CHEN_CH0_Msk | DPPIC_CHEN_CH1_Msk | DPPIC_CHEN_CH2_Msk | \
+ DPPIC_CHEN_CH3_Msk | DPPIC_CHEN_CH4_Msk | DPPIC_CHEN_CH5_Msk)
+
+#define DPPI_PUBLISH_TIMER0_EVENTS_COMPARE_0 ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << TIMER_PUBLISH_COMPARE_CHIDX_Pos) | \
+ (TIMER_PUBLISH_COMPARE_EN_Enabled << TIMER_PUBLISH_COMPARE_EN_Pos))
+#define DPPI_PUBLISH_TIMER0_EVENTS_COMPARE_3 ((DPPI_CH_TIMER0_EVENTS_COMPARE_3 << TIMER_PUBLISH_COMPARE_CHIDX_Pos) | \
+ (TIMER_PUBLISH_COMPARE_EN_Enabled << TIMER_PUBLISH_COMPARE_EN_Pos))
+#define DPPI_PUBLISH_RADIO_EVENTS_END ((DPPI_CH_RADIO_EVENTS_END << RADIO_PUBLISH_END_CHIDX_Pos) | \
+ (RADIO_PUBLISH_END_EN_Enabled << RADIO_PUBLISH_END_EN_Pos))
+#define DPPI_PUBLISH_RADIO_EVENTS_BCMATCH ((DPPI_CH_RADIO_EVENTS_BCMATCH << RADIO_PUBLISH_BCMATCH_CHIDX_Pos) | \
+ (RADIO_PUBLISH_BCMATCH_EN_Enabled << RADIO_PUBLISH_BCMATCH_EN_Pos))
+#define DPPI_PUBLISH_RADIO_EVENTS_ADDRESS ((DPPI_CH_RADIO_EVENTS_ADDRESS << RADIO_PUBLISH_ADDRESS_CHIDX_Pos) | \
+ (RADIO_PUBLISH_ADDRESS_EN_Enabled << RADIO_PUBLISH_ADDRESS_EN_Pos))
+#define DPPI_PUBLISH_RTC0_EVENTS_COMPARE_0 ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << RTC_PUBLISH_COMPARE_CHIDX_Pos) | \
+ (RTC_PUBLISH_COMPARE_EN_Enabled << RTC_PUBLISH_COMPARE_EN_Pos))
+
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_START ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << TIMER_SUBSCRIBE_START_CHIDX_Pos) | \
+ (TIMER_SUBSCRIBE_START_EN_Enabled << TIMER_SUBSCRIBE_START_EN_Pos))
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE1 ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+ (TIMER_SUBSCRIBE_CAPTURE_EN_Enabled << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE2 ((DPPI_CH_RADIO_EVENTS_END << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+ (TIMER_SUBSCRIBE_CAPTURE_EN_Enabled << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE3 ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+ (TIMER_SUBSCRIBE_CAPTURE_EN_Enabled << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
+#define DPPI_SUBSCRIBE_RADIO_TASKS_DISABLE ((DPPI_CH_TIMER0_EVENTS_COMPARE_3 << RADIO_SUBSCRIBE_DISABLE_CHIDX_Pos) | \
+ (RADIO_SUBSCRIBE_DISABLE_EN_Enabled << RADIO_SUBSCRIBE_DISABLE_EN_Pos))
+#define DPPI_SUBSCRIBE_RADIO_TASKS_RXEN ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_RXEN_CHIDX_Pos) | \
+ (RADIO_SUBSCRIBE_RXEN_EN_Enabled << RADIO_SUBSCRIBE_RXEN_EN_Pos))
+#define DPPI_SUBSCRIBE_RADIO_TASKS_TXEN ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_TXEN_CHIDX_Pos) | \
+ (RADIO_SUBSCRIBE_TXEN_EN_Enabled << RADIO_SUBSCRIBE_TXEN_EN_Pos))
+#define DPPI_SUBSCRIBE_AAR_TASKS_START ((DPPI_CH_RADIO_EVENTS_BCMATCH << AAR_SUBSCRIBE_START_CHIDX_Pos) | \
+ (AAR_SUBSCRIBE_START_EN_Enabled << AAR_SUBSCRIBE_START_EN_Pos))
+#define DPPI_SUBSCRIBE_CCM_TASKS_CRYPT ((DPPI_CH_RADIO_EVENTS_ADDRESS << CCM_SUBSCRIBE_CRYPT_CHIDX_Pos) | \
+ (CCM_SUBSCRIBE_CRYPT_EN_Enabled << CCM_SUBSCRIBE_CRYPT_EN_Pos))
+
+#define DPPI_UNSUBSCRIBE_TIMER0_TASKS_START ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << TIMER_SUBSCRIBE_START_CHIDX_Pos) | \
+ (TIMER_SUBSCRIBE_START_EN_Disabled << TIMER_SUBSCRIBE_START_EN_Pos))
+#define DPPI_UNSUBSCRIBE_TIMER0_TASKS_CAPTURE1 ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+ (TIMER_SUBSCRIBE_CAPTURE_EN_Disabled << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
+#define DPPI_UNSUBSCRIBE_TIMER0_TASKS_CAPTURE2 ((DPPI_CH_RADIO_EVENTS_END << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+ (TIMER_SUBSCRIBE_CAPTURE_EN_Disabled << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
+#define DPPI_UNSUBSCRIBE_TIMER0_TASKS_CAPTURE3 ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+ (TIMER_SUBSCRIBE_CAPTURE_EN_Disabled << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
+#define DPPI_UNSUBSCRIBE_RADIO_TASKS_DISABLE ((DPPI_CH_TIMER0_EVENTS_COMPARE_3 << RADIO_SUBSCRIBE_DISABLE_CHIDX_Pos) | \
+ (RADIO_SUBSCRIBE_DISABLE_EN_Disabled << RADIO_SUBSCRIBE_DISABLE_EN_Pos))
+#define DPPI_UNSUBSCRIBE_RADIO_TASKS_RXEN ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_RXEN_CHIDX_Pos) | \
+ (RADIO_SUBSCRIBE_RXEN_EN_Disabled << RADIO_SUBSCRIBE_RXEN_EN_Pos))
+#define DPPI_UNSUBSCRIBE_RADIO_TASKS_TXEN ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_TXEN_CHIDX_Pos) | \
+ (RADIO_SUBSCRIBE_TXEN_EN_Disabled << RADIO_SUBSCRIBE_TXEN_EN_Pos))
+#define DPPI_UNSUBSCRIBE_AAR_TASKS_START ((DPPI_CH_RADIO_EVENTS_BCMATCH << AAR_SUBSCRIBE_START_CHIDX_Pos) | \
+ (AAR_SUBSCRIBE_START_EN_Disabled << AAR_SUBSCRIBE_START_EN_Pos))
+#define DPPI_UNSUBSCRIBE_CCM_TASKS_CRYPT ((DPPI_CH_RADIO_EVENTS_ADDRESS << CCM_SUBSCRIBE_CRYPT_CHIDX_Pos) | \
+ (CCM_SUBSCRIBE_CRYPT_EN_Disabled << CCM_SUBSCRIBE_CRYPT_EN_Pos))
Review comment:
right
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [mynewt-nimble] andrzej-kaczmarek commented on a change in pull request #841: nimble/drivers: Add support for nRF5340 radio
Posted by GitBox <gi...@apache.org>.
andrzej-kaczmarek commented on a change in pull request #841:
URL: https://github.com/apache/mynewt-nimble/pull/841#discussion_r451145870
##########
File path: nimble/drivers/nrf5340/src/ble_phy.c
##########
@@ -0,0 +1,2001 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <stdint.h>
+#include <string.h>
+#include <assert.h>
+#include <syscfg/syscfg.h>
+#include <os/os.h>
+#include <nimble/ble.h>
+#include <nimble/nimble_opt.h>
+#include <nimble/nimble_npl.h>
+#include <controller/ble_phy.h>
+
+#include <ble/xcvr.h>
+#include <controller/ble_phy_trace.h>
+#include <controller/ble_ll.h>
+#include <mcu/nrf5340_net_clock.h>
+#include <mcu/cmsis_nvic.h>
+
+/*
+ * NOTE: This code uses 1-6 DPPI channels so care should be taken when using
+ * DPPI somewhere else.
+ * TODO maybe we could reduce number of used channels if we reuse same channel
+ * for mutually exclusive events but for now make it simpler to debug.
+ */
+
+#define DPPI_CH_TIMER0_EVENTS_COMPARE_0 DPPIC_CHEN_CH0_Pos
+#define DPPI_CH_TIMER0_EVENTS_COMPARE_3 DPPIC_CHEN_CH1_Pos
+#define DPPI_CH_RADIO_EVENTS_END DPPIC_CHEN_CH2_Pos
+#define DPPI_CH_RADIO_EVENTS_BCMATCH DPPIC_CHEN_CH3_Pos
+#define DPPI_CH_RADIO_EVENTS_ADDRESS DPPIC_CHEN_CH4_Pos
+#define DPPI_CH_RTC0_EVENTS_COMPARE_0 DPPIC_CHEN_CH5_Pos
Review comment:
it just does not make sense to use those symbols as a channel number (i.e. field value in some other register) - `DPPIC_CHEN_CH5_Pos` is a position of `CH5` field in `DPPIC->CHEN` register so the only reason it has the same value as channel number is because there are 32 fields there numbered 0..31 :)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [mynewt-nimble] apache-mynewt-bot commented on pull request #841: nimble/drivers: Add support for nRF5340 radio
Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on pull request #841:
URL: https://github.com/apache/mynewt-nimble/pull/841#issuecomment-654910917
<!-- style-bot -->
## Style check summary
### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
#### nimble/drivers/nrf5340/src/ble_phy.c
<details>
```diff
@@ -66,13 +66,18 @@
#define DPPI_SUBSCRIBE_TIMER0_TASKS_START ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << TIMER_SUBSCRIBE_START_CHIDX_Pos) | \
(TIMER_SUBSCRIBE_START_EN_Enabled << TIMER_SUBSCRIBE_START_EN_Pos))
#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE1 ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
- (TIMER_SUBSCRIBE_CAPTURE_EN_Enabled << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
+ (TIMER_SUBSCRIBE_CAPTURE_EN_Enabled << \
+ TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE2 ((DPPI_CH_RADIO_EVENTS_END << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
- (TIMER_SUBSCRIBE_CAPTURE_EN_Enabled << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
+ (TIMER_SUBSCRIBE_CAPTURE_EN_Enabled << \
+ TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE3 ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
- (TIMER_SUBSCRIBE_CAPTURE_EN_Enabled << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_SUBSCRIBE_RADIO_TASKS_DISABLE ((DPPI_CH_TIMER0_EVENTS_COMPARE_3 << RADIO_SUBSCRIBE_DISABLE_CHIDX_Pos) | \
- (RADIO_SUBSCRIBE_DISABLE_EN_Enabled << RADIO_SUBSCRIBE_DISABLE_EN_Pos))
+ (TIMER_SUBSCRIBE_CAPTURE_EN_Enabled << \
+ TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
+#define DPPI_SUBSCRIBE_RADIO_TASKS_DISABLE ((DPPI_CH_TIMER0_EVENTS_COMPARE_3 << \
+ RADIO_SUBSCRIBE_DISABLE_CHIDX_Pos) | \
+ (RADIO_SUBSCRIBE_DISABLE_EN_Enabled << \
+ RADIO_SUBSCRIBE_DISABLE_EN_Pos))
#define DPPI_SUBSCRIBE_RADIO_TASKS_RXEN ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_RXEN_CHIDX_Pos) | \
(RADIO_SUBSCRIBE_RXEN_EN_Enabled << RADIO_SUBSCRIBE_RXEN_EN_Pos))
#define DPPI_SUBSCRIBE_RADIO_TASKS_TXEN ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_TXEN_CHIDX_Pos) | \
@@ -85,13 +90,18 @@
#define DPPI_UNSUBSCRIBE_TIMER0_TASKS_START ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << TIMER_SUBSCRIBE_START_CHIDX_Pos) | \
(TIMER_SUBSCRIBE_START_EN_Disabled << TIMER_SUBSCRIBE_START_EN_Pos))
#define DPPI_UNSUBSCRIBE_TIMER0_TASKS_CAPTURE1 ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
- (TIMER_SUBSCRIBE_CAPTURE_EN_Disabled << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
+ (TIMER_SUBSCRIBE_CAPTURE_EN_Disabled << \
+ TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
#define DPPI_UNSUBSCRIBE_TIMER0_TASKS_CAPTURE2 ((DPPI_CH_RADIO_EVENTS_END << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
- (TIMER_SUBSCRIBE_CAPTURE_EN_Disabled << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
+ (TIMER_SUBSCRIBE_CAPTURE_EN_Disabled << \
+ TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
#define DPPI_UNSUBSCRIBE_TIMER0_TASKS_CAPTURE3 ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
- (TIMER_SUBSCRIBE_CAPTURE_EN_Disabled << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_UNSUBSCRIBE_RADIO_TASKS_DISABLE ((DPPI_CH_TIMER0_EVENTS_COMPARE_3 << RADIO_SUBSCRIBE_DISABLE_CHIDX_Pos) | \
- (RADIO_SUBSCRIBE_DISABLE_EN_Disabled << RADIO_SUBSCRIBE_DISABLE_EN_Pos))
+ (TIMER_SUBSCRIBE_CAPTURE_EN_Disabled << \
+ TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
+#define DPPI_UNSUBSCRIBE_RADIO_TASKS_DISABLE ((DPPI_CH_TIMER0_EVENTS_COMPARE_3 << \
+ RADIO_SUBSCRIBE_DISABLE_CHIDX_Pos) | \
+ (RADIO_SUBSCRIBE_DISABLE_EN_Disabled << \
+ RADIO_SUBSCRIBE_DISABLE_EN_Pos))
#define DPPI_UNSUBSCRIBE_RADIO_TASKS_RXEN ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_RXEN_CHIDX_Pos) | \
(RADIO_SUBSCRIBE_RXEN_EN_Disabled << RADIO_SUBSCRIBE_RXEN_EN_Pos))
#define DPPI_UNSUBSCRIBE_RADIO_TASKS_TXEN ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_TXEN_CHIDX_Pos) | \
@@ -123,23 +133,22 @@
/* NRF_RADIO_NS->PCNF0 configuration values */
#define NRF_PCNF0 (NRF_LFLEN_BITS << RADIO_PCNF0_LFLEN_Pos) | \
- (RADIO_PCNF0_S1INCL_Msk) | \
- (NRF_S0LEN << RADIO_PCNF0_S0LEN_Pos) | \
- (NRF_S1LEN_BITS << RADIO_PCNF0_S1LEN_Pos)
+ (RADIO_PCNF0_S1INCL_Msk) | \
+ (NRF_S0LEN << RADIO_PCNF0_S0LEN_Pos) | \
+ (NRF_S1LEN_BITS << RADIO_PCNF0_S1LEN_Pos)
#define NRF_PCNF0_1M (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_8bit << RADIO_PCNF0_PLEN_Pos)
+ (RADIO_PCNF0_PLEN_8bit << RADIO_PCNF0_PLEN_Pos)
#define NRF_PCNF0_2M (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_16bit << RADIO_PCNF0_PLEN_Pos)
+ (RADIO_PCNF0_PLEN_16bit << RADIO_PCNF0_PLEN_Pos)
#define NRF_PCNF0_CODED (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_LongRange << RADIO_PCNF0_PLEN_Pos) | \
- (NRF_CILEN_BITS << RADIO_PCNF0_CILEN_Pos) | \
- (NRF_TERMLEN_BITS << RADIO_PCNF0_TERMLEN_Pos)
+ (RADIO_PCNF0_PLEN_LongRange << RADIO_PCNF0_PLEN_Pos) | \
+ (NRF_CILEN_BITS << RADIO_PCNF0_CILEN_Pos) | \
+ (NRF_TERMLEN_BITS << RADIO_PCNF0_TERMLEN_Pos)
/* BLE PHY data structure */
-struct ble_phy_obj
-{
+struct ble_phy_obj {
uint8_t phy_stats_initialized;
- int8_t phy_txpwr_dbm;
+ int8_t phy_txpwr_dbm;
uint8_t phy_chan;
uint8_t phy_state;
uint8_t phy_transition;
@@ -152,7 +161,7 @@
uint8_t phy_tx_phy_mode;
uint8_t phy_rx_phy_mode;
uint8_t phy_bcc_offset;
- int8_t rx_pwr_compensation;
+ int8_t rx_pwr_compensation;
uint32_t phy_aar_scratch;
uint32_t phy_access_address;
struct ble_mbuf_hdr rxhdr;
@@ -174,7 +183,7 @@
/* RF center frequency for each channel index (offset from 2400 MHz) */
static const uint8_t g_ble_phy_chan_freq[BLE_PHY_NUM_CHANS] = {
- 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, /* 0-9 */
+ 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, /* 0-9 */
24, 28, 30, 32, 34, 36, 38, 40, 42, 44, /* 10-19 */
46, 48, 50, 52, 54, 56, 58, 60, 62, 64, /* 20-29 */
66, 68, 70, 72, 74, 76, 78, 2, 26, 80, /* 30-39 */
@@ -226,36 +235,36 @@
/* Statistics */
STATS_SECT_START(ble_phy_stats)
- STATS_SECT_ENTRY(phy_isrs)
- STATS_SECT_ENTRY(tx_good)
- STATS_SECT_ENTRY(tx_fail)
- STATS_SECT_ENTRY(tx_late)
- STATS_SECT_ENTRY(tx_bytes)
- STATS_SECT_ENTRY(rx_starts)
- STATS_SECT_ENTRY(rx_aborts)
- STATS_SECT_ENTRY(rx_valid)
- STATS_SECT_ENTRY(rx_crc_err)
- STATS_SECT_ENTRY(rx_late)
- STATS_SECT_ENTRY(radio_state_errs)
- STATS_SECT_ENTRY(rx_hw_err)
- STATS_SECT_ENTRY(tx_hw_err)
+STATS_SECT_ENTRY(phy_isrs)
+STATS_SECT_ENTRY(tx_good)
+STATS_SECT_ENTRY(tx_fail)
+STATS_SECT_ENTRY(tx_late)
+STATS_SECT_ENTRY(tx_bytes)
+STATS_SECT_ENTRY(rx_starts)
+STATS_SECT_ENTRY(rx_aborts)
+STATS_SECT_ENTRY(rx_valid)
+STATS_SECT_ENTRY(rx_crc_err)
+STATS_SECT_ENTRY(rx_late)
+STATS_SECT_ENTRY(radio_state_errs)
+STATS_SECT_ENTRY(rx_hw_err)
+STATS_SECT_ENTRY(tx_hw_err)
STATS_SECT_END
STATS_SECT_DECL(ble_phy_stats) ble_phy_stats;
STATS_NAME_START(ble_phy_stats)
- STATS_NAME(ble_phy_stats, phy_isrs)
- STATS_NAME(ble_phy_stats, tx_good)
- STATS_NAME(ble_phy_stats, tx_fail)
- STATS_NAME(ble_phy_stats, tx_late)
- STATS_NAME(ble_phy_stats, tx_bytes)
- STATS_NAME(ble_phy_stats, rx_starts)
- STATS_NAME(ble_phy_stats, rx_aborts)
- STATS_NAME(ble_phy_stats, rx_valid)
- STATS_NAME(ble_phy_stats, rx_crc_err)
- STATS_NAME(ble_phy_stats, rx_late)
- STATS_NAME(ble_phy_stats, radio_state_errs)
- STATS_NAME(ble_phy_stats, rx_hw_err)
- STATS_NAME(ble_phy_stats, tx_hw_err)
+STATS_NAME(ble_phy_stats, phy_isrs)
+STATS_NAME(ble_phy_stats, tx_good)
+STATS_NAME(ble_phy_stats, tx_fail)
+STATS_NAME(ble_phy_stats, tx_late)
+STATS_NAME(ble_phy_stats, tx_bytes)
+STATS_NAME(ble_phy_stats, rx_starts)
+STATS_NAME(ble_phy_stats, rx_aborts)
+STATS_NAME(ble_phy_stats, rx_valid)
+STATS_NAME(ble_phy_stats, rx_crc_err)
+STATS_NAME(ble_phy_stats, rx_late)
+STATS_NAME(ble_phy_stats, radio_state_errs)
+STATS_NAME(ble_phy_stats, rx_hw_err)
+STATS_NAME(ble_phy_stats, tx_hw_err)
STATS_NAME_END(ble_phy_stats)
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LE_ENCRYPTION)
@@ -273,8 +282,7 @@
static uint32_t nrf_encrypt_scratchpad[NRF_ENC_SCRATCH_WORDS];
-struct nrf_ccm_data
-{
+struct nrf_ccm_data {
uint8_t key[16];
uint64_t pkt_counter;
uint8_t dir_bit;
@@ -342,16 +350,16 @@
{
#if (BLE_LL_BT5_PHY_SUPPORTED == 1)
switch (g_ble_phy_data.phy_cur_phy_mode) {
- case BLE_PHY_MODE_1M:
- return BLE_PHY_1M;
- case BLE_PHY_MODE_2M:
- return BLE_PHY_2M;
- case BLE_PHY_MODE_CODED_125KBPS:
- case BLE_PHY_MODE_CODED_500KBPS:
- return BLE_PHY_CODED;
- default:
- assert(0);
- return -1;
+ case BLE_PHY_MODE_1M:
+ return BLE_PHY_1M;
+ case BLE_PHY_MODE_2M:
+ return BLE_PHY_2M;
+ case BLE_PHY_MODE_CODED_125KBPS:
+ case BLE_PHY_MODE_CODED_500KBPS:
+ return BLE_PHY_CODED;
+ default:
+ assert(0);
+ return -1;
}
#else
return BLE_PHY_1M;
@@ -418,10 +426,10 @@
" adds %[src], %[src], r4 \n"
" adds %[dst], %[dst], r4 \n"
: [dst] "+r" (dst), [src] "+r" (src),
- [len] "+r" (copy_len)
+ [len] "+r" (copy_len)
:
: "r3", "r4", "memory"
- );
+ );
if ((rem_len < 4) && (block_rem_len >= rem_len)) {
break;
@@ -443,7 +451,7 @@
: [len] "+r" (rem_len)
: [dst] "r" (dst), [src] "r" (src)
: "r3", "memory"
- );
+ );
/* Copy header */
memcpy(BLE_MBUF_HDR_PTR(rxpdu), &g_ble_phy_data.rxhdr,
@@ -734,7 +742,7 @@
NRF_CCM_NS->OUTPTR = (uint32_t)dptr;
NRF_CCM_NS->SCRATCHPTR = (uint32_t)&nrf_encrypt_scratchpad[0];
NRF_CCM_NS->MODE = CCM_MODE_LENGTH_Msk | CCM_MODE_MODE_Decryption |
- ble_phy_get_ccm_datarate();
+ ble_phy_get_ccm_datarate();
NRF_CCM_NS->CNFPTR = (uint32_t)&nrf_ccm_data;
NRF_CCM_NS->SHORTS = 0;
NRF_CCM_NS->EVENTS_ERROR = 0;
@@ -779,7 +787,7 @@
* to take this into account when setting up BCC.
*/
if (g_ble_phy_data.phy_cur_phy_mode == BLE_PHY_MODE_CODED_125KBPS ||
- g_ble_phy_data.phy_cur_phy_mode == BLE_PHY_MODE_CODED_500KBPS) {
+ g_ble_phy_data.phy_cur_phy_mode == BLE_PHY_MODE_CODED_500KBPS) {
g_ble_phy_data.phy_bcc_offset = 5;
} else {
g_ble_phy_data.phy_bcc_offset = 0;
@@ -796,10 +804,10 @@
NRF_RADIO_NS->EVENTS_RSSIEND = 0;
NRF_RADIO_NS->EVENTS_CRCOK = 0;
NRF_RADIO_NS->SHORTS = RADIO_SHORTS_END_DISABLE_Msk |
- RADIO_SHORTS_READY_START_Msk |
- RADIO_SHORTS_ADDRESS_BCSTART_Msk |
- RADIO_SHORTS_ADDRESS_RSSISTART_Msk |
- RADIO_SHORTS_DISABLED_RSSISTOP_Msk;
+ RADIO_SHORTS_READY_START_Msk |
+ RADIO_SHORTS_ADDRESS_BCSTART_Msk |
+ RADIO_SHORTS_ADDRESS_RSSISTART_Msk |
+ RADIO_SHORTS_DISABLED_RSSISTOP_Msk;
NRF_RADIO_NS->INTENSET = RADIO_INTENSET_ADDRESS_Msk;
}
@@ -907,10 +915,10 @@
* using CI field.
*/
if ((phy == BLE_PHY_MODE_CODED_125KBPS) ||
- (phy == BLE_PHY_MODE_CODED_500KBPS)) {
+ (phy == BLE_PHY_MODE_CODED_500KBPS)) {
phy = NRF_RADIO_NS->PDUSTAT & RADIO_PDUSTAT_CISTAT_Msk ?
- BLE_PHY_MODE_CODED_500KBPS :
- BLE_PHY_MODE_CODED_125KBPS;
+ BLE_PHY_MODE_CODED_500KBPS :
+ BLE_PHY_MODE_CODED_125KBPS;
}
#endif
@@ -1144,7 +1152,7 @@
NRF_RADIO_NS->EVENTS_BCMATCH = 0;
NRF_AAR_NS->SUBSCRIBE_START = DPPI_SUBSCRIBE_AAR_TASKS_START;
NRF_RADIO_NS->BCC = (BLE_LL_PDU_HDR_LEN + adva_offset + BLE_DEV_ADDR_LEN) * 8 +
- g_ble_phy_data.phy_bcc_offset;
+ g_ble_phy_data.phy_bcc_offset;
}
#endif
@@ -1271,16 +1279,16 @@
/* XXX: should maxlen be 251 for encryption? */
NRF_RADIO_NS->PCNF1 = NRF_MAXLEN |
- (RADIO_PCNF1_ENDIAN_Little << RADIO_PCNF1_ENDIAN_Pos) |
- (NRF_BALEN << RADIO_PCNF1_BALEN_Pos) |
- RADIO_PCNF1_WHITEEN_Msk;
+ (RADIO_PCNF1_ENDIAN_Little << RADIO_PCNF1_ENDIAN_Pos) |
+ (NRF_BALEN << RADIO_PCNF1_BALEN_Pos) |
+ RADIO_PCNF1_WHITEEN_Msk;
/* Enable radio fast ramp-up */
NRF_RADIO_NS->MODECNF0 |= (RADIO_MODECNF0_RU_Fast << RADIO_MODECNF0_RU_Pos) & RADIO_MODECNF0_RU_Msk;
/* Set logical address 1 for TX and RX */
- NRF_RADIO_NS->TXADDRESS = 0;
- NRF_RADIO_NS->RXADDRESSES = (1 << 0);
+ NRF_RADIO_NS->TXADDRESS = 0;
+ NRF_RADIO_NS->RXADDRESSES = (1 << 0);
/* Configure the CRC registers */
NRF_RADIO_NS->CRCCNF = (RADIO_CRCCNF_SKIPADDR_Skip << RADIO_CRCCNF_SKIPADDR_Pos) | RADIO_CRCCNF_LEN_Three;
@@ -1350,7 +1358,7 @@
"ble_phy");
assert(rc == 0);
- g_ble_phy_data.phy_stats_initialized = 1;
+ g_ble_phy_data.phy_stats_initialized = 1;
}
return 0;
@@ -1376,7 +1384,7 @@
*/
nrf_wait_disabled();
if ((NRF_RADIO_NS->STATE != RADIO_STATE_STATE_Disabled) &&
- ((NRF_RADIO_NS->STATE & 0x07) != RADIO_STATE_STATE_RxIdle)) {
+ ((NRF_RADIO_NS->STATE & 0x07) != RADIO_STATE_STATE_RxIdle)) {
ble_phy_disable();
STATS_INC(ble_phy_stats, radio_state_errs);
return BLE_PHY_ERR_RADIO_STATE;
@@ -1692,7 +1700,8 @@
*
* @return int Rounded power in dBm
*/
-int ble_phy_txpower_round(int dbm)
+int
+ble_phy_txpower_round(int dbm)
{
/* "Rail" power level if outside supported range */
@@ -1896,7 +1905,8 @@
}
/* Gets the current access address */
-uint32_t ble_phy_access_addr_get(void)
+uint32_t
+ble_phy_access_addr_get(void)
{
return g_ble_phy_data.phy_access_address;
}
@@ -1965,7 +1975,8 @@
#endif
#if MYNEWT_VAL(BLE_LL_DTM)
-void ble_phy_enable_dtm(void)
+void
+ble_phy_enable_dtm(void)
{
/* When DTM is enabled we need to disable whitening as per
* Bluetooth v5.0 Vol 6. Part F. 4.1.1
@@ -1973,7 +1984,8 @@
NRF_RADIO_NS->PCNF1 &= ~RADIO_PCNF1_WHITEEN_Msk;
}
-void ble_phy_disable_dtm(void)
+void
+ble_phy_disable_dtm(void)
{
/* Enable whitening */
NRF_RADIO_NS->PCNF1 |= RADIO_PCNF1_WHITEEN_Msk;
```
</details>
#### nimble/drivers/nrf5340/src/ble_phy_trace.c
<details>
```diff
@@ -38,7 +38,7 @@
ble_phy_trace_init(void)
{
ble_phy_trace_off =
- os_trace_module_register(&g_ble_phy_trace_mod, "ble_phy", 3,
+ os_trace_module_register(&g_ble_phy_trace_mod, "ble_phy", 3,
ble_phy_trace_module_send_desc);
}
#endif
```
</details>
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [mynewt-nimble] andrzej-kaczmarek commented on a change in pull request #841: nimble/drivers: Add support for nRF5340 radio
Posted by GitBox <gi...@apache.org>.
andrzej-kaczmarek commented on a change in pull request #841:
URL: https://github.com/apache/mynewt-nimble/pull/841#discussion_r492021557
##########
File path: nimble/drivers/nrf5340/src/ble_hw.c
##########
@@ -0,0 +1,483 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <stdint.h>
+#include <assert.h>
+#include <string.h>
+#include <syscfg/syscfg.h>
+#include <os/os.h>
+#include <nimble/ble.h>
+#include <nimble/nimble_opt.h>
+#include <controller/ble_hw.h>
+
+#include <ble/xcvr.h>
+#include <mcu/cmsis_nvic.h>
+#include <os/os_trace_api.h>
+
+/* Total number of resolving list elements */
+#define BLE_HW_RESOLV_LIST_SIZE (16)
+
+/* We use this to keep track of which entries are set to valid addresses */
+static uint8_t g_ble_hw_whitelist_mask;
+
+/* Random number generator isr callback */
+static ble_rng_isr_cb_t ble_rng_isr_cb;
+
+/* If LL privacy is enabled, allocate memory for AAR */
+#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_PRIVACY)
+
+/* The NRF5340 supports up to 16 IRK entries */
+#if (MYNEWT_VAL(BLE_LL_RESOLV_LIST_SIZE) < 16)
+#define NRF_IRK_LIST_ENTRIES (MYNEWT_VAL(BLE_LL_RESOLV_LIST_SIZE))
+#else
+#define NRF_IRK_LIST_ENTRIES (16)
+#endif
+
+/* NOTE: each entry is 16 bytes long. */
+uint32_t g_nrf_irk_list[NRF_IRK_LIST_ENTRIES * 4];
+
+/* Current number of IRK entries */
+uint8_t g_nrf_num_irks;
+
+#endif
+
+/* Returns public device address or -1 if not present */
+int
+ble_hw_get_public_addr(ble_addr_t *addr)
+{
+ uint32_t addr_high;
+ uint32_t addr_low;
+
+ /* Does FICR have a public address */
+ if ((NRF_FICR_NS->DEVICEADDRTYPE & 1) != 0) {
+ return -1;
+ }
+
+ /* Copy into device address. We can do this because we know platform */
+ addr_low = NRF_FICR_NS->DEVICEADDR[0];
+ addr_high = NRF_FICR_NS->DEVICEADDR[1];
+ memcpy(addr->val, &addr_low, 4);
+ memcpy(&addr->val[4], &addr_high, 2);
+ addr->type = BLE_ADDR_PUBLIC;
+
+ return 0;
+}
+
+/* Returns random static address or -1 if not present */
+int
+ble_hw_get_static_addr(ble_addr_t *addr)
+{
+ int rc;
+
+ if ((NRF_FICR_NS->DEVICEADDRTYPE & 1) == 1) {
+ memcpy(addr->val, (void *)&NRF_FICR_NS->DEVICEADDR[0], 4);
+ memcpy(&addr->val[4], (void *)&NRF_FICR_NS->DEVICEADDR[1], 2);
+ addr->val[5] |= 0xc0;
+ addr->type = BLE_ADDR_RANDOM;
+ rc = 0;
+ } else {
+ rc = -1;
+ }
+
+ return rc;
+}
+
+/**
+ * Clear the whitelist
+ *
+ * @return int
+ */
+void
+ble_hw_whitelist_clear(void)
+{
+ NRF_RADIO_NS->DACNF = 0;
+ g_ble_hw_whitelist_mask = 0;
+}
+
+/**
+ * Add a device to the hw whitelist
+ *
+ * @param addr
+ * @param addr_type
+ *
+ * @return int 0: success, BLE error code otherwise
+ */
+int
+ble_hw_whitelist_add(const uint8_t *addr, uint8_t addr_type)
+{
+ int i;
+ uint32_t mask;
+
+ /* Find first ununsed device address match element */
+ mask = 0x01;
+ for (i = 0; i < BLE_HW_WHITE_LIST_SIZE; ++i) {
+ if ((mask & g_ble_hw_whitelist_mask) == 0) {
+ NRF_RADIO_NS->DAB[i] = get_le32(addr);
+ NRF_RADIO_NS->DAP[i] = get_le16(addr + 4);
+ if (addr_type == BLE_ADDR_RANDOM) {
+ NRF_RADIO_NS->DACNF |= (mask << 8);
+ }
+ g_ble_hw_whitelist_mask |= mask;
+ return BLE_ERR_SUCCESS;
+ }
+ mask <<= 1;
+ }
+
+ return BLE_ERR_MEM_CAPACITY;
+}
+
+/**
+ * Remove a device from the hw whitelist
+ *
+ * @param addr
+ * @param addr_type
+ *
+ */
+void
+ble_hw_whitelist_rmv(const uint8_t *addr, uint8_t addr_type)
+{
+ int i;
+ uint8_t cfg_addr;
+ uint16_t dap;
+ uint16_t txadd;
+ uint32_t dab;
+ uint32_t mask;
+
+ /* Find first ununsed device address match element */
+ dab = get_le32(addr);
+ dap = get_le16(addr + 4);
+ txadd = NRF_RADIO_NS->DACNF >> 8;
+ mask = 0x01;
+ for (i = 0; i < BLE_HW_WHITE_LIST_SIZE; ++i) {
+ if (mask & g_ble_hw_whitelist_mask) {
+ if ((dab == NRF_RADIO_NS->DAB[i]) && (dap == NRF_RADIO_NS->DAP[i])) {
+ cfg_addr = txadd & mask;
+ if (addr_type == BLE_ADDR_RANDOM) {
+ if (cfg_addr != 0) {
+ break;
+ }
+ } else {
+ if (cfg_addr == 0) {
+ break;
+ }
+ }
Review comment:
```
if (addr_type == !!(txadd & mask)) {
break;
}
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [mynewt-nimble] apache-mynewt-bot removed a comment on pull request #841: nimble/drivers: Add support for nRF5340 radio
Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot removed a comment on pull request #841:
URL: https://github.com/apache/mynewt-nimble/pull/841#issuecomment-656584287
<!-- style-bot -->
## Style check summary
### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
#### nimble/drivers/nrf5340/src/ble_phy.c
<details>
```diff
@@ -63,23 +63,32 @@
#define DPPI_PUBLISH_RTC0_EVENTS_COMPARE_0 ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << RTC_PUBLISH_COMPARE_CHIDX_Pos) | \
(RTC_PUBLISH_COMPARE_EN_Enabled << RTC_PUBLISH_COMPARE_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_START(_enable) ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << TIMER_SUBSCRIBE_START_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_START(_enable) ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << \
+ TIMER_SUBSCRIBE_START_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_START_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE1(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE1(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << \
+ TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE2(_enable) ((DPPI_CH_RADIO_EVENTS_END << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE2(_enable) ((DPPI_CH_RADIO_EVENTS_END << \
+ TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE3(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE3(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << \
+ TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_SUBSCRIBE_RADIO_TASKS_DISABLE(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_3 << RADIO_SUBSCRIBE_DISABLE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_RADIO_TASKS_DISABLE(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_3 << \
+ RADIO_SUBSCRIBE_DISABLE_CHIDX_Pos) | \
((_enable) << RADIO_SUBSCRIBE_DISABLE_EN_Pos))
-#define DPPI_SUBSCRIBE_RADIO_TASKS_RXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_RXEN_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_RADIO_TASKS_RXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << \
+ RADIO_SUBSCRIBE_RXEN_CHIDX_Pos) | \
((_enable) << RADIO_SUBSCRIBE_RXEN_EN_Pos))
-#define DPPI_SUBSCRIBE_RADIO_TASKS_TXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_TXEN_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_RADIO_TASKS_TXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << \
+ RADIO_SUBSCRIBE_TXEN_CHIDX_Pos) | \
((_enable) << RADIO_SUBSCRIBE_TXEN_EN_Pos))
-#define DPPI_SUBSCRIBE_AAR_TASKS_START(_enable) ((DPPI_CH_RADIO_EVENTS_BCMATCH << AAR_SUBSCRIBE_START_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_AAR_TASKS_START(_enable) ((DPPI_CH_RADIO_EVENTS_BCMATCH << \
+ AAR_SUBSCRIBE_START_CHIDX_Pos) | \
((_enable) << AAR_SUBSCRIBE_START_EN_Pos))
-#define DPPI_SUBSCRIBE_CCM_TASKS_CRYPT(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << CCM_SUBSCRIBE_CRYPT_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_CCM_TASKS_CRYPT(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << \
+ CCM_SUBSCRIBE_CRYPT_CHIDX_Pos) | \
((_enable) << CCM_SUBSCRIBE_CRYPT_EN_Pos))
extern uint8_t g_nrf_num_irks;
@@ -104,17 +113,17 @@
/* NRF_RADIO_NS->PCNF0 configuration values */
#define NRF_PCNF0 (NRF_LFLEN_BITS << RADIO_PCNF0_LFLEN_Pos) | \
- (RADIO_PCNF0_S1INCL_Msk) | \
- (NRF_S0LEN << RADIO_PCNF0_S0LEN_Pos) | \
- (NRF_S1LEN_BITS << RADIO_PCNF0_S1LEN_Pos)
+ (RADIO_PCNF0_S1INCL_Msk) | \
+ (NRF_S0LEN << RADIO_PCNF0_S0LEN_Pos) | \
+ (NRF_S1LEN_BITS << RADIO_PCNF0_S1LEN_Pos)
#define NRF_PCNF0_1M (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_8bit << RADIO_PCNF0_PLEN_Pos)
+ (RADIO_PCNF0_PLEN_8bit << RADIO_PCNF0_PLEN_Pos)
#define NRF_PCNF0_2M (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_16bit << RADIO_PCNF0_PLEN_Pos)
+ (RADIO_PCNF0_PLEN_16bit << RADIO_PCNF0_PLEN_Pos)
#define NRF_PCNF0_CODED (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_LongRange << RADIO_PCNF0_PLEN_Pos) | \
- (NRF_CILEN_BITS << RADIO_PCNF0_CILEN_Pos) | \
- (NRF_TERMLEN_BITS << RADIO_PCNF0_TERMLEN_Pos)
+ (RADIO_PCNF0_PLEN_LongRange << RADIO_PCNF0_PLEN_Pos) | \
+ (NRF_CILEN_BITS << RADIO_PCNF0_CILEN_Pos) | \
+ (NRF_TERMLEN_BITS << RADIO_PCNF0_TERMLEN_Pos)
/* BLE PHY data structure */
struct ble_phy_obj {
@@ -409,7 +418,7 @@
: [len] "+r" (rem_len)
: [dst] "r" (dst), [src] "r" (src)
: "r3", "memory"
- );
+ );
/* Copy header */
memcpy(BLE_MBUF_HDR_PTR(rxpdu), &g_ble_phy_data.rxhdr,
@@ -1094,7 +1103,7 @@
NRF_RADIO_NS->EVENTS_BCMATCH = 0;
NRF_AAR_NS->SUBSCRIBE_START = DPPI_SUBSCRIBE_AAR_TASKS_START(1);
NRF_RADIO_NS->BCC = (BLE_LL_PDU_HDR_LEN + adva_offset + BLE_DEV_ADDR_LEN) * 8 +
- g_ble_phy_data.phy_bcc_offset;
+ g_ble_phy_data.phy_bcc_offset;
}
#endif
@@ -1314,7 +1323,7 @@
*/
nrf_wait_disabled();
if ((NRF_RADIO_NS->STATE != RADIO_STATE_STATE_Disabled) &&
- ((NRF_RADIO_NS->STATE & 0x07) != RADIO_STATE_STATE_RxIdle)) {
+ ((NRF_RADIO_NS->STATE & 0x07) != RADIO_STATE_STATE_RxIdle)) {
ble_phy_disable();
STATS_INC(ble_phy_stats, radio_state_errs);
return BLE_PHY_ERR_RADIO_STATE;
@@ -1734,7 +1743,8 @@
ble_phy_disable_irq_and_ppi();
}
-uint32_t ble_phy_access_addr_get(void)
+uint32_t
+ble_phy_access_addr_get(void)
{
return g_ble_phy_data.phy_access_address;
}
```
</details>
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [mynewt-nimble] apache-mynewt-bot removed a comment on pull request #841: nimble/drivers: Add support for nRF5340 radio
Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot removed a comment on pull request #841:
URL: https://github.com/apache/mynewt-nimble/pull/841#issuecomment-655396066
<!-- style-bot -->
## Style check summary
### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
#### nimble/drivers/nrf5340/src/ble_phy.c
<details>
```diff
@@ -63,23 +63,32 @@
#define DPPI_PUBLISH_RTC0_EVENTS_COMPARE_0 ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << RTC_PUBLISH_COMPARE_CHIDX_Pos) | \
(RTC_PUBLISH_COMPARE_EN_Enabled << RTC_PUBLISH_COMPARE_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_START(_enable) ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << TIMER_SUBSCRIBE_START_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_START(_enable) ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << \
+ TIMER_SUBSCRIBE_START_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_START_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE1(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE1(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << \
+ TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE2(_enable) ((DPPI_CH_RADIO_EVENTS_END << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE2(_enable) ((DPPI_CH_RADIO_EVENTS_END << \
+ TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE3(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE3(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << \
+ TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_SUBSCRIBE_RADIO_TASKS_DISABLE(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_3 << RADIO_SUBSCRIBE_DISABLE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_RADIO_TASKS_DISABLE(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_3 << \
+ RADIO_SUBSCRIBE_DISABLE_CHIDX_Pos) | \
((_enable) << RADIO_SUBSCRIBE_DISABLE_EN_Pos))
-#define DPPI_SUBSCRIBE_RADIO_TASKS_RXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_RXEN_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_RADIO_TASKS_RXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << \
+ RADIO_SUBSCRIBE_RXEN_CHIDX_Pos) | \
((_enable) << RADIO_SUBSCRIBE_RXEN_EN_Pos))
-#define DPPI_SUBSCRIBE_RADIO_TASKS_TXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_TXEN_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_RADIO_TASKS_TXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << \
+ RADIO_SUBSCRIBE_TXEN_CHIDX_Pos) | \
((_enable) << RADIO_SUBSCRIBE_TXEN_EN_Pos))
-#define DPPI_SUBSCRIBE_AAR_TASKS_START(_enable) ((DPPI_CH_RADIO_EVENTS_BCMATCH << AAR_SUBSCRIBE_START_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_AAR_TASKS_START(_enable) ((DPPI_CH_RADIO_EVENTS_BCMATCH << \
+ AAR_SUBSCRIBE_START_CHIDX_Pos) | \
((_enable) << AAR_SUBSCRIBE_START_EN_Pos))
-#define DPPI_SUBSCRIBE_CCM_TASKS_CRYPT(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << CCM_SUBSCRIBE_CRYPT_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_CCM_TASKS_CRYPT(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << \
+ CCM_SUBSCRIBE_CRYPT_CHIDX_Pos) | \
((_enable) << CCM_SUBSCRIBE_CRYPT_EN_Pos))
extern uint8_t g_nrf_num_irks;
@@ -104,23 +113,22 @@
/* NRF_RADIO_NS->PCNF0 configuration values */
#define NRF_PCNF0 (NRF_LFLEN_BITS << RADIO_PCNF0_LFLEN_Pos) | \
- (RADIO_PCNF0_S1INCL_Msk) | \
- (NRF_S0LEN << RADIO_PCNF0_S0LEN_Pos) | \
- (NRF_S1LEN_BITS << RADIO_PCNF0_S1LEN_Pos)
+ (RADIO_PCNF0_S1INCL_Msk) | \
+ (NRF_S0LEN << RADIO_PCNF0_S0LEN_Pos) | \
+ (NRF_S1LEN_BITS << RADIO_PCNF0_S1LEN_Pos)
#define NRF_PCNF0_1M (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_8bit << RADIO_PCNF0_PLEN_Pos)
+ (RADIO_PCNF0_PLEN_8bit << RADIO_PCNF0_PLEN_Pos)
#define NRF_PCNF0_2M (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_16bit << RADIO_PCNF0_PLEN_Pos)
+ (RADIO_PCNF0_PLEN_16bit << RADIO_PCNF0_PLEN_Pos)
#define NRF_PCNF0_CODED (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_LongRange << RADIO_PCNF0_PLEN_Pos) | \
- (NRF_CILEN_BITS << RADIO_PCNF0_CILEN_Pos) | \
- (NRF_TERMLEN_BITS << RADIO_PCNF0_TERMLEN_Pos)
+ (RADIO_PCNF0_PLEN_LongRange << RADIO_PCNF0_PLEN_Pos) | \
+ (NRF_CILEN_BITS << RADIO_PCNF0_CILEN_Pos) | \
+ (NRF_TERMLEN_BITS << RADIO_PCNF0_TERMLEN_Pos)
/* BLE PHY data structure */
-struct ble_phy_obj
-{
+struct ble_phy_obj {
uint8_t phy_stats_initialized;
- int8_t phy_txpwr_dbm;
+ int8_t phy_txpwr_dbm;
uint8_t phy_chan;
uint8_t phy_state;
uint8_t phy_transition;
@@ -133,7 +141,7 @@
uint8_t phy_tx_phy_mode;
uint8_t phy_rx_phy_mode;
uint8_t phy_bcc_offset;
- int8_t rx_pwr_compensation;
+ int8_t rx_pwr_compensation;
uint32_t phy_aar_scratch;
uint32_t phy_access_address;
struct ble_mbuf_hdr rxhdr;
@@ -155,7 +163,7 @@
/* RF center frequency for each channel index (offset from 2400 MHz) */
static const uint8_t g_ble_phy_chan_freq[BLE_PHY_NUM_CHANS] = {
- 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, /* 0-9 */
+ 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, /* 0-9 */
24, 28, 30, 32, 34, 36, 38, 40, 42, 44, /* 10-19 */
46, 48, 50, 52, 54, 56, 58, 60, 62, 64, /* 20-29 */
66, 68, 70, 72, 74, 76, 78, 2, 26, 80, /* 30-39 */
@@ -207,36 +215,36 @@
/* Statistics */
STATS_SECT_START(ble_phy_stats)
- STATS_SECT_ENTRY(phy_isrs)
- STATS_SECT_ENTRY(tx_good)
- STATS_SECT_ENTRY(tx_fail)
- STATS_SECT_ENTRY(tx_late)
- STATS_SECT_ENTRY(tx_bytes)
- STATS_SECT_ENTRY(rx_starts)
- STATS_SECT_ENTRY(rx_aborts)
- STATS_SECT_ENTRY(rx_valid)
- STATS_SECT_ENTRY(rx_crc_err)
- STATS_SECT_ENTRY(rx_late)
- STATS_SECT_ENTRY(radio_state_errs)
- STATS_SECT_ENTRY(rx_hw_err)
- STATS_SECT_ENTRY(tx_hw_err)
+STATS_SECT_ENTRY(phy_isrs)
+STATS_SECT_ENTRY(tx_good)
+STATS_SECT_ENTRY(tx_fail)
+STATS_SECT_ENTRY(tx_late)
+STATS_SECT_ENTRY(tx_bytes)
+STATS_SECT_ENTRY(rx_starts)
+STATS_SECT_ENTRY(rx_aborts)
+STATS_SECT_ENTRY(rx_valid)
+STATS_SECT_ENTRY(rx_crc_err)
+STATS_SECT_ENTRY(rx_late)
+STATS_SECT_ENTRY(radio_state_errs)
+STATS_SECT_ENTRY(rx_hw_err)
+STATS_SECT_ENTRY(tx_hw_err)
STATS_SECT_END
STATS_SECT_DECL(ble_phy_stats) ble_phy_stats;
STATS_NAME_START(ble_phy_stats)
- STATS_NAME(ble_phy_stats, phy_isrs)
- STATS_NAME(ble_phy_stats, tx_good)
- STATS_NAME(ble_phy_stats, tx_fail)
- STATS_NAME(ble_phy_stats, tx_late)
- STATS_NAME(ble_phy_stats, tx_bytes)
- STATS_NAME(ble_phy_stats, rx_starts)
- STATS_NAME(ble_phy_stats, rx_aborts)
- STATS_NAME(ble_phy_stats, rx_valid)
- STATS_NAME(ble_phy_stats, rx_crc_err)
- STATS_NAME(ble_phy_stats, rx_late)
- STATS_NAME(ble_phy_stats, radio_state_errs)
- STATS_NAME(ble_phy_stats, rx_hw_err)
- STATS_NAME(ble_phy_stats, tx_hw_err)
+STATS_NAME(ble_phy_stats, phy_isrs)
+STATS_NAME(ble_phy_stats, tx_good)
+STATS_NAME(ble_phy_stats, tx_fail)
+STATS_NAME(ble_phy_stats, tx_late)
+STATS_NAME(ble_phy_stats, tx_bytes)
+STATS_NAME(ble_phy_stats, rx_starts)
+STATS_NAME(ble_phy_stats, rx_aborts)
+STATS_NAME(ble_phy_stats, rx_valid)
+STATS_NAME(ble_phy_stats, rx_crc_err)
+STATS_NAME(ble_phy_stats, rx_late)
+STATS_NAME(ble_phy_stats, radio_state_errs)
+STATS_NAME(ble_phy_stats, rx_hw_err)
+STATS_NAME(ble_phy_stats, tx_hw_err)
STATS_NAME_END(ble_phy_stats)
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LE_ENCRYPTION)
@@ -254,8 +262,7 @@
static uint32_t nrf_encrypt_scratchpad[NRF_ENC_SCRATCH_WORDS];
-struct nrf_ccm_data
-{
+struct nrf_ccm_data {
uint8_t key[16];
uint64_t pkt_counter;
uint8_t dir_bit;
@@ -323,16 +330,16 @@
{
#if (BLE_LL_BT5_PHY_SUPPORTED == 1)
switch (g_ble_phy_data.phy_cur_phy_mode) {
- case BLE_PHY_MODE_1M:
- return BLE_PHY_1M;
- case BLE_PHY_MODE_2M:
- return BLE_PHY_2M;
- case BLE_PHY_MODE_CODED_125KBPS:
- case BLE_PHY_MODE_CODED_500KBPS:
- return BLE_PHY_CODED;
- default:
- assert(0);
- return -1;
+ case BLE_PHY_MODE_1M:
+ return BLE_PHY_1M;
+ case BLE_PHY_MODE_2M:
+ return BLE_PHY_2M;
+ case BLE_PHY_MODE_CODED_125KBPS:
+ case BLE_PHY_MODE_CODED_500KBPS:
+ return BLE_PHY_CODED;
+ default:
+ assert(0);
+ return -1;
}
#else
return BLE_PHY_1M;
@@ -399,10 +406,10 @@
" adds %[src], %[src], r4 \n"
" adds %[dst], %[dst], r4 \n"
: [dst] "+r" (dst), [src] "+r" (src),
- [len] "+r" (copy_len)
+ [len] "+r" (copy_len)
:
: "r3", "r4", "memory"
- );
+ );
if ((rem_len < 4) && (block_rem_len >= rem_len)) {
break;
@@ -424,7 +431,7 @@
: [len] "+r" (rem_len)
: [dst] "r" (dst), [src] "r" (src)
: "r3", "memory"
- );
+ );
/* Copy header */
memcpy(BLE_MBUF_HDR_PTR(rxpdu), &g_ble_phy_data.rxhdr,
@@ -715,7 +722,7 @@
NRF_CCM_NS->OUTPTR = (uint32_t)dptr;
NRF_CCM_NS->SCRATCHPTR = (uint32_t)&nrf_encrypt_scratchpad[0];
NRF_CCM_NS->MODE = CCM_MODE_LENGTH_Msk | CCM_MODE_MODE_Decryption |
- ble_phy_get_ccm_datarate();
+ ble_phy_get_ccm_datarate();
NRF_CCM_NS->CNFPTR = (uint32_t)&nrf_ccm_data;
NRF_CCM_NS->SHORTS = 0;
NRF_CCM_NS->EVENTS_ERROR = 0;
@@ -760,7 +767,7 @@
* to take this into account when setting up BCC.
*/
if (g_ble_phy_data.phy_cur_phy_mode == BLE_PHY_MODE_CODED_125KBPS ||
- g_ble_phy_data.phy_cur_phy_mode == BLE_PHY_MODE_CODED_500KBPS) {
+ g_ble_phy_data.phy_cur_phy_mode == BLE_PHY_MODE_CODED_500KBPS) {
g_ble_phy_data.phy_bcc_offset = 5;
} else {
g_ble_phy_data.phy_bcc_offset = 0;
@@ -777,10 +784,10 @@
NRF_RADIO_NS->EVENTS_RSSIEND = 0;
NRF_RADIO_NS->EVENTS_CRCOK = 0;
NRF_RADIO_NS->SHORTS = RADIO_SHORTS_END_DISABLE_Msk |
- RADIO_SHORTS_READY_START_Msk |
- RADIO_SHORTS_ADDRESS_BCSTART_Msk |
- RADIO_SHORTS_ADDRESS_RSSISTART_Msk |
- RADIO_SHORTS_DISABLED_RSSISTOP_Msk;
+ RADIO_SHORTS_READY_START_Msk |
+ RADIO_SHORTS_ADDRESS_BCSTART_Msk |
+ RADIO_SHORTS_ADDRESS_RSSISTART_Msk |
+ RADIO_SHORTS_DISABLED_RSSISTOP_Msk;
NRF_RADIO_NS->INTENSET = RADIO_INTENSET_ADDRESS_Msk;
}
@@ -888,10 +895,10 @@
* using CI field.
*/
if ((phy == BLE_PHY_MODE_CODED_125KBPS) ||
- (phy == BLE_PHY_MODE_CODED_500KBPS)) {
+ (phy == BLE_PHY_MODE_CODED_500KBPS)) {
phy = NRF_RADIO_NS->PDUSTAT & RADIO_PDUSTAT_CISTAT_Msk ?
- BLE_PHY_MODE_CODED_500KBPS :
- BLE_PHY_MODE_CODED_125KBPS;
+ BLE_PHY_MODE_CODED_500KBPS :
+ BLE_PHY_MODE_CODED_125KBPS;
}
#endif
@@ -1125,7 +1132,7 @@
NRF_RADIO_NS->EVENTS_BCMATCH = 0;
NRF_AAR_NS->SUBSCRIBE_START = DPPI_SUBSCRIBE_AAR_TASKS_START(1);
NRF_RADIO_NS->BCC = (BLE_LL_PDU_HDR_LEN + adva_offset + BLE_DEV_ADDR_LEN) * 8 +
- g_ble_phy_data.phy_bcc_offset;
+ g_ble_phy_data.phy_bcc_offset;
}
#endif
@@ -1252,16 +1259,16 @@
/* XXX: should maxlen be 251 for encryption? */
NRF_RADIO_NS->PCNF1 = NRF_MAXLEN |
- (RADIO_PCNF1_ENDIAN_Little << RADIO_PCNF1_ENDIAN_Pos) |
- (NRF_BALEN << RADIO_PCNF1_BALEN_Pos) |
- RADIO_PCNF1_WHITEEN_Msk;
+ (RADIO_PCNF1_ENDIAN_Little << RADIO_PCNF1_ENDIAN_Pos) |
+ (NRF_BALEN << RADIO_PCNF1_BALEN_Pos) |
+ RADIO_PCNF1_WHITEEN_Msk;
/* Enable radio fast ramp-up */
NRF_RADIO_NS->MODECNF0 |= (RADIO_MODECNF0_RU_Fast << RADIO_MODECNF0_RU_Pos) & RADIO_MODECNF0_RU_Msk;
/* Set logical address 1 for TX and RX */
- NRF_RADIO_NS->TXADDRESS = 0;
- NRF_RADIO_NS->RXADDRESSES = (1 << 0);
+ NRF_RADIO_NS->TXADDRESS = 0;
+ NRF_RADIO_NS->RXADDRESSES = (1 << 0);
/* Configure the CRC registers */
NRF_RADIO_NS->CRCCNF = (RADIO_CRCCNF_SKIPADDR_Skip << RADIO_CRCCNF_SKIPADDR_Pos) | RADIO_CRCCNF_LEN_Three;
@@ -1331,7 +1338,7 @@
"ble_phy");
assert(rc == 0);
- g_ble_phy_data.phy_stats_initialized = 1;
+ g_ble_phy_data.phy_stats_initialized = 1;
}
return 0;
@@ -1357,7 +1364,7 @@
*/
nrf_wait_disabled();
if ((NRF_RADIO_NS->STATE != RADIO_STATE_STATE_Disabled) &&
- ((NRF_RADIO_NS->STATE & 0x07) != RADIO_STATE_STATE_RxIdle)) {
+ ((NRF_RADIO_NS->STATE & 0x07) != RADIO_STATE_STATE_RxIdle)) {
ble_phy_disable();
STATS_INC(ble_phy_stats, radio_state_errs);
return BLE_PHY_ERR_RADIO_STATE;
@@ -1673,7 +1680,8 @@
*
* @return int Rounded power in dBm
*/
-int ble_phy_txpower_round(int dbm)
+int
+ble_phy_txpower_round(int dbm)
{
/* "Rail" power level if outside supported range */
@@ -1877,7 +1885,8 @@
}
/* Gets the current access address */
-uint32_t ble_phy_access_addr_get(void)
+uint32_t
+ble_phy_access_addr_get(void)
{
return g_ble_phy_data.phy_access_address;
}
@@ -1946,7 +1955,8 @@
#endif
#if MYNEWT_VAL(BLE_LL_DTM)
-void ble_phy_enable_dtm(void)
+void
+ble_phy_enable_dtm(void)
{
/* When DTM is enabled we need to disable whitening as per
* Bluetooth v5.0 Vol 6. Part F. 4.1.1
@@ -1954,7 +1964,8 @@
NRF_RADIO_NS->PCNF1 &= ~RADIO_PCNF1_WHITEEN_Msk;
}
-void ble_phy_disable_dtm(void)
+void
+ble_phy_disable_dtm(void)
{
/* Enable whitening */
NRF_RADIO_NS->PCNF1 |= RADIO_PCNF1_WHITEEN_Msk;
```
</details>
#### nimble/drivers/nrf5340/src/ble_phy_trace.c
<details>
```diff
@@ -38,7 +38,7 @@
ble_phy_trace_init(void)
{
ble_phy_trace_off =
- os_trace_module_register(&g_ble_phy_trace_mod, "ble_phy", 3,
+ os_trace_module_register(&g_ble_phy_trace_mod, "ble_phy", 3,
ble_phy_trace_module_send_desc);
}
#endif
```
</details>
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [mynewt-nimble] andrzej-kaczmarek commented on a change in pull request #841: nimble/drivers: Add support for nRF5340 radio
Posted by GitBox <gi...@apache.org>.
andrzej-kaczmarek commented on a change in pull request #841:
URL: https://github.com/apache/mynewt-nimble/pull/841#discussion_r492021557
##########
File path: nimble/drivers/nrf5340/src/ble_hw.c
##########
@@ -0,0 +1,483 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <stdint.h>
+#include <assert.h>
+#include <string.h>
+#include <syscfg/syscfg.h>
+#include <os/os.h>
+#include <nimble/ble.h>
+#include <nimble/nimble_opt.h>
+#include <controller/ble_hw.h>
+
+#include <ble/xcvr.h>
+#include <mcu/cmsis_nvic.h>
+#include <os/os_trace_api.h>
+
+/* Total number of resolving list elements */
+#define BLE_HW_RESOLV_LIST_SIZE (16)
+
+/* We use this to keep track of which entries are set to valid addresses */
+static uint8_t g_ble_hw_whitelist_mask;
+
+/* Random number generator isr callback */
+static ble_rng_isr_cb_t ble_rng_isr_cb;
+
+/* If LL privacy is enabled, allocate memory for AAR */
+#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_PRIVACY)
+
+/* The NRF5340 supports up to 16 IRK entries */
+#if (MYNEWT_VAL(BLE_LL_RESOLV_LIST_SIZE) < 16)
+#define NRF_IRK_LIST_ENTRIES (MYNEWT_VAL(BLE_LL_RESOLV_LIST_SIZE))
+#else
+#define NRF_IRK_LIST_ENTRIES (16)
+#endif
+
+/* NOTE: each entry is 16 bytes long. */
+uint32_t g_nrf_irk_list[NRF_IRK_LIST_ENTRIES * 4];
+
+/* Current number of IRK entries */
+uint8_t g_nrf_num_irks;
+
+#endif
+
+/* Returns public device address or -1 if not present */
+int
+ble_hw_get_public_addr(ble_addr_t *addr)
+{
+ uint32_t addr_high;
+ uint32_t addr_low;
+
+ /* Does FICR have a public address */
+ if ((NRF_FICR_NS->DEVICEADDRTYPE & 1) != 0) {
+ return -1;
+ }
+
+ /* Copy into device address. We can do this because we know platform */
+ addr_low = NRF_FICR_NS->DEVICEADDR[0];
+ addr_high = NRF_FICR_NS->DEVICEADDR[1];
+ memcpy(addr->val, &addr_low, 4);
+ memcpy(&addr->val[4], &addr_high, 2);
+ addr->type = BLE_ADDR_PUBLIC;
+
+ return 0;
+}
+
+/* Returns random static address or -1 if not present */
+int
+ble_hw_get_static_addr(ble_addr_t *addr)
+{
+ int rc;
+
+ if ((NRF_FICR_NS->DEVICEADDRTYPE & 1) == 1) {
+ memcpy(addr->val, (void *)&NRF_FICR_NS->DEVICEADDR[0], 4);
+ memcpy(&addr->val[4], (void *)&NRF_FICR_NS->DEVICEADDR[1], 2);
+ addr->val[5] |= 0xc0;
+ addr->type = BLE_ADDR_RANDOM;
+ rc = 0;
+ } else {
+ rc = -1;
+ }
+
+ return rc;
+}
+
+/**
+ * Clear the whitelist
+ *
+ * @return int
+ */
+void
+ble_hw_whitelist_clear(void)
+{
+ NRF_RADIO_NS->DACNF = 0;
+ g_ble_hw_whitelist_mask = 0;
+}
+
+/**
+ * Add a device to the hw whitelist
+ *
+ * @param addr
+ * @param addr_type
+ *
+ * @return int 0: success, BLE error code otherwise
+ */
+int
+ble_hw_whitelist_add(const uint8_t *addr, uint8_t addr_type)
+{
+ int i;
+ uint32_t mask;
+
+ /* Find first ununsed device address match element */
+ mask = 0x01;
+ for (i = 0; i < BLE_HW_WHITE_LIST_SIZE; ++i) {
+ if ((mask & g_ble_hw_whitelist_mask) == 0) {
+ NRF_RADIO_NS->DAB[i] = get_le32(addr);
+ NRF_RADIO_NS->DAP[i] = get_le16(addr + 4);
+ if (addr_type == BLE_ADDR_RANDOM) {
+ NRF_RADIO_NS->DACNF |= (mask << 8);
+ }
+ g_ble_hw_whitelist_mask |= mask;
+ return BLE_ERR_SUCCESS;
+ }
+ mask <<= 1;
+ }
+
+ return BLE_ERR_MEM_CAPACITY;
+}
+
+/**
+ * Remove a device from the hw whitelist
+ *
+ * @param addr
+ * @param addr_type
+ *
+ */
+void
+ble_hw_whitelist_rmv(const uint8_t *addr, uint8_t addr_type)
+{
+ int i;
+ uint8_t cfg_addr;
+ uint16_t dap;
+ uint16_t txadd;
+ uint32_t dab;
+ uint32_t mask;
+
+ /* Find first ununsed device address match element */
+ dab = get_le32(addr);
+ dap = get_le16(addr + 4);
+ txadd = NRF_RADIO_NS->DACNF >> 8;
+ mask = 0x01;
+ for (i = 0; i < BLE_HW_WHITE_LIST_SIZE; ++i) {
+ if (mask & g_ble_hw_whitelist_mask) {
+ if ((dab == NRF_RADIO_NS->DAB[i]) && (dap == NRF_RADIO_NS->DAP[i])) {
+ cfg_addr = txadd & mask;
+ if (addr_type == BLE_ADDR_RANDOM) {
+ if (cfg_addr != 0) {
+ break;
+ }
+ } else {
+ if (cfg_addr == 0) {
+ break;
+ }
+ }
Review comment:
```
if (addr_type == !!(txadd & mask)) {
break;
}
```
##########
File path: nimble/drivers/nrf5340/src/ble_hw.c
##########
@@ -0,0 +1,483 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <stdint.h>
+#include <assert.h>
+#include <string.h>
+#include <syscfg/syscfg.h>
+#include <os/os.h>
+#include <nimble/ble.h>
+#include <nimble/nimble_opt.h>
+#include <controller/ble_hw.h>
+
+#include <ble/xcvr.h>
+#include <mcu/cmsis_nvic.h>
+#include <os/os_trace_api.h>
+
+/* Total number of resolving list elements */
+#define BLE_HW_RESOLV_LIST_SIZE (16)
+
+/* We use this to keep track of which entries are set to valid addresses */
+static uint8_t g_ble_hw_whitelist_mask;
+
+/* Random number generator isr callback */
+static ble_rng_isr_cb_t ble_rng_isr_cb;
+
+/* If LL privacy is enabled, allocate memory for AAR */
+#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_PRIVACY)
+
+/* The NRF5340 supports up to 16 IRK entries */
+#if (MYNEWT_VAL(BLE_LL_RESOLV_LIST_SIZE) < 16)
+#define NRF_IRK_LIST_ENTRIES (MYNEWT_VAL(BLE_LL_RESOLV_LIST_SIZE))
+#else
+#define NRF_IRK_LIST_ENTRIES (16)
+#endif
+
+/* NOTE: each entry is 16 bytes long. */
+uint32_t g_nrf_irk_list[NRF_IRK_LIST_ENTRIES * 4];
+
+/* Current number of IRK entries */
+uint8_t g_nrf_num_irks;
+
+#endif
+
+/* Returns public device address or -1 if not present */
+int
+ble_hw_get_public_addr(ble_addr_t *addr)
+{
+ uint32_t addr_high;
+ uint32_t addr_low;
+
+ /* Does FICR have a public address */
+ if ((NRF_FICR_NS->DEVICEADDRTYPE & 1) != 0) {
+ return -1;
+ }
+
+ /* Copy into device address. We can do this because we know platform */
+ addr_low = NRF_FICR_NS->DEVICEADDR[0];
+ addr_high = NRF_FICR_NS->DEVICEADDR[1];
+ memcpy(addr->val, &addr_low, 4);
+ memcpy(&addr->val[4], &addr_high, 2);
+ addr->type = BLE_ADDR_PUBLIC;
+
+ return 0;
+}
+
+/* Returns random static address or -1 if not present */
+int
+ble_hw_get_static_addr(ble_addr_t *addr)
+{
+ int rc;
+
+ if ((NRF_FICR_NS->DEVICEADDRTYPE & 1) == 1) {
+ memcpy(addr->val, (void *)&NRF_FICR_NS->DEVICEADDR[0], 4);
+ memcpy(&addr->val[4], (void *)&NRF_FICR_NS->DEVICEADDR[1], 2);
+ addr->val[5] |= 0xc0;
+ addr->type = BLE_ADDR_RANDOM;
+ rc = 0;
+ } else {
+ rc = -1;
+ }
+
+ return rc;
+}
+
+/**
+ * Clear the whitelist
+ *
+ * @return int
+ */
+void
+ble_hw_whitelist_clear(void)
+{
+ NRF_RADIO_NS->DACNF = 0;
+ g_ble_hw_whitelist_mask = 0;
+}
+
+/**
+ * Add a device to the hw whitelist
+ *
+ * @param addr
+ * @param addr_type
+ *
+ * @return int 0: success, BLE error code otherwise
+ */
+int
+ble_hw_whitelist_add(const uint8_t *addr, uint8_t addr_type)
+{
+ int i;
+ uint32_t mask;
+
+ /* Find first ununsed device address match element */
+ mask = 0x01;
+ for (i = 0; i < BLE_HW_WHITE_LIST_SIZE; ++i) {
+ if ((mask & g_ble_hw_whitelist_mask) == 0) {
+ NRF_RADIO_NS->DAB[i] = get_le32(addr);
+ NRF_RADIO_NS->DAP[i] = get_le16(addr + 4);
+ if (addr_type == BLE_ADDR_RANDOM) {
+ NRF_RADIO_NS->DACNF |= (mask << 8);
+ }
+ g_ble_hw_whitelist_mask |= mask;
+ return BLE_ERR_SUCCESS;
+ }
+ mask <<= 1;
+ }
+
+ return BLE_ERR_MEM_CAPACITY;
+}
+
+/**
+ * Remove a device from the hw whitelist
+ *
+ * @param addr
+ * @param addr_type
+ *
+ */
+void
+ble_hw_whitelist_rmv(const uint8_t *addr, uint8_t addr_type)
+{
+ int i;
+ uint8_t cfg_addr;
+ uint16_t dap;
+ uint16_t txadd;
+ uint32_t dab;
+ uint32_t mask;
+
+ /* Find first ununsed device address match element */
+ dab = get_le32(addr);
+ dap = get_le16(addr + 4);
+ txadd = NRF_RADIO_NS->DACNF >> 8;
+ mask = 0x01;
+ for (i = 0; i < BLE_HW_WHITE_LIST_SIZE; ++i) {
+ if (mask & g_ble_hw_whitelist_mask) {
+ if ((dab == NRF_RADIO_NS->DAB[i]) && (dap == NRF_RADIO_NS->DAP[i])) {
+ cfg_addr = txadd & mask;
+ if (addr_type == BLE_ADDR_RANDOM) {
+ if (cfg_addr != 0) {
+ break;
+ }
+ } else {
+ if (cfg_addr == 0) {
+ break;
+ }
+ }
+ }
+ }
+ mask <<= 1;
+ }
+
+ if (i < BLE_HW_WHITE_LIST_SIZE) {
+ g_ble_hw_whitelist_mask &= ~mask;
+ NRF_RADIO_NS->DACNF &= ~mask;
+ }
+}
+
+/**
+ * Returns the size of the whitelist in HW
+ *
+ * @return int Number of devices allowed in whitelist
+ */
+uint8_t
+ble_hw_whitelist_size(void)
+{
+ return BLE_HW_WHITE_LIST_SIZE;
+}
+
+/**
+ * Enable the whitelisted devices
+ */
+void
+ble_hw_whitelist_enable(void)
+{
+ /* Enable the configured device addresses */
+ NRF_RADIO_NS->DACNF |= g_ble_hw_whitelist_mask;
+}
+
+/**
+ * Disables the whitelisted devices
+ */
+void
+ble_hw_whitelist_disable(void)
+{
+ /* Disable all whitelist devices */
+ NRF_RADIO_NS->DACNF &= 0x0000ff00;
+}
+
+/**
+ * Boolean function which returns true ('1') if there is a match on the
+ * whitelist.
+ *
+ * @return int
+ */
+int
+ble_hw_whitelist_match(void)
+{
+ return NRF_RADIO_NS->EVENTS_DEVMATCH ? 1 : 0;
Review comment:
`EVENT_DEVMATCH` is already a single bit register
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [mynewt-nimble] apache-mynewt-bot removed a comment on pull request #841: nimble/drivers: Add support for nRF5340 radio
Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot removed a comment on pull request #841:
URL: https://github.com/apache/mynewt-nimble/pull/841#issuecomment-656597114
<!-- style-bot -->
## Style check summary
### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
#### nimble/drivers/nrf5340/src/ble_phy.c
<details>
```diff
@@ -63,23 +63,32 @@
#define DPPI_PUBLISH_RTC0_EVENTS_COMPARE_0 ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << RTC_PUBLISH_COMPARE_CHIDX_Pos) | \
(RTC_PUBLISH_COMPARE_EN_Enabled << RTC_PUBLISH_COMPARE_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_START(_enable) ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << TIMER_SUBSCRIBE_START_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_START(_enable) ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << \
+ TIMER_SUBSCRIBE_START_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_START_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE1(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE1(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << \
+ TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE2(_enable) ((DPPI_CH_RADIO_EVENTS_END << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE2(_enable) ((DPPI_CH_RADIO_EVENTS_END << \
+ TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE3(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE3(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << \
+ TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_SUBSCRIBE_RADIO_TASKS_DISABLE(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_3 << RADIO_SUBSCRIBE_DISABLE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_RADIO_TASKS_DISABLE(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_3 << \
+ RADIO_SUBSCRIBE_DISABLE_CHIDX_Pos) | \
((_enable) << RADIO_SUBSCRIBE_DISABLE_EN_Pos))
-#define DPPI_SUBSCRIBE_RADIO_TASKS_RXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_RXEN_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_RADIO_TASKS_RXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << \
+ RADIO_SUBSCRIBE_RXEN_CHIDX_Pos) | \
((_enable) << RADIO_SUBSCRIBE_RXEN_EN_Pos))
-#define DPPI_SUBSCRIBE_RADIO_TASKS_TXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_TXEN_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_RADIO_TASKS_TXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << \
+ RADIO_SUBSCRIBE_TXEN_CHIDX_Pos) | \
((_enable) << RADIO_SUBSCRIBE_TXEN_EN_Pos))
-#define DPPI_SUBSCRIBE_AAR_TASKS_START(_enable) ((DPPI_CH_RADIO_EVENTS_BCMATCH << AAR_SUBSCRIBE_START_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_AAR_TASKS_START(_enable) ((DPPI_CH_RADIO_EVENTS_BCMATCH << \
+ AAR_SUBSCRIBE_START_CHIDX_Pos) | \
((_enable) << AAR_SUBSCRIBE_START_EN_Pos))
-#define DPPI_SUBSCRIBE_CCM_TASKS_CRYPT(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << CCM_SUBSCRIBE_CRYPT_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_CCM_TASKS_CRYPT(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << \
+ CCM_SUBSCRIBE_CRYPT_CHIDX_Pos) | \
((_enable) << CCM_SUBSCRIBE_CRYPT_EN_Pos))
extern uint8_t g_nrf_num_irks;
@@ -104,17 +113,17 @@
/* NRF_RADIO_NS->PCNF0 configuration values */
#define NRF_PCNF0 (NRF_LFLEN_BITS << RADIO_PCNF0_LFLEN_Pos) | \
- (RADIO_PCNF0_S1INCL_Msk) | \
- (NRF_S0LEN << RADIO_PCNF0_S0LEN_Pos) | \
- (NRF_S1LEN_BITS << RADIO_PCNF0_S1LEN_Pos)
+ (RADIO_PCNF0_S1INCL_Msk) | \
+ (NRF_S0LEN << RADIO_PCNF0_S0LEN_Pos) | \
+ (NRF_S1LEN_BITS << RADIO_PCNF0_S1LEN_Pos)
#define NRF_PCNF0_1M (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_8bit << RADIO_PCNF0_PLEN_Pos)
+ (RADIO_PCNF0_PLEN_8bit << RADIO_PCNF0_PLEN_Pos)
#define NRF_PCNF0_2M (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_16bit << RADIO_PCNF0_PLEN_Pos)
+ (RADIO_PCNF0_PLEN_16bit << RADIO_PCNF0_PLEN_Pos)
#define NRF_PCNF0_CODED (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_LongRange << RADIO_PCNF0_PLEN_Pos) | \
- (NRF_CILEN_BITS << RADIO_PCNF0_CILEN_Pos) | \
- (NRF_TERMLEN_BITS << RADIO_PCNF0_TERMLEN_Pos)
+ (RADIO_PCNF0_PLEN_LongRange << RADIO_PCNF0_PLEN_Pos) | \
+ (NRF_CILEN_BITS << RADIO_PCNF0_CILEN_Pos) | \
+ (NRF_TERMLEN_BITS << RADIO_PCNF0_TERMLEN_Pos)
/* BLE PHY data structure */
struct ble_phy_obj {
@@ -1094,7 +1103,7 @@
NRF_RADIO_NS->EVENTS_BCMATCH = 0;
NRF_AAR_NS->SUBSCRIBE_START = DPPI_SUBSCRIBE_AAR_TASKS_START(1);
NRF_RADIO_NS->BCC = (BLE_LL_PDU_HDR_LEN + adva_offset + BLE_DEV_ADDR_LEN) * 8 +
- g_ble_phy_data.phy_bcc_offset;
+ g_ble_phy_data.phy_bcc_offset;
}
#endif
```
</details>
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [mynewt-nimble] apache-mynewt-bot removed a comment on pull request #841: nimble/drivers: Add support for nRF5340 radio
Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot removed a comment on pull request #841:
URL: https://github.com/apache/mynewt-nimble/pull/841#issuecomment-696133538
<!-- style-bot -->
## Style check summary
### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
#### nimble/drivers/nrf5340/src/ble_phy.c
<details>
```diff
@@ -63,23 +63,32 @@
#define DPPI_PUBLISH_RTC0_EVENTS_COMPARE_0 ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << RTC_PUBLISH_COMPARE_CHIDX_Pos) | \
(RTC_PUBLISH_COMPARE_EN_Enabled << RTC_PUBLISH_COMPARE_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_START(_enable) ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << TIMER_SUBSCRIBE_START_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_START(_enable) ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << \
+ TIMER_SUBSCRIBE_START_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_START_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE1(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE1(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << \
+ TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE2(_enable) ((DPPI_CH_RADIO_EVENTS_END << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE2(_enable) ((DPPI_CH_RADIO_EVENTS_END << \
+ TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE3(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE3(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << \
+ TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_SUBSCRIBE_RADIO_TASKS_DISABLE(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_3 << RADIO_SUBSCRIBE_DISABLE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_RADIO_TASKS_DISABLE(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_3 << \
+ RADIO_SUBSCRIBE_DISABLE_CHIDX_Pos) | \
((_enable) << RADIO_SUBSCRIBE_DISABLE_EN_Pos))
-#define DPPI_SUBSCRIBE_RADIO_TASKS_RXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_RXEN_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_RADIO_TASKS_RXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << \
+ RADIO_SUBSCRIBE_RXEN_CHIDX_Pos) | \
((_enable) << RADIO_SUBSCRIBE_RXEN_EN_Pos))
-#define DPPI_SUBSCRIBE_RADIO_TASKS_TXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_TXEN_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_RADIO_TASKS_TXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << \
+ RADIO_SUBSCRIBE_TXEN_CHIDX_Pos) | \
((_enable) << RADIO_SUBSCRIBE_TXEN_EN_Pos))
-#define DPPI_SUBSCRIBE_AAR_TASKS_START(_enable) ((DPPI_CH_RADIO_EVENTS_BCMATCH << AAR_SUBSCRIBE_START_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_AAR_TASKS_START(_enable) ((DPPI_CH_RADIO_EVENTS_BCMATCH << \
+ AAR_SUBSCRIBE_START_CHIDX_Pos) | \
((_enable) << AAR_SUBSCRIBE_START_EN_Pos))
-#define DPPI_SUBSCRIBE_CCM_TASKS_CRYPT(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << CCM_SUBSCRIBE_CRYPT_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_CCM_TASKS_CRYPT(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << \
+ CCM_SUBSCRIBE_CRYPT_CHIDX_Pos) | \
((_enable) << CCM_SUBSCRIBE_CRYPT_EN_Pos))
extern uint8_t g_nrf_num_irks;
@@ -104,17 +113,17 @@
/* NRF_RADIO_NS->PCNF0 configuration values */
#define NRF_PCNF0 (NRF_LFLEN_BITS << RADIO_PCNF0_LFLEN_Pos) | \
- (RADIO_PCNF0_S1INCL_Msk) | \
- (NRF_S0LEN << RADIO_PCNF0_S0LEN_Pos) | \
- (NRF_S1LEN_BITS << RADIO_PCNF0_S1LEN_Pos)
+ (RADIO_PCNF0_S1INCL_Msk) | \
+ (NRF_S0LEN << RADIO_PCNF0_S0LEN_Pos) | \
+ (NRF_S1LEN_BITS << RADIO_PCNF0_S1LEN_Pos)
#define NRF_PCNF0_1M (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_8bit << RADIO_PCNF0_PLEN_Pos)
+ (RADIO_PCNF0_PLEN_8bit << RADIO_PCNF0_PLEN_Pos)
#define NRF_PCNF0_2M (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_16bit << RADIO_PCNF0_PLEN_Pos)
+ (RADIO_PCNF0_PLEN_16bit << RADIO_PCNF0_PLEN_Pos)
#define NRF_PCNF0_CODED (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_LongRange << RADIO_PCNF0_PLEN_Pos) | \
- (NRF_CILEN_BITS << RADIO_PCNF0_CILEN_Pos) | \
- (NRF_TERMLEN_BITS << RADIO_PCNF0_TERMLEN_Pos)
+ (RADIO_PCNF0_PLEN_LongRange << RADIO_PCNF0_PLEN_Pos) | \
+ (NRF_CILEN_BITS << RADIO_PCNF0_CILEN_Pos) | \
+ (NRF_TERMLEN_BITS << RADIO_PCNF0_TERMLEN_Pos)
/* BLE PHY data structure */
struct ble_phy_obj {
```
</details>
#### nimble/transport/nrf5340/src/nrf5340_ble_hci.c
<details>
```diff
@@ -216,7 +216,7 @@
if (buf) {
break;
}
- /* no break */
+ /* no break */
case BLE_HCI_TRANS_BUF_EVT_LO:
buf = os_memblock_get(&nrf5340_ble_hci_pool_evt_lo);
break;
```
</details>
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [mynewt-nimble] apache-mynewt-bot removed a comment on pull request #841: nimble/drivers: Add support for nRF5340 radio
Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot removed a comment on pull request #841:
URL: https://github.com/apache/mynewt-nimble/pull/841#issuecomment-654910917
<!-- style-bot -->
## Style check summary
### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
#### nimble/drivers/nrf5340/src/ble_phy.c
<details>
```diff
@@ -66,13 +66,18 @@
#define DPPI_SUBSCRIBE_TIMER0_TASKS_START ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << TIMER_SUBSCRIBE_START_CHIDX_Pos) | \
(TIMER_SUBSCRIBE_START_EN_Enabled << TIMER_SUBSCRIBE_START_EN_Pos))
#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE1 ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
- (TIMER_SUBSCRIBE_CAPTURE_EN_Enabled << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
+ (TIMER_SUBSCRIBE_CAPTURE_EN_Enabled << \
+ TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE2 ((DPPI_CH_RADIO_EVENTS_END << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
- (TIMER_SUBSCRIBE_CAPTURE_EN_Enabled << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
+ (TIMER_SUBSCRIBE_CAPTURE_EN_Enabled << \
+ TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE3 ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
- (TIMER_SUBSCRIBE_CAPTURE_EN_Enabled << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_SUBSCRIBE_RADIO_TASKS_DISABLE ((DPPI_CH_TIMER0_EVENTS_COMPARE_3 << RADIO_SUBSCRIBE_DISABLE_CHIDX_Pos) | \
- (RADIO_SUBSCRIBE_DISABLE_EN_Enabled << RADIO_SUBSCRIBE_DISABLE_EN_Pos))
+ (TIMER_SUBSCRIBE_CAPTURE_EN_Enabled << \
+ TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
+#define DPPI_SUBSCRIBE_RADIO_TASKS_DISABLE ((DPPI_CH_TIMER0_EVENTS_COMPARE_3 << \
+ RADIO_SUBSCRIBE_DISABLE_CHIDX_Pos) | \
+ (RADIO_SUBSCRIBE_DISABLE_EN_Enabled << \
+ RADIO_SUBSCRIBE_DISABLE_EN_Pos))
#define DPPI_SUBSCRIBE_RADIO_TASKS_RXEN ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_RXEN_CHIDX_Pos) | \
(RADIO_SUBSCRIBE_RXEN_EN_Enabled << RADIO_SUBSCRIBE_RXEN_EN_Pos))
#define DPPI_SUBSCRIBE_RADIO_TASKS_TXEN ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_TXEN_CHIDX_Pos) | \
@@ -85,13 +90,18 @@
#define DPPI_UNSUBSCRIBE_TIMER0_TASKS_START ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << TIMER_SUBSCRIBE_START_CHIDX_Pos) | \
(TIMER_SUBSCRIBE_START_EN_Disabled << TIMER_SUBSCRIBE_START_EN_Pos))
#define DPPI_UNSUBSCRIBE_TIMER0_TASKS_CAPTURE1 ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
- (TIMER_SUBSCRIBE_CAPTURE_EN_Disabled << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
+ (TIMER_SUBSCRIBE_CAPTURE_EN_Disabled << \
+ TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
#define DPPI_UNSUBSCRIBE_TIMER0_TASKS_CAPTURE2 ((DPPI_CH_RADIO_EVENTS_END << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
- (TIMER_SUBSCRIBE_CAPTURE_EN_Disabled << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
+ (TIMER_SUBSCRIBE_CAPTURE_EN_Disabled << \
+ TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
#define DPPI_UNSUBSCRIBE_TIMER0_TASKS_CAPTURE3 ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
- (TIMER_SUBSCRIBE_CAPTURE_EN_Disabled << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_UNSUBSCRIBE_RADIO_TASKS_DISABLE ((DPPI_CH_TIMER0_EVENTS_COMPARE_3 << RADIO_SUBSCRIBE_DISABLE_CHIDX_Pos) | \
- (RADIO_SUBSCRIBE_DISABLE_EN_Disabled << RADIO_SUBSCRIBE_DISABLE_EN_Pos))
+ (TIMER_SUBSCRIBE_CAPTURE_EN_Disabled << \
+ TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
+#define DPPI_UNSUBSCRIBE_RADIO_TASKS_DISABLE ((DPPI_CH_TIMER0_EVENTS_COMPARE_3 << \
+ RADIO_SUBSCRIBE_DISABLE_CHIDX_Pos) | \
+ (RADIO_SUBSCRIBE_DISABLE_EN_Disabled << \
+ RADIO_SUBSCRIBE_DISABLE_EN_Pos))
#define DPPI_UNSUBSCRIBE_RADIO_TASKS_RXEN ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_RXEN_CHIDX_Pos) | \
(RADIO_SUBSCRIBE_RXEN_EN_Disabled << RADIO_SUBSCRIBE_RXEN_EN_Pos))
#define DPPI_UNSUBSCRIBE_RADIO_TASKS_TXEN ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_TXEN_CHIDX_Pos) | \
@@ -123,23 +133,22 @@
/* NRF_RADIO_NS->PCNF0 configuration values */
#define NRF_PCNF0 (NRF_LFLEN_BITS << RADIO_PCNF0_LFLEN_Pos) | \
- (RADIO_PCNF0_S1INCL_Msk) | \
- (NRF_S0LEN << RADIO_PCNF0_S0LEN_Pos) | \
- (NRF_S1LEN_BITS << RADIO_PCNF0_S1LEN_Pos)
+ (RADIO_PCNF0_S1INCL_Msk) | \
+ (NRF_S0LEN << RADIO_PCNF0_S0LEN_Pos) | \
+ (NRF_S1LEN_BITS << RADIO_PCNF0_S1LEN_Pos)
#define NRF_PCNF0_1M (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_8bit << RADIO_PCNF0_PLEN_Pos)
+ (RADIO_PCNF0_PLEN_8bit << RADIO_PCNF0_PLEN_Pos)
#define NRF_PCNF0_2M (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_16bit << RADIO_PCNF0_PLEN_Pos)
+ (RADIO_PCNF0_PLEN_16bit << RADIO_PCNF0_PLEN_Pos)
#define NRF_PCNF0_CODED (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_LongRange << RADIO_PCNF0_PLEN_Pos) | \
- (NRF_CILEN_BITS << RADIO_PCNF0_CILEN_Pos) | \
- (NRF_TERMLEN_BITS << RADIO_PCNF0_TERMLEN_Pos)
+ (RADIO_PCNF0_PLEN_LongRange << RADIO_PCNF0_PLEN_Pos) | \
+ (NRF_CILEN_BITS << RADIO_PCNF0_CILEN_Pos) | \
+ (NRF_TERMLEN_BITS << RADIO_PCNF0_TERMLEN_Pos)
/* BLE PHY data structure */
-struct ble_phy_obj
-{
+struct ble_phy_obj {
uint8_t phy_stats_initialized;
- int8_t phy_txpwr_dbm;
+ int8_t phy_txpwr_dbm;
uint8_t phy_chan;
uint8_t phy_state;
uint8_t phy_transition;
@@ -152,7 +161,7 @@
uint8_t phy_tx_phy_mode;
uint8_t phy_rx_phy_mode;
uint8_t phy_bcc_offset;
- int8_t rx_pwr_compensation;
+ int8_t rx_pwr_compensation;
uint32_t phy_aar_scratch;
uint32_t phy_access_address;
struct ble_mbuf_hdr rxhdr;
@@ -174,7 +183,7 @@
/* RF center frequency for each channel index (offset from 2400 MHz) */
static const uint8_t g_ble_phy_chan_freq[BLE_PHY_NUM_CHANS] = {
- 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, /* 0-9 */
+ 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, /* 0-9 */
24, 28, 30, 32, 34, 36, 38, 40, 42, 44, /* 10-19 */
46, 48, 50, 52, 54, 56, 58, 60, 62, 64, /* 20-29 */
66, 68, 70, 72, 74, 76, 78, 2, 26, 80, /* 30-39 */
@@ -226,36 +235,36 @@
/* Statistics */
STATS_SECT_START(ble_phy_stats)
- STATS_SECT_ENTRY(phy_isrs)
- STATS_SECT_ENTRY(tx_good)
- STATS_SECT_ENTRY(tx_fail)
- STATS_SECT_ENTRY(tx_late)
- STATS_SECT_ENTRY(tx_bytes)
- STATS_SECT_ENTRY(rx_starts)
- STATS_SECT_ENTRY(rx_aborts)
- STATS_SECT_ENTRY(rx_valid)
- STATS_SECT_ENTRY(rx_crc_err)
- STATS_SECT_ENTRY(rx_late)
- STATS_SECT_ENTRY(radio_state_errs)
- STATS_SECT_ENTRY(rx_hw_err)
- STATS_SECT_ENTRY(tx_hw_err)
+STATS_SECT_ENTRY(phy_isrs)
+STATS_SECT_ENTRY(tx_good)
+STATS_SECT_ENTRY(tx_fail)
+STATS_SECT_ENTRY(tx_late)
+STATS_SECT_ENTRY(tx_bytes)
+STATS_SECT_ENTRY(rx_starts)
+STATS_SECT_ENTRY(rx_aborts)
+STATS_SECT_ENTRY(rx_valid)
+STATS_SECT_ENTRY(rx_crc_err)
+STATS_SECT_ENTRY(rx_late)
+STATS_SECT_ENTRY(radio_state_errs)
+STATS_SECT_ENTRY(rx_hw_err)
+STATS_SECT_ENTRY(tx_hw_err)
STATS_SECT_END
STATS_SECT_DECL(ble_phy_stats) ble_phy_stats;
STATS_NAME_START(ble_phy_stats)
- STATS_NAME(ble_phy_stats, phy_isrs)
- STATS_NAME(ble_phy_stats, tx_good)
- STATS_NAME(ble_phy_stats, tx_fail)
- STATS_NAME(ble_phy_stats, tx_late)
- STATS_NAME(ble_phy_stats, tx_bytes)
- STATS_NAME(ble_phy_stats, rx_starts)
- STATS_NAME(ble_phy_stats, rx_aborts)
- STATS_NAME(ble_phy_stats, rx_valid)
- STATS_NAME(ble_phy_stats, rx_crc_err)
- STATS_NAME(ble_phy_stats, rx_late)
- STATS_NAME(ble_phy_stats, radio_state_errs)
- STATS_NAME(ble_phy_stats, rx_hw_err)
- STATS_NAME(ble_phy_stats, tx_hw_err)
+STATS_NAME(ble_phy_stats, phy_isrs)
+STATS_NAME(ble_phy_stats, tx_good)
+STATS_NAME(ble_phy_stats, tx_fail)
+STATS_NAME(ble_phy_stats, tx_late)
+STATS_NAME(ble_phy_stats, tx_bytes)
+STATS_NAME(ble_phy_stats, rx_starts)
+STATS_NAME(ble_phy_stats, rx_aborts)
+STATS_NAME(ble_phy_stats, rx_valid)
+STATS_NAME(ble_phy_stats, rx_crc_err)
+STATS_NAME(ble_phy_stats, rx_late)
+STATS_NAME(ble_phy_stats, radio_state_errs)
+STATS_NAME(ble_phy_stats, rx_hw_err)
+STATS_NAME(ble_phy_stats, tx_hw_err)
STATS_NAME_END(ble_phy_stats)
#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LE_ENCRYPTION)
@@ -273,8 +282,7 @@
static uint32_t nrf_encrypt_scratchpad[NRF_ENC_SCRATCH_WORDS];
-struct nrf_ccm_data
-{
+struct nrf_ccm_data {
uint8_t key[16];
uint64_t pkt_counter;
uint8_t dir_bit;
@@ -342,16 +350,16 @@
{
#if (BLE_LL_BT5_PHY_SUPPORTED == 1)
switch (g_ble_phy_data.phy_cur_phy_mode) {
- case BLE_PHY_MODE_1M:
- return BLE_PHY_1M;
- case BLE_PHY_MODE_2M:
- return BLE_PHY_2M;
- case BLE_PHY_MODE_CODED_125KBPS:
- case BLE_PHY_MODE_CODED_500KBPS:
- return BLE_PHY_CODED;
- default:
- assert(0);
- return -1;
+ case BLE_PHY_MODE_1M:
+ return BLE_PHY_1M;
+ case BLE_PHY_MODE_2M:
+ return BLE_PHY_2M;
+ case BLE_PHY_MODE_CODED_125KBPS:
+ case BLE_PHY_MODE_CODED_500KBPS:
+ return BLE_PHY_CODED;
+ default:
+ assert(0);
+ return -1;
}
#else
return BLE_PHY_1M;
@@ -418,10 +426,10 @@
" adds %[src], %[src], r4 \n"
" adds %[dst], %[dst], r4 \n"
: [dst] "+r" (dst), [src] "+r" (src),
- [len] "+r" (copy_len)
+ [len] "+r" (copy_len)
:
: "r3", "r4", "memory"
- );
+ );
if ((rem_len < 4) && (block_rem_len >= rem_len)) {
break;
@@ -443,7 +451,7 @@
: [len] "+r" (rem_len)
: [dst] "r" (dst), [src] "r" (src)
: "r3", "memory"
- );
+ );
/* Copy header */
memcpy(BLE_MBUF_HDR_PTR(rxpdu), &g_ble_phy_data.rxhdr,
@@ -734,7 +742,7 @@
NRF_CCM_NS->OUTPTR = (uint32_t)dptr;
NRF_CCM_NS->SCRATCHPTR = (uint32_t)&nrf_encrypt_scratchpad[0];
NRF_CCM_NS->MODE = CCM_MODE_LENGTH_Msk | CCM_MODE_MODE_Decryption |
- ble_phy_get_ccm_datarate();
+ ble_phy_get_ccm_datarate();
NRF_CCM_NS->CNFPTR = (uint32_t)&nrf_ccm_data;
NRF_CCM_NS->SHORTS = 0;
NRF_CCM_NS->EVENTS_ERROR = 0;
@@ -779,7 +787,7 @@
* to take this into account when setting up BCC.
*/
if (g_ble_phy_data.phy_cur_phy_mode == BLE_PHY_MODE_CODED_125KBPS ||
- g_ble_phy_data.phy_cur_phy_mode == BLE_PHY_MODE_CODED_500KBPS) {
+ g_ble_phy_data.phy_cur_phy_mode == BLE_PHY_MODE_CODED_500KBPS) {
g_ble_phy_data.phy_bcc_offset = 5;
} else {
g_ble_phy_data.phy_bcc_offset = 0;
@@ -796,10 +804,10 @@
NRF_RADIO_NS->EVENTS_RSSIEND = 0;
NRF_RADIO_NS->EVENTS_CRCOK = 0;
NRF_RADIO_NS->SHORTS = RADIO_SHORTS_END_DISABLE_Msk |
- RADIO_SHORTS_READY_START_Msk |
- RADIO_SHORTS_ADDRESS_BCSTART_Msk |
- RADIO_SHORTS_ADDRESS_RSSISTART_Msk |
- RADIO_SHORTS_DISABLED_RSSISTOP_Msk;
+ RADIO_SHORTS_READY_START_Msk |
+ RADIO_SHORTS_ADDRESS_BCSTART_Msk |
+ RADIO_SHORTS_ADDRESS_RSSISTART_Msk |
+ RADIO_SHORTS_DISABLED_RSSISTOP_Msk;
NRF_RADIO_NS->INTENSET = RADIO_INTENSET_ADDRESS_Msk;
}
@@ -907,10 +915,10 @@
* using CI field.
*/
if ((phy == BLE_PHY_MODE_CODED_125KBPS) ||
- (phy == BLE_PHY_MODE_CODED_500KBPS)) {
+ (phy == BLE_PHY_MODE_CODED_500KBPS)) {
phy = NRF_RADIO_NS->PDUSTAT & RADIO_PDUSTAT_CISTAT_Msk ?
- BLE_PHY_MODE_CODED_500KBPS :
- BLE_PHY_MODE_CODED_125KBPS;
+ BLE_PHY_MODE_CODED_500KBPS :
+ BLE_PHY_MODE_CODED_125KBPS;
}
#endif
@@ -1144,7 +1152,7 @@
NRF_RADIO_NS->EVENTS_BCMATCH = 0;
NRF_AAR_NS->SUBSCRIBE_START = DPPI_SUBSCRIBE_AAR_TASKS_START;
NRF_RADIO_NS->BCC = (BLE_LL_PDU_HDR_LEN + adva_offset + BLE_DEV_ADDR_LEN) * 8 +
- g_ble_phy_data.phy_bcc_offset;
+ g_ble_phy_data.phy_bcc_offset;
}
#endif
@@ -1271,16 +1279,16 @@
/* XXX: should maxlen be 251 for encryption? */
NRF_RADIO_NS->PCNF1 = NRF_MAXLEN |
- (RADIO_PCNF1_ENDIAN_Little << RADIO_PCNF1_ENDIAN_Pos) |
- (NRF_BALEN << RADIO_PCNF1_BALEN_Pos) |
- RADIO_PCNF1_WHITEEN_Msk;
+ (RADIO_PCNF1_ENDIAN_Little << RADIO_PCNF1_ENDIAN_Pos) |
+ (NRF_BALEN << RADIO_PCNF1_BALEN_Pos) |
+ RADIO_PCNF1_WHITEEN_Msk;
/* Enable radio fast ramp-up */
NRF_RADIO_NS->MODECNF0 |= (RADIO_MODECNF0_RU_Fast << RADIO_MODECNF0_RU_Pos) & RADIO_MODECNF0_RU_Msk;
/* Set logical address 1 for TX and RX */
- NRF_RADIO_NS->TXADDRESS = 0;
- NRF_RADIO_NS->RXADDRESSES = (1 << 0);
+ NRF_RADIO_NS->TXADDRESS = 0;
+ NRF_RADIO_NS->RXADDRESSES = (1 << 0);
/* Configure the CRC registers */
NRF_RADIO_NS->CRCCNF = (RADIO_CRCCNF_SKIPADDR_Skip << RADIO_CRCCNF_SKIPADDR_Pos) | RADIO_CRCCNF_LEN_Three;
@@ -1350,7 +1358,7 @@
"ble_phy");
assert(rc == 0);
- g_ble_phy_data.phy_stats_initialized = 1;
+ g_ble_phy_data.phy_stats_initialized = 1;
}
return 0;
@@ -1376,7 +1384,7 @@
*/
nrf_wait_disabled();
if ((NRF_RADIO_NS->STATE != RADIO_STATE_STATE_Disabled) &&
- ((NRF_RADIO_NS->STATE & 0x07) != RADIO_STATE_STATE_RxIdle)) {
+ ((NRF_RADIO_NS->STATE & 0x07) != RADIO_STATE_STATE_RxIdle)) {
ble_phy_disable();
STATS_INC(ble_phy_stats, radio_state_errs);
return BLE_PHY_ERR_RADIO_STATE;
@@ -1692,7 +1700,8 @@
*
* @return int Rounded power in dBm
*/
-int ble_phy_txpower_round(int dbm)
+int
+ble_phy_txpower_round(int dbm)
{
/* "Rail" power level if outside supported range */
@@ -1896,7 +1905,8 @@
}
/* Gets the current access address */
-uint32_t ble_phy_access_addr_get(void)
+uint32_t
+ble_phy_access_addr_get(void)
{
return g_ble_phy_data.phy_access_address;
}
@@ -1965,7 +1975,8 @@
#endif
#if MYNEWT_VAL(BLE_LL_DTM)
-void ble_phy_enable_dtm(void)
+void
+ble_phy_enable_dtm(void)
{
/* When DTM is enabled we need to disable whitening as per
* Bluetooth v5.0 Vol 6. Part F. 4.1.1
@@ -1973,7 +1984,8 @@
NRF_RADIO_NS->PCNF1 &= ~RADIO_PCNF1_WHITEEN_Msk;
}
-void ble_phy_disable_dtm(void)
+void
+ble_phy_disable_dtm(void)
{
/* Enable whitening */
NRF_RADIO_NS->PCNF1 |= RADIO_PCNF1_WHITEEN_Msk;
```
</details>
#### nimble/drivers/nrf5340/src/ble_phy_trace.c
<details>
```diff
@@ -38,7 +38,7 @@
ble_phy_trace_init(void)
{
ble_phy_trace_off =
- os_trace_module_register(&g_ble_phy_trace_mod, "ble_phy", 3,
+ os_trace_module_register(&g_ble_phy_trace_mod, "ble_phy", 3,
ble_phy_trace_module_send_desc);
}
#endif
```
</details>
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [mynewt-nimble] apache-mynewt-bot commented on pull request #841: nimble/drivers: Add support for nRF5340 radio
Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on pull request #841:
URL: https://github.com/apache/mynewt-nimble/pull/841#issuecomment-696092914
<!-- style-bot -->
## Style check summary
### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
#### nimble/drivers/nrf5340/src/ble_phy.c
<details>
```diff
@@ -63,23 +63,32 @@
#define DPPI_PUBLISH_RTC0_EVENTS_COMPARE_0 ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << RTC_PUBLISH_COMPARE_CHIDX_Pos) | \
(RTC_PUBLISH_COMPARE_EN_Enabled << RTC_PUBLISH_COMPARE_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_START(_enable) ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << TIMER_SUBSCRIBE_START_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_START(_enable) ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << \
+ TIMER_SUBSCRIBE_START_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_START_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE1(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE1(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << \
+ TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE2(_enable) ((DPPI_CH_RADIO_EVENTS_END << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE2(_enable) ((DPPI_CH_RADIO_EVENTS_END << \
+ TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE3(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE3(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << \
+ TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_SUBSCRIBE_RADIO_TASKS_DISABLE(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_3 << RADIO_SUBSCRIBE_DISABLE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_RADIO_TASKS_DISABLE(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_3 << \
+ RADIO_SUBSCRIBE_DISABLE_CHIDX_Pos) | \
((_enable) << RADIO_SUBSCRIBE_DISABLE_EN_Pos))
-#define DPPI_SUBSCRIBE_RADIO_TASKS_RXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_RXEN_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_RADIO_TASKS_RXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << \
+ RADIO_SUBSCRIBE_RXEN_CHIDX_Pos) | \
((_enable) << RADIO_SUBSCRIBE_RXEN_EN_Pos))
-#define DPPI_SUBSCRIBE_RADIO_TASKS_TXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_TXEN_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_RADIO_TASKS_TXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << \
+ RADIO_SUBSCRIBE_TXEN_CHIDX_Pos) | \
((_enable) << RADIO_SUBSCRIBE_TXEN_EN_Pos))
-#define DPPI_SUBSCRIBE_AAR_TASKS_START(_enable) ((DPPI_CH_RADIO_EVENTS_BCMATCH << AAR_SUBSCRIBE_START_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_AAR_TASKS_START(_enable) ((DPPI_CH_RADIO_EVENTS_BCMATCH << \
+ AAR_SUBSCRIBE_START_CHIDX_Pos) | \
((_enable) << AAR_SUBSCRIBE_START_EN_Pos))
-#define DPPI_SUBSCRIBE_CCM_TASKS_CRYPT(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << CCM_SUBSCRIBE_CRYPT_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_CCM_TASKS_CRYPT(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << \
+ CCM_SUBSCRIBE_CRYPT_CHIDX_Pos) | \
((_enable) << CCM_SUBSCRIBE_CRYPT_EN_Pos))
extern uint8_t g_nrf_num_irks;
@@ -104,17 +113,17 @@
/* NRF_RADIO_NS->PCNF0 configuration values */
#define NRF_PCNF0 (NRF_LFLEN_BITS << RADIO_PCNF0_LFLEN_Pos) | \
- (RADIO_PCNF0_S1INCL_Msk) | \
- (NRF_S0LEN << RADIO_PCNF0_S0LEN_Pos) | \
- (NRF_S1LEN_BITS << RADIO_PCNF0_S1LEN_Pos)
+ (RADIO_PCNF0_S1INCL_Msk) | \
+ (NRF_S0LEN << RADIO_PCNF0_S0LEN_Pos) | \
+ (NRF_S1LEN_BITS << RADIO_PCNF0_S1LEN_Pos)
#define NRF_PCNF0_1M (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_8bit << RADIO_PCNF0_PLEN_Pos)
+ (RADIO_PCNF0_PLEN_8bit << RADIO_PCNF0_PLEN_Pos)
#define NRF_PCNF0_2M (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_16bit << RADIO_PCNF0_PLEN_Pos)
+ (RADIO_PCNF0_PLEN_16bit << RADIO_PCNF0_PLEN_Pos)
#define NRF_PCNF0_CODED (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_LongRange << RADIO_PCNF0_PLEN_Pos) | \
- (NRF_CILEN_BITS << RADIO_PCNF0_CILEN_Pos) | \
- (NRF_TERMLEN_BITS << RADIO_PCNF0_TERMLEN_Pos)
+ (RADIO_PCNF0_PLEN_LongRange << RADIO_PCNF0_PLEN_Pos) | \
+ (NRF_CILEN_BITS << RADIO_PCNF0_CILEN_Pos) | \
+ (NRF_TERMLEN_BITS << RADIO_PCNF0_TERMLEN_Pos)
/* BLE PHY data structure */
struct ble_phy_obj {
```
</details>
#### nimble/transport/nrf5340/src/nrf5340_ble_hci.c
<details>
```diff
@@ -216,7 +216,7 @@
if (buf) {
break;
}
- /* no break */
+ /* no break */
case BLE_HCI_TRANS_BUF_EVT_LO:
buf = os_memblock_get(&nrf5340_ble_hci_pool_evt_lo);
break;
```
</details>
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [mynewt-nimble] sjanc commented on pull request #841: nimble/drivers: Add support for nRF5340 radio
Posted by GitBox <gi...@apache.org>.
sjanc commented on pull request #841:
URL: https://github.com/apache/mynewt-nimble/pull/841#issuecomment-654852228
requires https://github.com/apache/mynewt-core/pull/2282
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [mynewt-nimble] apache-mynewt-bot commented on pull request #841: nimble/drivers: Add support for nRF5340 radio
Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on pull request #841:
URL: https://github.com/apache/mynewt-nimble/pull/841#issuecomment-656597114
<!-- style-bot -->
## Style check summary
### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
#### nimble/drivers/nrf5340/src/ble_phy.c
<details>
```diff
@@ -63,23 +63,32 @@
#define DPPI_PUBLISH_RTC0_EVENTS_COMPARE_0 ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << RTC_PUBLISH_COMPARE_CHIDX_Pos) | \
(RTC_PUBLISH_COMPARE_EN_Enabled << RTC_PUBLISH_COMPARE_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_START(_enable) ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << TIMER_SUBSCRIBE_START_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_START(_enable) ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << \
+ TIMER_SUBSCRIBE_START_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_START_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE1(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE1(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << \
+ TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE2(_enable) ((DPPI_CH_RADIO_EVENTS_END << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE2(_enable) ((DPPI_CH_RADIO_EVENTS_END << \
+ TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE3(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE3(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << \
+ TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_SUBSCRIBE_RADIO_TASKS_DISABLE(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_3 << RADIO_SUBSCRIBE_DISABLE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_RADIO_TASKS_DISABLE(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_3 << \
+ RADIO_SUBSCRIBE_DISABLE_CHIDX_Pos) | \
((_enable) << RADIO_SUBSCRIBE_DISABLE_EN_Pos))
-#define DPPI_SUBSCRIBE_RADIO_TASKS_RXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_RXEN_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_RADIO_TASKS_RXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << \
+ RADIO_SUBSCRIBE_RXEN_CHIDX_Pos) | \
((_enable) << RADIO_SUBSCRIBE_RXEN_EN_Pos))
-#define DPPI_SUBSCRIBE_RADIO_TASKS_TXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_TXEN_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_RADIO_TASKS_TXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << \
+ RADIO_SUBSCRIBE_TXEN_CHIDX_Pos) | \
((_enable) << RADIO_SUBSCRIBE_TXEN_EN_Pos))
-#define DPPI_SUBSCRIBE_AAR_TASKS_START(_enable) ((DPPI_CH_RADIO_EVENTS_BCMATCH << AAR_SUBSCRIBE_START_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_AAR_TASKS_START(_enable) ((DPPI_CH_RADIO_EVENTS_BCMATCH << \
+ AAR_SUBSCRIBE_START_CHIDX_Pos) | \
((_enable) << AAR_SUBSCRIBE_START_EN_Pos))
-#define DPPI_SUBSCRIBE_CCM_TASKS_CRYPT(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << CCM_SUBSCRIBE_CRYPT_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_CCM_TASKS_CRYPT(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << \
+ CCM_SUBSCRIBE_CRYPT_CHIDX_Pos) | \
((_enable) << CCM_SUBSCRIBE_CRYPT_EN_Pos))
extern uint8_t g_nrf_num_irks;
@@ -104,17 +113,17 @@
/* NRF_RADIO_NS->PCNF0 configuration values */
#define NRF_PCNF0 (NRF_LFLEN_BITS << RADIO_PCNF0_LFLEN_Pos) | \
- (RADIO_PCNF0_S1INCL_Msk) | \
- (NRF_S0LEN << RADIO_PCNF0_S0LEN_Pos) | \
- (NRF_S1LEN_BITS << RADIO_PCNF0_S1LEN_Pos)
+ (RADIO_PCNF0_S1INCL_Msk) | \
+ (NRF_S0LEN << RADIO_PCNF0_S0LEN_Pos) | \
+ (NRF_S1LEN_BITS << RADIO_PCNF0_S1LEN_Pos)
#define NRF_PCNF0_1M (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_8bit << RADIO_PCNF0_PLEN_Pos)
+ (RADIO_PCNF0_PLEN_8bit << RADIO_PCNF0_PLEN_Pos)
#define NRF_PCNF0_2M (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_16bit << RADIO_PCNF0_PLEN_Pos)
+ (RADIO_PCNF0_PLEN_16bit << RADIO_PCNF0_PLEN_Pos)
#define NRF_PCNF0_CODED (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_LongRange << RADIO_PCNF0_PLEN_Pos) | \
- (NRF_CILEN_BITS << RADIO_PCNF0_CILEN_Pos) | \
- (NRF_TERMLEN_BITS << RADIO_PCNF0_TERMLEN_Pos)
+ (RADIO_PCNF0_PLEN_LongRange << RADIO_PCNF0_PLEN_Pos) | \
+ (NRF_CILEN_BITS << RADIO_PCNF0_CILEN_Pos) | \
+ (NRF_TERMLEN_BITS << RADIO_PCNF0_TERMLEN_Pos)
/* BLE PHY data structure */
struct ble_phy_obj {
@@ -1094,7 +1103,7 @@
NRF_RADIO_NS->EVENTS_BCMATCH = 0;
NRF_AAR_NS->SUBSCRIBE_START = DPPI_SUBSCRIBE_AAR_TASKS_START(1);
NRF_RADIO_NS->BCC = (BLE_LL_PDU_HDR_LEN + adva_offset + BLE_DEV_ADDR_LEN) * 8 +
- g_ble_phy_data.phy_bcc_offset;
+ g_ble_phy_data.phy_bcc_offset;
}
#endif
```
</details>
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [mynewt-nimble] andrzej-kaczmarek commented on a change in pull request #841: nimble/drivers: Add support for nRF5340 radio
Posted by GitBox <gi...@apache.org>.
andrzej-kaczmarek commented on a change in pull request #841:
URL: https://github.com/apache/mynewt-nimble/pull/841#discussion_r450879340
##########
File path: nimble/drivers/nrf5340/src/ble_phy.c
##########
@@ -0,0 +1,2001 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <stdint.h>
+#include <string.h>
+#include <assert.h>
+#include <syscfg/syscfg.h>
+#include <os/os.h>
+#include <nimble/ble.h>
+#include <nimble/nimble_opt.h>
+#include <nimble/nimble_npl.h>
+#include <controller/ble_phy.h>
+
+#include <ble/xcvr.h>
+#include <controller/ble_phy_trace.h>
+#include <controller/ble_ll.h>
+#include <mcu/nrf5340_net_clock.h>
+#include <mcu/cmsis_nvic.h>
+
+/*
+ * NOTE: This code uses 1-6 DPPI channels so care should be taken when using
+ * DPPI somewhere else.
+ * TODO maybe we could reduce number of used channels if we reuse same channel
+ * for mutually exclusive events but for now make it simpler to debug.
+ */
+
+#define DPPI_CH_TIMER0_EVENTS_COMPARE_0 DPPIC_CHEN_CH0_Pos
+#define DPPI_CH_TIMER0_EVENTS_COMPARE_3 DPPIC_CHEN_CH1_Pos
+#define DPPI_CH_RADIO_EVENTS_END DPPIC_CHEN_CH2_Pos
+#define DPPI_CH_RADIO_EVENTS_BCMATCH DPPIC_CHEN_CH3_Pos
+#define DPPI_CH_RADIO_EVENTS_ADDRESS DPPIC_CHEN_CH4_Pos
+#define DPPI_CH_RTC0_EVENTS_COMPARE_0 DPPIC_CHEN_CH5_Pos
+
+#define DPPI_CH_ENABLE_ALL (DPPIC_CHEN_CH0_Msk | DPPIC_CHEN_CH1_Msk | DPPIC_CHEN_CH2_Msk | \
+ DPPIC_CHEN_CH3_Msk | DPPIC_CHEN_CH4_Msk | DPPIC_CHEN_CH5_Msk)
+
+#define DPPI_PUBLISH_TIMER0_EVENTS_COMPARE_0 ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << TIMER_PUBLISH_COMPARE_CHIDX_Pos) | \
+ (TIMER_PUBLISH_COMPARE_EN_Enabled << TIMER_PUBLISH_COMPARE_EN_Pos))
+#define DPPI_PUBLISH_TIMER0_EVENTS_COMPARE_3 ((DPPI_CH_TIMER0_EVENTS_COMPARE_3 << TIMER_PUBLISH_COMPARE_CHIDX_Pos) | \
+ (TIMER_PUBLISH_COMPARE_EN_Enabled << TIMER_PUBLISH_COMPARE_EN_Pos))
+#define DPPI_PUBLISH_RADIO_EVENTS_END ((DPPI_CH_RADIO_EVENTS_END << RADIO_PUBLISH_END_CHIDX_Pos) | \
+ (RADIO_PUBLISH_END_EN_Enabled << RADIO_PUBLISH_END_EN_Pos))
+#define DPPI_PUBLISH_RADIO_EVENTS_BCMATCH ((DPPI_CH_RADIO_EVENTS_BCMATCH << RADIO_PUBLISH_BCMATCH_CHIDX_Pos) | \
+ (RADIO_PUBLISH_BCMATCH_EN_Enabled << RADIO_PUBLISH_BCMATCH_EN_Pos))
+#define DPPI_PUBLISH_RADIO_EVENTS_ADDRESS ((DPPI_CH_RADIO_EVENTS_ADDRESS << RADIO_PUBLISH_ADDRESS_CHIDX_Pos) | \
+ (RADIO_PUBLISH_ADDRESS_EN_Enabled << RADIO_PUBLISH_ADDRESS_EN_Pos))
+#define DPPI_PUBLISH_RTC0_EVENTS_COMPARE_0 ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << RTC_PUBLISH_COMPARE_CHIDX_Pos) | \
+ (RTC_PUBLISH_COMPARE_EN_Enabled << RTC_PUBLISH_COMPARE_EN_Pos))
+
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_START ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << TIMER_SUBSCRIBE_START_CHIDX_Pos) | \
+ (TIMER_SUBSCRIBE_START_EN_Enabled << TIMER_SUBSCRIBE_START_EN_Pos))
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE1 ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+ (TIMER_SUBSCRIBE_CAPTURE_EN_Enabled << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE2 ((DPPI_CH_RADIO_EVENTS_END << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+ (TIMER_SUBSCRIBE_CAPTURE_EN_Enabled << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE3 ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+ (TIMER_SUBSCRIBE_CAPTURE_EN_Enabled << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
+#define DPPI_SUBSCRIBE_RADIO_TASKS_DISABLE ((DPPI_CH_TIMER0_EVENTS_COMPARE_3 << RADIO_SUBSCRIBE_DISABLE_CHIDX_Pos) | \
+ (RADIO_SUBSCRIBE_DISABLE_EN_Enabled << RADIO_SUBSCRIBE_DISABLE_EN_Pos))
+#define DPPI_SUBSCRIBE_RADIO_TASKS_RXEN ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_RXEN_CHIDX_Pos) | \
+ (RADIO_SUBSCRIBE_RXEN_EN_Enabled << RADIO_SUBSCRIBE_RXEN_EN_Pos))
+#define DPPI_SUBSCRIBE_RADIO_TASKS_TXEN ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_TXEN_CHIDX_Pos) | \
+ (RADIO_SUBSCRIBE_TXEN_EN_Enabled << RADIO_SUBSCRIBE_TXEN_EN_Pos))
+#define DPPI_SUBSCRIBE_AAR_TASKS_START ((DPPI_CH_RADIO_EVENTS_BCMATCH << AAR_SUBSCRIBE_START_CHIDX_Pos) | \
+ (AAR_SUBSCRIBE_START_EN_Enabled << AAR_SUBSCRIBE_START_EN_Pos))
+#define DPPI_SUBSCRIBE_CCM_TASKS_CRYPT ((DPPI_CH_RADIO_EVENTS_ADDRESS << CCM_SUBSCRIBE_CRYPT_CHIDX_Pos) | \
+ (CCM_SUBSCRIBE_CRYPT_EN_Enabled << CCM_SUBSCRIBE_CRYPT_EN_Pos))
+
+#define DPPI_UNSUBSCRIBE_TIMER0_TASKS_START ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << TIMER_SUBSCRIBE_START_CHIDX_Pos) | \
+ (TIMER_SUBSCRIBE_START_EN_Disabled << TIMER_SUBSCRIBE_START_EN_Pos))
+#define DPPI_UNSUBSCRIBE_TIMER0_TASKS_CAPTURE1 ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+ (TIMER_SUBSCRIBE_CAPTURE_EN_Disabled << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
+#define DPPI_UNSUBSCRIBE_TIMER0_TASKS_CAPTURE2 ((DPPI_CH_RADIO_EVENTS_END << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+ (TIMER_SUBSCRIBE_CAPTURE_EN_Disabled << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
+#define DPPI_UNSUBSCRIBE_TIMER0_TASKS_CAPTURE3 ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+ (TIMER_SUBSCRIBE_CAPTURE_EN_Disabled << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
+#define DPPI_UNSUBSCRIBE_RADIO_TASKS_DISABLE ((DPPI_CH_TIMER0_EVENTS_COMPARE_3 << RADIO_SUBSCRIBE_DISABLE_CHIDX_Pos) | \
+ (RADIO_SUBSCRIBE_DISABLE_EN_Disabled << RADIO_SUBSCRIBE_DISABLE_EN_Pos))
+#define DPPI_UNSUBSCRIBE_RADIO_TASKS_RXEN ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_RXEN_CHIDX_Pos) | \
+ (RADIO_SUBSCRIBE_RXEN_EN_Disabled << RADIO_SUBSCRIBE_RXEN_EN_Pos))
+#define DPPI_UNSUBSCRIBE_RADIO_TASKS_TXEN ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_TXEN_CHIDX_Pos) | \
+ (RADIO_SUBSCRIBE_TXEN_EN_Disabled << RADIO_SUBSCRIBE_TXEN_EN_Pos))
+#define DPPI_UNSUBSCRIBE_AAR_TASKS_START ((DPPI_CH_RADIO_EVENTS_BCMATCH << AAR_SUBSCRIBE_START_CHIDX_Pos) | \
+ (AAR_SUBSCRIBE_START_EN_Disabled << AAR_SUBSCRIBE_START_EN_Pos))
+#define DPPI_UNSUBSCRIBE_CCM_TASKS_CRYPT ((DPPI_CH_RADIO_EVENTS_ADDRESS << CCM_SUBSCRIBE_CRYPT_CHIDX_Pos) | \
+ (CCM_SUBSCRIBE_CRYPT_EN_Disabled << CCM_SUBSCRIBE_CRYPT_EN_Pos))
+
+extern uint8_t g_nrf_num_irks;
+extern uint32_t g_nrf_irk_list[];
+
+/* To disable all radio interrupts */
+#define NRF_RADIO_IRQ_MASK_ALL (0x34FF)
+
+/*
+ * We configure the nrf with a 1 byte S0 field, 8 bit length field, and
+ * zero bit S1 field. The preamble is 8 bits long.
+ */
+#define NRF_LFLEN_BITS (8)
+#define NRF_S0LEN (1)
+#define NRF_S1LEN_BITS (0)
+#define NRF_CILEN_BITS (2)
+#define NRF_TERMLEN_BITS (3)
+
+/* Maximum length of frames */
+#define NRF_MAXLEN (255)
+#define NRF_BALEN (3) /* For base address of 3 bytes */
+
+/* NRF_RADIO_NS->PCNF0 configuration values */
+#define NRF_PCNF0 (NRF_LFLEN_BITS << RADIO_PCNF0_LFLEN_Pos) | \
+ (RADIO_PCNF0_S1INCL_Msk) | \
+ (NRF_S0LEN << RADIO_PCNF0_S0LEN_Pos) | \
+ (NRF_S1LEN_BITS << RADIO_PCNF0_S1LEN_Pos)
+#define NRF_PCNF0_1M (NRF_PCNF0) | \
+ (RADIO_PCNF0_PLEN_8bit << RADIO_PCNF0_PLEN_Pos)
+#define NRF_PCNF0_2M (NRF_PCNF0) | \
+ (RADIO_PCNF0_PLEN_16bit << RADIO_PCNF0_PLEN_Pos)
+#define NRF_PCNF0_CODED (NRF_PCNF0) | \
+ (RADIO_PCNF0_PLEN_LongRange << RADIO_PCNF0_PLEN_Pos) | \
+ (NRF_CILEN_BITS << RADIO_PCNF0_CILEN_Pos) | \
+ (NRF_TERMLEN_BITS << RADIO_PCNF0_TERMLEN_Pos)
+
+/* BLE PHY data structure */
+struct ble_phy_obj
+{
+ uint8_t phy_stats_initialized;
+ int8_t phy_txpwr_dbm;
+ uint8_t phy_chan;
+ uint8_t phy_state;
+ uint8_t phy_transition;
+ uint8_t phy_transition_late;
+ uint8_t phy_rx_started;
+ uint8_t phy_encrypted;
+ uint8_t phy_privacy;
+ uint8_t phy_tx_pyld_len;
+ uint8_t phy_cur_phy_mode;
+ uint8_t phy_tx_phy_mode;
+ uint8_t phy_rx_phy_mode;
+ uint8_t phy_bcc_offset;
+ int8_t rx_pwr_compensation;
+ uint32_t phy_aar_scratch;
+ uint32_t phy_access_address;
+ struct ble_mbuf_hdr rxhdr;
+ void *txend_arg;
+ ble_phy_tx_end_func txend_cb;
+ uint32_t phy_start_cputime;
+};
+struct ble_phy_obj g_ble_phy_data;
+
+/* XXX: if 27 byte packets desired we can make this smaller */
+/* Global transmit/receive buffer */
+static uint32_t g_ble_phy_tx_buf[(BLE_PHY_MAX_PDU_LEN + 3) / 4];
+static uint32_t g_ble_phy_rx_buf[(BLE_PHY_MAX_PDU_LEN + 3) / 4];
+
+#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LE_ENCRYPTION)
+/* Make sure word-aligned for faster copies */
+static uint32_t g_ble_phy_enc_buf[(BLE_PHY_MAX_PDU_LEN + 3) / 4];
+#endif
+
+/* RF center frequency for each channel index (offset from 2400 MHz) */
+static const uint8_t g_ble_phy_chan_freq[BLE_PHY_NUM_CHANS] = {
+ 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, /* 0-9 */
+ 24, 28, 30, 32, 34, 36, 38, 40, 42, 44, /* 10-19 */
+ 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, /* 20-29 */
+ 66, 68, 70, 72, 74, 76, 78, 2, 26, 80, /* 30-39 */
+};
+
+#if (BLE_LL_BT5_PHY_SUPPORTED == 1)
+/* packet start offsets (in usecs) */
+static const uint16_t g_ble_phy_mode_pkt_start_off[BLE_PHY_NUM_MODE] = {
+ [BLE_PHY_MODE_1M] = 40,
+ [BLE_PHY_MODE_2M] = 24,
+ [BLE_PHY_MODE_CODED_125KBPS] = 376,
+ [BLE_PHY_MODE_CODED_500KBPS] = 376
+};
+#endif
+
+/* Various radio timings */
+/* Radio ramp-up times in usecs (fast mode) */
+#define BLE_PHY_T_TXENFAST (XCVR_TX_RADIO_RAMPUP_USECS)
+#define BLE_PHY_T_RXENFAST (XCVR_RX_RADIO_RAMPUP_USECS)
+
+/* delay between EVENTS_READY and start of tx */
+static const uint8_t g_ble_phy_t_txdelay[BLE_PHY_NUM_MODE] = {
+ [BLE_PHY_MODE_1M] = 4,
+ [BLE_PHY_MODE_2M] = 3,
+ [BLE_PHY_MODE_CODED_125KBPS] = 5,
+ [BLE_PHY_MODE_CODED_500KBPS] = 5
+};
+/* delay between EVENTS_END and end of txd packet */
+static const uint8_t g_ble_phy_t_txenddelay[BLE_PHY_NUM_MODE] = {
+ [BLE_PHY_MODE_1M] = 4,
+ [BLE_PHY_MODE_2M] = 3,
+ [BLE_PHY_MODE_CODED_125KBPS] = 9,
+ [BLE_PHY_MODE_CODED_500KBPS] = 3
+};
+/* delay between rxd access address (w/ TERM1 for coded) and EVENTS_ADDRESS */
+static const uint8_t g_ble_phy_t_rxaddrdelay[BLE_PHY_NUM_MODE] = {
+ [BLE_PHY_MODE_1M] = 6,
+ [BLE_PHY_MODE_2M] = 2,
+ [BLE_PHY_MODE_CODED_125KBPS] = 17,
+ [BLE_PHY_MODE_CODED_500KBPS] = 17
+};
+/* delay between end of rxd packet and EVENTS_END */
+static const uint8_t g_ble_phy_t_rxenddelay[BLE_PHY_NUM_MODE] = {
+ [BLE_PHY_MODE_1M] = 6,
+ [BLE_PHY_MODE_2M] = 2,
+ [BLE_PHY_MODE_CODED_125KBPS] = 27,
+ [BLE_PHY_MODE_CODED_500KBPS] = 22
+};
Review comment:
did you check those numbers or just copied from nrf52?
##########
File path: nimble/drivers/nrf5340/src/ble_phy.c
##########
@@ -0,0 +1,2001 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <stdint.h>
+#include <string.h>
+#include <assert.h>
+#include <syscfg/syscfg.h>
+#include <os/os.h>
+#include <nimble/ble.h>
+#include <nimble/nimble_opt.h>
+#include <nimble/nimble_npl.h>
+#include <controller/ble_phy.h>
+
+#include <ble/xcvr.h>
+#include <controller/ble_phy_trace.h>
+#include <controller/ble_ll.h>
+#include <mcu/nrf5340_net_clock.h>
+#include <mcu/cmsis_nvic.h>
+
+/*
+ * NOTE: This code uses 1-6 DPPI channels so care should be taken when using
+ * DPPI somewhere else.
+ * TODO maybe we could reduce number of used channels if we reuse same channel
+ * for mutually exclusive events but for now make it simpler to debug.
+ */
+
+#define DPPI_CH_TIMER0_EVENTS_COMPARE_0 DPPIC_CHEN_CH0_Pos
+#define DPPI_CH_TIMER0_EVENTS_COMPARE_3 DPPIC_CHEN_CH1_Pos
+#define DPPI_CH_RADIO_EVENTS_END DPPIC_CHEN_CH2_Pos
+#define DPPI_CH_RADIO_EVENTS_BCMATCH DPPIC_CHEN_CH3_Pos
+#define DPPI_CH_RADIO_EVENTS_ADDRESS DPPIC_CHEN_CH4_Pos
+#define DPPI_CH_RTC0_EVENTS_COMPARE_0 DPPIC_CHEN_CH5_Pos
+
+#define DPPI_CH_ENABLE_ALL (DPPIC_CHEN_CH0_Msk | DPPIC_CHEN_CH1_Msk | DPPIC_CHEN_CH2_Msk | \
+ DPPIC_CHEN_CH3_Msk | DPPIC_CHEN_CH4_Msk | DPPIC_CHEN_CH5_Msk)
+
+#define DPPI_PUBLISH_TIMER0_EVENTS_COMPARE_0 ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << TIMER_PUBLISH_COMPARE_CHIDX_Pos) | \
+ (TIMER_PUBLISH_COMPARE_EN_Enabled << TIMER_PUBLISH_COMPARE_EN_Pos))
+#define DPPI_PUBLISH_TIMER0_EVENTS_COMPARE_3 ((DPPI_CH_TIMER0_EVENTS_COMPARE_3 << TIMER_PUBLISH_COMPARE_CHIDX_Pos) | \
+ (TIMER_PUBLISH_COMPARE_EN_Enabled << TIMER_PUBLISH_COMPARE_EN_Pos))
+#define DPPI_PUBLISH_RADIO_EVENTS_END ((DPPI_CH_RADIO_EVENTS_END << RADIO_PUBLISH_END_CHIDX_Pos) | \
+ (RADIO_PUBLISH_END_EN_Enabled << RADIO_PUBLISH_END_EN_Pos))
+#define DPPI_PUBLISH_RADIO_EVENTS_BCMATCH ((DPPI_CH_RADIO_EVENTS_BCMATCH << RADIO_PUBLISH_BCMATCH_CHIDX_Pos) | \
+ (RADIO_PUBLISH_BCMATCH_EN_Enabled << RADIO_PUBLISH_BCMATCH_EN_Pos))
+#define DPPI_PUBLISH_RADIO_EVENTS_ADDRESS ((DPPI_CH_RADIO_EVENTS_ADDRESS << RADIO_PUBLISH_ADDRESS_CHIDX_Pos) | \
+ (RADIO_PUBLISH_ADDRESS_EN_Enabled << RADIO_PUBLISH_ADDRESS_EN_Pos))
+#define DPPI_PUBLISH_RTC0_EVENTS_COMPARE_0 ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << RTC_PUBLISH_COMPARE_CHIDX_Pos) | \
+ (RTC_PUBLISH_COMPARE_EN_Enabled << RTC_PUBLISH_COMPARE_EN_Pos))
+
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_START ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << TIMER_SUBSCRIBE_START_CHIDX_Pos) | \
+ (TIMER_SUBSCRIBE_START_EN_Enabled << TIMER_SUBSCRIBE_START_EN_Pos))
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE1 ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+ (TIMER_SUBSCRIBE_CAPTURE_EN_Enabled << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE2 ((DPPI_CH_RADIO_EVENTS_END << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+ (TIMER_SUBSCRIBE_CAPTURE_EN_Enabled << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE3 ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+ (TIMER_SUBSCRIBE_CAPTURE_EN_Enabled << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
+#define DPPI_SUBSCRIBE_RADIO_TASKS_DISABLE ((DPPI_CH_TIMER0_EVENTS_COMPARE_3 << RADIO_SUBSCRIBE_DISABLE_CHIDX_Pos) | \
+ (RADIO_SUBSCRIBE_DISABLE_EN_Enabled << RADIO_SUBSCRIBE_DISABLE_EN_Pos))
+#define DPPI_SUBSCRIBE_RADIO_TASKS_RXEN ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_RXEN_CHIDX_Pos) | \
+ (RADIO_SUBSCRIBE_RXEN_EN_Enabled << RADIO_SUBSCRIBE_RXEN_EN_Pos))
+#define DPPI_SUBSCRIBE_RADIO_TASKS_TXEN ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_TXEN_CHIDX_Pos) | \
+ (RADIO_SUBSCRIBE_TXEN_EN_Enabled << RADIO_SUBSCRIBE_TXEN_EN_Pos))
+#define DPPI_SUBSCRIBE_AAR_TASKS_START ((DPPI_CH_RADIO_EVENTS_BCMATCH << AAR_SUBSCRIBE_START_CHIDX_Pos) | \
+ (AAR_SUBSCRIBE_START_EN_Enabled << AAR_SUBSCRIBE_START_EN_Pos))
+#define DPPI_SUBSCRIBE_CCM_TASKS_CRYPT ((DPPI_CH_RADIO_EVENTS_ADDRESS << CCM_SUBSCRIBE_CRYPT_CHIDX_Pos) | \
+ (CCM_SUBSCRIBE_CRYPT_EN_Enabled << CCM_SUBSCRIBE_CRYPT_EN_Pos))
+
+#define DPPI_UNSUBSCRIBE_TIMER0_TASKS_START ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << TIMER_SUBSCRIBE_START_CHIDX_Pos) | \
+ (TIMER_SUBSCRIBE_START_EN_Disabled << TIMER_SUBSCRIBE_START_EN_Pos))
+#define DPPI_UNSUBSCRIBE_TIMER0_TASKS_CAPTURE1 ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+ (TIMER_SUBSCRIBE_CAPTURE_EN_Disabled << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
+#define DPPI_UNSUBSCRIBE_TIMER0_TASKS_CAPTURE2 ((DPPI_CH_RADIO_EVENTS_END << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+ (TIMER_SUBSCRIBE_CAPTURE_EN_Disabled << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
+#define DPPI_UNSUBSCRIBE_TIMER0_TASKS_CAPTURE3 ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+ (TIMER_SUBSCRIBE_CAPTURE_EN_Disabled << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
+#define DPPI_UNSUBSCRIBE_RADIO_TASKS_DISABLE ((DPPI_CH_TIMER0_EVENTS_COMPARE_3 << RADIO_SUBSCRIBE_DISABLE_CHIDX_Pos) | \
+ (RADIO_SUBSCRIBE_DISABLE_EN_Disabled << RADIO_SUBSCRIBE_DISABLE_EN_Pos))
+#define DPPI_UNSUBSCRIBE_RADIO_TASKS_RXEN ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_RXEN_CHIDX_Pos) | \
+ (RADIO_SUBSCRIBE_RXEN_EN_Disabled << RADIO_SUBSCRIBE_RXEN_EN_Pos))
+#define DPPI_UNSUBSCRIBE_RADIO_TASKS_TXEN ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_TXEN_CHIDX_Pos) | \
+ (RADIO_SUBSCRIBE_TXEN_EN_Disabled << RADIO_SUBSCRIBE_TXEN_EN_Pos))
+#define DPPI_UNSUBSCRIBE_AAR_TASKS_START ((DPPI_CH_RADIO_EVENTS_BCMATCH << AAR_SUBSCRIBE_START_CHIDX_Pos) | \
+ (AAR_SUBSCRIBE_START_EN_Disabled << AAR_SUBSCRIBE_START_EN_Pos))
+#define DPPI_UNSUBSCRIBE_CCM_TASKS_CRYPT ((DPPI_CH_RADIO_EVENTS_ADDRESS << CCM_SUBSCRIBE_CRYPT_CHIDX_Pos) | \
+ (CCM_SUBSCRIBE_CRYPT_EN_Disabled << CCM_SUBSCRIBE_CRYPT_EN_Pos))
Review comment:
subscribe and unsubscribe macros are identical except EN bit is set to either 0 or 1, so I'd just create single macro with parameter
##########
File path: nimble/drivers/nrf5340/src/ble_phy.c
##########
@@ -0,0 +1,2001 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <stdint.h>
+#include <string.h>
+#include <assert.h>
+#include <syscfg/syscfg.h>
+#include <os/os.h>
+#include <nimble/ble.h>
+#include <nimble/nimble_opt.h>
+#include <nimble/nimble_npl.h>
+#include <controller/ble_phy.h>
+
+#include <ble/xcvr.h>
+#include <controller/ble_phy_trace.h>
+#include <controller/ble_ll.h>
+#include <mcu/nrf5340_net_clock.h>
+#include <mcu/cmsis_nvic.h>
+
+/*
+ * NOTE: This code uses 1-6 DPPI channels so care should be taken when using
+ * DPPI somewhere else.
+ * TODO maybe we could reduce number of used channels if we reuse same channel
+ * for mutually exclusive events but for now make it simpler to debug.
+ */
+
+#define DPPI_CH_TIMER0_EVENTS_COMPARE_0 DPPIC_CHEN_CH0_Pos
+#define DPPI_CH_TIMER0_EVENTS_COMPARE_3 DPPIC_CHEN_CH1_Pos
+#define DPPI_CH_RADIO_EVENTS_END DPPIC_CHEN_CH2_Pos
+#define DPPI_CH_RADIO_EVENTS_BCMATCH DPPIC_CHEN_CH3_Pos
+#define DPPI_CH_RADIO_EVENTS_ADDRESS DPPIC_CHEN_CH4_Pos
+#define DPPI_CH_RTC0_EVENTS_COMPARE_0 DPPIC_CHEN_CH5_Pos
Review comment:
should be plain numbers instead of some CMSIS symbols
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [mynewt-nimble] apache-mynewt-bot commented on pull request #841: nimble/drivers: Add support for nRF5340 radio
Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on pull request #841:
URL: https://github.com/apache/mynewt-nimble/pull/841#issuecomment-696380747
<!-- style-bot -->
## Style check summary
### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
#### nimble/drivers/nrf5340/src/ble_phy.c
<details>
```diff
@@ -63,23 +63,32 @@
#define DPPI_PUBLISH_RTC0_EVENTS_COMPARE_0 ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << RTC_PUBLISH_COMPARE_CHIDX_Pos) | \
(RTC_PUBLISH_COMPARE_EN_Enabled << RTC_PUBLISH_COMPARE_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_START(_enable) ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << TIMER_SUBSCRIBE_START_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_START(_enable) ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << \
+ TIMER_SUBSCRIBE_START_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_START_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE1(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE1(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << \
+ TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE2(_enable) ((DPPI_CH_RADIO_EVENTS_END << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE2(_enable) ((DPPI_CH_RADIO_EVENTS_END << \
+ TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE3(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE3(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << \
+ TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_SUBSCRIBE_RADIO_TASKS_DISABLE(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_3 << RADIO_SUBSCRIBE_DISABLE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_RADIO_TASKS_DISABLE(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_3 << \
+ RADIO_SUBSCRIBE_DISABLE_CHIDX_Pos) | \
((_enable) << RADIO_SUBSCRIBE_DISABLE_EN_Pos))
-#define DPPI_SUBSCRIBE_RADIO_TASKS_RXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_RXEN_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_RADIO_TASKS_RXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << \
+ RADIO_SUBSCRIBE_RXEN_CHIDX_Pos) | \
((_enable) << RADIO_SUBSCRIBE_RXEN_EN_Pos))
-#define DPPI_SUBSCRIBE_RADIO_TASKS_TXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_TXEN_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_RADIO_TASKS_TXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << \
+ RADIO_SUBSCRIBE_TXEN_CHIDX_Pos) | \
((_enable) << RADIO_SUBSCRIBE_TXEN_EN_Pos))
-#define DPPI_SUBSCRIBE_AAR_TASKS_START(_enable) ((DPPI_CH_RADIO_EVENTS_BCMATCH << AAR_SUBSCRIBE_START_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_AAR_TASKS_START(_enable) ((DPPI_CH_RADIO_EVENTS_BCMATCH << \
+ AAR_SUBSCRIBE_START_CHIDX_Pos) | \
((_enable) << AAR_SUBSCRIBE_START_EN_Pos))
-#define DPPI_SUBSCRIBE_CCM_TASKS_CRYPT(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << CCM_SUBSCRIBE_CRYPT_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_CCM_TASKS_CRYPT(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << \
+ CCM_SUBSCRIBE_CRYPT_CHIDX_Pos) | \
((_enable) << CCM_SUBSCRIBE_CRYPT_EN_Pos))
extern uint8_t g_nrf_num_irks;
@@ -104,17 +113,17 @@
/* NRF_RADIO_NS->PCNF0 configuration values */
#define NRF_PCNF0 (NRF_LFLEN_BITS << RADIO_PCNF0_LFLEN_Pos) | \
- (RADIO_PCNF0_S1INCL_Msk) | \
- (NRF_S0LEN << RADIO_PCNF0_S0LEN_Pos) | \
- (NRF_S1LEN_BITS << RADIO_PCNF0_S1LEN_Pos)
+ (RADIO_PCNF0_S1INCL_Msk) | \
+ (NRF_S0LEN << RADIO_PCNF0_S0LEN_Pos) | \
+ (NRF_S1LEN_BITS << RADIO_PCNF0_S1LEN_Pos)
#define NRF_PCNF0_1M (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_8bit << RADIO_PCNF0_PLEN_Pos)
+ (RADIO_PCNF0_PLEN_8bit << RADIO_PCNF0_PLEN_Pos)
#define NRF_PCNF0_2M (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_16bit << RADIO_PCNF0_PLEN_Pos)
+ (RADIO_PCNF0_PLEN_16bit << RADIO_PCNF0_PLEN_Pos)
#define NRF_PCNF0_CODED (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_LongRange << RADIO_PCNF0_PLEN_Pos) | \
- (NRF_CILEN_BITS << RADIO_PCNF0_CILEN_Pos) | \
- (NRF_TERMLEN_BITS << RADIO_PCNF0_TERMLEN_Pos)
+ (RADIO_PCNF0_PLEN_LongRange << RADIO_PCNF0_PLEN_Pos) | \
+ (NRF_CILEN_BITS << RADIO_PCNF0_CILEN_Pos) | \
+ (NRF_TERMLEN_BITS << RADIO_PCNF0_TERMLEN_Pos)
/* BLE PHY data structure */
struct ble_phy_obj {
```
</details>
#### nimble/transport/nrf5340/src/nrf5340_ble_hci.c
<details>
```diff
@@ -216,7 +216,7 @@
if (buf) {
break;
}
- /* no break */
+ /* no break */
case BLE_HCI_TRANS_BUF_EVT_LO:
buf = os_memblock_get(&nrf5340_ble_hci_pool_evt_lo);
break;
```
</details>
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [mynewt-nimble] apache-mynewt-bot commented on pull request #841: nimble/drivers: Add support for nRF5340 radio
Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on pull request #841:
URL: https://github.com/apache/mynewt-nimble/pull/841#issuecomment-684536229
<!-- style-bot -->
## Style check summary
### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
#### nimble/drivers/nrf5340/src/ble_phy.c
<details>
```diff
@@ -63,23 +63,32 @@
#define DPPI_PUBLISH_RTC0_EVENTS_COMPARE_0 ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << RTC_PUBLISH_COMPARE_CHIDX_Pos) | \
(RTC_PUBLISH_COMPARE_EN_Enabled << RTC_PUBLISH_COMPARE_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_START(_enable) ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << TIMER_SUBSCRIBE_START_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_START(_enable) ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << \
+ TIMER_SUBSCRIBE_START_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_START_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE1(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE1(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << \
+ TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE2(_enable) ((DPPI_CH_RADIO_EVENTS_END << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE2(_enable) ((DPPI_CH_RADIO_EVENTS_END << \
+ TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE3(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE3(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << \
+ TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_SUBSCRIBE_RADIO_TASKS_DISABLE(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_3 << RADIO_SUBSCRIBE_DISABLE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_RADIO_TASKS_DISABLE(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_3 << \
+ RADIO_SUBSCRIBE_DISABLE_CHIDX_Pos) | \
((_enable) << RADIO_SUBSCRIBE_DISABLE_EN_Pos))
-#define DPPI_SUBSCRIBE_RADIO_TASKS_RXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_RXEN_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_RADIO_TASKS_RXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << \
+ RADIO_SUBSCRIBE_RXEN_CHIDX_Pos) | \
((_enable) << RADIO_SUBSCRIBE_RXEN_EN_Pos))
-#define DPPI_SUBSCRIBE_RADIO_TASKS_TXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_TXEN_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_RADIO_TASKS_TXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << \
+ RADIO_SUBSCRIBE_TXEN_CHIDX_Pos) | \
((_enable) << RADIO_SUBSCRIBE_TXEN_EN_Pos))
-#define DPPI_SUBSCRIBE_AAR_TASKS_START(_enable) ((DPPI_CH_RADIO_EVENTS_BCMATCH << AAR_SUBSCRIBE_START_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_AAR_TASKS_START(_enable) ((DPPI_CH_RADIO_EVENTS_BCMATCH << \
+ AAR_SUBSCRIBE_START_CHIDX_Pos) | \
((_enable) << AAR_SUBSCRIBE_START_EN_Pos))
-#define DPPI_SUBSCRIBE_CCM_TASKS_CRYPT(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << CCM_SUBSCRIBE_CRYPT_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_CCM_TASKS_CRYPT(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << \
+ CCM_SUBSCRIBE_CRYPT_CHIDX_Pos) | \
((_enable) << CCM_SUBSCRIBE_CRYPT_EN_Pos))
extern uint8_t g_nrf_num_irks;
@@ -104,17 +113,17 @@
/* NRF_RADIO_NS->PCNF0 configuration values */
#define NRF_PCNF0 (NRF_LFLEN_BITS << RADIO_PCNF0_LFLEN_Pos) | \
- (RADIO_PCNF0_S1INCL_Msk) | \
- (NRF_S0LEN << RADIO_PCNF0_S0LEN_Pos) | \
- (NRF_S1LEN_BITS << RADIO_PCNF0_S1LEN_Pos)
+ (RADIO_PCNF0_S1INCL_Msk) | \
+ (NRF_S0LEN << RADIO_PCNF0_S0LEN_Pos) | \
+ (NRF_S1LEN_BITS << RADIO_PCNF0_S1LEN_Pos)
#define NRF_PCNF0_1M (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_8bit << RADIO_PCNF0_PLEN_Pos)
+ (RADIO_PCNF0_PLEN_8bit << RADIO_PCNF0_PLEN_Pos)
#define NRF_PCNF0_2M (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_16bit << RADIO_PCNF0_PLEN_Pos)
+ (RADIO_PCNF0_PLEN_16bit << RADIO_PCNF0_PLEN_Pos)
#define NRF_PCNF0_CODED (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_LongRange << RADIO_PCNF0_PLEN_Pos) | \
- (NRF_CILEN_BITS << RADIO_PCNF0_CILEN_Pos) | \
- (NRF_TERMLEN_BITS << RADIO_PCNF0_TERMLEN_Pos)
+ (RADIO_PCNF0_PLEN_LongRange << RADIO_PCNF0_PLEN_Pos) | \
+ (NRF_CILEN_BITS << RADIO_PCNF0_CILEN_Pos) | \
+ (NRF_TERMLEN_BITS << RADIO_PCNF0_TERMLEN_Pos)
/* BLE PHY data structure */
struct ble_phy_obj {
```
</details>
#### nimble/transport/nrf5340/src/nrf5340_ble_hci.c
<details>
```diff
@@ -216,7 +216,7 @@
if (buf) {
break;
}
- /* no break */
+ /* no break */
case BLE_HCI_TRANS_BUF_EVT_LO:
buf = os_memblock_get(&nrf5340_ble_hci_pool_evt_lo);
break;
```
</details>
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [mynewt-nimble] apache-mynewt-bot commented on pull request #841: nimble/drivers: Add support for nRF5340 radio
Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on pull request #841:
URL: https://github.com/apache/mynewt-nimble/pull/841#issuecomment-696092914
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [mynewt-nimble] apache-mynewt-bot removed a comment on pull request #841: nimble/drivers: Add support for nRF5340 radio
Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot removed a comment on pull request #841:
URL: https://github.com/apache/mynewt-nimble/pull/841#issuecomment-684536229
<!-- style-bot -->
## Style check summary
### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
#### nimble/drivers/nrf5340/src/ble_phy.c
<details>
```diff
@@ -63,23 +63,32 @@
#define DPPI_PUBLISH_RTC0_EVENTS_COMPARE_0 ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << RTC_PUBLISH_COMPARE_CHIDX_Pos) | \
(RTC_PUBLISH_COMPARE_EN_Enabled << RTC_PUBLISH_COMPARE_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_START(_enable) ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << TIMER_SUBSCRIBE_START_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_START(_enable) ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << \
+ TIMER_SUBSCRIBE_START_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_START_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE1(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE1(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << \
+ TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE2(_enable) ((DPPI_CH_RADIO_EVENTS_END << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE2(_enable) ((DPPI_CH_RADIO_EVENTS_END << \
+ TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE3(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE3(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << \
+ TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_SUBSCRIBE_RADIO_TASKS_DISABLE(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_3 << RADIO_SUBSCRIBE_DISABLE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_RADIO_TASKS_DISABLE(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_3 << \
+ RADIO_SUBSCRIBE_DISABLE_CHIDX_Pos) | \
((_enable) << RADIO_SUBSCRIBE_DISABLE_EN_Pos))
-#define DPPI_SUBSCRIBE_RADIO_TASKS_RXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_RXEN_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_RADIO_TASKS_RXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << \
+ RADIO_SUBSCRIBE_RXEN_CHIDX_Pos) | \
((_enable) << RADIO_SUBSCRIBE_RXEN_EN_Pos))
-#define DPPI_SUBSCRIBE_RADIO_TASKS_TXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_TXEN_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_RADIO_TASKS_TXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << \
+ RADIO_SUBSCRIBE_TXEN_CHIDX_Pos) | \
((_enable) << RADIO_SUBSCRIBE_TXEN_EN_Pos))
-#define DPPI_SUBSCRIBE_AAR_TASKS_START(_enable) ((DPPI_CH_RADIO_EVENTS_BCMATCH << AAR_SUBSCRIBE_START_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_AAR_TASKS_START(_enable) ((DPPI_CH_RADIO_EVENTS_BCMATCH << \
+ AAR_SUBSCRIBE_START_CHIDX_Pos) | \
((_enable) << AAR_SUBSCRIBE_START_EN_Pos))
-#define DPPI_SUBSCRIBE_CCM_TASKS_CRYPT(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << CCM_SUBSCRIBE_CRYPT_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_CCM_TASKS_CRYPT(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << \
+ CCM_SUBSCRIBE_CRYPT_CHIDX_Pos) | \
((_enable) << CCM_SUBSCRIBE_CRYPT_EN_Pos))
extern uint8_t g_nrf_num_irks;
@@ -104,17 +113,17 @@
/* NRF_RADIO_NS->PCNF0 configuration values */
#define NRF_PCNF0 (NRF_LFLEN_BITS << RADIO_PCNF0_LFLEN_Pos) | \
- (RADIO_PCNF0_S1INCL_Msk) | \
- (NRF_S0LEN << RADIO_PCNF0_S0LEN_Pos) | \
- (NRF_S1LEN_BITS << RADIO_PCNF0_S1LEN_Pos)
+ (RADIO_PCNF0_S1INCL_Msk) | \
+ (NRF_S0LEN << RADIO_PCNF0_S0LEN_Pos) | \
+ (NRF_S1LEN_BITS << RADIO_PCNF0_S1LEN_Pos)
#define NRF_PCNF0_1M (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_8bit << RADIO_PCNF0_PLEN_Pos)
+ (RADIO_PCNF0_PLEN_8bit << RADIO_PCNF0_PLEN_Pos)
#define NRF_PCNF0_2M (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_16bit << RADIO_PCNF0_PLEN_Pos)
+ (RADIO_PCNF0_PLEN_16bit << RADIO_PCNF0_PLEN_Pos)
#define NRF_PCNF0_CODED (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_LongRange << RADIO_PCNF0_PLEN_Pos) | \
- (NRF_CILEN_BITS << RADIO_PCNF0_CILEN_Pos) | \
- (NRF_TERMLEN_BITS << RADIO_PCNF0_TERMLEN_Pos)
+ (RADIO_PCNF0_PLEN_LongRange << RADIO_PCNF0_PLEN_Pos) | \
+ (NRF_CILEN_BITS << RADIO_PCNF0_CILEN_Pos) | \
+ (NRF_TERMLEN_BITS << RADIO_PCNF0_TERMLEN_Pos)
/* BLE PHY data structure */
struct ble_phy_obj {
```
</details>
#### nimble/transport/nrf5340/src/nrf5340_ble_hci.c
<details>
```diff
@@ -216,7 +216,7 @@
if (buf) {
break;
}
- /* no break */
+ /* no break */
case BLE_HCI_TRANS_BUF_EVT_LO:
buf = os_memblock_get(&nrf5340_ble_hci_pool_evt_lo);
break;
```
</details>
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [mynewt-nimble] apache-mynewt-bot removed a comment on pull request #841: nimble/drivers: Add support for nRF5340 radio
Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot removed a comment on pull request #841:
URL: https://github.com/apache/mynewt-nimble/pull/841#issuecomment-696092914
<!-- style-bot -->
## Style check summary
### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
#### nimble/drivers/nrf5340/src/ble_phy.c
<details>
```diff
@@ -63,23 +63,32 @@
#define DPPI_PUBLISH_RTC0_EVENTS_COMPARE_0 ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << RTC_PUBLISH_COMPARE_CHIDX_Pos) | \
(RTC_PUBLISH_COMPARE_EN_Enabled << RTC_PUBLISH_COMPARE_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_START(_enable) ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << TIMER_SUBSCRIBE_START_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_START(_enable) ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << \
+ TIMER_SUBSCRIBE_START_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_START_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE1(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE1(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << \
+ TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE2(_enable) ((DPPI_CH_RADIO_EVENTS_END << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE2(_enable) ((DPPI_CH_RADIO_EVENTS_END << \
+ TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE3(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE3(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << \
+ TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_SUBSCRIBE_RADIO_TASKS_DISABLE(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_3 << RADIO_SUBSCRIBE_DISABLE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_RADIO_TASKS_DISABLE(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_3 << \
+ RADIO_SUBSCRIBE_DISABLE_CHIDX_Pos) | \
((_enable) << RADIO_SUBSCRIBE_DISABLE_EN_Pos))
-#define DPPI_SUBSCRIBE_RADIO_TASKS_RXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_RXEN_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_RADIO_TASKS_RXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << \
+ RADIO_SUBSCRIBE_RXEN_CHIDX_Pos) | \
((_enable) << RADIO_SUBSCRIBE_RXEN_EN_Pos))
-#define DPPI_SUBSCRIBE_RADIO_TASKS_TXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_TXEN_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_RADIO_TASKS_TXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << \
+ RADIO_SUBSCRIBE_TXEN_CHIDX_Pos) | \
((_enable) << RADIO_SUBSCRIBE_TXEN_EN_Pos))
-#define DPPI_SUBSCRIBE_AAR_TASKS_START(_enable) ((DPPI_CH_RADIO_EVENTS_BCMATCH << AAR_SUBSCRIBE_START_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_AAR_TASKS_START(_enable) ((DPPI_CH_RADIO_EVENTS_BCMATCH << \
+ AAR_SUBSCRIBE_START_CHIDX_Pos) | \
((_enable) << AAR_SUBSCRIBE_START_EN_Pos))
-#define DPPI_SUBSCRIBE_CCM_TASKS_CRYPT(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << CCM_SUBSCRIBE_CRYPT_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_CCM_TASKS_CRYPT(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << \
+ CCM_SUBSCRIBE_CRYPT_CHIDX_Pos) | \
((_enable) << CCM_SUBSCRIBE_CRYPT_EN_Pos))
extern uint8_t g_nrf_num_irks;
@@ -104,17 +113,17 @@
/* NRF_RADIO_NS->PCNF0 configuration values */
#define NRF_PCNF0 (NRF_LFLEN_BITS << RADIO_PCNF0_LFLEN_Pos) | \
- (RADIO_PCNF0_S1INCL_Msk) | \
- (NRF_S0LEN << RADIO_PCNF0_S0LEN_Pos) | \
- (NRF_S1LEN_BITS << RADIO_PCNF0_S1LEN_Pos)
+ (RADIO_PCNF0_S1INCL_Msk) | \
+ (NRF_S0LEN << RADIO_PCNF0_S0LEN_Pos) | \
+ (NRF_S1LEN_BITS << RADIO_PCNF0_S1LEN_Pos)
#define NRF_PCNF0_1M (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_8bit << RADIO_PCNF0_PLEN_Pos)
+ (RADIO_PCNF0_PLEN_8bit << RADIO_PCNF0_PLEN_Pos)
#define NRF_PCNF0_2M (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_16bit << RADIO_PCNF0_PLEN_Pos)
+ (RADIO_PCNF0_PLEN_16bit << RADIO_PCNF0_PLEN_Pos)
#define NRF_PCNF0_CODED (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_LongRange << RADIO_PCNF0_PLEN_Pos) | \
- (NRF_CILEN_BITS << RADIO_PCNF0_CILEN_Pos) | \
- (NRF_TERMLEN_BITS << RADIO_PCNF0_TERMLEN_Pos)
+ (RADIO_PCNF0_PLEN_LongRange << RADIO_PCNF0_PLEN_Pos) | \
+ (NRF_CILEN_BITS << RADIO_PCNF0_CILEN_Pos) | \
+ (NRF_TERMLEN_BITS << RADIO_PCNF0_TERMLEN_Pos)
/* BLE PHY data structure */
struct ble_phy_obj {
```
</details>
#### nimble/transport/nrf5340/src/nrf5340_ble_hci.c
<details>
```diff
@@ -216,7 +216,7 @@
if (buf) {
break;
}
- /* no break */
+ /* no break */
case BLE_HCI_TRANS_BUF_EVT_LO:
buf = os_memblock_get(&nrf5340_ble_hci_pool_evt_lo);
break;
```
</details>
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [mynewt-nimble] andrzej-kaczmarek commented on a change in pull request #841: nimble/drivers: Add support for nRF5340 radio
Posted by GitBox <gi...@apache.org>.
andrzej-kaczmarek commented on a change in pull request #841:
URL: https://github.com/apache/mynewt-nimble/pull/841#discussion_r492024304
##########
File path: nimble/drivers/nrf5340/src/ble_hw.c
##########
@@ -0,0 +1,483 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include <stdint.h>
+#include <assert.h>
+#include <string.h>
+#include <syscfg/syscfg.h>
+#include <os/os.h>
+#include <nimble/ble.h>
+#include <nimble/nimble_opt.h>
+#include <controller/ble_hw.h>
+
+#include <ble/xcvr.h>
+#include <mcu/cmsis_nvic.h>
+#include <os/os_trace_api.h>
+
+/* Total number of resolving list elements */
+#define BLE_HW_RESOLV_LIST_SIZE (16)
+
+/* We use this to keep track of which entries are set to valid addresses */
+static uint8_t g_ble_hw_whitelist_mask;
+
+/* Random number generator isr callback */
+static ble_rng_isr_cb_t ble_rng_isr_cb;
+
+/* If LL privacy is enabled, allocate memory for AAR */
+#if MYNEWT_VAL(BLE_LL_CFG_FEAT_LL_PRIVACY)
+
+/* The NRF5340 supports up to 16 IRK entries */
+#if (MYNEWT_VAL(BLE_LL_RESOLV_LIST_SIZE) < 16)
+#define NRF_IRK_LIST_ENTRIES (MYNEWT_VAL(BLE_LL_RESOLV_LIST_SIZE))
+#else
+#define NRF_IRK_LIST_ENTRIES (16)
+#endif
+
+/* NOTE: each entry is 16 bytes long. */
+uint32_t g_nrf_irk_list[NRF_IRK_LIST_ENTRIES * 4];
+
+/* Current number of IRK entries */
+uint8_t g_nrf_num_irks;
+
+#endif
+
+/* Returns public device address or -1 if not present */
+int
+ble_hw_get_public_addr(ble_addr_t *addr)
+{
+ uint32_t addr_high;
+ uint32_t addr_low;
+
+ /* Does FICR have a public address */
+ if ((NRF_FICR_NS->DEVICEADDRTYPE & 1) != 0) {
+ return -1;
+ }
+
+ /* Copy into device address. We can do this because we know platform */
+ addr_low = NRF_FICR_NS->DEVICEADDR[0];
+ addr_high = NRF_FICR_NS->DEVICEADDR[1];
+ memcpy(addr->val, &addr_low, 4);
+ memcpy(&addr->val[4], &addr_high, 2);
+ addr->type = BLE_ADDR_PUBLIC;
+
+ return 0;
+}
+
+/* Returns random static address or -1 if not present */
+int
+ble_hw_get_static_addr(ble_addr_t *addr)
+{
+ int rc;
+
+ if ((NRF_FICR_NS->DEVICEADDRTYPE & 1) == 1) {
+ memcpy(addr->val, (void *)&NRF_FICR_NS->DEVICEADDR[0], 4);
+ memcpy(&addr->val[4], (void *)&NRF_FICR_NS->DEVICEADDR[1], 2);
+ addr->val[5] |= 0xc0;
+ addr->type = BLE_ADDR_RANDOM;
+ rc = 0;
+ } else {
+ rc = -1;
+ }
+
+ return rc;
+}
+
+/**
+ * Clear the whitelist
+ *
+ * @return int
+ */
+void
+ble_hw_whitelist_clear(void)
+{
+ NRF_RADIO_NS->DACNF = 0;
+ g_ble_hw_whitelist_mask = 0;
+}
+
+/**
+ * Add a device to the hw whitelist
+ *
+ * @param addr
+ * @param addr_type
+ *
+ * @return int 0: success, BLE error code otherwise
+ */
+int
+ble_hw_whitelist_add(const uint8_t *addr, uint8_t addr_type)
+{
+ int i;
+ uint32_t mask;
+
+ /* Find first ununsed device address match element */
+ mask = 0x01;
+ for (i = 0; i < BLE_HW_WHITE_LIST_SIZE; ++i) {
+ if ((mask & g_ble_hw_whitelist_mask) == 0) {
+ NRF_RADIO_NS->DAB[i] = get_le32(addr);
+ NRF_RADIO_NS->DAP[i] = get_le16(addr + 4);
+ if (addr_type == BLE_ADDR_RANDOM) {
+ NRF_RADIO_NS->DACNF |= (mask << 8);
+ }
+ g_ble_hw_whitelist_mask |= mask;
+ return BLE_ERR_SUCCESS;
+ }
+ mask <<= 1;
+ }
+
+ return BLE_ERR_MEM_CAPACITY;
+}
+
+/**
+ * Remove a device from the hw whitelist
+ *
+ * @param addr
+ * @param addr_type
+ *
+ */
+void
+ble_hw_whitelist_rmv(const uint8_t *addr, uint8_t addr_type)
+{
+ int i;
+ uint8_t cfg_addr;
+ uint16_t dap;
+ uint16_t txadd;
+ uint32_t dab;
+ uint32_t mask;
+
+ /* Find first ununsed device address match element */
+ dab = get_le32(addr);
+ dap = get_le16(addr + 4);
+ txadd = NRF_RADIO_NS->DACNF >> 8;
+ mask = 0x01;
+ for (i = 0; i < BLE_HW_WHITE_LIST_SIZE; ++i) {
+ if (mask & g_ble_hw_whitelist_mask) {
+ if ((dab == NRF_RADIO_NS->DAB[i]) && (dap == NRF_RADIO_NS->DAP[i])) {
+ cfg_addr = txadd & mask;
+ if (addr_type == BLE_ADDR_RANDOM) {
+ if (cfg_addr != 0) {
+ break;
+ }
+ } else {
+ if (cfg_addr == 0) {
+ break;
+ }
+ }
+ }
+ }
+ mask <<= 1;
+ }
+
+ if (i < BLE_HW_WHITE_LIST_SIZE) {
+ g_ble_hw_whitelist_mask &= ~mask;
+ NRF_RADIO_NS->DACNF &= ~mask;
+ }
+}
+
+/**
+ * Returns the size of the whitelist in HW
+ *
+ * @return int Number of devices allowed in whitelist
+ */
+uint8_t
+ble_hw_whitelist_size(void)
+{
+ return BLE_HW_WHITE_LIST_SIZE;
+}
+
+/**
+ * Enable the whitelisted devices
+ */
+void
+ble_hw_whitelist_enable(void)
+{
+ /* Enable the configured device addresses */
+ NRF_RADIO_NS->DACNF |= g_ble_hw_whitelist_mask;
+}
+
+/**
+ * Disables the whitelisted devices
+ */
+void
+ble_hw_whitelist_disable(void)
+{
+ /* Disable all whitelist devices */
+ NRF_RADIO_NS->DACNF &= 0x0000ff00;
+}
+
+/**
+ * Boolean function which returns true ('1') if there is a match on the
+ * whitelist.
+ *
+ * @return int
+ */
+int
+ble_hw_whitelist_match(void)
+{
+ return NRF_RADIO_NS->EVENTS_DEVMATCH ? 1 : 0;
Review comment:
`EVENT_DEVMATCH` is already a single bit register
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [mynewt-nimble] apache-mynewt-bot commented on pull request #841: nimble/drivers: Add support for nRF5340 radio
Posted by GitBox <gi...@apache.org>.
apache-mynewt-bot commented on pull request #841:
URL: https://github.com/apache/mynewt-nimble/pull/841#issuecomment-696133538
<!-- style-bot -->
## Style check summary
### Our coding style is [here!](https://github.com/apache/mynewt-core/blob/master/CODING_STANDARDS.md)
#### nimble/drivers/nrf5340/src/ble_phy.c
<details>
```diff
@@ -63,23 +63,32 @@
#define DPPI_PUBLISH_RTC0_EVENTS_COMPARE_0 ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << RTC_PUBLISH_COMPARE_CHIDX_Pos) | \
(RTC_PUBLISH_COMPARE_EN_Enabled << RTC_PUBLISH_COMPARE_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_START(_enable) ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << TIMER_SUBSCRIBE_START_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_START(_enable) ((DPPI_CH_RTC0_EVENTS_COMPARE_0 << \
+ TIMER_SUBSCRIBE_START_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_START_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE1(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE1(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << \
+ TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE2(_enable) ((DPPI_CH_RADIO_EVENTS_END << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE2(_enable) ((DPPI_CH_RADIO_EVENTS_END << \
+ TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE3(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_TIMER0_TASKS_CAPTURE3(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << \
+ TIMER_SUBSCRIBE_CAPTURE_CHIDX_Pos) | \
((_enable) << TIMER_SUBSCRIBE_CAPTURE_EN_Pos))
-#define DPPI_SUBSCRIBE_RADIO_TASKS_DISABLE(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_3 << RADIO_SUBSCRIBE_DISABLE_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_RADIO_TASKS_DISABLE(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_3 << \
+ RADIO_SUBSCRIBE_DISABLE_CHIDX_Pos) | \
((_enable) << RADIO_SUBSCRIBE_DISABLE_EN_Pos))
-#define DPPI_SUBSCRIBE_RADIO_TASKS_RXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_RXEN_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_RADIO_TASKS_RXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << \
+ RADIO_SUBSCRIBE_RXEN_CHIDX_Pos) | \
((_enable) << RADIO_SUBSCRIBE_RXEN_EN_Pos))
-#define DPPI_SUBSCRIBE_RADIO_TASKS_TXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << RADIO_SUBSCRIBE_TXEN_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_RADIO_TASKS_TXEN(_enable) ((DPPI_CH_TIMER0_EVENTS_COMPARE_0 << \
+ RADIO_SUBSCRIBE_TXEN_CHIDX_Pos) | \
((_enable) << RADIO_SUBSCRIBE_TXEN_EN_Pos))
-#define DPPI_SUBSCRIBE_AAR_TASKS_START(_enable) ((DPPI_CH_RADIO_EVENTS_BCMATCH << AAR_SUBSCRIBE_START_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_AAR_TASKS_START(_enable) ((DPPI_CH_RADIO_EVENTS_BCMATCH << \
+ AAR_SUBSCRIBE_START_CHIDX_Pos) | \
((_enable) << AAR_SUBSCRIBE_START_EN_Pos))
-#define DPPI_SUBSCRIBE_CCM_TASKS_CRYPT(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << CCM_SUBSCRIBE_CRYPT_CHIDX_Pos) | \
+#define DPPI_SUBSCRIBE_CCM_TASKS_CRYPT(_enable) ((DPPI_CH_RADIO_EVENTS_ADDRESS << \
+ CCM_SUBSCRIBE_CRYPT_CHIDX_Pos) | \
((_enable) << CCM_SUBSCRIBE_CRYPT_EN_Pos))
extern uint8_t g_nrf_num_irks;
@@ -104,17 +113,17 @@
/* NRF_RADIO_NS->PCNF0 configuration values */
#define NRF_PCNF0 (NRF_LFLEN_BITS << RADIO_PCNF0_LFLEN_Pos) | \
- (RADIO_PCNF0_S1INCL_Msk) | \
- (NRF_S0LEN << RADIO_PCNF0_S0LEN_Pos) | \
- (NRF_S1LEN_BITS << RADIO_PCNF0_S1LEN_Pos)
+ (RADIO_PCNF0_S1INCL_Msk) | \
+ (NRF_S0LEN << RADIO_PCNF0_S0LEN_Pos) | \
+ (NRF_S1LEN_BITS << RADIO_PCNF0_S1LEN_Pos)
#define NRF_PCNF0_1M (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_8bit << RADIO_PCNF0_PLEN_Pos)
+ (RADIO_PCNF0_PLEN_8bit << RADIO_PCNF0_PLEN_Pos)
#define NRF_PCNF0_2M (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_16bit << RADIO_PCNF0_PLEN_Pos)
+ (RADIO_PCNF0_PLEN_16bit << RADIO_PCNF0_PLEN_Pos)
#define NRF_PCNF0_CODED (NRF_PCNF0) | \
- (RADIO_PCNF0_PLEN_LongRange << RADIO_PCNF0_PLEN_Pos) | \
- (NRF_CILEN_BITS << RADIO_PCNF0_CILEN_Pos) | \
- (NRF_TERMLEN_BITS << RADIO_PCNF0_TERMLEN_Pos)
+ (RADIO_PCNF0_PLEN_LongRange << RADIO_PCNF0_PLEN_Pos) | \
+ (NRF_CILEN_BITS << RADIO_PCNF0_CILEN_Pos) | \
+ (NRF_TERMLEN_BITS << RADIO_PCNF0_TERMLEN_Pos)
/* BLE PHY data structure */
struct ble_phy_obj {
```
</details>
#### nimble/transport/nrf5340/src/nrf5340_ble_hci.c
<details>
```diff
@@ -216,7 +216,7 @@
if (buf) {
break;
}
- /* no break */
+ /* no break */
case BLE_HCI_TRANS_BUF_EVT_LO:
buf = os_memblock_get(&nrf5340_ble_hci_pool_evt_lo);
break;
```
</details>
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org