Commit graph

19237 commits

Author SHA1 Message Date
Benjamin Walsh
7f577b2d5c arm: better handling of IRQ priorities reserved by the kernel
There are now three flags that decide how many priorities are reserved
by the kernel, each one requiring one priority level: Zero Latency
Interrupts, BASEPRI locking (for SVC usage) and faults that are not at
priority -1, so that taking them in an ISR actually triggers the fault
synchronously.

Change-Id: I7f4d760c9110051aeb82dcfd8cd68026a9b74b54
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-12-15 15:57:10 +00:00
Benjamin Walsh
c016252108 arm: add CPU_CORTEX_M_HAS_PROGRAMMABLE_FAULT_PRIOS kconfig flag
Cortex-M0/M0+ do not have other faults than the hard fault at priority
-1, so they do not need to reserve a priority to allow exceptions to
trigger during handling of ISRs.

Change-Id: I479e439f7bcac70b4b2b787bcd744a4c65437e80
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-12-15 15:57:09 +00:00
Benjamin Walsh
f5d0cbe8ad arm: move IRQ_PRIORITY_OFFSET to header file, rename to _IRQ_PRIO_OFFSET
This allows using it in _EXC_PRIO() instead of hardcoding 2 and 3.

Change-Id: I3549be54602643e06823ba63beb6a6992f39f776
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-12-15 15:57:08 +00:00
Benjamin Walsh
194a2e3a12 arm: add CPU_CORTEX_M_HAS_BASEPRI kconfig flag
Use it to flag which CPUs can do zero latency interrupts, which depend
on being able to lock up to a specific interrupt priority.

Change-Id: I09f71366ea1d05486e38c513a09abc270884879f
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
2016-12-15 15:57:07 +00:00
Anas Nashif
6ce672d753 net: remove unused variable pkt1
Change-Id: I987765a6020b7d5b5ff8fd1213dfc4b9a13cdf7f
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-15 14:33:02 +00:00
Anas Nashif
42738fdff4 net: multicast_eth_addr is use only with IPV6
Change-Id: Ia204a327ec7a85d1b0b0bf79778b4ebee8f294a6
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-15 14:32:57 +00:00
Anas Nashif
200c4031dd net: remove unused variable dis
Change-Id: Iec80bd13532b17d36fbe1b3d07f31b8f481859d9
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-15 14:32:52 +00:00
Tomasz Bursztyka
ca4ac62611 net: tests: Remove unused variables from dhcpv4 unit test
Fixes this:
error: ‘zero_addr’ defined but not used [-Werror=unused-const-variable=]
...

Change-Id: I5b0baf597e62f3206e15638a63e129503b76b048
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-15 14:34:16 +01:00
Tomasz Bursztyka
33479ec739 drivers: spi: Fix the help on sys log level
Change-Id: Ifdd63dc2930e43240b6aa3afc0fced92ba4d74cb
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-15 14:33:21 +01:00
Johan Hedberg
9609751909 net: buf: Fix incorrect reference to net_buf_get_debug
This is a left-over that should have been renamed to the new
net_buf_alloc_debug function name.

Change-Id: Iefcbd2eefab5614b1b80214cb0927f3db77d592e
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-12-15 12:49:57 +00:00
Julien Delayen
176d184fb8 power: Add ARC core suspend and resume support
When going into DEEP_SLEEP mode, the ARC core now saves
its context. This includes:
- All core registers
- Stack pointer
- Program counter (restored by jumping to the restore code)

The arc reset code now checks if the GPS0 bit 2 is set.
This is similar to the behavior of the x86 core done by
the QMSI bootloader which is setting GPS0 bit 1 in order
to call the restore path instead of cold boot path.

The sample has been adapted in order to support the ARC.

Jira: ZEP-1222

Change-Id: I375f03b16b8a5fd1f07ead55cf7e4947d6290c9f
Signed-off-by: Julien Delayen <julien.delayen@intel.com>
2016-12-15 12:49:33 +00:00
Julien Delayen
d127864366 arcv2_timer0: Add suspend and resume support
When going into DEEP_SLEEP state, the ARC timer
needs to be restored.

