Commit graph

10 commits

Author SHA1 Message Date
Kumar Gala a1b77fd589 zephyr: replace zephyr integer types with C99 types
git grep -l 'u\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/u\(8\|16\|32\|64\)_t/uint\1_t/g"
	git grep -l 's\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/s\(8\|16\|32\|64\)_t/int\1_t/g"

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-06-08 08:23:57 -05:00
Martí Bolívar 7e0eed9235 devicetree: allow access to all nodes
Usually, we want to operate only on "available" device
nodes ("available" means "status is okay and a matching binding is
found"), but that's not true in all cases.

Sometimes we want to operate on special nodes without matching
bindings, such as those describing memory.

To handle the distinction, change various additional devicetree APIs
making it clear that they operate only on available device nodes,
adjusting gen_defines and devicetree.h implementation details
accordingly:

- emit macros for all existing nodes in gen_defines.py, regardless
  of status or matching binding
- rename DT_NUM_INST to DT_NUM_INST_STATUS_OKAY
- rename DT_NODE_HAS_COMPAT to DT_NODE_HAS_COMPAT_STATUS_OKAY
- rename DT_INST_FOREACH to DT_INST_FOREACH_STATUS_OKAY
- rename DT_ANY_INST_ON_BUS to DT_ANY_INST_ON_BUS_STATUS_OKAY
- rewrite DT_HAS_NODE_STATUS_OKAY in terms of a new DT_NODE_HAS_STATUS
- resurrect DT_HAS_NODE in the form of DT_NODE_EXISTS
- remove DT_COMPAT_ON_BUS as a public API
- use the new default_prop_types edtlib parameter

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-05-08 19:37:18 -05:00
Tomasz Bursztyka 97326c0445 device: Fix structure attributes access
Since struct devconfig was merged earlier into struct device, let's fix
accessing config_info, name, ... attributes everywhere via:

grep -rlZ 'dev->config->' | xargs -0 sed -i 's/dev->config->/dev->/g'

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-05-08 23:07:44 +02:00
Kumar Gala 8eafcc32db drivers: counter: sam0_tc32: rework devicetree support
Rework the devicetree to utilize new DT_INST macros and extract per
instance data for clocks from devicetree.  Move the prescaler setting
from Kconfig to devicetree as well.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-04-25 13:33:56 -05:00
Henrik Brix Andersen c894a6db4d drivers: counter: add counter_get_value(), deprecate counter_read()
Introduce a new counter API function for reading the current counter
value (counter_get_value()) and deprecate the former counter_read() in
favor of this.

Update all drivers and calling code to match the new counter API.

The previous counter driver API function for reading the current value
of the counter (counter_read()) did not support indicating whether the
read suceeded. This is fine for counters internal to the SoC where the
read always succeeds but insufficient for external counters (e.g. I2C
or SPI slaves).

Fixes #21846.

Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
2020-01-28 12:52:46 -05:00
Krzysztof Chruscinski a37fce6171 drivers: counter: Add optional flags to alarm configuration structure
Flags in alarm configuration structure will allow further extention
without breaking API. Initially, existing absolute flag was added
as the only flag.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2019-07-10 07:42:12 -05:00
Anas Nashif 7e7a9bdf88 cleanup: include/: move counter.h to drivers/counter.h
move counter.h to drivers/counter.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
Piotr Zięcik 69406e0f9c counter: Update counter API in order to provide more flexibility
This commit introduces new top_value setting configuration structure
with flag for controlling resetting of the counter during change of
top value.

Such change allows for #12068 implementation on hardware which
does not provide alarms.

Signed-off-by: Piotr Zięcik <piotr.ziecik@nordicsemi.no>
Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Signed-off-by: Benjamin Valentin <benjamin.valentin@ml-pa.com>
2019-06-25 11:05:45 +02:00
Derek Hageman 4c27e5b72e drivers: sam0: Fix deprecated IRQ macro usage
During conversion in #16937 a few IRQ macro aliases where missed
(probably due to lack of enabled test cases that compile them),
this fixes their usage.

Signed-off-by: Derek Hageman <hageman@inthat.cloud>
2019-06-24 07:21:26 -04:00
Derek Hageman a4f3e628e5 drivers: counter: Add SAM0 basic counter support
This adds support for the basic timer counter (TC) found on SAM0
series parts.  This driver only supports running the counter
in 32 bit wide mode.  Since this mode explicitly slaves the odd
counters to the even ones, only instances of the even ones are
defined.

Tested with tests/drivers/counter/counter_basic_api on SAMD21.

Signed-off-by: Derek Hageman <hageman@inthat.cloud>
2019-05-28 09:23:44 -04:00