From 86546440d7e49d5abe4e250815cfcef30bd5f5c9 Mon Sep 17 00:00:00 2001 From: paul-szczepanek-arm <33840200+paul-szczepanek-arm@users.noreply.github.com> Date: Fri, 22 Feb 2019 11:28:28 +0000 Subject: [PATCH] put cordio cfg in mbed_lib.json --- .../targets/TARGET_CORDIO/mbed_lib.json | 60 +++++++++++++++++++ .../ble-host/sources/stack/cfg/cfg_stack.c | 6 +- .../ble-host/sources/stack/cfg/cfg_stack.h | 18 +++--- 3 files changed, 74 insertions(+), 10 deletions(-) create mode 100644 features/FEATURE_BLE/targets/TARGET_CORDIO/mbed_lib.json diff --git a/features/FEATURE_BLE/targets/TARGET_CORDIO/mbed_lib.json b/features/FEATURE_BLE/targets/TARGET_CORDIO/mbed_lib.json new file mode 100644 index 0000000000..f5205abebf --- /dev/null +++ b/features/FEATURE_BLE/targets/TARGET_CORDIO/mbed_lib.json @@ -0,0 +1,60 @@ +{ + "name": "cordio", + "config": { + "cordio-cfg-max-connections": { + "help": "Maximum number of connections", + "value": 3, + "macro_name": "CORDIO_CFG_MAX_CONNECTIONS" + }, + "cordio-cfg-max-syncs": { + "help": "Maximum number of periodic advertising synchronizations", + "value": 1, + "macro_name": "CORDIO_CFG_MAX_SYNCS" + }, + "cordio-cfg-max-advertising-sets": { + "help": "Number of supported advertising sets: must be set to 1 for legacy advertising", + "value": 3, + "macro_name": "CORDIO_CFG_MAX_ADVERTISING_SETS" + }, + "cordio-cfg-max-phys": { + "help": "Number of scanner and initiator PHYs (LE 1M, LE 2M and LE Coded): must be set to 1 for legacy scanner and initiator", + "value": 3, + "macro_name": "CORDIO_CFG_MAX_PHYS" + }, + "cordio-cfg-max-l2cap-channels": { + "help": "Maximum number of connection oriented channels", + "value": 8, + "macro_name": "CORDIO_CFG_MAX_L2CAP_CHANNELS" + }, + "cordio-cfg-max-l2cap-clients": { + "help": "Maximum number of connection oriented channel registered clients", + "value": 4, + "macro_name": "CORDIO_CFG_MAX_L2CAP_CLIENTS" + }, + "cordio-cfg-max-att-writes": { + "help": "Maximum number of simultaneous ATT write commands", + "value": 1, + "macro_name": "CORDIO_CFG_MAX_ATT_WRITES" + }, + "cordio-cfg-max-att-notifications": { + "help": "Maximum number of simultaneous ATT notifications", + "value": 1, + "macro_name": "CORDIO_CFG_MAX_ATT_NOTIFICATIONS" + }, + "cordio-cfg-max-smp-devices": { + "help": "Max number of devices in the security database", + "value": 3, + "macro_name": "CORDIO_CFG_MAX_SMP_DEVICES" + }, + "cordio-cfg-desired-att-mtu": { + "help": "Desired ATT_MTU, this needs to be between 23 and 517 (inclusive).", + "value": 23, + "macro_name": "CORDIO_CFG_DESIRED_ATT_MTU" + }, + "cordio-cfg-max-prepared-writes": { + "help": "Number of queued prepare writes supported by server.", + "value": 23, + "macro_name": "CORDIO_CFG_MAX_PREPARED_WRITES" + } + } +} \ No newline at end of file diff --git a/features/FEATURE_BLE/targets/TARGET_CORDIO/stack/cordio_stack/ble-host/sources/stack/cfg/cfg_stack.c b/features/FEATURE_BLE/targets/TARGET_CORDIO/stack/cordio_stack/ble-host/sources/stack/cfg/cfg_stack.c index 78a756b753..dcd285228f 100644 --- a/features/FEATURE_BLE/targets/TARGET_CORDIO/stack/cordio_stack/ble-host/sources/stack/cfg/cfg_stack.c +++ b/features/FEATURE_BLE/targets/TARGET_CORDIO/stack/cordio_stack/ble-host/sources/stack/cfg/cfg_stack.c @@ -62,11 +62,15 @@ l2cCfg_t *pL2cCfg = &l2cCfg; ATT **************************************************************************************************/ +#if CORDIO_CFG_DESIRED_ATT_MTU < ATT_DEFAULT_MTU || CORDIO_CFG_DESIRED_ATT_MTU > ATT_MAX_MTU +#error "CORDIO_CFG_DESIRED_ATT_MTU value is outside valid range" +#endif + /* Configuration structure */ attCfg_t attCfg = { 15, /* ATT server service discovery connection idle timeout in seconds */ - ATT_DEFAULT_MTU, /* desired ATT MTU */ + CORDIO_CFG_DESIRED_ATT_MTU, /* desired ATT MTU */ ATT_MAX_TRANS_TIMEOUT, /* transcation timeout in seconds */ 4 /* number of queued prepare writes supported by server */ }; diff --git a/features/FEATURE_BLE/targets/TARGET_CORDIO/stack/cordio_stack/ble-host/sources/stack/cfg/cfg_stack.h b/features/FEATURE_BLE/targets/TARGET_CORDIO/stack/cordio_stack/ble-host/sources/stack/cfg/cfg_stack.h index b06685ad46..22ff899b56 100644 --- a/features/FEATURE_BLE/targets/TARGET_CORDIO/stack/cordio_stack/ble-host/sources/stack/cfg/cfg_stack.h +++ b/features/FEATURE_BLE/targets/TARGET_CORDIO/stack/cordio_stack/ble-host/sources/stack/cfg/cfg_stack.h @@ -76,23 +76,23 @@ extern "C" { /**@{*/ /*! \brief Maximum number of connections */ #ifndef DM_CONN_MAX -#define DM_CONN_MAX 3 +#define DM_CONN_MAX CORDIO_CFG_MAX_CONNECTIONS #endif /*! \brief Maximum number of periodic advertising synchronizations */ #ifndef DM_SYNC_MAX -#define DM_SYNC_MAX 1 +#define DM_SYNC_MAX CORDIO_CFG_MAX_SYNCS #endif /*! \brief Number of supported advertising sets: must be set to 1 for legacy advertising */ #ifndef DM_NUM_ADV_SETS -#define DM_NUM_ADV_SETS 3 +#define DM_NUM_ADV_SETS CORDIO_CFG_MAX_ADVERTISING_SETS #endif /*! \brief Number of scanner and initiator PHYs (LE 1M, LE 2M and LE Coded): must be set to 1 for legacy scanner and initiator */ #ifndef DM_NUM_PHYS -#define DM_NUM_PHYS 3 +#define DM_NUM_PHYS CORDIO_CFG_MAX_PHYS #endif /**@}*/ @@ -106,12 +106,12 @@ extern "C" { /**@{*/ /*! \brief Maximum number of connection oriented channels */ #ifndef L2C_COC_CHAN_MAX -#define L2C_COC_CHAN_MAX 8 +#define L2C_COC_CHAN_MAX CORDIO_CFG_MAX_L2CAP_CHANNELS #endif /*! \brief Maximum number of connection oriented channel registered clients */ #ifndef L2C_COC_REG_MAX -#define L2C_COC_REG_MAX 4 +#define L2C_COC_REG_MAX CORDIO_CFG_MAX_L2CAP_CLIENTS #endif /**@}*/ @@ -125,12 +125,12 @@ extern "C" { /**@{*/ /*! \brief Maximum number of simultaneous ATT write commands */ #ifndef ATT_NUM_SIMUL_WRITE_CMD -#define ATT_NUM_SIMUL_WRITE_CMD 1 +#define ATT_NUM_SIMUL_WRITE_CMD CORDIO_CFG_MAX_ATT_WRITES #endif /*! \brief Maximum number of simultaneous ATT notifications */ #ifndef ATT_NUM_SIMUL_NTF -#define ATT_NUM_SIMUL_NTF 1 +#define ATT_NUM_SIMUL_NTF CORDIO_CFG_MAX_ATT_NOTIFICATIONS #endif /**@}*/ @@ -144,7 +144,7 @@ extern "C" { /**@{*/ /*! Max number of devices in the database */ #ifndef SMP_DB_MAX_DEVICES -#define SMP_DB_MAX_DEVICES 3 +#define SMP_DB_MAX_DEVICES CORDIO_CFG_MAX_SMP_DEVICES #endif /**@}*/