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

Interface for PHY drivers. More...

Data Structures

struct  pbl_phy_ops
 PHY driver operations, called with the device lock held. More...
 
struct  pbl_phy_state
 PHY runtime state. More...
 
struct  pbl_phy
 PHY. More...
 

Macros

#define PBL_PHY_STATE_DEFINE(sym)
 Define the runtime state of a PHY.
 
#define PBL_PHY_INIT(sym, _name, _parent, _ops)
 Initialize a struct pbl_phy.
 

Functions

void pbl_phy_report_vbus_changed (const struct pbl_phy *phy)
 Report VBUS coming or going to the listeners, from thread context.
 

Detailed Description

Interface for PHY drivers.

A driver embeds a struct pbl_phy in its instance, sets it up with PBL_PHY_STATE_DEFINE() and PBL_PHY_INIT(), and implements the struct pbl_phy_ops the class calls.


Data Structure Documentation

◆ pbl_phy_state

struct pbl_phy_state

PHY runtime state.

Data Fields
struct pbl_phy_listener * listeners Listeners.
struct pbl_mutex lock Device lock.

◆ pbl_phy

struct pbl_phy

PHY.

Data Fields
struct pbl_device dev Device.
const struct pbl_phy_ops * ops Driver operations.
struct pbl_phy_state * state Runtime state.

Macro Definition Documentation

◆ PBL_PHY_INIT

#define PBL_PHY_INIT (   sym,
  _name,
  _parent,
  _ops 
)
Value:
{ \
.dev = PBL_DEVICE_INIT_CLASS(sym, _name, pbl_phy_dev_init, _parent, &pbl_phy_class), \
.ops = (_ops), \
.state = &sym##_phy_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

Initialize a struct pbl_phy.

Parameters
symSymbol of the instance, as passed to PBL_PHY_STATE_DEFINE().
_nameDevice name.
_parentParent device, or NULL.
_opsDriver operations.

◆ PBL_PHY_STATE_DEFINE

#define PBL_PHY_STATE_DEFINE (   sym)
Value:
static struct pbl_phy_state sym##_phy_state = {.lock = PBL_MUTEX_INITIALIZER}
#define PBL_DEVICE_STATE_DEFINE(sym)
Define the runtime state of device instance sym.
Definition device.h:132
struct pbl_mutex lock
Device lock.
Definition driver.h:37
PHY runtime state.
Definition driver.h:35
#define PBL_MUTEX_INITIALIZER
Static initializer for an unlocked mutex.
Definition mutex.h:50

Define the runtime state of a PHY.

Parameters
symSymbol of the instance.

Function Documentation

◆ pbl_phy_report_vbus_changed()

void pbl_phy_report_vbus_changed ( const struct pbl_phy *  phy)

Report VBUS coming or going to the listeners, from thread context.

Parameters
phyPHY.