arch/nrf52/nrf52_sdc: fix memory configuration for MULTIROLE

This commit is contained in:
raiden00pl 2023-03-05 14:18:02 +01:00 committed by Petro Karashchenko
parent 238b606057
commit 242606a7d9

View File

@ -118,8 +118,10 @@
# error The minimum allowed number of scan buffers is 2. # error The minimum allowed number of scan buffers is 2.
# endif # endif
# define SCAN_MEM_SIZE (SDC_MEM_SCAN_BUFFER(CONFIG_NRF52_SDC_SCAN_BUFFER_COUNT)) # define SCAN_MEM_SIZE (SDC_MEM_SCAN_BUFFER(CONFIG_NRF52_SDC_SCAN_BUFFER_COUNT))
# define SCAN_MEM_COUNT (CONFIG_NRF52_SDC_SCAN_BUFFER_COUNT)
#else #else
# define SCAN_MEM_SIZE (0) # define SCAN_MEM_SIZE (0)
# define SCAN_MEM_COUNT (0)
#endif #endif
/* Broadcaster configuration */ /* Broadcaster configuration */
@ -132,6 +134,7 @@
# define ADV_MEM_SIZE (ADV_SET_COUNT * SDC_MEM_PER_ADV_SET(ADV_BUF_SIZE)) # define ADV_MEM_SIZE (ADV_SET_COUNT * SDC_MEM_PER_ADV_SET(ADV_BUF_SIZE))
#else #else
# define ADV_SET_COUNT (0) # define ADV_SET_COUNT (0)
# define ADV_BUF_SIZE (0)
# define ADV_MEM_SIZE (0) # define ADV_MEM_SIZE (0)
#endif #endif
@ -697,10 +700,10 @@ static int nrf52_configure_memory(void)
* sdc_support_*() calls. * sdc_support_*() calls.
*/ */
#ifdef CONFIG_NRF52_SDC_SCANNING #ifndef CONFIG_NRF52_SDC_PERIPHERAL
/* Configure scanner memory */ /* Configure scanner memory */
cfg.scan_buffer_cfg.count = CONFIG_NRF52_SDC_SCAN_BUFFER_COUNT; cfg.scan_buffer_cfg.count = SCAN_MEM_COUNT;
ret = sdc_cfg_set(SDC_DEFAULT_RESOURCE_CFG_TAG, ret = sdc_cfg_set(SDC_DEFAULT_RESOURCE_CFG_TAG,
SDC_CFG_TYPE_SCAN_BUFFER_CFG, &cfg); SDC_CFG_TYPE_SCAN_BUFFER_CFG, &cfg);
if (ret < 0) if (ret < 0)
@ -710,7 +713,7 @@ static int nrf52_configure_memory(void)
} }
#endif #endif
#ifdef CONFIG_NRF52_SDC_ADVERTISING #ifndef CONFIG_NRF52_SDC_CENTRAL
/* Configure advertisers memory */ /* Configure advertisers memory */
cfg.adv_count.count = ADV_SET_COUNT; cfg.adv_count.count = ADV_SET_COUNT;
@ -732,7 +735,7 @@ static int nrf52_configure_memory(void)
} }
#endif #endif
#if SDC_CENTRAL_COUNT > 0 #ifndef CONFIG_NRF52_SDC_PERIPHERAL
/* Configure central connections memory */ /* Configure central connections memory */
cfg.central_count.count = SDC_CENTRAL_COUNT; cfg.central_count.count = SDC_CENTRAL_COUNT;
@ -745,7 +748,7 @@ static int nrf52_configure_memory(void)
} }
#endif #endif
#if CONFIG_NRF52_SDC_PERIPHERAL_COUNT > 0 #ifndef CONFIG_NRF52_SDC_CENTRAL
/* Configure peripheral connections memory */ /* Configure peripheral connections memory */
cfg.peripheral_count.count = CONFIG_NRF52_SDC_PERIPHERAL_COUNT; cfg.peripheral_count.count = CONFIG_NRF52_SDC_PERIPHERAL_COUNT;