Commit graph

19193 commits

Author SHA1 Message Date
Szymon Janc
e896804811 Bluetooth: SMP: Add support for encryption key size reduction
This allows to pair with devices that use reduced encryption key size.
Encryption key size is stored with keys for future use. LTKs are kept
in full form (16 bytes) and are reduced only when used.

As master:
< ACL Data TX: Handle 64 flags 0x00 dlen 11
      SMP: Pairing Request (0x01) len 6
        IO capability: NoInputNoOutput (0x03)
        OOB data: Authentication data not present (0x00)
        Authentication requirement: Bonding, No MITM, Legacy,
                                    No Keypresses (0x01)
        Max encryption key size: 16
        Initiator key distribution: EncKey Sign (0x05)
        Responder key distribution: EncKey IdKey Sign (0x07)
> ACL Data RX: Handle 64 flags 0x02 dlen 11
      SMP: Pairing Response (0x02) len 6
        IO capability: KeyboardDisplay (0x04)
        OOB data: Authentication data not present (0x00)
        Authentication requirement: No bonding, No MITM, Legacy,
                                    No Keypresses (0x00)
        Max encryption key size: 7
        Initiator key distribution: <none> (0x00)
        Responder key distribution: <none> (0x00)
...
< HCI Command: LE Start Encryption (0x08|0x0019) plen 28
        Handle: 64
        Random number: 0x0000000000000000
        Encrypted diversifier: 0x0000
        Long term key: df3cff52a981d6000000000000000000

As slave:
> ACL Data RX: Handle 64 flags 0x02 dlen 11
      SMP: Pairing Request (0x01) len 6
        IO capability: KeyboardDisplay (0x04)
        OOB data: Authentication data not present (0x00)
        Authentication requirement: No bonding, No MITM, Legacy,
                                    No Keypresses (0x00)
        Max encryption key size: 7
        Initiator key distribution: <none> (0x00)
        Responder key distribution: <none> (0x00)
< ACL Data TX: Handle 64 flags 0x00 dlen 11
      SMP: Pairing Response (0x02) len 6
        IO capability: NoInputNoOutput (0x03)
        OOB data: Authentication data not present (0x00)
        Authentication requirement: No bonding, No MITM, Legacy,
                                    No Keypresses (0x00)
        Max encryption key size: 16
        Initiator key distribution: <none> (0x00)
        Responder key distribution: <none> (0x00)
...
> HCI Event: LE Meta Event (0x3e) plen 13
      LE Long Term Key Request (0x05)
        Handle: 64
        Random number: 0x0000000000000000
        Encrypted diversifier: 0x0000
< HCI Command: LE Long Term Key Request Reply (0x08|0x001a) plen 18
        Handle: 64
        Long term key: 701b431a9e17bb000000000000000000

Change-Id: Ibc70aa01c040aff0d39410d273d6880d35aa5ae0
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:24:30 -05:00
Szymon Janc
36d5294f8c Bluetooth: Pass LTK length to bt_conn_le_start_encryption
This is in preparation for supporting different encryption key sizes.

Change-Id: I36ed61a35fbe4988ce863127ae318c63f9298dd3
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:24:30 -05:00
Luiz Augusto von Dentz
e8bc54d9d8 Bluetooth: L2CAP: Handle connection request
This handle connection request looking up for existing servers and
responding properly:

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

Change-Id: Ic0339518b80d9e38109f3efee6be4f0d2b084f1d
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:24:30 -05:00
Luiz Augusto von Dentz
f98f423381 Bluetooth: L2CAP: Add initial server support
This adds bt_l2cap_server_register which can be used to register a
server to a given PSM.

Change-Id: I301dc26a0ed881230568aa0fdd6cc5d0d6dd814a
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:24:30 -05:00
Andrei Emeltchenko
7c7a94ae4e doc: Correct Bluetooth sample lines
After license text was changed correct also code lines.

Change-Id: Idd3f34c38bb8ff9a40b6c02755f9716a98a6e86f
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:24:30 -05:00
Rodrigo Caballero
207916c173 doc: Edit the communication section.
Performed edits based on Steve's comments. This new change fixes the
merge conflict of a previous version.

