Commit graph

42249 commits

Author SHA1 Message Date
Andrei Emeltchenko
1636eca4cb Bluetooth: shell: Add NBLE shell test to sanitycheck
Test can be verified with

$ sanitycheck -s bluetooth/shell/test_nble -v
arduino_101  bluetooth/shell/test_nble  PASSED

Change-Id: Icfc5892524041d169973bd6eb7d23b6ecffb98fc
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:27 -05:00
Andrei Emeltchenko
d5d9e081c6 Bluetooth: shell: Add Nordic BLE configuration
Allow to build shell for NBLE.

Change-Id: Icbd019ee1947f2dcf3bc358685024f22c6a5de34
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:27 -05:00
Andrei Emeltchenko
355146d2aa Bluetooth: shell: Fix usage of BREDR functions
Fix compiler errors when CONFIG_BLUETOOTH_BREDR is not enabled.

Change-Id: I003985a9769120b3314eaf1b9563a3bf9712e32a
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:27 -05:00
Andrei Emeltchenko
e4777eca2c Bluetooth: shell: Make buf_data local
Move buf_data to the place it is used reducing errors when dynamic
channels are disabled.

Change-Id: I82f640ffa8046e1c9b5805658e69cb722856d445
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:27 -05:00
Andrei Emeltchenko
06d9e61dd6 Bluetooth: shell: Fix dynamic channel usage
Fix wrong dynamic channel usage in shell

Change-Id: Ieb6505b4c5ce1d380af4ac0b5ef788b16a2eeb4d
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:27 -05:00
Luiz Augusto von Dentz
59a4e2eaea Bluetooth: tester: Add support for testing with nble driver
Change-Id: I4c996d30da30d8f3b88d7ba9efe974872f902e0a
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:25:27 -05:00
Luiz Augusto von Dentz
dab10c414b drivers/nble: Add UUID support
This reuses the existing code since that is not driver specific, with
this samples such as tester can be build using nble driver.

Change-Id: I6d9f3edf8deb2e84fce233ef02d1cd0ad6f52526
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:25:27 -05:00
Luiz Augusto von Dentz
7834061d12 Bluetooth: ATT: Check mask instead of specific permission
This enables simpler permissions as it is not longer needed to include
BT_GATT_PERM_READ or BT_GATT_PERM_WRITE.

Change-Id: I0c749b75bedb125bda8ea451474c82eec13d3c38
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:25:27 -05:00
Andrei Emeltchenko
eea10dd425 Bluetooth: test: Use correct target for Arduino
Current quark_se target is not specified in
scripts/sanity_chk/arches/x86.ini list and apparently this is the
reason tests were not executed, change it to arduino_101.

Change-Id: Ifedcf08cc9b25839d389bd7eb92ed42012e9075a
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:27 -05:00
Andrei Emeltchenko
6c988ba401 Bluetooth: beacon: Correct arduino target
Putting right target allows to build for arduino_101.

Change-Id: Ib11244c7f024c72f0ab0b15549be57c576bdef3c
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:27 -05:00
Andrei Emeltchenko
a166d5fd6d Bluetooth: nble: Include right platform
Currently it is not possible to build for Arduino since wrong platform
was specified.

Change-Id: I85ff6f5adb003db9a0905d6afa04bb5dfbd55d53
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:27 -05:00
Luiz Augusto von Dentz
16f398ddf7 Bluetooth: UUID: Fix conversion to 128 bit format
The current format used is a swap of RFC 4122 thus the 16 bit values do
come at the end not at the beggining and data need to be swapped.

Change-Id: I38a27cdf82a28d28e47675f719772278d85deaaa
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:25:27 -05:00
Luiz Augusto von Dentz
9e74b5171f Bluetooth: beacon: Add support for testing with nble driver
In addition to having a different CONF_FILE bt_enable needs to be given
a callback since nble driver cannot block while initializing.

Change-Id: I8bd2c79d0620e93dbecfef25c49c5529ff1ee954
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:25:27 -05:00
Andrei Emeltchenko
f4c5c9808a Bluetooth: nble: Fix missing format specifier
Change-Id: I6adbd6e19462b15644d32714ae7d454fac0ece32
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:27 -05:00
Andrei Emeltchenko
5da3fbdaf4 Bluetooth: att: Use correct format specification for size
Change-Id: Ida06f2d34bfd41256a98c79200717329497667ac
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:27 -05:00
Andrei Emeltchenko
bab5744358 Bluetooth: nble: Allow to build UART driver for nanokernel
Change-Id: I9901942521c376a22a6990835bce8ed7752a4b1a
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:27 -05:00
Arkadiusz Lichwa
2dc833880e Bluetooth: BR/EDR: Rename encr_mode to encr_enabled
Adjusts encryption state name in connection complete event.

