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

gpio: rearrange module to split version 1 and version 2 code #13

Merged
merged 6 commits into from
Dec 20, 2024

Conversation

luojia65
Copy link
Member

@luojia65 luojia65 commented Dec 18, 2024

This pull request refactors the GPIO module to improve code organization and readability. The Pad structure has been split into four distinct structures: Disabled, Input, Output, and Alternate, with the internal implementations of Padv1 and Padv2 now hidden within an Inner struct. Additionally, version 1 and version 2 code for GPIO functionality has been separated for clarity.

The update also introduces new pad structs (Input, Output, Disabled) and conversion functions in the IntoPad trait. The GLBv2 GPIO conversation logic is now implemented, removing the Alternate trait for simplicity. Documentation has been improved, and various code cleanups have been made, including the use of a reference to the GLB RegisterBlock to reduce complexity. All tests pass successfully across different feature gate options.

@luojia65 luojia65 force-pushed the feat/gpio-rearrange branch from 559a344 to 0714b1c Compare December 19, 2024 04:16
Documentation fixes on Pad structure

Signed-off-by: Zhouqi Jiang <[email protected]>
@luojia65 luojia65 force-pushed the feat/gpio-rearrange branch from 0714b1c to 5d4df4b Compare December 19, 2024 04:27
@luojia65 luojia65 force-pushed the feat/gpio-rearrange branch from 95c7588 to 2f06dae Compare December 19, 2024 06:23
small documentation fixes

Signed-off-by: Zhouqi Jiang <[email protected]>
@luojia65 luojia65 force-pushed the feat/gpio-rearrange branch 2 times, most recently from 3678333 to 86d1a4c Compare December 19, 2024 07:08
Simplify inner structures into `Inner` struct. Now `Padv1` and `Padv2`
inner structures are hidden and treated as inner implementations.

Now struct Pad is split into Disabled, Input, Output and Alternate structures to make code clearer.

Signed-off-by: Zhouqi Jiang <[email protected]>
@luojia65 luojia65 force-pushed the feat/gpio-rearrange branch 2 times, most recently from 3339b95 to 130f5b9 Compare December 19, 2024 07:17
@luojia65 luojia65 force-pushed the feat/gpio-rearrange branch 2 times, most recently from 37e1796 to 88758ac Compare December 19, 2024 08:59
… to RegisterBlock

This change shortens code and number of type generics. Code cleanup, pass tests on all feature gate options.

Signed-off-by: Zhouqi Jiang <[email protected]>
@luojia65 luojia65 force-pushed the feat/gpio-rearrange branch from 88758ac to 63c17cb Compare December 19, 2024 09:02
@luojia65 luojia65 marked this pull request as ready for review December 19, 2024 09:02
Copy link
Contributor

@Placebo27 Placebo27 left a comment

Choose a reason for hiding this comment

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

LGTM!

@luojia65
Copy link
Member Author

luojia65 commented Dec 20, 2024

The are bugs on mainline project, will be fixed on further contributions later.

@luojia65 luojia65 merged commit 69b39c5 into rustsbi:main Dec 20, 2024
15 checks passed
Copy link
Contributor

@Placebo27 Placebo27 left a comment

Choose a reason for hiding this comment

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

  1. The i2c-demo test result is:
    image
    It shows that there is something wrong in i2c module.
  2. The lz4d-demo test result is:
    image
    It always is decompressing until stops.
  3. The psram-demo test result is:
    image
    We can clearly see the fault when it is reading from the memory.

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.

2 participants