Change-Id: Ib99ed9a28da94c5780115ab0221edc9409e74919
Signed-off-by: Rodrigo Caballero <rodrigo.caballero.abraham@intel.com>
2016-02-05 20:24:30 -05:00
Rodrigo Caballero
7306a61264 doc: edit the Galileo Platform documentation
Edited for grammar, style, markup, linkage, consistency.
This change was resubmitted to avoid having a nickname as author.

Change-Id: Ie3a1a16c33939062ce2e139024afd2162a0c802d
Signed-off-by: Steve Ballard <stephen.r.ballard@intel.com>
Signed-off-by: Rodrigo Caballero <rodrigo.caballero.abraham@intel.com>
2016-02-05 20:24:30 -05:00
Rodrigo Caballero
ccc25e0063 doc: Edit the doxygen.rst file.
Minor changes to formatting to make guidelines clearer.
Edit for clarity, readability and markup. Cleared whitespace error.

Change-Id: I050857653303cfae32875b1b6c2151b22271c0b6
Signed-off-by: L.S. Cook <leonax.cook@intel.com>
Signed-off-by: Rodrigo Caballero <rodrigo.caballero.abraham@intel.com>
2016-02-05 20:24:30 -05:00
Javier B Perez Hernandez
7ea76b96fd Change new files from BSD-3 licenses to Apache 2.0
Change the new files from Intel in BSD-3 to Apache 2.0

Change-Id: Ica4b455e9cb8134889f2a88e2d96094ce7093734
Signed-off-by: Javier B Perez Hernandez <javier.b.perez.hernandez@linux.intel.com>
2016-02-05 20:24:30 -05:00
Allan Stephens
83946282a9 init: Optimize device_get_binding()
Improves the efficiency of the search by doing a single pass through
all device objects, rather than searching one level at a time.
Also enhances the comments for this routine.

Change-Id: I6786f24381f03d74d8c559ccbd7aa6a37683a8b7
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:24:30 -05:00
Allan Stephens
a860cb7bff init: Support fine-grained device initialization priorities
Introduces the SYS_DEFINE_DEVICE() macro, which supports 5 distinct
levels of device initialization and 100 priorities within each level.

Note: The existing init macros (e.g. nano_early_init()) have been
adapted to utilize the enhanced initialization model, but will
eventually be retired.

Change-Id: If677029d8b711a3fae9b2f32b5470cd97d19aeda
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:24:30 -05:00
Allan Stephens
acd9ffe5fb init: Simplify code for array of UART devices
Gets rid of obsolete #ifdefs, since the name of a UART device's
associated variable is now constant regardless of when it is
initialized.

Change-Id: Ic6b5ce7777f067fb57aee33899a644c63040d41f
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:24:29 -05:00
Allan Stephens
7b006066a4 init: Simplify symbol name generated by DECLARE_DEVICE_INIT_CONFIG()
Gets rid of the trailing initialization level character from the
name of the device variable generated by the macro, since it serves
no useful purpose. (The linker scripts place the various initialization
sections in ascending order based on the name of the section, so there
is no need to embed the initialization level in the variable name itself.)

Change-Id: I56bb79a513b8f77fb1f3fbaccec14454c2520772
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:24:29 -05:00
Tomasz Bursztyka
86db1b37bd arc: IRQ_CONFIG should not enable the irq
Drivers do it by themselves, usually either in a dedicated irq
configuration function or direcly in their initialization routine.

Change-Id: Id1cca1a1e3e3f36264d99d1d2f2d651d84e0687e
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:29 -05:00
Allan Stephens
f330d5adfe microkernel: Don't initialize packets in a command packet set
Reworks the internal design of a command packet set so that
the command packet array is split out into a separate variable
lying in uninitialized memory. This shrinks the command packet's
data section footprint to almost nothing.

Note: A side effect of this change is that it is no longer possible
to define a command packet set as a "static" variable since the
CMD_PKT_SET_INSTANCE() macro now generates two variables.

Change-Id: I9c7ebe637edf879758589ff4a26ace1303790bf7
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:24:29 -05:00
Tomasz Bursztyka
7193a3e007 sys_io: arc: Add sys_in*/sys_out* functions
This functions - reusing _arc_v2_aux_reg_* ones - will ease porting
drivers to ARC architecture hiding arch specific calls under generic
functions. On ARC, auxiliary registers is conceptually comparable to
x86 ports, thus the possibility to bring sys_in/sys_out to access those.

