InES Hardware Abstraction Layer
hal_dma.h
Go to the documentation of this file.
1 /* ----------------------------------------------------------------------------
2  * -- _____ ______ _____ -
3  * -- |_ _| | ____|/ ____| -
4  * -- | | _ __ | |__ | (___ Institute of Embedded Systems -
5  * -- | | | '_ \| __| \___ \ Zurich University of -
6  * -- _| |_| | | | |____ ____) | Applied Sciences -
7  * -- |_____|_| |_|______|_____/ 8401 Winterthur, Switzerland -
8  * ------------------------------------------------------------------------- */
18 /* Re-definition guard */
19 #ifndef _HAL_DMA_H
20 #define _HAL_DMA_H
21 
22 
23 /* User includes */
24 #include "reg_stm32f4xx.h"
25 #include "hal_common.h"
26 
27 
28 /* -- Type definitions
29  * ------------------------------------------------------------------------- */
30 
35 typedef enum {
36  HAL_DMA_STREAM_0 = 0u,
37  HAL_DMA_STREAM_1 = 1u,
38  HAL_DMA_STREAM_2 = 2u,
39  HAL_DMA_STREAM_3 = 3u,
40  HAL_DMA_STREAM_4 = 4u,
41  HAL_DMA_STREAM_5 = 5u,
42  HAL_DMA_STREAM_6 = 6u,
43  HAL_DMA_STREAM_7 = 7u
45 
46 
52 typedef enum {
53  HAL_DMA_CHANNEL_0 = 0u,
54  HAL_DMA_CHANNEL_1 = 1u,
55  HAL_DMA_CHANNEL_2 = 2u,
56  HAL_DMA_CHANNEL_3 = 3u,
57  HAL_DMA_CHANNEL_4 = 4u,
58  HAL_DMA_CHANNEL_5 = 5u,
59  HAL_DMA_CHANNEL_6 = 6u,
60  HAL_DMA_CHANNEL_7 = 7u
62 
63 
69 typedef enum {
70  HAL_DMA_PER_TO_MEM = 0x0,
71  HAL_DMA_MEM_TO_PER = 0x1,
72  HAL_DMA_MEM_TO_MEM = 0x2
74 
75 
80 typedef enum {
81  HAL_DMA_SIZE_8B = 0x0,
82  HAL_DMA_SIZE_16B = 0x1,
83  HAL_DMA_SIZE_32B = 0x2
85 
86 
91 typedef struct {
95  uint32_t source;
97  uint32_t destination;
100  uint8_t nr_transactions;
103 
104 
105 /* -- Public function declarations
106  * ------------------------------------------------------------------------- */
107 
113 void hal_dma_reset(reg_dma_t *dma, hal_dma_stream_t stream)
114 __attribute__((deprecated("Please use DMAx_RESET().")));
115 
122 void hal_dma_init_base(reg_dma_t *dma,
123  hal_dma_stream_t stream,
124  hal_dma_init_t init);
125 
131 void hal_dma_start(reg_dma_t *dma, hal_dma_stream_t stream);
132 
138 void hal_dma_stop(reg_dma_t *dma, hal_dma_stream_t stream);
139 
140 
141 #endif
hal_dma_dir_t
Defines the possible directions of the transfer, refer to manual p.306ff.
Definition: hal_dma.h:69
uint32_t destination
Definition: hal_dma.h:97
hal_dma_size_t
Specifies the size of the register / data.
Definition: hal_dma.h:80
uint8_t nr_transactions
Definition: hal_dma.h:100
void hal_dma_init_base(reg_dma_t *dma, hal_dma_stream_t stream, hal_dma_init_t init)
Initializes a basic dma transfer.
Registries for STM32F4xx.
hal_dma_channel_t
Defines the available channels of each stream, refer to manual p.304ff.
Definition: hal_dma.h:52
hal_dma_size_t size
Definition: hal_dma.h:99
uint32_t source
Definition: hal_dma.h:95
hal_dma_stream_t
Defines the available streams of the dma, refer to manual p.304ff.
Definition: hal_dma.h:35
hal_dma_channel_t channel
Definition: hal_dma.h:92
hal_dma_dir_t direction
Definition: hal_dma.h:93
Common #defines and typedefs.
hal_bool_t continous
Definition: hal_dma.h:101
void hal_dma_reset(reg_dma_t *dma, hal_dma_stream_t stream) __attribute__((deprecated("Please use DMAx_RESET().")))
Resets the specified dma stream to its default values.
Initialization structure for direct memory access.
Definition: hal_dma.h:91
void hal_dma_start(reg_dma_t *dma, hal_dma_stream_t stream)
Starts the dma transfer.
hal_bool_t
Often used TRUE / FALSE type.
Definition: hal_common.h:31
void hal_dma_stop(reg_dma_t *dma, hal_dma_stream_t stream)
Starts the dma transfer.
Representation of DMA register.
Definition: reg_stm32f4xx.h:393