Lines Matching +full:reg +full:- +full:rc

2  * 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()
60 data->reg[ADLTC2990_REG_CONTROL] = value; in adltc2990_emul_handle_write()
64 data->reg[ADLTC2990_REG_TRIGGER] = value; in adltc2990_emul_handle_write()
76 struct adltc2990_emul_data *data = target->data; in adltc2990_emul_transfer_i2c()
78 i2c_dump_msgs_rw(target->dev, msgs, num_msgs, addr, false); in adltc2990_emul_transfer_i2c()
82 return -EIO; in adltc2990_emul_transfer_i2c()
84 if (FIELD_GET(I2C_MSG_READ, msgs->flags)) { in adltc2990_emul_transfer_i2c()
86 return -EIO; in adltc2990_emul_transfer_i2c()
88 if (msgs->len < 1) { in adltc2990_emul_transfer_i2c()
89 LOG_ERR("Unexpected msg0 length %d", msgs->len); in adltc2990_emul_transfer_i2c()
90 return -EIO; in adltc2990_emul_transfer_i2c()
93 uint8_t regn = msgs->buf[0]; in adltc2990_emul_transfer_i2c()
94 bool is_read = FIELD_GET(I2C_MSG_READ, msgs->flags) == 1; in adltc2990_emul_transfer_i2c()
95 bool is_stop = FIELD_GET(I2C_MSG_STOP, msgs->flags) == 1; in adltc2990_emul_transfer_i2c()
100 is_read = FIELD_GET(I2C_MSG_READ, msgs->flags) == 1; in adltc2990_emul_transfer_i2c()
101 is_stop = FIELD_GET(I2C_MSG_STOP, msgs->flags) == 1; in adltc2990_emul_transfer_i2c()
105 for (int i = 0; i < msgs->len; ++i) { in adltc2990_emul_transfer_i2c()
106 msgs->buf[i] = data->reg[regn + i]; in adltc2990_emul_transfer_i2c()
109 int rc = adltc2990_emul_handle_write(target, regn, msgs->buf[1]); in adltc2990_emul_transfer_i2c() local
111 if (rc != 0) { in adltc2990_emul_transfer_i2c()
112 return rc; in adltc2990_emul_transfer_i2c()