flash2 2.0.0.0
flash2.h File Reference

This file contains API for Flash 2 Click driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_spi_master.h"

Go to the source code of this file.

Data Structures

struct  flash2_t
 Click ctx object definition. More...
 
struct  flash2_cfg_t
 Click configuration structure definition. More...
 

Macros

#define FLASH2_MAP_MIKROBUS(cfg, mikrobus)
 
#define FLASH2_STATUS_WEL   0x02
 
#define FLASH2_STATUS_WSE   0x04
 
#define FLASH2_STATUS_WSP   0x08
 
#define FLASH2_STATUS_WPLD   0x10
 
#define FLASH2_STATUS_SEC   0x20
 
#define FLASH2_STATUS_RES   0x40
 
#define FLASH2_STATUS_BUSY   0x80
 
#define FLASH2_CFG_RES   0x01
 
#define FLASH2_CFG_IOC   0x02
 
#define FLASH2_CFG_BPNV   0x08
 
#define FLASH2_CFG_WPEN   0x80
 
#define FLASH2_INSTR_NOP   0x00
 
#define FLASH2_INSTR_RSTEN   0x66
 
#define FLASH2_INSTR_RST   0x99
 
#define FLASH2_INSTR_EQIO   0x38
 
#define FLASH2_INSTR_RSTQIO   0xFF
 
#define FLASH2_INSTR_RDSR   0x05
 
#define FLASH2_INSTR_WRSR   0x01
 
#define FLASH2_INSTR_RDCR   0x35
 
#define FLASH2_INSTR_READ   0x03
 
#define FLASH2_INSTR_HS_READ   0x0B
 
#define FLASH2_INSTR_SQOR   0x6B
 
#define FLASH2_INSTR_SQIOR   0xEB
 
#define FLASH2_INSTR_SDOR   0x3B
 
#define FLASH2_INSTR_SDIOR   0xBB
 
#define FLASH2_INSTR_SB   0xC0
 
#define FLASH2_INSTR_RBSQI   0x0C
 
#define FLASH2_INSTR_RBSPI   0xEC
 
#define FLASH2_INSTR_JEDECID   0x9F
 
#define FLASH2_INSTR_QUAD_JID   0xAF
 
#define FLASH2_INSTR_SFDP   0x5A
 
#define FLASH2_INSTR_WREN   0x06
 
#define FLASH2_INSTR_WRDI   0x04
 
#define FLASH2_INSTR_SE   0x20
 
#define FLASH2_INSTR_BE   0xD8
 
#define FLASH2_INSTR_CE   0xC7
 
#define FLASH2_INSTR_PP   0x02
 
#define FLASH2_INSTR_SPI_QUAD   0x32
 
#define FLASH2_INSTR_WRSU   0xB0
 
#define FLASH2_INSTR_WRRE   0x30
 
#define FLASH2_INSTR_RBPR   0x72
 
#define FLASH2_INSTR_WBPR   0x42
 
#define FLASH2_INSTR_LBPR   0x8D
 
#define FLASH2_INSTR_NVWLDR   0xE8
 
#define FLASH2_INSTR_ULBPR   0x98
 
#define FLASH2_INSTR_RSID   0x88
 
#define FLASH2_INSTR_PSID   0xA5
 
#define FLASH2_INSTR_LSID   0x85
 
#define FLASH2_START_PAGE_ADDRESS   0x010000
 
#define FLASH2_END_PAGE_ADDRESS   0x7FFFFF
 
#define FLASH2_FLASH_PAGE_SIZE   256
 
#define FLASH2_RETVAL   uint8_t
 
#define FLASH2_OK   0x00
 
#define FLASH2_INIT_ERROR   0xFF
 

Functions

void flash2_cfg_setup (flash2_cfg_t *cfg)
 Config Object Initialization function.
 
FLASH2_RETVAL flash2_init (flash2_t *ctx, flash2_cfg_t *cfg)
 Initialization function.
 
void flash2_generic_transfer (flash2_t *ctx, uint8_t *wr_buf, uint16_t wr_len, uint8_t *rd_buf, uint16_t rd_len)
 Generic transfer function.
 
uint8_t flash2_busy (flash2_t *ctx)
 Flash 2 Busy.
 
uint8_t flash2_get_status_reg (flash2_t *ctx)
 Flash 2 Get Status Register.
 
uint8_t flash2_erase_status (flash2_t *ctx)
 Flash 2 Erase Status.
 
uint8_t flash2_write_status (flash2_t *ctx)
 Flash 2 Write Status.
 
uint8_t flash2_program_status (flash2_t *ctx)
 Flash 2 Program Status.
 
uint8_t flash2_protect_status (flash2_t *ctx)
 Flash 2 Protect Status.
 
void flash2_lock_security_id (flash2_t *ctx)
 flash2_lock_security_id
 
uint8_t flash2_security_status (flash2_t *ctx)
 Flash 2 Security Status.
 
void flash2_write_protect_enable (flash2_t *ctx)
 Flash 2 Write Protect Enable.
 
void flash2_write_protect_disable (flash2_t *ctx)
 Flash 2 Write Protect Disable.
 
void flash2_hold_enable (flash2_t *ctx)
 Flash 2 Hold Enable.
 
void flash2_hold_disable (flash2_t *ctx)
 Flash 2 Hold Disable.
 
