Commit graph

41120 commits

Author SHA1 Message Date
Andrei Emeltchenko
8e18fa8903 arduino_101: Do not duplicate GPIO select
GPIO would be selected by BLUETOOTH_NRF51_PM

Change-Id: I5d920723a46c1455d34c90c9dc43b21b91569ce1
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-04-14 15:22:58 +00:00
Szymon Janc
c2a1ac8ae7 Bluetooth: Add support for confirming incoming JustWorks pairing
If incoming pairing request would result in JustWorks pairing this
can be used to request consent from user for accepting it.

Change-Id: If0695d0e1bb010bade6a16abe1b57a2ce07856cc
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-04-14 15:20:03 +00:00
Andrei Emeltchenko
931afc81a4 drivers/nble: Fix spelling typo
Change-Id: Ibe5c910a69fccdf4375738ec13cbea9d6c972a41
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-04-14 14:48:51 +00:00
Szymon Janc
d11824ff58 Bluetooth: SMP: Refactor pairing request handling
This is in preparation for adding support to confirm incoming pairing
requests. smp_pairing_req is now more similar to smp_pairing_rsp making
code easier to follow.

Change-Id: Ie5a77ae5092b7bbf76a482d0bd49e022c4d19d70
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-04-14 14:44:43 +00:00
Grzegorz Kolodziejczyk
2bae7b4c5f Bluetooth: drivers/nble: Fix returning included service handle
Parse include function intention is to return last parsed included
service handle. Next discovery iteration of included services should be
started from last found included service handle instead of end handle
from included handle value (which contains attribute handle of included
service declaration and the end group handle, BLUETOOTH SPECIFICATION
Version 4.2 [Vol 3, Part G], 4.5.1).

Change-Id: I73fe4027cb616242e838ea54c61b7780f1838e52
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-04-14 13:47:26 +00:00
Mariusz Skamra
ff8b88b634 drivers/nble: Fix handling read errors
If on_nble_gattc_read_rsp returns an error, this error shall be
passed to the application to let know that Read Request/Read Blob Request
was aborted due to ATT error received.

Change-Id: I0efe26ec90fe27a1ab3c791e555ebe682927ab57
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-04-14 12:42:09 +02:00
Mariusz Skamra
5047d54403 drivers/nble: Fix compare logic in on_nble_gattc_read_rsp
The Read Response only contains a Characteristic Value that is less
than or equal to (ATT_MTU – 1) octets in length so, condition
(length < bt_att_get_mtu(conn)) is always true, and the full
Characteristic Value will not be read.

Change-Id: Ib18fbedf277c880dc5cf0ce21fd7d550d12a64ef
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-04-14 12:41:39 +02:00
Tomasz Bursztyka
c239a8cb7b cc2520: Properly start and stop the device
Disable reception and the oscillator as well when stopping. Revert
when starting.

Change-Id: I2a61066602267ac61e691ec9c20eb243de6fa076
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-04-14 07:49:23 +00:00
Tomasz Bursztyka
d8dcf56334 cc2520: Enable hardware filtering all the time
This prevents false packets to get accepted/generated into RX fifo.
Also, this will make AUTOACK working properly, when enabled. For some
reasons FRMFILT1 and SRCMATCH need to get their reset values written at
initialization, or then hw filtering won't work. This behavior is not
documented as it seems.

Change-Id: Ic0fe664dbc3b17d85d794c12b77bdbaafeb601f5
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-04-14 07:49:23 +00:00
Tomasz Bursztyka
a9af3c0512 cc2520: Set short address and ieee address from the driver
For hw filtering and autoack to work, all the information should be
properly set in the chip.

That's a fix for the legacy radio/net API. From original code, these
were set from the application which is bad. But setting it from the
driver is not any better. ieee802154 and net stack should know what to
do, that will be fixed in the future.

Change-Id: I1688223e9488d10a423e788eb88ba1e251cb3f88
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-04-14 07:49:23 +00:00
Tomasz Bursztyka
af33e21017 net: Test random is necessary to use CC2520 as radio driver
It will not build without it. Generalize it then.

Change-Id: I334586f629de1f057e654a13a1c705cd559b44d8
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-04-14 07:49:22 +00:00
Javier B Perez
3186d30ea6 doc: sphinx conf: use env var in sphinx doc version
Changed conf.py to use env var in the version of documentation.
CI can take advantage of this to name documentation using
tag version from git.

Change-Id: If59f800ccd37648a9c0dab6c948b13166a7f4aed
Signed-off-by: Javier B Perez <javier.b.perez.hernandez@intel.com>
2016-04-13 23:42:18 +00:00
Bogdan Davidoaia
176c2525a6 sensors: bma280: fix slope threshold measurement unit
Slope threshold attribute values should be received in m/s^2 instead
of Gs, since accel channels return data in m/s^2.

