Commit graph

19237 commits

Author SHA1 Message Date
Carles Cufi
2fb8a11906 Bluetooth: Controller: Fix __packed placement
Place __packed at the end of the structure definition in line
with the rest of the Zephyr codebase.

Jira: ZEP-732

Change-Id: I25aa731cbd188a6e23ca2035eb22fa919295bb25
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-10-04 08:12:14 +03:00
Szymon Janc
7ea426a8f1 Bluetooth: L2CAP: Cleanup flags names for BR/EDR channels
This makes all flags used for BR/EDR L2CAP be stored in single place.
Connection oriented flags and signaling flags are now sharing same
atomic.

Change-Id: If01b29009f9c60ed529338122992b9b5e31f883a
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-10-04 08:12:14 +03:00
Carles Cufi
e9d32ed6e1 Bluetooth: Controller: Remove unused macro
Leftover from previous commits, this macro is not used anymore in
the HCI implementation.

Change-Id: I376c92a6b68432d2ff818ea25e68f087131e8479
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-10-04 08:12:14 +03:00
Jaganath Kanakkassery
5c1ce90926 Bluetooth: RFCOMM: Handle dlc disconnection from peer
Sends UA response for the DISC request from peer and clean up
dlc. Disconnected callback will be called to profile. Dummy
buf and credit will be used to wake up the tx fiber for exit
and cleanup.

> ACL Data RX: Handle 256 flags 0x02 dlen 8
      Channel: 64 len 4 [PSM 3 mode 0] {chan 0}
      RFCOMM: Disconnect (DISC) (0x43)
         Address: 0x0b cr 1 dlci 0x02
         Control: 0x53 poll/final 1
         Length: 0
         FCS: 0xb8

< ACL Data TX: Handle 256 flags 0x00 dlen 8
      Channel: 64 len 4 [PSM 3 mode 0] {chan 0}
      RFCOMM: Unnumbered Ack (UA) (0x63)
         Address: 0x0b cr 1 dlci 0x02
         Control: 0x73 poll/final 1
         Length: 0
         FCS: 0x92

Change-Id: I4ec19a93d13a95a9cf4fc5a9beaf48ba8c98689d
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
2016-10-04 08:12:14 +03:00
Mariusz Skamra
c76da25cac Bluetooth: tester: Fix advertising data
This fixes data passed to the BTP Device Found event.

Change-Id: I1ab465b87ce24f3ea10b7217c254aafaee494c91
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-10-04 08:12:14 +03:00
Arkadiusz Lichwa
e3506ca120 Bluetooth: RFCOMM: Shuffle up Kconfig's RFCOMM_L2CAP_MTU
Moves RFCOMM frames max length settings directly under the main RFCOMM
selector for better relations readability. It uses 'depends on' clause
for RFCOMM dependency and proper indentation.

Change-Id: Ic4dc0ffddaf8b438ace1f455191b7a707c0e9ed6
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-10-04 08:12:14 +03:00
Carles Cufi
2f33724017 Bluetooth: Controller: Use net_buf for evt and ACL RX
Use the net_buf structure directly when populating incoming
ACL data or asynchronous events. This ensures that no additional
memcpy() operations are required and removes completely the
statically allocated buffers in hci.c.

Jira: ZEP-726

Change-Id: I6ac8bd0becb7037ce8ecfac109f44832d23fcfd2
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-10-04 08:12:14 +03:00
Szymon Janc
36b8e8cdc8 Bluetooth: Add debug keys support to HCI ECC emulation code
This was initialy done in SMP code but was lost when moved to HCI ECC
emulation. With this patch if CONFIG_BLUETOOTH_USE_DEBUG_KEYS is set
ECC emulation code uses debug public and private keys as specified
in Core Specifitation 4.2 Vol 3. Part H 2.3.5.6.1.

Change-Id: I626e7e1c6bde2baeae642d6f2c60c324fdd0369f
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-10-04 08:12:14 +03:00
Szymon Janc
f4d75398ca Bluetooth: SMP: Fix unused static variable
gen_method_legacy is used only if SMP SC only mode is not enabled.
This fix compilation warning on some GCC version.

