i2s_platform.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * SPDX-FileCopyrightText: 2021-2022 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 Hold the I2S port occupation
  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 id I2S port number
  20. * @param comp_name The name of compnant that occupied this i2s controller
  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_platform_acquire_occupation(int id, const char *comp_name);
  27. /**
  28. * @brief Release the I2S port occupation
  29. *
  30. * @note This function will help disable the peripheral APB clock as well.
  31. *
  32. * @param 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_platform_release_occupation(int id);
  39. /**
  40. * @brief This function is only used for getting DMA buffer offset in `test_i2s_iram.c`
  41. *
  42. * @return
  43. * - The offset of DMA buffers in the `i2s_chan_handle_t` struct (unit: bytes)
  44. */
  45. size_t i2s_platform_get_dma_buffer_offset(void);
  46. #ifdef __cplusplus
  47. }
  48. #endif