mirror of
https://github.com/0xFEEDC0DE64/arduino-esp32.git
synced 2025-06-30 04:21:00 +02:00
IDF master c13afea63 (#5214)
esp-dsp: master 7cc5073 esp-face: master 420fc7e esp-rainmaker: f1b82c7 esp32-camera: master 6f8489e esp_littlefs: master b58f00c
This commit is contained in:
@ -325,6 +325,15 @@ esp_err_t esp_vfs_register_with_id(const esp_vfs_t *vfs, void *ctx, esp_vfs_id_t
|
||||
*/
|
||||
esp_err_t esp_vfs_unregister(const char* base_path);
|
||||
|
||||
/**
|
||||
* Unregister a virtual filesystem with the given index
|
||||
*
|
||||
* @param vfs_id The VFS ID returned by esp_vfs_register_with_id
|
||||
* @return ESP_OK if successful, ESP_ERR_INVALID_STATE if VFS for the given index
|
||||
* hasn't been registered
|
||||
*/
|
||||
esp_err_t esp_vfs_unregister_with_id(esp_vfs_id_t vfs_id);
|
||||
|
||||
/**
|
||||
* Special function for registering another file descriptor for a VFS registered
|
||||
* by esp_vfs_register_with_id.
|
||||
@ -338,6 +347,21 @@ esp_err_t esp_vfs_unregister(const char* base_path);
|
||||
*/
|
||||
esp_err_t esp_vfs_register_fd(esp_vfs_id_t vfs_id, int *fd);
|
||||
|
||||
/**
|
||||
* Special function for registering another file descriptor with given local_fd
|
||||
* for a VFS registered by esp_vfs_register_with_id.
|
||||
*
|
||||
* @param vfs_id VFS identificator returned by esp_vfs_register_with_id.
|
||||
* @param local_fd The fd in the local vfs. Passing -1 will set the local fd as the (*fd) value.
|
||||
* @param permanent Whether the fd should be treated as permannet (not removed after close())
|
||||
* @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_with_local_fd(esp_vfs_id_t vfs_id, int local_fd, bool permanent, int *fd);
|
||||
|
||||
/**
|
||||
* Special function for unregistering a file descriptor belonging to a VFS
|
||||
* registered by esp_vfs_register_with_id.
|
||||
|
71
tools/sdk/esp32s2/include/vfs/include/esp_vfs_eventfd.h
Normal file
71
tools/sdk/esp32s2/include/vfs/include/esp_vfs_eventfd.h
Normal file
@ -0,0 +1,71 @@
|
||||
// Copyright 2021 Espressif Systems (Shanghai) CO LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stddef.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "esp_err.h"
|
||||
|
||||
#define EFD_SUPPORT_ISR (1 << 4)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Eventfd vfs initialization settings
|
||||
*/
|
||||
typedef struct {
|
||||
size_t max_fds; /*!< The maxinum number of eventfds supported */
|
||||
} esp_vfs_eventfd_config_t;
|
||||
|
||||
#define ESP_VFS_EVENTD_CONFIG_DEFAULT() (esp_vfs_eventfd_config_t) { \
|
||||
.max_fds = 5, \
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Registers the event vfs.
|
||||
*
|
||||
* @return ESP_OK if successful, ESP_ERR_NO_MEM if too many VFSes are
|
||||
* registered.
|
||||
*/
|
||||
esp_err_t esp_vfs_eventfd_register(const esp_vfs_eventfd_config_t *config);
|
||||
|
||||
/**
|
||||
* @brief Unregisters the event vfs.
|
||||
*
|
||||
* @return ESP_OK if successful, ESP_ERR_INVALID_STATE if VFS for given prefix
|
||||
* hasn't been registered
|
||||
*/
|
||||
esp_err_t esp_vfs_eventfd_unregister(void);
|
||||
|
||||
/*
|
||||
* @brief Creates an event file descirptor.
|
||||
*
|
||||
* The behavior of read, write and select is the same as man(2) eventfd with
|
||||
* EFD_SEMAPHORE **NOT** specified. A new flag EFD_SUPPORT_ISR has been added.
|
||||
* This flag is required to write to event fds in interrupt handlers. Accessing
|
||||
* the control blocks of event fds with EFD_SUPPORT_ISR will cause interrupts to
|
||||
* be temporarily blocked (e.g. during read, write and beginning and ending of
|
||||
* the * select).
|
||||
*
|
||||
* @return The file descriptor if successful, -1 if error happens.
|
||||
*/
|
||||
int eventfd(unsigned int initval, int flags);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
@ -0,0 +1,66 @@
|
||||
// Copyright 2021 Espressif Systems (Shanghai) PTE LTD
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "esp_err.h"
|
||||
#include "esp_vfs.h"
|
||||
#include "esp_vfs_common.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief add /dev/usbserjtag virtual filesystem driver
|
||||
*
|
||||
* This function is called from startup code to enable console output
|
||||
*/
|
||||
esp_err_t esp_vfs_dev_usb_serial_jtag_register(void);
|
||||
|
||||
/**
|
||||
* @brief Set the line endings expected to be received
|
||||
*
|
||||
* This specifies the conversion between line endings received and
|
||||
* newlines ('\n', LF) passed into stdin:
|
||||
*
|
||||
* - ESP_LINE_ENDINGS_CRLF: convert CRLF to LF
|
||||
* - ESP_LINE_ENDINGS_CR: convert CR to LF
|
||||
* - ESP_LINE_ENDINGS_LF: no modification
|
||||
*
|
||||
* @note this function is not thread safe w.r.t. reading
|
||||
*
|
||||
* @param mode line endings expected
|
||||
*/
|
||||
void esp_vfs_dev_usb_serial_jtag_set_rx_line_endings(esp_line_endings_t mode);
|
||||
|
||||
/**
|
||||
* @brief Set the line endings to sent
|
||||
*
|
||||
* This specifies the conversion between newlines ('\n', LF) on stdout and line
|
||||
* endings sent:
|
||||
*
|
||||
* - ESP_LINE_ENDINGS_CRLF: convert LF to CRLF
|
||||
* - ESP_LINE_ENDINGS_CR: convert LF to CR
|
||||
* - ESP_LINE_ENDINGS_LF: no modification
|
||||
*
|
||||
* @note this function is not thread safe w.r.t. writing
|
||||
*
|
||||
* @param mode line endings to send
|
||||
*/
|
||||
void esp_vfs_dev_usb_serial_jtag_set_tx_line_endings(esp_line_endings_t mode);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
Reference in New Issue
Block a user