Home
last modified time | relevance | path

Searched +full:reg +full:- +full:rc (Results 1 – 25 of 101) sorted by relevance

12345

/Zephyr-latest/drivers/sensor/jedec/jc42/
Djc42.c6 * SPDX-License-Identifier: Apache-2.0
24 int jc42_reg_read(const struct device *dev, uint8_t reg, uint16_t *val) in jc42_reg_read() argument
26 const struct jc42_config *cfg = dev->config; in jc42_reg_read()
27 int rc = i2c_write_read_dt(&cfg->i2c, &reg, sizeof(reg), val, sizeof(*val)); in jc42_reg_read() local
29 if (rc == 0) { in jc42_reg_read()
33 return rc; in jc42_reg_read()
36 int jc42_reg_write_16bit(const struct device *dev, uint8_t reg, uint16_t val) in jc42_reg_write_16bit() argument
38 const struct jc42_config *cfg = dev->config; in jc42_reg_write_16bit()
42 buf[0] = reg; in jc42_reg_write_16bit()
45 return i2c_write_dt(&cfg->i2c, buf, sizeof(buf)); in jc42_reg_write_16bit()
[all …]
/Zephyr-latest/drivers/gpio/
Dgpio_sam0.c5 * SPDX-License-Identifier: Apache-2.0
13 #include <zephyr/dt-bindings/gpio/atmel-sam0-gpio.h>
47 gpio_fire_callbacks(&data->callbacks, data->dev, pins); in gpio_sam0_isr()
54 const struct gpio_sam0_config *config = dev->config; in gpio_sam0_config()
55 struct gpio_sam0_data *data = dev->data; in gpio_sam0_config()
56 PortGroup *regs = config->regs; in gpio_sam0_config()
58 .reg = 0, in gpio_sam0_config()
62 return -ENOTSUP; in gpio_sam0_config()
72 return -ENOTSUP; in gpio_sam0_config()
76 regs->OUTCLR.reg = BIT(pin); in gpio_sam0_config()
[all …]
Dgpio_sx1509b.c4 * Copyright (c) 2019-2020 Nordic Semiconductor ASA
7 * SPDX-License-Identifier: Apache-2.0
19 #include <zephyr/dt-bindings/gpio/semtech-sx1509b.h>
153 * @brief Write a big-endian word to an internal address of an I2C slave.
160 * @retval -EIO General input / output error.
171 * @brief Write a big-endian byte to an internal address of an I2C slave.
178 * @retval -EIO General input / output error.
191 const struct sx1509b_config *cfg = dev->config; in sx1509b_handle_interrupt()
192 struct sx1509b_drv_data *drv_data = dev->data; in sx1509b_handle_interrupt()
197 k_sem_take(&drv_data->lock, K_FOREVER); in sx1509b_handle_interrupt()
[all …]
/Zephyr-latest/drivers/sensor/ti/tmp116/
Dtmp116.c4 * SPDX-License-Identifier: Apache-2.0
13 #include <zephyr/dt-bindings/sensor/tmp116.h>
28 static int tmp116_reg_read(const struct device *dev, uint8_t reg, in tmp116_reg_read() argument
31 const struct tmp116_dev_config *cfg = dev->config; in tmp116_reg_read()
33 if (i2c_burst_read_dt(&cfg->bus, reg, (uint8_t *)val, 2) in tmp116_reg_read()
35 return -EIO; in tmp116_reg_read()
43 static int tmp116_reg_write(const struct device *dev, uint8_t reg, in tmp116_reg_write() argument
46 const struct tmp116_dev_config *cfg = dev->config; in tmp116_reg_write()
47 uint8_t tx_buf[3] = {reg, val >> 8, val & 0xFF}; in tmp116_reg_write()
49 return i2c_write_dt(&cfg->bus, tx_buf, sizeof(tx_buf)); in tmp116_reg_write()
[all …]
/Zephyr-latest/drivers/charger/
Demul_sbs_charger.c4 * SPDX-License-Identifier: Apache-2.0
28 /** Run-time data used by the emulator */
33 static int emul_sbs_charger_reg_write(const struct emul *target, int reg, int val) in emul_sbs_charger_reg_write() argument
35 struct sbs_charger_emul_data *data = target->data; in emul_sbs_charger_reg_write()
37 LOG_INF("write %x = %x", reg, val); in emul_sbs_charger_reg_write()
38 switch (reg) { in emul_sbs_charger_reg_write()
40 data->reg_charger_mode = val; in emul_sbs_charger_reg_write()
43 LOG_ERR("Unknown write %x", reg); in emul_sbs_charger_reg_write()
44 return -EIO; in emul_sbs_charger_reg_write()
50 static int emul_sbs_charger_reg_read(const struct emul *target, int reg, int *val) in emul_sbs_charger_reg_read() argument
[all …]
/Zephyr-latest/drivers/fuel_gauge/max17048/
Demul_max17048.c4 * SPDX-License-Identifier: Apache-2.0
37 static int emul_max17048_reg_write(const struct emul *target, int reg, int val) in emul_max17048_reg_write() argument
40 return -EIO; in emul_max17048_reg_write()
43 static int emul_max17048_reg_read(const struct emul *target, int reg, int *val) in emul_max17048_reg_read() argument
46 switch (reg) { in emul_max17048_reg_read()
60 LOG_ERR("Unknown register 0x%x read", reg); in emul_max17048_reg_read()
61 return -EIO; in emul_max17048_reg_read()
63 LOG_INF("read 0x%x = 0x%x", reg, *val); in emul_max17048_reg_read()
73 int reg; in max17048_emul_transfer_i2c() local
74 int rc; in max17048_emul_transfer_i2c() local
[all …]
/Zephyr-latest/drivers/sensor/ti/tmp114/
Dtmp114.c4 * SPDX-License-Identifier: Apache-2.0
41 static int tmp114_reg_read(const struct device *dev, uint8_t reg, in tmp114_reg_read() argument
44 const struct tmp114_dev_config *cfg = dev->config; in tmp114_reg_read()
46 if (i2c_burst_read_dt(&cfg->bus, reg, (uint8_t *)val, 2) in tmp114_reg_read()
48 return -EIO; in tmp114_reg_read()
56 static int tmp114_reg_write(const struct device *dev, uint8_t reg, in tmp114_reg_write() argument
59 const struct tmp114_dev_config *cfg = dev->config; in tmp114_reg_write()
60 uint8_t tx_buf[3] = {reg, val >> 8, val & 0xFF}; in tmp114_reg_write()
62 return i2c_write_dt(&cfg->bus, tx_buf, sizeof(tx_buf)); in tmp114_reg_write()
68 LOG_ERR("%s: Failed to get Device ID register!", dev->name); in tmp114_device_id_check()
[all …]
/Zephyr-latest/drivers/fuel_gauge/bq27z746/
Dbq27z746.c5 * SPDX-License-Identifier: Apache-2.0
25 static int bq27z746_read16(const struct device *dev, uint8_t reg, uint16_t *value) in bq27z746_read16() argument
28 const struct bq27z746_config *cfg = dev->config; in bq27z746_read16()
29 const int status = i2c_burst_read_dt(&cfg->i2c, reg, i2c_data, sizeof(i2c_data)); in bq27z746_read16()
40 static int bq27z746_write16(const struct device *dev, uint8_t reg, uint16_t value) in bq27z746_write16() argument
43 const struct bq27z746_config *cfg = dev->config; in bq27z746_write16()
45 buf[0] = reg; in bq27z746_write16()
48 return i2c_write_dt(&cfg->i2c, buf, sizeof(buf)); in bq27z746_write16()
54 return -EINVAL; in bq27z746_read_mac()
58 const struct bq27z746_config *cfg = dev->config; in bq27z746_read_mac()
[all …]
Demul_bq27z746.c5 * SPDX-License-Identifier: Apache-2.0
43 const struct bq27z746_emul_data *data = target->data; in emul_bq27z746_read_altmac()
48 return -EIO; in emul_bq27z746_read_altmac()
57 * 34: Checksum calculated as (uint8_t)(0xFF - (sum of all command and data bytes)) in emul_bq27z746_read_altmac()
62 sys_put_le16(data->mac_cmd, buf); in emul_bq27z746_read_altmac()
65 /* In all of the operations, don't consider the zero-terminator. */ in emul_bq27z746_read_altmac()
66 switch (data->mac_cmd) { in emul_bq27z746_read_altmac()
68 memcpy(&buf[2], manufacturer_name, sizeof(manufacturer_name) - 1); in emul_bq27z746_read_altmac()
69 buf[35] = sizeof(manufacturer_name) - 1 + BQ27Z746_MAC_OVERHEAD_LEN; in emul_bq27z746_read_altmac()
72 memcpy(&buf[2], device_name, sizeof(device_name) - 1); in emul_bq27z746_read_altmac()
[all …]
/Zephyr-latest/dts/bindings/counter/
Datmel,sam-tc.yaml1 # SPDX-License-Identifier: Apache-2.0
5 compatible: "atmel,sam-tc"
8 - name: base.yaml
9 - name: pinctrl-device.yaml
12 reg:
25 Valid range: 0 - 2
30 Clock source selection as defined by TCCLKS bit-field of TC_CMR
40 reg-cmr:
47 properties like channel-num, pinctrl-0 this allows e.g. to configure
51 reg-rc:
[all …]
/Zephyr-latest/drivers/can/
Dcan_numaker.c4 * SPDX-License-Identifier: Apache-2.0
47 const struct can_mcan_config *mcan_config = dev->config; in can_numaker_get_core_clock()
48 const struct can_numaker_config *config = mcan_config->custom; in can_numaker_get_core_clock()
53 clksrc_rate_idx = CLK_GetModuleClockSource(config->clk_modidx); in can_numaker_get_core_clock()
55 clkdiv_divider = CLK_GetModuleClockDivider(config->clk_modidx) + 1; in can_numaker_get_core_clock()
72 return -EIO; in can_numaker_get_core_clock()
82 const struct can_mcan_config *mcan_config = dev->config; in can_numaker_init_unlocked()
83 const struct can_numaker_config *config = mcan_config->custom; in can_numaker_init_unlocked()
85 int rc; in can_numaker_init_unlocked() local
89 scc_subsys.pcc.clk_modidx = config->clk_modidx; in can_numaker_init_unlocked()
[all …]
/Zephyr-latest/drivers/i2c/
Di2c_sifive.c4 * SPDX-License-Identifier: Apache-2.0
18 #include "i2c-priv.h"
22 #define I2C_REG(config, reg) ((mem_addr_t) ((config)->base + reg)) argument
23 #define IS_SET(config, reg, value) (sys_read8(I2C_REG(config, reg)) & (value)) argument
73 const struct i2c_sifive_cfg *config = dev->config; in i2c_sifive_busy()
82 const struct i2c_sifive_cfg *config = dev->config; in i2c_sifive_send_addr()
103 return -EIO; in i2c_sifive_send_addr()
113 const struct i2c_sifive_cfg *config = dev->config; in i2c_sifive_write_msg()
114 int rc = 0; in i2c_sifive_write_msg() local
117 rc = i2c_sifive_send_addr(dev, addr, SF_TX_WRITE); in i2c_sifive_write_msg()
[all …]
/Zephyr-latest/drivers/sensor/silabs/si7210/
Dsi7210.c4 * SPDX-License-Identifier: Apache-2.0
113 const struct si7210_config *config = dev->config; in si7210_sleep()
114 struct si7210_data *data = dev->data; in si7210_sleep()
115 int rc; in si7210_sleep() local
119 * the register, but they get reloaded from OTP during wake-up. in si7210_sleep()
121 rc = i2c_reg_write_byte_dt(&config->bus, SI7210_REG_CTRL3, 0); in si7210_sleep()
122 if (rc < 0) { in si7210_sleep()
124 return rc; in si7210_sleep()
128 rc = i2c_reg_write_byte_dt(&config->bus, SI7210_REG_POWER_CTRL, in si7210_sleep()
130 if (rc < 0) { in si7210_sleep()
[all …]
/Zephyr-latest/drivers/sensor/honeywell/mpr/
Dmpr.c1 /* mpr.c - Driver for Honeywell MPR pressure sensor series */
6 * SPDX-License-Identifier: Apache-2.0
26 const struct mpr_config *cfg = dev->config; in mpr_init()
28 if (!device_is_ready(cfg->i2c.bus)) { in mpr_init()
30 return -ENODEV; in mpr_init()
38 struct mpr_data *data = dev->data; in mpr_read_reg()
39 const struct mpr_config *cfg = dev->config; in mpr_read_reg()
44 int rc = i2c_write_dt(&cfg->i2c, write_buf, sizeof(write_buf)); in mpr_read_reg() local
46 if (rc < 0) { in mpr_read_reg()
47 return rc; in mpr_read_reg()
[all …]
/Zephyr-latest/drivers/sensor/aosong/dht20/
Ddht20.c4 * SPDX-License-Identifier: Apache-2.0
72 const struct dht20_config *cfg = dev->config; in read_status()
73 int rc; in read_status() local
78 rc = i2c_write_dt(&cfg->bus, tx_buf, sizeof(tx_buf)); in read_status()
79 if (rc < 0) { in read_status()
81 return rc; in read_status()
84 rc = i2c_read_dt(&cfg->bus, rx_buf, sizeof(rx_buf)); in read_status()
85 if (rc < 0) { in read_status()
87 return rc; in read_status()
92 return rc; in read_status()
[all …]
/Zephyr-latest/drivers/counter/
Dmaxim_ds3231.c2 * Copyright (c) 2019-2020 Peter Bigot Consulting, LLC
4 * SPDX-License-Identifier: Apache-2.0
33 /* Return lower 32-bits of time as counter value */
107 * such an operation, or when doing a no-notify synchronize
148 struct ds3231_data *data = dev->data; in sc_ctrl()
149 const struct ds3231_config *cfg = dev->config; in sc_ctrl()
150 struct register_map *rp = &data->registers; in sc_ctrl()
151 uint8_t ctrl = (rp->ctrl & ~clear) | set; in sc_ctrl()
152 int rc = ctrl; in sc_ctrl() local
154 if (rp->ctrl != ctrl) { in sc_ctrl()
[all …]
/Zephyr-latest/drivers/fuel_gauge/sbs_gauge/
Dsbs_gauge.c7 * SPDX-License-Identifier: Apache-2.0
31 cfg = dev->config; in sbs_cmd_reg_read()
32 status = i2c_burst_read_dt(&cfg->i2c, reg_addr, i2c_data, ARRAY_SIZE(i2c_data)); in sbs_cmd_reg_read()
45 const struct sbs_gauge_config *config = dev->config; in sbs_cmd_reg_write()
50 return i2c_burst_write_dt(&config->i2c, reg_addr, buf, sizeof(buf)); in sbs_cmd_reg_write()
59 cfg = dev->config; in sbs_cmd_buffer_read()
60 status = i2c_burst_read_dt(&cfg->i2c, reg_addr, buffer, buffer_size); in sbs_cmd_buffer_read()
72 int rc = 0; in sbs_gauge_get_prop() local
77 rc = sbs_cmd_reg_read(dev, SBS_GAUGE_CMD_AVG_CURRENT, &tmp_val); in sbs_gauge_get_prop()
78 val->avg_current = tmp_val * 1000; in sbs_gauge_get_prop()
[all …]
Demul_sbs_gauge.c5 * SPDX-License-Identifier: Apache-2.0
33 /** Run-time data used by the emulator */
48 /* Non-register values associated with the state of the battery */
51 /* Battery terminal current - Pos is charging, Neg is discharging */
65 static void emul_sbs_gauge_maybe_do_battery_cutoff(const struct emul *target, int reg, int val) in emul_sbs_gauge_maybe_do_battery_cutoff() argument
67 struct sbs_gauge_emul_data *data = target->data; in emul_sbs_gauge_maybe_do_battery_cutoff()
68 const struct sbs_gauge_emul_cfg *cfg = target->cfg; in emul_sbs_gauge_maybe_do_battery_cutoff()
71 if (cfg->cutoff_support && reg == cfg->cutoff_reg_addr) { in emul_sbs_gauge_maybe_do_battery_cutoff()
72 __ASSERT_NO_MSG(ARRAY_SIZE(cfg->cutoff_payload) > 0); in emul_sbs_gauge_maybe_do_battery_cutoff()
79 uint16_t target_payload_elem_val = cfg->cutoff_payload[data->cutoff_writes]; in emul_sbs_gauge_maybe_do_battery_cutoff()
[all …]
/Zephyr-latest/drivers/spi/
Dspi_opentitan.c4 * SPDX-License-Identifier: Apache-2.0
78 const struct spi_opentitan_cfg *cfg = dev->config; in spi_config()
80 uint32_t reg; in spi_config() local
83 return -ENOTSUP; in spi_config()
87 return -ENOTSUP; in spi_config()
91 return -ENOTSUP; in spi_config()
95 return -ENOTSUP; in spi_config()
100 return -ENOTSUP; in spi_config()
105 return -ENOTSUP; in spi_config()
111 reg = cfg->f_input / 2 / frequency; in spi_config()
[all …]
/Zephyr-latest/drivers/sensor/adi/adltc2990/
Dadltc2990_emul.c2 * SPDX-FileCopyrightText: Copyright (c) 2023 Carl Zeiss Meditec AG
3 * SPDX-License-Identifier: Apache-2.0
25 uint8_t reg[ADLTC2990_NUM_REGS]; member
33 struct adltc2990_emul_data *data = target->data; in adltc2990_emul_set_reg()
36 memcpy(data->reg + reg_addr, val, 1); in adltc2990_emul_set_reg()
41 struct adltc2990_emul_data *data = target->data; in adltc2990_emul_get_reg()
44 memcpy(val, data->reg + reg_addr, 1); in adltc2990_emul_get_reg()
49 struct adltc2990_emul_data *data = target->data; in adltc2990_emul_reset()
51 memset(data->reg, 0, ADLTC2990_NUM_REGS); in adltc2990_emul_reset()
56 struct adltc2990_emul_data *data = target->data; in adltc2990_emul_handle_write()
[all …]
/Zephyr-latest/tests/lib/onoff/src/
Dmain.c5 * SPDX-License-Identifier: Apache-2.0
46 zassert_equal(xp->state, state, in check_trans()
48 idx, xp->state, state, tag); in check_trans()
49 zassert_equal(xp->res, res, in check_trans()
51 idx, xp->res, res, tag); in check_trans()
93 int rc = sys_notify_fetch_result(&cp->notify, &result); in cli_result() local
95 if (rc == 0) { in cli_result()
96 rc = result; in cli_result()
98 return rc; in cli_result()
119 tsp->async = false; in reset_transit_state()
[all …]
/Zephyr-latest/samples/subsys/modbus/tcp_server/src/
Dmain.c5 * SPDX-License-Identifier: Apache-2.0
45 if (rx_adu->length != request_len) { in custom_handler()
51 subfunc = rx_adu->data[0]; in custom_handler()
52 data_len = rx_adu->data[1]; in custom_handler()
56 sys_put_be16(0x5555, tx_adu->data); in custom_handler()
57 sys_put_be16(0xAAAA, &tx_adu->data[2]); in custom_handler()
58 sys_put_be16(*read_counter, &tx_adu->data[4]); in custom_handler()
59 tx_adu->length = response_len; in custom_handler()
73 return -ENODEV; in init_leds()
89 return -ENOTSUP; in coil_rd()
[all …]
/Zephyr-latest/drivers/adc/
Dadc_ads1112.c6 * SPDX-License-Identifier: Apache-2.0
81 const struct ads1112_config *config = dev->config; in ads1112_read_reg()
83 int rc = i2c_read_dt(&config->bus, buf, sizeof(buf)); in ads1112_read_reg() local
92 return rc; in ads1112_read_reg()
95 static int ads1112_write_reg(const struct device *dev, uint8_t reg) in ads1112_write_reg() argument
97 uint8_t msg[1] = {reg}; in ads1112_write_reg()
98 const struct ads1112_config *config = dev->config; in ads1112_write_reg()
104 return i2c_write_dt(&config->bus, msg, sizeof(msg)); in ads1112_write_reg()
109 struct ads1112_data *data = dev->data; in ads1112_acq_time_to_dr()
110 int odr = -EINVAL; in ads1112_acq_time_to_dr()
[all …]
Dadc_ads1119.c5 * SPDX-License-Identifier: Apache-2.0
107 const struct ads1119_config *config = dev->config; in ads1119_read_reg()
109 return i2c_reg_read_byte_dt(&config->bus, ADS1119_CMD_READ_REG | reg_addr, reg_val); in ads1119_read_reg()
112 static int ads1119_write_reg(const struct device *dev, uint8_t reg) in ads1119_write_reg() argument
114 const struct ads1119_config *config = dev->config; in ads1119_write_reg()
116 return i2c_reg_write_byte_dt(&config->bus, ADS1119_CMD_WRITE_REG, reg); in ads1119_write_reg()
122 struct ads1119_data *data = dev->data; in ads1119_acq_time_to_dr()
123 int odr = -EINVAL; in ads1119_acq_time_to_dr()
130 return -EINVAL; in ads1119_acq_time_to_dr()
157 data->ready_time = K_USEC(ready_time_us + 10); in ads1119_acq_time_to_dr()
[all …]
/Zephyr-latest/drivers/sensor/asahi_kasei/akm09918c/
Dakm09918c_emul.c3 * SPDX-License-Identifier: Apache-2.0
25 uint8_t reg[NUM_REGS]; member
34 struct akm09918c_emul_data *data = target->data; in akm09918c_emul_set_reg()
37 memcpy(data->reg + reg_addr, val, count); in akm09918c_emul_set_reg()
42 struct akm09918c_emul_data *data = target->data; in akm09918c_emul_get_reg()
45 memcpy(val, data->reg + reg_addr, count); in akm09918c_emul_get_reg()
50 struct akm09918c_emul_data *data = target->data; in akm09918c_emul_reset()
52 memset(data->reg, 0, NUM_REGS); in akm09918c_emul_reset()
53 data->reg[AKM09918C_REG_WIA1] = AKM09918C_WIA1; in akm09918c_emul_reset()
54 data->reg[AKM09918C_REG_WIA2] = AKM09918C_WIA2; in akm09918c_emul_reset()
[all …]

12345