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

Interface for flash drivers. More...

Data Structures

struct  pbl_flash_ops
 Flash driver operations. More...
 
struct  pbl_flash
 A flash. More...
 

Macros

#define PBL_FLASH_STATE_DEFINE(sym)
 Define the class state of flash sym, for the PBL_FLASH_*_DEFINE() macro of a driver.
 
#define PBL_FLASH_INIT(sym, _name, _parent, _ops, _geometry, _otp, _otp_layout)
 Initializer for the struct pbl_flash of flash sym.
 

Functions

static bool pbl_flash_in_coredump (const struct pbl_flash *flash)
 Check whether the flash runs in coredump mode, for drivers.
 
void pbl_flash_set_map (const struct pbl_flash *flash, const void *ptr, uint32_t len)
 Declare where the CPU reads the flash directly, for drivers.
 

Detailed Description

Interface for flash drivers.

A driver embeds a struct pbl_flash in its instance, sets it up with PBL_FLASH_STATE_DEFINE() and PBL_FLASH_INIT(), and implements the struct pbl_flash_ops the class calls.


Data Structure Documentation

◆ pbl_flash

struct pbl_flash

A flash.

Data Fields
struct pbl_device dev Device.
const struct pbl_flash_geometry * geometry Geometry.
const struct pbl_flash_ops * ops Driver operations.
const struct pbl_flash_otp_info * otp OTP organization, or NULL.
const struct pbl_flash_otp_layout * otp_layout OTP cells, or NULL.
struct pbl_flash_state * state Runtime state.

Macro Definition Documentation

◆ PBL_FLASH_INIT

#define PBL_FLASH_INIT (   sym,
  _name,
  _parent,
  _ops,
  _geometry,
  _otp,
  _otp_layout 
)
Value:
{ \
.dev = PBL_DEVICE_INIT_CLASS(sym, _name, pbl_flash_dev_init, _parent, &pbl_flash_class), \
.ops = (_ops), \
.state = &sym##_flash_state, \
.geometry = (_geometry), \
.otp = (_otp), \
.otp_layout = (_otp_layout), \
}
#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

Initializer for the struct pbl_flash of flash sym.

Parameters
symSymbol of the flash instance, with its state defined by PBL_FLASH_STATE_DEFINE().
_nameName.
_parentParent device, e.g. the memory controller, or NULL.
_opsDriver operations.
_geometryGeometry.
_otpOTP organization, or NULL.
_otp_layoutOTP cells, or NULL.

◆ PBL_FLASH_STATE_DEFINE

#define PBL_FLASH_STATE_DEFINE (   sym)
Value:
static struct pbl_flash_state sym##_flash_state
#define PBL_DEVICE_STATE_DEFINE(sym)
Define the runtime state of device instance sym.
Definition device.h:132

Define the class state of flash sym, for the PBL_FLASH_*_DEFINE() macro of a driver.

Parameters
symSymbol of the flash instance.

Function Documentation

◆ pbl_flash_in_coredump()

static bool pbl_flash_in_coredump ( const struct pbl_flash *  flash)
inlinestatic

Check whether the flash runs in coredump mode, for drivers.

Parameters
flashFlash.
Returns
True after pbl_flash_coredump_init().

References pbl_flash::state.

◆ pbl_flash_set_map()

void pbl_flash_set_map ( const struct pbl_flash *  flash,
const void *  ptr,
uint32_t  len 
)

Declare where the CPU reads the flash directly, for drivers.

Reads inside the window then copy from memory instead of going through the driver. The driver keeps the window coherent after it writes or erases.

Parameters
flashFlash.
ptrCPU address of the first byte, or NULL to remove the window.
lenSize of the window in bytes.