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

Fix EasyDMA max size. #315

Merged
merged 1 commit into from
May 11, 2021
Merged

Fix EasyDMA max size. #315

merged 1 commit into from
May 11, 2021

Conversation

Dirbaio
Copy link
Member

@Dirbaio Dirbaio commented May 10, 2021

EASY_DMA_SIZE changes based on peripheral, but it is always equal for UARTE, SPIx, TWIx, so
I've kept a single variable.

Data source is nrfx files, like this one.

I've added the values for all nrf chips, even currently unsupported ones, because they'll likely be supported soon. Can remove it if that's not wanted.

Fixes #314

EASY_DMA_SIZE changes based on peripheral, but it is always equal for UARTE, SPIx, TWIx, so
I've kept a single variable.

Data source is nrfx files, like [this one](https://github.com/NordicSemiconductor/nrfx/blob/b5399066bd7f3dc32ee15510d06ef7137bcacf36/mdk/nrf9160_peripherals.h#L150).

Fixes nrf-rs#314
Copy link
Contributor

@jonas-schievink jonas-schievink left a comment

Choose a reason for hiding this comment

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

why on earth are these all over the place...

thanks for fixing this!

bors r+

// Limits for Easy DMA - it can only read from data ram
pub const SRAM_LOWER: usize = 0x2000_0000;
pub const SRAM_UPPER: usize = 0x3000_0000;

#[cfg(any(feature = "51", feature = "52810", feature = "52832"))]
pub const FORCE_COPY_BUFFER_SIZE: usize = 255;
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we even need this constant if we already have EASY_DMA_SIZE?

Copy link
Contributor

Choose a reason for hiding this comment

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

I would say it's not necessarily bad to have a smaller force copy buffer size than the maximum allowed by DMA, because it gives less side effects with too big buffers overflowing memory unintentionally.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, stack-allocating a 64kb copy buffer wouldn't be pretty

@bors
Copy link
Contributor

bors bot commented May 11, 2021

Build succeeded:

@bors bors bot merged commit dbd46e4 into nrf-rs:master May 11, 2021
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.

EASY_DMA_SIZE is incorrect
3 participants