Skip to content

Add NoDma I2C master async bus implementation#333

Merged
tullom merged 1 commit into
OpenDevicePartnership:mainfrom
tullom:i2c-master-async-nodma
Mar 18, 2025
Merged

Add NoDma I2C master async bus implementation#333
tullom merged 1 commit into
OpenDevicePartnership:mainfrom
tullom:i2c-master-async-nodma

Conversation

@tullom
Copy link
Copy Markdown
Contributor

@tullom tullom commented Feb 28, 2025

Closes #327

Some kicking off questions:

  • The reason I need to make a new_async_nodma() fn instead of hijacking new_async() is because new_async() requires a dma_ch object that impls Peripheral and impls an interrupt with MasterDma. I tried creating structs to impl all that but I hit a wall.
  • I added documentation saying NOT to use this and to prefer new_async(), except in the cases of the Flexcomm not having DMA support. Is this enough or do you think this should be gated behind some sort of feature flag to reduce the possibility of misuse?

EDIT:
I was able to create a NoDma structure. I had to minimally modify the DMA api, specifically reserve_channel() now returns an option that will return None if NoDma is used.

@tullom tullom added the enhancement New feature or request label Feb 28, 2025
@tullom tullom self-assigned this Feb 28, 2025
@tullom tullom requested a review from sukomath February 28, 2025 00:08
Comment thread src/i2c/master.rs Outdated
Comment thread src/i2c/master.rs Outdated
@tullom tullom moved this to In review in ODP Backlog Feb 28, 2025
Comment thread src/i2c/master.rs Outdated
Comment thread src/i2c/master.rs Outdated
@tullom tullom force-pushed the i2c-master-async-nodma branch 5 times, most recently from 76988a3 to a9ffcd8 Compare March 5, 2025 22:59
@tullom
Copy link
Copy Markdown
Contributor Author

tullom commented Mar 6, 2025

FYI @jerrysxie @felipebalbi
I was able to create a NoDma structure. I had to minimally modify the DMA api, specifically reserve_channel() now returns an option that will return None if NoDma is used. Needed to slightly modify the UART driver and hashcrypt driver as well (is surface using these APIs? I can go and send out PRs to fix if needed) to return errors if NoDma is used since it doesn't make sense if NoDma is used.

Tested all touched drivers via examples on hardware and it works flawlessly.

Comment thread src/i2c/mod.rs
Comment thread src/hashcrypt/mod.rs Outdated
@tullom tullom force-pushed the i2c-master-async-nodma branch 2 times, most recently from 5e6e395 to cd30037 Compare March 14, 2025 17:53
@tullom tullom requested a review from felipebalbi March 14, 2025 17:56
@tullom tullom force-pushed the i2c-master-async-nodma branch from cd30037 to 93a9645 Compare March 18, 2025 21:56
@tullom tullom merged commit 35d4306 into OpenDevicePartnership:main Mar 18, 2025
@github-project-automation github-project-automation Bot moved this from In review to Done in ODP Backlog Mar 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Implement NoDma for I2C Master

5 participants