ql_api_fs_nand_flash.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /** @file
  2. ql_api_fs_nand_flash.h
  3. @brief
  4. quectel fs nand flash info interface definition.
  5. */
  6. /*================================================================
  7. Copyright (c) 2020 Quectel Wireless Solution, Co., Ltd. All Rights Reserved.
  8. Quectel Wireless Solution Proprietary and Confidential.
  9. =================================================================*/
  10. /*=================================================================
  11. EDIT HISTORY FOR MODULE
  12. This section contains comments describing changes made to the module.
  13. Notice that changes are listed in reverse chronological order.
  14. WHEN WHO WHAT, WHERE, WHY
  15. ------------ ------- -------------------------------------------------------------------------------
  16. 24/5/2021 Neo Init version
  17. =================================================================*/
  18. #ifndef QL_API_FS_NAND_FLASH_H
  19. #define QL_API_FS_NAND_FLASH_H
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23. #include "ql_api_common.h"
  24. /*===========================================================================
  25. * Macro Definition
  26. ===========================================================================*/
  27. #define QL_NAND_FLASH_ERRCODE_BASE (QL_COMPONENT_STORAGE_EXT_NANDFLASH<<16)
  28. /*========================================================================
  29. * Enumeration Definition
  30. *========================================================================*/
  31. typedef enum
  32. {
  33. QL_NAND_FLASH_SUCCESS = QL_SUCCESS,
  34. QL_NAND_FLASH_INVALID_PARAM_ERR = 1|QL_NAND_FLASH_ERRCODE_BASE,
  35. QL_NAND_FLASH_MOUNT_ERR,
  36. QL_NAND_FLASH_MKFS_ERR,
  37. QL_NAND_FLASH_NOT_MOUNT,
  38. QL_NAND_FLASH_MUTEX_CREATE_ERR,
  39. QL_NAND_FLASH_MUTEX_LOCK_ERR,
  40. } ql_errcode_nand_flash_e;
  41. typedef struct
  42. {
  43. uint32_t mid; //Manufacturer ID
  44. uint32_t blknum; //block count
  45. uint32_t blksize; //block size
  46. } ql_nand_hw_info_t;
  47. /*===========================================================================
  48. * Functions declaration
  49. ===========================================================================*/
  50. /*****************************************************************
  51. * Function: ql_nand_flash_mkfs
  52. *
  53. * Description: format nand flash in FM_FAT32
  54. *
  55. * Parameters:
  56. * opt [in] FM_FAT32(0x02)
  57. *
  58. * Return:
  59. * QL_NAND_FLASH_SUCCESS success
  60. * other error code
  61. *
  62. *****************************************************************/
  63. ql_errcode_nand_flash_e ql_nand_flash_mkfs(uint8_t opt);
  64. /*****************************************************************
  65. * Function: ql_nand_flash_umount
  66. *
  67. * Description: Uninitialize the nand flash driver, umount nand flash
  68. *
  69. * Parameters:
  70. * NULL
  71. *
  72. * Return:
  73. * QL_NAND_FLASH_SUCCESS success
  74. * other error code
  75. *
  76. *****************************************************************/
  77. ql_errcode_nand_flash_e ql_nand_flash_umount(void);
  78. /*****************************************************************
  79. * Function: ql_sdmmc_mount
  80. *
  81. * Description: Initialize the nand flash driver,and mount nand flash
  82. *
  83. * Parameters:
  84. * NULL
  85. *
  86. * Return:
  87. * QL_NAND_FLASH_SUCCESS success
  88. * other error code
  89. *
  90. *****************************************************************/
  91. ql_errcode_nand_flash_e ql_nand_flash_mount(void);
  92. /*****************************************************************
  93. * Function: ql_nand_get_hw_info
  94. *
  95. * Description: get information about nand
  96. *
  97. * Parameters:
  98. * info [out] Pointer to info data to read
  99. *
  100. * Return:
  101. * QL_NAND_FLASH_SUCCESS success
  102. * other error code
  103. *
  104. *****************************************************************/
  105. ql_errcode_nand_flash_e ql_nand_get_hw_info(ql_nand_hw_info_t *info);
  106. #ifdef __cplusplus
  107. } /*"C" */
  108. #endif
  109. #endif /* QL_API_FS_NAND_FLASH_H */