fs_manager.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /*
  2. * Copyright (c) 2018 Actions Semiconductor Co., Ltd
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. /**
  7. * @file fs manager interface
  8. */
  9. #ifndef __FS_MANGER_H__
  10. #define __FS_MANGER_H__
  11. #ifdef CONFIG_FILE_SYSTEM
  12. #include <ff.h>
  13. #include <fs/fs.h>
  14. #include <diskio.h>
  15. #include <disk/disk_access.h>
  16. #endif
  17. /**
  18. * @defgroup fs_manager_apis App FS Manager APIs
  19. * @ingroup system_apis
  20. * @{
  21. */
  22. /** disk type */
  23. enum{
  24. /** disk type of nor */
  25. DISK_NOR,
  26. /** disk type of nand */
  27. DISK_NAND,
  28. /** disk type of psram */
  29. DISK_PSRAM,
  30. /** disk type of usb card read */
  31. DISK_USB,
  32. /** disk type of sdcard */
  33. DISK_SD_CARD,
  34. /** max number of disk*/
  35. DISK_MAX_NUM,
  36. };
  37. /**
  38. * @brief init disk of volume_name
  39. *
  40. * @param volume_name disk volume name
  41. * @return 0 if successful, others if failed
  42. */
  43. int fs_manager_disk_init(const uint8_t *volume_name);
  44. /**
  45. * @brief uninit disk of volume_name
  46. *
  47. * @param volume_name disk volume name
  48. * @return 0 if successful, others if failed
  49. */
  50. int fs_manager_disk_uninit(const uint8_t *volume_name);
  51. /**
  52. * @brief Obtaining the residual capacity of the card
  53. *
  54. * @param volume_name disk volume name
  55. * @return free capacity of card ,in units of MByte
  56. * @return 0 if no card detected or no free capacity of card
  57. */
  58. int fs_manager_get_free_capacity(const uint8_t *volume_name);
  59. /**
  60. * @brief Obtaining the total capacity of the card
  61. * @details if volume not mount ,return 0 , otherwise return
  62. * the total capacity of target volume.
  63. * @param volume_name disk volume name
  64. * @return total capacity of card ,in units of MByte
  65. * @return 0 if no card detected
  66. */
  67. int fs_manager_get_total_capacity(const uint8_t *volume_name);
  68. /**
  69. * @brief Obtaining the volume state of the card
  70. *
  71. * @details if volume not mount ,return 0 , otherwise return 1
  72. * @param volume_name disk volume name
  73. *
  74. * @return 1 volume mounted
  75. * @return 0 volume not mounted
  76. */
  77. int fs_manager_get_volume_state(const uint8_t *volume_name);
  78. /**
  79. * @brief fs manager init function
  80. *
  81. * @return 0 int success others failed
  82. */
  83. int fs_manager_init(void);
  84. /**
  85. * @brief little fs manager init function
  86. *
  87. * @return 0 int success others failed
  88. */
  89. int littlefs_manager_init(void);
  90. /**
  91. * @} end defgroup fs_manager_apis
  92. */
  93. int fs_manager_sdcard_exit_high_speed(void);
  94. int fs_manager_sdcard_enter_high_speed(void);
  95. #endif