Commit graph

18591 commits

Author SHA1 Message Date
Allan Stephens
32826127de Rename nanokernel files
Makes various nanokernel file names more accurately reflect their
actual roles, and improves consistency with other naming conventions.

Change-Id: Ibea5a66a8d66c4e41810d6b3d70b4c459a3848a8
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:13:59 -05:00
Allan Stephens
4d30cd8408 Eliminate unnecessary operations during nanokernel initialization
There is no need to have code to set fields of _nanokernel to zero,
since the variable is zeroed out during BSS initialization.

Change-Id: I338369511d8b0bcc2fb2b6104acdd281dac9a926
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:13:59 -05:00
Allan Stephens
16f935ab1f Cosmetic changes to nanokernel initialization code
1) Revises name of background/idle task stack area to make it
   more meaningful.
2) Converts a routine to be non-global since it isn't used elsewhere,
   and renames it to remove an unneeded leading underscore.
3) Updates and enhances comments to better reflect the current
   operation of nanokernel initialization.

Change-Id: Ibff7703562d1a9585dc2022741a6f0acb90c0a78
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:13:59 -05:00
Allan Stephens
5d4390f012 Eliminate unneeded arguments during nanokernel initialization
No longer passes arguments to _nano_init() that aren't needed.

Note: Also eliminates duplicate declarations of _nano_init()
that are obsolete.

Change-Id: I36ddfc9ceb18e3e5d6942a23574e38c1dfd3eb65
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:13:59 -05:00
Allan Stephens
9597404727 Consolidate nanokernel initialization code
Moves all nanokernel initialization code into a single file, since
they are all conceptually related.

Change-Id: Icd4e8572756fdcef7d0b965224ae00824e748a0a
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:13:59 -05:00
Allan Stephens
ffdbe7d691 Consolidate the nanokernel's context manipulation APIs
Moves all general purpose context manipulation routines into a
single nanokernel file, since they are all conceptually related.
(This also eliminates the anomaly of having APIs that could be
used with a task in a fiber-specific file.)

Change-Id: Idb862175e8795962dd78d31b66151f7b14936df0
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:13:58 -05:00
Allan Stephens
a139256afc Enhance microkernel command stack size bounds checking
Ensures that the microkernel's command stack has at least one element
at project configuration time, rather than at project build time.

Change-Id: I74f10bcb0d0275854801b50d5160fc85fb911250
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:13:58 -05:00
Peter Mitsis
6273c15e7c Rewrite truesize tool to use python
Using 'python' instead of 'gawk' for the 'truesize' has several advantages:
  - more people understand python than gawk
  - python script is easier to maintain
  - lessens the number of tools on which the product depends

Change-Id: If6780b530e28867d89939e09b81b153a960004b2
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:13:58 -05:00
Peter Mitsis
7d75790dad Rename scp and scs sections
Renaming the "scp" and "scs" sections to ".scp" and ".scs" respectively
signals the "truesize" tool to ignore them as they occupy neither normal ROM
nor normal RAM space.

Change-Id: Ic22013965b20d0c14e08d4d0332f2b7d028d10d9
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:13:58 -05:00
Luiz Augusto von Dentz
9ef64a3112 toolchain/gcc: Add UNALIGNED_GET macro
Similar to PACK_STRUCT it provide safe access to possible unaligned data
but it is much more convenient to use with non-struct types since all
one need to do is add a cast e.g. UNALIGNED_GET((uint16_t *) data).

Change-Id: I46402bdf1dd13081fe340a7214a84750a6cf04d2
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:13:58 -05:00
Anas Nashif
06d380c2ba Add tools and Makefiles for Documentation
This will allow us to start adding content and structure.
To generate documentation you will need to install both
- sphinx
- breathe

go into the doc directory and run:

$ make doxy html

No content has been submitted here, only a few placeholders.

Change-Id: Ifc3617aee8f7d45fa4e4a494ff0a1ab71516af06
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:13:58 -05:00
Arkadiusz Lichwa
e60b8f1927 Bluetooth: Intro of basic ADV handler
Adds basic handler deserializing advertising data.
Adds helper reformat function.

