Commit Graph

3743 Commits

Author SHA1 Message Date
Daniel Leung d3d64ca4cf bluetooth/uart: register driver at boot if enabled
The driver should handle the initialization instead of relying on
platform initialization. This is to conform to the driver model.

Change-Id: Idc95d59bce2470b5118e416ee05f07548991a15c
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:48 -05:00
Dmitriy Korovkin 470ce8482c Initialize UART irq number statically
When PCI bus is not enumerated, I/O memory and IRQ
numbers need to be statically initialized.

Change-Id: I4efcccd95d8048910f6c900c8daf46cbe3a5fa00
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
2016-02-05 20:24:48 -05:00
Allan Stephens 3a60fd4e27 doc: Update descriptions for memory pool APIs
Standardizes appearance, corrects errors, improves readability,
and fills in gaps.

Change-Id: I3f8029ab5ae6f1f09f927471a395a357cc8c2c94
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:24:48 -05:00
Peter Mitsis 2920c72915 galileo: Disable features in minimal footprint
Prevents unnecessary features from bloating the size of the galileo's
minimal footprint benchmark project.

Change-Id: Ie689a2c6fe1409904c43ec9a24a0efc01e768e4c
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:24:48 -05:00
Anas Nashif 140392198d x86: add missing parameter documentation
The new flags parameter needs some documentation.

Change-Id: I24dc9df62323957bb4b294adf27487df3f76ea01
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:48 -05:00
Benjamin Walsh d75d4fb6ce test: remove task_event_handler_set with invalid ID test
task_event_handler_set() only does event ID validation using __ASSERT(),
which cannot be easily tested automatically.

Change-Id: I060e3aa5b31f0a312e328e89db6f20cd800e9c5d
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:24:48 -05:00
Benjamin Walsh 15d3ca1de6 events: add __ASSERT()s in APIs to validate event IDs
Event ID are not validated anymore against the maximum event number in
the system, since they are pointers now instead of low integers.
Validation can be useful, but only do it in a debug kernel, with no
penalty to a deployment system.

Change-Id: Ifd8dc8841892f6d19bbcb0c641a655fd0cb6ddb7
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:24:48 -05:00
Anas Nashif 4378eae1d3 gpio: fix inclusion of local header
since we are in the same directory, include the file directly.

Change-Id: I21c959538e4a3d9e3fba99eaa9b09697fffe25b0
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:48 -05:00
Anas Nashif 9f30c4a8b5 adc: fix inclusion of local header
since we are in the same directory, include the file directly.

Change-Id: I8c676e1e5acd7dbab2c283d914a3ef62c2d36cdc
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:48 -05:00
Allan Stephens dca7f8ccca doc: Update descriptions for memory map APIs
Standardizes appearance, corrects errors, improves readability,
and fills in gaps. Also streamlines descriptions for internal APIs
that don't require the same level of detail as public APIs.

Change-Id: Ic0f8149d14a8dab5e6df28b594c9b2e17f73e7b6
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:24:48 -05:00
Dan Kalowsky 2028db6399 i2c : re-naming interrupt_vector to irq_num
Changing the ROM struct's interrupt_vector to reflect
what the value is properly referencing.

Change-Id: Ifb284821e82e01123c51a848d694da19e442c1e8
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:24:48 -05:00
Andrew Boie f6dd6d5fd8 x86: atomic: don't use '__asm__ goto'
Not supported in LLVM/clang.  As it turns out,
this new implementation is 4 bytes shorter than its
predecessor.

Change-Id: I1f63b7a245dafcfc5a6dadc293875f00d02b997c
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:24:47 -05:00
Anas Nashif 44b71cc1df x86: remove duplicate const
Was exposed when building with clang. No need for a second const.

Change-Id: Ie97f6a4756aff62ce969e3eb786593f2fc175a56
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:47 -05:00
Anas Nashif db26a98c93 Fixed various clang build issues
Fix a few spots where building with with clang fails.

Change-Id: I621c7cb8daf119bf89ad512168d70e1c9b67e53f
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:47 -05:00
Anas Nashif 1b702154b5 kbuild: add clang support
Clang support already existed in the Makefiles but was not complete
and some gcc options did not work with clang. Move those to be conditional
on the compiler used to make clang work.

To build with clang for x86:

make  CC=clang  -C samples/microkernel/apps/hello_world/

You still need the gcc cross environment for various tools.

For now, only x86 was tested.

Change-Id: Ic5aeab4f80d312e1d1312a4a9fc885a43f760270
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:47 -05:00
Peter Mitsis 5c39418ae8 k20uart: Fix check for Rx/Tx irq
Due to a quirk of the k20 UART, when checking if either a Tx or Rx
irq is ready, one must first check whether the UART has enabled the
Tx and/or Rx interrupts.  If this is not done, then all one is doing
is testing the UART to determine if it is ready to Tx and/or Rx.

