ql_boot_spi4_exnsffs_cfg.c 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /**
  2. @file
  3. ql_boot_spi4_exnsffs_cfg.c
  4. @brief
  5. quectel boot spi4 ext nor flash init param configuration .
  6. */
  7. /*================================================================
  8. Copyright (c) 2020 Quectel Wireless Solution, Co., Ltd. All Rights Reserved.
  9. Quectel Wireless Solution Proprietary and Confidential.
  10. =================================================================*/
  11. /*=================================================================
  12. EDIT HISTORY FOR MODULE
  13. This section contains comments describing changes made to the module.
  14. Notice that changes are listed in reverse chronological order.
  15. WHEN WHO WHAT, WHERE, WHY
  16. ------------ ------- -------------------------------------------------------------------------------
  17. =================================================================*/
  18. #include <stdio.h>
  19. #include <string.h>
  20. #include <stdlib.h>
  21. #include "quec_boot_spi.h"
  22. #include "osi_log.h"
  23. #include "drv_names.h"
  24. /*===========================================================================
  25. * Macro Definition
  26. ===========================================================================*/
  27. //the SPI port currently used in boot,it can be configured in quec_boot_pin_cfg.h
  28. extern uint8_t ql_boot_cur_spi4_port;
  29. extern void quec_boot_spi4_extnsffs_set_port(uint8_t spi_port);
  30. /*========================================================================
  31. * function Definition
  32. *========================================================================*/
  33. void ql_boot_spi4_nor_flash_init(void)
  34. {
  35. //Initialize pin to SPI function
  36. quec_boot_spi_pin_init(ql_boot_cur_spi4_port);
  37. //Configure nor Flash initialization parameters
  38. ql_boot_spi_flash_config_s flash_config = {0};
  39. flash_config.port = ql_boot_cur_spi4_port;
  40. flash_config.spiclk = QL_BOOT_SPI_CLK_25MHZ;
  41. flash_config.input_sel = QL_BOOT_SPI_DI_1;
  42. flash_config.transmode = QL_BOOT_SPI_DIRECT_POLLING;//BOOT中不支持DMA模式
  43. flash_config.cs = QL_BOOT_SPI_CS0;
  44. //使用GPIO的方式来控制SPI CS引脚。注意,CS引脚需要配置为GPIO功能
  45. //flash_config.cs = QL_BOOT_SPI_GPIO;
  46. //flash_config.cs_gpio = 10;
  47. ql_boot_spi_flash_init_ext(flash_config);
  48. //Sets the SPI port currently used by NOR Flash
  49. quec_boot_spi4_extnsffs_set_port(ql_boot_cur_spi4_port);
  50. //OSI_LOGI(0, "ql_boot_spi4_nor_flash_init");
  51. }