-
Notifications
You must be signed in to change notification settings - Fork 0
/
XDMAC.h
80 lines (61 loc) · 2.44 KB
/
XDMAC.h
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/*
* XDMAC.h
*
* Created: 17-Oct-18 13:06:39
* Author: Willem van der Kooij
*/
#ifndef XDMAC_H_
#define XDMAC_H_
/* USED CHANNELS
* 0 I2S
* 1 I2S
* 2 I2S
* 3 I2S
* 4 HSMCI
*/
#define I2SC1_XDMAC_CH_L_RX
#define I2SC1_XDMAC_CH_L_TX
#define I2SC1_XDMAC_CH_R_RX
#define I2SC1_XDMAC_CH_R_TX
#define HSMCI_XDMAC_CH 4
#define XDMAC_PER_DATADIR_TX 0
#define XDMAC_PER_DATADIR_RX 1
#define XDMAC_I2SC1_PERID_L_TX 46
#define XDMAC_I2SC1_PERID_L_RX 47
#define XDMAC_I2SC1_PERID_R_TX 50
#define XDMAC_I2SC1_PERID_R_RX 51
#define COMPILER_WORD_ALIGNED __attribute__((__aligned__(4)))
/* Linked List descriptor view 1 style */
typedef struct
{
uint32_t mbr_nda; // addr of next descriptor
uint32_t mbr_ubc; // control settings of MBR_UBC
uint32_t mbr_sa; // //next source addr
uint32_t mbr_da; // next destination addr
} lld_view1;
void DMA_prepareChannel(uint32_t channel);
void DMA_configChannel_I2SC1(uint32_t channel, uint32_t PERID, uint32_t datadir, uint32_t *srcbuf, uint32_t *dstbuf, uint32_t bufsize);
void DMA_LinkedListSetupI2SC1(uint32_t channel, uint32_t datadir, lld_view1 *lld, uint32_t *srcbuf1, uint32_t *srcbuf2, uint32_t *dstbuf1 ,uint32_t *dstbuf2, uint32_t bufsize);
void DMA_enableInterrupt(uint32_t channel, uint32_t interruptMask);
void DMA_enableInterrupt(uint32_t channel, uint32_t interruptMask);
void DMA_enableChannel(uint32_t channel);
/* XDMA_MBR_UBC */
#define XDMAC_UBC_NDE (0x1u << 24)
#define XDMAC_UBC_NDE_FETCH_DIS (0x0u << 24)
#define XDMAC_UBC_NDE_FETCH_EN (0x1u << 24)
#define XDMAC_UBC_NSEN (0x1u << 25)
#define XDMAC_UBC_NSEN_UNCHANGED (0x0u << 25)
#define XDMAC_UBC_NSEN_UPDATED (0x1u << 25)
#define XDMAC_UBC_NDEN (0x1u << 26)
#define XDMAC_UBC_NDEN_UNCHANGED (0x0u << 26)
#define XDMAC_UBC_NDEN_UPDATED (0x1u << 26)
#define XDMAC_UBC_NVIEW_Pos 27
#define XDMAC_UBC_NVIEW_Msk (0x3u << XDMAC_UBC_NVIEW_Pos)
#define XDMAC_UBC_NVIEW_NDV0 (0x0u << XDMAC_UBC_NVIEW_Pos)
#define XDMAC_UBC_NVIEW_NDV1 (0x1u << XDMAC_UBC_NVIEW_Pos)
#define XDMAC_UBC_NVIEW_NDV2 (0x2u << XDMAC_UBC_NVIEW_Pos)
#define XDMAC_UBC_NVIEW_NDV3 (0x3u << XDMAC_UBC_NVIEW_Pos)
#define XDMAC_UBC_UBLEN_Pos 0
#define XDMAC_UBC_UBLEN_Msk (0xffffffu << XDMAC_UBC_UBLEN_Pos)
#define XDMAC_UBC_UBLEN(value) ((XDMAC_UBC_UBLEN_Msk & ((value) << XDMAC_UBC_UBLEN_Pos)))
#endif /* XDMAC_H_ */