Commit graph

41176 commits

Author SHA1 Message Date
Anas Nashif
0699191d33 tests: fixed resulting binary name in README
We no longer produce nanokernel.elf or microkernel.elf.

Change-Id: I37cb985ddc90f4129f122b9209d306898a71a596
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-09-07 12:56:03 +00:00
Grzegorz Kolodziejczyk
81e10314ef Bluetooth: tester: Add L2CAP init method
This adds method which initialize data pool for L2CAP data.

Change-Id: I2b170489aa4b2afc3c1f962591f377e23d147161
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-09-07 09:08:47 +00:00
Jaganath Kanakkassery
028bf3fb88 Bluetooth: RFCOMM: Modify bt_rfcomm_dlc() to return dlc
Currently bt_rfcomm_dlc() is returning error code and dlc is returned
as output param. Since caller does not need to check error, it can
return NULL if some error happens

Change-Id: I86e85b67545edb960b4b745267e6645017373bf6
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
2016-09-07 07:22:38 +00:00
Jaganath Kanakkassery
2df4bf6237 Bluetooth: RFCOMM: Implement TX flow control
Data sent by user will be queued in a FIFO. A TX fiber will be
started for each DLC which process this FIFO and write to L2CAP.
Fiber will sleep in two scenarios - no buffer in FIFO, no TX
credit. Credit is handled using semaphore. So if credit is 0
then fiber will wait on semaphore and will be scheduled when
it receives credit.

Change-Id: Id6e796eed594b28d6fb6e4259d3ed52634db9335
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
2016-09-07 07:22:32 +00:00
Vinayak Chettimada
d72b06da56 Bluetooth: GATT: Fix ccc cfg leak
ccc cfg is allocated when a peer updates a ccc value. This
fix will retain a cfg only if the new value is not default.

Change-id: I586082818145e43c771a6fccdb0bf2b3cecdd30c
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2016-09-07 05:19:45 +00:00
Carles Cufi
42f7ab9443 Bluetooth: Controller: Switch to Zephyr's hci.h for cmd handling
Start using Zephyr's include/bluetooth/hci.h for HCI command
handling.
This is the first commit in a series that transitions from
the structures in hci.c to the ones in hci.h.

Jira: ZEP-726

Change-Id: I1d79586b85d25c8ef707b8a2b19a27a77b08b819
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-09-07 08:17:26 +03:00
Carles Cufi
0762a5c744 Bluetooth: HCI: Add definitions and macros
Add multiple definitions and macros required by the
controller's HCI layer.

Jira: ZEP-726

Change-Id: I2d4ce0a740495613128092c56ee1b16a232bb076
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-09-07 08:17:26 +03:00
Vinayak Chettimada
73808e25d6 Bluetooth: GAP: Support multiple peripheral role connections
Fix the use of BT_DEV_KEEP_ADVERTISING and BT_DEV_ADVERTISING
so as to permit multiple peripheral role connections if the
controller supports Bluetooth Spec. v4.2 LE Topology.

Change-Id: Ia363181754cb788c13e9050e5fe5416201593c07
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2016-09-07 08:17:26 +03:00
Carles Cufi
49583b10d0 Bluetooth: HCI: Rename cmd complete struct
For consistency, add the bt_ prefix to
hci_evt_cmd_complete.

Jira: ZEP-726

Change-Id: I0deb9f12913991bf52ccffc8c85b86c83da1c045
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-09-07 08:17:26 +03:00
Carles Cufi
cdb197c727 Bluetooth: Controller: Unify handling of CC and CS
Place common code in hci_evt_handle() so as to avoid code
duplication in the handling of command complete and
command status events.

Jira: ZEP-726

Change-Id: I35ffcb63518b52a2b209f83ef6b8bbb1d1b4a849
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-09-07 08:17:26 +03:00
Carles Cufi
4ecc06c1e2 Bluetooth: Controller: Unify handling of unknown command
Handle all instances of an unknown OCF in a common place
instead of it being spread in multiple functions.

Jira: ZEP-726

Change-Id: Ibd9ebe429754980b243cb8772702cfeb59b0a18b
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-09-07 08:17:26 +03:00
Vinayak Chettimada
863e2b5ff5 Bluetooth: Controller: Enable all supported LE states
Controller implementation supports all Bluetooth Spec. v4.2 LE
states. Include the LE Read Supported States Command in Read
Local Supported Commands HCI command complete returned by the
Controller.

Change-id: I399f7c0326b058577e97e6d8a2676afbeb73b6fe
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2016-09-07 08:17:26 +03:00
Luiz Augusto von Dentz
4f418a6b42 Bluetooth: GATT: Fix unaligned accesses
Use net_buf helper whenever accessing data by reference.

