spi_flash_sfud.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * File : spi_flash_sfud.h
  3. * This file is part of RT-Thread RTOS
  4. * COPYRIGHT (C) 2006 - 2016, RT-Thread Development Team
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License along
  17. * with this program; if not, write to the Free Software Foundation, Inc.,
  18. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  19. *
  20. * Change Logs:
  21. * Date Author Notes
  22. * 2016-09-28 armink first version.
  23. */
  24. #ifndef _SPI_FLASH_SFUD_H_
  25. #define _SPI_FLASH_SFUD_H_
  26. #include <rtthread.h>
  27. #include "./sfud/inc/sfud.h"
  28. #include "spi_flash.h"
  29. /**
  30. * Probe SPI flash by SFUD(Serial Flash Universal Driver) driver library and though SPI device.
  31. *
  32. * @param spi_flash_dev_name the name which will create SPI flash device
  33. * @param spi_dev_name using SPI device name
  34. *
  35. * @return probed SPI flash device, probe failed will return RT_NULL
  36. */
  37. rt_spi_flash_device_t rt_sfud_flash_probe(const char *spi_flash_dev_name, const char *spi_dev_name);
  38. /**
  39. * Delete SPI flash device
  40. *
  41. * @param spi_flash_dev SPI flash device
  42. *
  43. * @return the operation status, RT_EOK on successful
  44. */
  45. rt_err_t rt_sfud_flash_delete(rt_spi_flash_device_t spi_flash_dev);
  46. /**
  47. * Find sfud flash device
  48. *
  49. * @param spi_dev_name using SPI device name
  50. *
  51. * @return sfud flash device if success, otherwise return RT_NULL
  52. */
  53. sfud_flash_t rt_sfud_flash_find(const char *spi_dev_name);
  54. #endif /* _SPI_FLASH_SFUD_H_ */