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

Update dma sdk with new macro definitions to handle different DMA parameters #563

Merged
merged 28 commits into from
Aug 7, 2024

Conversation

LuigiGiuffrida98
Copy link
Contributor

No description provided.

@LuigiGiuffrida98 LuigiGiuffrida98 marked this pull request as ready for review July 22, 2024 18:37
@LuigiGiuffrida98
Copy link
Contributor Author

@JuanSapriza @JoseCalero can you please review this PR?

Copy link
Contributor

@JuanSapriza JuanSapriza left a comment

Choose a reason for hiding this comment

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

Left some comments and made a PR with some proposed changes. You can pick which ones to keep and which ones not.
here: LuigiGiuffrida98#1

sw/applications/example_dma_sdk/main.c Outdated Show resolved Hide resolved
sw/device/lib/sdk/dma/dma_sdk.h Show resolved Hide resolved
// from here we wake up even if we did not jump to the ISR
}
CSR_SET_BITS(CSR_REG_MSTATUS, 0x8);
volatile dma *the_dma = dma_peri(channel);
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. the_dma ? hahaha
  2. If the_dma is being enforced to be volatile, having a separate function to start it does not make much sense. If it's only for clarity, maybe consider using __attribute__((always_inline)) ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Note that inline is a suggestion to the compiler only

Copy link
Contributor

Choose a reason for hiding this comment

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

if we are having a separate function, maybe there is no need to have the volatile, allowing the compiler to accelerate a bit the copying of the data.

I think its a small detail. For what it concerns me, it can be left like this (maybe not with the_dma tho hahaha)

@@ -107,6 +107,9 @@ extern "C" {
*/
#define DMA_DATA_TYPE_2_SIZE(type) (0b00000100 >> (type) )

#define DMA_REGISTER_SIZE_BYTES sizeof(int)
Copy link
Contributor

Choose a reason for hiding this comment

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

This is re-defined in the .c. I dont think any of the two are necessary, as they are used only on the write_register function were we are already calling the peripheral as a uint32_t*, meaning that we are already forcing the 32 bits (even safer than using int)

@LuigiGiuffrida98
Copy link
Contributor Author

This is still unstable, I'm still fixing it.

@JoseCalero
Copy link
Collaborator

this PR is functional? @LuigiGiuffrida98 @JuanSapriza

@LuigiGiuffrida98
Copy link
Contributor Author

Yes

@davideschiavone
Copy link
Member

what is the status of this? @JuanSapriza

@LuigiGiuffrida98
Copy link
Contributor Author

@davideschiavone this PR should be ready to be reviewed and eventually merged.

@JuanSapriza
Copy link
Contributor

i will check it today and let you guys know, but was already good when I last saw it

@davideschiavone
Copy link
Member

i will check it today and let you guys know, but was already good when I last saw it

OK thx let me know

@JuanSapriza
Copy link
Contributor

Ok, i tested it and everything looks ok. Maybe one day @LuigiGiuffrida98 can document the sdk functions and/or add them to the documentation? :)
@davideschiavone you can merge

@davideschiavone davideschiavone merged commit 98c47f9 into esl-epfl:main Aug 7, 2024
4 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.

4 participants