Commit graph

18576 commits

Author SHA1 Message Date
Juan Manuel Cruz
94b78c1276 Creation of offsets.h header file.
This commit adds the target to generate the offsets.h header.

Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
Change-Id: I6222f7478ade33f5ca130eea8637cb454b67eaab
2016-02-05 20:14:05 -05:00
Juan Manuel Cruz
e1bb210bf3 Creation of configs.c file.
This commit adds the target to generate the configs.c source file.

Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
Change-Id: Ia068a20c3b76c78f5bdd041f6e19daabd2107a5a
2016-02-05 20:14:04 -05:00
Juan Manuel Cruz
9b0854bd84 Creation of target for sysgen execution.
This commit adds the target to execute sysgen.

Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
Change-Id: I31f2e896274fa5ddfe6c10b4ccfb07ff6704c130
2016-02-05 20:14:04 -05:00
Juan Manuel Cruz
e33ede376e Creation of prj.vpf file.
This commit adds the target to generate the configuration file prj.vpf.

Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
Change-Id: I407b304d33fe27daf92e6049377930cca484fde5
2016-02-05 20:14:04 -05:00
Juan Manuel Cruz
a9b1c74ee3 Adding Kbuild root Makefile.
Adding the root Makefile from linux 3.19-rc7 Kbuild as is.

This Makefile will be modified and adapted to the current build
system in following commits.

This is done with the intention to help the revision of changes
that were done to the original Kbuild Makefile.

Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
Change-Id: Ib897553d4d073dc3e3dab702b87b92a6f82cd804
2016-02-05 20:14:04 -05:00
Juan Manuel Cruz
d31a6a6f31 Creation of Makefiles for libc minimal.
This commit adds the Makefiles to create object-bundle for
libc minimal.

Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
Change-Id: I9d15e0203664010ba4ef5cf3625b4075d7827ad7
2016-02-05 20:14:04 -05:00
Juan Manuel Cruz
f2ae6d5202 Creation of Makefiles for drivers directory.
This commit adds the Makefiles that describe the object-bundles
for the drivers directory and every subdirectory below.

Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
Change-Id: Id77cff9cf0ab51827acc2aef32cbed3ec3ad586b
2016-02-05 20:14:04 -05:00
Juan Manuel Cruz
1c233a0377 Creation of Makefiles for arch directory.
This commit creates all the Makefiles that describe the object-
bundles for the arch directory and  every sub-directory below.

Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
Change-Id: Icb4ebcfc430a132e514507149ad5ab6878eeed64
2016-02-05 20:14:04 -05:00
Juan Manuel Cruz
e55a79d6f9 Creation of Makefiles for kernel and misc directory.
This commit creates the Makefiles that describe the object-bundles for
the kernel directory and every sub-directory below.
It also includes the misc Makefile.

Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
Change-Id: I847e79a40ced0b1d8370b893cd95c15efc7e5147
2016-02-05 20:14:04 -05:00
Juan Manuel Cruz
f98466d54b Kconfig symbols for drivers directory.
This commit adds the Kconfig files that describe the CONFIG
symbols that belongs to the drivers directory and subdirectories.

Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
Change-Id: I924835ece11a3d597e77a55ace21d724dd5ddbe5
2016-02-05 20:14:04 -05:00
Juan Manuel Cruz
132649f2cc Kconfig symbols for arch directory.
This commit adds the Kconfig files that describe the CONFIG
    symbols that belongs to the arch directory and subdirectories.

Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
Change-Id: I744225ddaa5e2b45113ca049457a8f9925ebe4c2
2016-02-05 20:14:04 -05:00
Juan Manuel Cruz
0e301cc07f Kconfig symbols for kernel and misc directory.
This commit adds the Kconfig files that describe the CONFIG
symbols that belongs to the kernel directory and subdirectories.
It includes the misc directory Kconfig as well.

Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
Change-Id: I3e653562ea5c259203a63274197e3a0e1522ecc4
2016-02-05 20:14:04 -05:00
Juan Manuel Cruz
2763d51e1d Adding Kconfig root file.
This commit adds the Kconfig root file.

Signed-off-by: Juan Manuel Cruz <juan.m.cruz.alcaraz@linux.intel.com>
Change-Id: Id9478012376bfd19475bf08fd75aacad9048ce27
2016-02-05 20:14:04 -05:00
Johan Hedberg
a1dd6d6aec Bluetooth: Remove unused BDADDR_ANY variable
This is a left-over from previous code.

