Commit graph

41120 commits

Author SHA1 Message Date
Johan Hedberg
4488fc6cab Bluetooth: Move HCI device bus information to the driver
The bus that we notify over the monitor protocol is really driver
specific, so let each driver specify their bus type.

Change-Id: Ic3a086fcc06352dbf051e52cef5bf6b8696349ae
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-04-22 18:49:11 +03:00
Johan Hedberg
8c3add2b6a Bluetooth: tests: Add automated tests for new monitor code
Add two new test cases to exercise the code in monitor.c.

Change-Id: I66ae70e0d3b61d3b852916333019e1ed2c5c6cf4
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-04-22 18:49:11 +03:00
Johan Hedberg
264c207f4f Bluetooth: Add custom "monitor" protocol logging over UART
With most boards there's no simple way to get access to the HCI
traffic. Simultaneously these boards only have one external UART for
the console. This patch introduces a protocol which combines both
normal logs and HCI logs over a single binary protocol sent over the
console UART.

The protocol is modeled based on the btsnoop/monitor protocols used by
BlueZ, and the first tool that's able to decode this is btmon from
BlueZ ("btmon --tty <tty>").

For platforms with two or more external UARTs it is still possible to
use CONFIG_UART_CONSOLE as long as the UART devices used are
different, however on platforms with a single external UART
UART_CONSOLE should be disabled if BLUETOOTH_DEBUG_MONITOR is enabled
(in this case printk/printf get encoded to the monitor protocol).

Origin: Original
Change-Id: I9d3997c7a06fe48e7decb212b2ac9bd8b8f9b74c
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-04-22 18:49:11 +03:00
Szymon Janc
ad475d863a Bluetooth: Remove RX priority fiber
Processing command complete and status events in separate fiber is not
really needed as those handlers doesn't block nor do heavy computation.
This work can be done directly from ISR making code simpler.
Additionaly priority fiber stack is no longer needed resulting in 256
bytes memory savings.

Change-Id: I2ecb29b720d3a886e7881a2208f697a834f4cdaf
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-04-22 15:41:32 +00:00
Grzegorz Kolodziejczyk
9ac1782cd8 quark_se_devboard: Configure default UART for UART_PIPE
This UART config is needed to handle properly btp tester serial data
flow.

Change-Id: Id013a232e105247414d44148f5ccfe708b19c4a8
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-04-22 16:52:21 +02:00
Juan Manuel Cruz
401d67f91c debug: interrupt event logger sample for arc
Jira: ZEP-53
Change-Id: Idb24bb28d5f4b5f31f1cc32d9a9ec2b8c622543e
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@intel.com>
2016-04-22 12:39:22 +00:00
Juan Manuel Cruz
b17258b536 debug: interrupt event logger support for arc
Jira: ZEP-53
Change-Id: Id6ee505a7e89122a47fc22162b4c257ac2126d09
Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@intel.com>
2016-04-22 12:39:22 +00:00
Daniel Leung
267e6e639c i2c/quark_se_ss: make structs and functions const and static
() Make driver API into const, as it is not being modified
   at runtime. Saves 24 bytes of RAM by putting it into ROM.
() Make device config structs as static as they are local to
   the source file, and should not be referenced from outside at all.
() Same goes for the IRQ configuration functions, by declaring them
   static.

Change-Id: I5225dc550bdd65ec88a8930944da063efe16a3b2
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-22 12:32:26 +00:00
Szymon Janc
85d44978a5 Bluetooth: shell: Add support for advertising with RPA
This allows to test local privacy feature.

Change-Id: Ib231f9187e353f79fee9237acef0d1ffe9cb2b7d
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-04-22 11:07:19 +00:00
Szymon Janc
68c707884e Bluetooth: Fail if advertise with unsupported address type
This allows to gracefully handle case when privacy is not enabled.

Change-Id: I3f4ebafd05abe186212b554161d8a8982f58ff45
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-04-22 11:07:11 +00:00
Andrei Emeltchenko
ac7a43a177 arduino_101: Correct UART name configuration
Change NBLE_UART_ON_DEV_NAME to BLUETOOTH_UART_ON_DEV_NAME for H:4

