46 #include "mxc_config.h" 50 #include "mxc_errors.h" 62 #define MX25_Read_DUMMY 8 63 #define MX25_DREAD_DUMMY 4 64 #define MX25_QREAD_DUMMY 6 66 #define MX25_WIP_MASK 0x01 67 #define MX25_WEL_MASK 0x02 68 #define MX25_QE_MASK 0x40 69 #define MX25_WP_MASK 0x80 76 #define MX25_CMD_RST_EN 0x66 77 #define MX25_CMD_RST_MEM 0x99 78 #define MX25_CMD_ID 0x9F 79 #define MX25_CMD_WRITE_EN 0x06 80 #define MX25_CMD_WRITE_DIS 0x04 82 #define MX25_CMD_READ 0x0B 83 #define MX25_CMD_DREAD 0xBB 84 #define MX25_CMD_QREAD 0xEB 85 #define MX25_CMD_HPM 0xA3 87 #define MX25_CMD_READ_SR 0x05 88 #define MX25_CMD_WRITE_SR 0x01 90 #define MX25_CMD_PPROG 0x02 91 #define MX25_CMD_QUAD_PROG 0X38 93 #define MX25_CMD_4K_ERASE 0x20 94 #define MX25_CMD_32K_ERASE 0x52 95 #define MX25_CMD_64K_ERASE 0xD8 96 #define MX25_CMD_BULK_ERASE 0xC7 int MX25_Read(uint32_t address, uint8_t *rx_buf, uint32_t rx_len, spixfc_width_t width)
Read data out by using 4-wire SPI mode.
int MX25_Program_Page(uint32_t address, const uint8_t *tx_buf, uint32_t tx_len, spixfc_width_t width)
Program the memory to tx_buf and length tx_len, applies to both SPI and QPI modes.
4KB Sector Erase
Definition: mx25.h:102
int MX25_Init(void)
Initialize SPI configuration and reset n25q.
int MX25_Write_Protect(int enable)
enable write protection
MX25_Erase_t
Enumeration type to select the size for an Erase command.
Definition: mx25.h:101
int MX25_Read_SR(uint8_t *buf)
Read status register.
spixfc_width_t
Number of data lines to use.
Definition: spixfc.h:80
uint32_t MX25_ID(void)
Read manufacturer ID.
int MX25_Write_SR(uint8_t value)
Write status register.
int MX25_Reset(void)
Reset the MX25 flash memory.
int MX25_Bulk_Erase(void)
Bulk erase the MX25 flash memory.
32KB Block Erase
Definition: mx25.h:103
int MX25_Quad(int enable)
Enable/Disable the Quad Enable(QE) bit in the status register.
64KB Block Erase
Definition: mx25.h:104
int MX25_Erase(uint32_t address, MX25_Erase_t size)
Erase memory segments.