no-OS
Loading...
Searching...
No Matches
test_dma.c File Reference

CAPI DMA memory-to-memory tests. More...

#include <stdint.h>
#include <string.h>
#include "parameters.h"
#include "test_framework.h"
#include "test_dma.h"
Include dependency graph for test_dma.c:

Functions

int test_dma (void)
 Run all DMA test cases available on the mapped platform.
 

Detailed Description

CAPI DMA memory-to-memory tests.

Exercises the DMA driver using memory-to-memory transfers that require no external hardware. On STM32F7 only DMA2 supports mem-to-mem; the platform layer (parameters.h) selects the correct stream/channel.

Every case moves real bytes through the DMA engine and verifies the destination with memcmp against an oracle held in SRAM – the tests check observable transfer behavior, never the driver's internal state or argument validation. All transfers stay inside SRAM, so the suite needs no wiring.

API coverage: capi_dma_init / capi_dma_deinit - BASIC, LIFECYCLE capi_dma_init_chan / capi_dma_deinit_chan - BASIC, LIFECYCLE capi_dma_config_xfer - all cases capi_dma_xfer_start - all cases (polling path) capi_dma_chan_is_completed - BASIC (lifecycle), all cases capi_dma_xfer_abort - ABORT capi_dma_register_complete_callback - ASYNC (skipped when no IRQ)

Behavior verified: BASIC - incrementing copy + is_completed goes false on config, true after a polled start. PATTERN - 0x00 / 0xFF / 0xAA55 / walking-ones survive intact (no stuck or aliased bits). SIZES - a length sweep copies exactly N bytes and never overruns the destination (guard bytes past N stay untouched). SRC_FIXED - src_inc = NO_INCREMENT replays src[0] into every dst byte. DST_FIXED - dst_inc = NO_INCREMENT lands the last source byte in dst[0] and leaves the rest of dst untouched. REUSE - one channel accepts many config+start cycles back to back. ABORT - abort after completion returns 0 and the channel still works. LIFECYCLE - deinit/re-init resets the singleton; a second init_chan on a live id reports -EBUSY and an out-of-range id reports -EINVAL. ASYNC - IRQ-delivered completion via a registered callback (only on platforms whose backend has an IRQ completion path).

Copyright (c) 2026 Analog Devices, Inc. SPDX-License-Identifier: BSD-3-Clause

Function Documentation

◆ test_dma()

int test_dma ( void )

Run all DMA test cases available on the mapped platform.

Returns
0 if all executed cases passed, first non-zero test error otherwise.