Commit graph

19237 commits

Author SHA1 Message Date
Szymon Janc
d75acb44c3 Bluetooth: Remove LE Rand workaround for mynewt firmware
Latest firmware seems to have this fixed and delay is no longer needed.

Change-Id: I3caa8d38fc856964b57049d6704c80ca732ccde5
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-06-08 10:23:22 +02:00
Szymon Janc
6d3ddef1d0 Bluetooth: Fix using uninitialized PRNG
PRNG needs to be initialized right at the begining so that it is safe
to use it from initialization sequence. This fix a race when ECC
emulation code was using uninitiliazed PRNG for public key generation.

Change-Id: Ia396f964b915368cee39ea6be998ef5774062591
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-06-08 10:23:22 +02:00
Szymon Janc
c6fdf09340 Bluetooth: Fix notifying about cancelled connection attempt
If LE Create Connection was cancelled LE Connection Complete event
status is set to Unknown Connection Identifier and doesn't contain
valid remote address. In such case we need to look for connection
object in CONNECT state without using address. There can be only one
object in that state anyway so this is OK also for other error codes.

Change-Id: Ie61d47b8bb7ade6b2ab4db14ee394a65bb4e642b
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-06-08 10:23:21 +02:00
Szymon Janc
609843a527 Bluetooth: Fix comment for bt_conn_lookup_state_le
NULL peer means that first connection with specific state should be
returned.

Change-Id: Ia635584437f948d9dcd82a3619fcf1516d23e0d1
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-06-08 10:23:21 +02:00
Szymon Janc
c443888f3d Bluetooth: Simplify bt_hci_connect_le_cancel
There is no need for local variabel as error code can be returned
directly.

Change-Id: I0ad1bccb75bf1897d210c12d3ad0108f1f909dbe
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-06-08 10:23:21 +02:00
Roger Lendenmann
ee2dfbdcf0 Bluetooth: GATT: Handle ccc cfg values correctly on disconnect
* clear non-bonded ccc cfg values as per BT spec
 * address compare logic
 * check if cfg_changed is defined

Change-Id: Id002f22a6aac1b918d743ef1e73b7e5c4768a229
Signed-off-by: Roger Lendenmann <roger.lendenmann@intel.com>
2016-06-08 06:08:19 +00:00
Johan Hedberg
b76426de6f Bluetooth: Fix never yielding if rx_queue always contains data
It's common for the rx_queue to be written to in ISR context (by the
HCI driver). This means that if there's lots of data coming in from
the driver the rx_queue might get empty very rarely. With the current
code this means that the rx fiber might end up not yielding to other
higher priority runnable fibers for long durations (as long as there's
data in the rx_queue).

To solve the issue, call fiber_yield() explicitly after each processed
buffer from the rx_queue. This way we give other fibers a chance to
run even if there's a heavy flow of data from the Bluetooth
controller.

Change-Id: Ib3dbe6536a62360ad5153ed12eee8489645e4109
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-06-07 21:38:20 +03:00
Johan Hedberg
9edc472c3e doc: boards/arduino_101: Update BLE firmare for latest MyNewt version
The dependencies for the HCI firmware are now part of the latest
stable MyNewt release, so special editing of project.yml is no longer
needed.

Change-Id: Ia3658ab1da03e208cd5230e0cda4c96a4628e8f0
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-06-07 05:39:16 +00:00
Szymon Janc
6248407c00 Bluetooth: shell: Fix data_pool declaration
Buffers pass to BT stack need to have minimum BT_BUF_USER_DATA_MIN
of reserved user space data.

Change-Id: Iaeb85faa20b1c5281bfd0331336295ad7cfdd68e
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-06-06 19:09:59 +02:00
Szymon Janc
0bae6e8354 Bluetooth: L2CAP: Include <bluetooth/buf.h>
This header defines BT_BUF_USER_DATA_MIN which is needed for declaring
buffers passed to BT stack and already includes <net/buf.h>.

