spiffs_api.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // Copyright 2015-2017 Espressif Systems (Shanghai) PTE LTD
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #pragma once
  15. #include <stdint.h>
  16. #include <stddef.h>
  17. #include "freertos/FreeRTOS.h"
  18. #include "freertos/task.h"
  19. #include "freertos/semphr.h"
  20. #include "spiffs.h"
  21. #include "esp_vfs.h"
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. /**
  26. * @brief SPIFFS definition structure
  27. */
  28. typedef struct {
  29. spiffs *fs; /*!< Handle to the underlying SPIFFS */
  30. SemaphoreHandle_t lock; /*!< FS lock */
  31. const esp_partition_t* partition; /*!< The partition on which SPIFFS is located */
  32. char base_path[ESP_VFS_PATH_MAX+1]; /*!< Mount point */
  33. bool by_label; /*!< Partition was mounted by label */
  34. spiffs_config cfg; /*!< SPIFFS Mount configuration */
  35. uint8_t *work; /*!< Work Buffer */
  36. uint8_t *fds; /*!< File Descriptor Buffer */
  37. uint32_t fds_sz; /*!< File Descriptor Buffer Length */
  38. uint8_t *cache; /*!< Cache Buffer */
  39. uint32_t cache_sz; /*!< Cache Buffer Length */
  40. } esp_spiffs_t;
  41. s32_t spiffs_api_read(spiffs *fs, uint32_t addr, uint32_t size, uint8_t *dst);
  42. s32_t spiffs_api_write(spiffs *fs, uint32_t addr, uint32_t size, uint8_t *src);
  43. s32_t spiffs_api_erase(spiffs *fs, uint32_t addr, uint32_t size);
  44. void spiffs_api_check(spiffs *fs, spiffs_check_type type,
  45. spiffs_check_report report, uint32_t arg1, uint32_t arg2);
  46. #ifdef __cplusplus
  47. }
  48. #endif