Commit graph

181 commits

Author SHA1 Message Date
Tomasz Bursztyka 939fc26c2e drivers/watchdog: Add support for Microchip XEC device
Such watchdog timer is found on mec1501.
It comes with a support of dbg stall feature and interrupt support.

It does not support multistaging.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2019-09-07 09:56:58 -04:00
Piotr Zięcik a901e32a38 drivers: wdog_cmsdk_apb: Get clock frequency from DTS
The wdog_cmsdk_apb driver used system clock frequency
as a base for timeout calculation. This commit corrects
that by obtaining the needed value from DTS.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
2019-07-24 15:10:02 +02:00
Henrik Brix Andersen 7cb92552f3 drivers: watchdog: mcux_wdog32: add driver for the NXP Kinetis WDOG32
Add driver shim for the NXP Kinetis WDOG32 module.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2019-07-02 18:00:16 -05:00
Anas Nashif 5b0aa794b2 cleanup: include/: move misc/reboot.h to power/reboot.h
move misc/reboot.h to power/reboot.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif 9ab2a56751 cleanup: include/: move misc/printk.h to sys/printk.h
move misc/printk.h to sys/printk.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif 17ddd1714c cleanup: include/: move clock_control.h to drivers/clock_control.h
move clock_control.h to drivers/clock_control.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif d4d20677ac cleanup: include/: move watchdog.h to drivers/watchdog.h
move watchdog.h to drivers/watchdog.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif 190e368275 cleanup: include/: move power.h to power/power.h
move power.h to power/power.h and
create a shim for backward-compatibility.

No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.

Related to #16539

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-27 22:55:49 -04:00
Anas Nashif 43a49335f4 include: move interrupt controller headers to interrupt_controller/
Move internal and architecture specific headers from include/drivers to
subfolder for interrupt_controller:

include/drivers/interrupt_controller/

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-25 15:27:00 -04:00
Kumar Gala dba65ce47c drivers: Update DT IRQ alias defines
The defines should have had a _0 on them, now that we generate the
proper defines, fixup the cases that used that old scheme.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-06-21 07:53:05 -05:00
Anas Nashif f2cb20c772 docs: fix misspelling across the tree
Found a few annoying typos and figured I better run script and
fix anything it can find, here are the results...

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-19 15:34:13 -05:00
Tomasz Bursztyka 7245e433a1 drivers/wdt: Fixing tiny style issues in sam0 driver
- Even one-liner statement if () need { }
- you can coalesce assignment and condition if the later tests the
earlier only.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-06-17 16:45:27 -04:00
Kumar Gala a2693975d7 dts: Convert from DT_<COMPAT>_<INSTANCE>_<PROP> to DT_INST...
Change code from using now deprecated DT_<COMPAT>_<INSTANCE>_<PROP>
defines to using DT_INST_<INSTANCE>_<COMPAT>_<PROP>.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-06-14 08:02:15 -05:00
Anas Nashif 4c32258606 style: add braces around if/while statements
Per guidelines, all statements should have braces around them. We do not
have a CI check for this, so a few went in unnoticed.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-06-06 15:20:21 +02:00
Tomasz Bursztyka 5a2c6d33e4 drivers/wdt: Rename CMSDK driver to follow naming rules
Basically, all driver file names should start with the driver type as
prefix: wdt_ in case of watchdogs here, and not something custom like
wdog_.

For clarity, wdog_ prefix could be changed to wdt_ in the source code
also but that's a detail and will not be addressed here.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-06-04 15:34:55 -04:00
Tomasz Bursztyka 1b28cb0ff1 drivers/wdt: Rename STM32 IWDG files to follow naming rules
Basically, all driver file names should start with the driver type as
prefix: wdt_ in case of watchdogs here.

Maybe 'iwdg' keyword could be removed entirely, and also in function
names. However that is not the scope of this patch.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2019-06-04 15:34:55 -04:00
Benjamin Valentin 29deef2def drivers: watchdog: sam0: Check if timeout is valid
The upper limit of the timeout should not be 0.
tests/drivers/watchdog/wdt_basic_api checks for this and fails as the
driver currently only checks that the timout does not exceed the upper
bound.
This also makes it check the lower bound, so that the test passes.

Signed-off-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
2019-05-08 11:52:22 -05:00
Derek Hageman 06caf27436 drivers: watchdog: sam0: Remove defines from dts_fixup.h
Move SAM0 GPIO to use the raw defines generated from the DTS
parsing.

Signed-off-by: Derek Hageman <hageman@inthat.cloud>
2019-05-03 08:46:57 -05:00
Anas Nashif 3ae52624ff license: cleanup: add SPDX Apache-2.0 license identifier
Update the files which contain no license information with the
'Apache-2.0' SPDX license identifier.  Many source files in the tree are
missing licensing information, which makes it harder for compliance
tools to determine the correct license.