Change-Id: I0669345ff8af8559e47895bca8225e15d2576a06
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-04-13 17:27:08 +00:00
Bogdan Davidoaia
69793bb320 sensors: use SENSOR_G constant in all accelerometer drivers
Use the SENSOR_G constant from sensor.h in all accelerometer
drivers, instead of having the constant redefined in each
driver header file.

Since GRAVITY_CONST was measured in mili-m/s^2 and SENSOR_G
is measured in micro-m/s^2, some changes to the calculation
of the acceleration data were added.

Change-Id: Ia323dfc46bee00035e24b37e1b7fbc886dfbe029
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-04-13 17:27:08 +00:00
Gerardo Aceves
46e5fc6330 doc: Edit microkernel API links
Edited the microkernel API sections to get the proper linakage.

Change-Id: I1bc95c6e21ed996c4c5d72188c5f018038e3e958
Signed-off-by: Gerardo Aceves <gerardo.aceves@intel.com>
2016-04-13 15:04:04 +00:00
Daniel Leung
756b90b01f flash/spi_flash_w25qxxdv: do not set driver_api if init fails
If the driver fails initializations, do not set the driver_api.
This follows the idea that device_get_binding() will not return
a reference to the driver instance when driver init fails.

Change-Id: Iff56b4150658a76567928b1fd166bde5d2848d52
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-12 23:52:10 +00:00
Anas Nashif
3cf33cb0d8 doc: remove usage of sudo and reduce notes
Change-Id: I67cf7d6537c429df304fc3fa89c8d68c702c646a
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-04-12 22:52:45 +00:00
Anas Nashif
a1ae6fdcdf doc: remove networking configuration section
Change-Id: Ia5990d7dfdc7abbefa28f7e6b9d060a14758332e
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-04-12 22:52:45 +00:00
Anas Nashif
d0c5eaf4a0 docs: Getting Started overhaul
- Put everything in one page and simplify workflow.
- Fix indent and layout

Change-Id: Ifd9d11531c9b906324cf87cf401cbce416cc01a4
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-04-12 22:52:44 +00:00
Anas Nashif
2a8560e06d doc: make naming conventions apply to none kernel functions
Change-Id: I0204a0131959ed665ea6a61a0de48f2d808bb448
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-04-12 22:52:44 +00:00
Anas Nashif
c2170dfca9 doc: fix wording in device documentation
Change-Id: Ie1e9f908797d1c3473ad36acd0b10d205e665e81
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-04-12 22:52:44 +00:00
Anas Nashif
9daa1076cb docs: remove notes from bluetooth document
Integrate the notes into the actual steps, notes are usually understood
as optional and disturb the actual flow.

Change-Id: If3168581ca130bd506bc44c353acc082dfa003fd
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-04-12 22:52:43 +00:00
Anas Nashif
4dd845db13 doc: Fixed structure in collab guide
Merge documents and improve structure. Avoid too many jumps to get
to the information and avoid single paragraph pages.

Change-Id: Ifed4fa90d1105022bfe87e6d078845938e13bd3a
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-04-12 22:52:43 +00:00
Anas Nashif
530a422a98 doc: create subsystem section
Add sensors and networking into the new section and seperate
those from the kernel documentation.

Change-Id: I585845c3ba09173ced7caa0b7fbc1f1a81a26f96
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-04-12 22:52:43 +00:00
Anas Nashif
73fcb9f503 doc: move device driver to a new section
Put all device drivers and device model documentation into one
section.

Change-Id: Iba6a50796b02b7f9234c23dca706be62fd7b4259
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-04-12 22:52:42 +00:00
Jukka Rissanen
12485eb8c9 cc2520: Make the generated MAC address to look more random
Because the random number generator is very dumb at the moment,
the generated MAC address has always last byte set to 0.
The MAC address is used when generating IPv6 address.
In order to avoid IPv6 address collision, swap the last four
bytes of the MAC address so that the most random data is
at the end of the MAC.

Change-Id: I96c03654359e32f407bab3b29be0e3b08ee91bd7
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-04-12 16:27:21 +03:00
Jeremie Garcia
5e6da236cb net: fix uip_udp_conn leak
On each net_receive() call with different destination and/or port,
µIP stack consumes a uip_udp_conns[UIP_UDP_CONNS] entry.
As net_context_put() doesn't free it up, Zephyr applications can very
quickly reach the point where it can no more create new UDP connection
(default UIP_UDP_CONNS value is 10).

This patch is both IPv4 and IPv6 compliant.
It modifies net_context_put() so that it frees up such entries if
a UDP connection is registered for the context provided as argument.

