Commit Graph

8065 Commits

Author SHA1 Message Date
Baohong Liu b0c28f2d00 drivers: i2c: fix a compilation dependency issue
Fix a compilation warning. Compilation of the i2c driver
requires QMSI dma object file. As a solution, the current
code has "selects DMA_QMSI" in i2c Kconfig. This results
in a compilation warning since "select DMA" is also
required. Adding "select DMA" and "select DMA_QMSI"
together in i2c Kconfig can solve the compilation issue.
But, this will cause the dma driver be unnecessarily
enabled. So, the solution is to fix the issue in the QMSI
part instead of in the shim driver.

Jira: ZEP-777 ZEP-778

Change-Id: Id4c1f749bf71eece1e70583bd586a69b596768b2
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-09-10 11:29:49 +00:00
Baohong Liu 56011cee50 samples: remove stts 751 sensor app
Remove this app, since the sensor is not on the
board any more.

Jira: ZEP-763

Change-Id: I931acfe9f01b817bc0b24a4e0745bf759e53da90
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-09-10 11:29:05 +00:00
Andy Ross 5729235b57 libc/printf: Use compiler-provided 64 bit math, phase 2
Remove the function wrappers around the 64 bit math and just use C
syntax natively, combining ops where appropriate (e.g. there was a
sequence implementing "(x<<2+x)<<2" to do "multiply by 10").  The
_ldiv5 and _rlrshift routines are non-standard ops that provide useful
abstraction, so they remain as separate functions.

Change-Id: I4d83847348fdd7be09887b833c8ccbd2aa1e4182
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2016-09-10 00:49:01 +00:00
Andy Ross d06eea4eda libc/printf: Use compiler-provided 64 bit math, phase 1
The _to_float() implementation had a somewhat kludgey hand-written 64
bit math implementation, which is unhelpful on Zephyr as all our
toolchains provide a working uint64_t runtime.  This is at best just
dupicated code from libgcc, and at worst less efficient.

This patch replaces the existing 64 bit minilibrary but keeps the
uint32_t[2] API as is for ease of validation and review.

One exception is _ldiv5, a specialized divide-by-five implementation.
The 64 bit division routines are large on some architectures (ARM and
ARC in particular), not pulled in by a default Zephyr build, and will
swamp the benefit from this patch.  So this includes a
refactored/improved _ldiv5 which leverages libgcc for multiword shifts
instead of just using raw division.

Note also the "noinline" attribute on _ladd().  This is a workaround
for an apparent compiler bug when built with -Og or -Os (hand-hacking
the Makefiles to build with -O0 works), perhaps due to my aliasing the
int array with a long long.  This will go away in phase 2.

Change-Id: I63e8c82dabe2bfaa75b63ddb59e5f11d51be538e
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2016-09-10 00:49:00 +00:00
Andy Ross 073cfddd0f libc/printf: Remove vestigial "full" parameter to _to_float()
The _to_float routine was apparently written to be able to take a 32
bit float bit representationa as well as a 64 bit double.  But in a
printf routine, that can never happen per the C standard (where floats
are always promoted to doubles in varargs context).

This was just hard-configured to 1 at the top of the file, and nothing
else in the project sets "DOUBLE" to try to change it.  Just remove
it.  If we ever want code to convert a float to a double in memory so
we can use this routine, we have it in libgcc.  Or even in hardware on
the FPU where available.

Change-Id: I796814c0fce3ce96faa34fde8da411a28c826699
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2016-09-10 00:49:00 +00:00
Andy Ross a4537cb0d3 libc/printf: Unify & simplify number printing
Hex, octal and decimal all had separately implemented reduction loops
to generate strings.  With only a little work these can all be unified
to a single implementation that works with an arbitrary base.

Performance is probably a little lower owing to the fact that
hex/octal now requires a division per character, and the extra
"reverse the string" trick at the end of the conversion.  But code
size savings are substantial.

Change-Id: I11ff376aeca1483f974d328271e19918221b2a41
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2016-09-10 00:48:59 +00:00
Andy Ross cc5c3c48b6 uart_qmsi: Get the interrupt handling right on ARC
The Sensor Subsystem has different IRQ numbers for the same device
across CPUs.  QMSI declares these, but doesn't do anything to try to
map it automatically, so we have to do it in the driver.

Similarly the SCSS interrupt routing (the SoC-wide "APIC", which is
distinct from the per-CPU interrupt masking hardware) needs to know
which CPU we're trying to unmask an interrupt for.

Change-Id: I27e5ec44f324f869e16a92e7ef40a22a305d98a2
Jira: ZEP-546
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2016-09-09 21:37:56 +00:00
Andy Ross fb1daa0f97 samples/uart: Use the proper console
Don't try to detect the UART device manually, the list is missing a
bunch of boards (the Quark SE sensor subsystem variant, and both
Arduino 101 halves).  There's a config variable for that.

Change-Id: I903e52dcb6025e5da824faadb5e4bc59221fa210
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2016-09-09 21:37:56 +00:00
Andy Ross 55dd1cc918 quark_se_ss: Fix console default
The ARC side should use the same console UART as x86 by default if we
want identical behavior.