By default all files without license information are under the default
license of Zephyr, which is Apache version 2.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2019-04-07 08:45:22 -04:00
Patrik Flykt 97b3bd11a7 drivers: Rename reserved function names
Rename reserved function names in drivers/ subdirectory. Update
function macros concatenatenating function names with '##'. As
there is a conflict between the existing gpio_sch_manage_callback()
and _gpio_sch_manage_callback() names, leave the latter unmodified.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2019-04-03 17:31:00 -04:00
Patrik Flykt 24d71431e9 all: Add 'U' suffix when using unsigned variables
Add a 'U' suffix to values when computing and comparing against
unsigned variables.

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2019-03-28 17:15:58 -05:00
Ulf Magnusson 82adc2706d drivers: watchdog: Rename CONFIG_WDT_SAM_DISABLE_AT_BOOT in comments
CONFIG_WDT_SAM_DISABLE_AT_BOOT was removed in commit 2e01e86bdc
("drivers: watchdog: wdt_sam: use the generic disable option"), but some
comments still talked about it. Replace it with
CONFIG_WDT_DISABLE_AT_BOOT.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-03-15 10:38:46 -05:00
Ramakrishna Pallala e1639b5345 device: Extend device_set_power_state API to support async requests
The existing device_set_power_state() API works only in synchronous
mode and this is not desirable for devices(ex: Gyro) which take
longer time (few 100 mSec) to suspend/resume.

To support async mode, a new callback argument is added to the API.
The device drivers can asynchronously suspend/resume and call the
callback function upon completion of the async request.

This commit adds the missing callback parameter to all the drivers
to make it compliant with the new API.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
2019-03-14 14:26:15 +01:00
Jun Li b0d46a3175 watchdog: stm32: fix logic error
While installing timeout, the logic to judge if
timeout parameter is valid is wrong.

Signed-off-by: Jun Li <jun.r.li@intel.com>
2019-03-14 07:08:13 -05:00
Aurelien Jarno 2e01e86bdc drivers: watchdog: wdt_sam: use the generic disable option
Use the generic option WDT_DISABLE_AT_BOOT instead of the SAM specific
one WDT_SAM_DISABLE_AT_BOOT (note the generic one has been introduced
after the SAM one).

This also have the consequence of changing the default value for yes to
no, fixing the watchdog tests.

