Microchip® Advanced Software Framework

s25fl1xx.c File Reference

QSPI flash memory driver for S25FL1XX.

Copyright (c) 2015-2018 Microchip Technology Inc. and its subsidiaries.

#include <board.h>
#include <assert.h>
#include "stdlib.h"
#include "string.h"
#include "s25fl1xx.h"
#include "delay.h"

Macros

#define PAGE_SIZE   256
 

Functions

static uint8_t s25fl1xx_check_protected_addr (uint8_t status1, uint32_t addr)
 Check weather the address of addr is protected. More...
 
void s25fl1xx_continous_read_mode_reset (struct qspid_t *qspid)
 Issue 'CContinuous Read Mode' command, the device can return to normal SPI command mode, in which all commands can be accepts. More...
 
uint8_t s25fl1xx_data_protect (struct qspid_t *qspid, bool dir, enum block_size protect_size)
 Protect the contents of the serial flash device. More...
 
uint8_t s25fl1xx_data_unprotect (struct qspid_t *qspid)
 Unprotected the contents of the serial flash device. More...
 
static void s25fl1xx_disable_write (struct qspid_t *qspid)
 Disable write option to serial flash memory. More...
 
void s25fl1xx_enable_wrap (struct qspid_t *qspid, uint8_t byte_align)
 Enables critical writes operation on a serial flash device, such as sector protection, status register, etc. More...
 
static void s25fl1xx_enable_write (struct qspid_t *qspid)
 Enable write option to serial flash memory. More...
 
void s25fl1xx_enter_continous_read_mode (struct qspid_t *qspid)
 Reads data from the specified address on the serial flash. More...
 
uint8_t s25fl1xx_erase_64k_block (struct qspid_t *qspid, uint32_t address)
 Erases the specified 64KB block of the serial firmware dataflash. More...
 
uint8_t s25fl1xx_erase_chip (struct qspid_t *qspid)
 Erases all the content of the memory chip. More...
 
uint8_t s25fl1xx_erase_sector (struct qspid_t *qspid, uint32_t address)
 Erases the specified block of the serial firmware dataflash. More...
 
static void s25fl1xx_exec_command (struct qspid_t *qspid, uint8_t instr, uint32_t *tx_data, uint32_t *rx_data, enum qspi_access read_write, uint32_t size)
 Send command to the serial flash. More...
 
enum status_code s25fl1xx_initialize (Qspi *qspi, struct qspi_config_t *mode_config, uint32_t use_default_config)
 Initialize QSPI serial memory mode. More...
 
static void s25fl1xx_memory_access (struct qspid_t *qspid, uint8_t instr, uint32_t addr, uint32_t *tx_data, uint32_t *rx_data, enum qspi_access read_write, uint32_t size, uint8_t secure)
 Read/write data from serial flash memory. More...
 
uint8_t s25fl1xx_protect (struct qspid_t *qspid)
 Unprotected the contents of the serial flash device. More...
 
uint8_t s25fl1xx_read (struct qspid_t *qspid, uint32_t *data, uint32_t size, uint32_t address)
 Reads data from the specified address on the serial flash. More...
 
uint8_t s25fl1xx_read_dual (struct qspid_t *qspid, uint32_t *data, uint32_t size, uint32_t address)
 Reads data from the specified address on the serial flash. More...
 
uint8_t s25fl1xx_read_dual_io (struct qspid_t *qspid, uint32_t *data, uint32_t size, uint32_t address, uint8_t cont_mode, uint8_t secure)
 Reads data from the specified address on the serial flash. More...
 
uint32_t s25fl1xx_read_jedec_id (struct qspid_t *qspid)
 Reads and returns the serial flash device ID. More...
 
uint8_t s25fl1xx_read_quad (struct qspid_t *qspid, uint32_t *data, uint32_t size, uint32_t address)
 Reads data from the specified address on the serial flash. More...
 
uint8_t s25fl1xx_read_quad_io (struct qspid_t *qspid, uint32_t *data, uint32_t size, uint32_t address, uint8_t cont_mode, uint8_t secure)
 Reads data from the specified address on the serial flash. More...
 
static uint32_t s25fl1xx_read_status (struct qspid_t *qspid)
 Reads and returns the status register of the serial flash. More...
 
static uint8_t s25fl1xx_read_status1 (struct qspid_t *qspid)
 Reads and returns the status register of the serial flash. More...
 
static uint8_t s25fl1xx_read_status2 (struct qspid_t *qspid)
 Reads and returns the status register of the serial flash. More...
 
static uint8_t s25fl1xx_read_status3 (struct qspid_t *qspid)
 Reads and returns the status register of the serial flash. More...
 
void s25fl1xx_set_quad_mode (struct qspid_t *qspid, uint8_t mode)
 Enables critical writes operation on a serial flash device, such as sector protection, status register, etc. More...
 
void s25fl1xx_set_read_latency_control (struct qspid_t *qspid, uint8_t latency)
 Enables critical writes operation on a serial flash device, such as sector protection, status register, etc. More...
 
void s25fl1xx_soft_reset (struct qspid_t *qspid)
 s25fl1d software reset. More...
 
uint8_t s25fl1xx_unprotect (struct qspid_t *qspid)
 Unprotected the control bits of the serial flash device. More...
 
static void s25fl1xx_wait_memory_access_end (struct qspid_t *qspid)
 Wait for transfer to finish calling the SPI driver ISR. More...
 
uint8_t s25fl1xx_write (struct qspid_t *qspid, uint32_t *pdata, uint32_t size, uint32_t address, uint8_t secure)
 Writes data at the specified address on the serial firmware dataflash. More...
 
static void s25fl1xx_write_status (struct qspid_t *qspid, uint8_t *status)
 Writes the given value in the status register of the serial flash device. More...
 
static void s25fl1xx_write_volatile_status (struct qspid_t *qspid, uint8_t *status)
 Writes the given value in the status register of the serial flash device. More...
 

Variables

struct qspi_inst_frame_tdev
 
struct qspi_inst_frame_tmem