text
stringlengths
14
100k
source
stringclasses
1 value
repo
stringclasses
810 values
language
stringclasses
13 values
<|fim_prefix|>/* * Copyright (c) 2025 Philipp Steiner <philipp.steiner1987@gmail.com> * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SENSOR_LC709203F_LC709203F_H_ #define ZEPHYR_DRIVERS_SENSOR_LC709203F_LC709203F_H_ #include <zephyr/drivers/i2c.h> enum lc709203f_regs { LC709203F_REG_BEFORE_RS...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> \ EMUL_DT_INST_DEFINE(n, ltc2959_emul_init, &ltc2959_emul_data_##n, &ltc2959_emul_cfg_##n, \ &ltc2959_emul_api_i2c, NULL) DT_INST_FOREACH_STATUS_OKAY(DEFINE_LTC2959_EMUL); <|fim_prefix|>/** * Copyright (c) 2025 Nathan Winslow * SPDX-License...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> #define LTC2959_CTRL_GPIO_MODE_MASK GENMASK(4, 3) #define LTC2959_CTRL_VIN_SEL_BIT BIT(2) #define LTC2959_CTRL_RESERVED_MASK GENMASK(1, 0) #define LTC2959_CC_WRITABLE_MASK (BIT(7) | BIT(6) | BIT(3)) /* 0xC8 */ #define LTC2959_CC_RESERVED_FIXED BIT(4) /* Used when ACR is controlled via firmware */ ...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2025, Nathan Winslow <natelostintimeandspace@gmail.com> * * SPDX-License-Identifier: Apache<|fim_suffix|>NTROL = 0x02, /* Accumulated Charge (uint32_t) */ LTC2959_REG_ACC_CHARGE_3 = 0x03, LTC2959_REG_ACC_CHARGE_2 = 0x04, LTC2959_REG_ACC_CHARGE_1 = 0x05, LTC2959_REG_ACC_CHARGE_0...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>; return -EIO; } if (msgs->len != 1) { LOG_ERR("Unexpected msg0 length %d", msgs->len); return -EIO; } reg = msgs->buf[0]; /* Now process the 'read' part of the message */ msgs++; if (msgs->flags & I2C_MSG_READ) { switch (msgs->len - 1) { case 1: rc = emul_max17048_reg_re...
fim
zephyrproject-rtos/zephyr
c
/* max17048.c - Driver for max17048 battery fuel gauge */ /* * Copyright (c) 2023 Alvaro Garcia Gomez <maxpowel@gmail.com> * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT maxim_max17048 #include "max17048.h" #include <zephyr/drivers/fuel_gauge.h> #include <zephyr/kernel.h> #include <zephyr/init...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>gs { REGISTER_VCELL = 0x02, REGISTER_SOC = 0x04, REGISTER_MODE = 0x06, REGISTER_VERSION = 0x08, REGISTER_HIBRT = 0x0A, REGISTER_CONFIG = 0x0C, REGISTER_VALRT = 0x14, REGISTER_CRATE = 0x16, REGISTER_VRESET = 0x18, REGISTER_CHIP_ID = 0x19, REGISTER_STATUS = 0x1A, REGISTER_TABLE = 0x40, REGISTER...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright 2022 Google LLC * Copyright 2023 Microsoft Corporation * * SPDX-License-Identifier: Apache-2.0 * * Emulator for SBS 1.1 compliant smart battery fuel gauge. */ #ifdef CONFIG_FUEL_GAUGE #define DT_DRV_COMPAT sbs_sbs_gauge_new_api #else #define DT_DRV_COMPAT sbs_sbs_gauge #endif /* CON...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> break; case FUEL_GAUGE_SBS_REMAINING_TIME_ALARM_MINS: rc = sbs_cmd_reg_read(dev, SBS_GAUGE_CMD_REM_TIME_ALARM, &tmp_val); val->sbs_remaining_time_alarm_mins = tmp_val; break; default: rc = -ENOTSUP; } return rc; } static int sbs_gauge_do_battery_cutoff(const struct device *dev) { int rc ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>UGE_CMD_DEVICE_CHEMISTRY = 0x22, /* DeviceChemistry */ SBS_GAUGE_CMD_MANUFACTURER_DATA = 0x23, /* ManufacturerData */ }; /* * Nearly all cutoff payloads are actually a singular value that must be written twice to the fuel * gauge. For the case where it's a singular value that must only be written...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2025 Romain Paupe <rpaup<|fim_suffix|>t i2c_msg *msgs, int num_msgs, int addr) { int ret; __ASSERT_NO_MSG(msgs && num_msgs); i2c_dump_msgs_rw(target->dev, msgs, num_msgs, addr, false); switch (num_msgs) { case 1: if (msgs[0].flags & I2C_MSG_READ) { LOG_ERR("Unexpec...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>>config; uint8_t buffer[3] = {reg, 0, 0}; sys_put_be16(value, buffer + 1); int const ret = i2c_write_dt(&config->i2c, buffer, sizeof(buffer)); if (ret != 0) { LOG_ERR("i2c_write_read failed (reg 0x%02x): %d", reg, ret); return ret; } return ret; } static int sy24561_get_voltage(const struct...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2025 Romain Paupe <rpaupe@free.fr>, Franck Duriez <franck.lucien.duriez@gmail.com> * * SPDX-License-Identifier: Apache-2.0 * * Zephyr driver for SY24561 Battery Monitor * * Datasheet: * https://www.silergy.com/download/downloadFile?id=4987&type=product&ftype=note */ #pragma onc...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2023 Bjarki Arge Andreasen * * SPDX-License-Identifier: Apache-2.0 */ #include "gnss_dump.h" #include <stdlib.h> #include <zephyr/kernel.h> #include <zephyr/logging/log.h> #include <string.h> #if CONFIG_GNSS_DUMP_TO_LOG static char dump_buf[CONFIG_GNSS_DUMP_TO_LOG_BUF_SIZE]; #end...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2023 Bjarki Arge Andreasen * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_GNSS_GNSS_DUMP_H_ #define ZEPHYR_DRIVERS_GNSS_GNSS_DUMP_H_ #include <zephyr/drivers/gnss.h> /** * @brief Dump struct gnss_info as string * * @param str Destination for dumped GNSS info...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>ta->data.nav_data.bearing = 3000; data->data.nav_data.speed = 0; data->data.nav_data.altitude = 20000; } #endif /* CONFIG_GNSS_EMUL_MANUAL_UPDATE */ #ifdef CONFIG_GNSS_SATELLITES static void gnss_emul_clear_satellites(const struct device *dev) { struct gnss_emul_data *data = dev->data; data->satell...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2026 Hong Nguyen * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/kernel.h> #include <zephyr/drivers/gnss.h> #include <zephyr/drivers/gnss/gnss_publish.h> #include <zephyr/modem/chat.h> #include <zephyr/modem/backend/uart.h> #include <zephyr/logging/log.h> #include <zephyr/pm/device.h...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>script); if (ret < 0) { goto unlock_return; } unlock_return: luatos_air530z_unlock(dev); return ret; } static int luatos_air530z_set_enabled_systems(const struct device *dev, gnss_systems_t systems) { struct gnss_luatos_air530z_data *data = dev->data; gnss_systems_t supported_systems; uint8_t e...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2023 Trackunit Corporation * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/kernel.h> #include <string.h> #include <stdarg.h> #include "gnss_nmea0183.h" #include "gnss_parse.h" #define GNSS_NMEA0183_PICO_DEGREES_IN_DEGREE (1000000000000ULL) #define GNSS_NMEA0183_...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2023 Trackunit Corporation * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_GNSS_GNSS_NMEA0183_H_ #define ZEPHYR_DRIVERS_GNSS_GNSS_NMEA0183_H_ #include <zephyr/drivers/gnss.h> /** * @brief Compute NMEA0183 checksum * * @example "PAIR002" -> 0x38 * * @param s...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2023 Trackunit Corporation * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/drivers/gnss/gnss_publish.h> #include <zephyr/kernel.h> #include <zephyr/modem/chat.h> #include <string.h> #include "gnss_parse.h" #include "gnss_nmea0183.h" #include "gnss_nmea0183_match.h" s...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2023 Trackunit Corporation * * SPDX-License-Identifier: Apache-2.0 */ /* * The GNSS NMEA0183 match is a set of modem_chat match handlers and a context to be * passed to said handlers, to parse the NMEA0183 messages received from a NMEA0183 * based GNSS device. * * The conte<|f...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2023 Trackunit Corporation * Copyright (c) 2023 Bjarki Arge Andreasen * Copyright 2023 Google LLC * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/drivers/gnss.h> #include <zephyr/drivers/gnss/gnss_publish.h> #include <zephyr/modem/chat.h> #include <zephyr/modem/backen...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>onst char *str, int64_t *milli) { int ret; __ASSERT(str != NULL, "str argument must be provided"); __ASSERT(milli != NULL, "milli argument must be provided"); ret = gnss_parse_dec_to_nano(str, milli); if (ret < 0) { return ret; } (*milli) = (*milli) / GNSS_PARSE_MICRO; return 0; } int gnss_p...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2023 Trackunit Corporation * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_GNSS_GNSS_PARSE_H_ #define ZEPHYR_DRIVERS_GNSS_GNSS_PARSE_H_ #include <zephyr/types.h> /** * @brief Parse decimal string to nano parts * * @example "-1231.3512" -> -1231351200000 * *...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>mlock, K_FOREVER); STRUCT_SECTION_FOREACH(gnss_satellites_callback, callback) { if (callback->dev == NULL || callback->dev == dev) { callback->callback(dev, satellites, size); } } k_sem_give(&semlock); } #endif <|fim_prefix|>/* * Copyright (c) 2023 Trackunit Corporation * * SPDX-License-Ide...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2023 Trackunit Corporation * Copyright (c) 2023 Bjarki Arge Andreasen * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/drivers/gnss.h> #include <zephyr/drivers/gnss/gnss_publish.h> #include <zephyr/modem/chat.h> #include <zephyr/modem/backend/uart.h> #include <zephyr/kernel.h> #inclu...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2025 Croxel Inc. * Copyright (c) 2025 CogniPilot Foundation * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT u_blox_f9p #include <zephyr/kernel.h> #include <zephyr/drivers/uart.h> #include <zephyr/drivers/gnss.h> #include <zephyr/drivers/gnss/gnss_publish.h> #inc...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2024 NXP * Copyright (c) 2025 Croxel Inc. * Copyright (c) 2025 CogniPilot Foundation * * SPDX-License-Identifier: Apache-2.0 */ #include <string.h> #include <zephyr/kernel.h> #include <zephyr/drivers/uart.h> #include <zephyr/logging/log.h> #include <zephyr/modem/ubx/protocol.h> ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>S_U_BLOX_IFACE_H_ */ <|fim_prefix|>/* * Copyright (c) 2024 NXP * Copyright (c) 2025 Croxel Inc. * Copyright (c) 2025 CogniPilot Foundation * * SPDX-License-Identifier: Apache-2.0 */ #ifndef _GNSS_U_BLOX_IFACE_H_ #define _GNSS_U_BLOX_IFACE_H_ #include <zephyr/device.h> #include <zephyr/kernel.h> #in...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2024 NXP * Copyright (c) 2025 Croxel Inc. * Copyright (c) 2025 CogniPilot Foundation * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT u_blox_m8 #include <zephyr/kernel.h> #include <zephyr/drivers/gnss.h> #include <zephyr/drivers/gnss/gnss_publish.h> #include <ze...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> gnss_satellite sat = { /** TODO: Determine how to determine PRN from UBX sat info. * For now passing SV_ID. */ .prn = ubx_sat->sat[i].sv_id, .snr = ubx_sat->sat[i].cno, .elevation = ubx_sat->sat[i].elevation, .azimuth = ubx_sat->sat[i].azimuth, .system = gnss_system, .is_trac...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2023 Trackunit Corporation * Copyright (c) 2025 Croxel Inc. * Copyright (c) 2025 CogniPilot Foundation * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_GNSS_GNSS_UBX_COMM<|fim_suffix|> } satellites; #endif }; struct gnss_ubx_common_config { const struct device ...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2023 Grinn * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT adi_ad559x_gpio #include <zephyr/drivers/gpio.h> #include <zephyr/drivers/gpio/gpio_utils.h> #include <zephyr/kernel.h> #include <zephyr/sys/byteorder.h> #include <zephyr/drivers/mfd/ad559x.h> #define AD559X_GPIO_RD_POIN...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright 2024 NXP * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/kernel.h> #include <zephyr/drivers/gpio.h> #include <zephyr/drivers/gpio/gpio_utils.h> #include <zephyr/drivers/i2c.h> #include <zephyr/logging/log.h> #include <zephyr/sys/byteorder.h> #include <zephyr/drivers/mfd/ad...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>nitialized after ADS1X4S0X ADC driver"); #define GPIO_ADS1X4S0X_DEVICE(id) \ static const struct gpio_ads1x4s0x_config gpio_ads1x4s0x_##id##_cfg = { \ .common = GPIO_COMMON_CONFIG_FROM_DT_INST(id), ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>(&data->lock, key); return 0; } static int gpio_aesc_port_toggle_bits(const struct device *dev, gpio_port_pins_t mask) { volatile struct gpio_aesc_regs *gpio = DEV_GPIO(dev); struct gpio_aesc_data *data = DEV_DATA(dev); k_spinlock_key_t key; key = k_spin_lock(&data->lock); gpio->write ^...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>sponding callback registered for the pin */ gpio_fire_callbacks(&data->cb, dev, port_value); } static DEVICE_API(gpio, gpio_altera_driver_api) = { .pin_configure = gpio_altera_configure, .port_get_raw = gpio_altera_port_get_raw, .port_set_masked_raw = NULL, .port_set_bits_raw = gpio_altera_por...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>pio_pin)); k_spin_unlock(&data->lock, key); } #else am_hal_gpio_pincfg_t pincfg = am_hal_gpio_pincfg_default; int gpio_pin = pin + (dev_cfg->offset >> 2); uint32_t int_status; ret = am_hal_gpio_pinconfig_get(gpio_pin, &pincfg); if (mode == GPIO_INT_MODE_DISABLED) { pincfg.GP.cfg_b.eIntDir = AM...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2024 Realtek Semiconductor Corp. * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT realtek_ameba_gpio /* Include <soc.h> before <ameba_soc.h> to avoid redefining unlikely() macro */ #include <soc.h> #include <ameba_soc.h> #include <zephyr/drivers/gpio.h> #include <...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2021 Andes Technology Corporation * * SPDX-License-Identifier: Apache-2.0 */ /** * @file GPIO driver for the AndesTech ATCGPIO100 controller */ #incl<|fim_suffix|> /* Data Out reg. */ #define REG_DIR 0x28 /* Channel direction reg. */ #define REG_DCLR 0x...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> } end_init_int_gpio: #endif #if DT_ANY_INST_HAS_PROP_STATUS_OKAY(reset_gpios) if (!config->reset_gpio.port) { goto end_hw_reset; } if (!gpio_is_ready_dt(&config->reset_gpio)) { LOG_ERR("%s: Reset GPIO not ready", dev->name); return -ENODEV; } err = gpio_pin_configure_dt(&config->reset_gpio...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2023 Martin Kiepfer * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT x_powers_axp192_gpio #include <errno.h> #include <zephyr/drivers/gpio.h> #include <zephyr/drivers/gpio/gpio_utils.h> #include <zephyr/drivers/i2c.h> #include <zephyr/kernel.h> #include <zephyr/sy...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>0x3f; } else { return; } analog_write_reg8(analog_reg, (analog_read_reg8(analog_reg) & mask) | val); } /* Config Pin pull-up / pull-down resistors */ static void gpio_b91_config_up_down_res(volatile struct gpio_b91_t *gpio, gpio_pin_t pin, gpio_flags_t flags) { if ((flags & GPIO_PULL_UP)...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2023 Chen Xingyu <hi@xingrz.me> * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT brcm_bcm2711_gpio #include <zephyr/arch/cpu.h> #include <zephyr/device.h> #include <zephyr/drivers/gpio.h> #include <zephyr/drivers/gpio/gpio_utils.h> #include <zephyr/irq.h> #define GPIO_REG_GROUP(n,...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> return -EWOULDBLOCK; } k_mutex_lock(&data->lock, K_FOREVER); data->state ^= mask; int result = mfd_bd8lb600fs_set_outputs(config->parent_dev, data->state); k_mutex_unlock(&data->lock); return result; } static DEVICE_API(gpio, api_table) = { .pin_configure = bd8lb600fs_gpio_pin_configure, .po...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>e_init(const struct device *dev) { struct gpio_bee_data *data = dev->data; const struct gpio_bee_config *config = dev->config; const struct pinctrl_state *state; uint8_t pin_num, pad_num; int ret; (void)clock_control_on(BEE_CLOCK_CONTROLLER, (clock_control_subsys_t)&config->clkid); for (uint8_t i...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2024-2026 MASSDRIVER EI (massdriver.space) * Copyright (c) 2026 William Markezana * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT bflb_bl60x_70x_gpio #include <zephyr/drivers/gpio.h> #include <zephyr/irq.h> #include <zephyr/dt-bindings/pinctrl/bflb-common-pinctrl...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>FO_THRES_F && wo_data.left) { for (size_t i = 0; i < freesp && wo_data.left; i++) { sys_write32((uint32_t)wo_data.data[wo_data.len - wo_data.left], GLB_BASE + GLB_GPIO_CFG144_OFFSET); wo_data.left--; } freesp = bl61x_wo_free() - GPIO_BFLB_FIFO_THRES_MARGIN; } } int bl61x_wo_write_async(c...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>_data_##n; \ \ static const struct gpio_brcmstb_config gpio_brcmstb_cfg_##n = { \ .common = GPIO_COMMON_CONFIG_FROM_DT_INST(0), ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>IRECTION static int gpio_cc13xx_cc26xx_port_get_direction(const struct device *port, gpio_port_pins_t map, gpio_port_pins_t *inputs, gpio_port_pins_t *outputs) { uint32_t pin; gpio_port_pins_t ip = 0; gpio_port_pins_t op = 0; const struct gpio_driver_config *cfg = port->config; map &= ...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2024 Texas Instruments Incorporated * Copyright (c) 2024 BayLibre, SAS * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT ti_cc23x0_gpio #include <zephyr/types.h> #include <zephyr/device.h> #include <zephyr/irq.h> #include <zephyr/drivers/gpio.h> #include <zephyr/drivers/gpio/gpi...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2016, Texas Instruments Incorporated * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT ti_cc32xx_gpio #include <errno.h> #include <zephyr/device.h> #include <zephyr/drivers/gpio.h> #include <zephyr/init.h> #include <zephyr/kernel.h> #include <zephyr/sys/sys_io.h> /...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2016 Linaro Limited. * Copyright (c) 2025 Atmosic * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT arm_cmsdk_gpio #include <zephyr/kernel.h> #include <zephyr/devi<|fim_suffix|> = BIT(pin); *flags = GPIO_DISCONNECTED; if (cfg->port->outenableset & mask) { *f...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2021 Synopsys * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT snps_creg_gpio #include <errno.h> #include <zephyr/kernel.h> #include <zephyr/device.h> #include <zephyr/init.h> #include <zephyr/drivers/gpio.h> #include <zephyr/drivers/i2c.h> #include <zephyr/sys/by...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2021 Synopsys * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT cypress_cy8c95xx_gpio_port #include <errno.h> #include <zephyr/kernel.h> #include <zephyr/device.h> #include <zephyr/init.h> #include <zephyr/drivers/gpio.h> #include <zephyr/drivers/i2c.h> #include <z...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>pio_cyw43_config_##inst, POST_KERNEL, \ CONFIG_GPIO_CYW43_INIT_PRIORITY, &gpio_cyw43_api); DT_INST_FOREACH_STATUS_OKAY(GPIO_CYW43_DEFINE) <|fim_prefix|>/* * Copyright (c) 2025 John Lin * SPDX-License-Identifier: Apache-2.0 */ /** * @file * @brief GPIO driver fo...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>o_port_value_t value) { volatile struct gpio_davinci_regs *regs = DEV_REGS(dev); regs->out_data = (regs->out_data & (~mask)) | (mask & value); return 0; } static int gpio_davinci_port_set_bits_raw(const struct device *dev, gpio_port_pins_t mask) { volatile struct gpio_davinci_regs *regs = DEV...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>ort(dw_get_base(port)); bool pin_is_output, need_debounce; /* Set init value then direction */ pin_is_output = (flags & GPIO_OUTPUT) != 0U; dw_set_bit(base_addr, dir_port, pin, pin_is_output); if (pin_is_output) { if ((flags & GPIO_OUTPUT_INIT_HIGH) != 0U) { gpio_dw_port_set_bits_raw(port, BI...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/<|fim_suffix|>mon; DEVICE_MMIO_NAMED_RAM(gpio_mmio); sys_slist_t callbacks; }; #ifdef __cplusplus } #endif #endif /* ZEPHYR_DRIVERS_GPIO_GPIO_DW_H_ */ <|fim_middle|>* * Copyright (c) 2015 Intel Corporation. * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_GPIO_GPIO_DW_H_ #define...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> 0x30 #define INTMASK 0x34 #define INTTYPE_LEVEL 0x38 #define INT_POLARITY 0x3c #define INTSTATUS 0x40 #define RAW_INTSTATUS 0x44 #define PORTA_DEBOUNCE 0x48 #define PORTA_EOI 0x4c #define EXT_PORTA 0x50 #define EXT_PORTB 0x54 #define EXT_PORTC 0x58 #define EXT_PORTD ...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2023 Efinix Inc. * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT efinix_sapphire_gpio #include <zephyr/drivers/gpio/gpio_utils.h> #include <errno.h> #include <string.h> #include <zephyr/device.h> #include <zephyr/drivers/gpio.h> #include <zephyr/logging/log.h> #...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>nterrupt_configure(const struct device *port, gpio_pin_t pin, enum gpio_int_mode mode, enum gpio_int_trig trig) { int ret; struct gpio_emul_data *drv_data = (struct gpio_emul_data *)port->data; const struct gpio_emul_config *config = (const struct gpio_emul_config *)port->config; ...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2022, Basalte bv * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT zephyr_gpio_emul_sdl #include <zephyr/drivers/gpio/gpio_emul.h> #include <zephyr/kernel.h> #include <zephyr/logging/log.h> #include "gpio_emul_sdl_bottom.h" LOG_MODULE_REGISTER(gpio_emul_sdl, CONFI...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>(void *arg, SDL_Event *event) { struct gpio_sdl_data *data = arg; /* Only handle keyboard events */ switch (event->type) { case SDL_KEYDOWN: case SDL_KEYUP: break; default: return 1; } data->event_scan_code = event->key.keysym.scancode; data->key_down = event->type == SDL_KEYDOWN; return ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>tdbool.h> #include <stdint.h> #ifdef __cplusplus extern "C" { #endif /* Note: None of these are public interfaces. But internal to the SDL GPIO emulator */ #define GPIOEMULSDL_SCANCODE_UNKNOWN 0 struct gpio_sdl_data { void *dev; int (*callback)(struct gpio_sdl_data *data); int event_scan_code; boo...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2025-2026 ENE Technology Inc. * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT ene_kb106x_gpio #include <zephyr/kernel.h> #include <zephyr/drivers/gpio.h> #include <zephyr/drivers/gpio/gpio_utils.h> #include <zephyr/dt-bindings/gpio/ene-kb106x-gpio.h> #include <zep...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2023 ENE Technology Inc. * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT ene_kb1200_gpio #include <zephyr/drivers/gpio.h> #include <zephyr/kernel.h> #include <zephyr/drivers/gpio/gpio_utils.h> #include <zephyr/sys/util_macro.h> #include <zephyr/dt-bindings/gpio/en...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2020, Antmicro <www.antmicro.com> * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT quicklogic_eos_s3_gpio #include <errno.h> #include <zephyr/drivers/gpio.h> #include <zephyr/irq.h> #include <soc.h> #include <eoss3_hal_gpio.h> #include <eoss3_hal_pads.h> #include <...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2017 Intel Corporation * Copyright (c) 2021-2026 Espressif Systems (Shanghai) Co., Ltd. * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT espressif_esp32_gpio /* Include esp-idf headers first to avoid redefining BIT() macro */ #include <driver/gpio.h> #include <driver/rtc_io.h> ...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2025-2026 Espressif Systems (Shanghai) Co., Ltd. * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT espressif_esp32_lpgpio #include <soc.h> #include <errno.h> #include <zephyr/device.h> #include <zephyr/drivers/gpio.h> #include <zephyr/dt-bindings/gpio/espressif-esp3...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> } static int gpio_fxl6408_port_set_bits_raw(const struct device *dev, uint32_t mask) { return gpio_fxl6408_port_set_masked_raw(dev, mask, mask); } static int gpio_fxl6408_port_clear_bits_raw(const struct device *dev, uint32_t mask) { return gpio_fxl6408_port_set_masked_raw(dev, mask, 0);...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2021 Teslabs Engineering S.L. * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT gd_gd32_gpio #include <zephyr/drivers/gpio.h> #include <zephyr/drivers/clock_control.h> #include <zephyr/drivers/clock_control/gd32.h> #include <zephyr/drivers/interrupt_controller/gd32_exti.h> #inclu...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>errupt on static level is not supported by the hardware */ if (mode == GPIO_INT_MODE_LEVEL) { return -ENOTSUP; } if (mode == GPIO_INT_MODE_DISABLED) { GPIO_IntDisable(BIT(pin)); } else { /* Interrupt line is already in use */ if ((GPIO->IEN & BIT(pin)) != 0) { /* Check if the interrupt is ...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2023 Frontgrade Gaisler AB * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_GPIO_GPIO_GRGPIO_H_ #define ZEPHYR_DRIVERS_GPIO_GPIO_GRGPIO_H_ struct grgpio_regs { uint32_t data; /* 0x00 I/O port data register */ uint32_t output; /* 0x04 I/O port output register */ ui...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2023 Frontgrade Gaisler AB * * SPDX-License-Identifier: Apache-2.0 */ /* * Driver for GRLIB GRGPIO revision 2. * - iflag determine pending interrupt. * - interrupt map decides interrupt number if implemented. * - logic or/and/xor registers used when possible */ #define DT_DRV...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> inline int z_vrfy_gpio_get_pending_int(const struct device *dev) { K_OOPS(K_SYSCALL_DRIVER_GPIO(dev, get_pending_int)); return z_impl_gpio_get_pending_int(dev); } #include <zephyr/syscalls/gpio_get_pending_int_mrsh.c> #ifdef CONFIG_GPIO_GET_DIRECTION static inline int z_vrfy_gpio_port_get_direction(c...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2022-2023 Vestas Wind Systems A/S * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/devicetree.h> #include <zephyr/drivers/gpio.h> #include <zephyr/init.h><|fim_suffix|>ure(hogs->port, spec->pin, spec->flags); if (err < 0) { LOG_ERR("failed to configure GPIO hog fo...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2018-2019, NXP * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT nxp_imx_gpio #include <errno.h> #include <zephyr/device.h> #include <zephyr/drivers/gpio.h> #include <zephyr/irq.h> #include <soc.h> #include <zephyr/sys/util.h> #include <gpio_imx.h> #include <string....
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * SPDX-FileCopyrightText: <text>Copyright (c) 2026 Infineon Technologies AG, * or an affiliate of Infineon Technologies AG. All rights reserved.</text> * * SPDX-License-Identifier: Apache-2.0 */ /** * @brief GPIO driver functions for Infineon MCU family. */ #define DT_DRV_COMPAT infineon_gpio ...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2018-2019 Intel Corporation * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT intel_gpio /** * @file * @brief Intel GPIO Controller Driver * * The GPIO controller on Intel SoC serves * both GPIOs and Pinmuxing function. This driver provides * the GPIO function. * * Due to...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright 2020 Broadcom * Copyright 2024 Meta * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT brcm_iproc_gpio #include <zephyr/arch/common/sys_bitops.h> #include <zephyr/device.h> #include <zephyr/drivers/gpio.h> #include <zephyr/drivers/gpio/gpio_utils.h> #include <zephyr/irq...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>IO_ENABLE_DISABLE_INTERRUPT */ /* Disable GPIO interrupt */ irq_disable(gpio_irq); return 0; #ifdef CONFIG_GPIO_ENABLE_DISABLE_INTERRUPT } else if (mode == GPIO_INT_MODE_ENABLE_ONLY) { /* Only enable GPIO interrupt */ irq_enable(gpio_irq); return 0; #endif /* CONFIG_GPIO_ENABLE_DISABLE_INTERR...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2024 ITE Corporation. All Rights Reserved. * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT ite_it8801_gpio #include <zephyr/device.h> #include <zephyr/drivers/gpio.h> #include <zephyr/drivers/gpio/gpio_utils.h> #include <zephyr/drivers/i2c.h> #include <zephyr/driv...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2020 ITE Corporation. All Rights Reserved. * * SPDX-License-Identifier: Apache-2.0 * */ #include <errno.h> #include <zephyr/device.h> #include <zephyr/devicetree.h> #include <zephyr/drivers/gpio.h> #include <zephyr/dt-bindings/gpio/ite-it8xxx2-gpio.h> #include <zephyr/dt-bindings/interrupt-contr...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>umber of pins per port is 8."); \ static struct gpio_ite_data gpio_ite_data_##inst; \ static const struct gpio_ite_cfg gpio_ite_cfg_##inst = { \ .common = GPIO_COMMON_CONFIG_FROM_DT_INST(inst), ...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2022 ITE Corporation. * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT ite_it8xxx2_gpiokscan #include <errno.h> #include <zephyr/device.h> #include <zephyr/drivers/gpio.h> #include <zephyr/drivers/gpio/gpio_utils.h> #include <zephyr/dt-bindings/gpio/ite-it8xxx2-gpi...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2019-2021 Antmicro <www.antmicro.com> * Copyright (c) 2021 Raptor Engineering, LLC <sales@raptorengineering.com> * SPDX-FileCopyrightText: Copyright The Zephyr Project Contributors * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT litex_gpio #include <errno.h> #in...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>its, .port_get_raw = gpio_lmp90xxx_port_get_raw, }; BUILD_ASSERT(CONFIG_GPIO_LMP90XXX_INIT_PRIORITY > CONFIG_ADC_INIT_PRIORITY, "LMP90xxx GPIO driver must be initialized after LMP90xxx ADC " "driver"); #define GPIO_LMP90XXX_DEVICE(id) \ static const struct gpio_lmp90xxx_config gp...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2020 Seagate Technology LLC * Copyright 2022 NXP * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT nxp_lpc11u6x_gpio /** * @file * @brief GPIO driver for NXP LPC11U6X SoCs * * This driver allows to configure the GPIOs found on the LPC11U6x MCUs. * * @note See...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>get_raw, .port_set_masked_raw = gpio_m5pm1_port_set_masked_raw, .port_set_bits_raw = gpio_m5pm1_port_set_bits_raw, .port_clear_bits_raw = gpio_m5pm1_port_clear_bits_raw, .port_toggle_bits = gpio_m5pm1_port_toggle_bits, .pin_interrupt_configure = gpio_m5pm1_pin_interrupt_configure, }; static int gpio...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2024 Analog Devices Inc. * Copyright (c) 2024 Baylibre SAS * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/drivers/gpio.h> #include <zephyr/drivers/spi.h> #include <zephyr/kernel.h> #include <zephyr/sys/byteorder.h> #define LOG_LEVEL CONFIG_GPIO_LOG_LEVEL #include <ze...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>g1 { uint8_t reg_raw; struct { uint8_t FLED_SET: 1; /* BIT0 */ uint8_t SLED_SET: 1; uint8_t FLED_STRETCH: 2; uint8_t FFILTER_EN: 1; uint8_t FILTER_LONG: 1; uint8_t FLATCH_EN: 1; uint8_t LED_CURR_LIM: 1; /* BIT7 */ } reg_bits; }; union max14906_config2 { uint8_t reg_raw; struct { uint...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2024 Analog Devices Inc. * Copyright (c) 2024 Baylibre SAS * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/drivers/gpio.h> #include <zephyr/drivers/spi.h> #include <zephyr/kernel.h> #include <zephyr/sys/byteorder.h> #define LOG_LEVEL CONFIG_GPIO_LOG_LEVEL #include <ze...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2024 Analog Devices Inc. * Copyright (c) 2024 Baylibre SAS * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_GPIO_GPIO_MAX14916_H_ #define ZEPHYR_DRIVERS_GPIO_GPIO_MAX14916_H_ #define MAX14906_ENABLE 1 #define MAX14906_DISABLE 0 #define MAX149x6_MAX_PKT_SIZE 3 ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> *data = dev->data; ret = max14917_fault_check(dev); if (ret) { return ret; } data->gpios_ON ^= pins; return max14917_reg_trans_spi_diag(dev); } static DEVICE_API(gpio, gpio_max14917_api) = { .pin_configure = gpio_max14917_config, .port_get_raw = gpio_max14917_port_get_raw, .port_set_bits_ra...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|><|fim_suffix|>_dt_spec comerr_gpio; struct gpio_dt_spec fault_gpio; /* Output gpios */ struct gpio_dt_spec en_gpio; struct gpio_dt_spec sync_gpio; struct gpio_dt_spec crcen_gpio; bool crc_en; uint8_t pkt_size; }; struct max14917_data { uint8_t gpios_ON; /* GPIO states */ uint8_t gpios_fault; bo...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2024 Analog Devices Inc. * Copyright (c) 2024 Baylibre SAS * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_GPIO_GPIO_MAX149X6_H_ #define ZEPHYR_DRIVERS_GPIO_GPIO_MAX149X6_H_ #define MAX149x6_READ 0 #define MAX149x6_WRITE 1 #define MAX149X6_GET_BIT(val, i) (0x1...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>cb(const struct device *dev, struct gpio_callback *callback, bool set) { int ret; const struct gpio_adi_max22017_config *config = dev->config; struct max22017_data *data = config->parent->data; k_mutex_lock(&data->lock, K_FOREVER); ret = gpio_manage_callback(&data->callbacks_gpi, callback...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>reg_bits.max22190_WBG & data->fault1_en.reg_bits.max22190_WBGE) { uint8_t wb_val = max22190_reg_read(dev, MAX22190_WB_REG); max22190_update_wb_stat(dev, (uint8_t)wb_val); } } if (data->fault1.reg_bits.max22190_FAULT2) { /* FAULT2 */ data->fault2.reg_raw = max22190_reg_read(dev...
fim
zephyrproject-rtos/zephyr
c