RTEMS 6.1-rc2
Loading...
Searching...
No Matches
lpc-dma.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
11/*
12 * Copyright (C) 2010, 2012 embedded brains GmbH & Co. KG
13 *
14 * Redistribution and use in source and binary forms, with or without
15 * modification, are permitted provided that the following conditions
16 * are met:
17 * 1. Redistributions of source code must retain the above copyright
18 * notice, this list of conditions and the following disclaimer.
19 * 2. Redistributions in binary form must reproduce the above copyright
20 * notice, this list of conditions and the following disclaimer in the
21 * documentation and/or other materials provided with the distribution.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
24 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
27 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 * POSSIBILITY OF SUCH DAMAGE.
34 */
35
36#ifndef LIBBSP_ARM_SHARED_LPC_DMA_H
37#define LIBBSP_ARM_SHARED_LPC_DMA_H
38
39#include <bspopts.h>
40#include <bsp/utility.h>
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
60typedef struct {
61 uint32_t src;
62 uint32_t dest;
63 uint32_t lli;
64 uint32_t ctrl;
66
70typedef struct {
72 uint32_t cfg;
73 uint32_t reserved [3];
75
79typedef struct {
80 uint32_t int_stat;
81 uint32_t int_tc_stat;
82 uint32_t int_tc_clear;
83 uint32_t int_err_stat;
84 uint32_t int_err_clear;
85 uint32_t raw_tc_stat;
86 uint32_t raw_err_stat;
87 uint32_t enabled_channels;
88 uint32_t soft_burst_req;
89 uint32_t soft_single_req;
90 uint32_t soft_last_burst_req;
91 uint32_t soft_last_single_req;
92 uint32_t cfg;
93 uint32_t sync;
94 uint32_t reserved [50];
95 lpc_dma_channel channels [LPC_DMA_CHANNEL_COUNT];
96} lpc_dma;
97
104#define DMA_CFG_E BSP_BIT32(0)
105#define DMA_CFG_M_0 BSP_BIT32(1)
106#define DMA_CFG_M_1 BSP_BIT32(2)
107
116#define DMA_CH_CTRL_TSZ(val) BSP_FLD32(val, 0, 11)
117#define DMA_CH_CTRL_TSZ_MAX DMA_CH_CTRL_TSZ(0xfff)
118
119#define DMA_CH_CTRL_SB(val) BSP_FLD32(val, 12, 14)
120#define DMA_CH_CTRL_SB_1 DMA_CH_CTRL_SB(0)
121#define DMA_CH_CTRL_SB_4 DMA_CH_CTRL_SB(1)
122#define DMA_CH_CTRL_SB_8 DMA_CH_CTRL_SB(2)
123#define DMA_CH_CTRL_SB_16 DMA_CH_CTRL_SB(3)
124#define DMA_CH_CTRL_SB_32 DMA_CH_CTRL_SB(4)
125#define DMA_CH_CTRL_SB_64 DMA_CH_CTRL_SB(5)
126#define DMA_CH_CTRL_SB_128 DMA_CH_CTRL_SB(6)
127#define DMA_CH_CTRL_SB_256 DMA_CH_CTRL_SB(7)
128
129#define DMA_CH_CTRL_DB(val) BSP_FLD32(val, 15, 17)
130#define DMA_CH_CTRL_DB_1 DMA_CH_CTRL_DB(0)
131#define DMA_CH_CTRL_DB_4 DMA_CH_CTRL_DB(1)
132#define DMA_CH_CTRL_DB_8 DMA_CH_CTRL_DB(2)
133#define DMA_CH_CTRL_DB_16 DMA_CH_CTRL_DB(3)
134#define DMA_CH_CTRL_DB_32 DMA_CH_CTRL_DB(4)
135#define DMA_CH_CTRL_DB_64 DMA_CH_CTRL_DB(5)
136#define DMA_CH_CTRL_DB_128 DMA_CH_CTRL_DB(6)
137#define DMA_CH_CTRL_DB_256 DMA_CH_CTRL_DB(7)
138
139#define DMA_CH_CTRL_SW(val) BSP_FLD32(val, 18, 20)
140#define DMA_CH_CTRL_SW_8 DMA_CH_CTRL_SW(0)
141#define DMA_CH_CTRL_SW_16 DMA_CH_CTRL_SW(1)
142#define DMA_CH_CTRL_SW_32 DMA_CH_CTRL_SW(2)
143
144#define DMA_CH_CTRL_DW(val) BSP_FLD32(val, 21, 23)
145#define DMA_CH_CTRL_DW_8 DMA_CH_CTRL_DW(0)
146#define DMA_CH_CTRL_DW_16 DMA_CH_CTRL_DW(1)
147#define DMA_CH_CTRL_DW_32 DMA_CH_CTRL_DW(2)
148
149#define DMA_CH_CTRL_S BSP_BIT32(24)
150#define DMA_CH_CTRL_D BSP_BIT32(25)
151#define DMA_CH_CTRL_SI BSP_BIT32(26)
152#define DMA_CH_CTRL_DI BSP_BIT32(27)
153#define DMA_CH_CTRL_PROT(val) BSP_FLD32(val, 28, 30)
154#define DMA_CH_CTRL_I BSP_BIT32(31)
155
164#define DMA_CH_CFG_E BSP_BIT32(0)
165#define DMA_CH_CFG_SPER(val) BSP_FLD32(val, 1, 5)
166#define DMA_CH_CFG_DPER(val) BSP_FLD32(val, 6, 10)
167
168#define DMA_CH_CFG_FLOW(val) BSP_FLD32(val, 11, 13)
169#define DMA_CH_CFG_FLOW_MEM_TO_MEM_DMA DMA_CH_CFG_FLOW(0)
170#define DMA_CH_CFG_FLOW_MEM_TO_PER_DMA DMA_CH_CFG_FLOW(1)
171#define DMA_CH_CFG_FLOW_PER_TO_MEM_DMA DMA_CH_CFG_FLOW(2)
172#define DMA_CH_CFG_FLOW_PER_TO_PER_DMA DMA_CH_CFG_FLOW(3)
173#define DMA_CH_CFG_FLOW_PER_TO_PER_DEST DMA_CH_CFG_FLOW(4)
174#define DMA_CH_CFG_FLOW_MEM_TO_PER_PER DMA_CH_CFG_FLOW(5)
175#define DMA_CH_CFG_FLOW_PER_TO_MEM_PER DMA_CH_CFG_FLOW(6)
176#define DMA_CH_CFG_FLOW_PER_TO_PER_SRC DMA_CH_CFG_FLOW(7)
177
178#define DMA_CH_CFG_IE BSP_BIT32(14)
179#define DMA_CH_CFG_ITC BSP_BIT32(15)
180#define DMA_CH_CFG_L BSP_BIT32(16)
181#define DMA_CH_CFG_A BSP_BIT32(17)
182#define DMA_CH_CFG_H BSP_BIT32(18)
183
192#define LPC24XX_DMA_PER_SSP_0_TX 0
193#define LPC24XX_DMA_PER_SSP_0_RX 1
194#define LPC24XX_DMA_PER_SSP_1_TX 2
195#define LPC24XX_DMA_PER_SSP_1_RX 3
196#define LPC24XX_DMA_PER_SD_MMC 4
197#define LPC24XX_DMA_PER_I2S_CH_0 5
198#define LPC24XX_DMA_PER_I2S_CH_1 6
199
208#define LPC32XX_DMA_PER_I2S_0_CH_0 0
209#define LPC32XX_DMA_PER_I2S_0_CH_1 13
210#define LPC32XX_DMA_PER_I2S_1_CH_0 2
211#define LPC32XX_DMA_PER_I2S_1_CH_1 10
212#define LPC32XX_DMA_PER_NAND_0 1
213#define LPC32XX_DMA_PER_NAND_1 12
214#define LPC32XX_DMA_PER_SD_MMC 4
215#define LPC32XX_DMA_PER_SSP_0_RX 14
216#define LPC32XX_DMA_PER_SSP_0_TX 15
217#define LPC32XX_DMA_PER_SSP_1_RX 3
218#define LPC32XX_DMA_PER_SSP_1_TX 11
219#define LPC32XX_DMA_PER_UART_1_RX 6
220#define LPC32XX_DMA_PER_UART_1_TX 5
221#define LPC32XX_DMA_PER_UART_2_RX 8
222#define LPC32XX_DMA_PER_UART_2_TX 7
223#define LPC32XX_DMA_PER_UART_7_RX 10
224#define LPC32XX_DMA_PER_UART_7_TX 9
225
230#ifdef __cplusplus
231}
232#endif /* __cplusplus */
233
234#endif /* LIBBSP_ARM_SHARED_LPC_DMA_H */
This header file provides utility macros for BSPs.
DMA channel block.
Definition: lpc-dma.h:70
DMA descriptor item.
Definition: lpc-dma.h:60
DMA control block.
Definition: lpc-dma.h:79