Change-Id: I9abe686c81368231d4443fc53da9038761a1787d
Signed-off-by: Jeremie GARCIA <jeremie.garcia@intel.com>
2016-04-12 12:40:41 +00:00
Daniel Leung
00525c2acf sanitycheck: align output for easier visual comparison
() The test names are getting longer so adds more padding.
() Aligns the numerical size numbers for easier visual
   comparison when scrolling in shell.

Change-Id: Id218a641e9d5dffb77bf813ffbd828c48d14020f
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-12 12:00:47 +00:00
Anas Nashif
11ee55a6cc openocd: make openocd variables overridable from env
Some boards require a newer version of openocd, this will
allow overriding the default version that comes with the SDK.

Change-Id: I70113182c3a2c8610e3b36542c6057ff3f0df547
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-04-12 12:00:05 +00:00
cacu
124feb27c5 build: Add a toolchain file for the GCC ARM Embedded toolchain
Change-Id: Iea501d30297123955fd699eb7d53e642949b6af7
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-04-12 11:59:38 +00:00
Daniel Leung
3257193c6d serial/uart.h: no need to check driver_api being NULL
The device_get_binding() no longer returns pointers
to device struct when driver_api is NULL. Therefore,
there is no need to check for driver_api being NULL
in the serial driver wrapper functions.

Change-Id: I018a409324d7c1ae83c699a3ebf30f2f2abfb3b3
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-12 19:30:35 +08:00
Daniel Leung
dd5e90ec6c device_get_binding() returns NULL if driver_api is not set
This changes the behavior of device_get_binding() so that
it returns NULL if driver_api is not set. This provides
a way for driver to state that it has not been initialized
properly, and prevents app from using it since no reference
to the device struct will be returned.

This implements the idea specified in [1]. The idea is to
reuse an existing resource by piggy-backing onto driver_api,
thus avoiding an extra "device state" variable in the device
struct. This differs from the code specified in the mailing
list by checking driver_api for NULL first. This avoids
the unnecessary strcmp() if driver_api is NULL.

[1] https://lists.zephyrproject.org/archives/list/devel@lists.zephyrproject.org/message/MZB5PYBSRHV3NIEHJYXYQVLTPFIIHPB3/

Change-Id: I978b1a6683cd56c8a72532d6368c47e67515c82d
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-12 19:30:35 +08:00
Daniel Leung
90e93dce05 spi/intel: move driver_api assignment later
This moves the assignment of driver_api to just before
the init function returns. This is in preparation to
make device_get_binding() return NULL if driver
initialization fails.

Change-Id: I69590c463b84877d250c63d4460b7e254b79c8b3
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-12 19:30:35 +08:00
Daniel Leung
1870f95364 uart/nsim: fixed missing driver_api assignment
Change-Id: Icbda7600b808fa0338e4d672ccca1b969b6f5867
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-12 19:30:35 +08:00
Daniel Leung
b8e887a112 gpio/pcal_9535a: move driver_api assignment later
This moves the assignment of driver_api to just before
the init function returns. This is in preparation to
make device_get_binding() return NULL if driver
initialization fails.

Change-Id: Ibf08cb107885da7c1037c6e7d207530e1a4708f8
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-12 19:30:35 +08:00
Daniel Leung
aa98192cad pwm/pca_9685: move driver_api assignment later
This moves the assignment of driver_api to just before
the init function returns. This is in preparation to
make device_get_binding() return NULL if driver
initialization fails.

Change-Id: Ia0c7a0014eb28624cbf363f994d6149f1aa5aadd
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-12 11:25:03 +00:00
Baohong Liu
5ba89ffdea samples: A test app for spi flash
Demonstrate the use of SPI flash driver API on Arduino 101 board.

This is a re-submit of a previous merged patch which was reverted
because merge sequence was incorrect (the test app got merged
before the driver).

Origin: Original

Change-Id: I3fce61488ed7d48f400c12448f1c7a01c555661c
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-04-12 09:59:33 +00:00
Vlad Dogaru
b2419abfbc gpio: dw: Activate by default on D2000
Change-Id: I4b5a72ee086fae7c3d29311cd138af28d329f635
Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com>
2016-04-12 09:58:00 +00:00
Johan Hedberg
bacdf02061 Bluetooth: drivers/nble: Fix minor coding style issue
Change-Id: I71caf45702f053033fde5c5c0bc4dea22dbe95d1
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-04-12 12:33:24 +03:00
Andrei Emeltchenko
e12cf24e6d drivers/nble: Implement multiple read in bt_gatt_read
Implement read multiple characteristics in bt_gatt_read().

