SPRUJ79 November 2024 F29H850TU , F29H859TU-Q1
The RTDMA state machine is, at the most basic level, two nested loops.
Burst (Inner) Loop:
The burst (inner) loop transfers a programmable number of bytes set by (BURST_SIZE + 1) register when a RTDMA channel trigger (Peripheral or Software trigger) is received. The BURST_SIZE register allows a maximum of 256 bytes to be transferred in one burst. Each RTDMA channel supports 8-bit, 16-bit, 32-bit, or 64-bit bursts that can be controlled by MODE.DATASIZE bit field. Each RTDMA channel contains a shadowed address pointer for the source (SRC_ADDR_SHADOW) and the destination (DST_ADDR_SHADOW) address. At the beginning of each transfer, the shadowed version of each pointer is copied into the respective active (SRC_ADDR_ACTIVE or DST_ADDR_ACTIVE) register. During the burst loop, after each byte is transferred, the signed value contained in the appropriate source or destination BURST_STEP register is added to the active register:
SRC_ADDR_ACTIVE = SRC_ADDR_ACTIVE + SRC_BURST_STEP
DST_ADDR_ACTIVE = DST_ADDR_ACTIVE + DST_BURST_STEP
The burst (inner) loop transfers a burst of data when a RTDMA Channel Trigger (Peripheral or Software trigger) is received.
Transfer (Outer) Loop:
The Transfer (outer) loop transfers a programmable number of bursts set by (TRANSFER_SIZE + 1) register for each channel. Since TRANSFER_SIZE is a 32-bit register, the total size of a transfer allowed is well beyond any practical requirement. During the transfer loop, after each burst is complete, there are two methods that can be used to modify the active address pointer.
Method 1 (Default): When address wrapping is disabled (SRC_WRAP_SIZE or DST_WRAP_SIZE is greater than TRANSFER_SIZE), active address pointer is updated as shown below
SRC_ADDR_ACTIVE = SRC_ADDR_ACTIVE + SRC_TRANSFER_STEP
DST_ADDR_ACTIVE = DST_ADDR_ACTIVE + DST_TRANSFER_STEP
Method 2: Address wrapping gets enabled when SRC_WRAP_SIZE or DST_WRAP_SIZE is less than TRANSFER_SIZE. This allows the channel to wrap multiple times within a single transfer. When the number of bursts is equal to (SRC/DST_WRAP_SIZE + 1) register, the state machine modifies the active address pointers as:
SRC_BEG_ADDR_ACTIVE = SRC_BEG_ADDR_ACTIVE + SRC_WRAP_STEP
DST_BEG_ADDR_ACTIVE = DST_BEG_ADDR_ACTIVE + DST_WRAP_STEP
SRC_ADDR_ACTIVE = SRC_BEG_ADDR_ACTIVE
DST_ADDR_ACTIVE = DST_BEG_ADDR_ACTIVE
At the end of RTDMA transfer, RTDMA can have transferred (BURST_SIZE + 1) x (TRANSFER_SIZE + 1) words.
OneShot Mode:
The OneShot mode must not be used with channels configured with a priority of 0.
OneShot mode is disabled by default.
When OneShot mode is disabled (MODE.CHx[ONESHOT] = 0), RTDMA transfers one burst [(BURST_SIZE + 1) bytes] of data each time a RTDMA Channel Trigger is received until (TRANSFER_COUNT = 0). After the burst is completed, the state machine moves on to the next pending channel in the priority scheme, even if another trigger for the channel just completed is pending. This feature keeps any single channel from monopolizing the RTDMA bus.
When OneShot mode is enabled (MODE.CHx[ONESHOT] = 1), RTDMA transfers all the bursts [(BURST_SIZE + 1) x (TRANSFER_SIZE + 1) words] on a single RTDMA channel trigger until (TRANSFER_COUNT = 0).
Continuous Mode:
Continuous mode is disabled by default.
When Continuous mode is disabled (MODE.CHx[CONTINUOUS] = 0), RTDMA state machine disables channel after all bursts in a transfer loop (TRANSFER_COUNT = 0) are complete. The channel stops and the RUNSTS bit is cleared. The channel must be re-enabled by setting the RUN bit in the CONTROL register before another transfer can be started on that channel.
When Continuous mode is enabled (MODE.CHx[CONTINUOUS] = 1), RTDMA state machine keep channel active even after all bursts in a transfer loop (TRANSFER_COUNT = 0) are complete.
Each RTDMA channel can trigger an Interrupt Controller interrupt for each RTDMA transfer either at start of RTDMA transfer or end of RTDMA transfer using MODE.CHx[CHINTMODE] bit.
When an RTDMA channel receives a peripheral event trigger, the PERINTFLG bit in the CONTROL register is set, pending enabling of the channel to the RTDMA state machine. To initiate an RTDMA event using software, setting the PERINTFRC bit forces an event.
At the beginning of a transfer the shadow register (SRC/DST_ADDR_SHADOW) is copied into the active register (SRC/DST_ADDR_ACTIVE). The active register performs as the current address pointer.
The value written into the shadow register (SRC/DST_BEG_ADDR_SHADOW) is loaded into the active register (SRC/DST_BEG_ADDR_ACTIVE) at the start of a transfer. On a wrap condition, the active register (SRC/DST_BEG_ADDR_ACTIVE) is incremented by the signed value in the appropriate SRC/DST_WRAP_STEP register prior to being loaded into the active register ((SRC/DST_ADDR_ACTIVE).
For each channel, the transfer process can be controlled with the following size values:
This value is loaded into the BURST_COUNT register at the beginning of each burst. The BURST_COUNT decrements each byte that is transferred and when the register reaches a zero value, the burst is complete, indicating that the next channel can be serviced. The behavior of the current channel is defined by the ONE_SHOT bit in the MODE register. The maximum size of the burst is dictated by the type of peripheral. For the ADC, the burst size can be all 32 registers (if all 32 registers are used). For RAM, the burst size can be up to the maximum allowed by the BURST_SIZE register, which is 256. See Table 13-2 to understand how BURST_SIZE register affects the number of bytes transferred with respect to DATASIZE.
| BURSTSIZE | Number of Bytes Transferred in | |||
|---|---|---|---|---|
| DATASIZE = 8-bit | DATASIZE = 16-bit | DATASIZE = 32-bit | DATASIZE = 64-bit | |
| 0 | 1 | 2 | 4 | 8 |
| 1 | 2 | |||
| 2 | 3 | 4 | ||
| 3 | 4 | |||
| 4 | 5 | 6 | 8 | |
| 5 | 6 | |||
| 6 | 7 | 8 | ||
| 7 | 8 | |||
| 8 | 9 | 10 | 12 | 16 |
| 9 | 10 | |||
| 10 | 11 | 12 | ||
| 11 | 12 | |||
| * | * | * | * | * |
| * | * | * | 255 | 256 |
| * | * | * | ||
| * | * | * | ||
| * | * | * | ||
| * | * | 255 | 256 | |
| * | * | |||
| 254 | 255 | 256 | ||
| 255 | 256 | |||
In other words, BURSTSIZE has to be configured as a multiple of DATASIZE. The following configurations are the only allowed options:
| DATASIZE = 8-bit n = 1 |
DATASIZE = 16-bit n = 2 |
DATASIZE = 32-bit n = 4 |
DATASIZE = 64-bit n = 8 |
|
|---|---|---|---|---|
| BURSTSIZE | n - 1 | 2n - 1 | 4n - 1 | 8n - 1 |
Whether this interrupt is generated at the beginning or the end of the transfer is defined in the CHINTMODE bit in the MODE register. Whether the channel remains enabled or not after the transfer is completed is defined by the CONTINUOUS bit in the MODE register. The TRANSFER_SIZE register is loaded into the TRANSFER_COUNT register at the beginning of each transfer. The TRANSFER_COUNT register keeps track of how many bursts of data the channel has transferred and when the register reaches zero, the RTDMA transfer is complete.
This feature is used to implement a circular addressing type function. This value is loaded into the appropriate SRC/DST_WRAP_COUNT register at the beginning of each transfer. The SRC/DST_WRAP_COUNT registers keep track of how many bursts of data the channel has transferred and when the registers reach zero, the wrap procedure is performed on the appropriate source or destination address pointer. A separate size and count register is allocated for source and destination pointers. To disable the wrap function, assign the value of these registers to be larger than the TRANSFER_SIZE.
Regardless of the state of the DATASIZE bit, the value specified in the STEP registers are for 8-bit addresses. So, to transfer one 32-bit word, a value 4 can be placed in these registers.
For each source/destination pointer, the address changes can be controlled with the following step values:
This value is a signed 2s compliment number so that the address pointer can be incremented or decremented as required. If no increment is desired, such as when accessing the data receive or transmit registers in a communication peripheral, the value of these registers can be set to zero.
This is used in cases where registers or data memory locations are spaced at constant intervals. This value is a signed 2s compliment number so that the address pointer can be incremented or decremented as required.
This implements a circular type of addressing mode, useful in many applications. This value is a signed 2s compliment number so that the address pointer can be incremented or decremented as required.
If implementing a ping-pong buffer scheme with continuous mode of operation, then the interrupt can be generated at the beginning, just after the working registers are copied to the shadow set. If the RTDMA does not operate in continuous mode, then the interrupt is typically generated at the end when the transfer is complete.
All of the previous features and modes are shown in Figure 13-2. The following items are in reference to Figure 13-2.