Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update MPSL and BLE controller #14

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions ble_controller/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,22 @@ Changelog

All notable changes to this project are documented in this file.

Master branch
*************

Added
=====

* Added support for setting the event length of a connection. See :cpp:func:`hci_vs_cmd_event_length_set()`.
* Added Set Controller to Host Flow Control command.
* Added Host Buffer Size command.
* Added Host Number of Complete Packets command.

Changes
=======

* When LLPM mode is enabled, the connection event length is now no longer implicitly set to 1 ms.

nRF Connect SDK v1.3.0
**********************

Expand Down
105 changes: 56 additions & 49 deletions ble_controller/include/ble_controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,20 +130,22 @@ extern "C" {

/** @} end of ble_controller_mem_defines */

/** @brief Function prototype for the fault handler.
/** @brief Function prototype for the fault handler.
*
* @note The BLE Controller will disable all interrupts prior to calling the fault handler.
* The BLE Controller will reset the chip if the application returns from this function.
* @note The BLE Controller will disable all interrupts prior to calling the
* fault handler. The BLE Controller will reset the chip if the
* application returns from this function.
*
* @param[in] file The filename where the assertion occurred.
* @param[in] line The line number where the assertion occurred.
* @param[in] file The filename where the assertion occurred.
* @param[in] line The line number where the assertion occurred.
*/
typedef void (*ble_controller_fault_handler_t)(const char * file, const uint32_t line);


/** @brief Function prototype for the BLE Controller callback.
*
* @sa @ref ble_controller_enable */
* @sa @ref ble_controller_enable().
*/
typedef void (*ble_controller_callback_t)(void);


Expand Down Expand Up @@ -198,32 +200,36 @@ typedef union
} ble_controller_cfg_t;


/** @brief Initialize the BLE Controller
/** @brief Initialize the BLE Controller
*
* After this function is called, the application may use SoC APIs.
*
* @param[in] fault_handler The fault handler will be executed when there is an internal
* error in the BLE Controller.
* @param[in] fault_handler The fault handler will be executed when there is an
* internal error in the BLE Controller.
*
* @retval 0 Success
* @retval -NRF_EINVAL Invalid argument provided
* @retval -NRF_EPERM Unable to initialize because
* - MPSL is not initialized
* - MPSL needs to be configured with a LFCLK accuracy of 500 ppm or better.
* @retval 0 Success
* @retval -NRF_EINVAL Invalid argument provided
* @retval -NRF_EPERM Unable to initialize because
* - MPSL is not initialized
* - MPSL needs to be configured with a LFCLK accuracy
* of 500 ppm or better.
*/
int32_t ble_controller_init(ble_controller_fault_handler_t fault_handler);


/** @brief Change or add a BLE Controller configuration
*
* To change the default configuration, update @ref BLE_CONTROLLER_DEFAULT_RESOURCE_CFG_TAG.
* To create or update a new configuration, provide another resource_cfg_tag.
* To change the default configuration, update @ref
* BLE_CONTROLLER_DEFAULT_RESOURCE_CFG_TAG. To create or update a new
* configuration, provide another resource_cfg_tag.
*
* @note The application can set config_type to @ref BLE_CONTROLLER_CFG_TYPE_NONE to obtain
* the required memory size for the current configuration in bytes.
* @note The application can set config_type to @ref
* BLE_CONTROLLER_CFG_TYPE_NONE to obtain the required memory size for the
* current configuration in bytes.
*
* @note Resource configuration can only be performed prior to calling @ref ble_controller_enable.
* However, the current configuration may be changed after enabling the BLE Controller.
* @note Resource configuration can only be performed prior to calling @ref
* ble_controller_enable(). However, the current configuration may be
* changed after enabling the BLE Controller.
*
* @param[in] config_tag Configuration tag.
* @param[in] config_type Configuration type. @sa BLE_CONTROLLER_CFG_TYPE.
Expand All @@ -238,29 +244,29 @@ int32_t ble_controller_cfg_set(uint8_t config_tag,
ble_controller_cfg_t const * p_resource_cfg);


/** @brief Enable the BLE Controller
/** @brief Enable the BLE Controller
*
* After this function is called, the application may utilize HCI APIs.
*
* @param[in] callback The callback will be executed when HCI data or and HCI event is available.
* The callback will be executed in the same context as
* mpsl_low_priority_process.
* @sa hci_evt_get and @ref hci_data_get.
* @param[in] p_mem Provide memory for the current resource configuration.
* If custom resource configurations are used, use the value returned
* from @ref ble_controller_cfg_set.
* @param[in] callback The callback will be executed when HCI data or and HCI
* event is available. The callback will be executed in
* the same context as mpsl_low_priority_process.
* @sa @ref hci_evt_get() and @ref hci_data_get().
* @param[in] p_mem Provide memory for the current resource configuration. If
* custom resource configurations are used, use the value
* returned from @ref ble_controller_cfg_set().
*
* @retval 0 Success
* @retval -NRF_EINVAL Invalid argument provided
* @retval 0 Success
* @retval -NRF_EINVAL Invalid argument provided
*/
int32_t ble_controller_enable(ble_controller_callback_t callback,
uint8_t * p_mem);


