1 /* 2 * SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 // DO NOT USE THESE APIS IN YOUR APPLICATIONS 8 // The following APIs are for internal use, public to other IDF components, but not for users' applications. 9 10 #pragma once 11 12 #include "esp_err.h" 13 14 #ifdef __cplusplus 15 extern "C" { 16 #endif 17 18 /** 19 * @brief Hold the I2S port occupation 20 * 21 * @note This private API is used to avoid applications from using the same I2S instance for different purpose. 22 * @note This function will help enable the peripheral APB clock as well. 23 * 24 * @param id I2S port number 25 * @param comp_name The name of compnant that occupied this i2s controller 26 * @return 27 * - ESP_OK: The specific I2S port is free and register the new device object successfully 28 * - ESP_ERR_INVALID_ARG: Invalid argument, e.g. wrong port_id 29 * - ESP_ERR_NOT_FOUND Specific I2S port is not available 30 */ 31 esp_err_t i2s_platform_acquire_occupation(int id, const char *comp_name); 32 33 /** 34 * @brief Release the I2S port occupation 35 * 36 * @note This function will help disable the peripheral APB clock as well. 37 * 38 * @param id I2S port number 39 * @return 40 * - ESP_OK: Deregister I2S port successfully (i.e. that I2S port can used used by other users after this function returns) 41 * - ESP_ERR_INVALID_ARG: Invalid argument, e.g. wrong port_id 42 * - ESP_ERR_INVALID_STATE: Specific I2S port is free already 43 */ 44 esp_err_t i2s_platform_release_occupation(int id); 45 46 /** 47 * @brief This function is only used for getting DMA buffer offset in `test_i2s_iram.c` 48 * 49 * @return 50 * - The offset of DMA buffers in the `i2s_chan_handle_t` struct (unit: bytes) 51 */ 52 size_t i2s_platform_get_dma_buffer_offset(void); 53 54 #ifdef __cplusplus 55 } 56 #endif 57