mikroSDK Reference Manual
hal_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 _HAL_DMA_H_
45#define _HAL_DMA_H_
46
47#ifdef __cplusplus
48extern "C"{
49#endif
50
51#include "hal_target.h"
52
56typedef enum
57{
59 HAL_DMA_ERROR = (-1)
61
70
80
93
106
117
130
145
152typedef uint8_t hal_dma_channel_t[ DMA_NUM_OF_MODULES ][ DMA_NUM_OF_STREAMS_FAMILY ][ DMA_NUM_OF_CHANNELS_FAMILY ];
153
208
228typedef struct
229{
230 handle_t handle;
232 uint8_t module;
233 uint8_t stream;
234 uint8_t channel;
237} hal_dma_t;
238
295
340
368
407
446
485
543err_t hal_dma_set_transfer_config( hal_dma_t *obj, uint32_t addr_src, uint32_t addr_dst, size_t transfer_size, hal_dma_source_memory_region_t src_mem_type );
544
609
678
749
787
788 // haldmagroup
789 // halgroup
790 // pergroup
791
792#ifdef __cplusplus
793}
794#endif
795
796#endif // _HAL_DMA_H_
797// ------------------------------------------------------------------------- END
err_t hal_dma_set_transfer_config(hal_dma_t *obj, uint32_t addr_src, uint32_t addr_dst, size_t transfer_size, hal_dma_source_memory_region_t src_mem_type)
Configure the DMA transfer.
err_t hal_dma_set_mode(hal_dma_t *obj, hal_dma_mode_t mode)
Set the DMA mode.
void hal_dma_configure_default(hal_dma_config_t *config)
Configure DMA HAL configuration structure.
err_t hal_dma_close(hal_dma_t *obj)
Close DMA HAL object.
void hal_dma_get_channels(hal_dma_channel_t *channels)
Get DMA modules/streams/channels.
err_t hal_dma_set_priority(hal_dma_t *obj, hal_dma_priority_t priority)
Set the DMA priority.
err_t hal_dma_transfer_stop(hal_dma_t *obj)
Stops the DMA transfer.
err_t hal_dma_set_direction(hal_dma_t *obj, hal_dma_direction_t direction)
Set the DMA direction.
err_t hal_dma_transfer_abort(hal_dma_t *obj)
Aborts a DMA transfer.
err_t hal_dma_open(hal_dma_t *obj, hal_dma_config_t *config)
Open the DMA HAL object.
err_t hal_dma_transfer_start(hal_dma_t *obj)
Initializes the DMA transfer.
hal_dma_err_t
Definition hal_dma.h:57
@ HAL_DMA_ERROR
Definition hal_dma.h:59
@ HAL_DMA_SUCCESS
Definition hal_dma.h:58
hal_dma_state_t
Definition hal_dma.h:66
@ HAL_DMA_STATE_ALLOCATED
Definition hal_dma.h:68
@ HAL_DMA_STATE_FREE
Definition hal_dma.h:67
uint8_t hal_dma_channel_t[DMA_NUM_OF_MODULES][DMA_NUM_OF_STREAMS_FAMILY][DMA_NUM_OF_CHANNELS_FAMILY]
Definition hal_dma.h:152
hal_dma_mode_t
Definition hal_dma.h:111
@ HAL_DMA_MODE_NORMAL
Definition hal_dma.h:112
@ HAL_DMA_MODE_DEFAULT
Definition hal_dma.h:115
@ HAL_DMA_MODE_CIRCULAR
Definition hal_dma.h:113
hal_dma_data_align_t
Definition hal_dma.h:98
@ HAL_DMA_DATA_ALIGN_BYTES_2
Definition hal_dma.h:100
@ HAL_DMA_DATA_ALIGN_DEFAULT
Definition hal_dma.h:104
@ HAL_DMA_DATA_ALIGN_BYTES_1
Definition hal_dma.h:99
@ HAL_DMA_DATA_ALIGN_BYTES_3
Definition hal_dma.h:101
@ HAL_DMA_DATA_ALIGN_BYTES_4
Definition hal_dma.h:102
hal_dma_source_memory_region_t
Definition hal_dma.h:75
@ HAL_DMA_SOURCE_MEMORY_REGION_DEEPROM
Definition hal_dma.h:78
@ HAL_DMA_SOURCE_MEMORY_REGION_RAM
Definition hal_dma.h:76
@ HAL_DMA_SOURCE_MEMORY_REGION_PFM
Definition hal_dma.h:77
hal_dma_priority_t
Definition hal_dma.h:122
@ HAL_DMA_PRIORITY_MEDIUM
Definition hal_dma.h:124
@ HAL_DMA_PRIORITY_HIGH
Definition hal_dma.h:125
@ HAL_DMA_PRIORITY_LOW
Definition hal_dma.h:123
@ HAL_DMA_PRIORITY_VERY_HIGH
Definition hal_dma.h:126
@ HAL_DMA_PRIORITY_DEFAULT
Definition hal_dma.h:128
hal_dma_direction_t
Definition hal_dma.h:85
@ HAL_DMA_DIRECTION_DEFAULT
Definition hal_dma.h:91
@ HAL_DMA_DIRECTION_PERIPH_TO_PERIPH
Definition hal_dma.h:89
@ HAL_DMA_DIRECTION_MEMORY_TO_MEMORY
Definition hal_dma.h:86
@ HAL_DMA_DIRECTION_MEMORY_TO_PERIPH
Definition hal_dma.h:87
@ HAL_DMA_DIRECTION_PERIPH_TO_MEMORY
Definition hal_dma.h:88
hal_dma_burst_size_t
Definition hal_dma.h:135
@ HAL_DMA_BURST_SIZE_INCREMENT_32
Definition hal_dma.h:141
@ HAL_DMA_BURST_SIZE_INCREMENT_1
Definition hal_dma.h:136
@ HAL_DMA_BURST_SIZE_INCREMENT_4
Definition hal_dma.h:138
@ HAL_DMA_BURST_SIZE_INCREMENT_16
Definition hal_dma.h:140
@ HAL_DMA_BURST_SIZE_INCREMENT_8
Definition hal_dma.h:139
@ HAL_DMA_BURST_SIZE_INCREMENT_2
Definition hal_dma.h:137
@ HAL_DMA_BURST_SIZE_INCREMENT_DEFAULT
Definition hal_dma.h:143
HAL target macros and typedefs.
int32_t err_t
Definition hal_target.h:64
HAL DMA Configuration Structure prototype.
Definition hal_dma.h:176
bool source_inc
Definition hal_dma.h:186
hal_dma_burst_size_t burst_size_destination
Definition hal_dma.h:197
hal_dma_direction_t direction
Definition hal_dma.h:180
hal_dma_data_align_t data_align_source
Definition hal_dma.h:187
hal_dma_burst_size_t burst_size_source
Definition hal_dma.h:189
bool destination_inc
Definition hal_dma.h:194
hal_dma_priority_t priority
Definition hal_dma.h:202
hal_dma_mode_t mode
Definition hal_dma.h:184
hal_dma_data_align_t data_align_destination
Definition hal_dma.h:195
uint32_t addr_src
Definition hal_dma.h:204
size_t transfer_length
Definition hal_dma.h:206
uint8_t channel
Definition hal_dma.h:179
uint32_t addr_dst
Definition hal_dma.h:205
uint8_t uint8_t stream
Definition hal_dma.h:178
HAL DMA Handle prototype.
Definition hal_dma.h:229
uint8_t uint8_t stream
Definition hal_dma.h:233
bool initialized
Definition hal_dma.h:236
hal_dma_config_t config
Definition hal_dma.h:231
uint8_t channel
Definition hal_dma.h:234
hal_dma_state_t allocated
Definition hal_dma.h:235
handle_t handle
Definition hal_dma.h:230