Rabbit 4000 Microprocessor
User's Manual
PREV INDEX NEXT


19. DMA Channels

19.1 Overview

There are eight independent DMA channels on the Rabbit 4000. All eight channels are identical, and are capable of transferring data to or from memory, external I/O, or internal I/O. The priority between the channels can be either fixed or rotating, and the DMA use of the bus can be limited to guarantee interrupt latency or CPU throughput. The DMA channels are capable of special handling for the last byte of data when sending data to selected internal I/O addresses (such as the HDLC serial ports or to the Ethernet peripheral), and can also transfer end-of-frame status after transferring data from selected internal I/O addresses.

The DMA channels can watch the data being transferred and can terminate a transfer when a particular byte is matched. A mask is available for the byte match to allow termination only on particular bit settings in the data instead of an exact byte match.

Memory-to-memory transfers proceed at the maximum transfer rate unless they are gated by an external request signal or the internal timed request. Transfers to or from a number of internal I/O addresses are controlled by transfer request signals. These transfer request signals are connected automatically as a function of the internal I/O address loaded into the DMA channel. Note that if both the source and the destination are internal I/O, the source transfer request is used by the DMA channel.

The DMA channels are inherently byte-oriented, so while DMA transfers can be done from a 16-bit memory, DMA transfers to a 16-bit memory can only be done if the 16-bit memory is set up to allow byte writes. See Chapter 5 for more information.

There are two inputs available for requests linked to external I/O devices. These two external requests may be assigned to any DMA channel. These requests may also be used by a channel that has an internal I/O as a destination. In this case, the external request acts as a "flow control" signal for the DMA transfers because the external request is "ANDed" with the automatically connected internal request.

To facilitate periodic DMA transfers, there is also an internal timed request. This request is generated from a programmable 16-bit counter and may be assigned to any DMA channel. As in the case of the external requests, this request is "ANDed" with any internal or external request that is also assigned to that DMA channel. This periodic request can be programmed to transfer one byte or an entire buffer. The single-byte option is useful for driving an output port to create a sampled waveform, while the entire-buffer option can be used, for example, to send precisely timed serial messages over a serial port.

The DMA operation is controlled by memory structures called buffer descriptors. The current buffer descriptor resides in the registers of the DMA channel, but may have been placed there either by the processor or loaded directly by the DMA channel itself. Buffer descriptors may be used singly, to transfer one block of data, or they may be linked together for "scatter-gather" operation. Each DMA channel also contains an "initial address" that points to the first buffer descriptor in memory and allows the DMA channel to rewind itself automatically in the case of a transmit retry by the network port. Each buffer descriptor contains a control byte, a byte count for the data, a source address, a destination address, and an optional link address. In addition, each DMA channel retains a count of the number of bytes remaining in the buffer to allow software to determine the amount of valid data in a buffer that are terminated early by the source of the data.

A buffer descriptor in memory consists of either 12 or 16 consecutive bytes organized as shown in Table 19-1. The DMA channel uses the information in the control byte to determine the length of the buffer descriptor as well as which information to fetch from the buffer descriptor. If no link address field is present, the buffer descriptor is only 12 bytes long. A memory address for either source or destination causes the DMA channel to fetch three bytes from the corresponding field in the buffer descriptor. An internal I/O or external I/O address for either source or destination causes the DMA channel to fetch two bytes from the corresponding field in the buffer descriptor.

DMA memory addresses are always physical addresses, and are never translated by the MMU. All DMA memory addresses use the memory control signals, wait states, and flipped bits as selected in the Master Memory Bank Control registers. All DMA external I/O addresses use the I/O control signals and wait states as selected in the external I/O registers.

The first byte in the first buffer descriptor (the byte pointed to by the initial address) is reserved for status information when transferring data from an internal serial or network device. This automatic status transfer means that the processor does not need to service any interrupts from a serial or network receiver except in the case of an error condition.

When transferring data to an internal HDLC serial or network transmitter, the last byte of the last buffer will automatically be written to a special destination address to tag the data as the last in the frame, without processor intervention. However, this function is not available in the case where the buffer contains only one byte of data. If this case should occur, the buffer descriptor must contain the special destination address.

All the DMA channels request interrupts at the same priority level, which is set by a field in the DMA Master Control Register, but each DMA channel has its own interrupt vector location. This speeds up interrupt processing for the DMA interrupts by eliminating the need to resolve which DMA channel is actually requesting an interrupt.

DMA transfers may be programmed to occur at any priority level. If the programmed level is greater than or equal to the current CPU operating level, DMA transfers will occur on demand. When the CPU operating level is greater than the programmed DMA operating level, no DMA transfers can occur. This allows interrupt services routines, or other critical code, to run with a guarantee that there will be no DMA activity during execution. Note that a simultaneous interrupt request and DMA transfer request will be resolved in favor of the DMA transfer request.

The DMA and Ethernet peripherals were optimized to work together; if the Rabbit 4000's built-in Ethernet peripheral is used it is expected that two DMA channels will be dedicated for that purpose.

19.1.1 Block Diagram

19.1.2 Registers

Register Name

Mnemonic

I/O Address

R/W

Reset

