spi_flash_init.c 693 B

123456789101112131415161718192021222324252627282930
  1. /*
  2. * Copyright (c) 2006-2022, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2020-11-07 wanghaijing the first version
  9. */
  10. #include <rtthread.h>
  11. #include <rtdevice.h>
  12. #include <spi_flash.h>
  13. #include <drv_spi.h>
  14. static int rt_flash_init(void)
  15. {
  16. extern rt_spi_flash_device_t rt_sfud_flash_probe(const char *spi_flash_dev_name, const char *spi_dev_name);
  17. extern int fal_init(void);
  18. rt_hw_spi_device_attach("spi1", "spi10", GPIOA, GPIO_PIN_4);
  19. /* initialize SPI Flash device */
  20. rt_sfud_flash_probe("norflash0", "spi10");
  21. fal_init();
  22. return 0;
  23. }
  24. INIT_ENV_EXPORT(rt_flash_init);