Change-Id: I6b556be9fb3939a55af0b73d49fc59152d6d6a53
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-06-06 19:03:14 +02:00
Luiz Augusto von Dentz
f54c5b744d Bluetooth: GATT: Remove obsolete flush callback
It is no longer necessary to implement flush callback for long
descriptors since the stack can queue prepare writes this callback
will never be called which makes BT_GATT_LONG_DESCRIPTOR obsolete
as well.

Change-Id: Idca31ba8e4404d2acba760c420394d5adee0a508
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-06-06 12:29:02 +00:00
Luiz Augusto von Dentz
56419a135b drivers/nble: Add buffer pool for prepare writes
This is similar to previous patch which makes the API much more simple
when handling long writes.

Change-Id: Ibd3856863a43927195e23936872a160d5ff94648
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-06-06 12:28:35 +00:00
Luiz Augusto von Dentz
d7e0294227 Bluetooth: ATT: Add incoming buffer pool
This adds a buffer for incoming prepare writes which can be
tunned using BLUETOOTH_ATT_PREPARE_COUNT, these buffers are then used in
execute write to commit the data thus making flush callback obsolete:

[bt] [DBG] bt_att_recv: (0x001159c0)Received ATT code 0x16 len 50
[bt] [DBG] att_prepare_write_req: (0x001159c0)handle 0x0022 offset 0
[bt] [DBG] prep_write_cb: (0x001159c0)handle 0x0022 offset 0
[bt] [DBG] bt_att_recv: (0x001159c0)Received ATT code 0x16 len 34
[bt] [DBG] att_prepare_write_req: (0x001159c0)handle 0x0022 offset 45
[bt] [DBG] prep_write_cb: (0x001159c0)handle 0x0022 offset 45
[bt] [DBG] bt_att_recv: (0x001159c0)Received ATT code 0x18 len 2
[bt] [DBG] att_exec_write_req: (0x001159c0)flags 0x01
[bt] [DBG] write_cb: (0x001159c0)handle 0x0022 offset 0
[bt] [DBG] write_cb: (0x001159c0)handle 0x0022 offset 45

Change-Id: Iae071d7b4b5b042285952da57e3f7a853cf58afb
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-06-06 12:28:11 +00:00
Johan Hedberg
3f4631aeb9 Bluetooth: Kconfig: Reorder Bluetooth options behind single switch
This way we split all Bluetooth options behind a single switch.

Change-Id: Ia7a4b22842be4c0bf94bb73a6b39fd9f606db406
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-06-06 13:20:37 +03:00
Johan Hedberg
6d93cbb627 net: tests: Refactor net_buf tests for easier extensibility
Change-Id: I23380b1c78b5a9c8814c037a2d48b3505c99f6ea
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-06-06 11:22:23 +03:00
Johan Hedberg
7029d6ed62 net: tests: Remove unnecessary microkernel ifdef for mainloop
Change-Id: Ifbf41aeece7f889eb8f4e836c59df5e830882942
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-06-06 11:22:23 +03:00
Szymon Janc
8fc854029a Bluetooth: L2CAP: Fix reject command
Command reject may contain optional data depending on reject reason.

Change-Id: I0665f44e2adfbf03daa1625519530cabe247631e
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-06-06 08:21:06 +00:00
Johan Hedberg
8919bdc573 net: tests: Update net_buf test
Add testing for fragmented buffers to the net_buf test.

Change-Id: Id6c541b86c30ac94931a7086ebb6f1312fbc34f7
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-06-06 08:17:24 +03:00
Johan Hedberg
d10d1b21f5 net: buf: Don't use recursion for freeing fragment list
Freeing the fragment list by recursively calling net_buf_unref() is
elegant but dangerous. Since we have fairly small stack sizes it'd be
possible to overflow the stack if the user creates a very long list of
fragments (empirical tests showed that some 21 fragments is enough to
kill a 2k stack). Instead, use a while-loop for freeing up the
fragments, thereby guaranteeing a fixed upper bound for net_buf_unref()
stack usage.

