Skip to content

Commit

Permalink
refactor(sdmmc): dependency inversion to sdmmc component
Browse files Browse the repository at this point in the history
  • Loading branch information
Icarus113 committed Nov 16, 2023
1 parent c7c38b7 commit 5b8d904
Show file tree
Hide file tree
Showing 17 changed files with 51 additions and 38 deletions.
2 changes: 1 addition & 1 deletion components/driver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
6 changes: 0 additions & 6 deletions components/esp_driver_sd_common/CMakeLists.txt

This file was deleted.

10 changes: 0 additions & 10 deletions components/esp_driver_sd_common/README.md

This file was deleted.

4 changes: 2 additions & 2 deletions components/esp_driver_sdmmc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
2 changes: 1 addition & 1 deletion components/esp_driver_sdmmc/include/driver/sdmmc_defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@

#pragma once

#include "driver/esp_sd_defs.h"
#include "sd_protocol_defs.h"
2 changes: 1 addition & 1 deletion components/esp_driver_sdmmc/include/driver/sdmmc_host.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion components/esp_driver_sdmmc/include/driver/sdmmc_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@

#pragma once

#include "driver/esp_sd_types.h"
#include "sd_protocol_types.h"
2 changes: 1 addition & 1 deletion components/fatfs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion components/fatfs/diskio/diskio_sdmmc.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#pragma once

#include "sdmmc_cmd.h"
#include "driver/sdmmc_defs.h"
#include "sd_protocol_defs.h"

#ifdef __cplusplus
extern "C" {
Expand Down
3 changes: 1 addition & 2 deletions components/fatfs/vfs/esp_vfs_fat.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion components/fatfs/vfs/vfs_fat_sdmmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 0 additions & 1 deletion components/sdmmc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion components/sdmmc/include/sdmmc_cmd.h
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down
4 changes: 2 additions & 2 deletions components/sdmmc/sdmmc_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 0 additions & 3 deletions examples/storage/.build-test-rules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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:
Expand Down

0 comments on commit 5b8d904

Please sign in to comment.