Zephyr API Documentation 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
Counter capture APIs

Counter capture APIs. More...

Functions

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_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.
int counter_enable_capture (const struct device *dev, uint8_t chan_id)
 Enable capture on a channel.
int counter_disable_capture (const struct device *dev, uint8_t chan_id)
 Disable capture on a channel.

Detailed Description

Counter capture APIs.

[Experimental] Users should note that the APIs can change as a part of ongoing development.

Function Documentation

◆ counter_capture_configure()

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 )
inlinestatic

#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
devPointer to the device structure for the driver instance
chan_idChannel ID
flagsConfiguration flags (COUNTER_CAPTURE_FLAGS)
cbCallback function reference
user_dataArgument passed to the callback function
Return values
0If successful.
Negativeerror code on failure

◆ counter_capture_configure_64()

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 )
inlinestatic

#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
devPointer to the device structure for the driver instance
chan_idChannel ID
flagsConfiguration flags (COUNTER_CAPTURE_FLAGS)
cbCallback function reference
user_dataArgument passed to the callback function
Return values
0If successful.
Negativeerror 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
devPointer to the device structure for the driver instance.
chan_idChannel ID.
Return values
0If successful.
Negativeerror 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
devPointer to the device structure for the driver instance.
chan_idChannel ID.
Return values
0If successful.
Negativeerror code on failure