Commit graph

41120 commits

Author SHA1 Message Date
Anas Nashif
3206f0b231 kbuild: remove unnecessary if statements
The c files actually check for the Kconfig variables, so there is no 
need to do the checking in the Makefile again adding double logic.


Change-Id: I8521047bd575c8f9d64f7d8e5abfb5eee8a40cb3
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:17 -05:00
Anas Nashif
67dbf7531a doc: fixed type sempahores -> semaphores
Change-Id: Iec1748ddcc15f2f42cf195ebd7ad0b9594e4224c
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:17 -05:00
Anas Nashif
715946b67c microkernel: do not enable workload monitor by default
Do not enable the feature by default when EXPERIMENTAL features
are enabled.

Change-Id: I0538f9f94bb47a4bc870c8974e80faf273070f91
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:17 -05:00
Alexandre dAlton
3bef343493 linker: add whole-archive flag to app lib
Change-Id: I167b67bb227718d18bc383c4562cccaa915ed22b
Signed-off-by: Alexandre d'Alton <alexandre.d'alton@intel.com>
Signed-off-by: Alexandre d'Alton <alexandre.dalton@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:04 -05:00
Ricardo de Almeida Gonzaga
0eb46fe0e5 gpio: fix interrupt callback call on gpio-dw
When configured as GPIO_ACCESS_BY_PIN, the callback should
be called only if the pin is enabled and received an interrupt.

Change-Id: I7addeb57c8d46dddc027e9b82a92654cd210ade1
Signed-off-by: Ricardo de Almeida Gonzaga <ricardo.gonzaga@intel.com>
2016-02-05 20:16:17 -05:00
Anas Nashif
66b55a3f7c arc: if printk is disabled, do not set variables
if printk is disabled, the variables will be unused and we will
get compiler warning.

Change-Id: I5dad791ae89d7a8c98f9e4660da472ef0caacc92
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:16:17 -05:00
Johan Hedberg
fd0bd160e6 Bluetooth: Add missing copyright statement to btp_spec.txt
Change-Id: I21f567fa56ee6cd5038838938161ac9cb00e9841
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:16:17 -05:00
Luiz Augusto von Dentz
d1ca4eb92d Bluetooth: Add subscription type to gatt-subscribe in btshell
This enables passing the value to be used when writing to CCC so it can
be configure for indications in adition to notifications.

Change-Id: Ied89faed422e5c5ec60618d512dbd3f250f50b46
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:16:16 -05:00
Luiz Augusto von Dentz
1b4fb0d8a6 Bluetooth: GATT: Add value support to bt_gatt_subscribe
This enables bt_gatt_subscribe to subscribe using indication value in
addition to notification.

Change-Id: I25f3b057e36b023a79fb66b11b70716ecc299ba9
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:16:16 -05:00
Luiz Augusto von Dentz
d87d1878b4 Bluetooth: ATT: Handle Indications
This adds the callback necessary to parse Indication PDU generating
proper Confirm response:

> ACL Data RX: Handle 3585 flags 0x02 dlen 8
      ATT: Handle Value Indication (0x1d) len 3
        Handle: 0x0014
          Data: 00
< ACL Data TX: Handle 3585 flags 0x00 dlen 5
      ATT: Handle Value Confirmation (0x1e) len 0

Change-Id: I277c1776f32cc05a55ffad7aa483ff1857c9fb9f
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:16:16 -05:00
Luiz Augusto von Dentz
b5e8ecf12e Bluetooth: ATT: Fix BT_ATT_OP_CONFIRM code
The correct code is 0x1e not 0x1f.

Change-Id: Icee68ebd01d76a4b3ed31a54e18b1115172f5b71
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:16:16 -05:00
Johan Hedberg
6f580e363b Bluetooth: Ignore completed packets events for unknown connections
Some controllers are broken in that they may send a completed packets
event after a disconnection has already occurred and the handle is
invalid:

> HCI Event: Disconnect Complete (0x05) plen 4
        Status: Success (0x00)
        Handle: 64
        Reason: Remote User Terminated Connection (0x13)
< HCI Command: LE Set Advert.. (0x08|0x000a) plen 1
        Advertising: Enabled (0x01)
> HCI Event: Command Complete (0x0e) plen 4
      LE Set Advertise Enable (0x08|0x000a) ncmd 1
        Status: Success (0x00)
> HCI Event: Number of Completed Pa.. (0x13) plen 5
        Num handles: 1
        Handle: 64
        Count: 1