DMA Master Control/Status Register
DMCSR
0x0100
R/W
00000000
DMA Master Auto-load Register
DMALR
0x0101
W
00000000
DMA Master Halt Register
DMHR
0x0102
W
00000000
DMA y Buffer Complete Register
DyBCR
0x01y3
R
00000000
DMA Master Control Register
DMCR
0x0104
R/W
00000000
DMA Master Timing Control Register
DMTCR
0x0105
R/W
00000000
DMA Master Request 0 Control Register
DMR0CR
0x0106
R/W
00000000
DMA Master Request 0 Control Register
DMR1CR
0x0107
R/W
00000000
DMA Timed Request Control Register
DTRCR
0x0115
R/W
00000000
DMA Timed Request Divider Low Register
DTRDLR
0x0116
R/W
xxxxxxxx
DMA Timed Request Divider High Register
DTRDHR
0x0117
R/W
xxxxxxxx
DMA y Termination Byte Register
DyTBR
0x01y8
R/W
xxxxxxxx
DMA y Termination Mask Register
DyTMR
0x01y9
R/W
00000000
DMA y Buffer Unused [7:0] Register
DyBU0R
0x01yA
R
00000000
DMA y Buffer Unused [15:8] Register
DyBU1R
0x01yB
R
00000000
DMA y Initial Address [7:0] Register
DyIA0R
0x01yC
R/W
xxxxxxxx
DMA y Initial Address [15:8] Register
DyIA1R
0x01yD
R/W
xxxxxxxx
DMA y Initial Address [23:16] Register
DyIA2R
0x01yE
R/W
xxxxxxxx
DMA y State Machine Register
DySMR
0x01z0 (z = y + 8)
R
11111111
DMA y Control Register
DyCR
0x01z1 (z = y + 8)
R/W
00000000
DMA y Buffer Length [7:0] Register
DyL0R
0x01z2 (z = y + 8)
R/W
xxxxxxxx
DMA y Buffer Length [15:8] Register
DyL1R
0x01z3 (z = y + 8)
R/W
xxxxxxxx
DMA y Source Address [7:0] Register
DySA0R
0x01z4 (z = y + 8)
W
xxxxxxxx
DMA y Source Address [15:8] Register
DySA1R
0x01z5 (z = y + 8)
W
xxxxxxxx
DMA y Source Address [23:16] Register
DySA2R
0x01z6 (z = y + 8)
W
xxxxxxxx
DMA y Destination Address [7:0] Register
DyDA0R
0x01z8 (z = y + 8)
W
xxxxxxxx
DMA y Destination Address [15:8] Register
DyDA1R
0x01z9 (z = y + 8)
W
xxxxxxxx
DMA y Destination Address [23:16] Register
DyDA2R
0x01zA (z = y + 8)
W
xxxxxxxx
DMA y Link Address [7:0] Register
DyLA0R
0x01zC (z = y + 8)
R/W
xxxxxxxx
DMA y Link Address [15:8] Register
DyLA1R
0x01zD (z = y + 8)
R/W
xxxxxxxx
DMA y Link Address [23:16] Register
DyLA2R
0x01zE (z= y + 8)
R/W
xxxxxxxx


NOTE The y in "DMA y ..." expresses the DMA channel number (0–7).

19.2 Dependencies

19.2.1 I/O Pins

External DMA Request 0 can be enabled from pins PD2, PE2, or PE6. External DMA Request 1 can be enabled from pins PD3, PE3, or PE7.

The DMA can use either the memory management unit or the auxiliary I/O bus to perform its transfers, and so will use the appropriate pins for each operation.

19.2.2 Clocks

The DMA peripheral uses the peripheral clock for all operations. If the timed request option is enabled, then the 16-bit timed request counter will be clocked by the peripheral clock and will provide a DMA request each time it counts down to zero.

19.2.3 Interrupts

Each DMA channel has its own dedicated interrupt that can occur at the end of any DMA transfer, as specified in DyCR (normally loaded from the buffer descriptor). The interrupt request is automatically cleared when the interrupt is handled.

The DMA interrupt vectors are in the EIR starting at offset 0x080 for DMA Channel 0 and ending at offset 0x0F0 for DMA Channel 7. They can be set as Priority 1, 2, or 3.

19.3 Operation

It is possible to set up and start a DMA operation by writing directly to all the relevant address, length, and control registers, but it is expected that the typical operation would be to create a buffer descriptor in memory, write the address of that descriptor to the initial address registers (DyIAnR), and use a write to DMALR to auto-load the values from memory into the registers and start the transfer. The DMA transfer will then continue reading buffer descriptors until a buffer-marked halt is completed.

The descriptor can be either 12 or 16 bytes in length; a bit in the channel control byte (which corresponds to DyCR) selects whether the link address is present or not. The processor skips the read of those bytes if a 12-byte descriptor is selected, and always skips the reads of the bytes marked "not used."

Table 19-1. DMA Buffer Descriptor

Byte 0

Byte 1

Byte 2

Byte 3

Bytes 0–3
Frame Status
Channel Control
Buffer Length [15:0]
Bytes 4–7
Source Address [23:0]
Not Used
Bytes 8–11
Destination Address [23:0]
Not Used
Bytes 12–15
Link Address [23:0]
Not Used


It is possible to abort a DMA transfer by writing the appropriate bit to the halt register, DMHR. It is also possible to restart a DMA transfer using the already-loaded register values by writing to DMCSR.

