Commit graph

42559 commits

Author SHA1 Message Date
Johan Hedberg
b9d13664ab Bluetooth: Create protocol-specific outgoing ACL buffer pools
With this split we get better control of the buffer sizes and counts.
We also anyway will need a fragments pool so a simple generic ACL_OUT
pool doesn't make sense anymore. The related Kconfig options for that
have been removed.

Change-Id: I616cf49915a1cc0dc0ddc724e2e182bcbe0c80f6
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:45 -05:00
Johan Hedberg
1f6841c9c1 Bluetooth: Convert driver header info to hidden Kconfig options
We know the needed values at build-time, so there's no point in having
a runtime mechanism of accessing them in the code. Having the values
as defines makes it e.g. possible to use them as input for defining
the size of buffer pools.

Change-Id: Ib7556644719bfb631e638fa5bf29f3d1747a5072
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:45 -05:00
Johan Hedberg
4599fa1db3 Bluetooth: Move ACL_OUT buffer management to conn.c
This seems like a more appropriate place, and it's where we'll anyway
need to manage a separate pool for ACL_OUT fragments.

Change-Id: I6e0e2ec67d2f89a7f09787a3674405570d9b9cce
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:45 -05:00
Johan Hedberg
32f5826a1b Bluetooth: Add bt_conn_init() API
This helps move the ACL_OUT buffer management into conn.c.

Change-Id: Ie5ef48e02eeef5077f433e42c1e2eba9bdb94f63
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:45 -05:00
Mariusz Skamra
992237bc51 Bluetooth: Add bt_conn_enc_key_size function
This patch adds bt_conn_enc_key_size function which will be used
by application to check encryption keys size of a encrypted connection.
This will be used especialy by GATT applications, because some
attributes to be accessed require encryption with specified
minimum encryption key length.

> ACL Data RX: Handle 64 flags 0x02 dlen 7         [hci0] 708547.536685
      ATT: Read Request (0x0a) len 2
        Handle: 0x0003
< ACL Data TX: Handle 64 flags 0x00 dlen 9         [hci0] 708547.544302
      ATT: Error Response (0x01) len 4
        Read Request (0x0a)
        Handle: 0x0003
        Error: Insufficient Encryption Key Size (0x0c)

Change-Id: Idbc9afde7ec80504898bd8d1e193f3e71a93f3f9
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:24:45 -05:00
Szymon Janc
89cfd86f2f Bluetooth: SMP: Fix using JustWorks when MITM was required
JustWorks pairing should be forced only if both sides don't require
MITM. Code checking this was incorrect and forced JustWorks even if
one side required MITM.

Change-Id: I70312b6832218f430546896ae1f2283ae6ce7c60
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:24:45 -05:00
Szymon Janc
1baada5589 Bluetooth: Remove not needed key look-up in update_sec_level
Keys in struct conn are set before encryption is enabled so there is
no need to look-up those every time security level is updated.

Change-Id: Ib0edb3c40fd2c5deca00055ed3f3ae7414a5df8e
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:24:45 -05:00
Szymon Janc
47e3db235d Bluetooth: Fix not setting keys for connection as master
If no keys are set for connection look-up it done. If keys are already
present there is no need for another look-up.

Change-Id: I0518772c4c9d8458b4b79aa7cb34a049324fb552
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:24:44 -05:00
Johan Hedberg
3cae902928 Bluetooth: Make HCI driver send() consume the given buffer
It is more intuitive to assume that the driver send() consumes (takes
ownership) of the buffer given to it.

Change-Id: I53d9cbebc0564d1d11110fc78a62ce0bbb3cdfd2
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:44 -05:00
Arkadiusz Lichwa
555d0d2594 Bluetooth: Refactor bt_conn struct
Isolates existing LE connection specific attributes and
prepares for now empty BR/EDR specific connection internals.

Change-Id: Ib423306fbf60e8451998e3933aee00cb672a1106
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-02-05 20:24:44 -05:00
Mariusz Skamra
f3f63d0fb0 Bluetooth: Cleanup comments in GATT API
This removes some outdated comments, adds missing ones
and fixes some major typos.

Change-Id: I3e6c0c1b88c67852fc8c24eb2ff35d74af8bc656
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:24:44 -05:00
Arkadiusz Lichwa
4970defaa4 Bluetooth: Refactor br_init()
Don't jump to BR/EDR read buffer size if LE read buffer size
returned LE data packet length value > 0 in le_init().

