Path: blob/master/libraries/AP_Filesystem/AP_Filesystem_ESP32.h
9559 views
#pragma once12#include <stdio.h>3#include <string.h>4#include <errno.h>5#include <sys/unistd.h>6#include <sys/types.h>7#include <sys/stat.h>8#include <fcntl.h>9#include <dirent.h>10#include "esp_err.h"11#include "esp_log.h"12#include "esp_vfs_fat.h"13#include "driver/sdmmc_host.h"14#include "driver/sdspi_host.h"15#include "sdmmc_cmd.h"1617#include "AP_Filesystem_backend.h"1819class AP_Filesystem_ESP32 : public AP_Filesystem_Backend20{21public:22// functions that closely match the equivalent posix calls23int open(const char *fname, int flags, bool allow_absolute_paths = false) override;24int close(int fd) override;25int32_t read(int fd, void *buf, uint32_t count) override;26int32_t write(int fd, const void *buf, uint32_t count) override;27int fsync(int fd) override;28int32_t lseek(int fd, int32_t offset, int whence) override;29int stat(const char *pathname, struct stat *stbuf) override;30int unlink(const char *pathname) override;31int mkdir(const char *pathname) override;32void *opendir(const char *pathname) override;33struct dirent *readdir(void *dirp) override;34int closedir(void *dirp) override;35int rename(const char *oldpath, const char *newpath) override;3637uint32_t bytes_until_fsync(int fd) override;3839// return free disk space in bytes, -1 on error40int64_t disk_free(const char *path) override;4142// return total disk space in bytes, -1 on error43int64_t disk_space(const char *path) override;4445// set modification time on a file46bool set_mtime(const char *filename, const uint32_t mtime_sec) override;47};48495051