Change-Id: I3c7eb3af33a3d22741f73c094fb4a39e3e3d3440
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-09-07 08:17:26 +03:00
Kaustav Dey Biswas
68e58af67e Bluetooth: UUID: Add 32bit UUID support
This adds helper support for handling 32bit UUIDs

Change-Id: I4874b5f092bdbe30039b8031485bf856e4268f2a
Signed-off-by: Kaustav Dey Biswas <kaustav.d.biswas@intel.com>
2016-09-07 08:17:26 +03:00
Vinayak Chettimada
7a0561a60f Bluetooth: Controller: Measure and use correct stack size
Use stack_analyse in the recv fiber to print actual stack
usage, use this as default in Kconfig option, and declare a
rx fiber stack of Kconfig supplied stack size.

Change-id: Id97ad2de4f7be3069f93271d60544f760abbf575
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2016-09-07 08:17:26 +03:00
Luiz Augusto von Dentz
bafbe76dc3 Bluetooth: HoG: Require authentication for connections
HID over GATT Profile Specification states:

  'The HID Device shall use LE Security Mode 1 and either Security Level
   2 or 3.'

Change-Id: I2cfc1d9df76b4e8a8b2be7e87d18a7a5f3a19ea8
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-09-07 08:17:26 +03:00
Luiz Augusto von Dentz
f509d68cf1 Bluetooth: Add sample implementing HIDS
This adds a sample that implements HID Service peripheral, the current
descriptor map is for a generic mouse so when connecting to a Linux box
it will create a input device like in the following output:

input: Test HoG mouse as /devices/virtual/misc/uhid/0005:1D6B:0246.0035/input/input98
hid-generic 0005:1D6B:0246.0035: input,hidraw2: BLUETOOTH HID v5.29 Mouse [Test HoG mouse] on XX:XX:XX:XX:XX:XX

Change-Id: Iccf07926ecc7363f4f47e1aa9df506a722e7e2d3
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-09-07 08:17:26 +03:00
Luiz Augusto von Dentz
30665185f8 Bluetooth: Add service sample for HoG
This adds a HoG service sample which can be shared with application
samples.

Change-Id: I6893ff409b254d0a616b2ba558fd629ce9edf1d4
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-09-07 08:17:26 +03:00
Mariusz Skamra
de124844b3 Bluetooth: btp: Extend BTP specification to cover L2CAP tests
This adds commands to the Bluetooth Testing Protocol for L2CAP.

Change-Id: Ie9ea180c4db62c238ce1450e5714ffd7b0ca2f5f
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-09-07 08:17:26 +03:00
Johan Hedberg
3b61beca20 Bluetooth: GATT: Fix unaligned access to CCC value
The CCC value behind the 'buf' pointer in bt_gatt_attr_write_ccc() may
not be appropriately aligned. It should therefore be accessed with
sys_get_le16() instead of sys_le16_to_cpu(). This also eliminates the
need of a separate uint16_t helper variable in the function.

Change-Id: I93d50f894e877f25ec6ed2f576cf6bf6d440190b
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-09-07 08:17:26 +03:00
Vinayak Chettimada
1553ccc492 Bluetooth: Add LE read supported states
To fully support BT Spec. v4.2 LE Topology use LE read supported
states HCI command to find the supported states in the
controller.

Change-id: I6b4cf4cbefdff44e51bb0a4242e0aef3755f43db
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2016-09-07 08:17:26 +03:00
Vinayak Chettimada
d84054ab8b misc/byteorder.h: Add sys_get_le64 interface
Change-id: Ie1e5f0e5c5fa209c91fa94f4091ddc174796fb8c
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2016-09-07 08:17:26 +03:00
Luiz Augusto von Dentz
76773c2ff4 Bluetooth: UUID: Add HID Service
This adds UUIDs related to HID Service as defined in the assigned
numbers.

Change-Id: I73e8659546587aa9330bcd7d483bc097448e5ced
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-09-07 08:17:26 +03:00
Carles Cufi
2334e225b7 Bluetooth: Controller: Use offsetof() in memory sizing
GCC requires __builtin_offsetof() to be used whenever
sizing arrays with its help. Now that stddef.h
includes conditional compilation, use the macro instead
of hardcoding the GCC usage.

Jira: ZEP-732

Change-Id: Ieb5c694e1dc8323bd1fa2d18711a893f8824c5b1
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-09-07 08:17:26 +03:00
Andrei Emeltchenko
68182568cb drivers/nble: Rename nrf51 power management functions
Rename nrf51_enable() to nrf51_wakeup()
and nrf51_disable() to nrf51_allow_sleep().

