quec_spi_nand_flash_prop.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /** @file
  2. quec_spi_nand_flash_prop.h
  3. @brief
  4. This file is used to define spi NAND FLASH property for open 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. #include <stdio.h>
  18. #include <string.h>
  19. #include <stdlib.h>
  20. #include "ql_osi_def.h"
  21. #include "ql_api_osi.h"
  22. typedef enum
  23. {
  24. QUEC_NAND_FLASH_ID_16BIT = 0, //Manufacturer ID(8bit) + device ID(8bit)
  25. QUEC_NAND_FLASH_ID_24BIT, //Manufacturer ID(8bit) + device ID(16bit)
  26. }quec_spi_nand_flash_id_type_e;
  27. typedef struct
  28. {
  29. unsigned short page_spare_shift; //the offset of the spare area in page,bad block:2byte
  30. unsigned short block_postion_shift; //offset in page,1byte
  31. unsigned short block_type_shift; //offset in page,1byte
  32. unsigned short logic_addr_shift; //offset in page,4byte
  33. unsigned short page_used_shift; //offset in page,1byte
  34. unsigned short page_garbage_shift; //offset in page,1byte
  35. unsigned short page_num_shift; //offset in page,2byte
  36. }quec_spi_nand_spare_info_s;
  37. typedef struct
  38. {
  39. unsigned int page_totalsize; //each page bytes(main area + spare area),Internal ECC On
  40. unsigned int page_mainsize; //main area of the page
  41. unsigned int page_sparesize; //spare area of the page,Internal ECC On & user area
  42. unsigned int block_pagenum; //pages num in each block,Maximum 64
  43. //unsigned int plane_blocknum; //blocks num in each plane
  44. unsigned int block_totalnum; //blocks num in each device
  45. unsigned int cache_blocknum; //cache blocks num,the current value is fixed at 5 and cannot be changed
  46. quec_spi_nand_spare_info_s spare_info; //spare area data division
  47. unsigned int nand_id; //nand id(9FH),=MID + DID2(MSB 8BIT), not contain low 8bits(DID1(LSB 8BIT))
  48. quec_spi_nand_flash_id_type_e nand_id_type; //nand id type
  49. }quec_spi_nand_flash_info_s;