Interface for I2C controller drivers.
More...
Interface for I2C controller drivers.
A driver embeds a struct pbl_i2c_bus in its instance, sets it up with PBL_I2C_BUS_STATE_DEFINE() and PBL_I2C_BUS_INIT(), and implements the struct pbl_i2c_bus_ops the class calls.
◆ PBL_I2C_BUS_INIT
| #define PBL_I2C_BUS_INIT |
( |
|
sym, |
|
|
|
_name, |
|
|
|
_parent, |
|
|
|
_ops |
|
) |
| |
Value: { \
.ops = (_ops), \
.state = &sym##_i2c_state, \
}
#define PBL_DEVICE_INIT_CLASS(sym, _name, _init, _parent, _cls)
Initializer for the struct pbl_device of device instance sym, in class _cls.
Definition device.h:153
int pbl_i2c_bus_dev_init(const struct pbl_device *dev)
Device init of every bus: sets the class state up, then calls the driver's init.
Initializer for the struct pbl_i2c_bus of bus sym.
- Parameters
-
| sym | Symbol of the bus instance, with its state defined by PBL_I2C_BUS_STATE_DEFINE(). |
| _name | Name. |
| _parent | Parent device, or NULL. |
| _ops | Driver operations. |
◆ PBL_I2C_BUS_STATE_DEFINE
| #define PBL_I2C_BUS_STATE_DEFINE |
( |
|
sym | ) |
|
Value:
static struct pbl_i2c_bus_state sym##_i2c_state
#define PBL_DEVICE_STATE_DEFINE(sym)
Define the runtime state of device instance sym.
Definition device.h:132
Define the class state of bus sym, for the PBL_I2C_*_DEFINE() macro of a driver.
- Parameters
-
| sym | Symbol of the bus instance. |
◆ pbl_i2c_bus_complete()
| void pbl_i2c_bus_complete |
( |
const struct pbl_i2c_bus * |
bus, |
|
|
int |
status |
|
) |
| |
Report the outcome of the transfer in flight.
Called by the bus driver from its interrupt handler, which may then start the next queued transfer.
- Parameters
-
| bus | Bus. |
| status | 0 or a negative errno, see I2C. |
◆ pbl_i2c_bus_dev_init()
| int pbl_i2c_bus_dev_init |
( |
const struct pbl_device * |
dev | ) |
|
Device init of every bus: sets the class state up, then calls the driver's init.
- Parameters
-
- Returns
- 0 or a negative errno.