Change-Id: I4391b32c75c738478c964d4c79f6eb80d737b043
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-04-22 11:06:42 +00:00
Andrei Emeltchenko
45736940b9 quark_se_devboard: Add configuration for nimble HCI stack
Enable Power Management handling also for quark_se_devboard with
nimble HCI stack.

Change-Id: I6e5bb85c4f2370f52904be9dff14ce8e7fb1eb44
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-04-22 11:06:37 +00:00
Anas Nashif
13ce2d6285 doc: show information about documentation current version
show different information based on the state of the current
documentation and link to development version and released
versions depending on where the user lands.

Change-Id: Ifa6263900222db483efa0388e2588dd97222ecb6
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-04-22 10:54:38 +00:00
Szymon Janc
828fe15bbe Bluetooth: Always use RPA for connection if privacy is enabled
We should always use RPA for outgoing connection if privacy is enabled.
Otherwise privacy might be compromised if connecting to devices that
don't support pairing.

Change-Id: Ib12a5d9dfdc9285b5ff721f0fdb8f824ff1a8f0f
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-04-22 07:58:03 +00:00
Szymon Janc
7ba5715ae0 Bluetooth: Remove double address comparison
set_random_address already checks if current random address needs
to be updated so there is no need to double check that before it
is called.

Change-Id: If5fe16f1b886aa877bf014a8977ccaea2c8ba6e0
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-04-22 07:57:43 +00:00
Szymon Janc
605f7a0979 Bluetooth: Simplify creation of LE connection
hci_le_create_conn sets controller random address to one from
connection so there is no need to do that again in command status
event.

Change-Id: I22a24a46946413489445e577341cbf6ea68c0964
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-04-22 07:57:02 +00:00
Szymon Janc
4e4b81f06f Bluetooth: Simplify setting advertising parameters
There is no need for special handling of command complete when
using bt_hci_cmd_send_sync for sending HCI command.

Change-Id: I60671e490958e67f5d20dc8c6ddbf51ca839c338
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-04-22 07:55:53 +00:00
Szymon Janc
e5493c9ac8 Bluetooth: Simplify setting random address
There is no need for special handling of command complete when
using bt_hci_cmd_send_sync for sending HCI command.

Change-Id: Ib67f06d47249d24854c07be34b0e39f70f5d5170
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-04-22 07:55:42 +00:00
Andrei Emeltchenko
1b737d4cf4 quark_se_devboard: Enable PM for the board
Enable Power Management and enable logic for quark_se_devboard,
without the patch BLE Radio module might be enabled with JTAG tools
or right after boot.

Note that some boards do not have the GPIO pins connected to BLE
module but this should be still OK wrt to board functionality.

Change-Id: I9019e406afa36fe2dea52c07075c947e8c50a961
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-04-21 15:31:17 +00:00
Andrei Emeltchenko
5860325b4f drivers/nble: Cleanup Nordic RPC code
Remove handling not used and obsolete function prototypes.

Change-Id: I6086f2e13efe7fc219f237dda710a545bec07612
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-04-21 15:31:09 +00:00
Andrei Emeltchenko
642d596d69 drivers/nble: Update RPC to 0422 revision
Update RPC adding gap_tx_power request and event. Corresponds to BLE
version ATLASEDGE/PVT/FACTORY-386-gc1f694b.

Change-Id: I7e47553af63c3c3405522e37f86d9004dcca46f7
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-04-21 15:30:54 +00:00
Laurentiu Palcu
e5dc7ac363 sensor: bmi160: switch to the new logging API
Change-Id: Id370e06e95528c223e09bb4110eeec3dcc2d4aef
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
2016-04-21 14:16:15 +00:00
Laurentiu Palcu
01d133a201 sensor: bmi160: add trigger tests to the application
Also, lower the clock for the SPI bus in order not to hit the DW
controller CS issue.

