Zephyr API 3.6.99
Loading...
Searching...
No Matches

Wakeup Controller (WUC) Driver APIs . More...

Topics

 Devicetree WUC Controller API
 
 
 WUC Driver Backend API
 
 

Files

file  wuc.h
 Main header file for WUC (Wakeup Controller) driver API.
 
file  wuc_nxp_llwu.h
 NXP LLWU wakeup source encodings.
 

Data Structures

struct  wuc_dt_spec
 Wakeup controller device configuration. More...
 

Macros

#define WUC_DT_SPEC_GET_BY_IDX(node_id, idx)
 Static initializer for a wuc_dt_spec.
 
#define WUC_DT_SPEC_GET_BY_IDX_OR(node_id, idx, default_value)
 Like WUC_DT_SPEC_GET_BY_IDX(), with a fallback to a default value.
 
#define WUC_DT_SPEC_GET(node_id)
 Equivalent to WUC_DT_SPEC_GET_BY_IDX(node_id, 0).
 
#define WUC_DT_SPEC_GET_OR(node_id, default_value)
 Equivalent to WUC_DT_SPEC_GET_BY_IDX_OR(node_id, 0, default_value).
 
#define WUC_DT_SPEC_INST_GET_BY_IDX(inst, idx)
 Static initializer for a wuc_dt_spec from a DT_DRV_COMPAT instance's Wakeup Controller property at an index.
 
#define WUC_DT_SPEC_INST_GET_BY_IDX_OR(inst, idx, default_value)
 Static initializer for a wuc_dt_spec from a DT_DRV_COMPAT instance's 'wakeup-ctrls' property at an index, with fallback.
 
#define WUC_DT_SPEC_INST_GET(inst)
 Equivalent to WUC_DT_SPEC_INST_GET_BY_IDX(inst, 0).
 
#define WUC_DT_SPEC_INST_GET_OR(inst, default_value)
 Equivalent to WUC_DT_SPEC_INST_GET_BY_IDX_OR(node_id, 0, default_value).
 

Functions

static int wuc_enable_wakeup_source (const struct device *dev, uint32_t id)
 Enable a wakeup source.
 
static int wuc_enable_wakeup_source_dt (const struct wuc_dt_spec *spec)
 Enable a wakeup source using a wuc_dt_spec.
 
static int wuc_disable_wakeup_source (const struct device *dev, uint32_t id)
 Disable a wakeup source.
 
static int wuc_disable_wakeup_source_dt (const struct wuc_dt_spec *spec)
 Disable a wakeup source using a wuc_dt_spec.
 
static int wuc_check_wakeup_source_triggered (const struct device *dev, uint32_t id)
 Check if a wakeup source triggered.
 
static int wuc_check_wakeup_source_triggered_dt (const struct wuc_dt_spec *spec)
 Check if a wakeup source triggered using a wuc_dt_spec.
 
static int wuc_clear_wakeup_source_triggered (const struct device *dev, uint32_t id)
 Clear a wakeup source triggered status.
 
static int wuc_clear_wakeup_source_triggered_dt (const struct wuc_dt_spec *spec)
 Clear a wakeup source triggered status using a wuc_dt_spec.
 

Detailed Description

Wakeup Controller (WUC) Driver APIs .

Since
4.4
Version
0.1.0

Macro Definition Documentation

◆ WUC_DT_SPEC_GET

#define WUC_DT_SPEC_GET ( node_id)

#include <zephyr/drivers/wuc.h>

Value:
#define WUC_DT_SPEC_GET_BY_IDX(node_id, idx)
Static initializer for a wuc_dt_spec.
Definition wuc.h:72

Equivalent to WUC_DT_SPEC_GET_BY_IDX(node_id, 0).

Parameters
node_iddevicetree node identifier
Returns
static initializer for a struct wuc_dt_spec for the property
See also
WUC_DT_SPEC_GET_BY_IDX()

◆ WUC_DT_SPEC_GET_BY_IDX

#define WUC_DT_SPEC_GET_BY_IDX ( node_id,
idx )

#include <zephyr/drivers/wuc.h>

Value:
{.dev = DEVICE_DT_GET(DT_WUC_BY_IDX(node_id, idx)), .id = DT_WUC_ID_BY_IDX(node_id, idx)}
#define DEVICE_DT_GET(node_id)
Get a device reference from a devicetree node identifier.
Definition device.h:317
#define DT_WUC_ID_BY_IDX(node_id, idx)
Get a Wakeup Controller specifier's id cell at an index.
Definition wuc.h:173
#define DT_WUC_BY_IDX(node_id, idx)
Get the node identifier for the controller phandle from a "wakeup-ctrls" phandle-array property at an...
Definition wuc.h:51

Static initializer for a wuc_dt_spec.