The following steps explain how to set up a DMA channel.

  1. Select the DMA transfer and interrupt priorities by writing to DMCR.

  2. Select the DMA channel priority, maximum bytes per burst, and minimum clocks between bursts by writing to DMTCR.

  3. Write the interrupt vector for the interrupt service routine to the external interrupt table.

  4. Enable an external request line by writing to DMR0CR or DMR1CR. Make sure that the pin selected is set up as an input. Note that this enable will be logical-ANDed to any internal DMA enables if the DMA transfer is to/from an internal peripheral.

  5. Enable the internal-timed transfer request by writing to DTRCR. Select the divider value by writing to DTRDLR and DTRDHR. Note that this enable will be logical-ANDed to any internal DMA enables if the DMA transfer is to/from an internal peripheral.

  6. Select a byte to terminate the transfer on by writing to the appropriate DyTBR and DyTMR registers.

  7. The desired control, length, and address registers should be written to a buffer descriptor (or descriptors) in memory if not done already.

  8. The initial address registers (DyIAnR) should be loaded with the physical address of the first buffer descriptor.

  9. The buffer descriptor can be loaded and the DMA transfer started by writing to the appropriate bit of DMALR.

19.3.1 Handling Interrupts

The DMA interrupt request is cleared automatically when the interrupt is handled. A DMA interrupt will occur at the end of a transfer for any buffer descriptor that has bit 4 of DyCR set.

19.3.2 Example ISR

A sample interrupt handler is shown below.

19.3.3 DMA Priority with the Processor

Since the Rabbit 4000 DMA uses the memory management unit to perform transfers, normal code execution cannot occur while the DMA is active. This includes handling interrupts, so it is important to limit the amount of time that the DMA can operate.

This is handled in several ways. First of all, the DMA transfers can be set to take place whenever the processor is operating at one of the four priority levels, 0–3 (note that there is a single priority level for all DMA transfers). Setting an interrupt priority to something greater than the DMA transfer priority will ensure that no DMA activity occurs during that interrupt handler. Note that when both an interrupt and a DMA transfer are pending, the DMA transfer will be selected for execution first (provided its priority is equal or greater than the current processor priority level).

Table 19-2. DMA Transfer Priority

DMA Transfers at

Operation

Priority 0
DMA transfers only allowed when
processor priority at 0
Priority 1
DMA transfers only allowed when
processor priority at 0 or 1
Priority 2
DMA transfers only allowed when
processor priority at 0, 1, or 2
Priority 3
DMA transfers allowed at any time


When a DMA transfer is occurring, normal code execution will not occur until the transfer is completed. To prevent DMA transfers from excessively blocking interrupts or otherwise interfering with normal code execution, two options can be set in DMTCR. First, the maximum limit of a DMA transfer can be set from 1 to 64 bytes, which sets an upper limit on interrupt latency arising from a DMA transfer. Second, the minimum number of clocks before the DMA can be active again can be set from 12 to 512 clocks, guaranteeing processing time for the application.

The values providing roughly equal access to the memory bus for both the processor and the DMA is eight bytes per burst and 64 clocks between bursts.

When starting up, the DMA requires several cycles of overhead. This overhead comes about because the DMA actually uses part of the processor to perform the data transfers, and consists of one instruction fetch time plus three clock cycles. The byte fetched during the instruction fetch time is discarded, and will be refetched at the completion of the DMA burst. At the end of the DMA burst, two clock cycles are required before this first instruction fetch starts. An individual DMA channel transfers data without any overhead between bytes, but there is always one clock cycle of dead time when switching between DMA channels. Table 19-3 shows the number of clock cycles required per burst, assuming a single DMA channel transfer and no wait states.

Table 19-3. Maximum DMA Transfer Rates

Setting

Total Clocks

Clocks per Byte Transferred

1 byte per burst
11 clocks
11
2 bytes per burst
15 clocks
7.5
3 bytes per burst
19 clocks
6.3
4 bytes per burst
23 clocks
5.8
8 bytes per burst
39 clocks
4.9
16 bytes per burst
71 clocks
4.4
32 bytes per burst
135 clocks
4.2
64 bytes per burst
263 clocks
4.1


The total number of clocks listed in Table 19-3 is related to the number of bystes per burst by the following formula.

19.3.4 DMA Channel Priority

It is possible to control the priority between separate DMA channels. There are three channel-priority options in the Rabbit 4000. The first is fixed priority after every byte where the priority of each channel is equal to its number, i.e., if both DMA Channels 3 and 4 have a pending transfer request, DMA Channel 4 will always be enabled first. If at any point a channel with higher priority than the one currently transferring has a DMA request pending, the current transfer will be terminated and the new channel's transfer will start. With this setting, DMA Channel 7 will always have priority over all other channels, and DMA Channel 0 will transfer only if no other channels have pending requests.

The other two settings rotate the priority between channels as shown in Table 19-4; after the seventh rotation, the priority sequence restarts at the top of the table. One option is to rotate priority after every byte analogous to the fixed-priority setting. The priority list is updated after each byte transferred, and if a higher priority channel has a pending request the current transfer will be terminated and the new channel transfer will start. The other option is to rotate after every burst; this will guarantee that reasonable amounts of data are transferred by each channel before a switchover occurs.

Table 19-4. Rotating DMA Channel Priority

Rotation

Channel Priority, High to Low