Since the disconnection code already takes care of updating the
le_pkts_sem semaphore appropriately there is no need to do anything
for this kind of events (except log a warning of a misbehaving
controller).

Change-Id: I67b35aa50f7297d6bcdeeeab62f1f1d224b1a372
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:16:16 -05:00
Szymon Janc
19b2d6c258 Bluetooth: Factor out pending connection lookup in le_conn_complete
This is in preparation for being able to compile out SMP support.

Change-Id: Idb3597dd16e457d19d592a9b7dce954b950b174e
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:16:16 -05:00
Szymon Janc
6fc9e71d09 Bluetooth: Refactor bt_conn_security function
Separate connection master role related parts in single block making
it simpler to split. This is a preparation for being able to compile
in only central or peripheral role support.

Change-Id: I27dc9b32048bf4e682149d5f1d5edbd994155e2b
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:16:16 -05:00
Johan Hedberg
a9382fde50 Bluetooth: Fix missing error checks for drv->send()
The HCI driver send() callback may fail and in such a case require
different handling on the core stack side. This patch introduces the
missing error handling to the places calling drv->send().

Change-Id: Ia0e4f05aedd88c268cf0da98b11924eb3c5c4c0b
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:16:16 -05:00
Johan Hedberg
4817c96b68 Bluetooth: Fix returning unacknowledged packets upon disconnection
The core specification says the following about the treatment of
unacknowledged packets when a disconnection occurs (page 773 in core
spec 4.2):

"When the Host receives a Disconnection Complete, Disconnection Physical
Link Complete or Disconnection Logical Link Complete event, the Host shall
assume that all unacknowledged HCI Data Packets that have been sent to the
Controller for the returned Handle have been flushed, and that the
corresponding data buffers have been freed. A Primary Controller does not
have to notify the Host about this in a Number Of Completed Packets event"

This patch adds tracking of unacknowledged packets on a per-connection
basis and makes sure the semaphore that counts controller buffers is
given back the appropriate amount when a disconnection occurs.

Change-Id: I2ff4d12ffa50d4dda5b3e8c75fc75b4c0927e609
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:16:16 -05:00
Johan Hedberg
4cdcd228a2 Bluetooth: UART: Fix bt_uart_send error return values
The send() callback of HCI drivers should be returning 0 on success
and a negative value on error. The uart_fifo_fill() function returns
the number of transmitted bytes so it can not be directly mapped to
the send() return value.

Change-Id: I59be478c1985f44a46f2a9613f61471423b0e63a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:16:16 -05:00
Szymon Janc
5b5575a1fe Bluetooth: Refactor bt_le_scan_update function
Separate connection related parts in single block making it
simpler to split. This is a preparation for being able to compile
out connection support.

Change-Id: I992e604cae848ed2dfe821a6971248e53ae23498
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:16:16 -05:00
Szymon Janc
ff747d6808 Bluetooth: Factor out setting flow control
This patch factors setting up controller to host data flow control
to separate function. This is a preparation for being able to compile
out connection support.

Change-Id: Ibcce0b740534331a6365c2370b7b637877d71560
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:16:16 -05:00
Szymon Janc
cc261005f2 Bluetooth: Remove includes from internal headers
All required includes should be placed in source file that includes
internal header.

Change-Id: I161e7ebe2e62377ea4cf03f759d48f5900103076
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:16:16 -05:00
Arkadiusz Lichwa
348276044f Bluetooth: ATT: Fix write check permission
Writes to GATT attribute that has no write permission set, should
return write not permitted (BT_ATT_ERR_WRITE_NOT_PERMITTED)
in check permission routine.

Change-Id: I95f0988e171294cd98b79d3e7b518383ac47567d
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-02-05 20:16:16 -05:00
Szymon Janc
8b7097fd20 Bluetooth: Make parts of GATT API internal
Move parts of the API that are not usable for applications to
an internal header.

Change-Id: Idbcd3db8acda74375ea9deec2bf3d7eddc8a4ddb
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:16:16 -05:00
Grzegorz Kolodziejczyk
dabb5d49d5 Bluetooth: Fix read attr respond with invalid handle error
If no attribute with given handle is found in database then invalid
handle error should be set and returned. If attribute is found then
pre-set invalid handle error will be cleared.

Change-Id: I4119877bb72693e18003399f9b6764666f801fe4
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-02-05 20:16:16 -05:00
Szymon Janc
fb6c412b8d Bluetooth: Move Kconfig Bluetooth settings to submenu
This makes menu cleaner and easier to follow what options
are Bluetooth specific. It is now similar to IP configuration.

