Skip to content

Main content

DMA Transfer Alignment Margin Tool

Compute dma transfer alignment margin from explicit bounded inputs.

Loading tool…

Description

Compute remainder, zero-or-positive padding to the next boundary, and exact nextAddress.

Address calculations distinguish an occupied last byte from an exclusive end, and alignment rounds to a defined boundary. Element counts and byte counts are not interchangeable.

Compute remainder, zero-or-positive padding to the next boundary, and exact nextAddress.

When to use this tool

Use DMA Transfer Alignment Margin when you need an explicit address, alignment, page, or transfer-count mapping.

How to use the tool and how it works

  1. Enter address, alignment. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. Read aligned, nextAddress, padding. Inspect aligned before interpreting the associated values.

Require a power-of-two alignment from 1 through 65536 and a nonnegative decimal address. Compute remainder, zero-or-positive padding to the next boundary, and exact nextAddress.1

Input fieldMeaning and unitsAccepted input
addressAddressRequired. Text; maximum UTF-16 length 8192. Integer syntax: optional + or - and 1-128 decimal digits; leading zeros accepted. Apply the sign restriction above.
alignmentAlignmentRequired. Safe integer; minimum 1; maximum 65536.
Output fieldInterpretationReturned shape
alignedAlignedRequired. Boolean.
nextAddressNext AddressRequired. Text; maximum UTF-16 length 8192.
paddingUnused or added positions under the stated alignment rule.Required. Safe integer.
json
{
  "input": {
    "address": "4097",
    "alignment": 4
  },
  "output": {
    "aligned": false,
    "nextAddress": "4100",
    "padding": 3
  }
}

Limitations and assumptions

  • This aligns an address mathematically; DMA access validity, memory bounds, and device constraints are not checked.
  • Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.
  • Numeric calculations use binary floating point unless exact decimal-integer arithmetic is explicitly stated. No hidden measurement tolerance or decimal rounding is added; nonfinite or out-of-contract results are rejected. Numeric signed-zero results are exported as zero.

Alternative or Complementary methods

Validate the resulting span against actual memory bounds and device-specific access and transfer rules.

References

  1. Calculation and input contract: microcontroller/dma-transfer-alignment-margin — tool.io

Similar or alternative tools