Commit graph

18591 commits

Author SHA1 Message Date
Johan Hedberg
e899c811e6 Bluetooth: Use async callback for enabling Bluetooth
In the peripheral sample app use the async feature of bt_enable() to
verify that it works as expected.

Change-Id: I15f7758944a8c34d1aaef84f0ba77a6b5bbb4695
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:44 -05:00
Johan Hedberg
79696d3b34 Bluetooth: Redesign Bluetooth init API
We need to be able to perform the init procedure asynchronously
through a callback. The RX fiber is a good candidate to use for the
callback since it's not active in its normal operation before
drv->open has been called. In order to prepare for a future
bt_disable() API the init API is renamed from bt_init() to
bt_enable(). If a NULL pointer is given as the callback the API
behaves synchronously like the old bt_init().

Change-Id: I4e78fa8f32dcf5477ea05a8db75aca5cdce591fd
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:44 -05:00
Johan Hedberg
3ab32aa5f1 Bluetooth: Move hci_rx_fiber further down in hci_core.c
This is preparation for the next patch where we let the rx_fiber
perform part of the initialization procedure. This procedure needs to
make calls to functions that are defined after the old location of
hci_rx_fiber().

Change-Id: I5e4366a90dac22846b8bf4ef1a9ee41bfe30d36c
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:44 -05:00
Arkadiusz Lichwa
55607e5e9a Bluetooth: Allocate room for LE read remote features
Prepare room in connection object for result of LE read remote
features procedure.

Change-Id: I30a557656d44a6c35a2a022e8e6e574b52d257be
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-02-05 20:14:44 -05:00
Arkadiusz Lichwa
35ba35db7a Bluetooth: Add bitmask for LE exchange features
Adds bitmask to be used for validation of LE features
exchange support.

Change-Id: I96a79f5e5c4fef330933480f9dd5ec567cd9523f
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-02-05 20:14:44 -05:00
Arkadiusz Lichwa
6035dc2300 Bluetooth: LE read remote features HCI abstraction
Adds LE read remote features command and event types.

Change-Id: I3270142379c6f822f6f4be2e720c9cabb5d3df3e
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-02-05 20:14:44 -05:00
Arkadiusz Lichwa
d63811079f Bluetooth: Adjust update connection params over L2CAP
The slave may request a change to the connection parameters using
the L2CAP LE signaling channel if either the master or the slave
or both do not support the Connection Parameters Request procedure.
Therefore if local controller doesn't support this, the request
can be made for sure.

Change-Id: I23e70793763693e40dab3bfb6a9634816f5b02b2
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-02-05 20:14:44 -05:00
Luiz Augusto von Dentz
7540844891 Bluetooth: GATT: Make bt_gatt_notify length parameter uint16_t
This is consistent with the rest of the API since the attribute length
can be at most 512 bytes long.

Change-Id: Ia2e60cf8dadcb93d0d091cda5be1b80de98fae94
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:14:44 -05:00
Luiz Augusto von Dentz
870e466338 Bluetooth: GATT: Fix representing handle with uint8_t
GATT Handles are always 16 bits long.

Change-Id: I745197f7d7d3af52cb44e5be87b02471a23e9d73
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:14:44 -05:00
Luiz Augusto von Dentz
8697d207a0 Bluetooth: GATT: Fix using uint8_t for attribute length
Attribute length can be up to 512 bytes long so it needs to be at least
uint16_t, ATT already takes care that the MTU does not exceed 512 bytes.

Change-Id: I6c8dc80a4b63f212420c26c0a24d93939fa510fe
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:14:44 -05:00
Szymon Janc
e98b08b377 Bluetooth: SMP: Remove not needed smp->tk initialization
Whole smp context is already cleared up in smp_init().

Change-Id: Ided5d61dc6e859bd1a17b8b8d410f1ef8b2bebb0
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
2016-02-05 20:14:44 -05:00
Jukka Rissanen
7918507b15 net: contiki: Increase number of configurable IPv6 addresses
If user wants to add unicast and multicast address, the current
limit (2) is too small. Increasing the amount of configurable
IPv6 addresses to 4.

