Commit graph

42559 commits

Author SHA1 Message Date
Johan Hedberg
4b433d4fa6 Bluetooth: Differentiate send/recv of needed driver headroom
The space that the HCI driver needs to reserve for its own use is not
necessarily symmetrical. E.g. even with the current H4 driver we only
need to reserve space for sending data but not for receiving it.
Keeping track of these values independently enables more efficient use
of the buffers.

Change-Id: I64917b545c5cd77356ed038d09afe76422334661
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:39 -05:00
Ravi kumar Veeramally
1c0c1e4a00 net: apps: Add sanity test changes to test_15_4
Add sanity test related changes to test_15_4 application in both
micro and nano kernel. config_whitelist in testcase.ini is not
accepting other than PLATFORM configs. So creating test folder
for sanity tests. src directory is still common for all.

Change-Id: Iffa4c588500367fa475aef8e0772f1c08946c5a4
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-02-05 20:24:39 -05:00
Ravi kumar Veeramally
a81c968b0b net: Add Kconfig option for sanity test
Change-Id: I9d1742fb2c70fbba573fe9ed64bedd8a76aa504c
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-02-05 20:24:39 -05:00
Ravi kumar Veeramally
694d972595 net: apps: Add support for CONFIG_NET_15_4_LOOPBACK_NUM
Add support for CONFIG_NET_15_4_LOOPBACK_NUM in test_15_4 application.

Change-Id: I57246f9db587f492cddc0d0be607b1ae4a78fbf7
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-02-05 20:24:39 -05:00
Johan Hedberg
fa8636c24e Bluetooth: Fix handle value in completed packets command
The report_completed_packet() function overwrites the original buf
pointer so we have to use a local variable to store the handle value.

Change-Id: I9caada0dd83270f2de998f57940aaf4995a247da
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:39 -05:00
Johan Hedberg
13fcc5ca3e Bluetooth: Make ACL/HCI user data private to hci_core.c
Change-Id: I85ccbfd2d844195bffcc6dd3d6490808569ca129
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:39 -05:00
Johan Hedberg
52cf66feb9 Bluetooth: Remove user data from outgoing ACL buffers
Outgoing ACL buffers don't need any user data.

Change-Id: If7e6a27b88d3aa64c51672190bdecc705429aa7b
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:39 -05:00
Johan Hedberg
31114c384b Bluetooth: Remove buffer type information from user data
Since the type can be determined either from the context or from e.g.
the pool that it belongs to (the 'free' pointer) we no-longer need to
store the type as part of the user data struct.

Change-Id: I090636aaa0a0b1be798b6dadfab072151fc3ab14
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:39 -05:00
Johan Hedberg
5f4daa1551 Bluetooth: Merge send_acl/cmd back to a single callback
Now that we have the buffer type enum as part of the HCI driver API we
can take advantage of it to pass the buffer type information and not
have to have two separate callbacks.

Change-Id: Ib2ee5b1540e532c9b27903e97660a276c1293fbc
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:39 -05:00
Johan Hedberg
ff2d104105 Bluetooth: Move buffer type enum to driver.h
Since the buffer type is essentially a HCI driver - HCI core
communication detail the appropriate place for it is driver.h. At the
same time remove the unnecessary and slightly confusing BT_DUMMY type.

Change-Id: Ic813ad24d8f0530d3779006063ea21b010d29cf6
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:39 -05:00
Johan Hedberg
e000290627 Bluetooth: Move outgoing ACL buffer management to l2cap.c
The only user of this is l2cap.c so move the buffer pool there to
avoid unnecessary calls between c-files.

Change-Id: Ia9335b21c34546e2252fa40d9eec2e09156b0d67
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:39 -05:00
Johan Hedberg
3822aecd24 Bluetooth: Merge buf.[ch] functionality into hci_core.[ch]
There's no need to maintain a separate module for this anymore.
Subsequent patches will have further simplifications thanks to this
being now handled in a single c-file.

Change-Id: I4510c9f72b121e1e5fd19eeb8b5d5ddf2f4bfffe
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:39 -05:00
Johan Hedberg
1ddc3edcaa Bluetooth: Introduce HCI-driver specific buffer functions
This way we avoid dealing with the specific buffer type value and to
make it clear that these are for drivers onle.

Change-Id: I8aef7ec6a767b2fa68cbe374eb371e2a6192f675
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:39 -05:00
Johan Hedberg
7ff1cbd976 Bluetooth: Split HCI driver ACL/CMD send callback
This is a necessary step in preparation for removing the buffer type
information from the buffers.