Initial (and eighth)
7, 6, 5, 4, 3, 2, 1, 0
First
6, 5, 4, 3, 2, 1, 0, 7
Second
5, 4, 3, 2, 1, 0, 7, 6
Third
4, 3, 2, 1, 0, 7, 6, 5
Fourth
3, 2, 1, 0, 7, 6, 5, 4
Fifth
2, 1, 0, 7, 6, 5, 4, 3
Sixth
1, 0, 7, 6, 5, 4, 3, 2
Seventh
0, 7, 6, 5, 4, 3, 2, 1


19.3.5 Buffer Descriptor Modes

Flags in the control byte of a buffer descriptor (which gets loaded into DyCR) describe whether to halt on completion of the transfer (or load another descriptor) and whether the next descriptor is adjacent in memory (which implies that the current descriptor is only 12 bytes long) or located at the link address. Each descriptor can also be set to generate an interrupt on completion of the transfer. By using these options in various ways, the Rabbit 4000 DMA can be operated in a number of conventional DMA modes.

The most common options are described here; others are certainly possible by different use of the available linking methods.

19.3.5.1 Single Buffer

In the simplest mode, a single descriptor is set to halt and interrupt on completion.


19.3.5.2 Buffer Array

In this mode, an array of 12-byte descriptors is set up adjacent in memory; only the last buffer is set to halt on completion. The last buffer is also typically set to interrupt on completion, but other buffer descriptors in the array can also generate interrupts.


The advantage of the buffer array is that its descriptors require less memory than a full 16-byte descriptor.

The simplest version of the buffer array is a double buffer, which is frequently used to provide a reserve buffer in case the application is slow in handling the first buffer once received (in this case, both buffers are enabled to interrupt on completion).

19.3.5.3 Linked List

A linked list is similar to a buffer array, except that 16-byte descriptors are used and the descriptors are not necessarily adjacent in memory. The advantage of this mode is the ability to spread descriptors.


19.3.5.4 Circular Queue

A circular queue is a buffer array or linked list where the final buffer is linked back to the first buffer in the sequence. This method allows for continuous reception of transfers without having to reload the initial address for the DMA buffer descriptor sequence.

The "ping-pong buffer," where there are only two buffers, is the simplest version of a circular queue. The application can operate on one buffer while the other buffer is being loaded.

19.3.5.5 Linked Array

The linked array is simply a linked list of buffer arrays, where the last buffer in each array is linked to the first buffer in the next array (which can be located anywhere in memory). This method could be useful where a message is broken down into separate transfers, but entire messages could be scattered/gathered from anywhere in memory.

19.3.6 DMA with Peripherals

When the DMA is directed towards an internal I/O address, the DMA transfer request signals will be connected as appropriate for that peripheral. For example, when a DMA transfer is performed to Serial Port D's data register, the transfer request will be enabled whenever the serial port transmit buffer is empty, and will be disabled whenever it is not.

19.3.6.1 DMA with HDLC Serial Ports

The HDLC serial ports receive special handing by the DMA. When the DMA destination is Serial Port E's or Serial Port F's data register (SxDR), the final byte of the transfer will be written to the appropriate last data register (SxLDR) as required to complete an HDLC packet and append the CRC value. In addition, the value in the appropriate status register (SxSR) will be written to the status byte in the buffer descriptor pointed to by the initial address registers (not necessarily the buffer descriptor that is currently being used). These features allow an application to automatically send and receive packets via DMA, only requiring direct handling of a packet when an error occurs.

19.3.6.2 DMA with Ethernet

The Ethernet network peripheral also receives special handing by the DMA. When the DMA destination is the network data register (NADR), the final byte of the transfer will be written to the last data register (NALDR) as required to complete an Ethernet packet and append the CRC value. In addition, the value in the network status register (NASR) will be written to the status byte in the buffer descriptor pointed to by the initial address registers (not necessarily the buffer descriptor that is currently being used). These features allow the processor to only handle interrupts when an error occurs.

19.3.6.3 DMA with PWM and Timer C

The PWM and Timer C peripherals have special support for DMA; the block access and pointer registers in each of these peripherals provide a means for the DMA to update the settings of these peripherals at some desired rate. This allows complex PWM waveforms to be generated by using the DMA timed request to update the PWM duty cycles at regular intervals.

19.3.7 DMA Bug Workarounds (Appendix B.2)

19.3.7.1 DMA/HDLC/Ethernet Interaction

A specific bug can manifest itself when the following conditions are present.

· The HDLC or Ethernet peripherals are being fed bytes for transmit via DMA.
· The current DMA buffer has been marked with "special treatment for last byte."
· The buffer has not been marked as "final buffer."
· The DMA fills the transmit FIFO with the next-to-last byte of the buffer and then either switches to another channel or releases the bus.
· The DMA then returns to the channel before the transmitter has had a chance to transmit a single byte, freeing space in the transmit FIFO.

When all these conditions occur, the DMA will overwrite the next-to-last byte in the transmit FIFO, and that particular byte will never be transmitted.

There are several ways to avoid this bug.

· Always mark the buffer that contains the end-of-frame byte as the final buffer, and restart the DMA once that buffer has been transmitted.
· Make sure that the DMA will not return to this channel before the transmitter has sent one byte from the transmit FIFO.
· Place the end-of-frame byte in a separate DMA buffer.

The Ethernet driver provided by Rabbit Semiconductor in Dynamic C is written so that this bug never occurs.

19.3.8 DMA/Block Copy Interaction

