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

feat(MiscDrivers): Add API for Setting SDHC Data Width #1045

Merged
merged 9 commits into from
Jun 25, 2024

Conversation

EricB-ADI
Copy link
Contributor

@EricB-ADI EricB-ADI commented Jun 11, 2024

Description

Added API to set default SPI mode (single/quad) for SDHC. Compile time default set to single mode to maintain backwards compatibility.

@EricB-ADI EricB-ADI changed the title feat(MiscDrivers): SDHC Default QSPI feat(MiscDrivers): SDHC Default API Jun 11, 2024
@github-actions github-actions bot added the Tools This issue or pull request involves a change to the Tools label Jun 11, 2024
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't delete this

mxc_version.h Outdated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or this

Copy link
Contributor

@Jake-Carter Jake-Carter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some feedback below - take it or leave it. This looks good, just some thoughts on a potentially cleaner diff for this.

On the version number files - See #937. I still need to get around to an automatic workflow for updating them, but don't delete them in the meantime

@@ -236,6 +237,8 @@ int MXC_SDHC_Lib_SetBusWidth(mxc_sdhc_data_width bus_width)
uint32_t card_status;
int result;

bus_width = bus_width == MXC_SDHC_LIB_DEFAULT_DATA ? MXC_SDHC_Get_Default_DataWidth() : bus_width;
Copy link
Contributor

@Jake-Carter Jake-Carter Jun 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it might be cleaner to come in "over the top" and avoid adding the extra enum value. A direct getter/setter to the state variable would work, so your call from diskio.c would look like:

MXC_SDHC_Lib_Write(sector, (void *)buff, count, MXC_SDHC_Get_DataWidth())

Usually you're not gonna change your data width more than once at run-time, so a mechanism for setting the default value might be better implemented as a build-time option. Users can use the setter API you've exposed on initialization.

This would let us avoid these modifications to sdhc_lib.c, since the data width is already an arg to the SDHC functions

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is what is set as in diskio.c. The point of doing this extra step was to not break the API if someone uses it directly. Since Get/Set default data width doesn't really do more than allow us to get it at the higher level. It is a little Awkard that you set it and then have to pass it anyway. I am fine deleting those modifications though.

@github-actions github-actions bot added MAX32655 Related to the MAX32655 (ME17) MAX32670 Related to the MAX32670 (ME15) Workflow Related to Workflow development and removed Tools This issue or pull request involves a change to the Tools labels Jun 14, 2024
@github-actions github-actions bot added Tools This issue or pull request involves a change to the Tools and removed MAX32655 Related to the MAX32655 (ME17) MAX32670 Related to the MAX32670 (ME15) Workflow Related to Workflow development labels Jun 20, 2024
@github-actions github-actions bot added Workflow Related to Workflow development and removed Tools This issue or pull request involves a change to the Tools labels Jun 20, 2024
@Jake-Carter Jake-Carter changed the title feat(MiscDrivers): SDHC Default API feat(MiscDrivers): Add API for Setting SDHC Data Width Jun 25, 2024
@Jake-Carter Jake-Carter merged commit e6474de into main Jun 25, 2024
11 checks passed
@Jake-Carter Jake-Carter deleted the feat/sdhc_qspi_conf branch June 25, 2024 20:08
sihyung-maxim pushed a commit to analogdevicesinc/hal_adi that referenced this pull request Jun 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Workflow Related to Workflow development
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FatFS using SDHC is hardcoded to 1-bit mode in diskio.c
3 participants