This returns a static initializer for a wuc_dt_spec structure given a devicetree node identifier, a property specifying a Wakeup Controller and an index.

Example devicetree fragment:

 n: node {
    wakeup-ctrls = <&wuc 10>;
 }

Example usage:

 const struct wuc_dt_spec spec = WUC_DT_SPEC_GET_BY_IDX(DT_NODELABEL(n), 0);
 Initializes 'spec' to:
  {
          .dev = DEVICE_DT_GET(DT_NODELABEL(wuc)),
          .id = 10
  }

The 'wuc' field must still be checked for readiness, e.g. using device_is_ready(). It is an error to use this macro unless the node exists, has the given property, and that property specifies a wakeup controller wakeup source id as shown above.

Parameters
node_iddevicetree node identifier
idxlogical index into "wakeup-ctrls"
Returns
static initializer for a struct wuc_dt_spec for the property

◆ WUC_DT_SPEC_GET_BY_IDX_OR

#define WUC_DT_SPEC_GET_BY_IDX_OR ( node_id,
idx,
default_value )

#include <zephyr/drivers/wuc.h>

Value:
COND_CODE_1(DT_NODE_HAS_PROP(node_id, wakeup_ctrls), \
(WUC_DT_SPEC_GET_BY_IDX(node_id, idx)), \
(default_value))
#define DT_NODE_HAS_PROP(node_id, prop)
Does a devicetree node have a property?
Definition devicetree.h:3969
#define COND_CODE_1(_flag, _if_1_code, _else_code)
Insert code depending on whether _flag expands to 1 or not.
Definition util_macro.h:209

Like WUC_DT_SPEC_GET_BY_IDX(), with a fallback to a default value.

If the devicetree node identifier 'node_id' refers to a node with a 'wakeup-ctrls' property, this expands to WUC_DT_SPEC_GET_BY_IDX(node_id, idx). The default_value parameter is not expanded in this case.

Otherwise, this expands to default_value.

Parameters
node_iddevicetree node identifier
idxlogical index into the 'wakeup-ctrls' property
default_valuefallback value to expand to
Returns
static initializer for a struct wuc_dt_spec for the property, or default_value if the node or property do not exist

◆ WUC_DT_SPEC_GET_OR

#define WUC_DT_SPEC_GET_OR ( node_id,
default_value )

#include <zephyr/drivers/wuc.h>

Value:
WUC_DT_SPEC_GET_BY_IDX_OR(node_id, 0, default_value)
#define WUC_DT_SPEC_GET_BY_IDX_OR(node_id, idx, default_value)
Like WUC_DT_SPEC_GET_BY_IDX(), with a fallback to a default value.
Definition wuc.h:91

Equivalent to WUC_DT_SPEC_GET_BY_IDX_OR(node_id, 0, default_value).

Parameters
node_iddevicetree node identifier
default_valuefallback value to expand to
Returns
static initializer for a struct wuc_dt_spec for the property, or default_value if the node or property do not exist

◆ WUC_DT_SPEC_INST_GET

#define WUC_DT_SPEC_INST_GET ( inst)

#include <zephyr/drivers/wuc.h>

Value:
#define WUC_DT_SPEC_INST_GET_BY_IDX(inst, idx)
Static initializer for a wuc_dt_spec from a DT_DRV_COMPAT instance's Wakeup Controller property at an...
Definition wuc.h:126

Equivalent to WUC_DT_SPEC_INST_GET_BY_IDX(inst, 0).

Parameters
instDT_DRV_COMPAT instance number
Returns
static initializer for a struct wuc_dt_spec for the property
See also
WUC_DT_SPEC_INST_GET_BY_IDX()

◆ WUC_DT_SPEC_INST_GET_BY_IDX

#define WUC_DT_SPEC_INST_GET_BY_IDX ( inst,
idx )

#include <zephyr/drivers/wuc.h>

Value:
#define DT_DRV_INST(inst)
Node identifier for an instance of a DT_DRV_COMPAT compatible.
Definition devicetree.h:4222

Static initializer for a wuc_dt_spec from a DT_DRV_COMPAT instance's Wakeup Controller property at an index.

Parameters
instDT_DRV_COMPAT instance number
idxlogical index into "wakeup-ctrls"
Returns
static initializer for a struct wuc_dt_spec for the property
See also
WUC_DT_SPEC_GET_BY_IDX()

◆ WUC_DT_SPEC_INST_GET_BY_IDX_OR

#define WUC_DT_SPEC_INST_GET_BY_IDX_OR ( inst,
idx,
default_value )

#include <zephyr/drivers/wuc.h>

Value:
COND_CODE_1(DT_PROP_HAS_IDX(DT_DRV_INST(inst), wakeup_ctrls, idx), \
(default_value))
#define DT_PROP_HAS_IDX(node_id, prop, idx)
Is index idx valid for an array type property?
Definition devicetree.h:872