/** @brief Disable the BLE Controller
*
* This call is synchronous. After the BLE Controller is disabled, BLE functionality is no
* longer available.
* This call is synchronous. After the BLE Controller is disabled, BLE
* functionality is no longer available.
*
* @retval 0 Success
*/
Expand All @@ -274,30 +280,31 @@ int32_t ble_controller_disable(void);
*
* @param[in,out] p_build_revision Build revision.
*
* @retval 0 Success
* @retval -NRF_EINVAL Invalid argument provided
* @retval 0 Success
* @retval -NRF_EINVAL Invalid argument provided
*/
int32_t ble_controller_build_revision_get(uint8_t * p_build_revision);


/** @brief BLE Controller RNG interrupt handler
*
* @note This function should be called when a RNG interrupt occurs.
* The interrupt priority level should be lower than priority level 0, that is,
* a higher numerical priority value.
* @note This function should be called when a RNG interrupt occurs. The
* interrupt priority level should be lower than priority level 0, that
* is, a higher numerical priority value.
*/
void ble_controller_RNG_IRQHandler(void);

/** @brief Support Data Length Extensions
*
* After this API is called, the controller will support data length extension. That is:
* - All DLE HCI APIs are supported.
* - The controller replies with LL_LENGTH_RSP when a LL_LENGTH_REQ is received.
* - DLE is marked supported in the LL Feature Exchange procedure.
* After this API is called, the controller will support data length extension.
* That is:
* - All DLE HCI APIs are supported. The controller replies with LL_LENGTH_RSP
* - when a LL_LENGTH_REQ is received. DLE is marked supported in the LL
* - Feature Exchange procedure.
*
* @retval 0 Success
* @retval -NRF_EPERM This API must be called before @ref ble_controller_enable().
* @retval -NRF_EOPNOTSUPP Data Length Extension is not supported.
* @retval 0 Success
* @retval -NRF_EPERM This API must be called before @ref ble_controller_enable().
* @retval -NRF_EOPNOTSUPP Data Length Extension is not supported.
*/
int32_t ble_controller_support_dle(void);

Expand All @@ -308,8 +315,8 @@ int32_t ble_controller_support_dle(void);
* - The controller can use 2M PHY in both the connected and non-connected state.
* - LE 2M PHY is marked supported in the LL Feature Exchange procedure.
*
* @retval 0 Success
* @retval -NRF_EPERM This API must be called before @ref ble_controller_enable().
* @retval 0 Success
* @retval -NRF_EPERM This API must be called before @ref ble_controller_enable().
*/
int32_t ble_controller_support_le_2m_phy(void);

Expand All @@ -320,9 +327,9 @@ int32_t ble_controller_support_le_2m_phy(void);
* - The controller can use LE Coded PHY in both the connected and non-connected state.
* - LE Coded PHY is marked supported in the LL Feature Exchange procedure.
*
* @retval 0 Success
* @retval -NRF_EPERM This API must be called before @ref ble_controller_enable().
* @retval -NRF_EOPNOTSUPP LE Coded PHY is not supported.
* @retval 0 Success
* @retval -NRF_EPERM This API must be called before @ref ble_controller_enable().
* @retval -NRF_EOPNOTSUPP LE Coded PHY is not supported.
*/
int32_t ble_controller_support_le_coded_phy(void);