Change-Id: Ib7e6b2c5738ca9f5832e0e277d8f5718050f4bef
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-02-05 20:25:27 -05:00
Szymon Janc
e6f0356df7 Bluetooth: SMP: Fix legacy passkey entry for central role
In legacy passkey entry method confirm value is sent first.

Change-Id: Ic379650dab64715be6d281fa8d3389f5ff34a978
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:25:27 -05:00
Szymon Janc
04f6d80ff3 Bluetooth: SMP: Fix not initializing context correctly
Use uint8_t for pointer arithmetic when clearing SMP context so that
correct memory is cleared.

Change-Id: I8b88bc4c2eb181397bce5fb80a6ab250086cb17d
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:25:26 -05:00
Andrei Emeltchenko
44e311ed19 Bluetooth: nble: Limit number tries when reading from UART
There are situations when nble_read() might stuck reading from UART when
there is no data. Limit number of tries to 10.

Change-Id: I23380b622439ce9fa72b05f4eb527f03c749fce8
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:26 -05:00
Andrei Emeltchenko
e8ffda4a73 Bluetooth: nble: Implement ble_log
Implement using printf(), to make correct stack use define check.

Change-Id: I81894ccb511f921a5fcff37d85790191251d683f
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:26 -05:00
Andrei Emeltchenko
f8f24d7661 Bluetooth: nble: Clean up code making it consistent
Change-Id: Icfd4f245a2674d865cb670d6c4549cd39d31ca6b
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:26 -05:00
Andrei Emeltchenko
9c3de9ebca Bluetooth: nble: Use weak functions printing debug info
Since the headers defining RPC with Nordic chip changes frequently
define weak functions printing BT_WARN("Not implemented") if
function is not defined.
Weak function symbol is marked with "W" as viewed by nm.

Change-Id: Ia39b64c6e89fdddc65683711fd192a235fe754d4
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:26 -05:00
Johan Hedberg
53dd3ba2e0 drivers/nble: Implement bt_le_adv_start()
Change-Id: I169a2bc2f0e48473fbb50bdf8e651623e446c231
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:26 -05:00
Johan Hedberg
278d320f71 drivers/nble: Increase TX & RX buffer count to 2
This lowers the chance of running out of buffers when sending or
receiving a lot of data.

Change-Id: Ifedc5652f993fa54f7aded87aef545ffb49e7581
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:26 -05:00
Johan Hedberg
733f837aae drivers/nble: Fix passing correct length to poll_out()
The RPC code is not net_buf aware so it will not update the net_buf
length when encoding data into it. We have to therefore do it
ourselves.

Change-Id: I7d7d3c09007a2a9bce822625607dbf7470a7ea0b
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:26 -05:00
Johan Hedberg
3e9bfe5119 Bluetooth: Add missing nanokernel.h dependency to log.h
Change-Id: Ifcdc2d44dc9223833dc628613fada3d2cf7daa8f
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:26 -05:00
Andrei Emeltchenko
8dbd03a5f5 Bluetooth: nble: Make GATT coding style consistent
Make code readable removing extra spaces.

Change-Id: I61e3486e1d301ff7d36fd2e34243ff6e9111e54d
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:26 -05:00
Andrei Emeltchenko
64b1989f56 Bluetooth: nble: Make GAP coding style consistent
Remove extra spaces and make code readable

Change-Id: I3e57a5440476eb0143d19ce9865d3a76c58b90d1
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:26 -05:00
Andrei Emeltchenko
ac59405268 Bluetooth: nble: Include all functions to build
Include all functions using previously defined stubs.

Change-Id: If9ab3f02d2e3e1f27c09b0d666fcf531cf76898d
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:26 -05:00
Andrei Emeltchenko
d5100a0672 Bluetooth: nble: Enable GAP functions
Use debug stubs for now

Change-Id: I8e25ba8bb0fc4eec4d789c51e1599a17fa78cf5c
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:26 -05:00
Andrei Emeltchenko
228d0cb292 Bluetooth: nble: Enable GATT functions
Use debug stubs for now

Change-Id: Ia6f73ce3d289f3759a93eee42439fe7001770eab
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:26 -05:00
Andrei Emeltchenko
acc88b8a71 Bluetooth: nble: Refactor header include logic
Change-Id: I4f4475360c317ba69584b34b33a1dd0f27edb022
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:26 -05:00
Andrei Emeltchenko
702b151e47 Bluetooth: nble: Move receive logic to fiber
Move receiving logic to fiber rx_fiber(). rx_queue is registered with
uart driver and all data is sent there for processing. Clean up old
ipc_channel interface since there will be only one interface to uart
driver.

