mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-08-06 15:15:15 +08:00
Merge branch 'feature/add_get_dram_size' into 'master'
heap: add function to get DRAM region free size See merge request sdk/ESP8266_RTOS_SDK!1100
This commit is contained in:
@ -13,12 +13,23 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
#include "esp_heap_caps.h"
|
#include "esp_heap_caps.h"
|
||||||
|
#include "esp_attr.h"
|
||||||
|
|
||||||
#define HEAP_REGION_IRAM_MIN 512
|
#define HEAP_REGION_IRAM_MIN 512
|
||||||
#define HEAP_REGION_IRAM_MAX 0x00010000
|
#define HEAP_REGION_IRAM_MAX 0x00010000
|
||||||
|
|
||||||
heap_region_t g_heap_region[HEAP_REGIONS_MAX];
|
heap_region_t g_heap_region[HEAP_REGIONS_MAX];
|
||||||
|
|
||||||
|
size_t IRAM_ATTR heap_caps_get_dram_free_size(void)
|
||||||
|
{
|
||||||
|
#ifndef CONFIG_HEAP_DISABLE_IRAM
|
||||||
|
extern size_t g_heap_region_num;
|
||||||
|
|
||||||
|
return g_heap_region[g_heap_region_num - 1].free_bytes;
|
||||||
|
#else
|
||||||
|
return g_heap_region[0].free_bytes;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Initialize the capability-aware heap allocator.
|
* @brief Initialize the capability-aware heap allocator.
|
||||||
|
@ -14,6 +14,12 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
#define _heap_caps_lock(_num) \
|
#define _heap_caps_lock(_num) \
|
||||||
{ \
|
{ \
|
||||||
extern void vPortETSIntrLock(void); \
|
extern void vPortETSIntrLock(void); \
|
||||||
@ -32,3 +38,13 @@
|
|||||||
esp_task_wdt_reset(); \
|
esp_task_wdt_reset(); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get the total free size of DRAM region
|
||||||
|
*
|
||||||
|
* @return Amount of free bytes in DRAM region
|
||||||
|
*/
|
||||||
|
size_t heap_caps_get_dram_free_size(void);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
Reference in New Issue
Block a user