Change-Id: Ibfe794fa717d1cddc84365c7b7b9cff4024edbf6
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-06-06 08:17:24 +03:00
Johan Hedberg
7720f6ed1c net: buf: Introduce support for fragmentation
Introduce support buffer fragment chains that are linked together.
This is done with the help of a flag while the buffer is inside a FIFO
(indicating that the next fragment follows it in the same FIFO) and
with the help of a "next" pointer while the buffer is outside of a
FIFO.

In order to do proper "marshaling" a new net_buf_put() API needs to be
always used when inserting a buffer into a FIFO. Respectively, the
net_buf_get() and net_buf_get_timeout() functions are extended to
support getting buffers from arbitrary FIFOs and reassemble the
fragment chain based on the flags that the received buffers contain.

The insertion of a fragment chain using net_buf_put() into a FIFO is
done atomically with the help of irq_lock/unlock since FIFOs support
multiple writers, however since there's ever only a single reader per
FIFO similar locking is not necessary there.

Change-Id: I0ec579f63ea8d063f50e3f1f4c2e80ec399622d7
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-06-06 08:17:24 +03:00
Szymon Janc
ab9f70d867 Bluetooth: Add debug with currently set random address
This makes debugging easier when HCI monitor is not used.

Change-Id: I0f4480266fd745163f2fd789bedc3bf8f2a3ceb4
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-06-06 04:46:04 +00:00
Szymon Janc
61c2353fc0 Bluetooth: shell: Fix missing new lines
This makes shell logs cleaner.

Change-Id: I5ecc751e3062b9cb581471c5399dd01decc9fa57
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-06-06 04:45:30 +00:00
Johan Hedberg
118a36fc26 net: tests: Fix returning net_buf to free pool
When using a custom destroy callback it's the responsibility of the
callback of placing the buffer back in the free pool.

Change-Id: I5ff99c32bcb31ccc5eb0fad544d86b0c830e7051
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-06-05 19:28:54 +03:00
Geoff Gustafson
dbbe089aa1 doc: Fix remote debugging instructions on Arduino 101
If you pass arduino_101_factory, it expects a directory with that name,
but really the directory arduino_101 contains the factory config.

Change-Id: I12ce11c0e32a9d50998b52c2e2c16780b6ce00da
Signed-off-by: Geoff Gustafson <geoff@linux.intel.com>
2016-06-03 23:10:38 +00:00
Geoff Gustafson
3875463b36 doc: Fix typos and styling for clarity on coding conventions page
Change-Id: Ifb8a75869ee3d9fa8cab33c146a1fe9bd1fa8f27
Signed-off-by: Geoff Gustafson <geoff@linux.intel.com>
2016-06-03 14:49:03 -07:00
Anas Nashif
b67baefefd tests: fix build test configuration
Change-Id: I14f2c0a1c80f0c128db6a5d24830cc31c46308d1
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-06-03 18:42:33 +00:00
Baohong Liu
44f0481979 drivers: gpio: Fix a gpio port read bug
address was passed to QMSi port read function, even though
value is needed.

Change-Id: I6b923fdc56114936fb4a0c55c923d6b37884e07c
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-06-03 16:36:25 +00:00
Anas Nashif
6f6504c447 Zephyr v1.4.0
Change-Id: Iedb103de08349c3a046247cbdcf6498126765d72
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-06-03 12:17:40 -04:00
Anas Nashif
659ff5002f sanitycheck: update the footprint data
Change-Id: I6686e46a5f3c5649fc1781119f388feb8179b853
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-06-03 12:09:26 -04:00
Carles Cufi
a155617858 nrf52: Use nrf.h instead of *nrf*.h
Include nrf.h instead of directly using the specific header
required. This will be useful in the future when additional
Nordic ICs are supported.