Change-Id: I183c5d0072c2f76da78bf0d2b1077c8d0620f688
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-10-04 08:12:14 +03:00
Szymon Janc
aa6a9b0066 Bluetooth: SMP: Remove unused static const
This is no longer used and can produce warning on some GCC versions.

Change-Id: Ib19903ea41d6446983a738ea99912dc5ba9b88f8
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-10-04 08:12:14 +03:00
Carles Cufi
0a720c4771 Bluetooth: Controller: Use net_buf for CC/CS TX
Preallocate a response event net_buf buffer before processing an
incoming command and provide it to hci.c so that it populates
the event directly, instead of using a temporary buffer than
must then be copied into the return net_buf.
This applies exclusively to Command Complete and Command
Status, since those are the only events that are sent in
direct respone to an incoming command.

Jira: ZEP-726

Change-Id: Ia3ea71ac497690af929c44308760f68491ea829e
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-10-04 08:12:14 +03:00
Luiz Augusto von Dentz
6877651a30 Bluetooth: GATT: Fix locking RX fiber
If an indication is received while there is an outstanding request the
code will attempt to get a buffer from req_pool to confirm which may
block causing the RX fiber to lock and probably crash as the request
won't release the buffer until it gets a response or timeout.

JIRA: ZEP-940

Change-Id: I3df30db473a0c6c6c3e63b1d0b410a50bdd3accf
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-10-04 08:12:14 +03:00
Carles Cufi
d12b6c87c9 Bluetooth: Controller: Use net_buf for HCI RX
Instead of copying the net_buf contents into a temporary
buffer byte-by-byte, the Controller HCI code now handles
incoming commands and ACL packets from the Host directly
in the net_buf containers, to avoid unnecessary memory
copying and to align with the rest of the Bluetooth stack.

Jira: ZEP-726

Change-Id: I9802607d84ee6206218b711e7e6e23dafb70581a
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-10-04 08:12:14 +03:00
Luiz Augusto von Dentz
85f82d7985 Bluetooth: init: Add CONFIG_BLUETOOTH_A2DP to prj_20.conf
This makes sure A2DP support is build tested on each patch.

Change-Id: I9dba5c20d44d8ac92910e80c1ad97ac8d2207652
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-10-04 08:12:14 +03:00
Itankar, Piyush T
acb8c75648 Bluetooth: A2DP: Initialization of A2DP
A2DP Initialization, registers callback functions with AVDTP.

Change-Id: I6b24ca5e7906c08774a173f35da28b1711f34577
Signed-off-by: Itankar, Piyush T <piyush.t.itankar@intel.com>
2016-10-04 08:12:14 +03:00
Luiz Augusto von Dentz
52efcf8acd Bluetooth: AVDTP: Add missing BLUETOOTH_DEBUG_AVDTP
Change-Id: Ib2243f85bb06df9d98d258bce11d4e7ac87f212d
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-10-04 08:12:14 +03:00
Luiz Augusto von Dentz
4c44e66a5c Bluetooth: init: Add CONFIG_BLUETOOTH_AVDTP to prj_20.conf
This makes sure AVDTP support is build tested on each patch.

Change-Id: Ia7cf94ca84fa01bd676a99b0df58ac745bbfc8c7
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-10-04 08:12:14 +03:00
Luiz Augusto von Dentz
324b3a2948 Bluetooth: init: Add CONFIG_BLUETOOTH_RFCOMM to prj_20.conf
This makes sure RFCOMM support is build tested on each patch.

Change-Id: I9cd60da1b0ab0db2b41487393fb59fe1b415ea01
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-10-04 08:12:14 +03:00
Arun Jagadish
3afc05d816 Bluetooth: AVDTP: Module Initialization
- Data Structure Definition
- Registration and Initialization

Change-Id: Icca95ccbd2692a7d41fd41ef2c99e34761e864b3
Signed-off-by: Arun Jagadish <arun.jagadish@intel.com>
2016-10-04 08:12:14 +03:00
Carles Cufi
f976decdfa Bluetooth: Controller: Clean up naming in the HCI driver
As part of the effort to consolidate the BLE Controller's
HCI layer, the functions in hci_driver.c now use the "hci_driver_"
prefix when it is sensible to do so, and prefixes have been
removed altogether when they are not required.

Jira: ZEP-726

