PebbleOS v4.47.0-1362-gd278268fe
Loading...
Searching...
No Matches
I2C controller drivers

Interface for I2C controller drivers. More...

Data Structures

struct  pbl_i2c_bus_ops
 Bus driver operations. More...
 

Macros

#define PBL_I2C_BUS_STATE_DEFINE(sym)
 Define the class state of bus sym, for the PBL_I2C_*_DEFINE() macro of a driver.
 
#define PBL_I2C_BUS_INIT(sym, _name, _parent, _ops)
 Initializer for the struct pbl_i2c_bus of bus sym.
 

Functions

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.
 
void pbl_i2c_bus_complete (const struct pbl_i2c_bus *bus, int status)
 Report the outcome of the transfer in flight.
 

Detailed Description

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.

Macro Definition Documentation

◆ PBL_I2C_BUS_INIT

#define PBL_I2C_BUS_INIT (   sym,
  _name,
  _parent,
  _ops 
)
Value:
{ \
.dev = PBL_DEVICE_INIT_CLASS(sym, _name, pbl_i2c_bus_dev_init, _parent, &pbl_i2c_bus_class), \
.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
symSymbol of the bus instance, with its state defined by PBL_I2C_BUS_STATE_DEFINE().
_nameName.
_parentParent device, or NULL.
_opsDriver 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
symSymbol of the bus instance.

Function Documentation

◆ 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
busBus.
status0 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
devBus device.
Returns
0 or a negative errno.