Change-Id: Ic2f6002ab30093bed62e71fe268a576d69a9cd0d
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:16:16 -05:00
Mariusz Skamra
3bb2df0d24 Bluetooth: tester: Add missing GAP_SETTINGS_DISCOVERABLE define
Change-Id: I56cad6462a50783a9518b3bc7a3c6b082f323f8e
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:16:16 -05:00
Jukka Rissanen
01d8a82332 net: tinydtls: Add missing header files
Tinydtls had its own .gitignore file that masked away two
include files that are needed in compilation. Removed
the files from ignore file and added those two files.

Change-Id: Ibcfcf4e18ca8f56eef97d41464c4233148e9db9e
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:16:16 -05:00
Luiz Augusto von Dentz
c74c6fd453 Bluetooth: ATT: Retry in case of recoverable error
If the remote response with encryption/authentication error attempt to
elevate the security and retry sending the request:

bt: bt_att_recv (0x00112e0c): Received ATT code 0x01 len 5
bt: att_error_rsp (0x00112e0c): request 0x0a handle 0x0018 error 0x0f
bt: security_changed (0x00112e0c): conn 0x0010f5ac level 1
bt: security_changed (0x00112e0c): Retrying
bt: bt_att_recv (0x00112e0c): Received ATT code 0x0b len 1
bt: att_handle_read_rsp (0x00112e0c):
bt: att_read_rsp (0x00112e0c): err 0x00

Change-Id: I9d74fb50385c39b2092357f4fd6912a3eb041442
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:16:16 -05:00
Luiz Augusto von Dentz
2045f0ab12 Bluetooth: ATT: Clone request buffer
Clone request buffer so it can later be used to validate the response.

Change-Id: I306f7b01a9a72a6c4b8e97c30789247b28428365
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:16:16 -05:00
Andrei Emeltchenko
41d047f0fa Bluetooth: Fix bug in the shell app
Fixes bug accessing wrong memory.

Change-Id: I13b4bebe807fe3c2694311e72d9d49d3b688bceb
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:16:16 -05:00
Szymon Janc
deb72b0b34 Bluetooth: Add initial Bluetooth Tester Protocol specification
This documents describes protocol used by external tester to drive
IUT. Currently initial version includes only Core and GAP services.

Change-Id: I2fcb366076313880116be2ead8916bb56a4b5910
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:16:16 -05:00
Jukka Rissanen
3cf2e63f81 net: Check neighbor discovery option correctly
Use correct config option to either enable or disable
neighbor discovery.

Change-Id: If67219cfa71893d2805b37e5ab3bbd11af789cb5
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:16:16 -05:00
Luiz Augusto von Dentz
1354dc9a90 Bluetooth: Add bt_buf_clone
This adds bt_buf_clone which can be used to duplicate a buffer, including
its contents.

Change-Id: I473841e1fce00fddbfac1fb2c55d40741658484f
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:16:16 -05:00
Mariusz Skamra
241ff5336c Bluetooth: gatt: Fix data length in Prepare Write Request
Maximum allowable data length for Prepare Write Request
ATT command is ATT_MTU - 5, due to its header payload:
mtu - opcode(1 byte) - offset(2 bytes) - handle(2 bytes)

bt: bt_gatt_exchange_mtu (0x0011053c): Client MTU 65
Exchange pending
btshell> bt: bt_att_recv (0x00112cc8): Received ATT code 0x03 len 3
bt: att_mtu_rsp (0x00112cc8): Server MTU 23
Exchange successful
bt: gatt_prepare_write (0x0011053c): handle 0x00d0 offset 0 len 18
Write pending
btshell> bt: bt_att_recv (0x00112cc8): Received ATT code 0x17 len 23
bt: att_handle_prepare_write_rsp (0x00112cc8):
bt: att_prepare_write_rsp (0x00112cc8): err 0x00
bt: gatt_prepare_write (0x00112cc8): handle 0x00d0 offset 18 len 12
bt: bt_att_recv (0x00112cc8): Received ATT code 0x17 len 17
bt: att_handle_prepare_write_rsp (0x00112cc8):
bt: att_prepare_write_rsp (0x00112cc8): err 0x00
bt: gatt_exec_write (0x00112cc8):
bt: bt_att_recv (0x00112cc8): Received ATT code 0x19 len 1
bt: att_handle_exec_write_rsp (0x00112cc8):
bt: att_write_rsp (0x00112cc8): err 0x00
Write complete: err 0

