Commit graph

41120 commits

Author SHA1 Message Date
Paul Sokolovsky
c524ff6b8c subsys: console: getchar: Use consistent var names for RX path
Initially, there was support only for buffered input, and adhoc var
names used. Later, buffered output support was added, with variables
consistently using "tx_" prefix. Now, rename the original RX path
to use symmetric "rx_" prefix.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-06-11 17:41:44 -04:00
Vinayak Kariappa Chettimada
dc95e1ba05 Bluetooth: controller: Add Tx Power Kconfig option
Add support for changing the default Tx Power value using
Kconfig option.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2018-06-11 17:40:00 -04:00
Piotr Zięcik
3f3a907bb8 drivers: timer: Use sys_clock_hw_cycles_per_tick in nrf_rtc_timer.
The nrf_rtc_timer used own method to calculate number of timer cycles
per tick. As the result value was different than the one used by
the kernel, the reported time was incorrect.

This commit fixes the problem described above by using global
sys_clock_hw_cycles_per_tick instead of custom RTC_TICKS_PER_SYS_TICK.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2018-06-11 17:38:13 -04:00
Sathish Kuttan
7b7784e149 drivers: dma_cavs: Add support for circular list
Added support for circular linked list of DMA buffers
This patch checks the last block supplied by the application
and if the next pointer in the last block is valid, the tail
linked list item is linked to the head linked list item
to form a circular linked list

Signed-off-by: Sathish Kuttan <sathish.k.kuttan@intel.com>
2018-06-11 17:34:04 -04:00
Robert Lubos
d494398940 net: stats: handle_na_input: unref packet after stats are updated
Because per-interface statistics rely on interface pointer stored in a
net_pkt, it should not be unreferenced before stats are updated.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2018-06-11 17:33:17 -04:00
Robert Lubos
30c4aae948 net: samples: increase main stack size for echo_client
Default stack size was too small for main thread in qemu_x86
configuration and resulted in stack overflow during initialization.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2018-06-11 17:33:17 -04:00
Robert Lubos
3cf1b07d5a net: stats: do not use deallocated packet pointer
Functions for per-interface statistics collection used a pointer to a
packet that could've been deallocated in the net_conn callback function.
In result, application could crash when interface related to the packet
was referenced. To fix that, packet interface is stored earlier, so it
can be used instead for statistics collection.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
2018-06-11 17:33:17 -04:00
Sebastian Bøe
ee9af86f4c cmake: Improve user error feedback when -H$ZEPHYR_BASE is specified
Users are sometimes mistakenly invoking cmake with $ZEPHYR_BASE set as
the source directory.

This user-error can occur if the user believes that the toplevel
CMakeLists.txt file is at the root of the repo, or if the user uses
the wrong path when invoking cmake.

The error given when this user-error occurs is cryptic and undefined,
so we replace it with what should be an easy-to-understand error
message.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-06-11 17:32:50 -04:00
Johann Fischer
1ce6a6eaa8 subsys: usb: update bcdUSB to 2.00
Update bcdUSB to 2.00

resolves #7570

Signed-off-by: Johann Fischer <j.fischer@phytec.de>
2018-06-11 17:31:15 -04:00
Ruslan Mstoi
33fa63e40e sanitycheck: Add progress to verbose mode
In verbose mode (-v) progress of running test cases number out of total
number is not printed. Thus, if there are many test cases, it is
impossible to follow the progress. This commit adds printing of current
test case and total numbers to the verbose output.

Signed-off-by: Ruslan Mstoi <ruslan.mstoi@intel.com>
2018-06-11 17:30:58 -04:00
Vinayak Kariappa Chettimada
edb2ad11f0 Bluetooth: controller: Remove redundant include of cmsis.h
Remove the redundant include of cmsis.h as soc.h already
includes it as necessary.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2018-06-11 17:30:29 -04:00
Paul Sokolovsky
4dd61f8897 net: tcp: Process zero window probes when our recv_wnd == 0
The IP stack drops any TCP segment which doesn't fit into our
receive window. However, we still must accept Zero Window Probe
segments, which are segments, usually with data length of 1, which
a peer sends to us after we stayed with zero window for some time.
In this case, we need to repeat an ACK with the old ack number.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-06-11 17:30:04 -04:00
Alberto Escolar Piedras
477b5497a7 native: Add command line options to control real timeness
For the native_posix board,
added the command line options -rt and -no-rt to control
if the execution should be slowed down to real time or not.

CONFIG_NATIVE_POSIX_SLOWDOWN_TO_REAL_TIME still works, but
now it just sets a default.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-06-11 17:29:27 -04:00
Loic Poulain
452cb61844 usb: bluetooth: Use transfer API for ACL packets
Use transfer API for ACL out transfers. No extra buffer is requested,
directly use the net buf and update its len on transfer completion.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2018-06-11 17:28:27 -04:00
Loic Poulain
00a6b4c5ae usb: bluetooth: Fix assert due to unreserved headroom
Bluetooth net buffers have 1-byte reserve, which can be used by HCI bus
driver (uart, spi...) to set packet type (H4).
This fixes assert when building hci_usb with CONFIG_NET_BUF_SIMPLE_LOG.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2018-06-11 17:28:27 -04:00
Loic Poulain
51fecf80d9 usb: bluetooth: Add TX thread
Calling bt_send from IRQ context is not safe, at least in HCI SPI case.
In the same way as hci_core, create a thread for TX.
This fixes hci_usb sample for 96b_carbon board.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2018-06-11 17:28:27 -04:00
Loic Poulain
ea5b866763 Bluetooth: hci: spi: Select BT_RECV_IS_RX_THREAD
SPI driver has its own rx thread, select BT_RECV_IS_RX_THREAD.
This fixes build issue because of undefined CONFIG_BT_RX_PRIO.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
2018-06-11 17:28:27 -04:00
Rajavardhan Gundi
4ec773f276 DTS: intel_s1000: Clean up I2C and UART stuff from soc.h
Clean up some remnant stuff related to I2C and UART from soc.h
and put it in dts.fixup

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2018-06-11 17:27:58 -04:00
Rajavardhan Gundi
e5b0e9ac07 DTS: interrupt controller: Define IRQ priorities for CAVS & DW ICTL
IRQ priorities for CAVS and DW were previously defined in Kconfig.
They are now defined via DTS and removed from Kconfig.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2018-06-11 17:27:58 -04:00
Jukka Rissanen
5cda31c8f1 net: dhcpv4: Detect network interface on/off events
Catch interface up/down events so that we can renew the
address if interface goes down and is then restored.

Fixes #7553

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-06-11 17:27:29 -04:00
Jukka Rissanen
fa8824184d net: dhcpv4: Fix IPv4 and UDP checksum calculation
Make sure we calculate the IPv4 and UDP checksum only when
needed.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-06-11 17:27:29 -04:00
Jukka Rissanen
e7206318fa drivers: eth: mcux: Inform IP stack when carrier is lost
If carrier is ON or OFF, then tell this information to upper IP stack
so that it can act accordingly.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-06-11 17:27:29 -04:00
Jukka Rissanen
b93d29df56 net: ethernet: Add carrier detection to L2
Add net_eth_carrier_on() and net_eth_carrier_off() functions that
can be called by ethernet device driver when it detects that carrier
is lost or found.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-06-11 17:27:29 -04:00
Jukka Rissanen
3122112aa8 net: ethernet: Provide stubs for ethernet carrier functions
If CONFIG_NET_L2_ETHERNET_MGMT is not enabled, then provide
stubs for ethernet_mgmt_raise_carrier_on_event() and
ethernet_mgmt_raise_carrier_off_event() functions so that those
functions can be called always.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2018-06-11 17:27:29 -04:00
Michael R Rosen
92f146ea7a doc: update application docs wrt CONF_FILE
Update the application documentation to discuss the new ability to
use semicolons as separators when there are multiple files. Enabling
semicolon separators also enables CMake lists to manipulate CONF_FILE
from the application side.

Signed-off-by: Michael R Rosen <michael.r.rosen@intel.com>
2018-06-11 17:26:39 -04:00
Michael R Rosen
025a1e9086 cmake: fix CONF_FILE parsing to allow for cmake lists
Modify CONF_FILE variable treatment in the cmake infrastructure
to enable the use of CMake lists and semicolon-separated strings
in setting the CONF_FILE list for multiple configuration files.
This change does not impact the current method of using
single-space-separated strings for multiple files.

Signed-off-by: Michael R Rosen <michael.r.rosen@intel.com>
2018-06-11 17:26:39 -04:00
David B. Kinder
4dcf928a40 doc: fix doxygen error for device.h macros
Doxygen has issues with function macros (those that don't end with a
semicolon).  Workaround is to have doxygen treat these as predefined by
the doxygen preprocessor.

