Commit graph

96296 commits

Author SHA1 Message Date
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
Andrei Emeltchenko fa2473d912 Bluetooth: Allow redefine QEMU_EXTRA_FLAGS
Allowing to redefine QEMU_EXTRA_FLAGS helps to overcome user channel
stuck cases, you still have the possibility to use bluetooth over tcp
by specifying QEMU_EXTRA_FLAGS="-serial tcp:...". Default behavior
remains the same though.

Change-Id: I3a8190a1ca04029e788bfd424f3b3a3be9f2af75
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:13:57 -05:00
Johan Hedberg 5cff2d0b78 Bluetooth: Add debug support for buffers
For debugging buffer access related issues it's convenient to be able
to enable logs and extra checks specifically for the buffer related
code.

Change-Id: Ibb87d344809d2bcada10a22b16a23e6556f4ae79
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:13:57 -05:00
Andrei Emeltchenko f8df842dd5 Bluetooth: Add compile test for nanokernel shell app
Bluetooth regression and system regression would run compile test
for shell app.

Change-Id: I029772483e7aa9ac0717db760d8de1f6be3371b5
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:13:57 -05:00
Andrei Emeltchenko e15102a206 Bluetooth: Add nanokernel configuration for shell app
Add support for nanokernel build for shell application.

Change-Id: Idf5f3673050c2ac4c941dc9164536fc487e9216b
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:13:57 -05:00
Andrei Emeltchenko f3794dd657 Bluetooth: Update README with recent changes
Remove old way of starting qemu target and add extra information.

Change-Id: I37c378aa0eb873b3fc16362991eec8a6b661626b
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:13:57 -05:00
Andrei Emeltchenko 3750a7eb36 Bluetooth: Implement SMP error response
Add bt_smp_create_pdu() helper and implement send_err_rsp for an
unknown SMP command.

Change-Id: Iaed0811f3323f62aaa56eb531fb383cf15396ef8
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:13:57 -05:00
Andrei Emeltchenko 69f94f2484 Bluetooth: Add skeleton for SMP handling
Add support for Security Manager Protocol fixed channel. SMP handling
would be done in smp.c.

Change-Id: I26d3d098c6b1c3d03aad958d83dfee09e03add1d
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:13:57 -05:00
Andrei Emeltchenko 0f73da74c5 Bluetooth: Add Bluetooth shell sample application
Bluetooth shell sample application make use of serial console shell
and register Bluetooth commands to it. It shows example how console
shell might be used.

Change-Id: I98340422b90e85dc7a2c44823536121999a08952
Co-authored-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:13:57 -05:00
Andrei Emeltchenko 879541a918 console: Refactor serial console interface
Make serial console interface more robust. Enables interrupts only
when registering input, all memory is managed inside application.
Interface to application is changed to have two fifo queues. One
queue is a free line slots and another queue is keeping entered
lines. This way memory for lines is managed inside application which
provides free lines queue. It is also simpler to manage entered
lines by sleeping on fifo_get on app layer.

Change-Id: I4776c03eddd1e7d880df3b902bd48f5f2c901cad
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:13:57 -05:00
Andrei Emeltchenko 37d3fae356 Bluetooth: Add standard license header to l2cap.c
Add missing header with license.

Change-Id: I754bc0c3b4fd6b2699930fb9e126e788a438168a
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:13:57 -05:00
Johan Hedberg 90475d78f2 Bluetooth: Use min() macro where possible
There's no need to have custom minimum value evaluation logic when
there's already a convenience macro available.

Change-Id: I91ad50521deb2575100c3480cad516bbf6f4dc2d
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:13:57 -05:00
Andrei Emeltchenko 2ea4e83446 Bluetooth: Fix ATT code printing
Fix bug printing ATT code in bt_att_recv()

Change-Id: I21fe9cb1272428e618412e98b09e8d786132eef6
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:13:57 -05:00
Luiz Augusto von Dentz 028edd59ba Bluetooth: Add code to handle BT_ATT_OP_MTU_REQ
Add code to respond to BT_ATT_OP_MTU_REQ with BT_ATT_OP_MTU_RSP
selecting the MTU based on the amount of room bt_buf has:

< ACL Data RX: Handle 39 flags 0x02 dlen 7
      ATT: Exchange MTU Response (0x03) len 2
        Server RX MTU: 65

Change-Id: I47b8179fcee0d6adff5761abc37cfcb1ed636d65
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:13:56 -05:00
Luiz Augusto von Dentz 7cbb4e6f4b Bluetooth: Add bt_att_create_pdu
Add bt_att_create_pdu which works similarly to bt_l2cap_create_pdu
eliminating some duplicated when generating ATT PDUs.

Change-Id: I30b89effbae887f4032ba1d1e380a763c3556869
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:13:56 -05:00
Luiz Augusto von Dentz 7ab174d202 Bluetooth: Add len check to bt_l2cap_create_pdu
Check if buffer created is not too short for the len requested and in
case it is print an error and return NULL.

