Lines Matching +full:reg +full:- +full:rc
5 * 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()
108 return -ENOTSUP; in coil_wr()
126 static int holding_reg_rd(uint16_t addr, uint16_t *reg) in holding_reg_rd() argument
129 return -ENOTSUP; in holding_reg_rd()
132 *reg = holding_reg[addr]; in holding_reg_rd()
139 static int holding_reg_wr(uint16_t addr, uint16_t reg) in holding_reg_wr() argument
142 return -ENOTSUP; in holding_reg_wr()
145 holding_reg[addr] = reg; in holding_reg_wr()
168 tmp_adu.trans_id = adu->trans_id; in server_raw_cb()
169 tmp_adu.proto_id = adu->proto_id; in server_raw_cb()
170 tmp_adu.length = adu->length; in server_raw_cb()
171 tmp_adu.unit_id = adu->unit_id; in server_raw_cb()
172 tmp_adu.fc = adu->fc; in server_raw_cb()
173 memcpy(tmp_adu.data, adu->data, in server_raw_cb()
174 MIN(adu->length, CONFIG_MODBUS_BUFFER_SIZE)); in server_raw_cb()
202 return -ENODEV; in init_modbus_server()
220 return -errno; in modbus_tcp_reply()
223 if (send(client, adu->data, adu->length, 0) < 0) { in modbus_tcp_reply()
224 return -errno; in modbus_tcp_reply()
233 int rc; in modbus_tcp_connection() local
236 rc = recv(client, header, sizeof(header), MSG_WAITALL); in modbus_tcp_connection()
237 if (rc <= 0) { in modbus_tcp_connection()
238 return rc == 0 ? -ENOTCONN : -errno; in modbus_tcp_connection()
245 rc = recv(client, tmp_adu.data, data_len, MSG_WAITALL); in modbus_tcp_connection()
246 if (rc <= 0) { in modbus_tcp_connection()
247 return rc == 0 ? -ENOTCONN : -errno; in modbus_tcp_connection()
253 return -EIO; in modbus_tcp_connection()
308 int rc; in main() local
324 rc = modbus_tcp_connection(client); in main()
325 } while (!rc); in main()
329 addr_str, rc); in main()