ql_api_spi_flash.h 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /** @file
  2. ql_api_spi_flash.h
  3. @brief
  4. This file is used to define bt api for different Quectel Project.
  5. */
  6. /*================================================================
  7. Copyright (c) 2020 Quectel Wireless Solution, Co., Ltd. All Rights Reserved.
  8. Quectel Wireless Solution Proprietary and Confidential.
  9. =================================================================*/
  10. /*=================================================================
  11. EDIT HISTORY FOR MODULE
  12. This section contains comments describing changes made to the module.
  13. Notice that changes are listed in reverse chronological order.
  14. WHEN WHO WHAT, WHERE, WHY
  15. ------------ ------- -------------------------------------------------------------------------------
  16. =================================================================*/
  17. #ifndef QL_API_SPI_FLASH_H
  18. #define QL_API_SPI_FLASH_H
  19. #include "ql_api_common.h"
  20. #include "ql_api_spi.h"
  21. #include "ql_gpio.h"
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. /*========================================================================
  26. * Variable Definition
  27. *========================================================================*/
  28. /**************************** error code about ql spi flash ***************************/
  29. typedef enum
  30. {
  31. QL_SPI_FLASH_SUCCESS = 0,
  32. //is the same with nomal spi
  33. QL_SPI_FLASH_ERROR = 1 | (QL_COMPONENT_STORAGE_EXTFLASH << 16), //SPI总线其他错误
  34. QL_SPI_FLASH_PARAM_TYPE_ERROR, //参数类型错误
  35. QL_SPI_FLASH_PARAM_DATA_ERROR, //参数数据错误
  36. QL_SPI_FLASH_PARAM_ACQUIRE_ERROR, //参数无法获取
  37. QL_SPI_FLASH_PARAM_NULL_ERROR, //参数NULL错误
  38. QL_SPI_FLASH_DEV_NOT_ACQUIRE_ERROR, //无法获取SPI总线
  39. QL_SPI_FLASH_PARAM_LENGTH_ERROR, //参数长度错误
  40. QL_SPI_FLASH_MALLOC_MEM_ERROR, //申请内存错误
  41. QL_SPI_FLASH_ALIGNED_ERROR, //地址不是4字节对齐
  42. QL_SPI_FLASH_NOT_FLASH_CONN_ERROR, //没有接入FLASH芯片
  43. QL_SPI_FLASH_NOT_SUPPORT_ERROR, //FLASH型号不支持
  44. QL_SPI_FLASH_OP_NOT_SUPPORT_ERROR, //FLASH型号不支持此操作
  45. QL_SPI_FLASH_ECC_ERROR, //nand flash ecc error
  46. QL_SPI_FLASH_PROGRAM_ERROR, //flash program error
  47. QL_SPI_FLASH_ERASE_ERROR, //flash erase error
  48. QL_SPI_FLASH_MUTEX_CREATE_ERROR, //互斥锁创建失败报错
  49. QL_SPI_FLASH_MUTEX_LOCK_ERROR, //互斥锁上锁报错
  50. QL_SPI_FLASH_SET_GPIO_ERROR, //设置GPIO出错
  51. }ql_errcode_spi_flash_e;
  52. typedef struct
  53. {
  54. ql_spi_port_e port; //SPI总线选择
  55. ql_spi_clk_e spiclk; //SPI时钟配置
  56. ql_spi_input_sel_e input_sel; //SPI输入引脚选择
  57. ql_spi_transfer_mode_e transmode; //SPI工作模式,目前仅支持QL_SPI_DIRECT_POLLING和QL_SPI_DMA_POLLING
  58. ql_spi_cs_sel_e cs; //SPI片选CS引脚选择
  59. ql_GpioNum cs_gpio; //SPI片选CS使用的GPIO引脚
  60. ql_spi_release_e release_flag; //使用完SPI总线,是否需要释放总线
  61. } ql_spi_flash_config_s;
  62. /*========================================================================
  63. * function Definition
  64. *========================================================================*/
  65. #ifdef __cplusplus
  66. } /*"C" */
  67. #endif
  68. #endif /* QL_API_SPI_FLASH_H */