Skip to content

Main content

DMA Circular Buffer Half Transfer Index Tool

Calculate dma circular buffer half transfer index from explicit caller-supplied inputs.

Loading tool…

Description

Return floor(length / 2) as halfIndex and mark odd lengths.

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.

Return floor(length / 2) as halfIndex and mark odd lengths.

When to use this tool

Use DMA Circular Buffer Half Transfer Index when you need an explicit address, alignment, page, or transfer-count mapping.

How to use the tool and how it works

  1. Enter length, requireEven. 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 halfIndex, odd. Inspect odd before interpreting the associated values.

Return floor(length / 2) as halfIndex and mark odd lengths. Reject odd input only when requireEven is true.1

Input fieldMeaning and unitsAccepted input
lengthLengthRequired. Safe integer; minimum 2.
requireEvenRequire EvenRequired. Boolean.
Output fieldInterpretationReturned shape
halfIndexHalf IndexRequired. Safe integer.
oddOddRequired. Boolean.
json
{
  "input": {
    "length": 8,
    "requireEven": true
  },
  "output": {
    "halfIndex": 4,
    "odd": false
  }
}

Limitations and assumptions

  • The index is a supplied buffer split convention, not proof that hardware issues a half-transfer event there.
  • 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-circular-buffer-half-transfer-index — tool.io

Similar or alternative tools