PebbleOS v4.44.0-46-gef116268a
Loading...
Searching...
No Matches
pbl_spi_mem_ops Struct Reference

Controller driver operations. More...

#include <spi_mem.h>

Data Fields

int(* init )(const struct pbl_spi_mem *mem)
 Optional.
 
bool(* supports_op )(const struct pbl_spi_mem *mem, const struct pbl_spi_mem_op *op)
 Check whether the controller can run op.
 
int(* adjust_op_size )(const struct pbl_spi_mem *mem, struct pbl_spi_mem_op *op)
 Optional.
 
int(* exec_op )(const struct pbl_spi_mem *mem, const struct pbl_spi_mem_op *op)
 Run a supported operation.
 
int(* poll_status )(const struct pbl_spi_mem *mem, const struct pbl_spi_mem_op *op, const struct pbl_spi_mem_op *status, uint8_t mask, uint8_t match, const struct pbl_spi_mem_suspend *susp)
 Optional, required with PBL_SPI_MEM_XIP.
 
int(* dirmap_create )(const struct pbl_spi_mem *mem, struct pbl_spi_mem_dirmap *desc)
 Optional.
 
int(* dirmap_read )(const struct pbl_spi_mem *mem, const struct pbl_spi_mem_dirmap *desc, uint32_t offs, void *buf, size_t len)
 With dirmap_create.
 
void(* dirmap_invalidate )(const struct pbl_spi_mem *mem, const struct pbl_spi_mem_dirmap *desc, uint32_t offs, size_t len)
 Optional, with dirmap_create.
 
void(* power_down )(const struct pbl_spi_mem *mem, const struct pbl_spi_mem_pm *pm, pbl_spi_mem_pm_fn_t fn, void *arg)
 Optional.
 

Detailed Description

Controller driver operations.

Field Documentation

◆ adjust_op_size

int(* pbl_spi_mem_ops::adjust_op_size) (const struct pbl_spi_mem *mem, struct pbl_spi_mem_op *op)

Optional.

Reduce the data of op to what one run carries. Returns 0 or a negative errno.

◆ dirmap_create

int(* pbl_spi_mem_ops::dirmap_create) (const struct pbl_spi_mem *mem, struct pbl_spi_mem_dirmap *desc)

Optional.

Set up a memory-mapped read window for desc, reducing desc->length to what the controller maps. Returns 0, or -ENOTSUP to fall back to operations.

◆ dirmap_invalidate

void(* pbl_spi_mem_ops::dirmap_invalidate) (const struct pbl_spi_mem *mem, const struct pbl_spi_mem_dirmap *desc, uint32_t offs, size_t len)

Optional, with dirmap_create.

Drop cached copies of a range of the window.

◆ dirmap_read

int(* pbl_spi_mem_ops::dirmap_read) (const struct pbl_spi_mem *mem, const struct pbl_spi_mem_dirmap *desc, uint32_t offs, void *buf, size_t len)

With dirmap_create.

Read through the window. Returns 0 or a negative errno.

Referenced by pbl_spi_mem_dirmap_read().

◆ exec_op

int(* pbl_spi_mem_ops::exec_op) (const struct pbl_spi_mem *mem, const struct pbl_spi_mem_op *op)

Run a supported operation.

Returns 0 or a negative errno.

◆ init

int(* pbl_spi_mem_ops::init) (const struct pbl_spi_mem *mem)

Optional.

Bring the controller up. Returns 0 or a negative errno.

◆ poll_status

int(* pbl_spi_mem_ops::poll_status) (const struct pbl_spi_mem *mem, const struct pbl_spi_mem_op *op, const struct pbl_spi_mem_op *status, uint8_t mask, uint8_t match, const struct pbl_spi_mem_suspend *susp)

Optional, required with PBL_SPI_MEM_XIP.

Run op, then status until its first data byte masked with mask equals match, letting nothing else reach the memory in between. With susp, the controller may suspend the operation meanwhile to serve interrupts. Returns 0 or a negative errno.

◆ power_down

void(* pbl_spi_mem_ops::power_down) (const struct pbl_spi_mem *mem, const struct pbl_spi_mem_pm *pm, pbl_spi_mem_pm_fn_t fn, void *arg)

Optional.

Run pm->enter, if pm is not NULL, power the controller down, call fn, then undo it all, with interrupts disabled. With PBL_SPI_MEM_XIP the memory is unreadable in between: nothing but fn may run from it, and pm must be in RAM.

◆ supports_op

bool(* pbl_spi_mem_ops::supports_op) (const struct pbl_spi_mem *mem, const struct pbl_spi_mem_op *op)

Check whether the controller can run op.


The documentation for this struct was generated from the following file: