/* * Copyright 2018 Advanced Micro Devices, Inc. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Authors: AMD *
*/
if (!wait_for_scl_high_sw(ctx, ddc_handle, clock_delay_div_4)) returnfalse;
write_bit_to_ddc(ddc_handle, SCL, false);
--shift;
} while (shift >= 0);
/* The display sends ACK by preventing the SDA from going high * after the SCL pulse we use to send our last data bit. * If the SDA goes high after that bit, it's a NACK
*/
udelay(clock_delay_div_4);
write_bit_to_ddc(ddc_handle, SDA, true);
udelay(clock_delay_div_4);
write_bit_to_ddc(ddc_handle, SCL, true);
if (!wait_for_scl_high_sw(ctx, ddc_handle, clock_delay_div_4)) returnfalse;
bool result = start_sync_sw(engine->ctx, ddc, clock_delay_div_4);
/* process payload */
if (result) { switch (req->action) { case DCE_I2C_TRANSACTION_ACTION_I2C_WRITE: case DCE_I2C_TRANSACTION_ACTION_I2C_WRITE_MOT:
result = i2c_write_sw(engine->ctx, ddc, clock_delay_div_4,
req->address, req->length, req->data); break; case DCE_I2C_TRANSACTION_ACTION_I2C_READ: case DCE_I2C_TRANSACTION_ACTION_I2C_READ_MOT:
result = i2c_read_sw(engine->ctx, ddc, clock_delay_div_4,
req->address, req->length, req->data); break; default:
result = false; break;
}
}
/* send stop if not 'mot' or operation failed */
if (!result ||
(req->action == DCE_I2C_TRANSACTION_ACTION_I2C_WRITE) ||
(req->action == DCE_I2C_TRANSACTION_ACTION_I2C_READ)) if (!stop_sync_sw(engine->ctx, ddc, clock_delay_div_4))
result = false;
req->status = result ?
I2C_CHANNEL_OPERATION_SUCCEEDED :
I2C_CHANNEL_OPERATION_FAILED;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.