Skip to content

Fix EasyDMA max size.#315

Merged
bors[bot] merged 1 commit intonrf-rs:masterfrom
Dirbaio:fix-easydma-max-size
May 11, 2021
Merged

Fix EasyDMA max size.#315
bors[bot] merged 1 commit intonrf-rs:masterfrom
Dirbaio:fix-easydma-max-size

Conversation

@Dirbaio
Copy link
Copy Markdown
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

@Dirbaio Dirbaio force-pushed the fix-easydma-max-size branch from fccbc95 to 47bb76b Compare May 10, 2021 20:16
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
@Dirbaio Dirbaio force-pushed the fix-easydma-max-size branch from 47bb76b to 35282f8 Compare May 10, 2021 20:18
Copy link
Copy Markdown
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+

Comment thread nrf-hal-common/src/lib.rs
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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