Fixes: #7367

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-06-11 17:26:14 -04:00
Alberto Escolar Piedras
252be0b909 tests/kernel/sched/preempt: enable test for native_posix
The native_posix board does model irq_offload properly now
and therefore this test can be executed without problems.
So let's enable it.

Related to commit:
86b5364335

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-06-11 17:25:58 -04:00
Alberto Escolar Piedras
2e405fbc6d native_posix & kernel: Remove legacy preemption checking
Fix in interrupt wrapping for native_posix so it also
supports meta-interrupts.

Related to commit:
3a0cb2d35d

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-06-11 17:25:58 -04:00
Alberto Escolar Piedras
a7de06a687 native_posix: irq_offload to use a sw interrupt
New tests rely on irq_offload() actually being based on an
interrupt.
So let's base it on a new SW interrupt.

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2018-06-11 17:25:58 -04:00
Andy Ross
55a7e46b66 kernel/poll: Remove POLLING thread state bit
The _THREAD_POLLING bit in thread_state was never actually a
legitimate thread "state".  It is a clever synchronization trick
introduced to allow the thread to release the irq_lock while looping
over the input event array without dropping events.

Instead, make that flag a word in the "poller" struct that lives on
the stack of the thread calling k_poll.  The disadvantage is the 4
bytes of thread space needed.  Advantages:

+ Cleaner API, it's now internal to poll instead of being globally
  visible.

+ The thread_state bit space is just one byte, and was almost full
  already.

+ Smaller code to write/test a full word and not a bitfield

+ Words are atomic, so no need for one of irq lock/unlock pairs.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-06-11 17:25:38 -04:00
Paul Sokolovsky
59309c1a2d samples: sockets: dumb_http_server: Use consistent logging settings
Use logging settings consistent with other samples/net/sockets/ apps
(which includes error logging enabled by default).

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-06-11 17:24:54 -04:00
Ulf Magnusson
20721f39fa scripts: kconfig: Improve the 'user value != actual value' warning
Symbols that are assigned values in .config files must have satisfied
dependencies, and must have a prompt. Otherwise, the assigned value is
ignored. A warning is printed if the symbol ends up with a different
value than the assigned value as a result.

It might be difficult to know how to fix the problem just from seeing
the current warning. Add some hints to it to help out:

  - The symbol information dialog in menuconfig is good for figuring out
    dependencies that need to be enabled. Mention menuconfig in the
    warning.

  - The page for the symbol in the autogenerated Kconfig docs can be
    helpful too, so link it. There's a slight chance that it'll be
    outdated, but it's usually correct when working on the master
    branch.

Automatically enabling dependencies is much trickier than it might seem
at first, due to the generality of Kconfig. See
https://github.com/zephyrproject-rtos/zephyr/issues/8181 for some
discussion.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-06-11 17:24:07 -04:00
Paul Sokolovsky
eb3ecf6e66 net: shell: conn: Always show TCP state
It's rather confusing to not see current TCP state in any way (it
makes distinguishing different TCP contexts very hard). And nobody
can know/remember that it's printed with CONFIG_NET_DEBUG_TCP
defined. So, just make it be printed always (initially I thought
about printing just numeric value if CONFIG_NET_DEBUG_TCP isn't
defined, but why, if we can print symbolic name easily).

Also, add a hint that defining CONFIG_NET_DEBUG_TCP will still
print even more info (like unacked pkt list) - similarly to
similar helpful hints we have in other parts of net shell.

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
2018-06-11 17:21:58 -04:00
Tomasz Bursztyka
e1c1149957 net/pkt: Use IS_ENABLED instead of ifdef
It's a bit nicer that way.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-06-11 17:21:12 -04:00
Tomasz Bursztyka
d4e0a6872e net/pkt: Simplify a tiny bit how TC priority is set
Let's set it by default when allocating net_pkt. A macro will avoid
ifdefs as well

CONFIG_NET_TX_DEFAULT_PRIORITY is always defined.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-06-11 17:21:12 -04:00
Tomasz Bursztyka
a999d53a33 net/icmpv6: Removing duplicate checksum calculation
net_ipv6_finalize_raw() is already going to do that calculation.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2018-06-11 17:21:12 -04:00
Armando Visconti
87bd2c25bf drivers: sensor: lis2dh: Fix I2C burst read/write operations
As stated in LIS2DH datasheet in section "5.1.1 I2C Operation",
in order to read/write multiple bytes on I2C it is necessary
to add the autoincrement bit to the subaddress field.

