![]() |
RA Flexible Software Package Documentation
Release v5.8.0
|
|
Functions | |
fsp_err_t | R_DTC_Open (transfer_ctrl_t *const p_api_ctrl, transfer_cfg_t const *const p_cfg) |
fsp_err_t | R_DTC_Reconfigure (transfer_ctrl_t *const p_api_ctrl, transfer_info_t *p_info) |
fsp_err_t | R_DTC_Reset (transfer_ctrl_t *const p_api_ctrl, void const *volatile p_src, void *volatile p_dest, uint16_t const num_transfers) |
fsp_err_t | R_DTC_SoftwareStart (transfer_ctrl_t *const p_api_ctrl, transfer_start_mode_t mode) |
fsp_err_t | R_DTC_SoftwareStop (transfer_ctrl_t *const p_api_ctrl) |
fsp_err_t | R_DTC_Enable (transfer_ctrl_t *const p_api_ctrl) |
fsp_err_t | R_DTC_Disable (transfer_ctrl_t *const p_api_ctrl) |
fsp_err_t | R_DTC_InfoGet (transfer_ctrl_t *const p_api_ctrl, transfer_properties_t *const p_properties) |
fsp_err_t | R_DTC_Reload (transfer_ctrl_t *const p_api_ctrl, void const *p_src, void *p_dest, uint32_t const num_transfers) |
fsp_err_t | R_DTC_CallbackSet (transfer_ctrl_t *const p_api_ctrl, void(*p_callback)(transfer_callback_args_t *), void const *const p_context, transfer_callback_args_t *const p_callback_memory) |
fsp_err_t | R_DTC_Close (transfer_ctrl_t *const p_api_ctrl) |
Driver for the DTC peripheral on RA MCUs. This module implements the Transfer Interface.
The Data Transfer Controller (DTC) transfers data from one memory location to another without using the CPU.
The DTC uses a RAM based vector table. Each entry in the vector table corresponds to an entry in the ISR vector table. When the DTC is triggered by an interrupt, it reads the DTC vector table, fetches the transfer information, and then executes the transfer. After the transfer is executed, the DTC writes the updated transfer info back to the location pointed to by the DTC vector table.
Configuration | Options | Default | Description |
---|---|---|---|
Parameter Checking |
| Default (BSP) | If selected code for parameter checking is included in the build. |
Linker section to keep DTC vector table | Manual Entry | .fsp_dtc_vector_table | Section to place the DTC vector table. |
Configuration | Options | Default | Description |
---|---|---|---|
Name | Name must be a valid C symbol | g_transfer0 | Module name. |
Mode |
| Normal | Select the transfer mode. Normal: One transfer per activation, transfer ends after Number of Transfers. Repeat: One transfer per activation, Repeat Area address reset after Number of Transfers, transfer repeats until stopped. Block: Number of Blocks per activation, Repeat Area address reset after Number of Transfers, transfer ends after Number of Blocks. |
Transfer Size |
| 2 Bytes | Select the transfer size. |
Destination Address Mode |
| Fixed | Select the address mode for the destination. |
Source Address Mode |
| Fixed | Select the address mode for the source. |
Repeat Area (Unused in Normal Mode) |
| Source | Select the repeat area. Either the source or destination address resets to its initial value after completing Number of Transfers in Repeat or Block mode. |
Interrupt Frequency |
| After all transfers have completed | Select to have interrupt after each transfer or after last transfer. |
Number of Transfers | Value must be a non-negative integer | 0 | Specify the number of transfers. |
Number of Blocks (Valid only in Block Mode) | Must be a valid non-negative integer with a maximum configurable value of 65536. Applicable only in Block Mode. | 0 | Specify the number of blocks to transfer in Block mode. |
Number of Transfer Descriptors | Value must be a non-negative integer | 1 | Specify the number of transfer descriptors. Users have to initialize descriptors if its value is greater than 1. |
Activation Source | MCU Specific Options | Select the DTC transfer start event. |
The DTC peripheral module uses ICLK as the clock source. The ICLK frequency is set by using the Clocks tab of the RA Configuration editor prior to a build or by using the CGC module at runtime.
This module does not use I/O pins.
R_DTC_Reset() API function should be called to set the Source and Destination address before starting the transfer operation.
The DTC Module supports three modes of operation.
Multiple transfers can be configured for the same interrupt source by specifying an array of transfer_info_t structs instead of just passing a pointer to one. In this configuration, every transfer_info_t struct must be configured for a chain mode except for the last one. There are two types of chain mode; CHAIN_MODE_EACH and CHAIN_MODE_END. If a transfer is configured in CHAIN_MODE_EACH then it triggers the next transfer in the chain after it completes each transfer. If a transfer is configured in CHAIN_MODE_END then it triggers the next transfer in the chain after it completes its last transfer.
The Transfer API is implemented by both DTC and the DMAC so that applications can switch between the DTC and the DMAC. When selecting between them, consider these factors:
DTC | DMAC | |
---|---|---|
Repeat Mode |
|
|
Block Mode |
|
|
Channels |
|
|
Chained Transfers |
|
|
Software Trigger |
|
|
Offset Address Mode |
|
|
DTC_TRANSFER_INFO_ALIGNMENT
macro is supplied to align the structs as necessary.The DTC and DMAC interrupts behave differently. The DTC uses the configured event IRQ as the interrupt source whereas each DMAC channel has its own IRQ.
The transfer_info_t::irq setting also behaves a little differently depending on which mode is selected.
DTC | DMAC | |
---|---|---|
TRANSFER_IRQ_EACH | Interrupt after each transfer | N/A |
TRANSFER_IRQ_END | Interrupt after last transfer | Interrupt after last transfer |
DTC | DMAC | |
---|---|---|
TRANSFER_IRQ_EACH | Interrupt after each transfer | Interrupt after each repeat |
TRANSFER_IRQ_END | Interrupt after each repeat | Interrupt after last transfer |
DTC | DMAC | |
---|---|---|
TRANSFER_IRQ_EACH | Interrupt after each block | Interrupt after each block |
TRANSFER_IRQ_END | Interrupt after last block | Interrupt after last block |
When an interrupt is configured to trigger DTC transfers, the peripheral ISR will trigger on the following conditions:
For example, if SCI1_RXI is configured to trigger DTC transfers and a SCI1_RXI event occurs, the interrupt will not fire until the DTC transfer is completed. If the DTC transfer_info_t::irq is configured to only interrupt on the last transfer, then no RXI interrupts will occur until the last transfer is completed.
DTCST must be set to 0 before transitioning to any of the following:
Developers should be aware of the following limitations when using the DTC:
This is a basic example of minimal use of the DTC in an application.
Data Structures | |
struct | dtc_extended_cfg_t |
struct | dtc_instance_ctrl_t |
Macros | |
#define | DTC_MAX_NORMAL_TRANSFER_LENGTH |
#define | DTC_MAX_REPEAT_TRANSFER_LENGTH |
#define | DTC_MAX_BLOCK_TRANSFER_LENGTH |
#define | DTC_MAX_BLOCK_COUNT |
#define | DTC_TRANSFER_INFO_ALIGNMENT |
struct dtc_extended_cfg_t |
struct dtc_instance_ctrl_t |
Control block used by driver. DO NOT INITIALIZE - this structure will be initialized in transfer_api_t::open.
#define DTC_MAX_NORMAL_TRANSFER_LENGTH |
Max configurable number of transfers in NORMAL MODE
#define DTC_MAX_REPEAT_TRANSFER_LENGTH |
Max number of transfers per repeat for REPEAT MODE
#define DTC_MAX_BLOCK_TRANSFER_LENGTH |
Max number of transfers per block in BLOCK MODE
#define DTC_MAX_BLOCK_COUNT |
Max configurable number of blocks to transfer in BLOCK MODE
#define DTC_TRANSFER_INFO_ALIGNMENT |
Alignment required for transfer_info_t structures.
fsp_err_t R_DTC_Open | ( | transfer_ctrl_t *const | p_api_ctrl, |
transfer_cfg_t const *const | p_cfg | ||
) |
Configure the vector table if it hasn't been configured, enable the Module and copy the pointer to the transfer info into the DTC vector table. Implements transfer_api_t::open.
Example:
FSP_SUCCESS | Successful open. Transfer transfer info pointer copied to DTC Vector table. Module started. DTC vector table configured. |
FSP_ERR_ASSERTION | An input parameter is invalid. |
FSP_ERR_UNSUPPORTED | Address Mode Offset is selected. |
FSP_ERR_ALREADY_OPEN | The control structure is already opened. |
FSP_ERR_IN_USE | The index for this IRQ in the DTC vector table is already configured. |
FSP_ERR_IRQ_BSP_DISABLED | The IRQ associated with the activation source is not enabled in the BSP. |
fsp_err_t R_DTC_Reconfigure | ( | transfer_ctrl_t *const | p_api_ctrl, |
transfer_info_t * | p_info | ||
) |
Copy pointer to transfer info into the DTC vector table and enable transfer in ICU. Implements transfer_api_t::reconfigure.
FSP_SUCCESS | Transfer is configured and will start when trigger occurs. |
FSP_ERR_ASSERTION | An input parameter is invalid. |
FSP_ERR_NOT_OPEN | Handle is not initialized. Call R_DTC_Open to initialize the control block. |
FSP_ERR_NOT_ENABLED | Transfer source address is NULL or is not aligned correctly. Transfer destination address is NULL or is not aligned correctly. |
fsp_err_t R_DTC_Reset | ( | transfer_ctrl_t *const | p_api_ctrl, |
void const *volatile | p_src, | ||
void *volatile | p_dest, | ||
uint16_t const | num_transfers | ||
) |
Reset transfer source, destination, and number of transfers. Implements transfer_api_t::reset.
FSP_SUCCESS | Transfer reset successfully (transfers are enabled). |
FSP_ERR_ASSERTION | An input parameter is invalid. |
FSP_ERR_NOT_OPEN | Handle is not initialized. Call R_DTC_Open to initialize the control block. |
FSP_ERR_NOT_ENABLED | Transfer source address is NULL or is not aligned correctly. Transfer destination address is NULL or is not aligned correctly. |
fsp_err_t R_DTC_SoftwareStart | ( | transfer_ctrl_t *const | p_api_ctrl, |
transfer_start_mode_t | mode | ||
) |
Placeholder for unsupported softwareStart function. Implements transfer_api_t::softwareStart.
FSP_ERR_UNSUPPORTED | DTC software start is not supported. |
fsp_err_t R_DTC_SoftwareStop | ( | transfer_ctrl_t *const | p_api_ctrl | ) |
Placeholder for unsupported softwareStop function. Implements transfer_api_t::softwareStop.
FSP_ERR_UNSUPPORTED | DTC software stop is not supported. |
fsp_err_t R_DTC_Enable | ( | transfer_ctrl_t *const | p_api_ctrl | ) |
Enable transfers on this activation source. Implements transfer_api_t::enable.
Example:
FSP_SUCCESS | Transfers will be triggered by the activation source |
FSP_ERR_ASSERTION | An input parameter is invalid. |
FSP_ERR_UNSUPPORTED | Address Mode Offset is selected. |
FSP_ERR_NOT_OPEN | Handle is not initialized. Call R_DTC_Open to initialize the control block. |
fsp_err_t R_DTC_Disable | ( | transfer_ctrl_t *const | p_api_ctrl | ) |
Disable transfer on this activation source. Implements transfer_api_t::disable.
FSP_SUCCESS | Transfers will not occur on activation events. |
FSP_ERR_NOT_OPEN | Handle is not initialized. Call R_DTC_Open to initialize the control block. |
FSP_ERR_ASSERTION | An input parameter is invalid. |
fsp_err_t R_DTC_InfoGet | ( | transfer_ctrl_t *const | p_api_ctrl, |
transfer_properties_t *const | p_properties | ||
) |
Provides information about this transfer. Implements transfer_api_t::infoGet.
FSP_SUCCESS | p_info updated with current instance information. |
FSP_ERR_NOT_OPEN | Handle is not initialized. Call R_DTC_Open to initialize the control block. |
FSP_ERR_ASSERTION | An input parameter is invalid. |
fsp_err_t R_DTC_Reload | ( | transfer_ctrl_t *const | p_api_ctrl, |
void const * | p_src, | ||
void * | p_dest, | ||
uint32_t const | num_transfers | ||
) |
To update next transfer information without interruption during transfer.
FSP_ERR_UNSUPPORTED | This feature is not supported. |
fsp_err_t R_DTC_CallbackSet | ( | transfer_ctrl_t *const | p_api_ctrl, |
void(*)(transfer_callback_args_t *) | p_callback, | ||
void const *const | p_context, | ||
transfer_callback_args_t *const | p_callback_memory | ||
) |
Placeholder for unsupported callbackset function. Implements transfer_api_t::callbackSet.
FSP_ERR_UNSUPPORTED | DTC does not support direct callbacks. |
fsp_err_t R_DTC_Close | ( | transfer_ctrl_t *const | p_api_ctrl | ) |
Disables DTC activation in the ICU, then clears transfer data from the DTC vector table. Implements transfer_api_t::close.
FSP_SUCCESS | Successful close. |
FSP_ERR_ASSERTION | An input parameter is invalid. |
FSP_ERR_NOT_OPEN | Handle is not initialized. Call R_DTC_Open to initialize the control block. |