dev_spi_flash.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * Copyright (c) 2006-2025 RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2016/5/20 bernard the first version
  9. * 2020/1/7 redoc add include
  10. * 2025-10-30 wdfk-prog enable interrupt-safe operations using spinlocks
  11. */
  12. #ifndef __DEV_SPI_FLASH_H__
  13. #define __DEV_SPI_FLASH_H__
  14. #include <rtdevice.h>
  15. struct spi_flash_device
  16. {
  17. struct rt_device flash_device;
  18. struct rt_device_blk_geometry geometry;
  19. struct rt_spi_device * rt_spi_device;
  20. struct rt_mutex lock;
  21. #ifdef RT_USING_SPI_ISR
  22. rt_base_t _isr_lvl;
  23. struct rt_spinlock _spinlock;
  24. #endif /* RT_USING_SPI_ISR */
  25. void * user_data;
  26. };
  27. typedef struct spi_flash_device *rt_spi_flash_device_t;
  28. #ifdef RT_USING_MTD_NOR
  29. struct spi_flash_mtd
  30. {
  31. struct rt_mtd_nor_device mtd_device;
  32. struct rt_spi_device * rt_spi_device;
  33. struct rt_mutex lock;
  34. void * user_data;
  35. };
  36. #endif
  37. #endif