Management of the AT25DFx SerialFlash driver through SPI.
This file manages the accesses to the AT25DFx SerialFlash components.
Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.
#include "board.h"
#include "status_codes.h"
#include "conf_at25dfx.h"
#include "at25dfx.h"
#include "spi_master.h"
#include "at25dfx_hal_spi.h"
Data Structures | |
struct | at25_cmd |
SerialFlash transfers request prepared by the AT25 driver. More... | |
Macros | |
#define | AT25DFX_BLOCK_ERASE_CMD AT25_BLOCK_ERASE_64K |
AT25 block erase command. More... | |
#define | AT25DFX_BLOCK_SIZE (64*1024) |
AT25 block size. More... | |
#define | AT25DFX_DEV_ID 0x0001441F |
AT25 device ID. More... | |
#define | AT25DFX_PAGE_SIZE 256 |
The page size of AT25DF series is always 256. More... | |
#define | AT25DFX_SIZE (512 * 1024) |
AT25 total size. More... | |
Typedefs | |
typedef struct at25_cmd | at25_cmd_t |
SerialFlash transfers request prepared by the AT25 driver. More... | |
Functions | |
static at25_status_t | at25dfx_enable_write (void) |
Enable critical write operation on a SerialFlash device, such as sector protection, status register, etc. More... | |
at25_status_t | at25dfx_erase_block (uint32_t address) |
Erase the specified block of the SerialFlash. More... | |
at25_status_t | at25dfx_erase_chip (void) |
Erase all the content of the memory chip. More... | |
at25_status_t | at25dfx_initialize (void) |
Initialize the SerialFlash. More... | |
at25_status_t | at25dfx_mem_check (void) |
Check if the SerialFlash is valid. More... | |
at25_status_t | at25dfx_protect_chip (uint8_t protect_type) |
Protect the SerialFlash device. More... | |
at25_status_t | at25dfx_protect_sector (uint32_t address, uint8_t protect_type) |
Protect/unprotect the specific sector. More... | |
at25_status_t | at25dfx_read (uint8_t *data, uint16_t size, uint32_t address) |
Read data from the specified address on the SerialFlash. More... | |
static at25_status_t | at25dfx_read_dev_id (uint32_t *dev_id) |
Read and return the SerialFlash device ID. More... | |
at25_status_t | at25dfx_read_sector_protect_status (uint32_t address) |
Read sector protection status. More... | |
at25_status_t | at25dfx_read_status (uint8_t *status) |
Read and return the status register of the SerialFlash. More... | |
static at25_status_t | at25dfx_send_command (at25_cmd_t *at25cmd) |
Start an AT25DFx command transfer. More... | |
void | at25dfx_set_mem_active (uint8_t cs) |
Select the SerialFlash by the corresponding chip select. More... | |
static at25_status_t | at25dfx_wait_ready (void) |
Wait for the SerialFlash device to be ready to accept new commands. More... | |
at25_status_t | at25dfx_write (uint8_t *data, uint16_t size, uint32_t address) |
Write data at the specified address on the serial firmware SerialFlash. More... | |
at25_status_t | at25dfx_write_status (uint8_t status) |
Write the given value in the status register of the SerialFlash device. More... | |
Variables | |
static uint8_t | active_sf_cs = AT25DFX_MEM_ID |
Activated SerialFlash chip select, default to device 1. More... | |