Lines Matching refs:target
304 struct mcux_flexcomm_target_data *target; in mcux_flexcomm_find_free_target() local
308 target = &data->target_data[i]; in mcux_flexcomm_find_free_target()
309 if (!target->target_attached) { in mcux_flexcomm_find_free_target()
310 return target; in mcux_flexcomm_find_free_target()
319 struct mcux_flexcomm_target_data *target; in mcux_flexcomm_find_target_by_address() local
323 target = &data->target_data[i]; in mcux_flexcomm_find_target_by_address()
324 if (target->target_attached && target->target_cfg->address == address) { in mcux_flexcomm_find_target_by_address()
325 return target; in mcux_flexcomm_find_target_by_address()
332 struct mcux_flexcomm_target_data *target, bool disabled) in mcux_flexcomm_setup_i2c_config_address() argument
339 if (data->target_data[i].target_attached && &data->target_data[i] == target) { in mcux_flexcomm_setup_i2c_config_address()
368 addr->address = target->target_cfg->address; in mcux_flexcomm_setup_i2c_config_address()
380 struct mcux_flexcomm_target_data *target; in i2c_target_transfer_callback() local
386 target = mcux_flexcomm_find_target_by_address(data, address); in i2c_target_transfer_callback()
387 if (!target) { in i2c_target_transfer_callback()
392 target_cb = target->target_cfg->callbacks; in i2c_target_transfer_callback()
397 if (target->first_read && target_cb->read_requested) { in i2c_target_transfer_callback()
398 target->first_read = false; in i2c_target_transfer_callback()
399 target_cb->read_requested(target->target_cfg, &txVal); in i2c_target_transfer_callback()
401 target_cb->read_processed(target->target_cfg, &txVal); in i2c_target_transfer_callback()
410 if (target->first_write && target_cb->write_requested) { in i2c_target_transfer_callback()
411 target_cb->write_requested(target->target_cfg); in i2c_target_transfer_callback()
412 target->first_write = false; in i2c_target_transfer_callback()
417 target->is_write = true; in i2c_target_transfer_callback()
422 if (target->is_write && target_cb->write_received) { in i2c_target_transfer_callback()
423 target_cb->write_received(target->target_cfg, rxVal); in i2c_target_transfer_callback()
424 target->is_write = false; in i2c_target_transfer_callback()
430 target_cb->stop(target->target_cfg); in i2c_target_transfer_callback()
433 target->first_read = true; in i2c_target_transfer_callback()
434 target->first_write = true; in i2c_target_transfer_callback()
471 struct mcux_flexcomm_target_data *target; in mcux_flexcomm_target_register() local
480 target = mcux_flexcomm_find_free_target(data); in mcux_flexcomm_target_register()
481 if (!target) { in mcux_flexcomm_target_register()
485 target->target_cfg = target_config; in mcux_flexcomm_target_register()
486 target->target_attached = true; in mcux_flexcomm_target_register()
487 target->first_read = true; in mcux_flexcomm_target_register()
488 target->first_write = true; in mcux_flexcomm_target_register()
494 if (mcux_flexcomm_setup_i2c_config_address(data, target, false) < 0) { in mcux_flexcomm_target_register()
511 struct mcux_flexcomm_target_data *target; in mcux_flexcomm_target_unregister() local
514 target = mcux_flexcomm_find_target_by_address(data, target_config->address); in mcux_flexcomm_target_unregister()
515 if (!target || !target->target_attached) { in mcux_flexcomm_target_unregister()
519 if (mcux_flexcomm_setup_i2c_config_address(data, target, true) < 0) { in mcux_flexcomm_target_unregister()
523 target->target_cfg = NULL; in mcux_flexcomm_target_unregister()
524 target->target_attached = false; in mcux_flexcomm_target_unregister()