Change-Id: I08a8280ed9fb0faef586f3c7d7befb3bfdec1e2d
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:24:47 -05:00
Johan Hedberg 7fa137c241 Bluetooth: core: remove unrelated/inaccurate code comment
Change-Id: I41e312b28f8badf211cb9ded3015e7183d10154d
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:47 -05:00
Szymon Janc 856cba6d8b Bluetooth: Read supported commands on init
This will be used to determine if controller supports
"LE Read Local P-256 Public Key" and LE Generate DH Key" commands.

Change-Id: Ib2bf7cfa99a20c07af0d3043ac9f9c2e0a6c2fcb
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:24:47 -05:00
Szymon Janc 217c649a5e Bluetooth: Add HCI definitions used in LE Secure Connections
"LE Read Local P-256 Public Key" and LE Generate DH Key" commands
are used for LE Secure Connections pairing. "LE Set Event Mask"
is used to unmask events generated by those commands.

Change-Id: I601c8e21093ed2170dfe8e5618b34493268fe68d
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:24:47 -05:00
Mariusz Skamra d6c1a09e18 Bluetooth: gatt: Fix missing return and assignment to invalid type
This patch adds missing return call. Destroy was called early,
on read params. This could result in memory violation.

Another thing that has been fixed is assignment of bt_gatt_read
return value which can be negative to uint8_t type.

Change-Id: I1ddfea03038538efd70ad8ac68bd8df308a4ee3c
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:24:47 -05:00
Ravi kumar Veeramally 5e1f26e175 net: buf: Fix net buf debug
Net buf debug doesn't print even CONFIG_NET_BUF_DEBUG enabled.

Change-Id: Icbecc01b47010b7c3448fc3e8c07fd377842b15b
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-02-05 20:24:47 -05:00
Ravi kumar Veeramally ef017fe761 net: apps: Fix incorrect ip buf app data length
ip_buf_appdatalen should be user_data->expecting otherwise
it is zero.

Change-Id: Iedb61a7f0e3516a5643da04b5963a2e241fd8bc9
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-02-05 20:24:47 -05:00
Ravi kumar Veeramally 743de006ad net: apps: Fix function name in dtls-client
Change the init function name to have client string in it,
it is more logical that way.

Change-Id: Ie282151562620858dc78563f2a4e63f7fb4fc472
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-02-05 20:24:47 -05:00
Jukka Rissanen 588f5546b3 net: dtls: Allocate a separate buffer for sending
Instead of using IP bufs for sending stuff, allocate
a separate buffer that is only used in dtls sub-system
to send the encrypted buffer. This way there is no
possibility to deadlock in the dtls write callback
if we run out of buffers.

Change-Id: I45a909a50b6a9c83bb77712d47e968656b980d88
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:24:47 -05:00
Jukka Rissanen 5f8f6a9802 net: tools: Remove the network test tools directory
The network tester tools are not really part of the
Zephyr kernel so remove them from this repo.

Currently the tools code can be found at
git://git-amr-4.devtools.intel.com/zephyr_os_net_tools-tools.git

Change-Id: I6f076d6b32537fe3674b132cccd6c476ee19f6b0
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:24:47 -05:00
Johan Hedberg 572ad555d7 Bluetooth: Fix minor coding style (whitespace) issue
Change-Id: Ie3990f1a75099c2ec9e32c8bfed4a0c008eeeb4a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:47 -05:00
Szymon Janc cf1ec9fb7f Bluetooth: Explicitly set LE event mask on init
This allows to disable events not required by application. In future
this can be extended to enable events that are not enabled by default.

< HCI Command: LE Set Event Mask (0x08|0x0001) plen 8                                                                                 24.018392
        Mask: 0x000000000000001f
          LE Connection Complete
          LE Advertising Report
          LE Connection Update Complete
          LE Read Remote Used Features Complete
          LE Long Term Key Request
> HCI Event: Command Complete (0x0e) plen 4                                                                                           24.019215
      LE Set Event Mask (0x08|0x0001) ncmd 1
        Status: Success (0x00)

Change-Id: I29bfaa0743ac9e604a637f51503ff28a9b2074c2
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:24:47 -05:00
Luiz Augusto von Dentz 32f1e6d27a Bluetooth: L2CAP: Add support for receiving LE Credits
This adds support to receive LE Credits from the remote updating the
tx endpoint.

Change-Id: I0bf565370d50128cb34ffa3ee5f306bc48d56b3f
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:24:47 -05:00
Luiz Augusto von Dentz 0ba6b93793 Bluetooth: L2CAP: Fix sending wrong CID for LE Credits
The CID should be taken from rx endpoint not tx endpoint as the credits
are in fact updated in rx.credits.

