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

Allow users to create DMA Preparations #2455

Merged
merged 1 commit into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions esp-hal/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Circular DMA transfers now correctly error, `available` returns `Result<usize,DmaError>` now (#2409)
- Interrupt listen/unlisten/clear functions now accept any type that converts into `EnumSet` (i.e. single interrupt flags). (#2442)
- SPI interrupt listening is now only available in Blocking mode. The `set_interrupt_handler` is available via `InterruptConfigurable` (#2442)
- Allow users to create DMA `Preparation`s (#2455)

### Fixed

Expand Down
11 changes: 6 additions & 5 deletions esp-hal/src/dma/buffers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ use crate::soc::is_slice_in_psram;

/// Holds all the information needed to configure a DMA channel for a transfer.
pub struct Preparation {
pub(super) start: *mut DmaDescriptor,
/// The descriptor the DMA will start from.
pub start: *mut DmaDescriptor,

/// block size for PSRAM transfers
/// Block size for PSRAM transfers
#[cfg_attr(not(esp32s3), allow(dead_code))]
pub(super) block_size: Option<DmaBufBlkSize>,
pub block_size: Option<DmaBufBlkSize>,

/// Specifies whether descriptor linked list specified in `start` conforms
/// to the alignment requirements required to enable burst transfers.
Expand All @@ -22,7 +23,7 @@ pub struct Preparation {
/// There are no additional alignment requirements for TX burst transfers,
/// but RX transfers require all descriptors to have buffer pointers and
/// sizes that are a multiple of 4 (word aligned).
pub(super) is_burstable: bool,
pub is_burstable: bool,

/// Configures the "check owner" feature of the DMA channel.
///
Expand Down Expand Up @@ -50,7 +51,7 @@ pub struct Preparation {
///
/// Note: If the DMA channel doesn't support the provided option,
/// preparation will fail.
pub(super) check_owner: Option<bool>,
pub check_owner: Option<bool>,
}

/// [DmaTxBuffer] is a DMA descriptor + memory combo that can be used for
Expand Down