When a DMA transfer occurs during a block copy instruction (LDIR, LDDR, COPY, COPYR, UMA, or UMS) while executing code out of 16-bit memory with the "advanced 16-bit mode" enabled, the code prefetch queue and program counter will become out-of-synch. This means that one or two incorrect bytes (depending on the 16-bit alignment of the instruction) are reloaded and presented to the processor as instructions when execution is "rewound" after the DMA transfer. The result of this mismatch is that the block copy instruction does not complete.

The only way to prevent this from occurring is to prevent DMA transfers during block copy instructions, either by disabling the DMA or by increasing the processor priority above the priority of the DMA transfer.

There is a workaround. The processor's BC register is used as a program counter by the block copy instructions, and will be nonzero if the block copy instruction did not complete. By checking the value of BC and jumping back to the block copy instruction if it is nonzero, the block copy instruction is restarted with all the current register values (source and destination pointers) and will continue where it left off. Rabbit Semiconductor's Dynamic C compiler automatically includes this wrapper code whenever it identifies a block copy instruction.

19.3.9 Single-Byte DMA Requests to internal I/O Registers

When timed or external DMA requests are enabled and set to transfer a single byte at a time to an internal I/O register, two bytes will actually be transferred. The simplest workaround is to double each data byte in the buffer; two bytes will be transmitted, but they will be identical, so the actual I/O register setting will not change.

19.4 Register Descriptions

DMA Master Control/Status Register (DMCSR) (Address = 0x0100)

Bit(s)

Value

Description

7:0
0
No effect on the corresponding DMA channel.
(Write-only)
1
Start (or restart) the corresponding DMA channel using the contents of the DMA channel registers. This command should only be issued after all the DMA channel registers (source, destination, length, and link if applicable) have been loaded.
7:0
0
The corresponding DMA channel is either disabled or has completed the last buffer descriptor.
(Read-only)
1
The corresponding DMA channel is enabled and active. These bits are set by the start command and remain set until the completion of the last buffer.


DMA Master Auto-Load Register (DMALR) (Address = 0x0101)

Bit(s)

Value

Description

7:0
0
No effect of the corresponding DMA channel.
1
Start (using auto-load) the corresponding DMA channel, using the buffer descriptor in memory addressed by the channel initial address register. This command should only be issued after the initial address has been loaded.


DMA Master Halt Register (DMHR) (Address = 0x0102)

Bit(s)

Value

Description

7:0
0
No effect of the corresponding DMA channel.
1
Halt the corresponding DMA channel. The DMA registers retain the current state, and the DMA can be restarted using the DMCSR.


DMA y Buffer Complete Register (D0BCR) (Address = 0x0103)
(D1BCR) (Address = 0x0113)
(D2BCR) (Address = 0x0123)
(D3BCR) (Address = 0x0133)
(D4BCR) (Address = 0x0143)
(D5BCR) (Address = 0x0153)
(D6BCR) (Address = 0x0163)
(D7BCR) (Address = 0x0173)

Bit(s)

Value

Description

7:0
Read
The DMA increments a counter at the start of the next buffer. This count is latched in this register and can be used, along with the buffer unused count, to determine the actual amount of data transferred by the DMA. This counter is initialized by a start command or when the DMA is automatically rewound to the initial address.
Write
Writing to this register loads the counter. This feature is intended only for testing, because the DMA automatically resets the counter to all ones when fetching from the initial address. The counter is incremented whenever the DMA fetches a new buffer length value from a descriptor.


DMA Master Control Register (DMCR) (Address = 0x0104)

Bit(s)

Value

Description

7:4
These bits are reserved and should be written with zeros.
3:2
00
DMA transfers at Priority 0. No DMA transfers while CPU operates at Priority 3, 2, or 1.
01
DMA transfers at Priority 1. No DMA transfers while CPU operates at Priority 3 or 2.
10
DMA transfers at Priority 2. No DMA transfers while CPU operates at Priority 3.
11
DMA transfers at Priority 3. DMA transfers at any time.
1:0
00
DMA interrupts are disabled.
01
DMA interrupts use Interrupt Priority 1.
10
DMA interrupts use Interrupt Priority 2.
11
DMA interrupts use Interrupt Priority 3.


DMA Master Timing Control Register (DMTCR) (Address = 0x0105)

Bit(s)

Value

Description

7:6
0x
Fixed DMA channel priority. Higher channel number has higher priority.
10
Rotating DMA channel priority. Priority rotates highest channel number to lowest channel number after every byte is transferred.
11
Rotating DMA channel priority. Priority rotates highest channel number to lowest channel number after the current channel request is serviced.
5:3
000
Maximum one byte per burst.
001
Maximum two bytes per burst.
010
Maximum three bytes per burst.
011
Maximum four bytes per burst.
100
Maximum eight bytes per burst.
101
Maximum 16 bytes per burst.
110
Maximum 32 bytes per burst.
111
Maximum 64 bytes per burst.
2:0
000
Minimum 12 clocks between bursts.
001
Minimum 16 clocks between bursts.
010
Minimum 24 clocks between bursts.
011
Minimum 32 clocks between bursts.
100
Minimum 64 clocks between bursts.
101
Minimum 128 clocks between bursts.
110
Minimum 256 clocks between bursts.
111
Minimum 512 clocks between bursts.


DMA Master Request 0 Control Register (DMR0CR) (Address = 0x0106)

Bit(s)

Value

Description

