parse_abi.c
9.61 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
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
/*
* Interpret ABI command list and display it
*
*/
#include <stdlib.h>
#include <stdio.h>
#include <strings.h>
#ifdef __sgi__
#include <os.h>
#include <ultra64.h>
#endif
#include <gu.h>
#ifdef __sgi__
#include <bstring.h>
#endif
#include <libaudio.h>
#include "dlprint.h"
void ParseAbiCL(u8 *data, u32 nbytes)
{
Acmd *cmd = (Acmd *)data;
Acmd *endCmd = cmd + (nbytes/sizeof(Acmd));
float temp;
PRINTF("----------------------------------------------------\n");
PRINTF("Parsing audio command list\n\n");
for (; cmd < endCmd; cmd++) {
switch (cmd->adpcm.cmd) {
case A_SPNOOP:
PRINTF("A_SPNOOP: %d\n", cmd->adpcm.cmd);
PRINTF("\n");
break;
case A_ADPCM:
PRINTF("A_ADPCM: %d\n", cmd->adpcm.cmd);
PRINTF("\tflags: 0x%x\n", cmd->adpcm.flags);
PRINTF("\tgain: 0x%x\n", cmd->adpcm.gain);
PRINTF("\tsegment: %d\n", cmd->adpcm.addr>>26);
PRINTF("\tstate offset: 0x%x\n", cmd->adpcm.addr & 0x03ffffff);
PRINTF("\n");
break;
case A_CLEARBUFF:
PRINTF("A_CLEARBUFF: %d\n", cmd->adpcm.cmd);
PRINTF("\tpad1: 0x%x\n", cmd->clearbuff.pad1);
PRINTF("\tdmem: 0x%x\n", cmd->clearbuff.dmem);
PRINTF("\tpad2: 0x%x\n", cmd->clearbuff.pad2);
PRINTF("\tcount: 0x%x, %d\n", cmd->clearbuff.count,
cmd->clearbuff.count);
PRINTF("\n");
break;
case A_ENVMIXER:
PRINTF("A_ENVMIXER: %d\n", cmd->adpcm.cmd);
PRINTF("\tflags: 0x%x\n", cmd->envelope.flags);
PRINTF("\tpad1: 0x%x\n", cmd->envelope.pad1);
PRINTF("\tstate offset: 0x%x\n", cmd->envelope.addr);
PRINTF("\n");
break;
case A_LOADBUFF:
PRINTF("A_LOADBUFF: %d\n", cmd->adpcm.cmd);
PRINTF("\tpad1: 0x%x\n", cmd->loadbuff.pad1);
PRINTF("\tsegment: %d\n", cmd->loadbuff.addr>>26);
PRINTF("\tdram offset: 0x%x\n", cmd->loadbuff.addr & 0x03ffffff);
PRINTF("\n");
break;
case A_RESAMPLE:
PRINTF("A_RESAMPLE: %d\n", cmd->adpcm.cmd);
PRINTF("\tflags: 0x%x\n", cmd->resample.flags);
PRINTF("\tpitch: 0x%x, %f\n", cmd->resample.pitch,
(float)cmd->resample.pitch/(float)0x8000);
PRINTF("\tsegment: %d\n", cmd->resample.addr>>26);
PRINTF("\tstate offset: 0x%x\n",
cmd->resample.addr & 0x03ffffff);
PRINTF("\n");
break;
case A_SAVEBUFF:
PRINTF("A_SAVEBUFF: %d\n", cmd->adpcm.cmd);
PRINTF("\tpad1: 0x%x\n", cmd->savebuff.pad1);
PRINTF("\tsegment: %d\n", cmd->savebuff.addr>>26);
PRINTF("\tdram offset: 0x%x\n", cmd->savebuff.addr & 0x03ffffff);
PRINTF("\n");
break;
case A_SEGMENT:
PRINTF("A_SEGMENT: %d\n", cmd->adpcm.cmd);
PRINTF("\tpad1: 0x%x\n", cmd->segment.pad1);
PRINTF("\tpad2: 0x%x\n", cmd->segment.pad2);
PRINTF("\tnumber: 0x%x\n", cmd->segment.number);
PRINTF("\tbase: 0x%x\n", cmd->segment.base);
PRINTF("\n");
break;
case A_SETBUFF:
if (cmd->setbuff.flags & A_AUX) {
PRINTF("A_SETBUFF: %d\n", cmd->adpcm.cmd);
PRINTF("\tflags: 0x%x = %s\n", cmd->setbuff.flags, "A_AUX");
PRINTF("\tdmoutR: 0x%x\n", cmd->setbuff.dmemin);
PRINTF("\tdmauxL: 0x%x\n", cmd->setbuff.dmemout);
PRINTF("\tdmauxR: 0x%x\n", cmd->setbuff.count);
PRINTF("\n");
}
else {
PRINTF("A_SETBUFF: %d\n", cmd->adpcm.cmd);
PRINTF("\tflags: 0x%x\n", cmd->setbuff.flags);
PRINTF("\tdmemin: 0x%x\n", cmd->setbuff.dmemin);
PRINTF("\tdmemout: 0x%x\n", cmd->setbuff.dmemout);
PRINTF("\tcount: 0x%x, %d\n", cmd->setbuff.count,
cmd->setbuff.count);
PRINTF("\n");
break;
}
break;
case A_SETVOL:
if (cmd->setvol.flags & A_AUX) {
PRINTF("A_SETVOL: %d\n", cmd->adpcm.cmd);
PRINTF("\tflags: 0x%x = %s\n", cmd->setvol.flags, "A_AUX");
PRINTF("\tdry amount: 0x%x\n", cmd->setvol.vol);
PRINTF("\tunused: 0x%x\n", cmd->setvol.voltgt);
PRINTF("\twet amount: 0x%x\n", cmd->setvol.volrate);
PRINTF("\n");
}
else if (cmd->setvol.flags & A_VOL) {
if (cmd->setvol.flags & A_LEFT) {
PRINTF("A_SETVOL: %d\n", cmd->adpcm.cmd);
PRINTF("\tflags: 0x%x = %s\n", cmd->setvol.flags,
"A_VOL | A_LEFT");
PRINTF("\tvol left: 0x%x\n", cmd->setvol.vol);
PRINTF("\tunused: 0x%x\n", cmd->setvol.voltgt);
PRINTF("\tunused: 0x%x\n", cmd->setvol.volrate);
PRINTF("\n");
}
else{
PRINTF("A_SETVOL: %d\n", cmd->adpcm.cmd);
PRINTF("\tflags: 0x%x = %s\n", cmd->setvol.flags,
"A_VOL | A_RIGHT");
PRINTF("\tvol right: 0x%x\n", cmd->setvol.vol);
PRINTF("\tunused: 0x%x\n", cmd->setvol.voltgt);
PRINTF("\tunused: 0x%x\n", cmd->setvol.volrate);
PRINTF("\n");
}
}
else if (cmd->setvol.flags & A_LEFT) {
PRINTF("A_SETVOL: %d\n", cmd->adpcm.cmd);
PRINTF("\tflags: 0x%x = %s\n", cmd->setvol.flags,
"A_RATE | A_LEFT");
PRINTF("\ttarget left: 0x%x\n", cmd->setvol.vol);
PRINTF("\tinteger rate left: 0x%x\n", cmd->setvol.voltgt);
PRINTF("\tfractional rate left: 0x%x\n",
cmd->setvol.volrate);
PRINTF("\trate left: %f\n", (1.0*cmd->setvol.voltgt) +
((float)cmd->setvol.volrate/(float)0xffff));
PRINTF("\n");
}
else{
PRINTF("A_SETVOL: %d\n", cmd->adpcm.cmd);
PRINTF("\tflags: 0x%x = %s\n", cmd->setvol.flags,
"A_RATE | A_RIGHT");
PRINTF("\ttarget right: 0x%x\n", cmd->setvol.vol);
PRINTF("\tinteger rate right: 0x%x\n", cmd->setvol.voltgt);
PRINTF("\tfractional rate right: 0x%x\n",
cmd->setvol.volrate);
PRINTF("\trate right: %f\n", (1.0*cmd->setvol.voltgt) +
((float)cmd->setvol.volrate/(float)0xffff));
PRINTF("\n");
}
break;
case A_DMEMMOVE:
PRINTF("A_DMEMMOVE: %d\n", cmd->adpcm.cmd);
PRINTF("\tpad1: 0x%x\n", cmd->dmemmove.pad1);
PRINTF("\tdmemin: 0x%x\n", cmd->dmemmove.dmemin);
PRINTF("\tdmemout: 0x%x\n", cmd->dmemmove.dmemout);
PRINTF("\tcount: 0x%x\n", cmd->dmemmove.count);
PRINTF("\n");
break;
case A_LOADADPCM:
PRINTF("A_LOADADPCM: %d\n", cmd->adpcm.cmd);
PRINTF("\tpad1: 0x%x\n", cmd->loadadpcm.pad1);
PRINTF("\tcount: 0x%x\n", cmd->loadadpcm.count);
PRINTF("\tsegment: %d\n", cmd->loadadpcm.addr>>26);
PRINTF("\tdram offset: 0x%x\n",
cmd->loadadpcm.addr & 0x03ffffff);
PRINTF("\n");
break;
case A_MIXER:
PRINTF("A_MIXER: %d\n", cmd->adpcm.cmd);
PRINTF("\tflags: 0x%x\n", cmd->mixer.flags);
temp = (float)((short)cmd->mixer.gain)/(float)0x7fff;
PRINTF("\tgain: 0x%x, %f\n", cmd->mixer.gain, temp);
PRINTF("\tdmemin: 0x%x\n", cmd->mixer.dmemi);
PRINTF("\tdmemout: 0x%x\n", cmd->mixer.dmemo);
PRINTF("\n");
break;
case A_INTERLEAVE:
PRINTF("A_INTERLEAVE: %d\n", cmd->interleave.cmd);
PRINTF("\tpad1: 0x%x\n", cmd->interleave.pad1);
PRINTF("\tpad2: 0x%x\n", cmd->interleave.pad2);
PRINTF("\tLeft input: %d\n", cmd->interleave.inL);
PRINTF("\tRight input: %d\n", cmd->interleave.inR);
PRINTF("\n");
break;
case A_POLEF:
PRINTF("A_POLEF: %d\n", cmd->polef.cmd);
PRINTF("\tflags: 0x%x\n", cmd->polef.flags);
PRINTF("\tgain: %d\n", cmd->polef.gain);
PRINTF("\tstate offset: 0x%x\n", cmd->polef.addr);
PRINTF("\n");
break;
default:
PRINTF("Unknown Acmd: 0x%x\n", cmd->adpcm.cmd);
PRINTF("\tflags: 0x%x\n", cmd->adpcm.flags);
PRINTF("\taud0ls: 0x%x\n", cmd->adpcm.gain);
PRINTF("\taud1ms: %d\n", cmd->adpcm.addr>>16);
PRINTF("\taud1ls: 0x%x\n", cmd->adpcm.addr & 0xffff);
PRINTF("\n");
break;
}
}
PRINTF("Done parsing audio command list\n\n");
}