CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
Ardupilot

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: Ardupilot/ardupilot
Path: blob/master/libraries/AP_Filesystem/AP_Filesystem_ESP32.h
Views: 1798
1
#pragma once
2
3
#include <stdio.h>
4
#include <string.h>
5
#include <errno.h>
6
#include <sys/unistd.h>
7
#include <sys/types.h>
8
#include <sys/stat.h>
9
#include <fcntl.h>
10
#include <dirent.h>
11
#include "esp_err.h"
12
#include "esp_log.h"
13
#include "esp_vfs_fat.h"
14
#include "driver/sdmmc_host.h"
15
#include "driver/sdspi_host.h"
16
#include "sdmmc_cmd.h"
17
18
#include "AP_Filesystem_backend.h"
19
20
class AP_Filesystem_ESP32 : public AP_Filesystem_Backend
21
{
22
public:
23
// functions that closely match the equivalent posix calls
24
int open(const char *fname, int flags, bool allow_absolute_paths = false) override;
25
int close(int fd) override;
26
int32_t read(int fd, void *buf, uint32_t count) override;
27
int32_t write(int fd, const void *buf, uint32_t count) override;
28
int fsync(int fd) override;
29
int32_t lseek(int fd, int32_t offset, int whence) override;
30
int stat(const char *pathname, struct stat *stbuf) override;
31
int unlink(const char *pathname) override;
32
int mkdir(const char *pathname) override;
33
void *opendir(const char *pathname) override;
34
struct dirent *readdir(void *dirp) override;
35
int closedir(void *dirp) override;
36
int rename(const char *oldpath, const char *newpath) override;
37
38
// return free disk space in bytes, -1 on error
39
int64_t disk_free(const char *path) override;
40
41
// return total disk space in bytes, -1 on error
42
int64_t disk_space(const char *path) override;
43
44
// set modification time on a file
45
bool set_mtime(const char *filename, const uint32_t mtime_sec) override;
46
};
47
48
49