Change-Id: I292863b1f38e5adb8ca4e6ac63aed09c83de56bf
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:26 -05:00
Andrei Emeltchenko
96aaaadca8 Bluetooth: nble: Adding NBLE ready callback
Refactored Johan Hedberg's code adding callback to be called when NBLE
is up.

Change-Id: I2a8a2238942c0adae2a5c47cfe94d8f2b1112810
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:26 -05:00
Andrei Emeltchenko
500b59809f Bluetooth: nble: Drive BTWAKE high
Refactored Johan Hedberg's code adding writing to NBLE_BTWAKE_PIN one
to drive it high, needed to wake up NBLE chip.

Change-Id: I63b9583281db897f2326e4570716c25ce181128f
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:26 -05:00
Andrei Emeltchenko
cc190488ee Bluetooth: nble: Add basic RPC transmit code
Refactored Johan Hedberg's code adding initial transmit logic.

Change-Id: I44b0166c281d526fbd12b895b5777486c7392260
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:26 -05:00
Andrei Emeltchenko
14613089e5 Bluetooth: nble: Add RPC deserialization functions
Port RPC deserialization to Zephyr upstream.

Change-Id: Icc9e055565185e907f51832443386f929a752586
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:26 -05:00
Andrei Emeltchenko
79f47c65ba Bluetooth: nble: Add RPC Serialization IPC
Port RPC Serialization to Zephyr upstream

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Change-Id: I315d52dc6576254a6928520d1353856d41a25c69
2016-02-05 20:25:26 -05:00
Andrei Emeltchenko
124795afed Bluetooth: nble: Implement bt_enable
Resets Nordic BLE chip and opens communication channel to UART.

Change-Id: Ie516869a4d978fc1622361ebc42894430fdf9ea6
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:26 -05:00
Anas Nashif
abb6e223cf NBLE: Nordic BLE is not a feature of quark se
Move BLE configuration to board and enable GPIO for NBLE.

Change-Id: I99c309656430936edf6766fc99fe83b011801bb4
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:25:26 -05:00
Johan Hedberg
4218572c13 Bluetooth: samples/peripheral: Set right board for nble testcase
Change-Id: Ie0b1dceeb94a760dc9990a5c573616522169ea76
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:25:26 -05:00
Andrei Emeltchenko
baeb34a950 Bluetooth: nble: Add UART driver for Nordic BLE chip
Adds basic support for communication with Nordic BLE (NBLE) chip
connected to UART.

Change-Id: I3651e291ec18805a63ecd3d240dce62273e3c498
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:26 -05:00
Andrei Emeltchenko
d325faa670 arduino_101: Set UART0 default options and baud rate
Set options and baud rate to communicate with NBLE chip.

Change-Id: I338aad3b1dc03b809aade29eedac7093ea346a5e
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:25:26 -05:00
Jukka Rissanen
f5a58453d4 net: contiki: Fix the RA ICMPv6 sending
The ICMPv6 RA payload was ignored and not sent. This was seen
as malformed packet by receiver. We must update the length of
the message by calling net_buf_add().

Change-Id: I3dc64cfce669de54283db290cfb009b2c6ea7225
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:25:26 -05:00
Jukka Rissanen
a38fc2fc11 net: contiki: Fix the NS ICMPv6 sending
The ICMPv6 NS payload was ignored and not sent. This was seen
as malformed packet by receiver. We must update the length of
the message by calling net_buf_add().

Change-Id: I5bf53695c811c27a75320fea7331d91782a9748a
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:25:26 -05:00
Jukka Rissanen
209119cd63 net: contiki: Fix the RS ICMPv6 sending
The ICMPv6 RS payload was ignored and not sent. This was seen
as malformed packet by receiver. We must update the length of
the message by calling net_buf_add().

Change-Id: Iddedb7b6674f30c7943c0ba59c0afc7d244a1e0d
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:25:26 -05:00
Arkadiusz Lichwa
ea3b162bac Bluetooth: BR/EDR: Add support for Link Key request
Delivers a valid Link Key to controller if found or responds negative
to Link Key request to controller.

Change-Id: I98061110a60b066421f35db44455925cbcd3076e
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-02-05 20:25:25 -05:00
Arkadiusz Lichwa
9b0d42930c Bluetooth: BR/EDR: Define HCI Link Key request
Enable HCI protocol for handling Link Key request event and
responses.

Change-Id: Ib3e24782257a87028b63198d210203b442883211
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-02-05 20:25:25 -05:00
Arkadiusz Lichwa
a68db1fc57 Bluetooth: BR/EDR: Enable encryption handlers
Get access to available link encryption related handlers.

Change-Id: Ifcf4cf3af11368ca68cd93d3023a020bb01a7b74
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-02-05 20:25:25 -05:00