text
stringlengths
14
100k
source
stringclasses
1 value
repo
stringclasses
810 values
language
stringclasses
13 values
<|fim_prefix|>/* * Copyright (c) 2025 Texas Instruments Incorporated * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT ti_omap_mcspi #include <zephyr/logging/log.h> LOG_MODULE_REGISTER(omap_mcspi); #include <zephyr/drivers/spi.h> #include <zephyr/drivers/pinctrl.h> #include "spi_context.h" /* Max cl...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>nst struct spi_opentitan_cfg *cfg) { /* Rx bytes are available if Tx FIFO is non-empty. */ return !(sys_read32(cfg->base + SPI_HOST_STATUS_REG_OFFSET) & SPI_HOST_STATUS_RXEMPTY_BIT); } static void spi_opentitan_xfer(const struct device *dev, const bool gpio_cs_control) { const struct spi_opentitan_cfg...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>>ctx; /* Process by per chunk */ size_t chunk_len = spi_context_max_continuous_chunk(ctx); uint32_t txrx; /* Read RX FIFO */ while (SSP_RX_FIFO_NOT_EMPTY(cfg->reg) && (data->rx_count < chunk_len)) { txrx = SSP_READ_REG(SSP_DR(cfg->reg)); /* Discard received data if rx buffer not assigned */ i...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>ataSize); spi_context_update_rx(&data->ctx, 1, data->xfer.dataSize); /* Start next block * Since 1 byte at TX FIFO will start transfer data, let's try * minimize ISR recursion disabling all interrupt sources when add * data on TX FIFO */ Cy_SCB_SetMasterInterruptMask(config->base, 0U); spi_p...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2023 Intel Corporation. * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT intel_penwell_spi #include <errno.h> #include <stdint.h> #include <stdbool.h> #include <zephyr/kernel.h> #include <zephyr/drivers/spi.h> #include "spi_rtio.h" #if DT_ANY_INST_ON_BUS_STATUS_OKAY(...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>_MASK_RX (PW_SPI_CTRL1_RIE_BIT) /* SSP & DMA reset */ #define PW_SPI_INST_RESET 0x7 /* Chip select control */ #define PW_SPI_CS_CTRL_SW_MODE BIT(0) #define PW_SPI_CS_HIGH BIT(1) #define PW_SPI_CS_LOW (~(PW_SPI_CS_HIGH)) #define PW_SP...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> \ .length = 0, \ }, \ .rx_transfer_cfg_extend = {.activation_source = DT_INST_IRQ_BY_NAME(index, rxi, irq)}, \ ...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2024-2025 Renesas Electronics Corporation * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT renesas_ra_spi_sci #include <r_dtc.h> #include <r_sci_spi.h> #include <rp_sci_spi.h> #include <soc.h> #include <zephyr/drivers/clock_control/renesas_ra_cgc.h> #include <zephy...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>de = TRANSFER_CHAIN_MODE_DISABLED, \ .transfer_settings_word_b.src_addr_mode = TRANSFER_ADDR_MODE_INCREMENTED, \ .transfer_settings_word_b.size = TRANSFER_SIZE_1_BYTE, \ .transfer_settings_word_b.mode = TRANSFER_MODE_NORMAL, \ .p_dest = (void *)NU...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2025 Renesas Electronics Corporation * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT renesas_rx_rspi #include <zephyr/drivers/spi.h> #include <zephyr/drivers/pinctrl.h> #include <zephyr/irq.h> #include <soc.h> #include <zephyr/logging/log.h> #include "r_rspi_rx_if...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> \ .rxi_irq = DT_INST_IRQ_BY_NAME(n, rxi, irq), \ .txi_irq = DT_INST_IRQ_BY_NAME(n, txi, irq), \ .p_transfer_tx = NULL, \ .p_trans...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> \ static dmac_b_instance_ctrl_t g_transfer##n##_##dir##_ctrl; \ static void g_spi##n##_##dir##_transfer_callback(dmac_b_callback_args_t *p_args) \ { ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>t(pio, data->pio_sm); pio_sm_put(pio, data->pio_sm, (rx_size * data->bits) - 1); pio_sm_exec(pio, data->pio_sm, pio_encode_jmp(data->pio_rx_offset)); pio_sm_set_enabled(pio, data->pio_sm, true); while (data->rx_count < rx_size) { while ((!pio_sm_is_rx_fifo_empty(pio, data->pio_sm)) && ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>eturn ret; } /** Submit request and wait */ rtio_submit(ctx->r, ret); while (ret > 0) { cqe = rtio_cqe_consume(ctx->r); if (cqe == NULL) { err = -EIO; break; } if (cqe->result < 0) { err = cqe->result; } rtio_cqe_release(ctx->r, cqe); ret--; } spi_r_unlock(ctx); return e...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>= { \ .r = &CONCAT(_name, _r), \ }; /** * @brief Copy the tx_bufs and rx_bufs into a set of RTIO requests * * @param[in] r rtio context * @param[in] iodev iodev to transceive with * @param[in] tx_bufs transmit buffer set * @param[in] rx_bufs receive buffer set * @param[in] n...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>S5912_SPI_CTRL_RST_MASK; timeout_cnt = 0; while ((spi->CTRL & RTS5912_SPI_CTRL_RST_MASK) && (timeout_cnt < RTS5912_SPI_TIMEOUT_ROUND)) { k_usleep(sleep_time); timeout_cnt++; } } static int rts5912_spi_xfer(const struct device *dev) { struct spi_rts5912_data *data = dev->data; struct spi_...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>data->ctx, ret); return ret; } static int spi_mcux_transceive(const struct device *dev, const struct spi_config *spi_cfg, const struct spi_buf_set *tx_bufs, const struct spi_buf_set *rx_bufs) { return transceive(dev, spi_cfg, tx_bufs, rx_bufs, false, NULL, NULL); } #ifde...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2017 Google LLC. * Copyright (c) 2018 qianfan Zhao. * Copyright (c) 2023 Gerson Fernando Budke. * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT atmel_sam_spi #define LOG_LEVEL CONFIG_SPI_LOG_LEVEL #include <zephyr/logging/log.h> LOG_MODULE_REGISTER(spi_sam); #i...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2017 Google LLC. * Copyright (c) 2024 Gerson Fernando Budke <nandojve@gmail.com> * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT atmel_sam0_spi #define LOG_LEVEL CONFIG_SPI_LOG_LEVEL #include <zephyr/logging/log.h> LOG_MODULE_REGISTER(spi_sam0); /* clang-format off */ #includ...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2025, tinyvision.ai * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT nxp_sc18is606_spi #include <zephyr/logging/log.h> LOG_MODULE_REGISTER(spi_sc18is606, CONFIG_SPI_LOG_LEVEL); #include <zephyr/kernel.h> #include <stdint.h> #include <string.h> #include <zephyr/dev...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>AS_CELL(n, flags))(n) #define CREATE_SEDI_SPI_INSTANCE(num) \ static void spi_##num##_irq_init(void) \ { \ IRQ_CONNECT(DT_INST_IRQN(num), \ DT_INST_IRQ(num, priority), \ spi_isr, num, SPI_SEDI_IRQ_FLAGS(num)); \ irq_e...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2025, Qingsong Gou <gouqs@hotmail.com> * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT sifli_sf32lb_spi #include <zephyr/kernel.h> #include <zephyr/drivers/spi.h> #include <zephyr/drivers/clock_control/sf32lb.h> #include <zephyr/drivers/pinctrl.h> #include <zephyr/dr...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>on |= SPI_FRAME_FORMAT_TI; break; default: all_opts_is_valid = false; shell_error(ctx, "invalid setting %c", *opts); } opts++; } if (!all_opts_is_valid) { return -EINVAL; } out: spec->config.frequency = frequency; spec->config.operation = operation; return 0; } static int cmd_sp...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2018 SiFive Inc. * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT sifive_spi0 #define LOG_LEVEL CONFIG_SPI_LOG_LEVEL #include <zephyr/logging/log.h> LOG_MODULE_REGISTER(spi_sifive); #include "spi_sifive.h" #include <soc.h> #include <stdbool.h> /* Helper Function...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2018 SiFive Inc. * * SPDX-License-Identifier: <|fim_suffix|>3 #define SF_FMT_PROTO_SINGLE 0 #define SF_TXDATA_FULL (1 << 31) #define SF_RXDATA_EMPTY (1 << 31) /* Structure Declarations */ struct spi_sifive_data { struct spi_context ctx; }; struct spi_sifive_cfg { uint32_t bas...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2022 Intel Corporation <|fim_suffix|>ct device *dev, int result, void *userdata) { ARG_UNUSED(dev); struct k_poll_signal *sig = userdata; k_poll_signal_raise(sig, result); } #endif /* CONFIG_POLL */ <|fim_middle|>* * SPDX-License-Identifier: Apache-2.0 */ /*...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2024 Daikin Comfort Technologies North America, Inc. * Copyright (c) 2025 Silicon Laboratories Inc. * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT silabs_eusart_spi #include <stdbool.h> #include <stddef.h> #include <zephyr/sys/sys_io.h> #include <zephyr/sys/uti...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2025 Silicon Laboratories Inc. * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT silabs_gspi #include <string.h> #include <errno.h> #include <zephyr/drivers/dma.h> #include <zephyr/drivers/pinctrl.h> #include <zephyr/drivers/spi.h> #include <zephyr/drivers/clock_cont...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2019 Christian Taedcke <hacking@taedcke.com> * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT silabs_usart_spi #define LOG_LEVEL CONFIG_SPI_LOG_LEVEL #include <zephyr/logging/log.h> LOG_MODULE_REGISTER(spi_silabs_usart); #include "spi_context.h" #include <z<|fim_s...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2022 Renesas Electronics Corporation * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT renesas_smartbond_spi #define LOG_LEVEL CONFIG_SPI_LOG_LEVEL #include <zephyr/logging/log.h> LOG_MODULE_REGISTER(spi_smartbond); #include "spi_context.h" #include <zephyr/drivers/gpio.h> #inc...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>NC */ dma_callback_sync(spi_dev, channel, status); } #if !defined(CONFIG_SPI_RTIO) static int transceive_dma(const struct device *dev, const struct spi_config *config, const struct spi_buf_set *tx_bufs, const struct spi_buf_set *rx_bufs, bool asynchronous, spi_callback_t cb, ...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2016 BayLibre, SAS * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_SPI_SPI_STM32_H_ #define ZEPHYR_DRIVERS_SPI_SPI_STM32_H_ #include "spi_context.h" typedef void (*irq_config_func_t)(const struct device *port); /* This symbol takes the value 1 if one of the device instances ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>vider; const uint32_t unsupported = SPI_TRANSFER_LSB | SPI_MODE_LOOP | SPI_HALF_DUPLEX; if (spi_context_configured(&data->ctx, config)) { return 0; } if (!spi_cs_is_gpio(config)) { /* if cs0 and cs1 are not real gpios, that indicates, we are using the hw cs */ if (config->slave > 1U) { retu...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> \ SPI_DEVICE_DT_INST_DEFINE(n, NULL, NULL, NULL, NULL, POST_KERNEL, \ CONFIG_SPI_INIT_PRIORITY, &vnd_spi_api); DT_INST_FOREACH_STATUS_OKAY(VND_SPI_INIT) <|fim_prefix|>/* * Copyright (c) 2021, Nordic Semiconductor ASA * * SPDX-License-Identifier: Apach...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>OE; } regs->CTLR1 |= SPI_CTLR1_MSTR; if ((config->operation & SPI_TRANSFER_LSB) != 0U) { regs->CTLR1 |= SPI_CTLR1_LSBFIRST; } if ((config->operation & SPI_MODE_CPOL) != 0U) { regs->CTLR1 |= SPI_CTLR1_CPOL; } if ((config->operation & SPI_MODE_CPHA) != 0U) { regs->CTLR1 |= SPI_CTLR1_CPHA; ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> /* * If caller doesn't need CS# held asserted then find the last * descriptor, set its close flag, and set stop. */ if (!(config->operation & SPI_HOLD_ON_CS)) { /* Get last descriptor from status register */ last_didx = (regs->STS >> MCHP_QMSPI_C_NEXT_DESCR_POS) & MCHP_QMSPI_C_NEXT_DES...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2025 Microchip Technology Inc. * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT microchip_xec_qmspi_ldma #include <soc.h> #include <zephyr/device.h> #include <zephyr/devicetree.h> #include <zephyr/irq.h> #include <zephyr/drivers/gpio.h> #include <zephyr/drivers/pinctrl...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2020 Henrik Brix Andersen <henrik@brixandersen.dk> * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT xlnx_xps_spi_2_00_a #include <zephyr/device.h> #include <zephyr/drivers/spi.h> #include "spi_rtio.h" #include <zephyr/sys/sys_io.h> #include <zephyr/logging/log.h> #...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> GQSPI_DATA_DLY_ADJ_LOOPBACK_ENABLE); } else { /* Disable loopback */ xlnx_zynqmp_gqspi_write32(dev, GQSPI_LPBK_DLY_ADJ, GQSPI_LPBK_DLY_ADJ_LOOPBACK_DISABLE); xlnx_zynqmp_gqspi_write32(dev, GQSPI_DATA_DLY_ADJ, GQSPI_DATA_DLY_ADJ_LOOPBACK_DISABLE); } xlnx_zynqmp_gqspi_write32(dev,...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2022 Schlumberger * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT infineon_xmc4xxx_spi #define LOG_LEVEL CONFIG_SPI_LOG_LEVEL #include <zephyr/logging/log.h> LOG_MODULE_REGISTER(spi_xmc4xxx); #include "spi_context.h" #include <zephyr/drivers/dma.h> #include <zep...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * SPDX-FileCopyrightText: Copyright (c) 2024 Carl Zeiss Meditec AG * SP<|fim_suffix|>r_address, data >> 24, data >> 16, data >> 8, data}; uint8_t rx_buffer[BUFFER_SIZE]; int status; const struct spi_buf spi_buffer_tx = { .buf = &tx_buffer, .len = sizeof(tx_buffer), }; struct spi_buf_...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>_calc_crc(read_buffer, ADI_TMC_UART_DATAGRAM_SIZE - 1U); if (crc != read_buffer[7]) { LOG_ERR("CRC mismatch for register 0x%x: got 0x%x, expected 0x%x", register_address, read_buffer[7], crc); return -EIO; } /* Construct a 32-bit register value from received bytes */ *data = sys_get_be32(&rea...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>IZE]; struct uart_config rs485_cfg; uint8_t echo; int err = 0; /* Get current RS485 configuration */ err = uart_config_get(rs485, &rs485_cfg); if (err) { LOG_ERR("Failed to get UART configuration: %d", err); return -EIO; } /* Format the TMCM RS485 datagram */ write_buffer[0] = cmd->module_a...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>mmunication interface types */ #define TMC_COMM_SPI 0 #define TMC_COMM_UART 1 union tmc_bus { struct spi_dt_spec spi; const struct device *uart; }; /** * @brief Function pointer type for bus check function. * @param bus Pointer to the bus structure. * @param comm_type Communication type (SPI or UA...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>e to be written in the register. * * @return a value from spi_transceive(). */ int tmc_spi_write_register(const struct spi_dt_spec *bus, const uint8_t write_bit, const uint8_t register_address, const uint32_t data); /** * @} */ #ifdef __cplusplus } #endif #endif /* ZEPHYR_DRIVERS_STEPPER_ADI...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * SPDX-FileCopyrightText: Copyright (c) 2025 Dipak Shetty * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_STEPPER_ADI_TMC_BUS_UART_H_ #define<|fim_suffix|> uint8_t register_address, uint32_t data); #endif /* ZEPHYR_DRIVERS_STEPPER_ADI_TMC_BUS_UART_H_ */ <|fim_middle|> ZEPHYR...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> @brief Send command via RS485 interface * * @param rs485 Pointer to RS485 UART device * @param cmd Pointer to command parameters * @param reply Pointer to store reply data (MSB first) * @param de_gpio Pointer to DE GPIO spec (NULL if not used) * @return 0 on success, negative errno on failure */ i...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>nt64_t acceleration_hz, uint64_t clock_frequency) { uint64_t shifted_accel = MIN(acceleration_hz, UINT64_MAX >> (TMC5XXX_CLOCK_FREQ_SHIFT + TMC5XXX_ACCEL_CALC_SHIFT)); return DIV_ROUND_CLOSEST((shifted_accel << TMC5XXX_CLOCK_FREQ_SHIFT) << TMC5XXX_ACCEL_CALC_SHIFT, ...
fim
zephyrproject-rtos/zephyr
c
/** * @file drivers/stepper/adi_tmc/adi_tmc_reg.h * * @brief TMC Registers * */ /* * SPDX-FileCopyrightText: Copyright (c) 2024 Carl Zeiss Meditec AG * SPDX-FileCopyrightText: Copyright (c) 2025 Prevas A/S * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_STEPPER_ADI_TMC_COMMON_ADI_TMC_REG_H_ #...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>int tmc22xx_stepper_configure_msx_pins(const struct device *dev) { const struct tmc22xx_config *config = dev->config; int ret; if (!gpio_is_ready_dt(&config->common.m0_pin)) { LOG_ERR_DEVICE_NOT_READY(config->common.m0_pin.port); return -ENODEV; } ret = gpio_pin_configure_dt(&config->common.m0_...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>", dev->name); k_sem_init(&data->sem, 1, 1); if (!spi_is_ready_dt(&config->spi)) { LOG_ERR_DEVICE_NOT_READY(config->spi.bus); return -ENODEV; } /* Init non motor-index specific registers here. */ LOG_DBG("GCONF: %d", config->gconf); err = tmc50xx_write(dev, TMC5XXX_GCONF, config->gconf); if (...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * SPDX-FileCopyrightText: Copyright (c) 2025 Jilay Sandeep Pandya * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_STEPPER_ADI_TMC_TMC50XX_H_ #define ZEPHYR_DRIVERS_STEPPER_ADI_TMC_TMC50XX_H_ #include <zephyr/types.h> #include <zephyr/device.h> #include <zephyr/drivers/stepper/st...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * SPDX-FileCopyrightText: Copyright (c) 2025 Dipak Shetty * SPDX-FileCopyrightText: Copyright (c) 2025 Jilay Sandeep Pandya * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT adi_tmc50xx_stepper_ctrl #include <stdlib.h> #include "tmc50xx.h" #include <adi_tmc5xxx_common.h> #includ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>c int tmc50xx_stepper_driver_enable(const struct device *dev) { LOG_DBG("Enabling Stepper motor controller %s", dev->name); const struct tmc50xx_stepper_driver_config *config = dev->config; uint32_t reg_value; int err; err = tmc50xx_read(config->controller, TMC50XX_CHOPCONF(config->index), &reg_valu...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>T(8))), \ .bus_io = &tmc51xx_spi_bus_io, \ .diag0_gpio = GPIO_DT_SPEC_INST_GET_OR(inst, diag0_gpios, {0}) /* Initializes a struct tmc51xx_config for an instance on a UART bus. */ #define TMC51XX_CONFIG_UART(inst) ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>e TMC51xx device. * @param reg_addr Register address to write to. * @param reg_val Value to write to the register. * @retval -EIO on failure, 0 on success */ int tmc51xx_write(const struct device *dev, const uint8_t reg_addr, const uint32_t reg_val); /** * @brief Read a 32-bit value from a TMC51xx r...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * SPDX-FileCopyrightText: Copyright (c) 2025 Dipak Shetty * SPDX-FileCopyrightText: Copyright (c) 2025 Jilay Sandeep Pandya * * SPDX-License-Identifier: Apache-2.0 */ #include <stdlib.h> #include <zephyr/drivers/stepper/stepper_ctrl.h> #include "tmc51xx.h" #include <adi_tmc5xxx_common.h> #inclu...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>per_driver_data_##inst, \ &tmc51xx_stepper_driver_config_##inst, POST_KERNEL, \ CONFIG_STEPPER_INIT_PRIORITY, &tmc51xx_stepper_driver_api); DT_INST_FOREACH_STATUS_OKAY(TMC51XX_STEPPER_DRIVER_DEFINE) <|fim_prefix|>/* * SPDX-FileCopyrightT...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * SPDX-FileCopyrightText: Copyright (c) 2025 Alexis Czezar C Torreno * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT adi_tmcm3216 #include <zephyr/kernel.h> #include <zephyr/device.h> #include <zephyr/drivers/gpio.h> #include <zephyr/logging/log.h> #include <adi_tmcm_rs485.h> #incl...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>216_gap(const struct device *dev, uint8_t motor, uint8_t parameter, uint32_t *value); /** * @brief Send a raw TMCL command * * @param dev Pointer to stepper child device * @param cmd Command structure (module_addr will be overwritten) * @param reply Pointer to store reply value * @return 0 on succe...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/** * @file drivers/stepper/adi_tmc/tmcm3216/tmcm3216_reg.h * * @brief TMCM3216 Registers and Constants * */ /* * SPDX-FileCopyrightText: Copyright (c) 2025 Alexis Czezar C Torreno * SP<|fim_suffix|>ELOCITY 4 #define TMCL_AP_MAX_ACCELERATION 5 #define TMCL_AP_MAX_CURRENT 6 ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>event_callback(const struct device *dev, stepper_ctrl_event_callback_t callback, void *user_data) { struct tmcm3216_stepper_ctrl_data *data = dev->data; data->callback = callback; data->event_cb_user_data = user_data; LOG_DBG("%s event callback %s", dev->name, callback != NULL ? ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>t tmcm3216_stepper_driver_config tmcm3216_stepper_driver_config_##inst = \ { \ .controller = DEVICE_DT_GET(DT_INST_PARENT(inst)), \ .motor_index = DT_INST_PROP(inst, idx), ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> struct step_dir_stepper_common_config common; const struct gpio_dt_spec reset_pin; }; struct a4979_data { enum stepper_micro_step_resolution micro_step_res; }; STEP_DIR_STEPPER_STRUCT_CHECK(struct a4979_config); static int a4979_set_microstep_pin(const struct device *dev, const struct gpio_dt_spec *...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> stepper_ctrl_event_callback_t callback, void *user_data) { struct stepper_ctrl_event_handler_data *data = dev->data; data->callback = callback; data->event_cb_user_data = user_data; return 0; } /** @} */ #endif /* ZEPHYR_DRIVER_STEPPER_CTRL_EVENT_HANDLER_H_ */ <|fim_prefix|>/* * Copyr...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright 2024 Fabian Blatz <fabianblatz@gmail.com> * Copyright 2026 Navimatix GmbH * * SPDX-License-Identifier: Apache-2.0 */ #include <stepper_ctrl_event_handler.h> #include <zephyr/logging/log.h> LOG_MODULE_REGISTER(stepper_ctrl_event_handler, CONFIG_STEPPER_LOG_LEVEL); void stepper_ctrl_e...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> #define FAKE_STEPPER_CTRL_INIT(inst) \ \ static struct fake_stepper_ctrl_data fake_stepper_ctrl_data_##inst; \ ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>ing_source->init(dev); if (ret < 0) { LOG_ERR("Failed to initialize timing source: %d", ret); return ret; } } return stepper_ctrl_event_handler_init(dev); } <|fim_prefix|>/* * SPDX-FileCopyrightText: Copyright (c) 2024 Fabian Blatz <fabianblatz@gmail.com> * SPDX-License-Identifier: Apache-2...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright 2024 Fabian Blatz <fabianblatz@gmail.com> * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVER_STEPPER_GPIO_STEPPER_COMMON_H_ #define ZEPHYR_DRIVER_STEPPER_GPIO_STEPPER_COMMON_H_ /** * @brief Stepper Driver APIs * @defgroup gpio_stepper Stepper Driver APIs * @ingroup io...
fim
zephyrproject-rtos/zephyr
c
/* * SPDX-FileCopyrightText: Copyright (c) 2024 Fabian Blatz <fabianblatz@gmail.com> * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVER_STEPPER_GPIO_STEPPER_STEPPER_TIMING_SOURCE_H_ #define ZEPHYR_DRIVER_STEPPER_GPIO_STEPPER_STEPPER_TIMING_SOURCE_H_ #include <zephyr/device.h> /** * @brief Initialize ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>_timing_source_needs_reschedule, .stop = step_counter_timing_source_stop, .is_running = step_counter_timing_source_is_running, }; <|fim_prefix|>/* * SPDX-FileCopyrightText: Copyright (c) 2024 Fabian Blatz <fabianblatz@gmail.com> * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/drivers/count...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * SPDX-FileCopyrightText: Copyright (c) 2024 Fabian Blatz <fabianblatz@gmail.com> * SPDX-License-Identifier: Apache-2.0 */ #include <stepper_timing_source.h> #include <gpio_stepper_common.h> static k_timeout_t stepper_movement_delay(const struct device *dev) { const struct gpio_stepper_common_dat...
fim
zephyrproject-rtos/zephyr
c
/* * SPDX-FileCopyrightText: Copyright (c) 2025 Jilay Sandeep Pandya * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT zephyr_gpio_step_dir_stepper_ctrl #include <zephyr/drivers/stepper/stepper_ctrl.h> #include <zephyr/drivers/gpio.h> #include <step_dir_stepper_common.h> #include <gpio_stepper_common...
fim
zephyrproject-rtos/zephyr
c
/* * SPDX-FileCopyrightText: Copyright (c) 2024 Carl Zeiss Meditec AG * SPDX-FileCopyrightText: Copyright (c) 2024 Jilay Sandeep Pandya * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT zephyr_h_bridge_stepper_ctrl #include <zephyr/drivers/gpio.h> #include <zephyr/kernel.h> #include <zephyr/sys_clock...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright 2024 Fabian Blatz <fabianblatz@gmail.com> * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVER_STEPPER_STEP_DIR_STEPPER_COMMON_H_ #define ZEPHYR_DRIVER_STEPPER_STEP_DIR_STEPPER_COMMON_H_ /** * @brief Stepper Driver APIs * @defgroup step_dir_stepper Stepper Driver APIs *...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2024 Fabian Blatz <fabianblatz@gmail.com> * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_INCLUDE_DRIVERS_<|fim_suffix|>st struct device *, uint64_t); DECLARE_FAKE_VALUE_FUNC(int, fake_stepper_ctrl_configure_ramp, const struct device *, const struct stepper_ctrl_ra...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2024, Fabian Blatz <fabianblatz@gmail.com> * Copyright (c) 2024, Jilay Sandeep Pandya * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/shell/shell.h> #include <zephyr/device.h> #include <zephyr/drivers/stepper/stepper.h> #include <zephyr/drivers/stepper/stepper_ctrl.h> ...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>ata->ustep_res); if (ret != 0) { return ret; } } /* Configure fault pin if it is available */ if (config->fault_pin.port != NULL) { ret = gpio_pin_configure_dt(&config->fault_pin, GPIO_INPUT); if (ret != 0) { LOG_ERR("%s: Failed to configure fault_pin (error: %d)", dev->name, ret); re...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> \ }; \ DEVICE_DT_INST_DEFINE(inst, syscon_generic_init, NULL, &syscon_generic_data_##inst, \ &syscon_generic_config_##inst, PRE_KERNEL_1, ...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright 2021 Google LLC. * SPDX-License-Identifier: Apache-2.0 */ #ifndef DRIVERS_SYSCON_SYSCON_COMMON_H_ #define DRIVERS_SYSCON_SYSCON_COMMON_H_ #include <zephyr/sys/util.h> #ifdef __cplusplus extern "C" { #endif /** * @brief Validate register address alignment and bo<|fim_suffix|>% reg_wi...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2025 Basalte bv * * SPDX-License-Identifier: Apache-2.0 */ /** * @file * @brief SYSCON shell commands. */ #include <zephyr/shell/shell.h> #include <zephyr/drivers/syscon.h> static int cmd_base(const struct shell *sh, size_t argc, char **argv) { const struct device *dev; uint...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright 2023 EPAM Systems * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/arch/arm64/arm-smccc.h> #include <zephyr/drivers/tee.h> #include <zephyr/logging/log.h> #include <zephyr/sys/bitarray.h> #include <zephyr/sys/dlist.h> #include "optee_msg.h" #include "optee_rpc_cmd.h" #inclu...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* SPDX-License-Identifier: BSD-2-Clause */ /* * Copyright (c) 2015-2020, Linaro Limited */ #ifndef _OPTEE_MSG_H #define _OPTEE_MSG_H /* * TODO: Zephyr has similar macros defined in stdint.h and called UINT32_C, * UINT64_C etc. This should be refactored to use macro from Zephyr. */ #define U(v) v ##...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* SPDX-License-Identifier: BSD-2-Clause */ /* * Copyright (c) 2016-2021, Linaro Limited */ #ifndef __OPTEE_RPC_CMD_H #define __OPTEE_RPC_CMD_H /* * All RPC is done with a struct optee_msg_arg as bearer of information, * struct optee_msg_arg::arg holds values defined by OPTEE_RPC_CMD_* below. * Onl...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|> usage: * a0 OPTEE_SMC_RETURN_EBUSY * a1-7 Preserved */ #define OPTEE_SMC_FUNCID_BOOT_SECONDARY U(12) #define OPTEE_SMC_BOOT_SECONDARY \ OPTEE_SMC_FAST_CALL_VAL(OPTEE_SMC_FUNCID_BOOT_SECONDARY) /* * Inform OP-TEE about a new virtual machine * * Hypervisor issues this call during virtual machine (...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2023 EPAM Systems * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/drivers/tee.h> int tee_add_shm(const struct device *dev, void *addr, size_t align, size_t size, uint32_t flags, struct tee_shm **shmp) { int rc; void *p = addr; struct tee_shm *shm; if (!shmp) { ...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2022 Intel Corporation * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/drivers/timeaware_gpio.h> #include <zephyr/syscall_handler.h> static inline int z_vrfy_tgpio_port_get_time(const struct device *port, uint64_t *curr<|fim_suffix|>TGPIO(port, pin_disable)); return z_...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2023 Intel Corporation. * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT intel_timeaware_gpio #include <errno.h> #include <stdio.h> #include <zephyr/device.h> #include <zephyr/kernel.h> #include <zephyr/drivers/timeaware_gpio.h> #include <zephyr/devicetree.h> #incl...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2023 Antmicro <www.antmicro.com> * Copyright (c) 2025, Ambiq Micro Inc. <www.ambiq.com> * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT ambiq_stimer /** * @file * @brief Ambiq Apollo STIMER-based sys_clock driver * */ #include <zephyr/init.h> #include <zephy...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>PER_TICK); irq_enable(CONFIG_APIC_TIMER_IRQ); return 0; } SYS_INIT(sys_clock_driver_init, PRE_KERNEL_2, CONFIG_SYSTEM_CLOCK_INIT_PRIORITY); <|fim_prefix|>/* * Copyright (c) 2019 Intel Corporation * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/init.h> #include <zephyr/drivers/timer/sys...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>a recoverable way, * etc... We set it to zero on all cores for simplicity, because * firmware often leaves it in an inconsistent state between cores. */ static void clear_tsc_adjust(void) { /* But don't touch it on ACRN, where an hypervisor bug * confuses the APIC emulation and deadline interrupts ...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2014-2015 Wind River Systems, Inc. * Copyright (c) 2018 Synopsys Inc, Inc. * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/init.h> #include <zephyr/drivers/timer/system_timer.h> #include <zephyr/sys_clock.h> #include <zephyr/spinlock.h> #include <zephyr/arch/arc/v2/aux_...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>ending by the GIC's pending register * after this ISR has been executed) the error will be detected by the * check performed upon entry of the ISR -> the event flag is not set, * therefore, no actual hardware interrupt has occurred. */ arm_arch_timer_clear_int_status(); #else } #endif /* CONFIG_...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>r to complete reset */ HWREG(AON_RTC_BASE + AON_RTC_O_SYNC); AONRTCEventClear(AON_RTC_CH0); IntPendClear(INT_AON_RTC_COMB); HWREG(AON_RTC_BASE + AON_RTC_O_SYNC); } static void startDevice(void) { uint32_t compare; uint64_t period; unsigned int key; key = irq_lock(); /* reset timer */ AONRTC...
fim
zephyrproject-rtos/zephyr
c
/* * Copyright (c) 2024 BayLibre, SAS * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT ti_cc23x0_rtc_timer #include <soc.h> #include <zephyr/device.h> #include <zephyr/drivers/clock_control.h> #include <zephyr/drivers/timer/system_timer.h> #include <zephyr/irq.h> #include <zephyr/spinlock.h> #inc...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2024 Texas Instruments Incorporated * Copyright (c) 2024 BayLibre, SAS * * SPDX-License-Identifier: Apache-2.0 */ #define DT_DRV_COMPAT ti_cc23x0_systim_timer /* * TI SimpleLink CC23X0 timer driver based on SYSTIM */ #include <soc.h> #include <zephyr/device.h> #include <zephy...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2018 Intel Corporation * * SPDX-License-Identifier: Apache-2.0 */ #include <zephyr/init.h> #include <zephyr/drivers/timer/system_timer.h> #include <zephyr/sys_clock.h> #include <cmsis_core.h> #include <zephyr/irq.h> #include <zephyr/sys/util.h> #include <zephyr/drivers/counter.h> #i...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/** * Copyright (c) 2025 STMicroelectronics * * SPDX-License-Ident<|fim_suffix|>_MACRO #define z_cms_lptim_hook_on_lpm_exit z_sys_clock_lpm_exit __DEPRECATED_MACRO #endif /* ZEPHYR_INCLUDE_DRIVERS_TIMER_CORTEX_M_SYSTICK_H_ */ <|fim_middle|>ifier: Apache-2.0 */ #ifndef ZEPHYR_INCLUDE_DRIVERS_TIMER_CO...
fim
zephyrproject-rtos/zephyr
c
<|fim_prefix|>/* * Copyright (c) 2021-2026 Espressif Systems (Shanghai) Co., Ltd. * * SPDX-License-Identifier: Apache-2.0 */ #include <soc/soc_caps.h> #include <soc/soc.h> #include <hal/systimer_hal.h> #include <hal/systimer_ll.h> #include <esp_private/systimer.h> #include <rom/ets_sys.h> #include <esp_attr.h> #...
fim
zephyrproject-rtos/zephyr
c
<|fim_suffix|>p32_lptim_hook_get_freq(void); #endif /* ZEPHYR_DRIVERS_TIMER_ESP32_SYS_TIMER_H_ */ <|fim_prefix|>/* * Copyright (c) 2026 Espressif Systems (Shanghai) Co., Ltd. * * SPDX-License-Identifier: Apache-2.0 */ #ifndef ZEPHYR_DRIVERS_TIMER_ESP32_SYS_TIMER_H_ #define ZEPHYR_DRIVERS_TIMER_ESP32_SYS_TI<|fim_m...
fim
zephyrproject-rtos/zephyr
c