Change-Id: I69c4211bfa6efb85117185e2ae813dd7c4915a7a
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
2016-04-21 14:16:15 +00:00
Laurentiu Palcu
8943f6c5ce sensor: bmi160: add support for triggers
Add support for anymotion and data ready triggers. Also, the user can
choose at configuration time the source of the triggers. For quark, in
particular, since the current driver for ARC does not allow receiving
interrupts from AON GPIO controller, IPM is used: a helper app on x86,
registers a gpio callback and will 'relay' the interrupt, through IPM,
to arc core.

Origin: Original
Change-Id: I170d723425c6280f9aa8c240b66275647723edd9
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
2016-04-21 14:16:14 +00:00
Laurentiu Palcu
f71df44204 sensor: bmi160: make some read/write functions global
These will be needed by the trigger implementation.

Change-Id: Ib408ae540571447059301046a3486cedffa735d5
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
2016-04-21 14:16:14 +00:00
Laurentiu Palcu
5609ec95ee sensor: bmi160: fix bmi160_reg_field_update function
A mask was not applied on the shifted value, hence allowing one to pass
a val that would change other fields in the register.

Change-Id: I3c7bdb24c7b3a0ce94f664dbba303db35660ce7b
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
2016-04-21 14:16:14 +00:00
Laurentiu Palcu
77e28d2263 sensor: bmi160: create two wrappers for bmi160_reg_val_to_range
These will be used in the trigger implementation, which is a different
file, and will allow for the arrays to be static.

Change-Id: Ia34ebe9bde7d09abe8e93f3ace9e282cee1169db
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
2016-04-21 14:16:13 +00:00
Laurentiu Palcu
6330388bf5 sensor: bmi160: move the printing macro to the header
The macro will be used in the upcoming trigger file.

Change-Id: I57a570fde37f31771b3d8bb9c028520fdc41da8f
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
2016-04-21 14:16:13 +00:00
Laurentiu Palcu
b70278f113 sensor: bmi160: add x86 app for Arduino101
This app is needed for Arduino101 only, or boards using the Curie
module.

BMI160 interrupt pin is connected to AON GPIO controller. The driver
handling the AON GPIO controller runs on x86 core. Even though, the AON
GPIO controller is accesible to ARC core too, the current implementation
for Designware controller driver does not allow it. Hence, this app will
register a gpio callback and signal the ARC core through IPM.

Other boards that use a gpio pin on the regular GPIO controllers don't
need this app.

Origin: Original
Change-Id: I225ca60735e39c7a47693dc53237f48cd9ac2680
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
2016-04-21 14:16:12 +00:00
Laurentiu Palcu
8d7f52c2d9 sensor: sensor.h: fix typo
Change-Id: I989cd3de1096848c354b7eb597665849bc37bdb0
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
2016-04-21 14:16:12 +00:00
Laurentiu Palcu
559112a6a0 sensor: bmi160: move sample app to arc subdirectory
The movement is needed because on some boards, like Arduino101, the
current GPIO driver implementation does not allow for receiving
interrupts from AON GPIO controller directly on ARC core. Hence, IPM is
needed to relay the interrupts from x86 to arc.

However, other boards that can use a regular GPIO intterupt or users
that connect a BMI160 chip separately, can still use the ARC application
as is.

Change-Id: I58dd77edd45ea2b071db5b99073eb15722847bfe
Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com>
2016-04-21 14:16:12 +00:00
Szymon Janc
cef3c59488 Bluetooth: Refactor bt_init
This makes function flow follow common error handling convention
err = foo()
if (err)
  return err

Change-Id: Ifa3f44e3857b50436212cd5ed240795b220f8a15
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-04-21 14:03:10 +00:00
Grzegorz Kolodziejczyk
0d98a3633e Bluetooth: tester: Add support for seqence gatt database
This patch reorganize tester gatt commands to handle also sequence
builded gatt data base

Change-Id: I5fc89c1c498dd2ecf3999bc93e3caffd14f67cb7
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-04-21 13:32:42 +00:00
Johan Hedberg
3fbe227cdd Bluetooth: tests: Add DEBUG_DRIVER to automated tests
Change-Id: I9fa76816ceb1f6a49861a1145ae85394b6a64c80
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-04-21 10:41:48 +03:00
Johan Hedberg
b090d75d62 Bluetooth: drivers/h5: Remove redundant BT_DBG()
Change-Id: I90e7caadfb357c1c2451b0108d11ce57c0dae77a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-04-21 10:41:48 +03:00
Andrei Emeltchenko
503d01a96c Bluetooth: Fix typo tupe to type
Fixes compilation with debug for drivers h4 and h5