Change-Id: I067860581cfd93d97ffad3d8f0bc5591f555e3ce
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2016-09-09 21:37:56 +00:00
Andy Ross ee56af2a29 samples/drivers/uart: Fix line endings
This output is going to a terminal device, not a Unix tty descriptor
which will cook the output for us.  Newline moves the cursor down.
Carriage return moves it to the start of a line.  We need both.

Change-Id: If93d1a85d16cea93b4788fa55e694a7b77055bfe
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2016-09-09 21:37:55 +00:00
Andy Ross 425145da08 uart_console: Fix line endings
Overwhelming industry practice when using two-byte line termination is
to end the line with "\r\n" and not "\n\r".

Also remove needless casts.  GCC does not warn on int-to-char
conversions.

Change-Id: If01a2e5ca327aacebcbcaf384af9c7131119689b
Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2016-09-09 21:37:55 +00:00
Andrew Boie d6053db355 kernel: abolish FUNC_NO_FP
These impede debugging and we have CONFIG_OMIT_FRAME_POINTER
now which does this globally for the entire kernel.

Change-Id: I46939223e27dd298ca3ed162ff5790cb2e9ed2a2
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-09-09 21:13:30 +00:00
Ricardo Salveti b96cfc5191 arm/nrf52: fix default number of IRQs
There is a total of 39 IRQs defined at nrf52/soc_irq.h.

Change-Id: Id478fb15a07cfdecaa6cc136730d20017b8752c5
Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
2016-09-09 14:32:43 +00:00
Anas Nashif b71a8a4591 libc: remove stddef.h which is provided by the compiler
Jira: ZEP-733
Change-Id: I26ba720377826bfa662c61e46c0358f05218524b
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-09-09 11:57:41 +00:00
Andre Guedes a7f70af0db quark_d2000/se: Don't setup GDT during initialization
Quark D2000 and SE based boards (but Arduino 101) use QMSI bootloader
by default. QMSI bootloader sets up GDT in the so-called 'basic flat
model' just like Zephyr does by default.

This patch changes Quark D2000 and SE boards default configuration
so they rely on QMSI bootloader and we don't sets up GDT twice.

Change-Id: Ic6e520148b732bd48c00657c6c8138a8d865faef
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-09-09 11:21:39 +00:00
Carles Cufi aa76ea9ca2 misc/byteorder.h: Add a function to store a 64-bit int in LE
sys_put_le64 stores a 64-bit unsigned integer into an
arbitrary memory location and is alignment-safe for any
architecture.

Change-Id: Ifd9871a509b9cab05a59d81f4917c68dda3cc824
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-09-09 02:18:41 +00:00
Anas Nashif 5c7a26536d quark_se: sensor: enable QMSI ADC driver
If ADC is enabled, configure QMSI driver.

Change-Id: I73f23d0b2fa788f605e5a440ed0bcb3d5e5f011c
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-09-08 20:45:35 -04:00
Andrew Boie b82009ee58 doc: drivers: more details on Zephyr driver model
Issue: ZEP-199
Change-Id: I0f9a4029d5b0dbdd94322bbcaaad29071e508d2e
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-09-08 23:47:25 +00:00
Ricardo Salveti 30e76dfb7b arm/irq_manage: change assert to allow sharing prio with PendSV
Zephyr uses the last priority level for the PendSV exception, but
sharing prio can still be useful on systems with a reduced set of
priorities, like Cortex-M0/M0+.

Change-Id: I767527419dcd8f67c2b406756b9208afd3b96de0
Signed-off-by: Ricardo Salveti <ricardo.salveti@linaro.org>
2016-09-08 21:43:21 +00:00
Carles Cufi 5203304d45 doc: Expand doc on 3rd-party cross compilers
Add documentation for OS X users that want to compile
using an available 3rd-party cross compiler and also
complete the section to describe the existing support
for the GCC ARM Embedded toolchain.

Change-Id: I97d27d46c0048a49029dbe4d66fe141755c226e9
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-09-08 21:41:11 +00:00
Andrew Boie e931410756 x86: fatal: don't report bogus interrupt vectors
_irq_controller_isr_vector_get() now returns -1 if it couldn't
determine which vector was activated.

Issue: ZEP-602
Change-Id: Ib0f5dbc3b68cc5e2c3a23121530e178aede20d06
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-09-08 12:48:20 -07:00
Andrew Boie eec13ca8c1 interrupt_controller: allow for indeterminate faulting vectors
You can't query the LOAPIC for every kind of interrupt that fires,
it has no idea about IRQs that were generated by an 'int' instruction
for example. Extend the semantics of _irq_controller_isr_vector_get()
to return -1 if the vector can't be identified.

Issue: ZEP-602
Change-Id: I1174aa62fbedffdcd329d60da8ef14fabb042dc3
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-09-08 12:47:14 -07:00
Andrew Boie a498d46b87 init: document SYS_INIT and SYS_INIT_PM
Change-Id: Ia0c72e445dc8434e1162cb131e95ea136beca419
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-09-08 17:15:11 +00:00
Baohong Liu 20d85fefe9 i2c: qmsi_shim: change some i2c config parameters to SoC specific
Change the signal ramp up/down config parameters in i2c driver
module to SoC specific.

Jira: ZEP-753