JIRA: ZEP-377
Change-Id: I7a7257b0aaa5fa0a0d202322c366efbdd1d84458
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-06-03 04:41:26 -07:00
Carles Cufi
7da47626fb nrf52: Provide Nordic MDK compatible macro based on SoC series
Translate CONFIG_SOC_SERIES_NRF52X to NRF52, which is the macro
expected by the Nordic MDK headers.

JIRA: ZEP-377
Change-Id: Ic846e4cddf8146ae9d96bc98d4b12311552dc4f6
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-06-03 04:41:26 -07:00
Carles Cufi
a6119ac9b6 ext: Update and extend Nordic MDK header files
Update to version 8.6.0 and include nrf.h and the additional
files it requires for nRF52. This is so drivers targetting the
nRF Family can include nrf.h directly instead of *nrf5*.h

Origin: Nordic MDK 8.6.0
URL: http://www.nordicsemi.com/eng/Products/Bluetooth-Smart-Bluetooth-low-energy/nRF52832
Maintained-by: External

JIRA: ZEP-377
Change-Id: I71ad9828e1cf95e4d6ef09182a24f00e7d9f01ad
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-06-03 04:41:26 -07:00
Johan Hedberg
6011ad8af5 mailmap: Add more entries for incomplete author information
More commits have ended up in the tree with incomplete author
information. Add entries for these to .mailmap so at least
git shortlog shows them correctly.

Before:

     3  Aceves
     3  ktseng
     1  bitpathe
     1  cacu

After:

    19  Gerardo Aceves
     3  Kuo-Lang Tseng
     1  Bit Pathe
     9  Carles Cufi

Change-Id: I793f1fb0f5aee25ee189d2102ef88ee24ac348d6
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-06-03 10:52:22 +00:00
Bogdan Davidoaia
86589c60d4 samples: environmental sensing: fix BMP280 kconfig options
Update the prj.conf file, as the driver and Kconfig options for the BMP280
sensor were renamed to BME280 the following commit:
	310ed1e sensor: add support for BME280

Change-Id: If3d81d90c269883aa51ff04a12f8fd1aa444a592
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-06-03 12:00:20 +03:00
Bogdan Davidoaia
73e6eaf040 environmental sensing: add support for MyNewt Bluetooth firmware
Add support for using the MyNewt Bluetooth firmware with the
environmental sensing sample.

Change-Id: I7e5050bc9d1f0edb0df007dd3db4f7e6abd60136
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-06-03 12:00:20 +03:00
Rodrigo Caballero
c00cbb7bbf doc: Edit power management technical content.
Edited content for clarity, correctness, completness, markup usage and style.

Change-Id: I526ecf9ce9a2f516cbb01cc38763ef4f71ee52d9
Signed-off-by: Rodrigo Caballero <rodrigo.caballero.abraham@intel.com>
2016-06-03 00:44:10 +00:00
Anas Nashif
8b29fb720c Zephyr v1.4.0-rc3
Change-Id: I74707d577deb7f2001c85730a1bbdf9fe1fc39ac
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-06-02 19:54:05 -04:00
Andrew Boie
9d3bc9a398 MAINTAINERS: add Andrew for sanitycheck
I wrote it, might as well..

Change-Id: Ie85b81754175dd7db7c2b431d6341aa838801f0f
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-06-02 19:21:44 -04:00
Andrew Boie
7a87f9f500 expr_parser: support ':' operator
Similar to '==' but compiles the RHS into a regular expression
and attempts to match whatever is in the environment against it.

