quec_spi6_ext_norflash_cfg.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. /*================================================================
  2. Copyright (c) 2021, Quectel Wireless Solutions Co., Ltd. All rights reserved.
  3. Quectel Wireless Solutions Proprietary and Confidential.
  4. =================================================================*/
  5. /*=================================================================
  6. EDIT HISTORY FOR MODULE
  7. This section contains comments describing changes made to the module.
  8. Notice that changes are listed in reverse chronological order.
  9. WHEN WHO WHAT, WHERE, WHY
  10. ------------ ------- -------------------------------------------------------------------------------
  11. =================================================================*/
  12. #ifndef QUEC_SPI6_EXT_NORFLASH_CFG_H
  13. #define QUEC_SPI6_EXT_NORFLASH_CFG_H
  14. #include "quec_proj_config.h"
  15. #ifdef CONFIG_QUEC_PROJECT_FEATURE_SPI6_EXT_NOR
  16. #include "hal_config.h"
  17. #include <stdint.h>
  18. #include <stdbool.h>
  19. #include "osi_compiler.h"
  20. #include <sys/queue.h>
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24. /*===========================================================================
  25. * Macro Definition
  26. ===========================================================================*/
  27. #define MOUNT_ONLY (0)
  28. #define MOUNT_FORMAT_ON_FAIL (1)
  29. #define MOUNT_FORCE_FORMAT (2)
  30. #define HEADER_MAGIC OSI_MAKE_TAG('P', 'R', 'T', 'I')
  31. #define TYPE_FBDEV2 OSI_MAKE_TAG('F', 'B', 'D', '2')
  32. #define TYPE_SUBPART OSI_MAKE_TAG('B', 'P', 'R', 'T')
  33. #define TYPE_SFFS OSI_MAKE_TAG('S', 'F', 'F', 'S')
  34. #define NAME_FEXT OSI_MAKE_TAG('F', 'E', 'X', 'T')
  35. /*========================================================================
  36. * Enumeration Definition
  37. *========================================================================*/
  38. /*===========================================================================
  39. * Struct
  40. ===========================================================================*/
  41. typedef struct
  42. {
  43. uint32_t magic;
  44. uint32_t crc;
  45. uint32_t size;
  46. uint32_t version;
  47. } descHeader_t;
  48. typedef struct
  49. {
  50. uint32_t type;
  51. uint32_t flash;
  52. uint32_t name;
  53. uint32_t offset;
  54. uint32_t size;
  55. uint32_t eb_size;
  56. uint32_t pb_size;
  57. uint32_t flags;
  58. } descFbdev_t;
  59. typedef struct
  60. {
  61. uint32_t type;
  62. uint32_t device;
  63. uint32_t name;
  64. uint32_t offset;
  65. uint32_t count;
  66. uint32_t flags;
  67. } descSubpart_t;
  68. typedef struct
  69. {
  70. uint32_t type;
  71. uint32_t device;
  72. char mount[64];
  73. uint32_t reserve_block;
  74. uint32_t flags;
  75. } descSffs_t;
  76. /*===========================================================================
  77. * Extern
  78. ===========================================================================*/
  79. //
  80. int quec_spi6_ext_nor_flash_capacity;
  81. /*===========================================================================
  82. * Functions declaration
  83. ===========================================================================*/
  84. void ql_set_spi6_ext_nor_flash_status(bool onff);
  85. bool ql_get_spi6_ext_nor_status(void);
  86. void quec_set_spi6_ext_nor_flash_capacity(void);
  87. int quec_spi6_ext_nor_flash_mount(bool format_on_fail);
  88. int quec_spi6_ext_nor_flash_unmount(void);
  89. void quec_boot_get_spi6_ext_norflash_gpio_default_fuction(void);
  90. void quec_boot_spi6_ext_norflash_gpio_deinit(void);
  91. void quec_boot_spi6_ext_norflash_gpio_init(void);
  92. int quec_spi6_ext_nor_flash_mkfs(void);
  93. void quec_boot_spi6_ext_norflash_init(void);
  94. #ifdef __cplusplus
  95. } /*"C" */
  96. #endif
  97. #endif/* CONFIG_QUEC_PROJECT_FEATURE_SPI6_EXT_NOR */
  98. #endif /* QUEC_SPI6_EXT_NOR_FLASH_CFG_H */