Change-Id: Ic5c0fc41f32ec4ad861dbb58cd8defaf4497bc03
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:29 -05:00
Dan Kalowsky
61d87f57f8 grove-lcd: import of Grove LCD I2C controller
Initial import of the Grove LCD I2C controller.  Data sheet can
be found at:
http://www.seeedstudio.com/wiki/images/0/03/JHD1214Y_YG_1.0.pdf

[DL: Updated command sequence according to datasheet.]

Change-Id: Id1b491f8dce346769dc42c41fac0ea3aabe3950a
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
2016-02-05 20:24:29 -05:00
Rodrigo Caballero
314432e90f doc: Edit About Zephyr for readability.
Edit the content, adding bold text and headings for readability.
Revised the structure based on comments by developers.
Resubmitted to solve merge issues.

Change-Id: I7679eb7c71eab5cd18addcdb296c376923984494
Signed-off-by: L.S. Cook <leonax.cook@intel.com>
Signed-off-by: Rodrigo Caballero <rodrigo.caballero.abraham@intel.com>
2016-02-05 20:24:29 -05:00
Rodrigo Caballero
ebbecd072b doc: Edits to the about.rst and simple.rst files.
Book titles need italics, other minor issues Line length fixed.
Markup errors corrected.
Resubmitted to solve merge issues.

Change-Id: I069463a45655e1bd4c57828008c0868083757344
Signed-off-by: L.S. Cook <leonax.cook@intel.com>
Signed-off-by: Rodrigo Caballero <rodrigo.caballero.abraham@intel.com>
2016-02-05 20:24:29 -05:00
Anas Nashif
0066da7b65 checkpatch: ignore PREFER_KERNEL_TYPES
u16 and other types are linux specific

Change-Id: I5df86fb511343ac0db18fd9b919f37a5cada6ef1
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:29 -05:00
Anas Nashif
9104031a96 toolchain: change aligned/used macros to support external c libraries
use __aligned__ and __used__ instead of aligned/used to avoid conflicts
with macros of the same name.

Change-Id: Ic36067dfc9df7ebcea486a075f759825d0dbde70
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:29 -05:00
Anas Nashif
db13998741 toolchain: change section macro to support external c libraries
rename the sections macro to avoid conflicts with the same
macro being defined in sys/cdefs.h of an external libc.

Change-Id: I4d9e060eeff788ca4112c0ad3e98f0bea135f145
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:29 -05:00
Anas Nashif
360682b5b5 toolchain: extend iamcu variant to support provided libc
Change-Id: I2c6681a4ea3a4c8bc2367a5e9d6baeabc5a0dd90
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:29 -05:00
Anas Nashif
fa2e18b294 kbuild: make menuconfig work with local configuration
Calling 'make menuconfig' from an application will prepare
the configuration defined in the application (Makefile) and
will launch menuconfig with the correct configuration rather
than the default for the architecture.

Change-Id: I6c611ddaa23b67632c507291294a73b6c4283cea
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:29 -05:00
Rodrigo Caballero
a5e1b78141 doc: Changed the API table in the Bluetooth document.
Changed the existing API table to a list as it was done
in the Kernel Primer.

Change-Id: Ib0d7952c650316b414ac9258ab3c48e9f6c70c4e
Signed-off-by: Rodrigo Caballero <rodrigo.caballero.abraham@intel.com>
2016-02-05 20:24:29 -05:00
Anas Nashif
cbfb62c93d checkpatch: Update to latest version from the Linux kernel
Lots of enhancements and bug fixes but primarily it fixes an issue
where checkpatch was reporting errors in lines that have not changed.

Change-Id: If141a294b92cbabd4ad8978a40168abb062aebfb
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:29 -05:00
Anas Nashif
20439b488e gcc: build with -fstack-usage
will generate an extra file that specifies the maximum amount
of stack used, on a per-function basis.

Using a static stack checker the data can be analysed, for example:
   http://dlbeer.co.nz/oss/avstack.html

