Commit graph

11 commits

Author SHA1 Message Date
Peter Bigot bc34501892 drivers: use macro to define device structures
Replace individual device instance definitions with the macro that
expands to the equivalent change.

    F='struct device DEVICE_NAME_GET'
    git grep -l "$F" \
     | xargs sed -i -r \
       -e "s@$F"'\(([^)]*)\);@DEVICE_DECLARE(\1);@'

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-06-08 15:01:52 -04:00
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
Peter Bigot 4f16b419e8 device: avoid casting away const from config_info pointer
The driver-specific config_info structure referenced from the device
structure is marked const.  Some drivers fail to preserve that
qualifier when casting the pointer to the driver-specific structure,
violating MISRA 11.8.

Changes produced by scripts/coccinelle/const_config_info.cocci.

Some changes proposed by the script are not included because they
reveal mutation of state through the const pointer, though the
code works as long as the driver-specific object is defined without
the const qualifier.

Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
2020-05-13 18:21:52 +02: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 4cb0a5d992 drivers: silabs: Convert silabs drivers to new DT_INST macros
Convert older DT_INST_ macro use in silab drivers to the new
include/devicetree.h DT_INST macro APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-03-26 05:26:23 -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
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
Piotr Mienkowski abbd952d2b drivers: Add counter driver (RTCC) for SiLabs Gecko SoCs
This commit adds counter driver based on RTCC module for SiLabs Gecko
SoCs.

Tested with SLWSTK6061A / BRD4250B wireless starter kit.

Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
2019-06-10 22:27:25 -04:00