src_dmem.h
3.25 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
/*
* src_dmem.h
*
* This file lays out the DMEM usage for the RSP resampling task.
*
*/
#ifndef _src_dmem_h_
#define _src_dmem_h_ 1
/*
* usage of the 'eval' macro below implies that this code must pass
* throught the 'm4' macro processor. The RSP assembler does this,
* by default, but any C program including this might have trouble with this.
* Protect them by defining the eval() macro...
*/
#ifdef _LANGUAGE_C
# ifndef eval
# define eval(s) (s)
# endif /* eval */
#endif /* _LANGUAGE_C */
/*
* Memory addressing Strategy:
*
* We'll probably always keep the base address of DMEM around in
* a register. We'll define all the fixed areas as offsets from
* there. We'll also try to keep things clean and flexible as they
* _will_ change during development.
*
*/
#ifndef DCACHEBASE
# define DCACHEBASE 0x00000000
#endif
#ifndef DCACHEBASEHI
# define DCACHEBASEHI 0x0000
#endif
#ifndef DCACHEBASELO
# define DCACHEBASELO 0x0000
#endif
#define BYTES_PER_SHORT 2
#define BYTES_PER_VECTOR 16
#define COEF_TAB_SIZE 256
#define C_MULINC eval(RSP_PDATA_OFFSET)
#define C_ONE eval(C_MULINC + BYTES_PER_VECTOR)
#define C_SHIFT eval(C_ONE + BYTES_PER_VECTOR)
#define C_ZEROFOUR eval(C_SHIFT + BYTES_PER_VECTOR)
#define C_ONEFIVE eval(C_ZEROFOUR + BYTES_PER_VECTOR)
#define C_TWOSIX eval(C_ONEFIVE + BYTES_PER_VECTOR)
#define C_THREESEVEN eval(C_TWOSIX + BYTES_PER_VECTOR)
#define C_RAMP eval(C_THREESEVEN + BYTES_PER_VECTOR)
#define COEF_TAB eval(C_RAMP + BYTES_PER_VECTOR)
#define END_OF_SRC_PDATA eval(COEF_TAB + (COEF_TAB_SIZE * BYTES_PER_SHORT))
#define ICA eval(RSP_SCRATCH_OFFSET + RESAMPLE_STATE_SIZE8)
#define CPH eval(ICA + BYTES_PER_VECTOR)
#define VT eval(CPH + BYTES_PER_VECTOR)
#define LAST_FCA eval(VT + BYTES_PER_SHORT)
#define OUTPUT_COUNT eval(LAST_FCA + BYTES_PER_SHORT)
/* During compilation, report an informative message about DMEM allocation: */
#ifdef _LANGUAGE_ASSEMBLY
# define _DumpDMEMOffset(o,s) \
.print #o \
.print "\t\t : %d\t%d bytes.\n", (DCACHEBASE + (o)), (s)
.print "--------------------------------------------------------------------\n"
.print __FILE__
.print " : Scratch space allocated is %d bytes.\n", RSP_SCRATCH_SIZE8
.print __FILE__
.print " : Program data segment is at %08x.\n", DCACHEBASE+RSP_PDATA_OFFSET
.print __FILE__
.print " : DMEM PDATA Map:\n"
_DumpDMEMOffset(C_MULINC, BYTES_PER_VECTOR)
_DumpDMEMOffset(C_ONE, BYTES_PER_VECTOR)
_DumpDMEMOffset(C_SHIFT, BYTES_PER_VECTOR)
_DumpDMEMOffset(C_ZEROFOUR, BYTES_PER_VECTOR)
_DumpDMEMOffset(C_ONEFIVE, BYTES_PER_VECTOR)
_DumpDMEMOffset(C_TWOSIX, BYTES_PER_VECTOR)
_DumpDMEMOffset(C_THREESEVEN, BYTES_PER_VECTOR)
_DumpDMEMOffset(C_RAMP, BYTES_PER_VECTOR)
_DumpDMEMOffset(COEF_TAB, (COEF_TAB_SIZE * BYTES_PER_SHORT))
_DumpDMEMOffset(END_OF_SRC_PDATA, 0)
.print "\n\n"
.print __FILE__
.print " : DMEM SCRATCH Map:\n"
_DumpDMEMOffset(ICA, BYTES_PER_VECTOR)
_DumpDMEMOffset(CPH, BYTES_PER_VECTOR)
_DumpDMEMOffset(VT, BYTES_PER_SHORT)
_DumpDMEMOffset(LAST_FCA, BYTES_PER_SHORT)
.print "--------------------------------------------------------------------\n"
# undef _DumpDMEMOffset
#endif
#endif /* _src_dmem_h_ */