2022-01-14 12:33:37 -05:00
|
|
|
/*
|
|
|
|
* SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
2017-05-04 04:48:44 -04:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file test_fatfs_common.h
|
|
|
|
* @brief Common routines for FAT-on-SDMMC and FAT-on-WL tests
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define HEAP_SIZE_CAPTURE(heap_size) \
|
|
|
|
heap_size = esp_get_free_heap_size();
|
|
|
|
|
|
|
|
#define HEAP_SIZE_CHECK(heap_size, tolerance) \
|
|
|
|
do {\
|
|
|
|
size_t final_heap_size = esp_get_free_heap_size(); \
|
|
|
|
if (final_heap_size < heap_size - tolerance) { \
|
|
|
|
printf("Initial heap size: %d, final: %d, diff=%d\n", heap_size, final_heap_size, heap_size - final_heap_size); \
|
|
|
|
} \
|
|
|
|
} while(0)
|
|
|
|
|
2022-01-14 12:33:37 -05:00
|
|
|
extern const char* fatfs_test_hello_str;
|
|
|
|
extern const char* fatfs_test_hello_str_utf;
|
2017-05-04 04:48:44 -04:00
|
|
|
|
|
|
|
void test_fatfs_create_file_with_text(const char* name, const char* text);
|
|
|
|
|
|
|
|
void test_fatfs_overwrite_append(const char* filename);
|
|
|
|
|
|
|
|
void test_fatfs_read_file(const char* filename);
|
|
|
|
|
2017-11-30 07:57:37 -05:00
|
|
|
void test_fatfs_read_file_utf_8(const char* filename);
|
|
|
|
|
2019-07-01 05:08:57 -04:00
|
|
|
void test_fatfs_pread_file(const char* filename);
|
|
|
|
|
|
|
|
void test_fatfs_pwrite_file(const char* filename);
|
|
|
|
|
2017-05-04 04:48:44 -04:00
|
|
|
void test_fatfs_open_max_files(const char* filename_prefix, size_t files_count);
|
|
|
|
|
|
|
|
void test_fatfs_lseek(const char* filename);
|
|
|
|
|
2018-06-12 06:29:05 -04:00
|
|
|
void test_fatfs_truncate_file(const char* path);
|
|
|
|
|
2017-12-08 06:58:39 -05:00
|
|
|
void test_fatfs_stat(const char* filename, const char* root_dir);
|
2017-05-04 04:48:44 -04:00
|
|
|
|
2018-10-25 05:53:52 -04:00
|
|
|
void test_fatfs_utime(const char* filename, const char* root_dir);
|
|
|
|
|
2017-05-04 04:48:44 -04:00
|
|
|
void test_fatfs_unlink(const char* filename);
|
|
|
|
|
|
|
|
void test_fatfs_link_rename(const char* filename_prefix);
|
|
|
|
|
|
|
|
void test_fatfs_concurrent(const char* filename_prefix);
|
|
|
|
|
|
|
|
void test_fatfs_mkdir_rmdir(const char* filename_prefix);
|
|
|
|
|
2017-06-20 13:21:14 -04:00
|
|
|
void test_fatfs_can_opendir(const char* path);
|
|
|
|
|
2017-05-04 04:48:44 -04:00
|
|
|
void test_fatfs_opendir_readdir_rewinddir(const char* dir_prefix);
|
|
|
|
|
2017-11-30 07:57:37 -05:00
|
|
|
void test_fatfs_opendir_readdir_rewinddir_utf_8(const char* dir_prefix);
|
|
|
|
|
2017-05-04 04:48:44 -04:00
|
|
|
void test_fatfs_rw_speed(const char* filename, void* buf, size_t buf_size, size_t file_size, bool write);
|