Change-Id: Ie01f1d890a7133d30ea53eee07f60354734a8571
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-09-08 11:57:41 +00:00
Inaky Perez-Gonzalez 4562b77295 TCF: specify ARCH when creating initconfig
Fix "TCF: especify ARCH when building" missed feeding ARCH to the
initconfig phase, that some projects require.

Change-Id: Ie44c9056d2d44198abbac6aeb6e0df05aff4dc36
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-09-08 11:31:32 +00:00
Inaky Perez-Gonzalez 8dac292b9d TCF: disable running single core testcases on Quark SE's x86+arc
By default TCF was running test single core test cases in both Quark
SE cores at the same time.

This worked because the ARC output came through the IPM console to
x86, which enabled them to coexist.

However, after default configuration changes, this is no longer
possible without adding extra hardware to the current test setup,
which is cost prohibitive, and thus we are driving ARC output to the
same port as the x86 output.

This would make the output single-core test cases that are ran at the
same time in the x86 and ARC cores mix their outputs.

So we have that scenario disabled (and makes us run less test
cases). However, multicore test cases still can be run by selecting:

@targets bsp_model:x86+arc

Change-Id: I5f6b43246a24d0b263fd4a47866c7f0f99d20505
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-09-08 11:31:31 +00:00
Inaky Perez-Gonzalez 5452bbdfdb TCF: default Quark SE's ARC core to use UART1 as console for testing
The current code redirects the ARC output to UART0.

Our test setup is laid out with a single serial port (which is mostly
UART1). For simplicity (as the extra cabling would be prohibitive), we
will change the default test building to redirect output back to ARC1.

This implies that the output from test cases will be intermixed when
test cases are not prepared to share the serial port, so running of
testcases combined in x86+arc will have to be disabled by default and
only done in testcases which declare they need to do so.

Change-Id: I5a6b79ecb48ecfb2d711be7f5fdbe08b4c3d34e9
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-09-08 11:31:31 +00:00
Inaky Perez-Gonzalez 462f431791 TCF: update defaults to use configuration fragments
Currently it plucks configuration strings in/out of the $O/.config and
that is quite dirty.

There is a cleaner way to do that with configuration fragments which
is now enabled by being able to include them from the object
directory.

Change-Id: Id51881391293ace89b58153c5de7db1afe67118a
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-09-08 11:31:30 +00:00
Inaky Perez-Gonzalez 27482314d4 kconfig: include configuration fragment files from output directory
Current setup includes configuration fragments (*.conf) from the
source directory.

This patch enables said inclusion to also happen from the output
directory; this enables automatic build systems and validation to set
configuration fragments without modifying the source tree.

This is important so that the source tree remains pristine from the
standpoint of source control systems.

Change-Id: Ic4a896afad2b8525c13dd6c6d9081f514b18e7aa
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2016-09-08 11:31:30 +00:00
Vinicius Costa Gomes f0882c2c80 net/buf: Add missing line break in debug statement
Without this line break, when CONFIG_NET_BUF_DEBUG is enabled, the
output may get confusing.

Change-Id: Ic467511f1dbbd283710f51ef14f94e0269c7c0ea
Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@intel.com>
2016-09-08 11:29:29 +00:00
Anas Nashif ce52e3988f Merge "Merge bluetooth branch to master" 2016-09-08 02:26:59 +00:00
Anas Nashif af1eaf489d samples: adc: make project configuration arch agnostic and cleanup
- Set default board to Quark SE Debvboard

Jira: ZEP-690, ZEP-760, ZEP-782
Change-Id: I7f7cc45b527a116f88cf45796e46b429ae6f0060
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-09-07 22:09:59 -04:00
Johan Hedberg 65a8e3c1c9 libc: printf: Add support for 'z' length specifier
The 'z' length specifier is the appropriate one to be used with size_t
(%zu) and ssize_t (%zd) types. Having support for this in our libc
means that we can utilize the compiler format string checks
(__printf_like) without getting warnings of incorrect format
specifiers for size_t and ssize_t variables.

Change-Id: I73fec0145692e0a59934cab548caf24c1c16a3df
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-09-07 15:10:57 +00:00
Maureen Helm 92de81c36d i2c: Fix restart flag in burst read
The i2c_burst_read function transfers two messages to the I2C device.
The first message writes the internal address of the device, the second
message then reads bytes. A repeated start (restart) is needed to change
the direction from write to read, but the restart flag should be set in
the second message rather than the first.

Change-Id: I7d48de2f4866e3b514f689f41ce5d28eba90c39f
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2016-09-07 14:40:20 +00:00
Maureen Helm e4067638b7 i2c: ksdk: Add shim driver
Add a shim layer around the ksdk I2C driver to adapt it to the Zephyr
I2C interface. Currently only supports master mode.

Jira: ZEP-717
Change-Id: I704b8c38e22e456bb9fa4325682b2a354a27a7ba
Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2016-09-07 14:40:20 +00:00
Johan Hedberg 5ada33a862 Merge bluetooth branch to master
Main changes:

 - Introduce support for a native Bluetooth controller implementation. Current
   supported controller is the nRF52, with nRF51 soon to follow.
 - Initial support for the RFCOMM protocol
 - New raw HCI interface to enable exporting HCI externally
 - New sample application to expose HCI over USB (using the new raw API)
 - Close-to-complete BR/EDR L2CAP implementation
 - Cross-transport key derivation support from LE to BR/EDR

