| Kinetis SDK Demo Applications User Guide 1.0.0-beta Freescale Semiconductor, Inc.

- Main Page
- Related Pages
- Demos

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
edma.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2013 - 2014, Freescale Semiconductor, Inc.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without modification,
6 * are permitted provided that the following conditions are met:
7 *
8 * o Redistributions of source code must retain the above copyright notice, this list
9 * of conditions and the following disclaimer.
10 *
11 * o Redistributions in binary form must reproduce the above copyright notice, this
12 * list of conditions and the following disclaimer in the documentation and/or
13 * other materials provided with the distribution.
14 *
15 * o Neither the name of Freescale Semiconductor, Inc. nor the names of its
16 * contributors may be used to endorse or promote products derived from this
17 * software without specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
23 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 *
30 */
31
32 #ifndef __EDMA_H__
33 #define __EDMA_H__
34 /*******************************************************************************
35 * Standard C Included Files
36 ******************************************************************************/
37 #include <stdint.h>
38 /*******************************************************************************
39 * SDK Included Files
40 ******************************************************************************/
41 #include "fsl_edma_driver.h"
42 #include "fsl_uart_driver.h"
43 /*******************************************************************************
44 * Definitions
45 ******************************************************************************/
46 #define DMA_CH0 0x00U
47 #define DMA_CH1 0x01U
48 #define DMA_CH2 0x02U
49 /*******************************************************************************
50 * Constants
51 ******************************************************************************/
52 /* DMA software TCD arrays. TCDs must be aligned to 32-byte boundary. */
53 /*
54 **** NOTE ****
55 This has been left commented out so that the user may choose to use
56 costant software tcds at their own discretion.
57 **************
58
59 #define LOOP_PERIOD 0x01U
60
61 #if defined(__ICCARM__)
62
63 #pragma data_alignment = 32 * LOOP_PERIOD
64 __root edma_software_tcd_t stcd0[LOOP_PERIOD];
65 #pragma data_alignment = 32 * LOOP_PERIOD
66 __root edma_software_tcd_t stcd1[LOOP_PERIOD];
67 #pragma data_alignment = 32 * LOOP_PERIOD
68 __root edma_software_tcd_t stcd2[LOOP_PERIOD];
69
70 #elif defined(__GNUC__)
71
72 edma_software_tcd_t stcd0[LOOP_PERIOD] __attribute__ ((aligned(32 * LOOP_PERIOD)));
73 edma_software_tcd_t stcd1[LOOP_PERIOD] __attribute__ ((aligned(32 * LOOP_PERIOD)));
74 edma_software_tcd_t stcd2[LOOP_PERIOD] __attribute__ ((aligned(32 * LOOP_PERIOD)));
75
76 #endif
77 */
78 /*******************************************************************************
79 * Data Structures
80 ******************************************************************************/
81 typedef struct EdmaLoopSetup
82 {
83 edma_channel_t *dmaCh;
84 uint32_t dmaChanNum;
85 dma_request_source_t chSource;
86 edma_transfer_type_t type;
87 uint32_t srcAddr;
88 uint32_t destAddr;
89 uint32_t size;
90 uint32_t watermark;
91 uint32_t length;
92 uint8_t period;
93 edma_software_tcd_t *dmaChStcd;
94
95 } edma_loop_setup_t;
96 /*******************************************************************************
97 * Prototypes
98 ******************************************************************************/
99 void setup_edma_loop(edma_loop_setup_t *loopSetup);
100
101 void disable_edma_loop(edma_loop_setup_t *loopSetup);
102
103 #endif /* __EDMA_H__ */
104
105 /******************************************************************************
106 * EOF
107 ******************************************************************************/
edma_loop_setup_t::watermark
uint32_t watermark
Definition: edma.h:90
edma_loop_setup_t::length
uint32_t length
Definition: edma.h:91
edma_loop_setup_t::period
uint8_t period
Definition: edma.h:92
disable_edma_loop
void disable_edma_loop(edma_loop_setup_t *loopSetup)
Definition: edma.c:88
edma_loop_setup_t::destAddr
uint32_t destAddr
Definition: edma.h:88
edma_loop_setup_t
Definition: edma.h:81
edma_loop_setup_t::srcAddr
uint32_t srcAddr
Definition: edma.h:87
edma_loop_setup_t::dmaChanNum
uint32_t dmaChanNum
Definition: edma.h:84
edma_loop_setup_t::type
edma_transfer_type_t type
Definition: edma.h:86
edma_loop_setup_t::dmaChStcd
edma_software_tcd_t * dmaChStcd
Definition: edma.h:93
edma_loop_setup_t::dmaCh
edma_channel_t * dmaCh
Definition: edma.h:83
edma_loop_setup_t::size
uint32_t size
Definition: edma.h:89
setup_edma_loop
void setup_edma_loop(edma_loop_setup_t *loopSetup)
Definition: edma.c:59
edma_loop_setup_t::chSource
dma_request_source_t chSource
Definition: edma.h:85