void flash2_write_suspend (flash2_t *ctx)
 Flash 2 Write Suspend.
 
void flash2_write_resume (flash2_t *ctx)
 Flash 2 Write Resume.
 
void flash2_spi_get_security_id (flash2_t *ctx, uint8_t *buffer, uint32_t data_count)
 Flash 2 Get Security ID SPI.
 
void flash2_sqi_get_security_id (flash2_t *ctx, uint8_t *buffer, uint32_t data_count)
 Flash 2 Get Security ID SQI.
 
void flash2_set_security_id (flash2_t *ctx, uint8_t *buffer, uint32_t data_count)
 Flash 2 Set Security ID.
 
void flash2_write_disable (flash2_t *ctx)
 Flash 2 Write Disable.
 
void flash2_spi_get_bpr (flash2_t *ctx, uint8_t *buffer, uint32_t data_count)
 Flash 2 Get Block Protection Register SPI.
 
void flash2_sqi_get_bpr (flash2_t *ctx, uint8_t *buffer, uint32_t data_count)
 Flash 2 Get Block Protection Register SQI.
 
void flash2_set_bpr (flash2_t *ctx, uint8_t *buffer)
 Flash 2 Set Block Protection Register.
 
void flash2_lockBpr (flash2_t *ctx)
 Flash 2 Lock Block Protection Register.
 
void flash2_nonvolatile_write_lock (flash2_t *ctx, uint8_t *buffer)
 Flash 2 Non-Volatile Write-Lock.
 
void flash2_global_block_unlock (flash2_t *ctx)
 Flash 2 Global Block Unlock.
 
void flash2_read_generic (flash2_t *ctx, uint32_t address, uint8_t *buffer, uint32_t data_count)
 Flash 2 Read.
 
void flash2_highspeedRread (flash2_t *ctx, uint32_t address, uint8_t *buffer, uint32_t data_count)
 Flash 2 High Speed Read.
 
void flash2_quadWrite (flash2_t *ctx, uint32_t address, uint8_t *buffer, uint32_t data_count)
 Flash 2 Quad Write.
 
void flash2_write_generic (flash2_t *ctx, uint32_t address, uint8_t *buffer, uint32_t data_count)
 Flash 2 Write.
 
void flash2_quad_enable (flash2_t *ctx)
 Flash 2 Quad Enable.
 
void flash2_quad_out_read (flash2_t *ctx, uint32_t address, uint8_t *buffer, uint32_t data_count)
 Flash 2 Quad Output Read.
 
void flash2_quad_io_read (flash2_t *ctx, uint32_t address, uint8_t mode, uint8_t *buffer, uint32_t data_count)
 Flash 2 Quad I/O Read.
 
void flash2_quad_reset (flash2_t *ctx)
 Flash 2 Quad Reset.
 
void flash2_set_burst (flash2_t *ctx, uint8_t length)
 Flash 2 Set Burst.
 
void flash2_read_sqi_burst_wrap (flash2_t *ctx, uint32_t address, uint8_t *buffer, uint32_t data_count)
 Flash 2 Read Burst with Wrap through SQI.
 
void flash2_read_spi_burst_wrap (flash2_t *ctx, uint32_t address, uint8_t *buffer, uint32_t data_count)
 Flash 2 Read Burst with Wrap through SPI.
 
void flash2_read_dual_output (flash2_t *ctx, uint32_t address, uint8_t *buffer, uint32_t data_count)
 Flash 2 Read Dual Output.
 
void flash2_read_dual_io (flash2_t *ctx, uint32_t address, uint8_t *buffer, uint32_t data_count)
 Flash 2 Read Dual I/O.
 
void flash2_sector_erase (flash2_t *ctx, uint32_t address)
 Flash 2 Sector Erase.
 
void flash2_block_erase (flash2_t *ctx, uint32_t address)
 Flash 2 Block Erase.
 
void flash2_chip_erase (flash2_t *ctx)
 Flash 2 Chip Erase.
 
void flash2_get_sfdp_params (flash2_t *ctx, uint32_t address, uint8_t *buffer, uint32_t data_count)
 Flash 2 get Serial Flash Discoverable \ Parameters.
 
uint8_t flash2_quad_device_manufac (flash2_t *ctx)
 Flash 2 Quad Device Manufacturer.
 
uint8_t flash2_quad_device_type (flash2_t *ctx)
 Flash 2 Quad Device Type.
 
uint8_t flash2_quad_device_id (flash2_t *ctx)
 Flash 2 Quad Device ID.
 
uint8_t flash2_device_manufac (flash2_t *ctx)
 Flash 2 Device Manufacturer.
 
uint8_t flash2_device_type (flash2_t *ctx)
 Flash 2 Device Type.
 
uint8_t flash2_device_id (flash2_t *ctx)
 Flash 2 Device ID.
 
void flash2_reset (flash2_t *ctx)
 Flash 2 Reset.
 
void flash2_write_status_reg (flash2_t *ctx, uint8_t s_reg)
 Flash 2 Write Status Register.
 
uint8_t flash2_get_config_reg (flash2_t *ctx)
 Flash 2 Get Config Register.
 
void flash2_write_enable (flash2_t *ctx)
 Flash 2 Write Enable.
 

Detailed Description

This file contains API for Flash 2 Click driver.