chore: import upstream snapshot with attribution

This commit is contained in:
wehub-resource-sync
2026-07-13 13:04:25 +08:00
commit 548b49ebc0
20937 changed files with 5455372 additions and 0 deletions
@@ -0,0 +1,55 @@
/*
* SPDX-FileCopyrightText: 2025-2026 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <sys/types.h>
#include <stddef.h>
#include "esp_blockdev.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Create a new partition over a given blockdev
*
* @param parent The underlying device
* @param start Address of the start of the new partition. (Behaviour is undefined when this is not a multiple of block size for underlying device)
* @param size Size of the new partition. (Behaviour is undefined when this is not a multiple of block size for underlying device)
* @param out Where to store handle to the newly created block device. Will be unchanged upon failure.
*
* @return ESP_ERR_INVALID_ARG - Invalid argument was passed
* ESP_ERR_NO_MEM - Failed to allocate the struct
* ESP_OK
*/
esp_err_t esp_blockdev_generic_partition_get(esp_blockdev_handle_t parent, size_t start, size_t size, esp_blockdev_handle_t *out);
/**
* @brief Translate virtual partition address to parents address space
*
* @param device The device for which to do the translation
* @param address Address to be translated, relative to the partition start
*
* @return Parent-space address on success
* -1 on error (invalid argument or overflow)
*/
ssize_t esp_blockdev_generic_partition_translate_address_to_parent(esp_blockdev_handle_t device, size_t address);
/**
* @brief Translate virtual partition address from parents address space
*
* @param device The device for which to do the translation
* @param address Address to be translated, in the parent address space
*
* @return Partition-relative address on success
* -1 on error (invalid argument or underflow)
*/
ssize_t esp_blockdev_generic_partition_translate_address_to_child(esp_blockdev_handle_t device, size_t address);
#ifdef __cplusplus
}
#endif
@@ -0,0 +1,51 @@
/*
* SPDX-FileCopyrightText: 2025-2026 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#pragma once
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include "esp_blockdev.h"
#include "esp_err.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Create a memory-backed block device that wraps an existing buffer
*
* @param buffer Pointer to the storage backing the device
* @param buffer_size Size of the storage buffer in bytes
* @param geometry Desired geometry for the device; geometry->disk_size must not exceed buffer_size
* @param read_only Set true to disallow write/erase operations on the mapped memory
* @param out Output pointer that receives the created block device handle; unchanged on failure
*
* @return ESP_ERR_INVALID_ARG Invalid argument provided
* @return ESP_ERR_INVALID_SIZE Provided buffer or geometry is incompatible
* @return ESP_ERR_NO_MEM Memory allocation for device descriptor failed
* @return ESP_OK on success
*/
esp_err_t esp_blockdev_memory_get_from_buffer(uint8_t *buffer, size_t buffer_size, const esp_blockdev_geometry_t *geometry, bool read_only, esp_blockdev_handle_t *out);
/**
* @brief Create a memory-backed block device with internally allocated storage
*
* @param geometry Desired geometry for the device; geometry->disk_size determines the allocation size
* @param caps Heap capability flags passed to heap_caps_malloc
* @param out Output pointer that receives the created block device handle; unchanged on failure
*
* @return ESP_ERR_INVALID_ARG Invalid argument provided
* @return ESP_ERR_INVALID_SIZE Allocation size exceeds supported limits
* @return ESP_ERR_NO_MEM Memory allocation failed
* @return ESP_OK on success
*/
esp_err_t esp_blockdev_memory_create_with_heap_caps(const esp_blockdev_geometry_t *geometry, uint32_t caps, esp_blockdev_handle_t *out);
#ifdef __cplusplus
}
#endif