This implements the function to restore the timer
after sleep.
As the time spent during sleep is not currently known,
the timer is expired to reschedule the application task.

Jira: ZEP-1224

Change-Id: I22a30d0fd79f177cf166b9a29dc78d68f7d7fbad
Signed-off-by: Julien Delayen <julien.delayen@intel.com>
2016-12-15 12:49:32 +00:00
Julien Delayen
cd8504cc9c arcv2_irq: Add power management suspend/resume
In order to resume the ARC from deep sleep,
the interrupts need to be restored.

The FIRQ stack needs to be saved and restored
when performing sleep operations.

During early initialization, the sp in the 2nd register bank
is made to refer to _firq_stack.
This allows for the FIRQ handler to use its own stack.
Fast Interrupts cannot be used after sleep if this information
is not restored.

This patch adds the suspend and resume functions.

Jira: ZEP-1223

Change-Id: Ic81980f05aee6c1f7b8c46c743f2648c65b29486
Signed-off-by: Julien Delayen <julien.delayen@intel.com>
2016-12-15 12:49:31 +00:00
Julien Delayen
2008af30e7 arc: Define _arc_v2_irq_unit device
Move interrupt initialization for the ARC to its own
device. The init function for the arc will be only
doing platform specific operations

Jira: ZEP-1288

Change-Id: Icb04c3622890021c65cd24cecf6cafee6c37caf9
Signed-off-by: Julien Delayen <julien.delayen@intel.com>
2016-12-15 12:49:30 +00:00
Tomasz Bursztyka
353cd721a9 net: Fix incorrect logging format specifiers
Following commit fc21a76db6
Some more fixes are needed.

Change-Id: I19c2c979d44be5edfd76041d3cf4507860795c78
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-15 12:29:03 +00:00
Johan Hedberg
692771fbe9 net: buf: Switch from k_fifo to k_lifo for free buffers
Using a LIFO instead of a FIFO has the potential benefit that more
recently in-use buffers may be "cache-hot" and therefore accessed
faster than least recently used (which is what we get with a FIFO).

Change-Id: I59bb083ca2e00d0d404406540f7db216742a27cf
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-12-15 12:06:22 +02:00
Johan Hedberg
d659bb020e net: buf: Remove redundant user_data_size from buffers
Since the user data size is now stored in the pool there's very little
value in storing it as well per-buffer.

Change-Id: I17a99123b232423c52a2179b4eccd813728d51b1
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-12-15 09:58:17 +02:00
Johan Hedberg
71c7c01819 net: buf: Remove the need for net_buf_pool_init()
In order to keep the initialization process light-weight, remove
net_buf_pool_init() and instead perform the initialization of the pool
and buffers in a "lazy" manner. This means storing more information
in the pool, and removing any 'const' members from net_buf. Since
there are no more const members in net_buf the buffer array can be
declared with __noinit, which further reduces initialization overhead.

Change-Id: Ia126af101c2727c130651b697dcba99d159a1c76
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-12-15 09:58:02 +02:00
Johan Hedberg
45bc46d42e net: buf: Introduce net_buf_destroy() wrapper
This is only for use with custom destroy callbacks, so that the
application gets isolated away from the details of how exactly the
buffers are managed. This opens up the possibility of switching away
from k_fifo to potentially better solutions, such as k_lifo.

Change-Id: I0d8322fdec3500d8ae060ae471b9448aeaa4572a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-12-15 08:45:05 +02:00
Tomasz Bursztyka
c8f8527d55 net: ieee802154: ACK reply needs to set all FCF attributes.
That bug never got caught because the buffer in unit test is always
clean and fully initialized to 0, and that part of the code being
tested is never used in real as the ACK reply is directly made by the
chip.

Change-Id: I88c4dd3767b4addf2250165b94f49fae29d322ea
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-12-15 08:45:05 +02:00
Stig Bjørlykke
4ca8ca9b1c iot/mqtt: Fix rlen_decode size check.
If receiving a malformed MQTT packet with less than 5 bytes it's
possible to get a read one byte behind buf.