Change-Id: I43aed2a08b6fd978244c02c43640a3226d897e45
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:24:47 -05:00
Luiz Augusto von Dentz 602367e708 Bluetooth: Increase BLUETOOTH_HCI_EVT_COUNT
Some controller may actually generate more than 6 events simultaneously
as it seems to be tied with the number of buffers increase it to 8
whenever BLUETOOTH_CONN is selected otherwise default to 4.

Change-Id: I907847f56c2eb2d756513da171ff780aeb544259
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:24:47 -05:00
Arkadiusz Lichwa bd92608d0d Bluetooth: Kconfig: Require LE support whenever Bluetooth is enabled
Enforce enabling LE support whenever Bluetooth support has been selected.
Currently building Bluetooth support without LE is not supported.

Change-Id: I90acabfa06db6045ee24173f62719a776efde740
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-02-05 20:24:47 -05:00
Arkadiusz Lichwa 9e868b39b9 Bluetooth: Kconfig: Add BR/EDR option
Enables turn on classic BR/EDR core support in the stack.

Change-Id: If078a23e38857081538c52e24689bfa423db2307
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-02-05 20:24:47 -05:00
Johan Hedberg fd4d439d72 Bluetooth: samples/shell: Remove dependency on CONFIG_EXPERIMENTAL
There's no reason to depend on this config option, in fact it looks
like it doesn't even exist.

Change-Id: I3e072466700ca7115dfde5af09b08f98707062bb
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:47 -05:00
Arkadiusz Lichwa cb29e6135d Bluetooth: Kconfig: Change topmost option
Refactors existing menu by putting as topmost selectable option
general bluetooth subsystem support instead so far Low Energy (LE).
Implication of the change is introduction of new BLUETOOTH_LE config
flag. The flag needs to be propagated to all existing bluetooth
related apps to make them buildable.

Change-Id: I608c1baad038e0ee4cccf44a3e597e16ae1f7f54
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-02-05 20:24:47 -05:00
Jukka Rissanen 7e3301fc62 net: Fix checkpatch warnings
Change-Id: Ife0db49300ee7d0cdc4805d9e50c81feb397d8c6
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:24:47 -05:00
Jukka Rissanen 33ab70cebc net: Use the correct fifo get timeout function
The fifo get timeout functions must be called in proper execution
context. Because of this requirement, we must use correct fifo
get timeout function depending on whether the net_receive()
was called from a fiber or from a task.

Change-Id: Ibf4637d0e647a441de59a1cbb9fdf3c0abe0eb09
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:24:47 -05:00
Jukka Rissanen cc88aa3918 net: Rename net_init.c to net_core.c
As the file contains networking core routines and not just
init functions, the file is renamed.

Change-Id: Id633bae49296dfb4b14f1dd3a5064059f0418475
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:24:47 -05:00
Mariusz Skamra 619ad22c38 Bluetooth: gatt: Fix possible NULL pointer dereference
Change-Id: Ica534a516725597c1fae8c8a9f652d85b720774c
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:24:47 -05:00
Mariusz Skamra 7dc3d35da6 Bluetooth: gatt: Unsubscribe notification from callback directly
With this patch application can unsubscribe notifications
from Subscribe value callback directly, if BT_GATT_ITER_STOP
is returned.

Change-Id: I7873594f5dbe6e8c5bef11bf397a74cdc870a464
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:24:47 -05:00
Mariusz Skamra d42a70288b Bluetooth: gatt: Refactor read of attributes as a gatt client
This patch refactor reading of attribute values as a client.
Current MTU size is taken into account to determine if read
procedure has been completed or not.
For now, read procedure will be continued until whole is read,
or stopped by client.
Core Specification says that "The Read Blob Request is repeated
until the Read Blob Response’s Part Attribute Value parameter is
shorter than (ATT_MTU – 1)." (Vol 3, Part G 4.8.3)
Because application didn't know the current MTU value,
there was no way to determine if data received is complete.

Change-Id: I9d0e3f8638b58c3a4e39060333aedc133b775e3d
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:24:46 -05:00
Jukka Rissanen 13b939cb64 net: contiki: Proper rtimer implementation was missing
Real timer implementation in Contiki was always returning 0
which was incorrect.

Change-Id: I63d5f2b5914e1952a04addc200fe1f0f4a95a5ed
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:24:46 -05:00
Jukka Rissanen 14c30a3504 net: contiki: Remove obsolete spi.h file
This file should not be here as it is not used in Zephyr.

Change-Id: I4be96e5b03e4522af80e48da285a1509bccc60df
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:24:46 -05:00
Jukka Rissanen 809f8ca16e net: apps: Fix compile error of coap-observe-client
Include path was missing.