Change-Id: I23bd8ce7c4516bd0c7ffb74504e6d379677f25f8
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:29 -05:00
Tomasz Bursztyka
d2669b7a00 spi: intel: Port 0 needs gpio driver to be ready if using it for CS
GPIO driver is initialized at pre-kernel-late level, if SPI does it too,
it will happen before GPIO (depends on the ordered list of
initialization). In order to ensure it gets GPIO initialized always
before SPI, let's set SPI to initalize at the next level: nano-early.

Change-Id: I6e34168c88fca0187a809bf5c7971492bd5acb5c
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:29 -05:00
Anas Nashif
ecf3951990 samples: disable exception debug for test_static_idt
This test fails with exception debug enabled.  Make sanity pass again
while we debug this issue.

Change-Id: I0df279d2ec2f8fb29c30d25ec0d05da18e929964
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:29 -05:00
Andrew Boie
be3e3b0f8c x86: Improve exception/trap debugging
Currently when an unhandled exception or trap occurs, we don't know
specifically which one happened. The CONFIG_EXCEPTION_DEBUG option
installs handlers for various exceptions and prints out details
when they happen.

Change-Id: I4d3fe4544c3e2583c4f83b306b86ac0595d9ce0e
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:24:29 -05:00
Dmitriy Korovkin
4d2fa77334 spi: Fix SPI configuration flags
SPH and SPO flags are not mutual exclusive, this way
they need to occupy different bit fields.

Added missing () around _in_ parameters of macros as well.

Change-Id: I6175231dddaca84a2a3190a5d0a388496a549baf
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
2016-02-05 20:24:29 -05:00
Rodrigo Caballero
8e56617761 doc: Edit the build systems's Targets Documentation.
Remove unnecessary bullets and replaced them with indentation.
Added articles and performed other edits for clarity, markup and style.

Change-Id: I390d04a6a3c20eabde2eb100cac4fc88a3ca8cc8
Signed-off-by: Rodrigo Caballero <rodrigo.caballero.abraham@intel.com>
2016-02-05 20:24:29 -05:00
Rodrigo Caballero
367a8a7c1a doc: Edit the Application Development information of the build system.
The document was edited for clarity, style, consistency, grammar, and
spelling.

Change-Id: If1af5cfd8285bb13606a1bff257177521af7ab3d
Signed-off-by: Rodrigo Caballero <rodrigo.caballero.abraham@intel.com>
2016-02-05 20:24:29 -05:00
Rodrigo Caballero
2a0f0bc150 doc: Edit the build system's toolchains documentation.
Edited grammar, spelling, style, markup and consistency.

Change-Id: I4629924d153d6ae3e8b2756fb382a8f761933599
Signed-off-by: Rodrigo Caballero <rodrigo.caballero.abraham@intel.com>
2016-02-05 20:24:29 -05:00
Rodrigo Caballero
c1c1ffe7f7 doc: Change API tables to lists in the Kernel Primer.
The tables in the Kernel Primer are changed to lists. Making it easier
to update them. Other minor changes were done to ensure consitency.
The :c: and :cpp: markup has been fixed. When the documentation for a
call exists, then it is linked.

Change-Id: I8f389a0a0ca7c5fe904c0a1fa520e2e499f1001b
Signed-off-by: Rodrigo Caballero <rodrigo.caballero.abraham@intel.com>
2016-02-05 20:24:29 -05:00
Javier B Perez Hernandez
f7fffae8aa Change BSD-3 licenses to Apache 2
Change all the Intel and Wind River code license from BSD-3 to Apache 2.

Change-Id: Id8be2c1c161a06ea8a0b9f38e17660e11dbb384b
Signed-off-by: Javier B Perez Hernandez <javier.b.perez.hernandez@linux.intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-02-05 20:24:29 -05:00
Peter Mitsis
5705d06874 x86: Properly initialize _interrupt_vectors_allocated[] bitmap
Updates the 'gen_idt' tool to generate a bitmap of (statically) allocated
interrupt vectors that is linked into the final image in a manner similar to
the static IDT. The kernel then uses this bitmap when dynamically connecting
an interrupt vector, thereby preventing the dynamic irq connections
from clobbering the static irq connections.

Change-Id: I0a8f488408dad4912736865179f32f63ff1ca98f
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:24:28 -05:00
Peter Mitsis
56fa1a98d0 x86: Update generation of static IDT
Adds two new fields to the ISR_LIST structure (irq and priority) to allow
the decoupling of the vector ID and priority from the IRQ number at some
future time.