Change-Id: I34425add57c937c8fd9df5bf7b72af092d6f5f32
Signed-off-by: Stig Bjørlykke <stig@bjorlykke.org>
2016-12-14 22:09:19 +01:00
Genaro Saucedo Tejada
1589f2ccdd sanity: filter the build-all test for ethernet
Ethernet build-all test was not being filtered base on RAM size so
build step LINK was failing with "region `RAM' overflowed by 192
bytes" error when running daily sanitycheck.

Added filter so this test is not attempted for boards with smaller
RAM such as quark_d2000_crb, which was causing daily build failure

Change-Id: I4ed3bef4f1c78e83890331db34fb1f2b2b066414
Signed-off-by: Genaro Saucedo Tejada <genaro.saucedo.tejada@intel.com>
2016-12-14 17:25:10 +00:00
Anas Nashif
af978586d1 Revert "samples/logger-hook: Initialize variable to 0"
This reverts commit 7a74fb0454.

This commit breaks the sample. The sample code has a bug which will be
addressed in a separate patch.

Change-Id: Ic44faeafced4415765fded04e2493e306fc35331
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-14 10:28:51 -05:00
Anas Nashif
418058a123 kernel: remove NANOKERNEL and MICROKERNEL configs
Those are legacy and not needed anymore.

Change-Id: I8113114fd60880b3f538612db7702f6129af0a06
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-14 13:45:52 +00:00
Marcus Shawcroft
b42587e9cd net: Switch net dependency to CONFIG_RANDOM_GENERATOR
The CONFIG_TEST_RANDOM_GENERATOR parameter is not intended for
production use.  Switch to CONFIG_RANDOM_GENERATOR.

Change-Id: Id6ce986259270455223ce6a42d19a3d9c9b1e642
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-12-13 22:50:19 +00:00
Marcus Shawcroft
954baea90b random: Restructure RANDOM Kconfig
Restructure the RANDOM Kconfig to match the structure used in other
drivers with a single top level menu.  Move the true random number
generators to appear first in the menu, with pseudo generators at the
bottom.  Do not present pseudo generators if a true random generator
is presented.

This change implies that tests, samples and applications that require
the random driver interface must now select CONFIG_RANDOM_GENERATOR.

In order for tests and samples to build (and run) on platforms that
have no random driver it remains necessary to select
the CONFIG_TEST_RANDOM_GENERATOR.

Note that CONFIG_TEST_RANDOM_GENERATOR retains its original purpose of
enabling a random driver that delivers non random numbers for the
purpose of testing only.

Change-Id: I2e28e44b4adf800e64a885aefe36a52da8aa455a
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-12-13 22:50:18 +00:00
Marcus Shawcroft
fe8d044d9a tests: Remove unnecessary CONFIG_TEST_RANDOM_GENERATOR
Remove CONFIG_TEST_RANDOM_GENERATOR from each test and sample where it
is not required.

Change-Id: I949f8e93c2cb1881622a5e48efeb87c43122a170
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-12-13 22:50:18 +00:00
Bogdan Davidoaia
de4727ba3f sensor: update drivers to not return double values
Update drivers to return INT_PLUS_MICRO values instead of doubles.

This hides the fact that the drivers use floating point operations and
doesn't force the application to use them as well.

Change-Id: I14c6faecb35331c2fdbdab41bc624d751de984b8
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-12-13 21:51:11 +00:00
Bogdan Davidoaia
708fe8c1e3 sensor: use integers for simple value calculations
Use integers for sensor value calculations in which doubles are not
required.

Change-Id: I8662023ca596cb232e31849b0b77ae2bf0372cf0
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-12-13 21:51:10 +00:00
Bogdan Davidoaia
4946e3e6e6 sensor: remove SENSOR_VALUE_TYPE_INT
Remove SENSOR_VALUE_TYPE_INT as it is the same as
SENSOR_VALUE_TYPE_INT_PLUS_MICRO with val2 set to 0.