Change-Id: I2361925dfb83fe5e9746445c54e8f39e82b5504d
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:13:56 -05:00
Luiz Augusto von Dentz 4202d9a7bf Bluetooth: Fix missing parentesis to sizeof
Change-Id: I31e7b8fb3e463371950b538a51676baa77b671ba
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:13:56 -05:00
Luiz Augusto von Dentz 496147e88c Bluetooth: Make ATT opcode define names consistent
This drops L2CAP term and add OP in its place to make it clear what they
are for.

Change-Id: I50de8b505f64d9a468b2a0c96feb037c233ceac5
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:13:56 -05:00
Luiz Augusto von Dentz facd477484 Bluetooth: Add error code defines
These are the error codes that can be used in bt_att_error_rsp.

Change-Id: I5fd3a65ed0b35fd8b21644e3d23c58c7bd57cfec
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:13:56 -05:00
Luiz Augusto von Dentz 7f1119bb2e Bluetooth: Remove unnecessary PRJ_INCPATH
It is not necessary to add any PRJ_INCPATH in order to build Bluetooth
samples.

Change-Id: I3ddb0a645e475d937a7067059e8bf5caa783a04e
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:13:56 -05:00
Luiz Augusto von Dentz 8fc12c1600 Bluetooth: Add LE beacon sample app
Adds a sample which initializes Bluetooth and enables non-connectable
advertising (i.e. starts acting in the LE broadcaster role).

Change-Id: Ic554b1354464b357b44215af1c0b613f123aeb5d
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:13:56 -05:00
Johan Hedberg 4dda330440 Bluetooth: Implement ACL fragmentation for outgoing data
If we have a buffer that's larger than the supported ACL MTU we need
to split it into multiple fragments. The first fragment will have
'start' in the flags that are encoded to the connection handle and
subsequent ones will have 'continue' encoded into them.

To not loose track of the original buffer until we have created all of
the fragments we store each buffers in a temporary FIFO and then later
read them back out from there and put them into the tx_queue.

Change-Id: Ice77a79a89286829d624f76df77e0aa719af1490
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:13:56 -05:00
Johan Hedberg d14c9c176f Bluetooth: Refactor ACL PDU creation to prepare for fragmentation
There's no point in encoding the ACL header in bt_conn_create_pdu()
since ultimately we might end up having to split the data into
multiple buffers - each with their own ACL header. Instead, move the
header encoding into bt_conn_send() where we can later add the proper
fragmentation support.

Change-Id: I84ac35161fc31bbd0a92391ec920224da69f43e1
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:13:56 -05:00
Johan Hedberg a0bb20f4d1 Bluetooth: coding-style: fix one-line branch braces usage
The coding guidelines make an exception to the Linux kernel style
where all branches, even one-liners, should use braces.

Change-Id: I368930af3033eac15f0152a6671909e401d332e6
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:13:56 -05:00
Andrei Emeltchenko 607819ec5e Bluetooth: Add bt_regression script based on scripts/regression
bt_regression scripts builds all listed projects for all
configurations mentioned in the PRJ_LIST. For targets specified with
"!" it executes test in qemu.

Change-Id: I971a797b2a89547bb14208d0d43d1a36597bad52
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:13:56 -05:00
Andrei Emeltchenko 9bfda983d8 Bluetooth: Add arm targets for init sample
Add new targets for sanity_chk script: fsl_frdm_k64f and ti_lm3s6965,
this would add compile tests for mentioned BSPs in sanity check
script.

Change-Id: I556f8e3a5048d2a58ab09b10197e0cc6fb3c8765
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:13:56 -05:00
Andrei Emeltchenko 0ec0ea297d Bluetooth: Add arm targets for microkernel sanity test
Add ti_lm3s6965 and fsl_frdm_k64f targets for bluetooth test.

Change-Id: Ibbe8ebbab72abb02505f47a82c904f0e9460e812
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:13:56 -05:00
Andrei Emeltchenko 81a97132de Bluetooth: Add arm targets for nanokernel sanity test
Add ti_lm3s6965 and fsl_frdm_k64f targets for bluetooth test.

Change-Id: I054c9500511fe40969127445444f85f3fe85902c
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:13:56 -05:00
Luiz Augusto von Dentz b3cdfed003 Bluetooth: Extend advertising API
Extend bt_start_advertising to make it possible to add any data type
instead of just the name.

Change-Id: I3f2afe1eb64aec51f321f7fd7439e97b3d67374c
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:13:56 -05:00
Luiz Augusto von Dentz 77db73142a Bluetooth: Add advertising data types definitions
Adds remaining AD types definitions that can be used in BLE.

Change-Id: Ic9c63a111a5269a53326005012dff955cf399fcf
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:13:55 -05:00
Allan Stephens f2be9ae6c1 Cosmetic change to sysgen
Corrects a PEP8 coding standard violation.

Change-Id: Ifcdb2ac8d57dd90d74c2f72e94a774c894935a17
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:13:55 -05:00
Allan Stephens 103e84abcb Rename hidden TICKLESS_KERNEL config option to SYS_CLOCK_EXISTS
The revised option name more accurately describes its purpose, and
avoids potential confusion with the microkernel's tickless idle
capability. Also, inverting the "polarity" of the option means that
conditional code that references it does not have to use negative
logic, which make the code easier to comprehend.

