ESP32_RTOS_SDK V1.1.0

- Main Page
- Modules
- Data Structures
- Files

- File List

esp_system.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 ESP32 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 __ESP_SYSTEM_H__
26 #define __ESP_SYSTEM_H__
27
28 #include "c_types.h"
29
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33
49 const char *system_get_sdk_version(void);
50
62 void system_restore(void);
63
71 void system_restart(void);
72
86 void system_deep_sleep(uint64 time_in_us);
87
95 uint32 system_get_time(void);
96
104 void system_print_meminfo(void);
105
113 uint32 system_get_free_heap_size(void);
114
129 bool system_get_chip_id(uint8 *chip_id);
130
138 uint32 system_get_rtc_time(void);
139
159 bool system_rtc_mem_read(uint16 src, void *dst, uint16 n);
160
182 bool system_rtc_mem_write(uint16 dst, const void *src, uint16 n);
183
184 typedef enum {
185 ADC1_PAD_GPIO36 = 0,
186 ADC1_PAD_GPIO37,
187 ADC1_PAD_GPIO38,
188 ADC1_PAD_GPIO39,
189 ADC1_PAD_GPIO32,
190 ADC1_PAD_GPIO33,
191 ADC1_PAD_GPIO34,
192 ADC1_PAD_GPIO35
193 } adc1_read_pad;
194
195 typedef enum {
196 ADC1_ATTEN_0DB = 0,
197 ADC1_ATTEN_3DB,
198 ADC1_ATTEN_6DB,
199 ADC1_ATTEN_12DB
200 } adc1_read_atten;
201
214 uint16 system_adc1_read(adc1_read_pad pad, adc1_read_atten atten);
215
225 uint16 system_get_vdd33(void);
226
248 bool system_param_save_with_protect(uint16 start_sec, void *param, uint16 len);
249
273 bool system_param_load(uint16 start_sec, uint16 offset, void *param, uint16 len);
274
275
284 enum flash_size{
285 FLASH_SIZE_1MB = 0,
286 FLASH_SIZE_2MB,
287 FLASH_SIZE_4MB,
288 FLASH_SIZE_8MB,
289 FLASH_SIZE_16MB,
290 FLASH_SIZE_MAX
291 } ;
292
293 struct b_info{
294 char bin_start_flash_id;
295 char bin_end_flash_id;
296 char bin_status;
297 char pad;
298 unsigned int jump_addr;
299 };
300
308 enum flash_size system_get_flash_size(void);
309
317 uint8 system_get_cpu_freq(void);
318
328 bool system_get_bin_info(uint8 bin_id, struct b_info *b_if);
329
339 bool system_set_bin_info(uint8 bin_id, struct b_info *b_if);
340
348 uint8 system_get_current_bin_id(void);
349
358 bool system_reboot_to_userbin(uint8 bin_id);
359
377 typedef enum {
378 DEFAULT_MAC = 0,
379 USER_MAC,
380 } mac_group;
381
382 typedef enum {
383 WIFI_MAC = 0,
384 BT_MAC,
385 } mac_type;
386
400 int system_efuse_program_user_mac(mac_type type, uint8 *mac);
401
412 bool system_efuse_read_mac(mac_group group, mac_type type, uint8 *mac);
413
424 bool system_efuse_set_mac_group(mac_group group);
425
433 mac_group system_efuse_get_mac_group(void);
434
444 #ifdef __cplusplus
445 }
446 #endif
447
448 #endif
system_get_sdk_version
const char * system_get_sdk_version(void)
Get information of the SDK version.
mac_group
mac_group
Definition: esp_system.h:377
system_param_save_with_protect
bool system_param_save_with_protect(uint16 start_sec, void *param, uint16 len)
Write data into flash with protection.
system_get_current_bin_id
uint8 system_get_current_bin_id(void)
Get current bin's bin_id.
system_rtc_mem_read
bool system_rtc_mem_read(uint16 src, void *dst, uint16 n)
Read user data from the RTC memory.
system_efuse_get_mac_group
mac_group system_efuse_get_mac_group(void)
Get hardware MAC group, default MAC or user-defined MAC.
b_info::jump_addr
unsigned int jump_addr
Definition: esp_system.h:298
FLASH_SIZE_1MB
Definition: esp_system.h:285
b_info::bin_status
char bin_status
Definition: esp_system.h:296
system_rtc_mem_write
bool system_rtc_mem_write(uint16 dst, const void *src, uint16 n)
Write user data to the RTC memory.
FLASH_SIZE_2MB
Definition: esp_system.h:286
system_get_free_heap_size
uint32 system_get_free_heap_size(void)
Get the size of available heap.
system_restore
void system_restore(void)
Reset to default settings.
system_efuse_read_mac
bool system_efuse_read_mac(mac_group group, mac_type type, uint8 *mac)
Read hardware MAC address.
BT_MAC
Definition: esp_system.h:384
system_adc1_read
uint16 system_adc1_read(adc1_read_pad pad, adc1_read_atten atten)
Read ADC1.
WIFI_MAC
Definition: esp_system.h:383
FLASH_SIZE_16MB
Definition: esp_system.h:289
system_get_cpu_freq
uint8 system_get_cpu_freq(void)
Get CPU frequency.
system_param_load
bool system_param_load(uint16 start_sec, uint16 offset, void *param, uint16 len)
Read the data saved into flash with the read/write protection.
FLASH_SIZE_4MB
Definition: esp_system.h:287
FLASH_SIZE_8MB
Definition: esp_system.h:288
system_get_vdd33
uint16 system_get_vdd33(void)
Measure the power voltage of VDD3P3 pin 3 and 4, unit : 1/1024 V.
b_info::bin_end_flash_id
char bin_end_flash_id
Definition: esp_system.h:295
b_info::pad
char pad
Definition: esp_system.h:297
system_get_rtc_time
uint32 system_get_rtc_time(void)
Get RTC time, unit: RTC clock cycle.
system_get_bin_info
bool system_get_bin_info(uint8 bin_id, struct b_info *b_if)
Get bin info named by b_id.
system_deep_sleep
void system_deep_sleep(uint64 time_in_us)
Set the chip to deep-sleep mode.
system_get_chip_id
bool system_get_chip_id(uint8 *chip_id)
Get the chip ID.
flash_size
flash_size
Definition: esp_system.h:284
system_print_meminfo
void system_print_meminfo(void)
Print the system memory distribution, including data/rodata/bss/heap.
system_set_bin_info
bool system_set_bin_info(uint8 bin_id, struct b_info *b_if)
Set bin info named by b_id.
system_reboot_to_userbin
bool system_reboot_to_userbin(uint8 bin_id)
reboot and jump to bin named by bin_id
USER_MAC
Definition: esp_system.h:379
system_efuse_program_user_mac
int system_efuse_program_user_mac(mac_type type, uint8 *mac)
Set user-define hardware MAC address.
b_info::bin_start_flash_id
char bin_start_flash_id
Definition: esp_system.h:294
b_info
Definition: esp_system.h:293
system_get_time
uint32 system_get_time(void)
Get system time, unit: microsecond.
system_get_flash_size
enum flash_size system_get_flash_size(void)
Get the current Flash size.
system_restart
void system_restart(void)
Restart system.
DEFAULT_MAC
Definition: esp_system.h:378
mac_type
mac_type
Definition: esp_system.h:382
system_efuse_set_mac_group
bool system_efuse_set_mac_group(mac_group group)
Set hardware MAC group, default MAC or user-defined MAC.