You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "snikeguo (via GitHub)" <gi...@apache.org> on 2025/06/01 11:08:32 UTC
[PR] Add DMA Alignment Component and Integrate It into the MMC Driver [nuttx]
snikeguo opened a new pull request, #16464:
URL: https://github.com/apache/nuttx/pull/16464
*Note: Please adhere to [Contributing Guidelines](https://github.com/apache/nuttx/blob/master/CONTRIBUTING.md).*
## Summary
Add DMA Alignment Component and Integrate It into the MMC Driver
## Impact
I believe DMA management should be handled by device drivers, not by the FAT layer. For more details, see: @apache/nuttxhttps://github.com/apache/nuttx/issues/16415
during MMC/TF card enumeration, DMA should not be used because the data volume is only a few bytes. Linux is also designed this way.
## Testing
MMC Write Logic:
mmcsd_writemultiple() { .... mmcsd_transferready(); ... SDIO_DMASENDSETUP(); }
In the current code (https://github.com/apache/nuttx/commit/b05ec7729d9b7fe85a6f11bfbb2da979255f44b7), I found that after writing multiple sectors, when sending ACMD51 and then querying R1, the error rate is very high.
test code:
int r1_error_cnt=0;
mmcsd_transferready()
{
...
ret = mmcsd_get_r1(priv, &r1);
if (ret != OK)
{
ferr("ERROR: mmcsd_get_r1 failed: %d\n", ret);
return ret;
}
/* Now check if the card is in the expected transfer state. */
if (IS_STATE(r1, MMCSD_R1_STATE_TRAN))
{
/* Yes.. return Success */
priv->wrbusy = false;
return OK;
}
extern int wm_called;
if(wm_called)
{
r1_error_cnt++;
}
}

With my code, the test results show no errors.

--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add DMA Alignment Component and Integrate It into the MMC Driver [nuttx]
Posted by "acassis (via GitHub)" <gi...@apache.org>.
acassis commented on code in PR #16464:
URL: https://github.com/apache/nuttx/pull/16464#discussion_r2119245040
##########
drivers/dma/dma_align_manager.c:
##########
@@ -0,0 +1,30 @@
+#include <nuttx/dma/dma_align_manager.h>
+#include <sys/types.h>
+int dma_align_manager_init(struct dma_align_manager_s *manager,struct dma_align_manager_init_s *initcfg)
+{
+ manager->device=initcfg->dev;
+ manager->allocator=initcfg->allocator;
+ manager->align_buffer=manager->allocator->alloc_align_buffer(manager->device,initcfg->original_buffer_len);
+ if(manager->align_buffer==NULL)
+ {
+ return -ENOMEM;
+ }
+ manager->allocated=true;
+ return OK;
+}
+uint8_t *dma_align_manager_get_align_buffer(struct dma_align_manager_s *manager)
+{
+ return manager->align_buffer;
+}
+int dma_align_manager_finish(struct dma_align_manager_s *manager)
+{
+ if(manager->allocated)
+ {
+ if(manager->align_buffer)
Review Comment:
Why don't you use a single if? if (manager->allocated && manager->align_buffer) ?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add DMA Alignment Component and Integrate It into the MMC Driver [nuttx]
Posted by "acassis (via GitHub)" <gi...@apache.org>.
acassis commented on PR #16464:
URL: https://github.com/apache/nuttx/pull/16464#issuecomment-2927396852
@snikeguo also please don't use merge, use git rebase to kernel the git like sequence linear
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add DMA Alignment Component and Integrate It into the MMC Driver [nuttx]
Posted by "snikeguo (via GitHub)" <gi...@apache.org>.
snikeguo closed pull request #16464: Add DMA Alignment Component and Integrate It into the MMC Driver
URL: https://github.com/apache/nuttx/pull/16464
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Add DMA Alignment Component and Integrate It into the MMC Driver [nuttx]
Posted by "acassis (via GitHub)" <gi...@apache.org>.
acassis commented on PR #16464:
URL: https://github.com/apache/nuttx/pull/16464#issuecomment-2927393194
@snikeguo please run the nxstyle in your code, there are many issue that needs to be fixed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org