User`s manual

RX62N Group, RX621 Group 5. Usage Examples
5.7. Data Transfer Controller
5.7.1. Block transfer mode
Figure 5-11 shows an example of Data Transfer Controller usage with a single block transfer.
/* Peripheral driver function prototypes */
#include "r_pdl_dtc.h"
#include "r_pdl_io_port.h"
#include "r_pdl_intc.h"
/* RPDL device-specific definitions */
#include "r_pdl_definitions.h"
/* Required for this example */
#include <string.h>
/* Reserve an area for the DTC vector table */
#pragma address dtc_vector_table = 0x00015000
uint32_t dtc_vector_table[256];
/* Reserve 16 bytes for the IRQ15-triggered transfer data area */
uint32_t dtc_irq15_transfer_data[4];
const char source_string_1[] = "Renesas RX62N";
const char source_string_2[] = "Second trigger";
volatile char destination_string_1[] = ".......................";
volatile char destination_string_2[] = ".......................";
void IRQ15_handler(void);
void main(void)
{
/* Enable control of LED0 */
R_IO_PORT_Set(
PDL_IO_PORT_0_2,
PDL_IO_PORT_OUTPUT
);
/* Set the DTC options */
R_DTC_Set(
PDL_NO_DATA,
dtc_vector_table
);
/* Configure the DTC for IRQ15 (push switch SW3) */
R_DTC_Create(
PDL_DTC_BLOCK | PDL_DTC_DESTINATION | \
PDL_DTC_SOURCE_ADDRESS_PLUS | PDL_DTC_DESTINATION_ADDRESS_PLUS | \
PDL_DTC_SIZE_8 | \
PDL_DTC_IRQ_COMPLETE | \
PDL_DTC_TRIGGER_IRQ15,
dtc_irq15_transfer_data,
source_string_1,
destination_string_1,
1,
(uint8_t)(strlen((char *)source_string_1))
);
/* Enable the SW3 interrupt */
R_INTC_CreateExtInterruptAll(
PDL_INTC_IRQ15,
PDL_INTC_FALLING | PDL_INTC_A | PDL_INTC_DTC_TRIGGER_ENABLE,
IRQ15_handler,
7
);
R20UT0084EE0112 Rev.1.12 Page 5-23
July. 16, 2014