|
fsp_err_t | R_DMAC_B_Open (transfer_ctrl_t *const p_api_ctrl, transfer_cfg_t const *const p_cfg) |
|
fsp_err_t | R_DMAC_B_Reconfigure (transfer_ctrl_t *const p_api_ctrl, transfer_info_t *p_info) |
|
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) |
|
fsp_err_t | R_DMAC_B_SoftwareStart (transfer_ctrl_t *const p_api_ctrl, transfer_start_mode_t mode) |
|
fsp_err_t | R_DMAC_B_SoftwareStop (transfer_ctrl_t *const p_api_ctrl) |
|
fsp_err_t | R_DMAC_B_Enable (transfer_ctrl_t *const p_api_ctrl) |
|
fsp_err_t | R_DMAC_B_Disable (transfer_ctrl_t *const p_api_ctrl) |
|
fsp_err_t | R_DMAC_B_InfoGet (transfer_ctrl_t *const p_api_ctrl, transfer_properties_t *const p_info) |
|
fsp_err_t | R_DMAC_B_Close (transfer_ctrl_t *const p_api_ctrl) |
|
fsp_err_t | R_DMAC_B_Reload (transfer_ctrl_t *const p_api_ctrl, void const *p_src, void *p_dest, uint32_t const num_transfers) |
|
Driver for the DMAC peripheral on RZ MPUs. This module implements the Transfer Interface.
Overview
The Direct Memory Access Controller (DMAC) transfers data from one memory location to another without using the CPU.
Features
- Supports multiple transfer modes
- Normal transfer
- Block transfer
- Support Register mode
- Supports Next0 Register set and Next1 Register set
- Address increment, fixed
- Triggered by peripheral module events
- See "Table 14.3" in "14.5.2 DMA Transfer Requests" in the User's manual.
- Supports 1, 2, 4, 8, 16, 32, 64, 128 byte data units
- Configurable DMA transfer activation request source, detection method of DMA request signal and DACK output mode
- Configurable DMA transfer interval
- Configurable DMAC channel priority
Configuration
Build Time Configurations for r_dmac_b
The following build time configurations are defined in fsp_cfg/r_dmac_b_cfg.h:
Configuration | Options | Default | Description |
Parameter Checking |
-
Default (BSP)
-
Enabled
-
Disabled
| Default (BSP) | If selected code for parameter checking is included in the build. |
Configurations for Transfer > Transfer (r_dmac_b)
This module can be added to the Stacks tab via New Stack > Transfer > Transfer (r_dmac_b).
Configuration | Options | Default | Description |
Name | Name must be a valid C symbol | g_transfer0 | Module name. |
Unit | MCU Specific Options | | Specify the hardware unit. |
Channel | Must be a valid integer between 0 and 15. | 0 | Specify the hardware channel. |
Mode |
| Normal | Select the transfer mode. |
Source Data Size |
-
1 Byte
-
2 Bytes
-
4 Bytes
-
8 Bytes
-
16 Bytes
-
32 Bytes
-
64 Bytes
-
128 Bytes
| 2 Bytes | Select the source data size. |
Destination Data Size |
-
1 Byte
-
2 Bytes
-
4 Bytes
-
8 Bytes
-
16 Bytes
-
32 Bytes
-
64 Bytes
-
128 Bytes
| 2 Bytes | Select the destination data size. |
Destination Address Mode |
| Fixed | Select the address mode for the destination. |
Source Address Mode |
| Fixed | Select the address mode for the source. |
Activation Source | MCU Specific Options | | Select the DMAC transfer start event. |
DMA Activation Request Source Select |
-
Requested by a transfer source module
-
Requested by a transfer destination module
| Requested by a transfer source module | DMA Activation Request Source Select. |
DACK Output mode | MCU Specific Options | | Select DACK output mode. |
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) |
DMAC Mode | Register Mode | Register Mode | Select DMAC Mode. |
Callback | Name must be a valid C symbol | NULL | A user callback that is called at the end of the transfer. |
Context | Manual Entry | NULL | Pointer to the context structure passed through the callback argument. |
Transfer End Interrupt Enable | MCU Specific Options | | Enable the transfer end interrupt. |
Transfer End Interrupt Priority | Value must be an integer between 0 and 255 | 12 | Select the transfer end interrupt priority. |
Transfer Interval | Value must be a non-negative integer | 0 | Transfer interval |
Channel Priority |
| module.driver.transfer_on_dmac_b.channel_priority.fixed | Channel Priority |
Transfer Continuation |
-
DMA transfer only once
-
Transfer with Setting 1 and Setting 2 alternately
| DMA transfer only once | When Next0 Register Set Transfer completes, Next1 Register Set Transfer occurs |
Setting 1 Destination Address | Manual Entry | NULL | Specify the transfer destination address. |
Setting 1 Source Address | Manual Entry | NULL | Specify the transfer source address. |
Setting 1 Total Number of Transfer Bytes | Value must be a non-negative integer | 1 | Specify the total number of transfer bytes. |
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.) |
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.) |
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.) |
- Warning
- "DMA Activation Request Source Select", "Low Detection Enable", "High Detection Enable", and "DACK output" must be set according to the DMAC transfer source. For details, see 'DMA Transfer Request Detection Operation Setting Table' of User's Manual.
Clock Configuration
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.
Pin Configuration
This module does not use I/O pins.
Usage Notes
Transfer Modes
The DMAC Module supports two modes of operation.
- Normal Mode - In normal mode, a single data unit is forwarded each time a configured peripheral module event is received by the DMAC channel. The data unit can be 1 byte, 2 bytes, 4 bytes, 8 bytes, 16 bytes, 32 bytes, 64 bytes, or 128 bytes. The source and destination addresses can be fixed or incremented. The 32-bit counter decrements on every transfer. When the counter reaches 0, the peripheral module event no longer triggers the transfer and you can interrupt the CPU to signal that all transfers have finished.
- Block Mode - In block mode, the amount of data units transfered by each interrupt. For one DMA request, performs transfers until a DMA transfer completes. When the counter reaches 0, transfers will no longer be triggered by the peripheral module event and the CPU can be interrupted to signal that all transfers have finished.
Limitations
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.
It is not supported DMA transfer to DDR-SDRAM area (0x6000_0000 to 0x7FFF_FFFF) in the current driver version of RZ/G3S . Therefore, do not specify addresses in this area as source or destination addresses.
Examples
Basic Example
This is a basic example of minimal use of the DMAC in an application.
void dmac_minimal_example (void)
{
assert(FSP_SUCCESS == err);
assert(FSP_SUCCESS == err);
}
◆ dmac_b_callback_args_t
struct dmac_b_callback_args_t |
Callback function parameter data.
Data Fields |
dmac_b_event_t |
event |
Event code. |
void const * |
p_context |
Placeholder for user data. Set in r_transfer_t::open function in transfer_cfg_t. |
◆ dmac_b_register_set_setting_t
struct dmac_b_register_set_setting_t |
Data Fields |
void const * |
p_src |
Source pointer. |
void * |
p_dest |
Destination pointer. |
uint32_t |
length |
Transfer byte. |
◆ dmac_b_instance_ctrl_t
struct dmac_b_instance_ctrl_t |
Control block used by driver. DO NOT INITIALIZE - this structure will be initialized in transfer_api_t::open.
◆ dmac_b_extended_cfg_t
struct dmac_b_extended_cfg_t |
DMAC transfer configuration extension. This extension is required.
◆ activation_source
dmac_trigger_event_t dmac_b_extended_cfg_t::activation_source |
Select which event will trigger the transfer.
◆ p_callback
Callback for transfer end interrupt.
◆ p_context
void const* dmac_b_extended_cfg_t::p_context |
◆ dmac_b_extended_info_t
struct dmac_b_extended_info_t |
DMAC transfer information configuration extension. This extension is required.
◆ DMAC_B_MAX_NORMAL_TRANSFER_LENGTH
#define DMAC_B_MAX_NORMAL_TRANSFER_LENGTH |
Max configurable number of transfers in TRANSFER_MODE_NORMAL.
◆ DMAC_B_MAX_BLOCK_TRANSFER_LENGTH
#define DMAC_B_MAX_BLOCK_TRANSFER_LENGTH |
Max number of transfers per block in TRANSFER_MODE_BLOCK
◆ dmac_b_event_t
Events that can trigger a callback function.
Enumerator |
---|
DMAC_B_EVENT_TRANSFER_END | DMA transfer has completed.
|
DMAC_B_EVENT_TRANSFER_ERROR | A bus error occurred during DMA transfer.
|
◆ dmac_b_transfer_size_t
Transfer size specifies the size of each individual transfer.
Enumerator |
---|
DMAC_B_TRANSFER_SIZE_1_BYTE | Each transfer transfers a 8-bit value.
|
DMAC_B_TRANSFER_SIZE_2_BYTE | Each transfer transfers a 16-bit value.
|
DMAC_B_TRANSFER_SIZE_4_BYTE | Each transfer transfers a 32-bit value.
|
DMAC_B_TRANSFER_SIZE_8_BYTE | Each transfer transfers a 64-bit value.
|
DMAC_B_TRANSFER_SIZE_16_BYTE | Each transfer transfers a 128-bit value.
|
DMAC_B_TRANSFER_SIZE_32_BYTE | Each transfer transfers a 256-bit value.
|
DMAC_B_TRANSFER_SIZE_64_BYTE | Each transfer transfers a 512-bit value.
|
DMAC_B_TRANSFER_SIZE_128_BYTE | Each transfer transfers a 1024-bit value.
|
◆ dmac_b_ack_mode_t
DACK output mode. See RZ/T2M hardware manual Table 14.19 DMA Transfer Request Detection Operation Setting Table.
Enumerator |
---|
DMAC_B_ACK_MODE_LEVEL_MODE | Level mode.
|
DMAC_B_ACK_MODE_BUS_CYCLE_MODE | Bus cycle mode.
|
DMAC_B_ACK_MODE_MASK_DACK_OUTPUT | Output is masked.
|
◆ dmac_b_external_detection_t
Detection method of the external DMA request signal. See RZ/T2M hardware manual Table 14.19 DMA Transfer Request Detection Operation Setting Table.
Enumerator |
---|
DMAC_B_EXTERNAL_DETECTION_LOW_LEVEL | Low level detection.
|
DMAC_B_EXTERNAL_DETECTION_FALLING_EDGE | Falling edge detection.
|
DMAC_B_EXTERNAL_DETECTION_RISING_EDGE | Rising edge detection.
|
DMAC_B_EXTERNAL_DETECTION_FALLING_RISING_EDGE | Falling/Rising edge detection.
|
DMAC_B_EXTERNAL_DETECTION_NO_DETECTION | Not using hardware detection.
|
DMAC_B_EXTERNAL_DETECTION_NO_DETECTION | Not using hardware detection.
|
DMAC_B_EXTERNAL_DETECTION_NO_DETECTION | Not using hardware detection.
|
◆ dmac_b_internal_detection_t
Detection method of the internal DMA request signal. See RZ/T2M hardware manual Table 14.19 DMA Transfer Request Detection Operation Setting Table.
Enumerator |
---|
DMAC_B_INTERNAL_DETECTION_NO_DETECTION | Not using hardware detection.
|
DMAC_B_INTERNAL_DETECTION_FALLING_EDGE | Falling edge detection.
|
DMAC_B_INTERNAL_DETECTION_RISING_EDGE | Rising edge detection.
|
DMAC_B_INTERNAL_DETECTION_LOW_LEVEL | Low level detection.
|
DMAC_B_INTERNAL_DETECTION_HIGH_LEVEL | High level detection.
|
◆ dmac_b_request_direction_t
DMA activation request source select. See RZ/T2M hardware manual Table 14.19 DMA Transfer Request Detection Operation Setting Table.
Enumerator |
---|
DMAC_B_REQUEST_DIRECTION_SOURCE_MODULE | Requested by a transfer source module.
|
DMAC_B_REQUEST_DIRECTION_DESTINATION_MODULE | Requested by a transfer destination module.
|
◆ dmac_b_continuous_setting_t
Select the Next register set to be executed next.
Enumerator |
---|
DMAC_B_CONTINUOUS_SETTING_TRANSFER_ONCE | Transfer only once using the Next0 register set.
|
DMAC_B_CONTINUOUS_SETTING_TRANSFER_ALTERNATELY | Transfers are performed alternately with the Next0 register set and the Next1 register set.
|
◆ dmac_b_channel_scheduling_t
DMAC channel scheduling.
Enumerator |
---|
DMAC_B_CHANNEL_SCHEDULING_FIXED | Fixed priority mode.
|
DMAC_B_CHANNEL_SCHEDULING_ROUND_ROBIN | Round-robin mode.
|
◆ dmac_b_mode_select_t
DMAC mode setting.
Enumerator |
---|
DMAC_B_MODE_SELECT_REGISTER | Register mode.
|
DMAC_B_MODE_SELECT_LINK | Link mode.
|
◆ R_DMAC_B_Open()
Configure a DMAC channel.
- Return values
-
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. |
◆ R_DMAC_B_Reconfigure()
Reconfigure the transfer with new transfer info.
- Return values
-
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. |
◆ R_DMAC_B_Reset()
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.
- Return values
-
FSP_ERR_UNSUPPORTED | API not supported. |
◆ R_DMAC_B_SoftwareStart()
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.
- Return values
-
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. |
◆ R_DMAC_B_SoftwareStop()
Stop software transfers if they were started with TRANSFER_START_MODE_REPEAT.
- Return values
-
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. |
◆ R_DMAC_B_Enable()
Enable transfers for the configured activation source.
- Return values
-
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. |
◆ R_DMAC_B_Disable()
Disable transfers so that they are no longer triggered by the activation source.
- Return values
-
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. |
◆ R_DMAC_B_InfoGet()
Set driver specific information in provided pointer.
- Return values
-
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. |
◆ R_DMAC_B_Close()
Disable transfer and clean up internal data. Implements transfer_api_t::close.
- Return values
-
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. |
◆ R_DMAC_B_Reload()
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.
- Return values
-
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. |