-----------------------------------------------------------------------------
Andrei Emeltchenko (8):
      Bluetooth: Simplify configuration and fix warnings
      Bluetooth: Add RAW API interface to Bluetooth
      Bluetooth: Add documentation to HCI RAW interface
      Bluetooth: Export USB HCI controller using RAW HCI channel
      Bluetooth: Include btusb sample to sanity check
      Bluetooth/drivers: Fix missing argument in printf for h5 driver
      Bluetooth/samples: Fix missing argument in printf for btusb
      drivers/nble: Rename nrf51 power management functions

Arkadiusz Lichwa (8):
      Bluetooth: L2CAP: Make common RTX commands timer
      Bluetooth: L2CAP: Initialize & cleanup RTX timer on BR/EDR
      Bluetooth: L2CAP: Add RTX timer for 'get info' command
      Bluetooth: L2CAP: Add RTX timer for 'configuration' command
      Bluetooth: L2CAP: Add RTX timer for 'disconnect' command
      Bluetooth: L2CAP: Refactor connection security handler
      Bluetooth: L2CAP: Fix reset channel state context
      Bluetooth: L2CAP: Implement connect command on BR/EDR

Carles Cufi (7):
      Bluetooth: Cleanup and extend HCI header
      Bluetooth: Controller: Use offsetof() in memory sizing
      Bluetooth: Controller: Unify handling of unknown command
      Bluetooth: Controller: Unify handling of CC and CS
      Bluetooth: HCI: Rename cmd complete struct
      Bluetooth: HCI: Add definitions and macros
      Bluetooth: Controller: Switch to Zephyr's hci.h for cmd handling

Grzegorz Kolodziejczyk (1):
      Bluetooth: tester: Add L2CAP init method

Jaganath Kanakkassery (23):
      Bluetooth: L2CAP: Implement bt_l2cap_br_chan_send()
      Bluetooth: RFCOMM: Initialize and register to L2CAP
      Bluetooth: RFCOMM: Implement Register Server channel API
      Bluetooth: RFCOMM: Init buffer for outgoing signalling packets
      Bluetooth: RFCOMM: Handle signalling connection request
      Bluetooth: RFCOMM: Handle PN request
      Bluetooth: RFCOMM: Handle incoming dlc request
      Bluetooth: shell: Add support for RFCOMM test
      Bluetooth: RFCOMM: Move rfcomm_make_uih_msg() up
      Bluetooth: RFCOMM: Perform MSC transaction after dlc
      Bluetooth: RFCOMM: Handle data and credit from peer
      Bluetooth: RFCOMM: Fix cr bit of address in MSC response
      Bluetooth: L2CAP: Disable fragmentation of rx pdu
      Bluetooth: RFCOMM: Implement send data API
      Bluetooth: shell: Add support for RFCOMM send data
      Bluetooth: Kconfig: Add default for L2CAP_IN_MTU if BREDR is enabled
      Bluetooth: RFCOMM: Introduce helper to create rfcomm pdu
      Bluetooth: RFCOMM: Introduce Kconfig for max L2CAP MTU
      Bluetooth: shell: Use bt_rfcomm_create_pdu() in RFCOMM send
      Bluetooth: RFCOMM: Fix BT_RFCOMM_BUF_SIZE to include FCS and len
      Bluetooth: RFCOMM: Remove BT_RFCOMM_SEND_RESERVE
      Bluetooth: RFCOMM: Implement TX flow control
      Bluetooth: RFCOMM: Modify bt_rfcomm_dlc() to return dlc

Johan Hedberg (13):
      Bluetooth: monitor: Fix condition for disabling UART interrupts
      Bluetooth: Fix race condition when initializing ECC FIFO
      Bluetooth: Add missing guards to hci_raw.h header file
      Bluetooth: Controller: Fix coding style in ctrl.c, util/ and main.c
      Bluetooth: Kconfig: Remove unnecessary default conditionals
      Bluetooth: Make lmp_ext_feat_capable() more generic
      Bluetooth: Fix reading local features
      Bluetooth: Fix feature page count for single-mode configuration
      Bluetooth: Clean up feature test macros
      Bluetooth: ATT: Fix usage of unsupported %zu format specifier
      Bluetooth: Kconfig: Be consistent with the use of tabs vs spaces
      MAINTAINERS: Fix path for BLUETOOTH CONTROLLER
      Bluetooth: GATT: Fix unaligned access to CCC value

Jonathan Gelie (1):
      Bluetooth: Enable and disable BLE chip sleep mode dynamically

Kaustav Dey Biswas (1):
      Bluetooth: UUID: Add 32bit UUID support

Luiz Augusto von Dentz (7):
      Bluetooth: eddystone: Add timeout to deactivate configuration mode
      Bluetooth: GATT: Add queuing support
      Bluetooth: UUID: Add HID Service
      Bluetooth: Add service sample for HoG
      Bluetooth: Add sample implementing HIDS
      Bluetooth: HoG: Require authentication for connections
      Bluetooth: GATT: Fix unaligned accesses

Mariusz Skamra (1):
      Bluetooth: btp: Extend BTP specification to cover L2CAP tests

