![]() |
RZ Flexible Software Package Documentation
Release v4.1.0
|
|
Driver for the DMAC peripheral on RZ MPUs. 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 |
|---|---|---|---|
| External Output Signal Active Level > DACK 0 Active Level | MCU Specific Options | Select external DACK0 output signal active level. | |
| External Output Signal Active Level > DACK 1 Active Level | MCU Specific Options | Select external DACK1 output signal active level. | |
| External Output Signal Active Level > DACK 2 Active Level | MCU Specific Options | Select external DACK2 output signal active level. | |
| External Output Signal Active Level > DACK 3 Active Level | MCU Specific Options | Select external DACK3 output signal active level. | |
| External Output Signal Active Level > DACK 4 Active Level | MCU Specific Options | Select external DACK4 output signal active level. | |
| External Output Signal Active Level > TEND 0 Active Level | MCU Specific Options | Select external TEND0 output signal active level. | |
| External Output Signal Active Level > TEND 1 Active Level | MCU Specific Options | Select external TEND1 output signal active level. | |
| External Output Signal Active Level > TEND 2 Active Level | MCU Specific Options | Select external TEND2 output signal active level. | |
| External Output Signal Active Level > TEND 3 Active Level | MCU Specific Options | Select external TEND3 output signal active level. | |
| External Output Signal Active Level > TEND 4 Active Level | MCU Specific Options | Select external TEND4 output signal active level. | |
| Parameter Checking |
| Default (BSP) | If selected code for parameter checking is included in the build. |
| Configuration | Options | Default | Description |
|---|---|---|---|
| General > Name | Name must be a valid C symbol | g_transfer0 | Module name. |
| General > Unit | MCU Specific Options | Specify the hardware unit. In a multi-core environment, it is recommended to open a separate unit for each core. | |
| General > Channel | Must be a valid integer between 0 and 15. | 0 | Specify the hardware channel. |
| General > Activation Source | MCU Specific Options | Select the DMAC transfer start event. | |
| General > DACK Output mode | MCU Specific Options | Select DACK output mode. | |
| General > External DREQ Input Pin Select | MCU Specific Options | Select DREQ input signal. | |
| General > External DACK Output Pin Select | MCU Specific Options | Select DACK output signal. | |
| General > External TEND Output Pin Select | MCU Specific Options | Select TEND output signal. | |
| General > External DREQ Detection Mode | MCU Specific Options | External DREQ detection mode select.(This cannot be set on devices that do not have an external DREQ terminal) | |
| General > DMAC Mode |
| Register Mode | Select DMAC Mode. |
| General > Channel Priority |
| module.driver.rzv.transfer_on_dmac_b.channel_priority.fixed | Channel Priority |
| Register Mode > Mode |
| Normal | Select the transfer mode. |
| Register Mode > Source Data Size |
| 2 Bytes | Select the source data size. |
| Register Mode > Destination Data Size |
| 2 Bytes | Select the destination data size. |
| Register Mode > Destination Address Mode |
| Incremented | Select the address mode for the destination. |
| Register Mode > Source Address Mode |
| Incremented | Select the address mode for the source. |
| Register Mode > DMA Activation Request Source Select |
| Requested by a transfer source module | DMA Activation Request Source Select. |
| Register Mode > Transfer Interval | Value must be a non-negative integer | 0 | Transfer interval |
| Register Mode > Transfer Continuation |
| DMA transfer only once | When Next0 Register Set Transfer completes, Next1 Register Set Transfer occurs |
| Register Mode > Setting 1 Destination Address | Manual Entry | NULL | Specify the transfer destination address. |
| Register Mode > Setting 1 Source Address | Manual Entry | NULL | Specify the transfer source address. |
| Register Mode > Setting 1 Total Number of Transfer Bytes | Value must be a non-negative integer | 1 | Specify the total number of transfer bytes. |
| Register Mode > Setting 2 Destination Address | Manual Entry | NULL | Specify the transfer destination address.(Use only when Transfer with Setting 1 and Setting 2 horizontally is selected in Transfer Continuatuion.) |
| Register Mode > Setting 2 Source Address | Manual Entry | NULL | Specify the transfer source address.(Use only when Transfer with Setting 1 and Setting 2 horizontally is selected in Transfer Continuatuion.) |
| Register Mode > Setting 2 Total Number of Transfer Bytes | Value must be a non-negative integer | 1 | Specify the total number of transfer bytes.(Use only when Transfer with Setting 1 and Setting 2 horizontally is selected in Transfer Continuatuion.) |
| 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 Enable | MCU Specific Options | Enable the transfer end interrupt. | |
| Interrupts > Transfer End Interrupt Priority | Value must be an integer between 0 and 255 | 12 | Select the transfer end interrupt priority. |
The clock sources for the DMAC peripheral module vary depending on the device. These clocks are shown in the table below.
| MPU Group | Clock Name |
|---|---|
| RZ/V2L | P1CLK |
| RZ/V2H | I7CLK (for Unit 0), P7CLK (for Unit 1, 2), P11CLK (for Unit 3, 4) |
| RZ/V2N | I7CLK (for Unit 0), P7CLK (for Unit 1, 2), P11CLK (for Unit 3, 4) |
This module can use DREQn, DACKn and TENDn pins as external pins1 (n = 0~4).
In Register mode, a DMA transfer is performed by setting transfer information in each register. The address information of the transfer source and destination and the number of bytes to transfer, can be set up to two register sets (Next0 register set and Next1 register set), and continuous transfers can be performed alternately according to each setting. For more information, see the "Register Mode" section of the user's manual.
In Link mode, a DMA transfer is performed by reading a descriptor placed in the memory as the transfer information. The descriptor is configured by dmac_b_link_cfg_t struct. For more information, including what information can be set in the descriptor, see the "Link Mode" section of the user's manual.
The DMAC Module supports two modes of operation.
This driver only supports the transfer by non-secure access. Also, DMA transfer cannot be performed to the slave area for which the security level has been set. Therefore, for slave areas with a security level set, be sure to change the slave level appropriately before performing a DMA transfer.
If CPU has built-in cache memory, the transfer source and destination should be placed to the area where the cache memory is set to disabled.
The execution of the Reload function must be completed during the transfer of Next0 or Next1. If the total number of bytes transferred is small, the next transfer may start before the function execution completes. In this case, continuous operation of DMAC transfer is not guaranteed, so when using the Reload function, it is recommended to set the number of bytes to be transferred a little longer, taking into account the bus clock frequency and interrupt processing time.
This is a basic example of minimal use of the DMAC in an application.
This is an example of an application using the DMAC link mode for continuous transfers. DMAC transfer is triggered by R_DMAC_B_SoftwareStart().
In this example, if the MMU is supported, the source and destination addresses are set to non-cached areas of system RAM.
Classes | |
| struct | st_dmac_b_register_set_setting_t |
| struct | st_dmac_b_link_cfg |
| struct | st_dmac_b_instance_ctrl |
| struct | st_dmac_b_extended_cfg |
| struct | st_dmac_b_extended_info |
Typedefs | |
| typedef struct st_dmac_b_register_set_setting_t | dmac_b_register_set_setting_t |
| typedef struct st_dmac_b_link_cfg | dmac_b_link_cfg_t |
| typedef struct st_dmac_b_instance_ctrl | dmac_b_instance_ctrl_t |
| typedef struct st_dmac_b_extended_cfg | dmac_b_extended_cfg_t |
| typedef struct st_dmac_b_extended_info | dmac_b_extended_info_t |
Enumerations | |
| enum | dmac_b_transfer_size_t |
| enum | dmac_b_ack_mode_t |
| enum | dmac_b_external_output_signal_active_level_t |
| enum | dmac_b_external_detection_t |
| enum | dmac_b_internal_detection_t |
| enum | dmac_b_request_direction_t |
| enum | dmac_b_continuous_setting_t |
| enum | dmac_b_channel_scheduling_t |
| enum | dmac_b_mode_select_t |
| enum | dmac_b_link_valid_t |
| enum | dmac_b_link_end_t |
| enum | dmac_b_link_write_back_t |
| enum | dmac_b_link_interrupt_mask_t |
| struct RZV::st_dmac_b_register_set_setting_t |
| struct RZV::st_dmac_b_link_cfg |
Descriptor structure used in DMAC link mode, and variables of dmac_b_link_cfg_t must be allocated in the memory area.
| Class Members | ||
|---|---|---|
| union st_dmac_b_link_cfg | __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 RZV::st_dmac_b_instance_ctrl |
Control block used by driver. DO NOT INITIALIZE - this structure will be initialized in transfer_api_t::open.
| struct RZV::st_dmac_b_extended_cfg |
DMAC transfer configuration extension. This extension is required.
Public Attributes | |
| 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. | |
| dmac_trigger_event_t | activation_source |
| dmac_b_ack_mode_t | ack_mode |
| DACK output mode. | |
| dmac_b_external_input_pin_t | dreq_input_pin |
| DREQ input pin name. | |
| dmac_b_external_output_pin_t | ack_output_pin |
| DACK output pin name. | |
| dmac_b_external_output_pin_t | tend_output_pin |
| TEND output pin name. | |
| dmac_b_external_output_signal_active_level_t | ack_output_signal_active_level |
| DACK output signal active level. | |
| dmac_b_external_output_signal_active_level_t | tend_output_signal_active_level |
| TEND output signal active level. | |
| dmac_b_external_detection_t | external_detection_mode |
| DMAC request detection method for external pin. | |
| dmac_b_internal_detection_t | internal_detection_mode |
| DMAC request detection method for internal pin. | |
| dmac_b_request_direction_t | activation_request_source_select |
| DMAC activation request source. | |
| dmac_b_mode_select_t | dmac_mode |
| DMAC Mode. | |
| dmac_b_link_cfg_t const * | p_descriptor |
| The address of the descriptor (DMA Link Mode only) | |
| dmac_b_continuous_setting_t | continuous_setting |
| Next register operation settings. | |
| uint16_t | transfer_interval |
| DMA transfer interval. | |
| dmac_b_channel_scheduling_t | channel_scheduling |
| DMA channel scheduling. | |
| void(* | p_callback )(dmac_b_callback_args_t *cb_data) |
| void * | p_context |
| void * | p_reg |
| Register base address for specified unit. | |
| dmac_trigger_event_t activation_source |
Select which event will trigger the transfer.
| void(* p_callback) (dmac_b_callback_args_t *cb_data) |
Callback for transfer end interrupt.
| void* p_context |
Placeholder for user data. Passed to the user p_callback in RZV::transfer_callback_args_t.
| struct RZV::st_dmac_b_extended_info |
DMAC transfer information configuration extension. This extension is required.
| Class Members | ||
|---|---|---|
| dmac_b_transfer_size_t | src_size |
Select number of source bytes to transfer at once. |
| dmac_b_transfer_size_t | dest_size |
Select number of destination bytes to transfer at once. |
| dmac_b_register_set_setting_t * | p_next1_register_setting |
Next1 Register set settings |
| typedef struct st_dmac_b_register_set_setting_t dmac_b_register_set_setting_t |
Register set settings. Please refer to the struct st_dmac_b_register_set_setting_t.
| typedef struct st_dmac_b_link_cfg dmac_b_link_cfg_t |
Descriptor structure used in DMAC link mode, and variables of dmac_b_link_cfg_t must be allocated in the memory area. Please refer to the struct st_dmac_b_link_cfg.
| typedef struct st_dmac_b_instance_ctrl dmac_b_instance_ctrl_t |
Control block used by driver. DO NOT INITIALIZE - this structure will be initialized in transfer_api_t::open. Please refer to the struct st_dmac_b_instance_ctrl.
| typedef struct st_dmac_b_extended_cfg dmac_b_extended_cfg_t |
DMAC transfer configuration extension. This extension is required. Please refer to the struct st_dmac_b_extended_cfg.
| typedef struct st_dmac_b_extended_info dmac_b_extended_info_t |
DMAC transfer information configuration extension. This extension is required. Please refer to the struct st_dmac_b_extended_info.
Transfer size specifies the size of each individual transfer.
| enum dmac_b_ack_mode_t |
Detection method of the external DMA request signal.
Detection method of the internal DMA request signal.
| enum dmac_b_mode_select_t |
| enum dmac_b_link_valid_t |
| enum dmac_b_link_end_t |
Masks write back execution of the dmac_b_link_cfg_t::link_valid. When disable, DMAC does not perform write-back operation.
When dmac_b_link_cfg_t::link_valid is DMAC_B_LINK_VALID_DESCRIPTOR_DISABLE at loading of header, specifies whether DMA transfer completion interrupt mask or not.
| Enumerator | |
|---|---|
| DMAC_B_LINK_INTERRUPT_MASK_DISABLE | DMA transfer completion interrupt is asserted. |
| DMAC_B_LINK_INTERRUPT_MASK_ENABLE | DMA transfer completion interrupt is masked. |
| fsp_err_t R_DMAC_B_Open | ( | transfer_ctrl_t *const | p_api_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_B_Reconfigure | ( | transfer_ctrl_t *const | p_api_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_NOT_OPEN | Handle is not initialized. Call R_DMAC_Open to initialize the control block. |
| fsp_err_t R_DMAC_B_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.
| FSP_ERR_UNSUPPORTED | API not supported. |
| fsp_err_t R_DMAC_B_SoftwareStart | ( | transfer_ctrl_t *const | p_api_ctrl, |
| transfer_start_mode_t | mode | ||
| ) |
If the mode is TRANSFER_START_MODE_SINGLE initiate a single transfer with software. If the mode is TRANSFER_START_MODE_REPEAT continue triggering transfers until all of the transfers are completed.
| 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_B_SoftwareStop | ( | transfer_ctrl_t *const | p_api_ctrl | ) |
Stop software transfers if they were started with TRANSFER_START_MODE_REPEAT.
| FSP_SUCCESS | Transfer stopped 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_B_Enable | ( | transfer_ctrl_t *const | p_api_ctrl | ) |
Enable transfers for the configured activation source.
| FSP_SUCCESS | Counter value written successfully. |
| FSP_ERR_ASSERTION | An input parameter is invalid. |
| FSP_ERR_INVALID_ADDRESS | Descriptor address is invalid. |
| FSP_ERR_NOT_OPEN | Handle is not initialized. Call R_DMAC_Open to initialize the control block. |
| fsp_err_t R_DMAC_B_Disable | ( | transfer_ctrl_t *const | p_api_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_B_InfoGet | ( | transfer_ctrl_t *const | p_api_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_B_Close | ( | transfer_ctrl_t *const | p_api_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_B_Reload | ( | transfer_ctrl_t *const | p_api_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_t R_DMAC_B_CallbackSet | ( | transfer_ctrl_t *const | p_api_ctrl, |
| void(*)(dmac_b_callback_args_t *) | p_callback, | ||
| void *const | p_context, | ||
| dmac_b_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_B_LinkDescriptorSet | ( | transfer_ctrl_t *const | p_api_ctrl, |
| dmac_b_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 pointer is NULL. |
| 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_B_Open to initialize the control block. |