text stringlengths 14 100k | source stringclasses 1
value | repo stringclasses 810
values | language stringclasses 13
values |
|---|---|---|---|
<|fim_prefix|>/*
* Copyright (c) 2024 Vogl Electronic GmbH
*
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT mps_mpm54304
#include <errno.h>
#include <zephyr/device.h>
#include <zephyr/drivers/i2c.h>
#include <zephyr/drivers/regulator.h>
#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(mps_mpm5... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>ET(n), \
.regs = (VREF_Regs *)DT_INST_REG_ADDR(n), \
.vref_clock_cfg = { \
.clockSel = \
MSPM0_CLOCK_PERIPH_REG_MASK(DT_INST_CLOCKS_CELL(n, clk)), \
.divideRatio = VREF_CLOCK_DIVIDE_RATIO(n), \
}, \
}; \
\
DEVICE_DT_INST_DEFINE(n, re... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2026 Nordic Semiconductor ASA
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT nordic_npm10xx_regulator
#include <zephyr/device.h>
#include <zephyr/drivers/regulator.h>
#include <zephyr/dt-bindings/regulator/npm10xx.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr... | fim | zephyrproject-rtos/zephyr | c |
/*
* Copyright (c) 2023 Nordic Semiconductor ASA
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT nordic_npm1100
#include <errno.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/drivers/regulator.h>
#include <zephyr/dt-bindings/regulator/npm1100.h>
#include <zephyr/toolchain.h>
struct regulator... | fim | zephyrproject-rtos/zephyr | c |
/*
* Copyright (c) 2023 Nordic Semiconductor ASA
* SPDX-License-Identifier: Apache-2.0
*/
#include <errno.h>
#include <string.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/drivers/regulator.h>
#include <zephyr/drivers/mfd/npm13xx.h>
#include <zephyr/dt-bindings/regulator/npm13xx.h>
#include <zephyr/sys/line... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>(const struct device *dev, const struct gpio_dt_spec *spec)
{
const struct regulator_npm2100_config *config = dev->config;
if (spec->port == NULL) {
return 0;
}
int ret = gpio_pin_configure_dt(spec, GPIO_INPUT);
if (ret != 0) {
return ret;
}
uint8_t pin = spec->pin << 1U;
uint8_t offset = ... | fim | zephyrproject-rtos/zephyr | c |
/*
* Copyright (c) 2022 Nordic Semiconductor ASA
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT nordic_npm6001_regulator
#include <errno.h>
#include <zephyr/drivers/i2c.h>
#include <zephyr/drivers/regulator.h>
#include <zephyr/dt-bindings/regulator/npm6001.h>
#include <zephyr/sys/__assert.h>
#incl... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright Nordic Semiconductor ASA
* SPDX-License-Identifier: Apache-2.0
*/
#include <nrfx.h>
#include <errno.h>
#include <stdint.h>
#include <zephyr/drivers/regulator.h>
#include <zephyr/logging/log.h>
#include <zephyr/sys/sys_io.h>
#include <hal/nrf_vregusb.h>
LOG_MODULE_REGISTER(vregusb, CONF... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright 2023-2026 NXP
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT nxp_vref
#include <errno.h>
#include <zephyr/drivers/regulator.h>
#include <zephyr/dt-bindings/regulator/nxp_vref.h>
#include <zephyr/kernel.h>
#include <zephyr/drivers/clock_control.h>
#include <zephyr/sys/l... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright 2025 NXP
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT nxp_vrefv1
#include <zephyr/device.h>
#include <zephyr/drivers/regulator.h>
#include <zephyr/sys/linear_range.h>
#include <zephyr/drivers/clock_control.h>
#include <zephyr/dt-bindings/regulator/nxp_vref.h>
#include... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2021, 2025 NXP
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT nxp_pca9420
#include <errno.h>
#include <zephyr/kernel.h>
#include <zephyr/drivers/i2c.h>
#include <zephyr/drivers/regulator.h>
#include <zephyr/drivers/regulator/pca9420.h>
#include <zephyr/sys/linear_r... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright 2025 NXP
*
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT nxp_pca9422_regulator
#include <errno.h>
#include <zephyr/kernel.h>
#include <zephyr/drivers/regulator.h>
#include <zephyr/drivers/mfd/pca9422.h>
#include <zephyr/sys/linear_range.h>
#include <zephyr/sys/util.h... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>*dev, int32_t min_ua,
int32_t max_ua)
{
const struct regulator_pf1550_config *config = dev->config;
uint8_t val;
uint16_t idx;
int ret;
if (config->source != PF1550_PMIC_SOURCE_BUCK1 &&
config->source != PF1550_PMIC_SOURCE_BUCK2 &&
config->source != PF1550_PMIC_SOURCE_BUCK3) {
... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2023 TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT raspberrypi_core_supply_regulator
#include <zephyr/devicetree.h>
#include <zephyr/drivers/regulator.h>
#include <zephyr/dt-bindings/regulator/rpi_pico.h>
#include <zephyr... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2026 Realtek Semiconductor, Inc.
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/drivers/regulator.h>
#include <zephyr/kernel.h>
#include <zephyr/device.h>
#include <zephyr/sys/linear_range.h>
#include <zephyr/sys/util.h>
#include <zephyr/pm/device.h>
#include <zephyr/l... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2025 SiFli Technologies(Nanjing) Co., Ltd
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT sifli_sf32lb52x_ldo
#include <stdint.h>
#include <zephyr/arch/cpu.h>
#include <zephyr/device.h>
#include <zephyr/devicetree.h>
#include <zephyr/drivers/regulator.h>
#include <z... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>ev);
if (ret < 0) {
shell_error(sh, "Could not enable ship mode (%d)", ret);
return ret;
}
return 0;
}
static bool device_is_regulator(const struct device *dev)
{
return DEVICE_API_IS(regulator, dev);
}
static bool device_is_regulator_parent(const struct device *dev)
{
return DEVICE_API_IS(reg... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>_VREFBUF_INIT_PRIORITY, &api);
DT_INST_FOREACH_STATUS_OKAY(REGULATOR_STM32_VREFBUF_DEFINE)
<|fim_prefix|>/*
* Copyright 2025 CodeWrights GmbH
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT st_stm32_vrefbuf
#include <zephyr/drivers/regulator.h>
#include <zephyr/drivers/reset.h>
#inclu... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* SPDX-FileCopyrightText: Copyright The Zephyr Project Contributors
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT ti_tps55287
#include <zephyr/drivers/gpio.h>
#include <zephyr/drivers/i2c.h>
#include <zephyr/drivers/regulator.h>
#include <zephyr/logging/log.h>
#include <zephyr/sys... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>set_arm_scmi_driver_api, SCMI_RESET_PROTOCOL_SUPPORTED_VERSION);
<|fim_prefix|>/*
* Copyright 2026 EPAM Systems
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/kernel.h>
#include <zephyr/drivers/reset.h>
#include <zephyr/drivers/firmware/scmi/reset.h>
#include <zephyr/logging/log.h>
LOG_... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|> if (id >= ASPEED_RESET_GRP_1_OFFSET) {
id -= ASPEED_RESET_GRP_1_OFFSET;
addr = RESET_CTRL1_ASSERT;
}
ret = syscon_read_reg(syscon, addr, ®_value);
if (ret == 0) {
*status = !!(reg_value & BIT(id));
}
return ret;
}
static int aspeed_reset_line_toggle(const struct device *dev, uint32_t id)... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>@param id Reset line ID
*
* @retval 0 Always successful
*/
static int reset_ft9001_line_toggle(const struct device *dev, uint32_t id)
{
reset_ft9001_line_assert(dev, id);
reset_ft9001_line_deassert(dev, id);
return 0;
}
static DEVICE_API(reset, reset_ft9001_driver_api) = {
.status = reset_ft9001_... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>config = dev->config;
sys_clear_bit(config->base + GD32_RESET_ID_OFFSET(id),
GD32_RESET_ID_BIT(id));
return 0;
}
static int reset_gd32_line_toggle(const struct device *dev, uint32_t id)
{
(void)reset_gd32_line_assert(dev, id);
(void)reset_gd32_line_deassert(dev, id);
return 0;
}
static D... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2022-2023, Intel Corporation.
*
* SPDX-License-Identifier: <|fim_suffix|>intel_soc_driver_api);
DT_INST_FOREACH_STATUS_OKAY(INTEL_SOC_RESET_INIT);
<|fim_middle|>Apache-2.0
*/
#define DT_DRV_COMPAT intel_socfpga_reset
#include <zephyr/device.h>
#include <zephyr/drivers/reset.h>
#i... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright 2024 NXP
*
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT nxp_lpc_syscon_reset
#include <zephyr/device.h>
#include <zephyr/drivers/reset.h>
#include <zephyr/sys/util.h>
#include <fsl_device_registers.h>
#define LPC_RESET_OFFSET(id) (id >> 16)
#define LPC_RESET_BIT(id... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>VALID_BITS, bit)) {
return -EINVAL;
}
/* Turn on clock */
sys_set_bit(config->base + SUBBLK_CLOCK_CR_OFFSET, bit);
/* Remove soft reset */
sys_clear_bit(config->base + SOFT_RESET_CR_OFFSET, bit);
return 0;
}
static int reset_mss_line_toggle(const struct device *dev, uint32_t id)
{
reset_mss_l... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>upported by hardware.
*/
static int reset_mchp_line_toggle(const struct device *dev, uint32_t id)
{
return -ENOTSUP;
}
static DEVICE_API(reset, reset_mchp_api) = {
.status = reset_mchp_status,
.line_assert = reset_mchp_line_assert,
.line_deassert = reset_mchp_line_deassert,
.line_toggle = reset_mch... | fim | zephyrproject-rtos/zephyr | c |
/* Copyright (c) 2025 Google LLC.
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/device.h>
#include <zephyr/devicetree.h>
#include <zephyr/drivers/reset.h>
#include <zephyr/kernel.h>
struct reset_mmio_dev_config {
uint32_t base;
uint8_t num_resets;
bool active_low;
};
struct reset_mmio_dev_data {
... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2024 Nuvoton Technology Corporation.
*
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT nuvoton_npcx_rst
#include <zephyr/kernel.h>
#include <zephyr/drivers/reset.h>
#if defined(CONFIG_SOC_SERIES_NPCX7)
#include <zephyr/dt-bindings/reset/npcx7_reset.h>
#elif defined... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|> (void)reset_numaker_line_assert(dev, id);
(void)reset_numaker_line_deassert(dev, id);
return 0;
}
static DEVICE_API(reset, reset_numaker_driver_api) = {
.status = reset_numaker_status,
.line_assert = reset_numaker_line_assert,
.line_deassert = reset_numaker_line_deassert,
.line_toggle = reset_num... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>Y,
&reset_mrcc_driver_api);
<|fim_prefix|>/*
* Copyright 2025 NXP
*
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT nxp_mrcc_reset
#include <zephyr/device.h>
#include <zephyr/drivers/reset.h>
#include <zephyr/sys/util.h>
#include <fsl_device_registers.h>
#define LPC_RESET_OF... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright 2024 NXP
*
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT nxp_rstctl
#include <zephyr/device.h>
#include <zephyr/drivers/reset.h>
#include <zephyr/sys/util.h>
#include <fsl_device_registers.h>
#define NXP_RSTCTL_OFFSET(id) ((id >> 16) * sizeof(uint32_t))
#define NXP_... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>reset_block_num(id);
return 0;
}
static int reset_rpi_line_deassert(const struct device *dev, uint32_t id)
{
unreset_block_num_wait_blocking(id);
return 0;
}
static int reset_rpi_line_toggle(const struct device *dev, uint32_t id)
{
int ret;
ret = reset_rpi_line_assert(dev, id);
if (ret) {
ret... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>onfig, PRE_KERNEL_1,
CONFIG_RESET_INIT_PRIORITY, &reset_rts5817_driver_api);
BUILD_ASSERT(DT_NUM_INST_STATUS_OKAY(DT_DRV_COMPAT) <= 1,
"Only one reet instance can be supported");
<|fim_prefix|>/*
* Copyright (c) 2025 Realt<|fim_middle|>ek Semiconductor, Inc.
*
* SPDX-License-Identifier: ... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>eset, sf32lb_reset_api) = {
.status = sf32lb_reset_status,
.line_assert = sf32lb_reset_line_assert,
.line_deassert = sf32lb_reset_line_deassert,
.line_toggle = sf32lb_reset_line_toggle,
};
static const struct sf32lb_reset_config sf32lb_reset_cfg = {
.base = DT_REG_ADDR(DT_INST_PARENT(0)),
};
DEVICE... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2022 Google Inc
*
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT st_stm32_rcc_rctl
#include <zephyr/arch/cpu.h>
#include <zephyr/device.h>
#include <zephyr/devicetree.h>
#include <zephyr/drivers/reset.h>
#define STM32_RESET_CLR_OFFSET(id) (((id) >> 17U) & 0xFFFU)
... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2025 Synaptics, Inc.
*
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT syna_sr100_res<|fim_suffix|>a_config *config = dev->config;
uint32_t val;
uint32_t mask;
uint32_t sticky_reg = (id >> STI_REG) & 0xff;
uint32_t rst_reg = (id >> RST_REG) & 0xff;
if (sticky_r... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2026 Aleksandr Senin <al@meshium.net>
*
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT gd_gd32_backup_sram
#include <errno.h>
#include <string.h>
#include <zephyr/device.h>
#include <zephyr/devicetree.h>
#include <zephyr/drivers/regulator.h>
#include <zephyr/driver... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>K_SYSCALL_OBJ(dev, K_OBJ_DRIVER_RETAINED_MEM));
return z_impl_retained_mem_size(dev);
}
#include <zephyr/syscalls/retained_mem_size_mrsh.c>
static inline int z_vrfy_retained_mem_read(const struct device *dev, off_t offset,
uint8_t *buffer, size_t size)
{
K_OOPS(K_SYSCALL_OBJ(dev, K_OBJ_DRIVER_R... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2023, <|fim_suffix|>_config *config = dev->config;
return (ssize_t)config->size;
}
static int nrf_gpregret_read(const struct device *dev, off_t offset, uint8_t *buffer, size_t size)
{
const struct nrf_gpregret_config *config = dev->config;
nrf_gpregret_lock_take(dev);
memcpy(bu... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>_id)),\
.dt_size = DT_REG_SIZE(DT_PARENT(node_id))},
struct ret_mem_region {
uintptr_t dt_addr;
size_t dt_size;
};
static const struct ret_mem_region ret_mem_regions[] = {
DT_FOREACH_STATUS_OKAY(zephyr_retained_ram, _BUILD_MEM_REGION)
};
int z_nrf_retained_mem_retention_apply(void)
{
const struct... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2023, Nordic Semiconductor ASA
* Copyright (c) 2023, Bjarki Arge Andreasen
* Copyright (c) 2025 Silicon Laboratories Inc.
*
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT silabs_buram
#include <string.h>
#include <zephyr/device.h>
#include <zephyr/devicetree.h>
#... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>NT) && defined(CONFIG_DCACHE) */
zephyr_retained_mem_ram_lock_release(dev);
return err;
}
static DEVICE_API(retained_mem, zephyr_retained_mem_ram_api) = {
.size = zephyr_retained_mem_ram_size,
.read = zephyr_retained_mem_ram_read,
.write = zephyr_retained_mem_ram_write,
.clear = zephyr_retained_m... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2023, Nordic Semiconductor ASA
* Copyright (c) 2023, Bjarki Arge Andreasen
*
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT zephyr_retained_reg
#include <string.h>
#include <zephyr/device.h>
#include <zephyr/devicetree.h>
#include <zephyr/drivers/retained_mem.h>
#... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright (c) 2023 Linumiz
* Author: Sri Surya <srisurya@linumiz.com>
*/
#include <zephyr/drivers/gpio.h>
#include <zephyr/drivers/i2c.h>
#include <zephyr/drivers/rtc.h>
#include <zephyr/logging/log.h>
#include <zephyr/pm/device.h>
#include <zephyr/sys/u... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|> = false;
}
return ret;
}
static void ambiq_rtc_isr(const struct device *dev)
{
/* Clear the RTC alarm interrupt. 8*/
#if defined(CONFIG_SOC_SERIES_APOLLO3X)
am_hal_rtc_int_clear(AM_HAL_RTC_INT_ALM);
#else
am_hal_rtc_interrupt_clear(AM_HAL_RTC_INT_ALM);
#endif
#if defined(CONFIG_RTC_ALARM)
struct... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>
/**
* @brief Calculate month and day of the month according to year and day of the year.
* @param year: Actual year - 1900.
* @param yday: Day of the year.
* @param mon: Pointer to the variable that stores month, which can be 0~11.
* @note 0 represents January.
* @param mday: Pointer to the va... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>\
}; \
DEVICE_DT_INST_DEFINE(inst, &bq32002_init, NULL, &bq32002_data_##inst, \
&bq32002_config_##inst, POST_KERNEL, CONFIG_RTC_INIT_PRIORITY, \
&bq32002_driver_api);
DT_INST_FOREACH_STATUS_OKAY(BQ32002_INIT)
<|fim_prefix|>/*
* Copyright (c) 202... | fim | zephyrproject-rtos/zephyr | c |
/*
* Copyright 2025-2026 NXP
*
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT zephyr_rtc_counter
#include <zephyr/drivers/rtc.h>
#include <zephyr/drivers/counter.h>
#include <zephyr/device.h>
#include <zephyr/kernel.h>
#include <zephyr/nvmem.h>
#include <zephyr/types.h>
#include <zephyr/logging/lo... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright (c) 2026 Harpreet Saini
* Author: Harpreet Saini <sainiharpreet29@yahoo.com>
*/
#include <zephyr/drivers/spi.h>
#include <zephyr/drivers/rtc.h>
#include <zephyr/logging/log.h>
#include <zephyr/pm/device.h>
#include <zephyr/sys/util.h>
#include "... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>>sqw_freq) {
case SQW_PROP_ENUM_1HZ:
reg_val |= SQW_FREQ_1Hz;
break;
case SQW_PROP_ENUM_4096HZ:
reg_val |= SQW_FREQ_4096Hz;
break;
case SQW_PROP_ENUM_8192HZ:
reg_val |= SQW_FREQ_8192Hz;
break;
case SQW_PROP_ENUM_32768HZ:
reg_val |= SQW_FREQ_32768Hz;
break;
case SQW_PROP_ENUM_DISABLED:... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|> {
goto out_unlock;
}
timeptr->tm_sec = bcd2bin(regs[0] & DS1337_SECONDS_MASK);
timeptr->tm_min = bcd2bin(regs[1] & DS1337_MINUTES_MASK);
timeptr->tm_hour = bcd2bin(regs[2] & DS1337_HOURS_MASK);
timeptr->tm_wday = bcd2bin(regs[3] & DS1337_DAY_MASK) + DS1337_DAY_OFFSET;
timeptr->tm_mday = bcd2bin(... | fim | zephyrproject-rtos/zephyr | c |
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright (c) 2024 Gergo Vari <work@gergovari.com>
*/
/* TODO: implement user mode? */
/* TODO: implement aging offset with calibration */
/* TODO: handle century bit, external storage? */
#include <zephyr/drivers/mfd/ds3231.h>
#include "rtc_ds3231.h"
#include <zephyr... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>set to 0 */
#define DS3231_BITS_CTRL_STS_ALARM_1_FLAG BIT(0) /* can only be set to 0 */
/* Aging offset bitmask */
#define DS3231_BITS_DATA BIT(6, 0)
/* Settings bitmasks */
#define DS3231_BITS_STS_OSC BIT(0)
#define DS3231_BITS_STS_INTCTRL BIT(1)
#define DS3231_BITS_STS_SQW BIT(2)
#define DS323... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2022 Bjarki Arge Andreasen
*
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT zephyr_rtc_emul
#include <zephyr/kernel.h>
#include <zephyr/device.h>
#include <zephyr/drivers/rtc.h>
#include "rtc_utils.h"
struct rtc_emul_data;
struct rtc_emul_work_delayable {
struc... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2023 Prevas A/S
*
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT zephyr_fake_rtc
#include <zephyr/kernel.h>
#include <zephyr/device.h>
#include <zephyr/drivers/rtc.h>
#include <zephyr/drivers/rtc/rtc_fake.h>
#ifdef CONFIG_ZTEST
#include <zephyr/ztest.h>
#endif /* ... | fim | zephyrproject-rtos/zephyr | c |
/*
* Copyright (c) 2022 Bjarki Arge Andreasen
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/drivers/rtc.h>
#include <zephyr/internal/syscall_handler.h>
static inline int z_vrfy_rtc_set_time(const struct device *dev, const struct rtc_time *timeptr)
{
K_OOPS(K_SYSCALL_DRIVER_RTC(dev, set_time));
K_O... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2024 Cypress Semiconductor Corporation (an Infineon company) or
* an affiliate of Cypress Semiconductor Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @brief RTC driver for Infineon CAT1 MCU family.
*/
#include <zephyr/drivers/rtc.h>
#include <zephyr/sys/util.h>
#... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2026 ITE Corporation. All Rights Reserved.
*
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT ite_it8xxx2_rtc
#include <soc.h>
#include <zephyr/kernel.h>
#include <zephyr/device.h>
#include <zephyr/irq.h>
#include <zephyr/drivers/rtc.h>
#include <zephyr/sys/util.h>
#... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2025 Analog Devices Inc.
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/drivers/i2c.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/device.h>
#include <zephyr/sys/util.h>
#include <zephyr/logging/log.h>
#include <zephyr/drivers/rtc.h>
#include <errno.h>
#include "... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>
/** OFFSET HIGH */
#define COMPWORD_MSB_MASK GENMASK(7, 0)
/** OFFSET LOW */
#define COMPWORD_LSB_MASK GENMASK(7, 0)
/** TIMESTAMP 0 MASKS */
/** TIMESTAMP 0 SECONDS 1_128 MASKS */
#define TS0_SECONDS_1_2_MASK BIT(6)
#define TS0_SECONDS_1_4_MASK BIT(5)
#define TS0_SECONDS_1_8_MASK BIT(4)
#defin... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>void rtc_mc146818_isr(const struct device *dev)
{
struct rtc_mc146818_data * const dev_data = dev->data;
const struct rtc_mc146818_config *config = dev->config;
uint8_t regc;
ARG_UNUSED(dev_data);
/* Read register, which clears the register */
regc = mfd_mc146818_std_read(config->mfd, RTC_FLAG);
... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2025 Microchip Technology Inc.
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <stdlib.h>
#include <zephyr/kernel.h>
#include <zephyr/drivers/rtc.h>
#include <zephyr/logging/log.h>
#include <zephyr/drivers/clock_control/mchp_clock_control.h>
#include "rtc_utils.h"
#define DT_D... | fim | zephyrproject-rtos/zephyr | c |
/*
* Copyright (c) 2025-2026 Microchip Technology Inc.
*
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT microchip_rtc_g2
#include <string.h>
#include <soc.h>
#include <zephyr/device.h>
#include <zephyr/drivers/rtc.h>
#include <zephyr/drivers/syscon.h>
#include <zephyr/irq.h>
#include <zephyr/kerne... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>m mask");
return -EINVAL;
}
if (!validate_rtc_alrm_time(time_data, data)) {
LOG_ERR("RTC time validation fail");
return -EINVAL;
}
k_sem_take(&data->sem, K_FOREVER);
regs->SECS_ALRM = (alarm_mask & RTC_ALARM_TIME_MASK_SECOND) ? (uint8_t)time_data->tm_sec
: MCHP_RTC_ALRM_DONT_CARE... | fim | zephyrproject-rtos/zephyr | c |
/*
* Copyright (c) 2024 Nuvoton Technology Corporation.
*
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT nuvoton_numaker_rtc
#include <zephyr/kernel.h>
#include <zephyr/device.h>
#include <zephyr/irq.h>
#include <zephyr/drivers/rtc.h>
#include <zephyr/sys/util.h>
#include <zephyr/logging/log.h>
#i... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright <|fim_suffix|>onfig_##n = { \
.base = (RTC_Type *)DT_INST_REG_ADDR(n), \
NXP_IRTC_CLOCK_SELECTION_INIT(n) \
.share_counter = DT_INST_PROP(n, share_counter), \
.is_... | fim | zephyrproject-rtos/zephyr | c |
/*
* Copyright 2026 NXP
*
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT nxp_rtc_analog
#include <zephyr/devicetree.h>
#include <zephyr/drivers/rtc.h>
#include <zephyr/irq.h>
#include <zephyr/kernel.h>
#include <zephyr/logging/log.h>
#include <fsl_rtc.h>
#include "rtc_utils.h"
LOG_MODULE_REGIST... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/**
* Copyright (c) 2025 Lukas Gunnarsson <lukasgunnarsson@protonmail.com>
* SPDX-License-Identifier: Apache-2.0
*
* Supported features:
* - Base RTC functionality (set/get time)
* - Alarm interrupts
*/
#include <zephyr/kernel.h>
#include <zephyr/drivers/spi.h>
#include <zephyr/drivers/rtc.h>
#inc... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2025 Fabian Blatz <fabianblatz@gmail.com>
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/init.h>
#include <zephyr/kernel.h>
#include <zephyr/sys/byteorder.h>
#include <zephyr/sys/util.h>
#include "rtc_utils.h"
#include <stdint.h>
#include <string.h>
#include <zephyr/... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2019-2023 Henrik Brix Andersen <henrik@brixandersen.dk>
*
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT nxp_pcf8523
#include <zephyr/drivers/gpio.h>
#include <zephyr/drivers/i2c.h>
#include <zephyr/drivers/rtc.h>
#include <zephyr/logging/log.h>
#include <zephyr/pm... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|> {
timeptr->tm_wday = bcd2bin(regs[3] & GENMASK(2, 0));
*mask |= RTC_ALARM_TIME_MASK_WEEKDAY;
}
return 0;
}
static int pcf8563_alarm_is_pending(const struct device *dev, uint16_t id)
{
/* The description of this register is at page 7, section 8.3.2 Register Control_status_2
* There are several ... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2025 Renesas Electronics Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT renesas_ra_rtc
#include <zephyr/devicetree.h>
#include <zephyr/drivers/clock_control.h>
#include <zephyr/drivers/rtc.h>
#include <zephyr/drivers/pinctrl.h>
#include <zephyr/irq.h>... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2024 Andrew Featherstone
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/drivers/clock_control.h>
#include <zephyr/drivers/rtc.h>
#include <zephyr/irq.h>
#include <zephyr/kernel.h>
#include <zephyr/logging/log.h>
#include <zephyr/spinlock.h>
#include <hardware/irq.h>
#... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>->tm_nsec = 0;
return 0;
}
static DEVICE_API(rtc, rtc_rts5912_driver_api) = {
.set_time = rtc_rts5912_set_time,
.get_time = rtc_rts5912_get_time,
};
static int rtc_rts5912_init(const struct device *dev)
{
const struct rtc_rts5912_config *const rtc_config = dev->config;
struct rts5912_sccon_subsys ... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>rrupts and use 24 hour mode */
err = rv3028_write_reg8(dev, RV3028_REG_CONTROL2, 0);
if (err) {
return -ENODEV;
}
err = rv3028_read_regs(dev, RV3028_REG_ALARM_MINUTES, regs, sizeof(regs));
if (err) {
return -ENODEV;
}
regs[0] |= RV3028_ALARM_MINUTES_AE_M;
regs[1] |= RV3028_ALARM_HOURS_AE_H;
... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2025 Dipak Shetty
*
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT microcrystal_rv3032
#include <zephyr/kernel.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/drivers/i2c.h>
#include <zephyr/drivers/rtc.h>
#include <zephyr/logging/log.h>
#include <zephyr/sys/u... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>the alarm is enabled. */
if ((value[0] & RV8263C8_BM_ALARM_DISABLE) == 0) {
timeptr->tm_sec = bcd2bin(value[0]) & SECONDS_BITS;
(*p_mask) |= RTC_ALARM_TIME_MASK_SECOND;
}
if ((value[1] & RV8263C8_BM_ALARM_DISABLE) == 0) {
timeptr->tm_min = bcd2bin(value[1]) & MINUTES_BITS;
(*p_mask) |= RTC_ALA... | fim | zephyrproject-rtos/zephyr | c |
/*
* Copyright (c) 2024 Marcin Lyda <elektromarcin@gmail.com>
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/kernel.h>
#include <zephyr/sys/util.h>
#include <zephyr/logging/log.h>
#include <zephyr/drivers/i2c.h>
#include <zephyr/drivers/rtc.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/arch/com... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2025 Måns Ansgariusson <mansgariusson@gmail.com>
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/kernel.h>
#include <zephyr/device.h>
#include <zephyr/sys/util.h>
#include <zephyr/drivers/i2c.h>
#include <zephyr/drivers/rtc.h>
#include <zephyr/drivers/gpio.h>
#include <z... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>set_callback = rtc_sam_alarm_set_callback,
#endif /* CONFIG_RTC_ALARM */
#ifdef CONFIG_RTC_UPDATE
.update_set_callback = rtc_sam_update_set_callback,
#endif /* CONFIG_RTC_UPDATE */
#ifdef CONFIG_RTC_CALIBRATION
.set_calibration = rtc_sam_set_calibration,
.get_calibration = rtc_sam_get_calibration,
#end... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>alarm_is_pending,
.alarm_set_callback = rtc_sam0_alarm_set_callback,
#endif /* CONFIG_RTC_ALARM */
#ifdef CONFIG_RTC_CALIBRATION
.set_calibration = rtc_sam0_set_calibration,
.get_calibration = rtc_sam0_get_calibration,
#endif /* CONFIG_RTC_CALIBRATION */
};
#define ASSIGNED_CLOCKS_CELL_BY_NAME \... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>_config_##n, POST_KERNEL, CONFIG_RTC_INIT_PRIORITY, \
&rtc_sf32lb_driver_api); \
IF_ENABLED(CONFIG_RTC_ALARM, \
(static void rtc_sf32lb_irq_config_func_##n(void) ... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>ALARM_TIME_MASK_MINUTE) {
shell_print(sh, " MINUTE");
}
if (mask & RTC_ALARM_TIME_MASK_HOUR) {
shell_print(sh, " HOUR");
}
if (mask & RTC_ALARM_TIME_MASK_MONTHDAY) {
shell_print(sh, " MONTHDAY");
}
if (mask & RTC_ALARM_TIME_MASK_MONTH) {
shell_print(sh, " MONTH");
}
if (mask & RTC_ALAR... | fim | zephyrproject-rtos/zephyr | c |
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright (c) 2025 Silicon Laboratories Inc.
*/
#include <zephyr/devicetree.h>
#include <zephyr/drivers/clock_control.h>
#include <zephyr/drivers/rtc.h>
#include <zephyr/logging/log.h>
#include <zephyr/pm/device.h>
#include <zephyr/sys/util.h>
#include "rtc_utils.h"
#in... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>_PDC_TRIGGER_RTC_ALARM, MCU_PDC_MASTER_M33,
is_xtal32m_enabled ? MCU_PDC_EN_XTAL : 0);
__ASSERT(pdc_idx >= 0, "Failed to add RTC PDC entry");
da1469x_pdc_set(pdc_idx);
da1469x_pdc_ack(pdc_idx);
#endif
rtc_smartbond_100HZ_clock_cfg();
/* Timer and calendar counters will not reset after SW rese... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2023 Prevas A/S
* Copyright (c) 2023 Syslinbit
* Copyright (c) 2024 STMicroelectronics
* Copyright (c) 2025 Alexander Kozhinov <ak.alexander.kozhinov@gmail.com>
*
* SPDX-License-Identifier: Apache-2.0
*
*/
#define DT_DRV_COMPAT st_stm32_rtc
#include <errno.h>
#include <zephyr/... | fim | zephyrproject-rtos/zephyr | c |
/*
* Copyright (c) 2024 STMicroelectronics
* Copyright (c) 2025 Alexander Kozhinov <ak.alexander.kozhinov@gmail.com>
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ZEPHYR_DRIVERS_RTC_RTC_STM32_H_
#define ZEPHYR_DRIVERS_RTC_RTC_STM32_H_
/**
* ES0584 / ES0631 §2.5.2; ES0632 §2.6.2 (both Rev. 2)
* """
* RTC ... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2025 Linumiz GmbH
*
* SPDX-License-Identifier: Apache-2.0
*
*/
#define DT_DRV_COMPAT ti_mspm0_rtc
#include <zephyr/device.h>
#include <zephyr/devicetree.h>
#include <zephyr/drivers/rtc.h>
#include <zephyr/init.h>
#include <zephyr/irq.h>
#include <zephyr/kernel.h>
#include <zephyr... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2023 Bjarki Arge Andreasen
* Copyright (c) 2024 Andrew Featherstone
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <stdbool.h>
#include <stdint.h>
#include <zephyr/drivers/rtc.h>
#include "rtc_utils.h"
bool rtc_utils_validate_rtc_time(const struct rtc_time *timeptr, uint16... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2023 Bjarki Arge Andreasen
* Copyright (c) 2024 Andrew Featherstone
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ZEPHYR_DRIVERS_RTC_RTC_UTILS_H_
#define ZEPHYR_DRIVERS_RTC_RTC_UTILS_H_
#include <stdbool.h>
#in<|fim_suffix|>*
* @param timeptr The time to set
* @param mask ... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright (c) 2024 Andriy Gelman
* Author: Andriy Gelman <andriy.gelman@gmail.com>
*/
#include <zephyr/drivers/rtc.h>
#include <zephyr/logging/log.h>
#include <zephyr/sys/util.h>
#include <zephyr/kernel.h>
#include <soc.h>
#include <xmc_rtc.h>
#include ... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright 2022, 2025 NXP
*
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT nxp_imx_usdhc
#include <zephyr/kernel.h>
#include <zephyr/cache.h>
#include <zephyr/devicetree.h>
#include <zephyr/drivers/sdhc.h>
#include <zephyr/sd/sd_spec.h>
#include <zephyr/drivers/clock_control.h>
#... | fim | zephyrproject-rtos/zephyr | c |
/*
* Copyright (c) 2023 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT intel_emmc_host
#include <zephyr/kernel.h>
#include <zephyr/devicetree.h>
#include <zephyr/drivers/sdhc.h>
#include <zephyr/sd/sd_spec.h>
#include <zephyr/cache.h>
#include "intel_emmc_host.h"
#if DT_ANY_INS... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (c) 2023 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ZEPHYR_DRIVERS_DISK_EMMC_HOST_H_
#define ZEPHYR_DRI<|fim_suffix|>resp_01; /**< Response Register 0 & 1 */
volatile uint16_t resp_2; /**< Response Register 2*/
volatile uint16_t re... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright 2022 NXP
*
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT nxp_lpc_sdif
#include <zephyr/drivers/sdhc.h>
#include <zephyr/devicetree.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/drivers/pinctrl.h>
#include <zephyr/drivers/clock_control.h>
#include <zephyr/loggin... | fim | zephyrproject-rtos/zephyr | c |
/*
* Copyright (c) 2023 EPAM Systems
*
* SPDX-License-Identifier: Apache-2.0
*/
#define DT_DRV_COMPAT renesas_rcar_mmc
#include <zephyr/devicetree.h>
#include <zephyr/drivers/disk.h>
#include <zephyr/drivers/sdhc.h>
#include <zephyr/drivers/clock_control/renesas_cpg_mssr.h>
#include <zephyr/drivers/pinctrl.h>
#in... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>vice is complete (renesas) */
#define RCAR_MMC_DMA_INFO1_END_WR BIT(16) /* DMA to device is complete */
#define RCAR_MMC_DMA_INFO1_MASK 0x848
#define RCAR_MMC_DMA_INFO2 0x850
#define RCAR_MMC_DMA_INFO2_ERR_RD BIT(17)
#define RCAR_MMC_DMA_INFO2_ERR_WR BIT(16)
#define RCAR_MMC_DMA_INFO2_MASK 0x858
#defin... | fim | zephyrproject-rtos/zephyr | c |
<|fim_suffix|>R = cstor;
hsmci->HSMCI_CFG = cfg;
hsmci->HSMCI_CR = HSMCI_CR_PWSEN | HSMCI_CR_MCIEN;
return 0;
}
static int sam_hsmci_get_host_props(const struct device *dev, struct sdhc_host_props *props)
{
memset(props, 0, sizeof(*props));
props->f_max = _HSMCI_MAX_FREQ;
props->f_min = _HSMCI_MIN_FREQ;
/* hi... | fim | zephyrproject-rtos/zephyr | c |
<|fim_prefix|>/*
* Copyright (C) 2025 Microchip Technology Inc. and its subsidiaries
*
* SPDX-License-Identifier: Apache-2.0
*
*/
#define DT_DRV_COMPAT microchip_sama7g5_sdmmc
#include <zephyr/kernel.h>
#include <zephyr/cache.h>
#include <zephyr/devicetree.h>
#include <zephyr/sys/byteorder.h>
#include <zephyr/dr... | fim | zephyrproject-rtos/zephyr | c |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.