Change-Id: If0efa9f239ef75d832cf0f89ae6f227788cbf175
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-02-05 20:24:44 -05:00
Arkadiusz Lichwa
99bd06deaa Bluetooth: Refactor bt_dev struct
Groups LE stack specific values.

Change-Id: Ia947d25c105f518287293b4f870466daa416385c
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-02-05 20:24:44 -05:00
Johan Hedberg
20d946efa8 net: buf: Fix minor typo
Change-Id: Ibe47982cf3aeb1f4e2d700c4e7d11a77991ef6df
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:44 -05:00
Johan Hedberg
72050e2352 net: buf: Require destroy callbacks to handle returning to free FIFO
There could be cases where the destroy callback needs more
fine-grained control of step ordering than "1. destroy, 2. put back to
free FIFO". One case could be when the the pool needs to be protected
by a microkernel mutex or semaphore. In such a case the putting back
to the FIFO may need to happen before a custom action in the destroy
callback.

Making the destroy callback responsible for returning to the free FIFO
gives full flexibility regarding the order of the cleanup actions.

Change-Id: Ib9532d1dd70e0a2042af54ebd3e40a853dd42d33
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:44 -05:00
Luiz Augusto von Dentz
47fd65fdcf Bluetooth: L2CAP: Add #ifdef for l2cap_chan_le_recv
l2cap_chan_le_recv and related code should only be compiled if
CONFIG_BLUETOOTH_L2CAP_DYNAMIC_CHANNEL is defined.

Change-Id: Ia83e2010cdf251afc0a5cbf24b54173926de84c5
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:24:44 -05:00
Luiz Augusto von Dentz
8eaae649a7 Bluetooth: L2CAP: Fix documentation of bt_l2cap_server_register
Fix format of bt_l2cap_server_register documentation.

Change-Id: I22322a235bb1d6b6752bfe13ce8e305481649125
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:24:44 -05:00
Johan Hedberg
a8bd3c358d Bluetooth: Fix missing sem_give() for ncmd when driver send() fails
If we fail to send an HCI command to the HCI driver we should give back the
semaphore that counts available commands.

Change-Id: I4aedf662c8b96d57ebafeb471deeb911c5f8ac7a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:44 -05:00
Johan Hedberg
f1ebd8e513 Bluetooth: Fix missing sem_give() for ACL data when driver send() fails
If we fail to send an ACL packet to the HCI driver we should give back
the semaphore that counts available buffers on the controller side.

Change-Id: Ibad4039d24bcd49fe40b1f87608e1ad4c0248251
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:44 -05:00
Johan Hedberg
fa5dfa1366 Bluetooth: Kconfig: Make ACL buffer count ranges more reasonable
We need at least 2 buffers in each direction in case of fragmentation,
and there's no need to have such a low maximum count.

Change-Id: Ie25f4ebb231176a855e9651cb896fa8b59279629
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:44 -05:00
Johan Hedberg
db946d8bae Bluetooth: Add convenience defines for ACL handles
These make the code more readable when it comes to encoding and
decoding ACL handle values.

Change-Id: Ibd1972d6001c6c0c55428300f839b288dff1ce52
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:44 -05:00
Szymon Janc
542bb9cc34 Bluetooth: Fix disconnect command in shell application
Disconnect command is special since it is also used for cancelling
outgoing connection. Due to this is might be called with default_conn
set to NULL. To avoid conditional unref always pick extra reference
from default_conn for local use.

Change-Id: I59ad583becbf39a71366069d0307aa44f2c64174
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:24:44 -05:00
Dmitriy Korovkin
a4f6a32169 doc: Add flags to irq_connect(), IRQ_CONNECT_STATIC() and task_irq_alloc()
Change-Id: I671208ac3b1e9f6c26917e86c99337ff195ae2d4
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
2016-02-05 20:24:44 -05:00
Allan Stephens
bf223a8838 stdio: Fix bug in fputs()
The previous implementation mistakenly kept outputting the first
character of the string endlessly.