Change-Id: I6385249c39e92b2f068a01e89d34530b7a321f34
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-02-05 20:13:58 -05:00
Arkadiusz Lichwa
f170898634 Bluetooth: Add simple LE scan app
Use scan functionality by simple app that starts LE scan
and in a while stops it.
It uses basic HCI scan interface prepared for
supporting LE central role feature.

Change-Id: Idcde4c742290d46931ab86522e51b0fc547a2d42
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-02-05 20:13:58 -05:00
Luiz Augusto von Dentz
329e4276ae Bluetooth: Fix ATT define values
The codestyle is to use lower case for hexadecimal values.

Change-Id: I0e73cdf6d8ff4b48e6cb814f705193c65a01d14a
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:13:58 -05:00
Luiz Augusto von Dentz
f8215b94f5 Bluetooth: Move Write Command definitions
This changes order of Write Command definitions so it is consistent with
the opcode value.

Change-Id: Ie0eaaaec75d7b17d2da62a6c930ec56d1e666253
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:13:58 -05:00
Luiz Augusto von Dentz
f436fc835e Bluetooth: Warn unkown ATT PDUs
The code should always warn about unkown PDUs since it could be causing
unexpected behavior or that something is missing.

Change-Id: Idc608ca221c5ff6e440f90fa24c2cd6a3e6437fc
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:13:58 -05:00
Johan Hedberg
36bf88678c Bluetooth: coding-style: Fix missing braces in for-loop
Even one-line loops & branches should have braces.

Change-Id: Ie82e4dce1b7a2c9181f631b20d6532f1866c1197
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:13:58 -05:00
Johan Hedberg
89c6fe152f Bluetooth: Treat unkown SMP PDU as warning
Unknown SMP PDUs may be a bad thing so upgrade the respective log from
debug to a warning.

Change-Id: I05072dcbedb071ff968dd9ddfb075770110b5853
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:13:58 -05:00
Johan Hedberg
cde6b86657 Bluetooth: Treat unknown L2CAP PDUs as warnings
There are valid cases where we wont have handlers for unknown L2CAP
PDUS. Therefore, convert these logs from error to warnings.

Change-Id: I309b8074f9ef883ce981a4a2fbc6ab8421fda62a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:13:58 -05:00
Johan Hedberg
4cabc6902d Bluetooth: Convert unnecessary errors to debug logs
The unhandled opcodes and events are not really errors since we don't
need general handlers for everything. For events its good to have a
warning but for completed commands the cmd_send_sync() API means we
don't need generic handlers for everything.

Change-Id: Ie580189f3e6d69ef10d10e6c6080d5e983c08e8e
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:13:58 -05:00
Johan Hedberg
8271a58dd4 Bluetooth: Fix missing newline in debug log
Add missing newline character to debug log.

Change-Id: Ic78ae2587d8f48b1af9754f1484350e94039f6f7
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:13:58 -05:00
Johan Hedberg
3beca82c90 Bluetooth: Add debug config options for all current sub-modules
We want to be able to do fine-grained enabling of debug logs for the
various Bluetooth sub-modules. They all default to 'n' so an app
writer would need to go and enable the specific ones that they're
interested in.

Change-Id: I17105adf133d441dfc811bdd66a00be015813679
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:13:58 -05:00
Arkadiusz Lichwa
d46de84c03 Bluetooth: Create basic LE scan interface
Adds needed data structures.
Adds basic HCI interface to start/stop LE scan.

Change-Id: I69790b11d191078952ce05da386961c5c55a7172
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-02-05 20:13:58 -05:00
Andrei Emeltchenko
115176e323 Bluetooth: Fix dependency for UART debug option
Move UART debug config option after UART driver configuration and make
it depends on it.

Change-Id: I23dc8a4a43aa6dee0bb5266cd1f84a00e811db1d
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:13:58 -05:00
Andrei Emeltchenko
5fffe2f225 Bluetooth: Set default toolchain to gcc
Set the toolchain in case the user doesn't have it set in their
environment.

Change-Id: Ia961598bc125ded9326747cc8c5810635a8481d5
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:13:58 -05:00
Luiz Augusto von Dentz
dd7a73a228 Bluetooth: Rename bt_att_info structs and their defines
This replaces _1 and _2 with the respective UUID size they carry.