Expand Down
34 changes: 32 additions & 2 deletions ble_controller/include/ble_controller_hci_vs.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ enum HCI_VS_OPCODE
HCI_VS_OPCODE_CMD_CONN_EVENT_EXTEND = 0xfd03,
/** @brief See @ref hci_vs_cmd_qos_conn_event_report_enable(). */
HCI_VS_OPCODE_CMD_QOS_CONN_EVENT_REPORT_ENABLE = 0xfd04,
/** @brief See @ref hci_vs_cmd_event_length_set(). */
HCI_VS_OPCODE_CMD_EVENT_LENGTH_SET = 0xfd05,
};

/** @brief VS subevent Code values. */
Expand Down Expand Up @@ -259,6 +261,13 @@ typedef __PACKED_STRUCT
uint8_t enable;
} hci_vs_cmd_qos_conn_event_report_enable_t;

/** @brief Set event length for connections command parameter(s). */
typedef __PACKED_STRUCT
{
/** @brief Allocated event length in microseconds. */
uint32_t event_length_us;
} hci_vs_cmd_event_length_set_t;

/** @} end of HCI_COMMAND_PARAMETERS */

/**
Expand Down Expand Up @@ -376,7 +385,7 @@ uint8_t hci_vs_cmd_zephyr_write_tx_power(const hci_vs_cmd_zephyr_write_tx_power_
*
* This command enables or disables Low Latency Packet Mode support.
* When Low Latency Packet Mode is enabled, it is possible to switch to connection intervals in the
* range 1-7 ms. Switch to short connection intervals by calling hci_vs_cmd_conn_update().
* range 1-7 ms. Switch to short connection intervals by calling @ref hci_vs_cmd_conn_update().
*
* After HCI Reset, this feature is disabled.
*
Expand Down Expand Up @@ -407,7 +416,7 @@ uint8_t hci_vs_cmd_conn_update(const hci_vs_cmd_conn_update_t * p_params);
/** @brief Enable or Disable Extended Connection Events.
*
* When Extended Connection Events are disabled, the maximum connection event length is set by @ref
* ble_controller_cfg_event_length_t::event_length_us.
* hci_vs_cmd_event_length_set().
* When Extended Connection Events are enabled, the controller will extend the connection event as
* much as possible, if:
* - Either of the peers has more data to send.
Expand Down Expand Up @@ -443,6 +452,27 @@ uint8_t hci_vs_cmd_conn_event_extend(const hci_vs_cmd_conn_event_extend_t * p_pa
*/
uint8_t hci_vs_cmd_qos_conn_event_report_enable(const hci_vs_cmd_qos_conn_event_report_enable_t * p_params);

/** @brief Set event length for connections.
*
* That is, if this API must be called before starting a connectable advertiser or connecting to an
* advertiser.
* The event length will not be changed for existing connections.
*
* The BLE controller will ensure that the anchor points of master link connections are spaced
* event_length_us apart.
*
* The default event length is BLE_CONTROLLER_DEFAULT_EVENT_LENGTH_US.
*
* See also @ref hci_vs_cmd_conn_event_extend().
*
* @param[in] p_params Input parameters.
*
* @retval 0 if success.
* @return Returns value between 0x01-0xFF in case of error.
* See Vol 2, Part D, Error for a list of error codes and descriptions.
*/
uint8_t hci_vs_cmd_event_length_set(const hci_vs_cmd_event_length_set_t * p_params);

/** @} end of HCI_VS_API */