Change-Id: I0c6f82f077a87a28544048d214efa7020939e566
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:13:55 -05:00
Allan Stephens 8f66024f57 Revise kernel_main.c access to non-public microkernel APIs
Sysgen now copies kernel_main.h into its output directory, so that it
can be easily included by kernel_main.c. This eliminates a kludge
that required kernel_main.c to reference kernel_main.h using a relative
path name.

Change-Id: I24fcfa6b70a44526a80f33619dd68ff0a7f7acc5
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:13:55 -05:00
Allan Stephens 0507aefbdc Continue limiting exposure of microkernel APIs needed by sysgen
Relocates and renames the include file which declares non-public
APIs needed by sysgen from the directory containing the microkernel's
public API to the directory containing its non-public API.

Note: Need to come up with a more elegant way for generated
kernel_main.c to access kernel_main.h, since the current relative
path approach is kludgy.

Change-Id: I5e4b07038e566f1f161001d676a3b0faa487a480
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:13:55 -05:00
Allan Stephens fb64710410 Limit exposure of non-public microkernel APIs needed by sysgen
Hides the existence of these routines from the microkernel's main
public API include file, but allows both sysgen and the microkernel
itself to continue accessing them.

Change-Id: Iaf1beff81d045e9df29eb07517793e4b4410f51e
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:13:55 -05:00
Allan Stephens f4e72a4175 Limit exposure of non-public microkernel APIs defined by sysgen
Hides the existence of these routines from everyone but the
microkernel's initialization code.

Change-Id: I5dc0a1395c7f01f39d8f283e4f48b0c95578902e
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:13:55 -05:00
Allan Stephens 3c36c425f6 Limit exposure of non-public microkernel variables
Hides the existence of these variables from everyone but the
microkernel itself.

Change-Id: I03854f8fcfbd798f5cf1795fc8c261e6a31a9067
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:13:55 -05:00
Allan Stephens 678a2a90bd Limit exposure of non-public microkernel "no-op" API
Hides the existence of _task_nop() from everyone but the
microkernel's no-op subsystem itself. (This change forces the
sample benchmark project that measures no-op performance to
explicitly declare this API itself.)

Change-Id: I0cb2ec32d1c56b10743d5b2e727de2d5a99c95ea
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:13:55 -05:00
Allan Stephens 56f93e3a21 Eliminate unnecessary K_TIMER type
Since the K_TIMER type is a non-public API used within the micro-
kernel itself, it doesn't provide any real type abstraction benefit
that isn't served equally well by the struct k_timer type it is
based on.

Change-Id: I482d7c0459d5734402be541322ff752dd1a3714a
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:13:55 -05:00
Allan Stephens 19ec0685df Limit exposure of non-public microkernel object API
The encoding of the microkernel object identifier fields is
something that only the microkernel needs to know.

Change-Id: I3701760cdce5768e082b6d2432b75382f5a2f557
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:13:55 -05:00
Allan Stephens 6ecfc66152 Limit exposure of non-public microkernel timer APIs
Hides the existence of these APIs from everyone but the
microkernel's timer subsystem itself.

Change-Id: I49482a6e16fee28f1ed3e2244e47df401854c9fc
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:13:55 -05:00
Allan Stephens 067a47558f Consolidate (most) microkernel non-public API declarations
Relocates the declarations for most non-public microkernel APIs
into the main include file for such APIs (i.e. minik.h), then
eliminates the per-subsystem include files. (The per-subsystem
files don't serve any significant purpose now that the routines
comprising each microkernel subsystem have been consolidated.
In fact, there wasn't a single file that included one of these
files that didn't already include minik.h!)

Note: The channel APIs have not been consolidated yet, as they
require further cleanup. Also, one mailbox API that is used only
by the mailbox subsystem itself is moved there rather than being
placed in minik.h.

Change-Id: Ic7f1ac8a67bd39b685f70379dffff0d0caf1b290
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:13:55 -05:00
Allan Stephens 8e71a756c9 Limit exposure of microkernel system clock
Hides the existence of the microkernel's tick count variable
from everyone but the microkernel system clock subsystem itself.

Change-Id: I6bd20c28758a52eeac376617dd8d542c03738c2a
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:13:55 -05:00
Allan Stephens 7890a5960b Limit exposure of microkernel timer lists
Hides the existence of the microkernel timer list variables
from everyone but the microkernel itself.

Change-Id: I81b64040efce849328e860067e37731b755a094d
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:13:55 -05:00
Allan Stephens 4a77f47a9e Limit exposure of microkernel event list
Hides the existence of the microkernel event list variable from
everyone but the microkernel event subsystem itself.

Change-Id: I5a2ac41ebd8131b85897c60eaae24013f10686f0
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:13:55 -05:00
Allan Stephens fb7f961554 Rename EVENTS to _k_event_list
Brings the name of this non-public microkernel variable into line
with those of analogous variables.

Change-Id: I17dc343faf2dc1ace63b5a3e8164ff08ddd60ebd
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:13:55 -05:00