Change-Id: Icd3e56e0170f15636245ea12a389a5a9e86c166c
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-10-04 08:12:14 +03:00
Luiz Augusto von Dentz
c4fb8f8820 Bluetooth: eddystone: Add missing characteristics
This adds last 2 missing characteristics:

(Advanced) Factory reset - a3c8750b-8ed3-4bdf-8a39-a01bebede295
(Advanced) Remain Connectable - a3c8750c-8ed3-4bdf-8a39-a01bebede295

Change-Id: I749b4be65469080a24957805d40395563a74a972
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-10-04 08:12:14 +03:00
Maureen Helm
51c146b95b frdm_k64f: Add support for RGB LEDs
Add PTB22, PTE26, and PTB21 to the frdm_k64f pinmux table, and helper
macros to board.h to map them to red, green, and blue LEDs respectively.

Change-Id: I257621467e71dfd9bdc5d97d6da444dfb5c58b2b
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2016-10-04 01:29:14 +00:00
Maureen Helm
a6b57c9455 frdm_k64f: Add support for push button switches
Add PTC6 and PTA4 to the frdm_k64f pinmux table, and helper macros in
board.h to map them to SW2 and SW3 respectively.

Change-Id: Ia30df9015d6d3c09131b4fbb2f2009ee745f7268
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2016-10-04 01:23:00 +00:00
Yannis Damigos
84ae7d83d6 scripts/sysgen: Fix indentation inconsistency
Building samples or running sanitycheck script fails with
the following error using python 3:
Using /home/xekarfwtos/projects/zephyr as source for kernel
GEN     ./Makefile
CHK     include/generated/version.h
HOSTCC  scripts/basic/fixdep
HOSTCC  scripts/gen_idt/version.o
HOSTCC  scripts/gen_idt/gen_idt.o
HOSTLD  scripts/gen_idt/gen_idt
HOSTCC  scripts/gen_offset_header/gen_offset_header.o
HOSTLD  scripts/gen_offset_header/gen_offset_header
CHK     misc/generated/configs.c
CHK     include/generated/offsets.h
CHK     misc/generated/sysgen/prj.mdef
UPD     misc/generated/sysgen/prj.mdef
File "/home/xekarfwtos/projects/zephyr/scripts/sysgen", line 687
  kernel_main_c_out("K_MSGQ_DEFINE(_k_fifo_obj_%s, %s, %s);\n" %
				                               ^
TabError: inconsistent use of tabs and spaces in indentation

This patch fixes the indentation inconsistency allowing building
using python 3.

Change-Id: I51bda9452e7ff97fe9f07544927d76ce981700d1
Signed-off-by: Yannis Damigos <giannis.damigos@gmail.com>
2016-10-03 20:33:28 +00:00
Peter Mitsis
6704ff462e kernel: Add __unused tag
The '__unused' tag can be used to inform the compiler that a variable
might be deliberately unused. It can be used instead of ARG_UNUSED().

Change-Id: I0ec4ee92dcec29b5f9cbda362d0d6b051055628a
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-10-03 20:22:05 +00:00
Peter Mitsis
27a21a8e09 nanokernel: nanokernel.h to include sections.h
Mirrors kernel.h to allow both nanokernel and microkernel applications
easy access to section tags such as __noinit.

Change-Id: Ie01395ac63393b7afbebfe26c723702918bfe9ff
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-10-03 20:20:23 +00:00
Peter Mitsis
0cb65c3c0d unified: Eliminate k_mem_pool_t typedef
Replaces it with a pointer as there is no need for an opaque memory
pool type.

Jira: ZEP-916
Change-Id: I5493eed25c9c34e1b850dc3b20699864edb22d28
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-10-03 20:17:02 +00:00
Peter Mitsis
0ca7cea8f3 unified: Relocate internal thread group APIs
Moves the following internal thread group APIs from the public
kernel.h header file to the more private thread.c source file as
they do not need to be public APIs.
	_k_task_list_start[];
	_k_task_list_end[];
	_FOREACH_STATIC_THREAD()
	is_in_any_group()

Change-Id: I0b731fb0c20a5574cb1b3c1397803af82918d69d
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-10-03 20:17:02 +00:00
Marcus Shawcroft
9d67337c2d k64f: Refactor pinmux configuration table.
Statically compute the number of elements in the pinmux table rather
than keep a manual entry in step with the table.

Change-Id: I99634aa460a39bb8a9a10fe37d28aaae792aa641
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-03 19:49:40 +00:00
Carles Cufi
bb9f432dc1 toolchain: Add BUILD_ASSERT macro for compile-time checks
This new macro will trigger a build failure if the compile-time
check fails. Useful for checking static conditions such as
structure sizes or offsets.

Change-Id: I417ea816003b97beb1b5f15bc583c38691f0b8a9
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-10-03 19:41:08 +00:00
Ramesh Thomas
0d2b8224b1 timer: Fixes a build error when MVIC is used
MVIC does not have _REG_TIMER_CFG defined because it does
not have a timer config register. Add checks for MVIC at
places where it is used.

Jira: ZEP-1015
Change-Id: I59f5c43cc2d1b17cf9e88b940631c2542e9729ab
Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
2016-10-03 17:28:02 +00:00
Daniel Thompson
90f6ae1532 build: Support for integrating third party build systems
For projects like JerryScript and Micropython we are starting to see
hybrid build systems emerge where the application (which targets a
variety of OSs and already includes a complex build system) is compiled
using the applications own build system before handing over to the
zephyr build system for the final link.

Currently the integration is becoming quite complex as the applications
build integration tries to figure out sane values for CC and CFLAGS.
Much of this complexity can be avoided if we allow the zephyr build
system to export its configuration in a manner that can easily be
consumed by the alien build system.

Change-Id: I4ea4cda2ed0437222d9550c50f0b07e51d9ac91b
Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
2016-10-03 02:30:51 +00:00
Anas Nashif
c83e6a1f48 libc: define EWOULDBLOCK to be the same as EAGAIN
EWOULDBLOCK is an old error code from BSD. Not much uses it, and on basically
all modern systems it's defined to the same value as EAGAIN, which is the
System V value for the same condition.

Jira: ZEP-982
Change-Id: I5435ce55fa47f5bd2fac5d881b5b195b025f48a2
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-03 02:29:42 +00:00
Anas Nashif
0cf87e4c26 pinmux: remove nonexistant galileo Kconfig
Change-Id: I9f2fb8024f3de6fa6aaf1220ecfa884fabb6ad74
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-03 02:29:23 +00:00
Anas Nashif
1b4742f8a4 help: document ram/rom_report in 'make help'
Change-Id: I0b0b477cc19bb8966a67c6f1e5705f58d8679578
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-03 02:29:22 +00:00
Anas Nashif
315862f59a tests: remove redundant PRINT definition
Change-Id: I0ac5b3730a9a84b89f392c58e3b65e47cbdf132b
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-10-03 02:29:22 +00:00
Andy Ross
0f227848b9 link: Add section size validity checker
There are demons hiding in binutils with regard to the size of the
data section that needs to be copied in XIP platforms.  It's easy to
mess up and get a mismatch between the linker data output and the
runtime addresses.  Add a cheap check to discover this early when it
occurs.

Jira: ZEP-955

Change-Id: If1c61fe8712221c6450b5b89f5f8af006b41b3fe
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2016-10-01 01:41:51 +00:00
Andy Ross
6b3c5e8bb2 x86 link: Specify ALIGN_WITH_INPUT for XIP data sections
Binutils ld has an annoying misfeature (apparently a regression from a
few years ago) that alignment directives (and alignment specifiers on
symbols) apply only to the runtime addresses and not, apparently, to
the load address region specified with the "AT>" syntax.  The net
result is that by default the LMA output ends up too small for the
addresses generated in RAM.  See here for some details:

    https://sourceware.org/ml/binutils/2013-06/msg00246.html
    https://sourceware.org/ml/binutils/2014-01/msg00350.html

The required workaround/fix is that AFAICT any section which can have
inherit a separate VMA vs. LMA from a previous section must specify an
"ALIGN_WITH_INPUT" attribute.  Otherwise the sections will get out of
sync and the XIP data will be wrong at runtime.

No, I don't know why this isn't the default behavior.

A further complexity is that this feature only works as advertised
when the section is declared with the "AT> region" syntax after the
block and not "AT(address)" in the header.  If you use the header
syntax (with or without ALIGN_WITH_INPUT), ld appears to DOUBLE-apply
padding and the LMA ends up to big.  This is almost certainly a
binutils bug, but it's trivial to work around (and the working syntax
is actually cleaner) so we adjust the usage here.

