libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
dma_common.c
Go to the documentation of this file.
1/** @addtogroup dma_file DMA peripheral API
2 * @ingroup peripheral_apis
3 */
4/*
5 * This file is part of the libopencm3 project.
6 *
7 * Copyright (C) 2015 Kuldeep Singh Dhaka <kuldeepdhaka9@gmail.com>
8 *
9 * This library is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU Lesser General Public License as published by
11 * the Free Software Foundation, either version 3 of the License, or
12 * (at your option) any later version.
13 *
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public License
20 * along with this library. If not, see <http://www.gnu.org/licenses/>.
21 */
22
24
25/**@{*/
26
27#define CHANNEL_SUPPORT_LOOP(ch) (((ch) == DMA_CH0) || ((ch) == DMA_CH1))
28
29/**
30 * Enable DMA with privileged access
31 * @see dma_enable_with_unprivileged_access()
32 */
34{
36}
37
38/**
39 * Enable DMA with un-privileged access
40 * @see dma_enable_with_privileged_access()
41 */
43{
45}
46
47/**
48 * same as @a dma_enable_with_unprivileged_access()
49 * @see dma_enable_with_unprivileged_access()
50 */
51void dma_enable(void)
52{
54}
55
56/**
57 * Disable DMA
58 */
59void dma_disable(void)
60{
61 DMA_CONFIG = 0;
62}
63
64/**
65 * Set channel's descriptor address
66 * @param[in] desc_base Address of channel's descriptor address
67 * @note @a desc_base 8LSB's should be 0x00
68 */
69void dma_set_desc_address(uint32_t desc_base)
70{
71 if (desc_base & 0xFF) {
72 return;
73 }
74
75 DMA_CTRLBASE = desc_base;
76}
77
78/**
79 * Get channel wait on request status flag
80 * @retval true if flag is set
81 * @retval false if flag is not set
82 */
84{
85 uint32_t mask = DMA_CHWAITSTATUS_CHxWAITSTATUS(ch);
86 return (DMA_CHWAITSTATUS & mask) != 0;
87}
88
89/**
90 * Generate a software request on channel
91 * @param[in] ch Channel (use DMA_CHx)
92 */
94{
96}
97
98/**
99 * Enable channel burst only
100 * @param[in] ch Channel (use DMA_CHx)
101 */
103{
105}
106
107/**
108 * Enable channel single and burst
109 * @param[in] ch Channel (use DMA_CHx)
110 */
112{
114}
115
116/**
117 * Enable channel peripherial request
118 * @param[in] ch Channel (use DMA_CHx)
119 */
121{
123}
124
125/**
126 * Disable channel peripherial request
127 * @param[in] ch Channel (use DMA_CHx)
128 */
130{
132}
133
134/**
135 * Enable channel
136 * @param[in] ch Channel (use DMA_CHx)
137 */
139{
141}
142
143/**
144 * Disable channel
145 * @param[in] ch Channel (use DMA_CHx)
146 */
148{
150}
151
152/**
153 * Disable channel alternate structure
154 * @param[in] ch Channel (use DMA_CHx)
155 */
157{
159}
160
161/**
162 * Enable channel alternate structure
163 * @param[in] ch Channel (use DMA_CHx)
164 */
166{
168}
169
170/**
171 * Enable channel high priority
172 * @param[in] ch Channel (use DMA_CHx)
173 */
175{
177}
178
179/**
180 * Disable channel high priority
181 * @param[in] ch Channel (use DMA_CHx)
182 */
184{
186}
187
188/**
189 * Get bus error flag
190 * @retval true if flag is set
191 * @retval false if flag is not set
192 */
194{
195 return (DMA_ERRORC & DMA_ERRORC_ERRORC) != 0;
196}
197
198/**
199 * Clear bus error flag
200 */
202{
204}
205
206/**
207 * Get channel request flag
208 * @param[in] ch Channel (use DMA_CHx)
209 * @retval true if flag is set
210 * @retval false if flag is not set
211 */
213{
214 uint32_t mask = DMA_CHREQSTATUS_CHxSREQSTATUS(ch);
215 return (DMA_CHREQSTATUS & mask) != 0;
216}
217
218/**
219 * Get bus error interrupt flag
220 * @retval true if flag is set
221 * @retval false if flag is not set
222 */
224{
225 return (DMA_IF & DMA_IF_ERR) != 0;
226}
227
228/**
229 * Get channel done interrupt flag
230 * @param[in] ch Channel (use DMA_CHx)
231 * @retval true if flag is set
232 * @retval false if flag is not set
233 *
234 */
236{
237 return (DMA_IF & DMA_IF_CHxDONE(ch)) != 0;
238}
239
240/**
241 * Set bus error interrupt flag
242 */
244{
246}
247
248/**
249 * Set channel done interrupt flag
250 * @param[in] ch Channel (use DMA_CHx)
251 */
253{
255}
256
257/**
258 * Clear bus error interrupt flag
259 */
261{
263}
264
265/**
266 * Clear channel done interrupt flag
267 * @param[in] ch Channel (use DMA_CHx)
268 */
270{
272}
273
274/**
275 * Enable bus error interrupt
276 */
278{
280}
281
282/**
283 * Disable bus error interrupt
284 */
286{
287 DMA_IEN &= ~DMA_IEN_ERR;
288}
289
290/**
291 * Enable channel done interrupt
292 * @param[in] ch Channel (use DMA_CHx)
293 */
295{
297}
298
299/**
300 * Disable channel done interrupt
301 * @param[in] ch Channel (use DMA_CHx)
302 */
304{
305 DMA_IEN &= ~DMA_IEN_CHxDONE(ch);
306}
307
308/**
309 * Set channel source
310 * @param[in] ch Channel (use DMA_CHx)
311 * @param[in] source Source (use DMA_CH_CTRL_SOURCESEL_*)
312 */
313void dma_set_source(enum dma_ch ch, uint32_t source)
314{
315 DMA_CHx_CTRL(ch) = (DMA_CHx_CTRL(ch) & ~DMA_CH_CTRL_SOURCESEL_MASK)
316 | source;
317}
318
319/**
320 * Set channel source signal
321 * @param[in] ch Channel (use DMA_CHx)
322 * @param[in] signal Signal (use DMA_CH_CTRL_SIGSEL_*)
323 */
324void dma_set_signal(enum dma_ch ch, uint32_t signal)
325{
326 DMA_CHx_CTRL(ch) = (DMA_CHx_CTRL(ch) & ~DMA_CH_CTRL_SIGSEL_MASK)
327 | signal;
328}
329
330/**
331 * Reset channel
332 * @param[in] ch Channel (use DMA_CHx)
333 */
335{
336 /* Disable channel */
338 /* reset channel alternate desc */
340 /* reset channel priority */
342 /* clear channel interrupt */
344 /* disable loop */
345 if (CHANNEL_SUPPORT_LOOP(ch)) {
346 DMA_LOOPx(ch) = 0;
347 }
348 /* reset signal {source, select} */
349 DMA_CHx_CTRL(ch) = 0;
350}
351
352/**
353 * Set channel loop width to ( @a count + 1)
354 * @param[in] ch Channel (use DMA_CHx)
355 * @param[in] count Count
356 * @note @a count is expected to be equal to (n_minus_1 + 1)
357 */
358void dma_set_loop_count(enum dma_ch ch, uint16_t count)
359{
360 if (!CHANNEL_SUPPORT_LOOP(ch)) {
361 return;
362 }
363
364 DMA_LOOPx(ch) = (DMA_LOOPx(ch) & ~DMA_LOOP_WIDTH_MASK)
365 | DMA_LOOP_WIDTH(count - 1);
366}
367
368/**
369 * Enable channel loop
370 * @param[in] ch Channel (use DMA_CHx)
371 */
373{
374 if (!CHANNEL_SUPPORT_LOOP(ch)) {
375 return;
376 }
377
378 DMA_LOOPx(ch) |= DMA_LOOP_EN;
379}
380
381/**
382 * Disable channel loop
383 * @param[in] ch Channel (use DMA_CHx)
384 */
386{
387 if (!CHANNEL_SUPPORT_LOOP(ch)) {
388 return;
389 }
390
391 DMA_LOOPx(ch) &= ~DMA_LOOP_EN;
392}
393
394/**
395 * Set desination size
396 * @param[in] desc_base start of memory location that contain channel
397 * descriptor
398 * @param[in] ch Channel (use DMA_CHx)
399 * @param[in] size Size (use DMA_MEM_*)
400 */
401void dma_desc_set_dest_size(uint32_t desc_base, enum dma_ch ch,
402 enum dma_mem size)
403{
404 uint32_t cfg = DMA_DESC_CHx_CFG(desc_base, ch);
405 cfg &= ~DMA_DESC_CH_CFG_DEST_SIZE_MASK;
406 cfg |= DMA_DESC_CH_CFG_DEST_SIZE(size);
407 DMA_DESC_CHx_CFG(desc_base, ch) = cfg;
408}
409
410/**
411 * Set destination increment
412 * @param[in] desc_base start of memory location that contain channel
413 * descriptor
414 * @param[in] ch Channel (use DMA_CHx)
415 * @param[in] inc Increment (use DMA_MEM_*)
416 */
417void dma_desc_set_dest_inc(uint32_t desc_base, enum dma_ch ch,
418 enum dma_mem inc)
419{
420 uint32_t cfg = DMA_DESC_CHx_CFG(desc_base, ch);
421 cfg &= ~DMA_DESC_CH_CFG_DEST_INC_MASK;
422 cfg |= DMA_DESC_CH_CFG_DEST_INC(inc);
423 DMA_DESC_CHx_CFG(desc_base, ch) = cfg;
424}
425
426/**
427 * Set source size
428 * @param[in] desc_base start of memory location that contain channel
429 * descriptor
430 * @param[in] ch Channel (use DMA_CHx)
431 * @param[in] size Size (use DMA_MEM_*)
432 */
433void dma_desc_set_src_size(uint32_t desc_base, enum dma_ch ch,
434 enum dma_mem size)
435{
436 uint32_t cfg = DMA_DESC_CHx_CFG(desc_base, ch);
437 cfg &= ~DMA_DESC_CH_CFG_SRC_SIZE_MASK;
438 cfg |= DMA_DESC_CH_CFG_SRC_SIZE(size);
439 DMA_DESC_CHx_CFG(desc_base, ch) = cfg;
440}
441
442/**
443 * Set source increment
444 * @param[in] desc_base start of memory location that contain channel
445 * descriptor
446 * @param[in] ch Channel (use DMA_CHx)
447 * @param[in] inc Increment (use DMA_MEM_*)
448 */
449void dma_desc_set_src_inc(uint32_t desc_base, enum dma_ch ch, enum dma_mem inc)
450{
451
452 uint32_t cfg = DMA_DESC_CHx_CFG(desc_base, ch);
453 cfg &= ~DMA_DESC_CH_CFG_SRC_INC_MASK;
454 cfg |= DMA_DESC_CH_CFG_SRC_INC(inc);
455 DMA_DESC_CHx_CFG(desc_base, ch) = cfg;
456}
457
458/**
459 * Set R Power
460 * @param[in] desc_base start of memory location that contain channel
461 * descriptor
462 * @param[in] ch Channel (use DMA_CHx)
463 * @param[in] r_power R Power (Use DMA_R_POWER_*)
464 */
465void dma_desc_set_r_power(uint32_t desc_base, enum dma_ch ch,
466 enum dma_r_power r_power)
467{
468 uint32_t cfg = DMA_DESC_CHx_CFG(desc_base, ch);
469 cfg &= ~DMA_DESC_CH_CFG_R_POWER_MASK;
470 cfg |= DMA_DESC_CH_CFG_R_POWER(r_power);
471 DMA_DESC_CHx_CFG(desc_base, ch) = cfg;
472}
473
474/**
475 * Enable next useburst
476 * @param[in] desc_base start of memory location that contain channel
477 * descriptor
478 * @param[in] ch Channel (use DMA_CHx)
479 */
480void dma_desc_enable_next_useburst(uint32_t desc_base, enum dma_ch ch)
481{
482 DMA_DESC_CHx_CFG(desc_base, ch) &= ~DMA_DESC_CH_CFG_NEXT_USEBURST;
483}
484
485/**
486 * Disable next useburst
487 * @param[in] desc_base start of memory location that contain channel
488 * descriptor
489 * @param[in] ch Channel (use DMA_CHx)
490 */
491void dma_desc_disable_next_useburst(uint32_t desc_base, enum dma_ch ch)
492{
494}
495
496/**
497 * Set number (count) of transfer to be performed
498 * @param[in] desc_base start of memory location that contain channel
499 * descriptor
500 * @param[in] ch Channel (use DMA_CHx)
501 * @param[in] count Count
502 */
503void dma_desc_set_count(uint32_t desc_base, enum dma_ch ch, uint16_t count)
504{
505 uint32_t cfg = DMA_DESC_CHx_CFG(desc_base, ch);
506 cfg &= ~DMA_DESC_CH_CFG_N_MINUS_1_MASK;
507 cfg |= DMA_DESC_CH_CFG_N_MINUS_1(count - 1);
508 DMA_DESC_CHx_CFG(desc_base, ch) = cfg;
509}
510
511/**
512 * Store user data field in channel descriptor
513 * @param[in] desc_base start of memory location that contain channel
514 * descriptor
515 * @param[in] ch Channel (use DMA_CHx)
516 * @param[in] user_data User data
517 */
518void dma_desc_set_user_data(uint32_t desc_base, enum dma_ch ch,
519 uint32_t user_data)
520{
521 DMA_DESC_CHx_USER_DATA(desc_base, ch) = user_data;
522}
523
524/**
525 * Extract user data field from channel descriptor
526 * @param[in] desc_base start of memory location that contain channel
527 * descriptor
528 * @param[in] ch Channel (use DMA_CHx)
529 * @return user data
530 */
531uint32_t dma_desc_get_user_data(uint32_t desc_base, enum dma_ch ch)
532{
533 return DMA_DESC_CHx_USER_DATA(desc_base, ch);
534}
535
536/**
537 * Calculate end from start address.
538 *
539 * @details
540 * See "8.4.3.4 Address calculation" p68, EFM32LG-RM "d0183_Rev1.10"
541 *
542 * @param[in] start address to start of memory
543 * @param[in] inc Increment (use DMA_MEM_*)
544 * @param[in] n_minus_1 the number of transfers minus 1 (ie count - 1)
545 * @return the calculate end address
546 * @note can be used to calculate {source, destination} end address
547 */
548static inline uint32_t dma_calc_end_from_start(uint32_t start, uint8_t inc,
549 uint16_t n_minus_1)
550{
551 switch (inc) {
552 case DMA_MEM_BYTE:
553 return start + n_minus_1;
555 return start + (n_minus_1 << 1);
556 case DMA_MEM_WORD:
557 return start + (n_minus_1 << 2);
558 case DMA_MEM_NONE:
559 return start;
560 }
561
562 return 0;
563}
564
565/**
566 * Assign Source address to DMA Channel
567 * @param[in] desc_base start of memory location that contain channel
568 * descriptor
569 * @param[in] ch Channel (use DMA_CHx)
570 * @param[in] src_start Source data start address
571 * this function uses @ref dma_calc_end_from_start to calculate the
572 * src data end address from @a src_start
573 * @note dma_desc_set_count() should be called first.
574 * @note dma_desc_set_src_inc() should be called first.
575 */
576void dma_desc_set_src_address(uint32_t desc_base, enum dma_ch ch,
577 uint32_t src_start)
578{
579 uint32_t cfg = DMA_DESC_CHx_CFG(desc_base, ch);
580 uint8_t inc = (cfg & DMA_DESC_CH_CFG_SRC_INC_MASK)
582 uint16_t n_minus_1 = (cfg & DMA_DESC_CH_CFG_N_MINUS_1_MASK)
584 uint32_t src_end = dma_calc_end_from_start(src_start, inc, n_minus_1);
585 DMA_DESC_CHx_SRC_DATA_END_PTR(desc_base, ch) = src_end;
586}
587
588/**
589 * Assign Destination address to DMA Channel
590 * @param[in] desc_base start of memory location that contain channel
591 * descriptor
592 * @param[in] ch Channel (use DMA_CHx)
593 * @param[in] dest_start Destination data start address
594 * this function uses @ref dma_calc_end_from_start to calculate the
595 * dest data end address from @a dest_start
596 * @note dma_desc_set_count() should be called first.
597 * @note dma_desc_set_dest_inc() should be called first.
598 */
599void dma_desc_set_dest_address(uint32_t desc_base, enum dma_ch ch,
600 uint32_t dest_start)
601{
602 uint32_t cfg = DMA_DESC_CHx_CFG(desc_base, ch);
603 uint8_t inc = (cfg & DMA_DESC_CH_CFG_DEST_INC_MASK)
605 uint16_t n_minus_1 = (cfg & DMA_DESC_CH_CFG_N_MINUS_1_MASK)
607 uint32_t dest_end = dma_calc_end_from_start(dest_start, inc,
608 n_minus_1);
609 DMA_DESC_CHx_DEST_DATA_END_PTR(desc_base, ch) = dest_end;
610}
611
612/**
613 * Set the channel mode ("Cycle control")
614 * @param[in] desc_base start of memory location that contain channel
615 * descriptor
616 * @param[in] ch Channel (use DMA_CHx)
617 * @param[in] mode Mode (use DMA_MODE_*)
618 */
619void dma_desc_set_mode(uint32_t desc_base, enum dma_ch ch, enum dma_mode mode)
620{
621 uint32_t cfg = DMA_DESC_CHx_CFG(desc_base, ch);
622 cfg &= ~DMA_DESC_CH_CFG_CYCLE_CTRL_MASK;
623 cfg |= DMA_DESC_CH_CFG_CYCLE_CTRL(mode);
624 DMA_DESC_CHx_CFG(desc_base, ch) = cfg;
625}
626
627/**@}*/
dma_ch
Definition: dma_common.h:706
#define DMA_CHALTC
Definition: dma_common.h:56
#define DMA_CHENS_CHxSENS(i)
Definition: dma_common.h:207
#define DMA_DESC_CHx_CFG(base, x)
Definition: dma_common.h:591
#define DMA_DESC_CH_CFG_DEST_INC(v)
Definition: dma_common.h:600
#define DMA_CHENC
Definition: dma_common.h:54
dma_mode
Definition: dma_common.h:731
#define DMA_CHPRIS
Definition: dma_common.h:57
#define DMA_CHUSEBURSTC_CHxSUSEBURSTC(i)
Definition: dma_common.h:162
#define DMA_DESC_CH_CFG_SRC_INC_SHIFT
Definition: dma_common.h:619
#define DMA_CHPRIS_CHxSPRIC(i)
Definition: dma_common.h:267
#define DMA_CHPRIC
Definition: dma_common.h:58
#define DMA_ERRORC_ERRORC
Definition: dma_common.h:297
#define DMA_CONFIG
Definition: dma_common.h:43
#define DMA_IFS_CHxDONE(x)
Definition: dma_common.h:348
dma_r_power
Definition: dma_common.h:743
#define DMA_CHENC_CHxSENC(i)
Definition: dma_common.h:222
#define DMA_DESC_CH_CFG_N_MINUS_1(v)
Definition: dma_common.h:688
dma_mem
Definition: dma_common.h:723
#define DMA_IFS
Definition: dma_common.h:63
#define DMA_CHREQMASKC_CHxSREQMASKC(i)
Definition: dma_common.h:192
#define DMA_DESC_CH_CFG_SRC_INC_MASK
Definition: dma_common.h:620
#define DMA_ERRORC
Definition: dma_common.h:59
#define DMA_IFS_ERR
Definition: dma_common.h:347
#define DMA_CHPRIC_CHxSPRIC(i)
Definition: dma_common.h:282
#define DMA_CHREQSTATUS_CHxSREQSTATUS(i)
Definition: dma_common.h:300
#define DMA_IEN_CHxDONE(x)
Definition: dma_common.h:380
#define DMA_DESC_CH_CFG_NEXT_USEBURST
Definition: dma_common.h:692
#define DMA_CHUSEBURSTS_CHxSUSEBURSTS(i)
Definition: dma_common.h:147
#define DMA_CHUSEBURSTS
Definition: dma_common.h:49
#define DMA_DESC_CH_CFG_SRC_INC(v)
Definition: dma_common.h:622
#define DMA_IF_CHxDONE(x)
Definition: dma_common.h:331
#define DMA_CHALTS
Definition: dma_common.h:55
#define DMA_CHENS
Definition: dma_common.h:53
#define DMA_IFC_ERR
Definition: dma_common.h:363
#define DMA_CONFIG_EN
Definition: dma_common.h:114
#define DMA_DESC_CH_CFG_N_MINUS_1_SHIFT
Definition: dma_common.h:685
#define DMA_DESC_CH_CFG_SRC_SIZE(v)
Definition: dma_common.h:633
#define DMA_DESC_CHx_USER_DATA(base, x)
Definition: dma_common.h:593
#define DMA_CHSWREQ_CHxSWREQ(i)
Definition: dma_common.h:132
#define DMA_CONFIG_CHPROT
Definition: dma_common.h:113
#define DMA_DESC_CHx_DEST_DATA_END_PTR(base, x)
Definition: dma_common.h:589
#define DMA_CHWAITSTATUS_CHxWAITSTATUS(i)
Definition: dma_common.h:117
#define DMA_CHWAITSTATUS
Definition: dma_common.h:47
#define DMA_LOOP_WIDTH(v)
Definition: dma_common.h:417
#define DMA_CHREQMASKS_CHxSREQMASKS(i)
Definition: dma_common.h:177
#define DMA_IFC_CHxDONE(x)
Definition: dma_common.h:364
#define DMA_IEN_ERR
Definition: dma_common.h:379
#define DMA_CHx_CTRL(i)
Definition: dma_common.h:76
#define DMA_CHSWREQ
Definition: dma_common.h:48
#define DMA_DESC_CH_CFG_DEST_SIZE(v)
Definition: dma_common.h:611
#define DMA_DESC_CHx_SRC_DATA_END_PTR(base, x)
Definition: dma_common.h:587
#define DMA_DESC_CH_CFG_N_MINUS_1_MASK
Definition: dma_common.h:686
#define DMA_IF
Definition: dma_common.h:62
#define DMA_DESC_CH_CFG_DEST_INC_SHIFT
Definition: dma_common.h:597
#define DMA_CHALTC_CHxSALTC(i)
Definition: dma_common.h:252
#define DMA_CHREQSTATUS
Definition: dma_common.h:60
#define DMA_DESC_CH_CFG_CYCLE_CTRL(v)
Definition: dma_common.h:651
#define DMA_CHREQMASKC
Definition: dma_common.h:52
#define DMA_IF_ERR
Definition: dma_common.h:330
#define DMA_DESC_CH_CFG_R_POWER(v)
Definition: dma_common.h:644
#define DMA_CTRLBASE
Definition: dma_common.h:44
#define DMA_LOOPx(i)
Definition: dma_common.h:69
#define DMA_CHREQMASKS
Definition: dma_common.h:51
#define DMA_IFC
Definition: dma_common.h:64
#define DMA_CHALTS_CHxSALTS(i)
Definition: dma_common.h:237
#define DMA_DESC_CH_CFG_DEST_INC_MASK
Definition: dma_common.h:598
#define DMA_CHUSEBURSTC
Definition: dma_common.h:50
#define DMA_LOOP_EN
Definition: dma_common.h:414
#define DMA_IEN
Definition: dma_common.h:65
@ DMA_MEM_NONE
Definition: dma_common.h:727
@ DMA_MEM_HALF_WORD
Definition: dma_common.h:725
@ DMA_MEM_BYTE
Definition: dma_common.h:724
@ DMA_MEM_WORD
Definition: dma_common.h:726
void dma_enable_alternate_structure(enum dma_ch ch)
Enable channel alternate structure.
Definition: dma_common.c:165
void dma_set_signal(enum dma_ch ch, uint32_t signal)
Set channel source signal.
Definition: dma_common.c:324
void dma_desc_set_dest_inc(uint32_t desc_base, enum dma_ch ch, enum dma_mem inc)
Set destination increment.
Definition: dma_common.c:417
bool dma_get_request_flag(enum dma_ch ch)
Get channel request flag.
Definition: dma_common.c:212
void dma_desc_set_r_power(uint32_t desc_base, enum dma_ch ch, enum dma_r_power r_power)
Set R Power.
Definition: dma_common.c:465
void dma_enable_priority(enum dma_ch ch)
Enable channel high priority.
Definition: dma_common.c:174
void dma_set_bus_error_interrupt_flag(void)
Set bus error interrupt flag.
Definition: dma_common.c:243
void dma_enable_channel(enum dma_ch ch)
Enable channel.
Definition: dma_common.c:138
void dma_set_loop_count(enum dma_ch ch, uint16_t count)
Set channel loop width to ( count + 1)
Definition: dma_common.c:358
void dma_disable(void)
Disable DMA.
Definition: dma_common.c:59
void dma_disable_loop(enum dma_ch ch)
Disable channel loop.
Definition: dma_common.c:385
void dma_enable_with_privileged_access(void)
Enable DMA with privileged access.
Definition: dma_common.c:33
void dma_disable_priority(enum dma_ch ch)
Disable channel high priority.
Definition: dma_common.c:183
uint32_t dma_desc_get_user_data(uint32_t desc_base, enum dma_ch ch)
Extract user data field from channel descriptor.
Definition: dma_common.c:531
void dma_desc_set_src_inc(uint32_t desc_base, enum dma_ch ch, enum dma_mem inc)
Set source increment.
Definition: dma_common.c:449
#define CHANNEL_SUPPORT_LOOP(ch)
Definition: dma_common.c:27
void dma_desc_set_mode(uint32_t desc_base, enum dma_ch ch, enum dma_mode mode)
Set the channel mode ("Cycle control")
Definition: dma_common.c:619
void dma_enable_single_and_burst(enum dma_ch ch)
Enable channel single and burst.
Definition: dma_common.c:111
void dma_desc_set_dest_address(uint32_t desc_base, enum dma_ch ch, uint32_t dest_start)
Assign Destination address to DMA Channel.
Definition: dma_common.c:599
void dma_desc_set_src_size(uint32_t desc_base, enum dma_ch ch, enum dma_mem size)
Set source size.
Definition: dma_common.c:433
void dma_desc_set_dest_size(uint32_t desc_base, enum dma_ch ch, enum dma_mem size)
Set desination size.
Definition: dma_common.c:401
bool dma_get_done_interrupt_flag(enum dma_ch ch)
Get channel done interrupt flag.
Definition: dma_common.c:235
static uint32_t dma_calc_end_from_start(uint32_t start, uint8_t inc, uint16_t n_minus_1)
Calculate end from start address.
Definition: dma_common.c:548
bool dma_get_bus_error_flag(void)
Get bus error flag.
Definition: dma_common.c:193
void dma_enable_burst_only(enum dma_ch ch)
Enable channel burst only.
Definition: dma_common.c:102
void dma_enable_with_unprivileged_access(void)
Enable DMA with un-privileged access.
Definition: dma_common.c:42
void dma_disable_bus_error_interrupt(void)
Disable bus error interrupt.
Definition: dma_common.c:285
void dma_desc_set_src_address(uint32_t desc_base, enum dma_ch ch, uint32_t src_start)
Assign Source address to DMA Channel.
Definition: dma_common.c:576
void dma_disable_done_interrupt(enum dma_ch ch)
Disable channel done interrupt.
Definition: dma_common.c:303
void dma_enable_bus_error_interrupt(void)
Enable bus error interrupt.
Definition: dma_common.c:277
void dma_disable_channel(enum dma_ch ch)
Disable channel.
Definition: dma_common.c:147
void dma_set_source(enum dma_ch ch, uint32_t source)
Set channel source.
Definition: dma_common.c:313
void dma_clear_done_interrupt_flag(enum dma_ch ch)
Clear channel done interrupt flag.
Definition: dma_common.c:269
void dma_enable_done_interrupt(enum dma_ch ch)
Enable channel done interrupt.
Definition: dma_common.c:294
void dma_disable_periph_request(enum dma_ch ch)
Disable channel peripherial request.
Definition: dma_common.c:129
void dma_channel_reset(enum dma_ch ch)
Reset channel.
Definition: dma_common.c:334
void dma_disable_alternate_structure(enum dma_ch ch)
Disable channel alternate structure.
Definition: dma_common.c:156
void dma_enable_loop(enum dma_ch ch)
Enable channel loop.
Definition: dma_common.c:372
void dma_desc_set_count(uint32_t desc_base, enum dma_ch ch, uint16_t count)
Set number (count) of transfer to be performed.
Definition: dma_common.c:503
void dma_desc_set_user_data(uint32_t desc_base, enum dma_ch ch, uint32_t user_data)
Store user data field in channel descriptor.
Definition: dma_common.c:518
void dma_set_desc_address(uint32_t desc_base)
Set channel's descriptor address.
Definition: dma_common.c:69
void dma_set_done_interrupt_flag(enum dma_ch ch)
Set channel done interrupt flag.
Definition: dma_common.c:252
bool dma_get_wait_on_request_flag(enum dma_ch ch)
Get channel wait on request status flag.
Definition: dma_common.c:83
void dma_clear_bus_error_interrupt_flag(void)
Clear bus error interrupt flag.
Definition: dma_common.c:260
void dma_enable(void)
same as dma_enable_with_unprivileged_access()
Definition: dma_common.c:51
void dma_clear_bus_error_flag(void)
Clear bus error flag.
Definition: dma_common.c:201
void dma_desc_disable_next_useburst(uint32_t desc_base, enum dma_ch ch)
Disable next useburst.
Definition: dma_common.c:491
void dma_desc_enable_next_useburst(uint32_t desc_base, enum dma_ch ch)
Enable next useburst.
Definition: dma_common.c:480
bool dma_get_bus_error_interrupt_flag(void)
Get bus error interrupt flag.
Definition: dma_common.c:223
void dma_enable_periph_request(enum dma_ch ch)
Enable channel peripherial request.
Definition: dma_common.c:120
void dma_generate_software_request(enum dma_ch ch)
Generate a software request on channel.
Definition: dma_common.c:93