-
Notifications
You must be signed in to change notification settings - Fork 3k
Add support for Cordio to NRF52 Devices #8876
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
Merged
0xc0170
merged 27 commits into
ARMmbed:master
from
donatieng:public_pr_cordio_nordic_ll
Nov 28, 2018
Merged
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
065bad6
fix(pan-cordio): Move stack BLE stack setup to later in initialisation
f60c2c9
fix(pan-cordio): Increase the maximum number of supported WSF handlers
5782e93
fix(pan-cordio): Wrap call to wsfOsReadyToSleep in a critical section
299ae1d
fix(pan-cordio): Override WSF handler size in a platform specific manner
e5aa843
refactor(pan-cordio): Use Timer class instead of raw ticker for timing
ca2efcd
fix(pan-cordio): Reset timer after updating to reduce chance of overflow
815d0d5
feat(pan-cordio): Add cordio-ll libraries and NORDIC implementation
9326769
fix(pan-nordic): Fix memory allocation sizes to resolve NRF52832 issues
f583596
refactor(pan-cordio): Replace the uECC source with a precompiled library
c3e6113
fix(pan-cordio): Fix incorrectly adding macros to NRF52_DK target
0f4ded1
feat(pan-cordio): Replace NRF51 softdevice BLE stack with cordio
01620b9
Use uECC C99 implementation
1e1486e
fix(pan-cordio): Replace the compiled uECC library with the sources
93bf68d
fix(pan-cordio): Remove erroneous files added after rebasing
c68c150
Fix buffer size for NRF Cordio HCI driver
12fdab3
feat(pan-cordio): Add nordic softdevice sources back into repository
4f7dcf4
refactor(pan-cordio): Make nordic softdevice the default link layer
1b3efa4
doc(pan-cordio): Add documentation to README on how to enable Cordio LL
3ce1d91
Amend Nordic HCI driver to support BLE5 features
f980814
Add number of advertising sets
89aabae
Fix some rebasing quirks
5a87cfa
Fix a few more rebasing issues
a3bae1c
doc(pan-cordio): Add readme and license documents for cordio link layer
353e991
doc(pan-cordio): Add toolchain version used to compile cordio-ll readme
837ba72
NRF51: Add label to compile BLE softdevice implementation.
pan- 93d8c71
NORDIC: Fix labels in target.
pan- c998248
BLE: Reintroduce changes to address types lost.
pan- File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -17,6 +17,7 @@ | |||||
#include "mbed.h" | ||||||
#include "us_ticker_api.h" | ||||||
#include "BLE.h" | ||||||
#include "CriticalSectionLock.h" | ||||||
#include "wsf_types.h" | ||||||
#include "wsf_msg.h" | ||||||
#include "wsf_os.h" | ||||||
|
@@ -95,10 +96,11 @@ namespace cordio { | |||||
BLE::BLE(CordioHCIDriver& hci_driver) : | ||||||
initialization_status(NOT_INITIALIZED), | ||||||
instanceID(::BLE::DEFAULT_INSTANCE), | ||||||
_event_queue() | ||||||
_event_queue(), | ||||||
_last_update_us(0) | ||||||
{ | ||||||
_hci_driver = &hci_driver; | ||||||
stack_setup(); | ||||||
|
||||||
} | ||||||
|
||||||
BLE::~BLE() { } | ||||||
|
@@ -120,6 +122,8 @@ ble_error_t BLE::init( | |||||
{ | ||||||
switch (initialization_status) { | ||||||
case NOT_INITIALIZED: | ||||||
_timer.reset(); | ||||||
_timer.start(); | ||||||
_event_queue.initialize(this, instanceID); | ||||||
_init_callback = initCallback; | ||||||
start_stack_reset(); | ||||||
|
@@ -389,6 +393,7 @@ void BLE::stack_setup() | |||||
void BLE::start_stack_reset() | ||||||
{ | ||||||
_hci_driver->initialize(); | ||||||
stack_setup(); | ||||||
DmDevReset(); | ||||||
} | ||||||
|
||||||
|
@@ -397,20 +402,22 @@ void BLE::callDispatcher() | |||||
// process the external event queue | ||||||
_event_queue.process(); | ||||||
|
||||||
// follow by stack events | ||||||
static uint32_t lastTimeUs = us_ticker_read(); | ||||||
uint32_t currTimeUs, deltaTimeMs; | ||||||
_last_update_us += (uint64_t)_timer.read_high_resolution_us(); | ||||||
_timer.reset(); | ||||||
|
||||||
// Update the current cordio time | ||||||
currTimeUs = us_ticker_read(); | ||||||
deltaTimeMs = (currTimeUs - lastTimeUs) / 1000; | ||||||
if (deltaTimeMs > 0) { | ||||||
WsfTimerUpdate(deltaTimeMs / WSF_MS_PER_TICK); | ||||||
lastTimeUs += deltaTimeMs * 1000; | ||||||
uint64_t last_update_ms = (_last_update_us / 1000); | ||||||
wsfTimerTicks_t wsf_ticks = (last_update_ms / WSF_MS_PER_TICK); | ||||||
|
||||||
if (wsf_ticks > 0) { | ||||||
WsfTimerUpdate(wsf_ticks); | ||||||
|
||||||
_last_update_us -= (last_update_ms * 1000); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
otherwise you're losing milliseconds that aren't passed in as ticks |
||||||
} | ||||||
|
||||||
wsfOsDispatcher(); | ||||||
|
||||||
CriticalSectionLock critical_section; | ||||||
|
||||||
if (wsfOsReadyToSleep()) { | ||||||
static Timeout nextTimeout; | ||||||
// setup an mbed timer for the next Cordio timeout | ||||||
|
49 changes: 49 additions & 0 deletions
49
features/FEATURE_BLE/targets/TARGET_CORDIO_LL/cordio_stack/LICENSE
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
Permissive Binary License | ||
|
||
Version 1.0, September 2015 | ||
|
||
Redistribution. Redistribution and use in binary form, without | ||
modification, are permitted provided that the following conditions are | ||
met: | ||
|
||
1) Redistributions must reproduce the above copyright notice and the | ||
following disclaimer in the documentation and/or other materials | ||
provided with the distribution. | ||
|
||
2) Unless to the extent explicitly permitted by law, no reverse | ||
engineering, decompilation, or disassembly of this software is | ||
permitted. | ||
|
||
3) Redistribution as part of a software development kit must include the | ||
accompanying file named “DEPENDENCIES” and any dependencies listed in | ||
that file. | ||
|
||
4) Neither the name of the copyright holder nor the names of its | ||
contributors may be used to endorse or promote products derived from | ||
this software without specific prior written permission. | ||
|
||
Limited patent license. The copyright holders (and contributors) grant a | ||
worldwide, non-exclusive, no-charge, royalty-free patent license to | ||
make, have made, use, offer to sell, sell, import, and otherwise | ||
transfer this software, where such license applies only to those patent | ||
claims licensable by the copyright holders (and contributors) that are | ||
necessarily infringed by this software. This patent license shall not | ||
apply to any combinations that include this software. No hardware is | ||
licensed hereunder. | ||
|
||
If you institute patent litigation against any entity (including a | ||
cross-claim or counterclaim in a lawsuit) alleging that the software | ||
itself infringes your patent(s), then your rights granted under this | ||
license shall terminate as of the date such litigation is filed. | ||
|
||
DISCLAIMER. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND | ||
CONTRIBUTORS "AS IS." ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT | ||
NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | ||
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED | ||
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | ||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | ||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
25 changes: 25 additions & 0 deletions
25
features/FEATURE_BLE/targets/TARGET_CORDIO_LL/cordio_stack/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# BLE API Cordio Link Layer Implementation | ||
|
||
The BLE API Cordio link layer implementation allows Cordio licensee to easily | ||
deliver a complete and up to date implementation of mbed BLE to their customers | ||
using mbed OS. | ||
|
||
The library a consists of the controller HCI, Bluetooth 5 compliant link layer | ||
protocol core, scheduler, baseband porting layer and a portable software | ||
foundation. | ||
|
||
To deliver a BLE port, vendors simply have to provide an HCI driver tailored | ||
for the BLE module present on the board they want to support. | ||
|
||
## Source Organization | ||
|
||
The root contains the binary distribution `libcordio_stack.a` of the library and | ||
the folders contain the public headers to interface with it. | ||
|
||
* `controller`: HCI Controller headers | ||
* `platform`: Platform headers | ||
|
||
|
||
## Library information | ||
|
||
Compiled with: GNU Arm Embedded Toolchain 6-2017-q2-update |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason for that change ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The commit adding the initial change says "Fix advertising_t in GapEvents.h having a reference to an inexisting address_t instance". I'm not sure which usage of it caused the issue though.