Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unified implementation for TARGET_STM and TARGET_NXP #3

Closed
wants to merge 11 commits into from

Conversation

mathias-arm
Copy link

I merged #1 and #2, which were respectively based on JojoS62/sdio-driver/master from @JojoS62 and NXPmicro/sdio-driver/Add_SDIO_LPC55S69 from @mmahadevan108.

I had to make some changes for the coexistence of STM and NXP implementations, and I put everything in a COMPONENT_SDIO directory.

I am creating this pull request to start the discussion. I have not yet been able to test this. I am preparing another patch (pull request) for ARMmbed/mbed-os to support the SDIO component which should be make testing easier (without having to resort to other storage type).

JojoS62 and others added 11 commits November 9, 2018 22:36
add SDIOBlockdevice
implementation for STM32F4
added some description
almost the same as for STM32F4, but in F7 SDIO device is renamed to SDMMC
SDMMC1 is used for DISCO_F746NG
updated readme.md for new target
- removed comments
- renamed short variable names
tickstart was inside checking loop
removed wait_ms() calls
added timeout checks for all while loops
Took the work done as part of PR
ARMmbed/mbed-os#8634

Signed-off-by: Mahesh Mahadevan <[email protected]>
Tested this with the block device test inside features-storage-tests-blockdevice-general_block_device
Below was the change made to add SDIO test

--- a/features/storage/TESTS/blockdevice/general_block_device/main.cpp
+++ b/features/storage/TESTS/blockdevice/general_block_device/main.cpp
@@ -47,6 +47,8 @@
 #include "FlashIAPBlockDevice.h"
 #endif

+#include "SDIOBlockDevice.h"
+
 using namespace utest::v1;

 #define TEST_BLOCK_COUNT 10
@@ -69,6 +71,7 @@ enum bd_type {
     dataflash,
     sd,
     flashiap,
+    sdio,
     default_bd
 };

@@ -90,6 +93,11 @@ static inline uint32_t align_up(uint32_t val, uint32_t size)
 static BlockDevice *get_bd_instance(uint8_t bd_type)
 {
     switch (bd_arr[bd_type]) {
+        case sdio: {
+            static SDIOBlockDevice default_bd(P0_17);
+            return &default_bd;
+            break;
+        }
         case spif: {
 #if COMPONENT_SPIF
             static SPIFBlockDevice default_bd(
@@ -632,6 +640,8 @@ void test_get_type_functionality()
     const char *bd_type = block_device->get_type();
     TEST_ASSERT_NOT_EQUAL(0, bd_type);

+    TEST_ASSERT_EQUAL(0, strcmp(bd_type, "SDIO"));
+
 #if COMPONENT_QSPIF
     TEST_ASSERT_EQUAL(0, strcmp(bd_type, "QSPIF"));
 #elif COMPONENT_SPIF
@@ -708,10 +718,12 @@ int get_bd_count()
     bd_arr[count++] = flashiap;       //4
 #endif

+    bd_arr[count++] = sdio;       //5
+
     return count;
 }

-static const char *prefix[] = {"SPIF ", "QSPIF ", "DATAFLASH ", "SD ", "FLASHIAP ", "DEFAULT "};
+static const char *prefix[] = {"SPIF ", "QSPIF ", "DATAFLASH ", "SD ", "FLASHIAP ", "SDIO ", "DEFAULT "};

 int main()
 {

Signed-off-by: Mahesh Mahadevan <[email protected]>
- ARMmbed#1 is based on [JojoS62/sdio-driver/master](JojoS62@c03489c).
- ARMmbed#2 is based on [NXPmicro/sdio-driver/Add_SDIO_LPC55S69](nxp-archive@370c51a)
@mathias-arm
Copy link
Author

I just found ARMmbed/mbed-os#10235 (which was closed and masked by issue 10909 in the comment in #1).

@mathias-arm mathias-arm mentioned this pull request Aug 9, 2019
@mathias-arm
Copy link
Author

Replaced by #4.

@mathias-arm mathias-arm closed this Aug 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants