-
Notifications
You must be signed in to change notification settings - Fork 90
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(Examples,PeriphDrivers): Add SPIMSS_DMA example and SPIMSS Master Trans DMA APIs #840
feat(Examples,PeriphDrivers): Add SPIMSS_DMA example and SPIMSS Master Trans DMA APIs #840
Conversation
37b7f58
to
d692efd
Compare
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.
Thanks for your PR @kilicomercan
Consider the case where DMA channel 0 and 1 are already in use. In this case, the transaction function will acquire channel 2/3, and the ISRs and handlers will never be triggered (even though you've released the channel in the example code, we can't expect application code to also do this). Acquiring the DMA channel inside the transaction function is convenient, but it becomes problematic. We can't guarantee that it will acquire a specific channel, so we can't always assign the DMA_0_-specific handler. We also cannot easily check which channels will be used from "outside" the function in order to assign the correct ISRs, because the transaction acquires them on the fly.
I solved this problem for the UART module by implementing an "auto handlers" feature, as well as an API for users who would like to manually assign and manage their DMA channels.
I think a similar approach would solve this problem here as well. Take a look at #763 for more details
d692efd
to
2f9024b
Compare
7e7e878
to
022d621
Compare
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.
Thanks @kilicomercan, the new APIs for the DMA handlers look good.
I have some more comments below. They should be easy to fix, but there is one more detailed question related to the 16-bit data alignment.
aa2083c
to
8ae3990
Compare
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.
Thanks for your changes! I like this specific approach of having the option to set up DMA beforehand instead of within the transaction function itself.
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.
Looks good @kilicomercan, thanks. Sihyung has some review notes as well
9d40580
to
e90e6e6
Compare
Hi @Jake-Carter and @sihyung-maxim , |
e90e6e6
to
02c081c
Compare
2a9a235
to
b2f9044
Compare
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.
Nice work on a big driver addition!
Description
There is no transaction API over DMA for SPIMSS driver in MSDK. In addition, we don't have example application which shows how to make SPIMSS master transaction by using DMA.
Implemented Example:
SPIMSS_DMA example code is added for MAX32660 EVSYS
Implemented API Features:
SPIMSS DMA "Auto handlers". Auto handling is disabled by default.
APIs for using application defined DMA handlers and channels.
New API for SPIMSS Master Dma Transaction:
int MXC_SPIMSS_MasterTransDMA(mxc_spimss_regs_t *spi, mxc_spimss_req_t *req);
New APIs for Assigning DMA Channels:
int MXC_SPIMSS_SetTXDMAChannel(mxc_spimss_regs_t *spi, unsigned int channel);
int MXC_SPIMSS_SetRXDMAChannel(mxc_spimss_regs_t *spi, unsigned int channel);
int MXC_SPIMSS_GetTXDMAChannel(mxc_spimss_regs_t *spi);
int MXC_SPIMSS_GetRXDMAChannel(mxc_spimss_regs_t *spi);