xref: /inferno-os/os/mpc/dsp.h (revision 7ef44d652ae9e5e1f5b3465d73684e4a54de73c0)
1 /*
2  * MPC82x/QUICC DSP support
3  */
4 
5 typedef struct DSP DSP;
6 typedef struct FnD FnD;
7 
8 typedef short Real;
9 typedef struct Complex Complex;
10 
11 struct Complex {
12 	Real	im;
13 	Real	re;
14 };
15 
16 struct FnD {
17 	ushort	status;
18 	ushort	param[7];
19 };
20 
21 enum {
22 	FnDsize =	8*2,	/* each function descriptor is 8 shorts */
23 
24 	/* standard bits in FnD.status */
25 	FnStop = 	1<<15,
26 	FnWrap =	1<<13,
27 	FnInt =	1<<12,
28 
29 	/* optional bits */
30 	FnZ =	1<<11,	/* FIR[35], MOD */
31 	FnIALL =	1<<10,	/* FIRx */
32 	FnXinc0 =	0<<8,	/* FIRx, IRR */
33 	FnXinc1 =	1<<8,
34 	FnXinc2 =	2<<8,
35 	FnXinc3 =	3<<8,
36 	FnPC =	1<<7,	/* FIRx */
37 
38 
39 	/* DSP functions (table 16-6) */
40 	FnFIR1 =	0x01,
41 	FnFIR2 =	0x02,
42 	FnFIR3 =	0x03,
43 	FnFIR5 = 	0x03,
44 	FnFIR6 =	0x06,
45 	FnIIR =	0x07,
46 	FnMOD =	0x08,
47 	FnDEMOD = 0x09,
48 	FnLMS1 =	0x0A,
49 	FnLMS2 =	0x0B,
50 	FnWADD = 0x0C,
51 };
52 
53 void	dspinitialise(void);
54 DSP*	dspacquire(void (*)(void*), void*);
55 void	dspexec(DSP*, FnD*, ulong);
56 void*	dspmalloc(ulong);
57 void	dspfree(void*, ulong);
58 void	dspsetfn(DSP*, FnD*, ulong);
59 void	dspstart(DSP*);
60 void	dsprelease(DSP*);
61 FnD*	fndalloc(ulong);
62 void	fndfree(FnD*, ulong);
63