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>
C++ support moved from nanokernel.h to kernel.h.
Change-Id: I5e1631941e26f4ab3f311b680267b743bab15e40
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
PM control function is used only by the PM subsystem. Update
documentations to make it clear and name the relevant structures and
functions with _pm_ in the name.
Jira: ZEP-1044
Change-Id: I29e5b7690db34a228ed30a24a2e912e1360a0090
Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
Finally, after numerous, preparation patches... Make a device drivers
config_info structure 'const'.
Change-Id: Idc4682705da18a18b694d3fb21ba6006f96ac87b
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
Currently passing a constant string (other than a string
literal) to device_get_binding() generates a spurious warning.
The warning is spurious because device_get_binding() does not,
nor is it ever likely to, modify its argument. To fix the
warning we modify the prototype to make clear name will never
be modified.
Change-Id: I2df22de61eb2580b2086a685549900d7ed4a322d
Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
Avoids a build error if two or more system devices are declared
in the same C file that use the same init function.
Use _CONCAT() for token concatenation to ensure the names are
properly generated, needed if any of the components are themselves
macros that need to be expanded.
Change-Id: I559bd987617d8cf3bd8c9ee0c985d670b4f59a64
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
Mark old device power management API functions as deprecated:
1. device_suspend(struct device *device,int pm_policy)
2. device_resume(struct device *device, int pm_policy)
In addition added deprecated comments for the macro related
to the old API
Jira: ZEP-954
Change-Id: Ibfeeb88f4e6644409296b5f4e2ed02a149d911a2
Signed-off-by: Amir Kaplan <amir.kaplan@intel.com>
Have one function that can be used for all possible device
purposes using a control code instead of the suspend
resume functions, makes it generic for device control.
Added device power states.
The older replaced APIs will be deprecated in a future patch
Jira: ZEP-954
Change-Id: I6dd3ebfd0fde3546b2d8397f19842f5758fda0c4
Signed-off-by: Amir Kaplan <amir.kaplan@intel.com>
This allows current code to build but using the definitions from
kernel.h instead of the original headers.
Change-Id: I8f51a83bab4448cd63aa6c54b8e357a8ad6cc1e2
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
DEFINE_DEVICE_PM macro was not defining device_pm_ops
as 'static'. Fixes the issue and impacted areas.
Jira: ZEP-639
Change-Id: I5e1de6af97bf7b2b690af0c81034ce167e655e43
Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
Enhances the DEVICE_INIT_PM and SYS_INIT_PM macros so the drivers
can avoid #ifdef checks in C code. This also prepares for future
merging of the different versions of these macros.
Change-Id: I2cc50686a2e2c6bdf675bff8b208f741231c2537
Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
Some macros were inheriting from other macros with minor
differences. They were referring to the description of the
the params from the original macro. However, doxygen does
not recognize that. Replaced with another doxygen command
that actually pulls in the descriptions avoiding the warnings.
Change-Id: I8545a965ee64f7800f54208e330de7b2c7a611eb
Jira: ZEP-460
Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
Moved comments from code to header.
Jira: ZEP-160
Change-Id: Ifd0f3c930289256e682b5941d77433aca3d3f941
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Takes advantage of the fact that microkernel tasks can now wait on
nanokernel objects to simplify the device synchronization code.
Change-Id: I5b8d21eaccde9db8b63dd906ef982494a6170271
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
This patch removes DEV_* codes from device.h since they are not used
anymore. All APIs now use error codes from errno.h, following the
conventions from doc/collaboration/code/error_code_conventions.rst.
Change-Id: Ifc363ec8d3d5aa108eaef49d9283b67dcae69ce5
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
Documented the Power Management subsystem which includes the
power management hook interface, device power management,
device busy status interfac and other APIs. Also included
is a guide to writing Power Management applications.
This has 2 parts. One is the general description of the
infrastructure and the PMA writing guide which goes in the
'subsystem' area. Other is the API description that gets
automatically pulled in from the comments in the source files.
The API description goes into the section where all other
Zephyr APIs are put.
Change-Id: Id630209b23f931a8fcccb6f59428610298486743
Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
Certain Low power SOC states (e.g. deep sleep) will result in device
IP blocks losing state. In such a scenario it can be useful to have
a mechanism for devices (driver code) to signal the power manager /
policy that they are in the middle of a transaction.
We expect the device driver code to make a call to
device_busy_set(device *) before initiating a transaction and
device_busy_clear(device *) on completion. It is expected that device
driver developers will add this as necessary in their drivers.
Further an API is provided for power manager application / policy to
check this. Based on this the power manager / policy can decide
whether or not to go into a particular power state.
Change-Id: I0fedd90b98e182cd41b53c7f9e08655532822faa
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
DEV_* error codes are being deprecated so hide them from
public documentation, to prevent mis-use.
Change-Id: Iee2f59502c9470c14ddf2fb1ed19b3526609e43b
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This adds the DEVICE_AND_API_INIT() macro to take in a parameter
to assign to device->driver_api. This eliminates the need to
assign to driver_api during runtime device initialization.
This provides an alternative way to declare devices. This should
save a few bytes in ROM for those devices that will never fail
initialization (in other words, never need to manipulate
driver_api pointer at all).
Also clean up the documentation a bit to remove duplicated
block of information.
Change-Id: I6abed1abe75db2e8babfcf1ecf590491132a5543
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Added device power management hook infrastructure. Added
DEVICE_INIT_PM and SYS_INIT_PM macros that creates device
structures with the supplied device_ops structure containing
the hooks.
Added example support in gpio_dw driver. Updated the sample
app and tested using LPS and Device Suspend Only policies.
Change-Id: I2fe347f8d8fd1041d8318e02738990deb8c5d68e
Signed-off-by: Ramesh Thomas <ramesh.thomas@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This patch adds a comment to DEV_* codes definition to inform that these
codes are deprecated and we should use codes from errno.h instead.
Change-Id: Ia01b83035db5526b2da56ad4a06b2ebab85b0d55
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
This patch redefines DEV_* error codes in terms of errno.h codes.
Change-Id: Iab994c40265c294296491d427f65c38abd48b795
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
Make device APIs a group to enable in raw doxygen output and group
all IO drivers into one category.
Change-Id: I1f9338d3b977bd08a6a1b8d8b396ce1fba33aada
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
If an ISR was enabled and ran before the thread that wants to wait for
completion actually does wait, the type of thread would not be
registered in the object. The ISR would thus not know what type of
semaphore to release. This caused the ISR to release the object for the
previous caller of device_sync_call_wait().
Instead, the ISR now looks if there is already a waiter: if not, it
marks the device as being ready in the object, which allows the thread
to skip taking the semaphore; if there is a waiter, the correct
semaphore type is released, as before.
Change-Id: Ib97480db8ba3e895812cf4bc209d9794639af325
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
TICKS_NONE was mistakenly used when waiting on the nanokernerel
semaphore in the microkernel case, instead of TICKS_UNLIMITED, causing a
thread that wants to wait to return immediately, as if the device was
always ready.
Change-Id: Id2376ebef324339fec05c56655e705755a670973
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
If an init or config function needs to configure a static interrupt or
otherwise do something that requires a build time reference to
a device with DEVICE_GET(), there is a dependency issue that so
far is usually resolved with a forward prototype of the init function.
In addition, there currently isn't a good way to declare a device in
a header so that DEVICE_GET() can be used in a different C file.
This patch should resolve both of these problems; the data structure
defined for the device is no longer static (the names have to be unique
anyway), and in cases where we need a forward declaration so that
DEVICE_GET() can be used, we have a new DEVICE_DECLARE() macro which
does this.
Change-Id: Ie8d53d0c344f61a130c735c86473562820190d70
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
device_sync_call_complete can be called from ISR, fiber or task, thus
needs to be aware not only of the waiter context, but also on the actual
caller one.
Change-Id: I76652a2c44d854db9c34e7192355d455d43f61e3
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Rename them from __initconfig_XXX to __device_XXX, which is more
indicative of what they are.
Change-Id: Ia63ae40c16a2b6f0413c37863cddc39f04839b72
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
They have been replaced by DEVICE_INIT().
Change-Id: I06551f37593a3debb7eb221badd267bb5c7040c0
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
DEVICE_INIT() is a consolidation of DEVICE_INIT_CONFIG_DEFINE() and
DEVICE_DEFINE(), which are always used in pairs.
Change-Id: I263ac195970483e1bb8bf709ef807ba054db9c32
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
Rename it to DEVICE_INIT_CONFIG_DEFINE(), because (a) it was not fitting
in any namespace and (b) it is not used to declare, but rather define a
object.
Change-Id: I1da5822f06b85a9fb024b5b184afd0ccc01012ec
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
Rename it to 'waiter', since 'caller' is ambiguous from the point of
view of the _complete() API, since it is not the 'caller' in that case.
Change-Id: Ib3cadba99195935d67153023d731be26ffa58679
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
Rename them to device_sync_ to fit in the device_ namespace.
Change-Id: I1088dda958584ed90b97137298050fee44c20ee4
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
Adds extern "C" { } blocks to header files so that they can be
safely used by C++ source files.
Change-Id: Ia4db0c36a5dac5d3de351184a297d2af0df64532
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
Changes the nanokernel semaphore API so that the timeout parameter must be
specified when invoking nano_isr_sem_take(), nano_fiber_sem_take(),
nano_task_sem_take() and nano_sem_take().
This obsoletes the following APIs:
nano_fiber_sem_take_wait()
nano_fiber_sem_take_wait_timeout()
nano_task_sem_take_wait()
nano_task_sem_take_wait_timeout()
nano_sem_take_wait()
nano_sem_take_wait_timeout()
Change-Id: If7a4bce1bd8ec8d6410d04f3c16ff1922ff0910e
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
Changes the semaphore API so that the timeout parameter must be specified
when invoking task_sem_take() thereby obsoleting the following APIs:
task_sem_take_wait()
task_sem_take_wait_timeout()
_task_sem_take()
Change-Id: I746d5c966a3b81ffe014333af51aa10ea8a63263
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
Initialization and usage of nano semaphore require an actual semaphore
object in memory. So make sure the semaphore is there.
Change-Id: I4a7391973c65f99132735133b82f1e3837eab4f8
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Introduce the device_sync_call_t object type and its API.
This object type allows one thread to perform synchronous calls into a
driver. Only one thread can do such calls per instance of the
device_sync_call_t object since it makes a global record of what type of
thread is waiting on it.
Based on an idea from Dmitriy Korovkin and Peter Mitsis, moving their
proposal to a more generic API provides the solution for all device
drivers that exposes synchronous API in an interrupt based
implementation.
Change-Id: I793fac76645396bf4eb6be38b5a130ac6bde8f73
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Change all the Intel and Wind River code license from BSD-3 to Apache 2.
Change-Id: Id8be2c1c161a06ea8a0b9f38e17660e11dbb384b
Signed-off-by: Javier B Perez Hernandez <javier.b.perez.hernandez@linux.intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
Extending devices.h to contain values that include error code
values that a driver may need to share. These include things like:
okay, fail, invalid configuration, etc.
Change-Id: Ib3a5e3fdd93ec8115686cf02a75436af31ef6eff
Signed-off-by: Dan Kalowsky <daniel.kalowsky@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Macro definitions must not have trailing semi-colons. Depending upon the
compiler, trailing semi-colons may result in a warning when a user invokes
those macros AND adds their own trailing semi-colon.
Change-Id: I34e8da2b0ce7c21ce67e84fab75ea3edefe19cfe
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
Change all occurances of /*! to /** to match javadoc
style.
Change-Id: I3a759d34e0e928216f61252682266e64c5b875f8
Signed-off-by: Anas Nashif <anas.nashif@intel.com>