Note finally that this patch includes an effective reversion of commit
d82e9dd9 ("x86: HACK force alignment for _k_task_list section"), which
was an earlier workaround for what seems to be the same issue.

Jira: ZEP-955

Change-Id: I2accd92901cb61fb546658b87d6752c1cd14de3a
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2016-10-01 01:41:50 +00:00
Benjamin Walsh
72e5a39ba7 unified: fix misc issues with APIs in kernel.h
ZEP-1022

Change-Id: I88a043cb0127631fcbb48c91504fe4fcd6ae1ecc
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-10-01 01:36:38 +00:00
Benjamin Walsh
9091e5d253 unified: use correct init macro for k_fifo objects
Was using dlist macro instead of slist macro.

ZEP-1021.

Change-Id: I374ae88289669ca03e3c0c76d33fa0229977e403
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-10-01 01:36:38 +00:00
Benjamin Walsh
d3cfc8602d slist: add static initialization macro
Change-Id: Ic0d057ed68dc6513bcc1d4b68fbdfb86c28d1fda
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-10-01 01:36:38 +00:00
Vinicius Costa Gomes
0dfc9db815 samples/zoap-client: Add a README.txt to zoap-client
Change-Id: I2373d87cda125036cce169aaa492aeedcbe200dd
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-10-01 01:11:27 +00:00
Vinicius Costa Gomes
fcb3297b32 samples/zoap-server: Add a README.txt to zoap-server
Change-Id: I136d405e520ed8550e0b5012128a0c673bb9954a
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-10-01 01:11:27 +00:00
Vinicius Costa Gomes
76e81874f0 samples/zoap_client: Make it work with zoap-server
The path and port used by zoap-client were different than the ones used
by zoap-server.

