RZT Flexible Software Package Documentation
Release v2.2.0
|
|
Driver for the DMAC peripheral on RZ microprocessor. This module implements the Transfer Interface.
The Direct Memory Access Controller (DMAC) transfers data from one memory location to another without using the CPU.
Configuration | Options | Default | Description |
---|---|---|---|
Channel Priority Control > Unit 0 > Arbitration method (Channel 0-7) |
| Fixed | Select Unit0 Channel 0 - 7 channel priority |
Channel Priority Control > Unit 0 > Arbitration method (Channel 8-15) |
| Fixed | Select Unit0 Channel 8 - 15 channel priority |
Channel Priority Control > Unit 1 > Arbitration method (Channel 0-7) |
| Fixed | Select Unit1 Channel 0 - 7 channel priority |
Channel Priority Control > Unit 1 > Arbitration method (Channel 8-15) |
| Fixed | Select Unit1 Channel 8 - 15 channel priority |
Parameter Checking |
| Default (BSP) | If selected code for parameter checking is included in the build. |
Multiplex Interrupt |
| Disabled | Enable multiplex interrupt for a single driver. |
Configuration | Options | Default | Description |
---|---|---|---|
General > Name | Name must be a valid C symbol | g_transfer0 | Module name. |
General > Unit | Value must be a non-negative integer | 0 | Specify the hardware unit. |
General > Channel | Must be a valid integer between 0 and 15. | 0 | Specify the hardware channel. |
General > DMA Mode |
| Register mode | Select the DMA mode. |
General > Activation Source | MCU Specific Options | Select the DMAC transfer start event. Don't select same event between defferent CPUs. | |
Register Mode > Mode |
| Normal | Select the transfer mode. |
Register Mode > Transfer Source Size |
| 2 Bytes | Select the transfer source size. |
Register Mode > Transfer Destination Size |
| 2 Bytes | Select the transfer destination size. |
Register Mode > Destination Address Mode |
| Fixed | Select the address mode for the destination. |
Register Mode > Source Address Mode |
| Fixed | Select the address mode for the source. |
Register Mode > Destination Pointer | Manual Entry | NULL | Specify the transfer destination pointer. |
Register Mode > Source Pointer | Manual Entry | NULL | Specify the transfer source pointer. |
Register Mode > Number of Transfers | Value must be a non-negative integer | 1 | Specify the bytes of transfers. |
Register Mode > DMA Activation Request Source Select |
| Requested by a transfer source module | Select DMA activation request source. |
Register Mode > Low Detection Enable |
| Enable | Select low detection enable. |
Register Mode > High Detection Enable |
| Disable | Select high detection enable. |
Register Mode > Level Detection Enable |
| Edge | Select level detection enable. |
Register Mode > DACK Output mode |
| Level mode | Select DACK output mode. |
Register Mode > Next 1 Register Set enable |
| Disable | When Next0 Register Set Transfer completes, Next1 Register Set Transfer occurs |
Register Mode > Next 1 Register Set Destination Pointer | Manual Entry | NULL | Specify the transfer destination pointer. |
Register Mode > Next 1 Register Set Source Pointer | Manual Entry | NULL | Specify the transfer source pointer. |
Register Mode > Next 1 Register Set Number of Transfers | Value must be a non-negative integer | 1 | Specify the bytes of transfers. |
Register Mode > Transfer Interval | Value must be a non-negative integer | 0 | Transfer interval |
Link Mode > Descriptor | Name must be a valid C symbol | NULL | DMAC Link mode descriptor symbol name. |
Interrupts > Callback | Name must be a valid C symbol | NULL | A user callback that is called at the end of the transfer. |
Interrupts > Context | Manual Entry | NULL | Pointer to the context structure passed through the callback argument. |
Interrupts > Transfer End Interrupt Detect Type | MCU Specific Options | Select transfer end interrupt detect type. | |
Interrupts > Transfer End Interrupt Priority | MCU Specific Options | Select the transfer end interrupt priority. |
The DMAC peripheral module uses ICLK as the clock source. The ICLK frequency is set by using the Clocks tab of the FSP Configuration editor prior to a build, or by using the CGC module at run-time.
The following pins are available by this module.
The DMAC Module supports two modes of operation.
In Link mode, a DMA transfer is performed by reading a descriptor placed in the RAM area as the transfer information setting value. The descriptor is configured by dmac_link_cfg_t struct. For more information see 'Link Mode' section in the RZ microprocessor manual.
The DMAC outputs an error signal to the ICU when DMA error interrupt occurs. ICU can output PERI_ERRn interrupt (Peripherals error event n) to GIC or cause error reset when ICU accepts error signal from DMAC. To use PERI_ERRn interrupt or reset at DMAC, Interrupt Controller Unit (ICU) ERROR (r_icu_error) need to be configured. When the PERI_ERRn interrupt is configured to use interrupt and triggered, the callback function registered during open is called.
Developers should be aware of the following limitations when using the DMAC:
This is a basic example of minimal use of the DMAC register mode operation in an application.
In this case, one or more events have been routed to the DMAC for handling so it only needs to be enabled to start accepting transfers.
In this example, one or more events (include CMTW) have been routed to the DMAC for handling so it only needs to be enabled to start accepting transfers.
This is a basic example of minimal use of two Next register sets (Next0/1 register set) to continue DMA transfers in register mode. For more information see 'Next Register Continuous Execution Settings' section in the RZ microprocessor manual.
This is a basic example of minimal use of the DMAC link mode operation in an application. DMAC transfer is triggered by R_DMAC_SoftwareStart().
This is a basic example of minimal use of the DMAC link mode operation in an application. DMAC transfer is triggered by R_DMAC_SoftwareStart().
In this example, the transfer source/destination address is set to a Non-Cached area of System RAM.
This is a basic example of minimal use of the DMAC link mode operation in an application. DMAC transfer is triggered by R_DMAC_SoftwareStart().
In this example, the transfer source/destination address is set to a Non-Cached area of System RAM.
Data Structures | |
struct | dmac_link_cfg_t |
struct | dmac_instance_ctrl_t |
struct | dmac_extended_cfg_t |
Macros | |
#define | DMAC_MAX_NORMAL_TRANSFER_LENGTH |
#define | DMAC_MAX_BLOCK_TRANSFER_LENGTH |
Enumerations | |
enum | dmac_link_valid_t |
enum | dmac_link_end_t |
enum | dmac_link_write_back_t |
enum | dmac_link_interrupt_mask_t |
enum | dmac_register_select_reverse_t |
enum | dmac_ack_mode_t |
enum | dmac_detection_t |
enum | dmac_request_direction_t |
enum | dmac_channel_scheduling_t |
enum | dmac_mode_select_t |
struct dmac_link_cfg_t |
Descriptor structure used in DMAC link mode, and variables of dmac_link_cfg_t must be allocated in the memory area.
Data Fields | ||
---|---|---|
union dmac_link_cfg_t | __unnamed__ | |
void const *volatile | p_src | Source address. |
void *volatile | p_dest | Destination address. |
volatile uint32_t | transaction_byte | Transaction byte. |
volatile uint32_t | channel_cfg | Channel configuration (Set value for CHCFG_n register). |
volatile uint32_t | channel_interval | Channel interval (Set value for CHITVL register). |
volatile uint32_t | channel_extension_cfg | Channel extension configuration (Set value for CHEXT_n register). |
void *volatile | p_next_link_addr | Next link address. |
struct dmac_instance_ctrl_t |
Control block used by driver. DO NOT INITIALIZE - this structure will be initialized in transfer_api_t::open.
struct dmac_extended_cfg_t |
DMAC transfer configuration extension. This extension is required.
Data Fields | |
uint8_t | unit |
Unit number. | |
uint8_t | channel |
Channel number. | |
IRQn_Type | dmac_int_irq |
DMAC interrupt number. | |
uint8_t | dmac_int_ipl |
DMAC interrupt priority. | |
uint32_t | dmac_int_irq_detect_type |
DMAC interrupt detection type. | |
elc_event_t | activation_source |
dmac_ack_mode_t | ack_mode |
DACK output mode. | |
dmac_detection_t | detection_mode |
DMAC request detection method. | |
dmac_request_direction_t | activation_request_source_select |
DMAC activation request source. | |
dmac_register_select_reverse_t | next_register_operaion |
DEPRECATED - next_register_operaion will be renamed next_register_operation in the major release. Next register operation settings. | |
dmac_mode_select_t | dmac_mode |
DMAC Mode. | |
dmac_link_cfg_t const * | p_descriptor |
The address of the descriptor (DMA Link Mode only) | |
uint16_t | transfer_interval |
DMA transfer interval. | |
dmac_channel_scheduling_t | channel_scheduling |
DMA channel scheduling. | |
void(* | p_callback )(transfer_callback_args_t *cb_data) |
void const * | p_context |
elc_event_t dmac_extended_cfg_t::activation_source |
Select which event will trigger the transfer.
void(* dmac_extended_cfg_t::p_callback) (transfer_callback_args_t *cb_data) |
Callback for transfer end interrupt.
void const* dmac_extended_cfg_t::p_context |
Placeholder for user data. Passed to the user p_callback in transfer_callback_args_t.
#define DMAC_MAX_NORMAL_TRANSFER_LENGTH |
Max configurable number of transfers in TRANSFER_MODE_NORMAL.
#define DMAC_MAX_BLOCK_TRANSFER_LENGTH |
Max number of transfers per block in TRANSFER_MODE_BLOCK
enum dmac_link_valid_t |
enum dmac_link_end_t |
Masks write back execution of the dmac_link_cfg_t::link_valid. When disable, DMAC does not perform write-back operation.
Enumerator | |
---|---|
DMAC_LINK_WRITE_BACK_ENABLE | Set dmac_link_cfg_t::link_valid to disable after the DMA transfer ends. |
DMAC_LINK_WRITE_BACK_DISABLE | Remain dmac_link_cfg_t::link_valid after DMA transfer ends. |
When dmac_link_cfg_t::link_valid is DMAC_LINK_VALID_DESCRIPTOR_DISABLE at loading of header, specifies whether DMA transfer completion interrupt mask or not.
Enumerator | |
---|---|
DMAC_LINK_INTERRUPT_MASK_DISABLE | DMA transfer completion interrupt is asserted. |
DMAC_LINK_INTERRUPT_MASK_ENABLE | DMA transfer completion interrupt is masked. |
Select the Next register set to be executed next.
enum dmac_ack_mode_t |
enum dmac_detection_t |
Detection method of the DMA request signal. See 'DMA Transfer Request Detection Operation Setting Table' of RZ microprocessor manual.
enum dmac_mode_select_t |
fsp_err_t R_DMAC_Open | ( | transfer_ctrl_t *const | p_ctrl, |
transfer_cfg_t const *const | p_cfg | ||
) |
Configure a DMAC channel.
FSP_SUCCESS | Successful open. |
FSP_ERR_ASSERTION | An input parameter is invalid. |
FSP_ERR_IP_CHANNEL_NOT_PRESENT | The configured channel is invalid. |
FSP_ERR_IRQ_BSP_DISABLED | The IRQ associated with the activation source is not enabled in the BSP. |
FSP_ERR_ALREADY_OPEN | The control structure is already opened. |
fsp_err_t R_DMAC_Reconfigure | ( | transfer_ctrl_t *const | p_ctrl, |
transfer_info_t * | p_info | ||
) |
Reconfigure the transfer with new transfer info.
FSP_SUCCESS | Transfer is configured and will start when trigger occurs. |
FSP_ERR_ASSERTION | An input parameter is invalid. |
FSP_ERR_NOT_ENABLED | DMAC is not enabled. The current configuration must not be valid. |
FSP_ERR_INVALID_MODE | DMA mode is link mode. This function can only be used when the DMA mode is register mode. |
FSP_ERR_NOT_OPEN | Handle is not initialized. Call R_DMAC_Open to initialize the control block. |
fsp_err_t R_DMAC_Reset | ( | transfer_ctrl_t *const | p_ctrl, |
void const *volatile | p_src, | ||
void *volatile | p_dest, | ||
uint16_t const | num_transfers | ||
) |
Reset transfer source, destination, and number of transfers.
FSP_ERR_UNSUPPORTED | API not supported. |
fsp_err_t R_DMAC_SoftwareStart | ( | transfer_ctrl_t *const | p_ctrl, |
transfer_start_mode_t | mode | ||
) |
Set a transfer request by software.
FSP_SUCCESS | Transfer started written successfully. |
FSP_ERR_ASSERTION | An input parameter is invalid. |
FSP_ERR_NOT_OPEN | Handle is not initialized. Call R_DMAC_Open to initialize the control block. |
fsp_err_t R_DMAC_SoftwareStop | ( | transfer_ctrl_t *const | p_ctrl | ) |
Stop software transfers if they were started with TRANSFER_START_MODE_REPEAT.
FSP_ERR_UNSUPPORTED | API not supported. |
fsp_err_t R_DMAC_Enable | ( | transfer_ctrl_t *const | p_ctrl | ) |
Enable transfers for the configured activation source.
FSP_SUCCESS | Counter value written successfully. |
FSP_ERR_ASSERTION | An input parameter is invalid. |
FSP_ERR_NOT_OPEN | Handle is not initialized. Call R_DMAC_Open to initialize the control block. |
fsp_err_t R_DMAC_Disable | ( | transfer_ctrl_t *const | p_ctrl | ) |
Disable transfers so that they are no longer triggered by the activation source.
FSP_SUCCESS | Counter value written successfully. |
FSP_ERR_ASSERTION | An input parameter is invalid. |
FSP_ERR_NOT_OPEN | Handle is not initialized. Call R_DMAC_Open to initialize the control block. |
fsp_err_t R_DMAC_InfoGet | ( | transfer_ctrl_t *const | p_ctrl, |
transfer_properties_t *const | p_info | ||
) |
Set driver specific information in provided pointer.
FSP_SUCCESS | Information has been written to p_info. |
FSP_ERR_NOT_OPEN | Handle is not initialized. Call R_DMAC_Open to initialize the control block. |
FSP_ERR_ASSERTION | An input parameter is invalid. |
fsp_err_t R_DMAC_Close | ( | transfer_ctrl_t *const | p_ctrl | ) |
Disable transfer and clean up internal data. 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_DMAC_Open to initialize the control block. |
fsp_err_t R_DMAC_Reload | ( | transfer_ctrl_t *const | p_ctrl, |
void const *volatile | p_src, | ||
void *volatile | p_dest, | ||
uint32_t const | num_transfers | ||
) |
Make the following transfer settings to continue the transfer.
FSP_SUCCESS | Successful continuous transfer settings. |
FSP_ERR_ASSERTION | An input parameter is invalid. |
FSP_ERR_NOT_OPEN | Handle is not initialized. Call R_DMAC_Open to initialize the control block. |
FSP_ERR_INVALID_MODE | This API cannot be called during link mode operation or setting not to use the Next1 register. |
FSP_ERR_INVALID_CALL | Invalid call. The series of transfer processing has finished. |
fsp_err_t R_DMAC_CallbackSet | ( | transfer_ctrl_t *const | p_ctrl, |
void(*)(transfer_callback_args_t *) | p_callback, | ||
void const *const | p_context, | ||
transfer_callback_args_t *const | p_callback_memory | ||
) |
Updates the user callback with the option to provide memory for the callback argument structure. Implements transfer_api_t::callbackSet.
FSP_SUCCESS | Callback updated successfully. |
FSP_ERR_ASSERTION | A required pointer is NULL. |
FSP_ERR_NOT_OPEN | The control block has not been opened. |
fsp_err_t R_DMAC_LinkDescriptorSet | ( | transfer_ctrl_t *const | p_ctrl, |
dmac_link_cfg_t * | p_descriptor | ||
) |
Reconfigure the transfer descriptor information with new transfer descriptor.
FSP_SUCCESS | Transfer is configured and will start when trigger occurs. |
FSP_ERR_ASSERTION | An input parameter is invalid. |
FSP_ERR_NOT_ENABLED | DMAC is not enabled. The current configuration must not be valid. |
FSP_ERR_INVALID_MODE | DMA mode is register mode. This function can only be used when the DMA mode is link mode. |
FSP_ERR_NOT_OPEN | Handle is not initialized. Call R_DMAC_Open to initialize the control block. |