Change-Id: Ie8e8fa2dde281f212e231e0c4b751d3e0021b6b6
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-09-07 08:17:26 +03:00
Jaganath Kanakkassery
623ce45fc9 Bluetooth: RFCOMM: Remove BT_RFCOMM_SEND_RESERVE
Profiles should use bt_rfcomm_create_pdu() hereafter.

Change-Id: I2fcbbd910005ec5b7b8d75ca452a63c21e6964ea
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
2016-09-07 08:17:26 +03:00
Johan Hedberg
333a7bb1dc MAINTAINERS: Fix path for BLUETOOTH CONTROLLER
The path refers to a directory so it must have a / at the end to be
identified as such.

Change-Id: I10ca81ff14666d47c1a63ab16b9f18c24cece96f
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-09-07 08:17:26 +03:00
Jaganath Kanakkassery
ca938e0dcd Bluetooth: RFCOMM: Fix BT_RFCOMM_BUF_SIZE to include FCS and len
Profiles uses this helper to allocate net buf, so it should include
2 byte length in RFCOMM header and FCS which will be appended in the
tail by RFCOMM.

Change-Id: I0118eb9b0e0ab1daa9267c165af62bb50f1575d9
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
2016-09-07 08:17:26 +03:00
Jaganath Kanakkassery
2a3a95b24d Bluetooth: shell: Use bt_rfcomm_create_pdu() in RFCOMM send
Remove BT_RFCOMM_SEND_RESERVE usage since it will be removed
eventually.

Change-Id: Iada20cf0692ae12996e7ed820601bb77fe47d438
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
2016-09-07 08:17:26 +03:00
Jaganath Kanakkassery
6ffbf795ce Bluetooth: RFCOMM: Introduce Kconfig for max L2CAP MTU
Intorduces CONFIG_BLUETOOTH_RFCOMM_L2CAP_MTU which sets default as
CONFIG_BLUETOOTH_L2CAP_IN_MTU since it will make sure that RFCOMM
frames can be fit in ACL buffer to avoid fragmentation and at the
same time profiles can utilize the size of ACL buffer while configuring
RFCOMM MTU.

Once fragementation is handled, this can be configured to higher values
based on the profiles supported and its L2CAP PDU size requirement.

The maximum value possible is 32676 which is max RFCOMM frame size
given in the spec.

Change-Id: I57e178ea4da846243067c3e072d1f4c5536a3ee3
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
2016-09-07 08:17:26 +03:00
Szymon Janc
68adceed5e Bluetooth: Move reading extended features to BR/EDR section of init
Those are needed only for BR/EDR and in fact was read was never issued
on LE only system due to pages count being 1 in such case.

Change-Id: I8facb77edb9cd03b392034423d8bb261f685b725
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-09-07 08:17:26 +03:00
Jaganath Kanakkassery
6198f07637 Bluetooth: RFCOMM: Introduce helper to create rfcomm pdu
Profiles can use this helper to create buffer which reserves the
headroom for rfcomm, l2cap and acl headers

Change-Id: I22f97b54423d66fe0c133a8e9903b652fb6a6854
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
2016-09-07 08:17:26 +03:00
Vinayak Chettimada
f77d06ae09 Bluetooth: GATT: Fix notifications to non-bonded peers
GATT implementation fixed so that two or more non-bonded peers
can now independently enable/disable notification and/or
indications; and subsequently receive them too.

Change-id: Ifae78297b6ba13f8ea3db58694302bb7f3449e97
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2016-09-07 08:17:26 +03:00
Johan Hedberg
91c7d938e3 Bluetooth: Kconfig: Be consistent with the use of tabs vs spaces
The most common convention is a space between "config" and the
variable name.

Change-Id: I0f97d5fee56b7db1808dcf07f21016b11f821fa3
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-09-07 08:17:26 +03:00
Jaganath Kanakkassery
5d8f6bf2eb Bluetooth: Kconfig: Add default for L2CAP_IN_MTU if BREDR is enabled
Currently set value as 200 since the HFP needs atleast 132 for CIND
response. AVDTP requirement is less that that and SDP protocol can
handle partial responses.

Note that currently only A2DP offload is considered and for non offload
case (which will need a seperate Kconfig anyway) another default will be
required.

Change-Id: Ief0854365ec47baf754b0a657203e1dc93f0d154
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
2016-09-07 08:17:26 +03:00
Carles Cufi
341f5c9c5e Bluetooth: Cleanup and extend HCI header
In preparation for the unification of the code in:
drivers/bluetooth/controller/hci
with the existing HCI definitions in Zephyr,
this change addresses both the required usage of spaces
in the alignment of line components that require matching
the alignment of other adjacent lines and also adds all
missing Bluetooth 4.2 LE commands and events so that the
controller code can make use of them.

