Lines Matching +full:- +full:- +full:merge +full:- +full:mode +full:- +full:functions
10 * SPDX-License-Identifier: Apache-2.0
65 /** Use 10-bit addressing. DEPRECATED - Use I2C_MSG_ADDR_10_BITS instead. */
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.
271 /** Target device responds to 10-bit addressing. */
438 * i2c_target_unregister() functions to indicate addition and removal
455 /** Callback functions */
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()
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()
760 * @brief Perform data transfer to another I2C device in controller mode.
775 * limitations on support for multi-message bus transactions.
782 * driver configured in controller mode.
788 * @retval -EIO General input / output error.
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()
823 * @brief Perform data transfer to another I2C device in controller mode.
832 * driver configured in controller mode.
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
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()
871 * @brief Perform data transfer to another I2C device in master mode asynchronously.
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
903 * driver configured in master mode.
923 return -EINVAL; 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()
974 * @brief Perform data transfer to another I2C device in controller mode.
983 * driver configured in controller mode.
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
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()
1128 * @brief Perform data transfer to another I2C device in controller mode.
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()
1152 * driver configured in controller mode.
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()
1175 * Enable I2C target mode for the 'dev' I2C bus driver using the provided
1176 * 'config' struct containing the functions and parameters to send bus
1178 * struct member. Addressing mode - 7 or 10 bit - depends on the 'flags'
1179 * struct member. Any I2C bus events related to the target mode will be passed
1180 * onto I2C target device driver via a set of callback functions provided in
1184 * and target mode. This is however not guaranteed.
1187 * driver configured in target mode.
1188 * @param cfg Config struct with functions and parameters used by the I2C driver
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()
1212 * This routine disables I2C target mode for the 'dev' I2C bus driver using
1213 * the provided 'config' struct containing the functions and parameters
1217 * driver configured in target mode.
1218 * @param cfg Config struct with functions and parameters used by the I2C driver
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()
1294 * driver configured in controller mode.
1300 * @retval -EIO General input / output error.
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()
1339 * driver configured in controller mode.
1345 * @retval -EIO General input / output error.
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
1386 * driver configured in controller mode.
1418 * i2c_write_read(spec->bus, spec->addr,
1434 return i2c_write_read(spec->bus, spec->addr, in i2c_write_read_dt()
1448 * driver configured in controller mode.
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()
1503 * driver configured in controller mode.
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
1561 * driver configured in controller mode.
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
1607 * driver configured in controller mode.
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
1653 * driver configured in controller mode.
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()