Change-Id: If5a9c579b7267701c27f40fd887acae47d64edc5
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-12-13 21:51:10 +00:00
Bogdan Davidoaia
b584acb0a4 sensor: remove unused Q16_16 value type
Remove SENSOR_VALUE_TYPE_Q16_16 as it is not used by any driver. Future
drivers can use any of the remaining value types.

Change-Id: I984143cc65d6a6fd0477f310ac17c62498cc05b8
Signed-off-by: Bogdan Davidoaia <bogdan.m.davidoaia@intel.com>
2016-12-13 21:51:09 +00:00
Johan Hedberg
c3e08c8fea net: buf: Redesigned pool & buffer allocation API
Until now it has been necessary to separately define a k_fifo and
an array of buffers when creating net_buf pools. This has been a bit
of an inconvenience as well as blurred the line of what exactly
constitutes the "pool".

This patch removes the NET_BUF_POOL() macro and replaces it with a
NET_BUF_POOL_DEFINE() macro that internally expands into the buffer
array and new net_buf_pool struct with a given name:

	NET_BUF_POOL_DEFINE(pool_name, ...);

Having a dedicated context struct for the pool has the added benefit
that we can start moving there net_buf members that have the same
value for all buffers from the same pool. The first such member that
gets moved is the destroy callback, thus shrinking net_buf by four
bytes. Another potential candidate is the user_data_size, however
right not that's left out since it would just leave 2 bytes of padding
in net_buf (i.e. not influence its size). Another common value is
buf->size, however that one is also used by net_buf_simple and can
therefore not be moved.

This patch also splits getting buffers from a FIFO and allocating a
new buffer from a pool into two separate APIs: net_buf_get and
net_buf_alloc, thus simplifying the APIs and their usage. There is no
separate 'reserve_head' parameter anymore when allocating, rather the
user is expected to call net_buf_reserve() afterwards if something
else than 0 headroom is desired.

Change-Id: Id91b1e5c2be2deb1274dde47f5edebfe29af383a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-12-13 21:41:53 +00:00
Sergio Rodriguez
1e2e05c784 drivers: sensor: fxos8700: Fix uninitialized variable
This issue was reported by Coverity

Coverity-CID: 157621

Change-Id: I7f84c0868467ab55e033aecac037967da001a6db
Signed-off-by: Sergio Rodriguez <sergio.sf.rodriguez@intel.com>
2016-12-13 11:36:27 +00:00
Julien Delayen
60f5d4ef05 arc: Add cc to clobber list for sleep instruction
As flags are modified when entering sleep, add cc to
clobber list.

Jira: ZEP-1408

Change-Id: Ia80bc1c7ddedb9d9963c47108372a90928597c1d
Signed-off-by: Julien Delayen <julien.delayen@intel.com>
2016-12-12 22:06:29 +00:00
Szymon Janc
87a7fe8399 kernel: legacy: Fix int overflow in nano_stack_init
Last argument for k_stack_init is of time int resulting in UINT_MAX
being converted to negative value. Instead of UINT_MAX use maximum
possible number of entires that won't result in stack->base and
stack->top overflow.

Change-Id: I8470f6dd18abcccc72590e07e0d0efd4ce2208cc
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-12-12 22:03:54 +00:00
Anas Nashif
0859df1eca kernel: disable MDEF by default
Disable MDEF option and set it only in legacy projects.

Change-Id: I2e1f011eb1f876af929140e36f71f0efb5e955c1
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-12 20:25:07 +00:00
Anas Nashif
095112516a scripts: remove old qemu patch
This patch does not apply anymore. A patched qemu already exists in the
SDK.

Change-Id: Iee18550a7b9288a1db2a6ecc4378ff554b240229
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-12 20:25:06 +00:00
Carles Cufi
680270f809 toolchain: Add a popcount macro for GCC
Hamming Weight or "popcount" consists in counting the number of bits set
to 1 in a particular word. This commit adds a macro to be able to use
the existing builtin for this purpose with the GCC compiler.

