예제 #1
0
bool spicommon_dma_chan_free(int dma_chan)
{
    assert( dma_chan == 1 || dma_chan == 2 );
    assert( spi_dma_chan_enabled & DMA_CHANNEL_ENABLED(dma_chan) );

    portENTER_CRITICAL(&spi_dma_spinlock);
    spi_dma_chan_enabled &= ~DMA_CHANNEL_ENABLED(dma_chan);
    if ( spi_dma_chan_enabled == 0 ) {
        //disable the DMA only when all the channels are freed.
        periph_module_disable( PERIPH_SPI_DMA_MODULE );
    }
    portEXIT_CRITICAL(&spi_dma_spinlock);

    return true;
}
예제 #2
0
esp_err_t esp_phy_rf_deinit(void)
{
    assert((s_phy_rf_init_count <= 2) && (s_phy_rf_init_count >= 1));

    _lock_acquire(&s_phy_rf_init_lock);
    if (s_phy_rf_init_count == 1) {
        // Disable PHY and RF.
        phy_close_rf();
        // Disable WiFi/BT common peripheral clock. Do not disable clock for hardware RNG
        periph_module_disable(PERIPH_WIFI_BT_COMMON_MODULE);
    } else {
#if CONFIG_SW_COEXIST_ENABLE
        coex_deinit();
#endif
    }
    s_phy_rf_init_count--;
    _lock_release(&s_phy_rf_init_lock);
    return ESP_OK;
}
예제 #3
0
//Returns true if this peripheral is successfully freed, false if otherwise.
bool spicommon_periph_free(spi_host_device_t host)
{
    bool ret = __sync_bool_compare_and_swap(&spi_periph_claimed[host], true, false);
    if (ret) periph_module_disable(io_signal[host].module);
    return ret;
}