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

Flash driver operations. More...

#include <flash.h>

Data Fields

int(* init )(const struct pbl_flash *flash)
 Optional.
 
int(* read )(const struct pbl_flash *flash, uint32_t addr, void *buf, size_t len)
 Read len bytes.
 
int(* write )(const struct pbl_flash *flash, uint32_t addr, const void *buf, size_t len)
 Program len bytes, returning once they are programmed.
 
int(* erase )(const struct pbl_flash *flash, uint32_t addr, uint32_t size)
 Start erasing the sector or subsector of size bytes at addr.
 
int(* erase_status )(const struct pbl_flash *flash)
 Optional.
 
int(* erase_suspend )(const struct pbl_flash *flash)
 Optional, with erase_status.
 
int(* erase_resume )(const struct pbl_flash *flash)
 With erase_suspend.
 
void(* power_down )(const struct pbl_flash *flash, pbl_flash_pm_fn_t fn, void *arg)
 Optional.
 
void(* stop )(const struct pbl_flash *flash)
 Optional.
 
int(* otp_read )(const struct pbl_flash *flash, uint8_t region, uint32_t offs, void *buf, size_t len)
 With OTP.
 
int(* otp_write )(const struct pbl_flash *flash, uint8_t region, uint32_t offs, const void *buf, size_t len)
 With OTP.
 
int(* otp_is_locked )(const struct pbl_flash *flash, uint8_t region, bool *locked)
 With OTP.
 
int(* otp_lock )(const struct pbl_flash *flash, uint8_t region)
 Optional.
 
int(* otp_erase )(const struct pbl_flash *flash, uint8_t region)
 Optional.
 

Detailed Description

Flash driver operations.

Called with the device lock held, or without any OS service in coredump mode, which drivers check with pbl_flash_in_coredump(): they must then poll instead of blocking.

Field Documentation

◆ erase

int(* pbl_flash_ops::erase) (const struct pbl_flash *flash, uint32_t addr, uint32_t size)

Start erasing the sector or subsector of size bytes at addr.

Returns 0, 1 if the erase completed before returning, or a negative errno. Without erase_status, returns once the erase is done.

◆ erase_resume

int(* pbl_flash_ops::erase_resume) (const struct pbl_flash *flash)

With erase_suspend.

Resume the suspended erase. Returns 0 or a negative errno.

◆ erase_status

int(* pbl_flash_ops::erase_status) (const struct pbl_flash *flash)

Optional.

Returns 0 once the erase is done, -EBUSY while it is in progress, -EAGAIN while it is suspended, or another negative errno if it failed.

◆ erase_suspend

int(* pbl_flash_ops::erase_suspend) (const struct pbl_flash *flash)

Optional, with erase_status.

Suspend the erase in progress. Returns 0, 1 if the erase had already completed, or a negative errno.

◆ init

int(* pbl_flash_ops::init) (const struct pbl_flash *flash)

Optional.

Bring the hardware up. Also called by pbl_flash_coredump_init(), possibly after a previous initialization. Returns 0 or a negative errno.

◆ otp_erase

int(* pbl_flash_ops::otp_erase) (const struct pbl_flash *flash, uint8_t region)

Optional.

Erase OTP region region.

◆ otp_is_locked

int(* pbl_flash_ops::otp_is_locked) (const struct pbl_flash *flash, uint8_t region, bool *locked)

With OTP.

Check whether OTP region region is locked.

◆ otp_lock

int(* pbl_flash_ops::otp_lock) (const struct pbl_flash *flash, uint8_t region)

Optional.

Lock OTP region region forever.

◆ otp_read

int(* pbl_flash_ops::otp_read) (const struct pbl_flash *flash, uint8_t region, uint32_t offs, void *buf, size_t len)

With OTP.

Read len bytes at offs of OTP region region.

◆ otp_write

int(* pbl_flash_ops::otp_write) (const struct pbl_flash *flash, uint8_t region, uint32_t offs, const void *buf, size_t len)

With OTP.

Program len bytes at offs of OTP region region.

◆ power_down

void(* pbl_flash_ops::power_down) (const struct pbl_flash *flash, pbl_flash_pm_fn_t fn, void *arg)

Optional.

Power down while fn runs, with interrupts disabled.

◆ read

int(* pbl_flash_ops::read) (const struct pbl_flash *flash, uint32_t addr, void *buf, size_t len)

Read len bytes.

Returns 0 or a negative errno.

◆ stop

void(* pbl_flash_ops::stop) (const struct pbl_flash *flash)

Optional.

Return the hardware to the state the boot code expects, before a reset.

◆ write

int(* pbl_flash_ops::write) (const struct pbl_flash *flash, uint32_t addr, const void *buf, size_t len)

Program len bytes, returning once they are programmed.

Returns 0 or a negative errno.


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