spi_flash_chip_drivers.c 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // Copyright 2015-2019 Espressif Systems (Shanghai) PTE LTD
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #include <stdlib.h>
  15. #include "spi_flash_chip_driver.h"
  16. #include "spi_flash_chip_generic.h"
  17. #include "spi_flash_chip_issi.h"
  18. #include "spi_flash_chip_mxic.h"
  19. #include "spi_flash_chip_gd.h"
  20. #include "spi_flash_chip_winbond.h"
  21. #include "spi_flash_chip_boya.h"
  22. #include "sdkconfig.h"
  23. /*
  24. * Default registered chip drivers. Note these are tested in order and first
  25. * match is taken, so generic/catchall entries should go last. Note that the
  26. * esp_flash_registered_flash_ops pointer can be changed to point to a different
  27. * array of registered ops, if desired.
  28. *
  29. * It can be configured to support only available chips in the sdkconfig, to
  30. * avoid possible issues, and speed up the auto-detecting.
  31. */
  32. static const spi_flash_chip_t *default_registered_chips[] = {
  33. #ifdef CONFIG_SPI_FLASH_SUPPORT_ISSI_CHIP
  34. &esp_flash_chip_issi,
  35. #endif
  36. #ifdef CONFIG_SPI_FLASH_SUPPORT_GD_CHIP
  37. &esp_flash_chip_gd,
  38. #endif
  39. #ifdef CONFIG_SPI_FLASH_SUPPORT_MXIC_CHIP
  40. &esp_flash_chip_mxic,
  41. #endif
  42. #ifdef CONFIG_SPI_FLASH_SUPPORT_WINBOND_CHIP
  43. &esp_flash_chip_winbond,
  44. #endif
  45. #ifdef CONFIG_SPI_FLASH_SUPPORT_BOYA_CHIP
  46. &esp_flash_chip_boya,
  47. #endif
  48. // Default chip drivers that will accept all chip ID.
  49. // FM, Winbond and XMC chips are supposed to be supported by this chip driver.
  50. &esp_flash_chip_generic,
  51. NULL,
  52. };
  53. const spi_flash_chip_t **esp_flash_registered_chips = default_registered_chips;