![]() |
ACwing FC firmware
STM32WB55: attitude IEKF, altitude Kalman filter, flight core, protocol v2
|
Winbond W25Q serial NOR flash (W25Q128JV on the ACwing FC: 16 MB, 4 KB sectors, 256-byte pages, SPI mode 0/3). More...
#include <stdint.h>Go to the source code of this file.
Data Structures | |
| struct | w25q_bus_t |
| struct | w25q_t |
Functions | |
| 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_read (w25q_t *d, uint32_t addr, 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_sector (w25q_t *d, uint32_t addr) |
| 4 KB, waits (≤ 400 ms) | |
| int | w25q_erase_chip (w25q_t *d) |
| waits (≤ 200 s) | |
| 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_lf_erase (void *ctx, uint32_t addr) |
Winbond W25Q serial NOR flash (W25Q128JV on the ACwing FC: 16 MB, 4 KB sectors, 256-byte pages, SPI mode 0/3).
Portable: the bus is one function that runs a transaction with chip select held low for the whole of it (command and address in tx, then rx bytes clocked in). The ACwing FC shares SPI1 with the IMU, so the binding takes the bus lock around each transaction; a sector erase is one short command followed by status polls, never a long bus hold.
Provides the log_flash_t callbacks of log/log_store.h.
Definition in file w25q.h.
| int w25q_init | ( | w25q_t * | d, |
| const w25q_bus_t * | bus | ||
| ) |
reads the JEDEC id, releases power-down; 0 = a W25Q-compatible part
Definition at line 59 of file w25q.c.
References w25q_t::bus, w25q_t::cap, cmd1(), CMD_JEDEC, CMD_RELEASE_PD, w25q_bus_t::ctx, w25q_bus_t::delay_ms, w25q_t::mfr, w25q_t::size, w25q_t::type, and w25q_bus_t::xfer.
| int w25q_read | ( | w25q_t * | d, |
| uint32_t | addr, | ||
| void * | buf, | ||
| uint32_t | n | ||
| ) |
Definition at line 75 of file w25q.c.
References a24(), addr(), w25q_t::base, w25q_t::bus, CMD_READ, w25q_bus_t::ctx, n, w25q_t::size, and w25q_bus_t::xfer.
Referenced by w25q_lf_read().
| int w25q_prog | ( | w25q_t * | d, |
| uint32_t | addr, | ||
| const void * | buf, | ||
| uint32_t | n | ||
| ) |
inside one page
Definition at line 83 of file w25q.c.
References a24(), addr(), w25q_t::base, w25q_t::bus, CMD_PP, w25q_bus_t::ctx, n, w25q_t::size, T_PP_MS, wait_ready(), write_enable(), and w25q_bus_t::xfer_w.
Referenced by w25q_lf_prog().
| int w25q_erase_sector | ( | w25q_t * | d, |
| uint32_t | addr | ||
| ) |
4 KB, waits (≤ 400 ms)
Definition at line 94 of file w25q.c.
References a24(), addr(), w25q_t::base, w25q_t::bus, CMD_SE, w25q_bus_t::ctx, w25q_t::size, T_SE_MS, wait_ready(), write_enable(), and w25q_bus_t::xfer.
Referenced by w25q_lf_erase().
| int w25q_erase_chip | ( | w25q_t * | d | ) |
waits (≤ 200 s)
Definition at line 104 of file w25q.c.
References cmd1(), CMD_CE, T_CE_MS, wait_ready(), and write_enable().
| int w25q_lf_read | ( | void * | ctx, |
| uint32_t | addr, | ||
| void * | buf, | ||
| uint32_t | n | ||
| ) |
Definition at line 111 of file w25q.c.
References b, n, and w25q_read().
| int w25q_lf_prog | ( | void * | ctx, |
| uint32_t | addr, | ||
| const void * | buf, | ||
| uint32_t | n | ||
| ) |
Definition at line 112 of file w25q.c.
References b, n, and w25q_prog().
| int w25q_lf_erase | ( | void * | ctx, |
| uint32_t | addr | ||
| ) |
Definition at line 113 of file w25q.c.
References w25q_erase_sector().