MeterLogger
upgrade.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 __UPGRADE_H__
26 #define __UPGRADE_H__
27 
28 #define SPI_FLASH_SEC_SIZE 4096
29 #define LIMIT_ERASE_SIZE 0x10000
30 
31 #define USER_BIN1 0x00
32 #define USER_BIN2 0x01
33 
34 #define UPGRADE_FLAG_IDLE 0x00
35 #define UPGRADE_FLAG_START 0x01
36 #define UPGRADE_FLAG_FINISH 0x02
37 
38 #define UPGRADE_FW_BIN1 0x00
39 #define UPGRADE_FW_BIN2 0x01
40 
41 typedef void (*upgrade_states_check_callback)(void * arg);
42 
43 //#define UPGRADE_SSL_ENABLE
44 
46  uint8 ip[4];
48 
50 
53 
56 
58  struct espconn *pespconn;
59 };
60 
61 #define UPGRADE_FLAG_IDLE 0x00
62 #define UPGRADE_FLAG_START 0x01
63 #define UPGRADE_FLAG_FINISH 0x02
64 
65 void system_upgrade_init();
67 bool system_upgrade(uint8 *data, uint16 len);
68 
69 #ifdef UPGRADE_SSL_ENABLE
70 bool system_upgrade_start_ssl(struct upgrade_server_info *server); // not supported now
71 #else
72 bool system_upgrade_start(struct upgrade_server_info *server);
73 #endif
74 #endif
uint8 upgrade_version[16]
Definition: upgrade.h:52
unsigned short uint16
Definition: c_types.h:50
void system_upgrade_deinit()
struct espconn * pespconn
Definition: upgrade.h:58
uint32 check_times
Definition: upgrade.h:54
unsigned char uint8
Definition: c_types.h:45
void(* upgrade_states_check_callback)(void *arg)
Definition: upgrade.h:41
uint8 pre_version[16]
Definition: upgrade.h:51
upgrade_states_check_callback check_cb
Definition: upgrade.h:57
uint8 upgrade_flag
Definition: upgrade.h:49
unsigned int uint32
Definition: c_types.h:54
bool system_upgrade(uint8 *data, uint16 len)
void system_upgrade_init()
bool system_upgrade_start(struct upgrade_server_info *server)