Change-Id: I254afe335121aef23ed49a5fe0c49520937cc14f
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:13:58 -05:00
Luiz Augusto von Dentz
bfcd16be8b Bluetooth: Add ATT server initiated skeletons
This adds the remaining ATT PDU definitions.

Change-Id: Id58116e00ba0d3a0ea4b0f94bd262290342e7e9f
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:13:58 -05:00
Luiz Augusto von Dentz
ed7b333385 Bluetooth: Add ATT Execute Write Request skeleton
This adds the defines for Execute Write PDUs along with initial code to
parse them.

Change-Id: Ifa8229b9f3bf0a60d9abe553263b32397d1ba881
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:13:58 -05:00
Luiz Augusto von Dentz
0fe5fa9fcf Bluetooth: Add ATT Prepare Write Request skeleton
This adds the defines for Prepare Write PDUs along with initial code to
parse them.

Change-Id: Ia7210dbe4662afbebe742b5b1a7b8f08999adf2a
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:13:58 -05:00
Luiz Augusto von Dentz
d3acf5f16a Bluetooth: Add ATT Signed Write Command skeleton
This adds the defines for Signed Write Command along with initial code
to parse it.

Change-Id: I2071163c8468a6580d9a9305095187a140c80a43
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:13:58 -05:00
Luiz Augusto von Dentz
75f56d9e07 Bluetooth: Add ATT Write Command skeleton
This adds the defines for Write Command along with initial code to parse
it.

Change-Id: Ifabcfa8efb54b5135a540718fb60d9a656cd088c
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:13:58 -05:00
Luiz Augusto von Dentz
9e8c1d1326 Bluetooth: Add ATT Write Request skeleton
This adds the defines for Write PDUs along with initial code to parse
them.

Change-Id: I69d2002b3e6da80037c058f42f543a0ab4765958
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:13:58 -05:00
Luiz Augusto von Dentz
75aab47603 Bluetooth: Add ATT Read by Group Type Request skeleton
This adds the defines for Read by Group Type PDUs along with initial
code to parse them:

> ACL Data RX: Handle 3585 flags 0x02 dlen 11
      ATT: Read By Group Type Request (0x10) len 6
        Handle range: 0x0001-0xffff
        Attribute group type: Primary Service (0x2800)
< ACL Data TX: Handle 3585 flags 0x00 dlen 9
      ATT: Error Response (0x01) len 4
        Read By Group Type Request (0x10)
        Handle: 0x0001
        Error: Attribute Not Found (0x0a)

Change-Id: Iebc84e7a9c405fa58b7984602d2d27f79d6033a7
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:13:58 -05:00
Luiz Augusto von Dentz
f00308f0eb Bluetooth: Add ATT Read Mutiple Request skeleton
This adds the defines for Read Multiple PDUs along with initial code to
parse them.

Change-Id: I34f597881e3bdb9325ffbf2bda42b7ae6710c3ae
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:13:58 -05:00
Luiz Augusto von Dentz
eedc01d6d5 Bluetooth: Add ATT Read Blob Request skeleton
This adds the defines for Read Blob PDUs along with initial code to
parse them.

Change-Id: I5a2a2e2e32bf44d98ce928b3d57ad7f05059a927
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:13:58 -05:00
Luiz Augusto von Dentz
dfdd657b37 Bluetooth: Add ATT Read Request skeleton
This adds the defines for Read PDUs along with initial code to parse
them.

Change-Id: I3ec54a0bf2394b54bd8b08957533f0826bf4a23a
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:13:58 -05:00
Luiz Augusto von Dentz
0d853d64c2 Bluetooth: Add ATT Read by Type Request skeleton
This adds the defines for Read by Type Value PDUs along with initial
code to parse them:

> ACL Data RX: Handle 3585 flags 0x02 dlen 11
      ATT: Read By Type Request (0x08) len 6
        Handle range: 0x0001-0xffff
        Attribute type: Characteristic (0x2803)
< ACL Data TX: Handle 3585 flags 0x00 dlen 9
      ATT: Error Response (0x01) len 4
        Read By Type Request (0x08)
        Handle: 0x0001
        Error: Attribute Not Found (0x0a)

Change-Id: I0b4371b8decebf33710a949552a11c80c544b5f8
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:13:58 -05:00
Johan Hedberg
f73b3b954e Bluetooth: Remove unnecessary reinit of buffers
Now that we no-longer need to set an upper limit of outgoing ACL
buffers (thanks to reintroducing the ACL semaphore) we don't need to
perform a second initialization of the buffers.