Change-Id: I29c1b31143fe4d03cde5bd0cd63319960b817322
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:24:46 -05:00
Luiz Augusto von Dentz 7f6dd71e79 Bluetooth: L2CAP: Disconnect when receiving invalid data
When receiving invalid data the spec recommends disconnecting.

Change-Id: I13b043d4b7d7b5c9fc2fdd8e09077be948694a57
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:24:46 -05:00
Luiz Augusto von Dentz 8061ed1277 Bluetooth: Add l2cap-disconnect command to btshell
l2cap-disconnect can be used to disconnect or cancel a connection to
a server:

btshell> l2cap-disconnect
bt: bt_l2cap_chan_disconnect (0x0011260c): chan 0x0011065c scid 0x0040 dcid 0x0040
btshell> bt: bt_l2cap_recv (0x00114e00): Packet for CID 5 len 8
bt: l2cap_chan_recv (0x00114e00): chan 0x00111534 len 8
bt: l2cap_recv (0x00114e00): LE signaling code 0x07 ident 2 len 4
bt: le_disconn_rsp (0x00114e00): dcid 0x0040 scid 0x0040
bt: l2cap_chan_del (0x00114e00): conn 0x001111c0 chan 0x0011065c cid 0x0040
Channel 0011065c disconnected

Change-Id: If249748f98f9b006e4eb2f8722a6f698b372d959
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:24:46 -05:00
Luiz Augusto von Dentz a983eff168 Bluetooth: L2CAP: Add bt_l2cap_chan_disconnect
This adds bt_l2cap_chan_disconnect which can be used to disconnect
dynamic channels resulting in the following trace:

< ACL Data TX: Handle 3585 flags 0x00 dlen 12
      LE L2CAP: Disconnection Request (0x06) ident 2 len 4
        Destination CID: 64
        Source CID: 64
> ACL Data RX: Handle 3585 flags 0x02 dlen 12
      LE L2CAP: Disconnection Response (0x07) ident 2 len 4
        Destination CID: 64
        Source CID: 64

Change-Id: I77ec29c8879a330b7f73e217621436045fa5163e
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:24:46 -05:00
Luiz Augusto von Dentz 2902d5c3c3 Bluetooth: Add l2cap-connect command to btshell
l2cap-connect can be used to connect to a server:

btshell> l2cap-connect 0080
bt: bt_l2cap_chan_connect (0x0011260c): conn 0x001111c0 chan 0x0011065c psm 0x0080
bt: l2cap_le_connect (0x0011260c): conn 0x001111c0 chan 0x0011065c psm 0x0080
bt: l2cap_chan_add (0x0011260c): conn 0x001111c0 chan 0x0011065c cid 0x0040
btshell> bt: bt_l2cap_recv (0x00114e00): Packet for CID 5 len 14
bt: l2cap_chan_recv (0x00114e00): chan 0x00111534 len 14
bt: l2cap_recv (0x00114e00): LE signaling code 0x15 ident 1 len 10
bt: le_conn_rsp (0x00114e00): dcid 0x0040 mtu 672 mps 230 credits 10 result 0x0000
Channel 0011065c connected

Change-Id: I8440615225e74d603c0f6bc3db4cf4bd46831841
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:24:46 -05:00
Luiz Augusto von Dentz 973bd0f4d7 Bluetooth: L2CAP: Add bt_l2cap_chan_connect
This adds bt_l2cap_chan_connect which can be used to connect dynamic
channels resulting in the following trace:

< ACL Data TX: Handle 3585 flags 0x00 dlen 18
      LE L2CAP: LE Connection Request (0x14) ident 1 len 10
        PSM: 128 (0x0080)
        Source CID: 64
        MTU: 63
        MPS: 65
        Credits: 4
> ACL Data RX: Handle 3585 flags 0x02 dlen 18
      LE L2CAP: LE Connection Response (0x15) ident 1 len 10
        Destination CID: 64
        MTU: 672
        MPS: 230
        Credits: 10
        Result: Connection successful (0x0000)

Change-Id: I73b2bd62fdca4a3ffa35577f0b66c2e6bb0083cd
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:24:46 -05:00
Luiz Augusto von Dentz cbe71672e0 Bluetooth: L2CAP: Add defines for PSM range
This also change the start to allow creating server for fixed PSM.

Change-Id: I50054cc7a583111fe096181236cbf80d79d2585f
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:24:46 -05:00
Jukka Rissanen d32b0004ee net: Kconfig: Refactor sanity test options
The loopback number test count should only be available when
we have network sanity tests enabled.

Change-Id: Ifd4fc1f6249dda62c195810cfef7dd8ff9d17f9c
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:24:46 -05:00