Change-Id: Ia09ce0a5ca3d684a4f9d25fdfe8530e80a46afac
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-04-21 10:09:30 +03:00
Yannis Damigos
2b8d3626c6 sanitycheck: Add olimexino_stm32 board to sanitycheck
Adds olimexino_stm32 board to sanitycheck.

Change-Id: Icd0e5025bc7a348c7a1a4d18d10d2d1e3a9817bd
Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2016-04-20 22:29:02 +00:00
Yannis Damigos
7a33682a03 doc/board: Add documentation file for olimexino_stm32
Adds documentation file of oliemxino_stm32 to the
supported boards.

Change-Id: Ide6c7767be56d33e8c040a03df13337919a09750
Origin: Original
Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2016-04-20 22:29:02 +00:00
Yannis Damigos
de22f4e55e boards/olimexino_stm32: add new board
Add configuration for OLIMEXINO_STM32 board.
By default, the UART console is forwarded to USART1 available on
UEXT connector. All GPIO ports available on the connecot headers
are enabled.

Change-Id: I60b3ff20ea60b5294a3a6c31f4dba0802794f9d8
Origin: Based on nucleo_f103rb board
Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2016-04-20 22:29:01 +00:00
Anas Nashif
1d93e321e8 samples: ipm: reset kernel binary name to zephyr
Those samples are confusing test suites by not generating
the expected zephyr.bin binary.

Change-Id: I4fb81782bacafb4f259e088df4b2518faa6f47cf
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-04-20 17:20:10 +00:00
Johan Hedberg
560956c54d Bluetooth: Kconfig: Split debug selection into a choice
This prepares for adding other debug types besides the printf-style
logging to the console.

Change-Id: Ic2ed305192491734da991c4f61fdaace03fd60f2
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-04-20 17:46:09 +03:00
Johan Hedberg
5cec79e4c8 Bluetooth: Add dedicated bt_send() function
This helps avoid digging out the driver and send callback pointers,
and helps prepare for extended logging support to export the HCI
traffic externally.

Change-Id: I1a9a58a6b47babed41b5bb9349635478905352e1
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-04-20 14:46:48 +03:00
Bogdan Davidoaia
b628aa8a87 sensors: bma280: add support for BMC150 accelerometer
Add support for BMC150 accelerometer which differs from BMA280 only in
id, I2C address and acceleration data width.

Change-Id: Iccf47ecc5de9fdb1b9e45f1561c5dbb54f720806
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-04-19 18:40:43 +00:00
Bogdan Davidoaia
0eec9492fc sensors: bma280: fix accel data sample calculation
The values from the accel data sample msb and lsb registers need to
be concatenated (using bitwise or) and not added, since together they
represent a single 14-bit value.

Change-Id: I476f05512beb3d6b81bacefd4c52e4b2a541708b
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-04-19 18:40:43 +00:00
Bogdan Davidoaia
62fca8fcc1 sensors: bma280: compute accel scales based on data width
Compute acceleration data and threshold scales based on data width and
acceleration measurement range instead of defining LSB values for each
measurement range.

Change-Id: I2a15877cef00d49d7a64fd6f6003722bb9f80b92
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-04-19 18:40:42 +00:00
Arkadiusz Lichwa
bf62dfad70 Bluetooth: BR/EDR: Initiate encryption on link
Adds method to start encrypting the link by local controller. Encryption
implies successful authentication to be done before.

> HCI Event: Auth Complete (0x06) plen 3
	Status: Success (0x00)
	Handle: 11
< HCI Command: Set Connection Encryption (0x01|0x0013) plen 3
	Handle: 11
	Encryption: Enabled (0x01)
> HCI Event: Command Status (0x0f) plen 4
	Set Connection Encryption (0x01|0x0013) ncmd 1
	Status: Success (0x00)
