Lines Matching +full:enter +full:- +full:4 +full:byte +full:- +full:addr

10  * SPDX-License-Identifier: Apache-2.0
65 /** Use 10-bit addressing. DEPRECATED - Use I2C_MSG_ADDR_10_BITS instead. */
69 #define I2C_MODE_CONTROLLER BIT(4)
75 * @param addr is the target address
79 uint16_t addr; member
94 .addr = DT_PROP_BY_IDX(node_id, reg, 0)
108 .addr = DT_REG_ADDR(node_id)
160 * that follows a write, or vice-versa. Some drivers will merge
165 /** Use 10-bit addressing for this message.
199 * @param result Result code of the transfer request. 0 is success, -errno for failure.
219 uint16_t addr);
228 uint16_t addr,
271 /** Target device responds to 10-bit addressing. */
280 * A success return shall cause the controller to ACK the next byte
282 * next byte received.
295 * reception of a byte of data in an ongoing write operation to the
298 * A success return shall cause the controller to ACK the next byte
300 * next byte received.
305 * @param val the byte received by the controller.
327 * @param val pointer to storage for the first byte of data to return
349 * @param val pointer to storage for the next byte of data to return
406 * controller shall enter a state where it is ready to react to new
470 return device_is_ready(spec->bus); in i2c_is_ready_dt()
482 return (msg->flags & I2C_MSG_READ) == I2C_MSG_READ; in i2c_is_read_op()
494 return (msg->flags & I2C_MSG_STOP) == I2C_MSG_STOP; in i2c_is_stop_op()
507 * D: I2C msg: testing, addr=56
520 * @param addr Address of the I2C target device.
524 uint16_t addr, bool dump_read);
531 * i2c_dump_msgs_rw(dev, msgs, num_msgs, addr, false);
538 * @param addr Address of the I2C target device.
541 uint8_t num_msgs, uint16_t addr) in i2c_dump_msgs() argument
543 i2c_dump_msgs_rw(dev, msgs, num_msgs, addr, false); in i2c_dump_msgs()
588 CONTAINER_OF(dev->state, struct i2c_device_state, devstate); in i2c_xfer_stats()
592 STATS_INC(state->stats, transfer_call_count); in i2c_xfer_stats()
593 STATS_INCN(state->stats, message_count, num_msgs); in i2c_xfer_stats()
601 STATS_INCN(state->stats, bytes_read, bytes_read); in i2c_xfer_stats()
602 STATS_INCN(state->stats, bytes_written, bytes_written); in i2c_xfer_stats()
624 CONTAINER_OF(dev->state, struct i2c_device_state, devstate); \
625 stats_init(&state->stats.s_hdr, STATS_SIZE_32, 4, \
627 stats_register(dev->name, &(state->stats.s_hdr)); \
709 * @param dev_config Bit-packed 32-bit value to the device runtime configuration
713 * @retval -EIO General input / output error, failed to configure device.
721 (const struct i2c_driver_api *)dev->api; in z_impl_i2c_configure()
723 return api->configure(dev, dev_config); in z_impl_i2c_configure()
738 * @param dev_config Pointer to return bit-packed 32-bit value of
742 * @retval -EIO General input / output error.
743 * @retval -ERANGE Configured I2C frequency is invalid.
744 * @retval -ENOSYS If get config is not implemented
750 const struct i2c_driver_api *api = (const struct i2c_driver_api *)dev->api; in z_impl_i2c_get_config()
752 if (api->get_config == NULL) { in z_impl_i2c_get_config()
753 return -ENOSYS; in z_impl_i2c_get_config()
756 return api->get_config(dev, dev_config); in z_impl_i2c_get_config()
775 * limitations on support for multi-message bus transactions.
785 * @param addr Address of the I2C target device.
788 * @retval -EIO General input / output error.
792 uint16_t addr);
796 uint16_t addr) in z_impl_i2c_transfer() argument
799 (const struct i2c_driver_api *)dev->api; in z_impl_i2c_transfer()
806 msgs[num_msgs - 1].flags |= I2C_MSG_STOP; in z_impl_i2c_transfer()
809 int res = api->transfer(dev, msgs, num_msgs, addr); in z_impl_i2c_transfer()
814 i2c_dump_msgs_rw(dev, msgs, num_msgs, addr, true); in z_impl_i2c_transfer()
835 * @param addr Address of the I2C target device.
840 * @retval -EIO General input / output error.
841 * @retval -ENOSYS If transfer async is not implemented
842 * @retval -EWOULDBLOCK If the device is temporarily busy doing another transfer
847 uint16_t addr, in i2c_transfer_cb() argument
852 (const struct i2c_driver_api *)dev->api; in i2c_transfer_cb()
854 if (api->transfer_cb == NULL) { in i2c_transfer_cb()
855 return -ENOSYS; in i2c_transfer_cb()
864 msgs[num_msgs - 1].flags |= I2C_MSG_STOP; in i2c_transfer_cb()
867 return api->transfer_cb(dev, msgs, num_msgs, addr, cb, userdata); in i2c_transfer_cb()
875 * i2c_transfer_cb(spec->bus, msgs, num_msgs, spec->addr, cb, userdata);
891 return i2c_transfer_cb(spec->bus, msgs, num_msgs, spec->addr, cb, userdata); in i2c_transfer_cb_dt()
898 * it to me" transaction pair through a combined write-then-read bus
906 * @param addr Address of the I2C device
918 uint8_t num_msgs, uint16_t addr, const void *write_buf, in i2c_write_read_cb() argument
923 return -EINVAL; in i2c_write_read_cb()
934 return i2c_transfer_cb(dev, msgs, num_msgs, addr, cb, userdata); in i2c_write_read_cb()
942 * i2c_write_read_cb(spec->bus, msgs, num_msgs,
943 * spec->addr, write_buf,
963 return i2c_write_read_cb(spec->bus, msgs, num_msgs, spec->addr, write_buf, num_write, in i2c_write_read_cb_dt()
986 * @param addr Address of the I2C target device.
990 * @retval -EIO General input / output error.
991 * @retval -ENOSYS If transfer async is not implemented
992 * @retval -EWOULDBLOCK If the device is temporarily busy doing another transfer
997 uint16_t addr, in i2c_transfer_signal() argument
1000 const struct i2c_driver_api *api = (const struct i2c_driver_api *)dev->api; in i2c_transfer_signal()
1002 if (api->transfer_cb == NULL) { in i2c_transfer_signal()
1003 return -ENOSYS; in i2c_transfer_signal()
1006 return api->transfer_cb(dev, msgs, num_msgs, addr, z_i2c_transfer_signal_cb, sig); in i2c_transfer_signal()
1036 const struct i2c_dt_spec *dt_spec = (const struct i2c_dt_spec *)iodev_sqe->sqe.iodev->data; in i2c_iodev_submit()
1037 const struct device *dev = dt_spec->bus; in i2c_iodev_submit()
1038 const struct i2c_driver_api *api = (const struct i2c_driver_api *)dev->api; in i2c_iodev_submit()
1040 if (api->iodev_submit == NULL) { in i2c_iodev_submit()
1041 rtio_iodev_sqe_err(iodev_sqe, -ENOSYS); in i2c_iodev_submit()
1044 api->iodev_submit(dt_spec->bus, iodev_sqe); in i2c_iodev_submit()
1076 .addr = _addr, \
1132 * i2c_transfer(spec->bus, msgs, num_msgs, spec->addr);
1143 return i2c_transfer(spec->bus, msgs, num_msgs, spec->addr); in i2c_transfer_dt()
1154 * @retval -EBUSY If bus is not clear after recovery attempt.
1155 * @retval -EIO General input / output error.
1156 * @retval -ENOSYS If bus recovery is not implemented
1163 (const struct i2c_driver_api *)dev->api; in z_impl_i2c_recover_bus()
1165 if (api->recover_bus == NULL) { in z_impl_i2c_recover_bus()
1166 return -ENOSYS; in z_impl_i2c_recover_bus()
1169 return api->recover_bus(dev); in z_impl_i2c_recover_bus()
1178 * struct member. Addressing mode - 7 or 10 bit - depends on the 'flags'
1192 * @retval -EINVAL If parameters are invalid
1193 * @retval -EIO General input / output error.
1194 * @retval -ENOSYS If target mode is not implemented
1200 (const struct i2c_driver_api *)dev->api; in i2c_target_register()
1202 if (api->target_register == NULL) { in i2c_target_register()
1203 return -ENOSYS; in i2c_target_register()
1206 return api->target_register(dev, cfg); in i2c_target_register()
1222 * @retval -EINVAL If parameters are invalid
1223 * @retval -ENOSYS If target mode is not implemented
1229 (const struct i2c_driver_api *)dev->api; in i2c_target_unregister()
1231 if (api->target_unregister == NULL) { in i2c_target_unregister()
1232 return -ENOSYS; in i2c_target_unregister()
1235 return api->target_unregister(dev, cfg); in i2c_target_unregister()
1248 * @retval -EINVAL If parameters are invalid
1249 * @retval -EIO General input / output error.
1256 (const struct i2c_target_driver_api *)dev->api; in z_impl_i2c_target_driver_register()
1258 return api->driver_register(dev); in z_impl_i2c_target_driver_register()
1272 * @retval -EINVAL If parameters are invalid
1279 (const struct i2c_target_driver_api *)dev->api; in z_impl_i2c_target_driver_unregister()
1281 return api->driver_unregister(dev); in z_impl_i2c_target_driver_unregister()
1285 * Derived i2c APIs -- all implemented in terms of i2c_transfer()
1297 * @param addr Address to the target I2C device for writing.
1300 * @retval -EIO General input / output error.
1303 uint32_t num_bytes, uint16_t addr) in i2c_write() argument
1311 return i2c_transfer(dev, &msg, 1, addr); in i2c_write()
1319 * i2c_write(spec->bus, buf, num_bytes, spec->addr);
1330 return i2c_write(spec->bus, buf, num_bytes, spec->addr); in i2c_write_dt()
1342 * @param addr Address of the I2C device being read.
1345 * @retval -EIO General input / output error.
1348 uint32_t num_bytes, uint16_t addr) in i2c_read() argument
1356 return i2c_transfer(dev, &msg, 1, addr); in i2c_read()
1364 * i2c_read(spec->bus, buf, num_bytes, spec->addr);
1375 return i2c_read(spec->bus, buf, num_bytes, spec->addr); in i2c_read_dt()
1382 * it to me" transaction pair through a combined write-then-read bus
1387 * @param addr Address of the I2C device
1396 static inline int i2c_write_read(const struct device *dev, uint16_t addr, in i2c_write_read() argument
1410 return i2c_transfer(dev, msg, 2, addr); in i2c_write_read()
1418 * i2c_write_read(spec->bus, spec->addr,
1434 return i2c_write_read(spec->bus, spec->addr, in i2c_write_read_dt()
1455 * @retval -EIO General input / output error.
1473 * i2c_burst_read(spec->bus, spec->addr, start_addr, buf, num_bytes);
1487 return i2c_burst_read(spec->bus, spec->addr, in i2c_burst_read_dt()
1510 * @retval -EIO General input / output error.
1536 * i2c_burst_write(spec->bus, spec->addr, start_addr, buf, num_bytes);
1550 return i2c_burst_write(spec->bus, spec->addr, in i2c_burst_write_dt()
1557 * This routine reads the value of an 8-bit internal register of an I2C
1567 * @retval -EIO General input / output error.
1583 * i2c_reg_read_byte(spec->bus, spec->addr, reg_addr, value);
1594 return i2c_reg_read_byte(spec->bus, spec->addr, reg_addr, value); in i2c_reg_read_byte_dt()
1600 * This routine writes a value to an 8-bit internal register of an I2C
1613 * @retval -EIO General input / output error.
1629 * i2c_reg_write_byte(spec->bus, spec->addr, reg_addr, value);
1640 return i2c_reg_write_byte(spec->bus, spec->addr, reg_addr, value); in i2c_reg_write_byte_dt()
1646 * This routine updates the value of a set of bits from an 8-bit internal
1660 * @retval -EIO General input / output error.
1688 * i2c_reg_update_byte(spec->bus, spec->addr, reg_addr, mask, value);
1701 return i2c_reg_update_byte(spec->bus, spec->addr, in i2c_reg_update_byte_dt()