Change-Id: I18c11275e4352bfc571b06558116bcbb9b4a32d3
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-04-12 12:09:08 +03:00
Andrei Emeltchenko
424cf4f9d2 drivers/nble: Update RPC to Nordic BLE Module
Add read multiple attributes request and response. Update RPC version
to niko-0412.

Change-Id: I5dfd99a1b8af866b69eae230ad24304eafccab4d
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-04-12 10:32:41 +03:00
Peter Mitsis
5aaf7ab930 nano_fifo: Fix problem with nano_fifo and timeouts
Fixes a problem where the nanokernel FIFO state information could get
out of sync due to a timeout.

The nanokernel FIFO structure nano_fifo now maintains two separate
queues: one for waiting fibers and the other for posted data. This
permits the safe and independent querying of the queues as needed
when getting and/or putting data from/on the nanokernel FIFO.

Change-Id: Ifbcb5004558b06fc55cad2a955f5be20e716b392
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-04-12 01:22:42 +00:00
Arkadiusz Lichwa
af2deb8dea Bluetooth: BR/EDR: Move up code in conn.c
Moves up and consolidate the BREDR specific code to skip certain forward
declaration and to prepare for possibility to initiate authentication
using start_security() routine.

Change-Id: Ic32d7d1376173d47b0eb0481eff37c6e56f995d4
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-04-11 19:15:24 +00:00
Mariusz Skamra
550d031107 Revert "Bluetooth: Fix compare logic in ATT read rsp"
This reverts commit 3d08d16780.

The Read Response only contains a Characteristic Value that is less than or
equal to (ATT_MTU – 1) octets in length so, condition
(length < bt_att_get_mtu(conn)) is always true, and the full Characteristic
Value will not be read.

Change-Id: I63280e65b4ff5b830295aa9aadebe2758b626912
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-04-11 15:24:33 +00:00
Andrei Emeltchenko
37ef89511d drivers/nble: Correct auth configuration for No Input / Output
Change-Id: I5d1a9508ca8deca97149db2faa2f3406517e3b05
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-04-11 15:24:24 +00:00
Szymon Janc
01f80c48ff Bluetooth: shell: Use same config for arm and x86 build
There is no need to have separate configs as init sample is now
used for different build configuration tests.

Change-Id: I917692f8a8e96345afc561dd04bdcf08cdfa5de7
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-04-11 11:54:07 +00:00
Arkadiusz Lichwa
435ccd3e81 Bluetooth: BR/EDR: Refactor internals of 'Cancel' authentication API
For better code readability use 'switch-case' statement selecting valid
authentication cancel method. Adds also legacy pairing (pre-SSP) as first
item in valid paring method set.

Change-Id: I4d9c5178526cd5210b844878360d12b58b99a24f
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-04-11 11:53:31 +00:00
Arkadiusz Lichwa
8f844fac29 Bluetooth: BR/EDR: Rename pair method field
Refines pairing method holder name to be more generic in connection object
representing applied method during authentication process.

Change-Id: Ia6f51788912974fbbda26b760d187c0f7e24bb0b
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-04-11 11:53:10 +00:00
Johan Hedberg
54425117d0 Bluetooth: Export helpers for defining buffer pools
Now that the incoming ACL & HCI event pools can be defined externally
to hci_core.c there should be convenience macros to know what's the
minimum required buffer size for these pools.

Change-Id: I6f2a7322a3d77e1304e9d925767a1fd3471c76c7
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-04-11 11:52:38 +00:00
Johan Hedberg
30601c09bb Bluetooth: Refactor buffer handling for non-host managed buffers
So far the assumption has been that the host stack manages all
incoming and outgoing buffers. For the incoming buffers (from the
controller) this has required hci_core.c to manage its own pools and
do the host flow control. This setup makes perfect sense for an
architecture where the controller resides remotely on a different CPU
& address space (i.e. the "traditional" HCI transport case).

When the stack runs on a system where the controller resides in the
same address space this setup doesn't work that well. In such a
scenario the incoming buffers are ideally created as low down in the
stack as possible (i.e. below HCI), which means that the current
hci_core.c cannot be responsible for managing their pools.

To allow for both types of architectures this patch introduces a new
BLUETOOTH_HOST_BUFFERS Kconfig option that can be selected to say that
host-side management is desired, or deselected to say that the
controller (residing in the same address space) takes care of managing
the incoming buffers.

So far the incoming buffer types were identified by hci_core.c by
looking at their "free pool" pointers, however as soon as the pools
are allowed to be somewhere else this doesn't work. To solve this we
now require a minimum user data size for all Bluetooth buffers and use
that to store the buffer type.

Change-Id: I14bc32007e3e3f17c654f71f79b520650028d7ce
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-04-11 11:52:29 +00:00