Change-Id: I4c652e6c45266d6d0ac9ebf207a045158efdd300
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:44 -05:00
Jukka Rissanen
c94b69c542 net: tools: Add multicast support to echo-client
Now the echo-client can send multicast packets to server.

Change-Id: I9bb5ba2726a116a010c2e35981cde62f6af7e3e6
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:44 -05:00
Jukka Rissanen
e0b6702d71 net: apps: Add multicast support to echo-server
echo-server can now receive both unicast and multicast UDP
messages.

Change-Id: I3837b8e7126584fa7c87958e68a8439824abd5ab
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:44 -05:00
Jukka Rissanen
2be43b3c47 net: context: Allow multicast address to be created
Allow user to add multiple addresses with the same port number.
This situation easily happens when application adds unicast
and multicast address for same port it wants to listen.

Change-Id: Iabe51f21ac2fe6aab8e6c3ff42371fa11e0cec1c
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:44 -05:00
Jukka Rissanen
f4a2245d8b net: contiki: Add debug printing when traversing UDP connections
Disabling prints by default but have them around as we will need
them later.

Change-Id: I21d980018286be560b9a072ee08ef0be42b0e788
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:44 -05:00
Jukka Rissanen
857017a9e3 net: contiki: Traverse UDP connection list properly
We have an array of UDP connections so just go through
the list in a most simple way. Set only the UDP connection
pointer if we found something and clear it otherwise.

This helps to avoid weird errors where multiple UDP connections
were added but only the first one was found during list traversal.

Change-Id: Iae90ee6803eee1d06e7a49211d77692b0cf5ca50
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:44 -05:00
Jukka Rissanen
6f059122f7 net: contiki: Init UDP connection list properly
It is better to initialize the UDP connection array
fully in init instead of setting only the port number
to zero. This way we do not have any garbage bytes
left around.

Change-Id: I90dcf6dc39a5a108818f25796160ca7dc52ba9d9
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:44 -05:00
Jukka Rissanen
6a2e400076 net: contiki: Print info about added multicast addresses
It is difficult to know what multicast addresses were added
without this print.

Change-Id: I870a911b14a0349949f1581084d3b4ec4ffb0ecb
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:14:43 -05:00
Luiz Augusto von Dentz
369ff3bb90 Bluetooth: Make central sample discover HRS over GATT
This makes the central sample discover the attributes and subscribe
to receive notifications of HeartRate Measurement Characteristic.

Change-Id: Icedbdd759638be0b8fa8515112208aa61ad5eb90
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:14:43 -05:00
Luiz Augusto von Dentz
f581894abf Bluetooth: Make central sample connect to devices supporting HRS
This makes central sample to parse the Advertising Data and in case the
device supports HeartRate Service stop scanning and connect to it, if the
device disconnects then start scanning again.

Change-Id: I49962eadb5c82c7a910185212063cd576cadf62e
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:14:43 -05:00
Luiz Augusto von Dentz
7942266868 Bluetooth: Add connection callbacks to central sample
This will be needed to monitor connections with peripherals.

Change-Id: Iccea2696af72b0b8b3f40aac180738dc6b80abc8
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:14:43 -05:00
Mariusz Skamra
b79ea66038 Bluetooth: L2CAP: Reject a request for conn parameters update as slave
According to Core vol.3, part A 4.20, if we operate in slave mode,
and we receive a Connection Parameter Update Request, we should
respond with a Command Reject with reason Command not understood.

Change-Id: Icf67eae432836796b8249953f53890b15bc542bf
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:14:43 -05:00
Mariusz Skamra
6b4f7025f2 Bluetooth: Start using atomic flags to indicate bt_dev state
With this patch advertising state and scanning state are stored as flags.

Change-Id: I5d2dc37972620ee89aaf55d45e294e8be82863d3
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:14:43 -05:00
Mariusz Skamra
4dd751cf99 Bluetooth: SMP: Factor out duplicated code
Initial setting of allowable commands can be put in one
function since it repeats in few places.

Change-Id: I645731810a2d83179af3e095bc20eb66809d9d8f
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:14:43 -05:00
Mariusz Skamra
c9287c2bc2 Bluetooth: SMP: Fix zeroing smp
In smp_init we reset smp so that Pairing Failed command is deleted
from allowable commands and the pointer to the associated conn is lost.
With this patch associated conn is copied and the Pairing Failed
command is marked as allowed.

