-
Notifications
You must be signed in to change notification settings - Fork 0
/
audioRegs.cpp
127 lines (81 loc) · 2.05 KB
/
audioRegs.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#include "audioRegs.h"
uint32_t audioRegsInit( tgAudioRegs_t *regs )
{
regs->id = 0x80000007;
regs->version = 0x20240926;
regs->audioFiFoData = 0;
regs->audioFiFoStatus = 0;
regs->i2sClockConfig = 0x00410020;
regs->fifoReadConfig = 0;
regs->audioDmaConfig = 0;
regs->audioDmaStatus = 0;
regs->audioDmaPointer = 0;
regs->audioDmaLength = 0;
return RV_OK;
}
uint32_t audioRegsReadReg( tgAudioRegs_t *regs, audContext_t *audCtx, uint16_t addr )
{
switch( addr >> 2 )
{
case 0x00:
return regs->id;
break;
case 0x01:
return regs->version;
break;
case 0x02:
return regs->audioFiFoData;
break;
case 0x03:
return regs->audioFiFoStatus;
break;
case 0x04:
return regs->i2sClockConfig;
break;
case 0x05:
return regs->fifoReadConfig;
break;
case 0x06:
return regs->audioDmaConfig;
break;
case 0x07:
return audioGetDMAStatus( audCtx );
break;
case 0x08:
return regs->audioDmaPointer;
break;
case 0x09:
return regs->audioDmaLength;
break;
default:
return 0;
break;
}
return 0;
}
uint32_t audioRegsWriteReg( tgAudioRegs_t *regs, audContext_t *audCtx, uint16_t addr, uint32_t value )
{
switch( addr >> 2 )
{
case 0x02:
//return regs->audioFiFoData;
break;
case 0x04:
regs->i2sClockConfig = value;
break;
case 0x05:
regs->fifoReadConfig = value;
break;
case 0x06:
regs->audioDmaConfig = value;
audioSetDMAConfig( audCtx, regs->fifoReadConfig, regs->audioDmaConfig, regs->audioDmaPointer, regs->audioDmaLength );
break;
case 0x08:
regs->audioDmaPointer = value;
break;
case 0x09:
regs->audioDmaLength = value;
break;
}
return RV_OK;
}