21 int (*
xfer)(
void *ctx,
const uint8_t *
tx, uint32_t ntx, uint8_t *rx, uint32_t nrx);
23 int (*xfer_w)(
void *ctx,
const uint8_t *
tx, uint32_t ntx,
const uint8_t *data, uint32_t
n);
24 void (*delay_ms)(uint32_t
ms);
25 uint32_t (*now_ms)(void);
32 uint8_t mfr, type,
cap;
static void tx(const uint8_t *f, size_t len)
static int32_t xfer(void *h, uint16_t reg, uint16_t regsz, uint8_t *d, uint16_t len, int write)
static uint32_t addr(uint16_t sect)
uint32_t base
start of the log area
uint32_t size
bytes, from the JEDEC id
int w25q_init(w25q_t *d, const w25q_bus_t *bus)
reads the JEDEC id, releases power-down; 0 = a W25Q-compatible part
int w25q_lf_read(void *ctx, uint32_t addr, void *buf, uint32_t n)
int w25q_lf_prog(void *ctx, uint32_t addr, const void *buf, uint32_t n)
int w25q_prog(w25q_t *d, uint32_t addr, const void *buf, uint32_t n)
inside one page
int w25q_erase_chip(w25q_t *d)
waits (≤ 200 s)
int w25q_read(w25q_t *d, uint32_t addr, void *buf, uint32_t n)
int w25q_lf_erase(void *ctx, uint32_t addr)
int w25q_erase_sector(w25q_t *d, uint32_t addr)
4 KB, waits (≤ 400 ms)