Static initializer for a wuc_dt_spec from a DT_DRV_COMPAT instance's 'wakeup-ctrls' property at an index, with fallback.

Parameters
instDT_DRV_COMPAT instance number
idxlogical index into the 'wakeup-ctrls' property
default_valuefallback value to expand to
Returns
static initializer for a struct wuc_dt_spec for the property, or default_value if the node or property do not exist

◆ WUC_DT_SPEC_INST_GET_OR

#define WUC_DT_SPEC_INST_GET_OR ( inst,
default_value )

#include <zephyr/drivers/wuc.h>

Value:
WUC_DT_SPEC_INST_GET_BY_IDX_OR(inst, 0, default_value)
#define WUC_DT_SPEC_INST_GET_BY_IDX_OR(inst, idx, default_value)
Static initializer for a wuc_dt_spec from a DT_DRV_COMPAT instance's 'wakeup-ctrls' property at an in...
Definition wuc.h:138

Equivalent to WUC_DT_SPEC_INST_GET_BY_IDX_OR(node_id, 0, default_value).

Parameters
instDT_DRV_COMPAT instance number
default_valuefallback value to expand to
Returns
static initializer for a struct wuc_dt_spec for the property, or default_value if the node or property do not exist

Function Documentation

◆ wuc_check_wakeup_source_triggered()

static int wuc_check_wakeup_source_triggered ( const struct device * dev,
uint32_t id )
inlinestatic

#include <zephyr/drivers/wuc.h>

Check if a wakeup source triggered.

Parameters
devPointer to the WUC device structure.
idWakeup source identifier.
Return values
1If wakeup was triggered by this source.
0If wakeup was not triggered by this source.
-errnoNegative errno code on failure.
-ENOSYSif the interface is not implemented.

◆ wuc_check_wakeup_source_triggered_dt()

static int wuc_check_wakeup_source_triggered_dt ( const struct wuc_dt_spec * spec)
inlinestatic

#include <zephyr/drivers/wuc.h>

Check if a wakeup source triggered using a wuc_dt_spec.

Parameters
specPointer to the WUC devicetree spec structure.
Return values
1If wakeup was triggered by this source.
0If wakeup was not triggered by this source.
-errnoNegative errno code on failure.
-ENOSYSif the interface is not implemented.

◆ wuc_clear_wakeup_source_triggered()

static int wuc_clear_wakeup_source_triggered ( const struct device * dev,
uint32_t id )
inlinestatic

#include <zephyr/drivers/wuc.h>

Clear a wakeup source triggered status.

Parameters
devPointer to the WUC device structure.
idWakeup source identifier.
Return values
0If successful.
-errnoNegative errno code on failure.
-ENOSYSif the interface is not implemented.

◆ wuc_clear_wakeup_source_triggered_dt()

static int wuc_clear_wakeup_source_triggered_dt ( const struct wuc_dt_spec * spec)
inlinestatic

#include <zephyr/drivers/wuc.h>

Clear a wakeup source triggered status using a wuc_dt_spec.

Parameters
specPointer to the WUC devicetree spec structure.
Return values
0If successful.
-errnoNegative errno code on failure.
-ENOSYSif the interface is not implemented.

◆ wuc_disable_wakeup_source()

static int wuc_disable_wakeup_source ( const struct device * dev,
uint32_t id )
inlinestatic

#include <zephyr/drivers/wuc.h>

Disable a wakeup source.

Parameters
devPointer to the WUC device structure.
idWakeup source identifier.
Return values
0If successful.
-errnoNegative errno code on failure.

◆ wuc_disable_wakeup_source_dt()

static int wuc_disable_wakeup_source_dt ( const struct wuc_dt_spec * spec)
inlinestatic

#include <zephyr/drivers/wuc.h>

Disable a wakeup source using a wuc_dt_spec.

Parameters
specPointer to the WUC devicetree spec structure.
Return values
0If successful.
-errnoNegative errno code on failure.

◆ wuc_enable_wakeup_source()

static int wuc_enable_wakeup_source ( const struct device * dev,
uint32_t id )
inlinestatic

#include <zephyr/drivers/wuc.h>

Enable a wakeup source.

Parameters
devPointer to the WUC device structure
idWakeup source identifier
Return values
0If successful
-errnoNegative errno code on failure

◆ wuc_enable_wakeup_source_dt()

static int wuc_enable_wakeup_source_dt ( const struct wuc_dt_spec * spec)
inlinestatic

#include <zephyr/drivers/wuc.h>

Enable a wakeup source using a wuc_dt_spec.

Parameters
specPointer to the WUC devicetree spec structure.
Return values
0If successful.
-errnoNegative errno code on failure.