Merge pull request #13910 from marcemmers/nrf-ble-config

Update NRF ble configuration options
pull/13918/head
Martin Kojtal 2020-11-18 09:41:42 +00:00 committed by GitHub
commit 96f3de6914
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 47 deletions

View File

@ -56,5 +56,11 @@
"value": 1, "value": 1,
"macro_name": "CHCI_TR_CUSTOM" "macro_name": "CHCI_TR_CUSTOM"
} }
},
"target_overrides": {
"MCU_NRF52840": {
"phy-coded-support": 1,
"extended-advertising-size": 512
}
} }
} }

View File

@ -1,22 +1,6 @@
{ {
"name": "cordio-ll-nrf52840", "name": "cordio-ll-nrf52840",
"config": { "config": {
"phy-coded-support": {
"help": "Coded PHY supported.",
"value": 1
},
"extended-advertising-size": {
"help": "Maximum extended advertising data (and scan data response) size",
"value": 512
},
"max-acl-size": {
"help": "Maximum ACL buffer size",
"value": 256
},
"tx-buffers": {
"help": "Default number of send buffers",
"value": 4
},
"cryptocell310-acceleration": { "cryptocell310-acceleration": {
"help": "Should the link layer use the Crypto Cell 310 to offload encryption.", "help": "Should the link layer use the Crypto Cell 310 to offload encryption.",
"value": 1 "value": 1

View File

@ -55,26 +55,6 @@
using namespace ble; using namespace ble;
/*! \brief Memory that should be reserved for the stack. */
#if defined(NRF52840_XXAA)
#undef MBED_CONF_CORDIO_LL_EXTENDED_ADVERTISING_SIZE
#undef MBED_CONF_CORDIO_LL_MAX_ACL_SIZE
#undef MBED_CONF_CORDIO_LL_TX_BUFFERS
#undef MBED_CONF_CORDIO_LL_PHY_CODED_SUPPORT
#define MBED_CONF_CORDIO_LL_EXTENDED_ADVERTISING_SIZE MBED_CONF_CORDIO_LL_NRF52840_EXTENDED_ADVERTISING_SIZE
#define MBED_CONF_CORDIO_LL_MAX_ACL_SIZE MBED_CONF_CORDIO_LL_NRF52840_MAX_ACL_SIZE
#define MBED_CONF_CORDIO_LL_TX_BUFFERS MBED_CONF_CORDIO_LL_NRF52840_TX_BUFFERS
#define MBED_CONF_CORDIO_LL_PHY_CODED_SUPPORT MBED_CONF_CORDIO_LL_NRF52840_PHY_CODED_SUPPORT
#define CORDIO_LL_MEMORY_FOOTPRINT 16056UL
#else
#define CORDIO_LL_MEMORY_FOOTPRINT 12500UL
#endif
/*! \brief Typical implementation revision number (LlRtCfg_t::implRev). */ /*! \brief Typical implementation revision number (LlRtCfg_t::implRev). */
#define LL_IMPL_REV 0x2303 #define LL_IMPL_REV 0x2303
@ -202,7 +182,7 @@ extern "C" void TIMER2_IRQHandler(void);
NRFCordioHCIDriver::NRFCordioHCIDriver(CordioHCITransportDriver& transport_driver) : CordioHCIDriver(transport_driver), _is_init(false), _stack_buffer(NULL) NRFCordioHCIDriver::NRFCordioHCIDriver(CordioHCITransportDriver& transport_driver) : CordioHCIDriver(transport_driver), _is_init(false), _stack_buffer(NULL)
{ {
_stack_buffer = (uint8_t*)malloc(CORDIO_LL_MEMORY_FOOTPRINT); _stack_buffer = (uint8_t*)malloc(MBED_CONF_CORDIO_NORDIC_LL_HCI_DRIVER_BUFFER_SIZE);
MBED_ASSERT(_stack_buffer != NULL); MBED_ASSERT(_stack_buffer != NULL);
} }
@ -233,11 +213,7 @@ NRFCordioHCIDriver::~NRFCordioHCIDriver()
ble::buf_pool_desc_t NRFCordioHCIDriver::get_buffer_pool_description() ble::buf_pool_desc_t NRFCordioHCIDriver::get_buffer_pool_description()
{ {
static union { static union {
#if defined(NRF52840_XXAA) uint8_t buffer[MBED_CONF_CORDIO_NORDIC_LL_WSF_POOL_BUFFER_SIZE];
uint8_t buffer[ 4900 ];
#else
uint8_t buffer[ 4900 ];
#endif
uint64_t align; uint64_t align;
}; };
static const wsfBufPoolDesc_t pool_desc[] = { static const wsfBufPoolDesc_t pool_desc[] = {
@ -268,7 +244,7 @@ void NRFCordioHCIDriver::do_initialize()
.plSizeCfg = 4, .plSizeCfg = 4,
.pLlRtCfg = &_ll_cfg, .pLlRtCfg = &_ll_cfg,
.pFreeMem = _stack_buffer, .pFreeMem = _stack_buffer,
.freeMemAvail = CORDIO_LL_MEMORY_FOOTPRINT .freeMemAvail = MBED_CONF_CORDIO_NORDIC_LL_HCI_DRIVER_BUFFER_SIZE
}; };
/* switch to more accurate 16 MHz crystal oscillator (system starts up using 16MHz RC oscillator) */ /* switch to more accurate 16 MHz crystal oscillator (system starts up using 16MHz RC oscillator) */
@ -314,12 +290,12 @@ void NRFCordioHCIDriver::do_initialize()
// WARNING // WARNING
// If a submodule does not have enough space to allocate its memory from buffer, it will still allocate its memory (and do a buffer overflow) and return 0 (as in 0 byte used) // If a submodule does not have enough space to allocate its memory from buffer, it will still allocate its memory (and do a buffer overflow) and return 0 (as in 0 byte used)
// however that method will still continue which will lead to undefined behaviour // however that method will still continue which will lead to undefined behaviour
// So whenever a change of configuration is done, it's a good idea to set CORDIO_LL_MEMORY_FOOTPRINT to a high value and then reduce accordingly // So whenever a change of configuration is done, it's a good idea to set MBED_CONF_CORDIO_NORDIC_LL_HCI_DRIVER_BUFFER_SIZE to a high value and then reduce accordingly
uint32_t mem_used = LlInitControllerInit(&ll_init_cfg); uint32_t mem_used = LlInitControllerInit(&ll_init_cfg);
if( mem_used < CORDIO_LL_MEMORY_FOOTPRINT ) if( mem_used < MBED_CONF_CORDIO_NORDIC_LL_HCI_DRIVER_BUFFER_SIZE )
{ {
// Sub-optimal, give warning // Sub-optimal, give warning
DBG_WARN("NRFCordioHCIDriver: CORDIO_LL_MEMORY_FOOTPRINT can be reduced to %lu instead of %lu", mem_used, CORDIO_LL_MEMORY_FOOTPRINT); DBG_WARN("NRFCordioHCIDriver: MBED_CONF_CORDIO_NORDIC_LL_HCI_DRIVER_BUFFER_SIZE can be reduced to %lu instead of %lu", mem_used, MBED_CONF_CORDIO_NORDIC_LL_HCI_DRIVER_BUFFER_SIZE);
} }
// BD Addr // BD Addr

View File

@ -5,6 +5,19 @@
"help": "messages sent between Host and Controller are passed directly without copying if enabled. WSF messages ownership is trasfered to the callee.", "help": "messages sent between Host and Controller are passed directly without copying if enabled. WSF messages ownership is trasfered to the callee.",
"value": 1, "value": 1,
"macro_name": "CORDIO_ZERO_COPY_HCI" "macro_name": "CORDIO_ZERO_COPY_HCI"
},
"hci-driver-buffer-size": {
"help": "Defines the memory to be allocated by the NRFCordiHciDriver.",
"value": 12500
},
"wsf-pool-buffer-size": {
"help": "Defines the memory allocated for the wsf memory pool.",
"value": 4900
}
},
"target_overrides": {
"MCU_NRF52840": {
"hci-driver-buffer-size": 16056
} }
}, },
"macros": [ "macros": [