PER Firmware
Loading...
Searching...
No Matches
dma.h
Go to the documentation of this file.
1
12#ifndef _DMA_H_
13#define _DMA_H_
14
15#include "common/phal_F4_F7/phal_F4_F7.h"
16
17typedef struct {
18 uint32_t periph_addr;
19 uint32_t mem_addr;
20 uint16_t tx_size;
21 uint8_t mem_size;
22
23 bool increment;
24 bool circular;
25 uint8_t dir;
26 bool mem_inc;
27 bool periph_inc;
28 bool mem_to_mem;
29 uint8_t priority;
30 uint8_t periph_size;
31 bool tx_isr_en;
32 uint8_t dma_chan_request;
33 uint8_t stream_idx;
34
35 DMA_TypeDef* periph;
36 DMA_Stream_TypeDef* stream; // Example DMA1_Stream0 or DMA2_Stream7
38
39/*
40 * @brief Initialize DMA peripheral to set m2m, p2p, or p2m with set size
41 * and length of txfer
42 *
43 * @param init -> Address of initialization structure
44 * @return true -> Successful init (no clashing params)
45 * @return false -> Init not complete (parameters clash)
46 */
47bool PHAL_initDMA(dma_init_t* init);
48
49/*
50 * @brief Start txfer after sucessful DMA peripheral initialization
51 *
52 * @param init -> Address of initialization structure
53 */
54void PHAL_startTxfer(dma_init_t* init);
55
56/*
57 * @brief Stop txfer
58 *
59 * @param init -> Address of initialization structure
60 */
61void PHAL_stopTxfer(dma_init_t* init);
62
63/*
64 * @brief Re-enable DMA txfer after error ISR fires
65 *
66 * @param init -> Address of initialization structure
67 */
68void PHAL_reEnable(dma_init_t* init);
69
70/*
71 * @brief Set memory address for DMA transfer. In Mem to Mem this acts as the source address
72 *
73 * @param init -> Address of initialization structure
74 */
75void PHAL_DMA_setMemAddress(dma_init_t* init, const uint32_t address);
76
77/*
78 * @brief Set transfer length for DMA transaction
79 *
80 * @param init -> Address of initialization structure
81 */
82void PHAL_DMA_setTxferLength(dma_init_t* init, const uint32_t length);
83
84#endif
Definition dma.h:17