Ricardo Salveti (1):
      board: nrf52_nitrogen: Include BLE controller by default

Szymon Janc (22):
      Bluetooth: Split keys into LE and BR/EDR specific storage
      Bluetooth: SMP: Remove not needed stubs from NULL backend
      Bluetooth: Mark AES encrypted BR/EDR link as FIPS security level
      Bluetooth: SMP: Add helper for notifying pairing complete
      Bluetooth: SMP: Refactor keys distribution bitfields
      Bluetooth: SMP: Add support for Link Key derivation
      Bluetooth: SMP: Add self test for H6 function
      Bluetooth: Fail on init if BR/EDR is enabled but not supported
      Bluetooth: L2CAP: Remove mask from struct bt_l2cap_fixed_chan
      Bluetooth: L2CAP: Use BIT macro for supported BR/EDR fixed channels
      Bluetooth: L2CAP: Make bt_l2cap_br_fixed_chan_register global
      Bluetooth: Set BR/EDR device name on init
      Bluetooth: tests/shell: Set same name on BR/EDR and LE
      Bluetooth: tests/shell: Add dedicated BR/EDR config
      Bluetooth: tests/shell: Remove not needed RFCOMM option from config
      Bluetooth: Fix typo in code comment
      Bluetooth: Build RFCOMM documentation
      Bluetooth: Refactor Link Key notification event handling
      Bluetooth: Add support for P256 Link Keys
      Bluetooth: Read local extended features on init
      Bluetooth: Enable Secure Connections if supported
      Bluetooth: Move reading extended features to BR/EDR section of init