Even if they are different applications, for consistency, it makes sense
for them both to be able to talk to each other.

Change-Id: I883d59c77bc3800b4f0965ba7bcf96a08e545d29
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-10-01 01:11:26 +00:00
Vinicius Costa Gomes
08e0e86bb0 tests/zoap: Add tests for the observe feature
Change-Id: I993437169715ce57f6c5c9f3e95689f785db65c4
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-10-01 01:11:26 +00:00
Vinicius Costa Gomes
7079a18267 iot/zoap: Add helpers for dealing with integer options
A good number of option values represent numbers, so add these helpers
so applications can avoid repeating this.

Change-Id: Ied2a844c51808dcafe751a77492d00f2063de7d6
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-10-01 01:11:25 +00:00
Vinicius Costa Gomes
441d22a371 iot/zoap: Add port information to network addresses
uIP keeps the port separated from the IP addresses, so if the
application wants to communicate with a remote endpoint we must also
have the port information available.

Change-Id: I8e2b01fe5717166e1f9cebcc74b2056325b8ccc3
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-10-01 01:11:25 +00:00
Vinicius Costa Gomes
92a79f7351 iot/zoap: Add support for observing resources
This adds support for observing resources, for client and server side.

For the server side we augment the resource struct so it can hold
information about each interested observer.

For client side, observing a resource abstracted as an reply that
can be called multiple times.

Change-Id: If3f0b41e302cff357ab891e6e91ec2d41579fb92
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-10-01 01:11:24 +00:00
Jaakko Hannikainen
54c90bcbd5 tests: Add gcov support
If the -C flag is given to sanitycheck, generate gcov files for unit
tests and render them with lcov.

Signed-off-by: Jaakko Hannikainen <jaakko.hannikainen@intel.com>
Change-Id: Ic25eae6a3cfc2c45595bd6aa235df2c483aaf6ec
2016-09-30 21:17:42 +00:00
Jaakko Hannikainen
bdfe417020 tests: Add a sample for testing natively
This simple unit test runs basic sanity checking on buffers from
net_buf_get. It demonstrates the mocking support in a real-world case,
where it is used to remove the dependency to nano_fifo.

Origin: Original

Signed-off-by: Jaakko Hannikainen <jaakko.hannikainen@intel.com>
Change-Id: If2757823bebbc0fa22b3064a432032cdbccdfe2b
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-09-30 21:17:42 +00:00