Change-Id: I7a71f985ca9d9d332e392aeb9368053a8c084750
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:14:43 -05:00
Luiz Augusto von Dentz
368cfb775e Bluetooth: Add gatt-unsubscribe command to btshell
This adds gatt-unsubscribe which works as follow:

btshell> gatt-unsubscribe <CCC handle>
bt: gatt_write_ccc (0x0010edc8): handle 0x0015 value 0x0000
Unsubscribe success

Change-Id: I812fd237f71c4cad8e188015f1cd4cd2f2902aa6
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:14:43 -05:00
Luiz Augusto von Dentz
7006b5ae92 Bluetooth: GATT: Add bt_gatt_unsubscribe
This adds bt_gatt_unsubscribe which can used to unsubscribe to attribute
value notification using CCC handle.

Change-Id: I8a3b1594787a3322834516d0306a84c8ef7792dd
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:14:43 -05:00
Luiz Augusto von Dentz
d39eb230ee Bluetooth: Add gatt-subscribe command to btshell
This adds gatt-subscribe which works as follow:

btshell> gatt-subscribe <CCC handle> <value handle>
bt: gatt_write_ccc (0x0010e594): handle 0x0015 value 0x0001
bt: bt_att_recv (0x0011082c): Received ATT code 0x13 len 1
bt: att_handle_write_rsp (0x0011082c):
bt: att_write_ccc_rsp (0x0011082c): err 0x00
Subscribe complete: err 0
Subscribe destroy
bt: bt_att_recv (0x0011082c): Received ATT code 0x1b len 4
bt: att_notify (0x0011082c): handle 0x0014
bt: bt_gatt_notification (0x0011082c): handle 0x0014 length 1
Notification: data 0010cea9 length 1

Change-Id: Ide1f737358857a87db6dac1ecd9097f8da99ed72
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:14:43 -05:00
Luiz Augusto von Dentz
fac5df2bae Bluetooth: GATT: Add bt_gatt_subscribe
This adds bt_gatt_subscribe which can used to subscribe to attribute
value notification using CCC handle.

Change-Id: I0983843836b0c2253f750b34b7765dd880cb10a0
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:14:43 -05:00
Luiz Augusto von Dentz
d354059ad4 Bluetooth: ATT: Handle Value Notification
This adds function handler for Handle Value Notification PDU:

> ACL Data RX: Handle 3585 flags 0x02 dlen 8
      ATT: Handle Value Notification (0x1b) len 3
        Handle: 0x0014
          Data: 00

Change-Id: I6faf9c8a3a3f892f889389c08380551268c7202a
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:14:43 -05:00
Luiz Augusto von Dentz
a6b826e918 Bluetooth: Use connection context in btshell
Once connected store the bt_conn as context, this save the trouble of
entering the same parameter over and over and remove the lookups from
commands that requires a connection.

Change-Id: I9671b8fa07a1a61db45516f63eb007f19f0e59a1
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:14:43 -05:00
Luiz Augusto von Dentz
8ffb486829 Bluetooth: GATT: Fix bt_gatt_discover_characteristic
After each response the start_handle shall be updated otherwise it will
loop foverever reading the same range over and over.

Change-Id: I9712f7a6cf0ca5c36460732ea96cf40471631e8a
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:14:43 -05:00
Johan Hedberg
9698411362 Bluetooth: Minor coding style (white space) fix
Change-Id: I50f0f4548fdf5c79c783f4055974e427ba9cbfe8
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:14:43 -05:00
Johan Hedberg
9e1c434ad9 Bluetooth: Move bt_conn timeout handling into conn.c
Change-Id: I865e86d41e2744a41653195f2b99d365426aee7d
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:43 -05:00
Mariusz Skamra
f3232cb999 Bluetooth: Add simple timeout for connection establishment
Adds fiber which starts with some specified delay.
If the fiber is not cancelled, bt_disconnect is called to
cancel creation of connection.

