spi_flash_chip_drivers.c 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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 "sdkconfig.h"
  21. /*
  22. * Default registered chip drivers. Note these are tested in order and first
  23. * match is taken, so generic/catchall entries should go last. Note that the
  24. * esp_flash_registered_flash_ops pointer can be changed to point to a different
  25. * array of registered ops, if desired.
  26. *
  27. * It can be configured to support only available chips in the sdkconfig, to
  28. * avoid possible issues, and speed up the auto-detecting.
  29. */
  30. static const spi_flash_chip_t *default_registered_chips[] = {
  31. #ifdef CONFIG_SPI_FLASH_SUPPORT_ISSI_CHIP
  32. &esp_flash_chip_issi,
  33. #endif
  34. #ifdef CONFIG_SPI_FLASH_SUPPORT_GD_CHIP
  35. &esp_flash_chip_gd,
  36. #endif
  37. #ifdef CONFIG_SPI_FLASH_SUPPORT_MXIC_CHIP
  38. &esp_flash_chip_mxic,
  39. #endif
  40. // Default chip drivers that will accept all chip ID.
  41. // FM, Winbond and XMC chips are supposed to be supported by this chip driver.
  42. &esp_flash_chip_generic,
  43. NULL,
  44. };
  45. const spi_flash_chip_t **esp_flash_registered_chips = default_registered_chips;