i2s_platform.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. // DO NOT USE THESE APIS IN YOUR APPLICATIONS
  7. // The following APIs are for internal use, public to other IDF components, but not for users' applications.
  8. #pragma once
  9. #include "esp_err.h"
  10. #ifdef __cplusplus
  11. extern "C" {
  12. #endif
  13. /**
  14. * @brief Register an I2S or I2S variant driver object to platform
  15. *
  16. * @note This private API is used to avoid applications from using the same I2S instance for different purpose.
  17. * @note This function will help enable the peripheral APB clock as well.
  18. *
  19. * @param driver_obj Driver object
  20. * @param port_id I2S port number
  21. * @return
  22. * - ESP_OK: The specific I2S port is free and register the new device object successfully
  23. * - ESP_ERR_INVALID_ARG: Invalid argument, e.g. wrong port_id
  24. * - ESP_ERR_NOT_FOUND: Specific I2S port is not available
  25. */
  26. esp_err_t i2s_priv_register_object(void *driver_obj, int port_id);
  27. /**
  28. * @brief Deregister I2S or I2S variant driver object from platform
  29. *
  30. * @note This function will help disable the peripheral APB clock as well.
  31. *
  32. * @param port_id I2S port number
  33. * @return
  34. * - ESP_OK: Deregister I2S port successfully (i.e. that I2S port can used used by other users after this function returns)
  35. * - ESP_ERR_INVALID_ARG: Invalid argument, e.g. wrong port_id
  36. * - ESP_ERR_INVALID_STATE: Specific I2S port is free already
  37. */
  38. esp_err_t i2s_priv_deregister_object(int port_id);
  39. #ifdef __cplusplus
  40. }
  41. #endif