mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-09 12:35:28 +00:00
feat(sdmmc): Concurrent use of SDMMC peripheral
Host and device (card, etc.) initialization is not thread-safe. After initialization transactions are serialized and guarded by mutex. Changed `SDMMC_HOST_DEFAULT()` default deinit function to `sdmmc_host_deinit_slot` which has a slot number as argument.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "hal/assert.h"
|
||||
#include "soc/clk_tree_defs.h"
|
||||
#include "soc/sdmmc_struct.h"
|
||||
#include "soc/sdmmc_reg.h"
|
||||
#include "soc/system_struct.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -26,6 +27,22 @@ extern "C" {
|
||||
|
||||
#define SDMMC_LL_GET_HW(id) (((id) == 0) ? (&SDMMC) : NULL)
|
||||
|
||||
/* Default disabled interrupts (on init):
|
||||
* SDMMC_INTMASK_RXDR,
|
||||
* SDMMC_INTMASK_TXDR,
|
||||
* SDMMC_INTMASK_BCI,
|
||||
* SDMMC_INTMASK_ACD,
|
||||
* SDMMC_INTMASK_IO_SLOT1,
|
||||
* SDMMC_INTMASK_IO_SLOT0
|
||||
*/
|
||||
// Default enabled interrupts (sdio is enabled only when use):
|
||||
#define SDMMC_LL_INTMASK_DEFAULT \
|
||||
(SDMMC_INTMASK_CD | SDMMC_INTMASK_RESP_ERR | SDMMC_INTMASK_CMD_DONE | SDMMC_INTMASK_DATA_OVER | \
|
||||
SDMMC_INTMASK_RCRC | SDMMC_INTMASK_DCRC | SDMMC_INTMASK_RTO | SDMMC_INTMASK_DTO | SDMMC_INTMASK_HTO | \
|
||||
SDMMC_INTMASK_HLE | \
|
||||
SDMMC_INTMASK_SBE | \
|
||||
SDMMC_INTMASK_EBE)
|
||||
|
||||
/**
|
||||
* SDMMC capabilities
|
||||
*/
|
||||
@@ -427,6 +444,17 @@ static inline void sdmmc_ll_clear_interrupt(sdmmc_dev_t *hw, uint32_t mask)
|
||||
hw->rintsts.val = mask;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Enable / disable interrupts globally
|
||||
*
|
||||
* @param hw hardware instance address
|
||||
* @param en enable / disable
|
||||
*/
|
||||
static inline void sdmmc_ll_enable_global_interrupt(sdmmc_dev_t *hw, bool en)
|
||||
{
|
||||
hw->ctrl.int_enable = (uint32_t)en;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user