<< Previous | Next >>

serXdmaOn

int serXdmaOn( int tcmask, int rcmask ); /* where X is A-F */

Description

Enables DMA for serial send and receive. This function should be called directly after serXopen().

NOTE Alternatively you can use another form of this function that has been generalized for all serial ports. Instead of substituting for "X" in the function name, the function prototype is: serXdmaOn(int port, ...), where "port" is one of the macros SER_PORT_A through SER_PORT_F.

Important Flow Control Note:

Because the DMA flowcontrol uses the external request feature, only two serial ports can use DMA flowcontrol at a time. For the CTS pin, one serial port can use PD2, PE2, or PE6, and the other can use PD3, PE3 or PE7.

How DMA Serial Works:

DMA Transmit:

When a serial function is called to transmit data, a DMA transfer begins. The length of that transfer is either the length requested, or the rest of the transmit buffer size from the current position. An interrupt is fired at the end of the transmit at which time another transmit is set up if more data is ready to go.

DMA Receive:

When serXdmaOn() is called, a continuous chain of DMA transfers begins sending any data received on the serial line to the circular buffer. With flowcontrol on, there is an interrupt after each segment of the data transfer. At that point, if receiving another segment would overwrite data, the RTSoff function is called.

For more information see the description at the beginning of RS232.LIB.

Parameters

tcmask
Channel mask for DMA transmit. Use DMA_CHANNEL_ANY to choose any available channel.

rcmask
Channel mask for DMA receive. Use DMA_CHANNEL_ANY to choose any available channel.

Return Value

DMA error code or 0 for success

Library

RS232.LIB

See Also

serXdmaOff


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