Zephyr kernel is unable to compile when CONFIG_RUNTIME_NMI is enabled in
defconfig on ARM's architectures.
This patch addresses the following issues:
* In nmi.c _DefaultHandler() is referencing a function
(_ScbSystemReset()) not defined in Zephyr. This has now been replaced
with sys_arch_reboot.
* nmi.h is included in ASM files and due to the usage of "extern" the
compilation ends with an error. Added the directive _ASMLANGUAGE to
prevent the problem.
Jira: ZEP-1319
Change-Id: I7623ca97523cde04e4c6db40dc332d93ca801928
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
Rewrites the timestamping logic to always generate timestamps
via a function pointer that is initialized to sys_cycle_get_32(),
but can be changed to point to a user-supplied function. This
eliminates the need for an if/then/else construct in every place
that a timestamp is generated.
Change-Id: Id11f8c41b193a93cece16565978a525056010f0e
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Prepares the kernel event logger APIs for inclusion in the
API guide. Also corrects a couple of other issues:
* Gets rid of obsolete thread monitor code.
* Renames "timer_func" global variable to "_sys_k_timer_func"
to align it with kernel naming conventions.
Change-Id: I93d403f83ae44ff45dda489c2ead7bfec6ce1fa3
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Prio should be an int, since values are small integers, not a fixed-size
int32_t. It aligns with the prio parameters of the other APIs.
Stack size should be size_t.
Change-Id: Id29751b86c4ad7a7c2a7ffe446c2a96ae83c77bf
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
This fixes defect found by coverity: 152027 Pointer to local outside
scope.
Change-Id: I50f196a04363ffa6e6654b71a9a1d89034580413
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Implement the 3 missing HCI commands required to support
Data Length Extensions:
- LE Read Suggested Default Data Length
- LE Write Suggested Default Data Length
- LE Read Maximum Data Length
Note: Only octets are actually used at this time, not time.
Jira: ZEP-1246
Change-Id: Id76d8fedb5ecaf0001c8429cf22f9a3e2c910a44
Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
Also fixes up Kernel Primer examples to use these macros.
Change-Id: Ib1bc9e3f85ab75f81986bc3930fb287266a886b5
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Return value descriptions using the "@retval" tag now reflect
the fact that they appear on a separate line from the value
they are describing.
Change-Id: I3e3e347d133ad998e7db50a99369d41cbfb9efcc
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
The API guide now does a better job of explaining how to use
a workqueue. Also hides information about workqueue internals
and fixes several errors and omissions.
Change-Id: I6492c1c6105c258ce98365ca33059d8f32c1be41
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
The API guide now does a better job of explaining how to correctly
write these functions.
Change-Id: Ib1df55eb28fa408f3f786f122353e37505002f07
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
There was no check to see if the head of a list was empty before trying
to fetch the next node in the list. The fix is added to
sys_dlist_peek_next() so that it also return NULL if the node parameter
is NULL, in addition to being the tail of the list.
Since the value is not used until the second iteration of the loop, and
there will be no second iteration if the list is empty, as long as the
CPU does allow reading at address 0, this was not causing any issues.
Our ARC targets did not seem to like that.
Fixes ZEP-1263 and ZEP-1297.
Change-Id: I07ca16592d206d13662226d1249f487ee78c06aa
Signed-off-by: Benjamin Walsh <walsh.benj@gmail.com>
The uart_poll_in() Doxygen comment has a typo ("if empty" should be "is
empty"). Fix it up and make it more clear.
Change-Id: I222051dedc6036e70ce94e8046084d763628ff13
Signed-off-by: Marti Bolivar <marti.f.bolivar@gmail.com>
Most kernel APIs are now ready for inclusion in the API guide.
The APIs largely follow a standard template to provide users
of the API guide with a consistent look-and-feel.
Change-Id: Ib682c31f912e19f5f6d8545d74c5f675b1741058
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Move away from legacy APIs and use unified kenrel instead.
Change-Id: Icae86beec66df1b041405cbe3455913630fc8ad1
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
These should help to make it easier to understand code passing
specific durations to the kernel APIs.
Change-Id: I8682fafc291e8af56fd0289d0cab8c736b88da59
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
There was a lot of duplication between architectures for the definition
of threads and the "nanokernel" guts. These have been consolidated.
Now, a common file kernel/unified/include/kernel_structs.h holds the
common definitions. Architectures provide two files to complement it:
kernel_arch_data.h and kernel_arch_func.h. The first one contains at
least the struct _thread_arch and struct _kernel_arch data structures,
as well as the struct _callee_saved and struct _caller_saved register
layouts. The second file contains anything that needs what is provided
by the common stuff in kernel_structs.h. Those two files are only meant
to be included in kernel_structs.h in very specific locations.
The thread data structure has been separated into three major parts:
common struct _thread_base and struct k_thread, and arch-specific struct
_thread_arch. The first and third ones are included in the second.
The struct s_NANO data structure has been split into two: common struct
_kernel and arch-specific struct _kernel_arch. The latter is included in
the former.
Offsets files have also changed: nano_offsets.h has been renamed
kernel_offsets.h and is still included by the arch-specific offsets.c.
Also, since the thread and kernel data structures are now made of
sub-structures, offsets have to be added to make up the full offset.
Some of these additions have been consolidated in shorter symbols,
available from kernel/unified/include/offsets_short.h, which includes an
arch-specific offsets_arch_short.h. Most of the code include
offsets_short.h now instead of offsets.h.
Change-Id: I084645cb7e6db8db69aeaaf162963fe157045d5a
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
Use k_current_get() instead of the deprecated sys_thread_self_get()
API.
Change-Id: I4ddb45f299373237690b2f4ca614e7fd3b6c0c36
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Addresses a range of issues affecting the Kernel Primer or
the API Guide generated from doxygen tags.
* Ensures mailbox examples use kernel APIs correctly.
(Fix for ZEP-1262, as well as other errors).
* Ensures memory alignment limitations for memory slabs
are correctly described. (Fix for ZEP-1265.)
* Ensures memory alignment limitations for memory pools
are more clearly described. Also fixes a typo in a
memory pool example.
* Ensures memory alignment limitations for message
queues are more clearly described.
* Fixes references to a number of kernel configuration
options that were omitted or incorrectly formatted.
* Fixes a typo in an example of thread spawning.
Change-Id: I395186f333490b1e0c4223b87c0fe7136548770f
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
The API to disable _sys_soc_resume notification is currently
called _sys_soc_disable_wake_event_notification. This is
misleading because it is possible that the ISR from which
_sys_soc_resume is called could be from a different interrupt
with higher priority that happened before interrupts were
enabled. More accurately, it is a notification of exit from
kernel idling after pm operations.
Jira: ZEP-1271
Change-Id: I83747f2cacac1bc17f135d12f4aa4478970fc02d
Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
_sys_soc_resume hook is over loaded to handle to different
scenarios. It is primarily called to notify exit of kernel idling
after PM operations. It is also used to notify exit from deep sleep.
This is very confusing and also makes the implementation of the
hook function very difficult because of very different conditions
involved in the 2 different use cases. Further, users may not require
either or both use cases depending of their custom boot flow and
power state handling. To simplify, create a separate hook for the
purpose of deep sleep exit notification. Use the existing one to
only notify kernel idling exit after PM operations.
Jira: ZEP-1256
Change-Id: I96350199a0fd37f16590c8ee5302a94a3d71b8ba
Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
This fixes the warnings related to the use of deprecated APIs
converting them to use the unified version.
Change-Id: I76d076de27ecdae4af46abf4baac68e2cc1313c0
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Only net_receive() is using non-special value for net_buf_get_timeout
so this change is included here. Other users are using special values
which are already correctly handling ticks vs ms change.
Change-Id: Ib12d34ac5a546b36fa7b35615f082c82a256bd07
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
This fixes warnings related to the use of nano_work and
nano_delayed_work in L2CAP layer.
Note that k_delayed_work takes a timeout in miliseconds rather than in
ticks thus the timeouts values changes.
Change-Id: I1e3bd7857248865e34a313dd42862af5f4e3805b
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This patch introduces the Connect API which initiates session
connection first. If session is already there with the peer
then it has to reuse it and initiate DLC (which will be done
in the subsequent patch) since there can be only one session
per device.
< ACL Data TX: Handle 256 flags 0x00 dlen 8
Channel: 64 len 4 [PSM 3 mode 0] {chan 0}
RFCOMM: Set Async Balance Mode (SABM) (0x2f)
Address: 0x03 cr 1 dlci 0x00
Control: 0x3f poll/final 1
Length: 0
FCS: 0x1c
> ACL Data RX: Handle 256 flags 0x02 dlen 8
Channel: 64 len 4 [PSM 3 mode 0] {chan 0}
RFCOMM: Unnumbered Ack (UA) (0x63)
Address: 0x03 cr 1 dlci 0x00
Control: 0x73 poll/final 1
Length: 0
FCS: 0xd7
Change-Id: I9828e0f3b3ea43bb17df95f0536e15df86f1b4be
Signed-off-by: Jaganath Kanakkassery <jaganathx.kanakkassery@intel.com>
Add Low Power States support to the power shim layer
and show the usage in the quark_se sample.
States are defined as follow:
- SYS_POWER_STATE_CPU_LPS: SS2 with LPSS enabled
- SYS_POWER_STATE_CPU_LPS_1: SS2 with LPSS disabled
- SYS_POWER_STATE_CPU_LPS_2: SS1 with LPSS disabled
Jira: ZEP-994
Change-Id: Ie4b93f6e539cb53fc035be00280b66b2cb0d9fea
Signed-off-by: Julien Delayen <julien.delayen@intel.com>
There was no check to see if the current context was running an ISR when
taking a decision whether to do a context switch or not.
Change-Id: Ib9c426de8c0893b3d9383290bb59f6e0e41e9f52
Signed-off-by: Benjamin Walsh <walsh.benj@gmail.com>
Useful for finding out if the current thread is protected against
preemption when using non-preemption to protect data structures.
Change-Id: Ib545a3609af3646ba49eeeb5a2c50dc51af010d4
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
Oversight. These functions are used extensively in the kernel guts, but
are also supposed to be an API.
k_sched_lock used to be implemented as a static inline. However, until
the header files are cleaned-up, and everything, including applications
get access to the kernel internal data structures, it must be
implemented as a function. To reduce the cost to the internals of the
kernel, the new internal _sched_lock() contains the same implemetation,
but is inlined.
Change-Id: If2f61d7714f87d81ddbeed69fedd111b8ce01376
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
The header uses struct device * plus stdint types.
Change-Id: Id4b817682afa4cc229f98a289adf6646d26d18bc
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Does a general cleanup including:
* adding descriptions for APIs that are missing them
* adding information that would be helpful to users
and removing information that wouldn't be helpful
* correcting errors
* aligning the terminology with the terminology used
in the Kernel Primer document
* standardizing the way information is presented
Change-Id: I536644a7dc60b62100e379a199a645344430beb7
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Updates x86 floating point support to reflect changes that have
been made in recent months.
* Many, many, many cosmetic changes (mostly revisions to comments).
* Elimination of unnecessary function aliases that were needed
to support the task and fiber versions of certain APIs.
* Elimination of run-time code to enable a thread's "FP regs"
option bit if the "SSE regs" option bit was set. The kernel
now recognizes that the thread is using the FPU as long as
either option bit is set. (If the thread has both option bits
enabled this is the same as if only the "SSE regs" bit is set.)
Change-Id: Ic12abc54b6fa78921749b546d8debf23e7ad232d
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Many APIs needed to be converted into inline functions first.
Now all APIs here are deprecated, or #defined to something that is
deprecated.
Change-Id: Ibad55adec113eb8913ebe07134a2e4935616bc1d
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
PRIMARY, SECONDARY, NANOKERNEL, MICROKERNEL init levels are now
deprecated.
New init levels introduced: PRE_KERNEL_1, PRE_KERNEL_2, POST_KERNEL
to replace them.
Most existing code has instances of PRIMARY replaced with PRE_KERNEL_1,
SECONDARY with POST_KERNEL as SECONDARY has had a longstanding bug
where the documentation specified SECONDARY ran before the kernel started
up, but actually ran afterwards.
Change-Id: I771bc634e9caf7f17dbf214a270bc9967eed7d32
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
'private' is a C++ reserved word and will lead to compilation errors:
C++ ble.o
In file included from ble.cpp:7:0:
include/bluetooth/bluetooth.h:284:10: error: expected unqualified-id before 'private'
uint8_t private[4];
Change-Id: I36aef5a84af4fc66e1c810bd0c56e5ab5f803294
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
USB class drivers may need to offload some work from
upcall interrupt context to a background fiber. This
requires some way to defer taking more data from host
till the offloaded work completes. Two APIs are added to
achieve this.
Further USB class drivers sometimes need to set STALL condition
on end-points to signal errors to host.These too are
added.
Change-Id: Ic973522c3394e23d7f9c4c67affc0cd050afc20f
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
This patch removes "FAT" from files names, config names and
symbol names so as to avoid confusion, when other modules use
them in a more generic way.
Also flash_disk_access.c and ram_disk_access.c now exports generic
disk_access symbols as defined in include/disk_access.h rather
than FAT specific ones in fs/fat_diskio.h. Thus modules like
USB which need to use disk_access interface is not dependent
on symbols from ELMChan FAT module. Also fat_diskio.h
is removed.
Further the shim between ELM chan and Zephyr is modified as
per these changes.
Change-Id: Ifd80f14a629e467ee9c7a9aaff8a4896eed11982
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
Adds a disk interface which is independent
of filesystem specific symbols or headers.
Change-Id: I8c72fd3a9d12c5d9623721513fc66edc7bce0a5d
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>