2021-08-04 04:47:56 -04:00
|
|
|
/*
|
2022-03-13 23:34:46 -04:00
|
|
|
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
|
2021-08-04 04:47:56 -04:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
|
|
|
// DO NOT USE THESE APIS IN YOUR APPLICATIONS
|
|
|
|
// The following APIs are for internal use, public to other IDF components, but not for users' applications.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "esp_err.h"
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
2021-08-18 07:45:51 -04:00
|
|
|
* @brief Hold the I2S port occupation
|
2021-08-04 04:47:56 -04:00
|
|
|
*
|
|
|
|
* @note This private API is used to avoid applications from using the same I2S instance for different purpose.
|
|
|
|
* @note This function will help enable the peripheral APB clock as well.
|
|
|
|
*
|
2021-08-18 07:45:51 -04:00
|
|
|
* @param id I2S port number
|
|
|
|
* @param comp_name The name of compnant that occupied this i2s controller
|
2021-08-04 04:47:56 -04:00
|
|
|
* @return
|
|
|
|
* - ESP_OK: The specific I2S port is free and register the new device object successfully
|
|
|
|
* - ESP_ERR_INVALID_ARG: Invalid argument, e.g. wrong port_id
|
2021-08-18 07:45:51 -04:00
|
|
|
* - ESP_ERR_NOT_FOUND Specific I2S port is not available
|
2021-08-04 04:47:56 -04:00
|
|
|
*/
|
2021-08-18 07:45:51 -04:00
|
|
|
esp_err_t i2s_platform_acquire_occupation(int id, const char *comp_name);
|
2021-08-04 04:47:56 -04:00
|
|
|
|
|
|
|
/**
|
2021-08-18 07:45:51 -04:00
|
|
|
* @brief Release the I2S port occupation
|
2021-08-04 04:47:56 -04:00
|
|
|
*
|
|
|
|
* @note This function will help disable the peripheral APB clock as well.
|
|
|
|
*
|
2021-08-18 07:45:51 -04:00
|
|
|
* @param id I2S port number
|
2021-08-04 04:47:56 -04:00
|
|
|
* @return
|
|
|
|
* - ESP_OK: Deregister I2S port successfully (i.e. that I2S port can used used by other users after this function returns)
|
|
|
|
* - ESP_ERR_INVALID_ARG: Invalid argument, e.g. wrong port_id
|
|
|
|
* - ESP_ERR_INVALID_STATE: Specific I2S port is free already
|
|
|
|
*/
|
2021-08-18 07:45:51 -04:00
|
|
|
esp_err_t i2s_platform_release_occupation(int id);
|
2021-08-04 04:47:56 -04:00
|
|
|
|
2022-04-07 03:32:46 -04:00
|
|
|
/**
|
|
|
|
* @brief This function is only used for getting DMA buffer offset in `test_i2s_iram.c`
|
|
|
|
*
|
|
|
|
* @return
|
|
|
|
* - The offset of DMA buffers in the `i2s_chan_handle_t` struct (unit: bytes)
|
|
|
|
*/
|
|
|
|
size_t i2s_platform_get_dma_buffer_offset(void);
|
|
|
|
|
2021-08-04 04:47:56 -04:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|