mikroSDK Reference Manual
drv_dma.h
Go to the documentation of this file.
1/****************************************************************************
2**
3** Copyright (C) 2024 MikroElektronika d.o.o.
4** Contact: https://www.mikroe.com/contact
5**
6** This file is part of the mikroSDK package
7**
8** Commercial License Usage
9**
10** Licensees holding valid commercial NECTO compilers AI licenses may use this
11** file in accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The MikroElektronika Company.
14** For licensing terms and conditions see
15** https://www.mikroe.com/legal/software-license-agreement.
16** For further information use the contact form at
17** https://www.mikroe.com/contact.
18**
19**
20** GNU Lesser General Public License Usage
21**
22** Alternatively, this file may be used for
23** non-commercial projects under the terms of the GNU Lesser
24** General Public License version 3 as published by the Free Software
25** Foundation: https://www.gnu.org/licenses/lgpl-3.0.html.
26**
27** The above copyright notice and this permission notice shall be
28** included in all copies or substantial portions of the Software.
29**
30** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
31** OF MERCHANTABILITY, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
32** TO THE WARRANTIES FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
33** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
34** DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
35** OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
36** OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
37**
38****************************************************************************/
44#ifndef _DRV_DMA_H_
45#define _DRV_DMA_H_
46
47#ifdef __cplusplus
48extern "C"{
49#endif
50
51#include "drv_name.h"
52#include "hal_dma.h"
53
57typedef enum
58{
60 DMA_ERROR = (-1)
62
71
81
94
107
118
131
146
153typedef uint8_t dma_channel_t[ DMA_NUM_OF_MODULES ][ DMA_NUM_OF_STREAMS_FAMILY ][ DMA_NUM_OF_CHANNELS_FAMILY ];
154
209
229typedef struct
230{
231 handle_t handle;
233 uint8_t module;
234 uint8_t stream;
235 uint8_t channel;
238} dma_t;
239
299
344
372
411
450
489
547err_t dma_set_transfer_config( dma_t *obj, uint32_t addr_src, uint32_t addr_dst, size_t transfer_size, dma_source_memory_region_t src_mem_type );
548
613
682
753
791
792 // drvdmagroup
793 // drvgroup
794 // pergroup
795
796#ifdef __cplusplus
797}
798#endif
799
800#endif // _DRV_DMA_H_
801// ------------------------------------------------------------------------- END
uint8_t dma_channel_t[DMA_NUM_OF_MODULES][DMA_NUM_OF_STREAMS_FAMILY][DMA_NUM_OF_CHANNELS_FAMILY]
Definition drv_dma.h:153
dma_burst_size_t
Definition drv_dma.h:136
@ DMA_BURST_SIZE_INCREMENT_16
Definition drv_dma.h:141
@ DMA_BURST_SIZE_INCREMENT_8
Definition drv_dma.h:140
@ DMA_BURST_SIZE_INCREMENT_32
Definition drv_dma.h:142
@ DMA_BURST_SIZE_INCREMENT_DEFAULT
Definition drv_dma.h:144
@ DMA_BURST_SIZE_INCREMENT_1
Definition drv_dma.h:137
@ DMA_BURST_SIZE_INCREMENT_4
Definition drv_dma.h:139
@ DMA_BURST_SIZE_INCREMENT_2
Definition drv_dma.h:138
dma_priority_t
Definition drv_dma.h:123
@ DMA_PRIORITY_DEFAULT
Definition drv_dma.h:129
@ DMA_PRIORITY_HIGH
Definition drv_dma.h:126
@ DMA_PRIORITY_MEDIUM
Definition drv_dma.h:125
@ DMA_PRIORITY_VERY_HIGH
Definition drv_dma.h:127
@ DMA_PRIORITY_LOW
Definition drv_dma.h:124
dma_err_t
Definition drv_dma.h:58
@ DMA_ERROR
Definition drv_dma.h:60
@ DMA_SUCCESS
Definition drv_dma.h:59
dma_data_align_t
Definition drv_dma.h:99
@ DMA_DATA_ALIGN_BYTES_2
Definition drv_dma.h:101
@ DMA_DATA_ALIGN_DEFAULT
Definition drv_dma.h:105
@ DMA_DATA_ALIGN_BYTES_1
Definition drv_dma.h:100
@ DMA_DATA_ALIGN_BYTES_4
Definition drv_dma.h:103
@ DMA_DATA_ALIGN_BYTES_3
Definition drv_dma.h:102
dma_source_memory_region_t
Definition drv_dma.h:76
@ DMA_SOURCE_MEMORY_REGION_DEEPROM
Definition drv_dma.h:79
@ DMA_SOURCE_MEMORY_REGION_RAM
Definition drv_dma.h:77
@ DMA_SOURCE_MEMORY_REGION_PFM
Definition drv_dma.h:78
dma_direction_t
Definition drv_dma.h:86
@ DMA_DIRECTION_PERIPH_TO_MEMORY
Definition drv_dma.h:89
@ DMA_DIRECTION_MEMORY_TO_PERIPH
Definition drv_dma.h:88
@ DMA_DIRECTION_DEFAULT
Definition drv_dma.h:92
@ DMA_DIRECTION_PERIPH_TO_PERIPH
Definition drv_dma.h:90
@ DMA_DIRECTION_MEMORY_TO_MEMORY
Definition drv_dma.h:87
dma_mode_t
Definition drv_dma.h:112
@ DMA_MODE_CIRCULAR
Definition drv_dma.h:114
@ DMA_MODE_NORMAL
Definition drv_dma.h:113
@ DMA_MODE_DEFAULT
Definition drv_dma.h:116
dma_state_t
Definition drv_dma.h:67
@ DMA_STATE_FREE
Definition drv_dma.h:68
@ DMA_STATE_ALLOCATED
Definition drv_dma.h:69
Pin and port name type definitions.
err_t dma_transfer_start(dma_t *obj)
Initializes the DMA transfer.
err_t dma_set_mode(dma_t *obj, dma_mode_t mode)
Set the DMA mode.
err_t dma_open(dma_t *obj, dma_config_t *config)
Open the DMA Driver object.
void dma_get_channels(dma_channel_t *channels)
Get DMA modules/streams/channels.
err_t dma_transfer_abort(dma_t *obj)
Aborts a DMA transfer.
err_t dma_transfer_stop(dma_t *obj)
Stops the DMA transfer.
err_t dma_set_transfer_config(dma_t *obj, uint32_t addr_src, uint32_t addr_dst, size_t transfer_size, dma_source_memory_region_t src_mem_type)
Configure the DMA transfer.
err_t dma_set_direction(dma_t *obj, dma_direction_t direction)
Set the DMA direction.
err_t dma_set_priority(dma_t *obj, dma_priority_t priority)
Set the DMA priority.
err_t dma_close(dma_t *obj)
Close DMA Driver object.
void dma_configure_default(dma_config_t *config)
Configure DMA Driver configuration structure.
API for DMA HAL level.
int32_t err_t
Definition hal_target.h:64
DMA Configuration Structure prototype.
Definition drv_dma.h:177
dma_mode_t mode
Definition drv_dma.h:185
dma_direction_t direction
Definition drv_dma.h:181
dma_priority_t priority
Definition drv_dma.h:203
dma_burst_size_t burst_size_destination
Definition drv_dma.h:198
bool dst_inc
Definition drv_dma.h:195
uint8_t channel
Definition drv_dma.h:180
uint8_t uint8_t stream
Definition drv_dma.h:179
uint32_t addr_dst
Definition drv_dma.h:206
dma_data_align_t data_align_source
Definition drv_dma.h:188
size_t transfer_length
Definition drv_dma.h:207
bool src_inc
Definition drv_dma.h:187
dma_data_align_t data_align_destination
Definition drv_dma.h:196
dma_burst_size_t burst_size_source
Definition drv_dma.h:190
uint32_t addr_src
Definition drv_dma.h:205
DMA Handle prototype.
Definition drv_dma.h:230
uint8_t channel
Definition drv_dma.h:235
bool initialized
Definition drv_dma.h:237
dma_config_t config
Definition drv_dma.h:232
dma_state_t allocated
Definition drv_dma.h:236
handle_t handle
Definition drv_dma.h:231
uint8_t uint8_t stream
Definition drv_dma.h:234