Counter capture APIs.
More...
|
| static int | counter_capture_configure (const struct device *dev, uint8_t chan_id, counter_capture_flags_t flags, counter_capture_cb_t cb, void *user_data) |
| | Configure a capture channel and register its callback.
|
| |
| static int | counter_capture_configure_dt (const struct counter_capture_dt_spec *spec, counter_capture_cb_t cb, void *user_data) |
| | Configure a capture channel and register its callback using a DT spec.
|
| |
| static int | counter_capture_configure_64 (const struct device *dev, uint8_t chan_id, counter_capture_flags_t flags, counter_capture_cb_64_t cb, void *user_data) |
| | Configure a capture channel and register its callback for 64 bits ticks.
|
| |
| static int | counter_capture_configure_64_dt (const struct counter_capture_dt_spec *spec, counter_capture_cb_64_t cb, void *user_data) |
| | Configure a capture channel and register its 64-bit callback using a DT spec.
|
| |
| int | counter_enable_capture (const struct device *dev, uint8_t chan_id) |
| | Enable capture on a channel.
|
| |
| static int | counter_enable_capture_dt (const struct counter_capture_dt_spec *spec) |
| | Enable capture on a channel using a DT spec.
|
| |
| int | counter_disable_capture (const struct device *dev, uint8_t chan_id) |
| | Disable capture on a channel.
|
| |
| static int | counter_disable_capture_dt (const struct counter_capture_dt_spec *spec) |
| | Disable capture on a channel using a DT spec.
|
| |
Counter capture APIs.
[Experimental] Users should note that the APIs can change as a part of ongoing development.
◆ counter_capture_configure()
#include <zephyr/drivers/counter.h>
Configure a capture channel and register its callback.
Configures the edge polarity and capture mode (single-shot vs continuous) for a capture channel, and registers the callback that delivers captured tick values.
- Note
- The mapping from a capture channel to its input source (e.g. a physical pad or an internal signal) is vendor-specific and is not part of this API. On most SoCs the channel-to-pin association is fixed by the hardware and exposed through devicetree (typically via pinctrl or a dedicated property on the counter node). Refer to the binding for your counter device for how to select the input. Future revisions of this API may add a runtime source-selection call (e.g. counter_capture_set_source or add a source argument to this function) if SoCs with a configurable input fabric require it.
- Parameters
-
| dev | Pointer to the device structure for the driver instance |
| chan_id | Channel ID |
| flags | Configuration flags (COUNTER_CAPTURE_FLAGS) |
| cb | Callback function reference |
| user_data | Argument passed to the callback function |
- Return values
-
| 0 | If successful. |
| Negative | error code on failure |
◆ counter_capture_configure_64()
#include <zephyr/drivers/counter.h>
Configure a capture channel and register its callback for 64 bits ticks.
Configures the edge polarity and capture mode (single-shot vs continuous) for a capture channel, and registers the 64b callback that delivers captured tick values.
- Note
- The mapping from a capture channel to its input source (e.g. a physical pad or an internal signal) is vendor-specific and is not part of this API. On most SoCs the channel-to-pin association is fixed by the hardware and exposed through devicetree (typically via pinctrl or a dedicated property on the counter node). Refer to the binding for your counter device for how to select the input. Future revisions of this API may add a runtime source-selection call (e.g. counter_capture_set_source or add a source argument to this function) if SoCs with a configurable input fabric require it.
- Parameters
-
| dev | Pointer to the device structure for the driver instance |
| chan_id | Channel ID |
| flags | Configuration flags (COUNTER_CAPTURE_FLAGS) |
| cb | Callback function reference |
| user_data | Argument passed to the callback function |
- Return values
-
| 0 | If successful. |
| Negative | error code on failure |
◆ counter_capture_configure_64_dt()
#include <zephyr/drivers/counter.h>
Configure a capture channel and register its 64-bit callback using a DT spec.
- Parameters
-
| spec | Pointer to the counter capture DT spec. |
| cb | Callback function reference. |
| user_data | Argument passed to the callback function. |
- Return values
-
| 0 | If successful. |
| Negative | error code on failure. |
◆ counter_capture_configure_dt()
#include <zephyr/drivers/counter.h>
Configure a capture channel and register its callback using a DT spec.
- Parameters
-
| spec | Pointer to the counter capture DT spec. |
| cb | Callback function reference. |
| user_data | Argument passed to the callback function. |
- Return values
-
| 0 | If successful. |
| Negative | error code on failure. |
◆ counter_disable_capture()
| int counter_disable_capture |
( |
const struct device * | dev, |
|
|
uint8_t | chan_id ) |
#include <zephyr/drivers/counter.h>
Disable capture on a channel.
- Parameters
-
| dev | Pointer to the device structure for the driver instance. |
| chan_id | Channel ID. |
- Return values
-
| 0 | If successful. |
| Negative | error code on failure |
◆ counter_disable_capture_dt()
#include <zephyr/drivers/counter.h>
Disable capture on a channel using a DT spec.
- Parameters
-
| spec | Pointer to the counter capture DT spec. |
- Return values
-
| 0 | If successful. |
| Negative | error code on failure. |
◆ counter_enable_capture()
| int counter_enable_capture |
( |
const struct device * | dev, |
|
|
uint8_t | chan_id ) |
#include <zephyr/drivers/counter.h>
Enable capture on a channel.
- Parameters
-
| dev | Pointer to the device structure for the driver instance. |
| chan_id | Channel ID. |
- Return values
-
| 0 | If successful. |
| Negative | error code on failure |
◆ counter_enable_capture_dt()
#include <zephyr/drivers/counter.h>
Enable capture on a channel using a DT spec.
- Parameters
-
| spec | Pointer to the counter capture DT spec. |
- Return values
-
| 0 | If successful. |
| Negative | error code on failure. |