> HCI Event: Encryption Change (0x08) plen 4
	Status: Success (0x00)
	Handle: 11
	Encryption: Enabled with E0 (0x01)

Change-Id: I3bbfc6ca77a6fd088582ab45f14d7c122aec7f05
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-04-19 12:50:31 +00:00
Arkadiusz Lichwa
99483fded6 Bluetooth: BR/EDR: Notify about pairing while JustWorks
In some cases 'justworks' model applied on authentication/pairing process
requires user attention.
BT Core 4.2 says in table 5.7 [Vol 3, Part C, 5.2.2.6] that not always
passkey auto-accept can be applied on both devices involved in SSP
pairing for this authentication association model.

Change-Id: I7cc575ac088bcce7830f22d08e49dab40889f515
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-04-19 12:49:18 +00:00
Arkadiusz Lichwa
9d9e349b31 Bluetooth: BR/EDR: Initiate authentication
Enables initiate authentication using possibility to change security
level on link by calling internal security API. In case of failure
resets pairing state flag to re-enable change security on subsequent
authentication attempts.

To verify the process of authentication run BT shell app from
tests/bluetooth/shell folder and use commands like below:
 >br-connect xx:xx:xx:xx:xx:xx
 [Connected: xx:xx:xx:xx:xx:xx]
 >security 1

HCI log:
> HCI Event: Connect Complete (0x03) plen 11
	Status: Success (0x00)
	Handle: 11
	Address: 00:13:17:72:8D:87 (GN Netcom A/S)
	Link type: ACL (0x01)
	Encryption: Disabled (0x00)
< HCI Command: Authentication Requested (0x01|0x0011) plen 2
	Handle: 11
> HCI Event: Command Status (0x0f) plen 4
	Authentication Requested (0x01|0x0011) ncmd 1
	Status: Success (0x00)
> HCI Event: Link Key Request (0x17) plen 6
	Address: 00:13:17:72:8D:87 (GN Netcom A/S)
< HCI Command: Link Key Request Negative Reply (0x01|0x000c) plen 6
	Address: 00:13:17:72:8D:87 (GN Netcom A/S)
> HCI Event: Command Complete (0x0e) plen 10
	Link Key Request Negative Reply (0x01|0x000c) ncmd 1
	Status: Success (0x00)
	Address: 00:13:17:72:8D:87 (GN Netcom A/S)
> HCI Event: PIN Code Request (0x16) plen 6
	Address: 00:13:17:72:8D:87 (GN Netcom A/S)
< HCI Command: PIN Code Request Reply (0x01|0x000d) plen 23
	Address: 00:13:17:72:8D:87 (GN Netcom A/S)
	PIN length: 4
	PIN code: 0000
> HCI Event: Command Complete (0x0e) plen 10
	PIN Code Request Reply (0x01|0x000d) ncmd 1
	Status: Success (0x00)
	Address: 00:13:17:72:8D:87 (GN Netcom A/S)
> HCI Event: Link Key Notification (0x18) plen 23
	Address: 00:13:17:72:8D:87 (GN Netcom A/S)
	Link key: d9ff76c09284c1ed369851f87d7ac623
	Key type: Combination key (0x00)
> HCI Event: Auth Complete (0x06) plen 3
	Status: Success (0x00)
	Handle: 11

Change-Id: I2d383d34e19c04ead3fa254e5514d5c7f352a21e
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-04-19 12:48:45 +00:00
Johan Hedberg
d458c616df Bluetooth: Add missing debug log to HCI driver send()
Change-Id: I0842675192cd1fbf3997a8f0d4906f114c0489c1
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-04-19 14:39:55 +03:00
Johan Hedberg
483fc4705f Bluetooth: samples: Add sample Kconfig for nimble based controllers
Add config files to be used on Arduino 101 (or any Curie-based) board
with the MyNewt nimble stack running on the nRF51 and exposing HCI
over UART. These configs contain a stripped-down set of features so
that the resulting image fits e.g. on the Arduino 101.

Change-Id: I7300e9ca4205de6f52aa6ca1bfe4e0b011b6dcbe
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-04-19 13:19:02 +03:00