Fixes #13290

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2019-03-09 10:26:32 -05:00
Maksim Masalski 039d8ecf6a drivers: Changed return statement in function get_timeout()
According to the Coverity issue 188890 (github issue #10705)
Fix for overflowed or truncated value  count-1U used as return value.
I decided to use a saturating subtract to avoid a vulnerability.
It will always return 0 or bigger value according to the conditions.
Now if count value is 0, function will return 0, not -1 as before.

Signed-off-by: Maksim Masalski <maxxliferobot@gmail.com>
2019-03-03 10:44:06 -05:00
Ulf Magnusson 9aab5cef96 kconfig: Remove redundant 'default n' properties
Some more were added since the cleanup pass in June 2018. See e.g.
commit 2d50da70a1 ("drivers: ipm: Kconfig: Remove redundant 'default n'
properties") for a motivation. It also avoids people wondering whether
or not they need to put in 'default n'.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-02-27 09:25:22 +01:00
Erwan Gouriou 8ce7921451 drivers/watchdog: stm32: Disable IWDG_STM32_START_AT_BOOT by default
STM32 specific behavior "IWDG_STM32_START_AT_BOOT" is enabled
by default. As all vendor specific behavior, this is preferred
to be disabled by default and activated at application level,
so application can have better control of the driver.
For instance watchdog test can't run with this setting.
Disable by default.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-02-01 19:16:59 -05:00
Erwan Gouriou 7ae381a808 drivers/watchdog: stm32: move driver to dts based configuration
STM32 watchdog driver is now configured from device tree settings.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2019-02-01 19:16:59 -05:00
qianfan Zhao 634e482fe1 samples: watchdog: Remove stm32 iwdg sample
STM32 iwdg driver are convented to new API now, the old sample
are doesn't need again.

Signed-off-by: qianfan Zhao <qianfanguijin@163.com>
2019-02-01 19:16:59 -05:00
qianfan Zhao 107375da8d drivers: iwdg_stm32: Convent STM32 watchdong driver to new API
Fixes: #10917

Signed-off-by: qianfan Zhao <qianfanguijin@163.com>
Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.com>
2019-02-01 19:16:59 -05:00
Kumar Gala 03bfb18c61 drivers: watchdog: remove deprecated apis
Its been at least 2 releases since we marked a number of watchdog APIs
as deprecated.  Lets remove them.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-01 10:37:49 -06:00
Kumar Gala 61cb8b6c4f drivers: wdog: cmsdk: Convert to new DT_<COMPAT>_<INSTANCE> defines
Convert cmsdk driver to use new defines so we can remove the
dts_fixup.h code for it.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-01-25 08:55:06 -06:00
Patrik Flykt 8ff96b5a57 drivers: Add 'U' to unsigned variable assignments
Add 'U' to a value when assigning it to an unsigned variable.
MISRA-C rule 7.2

Signed-off-by: Patrik Flykt <patrik.flykt@intel.com>
2018-12-04 22:51:56 -05:00
Mieszko Mierunski 94dc637c65 dts: nrf: Remove WDT dts.fixup defines and use aliases instead.
Changed driver to use defines from aliases instead of fixup.

Signed-off-by: Mieszko Mierunski <mieszko.mierunski@nordicsemi.no>
2018-11-20 22:18:09 +01:00
Vincenzo Frascino 03c7d9bd49 drivers: wdog: Update CMSDK Wdog driver
The commit 0c2ef4ea3d "drivers:
watchdog: Watchdog API redesign" introduced an API redesign for the
watchdog drivers compliant with Zephyr.

This patch updated the CMSDK Watchdog driver to be compliant with the
new API.

Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2018-11-19 08:40:48 -06:00
Henrik Brix Andersen e5460c6bcc drivers: watchdog: wdt_sam0: Convert Atmel SAM0 driver to the new API
Convert the Atmel SAM0 watchdog driver to the new watchdog API and
enable DTS support.

This fixes #10914.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2018-11-19 08:40:15 -06:00
Kumar Gala ee9b08d7da drivers: watchdog: Convert Atmel SAM driver to DTS
The majority of bits where already in place, but some minor support
get the driver name from DTS was needed.  Now we select HAS_DTS_WDT
for the driver.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-11-16 11:19:36 -06:00
Andrzej Głąbek 20202902f2 dts_fixups: Use DT_ prefix in all defined labels not related to Kconfig
These changes were obtained by running a script  created by
Ulf Magnusson <Ulf.Magnusson@nordicsemi.no> for the following
specification:

1. Read the contents of all dts_fixup.h files in Zephyr
2. Check the left-hand side of the #define macros (i.e. the X in
   #define X Y)
3. Check if that name is also the name of a Kconfig option
   3.a If it is, then do nothing
   3.b If it is not, then replace CONFIG_ with DT_ or add DT_ if it
       has neither of these two prefixes
4. Replace the use of the changed #define in the code itself
   (.c, .h, .ld)

Additionally, some tweaks had to be added to this script to catch some
of the macros used in the code in a parameterized form, e.g.:
- CONFIG_GPIO_STM32_GPIO##__SUFFIX##_BASE_ADDRESS
- CONFIG_UART_##idx##_TX_PIN
- I2C_SBCON_##_num##_BASE_ADDR
and to prevent adding DT_ prefix to the following symbols:
- FLASH_START
- FLASH_SIZE
- SRAM_START
- SRAM_SIZE
- _ROM_ADDR
- _ROM_SIZE
- _RAM_ADDR
- _RAM_SIZE
which are surprisingly also defined in some dts_fixup.h files.

Finally, some manual corrections had to be done as well:
- name##_IRQ -> DT_##name##_IRQ in uart_stm32.c

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-11-13 10:44:42 -06:00
Krzysztof Chruscinski 97345dbb1b logging: Fix errors in log usage
Couple of findings which were revealed after changing
LOG_MODULE_REGISTER macro:
- missing semicolons after LOG_MODULE_REGISTER()
- missing LOG_LEVEL defines
- other

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2018-11-10 12:38:29 -05:00
Subramanian Meenakshi Sundaram 4e1179bba5 drivers: watchdog: Adding watchdog support for sam SOC
Adding watchdog driver for sam SoC. The current implemntation just
diables the watchdog on device boot.
This PR adds the following support for SAM3X, SAM4S and SAME70
1. Activate processor reset
2. Activate all reset
3. Generate interrupt on watchdog timer expiration.

Signed-off-by: Subramanian Meenakshi Sundaram <subbu147@gmail.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2018-11-02 15:09:22 -05:00
Savinay Dharmappa bf389e0853 drivers: watchdog: Add dts support for QMSI based watchdog.
patch adds the device binding for qmsi watchdog and device node
for socs which are using wdt qmsi driver.

Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-14 14:16:03 -04:00
Savinay Dharmappa 7b6776a36a drivers: wdt: Migrate esp32 wdt driver api to new wdt interface
patch migrates the esp32 wdt driver to new wdt interfaces

Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
2018-10-14 14:16:03 -04:00
Savinay Dharmappa ea07658a4f drivers: wdt: Migrate qmsi wdt driver api to new wdt api interface.
patch migrates the wdt qmsi driver to new wdt interfaces.

Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
2018-10-14 14:16:03 -04:00
Olivier Martin 049a4f8688 drivers: watchdog: Migrate to new logging subsys
Migrate from `SYS_LOG` to `LOG` logging mechanism.

Signed-off-by: Olivier Martin <olivier.martin@proglove.de>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-10-08 17:49:12 -04:00
Flavio Ceolin 67ca176754 headers: Fix headers across the project
Any word started with underscore followed by and uppercase letter or a
second underscore is a reserved word according with C99.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-09-17 15:49:26 -04:00
Flavio Ceolin da49f2e440 coccicnelle: Ignore return of memset
The return of memset is never checked. This patch explicitly ignore
the return to avoid MISRA-C violations.

The only directory excluded directory was ext/* since it contains
only imported code.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2018-09-14 16:55:37 -04:00
Karol Lasończyk c9e3c938e6 tests/samples: watchdog: Update projects' configuration
WDT_NRFX is now enabling by default. Its configuration from proj.conf
files was removed.

Signed-off-by: Karol Lasończyk <karol.lasonczyk@nordicsemi.no>
2018-08-20 06:38:02 -07:00
Ulf Magnusson 8cf8db3a73 Kconfig: Use a short, consistent style for prompts
Consistently use

    config FOO
            bool/int/hex/string "Prompt text"

instead of

    config FOO
            bool/int/hex/string
            prompt "Prompt text"

(...and a bunch of other variations that e.g. swapped the order of the
type and the 'prompt', or put other properties between them).

The shorthand is fully equivalent to using 'prompt'. It saves lines and
avoids tricking people into thinking there is some semantic difference.

Most of the grunt work was done by a modified version of
https://unix.stackexchange.com/questions/26284/
how-can-i-use-sed-to-replace-a-multi-line-string/26290#26290, but some
of the rarer variations had to be converted manually.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-08-15 04:10:10 -07:00
Andrzej Głąbek ead399914e drivers: watchdog: nrfx: Remove false dependency on CLOCK_CONTROL_NRF5
This driver no longer uses any clock control API, so the dependency
became outdated.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2018-08-08 17:23:55 +02:00
Karol Lasończyk 14112768c0 drivers: watchdog: Fix assert errors in nrf watchdog implementation
Bad function calls caused assertion errors in previous implementation.
This change introduces fixes to prevent those errors. In addition
nrfx_wdt_init function is moved to init function calling at the start of
zephyr.
There are additional changes. -EINVAL value is returning in install
function when watchdog timeout value is invalid (less or equal minimum
or greater than value supported by watchdog peripheral in Nordic's SoCs.
Additionaly condition to chech if low frequency clock is enabled was
removed. Watchdog peripheral requests LFCLK in hardware.

Signed-off-by: Karol Lasończyk <karol.lasonczyk@nordicsemi.no>
2018-07-26 22:22:03 -04:00
Karol Lasończyk e482feac9d drivers: watchdog: Align nrf wdt driver to new nrfx
New nrfx version brings fixes also in watchdog implementation.
Previously introduced workaround for supporting more than one channel
can be changed to driver-management solution.

Signed-off-by: Karol Lasończyk <karol.lasonczyk@nordicsemi.no>
2018-07-26 22:22:03 -04:00
Ulf Magnusson 09acea9f03 drivers: watchdog: Kconfig: Remove redundant 'default n' properties
Bool symbols implicitly default to 'n'.

A 'default n' can make sense e.g. in a Kconfig.defconfig file, if you
want to override a 'default y' on the base definition of the symbol. It
isn't used like that on any of these symbols though, and is
inconsistent.

This will make the auto-generated Kconfig documentation have "No
defaults. Implicitly defaults to n." as well, which is clearer than
'default n if ...'

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2018-07-03 17:11:31 -04:00
David B. Kinder 90380730b3 doc: fix misspelling in watchdog Kconfig
fix misspellings missed during regular review

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2018-06-20 12:36:48 -04:00
Leandro Pereira 158ea970ea drivers: watchdog: Use common name configuration for all drivers
Each driver seemed to use their own Kconfig option to set the name for
their drivers.  This makes writing example/test code difficult as each
one of them will have to special case for each of the supported
platforms.

Use a consistent CONFIG_WDT_0_NAME option in all drivers.

Fixes #8094.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2018-06-01 15:31:56 -05:00
Leandro Pereira eefeb2b050 drivers: watchdog: esp32: Use common Kconfig option to disable at boot
Instead of relying on CONFIG_WDT_ESP32_DISABLE_AT_BOOT, use
CONFIG_WDT_DISABLE_AT_BOOT that's available for all watchdog timers.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2018-06-01 15:31:56 -05:00
Maureen Helm 474a618f1b watchdog: Introduce mcux wdog shim driver
Adds a shim layer around the mcux kinetis wdog driver to adapt it to the
zephyr watchdog interface.

Signed-off-by: Maureen Helm <maureen.helm@nxp.com>
2018-05-17 15:00:55 -05:00
Florian Vaussard 35cb2ba346 watchdog: stm32: fix style issue
Convert uint32_t to u32_t. Warning reported by checkpatch.

Signed-off-by: Florian Vaussard <florian.vaussard@gmail.com>
2018-05-17 13:09:09 -05:00
Florian Vaussard d0fa58722d watchdog: iwdg: honor IWDG_STM32_START_AT_BOOT
The Kconfig IWDG_STM32_START_AT_BOOT is actually not used and the
watchdog is enabled unconditionnally at init.

Enable the watchdog only if CONFIG_IWDG_STM32_START_AT_BOOT is set.

Signed-off-by: Florian Vaussard <florian.vaussard@gmail.com>
2018-05-17 13:09:09 -05:00
Karol Lasończyk 30a24e8ad0 drivers: watchdog: Add shim for nrfx WDT driver
Changes add a translation layer to make nrfx WDT driver works
with Zephyr API.

Signed-off-by: Karol Lasończyk <karol.lasonczyk@nordicsemi.no>
2018-05-14 10:28:23 -05:00
Michał Kruszewski 0c2ef4ea3d drivers: watchdog: Watchdog API redesign
New API enables setting watchdog timeout in the unit of microseconds.
It is possible to configure watchdog timer behavior in CPU sleep state
as well as when it is halted by the debugger.
It supports watchdogs with multiple reload channels.

Jira: ZEP-2564

Signed-off-by: Michał Kruszewski <michal.kruszewski@nordicsemi.no>
Signed-off-by: Karol Lasończyk <karol.lasonczyk@nordicsemi.no>
2018-05-14 10:28:23 -05:00
Michael Hope be8cba4bad watchdog: add a watchdog driver for the SAM0 family.
Signed-off-by: Michael Hope <mlhx@google.com>
2018-01-04 13:18:25 -05:00
Sebastian Bøe 0829ddfe9a kbuild: Removed KBuild
Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
2017-11-08 20:00:22 -05:00
Sebastian Bøe 12f8f76165 Introduce cmake-based rewrite of KBuild
Introducing CMake is an important step in a larger effort to make
Zephyr easy to use for application developers working on different
platforms with different development environment needs.

Simplified, this change retains Kconfig as-is, and replaces all
Makefiles with CMakeLists.txt. The DSL-like Make language that KBuild
offers is replaced by a set of CMake extentions. These extentions have
either provided simple one-to-one translations of KBuild features or
introduced new concepts that replace KBuild concepts.

This is a breaking change for existing test infrastructure and build
scripts that are maintained out-of-tree. But for FW itself, no porting
should be necessary.

For users that just want to continue their work with minimal
disruption the following should suffice:

Install CMake 3.8.2+

Port any out-of-tree Makefiles to CMake.

Learn the absolute minimum about the new command line interface:

$ cd samples/hello_world
$ mkdir build && cd build
$ cmake -DBOARD=nrf52_pca10040 ..

$ cd build
$ make

PR: zephyrproject-rtos#4692
docs: http://docs.zephyrproject.org/getting_started/getting_started.html

Signed-off-by: Sebastian Boe <sebastian.boe@nordicsemi.no>
2017-11-08 20:00:22 -05:00
Adam Podogrocki 6d4da19602 iwdg: make independent watchdog driver compliant with STM32Cube LL API
Appropriate inclusion done for F1/F3/F4/L4 families in SoC tree.

JIRA: ZEP-2347

Signed-off-by: Adam Podogrocki <adam.podogrocki@rndity.com>
2017-10-23 09:51:16 +02:00
Leandro Pereira 5f22dab17a esp32: Prefix ROM routines with esp32_rom_
Also provide their prototypes in `soc.h`.  This should help
readability, since some ROM functions, with their names as provided by
Espressif, have sometimes the same prefix as Zephyr APIs.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-10-09 20:53:22 -04:00
David B. Kinder f00f58517b doc: replace UTF-8 chars
Some our Zephyr tools don't like seeing UTF-8 characters, as reported in
issue #4131) so a quick scan and replace for UTF-8 characters in .rst,
.h, and Kconfig files using "file --mime-encoding" (excluding the /ext
folders) finds these files to tweak.

Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
2017-10-03 20:03:57 -04:00
Leandro Pereira 8dc88069be drivers: watchdog: esp32: Acknowledge watchdog interrupt
If the interrupt isn't acknowledged, the callback will continue to be
called.

Jira: ZEP-2556
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-08-25 15:31:46 -04:00
Leandro Pereira 1861022148 drivers: watchdog: esp32: Reduce number of seals/unseals
Jira: ZEP-2556
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-08-25 15:31:46 -04:00
Leandro Pereira 9bacdbac30 drivers: watchdog: esp32: Always use Timer Group 1 for WDT
The FreeRTOS port by Espressif uses the same timer group.  Do the same
here.

Jira: ZEP-2556
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-08-25 15:31:46 -04:00
Leandro Pereira d52de29fba esp32: Fix redefinition of BIT() macro
Esp-idf defines the BIT macro that is also defined in Zephyr's
misc/util.h.  Fix the issue by including the esp-idf headers first, so
that a check in util.h won't redefine the macro if it's already
defined.

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-08-19 07:50:18 -04:00
Leandro Pereira d691045592 drivers: watchdog: Implement ESP32 watchdog driver
Zephyr's watchdog API is badly designed in the sense that it's a 1:1
abstraction on top of whatever Quark D2000 expects for its watchdog,
instead of expecting a generic timeout value.

This implementation tries as much as possible to calculate the watchdog
timeout in a way that's compatible with a Quark D2000 running at 32MHz;
a comment in adjust_timeout() explains this in more detail.

Jira: ZEP-2296
Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-08-09 12:26:14 -07:00
Leandro Pereira 732424f065 drivers, net: Clean up semaphore initialization
Change the common "init with 0" + "give" idiom to "init with 1".  This
won't change the behavior or performance, but should decrease the size
ever so slightly.

This change has been performed mechanically with the following
Coccinelle script:

    @@
    expression SEM;
    expression LIMIT;
    expression TIMEOUT;
    @@

    - k_sem_init(SEM, 0, LIMIT);
    - k_sem_give(SEM);
    + k_sem_init(SEM, 1, LIMIT);

Signed-off-by: Leandro Pereira <leandro.pereira@intel.com>
2017-07-27 15:23:07 -04:00
Piotr Mienkowski b185f8617f watchdog: atmel_sam: enable build for all SAM family
atmel_sam watchdog driver was temporarily limited to SAME70
series only. Now that all SAM series are using ASF the
change can be reverted.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2017-05-28 09:18:54 -05:00
Kumar Gala c40239dcfa watchdog: atmel_sam: only build for SAME70
With recent changes we now have both SAME70 and SAM3X under
SOC_FAMILY_SAM so we need to limit the watchdog driver only to SAME70 as
it only builds there right now.

Change-Id: I4a7c90247ad22532b2384ca536cfb0cbd65186f9
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-28 21:49:45 +00:00
Kumar Gala ccad5bf3e3 drivers: convert to using newly introduced integer sized types
Convert code to use u{8,16,32,64}_t and s{8,16,32,64}_t instead of C99
integer types.

Jira: ZEP-2051

Change-Id: I08f51e2bfd475f6245771c1bd2df7ffc744c48c4
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-21 10:06:48 -05:00
Kumar Gala 789081673f Introduce new sized integer typedefs
This is a start to move away from the C99 {u}int{8,16,32,64}_t types to
Zephyr defined u{8,16,32,64}_t and s{8,16,32,64}_t.  This allows Zephyr
to define the sized types in a consistent manor across all the
architectures we support and not conflict with what various compilers
and libc might do with regards to the C99 types.

We introduce <zephyr/types.h> as part of this and have it include
<stdint.h> for now until we transition all the code away from the C99
types.

We go with u{8,16,32,64}_t and s{8,16,32,64}_t as there are some
existing variables defined u8 & u16 as well as to be consistent with
Zephyr naming conventions.

Jira: ZEP-2051

Change-Id: I451fed0623b029d65866622e478225dfab2c0ca8
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-04-20 16:07:08 +00:00
Souvik K Chakravarty 8fa2f82524 watchdog: Add WDT driver for Atmel SAM SoCs
Basic Watchdog driver for Atmel SAM family MCUs. Currently only
disabling the watchdog is supported.

Tested on Atmel SAMV71 Xplained Ultra Evaluation Kit.

Origin: Original

Jira: ZEP-1684

Change-Id: I8f717c7f53aa290c944b7935e0570c2a6f53956e
Signed-off-by: Souvik K Chakravarty <souvik.k.chakravarty@intel.com>
2017-03-09 13:43:17 +00:00
Juan Solano ee623d21de drivers: Remove unnecessary CONFIG_SYS_POWER_DEEP_SLEEP
This commit removes unnecessary CONFIG_SYS_POWER_DEEP_SLEEP protection
in shim drivers as QMSI 1.4 has introduced empty context save/restore
functions that can be called in Quark D2000, therefore keeping common
code at the shim driver level for Quark SE and D2000.

Change-Id: Ia2a466327f999668c6511c0193014e9151bff6ae
Signed-off-by: Juan Solano <juanx.solano.menacho@intel.com>
2017-02-10 16:27:32 +00:00
Kuo-Lang Tseng 23b0074012 ext qmsi: Update to QMSI 1.4 RC2
Update the builtin QMSI code to 1.4 (RC2).
The below shim drivers were updated for API or interface changes:
- aio
- counter
- i2c_ss
- rtc
- wdt.

Also, arch soc specific power management code were updated.

Jira: ZEP-1572

Change-Id: Ibc8fae032a39ffb2c2c997f697835bc0208fd308
Signed-off-by: Jesus Sanchez-Palencia <jesus.sanchez-palencia@intel.com>
Signed-off-by: Kuo-Lang Tseng <kuo-lang.tseng@intel.com>
2017-02-08 11:59:12 +00:00
Kuo-Lang Tseng dad4127761 drivers: QMSI WDT: simplify driver reentrancy code using IS_ENABLED macro
This is one of the series of patches that simplifies the driver
code by using the IS_ENABLED macro. This removes the need of the
const variable and the three wrapper functions on semaphore APIs.

Jira: ZEP-1251

Change-Id: I2ea0b2d04252d6b28e7d5ca528480234545e6eed
Signed-off-by: Kuo-Lang Tseng <kuo-lang.tseng@intel.com>
2017-01-19 16:48:42 -08:00
David B. Kinder ac74d8b652 license: Replace Apache boilerplate with SPDX tag
Replace the existing Apache 2.0 boilerplate header with an SPDX tag
throughout the zephyr code tree. This patch was generated via a
script run over the master branch.

Also updated doc/porting/application.rst that had a dependency on
line numbers in a literal include.

Manually updated subsys/logging/sys_log.c that had a malformed
header in the original file.  Also cleanup several cases that already
had a SPDX tag and we either got a duplicate or missed updating.

Jira: ZEP-1457

Change-Id: I6131a1d4ee0e58f5b938300c2d2fc77d2e69572c
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2017-01-19 03:50:58 +00:00
Vincenzo Frascino 8e44a5aa0e watchdog: Add driver for CMSDK APB WDOG
Add driver for CMSDK (Cortex-M System Design Kit) APB WDOG. This device
uses NMI as interrupt hence it requires Runtime NMI (CONFIG_RUNTIME_NMI)
to be configured in the platform.

Tested with drivers/watchdog sample application.

Jira: ZEP-1300
Change-Id: Ib318047109af81e32060e80d456ef3873fd380ea
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2016-12-06 10:31:45 -06:00
Vincenzo Frascino b41c0159a8 watchdog: Refactor main Kconfig file
This patch refactors the main Kconfig file in order to align it with the
Zephyr code style and to make sure that each Kconfig configuration
portion is easily identifiable.

Change-Id: Ib226aaa9a98e9b08a47d9d1c329f18f4f6936620
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
2016-11-30 17:25:15 +00:00
Baohong Liu 3c01b5db57 drivers: wdt: update to unified kernel
Use new semaphore APIs from unified kernel.

Change-Id: I1e051271212290a90a5659190bf031e9961e1917
Signed-off-by: Baohong Liu <baohong.liu@intel.com>
2016-11-10 05:12:19 +00:00
Andrew Boie 0b474eef9c kernel: deprecate old init levels
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>
2016-11-09 17:59:44 +00:00
JuanX Solano Menacho f8130521e2 wdt_qmsi: Use qm_wdt_*_context API
Remove the Zephyr implementation and
update the wdt_qmsi driver to use new QMSI PM APIs.

Jira: ZEP-1001
Change-Id: I4d0a2e3b8cf402b457ee0454650080d406eb6d0a
Signed-off-by: JuanX Solano Menacho <juanx.solano.menacho@intel.com>
2016-11-03 23:52:07 +00:00
Iván Briano 5b2160b598 watchdog qmsi: Enable the driver to work on ARC
Jira: ZEP-1030
Change-Id: Iab5bb301dae9a18dc2050606f230606ef76bebb5
Signed-off-by: Iván Briano <ivan.briano@intel.com>
2016-11-02 22:24:48 +00:00
Jesus Sanchez-Palencia fd4dc0f11f wdt: Remove unneeded include from wdt_qmsi.c
qm_interrupt.h is not needed.

Change-Id: Ia9e62db9fc39ee7a8a36e087eb447cbc4a419817
Signed-off-by: Jesus Sanchez-Palencia <jesus.sanchez-palencia@intel.com>
2016-10-31 20:58:33 +00:00
Iván Briano 0094ab228d ext qmsi: Update to QMSI 1.3 release
Update the QMSI drop we maintain in Zephyr, and fix the build where
needed:

- QM_SCSS_INT is renamed to QM_INTERRUPT_ROUTER;
- every member of QM_INTERRUPT_ROUTER was renamed as well;
- QM_IRQ_* renamed too, mostly added _INT at the end;
- some isr functions were renamed to keep their names consistent;
- build for x86 needs to define QM_LAKEMONT, as QM_SENSOR was for ARC.

Change-Id: I459029ca0d373f6c831e2bb8ebd52402a55994d1
Signed-off-by: Iván Briano <ivan.briano@intel.com>
2016-10-31 13:26:06 +00:00
Marcus Shawcroft 807a103653 watchdog/iwdg_stm32: Limit name space, add static.
Change-Id: I497e2afe0a0e700c1fb95ef50338d44e601248df
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-26 20:51:09 +00:00
Marcus Shawcroft a2017aafa1 watchdog/iwdg_stm32: Fix missing include compilation error.
Change-Id: I0dae37eae451452e6071639b5258634c44c7ccbf
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-26 20:51:08 +00:00
Marcus Shawcroft bcc7f633fc drivers/watchdog: Make WDT_0_IRQ_PRI dependent on WDT_QMSI
The config variable WDT_0_IRQ_PRI is intended to be generic across a
range of watchdog drivers, however it has no default value which means
that if CONFIG_WATCHDOG is enabled, but no driver is provided for a
specific board the the configuration will fail.  For now, make
WDT_0_IRQ_PRI depend on the only driver that uses it.

Change-Id: I54708d66ac8fbc2ef657a1ef4510eb5e7a2cff28
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-26 20:51:07 +00:00
Marcus Shawcroft eb2f6e0325 wdt_qmsi: Make driver_api const.
Change-Id: I35055a6c5d41b3a9474fef45b9e7f8662f286c65
Signed-off-by: Marcus Shawcroft <marcus.shawcroft@arm.com>
2016-10-26 20:51:00 +00:00
Jesus Sanchez-Palencia 7c0fc99c79 ext qmsi: Update to QMSI 1.2 release
Update the QMSI drop we maintain in Zephyr, and fix the build where
needed:

- QM_USB_BASE is renamed to QM_USB_0_BASE;
- parameter int_en from qm_uart cfg struct was removed;
- driver's folder now has a new structure, fix makefiles accordingly;
- QM_WDT_MODE and related renamed to QM_WDT_CR_RMOD;
- QM_SCSS_AON renamed to QM_AONC.

Change-Id: Iffe9c66b7a3f2fe64418326e20ff0894149b3044
Signed-off-by: Jesus Sanchez-Palencia <jesus.sanchez-palencia@intel.com>
2016-10-18 23:26:01 +00:00
Iván Briano aba245daad drivers qmsi: Fix power management with reentrancy disabled
The new device control API added a 'device_power_state' variable to the
driver's data structure to keep track of the current power state set
for a device. This member variable is conditionally built into the
runtime data structure of each driver, but in some cases the whole data
structure is conditional on its respective API_REENTRANCY config
variable.

In those cases where the runtime data was previously used only for
reentrancy protection, the runtime data pointer used for device
initialization is NULL, and when power management is enabled, this
invalid pointer ends up dereferenced to get the device_power_state
member.

Make the declaration of the runtime data dependent on any of its
conditional members, and NULL only when all of those settings are
disabled.

Change-Id: I4f41e00ad8551a096db639e31d33f43752b6672f
Signed-off-by: Iván Briano <ivan.briano@intel.com>
2016-10-05 09:51:09 +00:00
amirkapl c490219d1e power_mgmt: Update sample and drivers according to new pm device API
Update the power sample and drivers with the new device driver power
management API using the existing logic

Jira: ZEP-954
Change-Id: Idd94232e458767635973e94e9fc673c01612c1e2
Signed-off-by: Amir Kaplan <amir.kaplan@intel.com>
2016-09-22 00:23:43 +00:00
Julien Delayen 0392d79845 wdt_qmsi: Implement suspend and resume functions
In order to restore watchdog context after entering
SYS_PM_DEEP_SLEEP, suspend and resume functions
are called.

The following parameters are restored:
 - All registers for the WDT device.
 - Watchdog interrupt mask.

The suspend/resume functionality is implemented in
the QMSI shim layer as a fast and temporary solution,
it will be removed and migrated to QMSI later.

Change-Id: I6e4e30a797b0ca38ce727d50fa51d1b2f8330405
Signed-off-by: Julien Delayen <julien.delayen@intel.com>
2016-09-12 00:29:25 +00:00
Jithu Joseph 3dd008e0c2 qmsi: wdt: improved reentrancy of the wdt driver
Uses locking in an API and removes a global variable
for improved safety/correctness in the face of concurrent
threads and fibers.

The locking mechanism is by default disabled in the
build. To enable it, the following flag needs to be defined:

CONFIG_WDT_QMSI_API_REENTRANCY

Jira: ZEP-440
Change-Id: Ibcd1501a4af628017b20d7e7ce20b988c8e4e4e2
Signed-off-by: Jithu Joseph <jithu.joseph@intel.com>
Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
Signed-off-by: Kuo-Lang Tseng <kuo-lang.tseng@intel.com>
2016-07-27 22:17:09 +00:00
Anas Nashif f35d6e04e3 qmsi: update qmsi to 1.1 alpha
Change-Id: Ib35ebcb32954f764ef8e33f6a1c11ad9f63931bc
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-05-23 21:30:04 +00:00