* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. * Functions used for executing the I²C protocol. * Caller should provide a vector of function calls which can * be called to perform the following low-level functions: * set_scl() set SCL line 0 or 1 * set_sda() set SDA line 0 or 1 * get_scl() return SCL line * get_sda() return SDA line * ddc_clk() wait for 'n' clock periods. 'n' is usually 1 * and the period is typically 2.5-40 µsec, but this * value is up to the implementation. One bus cycle * is four clock periods, so the minimum allowable * period is 2.5 µsec (100 kHz bus clock). * clock_interval integer field specifying the clock period in µsec. * clock_stretch integer field specifying maximum clock stretch * time in µsec. Typically 10000. * All functions accept two arbitrary arguments which may be used * to pass one pointer and one integer value. These might typically * be used to pass a device softc structure and a unit number. * All functions which return an int will return 0 on success, error code * Caller should use mutex locking to ensure that two threads do not * attempt to simultaneously access the device. The regular device * mutex should usually not be used for this purpose if avoidable, as this * protocol can take a considerable amount of time to execute.