Skip to content
Snippets Groups Projects
Select Git revision
  • d87faf9bd19df32d74c0cfe13428394f1ce22d47
  • main default protected
  • phhw
  • captouch-threshold
  • t
  • dos
  • test2
  • test
  • slewtest
  • simtest
  • view-think
  • vm-pending
  • media-buf
  • scope
  • passthrough
  • wave
  • vsync
  • dos-main-patch-50543
  • json-error
  • rahix/big-flow3r
  • pippin/media_framework
  • v1.3.0
  • v1.2.0
  • v1.2.0+rc1
  • v1.1.1
  • v1.1.0
  • v1.1.0+rc1
  • v1.0.0
  • v1.0.0+rc6
  • v1.0.0+rc5
  • v1.0.0+rc4
  • v1.0.0+rc3
  • v1.0.0+rc2
  • v1.0.0+rc1
34 results

collections.rst

Blame
  • Forked from flow3r / flow3r firmware
    Source project has a limited visibility.
    i2s_legacy.c 76.36 KiB
    /*
     * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD
     *
     * SPDX-License-Identifier: Apache-2.0
     */
    
    #include <string.h>
    #include <stdbool.h>
    #include <math.h>
    #include <esp_types.h>
    #include "freertos/FreeRTOS.h"
    #include "freertos/queue.h"
    #include "freertos/semphr.h"
    
    #include "sdkconfig.h"
    
    #if CONFIG_I2S_ENABLE_DEBUG_LOG
    // The local log level must be defined before including esp_log.h
    // Set the maximum log level for this source file
    #define LOG_LOCAL_LEVEL ESP_LOG_DEBUG
    #endif
    
    #include "soc/lldesc.h"
    #include "driver/gpio.h"
    #include "hal/gpio_hal.h"
    #include "driver/i2s_types_legacy.h"
    #include "hal/i2s_hal.h"
    #if SOC_I2S_SUPPORTS_DAC
    #include "driver/dac.h"
    #include "driver/adc.h"
    #include "../adc1_private.h"
    #endif // SOC_I2S_SUPPORTS_ADC
    
    #if SOC_GDMA_SUPPORTED
    #include "esp_private/gdma.h"
    #endif
    
    #include "clk_ctrl_os.h"
    #include "esp_intr_alloc.h"
    #include "esp_err.h"
    #include "esp_check.h"
    #include "esp_attr.h"
    #include "esp_log.h"
    #include "esp_pm.h"
    #include "esp_efuse.h"
    #include "esp_rom_gpio.h"
    #include "esp_private/periph_ctrl.h"
    
    static const char *TAG = "i2s(legacy)";
    
    #define I2S_ENTER_CRITICAL_ISR(i2s_num)          portENTER_CRITICAL_ISR(&i2s_spinlock[i2s_num])
    #define I2S_EXIT_CRITICAL_ISR(i2s_num)           portEXIT_CRITICAL_ISR(&i2s_spinlock[i2s_num])
    #define I2S_ENTER_CRITICAL(i2s_num)              portENTER_CRITICAL(&i2s_spinlock[i2s_num])
    #define I2S_EXIT_CRITICAL(i2s_num)               portEXIT_CRITICAL(&i2s_spinlock[i2s_num])
    
    #define I2S_DMA_BUFFER_MAX_SIZE     4092
    
    #if SOC_I2S_SUPPORTS_ADC_DAC
    #define    I2S_COMM_MODE_ADC_DAC    -1
    #endif
    
    /**
     * @brief General clock configuration information
     * @note It is a general purpose struct, not supposed to be used directly by user
     */
    typedef struct {
        uint32_t                sample_rate_hz;     /*!< I2S sample rate */
        i2s_clock_src_t         clk_src;            /*!< Choose clock source */
        i2s_mclk_multiple_t     mclk_multiple;      /*!< The multiple of mclk to the sample rate */
    #if SOC_I2S_SUPPORTS_PDM_TX