Change-Id: I299c627a52158218be8e88c952935edb87a636fe
Suggested-by: Tom Yeon <tom.yeon@windriver.com>
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:24:44 -05:00
Dmitriy Korovkin
f1420515a7 irq: Add flags to IRQ_CONNECT_STATIC() macro and irq_connect() function
Flags allow passing IRQ triggering option for x86 architecture.
Each platform defines flags for a particular device and then
device driver uses them when registers the interrupt handler.

The change in API means that device drivers and sample
applications need to use the new API.

IRQ triggering configuration is now handled by device drivers
by using flags passed to interrupt registering API:
IRQ_CONNECT_STATIC() or irq_connect()

Change-Id: Ibc4312ea2b4032a2efc5b913c6389f780a2a11d1
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
2016-02-05 20:24:44 -05:00
Dan Kalowsky
4a61c2824b i2c: adding in support for I2C1
Somehow through the process of enabling Galileo, we have partially lost
the functionality needed to enable I2C1.  Bringing back the I2C
configuration options for I2C1 to the DW IP block.

Change-Id: I296bd9c3d167969df5b2fe17627633f5ec4b1ba4
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:24:44 -05:00
Andrei Emeltchenko
71a19117d6 Bluetooth: Rename __unused to compile with newlib
__unused is define in sys/cdefs.h when building against newlib.

Change-Id: I0fad81dc91e1eb91368b5b3370e3fbb0fb7ba4a9
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:24:44 -05:00
Peter Mitsis
0497dabd36 k20uart: Fix uart fifo enabling logic
Change-Id: I9d48f0fb57e975ec336cf8a970c2678b695199a6
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:24:44 -05:00
Tomasz Bursztyka
74e29ac373 galileo: Use SCH GPIO driver for it's legacy bridge GPIO controller
Such controller offers 2 blocks (respectivelly Core Well and Resume
Well) on Quark x1000, with 2 and 6 GPIO pins to use.

Change-Id: I50075f0880bef4574e9eeb1c65602082e8da647a
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:44 -05:00
Tomasz Bursztyka
4effd20617 gpio: Add a driver for Intel's SCH controller
Such controller is found in legacy bridge on Intel's platforms. Such as
Poulsbo or Quark x1000.

Change-Id: I30f205f1e73aaa680092e92717fdacbb74046fa3
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:44 -05:00
Tomasz Bursztyka
72a26b5a38 gpio: mmio: Use i/o port bit operations functions
Now make use of sys_io_clear_bit and sys_io_set_bit

Change-Id: I11ebcd8c31d2a4c6d3dac37a0eca0ffcfacead61
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:44 -05:00
Tomasz Bursztyka
dc6a584650 gpio: dw: The callback should tell about the GPIO pin
A tiny fix where the pin is the bit position, not its mask.

Change-Id: I4ed8c4b2968ff28b407cab88903351bafe6501ba
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:44 -05:00
Tomasz Bursztyka
7cbe13ce3f sys_io: x86: Fix I/O ports bit operations
I/O ports are not memory and thus such asm instruction cannot follow
such constraint. Plus, usual BT* instruction can be used on normal
registers.

Change-Id: Ie3aad668173962a0a90e7cb11231c7843836d412
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:44 -05:00
Tomasz Bursztyka
47369555b8 sys_io: x86: Make sys_in/sys_out fitting properly in other functions
Let the compiler decide about the registers to use, depending on which
functions those are called from (as they might be already in use or
not).

Change-Id: I00afa0f82c740c8ea70133d85ab67e9cb117187d
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:44 -05:00
Anas Nashif
6ba5c09d23 kconfig: change RAM_SIZE to be in hex
We already had this kconfig defined as hex for arc. Make it
readable and change the variable to hex to comply with what
we had already.

Change-Id: Ib8bc72f27d1b97ba2c886201ec29fb13aa4fa429
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:43 -05:00
Anas Nashif
c5ad109c7b fsl_frdm_k64f: do not declare kernel type
This is done from the kernel fragments, no need to declare it here.
(micro kernel is the default anyways)

Change-Id: I88511c03f44538cab3e8fbf8292e179e01005b0d
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:43 -05:00
Anas Nashif
a3f8d81614 cortex_m: re-add __start definition for cortex_m
This was removed as part of some Diab cleanup, however it is needed
and without the definition we get the following when building
for the FRDM-K64F  board:

arm-none-eabi-ld: warning: cannot find entry symbol __start; not setting start address