Vinayak Chettimada (22):
      soc: Use nrf.h instead of nrf52.h and nrf52_bitfields.h
      Bluetooth: Fix race condition between ecc_send and ecc_task
      MAINTAINERS: Add BLUETOOTH CONTROLLER section
      Bluetooth: Controller: Hardware abstraction layer for nRF5x radio
      Bluetooth: Controller: Add a util folder with basic primitives
      Bluetooth: Controller: Add initial HCI implementation
      Bluetooth: Controller: A full, hardware-agnostic BLE Link Layer
      Bluetooth: Controller: Add BLE controller driver
      board: nrf52_pca10040: Include BLE controller by default
      Bluetooth: tests: Add BLE controller init tests
      Bluetooth: Controller: Fix coding style, use of (void)
      Bluetooth: Controller: Fix assert on advertise start
      Bluetooth: Controller: Fix memory required calculation macro
      Bluetooth: Controller: Fix deadlock in recv fiber
      Bluetooth: GATT: Fix notifications to non-bonded peers
      misc/byteorder.h: Add sys_get_le64 interface
      Bluetooth: Add LE read supported states
      Bluetooth: Controller: Measure and use correct stack size
      Bluetooth: Controller: Enable all supported LE states
      Bluetooth: GAP: Support multiple peripheral role connections
      Bluetooth: GATT: Fix ccc cfg leak
      Bluetooth: Controller: alternate ticker compare set logic

 MAINTAINERS                                     |    6 +
 arch/arm/soc/nordic_nrf5/nrf52/soc.h            |    3 +-
 boards/nrf52_nitrogen/nrf52_nitrogen_defconfig  |    4 +
 boards/nrf52_pca10040/nrf52_pca10040_defconfig  |    4 +
 doc/api/bluetooth.rst                           |   19 +
 drivers/bluetooth/Kconfig                       |   13 +-
 drivers/bluetooth/Makefile                      |    1 +
 drivers/bluetooth/controller/Kconfig            |   39 +
 drivers/bluetooth/controller/Makefile           |   18 +
 drivers/bluetooth/controller/hal/ccm.h          |   31 +
 drivers/bluetooth/controller/hal/clock.c        |  230 +++++
 drivers/bluetooth/controller/hal/clock.h        |   26 +
 drivers/bluetooth/controller/hal/cpu.h          |   30 +
 drivers/bluetooth/controller/hal/debug.h        |  233 +++++
 drivers/bluetooth/controller/hal/ecb.c          |  188 ++++
 drivers/bluetooth/controller/hal/ecb.h          |   45 +
 drivers/bluetooth/controller/hal/hal_irq.h      |   27 +
 drivers/bluetooth/controller/hal/hal_rtc.h      |   27 +
 drivers/bluetooth/controller/hal/hal_work.h     |   33 +
 drivers/bluetooth/controller/hal/irq.c          |   53 +
 drivers/bluetooth/controller/hal/radio.c        |  552 ++++++++++
 drivers/bluetooth/controller/hal/radio.h        |  108 ++
 drivers/bluetooth/controller/hal/rand.c         |  125 +++
 drivers/bluetooth/controller/hal/rand.h         |   25 +
 drivers/bluetooth/controller/hal/rtc.c          |   68 ++
 drivers/bluetooth/controller/hci/hci.c          | 1979 ++++++++++++++++++++++++++++++++++++
 drivers/bluetooth/controller/hci/hci.h          |   26 +
 drivers/bluetooth/controller/ll/ctrl.c          | 7407 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 drivers/bluetooth/controller/ll/ctrl.h          |  255 +++++
 drivers/bluetooth/controller/ll/ctrl_internal.h |  239 +++++
 drivers/bluetooth/controller/ll/ll.c            |  295 ++++++
 drivers/bluetooth/controller/ll/ll.h            |   39 +
 drivers/bluetooth/controller/ll/pdu.h           |  260 +++++
 drivers/bluetooth/controller/ll/ticker.c        | 1538 ++++++++++++++++++++++++++++
 drivers/bluetooth/controller/ll/ticker.h        |  138 +++
 drivers/bluetooth/controller/main.c             |  400 ++++++++
 drivers/bluetooth/controller/util/defines.h     |   34 +
 drivers/bluetooth/controller/util/mem.c         |  196 ++++
 drivers/bluetooth/controller/util/mem.h         |   35 +
 drivers/bluetooth/controller/util/memq.c        |   96 ++
 drivers/bluetooth/controller/util/memq.h        |   25 +
 drivers/bluetooth/controller/util/util.c        |  134 +++
 drivers/bluetooth/controller/util/util.h        |   26 +
 drivers/bluetooth/controller/util/work.c        |  168 ++++
 drivers/bluetooth/controller/util/work.h        |   38 +
 drivers/bluetooth/h5.c                          |    2 +-
 drivers/bluetooth/nble/gatt.c                   |    5 +-
 drivers/bluetooth/nble/gatt_internal.h          |    6 +-
 drivers/bluetooth/nble/uart.c                   |   10 +-
 drivers/bluetooth/nrf51_pm.c                    |    6 +-
 drivers/bluetooth/nrf51_pm.h                    |    4 +-
 include/bluetooth/att.h                         |   18 +
 include/bluetooth/gatt.h                        |   27 +-
 include/bluetooth/hci.h                         |  653 ++++++++----
 include/bluetooth/hci_raw.h                     |   64 ++
 include/bluetooth/l2cap.h                       |    6 +-
 include/bluetooth/rfcomm.h                      |  162 +++
 include/bluetooth/uuid.h                        |   50 +
 include/misc/byteorder.h                        |   15 +
 net/bluetooth/Kconfig                           |  121 ++-
 net/bluetooth/Makefile                          |   21 +-
 net/bluetooth/att.c                             |  298 +++---
 net/bluetooth/att_internal.h                    |   13 +-
 net/bluetooth/conn.c                            |   50 +-
 net/bluetooth/conn_internal.h                   |   16 +-
 net/bluetooth/gatt.c                            |   60 +-
 net/bluetooth/hci_core.c                        |  405 +++++---
 net/bluetooth/hci_core.h                        |   18 +-
 net/bluetooth/hci_ecc.c                         |   19 +-
 net/bluetooth/hci_raw.c                         |  142 +++
 net/bluetooth/keys.c                            |   96 +-
 net/bluetooth/keys.h                            |   55 +-
 net/bluetooth/keys_br.c                         |   85 ++
 net/bluetooth/l2cap.c                           |   29 +-
 net/bluetooth/l2cap_br.c                        |  431 +++++++-
 net/bluetooth/l2cap_internal.h                  |   18 +-
 net/bluetooth/monitor.c                         |    2 +
 net/bluetooth/rfcomm.c                          |  728 ++++++++++++++
 net/bluetooth/rfcomm_internal.h                 |  125 +++
 net/bluetooth/smp.c                             |  241 ++++-
 net/bluetooth/smp_null.c                        |    9 -
 net/bluetooth/uuid.c                            |   10 +
 samples/bluetooth/README                        |    5 +
 samples/bluetooth/btusb/Makefile                |    5 +
 samples/bluetooth/btusb/prj.conf                |   10 +
 samples/bluetooth/btusb/src/Makefile            |    3 +
 samples/bluetooth/btusb/src/btusb.c             |  725 ++++++++++++++
 samples/bluetooth/btusb/testcase.ini            |    5 +
 samples/bluetooth/eddystone/src/main.c          |   40 +-
 samples/bluetooth/gatt/hog.c                    |  178 ++++
 samples/bluetooth/gatt/hog.h                    |   21 +
 samples/bluetooth/peripheral_hids/Makefile      |    7 +
 samples/bluetooth/peripheral_hids/prj.conf      |    7 +
 samples/bluetooth/peripheral_hids/prj.mdef      |    5 +
 samples/bluetooth/peripheral_hids/prj_nble.conf |    5 +
 samples/bluetooth/peripheral_hids/src/Makefile  |    4 +
 samples/bluetooth/peripheral_hids/src/main.c    |  155 +++
 samples/bluetooth/peripheral_hids/testcase.ini  |   19 +
 tests/bluetooth/init/prj_controller.conf        |   13 +
 tests/bluetooth/init/prj_controller_dbg.conf    |   25 +
 tests/bluetooth/init/testcase.ini               |   16 +
 tests/bluetooth/shell/prj.conf                  |    3 +-
 tests/bluetooth/shell/prj_br.conf               |   18 +
 tests/bluetooth/shell/src/main.c                |  115 ++-
 tests/bluetooth/shell/testcase.ini              |    9 +
 tests/bluetooth/tester/btp_spec.txt             |  149 +++
 tests/bluetooth/tester/prj.conf                 |    1 +
 tests/bluetooth/tester/prj_nimble.conf          |    1 +
 tests/bluetooth/tester/src/Makefile             |    4 +-
 tests/bluetooth/tester/src/bttester.c           |    9 +
 tests/bluetooth/tester/src/bttester.h           |    3 +
 tests/bluetooth/tester/src/gatt.c               |    9 +-
 tests/bluetooth/tester/src/l2cap.c              |   14 +
 113 files changed, 19979 insertions(+), 860 deletions(-)
 create mode 100644 drivers/bluetooth/controller/Kconfig
 create mode 100644 drivers/bluetooth/controller/Makefile
 create mode 100644 drivers/bluetooth/controller/hal/ccm.h
 create mode 100644 drivers/bluetooth/controller/hal/clock.c
 create mode 100644 drivers/bluetooth/controller/hal/clock.h
 create mode 100644 drivers/bluetooth/controller/hal/cpu.h
 create mode 100644 drivers/bluetooth/controller/hal/debug.h
 create mode 100644 drivers/bluetooth/controller/hal/ecb.c
 create mode 100644 drivers/bluetooth/controller/hal/ecb.h
 create mode 100644 drivers/bluetooth/controller/hal/hal_irq.h
 create mode 100644 drivers/bluetooth/controller/hal/hal_rtc.h
 create mode 100644 drivers/bluetooth/controller/hal/hal_work.h
 create mode 100644 drivers/bluetooth/controller/hal/irq.c
 create mode 100644 drivers/bluetooth/controller/hal/radio.c
 create mode 100644 drivers/bluetooth/controller/hal/radio.h
 create mode 100644 drivers/bluetooth/controller/hal/rand.c
 create mode 100644 drivers/bluetooth/controller/hal/rand.h
 create mode 100644 drivers/bluetooth/controller/hal/rtc.c
 create mode 100644 drivers/bluetooth/controller/hci/hci.c
 create mode 100644 drivers/bluetooth/controller/hci/hci.h
 create mode 100644 drivers/bluetooth/controller/ll/ctrl.c
 create mode 100644 drivers/bluetooth/controller/ll/ctrl.h
 create mode 100644 drivers/bluetooth/controller/ll/ctrl_internal.h
 create mode 100644 drivers/bluetooth/controller/ll/ll.c
 create mode 100644 drivers/bluetooth/controller/ll/ll.h
 create mode 100644 drivers/bluetooth/controller/ll/pdu.h
 create mode 100644 drivers/bluetooth/controller/ll/ticker.c
 create mode 100644 drivers/bluetooth/controller/ll/ticker.h
 create mode 100644 drivers/bluetooth/controller/main.c
 create mode 100644 drivers/bluetooth/controller/util/defines.h
 create mode 100644 drivers/bluetooth/controller/util/mem.c
 create mode 100644 drivers/bluetooth/controller/util/mem.h
 create mode 100644 drivers/bluetooth/controller/util/memq.c
 create mode 100644 drivers/bluetooth/controller/util/memq.h
 create mode 100644 drivers/bluetooth/controller/util/util.c
 create mode 100644 drivers/bluetooth/controller/util/util.h
 create mode 100644 drivers/bluetooth/controller/util/work.c
 create mode 100644 drivers/bluetooth/controller/util/work.h
 create mode 100644 include/bluetooth/hci_raw.h
 create mode 100644 include/bluetooth/rfcomm.h
 create mode 100644 net/bluetooth/hci_raw.c
 create mode 100644 net/bluetooth/keys_br.c
 create mode 100644 net/bluetooth/rfcomm.c
 create mode 100644 net/bluetooth/rfcomm_internal.h
 create mode 100644 samples/bluetooth/btusb/Makefile
 create mode 100644 samples/bluetooth/btusb/prj.conf
 create mode 100644 samples/bluetooth/btusb/src/Makefile
 create mode 100644 samples/bluetooth/btusb/src/btusb.c
 create mode 100644 samples/bluetooth/btusb/testcase.ini
 create mode 100644 samples/bluetooth/gatt/hog.c
 create mode 100644 samples/bluetooth/gatt/hog.h
 create mode 100644 samples/bluetooth/peripheral_hids/Makefile
 create mode 100644 samples/bluetooth/peripheral_hids/prj.conf
 create mode 100644 samples/bluetooth/peripheral_hids/prj.mdef
 create mode 100644 samples/bluetooth/peripheral_hids/prj_nble.conf
 create mode 100644 samples/bluetooth/peripheral_hids/src/Makefile
 create mode 100644 samples/bluetooth/peripheral_hids/src/main.c
 create mode 100644 samples/bluetooth/peripheral_hids/testcase.ini
 create mode 100644 tests/bluetooth/init/prj_controller.conf
 create mode 100644 tests/bluetooth/init/prj_controller_dbg.conf
 create mode 100644 tests/bluetooth/shell/prj_br.conf

