-
Notifications
You must be signed in to change notification settings - Fork 3k
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
SDIO support - WIP #10235
SDIO support - WIP #10235
Conversation
@mmahadevan108 FYI |
@orenc17 Please take a look at the astyle issues (yesterday's issues have been fixed and merged. Results in job appear to be correctly failing). |
Hi |
@jeromecoutant i'm working on integrating the new Blockdevice to the current Blockdevice tests |
add SDIOBlockdevice implementation for STM32F4
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 # Conflicts: # README.md
- removed comments - renamed short variable names
tickstart was inside checking loop removed wait_ms() calls added timeout checks for all while loops
return SD_BLOCK_DEVICE_ERROR_NO_DEVICE; | ||
} | ||
|
||
if (!is_valid_read(addr, size)) { |
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.
when not initialized 'this->size()" is 0 and is_valid_read/program/trim will fail..
You will receive SD_BLOCK_DEVICE_ERROR_PARAMETER instead of SD_BLOCK_DEVICE_ERROR_NO_INIT, which is more appropriate.
@ARMmbed/mbed-os-hal can you please review |
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]>
@mmahadevan108 it seems to pass the general-block-device test |
Should we pass in PinNames to sdio_init() for DAT0-3, CLK, CMD? |
@mmahadevan108 i think so, this is an initial step, it will evolve in time |
* @param ReadAddr: Address from where data is to be read | ||
* @param NumOfBlocks: Number of SD blocks to read | ||
* @retval SD status | ||
*/ |
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.
Please specify the ReadAddress units: Bytes or blocks?
uint32_t RelCardAdd; /* Specifies the Relative Card Address */ | ||
uint32_t BlockNbr; /* Specifies the Card Capacity in blocks */ | ||
uint32_t BlockSize; /* Specifies one block size in bytes */ | ||
uint32_t LogBlockNbr; /* Specifies the Card logical Capacity in blocks */ |
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 be good to add some comments about the difference between BlockNbr and LogBlockNbr
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.
this part is a direct copy from sdio-driver.
@JojoS62 is there a difference?
@screamerbg this is a new HAL layer for mbed-os plus a new BlockDevice using that hal you wont find any FEATURE_ folders in this PR |
@@ -48,6 +48,10 @@ | |||
#include "FlashIAPBlockDevice.h" | |||
#endif | |||
|
|||
#if COMPONENT_SDIO | |||
#include "SDIOBlockDevice.h" |
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 happened if a targets adds component SDIO and SD and QSPIF ?
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.
All three blockdevices will be tested
Could you attach your test results ? Thx |
}, | ||
"target_overrides": { | ||
"DISCO_F469NI": { | ||
"CMD_TIMEOUT": 30000 |
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.
Why same value is overridden ?
PC9 ------> SDIO_D1 | ||
PC8 ------> SDIO_D0 | ||
*/ | ||
GPIO_InitStruct.Pin = GPIO_PIN_12 | GPIO_PIN_11 | GPIO_PIN_10 | GPIO_PIN_9 | GPIO_PIN_8; |
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.
This pin configuration can't be defined for all STM32 like this.
We should use some MACRO which can be define at each MCU level?
Or we should create a new structure in PeripheralPins.c ?
But OK to keep it like this in a first step, it can be optimized later while adding more SDIO targets.
"USBDEVICE" | ||
"USBDEVICE", | ||
"SDIO", | ||
"SDIO_ASYNC" |
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.
We need to add COMPONENT_SDIO AND DEVICE_SDIO AND DEVICE_SDIO_ASYNC ?
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.
Yes
Hi |
@orenc17 Could you address the review comments please ? |
@orenc17 What is missing here to land this on the feature branch? Besides tests. |
Hi |
@ARMmbed/mbed-os-storage ^^ |
@davisga @trowbridgec @farrenv @AGlass0fMilk any feedback? |
Description
@JojoS62 thanks for the hard work
@ARMmbed/mbed-os-maintainers please set this to a new feature branch
Pull request type
Reviewers
@ARMmbed/mbed-os-maintainers @ARMmbed/mbed-os-storage @JojoS62 @ARMmbed/team-st-mcd
Release Notes