1 // Copyright 2015-2017 Espressif Systems (Shanghai) PTE LTD
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //     http://www.apache.org/licenses/LICENSE-2.0
7 //
8 // Unless required by applicable law or agreed to in writing, software
9 // distributed under the License is distributed on an "AS IS" BASIS,
10 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 // See the License for the specific language governing permissions and
12 // limitations under the License.
13 
14 #ifndef _WL_Ext_Safe_H_
15 #define _WL_Ext_Safe_H_
16 
17 #include "WL_Flash.h"
18 #include "WL_Ext_Cfg.h"
19 #include "WL_Ext_Perf.h"
20 
21 class WL_Ext_Safe : public WL_Ext_Perf
22 {
23 public:
24     WL_Ext_Safe();
25     ~WL_Ext_Safe() override;
26 
27     esp_err_t config(WL_Config_s *cfg, Flash_Access *flash_drv) override;
28     esp_err_t init() override;
29 
30     size_t chip_size() override;
31 
32 protected:
33     esp_err_t erase_sector_fit(uint32_t start_sector, uint32_t count) override;
34 
35     // Dump Sector
36     uint32_t dump_addr; // dump buffer address
37     uint32_t state_addr;// sectore where state of transaction will be stored
38 
39     esp_err_t recover();
40 };
41 
42 #endif // _WL_Ext_Safe_H_
43