mtd_nor_partition.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. /**
  2. ******************************************************************************
  3. * @file spi_flash_mtd_partition.h
  4. * @author Urey
  5. * @version V1.0.0
  6. * @date 2017Äê2ÔÂ11ÈÕ
  7. * @brief TODO
  8. ******************************************************************************
  9. **/
  10. #ifndef _SPI_FLASH_MTD_PARTITION_H_
  11. #define _SPI_FLASH_MTD_PARTITION_H_
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif
  15. #include <drivers/mtd_nor.h>
  16. #define PART_FLAG_RDONLY 0x0001
  17. #define PART_FLAG_WRONLY 0x0002
  18. #define PART_FLAG_RDWR 0x0003
  19. #define PART_TYPE_BLK 0x0010
  20. #define PART_TYPE_MTD 0x0020
  21. struct rt_mtd_nor_partition
  22. {
  23. union
  24. {
  25. struct rt_mtd_nor_device mtd;
  26. struct rt_device blk;
  27. };
  28. const char *name;
  29. rt_uint32_t offset; /* offset within the master MTD space */
  30. rt_uint32_t size; /* partition size */
  31. rt_uint32_t mask_flags; /* master MTD flags to mask out for this partition */
  32. void* user_data; /* hold parent device */
  33. };
  34. /*
  35. * functions
  36. */
  37. extern rt_err_t mtd_nor_init_partition(const char *mtd_name,struct rt_mtd_nor_partition *parts);
  38. #ifdef __cplusplus
  39. }
  40. #endif
  41. #endif /* _SPI_FLASH_MTD_PARTITION_H_ */