Signed-off-by: Armando Visconti <armando.visconti@st.com>
2018-06-11 17:20:21 -04:00
Evgeny Kalugin
e16037d87a drivers: sensor: lis2dh: Fix of compilation issue
The lis2dh_burst_write used "bus" as an input parameters, while
inside "dev" was referred. Now variable names are aligned.

Signed-off-by: Evgeny Kalugin <evgeny.kalugin@intel.com>
2018-06-11 17:20:21 -04:00
Johan Hedberg
7d9896575b Bluetooth: Add HCI User Channel driver for native POSIX port
Introduce a custom HCI driver for the native POSIX port, which opens a
HCI User Channel socket to the Linux kernel to gain access to a local
Bluetooth controller.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2018-06-11 17:14:43 -04:00
Andy Ross
b173e4353f kernel/queue: Fix spurious NULL exit condition when using timeouts
The queue loop when CONFIG_POLL is in used has an inherent race
between the return of k_poll() and the inspection of the list where no
lock can be held.  Other contending readers of the same queue can
sneak in and steal the item out of the list before the current thread
gets to the sys_sflist_get() call, and the current loop will (if it
has a timeout) spuriously return NULL before the timeout expires.

It's not even a hard race to exercise.  Consider three threads at
different priorities: High (which can be an ISR too), Mid, and Low:

1. Mid and Low both enter k_queue_get() and sleep inside k_poll() on
   an empty queue.

2. High comes along and calls k_queue_insert().  The queue code then
   wakes up Mid, and reschedules, but because High is still running Mid
   doesn't get to run yet.

3. High inserts a SECOND item.  The queue then unpends the next thread
   in the list (Low), and readies it to run.  But as before, it won't
   be scheduled yet.

4. Now High sleeps (or if it's an interrupt, exits), and Mid gets to
   run.  It dequeues and returns the item it was delivered normally.

5. But Mid is still running!  So it re-enters the loop it's sitting in
   and calls k_queue_get() again, which sees and returns the second
   item in the queue synchronously.  Then it calls it a third time and
   goes to sleep because the queue is empty.

6. Finally, Low wakes up to find an empty queue, and returns NULL
   despite the fact that the timeout hadn't expired.

The fix is simple enough: check the timeout expiration inside the loop
so we don't return early.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2018-06-11 17:11:51 -04:00
Anas Nashif
10d8e711be samples: move grove samples to sensors and display
No need to have a category for grove, instead moved the samples to both
sensors and display based on what the sample does.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-06-11 17:11:18 -04:00
Anas Nashif
f37287bbca samples: cleanup sample test naming
Cleanup test names and make them suitable for import into test
management system.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-06-11 17:11:18 -04:00
Anas Nashif
3f8352f2e6 samples: remove sample.tc
This is not used by Zephyr directly and comes from a test framework. We
do matching in the sample.yaml file now.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-06-11 17:11:18 -04:00
Anas Nashif
57f6790335 samples: can: move CAN sample under drivers
Move CAN driver sample under samples/drivers and add a sample.yaml.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-06-11 17:11:18 -04:00
Anas Nashif
9b2880fe6e tests: posix: fix meta-data and rename test file
Be consistent with other posix tests, and name main file main.c.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-06-11 17:11:18 -04:00
Anas Nashif
fb3aeddebb boards: lpcxpresso54114_m0: do not set as default
We already have the BBC microbit for Cortex-M0 coverage.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-06-11 17:11:18 -04:00
Sebastian Bøe
d94231f66e cmake: libc: minimal: Move sources from 'app' to a new CMake library
The minimal libc source files have been added to 'app'. The Zephyr
build system should not be adding source files to the 'app' library
unless necessary.

This patch creates a new Zephyr CMake Library in lib/libc/minimal and
adds the sources to it.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2018-06-11 17:11:00 -04:00
David B. Kinder
5890004ea7 release: 1.12 doc cleanup
Fix typo in 1.12 release notes, remove old doc version links (before
1.9)

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-06-11 15:16:19 -04:00
Luiz Augusto von Dentz
68de9d5d66 Bluetooth: Use Characteristic attribute whenever possible
With updates to bt_gatt_notify and bt_gatt_indicate it is now possible
to pass the Characteristic attribute instead of its value which makes
the code able to verify if attribute properties are set correctly.

Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2018-06-11 14:41:19 -04:00