Zephyr API Documentation 4.2.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
sf32lb.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2025 Core Devices LLC
3 * SPDX-License-Identifier: Apache-2.0
4 */
5
6#ifndef _INCLUDE_ZEPHYR_DRIVERS_CLOCK_CONTROL_SF32LB_H_
7#define _INCLUDE_ZEPHYR_DRIVERS_CLOCK_CONTROL_SF32LB_H_
8
9#include <stdint.h>
10
11#include <zephyr/device.h>
12#include <zephyr/devicetree.h>
15
22
26 const struct device *dev;
29};
30
36#define SF32LB_CLOCK_DT_SPEC_GET(node_id) \
37 { \
38 .dev = DEVICE_DT_GET(DT_CLOCKS_CTLR(node_id)), \
39 .id = DT_CLOCKS_CELL(node_id, id), \
40 }
41
48#define SF32LB_CLOCK_DT_SPEC_GET_OR(node_id, default_spec) \
49 COND_CODE_1(DT_CLOCKS_HAS_IDX(node_id, 0), \
50 (SF32LB_CLOCK_DT_SPEC_GET(node_id)), (default_spec))
51
57#define SF32LB_CLOCK_DT_INST_SPEC_GET(index) SF32LB_CLOCK_DT_SPEC_GET(DT_DRV_INST(index))
58
65#define SF32LB_CLOCK_DT_INST_SPEC_GET_OR(index, default_spec) \
66 SF32LB_CLOCK_DT_SPEC_GET_OR(DT_DRV_INST(index), default_spec)
67
75static inline bool sf3232lb_clock_is_ready_dt(const struct sf32lb_clock_dt_spec *spec)
76{
77 return device_is_ready(spec->dev);
78}
79
86static inline int sf32lb_clock_control_on_dt(const struct sf32lb_clock_dt_spec *spec)
87{
88 return clock_control_on(spec->dev, (clock_control_subsys_t)&spec->id);
89}
90
97static inline int sf32lb_clock_control_off_dt(const struct sf32lb_clock_dt_spec *spec)
98{
99 return clock_control_off(spec->dev, (clock_control_subsys_t)&spec->id);
100}
101
103
104#endif /* _INCLUDE_ZEPHYR_DRIVERS_CLOCK_CONTROL_SF32LB_H_ */
Main header file for clock control driver API.
Clocks Devicetree macro public API header file.
Devicetree main header.
void * clock_control_subsys_t
clock_control_subsys_t is a type to identify a clock controller sub-system.
Definition clock_control.h:59
static int clock_control_off(const struct device *dev, clock_control_subsys_t sys)
Disable a clock controlled by the device.
Definition clock_control.h:149
static int clock_control_on(const struct device *dev, clock_control_subsys_t sys)
Enable a clock controlled by the device.
Definition clock_control.h:126
static int sf32lb_clock_control_off_dt(const struct sf32lb_clock_dt_spec *spec)
Turn off a clock using a sf32lb_clock_dt_spec structure.
Definition sf32lb.h:97
static bool sf3232lb_clock_is_ready_dt(const struct sf32lb_clock_dt_spec *spec)
Check if the clock device is ready.
Definition sf32lb.h:75
static int sf32lb_clock_control_on_dt(const struct sf32lb_clock_dt_spec *spec)
Turn on a clock using a sf32lb_clock_dt_spec structure.
Definition sf32lb.h:86
bool device_is_ready(const struct device *dev)
Verify that a device is ready for use.
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
Runtime device structure (in ROM) per driver instance.
Definition device.h:510
SF32LB Clock DT spec.
Definition sf32lb.h:24
uint16_t id
Clock ID.
Definition sf32lb.h:28
const struct device * dev
Clock controller (RCC)
Definition sf32lb.h:26