-
Notifications
You must be signed in to change notification settings - Fork 0
/
main1.cpp
79 lines (33 loc) · 987 Bytes
/
main1.cpp
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
/*
* DMA.cpp
*
* Created on: Apr 20, 2023
* Author: samso
*/
#include"dma.hpp"
#include<iostream>
int main() {
unsigned long int status;
DirectMemoryAccess* dma = new DirectMemoryAccess(0x40400000, 0x0e000000, 0x0f000000);
dma->reset();
dma->halt();
// dma->write2DArray()
dma->hexdumpSource(8);
dma->setInterrupt(true, false, 0);
dma->ready(); // ready the DMA
dma->setDestinationAddress(0x0f000000);
dma->setSourceAddress(0x0e000000);
dma->setDestinationLength(8);
dma->setSourceLength(8);
printf("Waiting for MM2S...\n");
do {
status = dma->getMM2SStatus();
dma->dumpStatus(status);
} while((!(status & 1<<12) && !(status & 1 << 1)));
printf("Waiting for S2MM...\n");
do {
status = dma->getS2MMStatus();
dma->dumpStatus(status);
} while((!(status & 1<<12) && !(status & 1 << 1)));
dma->hexdumpDestination(8);
}