mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-05-17 23:27:06 +08:00
feat(wear_levelling): modify wear_levelling for ESP8266
This commit is contained in:
@ -12,7 +12,7 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
#include "crc32.h"
|
#include "crc32.h"
|
||||||
#include "esp32/rom/crc.h"
|
#include "rom/crc.h"
|
||||||
|
|
||||||
unsigned int crc32::crc32_le(unsigned int crc, unsigned char const *buf, unsigned int len)
|
unsigned int crc32::crc32_le(unsigned int crc, unsigned char const *buf, unsigned int len)
|
||||||
{
|
{
|
||||||
|
@ -2,17 +2,25 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "unity.h"
|
#include "unity.h"
|
||||||
#include "wear_levelling.h"
|
#include "wear_levelling.h"
|
||||||
|
#include "esp_system.h"
|
||||||
|
#include "esp_timer.h"
|
||||||
#include "test_utils.h"
|
#include "test_utils.h"
|
||||||
#include "freertos/FreeRTOS.h"
|
#include "freertos/FreeRTOS.h"
|
||||||
#include "freertos/portable.h"
|
//#include "freertos/portable.h"
|
||||||
#include "freertos/task.h"
|
#include "freertos/task.h"
|
||||||
#include "freertos/semphr.h"
|
#include "freertos/semphr.h"
|
||||||
#ifdef CONFIG_IDF_TARGET_ESP32
|
#ifdef CONFIG_IDF_TARGET_ESP32
|
||||||
#include "esp32/clk.h"
|
#include "esp32/clk.h"
|
||||||
|
#include "soc/cpu.h"
|
||||||
#elif defined(CONFIG_IDF_TARGET_ESP32S2BETA)
|
#elif defined(CONFIG_IDF_TARGET_ESP32S2BETA)
|
||||||
#include "esp32s2beta/clk.h"
|
#include "esp32s2beta/clk.h"
|
||||||
#endif
|
|
||||||
#include "soc/cpu.h"
|
#include "soc/cpu.h"
|
||||||
|
#elif CONFIG_IDF_TARGET_ESP8266
|
||||||
|
#include "esp_clk.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define xPortGetFreeHeapSize() esp_get_free_heap_size()
|
||||||
|
#define RSR(_c, _t) _t = (uint32_t) esp_timer_get_time()
|
||||||
|
|
||||||
TEST_CASE("wl_unmount doesn't leak memory", "[wear_levelling]")
|
TEST_CASE("wl_unmount doesn't leak memory", "[wear_levelling]")
|
||||||
{
|
{
|
||||||
@ -101,7 +109,7 @@ static void read_write_task(void* param)
|
|||||||
esp_err_t err;
|
esp_err_t err;
|
||||||
srand(args->seed);
|
srand(args->seed);
|
||||||
for (size_t i = 0; i < args->word_count; ++i) {
|
for (size_t i = 0; i < args->word_count; ++i) {
|
||||||
uint32_t val = rand();
|
uint32_t val = i * 77;
|
||||||
if (args->write) {
|
if (args->write) {
|
||||||
err = wl_write(args->handle, args->offset + i * sizeof(val), &val, sizeof(val));
|
err = wl_write(args->handle, args->offset + i * sizeof(val), &val, sizeof(val));
|
||||||
if (err != ESP_OK) {
|
if (err != ESP_OK) {
|
||||||
|
Reference in New Issue
Block a user