7:6
00
External DMA Request 0 disabled.
01
External DMA Request 0 enabled from Parallel Port D2.
10
External DMA Request 0 enabled from Parallel Port E2.
11
External DMA Request 0 enabled from Parallel Port E6.
5
This bit is reserved and should be written with zero.
4:3
00
External DMA Request 0 falling-edge triggered. One transfer per request.
01
External DMA Request 0 rising-edge triggered. One transfer per request.
10
External DMA Request 0 active low. Transfers continue while low.
11
External DMA Request 0 active high. Transfers continue while high.
2:0
000
External DMA Request 0 supplied to DMA Channel 0.
001
External DMA Request 0 supplied to DMA Channel 1.
010
External DMA Request 0 supplied to DMA Channel 2.
011
External DMA Request 0 supplied to DMA Channel 3.
100
External DMA Request 0 supplied to DMA Channel 4.
101
External DMA Request 0 supplied to DMA Channel 5.
110
External DMA Request 0 supplied to DMA Channel 6.
111
External DMA Request 0 supplied to DMA Channel 7.


DMA Master Request 1 Control Register (DMR1CR) (Address = 0x0107)

Bit(s)

Value

Description

7:6
00
External DMA Request 1 disabled.
01
External DMA Request 1 enabled from Parallel Port D3.
10
External DMA Request 1 enabled from Parallel Port E3.
11
External DMA Request 1 enabled from Parallel Port E7.
5
This bit is reserved and should be written with zero.
4:3
00
External DMA Request 1 falling edge triggered. One byte per request.
01
External DMA Request 1 rising edge triggered. One transfer per request.
10
External DMA Request 1 active low. Transfers continue while low.
11
External DMA Request 1 active high. Transfers continue while high.
2:0
000
External DMA Request 1 supplied to DMA Channel 0.
001
External DMA Request 1 supplied to DMA Channel 1.
010
External DMA Request 1 supplied to DMA Channel 2.
011
External DMA Request 1 supplied to DMA Channel 3.
100
External DMA Request 1 supplied to DMA Channel 4.
101
External DMA Request 1 supplied to DMA Channel 5.
110
External DMA Request 1 supplied to DMA Channel 6.
111
External DMA Request 1 supplied to DMA Channel 7.


DMA Timed Request Control Register (DTRCR) (Address = 0x0115)

Bit(s)

Value

Description

7
0
Timed DMA request disabled.
1
Timed DMA request enabled.
6:5
These bits are reserved and should be written with zeros.
4:3
00
Timed DMA request transfers one byte per request.
01
This bit combination is reserved and should not be used.
10
Timed DMA request triggers transfers until current descriptor is complete. DMA channel fetches the next descriptor if appropriate.
11
This bit combination is reserved and should not be used.
2:0
000
Timed DMA request supplied to DMA Channel 0.
001
Timed DMA request supplied to DMA Channel 1.
010
Timed DMA request supplied to DMA Channel 2.
011
Timed DMA request supplied to DMA Channel 3.
100
Timed DMA request supplied to DMA Channel 4.
101
Timed DMA request supplied to DMA Channel 5.
110
Timed DMA request supplied to DMA Channel 6.
111
Timed DMA request supplied to DMA Channel 7.


DMA Timed Request Divider Low Register (DTRDLR) (Address = 0x0116)

Bit(s)

Value

Description

7:0
Write
The eight LSBs of the limit value for the DMA timed request timer are stored.


DMA Timed Request Divider High Register (DTRDHR) (Address = 0x0117)

Bit(s)

Value

Description

7:0
Write
The eight MSBs of the limit value for the DMA timed request timer are stored.


DMA y Termination Byte Register (D0TBR) (Address = 0x0108)
(D1TBR) (Address = 0x0118)
(D2TBR) (Address = 0x0128)
(D3TBR) (Address = 0x0138)
(D4TBR) (Address = 0x0148)
(D5TBR) (Address = 0x0158)
(D6TBR) (Address = 0x0168)
(D7TBR) (Address = 0x0178)

Bit(s)

Value

Description

7:0
Byte value that, if matched, will terminate a buffer.


DMA y Termination Mask Register (D0TMR) (Address = 0x0109)
(D1TMR) (Address = 0x0119)
(D2TMR) (Address = 0x0129)
(D3TMR) (Address = 0x0139)
(D4TMR) (Address = 0x0149)
(D5TMR) (Address = 0x0159)
(D6TMR) (Address = 0x0169)
(D7TMR) (Address = 0x0179)

Bit(s)

Value

Description

7:0
Mask for termination byte. A one in a bit position enables the corresponding bit of the termination byte to be used in the compare to generate the termination condition. A zero in a bit position disables the corresponding bit from contributing to the termination condition. A value of all zeros in this register disables the termination-byte match feature.

DMA y Buffer Unused[7:0] Register (D0BU0R) (Address = 0x010A)
(D1BU0R) (Address = 0x011A)
(D2BU0R) (Address = 0x012A)
(D3BU0R) (Address = 0x013A)
(D4BU0R) (Address = 0x014A)
(D5BU0R) (Address = 0x015A)
(D6BU0R) (Address = 0x016A)
(D7BU0R) (Address = 0x017A)

Bit(s)

Value

Description

7:0
Bits 7:0 of the buffer unused length value are stored in this register. The DMA copies the buffer remaining length to this register at the completion of the transfer. Normally the buffer remaining length is zero, but if the transfer terminates early, under source control or because of a termination-byte match, the number of unused bytes in the buffer is written.