/** @} */
Expand Down
8 changes: 4 additions & 4 deletions ble_controller/include/ble_controller_soc.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,10 @@ uint32_t ble_controller_rand_vector_get(uint8_t * p_dst, uint16_t length);
* The BLE Controller will use NRF_RNG to obtain the numbers.
* The function can be called from ISR context.
*
* @note This function works like @ref ble_controller_rand_vector_get, except that
* instead of failing in the event of not enough numbers being available, it
* will block until it has filled the specified length with random number
* bytes. The time until completion will vary.
* @note This function works like @ref ble_controller_rand_vector_get(), except
* that instead of failing in the event of not enough numbers being
* available, it will block until it has filled the specified length with
* random number bytes. The time until completion will vary.
*
* @param[out] p_dst Pointer to a buffer in RAM for storing the bytes.
* @param[in] length Number of random bytes to retrieve.
Expand Down
Binary file not shown.
5 changes: 5 additions & 0 deletions ble_controller/lib/cortex-m33+nodsp/soft-float/manifest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
description: nRF Bluetooth LE Controller
git_revision: 77f44922aa82225e809adca6e6c31e784002d210
ll_subversion_number: '0x20A9'
ll_version_number: '0x0B'
timestamp: '2020-06-23T13:51:34Z'
Binary file modified ble_controller/lib/cortex-m4/hard-float/libble_controller_s112.a
Binary file not shown.
Binary file modified ble_controller/lib/cortex-m4/hard-float/libble_controller_s132.a
Binary file not shown.
Binary file modified ble_controller/lib/cortex-m4/hard-float/libble_controller_s140.a
Binary file not shown.
5 changes: 5 additions & 0 deletions ble_controller/lib/cortex-m4/hard-float/manifest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
description: nRF Bluetooth LE Controller
git_revision: 77f44922aa82225e809adca6e6c31e784002d210
ll_subversion_number: '0x10A9'
ll_version_number: '0x0B'
timestamp: '2020-06-23T13:51:34Z'
Binary file modified ble_controller/lib/cortex-m4/soft-float/libble_controller_s112.a
Binary file not shown.
Binary file modified ble_controller/lib/cortex-m4/soft-float/libble_controller_s132.a
Binary file not shown.
Binary file modified ble_controller/lib/cortex-m4/soft-float/libble_controller_s140.a
Binary file not shown.
5 changes: 5 additions & 0 deletions ble_controller/lib/cortex-m4/soft-float/manifest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
description: nRF Bluetooth LE Controller
git_revision: 77f44922aa82225e809adca6e6c31e784002d210
ll_subversion_number: '0x10A9'
ll_version_number: '0x0B'
timestamp: '2020-06-23T13:51:34Z'
Binary file not shown.
Binary file not shown.
Binary file not shown.
5 changes: 5 additions & 0 deletions ble_controller/lib/cortex-m4/softfp-float/manifest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
description: nRF Bluetooth LE Controller
git_revision: 77f44922aa82225e809adca6e6c31e784002d210
ll_subversion_number: '0x10A9'
ll_version_number: '0x0B'
timestamp: '2020-06-23T13:51:34Z'
5 changes: 0 additions & 5 deletions ble_controller/manifest.yaml

This file was deleted.

Binary file modified mpsl/lib/cortex-m33+nodsp/soft-float/libmpsl.a
Binary file not shown.
3 changes: 3 additions & 0 deletions mpsl/lib/cortex-m33+nodsp/soft-float/manifest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
description: Multi-Protocol Service Layer (MPSL)
git_revision: 2de5ec33a0495fdd47621b6c378f583669003376
timestamp: '2020-06-23T13:51:44Z'
Binary file modified mpsl/lib/cortex-m4/hard-float/libmpsl.a
Binary file not shown.
3 changes: 3 additions & 0 deletions mpsl/lib/cortex-m4/hard-float/manifest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
description: Multi-Protocol Service Layer (MPSL)
git_revision: 2de5ec33a0495fdd47621b6c378f583669003376
timestamp: '2020-06-23T13:52:02Z'
Binary file modified mpsl/lib/cortex-m4/soft-float/libmpsl.a
Binary file not shown.
3 changes: 3 additions & 0 deletions mpsl/lib/cortex-m4/soft-float/manifest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
description: Multi-Protocol Service Layer (MPSL)
git_revision: 2de5ec33a0495fdd47621b6c378f583669003376
timestamp: '2020-06-23T13:52:02Z'
Binary file modified mpsl/lib/cortex-m4/softfp-float/libmpsl.a
Binary file not shown.
3 changes: 3 additions & 0 deletions mpsl/lib/cortex-m4/softfp-float/manifest.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
description: Multi-Protocol Service Layer (MPSL)
git_revision: 2de5ec33a0495fdd47621b6c378f583669003376
timestamp: '2020-06-23T13:52:02Z'
3 changes: 0 additions & 3 deletions mpsl/manifest.yaml

This file was deleted.