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(spi_nand_flash): expose lower-level API and make it usable without Dhara #447

Merged

Conversation

RathiSonika
Copy link
Collaborator

@RathiSonika RathiSonika commented Nov 11, 2024

spi_nand_flash
└── src
├── nand.c : Defines all public interfaces; includes definitions for spi_nand_flash.h
├── nand_gigadevice.c : Initializes chip-specific settings for GigaDevice
├── nand_micron.c : Initializes chip-specific settings for Micron
├── nand_winbond.c : Initializes chip-specific settings for Winbond
├── nand_alliance.c : Initializes chip-specific settings for Alliance
├── spi_nand_oper.c : Contains lower-level SPI communication APIs
├── nand_impl.c : Implements lower-level APIs such as nand_erase, nand_mark_bad, nand_prog, etc.
├── nand_impl_wrap.c : Implements wrapper functions for lower-level APIs implemented in nand_impl.c
└── dhara_glue.c : Initializes and defines Dhara-related APIs and registers function pointers in nand.c. Only
dhara_glue.c depends on the Dhara library, making it easy to replace with another library if
needed, allowing the code to function independently of Dhara.

Refactoring nand.c and the chip-specific settings is possible; however, this PR primarily focuses on exposing lower-level APIs and enabling easy replacement of the Dhara library in the future, if needed.

Checklist

  • Code cleanup
  • CI passing

Change description

  1. Expose lower level API such as nand_erase, nand_mark_bad, nand_prog etc. and make it usable without Dhara
  2. Fixed an issue in the nand_mark_bad() API. After erasing a block, it now correctly waits for the erase_block_delay time. Previously, the function was failing to mark the block as bad due to this missing delay.

@RathiSonika RathiSonika force-pushed the feat/spi_nand_expose_lower_level_api branch 4 times, most recently from b66eda8 to fe2657f Compare November 11, 2024 17:48
@RathiSonika RathiSonika force-pushed the feat/spi_nand_expose_lower_level_api branch 3 times, most recently from 8196058 to eb3dfe2 Compare November 12, 2024 07:26
@RathiSonika RathiSonika requested a review from igrr November 12, 2024 13:40
@pacucha42
Copy link

Generally LGTM, but why do you place spi_nand_api.h into private includes? Isn't this PR about exposing the APIs?

Copy link
Member

@igrr igrr left a comment

Choose a reason for hiding this comment

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

@RathiSonika LGTM overall, looks like a nice improvement. I left a few comments for discussion.

spi_nand_flash/include/spi_nand_flash.h Outdated Show resolved Hide resolved
spi_nand_flash/include/spi_nand_flash.h Outdated Show resolved Hide resolved
spi_nand_flash/include/spi_nand_flash.h Outdated Show resolved Hide resolved
spi_nand_flash/src/spi_nand_api.c Outdated Show resolved Hide resolved
spi_nand_flash/priv_include/nand.h Outdated Show resolved Hide resolved
spi_nand_flash/src/dhara_glue.c Outdated Show resolved Hide resolved
spi_nand_flash/src/dhara_glue.c Outdated Show resolved Hide resolved
@RathiSonika
Copy link
Collaborator Author

Generally LGTM, but why do you place spi_nand_api.h into private includes? Isn't this PR about exposing the APIs?

This is actually a private header for this component. The APIs defined here are used internally within the component and are not public APIs. I understand the name might be confusing, so I’ll rename it.

@RathiSonika RathiSonika force-pushed the feat/spi_nand_expose_lower_level_api branch 2 times, most recently from 0601427 to d83e3a6 Compare November 21, 2024 11:39
@RathiSonika RathiSonika marked this pull request as ready for review November 21, 2024 12:47
@RathiSonika RathiSonika force-pushed the feat/spi_nand_expose_lower_level_api branch 2 times, most recently from 8a0ba94 to c2fd329 Compare November 22, 2024 15:34
@RathiSonika RathiSonika requested a review from igrr November 22, 2024 15:40
@RathiSonika
Copy link
Collaborator Author

@igrr PTAL. Thank you!

Copy link
Member

@igrr igrr left a comment

Choose a reason for hiding this comment

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

Some final comments, LGTM otherwise.

spi_nand_flash/test_app/main/test_app_main.c Outdated Show resolved Hide resolved
spi_nand_flash/src/nand.c Outdated Show resolved Hide resolved
@RathiSonika RathiSonika force-pushed the feat/spi_nand_expose_lower_level_api branch from 86bceb9 to dedb5e8 Compare November 29, 2024 15:00
@RathiSonika RathiSonika force-pushed the feat/spi_nand_expose_lower_level_api branch from ab1e619 to eb4e40c Compare November 29, 2024 15:24
@RathiSonika RathiSonika merged commit 116bceb into espressif:master Nov 29, 2024
48 checks passed
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