MeterLogger
spi_flash.h
Go to the documentation of this file.
1 /*
2  * ESPRSSIF MIT License
3  *
4  * Copyright (c) 2016 <ESPRESSIF SYSTEMS (SHANGHAI) PTE LTD>
5  *
6  * Permission is hereby granted for use on ESPRESSIF SYSTEMS ESP8266 only, in which case,
7  * it is free of charge, to any person obtaining a copy of this software and associated
8  * documentation files (the "Software"), to deal in the Software without restriction, including
9  * without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  * and/or sell copies of the Software, and to permit persons to whom the Software is furnished
11  * to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in all copies or
14  * substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
18  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
19  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
20  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22  *
23  */
24 
25 #ifndef SPI_FLASH_H
26 #define SPI_FLASH_H
27 
28 typedef enum {
33 
34 typedef struct{
36  uint32 chip_size; // chip size in byte
41 } SpiFlashChip;
42 
43 #define SPI_FLASH_SEC_SIZE 4096
44 
47 SpiFlashOpResult spi_flash_write(uint32 des_addr, uint32 *src_addr, uint32 size);
48 SpiFlashOpResult spi_flash_read(uint32 src_addr, uint32 *des_addr, uint32 size);
49 
51  SpiFlashChip *spi,
52  uint32 src_addr,
53  uint32 *des_addr,
54  uint32 size);
55 
57 
58 #endif
SpiFlashOpResult
Definition: spi_flash.h:28
SpiFlashOpResult spi_flash_read(uint32 src_addr, uint32 *des_addr, uint32 size)
SpiFlashOpResult spi_flash_erase_sector(uint16 sec)
uint32 chip_size
Definition: spi_flash.h:36
uint32 page_size
Definition: spi_flash.h:39
uint32 block_size
Definition: spi_flash.h:37
uint32 status_mask
Definition: spi_flash.h:40
unsigned short uint16
Definition: c_types.h:50
uint32 spi_flash_get_id(void)
uint32 sector_size
Definition: spi_flash.h:38
SpiFlashOpResult(* user_spi_flash_read)(SpiFlashChip *spi, uint32 src_addr, uint32 *des_addr, uint32 size)
Definition: spi_flash.h:50
unsigned int uint32
Definition: c_types.h:54
void spi_flash_set_read_func(user_spi_flash_read read)
SpiFlashOpResult spi_flash_write(uint32 des_addr, uint32 *src_addr, uint32 size)
uint32 deviceId
Definition: spi_flash.h:35