-
Notifications
You must be signed in to change notification settings - Fork 15
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
Add sdio driver #2
base: master
Are you sure you want to change the base?
Conversation
SDIOBlockDevice.cpp
Outdated
@@ -0,0 +1,296 @@ | |||
/* mbed Microcontroller Library | |||
* Copyright (c) 2017 ARM Limited |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
year 2019 and add also SPDX identifier please
SDIOBlockDevice.cpp
Outdated
|
||
int SDIOBlockDevice::program(const void *b, bd_addr_t addr, bd_size_t size) | ||
{ | ||
//debug_if(SD_DBG, "program Card...\r\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove unused code
target/fsl_sdmmc_common.h
Outdated
@@ -0,0 +1,236 @@ | |||
/* | |||
* Copyright (c) 2015, Freescale Semiconductor, Inc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will these file work , if the location is target/fsl_sdmmc_common.h
? rather than TARGET_NXP as it's only for NXP targets?
Took the work done as part of PR ARMmbed/mbed-os#8634 Signed-off-by: Mahesh Mahadevan <[email protected]>
cc3e7e5
to
1040204
Compare
I have update the PR to address the comments |
target/TARGET_NXP/sdio_device.c
Outdated
//pin_mode(P0_17, PullNone); | ||
|
||
/* SD Write Protect */ | ||
//pin_function(P0_15, 5); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about these unused code, lines 88-94 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for catching this. This has been fixed.
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]>
1040204
to
370c51a
Compare
@mmahadevan108 : this PR#2 seems to be conflicting PR#1 on this same repo: (#1). For instance #1 is using DMA mode and #2 does not. cc: @ARMmbed/mbed-os-storage |
I moved that part of the code to the target to decide the transfer mechanism to use. |
@mmahadevan108 - logically, leaving this part for the target to decide makes sense, but practically until someone changes PR #1 we have two separate PRs that conflict each other. @0xc0170 - I think we need to decide whether we would like two separate SDIOBlockDevice repos, for each target. |
cc @flit |
How should we proceed? |
@mmahadevan108 - can you confirm usage details for testing this on LPC55S69_EVK? How did you test this? is card detect required? Or did you use something like this?
Also, there appears to be hard-coded pin seetings in sdio_device.c. Seems better to pass these in via the constructors.
|
Never mind my last comment about usage details. I took the standard mbed-os-example-filesystem, made these changes and it works.
|
Tested this with the block device test inside features-storage-tests-blockdevice-general_block_device
|
- 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)
Remove some warnings
add get_default_instance
Initial SDIO Block device driver.
Add SDIO support for LPC55S69