
Rev.1.00 May 22 2012
REJ09B0566
5.4. DMA controller
Figure 5-4 shows an example of DMAC usage.
Channel 0 will copy the string “Renesas SH7267” into the destination area when a falling edge occurs on pin IRQ3-B.
Channel 1 will copy the string “Hello, World” into the destination area as soon as it is enabled.
/* PDL functions and definitions */
#include “r_pdl_dmac.h”
#include “r_pdl_cpg.h”
#include “r_pdl_intc.h”
/* PDL device-specific definitions */
#include “r_pdl_definitions.h”
/* Required for this example */
#include <string.h>
/* Callback function prototype */
void DMAC0_transfer_end_handler(void);
/* Data source and destination declarations */
const uint8_t source_string_1[]="Renesas SH7267";
const uint8_t source_string_2[]="Hello, World";
volatile uint8_t destination_string_1[]=".......................";
volatile uint8_t destination_string_2[]=".......................";
void main(void)
{
uint16_t StatusValue;
uint32_t SourceAddr;
uint32_t DestAddr;
uint32_t ByteCount;
/* Initialise the system clocks */
R_CPG_Set(
12.5E6,
100E6,
50E6,
25E6,
PDL_CGC_BCLK_DISABLE
);
/* Set the CPU’s Interrupt Priority Level to 0 */
R_INTC_Write(
PDL_INTC_REG_IPL,
0,
0
);
/* Enable control of LED0 */
R_IO_PORT_Set(
PDL_IO_PORT_3_4,
PDL_IO_PORT_OUTPUT,
0,
0,
0
);
/* Configure channel 0 */
R_DMAC_Create(
0,
PDL_DMAC_CONSECUTIVE | PDL_DMAC_SOURCE_ADDRESS_PLUS | \
PDL_DMAC_DESTINATION_ADDRESS_PLUS,
PDL_DMAC_REQUEST_IRQ3,
source_string_1,
Kommentare zu diesen Handbüchern