Change-Id: Iec64c19e897de2bc02e981071465bbe230ee9add
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2016-12-12 20:07:53 +00:00
Flavio Santes
b80db0a41b kernel: Add ARG_UNUSED macro to avoid compiler warnings
The ARG_UNUSED macro is added to avoid compiler warnings.

Change-Id: Ie9b72c94191318c1d667d7929eb029098c62e993
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-12-12 20:02:31 +00:00
Flavio Santes
59c8f32f0f x86/soc: Add ARG_UNUSED macro to avoid compiler warnings
The ARG_UNUSED macro is added to avoid compiler warnings.

Change-Id: If0242548849ee5b258bb3fce9fd727b377411343
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-12-12 20:02:30 +00:00
Flavio Santes
935c447ae0 shell: Add ARG_UNUSED macro to avoid compiler warnings
The ARG_UNUSED macro is added to avoid compiler warnings.

Change-Id: If14c3928a30c8f3156cdcd0fe11e22407a78c088
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-12-12 20:02:30 +00:00
Flavio Santes
5349af8702 kernel/mem_slab: Use the right data-type
Use uint32_t for counters instead of int to avoid compiler warnings.

Change-Id: Ie96dfaca650b5f91562c0740c18610fc40968be6
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-12-12 20:01:31 +00:00
Flavio Santes
380ee05a58 kernel/mem_pool: Use the right data-type
mem_pool structures use uint32_t for counters and size_t
to specify sizes, however some routines in mem_pool.c
make use of int for similar purposes. This commit fixes
that situation by updating some variables to match
mem_pool data types.

Change-Id: I0aa01c27e512d06d40432e8091ed8fd9d959970c
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-12-12 20:01:31 +00:00
Johan Hedberg
c8201b2c2c kernel: Introduce new k_delayed_work_remaining_get API
Applications may want to know how much time is left until a delayed
work gets scheduled. To prevent applications from having to track this
themselves simply use the information that's already embedded as part
of the timer that's part of the delayed work struct.

Change-Id: I189df2f3be8b207e68b554a0cbb4f97f1a99de22
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-12-12 18:55:40 +00:00
Johan Hedberg
f99ad3f0e2 kernel: Refactor remaining time evaluation for timeouts
Factor out the code for evaluating the remaining time for _timeout
structs so that it can also be used for other objects besides k_timer
structs (like k_delayed_work, coming in a subsequent patch).

Change-Id: I243a7b29fb2831f06e95086a31f0d3a6c37dad67
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-12-12 18:55:40 +00:00
Flavio Santes
142c0024de MAINTAINERS: Update network applications section
Remove legacy mqtt applications and add dns, http and mqtt lib dirs.

Change-Id: Iaddc4ba1fdc04de1f889c58cda8ed4d5ebdb50f5
Signed-off-by: Flavio Santes <flavio.santes@intel.com>
2016-12-11 19:09:25 -06:00
Anas Nashif
79631ad457 device: do not set struct as deprecated
Change-Id: I6cbec81e02dc706ba86f27aab76740031f89dbd1
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-12-11 06:36:14 -05:00
Baohong Liu
3b831465a4 samples: spi_fram: correct syntax error and update comments
Correct some syntax error and update some comments. There is
no functionality change.

Change-Id: I86c922c8aabcc4464b86f33ad7edf6056b1d765c
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-12-11 11:26:57 +00:00
Baohong Liu
683cb88777 drivers: adc: replace device sync APIs with semaphores
Device sync APIs are actually wrappers for semaphores.
Let's replace them with semaphores.

Jira: ZEP-1411

Change-Id: Ic37972a631f0bfd7bc45f28088e1c423151b1612
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-12-11 11:26:06 +00:00
Baohong Liu
130ac06a02 drivers: spi: replace device sync APIs with semaphores
Device sync APIs are actually wrappers for semaphores.
Let's replace them with semaphores.

Jira: ZEP-1411

Change-Id: I02c7cba21d21ff9288e452121e3b7ebb7d251bb4
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-12-11 11:25:42 +00:00