mirror of
https://github.com/0xFEEDC0DE64/arduino-esp32.git
synced 2025-06-30 12:30:59 +02:00
Update IDF to aaf1239 (#1539)
* fix sdmmc config * Fix warnings in EEPROM from @Curclamas * remove leftover TAG in EEPROM * Initial add of @stickbreaker i2c * Add log_n * fix warnings when log is off * i2c code clean up and reorganization * add flags to interrupt allocator * fix sdmmc config * Fix warnings in EEPROM from @Curclamas * remove leftover TAG in EEPROM * fix errors with latest IDF * fix debug optimization (#1365) incorrect optimization for debugging tick markers. * Fix some missing BT header * Change BTSerial log calls * Update BLE lib * Arduino-ESP32 release management scripted (#1515) * Calculate an absolute path for a custom partitions table (#1452) * * Arduino-ESP32 release management scripted (ready-to-merge) * * secure env for espressif/arduino-esp32 * * build tests enabled * gitter webhook enabled * * gitter room link fixed * better comment * * filepaths fixed * BT Serial adjustments * * don't run sketch builds & tests for tagged builds * Return false from WiFi.hostByName() if hostname is not resolved * Free BT Memory when BT is not used * WIFI_MODE_NULL is not supported anymore * Select some key examples to build with PlatformIO to save some time * Update BLE lib * Fixed BLE lib * Major WiFi overhaul - auto reconnect on connection loss now works - moved to event groups - some code clean up and procedure optimizations - new methods to get a more elaborate system ststus * Add cmake tests to travis * Add initial AsyncUDP * Add NetBIOS lib and fix CMake includes * Add Initial WebServer * Fix WebServer and examples * travis not quiting on build fail * Try different travis build * Update IDF to aaf1239 * Fix WPS Example * fix script permission and add some fail tests to sketch builder * Add missing space in WiFiClient::write(Stream &stream)
This commit is contained in:
@ -18,16 +18,30 @@
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdarg.h>
|
||||
#include <unistd.h>
|
||||
#include "freertos/FreeRTOS.h"
|
||||
#include "freertos/semphr.h"
|
||||
#include "esp_err.h"
|
||||
#include <sys/types.h>
|
||||
#include <sys/reent.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/time.h>
|
||||
#include <dirent.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef _SYS_TYPES_FD_SET
|
||||
#error "VFS should be used with FD_SETSIZE and FD_SET from sys/types.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Maximum number of (global) file descriptors.
|
||||
*/
|
||||
#define MAX_FDS FD_SETSIZE /* for compatibility with fd_set and select() */
|
||||
|
||||
/**
|
||||
* Maximum length of path prefix (not including zero terminator)
|
||||
*/
|
||||
@ -43,20 +57,10 @@ extern "C" {
|
||||
*/
|
||||
#define ESP_VFS_FLAG_CONTEXT_PTR 1
|
||||
|
||||
/**
|
||||
* Flag which indicates that the FD space of the VFS implementation should be made
|
||||
* the same as the FD space in newlib. This means that the normal masking off
|
||||
* of VFS-independent fd bits is ignored and the full user-facing fd is passed to
|
||||
* the VFS implementation.
|
||||
*
|
||||
* Set the p_minimum_fd & p_maximum_fd pointers when registering the socket in
|
||||
* order to know what range of FDs can be used with the registered VFS.
|
||||
*
|
||||
* This is mostly useful for LWIP which shares the socket FD space with
|
||||
* socket-specific functions.
|
||||
*
|
||||
/*
|
||||
* @brief VFS identificator used for esp_vfs_register_with_id()
|
||||
*/
|
||||
#define ESP_VFS_FLAG_SHARED_FD_SPACE 2
|
||||
typedef int esp_vfs_id_t;
|
||||
|
||||
/**
|
||||
* @brief VFS definition structure
|
||||
@ -81,7 +85,7 @@ extern "C" {
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
int flags; /*!< ESP_VFS_FLAG_CONTEXT_PTR or ESP_VFS_FLAG_DEFAULT, plus optionally ESP_VFS_FLAG_SHARED_FD_SPACE */
|
||||
int flags; /*!< ESP_VFS_FLAG_CONTEXT_PTR or ESP_VFS_FLAG_DEFAULT */
|
||||
union {
|
||||
ssize_t (*write_p)(void* p, int fd, const void * data, size_t size);
|
||||
ssize_t (*write)(int fd, const void * data, size_t size);
|
||||
@ -166,6 +170,24 @@ typedef struct
|
||||
int (*fsync_p)(void* ctx, int fd);
|
||||
int (*fsync)(int fd);
|
||||
};
|
||||
union {
|
||||
int (*access_p)(void* ctx, const char *path, int amode);
|
||||
int (*access)(const char *path, int amode);
|
||||
};
|
||||
union {
|
||||
int (*truncate_p)(void* ctx, const char *path, off_t length);
|
||||
int (*truncate)(const char *path, off_t length);
|
||||
};
|
||||
/** start_select is called for setting up synchronous I/O multiplexing of the desired file descriptors in the given VFS */
|
||||
esp_err_t (*start_select)(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, SemaphoreHandle_t *signal_sem);
|
||||
/** socket select function for socket FDs with the functionality of POSIX select(); this should be set only for the socket VFS */
|
||||
int (*socket_select)(int nfds, fd_set *readfds, fd_set *writefds, fd_set *errorfds, struct timeval *timeout);
|
||||
/** called by VFS to interrupt the socket_select call when select is activated from a non-socket VFS driver; set only for the socket driver */
|
||||
void (*stop_socket_select)();
|
||||
/** stop_socket_select which can be called from ISR; set only for the socket driver */
|
||||
void (*stop_socket_select_isr)(BaseType_t *woken);
|
||||
/** end_select is called to stop the I/O multiplexing and deinitialize the environment created by start_select for the given VFS */
|
||||
void (*end_select)();
|
||||
} esp_vfs_t;
|
||||
|
||||
|
||||
@ -193,19 +215,38 @@ esp_err_t esp_vfs_register(const char* base_path, const esp_vfs_t* vfs, void* ct
|
||||
|
||||
/**
|
||||
* Special case function for registering a VFS that uses a method other than
|
||||
* open() to open new file descriptors.
|
||||
* open() to open new file descriptors from the interval <min_fd; max_fd).
|
||||
*
|
||||
* This is a special-purpose function intended for registering LWIP sockets to VFS.
|
||||
*
|
||||
* @param vfs Pointer to esp_vfs_t. Meaning is the same as for esp_vfs_register().
|
||||
* @param vfs Pointer to esp_vfs_t. Meaning is the same as for esp_vfs_register().
|
||||
* @param ctx Pointer to context structure. Meaning is the same as for esp_vfs_register().
|
||||
* @param p_min_fd If non-NULL, on success this variable is written with the minimum (global/user-facing) FD that this VFS will use. This is useful when ESP_VFS_FLAG_SHARED_FD_SPACE is set in vfs->flags.
|
||||
* @param p_max_fd If non-NULL, on success this variable is written with one higher than the maximum (global/user-facing) FD that this VFS will use. This is useful when ESP_VFS_FLAG_SHARED_FD_SPACE is set in vfs->flags.
|
||||
* @param min_fd The smallest file descriptor this VFS will use.
|
||||
* @param max_fd Upper boundary for file descriptors this VFS will use (the biggest file descriptor plus one).
|
||||
*
|
||||
* @return ESP_OK if successful, ESP_ERR_NO_MEM if too many VFSes are
|
||||
* registered.
|
||||
* registered, ESP_ERR_INVALID_ARG if the file descriptor boundaries
|
||||
* are incorrect.
|
||||
*/
|
||||
esp_err_t esp_vfs_register_socket_space(const esp_vfs_t *vfs, void *ctx, int *p_min_fd, int *p_max_fd);
|
||||
esp_err_t esp_vfs_register_fd_range(const esp_vfs_t *vfs, void *ctx, int min_fd, int max_fd);
|
||||
|
||||
/**
|
||||
* Special case function for registering a VFS that uses a method other than
|
||||
* open() to open new file descriptors. In comparison with
|
||||
* esp_vfs_register_fd_range, this function doesn't pre-registers an interval
|
||||
* of file descriptors. File descriptors can be registered later, by using
|
||||
* esp_vfs_register_fd.
|
||||
*
|
||||
* @param vfs Pointer to esp_vfs_t. Meaning is the same as for esp_vfs_register().
|
||||
* @param ctx Pointer to context structure. Meaning is the same as for esp_vfs_register().
|
||||
* @param vfs_id Here will be written the VFS ID which can be passed to
|
||||
* esp_vfs_register_fd for registering file descriptors.
|
||||
*
|
||||
* @return ESP_OK if successful, ESP_ERR_NO_MEM if too many VFSes are
|
||||
* registered, ESP_ERR_INVALID_ARG if the file descriptor boundaries
|
||||
* are incorrect.
|
||||
*/
|
||||
esp_err_t esp_vfs_register_with_id(const esp_vfs_t *vfs, void *ctx, esp_vfs_id_t *vfs_id);
|
||||
|
||||
/**
|
||||
* Unregister a virtual filesystem for given path prefix
|
||||
@ -216,6 +257,31 @@ esp_err_t esp_vfs_register_socket_space(const esp_vfs_t *vfs, void *ctx, int *p_
|
||||
*/
|
||||
esp_err_t esp_vfs_unregister(const char* base_path);
|
||||
|
||||
/**
|
||||
* Special function for registering another file descriptor for a VFS registered
|
||||
* by esp_vfs_register_with_id.
|
||||
*
|
||||
* @param vfs_id VFS identificator returned by esp_vfs_register_with_id.
|
||||
* @param fd The registered file descriptor will be written to this address.
|
||||
*
|
||||
* @return ESP_OK if the registration is successful,
|
||||
* ESP_ERR_NO_MEM if too many file descriptors are registered,
|
||||
* ESP_ERR_INVALID_ARG if the arguments are incorrect.
|
||||
*/
|
||||
esp_err_t esp_vfs_register_fd(esp_vfs_id_t vfs_id, int *fd);
|
||||
|
||||
/**
|
||||
* Special function for unregistering a file descriptor belonging to a VFS
|
||||
* registered by esp_vfs_register_with_id.
|
||||
*
|
||||
* @param vfs_id VFS identificator returned by esp_vfs_register_with_id.
|
||||
* @param fd File descriptor which should be unregistered.
|
||||
*
|
||||
* @return ESP_OK if the registration is successful,
|
||||
* ESP_ERR_INVALID_ARG if the arguments are incorrect.
|
||||
*/
|
||||
esp_err_t esp_vfs_unregister_fd(esp_vfs_id_t vfs_id, int fd);
|
||||
|
||||
/**
|
||||
* These functions are to be used in newlib syscall table. They will be called by
|
||||
* newlib when it needs to use any of the syscalls.
|
||||
@ -233,10 +299,55 @@ int esp_vfs_unlink(struct _reent *r, const char *path);
|
||||
int esp_vfs_rename(struct _reent *r, const char *src, const char *dst);
|
||||
/**@}*/
|
||||
|
||||
/**
|
||||
* @brief Synchronous I/O multiplexing which implements the functionality of POSIX select() for VFS
|
||||
* @param nfds Specifies the range of descriptors which should be checked.
|
||||
* The first nfds descriptors will be checked in each set.
|
||||
* @param readfds If not NULL, then points to a descriptor set that on input
|
||||
* specifies which descriptors should be checked for being
|
||||
* ready to read, and on output indicates which descriptors
|
||||
* are ready to read.
|
||||
* @param writefds If not NULL, then points to a descriptor set that on input
|
||||
* specifies which descriptors should be checked for being
|
||||
* ready to write, and on output indicates which descriptors
|
||||
* are ready to write.
|
||||
* @param errorfds If not NULL, then points to a descriptor set that on input
|
||||
* specifies which descriptors should be checked for error
|
||||
* conditions, and on output indicates which descriptors
|
||||
* have error conditions.
|
||||
* @param timeout If not NULL, then points to timeval structure which
|
||||
* specifies the time period after which the functions should
|
||||
* time-out and return. If it is NULL, then the function will
|
||||
* not time-out.
|
||||
*
|
||||
* @return The number of descriptors set in the descriptor sets, or -1
|
||||
* when an error (specified by errno) have occurred.
|
||||
*/
|
||||
int esp_vfs_select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *errorfds, struct timeval *timeout);
|
||||
|
||||
/**
|
||||
* @brief Notification from a VFS driver about a read/write/error condition
|
||||
*
|
||||
* This function is called when the VFS driver detects a read/write/error
|
||||
* condition as it was requested by the previous call to start_select.
|
||||
*
|
||||
* @param signal_sem semaphore handle which was passed to the driver by the start_select call
|
||||
*/
|
||||
void esp_vfs_select_triggered(SemaphoreHandle_t *signal_sem);
|
||||
|
||||
/**
|
||||
* @brief Notification from a VFS driver about a read/write/error condition (ISR version)
|
||||
*
|
||||
* This function is called when the VFS driver detects a read/write/error
|
||||
* condition as it was requested by the previous call to start_select.
|
||||
*
|
||||
* @param signal_sem semaphore handle which was passed to the driver by the start_select call
|
||||
* @param woken is set to pdTRUE if the function wakes up a task with higher priority
|
||||
*/
|
||||
void esp_vfs_select_triggered_isr(SemaphoreHandle_t *signal_sem, BaseType_t *woken);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
|
||||
#endif //__ESP_VFS_H__
|
||||
|
Reference in New Issue
Block a user