This commit removes API functions and macros which were deprecated in
2.2 release. GPIO drivers are updated accordingly.
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
This change removes the hardcoded subsystem list in gen_kobject_list.py
favor of marking the relevant driver API structs with the _subsystem
sentinel.
Signed-off-by: Corey Wharton <coreyw7@fb.com>
GPIO_DIR_OUT is deprecated but allowed in devicetree bindings because
some in-tree bindings provided it in the past. GPIO_DIR_IN was the
former explicit way of representing the default direction. Put it
back so symmetry is maintained.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Use gpio_pin_t uniformly when passing pin indexes to the driver. Use
gpio_flags_t uniformly when passing flags to the driver. Change name
of pin configuration function in API function table to be consistent
with other API functions.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
There is a typedef used to store pin indexes in configuration
structures. For consistency it should also be used to identify pin
indexes in function prototypes.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
The only remaining port operations have dedicated API function table
entries. Remove the defines for access op (mode), and remove support
for access op from all implementations.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
The last external reference to these was removed when the pin
write/read functions were deprecated. Remove the syscall support, API
function table entries, and implementation from all drivers.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
These have been replaced by the appropriate call to
gpio_pin_interrupt_configure(). While the disable function could be
implemented using the new functionality, the enable function cannot
because the interrupt mode is not available. Consequently we cannot
replace these with equivalent functionality using the legacy API.
Clean up the internal implementation by removing the inaccessible
port-based enable/disable feature, leaving the pin-based capability in
place.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Remove macros and a state structure that are not used anywhere and
incompletely describe a GPIO pin specifier.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Extend the driver data structure with a field that identifies the pins
supported by the device. Document the fields and who is responsible
for maintaining them.
Update all configuration functions for specific pins to return an
error if the pin is not supported.
Update all set/get functions for specific pins to assert if the pin is
not supported.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Several declarations provided a const pointer to mutable data. Change
all declarations that are not used to change the invert field to be
pointers to const data.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
The public API for GPIO flags should use unsigned values, and for
MISRA compliance the size should not be platform-dependent. Add a
typedef for generic flags.
Also add typedefs for pin indexes and devicetree flags so these can
be safely recorded from devicetree property values without risking
loss of information if more flags are added in the future.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Extend the physical level GPIO_OUTPUT_{HIGH,LOW} configuration with
GPIO_OUTPUT_{ACTIVE,INACTIVE} for logic level initialization.
This enables use of device-tree configuration flags in calls to
gpio_pin_configure() to set the logic level without having to
determine the corresponding physical level.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
gpio_pin_interrupt_configure() is invoked from within
gpio_pin_configure() to support legacy code that combines pin and
interrupt configuration. Expressing a disabled interrupt by a zero
value for interrupt flags causes this invocation to disable interrupts
when the intent is to change only a pin configuration, such as pull
direction.
Support a distinction between explicitly disabling interrupts and
leaving the interrupt configuration unchanged.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
gpio_pin_interrupt_configure() verified that the pin was within range,
while gpio_pin_configure() did not. Make them consistent since they
take the same set of flags.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Define the mask in terms of the individual non-zero fields to isolate
from future changes to the bit position.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
The debounce flag is to be provided to the pin configuration, not the
pin interrupt configuration.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
The asserts verify that:
- Output needs to be enabled for 'Open Drain', 'Open Source' mode to be
supported.
- GPIO_LINE_OPEN_DRAIN flag can be enabled only if GPIO_SINGLE_ENDED is
enabled.
- Only one of GPIO_INT_LOW_0, GPIO_INT_HIGH_1 can be enabled for a level
interrupt.
- GPIO_INT_DEBOUNCE is not passed to gpio_pin_interrupt_configure
function.
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
A large number of sensor drivers specify GPIO_INT_DEBOUNCE to request
a debounced signal; in practice the debounce may be performed by
external components on the board. Historically this flag was ignored
on the many GPIO peripherals that do not support hardware debouncing.
Document that this flag is an exception to the normal rule that
unsupported features should be rejected by gpio_pin_configure.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
A disconnected GPIO is one that is neither an input nor an output.
This is represented by a zero-valued all-default configuration. Call
this configuration GPIO_DISCONNECTED so the intent is clear.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
External GPIO drivers may not be supported from interrupt context
because they involve blocking bus transactions. Describe the return
value for this situation, and add the I/O error to operations where it
was missing.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
The comments identifying replacement API were inadvertently removed
along with the flag that triggers deprecation warnings.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Move handling of logical flag support into gpio_pin_configure and
gpio_pin_interrupt_configure. This way drivers don't need to know
anything about logical levels.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
Move z_impl_gpio_pin_interrupt_configure before gpio_pin_configure so we
can utilize z_impl_gpio_pin_interrupt_configure in gpio_pin_configure in
the future.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Both pin sets and values encoding pin values are ultimately represented
by 32-bit unsigned integers. Provide typedefs that make the role of a
parameter explicit.
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
This commit moves interrupt configuration for a single pin from
gpio_pin_configure to gpio_pin_interrupt_configure function.
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
This commit adds following functions which work with pin logical levels
(take into account GPIO_ACTIVE_LOW flag):
- gpio_port_get, gpio_port_set_masked, gpio_port_set_bits,
gpio_port_clear_bits, gpio_port_set_clr_bits
- gpio_pin_get, gpio_pin_set
Functions which work with pin physical levels:
- gpio_port_get_raw, gpio_port_set_masked_raw, gpio_port_set_bits_raw,
gpio_port_clear_bits_raw, gpio_port_set_clr_bits_raw
- gpio_pin_get_raw, gpio_pin_set_raw
As well as functions:
- gpio_port_toggle_bits, gpio_pin_toggle_bits
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
This commit makes following changes to GPIO dt-bindings flags:
- Added GPIO_ACTIVE_LOW, GPIO_ACTIVE_HIGH to indicate pin active state.
- Added GPIO_OPEN_DRAIN, GPIO_OPEN_SOURCE to configure single ended pin
driving mode.
- Added GPIO_PULL_UP, GPIO_PULL_DOWN flags.
- GPIO_INPUT, GPIO_OUTPUT to configure pin as input or output.
- Added GPIO_OUTPUT_LOW, GPIO_OUTPUT_HIGH flags to initialize output
in low or high state.
- reworked GPIO_INT_* flags to configure pin interrupts.
- following flags were deprecated: GPIO_DIR_*, GPIO_DS_DISCONNECT_*,
GPIO_PUD_*, GPIO_INT_ACTIVE_*, GPIO_INT_DOUBLE_EDGE, GPIO_POL_*.
To be aligned with Linux DTS standard any GPIO flags that should not be
used in DTS files are moved from include/dt-bindings/gpio/gpio.h file to
include/drivers/gpio.h with an exception of several old flags which
removal would cause DTS compilation errors. Those remaining old flags
will be removed from include/dt-bindings/gpio/gpio.h at a later stage.
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
Fix minor issues in doxygen comments. Do not use typedefs for internal
driver API calls. The functions are declared directly in
`struct gpio_driver_api`. No functional changes.
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
Following functions have been deprecated for at least 2 releases. This
commit removes them:
- gpio_port_configure
- gpio_port_write
- gpio_port_read
- gpio_port_enable_callback
- gpio_port_disable_callback
Signed-off-by: Piotr Mienkowski <piotr.mienkowski@gmail.com>
Consistently place C++ use of extern "C" after all include directives,
within the negative branch of _ASMLANGUAGE if used.
The inclusion of the generated syscall files is placed outside the
extern "C" block as the generated file has its own extern "C" block.
Background from issue #17997:
Declarations that use C linkage should be placed within extern "C"
so the language linkage is correct when the header is included by
a C++ compiler.
Similarly #include directives should be outside the extern "C" to
ensure the language-specific default linkage is applied to any
declarations provided by the included header.
See: https://en.cppreference.com/w/cpp/language/language_linkage
Signed-off-by: Peter Bigot <peter.bigot@nordicsemi.no>
move misc/slist.h to sys/slist.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>
move misc/__assert.h to sys/__assert.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>
move gpio.h to drivers/gpio.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>