ESP8266_RTOS_SDK v1.4.0

- Main Page
- Modules
- Data Structures
- Files

- File List

upgrade.h
1 /*
2 * ESPRSSIF MIT License
3 *
4 * Copyright (c) 2015 <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 #include "lwip/sockets.h"
29
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33
50 #define SPI_FLASH_SEC_SIZE 4096
52 #define USER_BIN1 0x00
53 #define USER_BIN2 0x01
55 #define UPGRADE_FLAG_IDLE 0x00
56 #define UPGRADE_FLAG_START 0x01
57 #define UPGRADE_FLAG_FINISH 0x02
59 #define UPGRADE_FW_BIN1 0x00
60 #define UPGRADE_FW_BIN2 0x01
69 typedef void (*upgrade_states_check_callback)(void *arg);
70
71 //#define UPGRADE_SSL_ENABLE
72
73 struct upgrade_server_info {
74 struct sockaddr_in sockaddrin;
75 upgrade_states_check_callback check_cb;
76 uint32 check_times;
77 uint8 pre_version[16];
78 uint8 upgrade_version[16];
79 uint8 *url;
80 void *pclient_param;
81 uint8 upgrade_flag;
82 };
83
91 void system_upgrade_init();
92
100 void system_upgrade_deinit();
101
110 bool system_upgrade(uint8 *data, uint32 len);
111
112 #ifdef UPGRADE_SSL_ENABLE
113
122 bool system_upgrade_start_ssl(struct upgrade_server_info *server);
123 #else
124
134 bool system_upgrade_start(struct upgrade_server_info *server);
135 #endif
136
145 #ifdef __cplusplus
146 }
147 #endif
148
149 #endif
upgrade_server_info::upgrade_flag
uint8 upgrade_flag
Definition: upgrade.h:81
upgrade_server_info::check_times
uint32 check_times
Definition: upgrade.h:76
upgrade_server_info::check_cb
upgrade_states_check_callback check_cb
Definition: upgrade.h:75
upgrade_server_info::pre_version
uint8 pre_version[16]
Definition: upgrade.h:77
system_upgrade_init
void system_upgrade_init()
Upgrade function initialization.
upgrade_server_info
Definition: upgrade.h:73
upgrade_server_info::upgrade_version
uint8 upgrade_version[16]
Definition: upgrade.h:78
system_upgrade_start
bool system_upgrade_start(struct upgrade_server_info *server)
Start upgrade firmware through WiFi with normal connection.
upgrade_server_info::sockaddrin
struct sockaddr_in sockaddrin
Definition: upgrade.h:74
upgrade_server_info::url
uint8 * url
Definition: upgrade.h:79
system_upgrade
bool system_upgrade(uint8 *data, uint32 len)
Upgrade function de-initialization.
system_upgrade_deinit
void system_upgrade_deinit()
Upgrade function de-initialization.
upgrade_states_check_callback
void(* upgrade_states_check_callback)(void *arg)
Callback of upgrading firmware through WiFi.
Definition: upgrade.h:69