Change-Id: I4d12e236a4065d2cd33d492605704f516df906f3
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:04 -05:00
Johan Hedberg
3b71b2dd41 Bluetooth: Fix using correct cmd_rx_fiber stack size
The code was incorrectly using RX_STACK_SIZE instead of
CMD_RX_STACK_SIZE.

Change-Id: I4a8ddb700e2a701bf8572ed877865a7d0cb3b2d0
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:04 -05:00
Johan Hedberg
4172b712c9 Bluetooth: Fix build when HCI_CORE debug is enabled
Some hci_core.c debug logs were still incorrectly using the old
bt_bdaddr_str API.

Change-Id: I92ce4544c44266216225b4d9a20e639a2fefa9d0
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:04 -05:00
Luiz Augusto von Dentz
3ea2c48899 Bluetooth: Fix advertising data of peripheral sample
An extended inquiry response or advertising data packet shall not contain
more than one instance for each Service UUID data size.

Change-Id: I41d1a25fdcb2987e8d0cadfb2110fd62b3685f17
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:14:04 -05:00
Johan Hedberg
8620ff3e0c Bluetooth: Add GATT debug config option
Add a GATT debug config option to be able to limit the debug logs only
to the GATT submodule.

Change-Id: Ie486c9125070f32506547f981c704eaf3e9f2377
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:04 -05:00
Andrei Emeltchenko
bd0805acdd Bluetooth: Fix too few arguments to error log
Change-Id: Ic618f3535b60d861e2044aefb82671c48fa35f61
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:14:04 -05:00
Luiz Augusto von Dentz
fc1392d7aa Bluetooth: Add implementation of ATT Find Information Response
Read attributes matching handle range generating a proper response:

< ACL Data TX: Handle 3585 flags 0x00 dlen 10
      ATT: Find Information Response (0x05) len 5
        Format: UUID-16 (0x01)
        Handle: 0x0011
        UUID: Client Characteristic Configuration (0x2902)

Change-Id: I16a5abbcca67d522bd2282d3bf727770d1fa4006
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:14:04 -05:00
Luiz Augusto von Dentz
32c50333b3 Bluetooth: Add implementation of ATT Read and Read Blob Response
Read attribute and generate a proper responses:

< ACL Data TX: Handle 3585 flags 0x00 dlen 6
      ATT: Read Response (0x0b) len 1
        Value: 01

< ACL Data TX: Handle 3585 flags 0x00 dlen 20
      ATT: Read Blob Response (0x0d) len 15
        54 65 73 74 20 50 65 72 69 70 68 65 72 61 6c     Test Peripheral

Change-Id: I5a644fd29ae46fdecdc32c6558591ce7a8d2d42c
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:14:04 -05:00
Luiz Augusto von Dentz
e6ef8df212 Bluetooth: Add implementation of ATT Find by Type Value Response
Read attributes matching value and handle range generating a proper
response:

< ACL Data TX: Handle 3585 flags 0x00 dlen 9
      ATT: Find By Type Value Response (0x07) len 4
        Handle range: 0x0001-0x0005

Change-Id: I8001afa2b22e804bef3778d0509d17b01a8d597c
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:14:04 -05:00
Luiz Augusto von Dentz
9a09a5d329 Bluetooth: Add implementation of ATT Read by Type Response
Read attributes matching UUID and handle range generating a proper
response:

< ACL Data TX: Handle 3585 flags 0x00 dlen 20
      ATT: Read By Type Response (0x09) len 15
        Attribute data length: 7
        Attribute data list: 2 entries
        Handle: 0x0002
        Value: 020300002a
        Handle: 0x0004
        Value: 020500012a

Change-Id: Iaf4b0c963765a7769a17144a4d394dce8555c2d3
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:14:04 -05:00
Luiz Augusto von Dentz
7c14248061 Bluetooth: Add implementation of ATT Read by Group Type Request
Read attributes matching UUID and handle range generating a proper
response:

< ACL Data TX: Handle 3585 flags 0x00 dlen 24
      ATT: Read By Group Type Response (0x11) len 19
        Attribute data length: 6
        Attribute group list: 3 entries
        Handle range: 0x0001-0x0005
        UUID: Generic Access Profile (0x1800)
        Handle range: 0x0006-0x000d
        UUID: Heart Rate (0x180d)
        Handle range: 0x000e-0x0011
        UUID: Battery Service (0x180f)