As a result of the addition of these two new fields, the gen_idt tool is
modified to both process these new fields as well as validate them.

Change-Id: I343dac68d99c78168a25b19784140f85d5db7578
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:24:28 -05:00
Peter Mitsis
3dc247825c Refactor gen_idt
Refactor gen_idt tool to detect more errors as well as be both more clear and
easily expanded.

Change-Id: I035a0666871733cc670f64302a1e85be455550ee
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:24:28 -05:00
Peter Mitsis
ad76795063 gen_idt: Fix issues found by checkpatch
Change-Id: Ib486d8453c16c093dd188cd9e84c1eb2282ab746
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:24:28 -05:00
Peter Mitsis
b8780c7813 gen_idt: Update file description section
Change-Id: Ice0c88228f5d79404277502f68594db91058344b
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:24:28 -05:00
Peter Mitsis
25359412ba x86: Do not use IRQ priority for DPL
Fixes a bug in the x86 IRQ_CONNECT_STATIC() macro that resulted in setting
the DPL for the interrupt to the IRQ priority level.

Note 1: Using a proper value for the DPL (instead of the priority) prevents
the corruption of the other IDT fields.

Note 2: The priority of the IRQ is completely ignored.

Change-Id: Ic9f59bd91db4b356263f533cc26a0168b1d236e1
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:24:28 -05:00
Peter Mitsis
3bcaad8a39 x86: Simplify _IntVecAlloc() logic
Instead of using logic choosing between invoking find_lsb_set() and
find_msb_set(), mask out the unwanted bits and always invoke find_lsb_set().
This also has the side benefit of simplifying the error checking when DEBUG is
enabled.

Change-Id: I7f3e529ab3807b4433291197793e79e371d06ae3
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:24:28 -05:00
Peter Mitsis
616ca21599 x86: Lock interrupts when connecting interrupts
When dyanmicaly connecting an interrupt via irq_connect(), interrupts must be
locked both when allocating a dynamic interrupt stub and when updating the
interrupt descriptor table (IDT) to prevent race conditions.

Change-Id: I9c68c1f73dda478880f1a32793a84cb6eb87735e
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:24:28 -05:00
Peter Mitsis
ae448ff6ca Update galileo minimal footprint configuration
The galileo minimal footprint project requires at least 53 IDT entries
to accommodate the HPET.  This is due to the current algorithm used to
map an IRQ number to an interrupt vector.
            Interrupt vector = IRQ number + 0x20

Change-Id: I6de2cd72da631af04237615082823e7de65d8b22
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:24:28 -05:00
Rodrigo Caballero
e53aa04dc1 doc: Friendlier advice for contributing to project.
Edited file to have a friendlier tone regarding collaboration standards for the project.

Signed-off-by: Leona Cook <leonax.cook@intel.com>
Change-Id: I5e02b9d9065c3c9c4d96ed67215770167b9b94e1
Signed-off-by: Rodrigo Caballero <rodrigo.caballero.abraham@intel.com>
2016-02-05 20:24:28 -05:00
L.S. Cook
d229efe476 doc: cleaning up tone to be a little more polite to potential feedback givers
Gerrit review improvements

Signed-off-by: Leona Cook <leonax.cook@intel.com>
Change-Id: I39d00195c47ac015246068b308ef69e0ecb2d024
2016-02-05 20:24:28 -05:00
Anas Nashif
a401ddec57 remove linux configs and compile options not being used
The makefile has some options we do not have in Zephyr, so better
remove them to avoid any confusion and misconfiguration.

Change-Id: I35663261bceb741a28d35bdbe87df451aa298c86
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:28 -05:00
Anas Nashif
1cc1ac4b2f move cflags setting to arch/<arch>/Makefile
Move Zephyr specific CFLAGS that depend on config options to
the Makefile where they can better be managed among other cflag
options.

Change-Id: Ia79a2f2def4f51857f6d661aa78e9fb7eb7a5e22
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:28 -05:00
Anas Nashif
6f8d628d77 re-enable compile time option checking and make it conditional
When building a sinle application, use the compiler option checking
macro, disable macro if running sanity checks to speed up build
time.

Change-Id: I63b17f4bd9fdff9030f1b2550ec8b05ee0bc2df2
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:28 -05:00