Change-Id: I98253a11e4ca6953def3d7a764ca6aa60a7f29ff
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-09-07 16:21:38 +03:00
Vinayak Chettimada 2253f9b2b0 Bluetooth: Controller: alternate ticker compare set logic
Paranoid with older compare set logic, the changes in this
commit is better in avoiding compares being set to stale
count values (values in past). Compares shall always be set
in future w.r.t to current count value in the counter h/w.

No longer using fp_worker_sched() to explicitly run the
worker because there may be no ticks elapsed when worker
runs, which leads to ticker job running thereafter not to
update the compare to a new value, probably leading to a
stalled controller roles.

Change-id: If07f648357585ebb80c35d1320210eac3137781c
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2016-09-07 13:19:37 +00:00
Carles Cufi 5a271f913c build: Use __CYGWIN__ to detect Cygwin
The old __CYGWIN32__ does not work with the 64-bit version
of Cygiwn. Using __CYGWIN__ instead allows us to build
gen_idt.c under 64-bit Cygwin.

Change-Id: I6590767153e929764f0b448f74bb8e3f2e593a6a
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-09-07 12:58:55 +00:00
Carles Cufi d29576b365 kconfig: Specify ncurses explicitely
On OS X (macOS), "make menuconfig" fails with missing
linker symbols. By specifying the "-l" linker options
with the menu, panel and ncurses libraries directly if
the autodetection fails, it builds and links properly.
Note that this might denote a problem with
"check-lxdialog.sh".

