]> granicus.if.org Git - esp-idf/blob - components/driver/adc1_i2s_private.h
heap: test: don’t warn about oversized mallocs
[esp-idf] / components / driver / adc1_i2s_private.h
1 // Copyright 2015-2016 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
15 #ifndef _DRIVER_ADC1_I2S_PRIVATE_H_
16 #define _DRIVER_ADC1_I2S_PRIVATE_H_
17
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21
22 #include "esp_err.h"
23
24
25 /**
26  * @brief Force power on for SAR ADC.
27  * This function should be called for the scenario in which ADC are controlled by digital function like DMA.
28  * When the ADC power is always on, RTC FSM can still be functional.
29  * This is an internal API for I2S module to call to enable I2S-ADC function.
30  * Note that adc_power_off() can still power down ADC.
31  */
32 void adc_power_always_on();
33
34 /**
35  * @brief For I2S dma to claim the usage of ADC1.
36  *
37  * Other tasks will be forbidden to use ADC1 between ``adc1_i2s_mode_acquire`` and ``adc1_i2s_release``.
38  * The I2S module may have to wait for a short time for the current conversion (if exist) to finish.
39  *
40  * @return
41  *      - ESP_OK success
42  *      - ESP_ERR_TIMEOUT reserved for future use. Currently the function will wait until success.
43  */
44 esp_err_t adc1_i2s_mode_acquire();
45
46 /**
47  * @brief For ADC1 to claim the usage of ADC1.
48  *
49  * Other tasks will be forbidden to use ADC1 between ``adc1_adc_mode_acquire`` and ``adc1_i2s_release``.
50  * The ADC1 may have to wait for some time for the I2S read operation to finish.
51  *
52  * @return
53  *      - ESP_OK success
54  *      - ESP_ERR_TIMEOUT reserved for future use. Currently the function will wait until success.
55  */
56 esp_err_t adc1_adc_mode_acquire();
57
58 /**
59  * @brief to let other tasks use the ADC1 when I2S is not work.
60  *
61  * Other tasks will be forbidden to use ADC1 between ``adc1_adc/i2s_mode_acquire`` and ``adc1_i2s_release``.
62  * Call this function to release the occupation of ADC1
63  *
64  * @return always return ESP_OK.
65  */
66 esp_err_t adc1_lock_release();
67
68 #ifdef __cplusplus
69 }
70 #endif
71
72 #endif  /*_DRIVER_ADC1_I2S_PRIVATE_H_*/
73