DMA y Buffer Unused[15:8] Register (D0BU1R) (Address = 0x010B)
(D1BU1R) (Address = 0x011B)
(D2BU1R) (Address = 0x012B)
(D3BU1R) (Address = 0x013B)
(D4BU1R) (Address = 0x014B)
(D5BU1R) (Address = 0x015B)
(D6BU1R) (Address = 0x016B)
(D7BU1R) (Address = 0x017B)

Bit(s)

Value

Description

7:0
Bits 15:8 of the buffer unused-length value are stored in this register.


DMA y Initial Addr[7:0] Register (D0IA0R) (Address = 0x010C)
(D1IA0R) (Address = 0x011C)
(D2IA0R) (Address = 0x012C)
(D3IA0R) (Address = 0x013C)
(D4IA0R) (Address = 0x014C)
(D5IA0R) (Address = 0x015C)
(D6IA0R) (Address = 0x016C)
(D7IA0R) (Address = 0x017C)

Bit(s)

Value

Description

7:0
Bits 7:0 of the initial address are stored in this register.


DMA y Initial Addr[15:8] Register (D0IA1R) (Address = 0x010D)
(D1IA1R) (Address = 0x011D)
(D2IA1R) (Address = 0x012D)
(D3IA1R) (Address = 0x013D)
(D4IA1R) (Address = 0x014D)
(D5IA1R) (Address = 0x015D)
(D6IA1R) (Address = 0x016D)
(D7IA1R) (Address = 0x017D)

Bit(s)

Value

Description

7:0
Bits 15:8 of the initial address are stored in this register.


DMA y Initial Addr[23:16] Register (D0IA2R) (Address = 0x010E)
(D1IA2R) (Address = 0x011E)
(D2IA2R) (Address = 0x012E)
(D3IA2R) (Address = 0x013E)
(D4IA2R) (Address = 0x014E)
(D5IA2R) (Address = 0x015E)
(D6IA2R) (Address = 0x016E)
(D7IA2R) (Address = 0x017E)

Bit(s)

Value

Description

7:0
Bits 23:16 of the initial address are stored in this register.


DMA y State Machine Register (D0SMR) (Address = 0x0180)
(D1SMR) (Address = 0x0190)
(D2SMR) (Address = 0x01A0)
(D3SMR) (Address = 0x01B0)
(D4SMR) (Address = 0x01C0)
(D5SMR) (Address = 0x01D0)
(D6SMR) (Address = 0x01E0)
(D7SMR) (Address = 0x01F0)

Bit(s)

Value

Description

7:0
11111110
Idle (disabled).
11111100
Fetching control byte next (during start-up).
11111010
Fetching control byte next (during chaining).
11110100
Fetching Byte Count 0 next.
11110010
Fetching Byte Count 1 next.
11101110
Fetching Source Address 0 next.
11101100
Fetching Source Address 1 next.
11101010
Fetching Source Address 2 next.
11011110
Fetching Destination Address 0 next.
11011100
Fetching Destination Address 1 next.
11011010
Fetching Destination Address 2 next.
10111110
Fetching Link Address 0 next.
10111100
Fetching Link Address 1 next.
10111010
Fetching Link Address 2 next.
01111110
Transferring data next.
01111100
Transferring receive status next.
01111010
Transferring last received byte next.
01111000
Transferring last transmitted byte next.


DMA y Control Register (D0CR) (Address = 0x0181)
(D1CR) (Address = 0x0191)
(D2CR) (Address = 0x01A1)
(D3CR) (Address = 0x01B1)
(D4CR) (Address = 0x01C1)
(D5CR) (Address = 0x01D1)
(D6CR) (Address = 0x01E1)
(D7CR) (Address = 0x01F1)

Bit(s)

Value

Description

7
0
Continue to next buffer descriptor.
1
Final buffer descriptor. Stop DMA operation upon completion of this transfer.
6
0
Use sequential address for next buffer descriptor. The link address field is not present in this buffer descriptor, which is now 12 bytes long.
1
Use the link address field as a pointer to the next buffer descriptor. This buffer descriptor is 16 bytes long.
5
0
No special treatment for last byte.
1
Internal Source: status byte written to initial buffer descriptor before last data.
Internal Destination: Last byte written to offset address for frame termination.
All others: No effect.
4
0
No interrupt on completing this transfer.
1
Interrupt on completing this transfer.
3:2
00
Source address is fixed internal I/O (two-byte) address.
01
Source address is fixed external I/O (two-byte) address.
10
Source address is memory (three-byte) address, auto-decrement.
11
Source address is memory (three-byte) address, auto-increment.
1:0
00
Destination address is fixed internal I/O (two-byte) address.
01
Destination address is fixed external I/O (two-byte) address.
10
Destination address is memory (three-byte) address, auto-decrement.
11
Destination address is memory (three-byte) address, auto-increment.


DMA y Length[7:0] Register (D0L0R) (Address = 0x0182)
(D1L0R) (Address = 0x0192)
(D2L0R) (Address = 0x01A2)
(D3L0R) (Address = 0x01B2)
(D4L0R) (Address = 0x01C2)
(D5L0R) (Address = 0x01D2)
(D6L0R) (Address = 0x01E2)
(D7L0R) (Address = 0x01F2)

Bit(s)

Value

Description

7:0
Bits 7:0 of the buffer length value are stored in this register. The DMA does a transfer followed by a decrement of this register, so an initial value of 0x0000 will result in a 65536-byte transfer.