Change-Id: Ib2721646cc01c3e977911d8e6d0c8303dcedbc58
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-09-07 12:58:29 +00:00
Anas Nashif 0699191d33 tests: fixed resulting binary name in README
We no longer produce nanokernel.elf or microkernel.elf.

Change-Id: I37cb985ddc90f4129f122b9209d306898a71a596
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-09-07 12:56:03 +00:00
Grzegorz Kolodziejczyk 81e10314ef Bluetooth: tester: Add L2CAP init method
This adds method which initialize data pool for L2CAP data.

Change-Id: I2b170489aa4b2afc3c1f962591f377e23d147161
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-09-07 09:08:47 +00:00
Jaganath Kanakkassery 028bf3fb88 Bluetooth: RFCOMM: Modify bt_rfcomm_dlc() to return dlc
Currently bt_rfcomm_dlc() is returning error code and dlc is returned
as output param. Since caller does not need to check error, it can
return NULL if some error happens

Change-Id: I86e85b67545edb960b4b745267e6645017373bf6
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
2016-09-07 07:22:38 +00:00
Jaganath Kanakkassery 2df4bf6237 Bluetooth: RFCOMM: Implement TX flow control
Data sent by user will be queued in a FIFO. A TX fiber will be
started for each DLC which process this FIFO and write to L2CAP.
Fiber will sleep in two scenarios - no buffer in FIFO, no TX
credit. Credit is handled using semaphore. So if credit is 0
then fiber will wait on semaphore and will be scheduled when
it receives credit.

Change-Id: Id6e796eed594b28d6fb6e4259d3ed52634db9335
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
2016-09-07 07:22:32 +00:00
Vinayak Chettimada d72b06da56 Bluetooth: GATT: Fix ccc cfg leak
ccc cfg is allocated when a peer updates a ccc value. This
fix will retain a cfg only if the new value is not default.

Change-id: I586082818145e43c771a6fccdb0bf2b3cecdd30c
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2016-09-07 05:19:45 +00:00
Carles Cufi 42f7ab9443 Bluetooth: Controller: Switch to Zephyr's hci.h for cmd handling
Start using Zephyr's include/bluetooth/hci.h for HCI command
handling.
This is the first commit in a series that transitions from
the structures in hci.c to the ones in hci.h.

Jira: ZEP-726

Change-Id: I1d79586b85d25c8ef707b8a2b19a27a77b08b819
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-09-07 08:17:26 +03:00
Carles Cufi 0762a5c744 Bluetooth: HCI: Add definitions and macros
Add multiple definitions and macros required by the
controller's HCI layer.

Jira: ZEP-726

Change-Id: I2d4ce0a740495613128092c56ee1b16a232bb076
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-09-07 08:17:26 +03:00
Vinayak Chettimada 73808e25d6 Bluetooth: GAP: Support multiple peripheral role connections
Fix the use of BT_DEV_KEEP_ADVERTISING and BT_DEV_ADVERTISING
so as to permit multiple peripheral role connections if the
controller supports Bluetooth Spec. v4.2 LE Topology.

Change-Id: Ia363181754cb788c13e9050e5fe5416201593c07
Signed-off-by: Vinayak Chettimada <vinayak.kariappa.chettimada@nordicsemi.no>
2016-09-07 08:17:26 +03:00
Carles Cufi 49583b10d0 Bluetooth: HCI: Rename cmd complete struct
For consistency, add the bt_ prefix to
hci_evt_cmd_complete.

Jira: ZEP-726

Change-Id: I0deb9f12913991bf52ccffc8c85b86c83da1c045
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-09-07 08:17:26 +03:00
Carles Cufi cdb197c727 Bluetooth: Controller: Unify handling of CC and CS
Place common code in hci_evt_handle() so as to avoid code
duplication in the handling of command complete and
command status events.

Jira: ZEP-726

Change-Id: I35ffcb63518b52a2b209f83ef6b8bbb1d1b4a849
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-09-07 08:17:26 +03:00
Carles Cufi 4ecc06c1e2 Bluetooth: Controller: Unify handling of unknown command
Handle all instances of an unknown OCF in a common place
instead of it being spread in multiple functions.

Jira: ZEP-726

Change-Id: Ibd9ebe429754980b243cb8772702cfeb59b0a18b
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-09-07 08:17:26 +03:00