Change-Id: I06667d970ba3398f205f19f1d2e76ab6c283f274
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:14:43 -05:00
Dmitriy Korovkin
4e3bce5e96 Add page-aligned padding to initlevel section for Galileo test load
Galileo testing uses Linux kexec() feature to load Zephyr OS.
kexec() requires all program headers page size aligned.
Add page size padding to initlevel section in order to make
BSS page aligned.

Change-Id: I7c0e309be70aef45b347b16c6d5c01bdf5659351
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
2016-02-05 20:14:43 -05:00
Peter Mitsis
ed610c5bd5 x86: Replace references to BSP with platform
Removes references to obsolete BSP terminology.  Where appropriate, replaces it
with platform terminology.

Change-Id: I41fc099844d137dd0ea87cce0f675dc6f022ad40
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:43 -05:00
Peter Mitsis
7175ec33a2 arm: Replace references to BSP with platform
Removes references to obsolete BSP terminology.  Where appropriate, replaces it
with platform terminology.

Change-Id: I26c199c50fefc9729ec07c48083bedc86890cc89
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:43 -05:00
Peter Mitsis
fd0f9a2047 arm: Rename IRQ_VECTOR_TABLE_BSP to IRQ_VECTOR_TABLE_PLATFORM
Replaces references to obsolete BSP terminology with platform.

Change-Id: Ibd083558bbbb08a16a68d58251774fb4c84cbbf8
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:43 -05:00
Peter Mitsis
f1bcbf51f0 arm: Remove obsolete SW_ISR_TABLE_BSP Kconfig option
The Kconfig option SW_ISR_TABLE_BSP is not used anymore.

Change-Id: Ifc1be395f5ed7e5d1072a783d800385e69fbc4dc
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:43 -05:00
Peter Mitsis
2a4a6cf578 Remove references to BSP from drivers/ directory
Removes references to obsolete BSP terminology.  Where appropriate, replaces it
with platform terminology.

Change-Id: Ifb17f98bc12d3a28198810351629a109abdc18a5
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:43 -05:00
Peter Mitsis
7cbad4e7dd Remove references to BSP from include/ directory
Removes references to obsolete BSP terminology.  Where appropriate, replaces it
with platform terminology.

Change-Id: If38c859338c7cf0de58430336e1046b28f9e9944
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:43 -05:00
Peter Mitsis
771c5998e9 kbuild: Replace 'bsp-y' with 'platform-y'
Replace obsolete BSP terminology with platform terminology.

Change-Id: I4c23cc0cc0c12f1402e9ea467b87d10e17e5ef71
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:43 -05:00
Peter Mitsis
8ff6904084 Remove references to BSP from misc/ directory
Replaces references to obsolete BSP terminology with platforms.

Change-Id: Id5f7760e2d14353a19c020afd8f87d9033ddbf69
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:43 -05:00
Peter Mitsis
c41824b097 Update README file to reference platforms
Updates instructions to use the new platform terminology and build variables
instead of the obsolete BSP nomenclature.

Change-Id: I165982c701cde6e645138b3346e42b4588706ffa
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:43 -05:00
Peter Mitsis
99037499b6 Remove references to BSPs from sample projects
Removes references to obsolete BSP terminology from the sample projects and
replaces it with references to platforms where appropriate.

Change-Id: I6c8071a84f77c2cfe1458e3891d2b5e5afdaf8f9
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:43 -05:00
Peter Mitsis
ad03f13db5 samples: Update sanity_chk usage notes
Removes reference to the unsupported "-T <toolchain>" option and the replaces
the deprecated "-B <BSP>" option with "-P <platform>".

Change-Id: I21ab863dded9cbfd4fc0ab2fcade59137add08cf
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:43 -05:00
Dmitriy Korovkin
5a57c36a6c Fix galileo configuration to HPET
Add to the configuration that HPET timer legacy emulation
mode is not used, as hardware does not support it.

Change-Id: I51175a0ce8f06c9c38a3fc36f9723e431fc72dd6
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
2016-02-05 20:14:42 -05:00
Dmitriy Korovkin
6ab23e30da Port basic_atom configuration to HPET
In order to work reliably on QEMU and not depend on the
host CPU frequency change basic_atom configuration to use HPET.

Change-Id: I1253a0224bcbff4a7d54406b089c29b5ace32080
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
2016-02-05 20:14:42 -05:00