forked from thesofproject/sof
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdma.c
More file actions
60 lines (52 loc) · 1.22 KB
/
dma.c
File metadata and controls
60 lines (52 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// SPDX-License-Identifier: BSD-3-Clause
//
// Copyright 2019 NXP
//
// Author: Daniel Baluta <daniel.baluta@nxp.com>
#include <sof/common.h>
#include <rtos/interrupt.h>
#include <sof/lib/dma.h>
#include <sof/lib/memory.h>
#include <rtos/sof.h>
#include <rtos/spinlock.h>
extern struct dma_ops dummy_dma_ops;
extern struct dma_ops sdma_ops;
static SHARED_DATA struct dma dma[PLATFORM_NUM_DMACS] = {
{
.plat_data = {
.id = DMA_ID_HOST,
.dir = DMA_DIR_HMEM_TO_LMEM | DMA_DIR_LMEM_TO_HMEM,
.devs = DMA_DEV_HOST,
.channels = 16,
},
.ops = &dummy_dma_ops,
},
{
.plat_data = {
.id = DMA_ID_SDMA3,
/* Note: support is available for MEM_TO_MEM but not
* enabled as it is unneeded
*/
.dir = DMA_DIR_MEM_TO_DEV | DMA_DIR_DEV_TO_MEM,
.devs = DMA_DEV_SAI | DMA_DEV_MICFIL,
.base = SDMA3_BASE,
.channels = 32,
.irq = SDMA3_IRQ,
.irq_name = SDMA3_IRQ_NAME,
},
.ops = &sdma_ops,
},
};
static const struct dma_info lib_dma = {
.dma_array = cache_to_uncache_init((struct dma *)dma),
.num_dmas = ARRAY_SIZE(dma)
};
int dmac_init(struct sof *sof)
{
int i;
/* early lock initialization for ref counting */
for (i = 0; i < ARRAY_SIZE(dma); i++)
k_spinlock_init(&dma[i].lock);
sof->dma_info = &lib_dma;
return 0;
}