|
55 | 55 |
|
56 | 56 | using namespace ble;
|
57 | 57 |
|
58 |
| -/*! \brief Memory that should be reserved for the stack. */ |
59 |
| -#if defined(NRF52840_XXAA) |
60 |
| - |
61 |
| -#undef MBED_CONF_CORDIO_LL_EXTENDED_ADVERTISING_SIZE |
62 |
| -#undef MBED_CONF_CORDIO_LL_MAX_ACL_SIZE |
63 |
| -#undef MBED_CONF_CORDIO_LL_TX_BUFFERS |
64 |
| -#undef MBED_CONF_CORDIO_LL_PHY_CODED_SUPPORT |
65 |
| -#define MBED_CONF_CORDIO_LL_EXTENDED_ADVERTISING_SIZE MBED_CONF_CORDIO_LL_NRF52840_EXTENDED_ADVERTISING_SIZE |
66 |
| -#define MBED_CONF_CORDIO_LL_MAX_ACL_SIZE MBED_CONF_CORDIO_LL_NRF52840_MAX_ACL_SIZE |
67 |
| -#define MBED_CONF_CORDIO_LL_TX_BUFFERS MBED_CONF_CORDIO_LL_NRF52840_TX_BUFFERS |
68 |
| -#define MBED_CONF_CORDIO_LL_PHY_CODED_SUPPORT MBED_CONF_CORDIO_LL_NRF52840_PHY_CODED_SUPPORT |
69 |
| - |
70 |
| -#define CORDIO_LL_MEMORY_FOOTPRINT 16056UL |
71 |
| - |
72 |
| -#else |
73 |
| - |
74 |
| -#define CORDIO_LL_MEMORY_FOOTPRINT 12500UL |
75 |
| - |
76 |
| -#endif |
77 |
| - |
78 | 58 | /*! \brief Typical implementation revision number (LlRtCfg_t::implRev). */
|
79 | 59 | #define LL_IMPL_REV 0x2303
|
80 | 60 |
|
@@ -202,7 +182,7 @@ extern "C" void TIMER2_IRQHandler(void);
|
202 | 182 |
|
203 | 183 | NRFCordioHCIDriver::NRFCordioHCIDriver(CordioHCITransportDriver& transport_driver) : CordioHCIDriver(transport_driver), _is_init(false), _stack_buffer(NULL)
|
204 | 184 | {
|
205 |
| - _stack_buffer = (uint8_t*)malloc(CORDIO_LL_MEMORY_FOOTPRINT); |
| 185 | + _stack_buffer = (uint8_t*)malloc(MBED_CONF_CORDIO_NORDIC_LL_HCI_DRIVER_BUFFER_SIZE); |
206 | 186 | MBED_ASSERT(_stack_buffer != NULL);
|
207 | 187 | }
|
208 | 188 |
|
@@ -233,11 +213,7 @@ NRFCordioHCIDriver::~NRFCordioHCIDriver()
|
233 | 213 | ble::buf_pool_desc_t NRFCordioHCIDriver::get_buffer_pool_description()
|
234 | 214 | {
|
235 | 215 | static union {
|
236 |
| - #if defined(NRF52840_XXAA) |
237 |
| - uint8_t buffer[ 4900 ]; |
238 |
| - #else |
239 |
| - uint8_t buffer[ 4900 ]; |
240 |
| - #endif |
| 216 | + uint8_t buffer[MBED_CONF_CORDIO_NORDIC_LL_WSF_POOL_BUFFER_SIZE]; |
241 | 217 | uint64_t align;
|
242 | 218 | };
|
243 | 219 | static const wsfBufPoolDesc_t pool_desc[] = {
|
@@ -268,7 +244,7 @@ void NRFCordioHCIDriver::do_initialize()
|
268 | 244 | .plSizeCfg = 4,
|
269 | 245 | .pLlRtCfg = &_ll_cfg,
|
270 | 246 | .pFreeMem = _stack_buffer,
|
271 |
| - .freeMemAvail = CORDIO_LL_MEMORY_FOOTPRINT |
| 247 | + .freeMemAvail = MBED_CONF_CORDIO_NORDIC_LL_HCI_DRIVER_BUFFER_SIZE |
272 | 248 | };
|
273 | 249 |
|
274 | 250 | /* switch to more accurate 16 MHz crystal oscillator (system starts up using 16MHz RC oscillator) */
|
@@ -314,12 +290,12 @@ void NRFCordioHCIDriver::do_initialize()
|
314 | 290 | // WARNING
|
315 | 291 | // 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)
|
316 | 292 | // however that method will still continue which will lead to undefined behaviour
|
317 |
| - // 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 |
| 293 | + // 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 |
318 | 294 | uint32_t mem_used = LlInitControllerInit(&ll_init_cfg);
|
319 |
| - if( mem_used < CORDIO_LL_MEMORY_FOOTPRINT ) |
| 295 | + if( mem_used < MBED_CONF_CORDIO_NORDIC_LL_HCI_DRIVER_BUFFER_SIZE ) |
320 | 296 | {
|
321 | 297 | // Sub-optimal, give warning
|
322 |
| - DBG_WARN("NRFCordioHCIDriver: CORDIO_LL_MEMORY_FOOTPRINT can be reduced to %lu instead of %lu", mem_used, CORDIO_LL_MEMORY_FOOTPRINT); |
| 298 | + 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); |
323 | 299 | }
|
324 | 300 |
|
325 | 301 | // BD Addr
|
|
0 commit comments