-
Notifications
You must be signed in to change notification settings - Fork 7.1k
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
Silabs siwx91x dma driver scatter gather feature and other fixes/improvements #87383
base: main
Are you sure you want to change the base?
Silabs siwx91x dma driver scatter gather feature and other fixes/improvements #87383
Conversation
1. Corrected the burst length processing to be handled in bytes for the siwx917 DMA drivers. 2. Removed overlay and configuration files associated with the chan_blen_transfer test application. The chan_blen_transfer test application attempted to use 8 and 16 byte bursts, which are not supported by the siwx91x UDMA. Signed-off-by: Sai Santhosh Malae <Santhosh.Malae@silabs.com>
Refactored the driver code to ensure compatibility with the dma_context API, improving maintainability and consistency with other DMA drivers in the Zephyr project. Signed-off-by: Sai Santhosh Malae <Santhosh.Malae@silabs.com>
drivers/dma/dma_silabs_siwx91x.c
Outdated
ARG_UNUSED(dev); | ||
|
||
if (filter_param != NULL) { | ||
if ((int)*((int *)filter_param) == channel) { |
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.
There is no need to cast filter_param
twice: return (*(int *)filter_param == channel);
.
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.
Done
drivers/dma/dma_silabs_siwx91x.c
Outdated
return false; | ||
} | ||
} | ||
return 0; |
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.
Since the prototype declare a bool, prefer return false;
.
BTW, you can handle exception first and remove a level of indentation:
if (!filter_param) {
return false;
}
[...]
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.
Updated
drivers/dma/dma_silabs_siwx91x.c
Outdated
status = siwx91x_channel_config(dev, udma_handle, channel, config); | ||
if (config->head_block->next_block != NULL) { | ||
/* Configure DMA for a Scatter-Gather transfer */ | ||
status = siwx91x_sg_config(dev, udma_handle, channel, config); |
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.
We have to check somewhere if the caller set complete_callback_en
and returns an error on this case.
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.
Handled the check
drivers/dma/dma_silabs_siwx91x.c
Outdated
/* Configure DMA for a Scatter-Gather transfer */ | ||
status = siwx91x_sg_config(dev, udma_handle, channel, config); | ||
} else { | ||
status = siwx91x_channel_config(dev, udma_handle, channel, config); |
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.
siwx91x_channel_config()
and siwx91x_sg_config()
are "sibling" functions. I would try reflect this link in their names. eg. siwx91x_direct_chan_config()
/siwx91x_sg_chan_config()
, siwx91x_chan_cfg_contiguous()
/siwx91x_chan_cfg_sg()
, ...
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.
Changed the names accordingly
drivers/dma/dma_silabs_siwx91x.c
Outdated
@@ -33,6 +36,7 @@ enum { | |||
struct dma_siwx91x_channel_info { | |||
dma_callback_t dma_callback; /* User callback */ | |||
void *cb_data; /* User callback data */ | |||
uint32_t sg_desc_addr_info; /* Scatter-Gather table start address */ |
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.
I believe sg_desc_addr_info
should be a RSI_UDMA_DESC_T *
.
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.
Agreed. Updated the type.
2c25fc7
to
1646510
Compare
This new API allows the assignment of desired DMA channels for peripheral transfers, enhancing flexibility and control over DMA operations. Signed-off-by: Sai Santhosh Malae <Santhosh.Malae@silabs.com>
Updated the driver to ensure that each DMA channel can properly assign and handle individual callbacks. Signed-off-by: Sai Santhosh Malae <Santhosh.Malae@silabs.com>
Implement support for scatter-gather DMA transfers in the siwx917 driver. This enhancement allows the driver to handle multiple non-contiguous memory buffers in a single DMA transaction Signed-off-by: Sai Santhosh Malae <Santhosh.Malae@silabs.com>
1646510
to
7fd8b45
Compare
@nordicjm, I believe your comment has been fixed. |
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.
Kconfig part OK
for the siwx917 DMA drivers.
chan_blen_transfer test application. The chan_blen_transfer
test application attempted to use 8 and 16 byte bursts, which
are not supported by the siwx91x UDMA.
assign and handle individual callbacks.