Change-Id: Ie59bf7cb0e6915f1c67ca3dfb03244f9b4af94d5
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:13:58 -05:00
Johan Hedberg
9b1e7a935b Revert "Bluetooth: Rotate outgoing ACL packets via a pending queue"
This reverts commit ce981a0f51f94a3f23c43b947a2ce62a1ef08623.

Now that we're back to using an ACL buffer semaphore the rotation of
outgoing ACL packets via a pending queue is no-longer necessary.

Change-Id: I0da42992bed2abba1544b1a82c31bc71342ecf70
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:13:57 -05:00
Johan Hedberg
1f5b1b83e0 Bluetooth: Reintroduce ACL buffers semaphore
Since nano_sema is after all able to handle multiple waiters we can
have a cleaner and more efficient implementation by using a single
semaphore for all of the connection tx fibers.

Change-Id: Iafb595ae556a2dd826502cf282b88548cb34f336
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:13:57 -05:00
Luiz Augusto von Dentz
d51985e4ce Bluetooth: Add ATT Find Information by Type Value Request skeleton
This adds the defines for Find Information by Type Value PDUs along
with initial code to parse them.

Change-Id: I9eaf2df390ca6f78530df7f1ae606b588d1fcb2e
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:13:57 -05:00
Luiz Augusto von Dentz
b6d35d8281 Bluetooth: Add ATT Find Information Request skeleton
This adds the defines for Find Information PDUs along with initial code
to parse them.

Change-Id: If34533cca4a1a554ca3f119c7639a1167dae0ff2
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:13:57 -05:00
Andrei Emeltchenko
94fc5b27c5 Bluetooth: Add definitions for LE Encrypt command and reply
Add definitions for implementing HCI controller encryption.

Change-Id: I4e919c8a081c9e61174e6b08f5b2ac088e4b1a4d
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:13:57 -05:00
Andrei Emeltchenko
7a995c0a60 Bluetooth: Export bt_hci_cmd_send_sync() for SMP use
The function bt_hci_cmd_send_sync() would be used in LE SMP code for
using HCI controller for encryption.

Change-Id: I0f8f7963a0bf0597b59f24e6d21b6d1f49072f43
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:13:57 -05:00
Andrei Emeltchenko
82c913d53c Bluetooth: Add SMP encryption key check
Fixes PTS test case TC_EKS_BI_02_C sending correct failed reply to
wrong key size.
...
> 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: 6
        Initiator key distribution: <none> (0x00)
        Responder key distribution: <none> (0x00)
< ACL Data TX: Handle 64 flags 0x00 dlen 6
      SMP: Pairing Failed (0x05) len 1
        Reason: Encryption key size (0x06)
...

Change-Id: I1c02cbc03d1aaf6221d7a6ddfd9bc7ab30ca9586
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:13:57 -05:00
Andrei Emeltchenko
0aadf6ce69 Bluetooth: Add SMP Pairing Confirm skeleton
Change-Id: I484e24f111212acf3e920b4eed56d69e6b94493d
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:13:57 -05:00
Andrei Emeltchenko
b7dddcff00 Bluetooth: Add SMP Pairing Request skeleton
Add handling of SMP Pairing Request for Pairing Feature Exchange. In
the beginning support Just Works pairing method.

Change-Id: I8aab10683e9f26db4e0e9cb1bb9a8dc8940f0ab0
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:13:57 -05:00
Andrei Emeltchenko
d780f70339 Bluetooth: trivial empty space fix
Change-Id: I933dae2543f0f0c722736a3b3be79cf5494e9ff6
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:13:57 -05:00
Andrei Emeltchenko
d135dcf0e5 Bluetooth: Fix using magic number
Instead of magic number use sizeof().

Change-Id: I6c9db3d7a371312d0aab4fd7dc6a9d0c92449afc
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:13:57 -05:00
Andrei Emeltchenko
a9cd5276ec Bluetooth: Enable HCI_CORE debug for samples
Enabling HCI_CORE debug helps to identify possible bugs.

Change-Id: I13df39d63ee9b15f83503d86edc71733c7db94d5
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:13:57 -05:00