text
stringlengths
14
100k
source
stringclasses
1 value
repo
stringclasses
810 values
language
stringclasses
13 values
<|fim_suffix|>_EP_GET_IDX(cfg->addr)].ENDPT, bd->bd_fields); return 0; } /* Initiate a new transfer, must not be used for control endpoint OUT */ static int usbfsotg_xfer_next(const struct device *dev, struct udc_ep_config *const cfg) { struct net_buf *buf; buf = udc_buf_peek(cfg); if (buf == NULL) { ...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2025 Analog Devices, Inc. * * SPDX-License-Identifier: Apache-2.0 */ #include "udc_common.h" #include <string.h> #include <stdio.h> #include <stdlib.h> #include <zephyr/kernel.h> #include <zephyr/drivers/usb/udc.h> #include <wrap_max32_usb.h> #include <zephyr/drivers/clock_contr...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright 2024-2025 NXP * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT nxp_ehci #include <string.h> #include <stdio.h> #include <stdint.h> #include <soc.h> #include <zephyr/device.h> #include <zephyr/kernel.h> #include <zephyr/sys/byteorder.h> #include <zephyr/drivers/usb/udc...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright 2024 NXP * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT nxp_lpcip3511 #include <soc.h> #include <string.h> #include <stdio.h> #include <zephyr/device.h> #include <zephyr/kernel.h> #include <zephyr/sys/byteorder.h> #include <zephyr/drivers/usb/udc.h> #include <zephyr/...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2021 Nordic Semiconductor ASA * * SPDX-License-Identifier: Apache-2.0 */ #include <string.h> #include <stdio.h> #include <soc.h> #include <zephyr/kernel.h> #include <zephyr/drivers/usb/udc.h> #include <zephyr/drivers/clock_control.h> #include <zephyr/drivers/clock_control/nrf_cloc...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> be DATA1. HSUSBD will handle the toggle by itself and needn't * extra control. */ /* Message for bottom-half processing */ /* NOTE: In Zephyr USB device stack, Setup packet is passed via * CTRL OUT EP */ msg.type = NUMAKER_USBD_MSG_TYPE_SETUP; numaker_usbd_setup_copy_to_user(dev, msg...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>_H */ <|fim_prefix|>/* * Copyright (c) 2026 Nuvoton Technology Corporation. * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_USB_UDC_NUMAKER_H #define ZEPHYR_DRIVERS_USB_UDC_NUMAKER_H #include <stdint.h> #include <soc.h> /* Dummy USBD/HSUSBD device definitions * * This is used to...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2024-2025 Renesas Electronics Corporation * * SPDX-License-Identifier: Apache-2.0 */ #include "udc_common.h" #include <soc.h> #include <zephyr/drivers/pinctrl.h> #include <zephyr/drivers/clock_control/renesas_ra_cgc.h> #include <zephyr/drivers/usb/udc.h> #include "r_usb_device.h" ...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2024 Nordic Semiconductor ASA * Copyright (c) 2021 Pete Johanson * * SPDX-License-Identifier: Apache-2.0 */ #include "udc_common.h" #include <string.h> #include <stdio.h> #include <soc.h> #include <hardware/structs/usb.h> #include <zephyr/kernel.h> #include <zephyr/sys/mem_bloc...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>shed event ep 0x%02x", ep); err = sam0_handle_evt_finished(dev, ep_cfg); if (err) { udc_submit_event(dev, UDC_EVT_ERROR, err); } if (!udc_ep_is_busy(ep_cfg)) { sam0_handle_xfer_next(dev, ep_cfg); } else { LOG_ERR("Endpoint 0x%02x busy", ep); } } } if (evt & BIT(SAM0_EV...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2026 Gerson Fernando Budke <nandojve@gmail.com> * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT atmel_sam_udp #include "udc_common.h" #include <zephyr/kernel.h> #include <zephyr/drivers/usb/udc.h> #include <zephyr/drivers/clock_control.h> #include <zephyr/drivers...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2025-2026 Gerson Fernando Budke <nandojve@gmail.com> * * SPDX-License-Identifier: Apache-2.0 */ #include "udc_common.h" #include <string.h> #include <soc.h> #include <zephyr/irq.h> #include <zephyr/kernel.h> #include <zephyr/drivers/pinctrl.h> #include <zephyr/drivers/usb/udc.h> ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> * Test_Packet mode sequence per datasheet: * 1. TSTPCKT = 1 * 2. Store data in endpoint bank * 3. Clear FIFOCON to start transmission */ volatile uint8_t *fifo = sam_usbhs_ep_fifo(0); /* Disable and reset EP0 */ base->USBHS_DEVEPT &= ~USBHS_DEVEPT_EPEN0; base->USBHS_DEVEPT |= USBH...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2023 Nordic Semiconductor ASA * * SPDX-License-Identifier: Apache-2.0 */ /* * USB device controller (UDC) driver skeleton * * This is a skeleton for a device controller driver using the UDC API. * Please use it as a starting point for a driver implementation for your * USB dev...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>#define VBUS_IRQ_PRI(inst) DT_INST_IRQ_BY_IDX(inst, 1, priority) /* * Minimal transfer size needed to use DMA. For short transfers * it may be simpler to just fill hardware FIFO with data instead * of programming DMA registers. */ #define DMA_MIN_TRANSFER_SIZE(inst) DT_INST_PROP(inst, dma_min_transfe...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> += UDC_STM32_EP0_MAX_PACKET_SIZE; /* Reset TX allocs */ for (unsigned int i = 1U; i < cfg->num_endpoints; i++) { status = HAL_PCDEx_SetTxFiFo(&priv->pcd, i, 0); __ASSERT_NO_MSG(status == HAL_OK); } } static int udc_stm32_ep_mem_config(const struct device *dev, struct udc_ep_config *ep_cfg...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>r = udc_register_ep(dev, &config->ep_cfg_in[i]); if (err != 0) { LOG_ERR("Failed to register endpoint"); return err; } } config->dev_node->priv = dev; config->make_thread(dev); LOG_INF("Device %p (max. speed %d) belongs to %s", dev, config->speed_idx, config->uhc_name); return 0; } sta...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>_buf_add(const struct device *dev, struct uhc_transfer *const xfer, struct net_buf *buf) { const struct uhc_api *api = dev->api; int ret = 0; api->lock(dev); if (xfer->queued) { ret = -EBUSY; } else { xfer->buf = buf; } api->unlock(dev); return ret; } int uhc_ep_enqueue(const...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>e is no buffer in the queue */ int uhc_xfer_append(const struct device *dev, struct uhc_transfer *const xfer); /** * @brief Helper function to send UHC event to a higher level. * * The callback would typically sends UHC even to a message queue (k_msgq). * * @param[in] dev Pointer to device...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c<|fim_suffix|>) { return max3421e_write_byte(dev, MAX3421E_REG_HIRQ, hirq); } static int max3421e_handle_bus_irq(const struct device *dev) { struct max3421e_data *priv = uhc_get_private(dev); const uint8_t hirq = priv->hirq; int ret = 0; /* Suspend operation Done Interrupt (bus su...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>U #define MAX3421E_HR_UNDEF 0x03U #define MAX3421E_HR_NAK 0x04U #define MAX3421E_HR_STALL 0x05U #define MAX3421E_HR_TOGERR 0x06U #define MAX3421E_HR_WRONGPID 0x07U #define MAX3421E_HR_BADBC 0x08U #define MAX3421E_HR_PIDERR 0x09U #define MAX3421E_HR_PKTERR 0x0AU #define MAX3421E_HR_CRCERR 0x0BU #...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright 2024 NXP * * SPDX-License-Identifier: Apache-2.0 */ #include <soc.h> #include <string.h> #include <stdio.h> #include <zephyr/device.h> #include <zephyr/kernel.h> #include <zephyr/sys/byteorder.h> #include <zephyr/init.h> #include <zephyr/drivers/usb/uhc.h> #include "uhc_common.h" #inc...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>ller driver common unlock function */ int uhc_mcux_unlock(const struct device *dev); int uhc_mcux_enable(const struct device *dev); int uhc_mcux_disable(const struct device *dev); int uhc_mcux_shutdown(const struct device *dev); /* Signal bus reset, 50ms SE0 signal */ int uhc_mcux_bus_reset(const stru...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright 2024 NXP * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT nxp_uhc_ehci #include <soc.h> #include <string.h> #include <stdio.h> #include <zephyr/device.h> #include <zephyr/kernel.h> #include <zephyr/sys/byteorder.h> #include <zephyr/init.h> #include <zephyr/drivers/usb/...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright 2024 NXP * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT nxp_uhc_ip3516hs #include <soc.h> #include <string.h> #include <stdio.h> #include <zephyr/device.h> #include <zephyr/kernel.h> #include <zephyr/sys/byteorder.h> #include <zephyr/init.h> #include <zephyr/drivers/...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright 2024 NXP * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT nxp_uhc_khci #include <soc.h> #include <string.h> #include <stdio.h> #include <zephyr/device.h> #include <zephyr/kernel.h> #include <zephyr/sys/byteorder.h> #include <zephyr/init.h> #include <zephyr/drivers/usb/uhc.h> #includ...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright 2024 NXP * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT nxp_uhc_ohci #include <soc.h> #include <string.h> #include <stdio.h> #include <zephyr/device.h> #include <zephyr/kernel.h> #include <zephyr/sys/byteorder.h> #include <zephyr/init.h> #include <zephyr/drivers/usb/...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>E_MAX_TRANSFERS) { /* No more free slots */ break; } } irq_unlock(key); } static int vrt_schedule_frame(const struct device *dev) { struct uhc_vrt_data *const priv = uhc_get_private(dev); struct uhc_vrt_frame *const frame = &priv->frame; struct uhc_vrt_slot *slot; if (priv->last_xfer == N...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2022 Nordic Semiconductor ASA * * SPDX-License-Identifier: Apache-2.0 */ #include <stdio.h> #include <zephyr/kernel.h> #include <zephyr/init.h> #include <zephyr/sys/dlist.h> #include <zephyr/sys/iterable_sections.h> #include "uvb.h" #include <zephyr/logging/log.h> LOG_MODULE_REGI...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2022 Nordic Semiconductor ASA * * SPDX-License-Identifier: Apache-2.0 */ /** * @file * @brief USB virtual bus service */ #ifndef ZEPHYR_INCLUDE_UVB #define ZEPHYR_INCLUDE_UVB #include <zephyr/sys/atomic.h> #include <zephyr/sys/dlist.h> #include <zephyr/sys/iterable_sections.h> #ifdef __cpl...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> \ { \ .bus = I2C_DT_SPEC_GET(node), .irq_gpio = GPIO_DT_SPEC_GET(node, irq_gpios), \ .snk_ovp_thresh = DT_PROP(node, snk_ovp), .src_use_hv = DT_PROP(node, src_hv), \ .src_5v_ocp...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>fine NX20P3483_REG_INT1_OTP BIT(0) /** Register address - interrupt2*/ #define NX20P3483_REG_INT2 0x05 /** Bit field for sink and source routes enabled fault */ #define NX20P3483_REG_INT2_EN_ERR BIT(7) /** Bit field for reverse current fault triggered on HV sink path */ #define NX20P3...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>functions executed, 0 in case of success */ static int cmd_ppc_dump(const struct shell *sh, size_t argc, char **argv) { int ret = 0; if (argc <= 1) { DT_FOREACH_STATUS_OKAY_VARGS(usb_c_connector, CALL_IF_HAS_PPC, ppc_dump_regs); } else { const struct device *dev = shell_device_get_binding(argv[1]...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2024 Nuvoton Technology Corporation. * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT nuvoton_numaker_ppc #include <zephyr/kernel.h> #include <zephyr/drivers/usb_c/usbc_ppc.h> #include <zephyr/drivers/clock_control.h> #include <zephyr/drivers/clock_control/clock_co...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>nt16_t tcpci_rev; int ret; LOG_INF("Initializing FUSB307 chip: %s", data->dev->name); ret = tcpci_tcpm_get_status_register(&cfg->bus, TCPC_POWER_STATUS, (uint16_t *)&power_reg); if (ret != 0 || (power_reg & TCPC_REG_POWER_STATUS_UNINIT)) { data->init_retries++; if (data->init_retries > CONFIG_U...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> of VBUS Measurement, at least greater than 3ms */ #define FUSB307_T_VBUS_SAMPLE 4 /* ms */ #endif /* ZEPHYR_DRIVERS_USBC_TCPC_FUSB307_H_ */ <|fim_prefix|>/* * Copyright (c) 2025 Jianxiong Gu <jianxiong.gu@outlook.com> * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_USBC_TCPC_FUSB307_...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>ister(&cfg->bus, TCPC_POWER_STATUS, (uint16_t *)&power_reg); if (ret != 0 || (power_reg & TCPC_REG_POWER_STATUS_UNINIT)) { data->init_retries++; if (data->init_retries > CONFIG_USBC_TCPC_PS8XXX_INIT_RETRIES) { LOG_ERR("Chip didn't respond"); return; } LOG_DBG("Postpone chip initialization...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>ifier: Apache-2.0 */ /* Note: The Product ID will read as 0x8803 if the firmware has malfunctioned in 8705, 8755 and * 8805. Also the Product ID can be invalid if chip is before or during the power-up and * initialization process. */ #define PS8705_PRODUCT_ID 0x8705 #define PS8745_PRODUCT_ID 0x8745 #...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2024 Jianxiong Gu <jianxiong.gu@outlook.com> * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/device.h> #include <zephyr/logging/log.h> #include <zephyr/drivers/gpio.h> #include <zephyr/drivers/i2c.h> #include <zephyr/drivers/usb_c/tcpci_priv.h> #include <zephyr/usb_c/usbc....
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> VBUS detection enable */ #define RT1715_REG_SYS_CTRL_1_VBUS_DETECT_EN BIT(1) /** 24M oscillator for BMC communication */ #define RT1715_REG_SYS_CTRL_1_BMCIO_OSC_EN BIT(0) #define RT1715_REG_OCP 0x93 /** VCONN over-current control selection */ #define RT1715_REG_OCP_BMCIO_VCON_OC...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright 2023 Google LLC * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/device.h> #include <zephyr/logging/log.h> #include <zephyr/usb_c/usbc.h> #include <zephyr/shell/shell.h> /** Macro used to call the dump_std_reg function from the TCPC device pointer */ #define TCPC_DUMP_DEV(dev)...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright 2024 Google LLC * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/device.h> #include <zephyr/logging/log.h> #include <zephyr/sys/util.h> #include <zephyr/kernel.h> #include <zephyr/usb_c/usbc.h> #include <zephyr/usb_c/tcpci.h> #include <zephyr/sys/byteorder.h> #include <zephyr/d...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> \ .vbscale = NUMAKER_UTCPD_VBUS_DIVIDE_CAST(inst), \ } #define NUMAKER_UTCPD_INIT(inst) \ { ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> bool enable); int numaker_tcpc_ppc_set_vbus_discharge(const struct device *dev, bool enable); int numaker_tcpc_ppc_is_vbus_present(const struct device *dev); int numaker_tcpc_ppc_set_event_handler(const struct device *dev, usbc_ppc_event_cb_t handler, void *data); int numaker_tcpc_ppc_dump_reg...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright 2022 The Chromium OS Authors * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT st_stm32_ucpd #include <zephyr/logging/log.h> LOG_MODULE_REGISTER(ucpd_stm32, CONFIG_USBC_LOG_LEVEL); #include <stm32_bitops.h> #include <zephyr/device.h> #include <zephyr/sys/util.h> #inclu...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> uint16_t header; /* Power Deliver message data including the message header */ uint8_t msg[UCPD_BUF_LEN]; }; /** * @brief Struct used for transmitting a power delivery message */ struct ucpd_tx_desc { /* Type of the message */ enum pd_packet_type type; /* Length of the message */ int msg_len; /...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright 2022 The Chromium OS Authors * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT zephyr_usb_c_vbus_adc #include <zephyr/logging/log.h> LOG_MODULE_REGISTER(usbc_vbus_adc, CONFIG_USBC_LOG_LEVEL); #include <zephyr/device.h> #include <zephyr/sys/util.h> #include <zephyr/kern...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2022 The Chromium OS Authors * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_USBC_VBUS_ADC_PRIV_H_ #define ZEPHYR_DRIVERS_USBC_VBUS_ADC_PRIV_H_ #include <zephyr/drivers/gpio.h> #include <zephyr/drivers/adc.h> /** * @<|fim_suffix|>ce sequence; }; #endif /* ZEP...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> @retval 0 on success * @retval -EIO on failure */ static int numaker_vbus_discharge(const struct device *dev, bool enable) { const struct numaker_vbus_config *const config = dev->config; const struct device *tcpc_dev = config->tcpc_dev; return numaker_tcpc_vbus_discharge(tcpc_dev, enable); } /** ...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright 2024 Google LLC * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT zephyr_usb_c_vbus_tcpci #include <zephyr/logging/log.h> LOG_MODULE_REGISTER(usbc_vbus_tcpci, CONFIG_USBC_LOG_LEVEL); #include <zephyr/device.h> #include <zephyr/kernel.h> #include <zephyr/drivers/i2c.h> #include <zephyr/...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>ate */ return video_modify_cci_reg(&cfg->i2c, GC2145_REG_AMODE1, GC2145_REG_AMODE1_MIRROR, drv_data->ctrls.hflip.val ? GC2145_REG_AMODE1_MIRROR : 0); case VIDEO_CID_VFLIP: /* Set the vertical flip state */ return video_modify_cci_reg(&cfg->i2c, GC2145_REG_AMODE1, GC2145_REG_AMODE1...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright The Zephyr Project Contributors * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT himax_hm01b0 #include <zephyr/drivers/gpio.h> #include <zephyr/drivers/i2c.h> #include <zephyr/drivers/video-controls.h> #include <zephyr/drivers/video.h> #include <zephyr/kernel.h> #inclu...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright The Zephyr Project Contributors * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT himax_hm0360 #include <zephyr/drivers/gpio.h> #include <zephyr/drivers/i2c.h> #include <zephyr/drivers/video.h> #include <zephyr/drivers/video-controls.h> #include <zephyr/logging/log.h> ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>rn ret; } drv_data->fmt = *fmt; return 0; } static int imx219_get_fmt(const struct device *dev, struct video_format *fmt) { struct imx219_data *drv_data = dev->data; *fmt = drv_data->fmt; return 0; } static int imx219_get_caps(const struct device *dev, struct video_caps *caps) { if (caps->typ...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2025 STMicroelectronics. * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT sony_imx335 #include <zephyr/kernel.h> #include <zephyr/device.h> #include <zephyr/drivers/i2c.h> #include <zephyr/drivers/gpio.h> #include <zephyr/drivers/video.h> #include <zephyr/drivers/v...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>SIZE(resolution_configs); i++) { if (fmt->width == resolution_configs[i].width && fmt->height == resolution_configs[i].height) { ret = mt9m114_write_all(dev, resolution_configs[i].params); if (ret) { LOG_ERR("Unable to set resolution"); return ret; } break; } } /* Apply C...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2021 Antmicro <www.antmicro.com> * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT ovti_ov2640 #include <zephyr/kernel.h> #include <zephyr/device.h> #include <zephyr/logging/log.h> #include <zephyr/drivers/video.h> #include <zephyr/drivers/video-controls.h> #include...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright 2024 NXP * Copyright (c) 2025, Charles Dias * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT ovti_ov5640 #include <zephyr/kernel.h> #include <math.h> #include <stdlib.h> #include <zephyr/device.h> #include <zephyr/logging/log.h> #include <zephyr/sys/byteorder.h> #incl...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * SPDX-License-Identifier: Apache-2.0 * * Copyright (c) 2025 Silicon Signals Pvt. Ltd. * * Author: Hardevsinh Palaniya <hardevsinh.palaniya@siliconsignals.io> * Author: Rutvij Trivedi <rutvij.trivedi@siliconsignals.io> */ #define DT_DRV_COMPAT ovti_ov5642 #include <math.h> #include <stdlib.h> ...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright 2024 NXP * Copyright (c) 2025 Michael Smorto * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT ovti_ov7670 #include <zephyr/drivers/gpio.h> #include <zephyr/drivers/i2c.h> #include <zephyr/drivers/video.h> #include <zephyr/drivers/video-controls.h> #include <zephyr/logging/log.h> #...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>>i2c, OV7725_VER, &ver); if (ret) { LOG_ERR("Unable to read VER"); return -ENODEV; } if (OV7725_REVISION != (((uint32_t)pid << 8U) | (uint32_t)ver)) { LOG_ERR("OV7725 Get Vision fail\n"); return -ENODEV; } /* Device identify OK, perform software reset. */ ov7725_write_reg(&cfg->i2c, OV7725...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright 2025 ST Microelectronics * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT ovti_ov9655 #include <zephyr/drivers/gpio.h> #include <zephyr/drivers/i2c.h> #include <zephyr/drivers/video.h> #include <zephyr/logging/log.h> #include "video_common.h" #include "video_device.h" LOG_MODULE_R...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/** * Copyright (c) 2023 Arducam Technology Co., Ltd. <www.arducam.com> * Copyright The Zephyr Project Contributors * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT arducam_mega #include <zephyr/device.h> #include <zephyr/drivers/spi.h> #include <zephyr/drivers/video-controls.h> #in...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2019, Linaro Limited * Copyright (c) 2024-2025, tinyVision.ai Inc. * Copyright (c) 2026 NXP * * SPDX-License-Identifier: Apache-2.0 */ #include <string.h> #include <zephyr/device.h> #include <zephyr/drivers/i2c.h> #include <zephyr/video/video.h> #include <zephyr/drivers/video-co...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2025 tinyVision.ai Inc. * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_VIDEO_COMMON_H_ #define ZEPHYR_DRIVERS_VIDEO_COMMON_H_ #include <stddef.h> #include <zephyr/device.h> #include <zephyr/drivers/i2c.h> #include <zephyr/kernel.h> #include <zephyr/sys/util.h> #include <zeph...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>0x%x is write-only\n", control->id); return -EACCES; } if (ctrl->flags & VIDEO_CTRL_FLAG_VOLATILE) { if (DEVICE_API_GET(video, ctrl->vdev->dev)->get_volatile_ctrl == NULL) { return -ENOSYS; } /* Call driver's get_volatile_ctrl */ ret = DEVICE_API_GET(video, ctrl->vdev->dev) ->get...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright 2025 NXP * * SPDX-License-Identifier: Apache-2.0 */ #<|fim_suffix|>*/ VIDEO_CTRL_TYPE_STRING = 5, /** Menu integer type, standard or driver-defined menu */ VIDEO_CTRL_TYPE_INTEGER_MENU = 6, }; struct video_device; /** * @see video_control for the struct used in public API */ stru...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> if (vdev->dev == dev) { return vdev; } } return NULL; } <|fim_prefix|>/* * Copyright 2025 NXP * * SPDX-License-Identifier: Apache-2.0 */ #include "video_device.h" struct vid<|fim_middle|>eo_device *video_find_vdev(const struct device *dev) { if (!dev) { return NULL; } STRUCT_SECTION...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>HYR_INCLUDE_DRIVERS_VIDEO_VIDEO_DEVICE_H_ #include <zephyr/device.h> #include <zephyr/sys/dlist.h> struct video_device { const struct device *dev; const struct device *src_dev; sys_dlist_t ctrls; }; #define VIDEO_DEVICE_DEFINE(name, device, source) \ ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>\ }; \ \ DEVICE_DT_INST_DEFINE(inst, &emul_imager_init, NULL, &emul_imager_data_##inst, \ &emul_...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>onfig; return video_get_caps(cfg->source_dev, caps); } static int emul_rx_set_stream(const struct device *dev, bool enable, enum video_buf_type type) { const struct emul_rx_config *cfg = dev->config; /* A real hardware driver would first start / stop its own peripheral */ return enable ? video_stre...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2024 espros photonics Co. * Copyright (c) 2024 Espressif Systems (Shanghai) CO LTD. * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT espressif_esp32_lcd_cam_dvp #include <hal/gdma_channel.h> #include <zephyr/device.h> #include <zephyr/drivers/clock_control/esp32_c...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>config video_mcux_csi_config_0 = { .base = (CSI_Type *)DT_INST_REG_ADDR(0), .source_dev = SOURCE_DEV(0), .pincfg = PINCTRL_DT_INST_DEV_CONFIG_GET(0), }; static struct video_mcux_csi_data video_mcux_csi_data_0; static int video_mcux_csi_init_0(const struct device *dev) { struct video_mcux_csi_data *d...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>dev->data; int ret; uint32_t est_pixel_rate; struct video_frmival cur_frmival; struct video_format cur_fmt; struct video_control sensor_rate = {.id = VIDEO_CID_PIXEL_RATE, .val64 = -1}; ret = video_enum_frmival(config->sensor_dev, fie); if (ret) { return ret; } ret = video_get_frmival(config-...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>ved = true; } else { data->params.p_buffer_ping_pong = (uint32_t *)data->queued_buf->buffer; } } else { if (data->stream_starved) { /* Signal any waiting threads */ k_sem_give(&data->stream_empty); } data->active_buf->line_offset = (data->frame_idx / 2) * SDMA_LINE_COUNT; data->activ...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2025 Renesas Electronics Co. * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT renesas_ra_ceu #include <zephyr/drivers/clock_control.h> #include <zephyr/drivers/pinctrl.h> #include <zephyr/drivers/video.h> #include <zephyr/irq.h> #include <zephyr/logging/log.h> #inc...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright The Zephyr Project Contributors * * SPDX-License-Identifier: Apache-2.0 */ #include <ctype.h> #include <stdio.h> #include <stdlib.h> #include <zephyr/device.h> #include <zephyr/drivers/video-controls.h> #include <zephyr/drivers/video.h> #include <zephyr/shell/shell.h> #include <zephyr...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>t_desc(caps->format_caps[i].pixelformat); if (!desc) { continue; } drv_data->caps[ind] = caps->format_caps[i]; drv_data->caps[ind].pixelformat = desc->pixelformat; ind++; if (ind == caps_nb) { memset(&drv_data->caps[ind], 0, sizeof(drv_data->caps[ind])); break; } } caps->forma...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2024 Charles Dias <charlesdias.cd@outlook.com> * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT st_stm32_dcmi #include <errno.h> #include <zephyr/kernel.h> #include <zephyr/irq.h> #include <zephyr/logging/log.h> #include <zephyr/drivers/video.h> #include <zephyr/d...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>_TGT_NATIVE_SIZE: sel->rect.top = 0; sel->rect.left = 0; sel->rect.width = dcmipp->source_fmt.width; sel->rect.height = dcmipp->source_fmt.height; break; default: return -EINVAL; }; return 0; } static DEVICE_API(video, stm32_dcmipp_driver_api) = { .set_format = stm32_dcmipp_set_fmt, .ge...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> VIDEO_BUF_TYPE_INPUT ? &data->m2m.in : &data->m2m.out; int ret = 0; k_mutex_lock(&data->lock, K_FOREVER); /* Input & Output resolutions are always same so ensure this here */ if (data->m2m.in.fmt.width != data->m2m.out.fmt.width || data->m2m.in.fmt.height != data->m2m.out.fmt.height) { LOG_E...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>q_fuse_cnt); } else { /* if there was a frame previously, set as predicted */ enc_in.timeIncrement = 1; enc_in.codingType = H264ENC_PREDICTED_FRAME; } enc_in.ipf = H264ENC_REFERENCE_AND_REFRESH; enc_in.ltrf = H264ENC_REFERENCE; /* set input buffers to structures */ enc_in.busLuma = (ptr_t)in...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2019, Linaro Limited * Copyright 2026 NXP * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT zephyr_video_sw_generator #include <zephyr/drivers/video-controls.h> #include <zephyr/drivers/video.h> #include <zephyr/kernel.h> #include <zephyr/logging/log.h> #include <z...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2025 Antmicro <www.antmicro.com> * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/logging/log.h> #include <zephyr/sys/byteorder.h> #include <zephyr/drivers/virtio.h> #include <zephyr/drivers/virtio/virtqueue.h> #include "virtio_common.h" LOG_MODULE_REGISTER(virtio_commo...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2025 Antmicro <www.antmicro.com> * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_VIRTIO_VIRTIO_COMMON_H_ <|fim_suffix|>ZEPHYR_VIRTIO_VIRTIO_COMMON_H_ #include <zephyr/drivers/virtio/virtio_config.h> /** * Common virtio isr * * @param dev virtio device it operates on ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>sion); return -EINVAL; } const uint32_t dev_id = virtio_mmio_read32(dev, VIRTIO_MMIO_DEVICE_ID); if (dev_id == VIRTIO_MMIO_INVALID_DEVICE_ID) { LOG_ERR("Invalid device id %x", dev_id); return -EINVAL; } LOG_DBG("VENDOR_ID = %x", virtio_mmio_read32(dev, VIRTIO_MMIO_VENDOR_ID)); virtio_mmio_...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>O_PCI_DEFINE(inst) \ BUILD_ASSERT(DT_NODE_HAS_COMPAT(DT_INST_PARENT(inst), pcie_controller)); \ DEVICE_PCIE_INST_DECLARE(inst); \ static struct virtio_pci_data virtio_pci_data##inst; ...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2024-2026 Antmicro <www.antmicro.com> * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/drivers/virtio/virtqueue.h> #include <zephyr/kernel.h> #include <zephyr/logging/log.h> #include <zephyr/sys/__assert.h> #include <zephyr/sys/byteorder.h> #include <zephyr/sys/barrier.h...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>, uint32_t peer_id) { struct ivshmem *data = dev->data; if (!data->ivshmem_v2 || peer_id >= data->max_peers) { return 0; } const volatile uint32_t *state_table = (const volatile uint32_t *)data->state_table_shmem; return state_table[peer_id]; } static int ivshmem_api_set_state(const...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2020 Intel Corporation. * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_VIRTUALIZATION_VIRT_IVSHMEM_H_ #define ZEPHYR_DRIVERS_VIRTUALIZATION_VIRT_IVSHMEM_H_ #include <zephyr/drivers/pcie/pcie.h> #ifdef CONFIG_IVSHMEM_DOORBELL #include <zephyr/drivers/pcie/msi.h>...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>set_state)); return z_impl_ivshmem_set_state(dev, state); } #include <zephyr/syscalls/ivshmem_set_state_mrsh.c> static inline uint32_t z_vrfy_ivshmem_get_max_peers(const struct device *dev) { K_OOPS(K_SYSCALL_DRIVER_IVSHMEM(dev, get_max_peers)); return z_impl_ivshmem_get_max_peers(dev); } #include <...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2020 Intel Corporation * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/shell/shell.h> #include <stdlib.h> #include <zephyr/drivers/virtualization/ivshmem.h> static const struct device *ivshmem = DEVICE_DT_GET_ONE(qemu_ivshmem); #ifdef CONFIG_IVSHMEM_DOORBELL #define ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>; } buffer[i] = ret; } return 0; } int z_impl_w1_write_block(const struct device *dev, const uint8_t *buffer, size_t len) { const struct w1_driver_api *api = dev->api; int ret; if (api->write_block != NULL) { return api->write_block(dev, buffer, len); } for (int i = 0; i < len; ++i) {...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>, PORT_REG_RPUP_BUF, cfg->rpup_buf) < 0) { return -EIO; } if (ds2477_85_write_port_config(dev, PORT_REG_PDSLEW, cfg->pdslew) < 0) { return -EIO; } LOG_DBG("cfg: rpup_buf=%02x, pdslew:%02x", cfg->rpup_buf, cfg->pdslew); /* RPUP/BUF configuration is applied after a bus reset */ (void)ds2477_85_...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2022 Thomas Stranger * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_W1_DS2477_DS2485_COMMON_H_ #define ZEPHYR_DRIVERS_W1_DS2477_DS2485_COMMON_H_ #include <zephyr/drivers/i2c.h> #include <zephyr/drivers/w1.h> #include <zephyr/kernel.h> /* memory specific commands */ #define C...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2023 Caspar Friedrich <c.s.w.friedrich@gmail.com> * * SPDX-License-Identifier: Apache-2.0 */ #include "w1_ds2482-800.h" #include "w1_ds2482_84_common.h" #include <zephyr/devicetree.h> #include <zephyr/drivers/i2c.h> #include <zephyr/logging/log.h> #define DT_DRV_COMPAT maxim_ds24...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2023 Caspar Friedrich <c.s.w.friedrich@gmail.com> * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_W1_W1_DS2482_800_H_ #define ZEPHYR_DRIVERS_W1_W1_DS2482_800_H_ #include <zephyr/drivers/i2c.h> int ds2482_change_bus_lock_impl(cons<|fim_suffix|>dif /* ZEPHYR_DRIVE...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>ig = dev->config; return ds2482_84_read_bit(&config->i2c_spec); } static int ds2482_write_bit(const struct device *dev, bool bit) { const struct ds2482_config *config = dev->config; return ds2482_84_write_bit(&config->i2c_spec, bit); } static int ds2482_read_byte(const struct device *dev) { const ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>US_1WB_msk); return reg & STATUS_SBR_msk ? 1 : 0; } static inline int ds2482_84_read_bit(const struct i2c_dt_spec *spec) { return ds2482_84_single_bit(spec, BIT_SET_msk); } static inline int ds2482_84_write_bit(const struct i2c_dt_spec *spec, bool bit) { return ds2482_84_single_bit(spec, bit ? BIT_S...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2022 Caspar Friedrich <c.s.w.friedrich@gmail.com> * * SPDX-License-Identifier: Apache-2.0 */ #include "w1_ds2482_84_common.h" #include <zephyr/devicetree.h> #include <zephyr/drivers/gpio.h> #include <zephyr/drivers/i2c.h> #include <zephyr/drivers/w1.h> #include <zephyr/kernel.h> #...
fim
zephyrproject-rtos/zephyr
c