Change-Id: I7a03452ef88d067b62661d14dc6f42273de436fa
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-06-02 23:10:07 +00:00
Andrew Boie
99c0f64b34 expr_parser: fix concurrent use issues
Change-Id: Ic9ef5d42f4348ada5c418a36118660e79a1a689b
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-06-02 23:10:07 +00:00
Andrew Boie
5aaf5f1c6f expr_parser: support single-quoted strings
Change-Id: I00af87ac3ebd1d63ceba0bb2c9dcf17f56aa8177
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-06-02 23:10:07 +00:00
ktseng
837c7629bb maintainer: add sections for power management, shim drivers, and
flash driver

Change-Id: I85af1365d19b2a880864b6732c7733d6490b4a69
Signed-off-by: Kuo-Lang Tseng <kuo-lang.tseng@intel.com>
2016-06-02 23:09:31 +00:00
Anas Nashif
1cb62d0372 i2c: qmsi: use I2C_SPEED_FAST_PLUS from API
Do not use the QMSI specfic define, use the one define in the
i2c API instead.

Change-Id: I979673e35060d041cb97f4de178069e2bdfd2c7b
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-06-02 13:46:44 -04:00
Anas Nashif
5b202557d3 adc: qmsi: remove obsolete usage of QM_RC_OK
Change-Id: Ia34cc9d8b8b37a9157499be0843c5a42fec9a380
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-06-02 12:21:10 -04:00
Szymon Janc
05bdba7768 Bluetooth: Fix clearing BT_DEV_ENABLE on HCI reset complete
BT_DEV_ENABLE flag value must be preserved after HCI reset is complete
to not allow calling bt_enable more then once.

Change-Id: I77bf6111d4fc2a209e0c5a56717decba156068a6
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-06-02 13:37:25 +00:00
Szymon Janc
07fb2e106b console: shell: Reduce stack usage of tab completion
Print commands names when matched instead of first creating
completion string in buffer. Common part of commands names
can only be reduced when matching further commands so only
first match needs to be kept for altering command line.

Change-Id: I5a9d2eb171ef4d31da9cbe6e93b577457b13c5a2
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-06-02 13:28:15 +00:00
Chuck Jordan
789c33e31b board: em_starterkit doesn't have FLASH_SCRIPT yet
I see in the TOP makefile that if FLASH_SCRIPT is undefined,
it outputs the message "Flashing not supported with this board".
This behavior is wanted currently as this board does not
have a memory mapped FLASH device. It has a SPI-FLASH and
there are different instructions for putting an image on to the board.

Change-Id: I07dcdd9a7fd8346b846ee0fe1312d22f9ffaa13e
Signed-off-by: Chuck Jordan <cjordan@synopsys.com>
2016-06-02 12:37:13 +00:00
Johan Hedberg
e8620aaada Bluetooth: Take advantage of net_buf_get_timeout()
Use the more explicit net_buf_get_timeout() call where it makes sense
(e.g. where we always want to wait or never want to wait).

Change-Id: Id1eabe0ad2f9fa79f7be39e51fefa5161f9cc550
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-06-02 10:32:29 +00:00
Johan Hedberg
6e4d2a9e0e net: Add net_buf_get_timeout() API
With this API it's possible for the caller to force specific behavior
when it comes to waiting (or not waiting) on the FIFO.

Change-Id: Ib66e2f767c26c82abf1ba3b80bd15aec2383542e
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-06-02 10:32:20 +00:00
Andrei Emeltchenko
2b456dd120 drivers/nble: Implement on_nble_sm_security_request_evt()
Implement handling SM Security Requests. Fixes among others following
Bluetooth PTS test cases:

...
1/6   GATT   TC_GAR_CL_BI_05_C   PASS
2/6   GATT   TC_GAR_CL_BI_22_C   PASS
3/6   GATT   TC_GAR_CL_BI_27_C   PASS
4/6   GATT   TC_GAW_CL_BI_06_C   PASS
5/6   GATT   TC_GAW_CL_BI_24_C   PASS
...

Change-Id: Id35004a134bb9898e3b0dd51309f1762676ca579
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-06-02 12:08:54 +03:00