Change-Id: Ie0604a600b6f7a4faa321c58aa63c5617a163107
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:43 -05:00
Tomasz Bursztyka
b54138916a microkernel: Fix the documentation on semaphore
The documentation just needs to be swapped for isr_sem_give() and
fiber_sem_give().

Change-Id: I8e51dc63f6d567ade2fe52d63404dcdf1b9de968
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:43 -05:00
Yonattan Louise
16ddcfa43d Fix kernel event logger sample for nanokernel-only systems.
This commit fixes the nanokernel sample of the kernel event logger
that shows the event messages for context switch and interrupt events.

Change-Id: I4e972adb06b81f2f548bbabe8cd6577af633001c
Signed-off-by: Yonattan Louise <yonattan.a.louise.mendoza@intel.com>
2016-02-05 20:24:43 -05:00
Andrew Boie
c065ed5d78 x86: reduce footprint of exception debugging
We're smart, we can look up the vector IDs in a book if we
don't already know what they are.

Change-Id: Iaff3986d7c96dea597be4b2a5b13721ab57980fa
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:24:43 -05:00
Peter Mitsis
9fce2a2209 Remove obsolete ctors section
Remove prototype support for C++ constructors, since it is not well
designed. Device drivers (or other application code) that requires an
automatic initialization capability should use the device initialization
macros instead.

Note: Support for C++ constructors may be re-introduced at a later date.
However, a number of issues need to be settled, such as when the
constructors are invoked and what context they run in. (Running them
during nanokernel initialization, as was previously done, is probably
not the right approach.)

Change-Id: If6d27ac16b485cb39d5ec34084e9d0f1991074f4
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:24:43 -05:00
Peter Mitsis
067ed49efc k20UartDrv: Fix k20_uart_fifo_read()
Fixes the logic in the routine k20_uart_fifo_read() so that it reads the
data from UART if the status register 1 indicates that data is available.

Change-Id: I1722b013e05c7477587c07f5a0b90c753ba34aab
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:24:43 -05:00
Anas Nashif
833fb90087 doc: fix parameters to IRQ_CONFIG
Change-Id: I5c3e22ad2311faf76ada79a61eac7ccac5864334
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:43 -05:00
Andre Guedes
5b847c0aa2 x86: Fix IRQ_CONNECT_STATIC documentation
Since commit 3d7b21b69e the 'priority' parameter is used by the macro
IRQ_CONNECT_STATIC. This patch fixes the macro documentation which
says it is ignored.

Change-Id: I56eec49466a33441fa1822af78956ebb7f5c24ce
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
2016-02-05 20:24:43 -05:00
Anas Nashif
f75a8157e3 sanity: exclude Minute IA platforms from float tests
exclude Minute-IA platforms from tests that enable CONFIG_FLOAT.

Change-Id: Id186857403cb73d009b6e9e126c4e240f95dbf1a
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:43 -05:00
Anas Nashif
8ea9d02cdf sanity: add extra arguments when creating defconfigs
When config_whitelist is used in a testcase that has extra
arguments, those were not set correctly and the test case build would
fail in some cases.

Change-Id: Idb8a4f07d29beefe62de932afa7cc0986e8dd1d4
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:43 -05:00
Peter Mitsis
111323fc90 doc: Fix typo in nanokernel semaphore APIs
Change-Id: If3206b3113b7a47efc520887f53b3299e8da2404
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:24:43 -05:00
Vlad Lungu
3fc0f0f422 fsl_frdm_k64f: Increased NUM_IRQS to 86
Needed for the Ethernet MAC

Change-Id: Iecef5be818c87c34280ea32123f05b8f5974a998
Signed-off-by: Vlad Lungu <vlad.lungu@windriver.com>
2016-02-05 20:24:43 -05:00
Benjamin Walsh
665dd5d331 galileo: disable SPI_PORT_1 by default
Unused, uses IRQ17, which conflicts with UART1.

Change-Id: I5d285ee8a2e7e5d45b38a85a417bd36f0e4bb92e
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:24:43 -05:00
Dmitriy Korovkin
ea5ff12110 galileo: Add ADC configuration
Change-Id: I694d2812496220e54e757cb89ce0c529f3bad48f
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
2016-02-05 20:24:43 -05:00