Change-Id: I29d8fae32aa660416a1c12e87840499c711e659f
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:39 -05:00
Johan Hedberg
70f80ad968 Bluetooth: samples/peripheral: Remove dependency on internal define
Change-Id: I514d9beb69c27e563d7daeaa880ba55b49a6f159
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:39 -05:00
Szymon Janc
51af39ff16 Bluetooth: Allow sanity to build tester on x86
This allows to build sanity for both ARM and x86 archs.
Only supported platforms are enabled.

Change-Id: I499dbdee7b9df265affb2bba98b5bb100339fe18
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:24:39 -05:00
Ravi kumar Veeramally
34f1cacae3 net: Add Kconfig option for loopback num
NET_15_4_LOOPBACK_NUM is Kconfig option for number of times
loopback runs. In a controllable way loopback runs. This will
be helpful in sanity tests.

Change-Id: I48392d7e0d0b793ddc1b2b0c1b8c1f22e1bb318a
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-02-05 20:24:39 -05:00
Ravi kumar Veeramally
5e965ca8ca net: apps: Remove unused nanosems
Change-Id: I0c62ad9919d5915438a85adc4a2afcca8e23950a
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-02-05 20:24:39 -05:00
Ravi kumar Veeramally
4d705eec5c net: Fix net_buf variable initialization
Variable len is related uIP stack. datalen is actual variable which
needs to be set zero in net_buf_get_reserve.

Change-Id: I75273ef760d3cd4f90808b496b75f56f19bd2e2b
Signed-off-by: Ravi kumar Veeramally <ravikumar.veeramally@linux.intel.com>
2016-02-05 20:24:39 -05:00
Szymon Janc
162b5e8091 Bluetooth: Default to ARM build for tester application
Tester application requires 3 UARTs and currently no x86 based
platform supports it. For convenience default to arch that allows
to run, not only build tester.

Change-Id: I086e72a580f56d94181a6d6eada7693ddd24dec1
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:24:39 -05:00
Johan Hedberg
f1baa0b8fc Bluetooth: uart: Remove incorrect buffer type check
It's invalid to try to send HCI events to the controller so we should
treat such buffer types as invalid in bt_uart_send().

Change-Id: I4108a158d5b91f364a9f3c56e3037f03755daa19
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:39 -05:00
Johan Hedberg
0c338649f0 Bluetooth: Remove unnecessary deadlock check
Previously we didn't have the split to priority rx fiber vs "normal"
rx fiber. This meant that we didn't have full control of code that
would run from this fiber and therefore a deadlock check was useful.
The rx priority fiber (where the deadlock could happen) is very well
defined and controlled so the value of this extra check is now quite
minimal.

Change-Id: I8d09cc39ca6548230a973bc8b8231d999dc1dc67
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:39 -05:00
Johan Hedberg
ea11d4b5cd Bluetooth: Add helper macros for accessing Bluetooth user data
To avoid unnecessary stack variables and to simplify code, add helper
macros to access the Bluetooth specific ACL and HCI user data that's
part of the buffers.

Change-Id: Idc337537721115c4091982c04f8a05bbbf0d5a19
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:39 -05:00
Johan Hedberg
6e84d77151 Bluetooth: Remove old bt_buf API
Now that all code is converted remove the temporary helpers for the
old bt_buf API.

Change-Id: I5183add527d204c51103549fda3378040d5f8f68
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:39 -05:00
Johan Hedberg
48fde83fe5 Bluetooth: samples/test_bluetooth: Convert to net_buf API
Convert the code to use the net_buf API instead of the soon to be
removed bt_buf API.

Change-Id: I98a0720483d3f364b77fe6dc030c9169aa4ade67
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:39 -05:00
Johan Hedberg
e41285999c Bluetooth: samples/shell: Convert to net_buf API
Convert the code to use the net_buf API instead of the soon to be
removed bt_buf API.

Change-Id: I4eb6cea592cce99dcc9e4c1b1219ebbf89eddd04
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:39 -05:00
Johan Hedberg
ad20899261 Bluetooth: gatt: Convert to net_buf API
Convert the code to use the net_buf API instead of the soon to be
removed bt_buf API.

Change-Id: I9437750aa6fffcde31e1879bf6e3a13143f45480
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:39 -05:00
Johan Hedberg
b9476947d9 Bluetooth: att: Convert to net_buf API
Convert the code to use the net_buf API instead of the soon to be
removed bt_buf API.

