ql_ext_nor_flash.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /** @file
  2. ql_ext_nor_flash.h
  3. @brief
  4. This file is used to define spi6 ext_nor flash interface for different Quectel Project.
  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. =================================================================*/
  17. /*=================================================================
  18. READ ME
  19. API能够直接读写位于[0x70000000~(0x70000000+FLASH大小)]中用户新增的自定义flash分区,
  20. 并判断读写地址的合法性,请确保读写区域在分区文件中已经被预留并定义,否则将返回失败
  21. 定义预留的flash分区时,分区的地址和大小必须为4K对齐。
  22. 用户需在 components\ql-config\build\EXX00GXX_XX\8850XX_cat1_open\target.config
  23. 文件中添加 CONFIG_QUEC_PROJECT_FEATURE_EXT_NOR_SFFS_MOUNT=n 启用此功能
  24. 其中EXX00GXX_XX指代用户需要的实际型号
  25. =================================================================*/
  26. #ifndef QL_EXT_NOR_FLASH_H
  27. #define QL_EXT_NOR_FLASH_H
  28. #include "ql_api_common.h"
  29. #include <stdlib.h>
  30. #include "drv_names.h"
  31. #include "ql_spi6_nor_flash.h"
  32. #ifdef __cplusplus
  33. extern "C" {
  34. #endif
  35. typedef ql_spi6_nor_flash_e ql_ext_nor_flash_e;
  36. /*****************************************************************
  37. * Function: ql_ext_nor_flash_write
  38. * Description: ext nor flash write data
  39. * This will just use flash PROGRAM command to write. Caller should ensure
  40. * the write sector or block is erased before. Otherwise, the data on
  41. * flash may be different from the input data.
  42. * Parameters:
  43. * write_addr [in] write address
  44. * data [in] write data
  45. * size [in] the size of write data
  46. *
  47. * Return:
  48. * success:QL_EXT_NOR_FLASH_SUCCESS
  49. * failed: OTHER
  50. *****************************************************************/
  51. //ql_ext_nor_flash_e ql_ext_nor_flash_write(uint32 write_addr,void *data,size_t size);
  52. #define ql_ext_nor_flash_write(write_addr,data,size) ql_spi6_nor_flash_write(DRV_NAME_SPI_FLASH_EXT, write_addr, data, size);
  53. /*****************************************************************
  54. * Function: ql_embed_nor_flash_read
  55. * Description: embed nor flash read data
  56. * Parameters:
  57. * read_addr [in] read address
  58. * data [in] read data
  59. * size [in] the size of read data
  60. *
  61. * Return:
  62. * success:QL_EXT_NOR_FLASH_SUCCESS
  63. * failed: OTHER
  64. *****************************************************************/
  65. //ql_ext_nor_flash_e ql_ext_nor_flash_read(uint32 read_addr,void *data,size_t size);
  66. #define ql_ext_nor_flash_read(read_addr,data,size) ql_spi6_nor_flash_read(DRV_NAME_SPI_FLASH_EXT, read_addr, data, size);
  67. /*****************************************************************
  68. * Function: ql_ext_nor_flash_erase
  69. *
  70. * Description: erase embed nor flash,
  71. * Both erase_addr and size must be sector (4KB) aligned.
  72. * Parameters:
  73. * erase_addr [in] erase address
  74. * size [in] the size of erase
  75. *
  76. * Return:
  77. * success:QL_EXT_NOR_FLASH_SUCCESS
  78. * failed: OTHER
  79. *****************************************************************/
  80. //ql_ext_nor_flash_e ql_ext_nor_flash_erase(uint32 erase_addr,size_t size);
  81. #define ql_ext_nor_flash_erase(erase_addr,size) ql_spi6_nor_flash_erase(DRV_NAME_SPI_FLASH_EXT, erase_addr, size);
  82. #ifdef __cplusplus
  83. } /*"C" */
  84. #endif
  85. #endif