DMA y Length[15:8] Register (D0L1R) (Address = 0x0183)
(D1L1R) (Address = 0x0193)
(D2L1R) (Address = 0x01A3)
(D3L1R) (Address = 0x01B3)
(D4L1R) (Address = 0x01C3)
(D5L1R) (Address = 0x01D3)
(D6L1R) (Address = 0x01E3)
(D7L1R) (Address = 0x01F3)

Bit(s)

Value

Description

7:0
Bits 15:8 of the buffer length value are stored in this register.


DMA Source Addr[7:0] Register (D0SA0R) (Address = 0x0184)
(D1SA0R) (Address = 0x0194)
(D2SA0R) (Address = 0x01A4)
(D3SA0R) (Address = 0x01B4)
(D4SA0R) (Address = 0x01C4)
(D5SA0R) (Address = 0x01D4)
(D6SA0R) (Address = 0x01E4)
(D7SA0R) (Address = 0x01F4)

Bit(s)

Value

Description

7:0
Bits 7:0 of the source address are stored in this register.


DMA y Source Addr[15:8] Register (D0SA1R) (Address = 0x0185)
(D1SA1R) (Address = 0x0195)
(D2SA1R) (Address = 0x01A5)
(D3SA1R) (Address = 0x01B5)
(D4SA1R) (Address = 0x01C5)
(D5SA1R) (Address = 0x01D5)
(D6SA1R) (Address = 0x01E5)
(D7SA1R) (Address = 0x01F5)

Bit(s)

Value

Description

7:0
Bits 15:8 of the source address are stored in this register.


DMA y Source Addr[23:16] Register (D0SA2R) (Address = 0x0186)
(D1SA2R) (Address = 0x0196)
(D2SA2R) (Address = 0x01A6)
(D3SA2R) (Address = 0x01B6)
(D4SA2R) (Address = 0x01C6)
(D5SA2R) (Address = 0x01D6)
(D6SA2R) (Address = 0x01E6)
(D7SA2R) (Address = 0x01F6)

Bit(s)

Value

Description

7:0
Bits 23:16 of the source address are stored in this register.


DMA y Destination Addr[7:0] Register (D0DA0R) (Address = 0x0188)
(D1DA0R) (Address = 0x0198)
(D2DA0R) (Address = 0x01A8)
(D3DA0R) (Address = 0x01B8)
(D4DA0R) (Address = 0x01C8)
(D5DA0R) (Address = 0x01D8)
(D6DA0R) (Address = 0x01E8)
(D7DA0R) (Address = 0x01F8)

Bit(s)

Value

Description

7:0
Bits 7:0 of the destination address are stored in this register.


DMA y Destination Addr[15:8] Register (D0DA1R) (Address = 0x0189)
(D1DA1R) (Address = 0x0199)
(D2DA1R) (Address = 0x01A9)
(D3DA1R) (Address = 0x01B9)
(D4DA1R) (Address = 0x01C9)
(D5DA1R) (Address = 0x01D9)
(D6DA1R) (Address = 0x01E9)
(D7DA1R) (Address = 0x01F9)

Bit(s)

Value

Description

7:0
Bits 15:8 of the destination address are stored in this register.


DMA y Destination Addr[23:16] Register (D0DA2R) (Address = 0x018A)
(D1DA2R) (Address = 0x019A)
(D2DA2R) (Address = 0x01AA)
(D3DA2R) (Address = 0x01BA)
(D4DA2R) (Address = 0x01CA)
(D5DA2R) (Address = 0x01DA)
(D6DA2R) (Address = 0x01EA)
(D7DA2R) (Address = 0x01FA)

Bit(s)

Value

Description

7:0
Bits 23:16 of the destination address are stored in this register.


DMA y Link Addr[7:0] Register (D0LA0R) (Address = 0x018C)
(D1LA0R) (Address = 0x019C)
(D2LA0R) (Address = 0x01AC)
(D3LA0R) (Address = 0x01BC)
(D4LA0R) (Address = 0x01CC)
(D5LA0R) (Address = 0x01DC)
(D6LA0R) (Address = 0x01EC)
(D7LA0R) (Address = 0x01FC)

Bit(s)

Value

Description

7:0
Bits 7:0 of the link address are stored in this register.


DMA y Link Addr[15:8] Register (D0LA1R) (Address = 0x018D)
(D1LA1R) (Address = 0x019D)
(D2LA1R) (Address = 0x01AD)
(D3LA1R) (Address = 0x01BD)
(D4LA1R) (Address = 0x01CD)
(D5LA1R) (Address = 0x01DD)
(D6LA1R) (Address = 0x01ED)
(D7LA1R) (Address = 0x01FD)

Bit(s)

Value

Description

7:0
Bits 15:8 of the link address are stored in this register.


DMA y Link Addr[23:16] Register (D0LA2R) (Address = 0x018E)
(D1LA2R) (Address = 0x019E)
(D2LA2R) (Address = 0x01AE)
(D3LA2R) (Address = 0x01BE)
(D4LA2R) (Address = 0x01CE)
(D5LA2R) (Address = 0x01DE)
(D6LA2R) (Address = 0x01EE)
(D7LA2R) (Address = 0x01FE)

Bit(s)

Value

Description

7:0
Bits 23:16 of the link address are stored in this register.



Rabbit Semiconductor
www.rabbit.com
PREV INDEX NEXT