Jira: ZEP-726

Change-Id: Iabcee6898a09ddaf4479cfe4ecb0eedc194da8a3
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-09-07 08:17:26 +03:00
Johan Hedberg
9966337daf Bluetooth: ATT: Fix usage of unsupported %zu format specifier
The Zephyr libc doesn't currently support %zu (it just produces
garbage), so use %u instead.

Change-Id: Ifcaaec79e21f600f00a9336b5267d2d1654adfd7
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-09-07 08:17:26 +03:00
Johan Hedberg
50318d2e4f Bluetooth: Clean up feature test macros
The lmp_*_capable() macros were neither following the appropriate name
space (BT_*) nor the appropriate style (macros should be upper-case).
Introduce a new BT_FEAT_TEST() macro which gives a clearer mapping to
the feature tables found in the core specification. Each specific
feature test macro is now also named with the appropriate BT_FEAT_*
prefix.

Change-Id: Ia6b18b066927908f9bda646e737e63d46a1d17df
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-09-07 08:17:26 +03:00
Vinayak Chettimada
09b5998ced Bluetooth: Controller: Fix deadlock in recv fiber
Controller's fiber is expected to read all enqueued events
and data, hence wait on semaphore only after all events and
data are read.

Change-id: I0150f042b0ba91efa712b38903752b20198e5e6e
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2016-09-07 08:17:26 +03:00
Vinayak Chettimada
5860686013 Bluetooth: Controller: Fix memory required calculation macro
Change-id: I73b06983911590f63728d769c401c8a9a53053d7
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2016-09-07 08:17:26 +03:00
Johan Hedberg
8d6b12f235 Bluetooth: Fix feature page count for single-mode configuration
Single-mode controllers only have features page 0 (plus the LE
features), so allocating three pages in struct bt_dev is a waste of
space.

Change-Id: Idad73ded12bd153776019d0e5f8adbdb74724845
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-09-07 08:17:26 +03:00
Johan Hedberg
0af62d309f Bluetooth: Fix reading local features
Page 0 should be read with the "non-ext" HCI command whereas pages 1-n
with the extended features command (and only if the controller
supports extended features).

Change-Id: I1ddddd367e6883eb83e98983b545f3ffb6159e97
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-09-07 08:17:26 +03:00
Johan Hedberg
00eda80c59 Bluetooth: Make lmp_ext_feat_capable() more generic
Make is possible to use lmp_ext_feat_capable() both for local as well
as remote features.

Change-Id: I05bb6a25303c0dd2f5e0bbc4f7f412210f668aa3
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-09-07 08:17:26 +03:00
Szymon Janc
29cbaa864d Bluetooth: Enable Secure Connections if supported
Enable BR/EDR Secure Connections if Write Secure Connections Host
Support Command is supported in controller.

Change-Id: Ic0c989217be3cd95e5c0ce1ae2b18d3557c774b8
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-09-07 08:17:26 +03:00
Szymon Janc
a5ab11708e Bluetooth: Read local extended features on init
Use Read Local Extended Features command to read local features and
extended local features on init.

Change-Id: I4c8594783895f439af36214881aeff24e116e783
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-09-07 08:17:26 +03:00
Szymon Janc
0bb0acc8a7 Bluetooth: Add support for P256 Link Keys
If P256 Link Key is received in Link Key notification event is should
be marked appropriately.

Change-Id: I09c2f5560d95dd360ef046330e5d85451b02821c
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-09-07 08:17:26 +03:00
Szymon Janc
d48f19d3cc Bluetooth: Refactor Link Key notification event handling
Make sure that Link Key flags are always synced with key type received
in event. Also make sure that no garbage data is stored in key value.

Change-Id: I06d91da19a7c3497a3051d66f43c0d22f24f5e7d
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-09-07 08:17:26 +03:00
Szymon Janc
093468843b Bluetooth: Build RFCOMM documentation
Change-Id: Iaba8fc321d73d66826d24f7f82d82d91ff0a250f
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-09-07 08:17:26 +03:00
Andrei Emeltchenko
9dc90369d5 Bluetooth/samples: Fix missing argument in printf for btusb
Change-Id: I130362a9a3a7f58036b09821bf897295dcca7fdf
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-09-07 08:17:26 +03:00
Andrei Emeltchenko
7a65695f0a Bluetooth/drivers: Fix missing argument in printf for h5 driver
Change-Id: Ia051f96742a4812c0a1014ec7030191d13544c3b
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-09-07 08:17:26 +03:00