Change-Id: I89e5ac5a178cf57c0a3f7fee38d1170c25e07c5b
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:38 -05:00
Johan Hedberg
dfdd7b24de Bluetooth: smp: Convert to net_buf API
Convert the code to use the net_buf API instead of the soon to be
removed bt_buf API.

Change-Id: I3c7f6c5ec2b447adc8855acf8d66205434ce08eb
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:38 -05:00
Johan Hedberg
529a12338b Bluetooth: l2cap: Convert to net_buf API
Convert the code to use the net_buf API instead of the soon to be
removed bt_buf API.

Change-Id: I5f376caeb861ac8b815a0a2e235bd188b9e8185b
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:38 -05:00
Johan Hedberg
5b4063094a Bluetooth: conn: Convert to net_buf API
Convert the code to use the net_buf API instead of the soon to be
removed bt_buf API.

Change-Id: I7f4577ba31f8e5646873f164ff308c71d23021e5
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:38 -05:00
Johan Hedberg
c73b131b3b Bluetooth: core: Convert to net_buf API
Convert the code to use the net_buf API instead of the soon to be
removed bt_buf API.

Change-Id: I226de212d4f8d4f5b613708ffe42570443bc2182
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:38 -05:00
Johan Hedberg
1f01f1da16 Bluetooth: uart: Convert to net_buf API
Convert the code to use the net_buf API instead of the soon to be
removed bt_buf API.

Change-Id: I8df37d214e1f93ee472cde82c4198d667709ff5a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:38 -05:00
Johan Hedberg
581fa90ea8 Bluetooth: Initial conversion to net_buf API
This patch performs the minimal necessary conversion to the net_buf
API. It uses a temporary "#define bt_buf net_buf" to make it possible
to convert the code in smaller increments. Most old bt_buf function
also serve as one-line wrappers to the matching net_buf APIs. Once
everything is converted these helpers will be removed.

Change-Id: Ie31433d33576022c9c193a35d2389267005545d6
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:38 -05:00
Johan Hedberg
c1f007687f net: Add initial generic buffer implementation
We need to have a generic buffer API in order to efficiently transfer
data between different subsystems. The first such case will be the
Networking and Bluetooth subsystems where 6LoWPAN data will be passed
back and forth.

The needed API needs to provide enough flexibility for different
buffer sizes as well as custom protocol-specific context data.

The implementation offered in this patch follows the general design of
the existing Networking and Bluetooth buffer implementations by using
a backing array of buffer which is fed into a "free buffers" FIFO for
management. The main difference is that the API allows specifying
variable sized buffers for each created pool, as well as a minimum
amount of "user data" that's allocated as part of each buffer.

There's also an optional destroy callback that's e.g. useful for HCI
flow control in Bluetooth (for notifying the controller of available
buffers).

Change-Id: I00b7007135a0ff35219f38f48658f31728fbb7ca
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:38 -05:00
Luiz Augusto von Dentz
d57e54fddc Bluetooth: Make it possible to build tester for x86
Currently it is only possible to build the tester for arm.

Change-Id: I7fd530ca09bfa41072420da774fba3b48a5d5a90
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:24:38 -05:00
Luiz Augusto von Dentz
929d4f4c86 Bluetooth: GATT: Make BT_GATT_CHARACTERISTIC declare its value
This makes BT_GATT_CHARACTERISTIC declare a local bt_gatt_chrc so the
applications don't need to declare themselves.

Change-Id: Icf3fad7dffea5667c6f13aa022a5722900da51e8
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:24:38 -05:00
Luiz Augusto von Dentz
1617f5580b Bluetooth: GATT: Remove value_handle from bt_gatt_chrc
The spec says it should always be the very first descriptor after the
characteristic:

  "BLUETOOTH SPECIFICATION Version 4.2 [Vol 3, Part G] page 534:
   3.3.2 Characteristic Value Declaration
   The Characteristic Value declaration contains the value of the
   characteristic. It is the first Attribute after the characteristic
   declaration. All characteristic definitions shall have a
   Characteristic Value declaration."

Change-Id: I6c38dea9cc4c1a05997edbd348e2759680472725
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:24:38 -05:00
Luiz Augusto von Dentz
148ce3013c Bluetooth: GATT: Remove unused field of _bt_gatt_ccc
value_handle is not used for anything.

Change-Id: I3885d221b162eb3bd44956af64280baf61dc001b
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:24:38 -05:00
Luiz Augusto von Dentz
1284e608ac Bluetooth: GATT: Remove handles from macros
bt_gatt_register will assign a handle if not initialized and removing
the handle makes it simpler to change the attributes since it is no
longer possible to have conflicting handles.