Change-Id: I1ef2d5b1b0237fc0f89221239686777169cc8883
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:14:04 -05:00
Luiz Augusto von Dentz
2506aa93b3 Bluetooth: Make use of bt_uuid_cmp to compare UUIDs
This replace the old code that could only compare 16 bits UUID with
bt_uuid_cmp which can expand to 128 bits if types don't match.

Change-Id: I84219d451d8c95baf6f7e42b92629cb106428ccf
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:14:04 -05:00
Luiz Augusto von Dentz
dd41c3375c Bluetooth: Add bt_gatt_foreach_attr
bt_gatt_foreach_attr iterates over attributes via callback, it will be
used to implement discovery functionality.

Change-Id: Ice66f4b3d0d12b3616986931d5da0fe0f202e533
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:14:04 -05:00
Luiz Augusto von Dentz
862835d8a6 Bluetooth: Add bt_uuid_cmp
bt_uuid_cmp compares 2 UUIDs returning if they match, if the types are
different it converts both to 128 bit format before performing the
comparison.

Change-Id: Iacf330cc0271a7e5429cbb2f405a7d9ef249a1a3
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:14:04 -05:00
Luiz Augusto von Dentz
a8f34a1c1e Bluetooth: Add Battery Service to peripheral sample
Add Battery Service along with its characteristics and descriptors
to the database table.

Change-Id: Ifb83ebcb4d6cdafa5df84d643b2e2a69e5a6c1e3
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:14:04 -05:00
Luiz Augusto von Dentz
1b793139db Bluetooth: Add Heart Rate Service to peripheral sample
Add Heart Rate Service along with its characteristics and descriptors
to the database table.

Change-Id: Ibff52da7352883edccb7c5b903538a81aad2ba55
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:14:04 -05:00
Luiz Augusto von Dentz
0d505e2045 Bluetooth: Add GAP primary service to peripheral sample
This adds attributes for Generic Access Profile.

Change-Id: I1fe08429f80341e7ba9fc06ef35a6df9b5abbf84
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:14:04 -05:00
Luiz Augusto von Dentz
de52b09a3f Bluetooth: Add GATT skeleton
This adds initial API and definitions to create a database.

Change-Id: I69d5b3f5fd2f04cc309c2f76a84581673aa54e7b
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:14:04 -05:00
Luiz Augusto von Dentz
6d564a9648 Bluetooth: Handle ATT Exchange MTU request
This properly init the MTU to default upon new connection and properly
store the new value in case of Exchange MTU request.

Change-Id: I561f5b1756fd8833244cdd2a986e561c16fc8471
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:14:04 -05:00
Johan Hedberg
1781490c87 Bluetooth: Improve buffer debug usefulness
The overflow/underflow checks are something that we want to have
whenever debug is enabled in general (and not just for buffers
specifically).

Change-Id: Ib4edd366ae8ce1a80d33155ab1dc8d5a20477909
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:04 -05:00
Johan Hedberg
8d0d247f23 Bluetooth: Add helpers for checking LE address type
For LE Privacy support we'll need to be able to distinguish which
addresses are RPAs and which are Identity Addresses.

Change-Id: Ie244a4d53ffddc435edbd6d69d7ecca205202f18
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:04 -05:00
Johan Hedberg
9b40ec3360 Bluetooth: Introduce dedicated Bluetooth address types
We use addresses in lots of places and with LE we always need to pass
around the type in addition to the address value. Defining dedicated
types for addresses makes the code much simpler.

Change-Id: Ie8b495dce50e3f084685909c19acc5d08e2cca10
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:03 -05:00
Johan Hedberg
85fec6dd2c Bluetooth: Increase cmd_rx fiber stack size
When debug is enabled the cmd_rx fiber seems to cause exceptions some
times. Increasing its stack size seems to help.

Change-Id: I8152645f5904758b771ffe73b1112c77c8bfe924
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:03 -05:00
Johan Hedberg
da7ea16c6c Bluetooth: coding-style: Fix unnecessary space after typecast
Change-Id: I229df078f205d2fb4e16d02ad7fea3382e4d6287
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:03 -05:00
Johan Hedberg
e9c3994b47 Bluetooth: Move LTK/EDiv/Rand generation to key dist stage
Now that bt_hci_send_cmd_sync() is safe to be called from the rx fiber
(used for all HCI events besides Command Complete/Status) we can move
the le_rand() usage to the key distribution stage instead of the
workaround of generating them prematurely.

