forked from MuneebMohammed/PRUSS-Bindings
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmem_debug.c
68 lines (58 loc) · 1.62 KB
/
mem_debug.c
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
#include <iostream>
#include <string>
#include "pruss.h"
using namespace std;
int main()
{
PRUSS& p = PRUSS::get();
PRU p0 = p.pru0;
cout<<"1. View PRU Control and General Purpose Registers \n2. Perform PRU memory actions"<<endl;
int input;
cin>>input;
if (input == 1){
cout<<p0.showRegs();
}
else{
Memory mem;
int x;
string offset;
string data;
cout<<"Choose Base Location:"<<endl;
cout<<"1: DRAM0; 2: DRAM1; 3: SRAM"<<endl;
cin>>x;
switch(x){
case 1:
mem = DATA0;
cout<< "Base Location: 0x0000 0000"<<endl;
break;
case 2:
mem = DATA1;
cout<< "Base Location: 0x0000 2000"<<endl;
break;
case 3:
mem = SHARED;
cout<< "Base Location: 0x0001 0000"<<endl;
break;
default:
break;
}
cout<<"1: Read; 2: Write; 0: Exit"<<endl;
cin>>x;
switch(x){
case 1:
cout<< "Enter address offset"<<endl;
cin>>offset;
cout<< "Data returned: "<<p0.mem_read(mem, offset)<<endl<<endl;
break;
case 2:
cout<< "Enter address offset"<<endl;
cin>>offset;
cout<< "Enter data to be written"<<endl;
cin >>data;
cout<< "Return Value: "<<p0.mem_write(mem, offset, data)<<endl<<endl;
break;
default:
break;
}
}
}