Jump to main content

##

# 2.31.11 DMA_ChannelPatternMatchSetup Function

## C

The prototype of this function varies based on device family. Refer to the generated header file for the actual prototype to be used.

    void DMA_ChannelPatternMatchSetup ( DMA_CHANNEL channel, DMA_PATTERN_MATCH_LEN patternLen, uint16_t matchData )

    void DMA_ChannelPatternMatchSetup(DMA_CHANNEL channel, uint32_t patternMatchMask, uint32_t patternMatchData)

## Summary

This API is used to setup DMA pattern matching.

## Description

This API is used to setup DMA pattern matching. It configures the pattern match data and pattern match length. If the pattern match length is DMA_PATTERN_MATCH_LEN_2BYTE, then matchData is 16-bit. If the pattern match length is DMA_PATTERN_MATCH_LEN_1BYTE, then the matchData is 8-bit. This API also enables pattern matching. When a pattern match occurs the transfer is aborted.

When the content of the incoming data is required in making decisions in real time, the 32-bit DMA Controller can recognize a data pattern in its internal buffer being transferred from the source to the destination locations. The pattern match capability, when enabled, allows a user-programmable data pattern to be compared against a (partial) content of DMABUF[31:0]. Upon match detection, the DMA Controller invokes its interrupt to inform the CPU to take further action

## Precondition

DMA should have been initialized by calling DMA_Initialize.

## Parameters

Param | Description
--- | ---
channel | DMA channel
patternLen | Length of the pattern match data. The value can either be DMA_PATTERN_MATCH_LEN_1BYTE or DMA_PATTERN_MATCH_LEN_2BYTE
matchData | Pattern match data. 8-bit or 16-bit depending on the value of patternLen.

Param | Description
--- | ---
channel | DMA channel
patternMatchMask | The value used to mask certain bits in the incoming data
patternMatchData | Pattern match data.

## Returns

None

## Example

    DMA_ChannelPatternMatchSetup(DMA_CHANNEL_0, DMA_PATTERN_MATCH_LEN_1BYTE, 0x0d);

    DMA_ChannelPatternMatchSetup(DMA_CHANNEL_0, 0x00FF, 0x0055);

## Remarks

None.