Change-Id: I8bbc8dc78922a275a0c9982474d60b0693b29af2
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:03 -05:00
Johan Hedberg
c825e91e57 Bluetooth: Remove per-connection RX fiber
Now that there's the split of Command Complete/Status events from all
other RX data we don't anymore need dedicated per-connection RX
fibers. Remove these fibers and their associated FIFO and use
bt_l2cap_recv() directly from bt_conn_recv().

Change-Id: Ib9740e76200cfa40d46ee234f9693dcb7e8387fd
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:03 -05:00
Johan Hedberg
d8e9e71acd Bluetooth: Add dedicated stack for Command Complete/Status events
These events are special since they release any blocking
bt_hci_cmd_send_sync() calls. In order to be able to use the send_sync
API from HCI Event handlers without deadlocking having the Command
Complete/Status events processed through a dedicated fiber is
essential.

Change-Id: Id5c597d618bf326a8efb7c9ca2500af60a502d77
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:03 -05:00
Johan Hedberg
a4ecff8dad Bluetooth: Rename cmd_stack/fiber/queue to cmd_tx_stack/fiber/queue
To prepare for a dedicated Command Complete/Status processing fiber,
add 'tx' to the existing names to differentiate from the 'rx' in the
upcoming names.

Change-Id: I59e0ba34502e4a2341396f81bfb5829c296b35a5
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:03 -05:00
Johan Hedberg
b3c29b6f9d Bluetooth: Fix buffer leak in hci_rx_fiber
Unknown buffers are likely a bug, but we should still put them back to
the buffer pool. Also, there's no reason to stop running the fiber.

Change-Id: I413f9ff115689da9b1487bc622a8d26693cfd6d0
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:03 -05:00
Johan Hedberg
d1d2810c8d Bluetooth: Fix coding style of switch statement
Change-Id: Ib53a639a48929344609857447c577b9be764fbb0
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:03 -05:00
Luiz Augusto von Dentz
0b21762db2 Bluetooth: Add enum for UUID types
UUID types don't come from any spec so it is safe to have a enum which
can be changed whenever we want.

Change-Id: I7549f3a487191eeb847a239936f882ff88f4d345
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:14:03 -05:00
Luiz Augusto von Dentz
06383eae4f Bluetooth: Fix beacon scan data
Length of "Test beacon" is 11 + 1 of type that should be 12 not 16.
In addition to that make the data variable static since they are only
used locally.

Change-Id: I2d7fb16cf7d383dafc9b083da6cd63a4d9be21c0
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:14:03 -05:00
Johan Hedberg
943f0896a8 Bluetooth: Add deadlock protection for bt_hci_cmd_send_sync
The bt_hci_cmd_send_sync function will deadlock if called from within
the rx fiber. Add prevention for this when debug is enabled by
verifying that the calling context is not the rx fiber.

Change-Id: Ib94bd5c10185165d017fe0aeafbce46d503ad705
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:03 -05:00
Johan Hedberg
06098aa73e Bluetooth: Remove CONFIG_BLUETOOTH_DEBUG_HCI_CORE from samples
There's no point in enabling BLUETOOTH_DEBUG_HCI_CORE for the samples
as the user/developer is unlikely to be interested in this specific
sub-module of the Bluetooth stack. The samples already have the
BLUETOOTH_DEBUG enabled, so leave it up to the user/developer to
decide if they want to add specific sub-module debug options.

Change-Id: I327086464561667a2462db0aab00d0ffcdd40d4c
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:03 -05:00
Johan Hedberg
544cb1433c Bluetooth: SMP: Add Encryption Key distribution support
Add support for distributing our LTK to the remote side. Normally we
would generate the needed random bytes when the connection becomes
encrypted, however using bt_hci_cmd_send_sync() from a HCI event
handler (which the encryption_change is) is not possible and will
deadlock (because it needs to wait for a HCI command of its own to
complete). Instead, pre-generate the LTK as part of the SMP context
when we receive the SMP Random PDU from the remote.

Change-Id: Id9cc34b7ddfd1804626cf8bdc81c25aa8cc7943c
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:03 -05:00
Johan Hedberg
4c11bb5fdb Bluetooth: SMP: Fix authentication requirement in response
We shouldn't send any unknown bits or bits that we do not support.

Change-Id: Ia1c1cfd1e70ca879fd070b5fbcceef3b66ba8237
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:03 -05:00
Johan Hedberg
20b2d70a56 Bluetooth: SMP: Add more protocol defines
Add more defines needed to do key distribution and using correct
values for the authentication requirement.

Change-Id: I674c143d26ee31e9473c50c181c2947a305025fd
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:03 -05:00