Commit graph

19237 commits

Author SHA1 Message Date
Daniel Leung
793da30039 serial/uart_ns16550: convert to use DEVICE_AND_API_INIT()
Note that the failure case can only be reached when PCI is enabled.
Otherwise, the if-block is always false, which reduces code size
for non-PCI platforms.

Change-Id: Ib98b78a75cc2a5f124e67f32f2bf82960a963aec
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-15 22:06:10 +00:00
Daniel Leung
0ac7c72e7b clock_control/quark_se: convert to use DEVICE_AND_API_INIT()
Change-Id: Ib3aa021b8e8c32079d5800b3f2ffc9f9fabdb4b6
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-15 22:06:09 +00:00
Daniel Leung
ab38abff12 pinmux/dev: convert to use DEVICE_AND_API_INIT()
This converts the pinmux/dev drivers to use DEVICE_AND_API_INIT(),
since the driver_api assignment will never change.

Change-Id: I0063b19e2afe932e1daf3255e718455aaa200ff1
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-15 22:06:09 +00:00
Daniel Leung
ce2e4ebdf1 device: add macro to assign driver_api at compile time
This adds the DEVICE_AND_API_INIT() macro to take in a parameter
to assign to device->driver_api. This eliminates the need to
assign to driver_api during runtime device initialization.

This provides an alternative way to declare devices. This should
save a few bytes in ROM for those devices that will never fail
initialization (in other words, never need to manipulate
driver_api pointer at all).

Also clean up the documentation a bit to remove duplicated
block of information.

Change-Id: I6abed1abe75db2e8babfcf1ecf590491132a5543
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-15 22:06:09 +00:00
Arkadiusz Lichwa
26a8dcd2c1 Bluetooth: L2CAP: l2cap_chan_get() can get BR/EDR L2CAP SIG channel
Enables to get right channel reference on both connection transports,
LE and BR/EDR.

Change-Id: Ia577963132e3a600cd9a95b90f218a5bffee8e58
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-04-15 19:15:20 +00:00
Daniel Leung
f9f10f37fe doc: counter should be under device driver
Adds the missing @ingroup for counter API so it appears
under device driver category.

Change-Id: I763faab802d3a6453ab46ee969b5ffd082282f1d
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-04-15 18:42:17 +00:00
Arkadiusz Lichwa
c94cfbd4db Bluetooth: L2CAP: l2cap_send_reject() can use BR/EDR L2CAP SIG channel
The L2CAP reject command can now be propagated over both connection
transports, LE and BR/EDR.

Change-Id: Ie8466490ed205e194a586646f496ebfce5ceea70
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-04-15 18:35:14 +00:00
Flavio Santes
051a37dbd7 wdt: update sample code
Remove wdt_fired, whose existence is irrelevant.

Change-Id: I27e5f5fe449423cd747b34fc6a38d261ae02d1e3
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-04-15 18:28:26 +00:00
Andrei Emeltchenko
8418b2eeb3 drivers/nble: Implement read multiple response
Implement on_nble_gattc_read_multiple_rsp().

Change-Id: I25e8e7f74325024fde1737086e4674893f4a105a
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-04-15 17:02:11 +00:00
Grzegorz Kolodziejczyk
52e5c91f37 Bluetooth: Remove redundant returns from switch
Primary and secondary service attributes discovery uses att_find_type,
include service and characteristic uses att_read_type.

Change-Id: Ia3539b446a4afb5c72bc1aba443167be6f893d0d
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-04-15 17:00:44 +00:00
Mariusz Skamra
1cfccfda84 Bluetooth: tester: Start using net_buf to store GATT database
With this patch net_buf based heap will be used to store attribute
user_data and UUID. This is the first step to remove gatt_buf.

Change-Id: I578f26b781e01f5f3464c05f7210dc27cdea8edf
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-04-15 16:51:40 +00:00
Andrew Boie
15800ce78a nanokernel: deprecate dynamic IRQs
We have not found any use-cases for dynamic IRQs where a static
IRQ did not also suffice. Deprecate so that we can eventually
remove from Zephyr and nontrivially decrease the complexity of
the kernel.

Change-Id: I509655371773aeaca7d01134dd850eb4cd95f387
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-04-15 16:02:12 +00:00
Andrew Boie
a83f895dd5 microkernel: deprecate task IRQs
This mechanism does not add enough value to the kernel to be worth
maintaining it. Drivers that need deferred processing of interrupts
can simply define their own task and have the interrupt handler
release an event that the task waits on.

The API is marked as deprecated and it is removed from unit test
coverage as well as the documentation.

Change-Id: Ib87b91cb41e9b6d7fdf0dc62b240a531b6a8889f
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-04-15 16:02:12 +00:00
Grzegorz Kolodziejczyk
38b202e810 Bluetooth: tester: Update server commands with sequence params
Most iuts data base are intended to have its attribute database builded
in sequence and its constant (except attribute values, parameters,
permissions). Patch allows btp specification to cover also devices
which cannot assign an ID right after issuing add attribute command or
set attribute component (which points to defined attribute ID).

Change-Id: Ie8e5ed223609cca2b6e3fb8444065f33b1408142
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-04-15 15:14:23 +00:00
Mariusz Skamra
1bc53f3f47 drivers/nble: Fix NULL pointer dereference
This fixes conn->gatt_private = NULL pointer dereference that occurs
in the next Read Blob Response, here:

/* TODO: Get params from user_data pointer, not working at the moment */
params = conn->gatt_private;

Change-Id: Icf280c856133a4c91fc10475d3a047809f917f46
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-04-15 11:04:20 +02:00
Szymon Janc
cdd5851715 Bluetooth: shell: Add confirming incoming JustWorks pairing
This allows to accept or decline incoming pairing that would
otherwise result in JustWorks pairing.

Change-Id: I759ea067ef298b437e0112b8b7ef3bedf106dc52
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-04-15 04:57:41 +00:00
Andrei Emeltchenko
9e158899eb quark_se_devboard: Do not select GPIO
GPIO is not needed for quark_se_devboard for now when dealing with
NBLE.

Change-Id: I0dedf2bee0af153e1d6e224d90f4662f5601b2b7
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-04-14 15:23:35 +00:00
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