refactor(sdmmc): dependency inversion to sdmmc component

This commit is contained in:
Armando 2023-11-14 15:01:08 +08:00
parent c7c38b7904
commit 5b8d904a9b
17 changed files with 51 additions and 38 deletions

View File

@ -192,7 +192,7 @@ else()
# for backward compatibility, the driver component needs to
# have a public dependency on other "esp_driver_foo" components
esp_driver_gpio esp_driver_pcnt esp_driver_gptimer esp_driver_spi esp_driver_mcpwm
esp_driver_sd_common esp_driver_sdmmc
esp_driver_sdmmc
LDFRAGMENTS ${ldfragments}
)
endif()

View File

@ -1,6 +0,0 @@
set(srcs)
set(public_include "include")
idf_component_register(SRCS ${srcs}
INCLUDE_DIRS ${public_include}
)

View File

@ -1,10 +0,0 @@
# Common Component for SD Related Drivers
This component contains driver layer common files:
- `esp_sd_defs.h`
- `esp_sd_types.h`
These files will be used by SD related drivers, including:
- `esp_driver_sdmmc`
- `esp_driver_sdspi`

View File

@ -10,6 +10,6 @@ endif()
idf_component_register(SRCS ${srcs}
INCLUDE_DIRS ${public_include}
REQUIRES
PRIV_REQUIRES esp_timer esp_pm esp_mm esp_driver_gpio esp_driver_sd_common
REQUIRES sdmmc esp_driver_gpio
PRIV_REQUIRES esp_timer esp_pm esp_mm
)

View File

@ -6,4 +6,4 @@
#pragma once
#include "driver/esp_sd_defs.h"
#include "sd_protocol_defs.h"

View File

@ -12,7 +12,7 @@
#include <stdint.h>
#include <stddef.h>
#include "esp_err.h"
#include "sdmmc_types.h"
#include "driver/sdmmc_types.h"
#include "driver/sdmmc_default_configs.h"
#include "driver/gpio.h"

View File

@ -6,4 +6,4 @@
#pragma once
#include "driver/esp_sd_types.h"
#include "sd_protocol_types.h"

View File

@ -22,7 +22,7 @@ else()
list(APPEND include_dirs "vfs")
list(APPEND requires "sdmmc")
list(APPEND requires "sdmmc" "driver") # `driver` will be replaced with `esp_driver_sdspi`
list(APPEND priv_requires "vfs" "esp_driver_gpio")
endif()

View File

@ -7,7 +7,7 @@
#pragma once
#include "sdmmc_cmd.h"
#include "driver/sdmmc_defs.h"
#include "sd_protocol_defs.h"
#ifdef __cplusplus
extern "C" {

View File

@ -7,8 +7,7 @@
#pragma once
#include <stddef.h>
#include "esp_err.h"
#include "driver/gpio.h"
#include "driver/sdmmc_types.h"
#include "sd_protocol_types.h"
#include "driver/sdspi_host.h"
#include "ff.h"
#include "wear_levelling.h"

View File

@ -15,7 +15,7 @@
#include "diskio_impl.h"
#include "diskio_sdmmc.h"
#include "soc/soc_caps.h"
#include "driver/sdmmc_defs.h"
#include "sd_protocol_defs.h"
#if SOC_SDMMC_HOST_SUPPORTED
#include "driver/sdmmc_host.h"

View File

@ -11,5 +11,4 @@ idf_component_register(SRCS "sdmmc_cmd.c"
"sdmmc_mmc.c"
"sdmmc_sd.c"
INCLUDE_DIRS include
REQUIRES driver
PRIV_REQUIRES soc esp_timer)

View File

@ -1,7 +1,24 @@
/*
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2006 Uwe Stuehler <uwe@openbsd.org>
*
* SPDX-License-Identifier: Apache-2.0
* SPDX-License-Identifier: ISC
*
* SPDX-FileContributor: 2016-2023 Espressif Systems (Shanghai) CO LTD
*/
/*
* Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#pragma once

View File

@ -1,7 +1,24 @@
/*
* SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2006 Uwe Stuehler <uwe@openbsd.org>
*
* SPDX-License-Identifier: Apache-2.0
* SPDX-License-Identifier: ISC
*
* SPDX-FileContributor: 2016-2023 Espressif Systems (Shanghai) CO LTD
*/
/*
* Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#pragma once

View File

@ -8,7 +8,7 @@
#include <stdio.h>
#include "esp_err.h"
#include "driver/sdmmc_types.h"
#include "sd_protocol_types.h"
#ifdef __cplusplus
extern "C" {

View File

@ -21,8 +21,8 @@
#include "esp_heap_caps.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "driver/sdmmc_defs.h"
#include "driver/sdmmc_types.h"
#include "sd_protocol_defs.h"
#include "sd_protocol_types.h"
#include "sdmmc_cmd.h"
#include "sys/param.h"
#include "soc/soc_memory_layout.h"

View File

@ -15,7 +15,6 @@ examples/storage/emmc:
- fatfs
- vfs
- esp_driver_sdmmc
- esp_driver_sd_common
enable:
- if: IDF_TARGET == "esp32s3"
reason: only support on esp32s3
@ -110,7 +109,6 @@ examples/storage/perf_benchmark:
- wear_levelling
- esp_partition
- esp_driver_sdmmc
- esp_driver_sd_common
disable:
- if: IDF_TARGET == "esp32p4" and CONFIG_NAME in ["sdmmc_1line", "sdmmc_4line", "sdspi_1line"]
temporary: true
@ -125,7 +123,6 @@ examples/storage/sd_card/sdmmc:
- vfs
- sdmmc
- esp_driver_sdmmc
- esp_driver_sd_common
disable:
- if: SOC_SDMMC_HOST_SUPPORTED != 1
disable_test: