Skip to content

Commit

Permalink
Allow users to create DMA Preparations
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominic Fischer committed Nov 3, 2024
1 parent b953f17 commit d283b5d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
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

0 comments on commit d283b5d

Please sign in to comment.