Change-Id: I28fc2e6806d16826915234fc13b108fa40baed67
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:16:16 -05:00
Szymon Janc
bece111ec9 Bluetooth: Refactor tester application
This big patch refactors tester application and put it in par with
updated tester protocol.

Change-Id: Ib016fdd0aac58a32bcdc67774843cf65d619947d
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:16:16 -05:00
Johan Hedberg
1712baf9cd Bluetooth: Initialize RX prio fiber before RX fiber
If bt_enable() is called from a preemptible context we need to make
sure the RX prio fiber is initialized by the time the HCI init runs
from the hci_rx_fiber function.

Change-Id: I91bb0c69d011944ee2a035b2a707618632a6b189
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:16:16 -05:00
Szymon Janc
b0794cc71e Bluetooth: Reduce number of memcpy in le_adv_report
There is no need for local copy of addres. Use pointer instead.

Change-Id: I4681af527813093547d2641ab2390cfa64383d6b
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:16:16 -05:00
Szymon Janc
8efdadc9ab Bluetooth: Simplify check_pending_conn function
Connection address based on keys is already selected before call to
check_pending_conn. There is no need to select it again.

Change-Id: I2f1a329c19f5c08734c50dbf8d32bf5c28192a35
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:16:15 -05:00
Grzegorz Kolodziejczyk
1d322531cd Bluetooth: Add GAP Appearance characteristic to GATT db
This is a mandatory characteristic for GAP servie. It must be included
in GATT db.

Change-Id: I27c0c6d56f5303c3c5d1606d7656c51823f74989
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-02-05 20:16:15 -05:00
Mariusz Skamra
a679ffbfa8 Bluetooth: gatt: Fix non-passing service handles to the callback
Pass service handles to the callback during service discovery.

Change-Id: I616de5188faf76c84cc02ceb29a6f5aab631b89c
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:16:15 -05:00
Andrew Boie
009ddade3a .gitignore: add ctags data file
Change-Id: I4befc9393e46be11f6f16d88ffee03853b27ed38
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:16:15 -05:00
Anas Nashif
196bb2e17f libc: use isdigit from ctype.h
Do not use local _isdigit function, use public isdigit
instead.

Change-Id: Ifc2721fc2def429de4934c9855f08dae30326694
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:16:15 -05:00
Anas Nashif
f3f7eac765 Add MINIMAL_LIBC_EXTENDED to limit libc builds
This option adds optional libc functions that are not directly
used by the kernel but can be used for testing purposes.

This option is experimental.

Change-Id: Ia4dba718359c4f381047a5b52ebddb26d87ea75a
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:16:15 -05:00
Anas Nashif
751d90da85 libc: add support for strncasecmp function
Add function for comparing two strings ignoring case.

Change-Id: I2fc78c0a0d0f53e23566ffacd8dca3b23e386c26
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:16:15 -05:00
Anas Nashif
3e02a4a107 libc: add atoi to minimal libc
Change-Id: I589fe6599dec1a93e9700005742b8b34b42dee64
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:16:15 -05:00
Anas Nashif
9d648ebc48 libc: add strcat to minimal libc
Change-Id: Ifae9da3abb60d061a4211e0fac20037f72ca90e2
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:16:15 -05:00
Anas Nashif
bddd72602c libc: add strtol and strtoul to minimal libc
Change-Id: Ia6198cd34ff486d8eb9d978a59d885cae06b60d3
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:16:15 -05:00
Anas Nashif
17f666bd89 libc: update ctype.h with isdigit, isspace, isalpha, isupper
Change-Id: Id8d865cde04d66367ddcf26995780767ad1b05f8
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:16:15 -05:00
Dirk Brandewie
6bc71f5933 libc: added errno global variable
Change-Id: I42ae30fe5826828cc4696f155caeb186a31f913b
Signed-off-by: Fabien Chereau <fabien.chereau@intel.com>
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
2016-02-05 20:16:01 -05:00
steveballard123
b4c75df9dc doc: Edits to the supported platform documents.
Edit grammar, punctuation, consistency, linkage, and accuracy.

Change-Id: I46b2b0cdf18b89f5c669c398360decd6a4c68217
Signed-off-by: steveballard123 <stephen.r.ballard@intel.com>
Signed-off-by: Rodrigo Caballero <rodrigo.caballero.abraham@intel.com>
2016-02-05 20:15:59 -05:00
Peter Mitsis
e54276391b loapic_timer: rewrite tickless idle for loapic timer
Rewrites the LOAPIC timer tickless idle implementation to cover all edge cases.

Change-Id: Ide0a235f298dfc5c75a090a45d1bf8275d81e248
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:15:59 -05:00