Change-Id: I787f7325cc990c360056b1aefd07bb7d7876b445
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:24:38 -05:00
Luiz Augusto von Dentz
1c8ab98114 Bluetooth: GATT: Make attribute database into a list
This allow calling bt_gatt_register multiple times so different tasks
can add their own services separately.

Change-Id: I8143ddedfa1079087d608013d1a97b552a3007dc
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:24:38 -05:00
Michael LeMay
2a11205499 net: apps: echo_server: Add Ethernet support
This patch adds a NET_INTF makefile configuration option to the
echo_server sample application to allow Ethernet support to be enabled
by specifying NET_INTF=ethernet.  It currently includes specific
support for the Ethernet device in the Intel Galileo.

Change-Id: I6b605db32d2d8a4259fc003724b2daa11c9a26d9
Signed-off-by: Michael LeMay <michael.lemay@intel.com>
2016-02-05 20:24:38 -05:00
Michael LeMay
ef2a2254e6 eth: dw: galileo: Provide pre-set MMIO base address and IRQ
Provide a preconfigured base address for MMIO and a preconfigured IRQ
pin identifier for the first PCI Ethernet MAC in the Intel Quark X1000
SoC.

Change-Id: I1b527df6c3b1b65da9f0233464e54157029f04f5
Signed-off-by: Michael LeMay <michael.lemay@intel.com>
2016-02-05 20:24:38 -05:00
Michael LeMay
ebba3bf38b eth: dw: Add driver for Synopsys DesignWare Ethernet MAC
This patch adds a driver for a Synopsys DesignWare Ethernet MAC.  The
driver uses interrupts to handle received frames, but it uses a
spinloop when transmitting to wait for the transmit descriptor to
become available.  Transmission is coordinated by a fiber, so this
should not result in the system execution being blocked.  Only a
single descriptor is allocated for each of the transmit and receive
directions to save memory and simplify the code.  Another
simplification is that none of the offload capabilities of the
Ethernet device are used.  The driver currently only supports a single
instance of the Ethernet MAC, which is consistent with the limitation
in the network stack that only a single network device is supported.

Change-Id: I013b3d439a76e8ff91a775516f7035841b040870
Signed-off-by: Michael LeMay <michael.lemay@intel.com>
2016-02-05 20:24:38 -05:00
Michael LeMay
0927378a59 net: Add Ethernet support to the network stack
This patch adds support for Ethernet to the network stack, which
entails relying on the Ethernet device driver to set the MAC address,
invoking ARP routines at the appropriate points, configuring the
Contiki network stack to use the appropriate link-level header length,
etc.

Change-Id: I153a6f4c83c28ca7129ef5affa1e9a18b0f92913
Signed-off-by: Michael LeMay <michael.lemay@intel.com>
2016-02-05 20:24:38 -05:00
Michael LeMay
2684f4472f pci: Add pci_enable_bus_master
This patch adds the pci_enable_bus_master function that enables bus
master access for a PCI device.

Change-Id: I317daac1a613ccfc5a3894332c1a7dbbff05991f
Signed-off-by: Michael LeMay <michael.lemay@intel.com>
2016-02-05 20:24:38 -05:00
Johan Hedberg
b7ae2f44ad net: Fix enabling both Bluetooth and Networking support
We can't use '=' in net/Makefile since then one statement would
override the value of the previous one when both CONFIG_NETWORKING and
CONFIG_BLUETOOTH were set to 'y'. Instead, use '+='.

Change-Id: Idba9916cc9fb2bd0e53975bdf0a86c0fd184533c
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:38 -05:00
Johan Hedberg
49885879f2 Bluetooth: Rename bt_conn_get/put to bt_conn_ref/unref
We want to make the naming convention ref/unref rather than get/put.
So far the only reference counted objects are the buffers and the
connections. For the buffers the new generic buffer API will also use
ref/unref.

Change-Id: I9fe8b8a6a50a8baf06ba231e8f6717a5a47dd292
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:24:38 -05:00
Luiz Augusto von Dentz
6f410176ef Bluetooth: Make bt_uuid_str parameter const
bt_uuid_to_str uuid param is const therefore bt_uuid_str should be const
as well.

Change-Id: I043d66d16c863ed92e60477dbbb9c37bcde92703
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:24:38 -05:00
Luiz Augusto von Dentz
48cbd12ffb Bluetooth: Fix UUID 128 bits string format
The two last fields are 32 bits and 16 bits respectively not the other
way around.

Change-Id: I10d2ed9d69229f02b430f9812e95e4a8f3f060c7
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:24:38 -05:00