<< Previous | Next >>

DMAsetParameters

int DMAsetParameters( unsigned int transfer_pri, unsigned int interrupt_pri, unsigned int inter_dma_pri, unsigned int chunkiness, unsigned int min_cpu_pct );

Description

This function sets up DMA parameters. The chunkiness parameter determines the amount of CPU time needed to transfer data according to this chart:
chunkiness

1

2

3

4

8

16

32

64

CPU_cycles

11

15

19

23

39

71

135

263

The min_cpu_pct parameter determines the minimum time between bursts and is calculated with this formula:

This is then rounded up to the nearest value out of 12, 16, 24, 32, 64, 128, 256, or 512.

Parameters

transfer_pri
DMA transfer priority (0, 1, 2 or 3), transfers can occur when the CPU interrupt priority is less than or equal to this value.

interrupt_pri
DMA interrupt priority (0, 1, 2, or 3); a value of 0 will disable the DMA interrupts.

inter_dma_pri
Relative prioritization amongst the DMA channels. It is one of the following constants:

  • DMA_IDP_FIXED - fixed priorities, with higher channel numbers taking precedence;

  • DMA_IDP_ROTATE_FINE - priorities are rotated after every byte transferred;

  • DMA_IDP_ROTATE_COARSE - priorities rotated after every transfer request, the size of which is determined by the "chunkiness" parameter.

chunkiness
Maximum transfer burst size. Allowed values are 1, 2, 3, 4, 8, 16, 32, or 64. Other numbers will be rounded down to the nearest allowed value.

min_cpu_pct
A number between 0 and 100 describing the minimum (worst-case) relative amount of time that the CPU will control the bus versus the DMA time. Internally, this function uses this figure to determine the 'minimum clocks between bursts' hardware setting. The figure will be rounded in favor of the CPU, up to the maximum possible hardware setting.

Return Value

0: Success
-EINVAL: for an error

Library

DMA.LIB


Dynamic C Functions << Previous | Next >> rabbit.com