summaryrefslogtreecommitdiff
path: root/packages/ti/ipc/tests/ping_rpmsg_common.cfg.xs
blob: 8e3dea7302009db9ddcbbe79430b1069eb53edf9 (plain)
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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
/*
 * Copyright (c) 2012-2018 Texas Instruments Incorporated - http://www.ti.com
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * *  Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *
 * *  Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * *  Neither the name of Texas Instruments Incorporated nor the names of
 *    its contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

var Memory = xdc.useModule('xdc.runtime.Memory');
var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore');
var BIOS = xdc.useModule('ti.sysbios.BIOS');
BIOS.heapSize = 0x10000;
/* Reduces code size, by only pulling in modules explicitly referenced: */
BIOS.libType = BIOS.LibType_Custom;

var Idle = xdc.useModule('ti.sysbios.knl.Idle');
Idle.addFunc('&VirtQueue_cacheWb');

var System = xdc.useModule('xdc.runtime.System');
/* Use ti.trace.SysMin for remoteproc to handle trace as circular buffer */
var SysMin = xdc.useModule('ti.trace.SysMin');
System.SupportProxy = SysMin;

var Diags = xdc.useModule('xdc.runtime.Diags');

if (Program.cpu.deviceName == "OMAPL138") {
    xdc.useModule('ti.ipc.family.omapl138.VirtQueue');
    xdc.useModule('ti.sdo.ipc.family.da830.InterruptDsp');

    var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
    MultiProc.setConfig("DSP", ["HOST", "DSP"]);

    /* Enable Memory Translation module that operates on the Resource Table */
    var Resource = xdc.useModule('ti.ipc.remoteproc.Resource');
    Resource.loadSegment = Program.platform.dataMemory;

    Program.sectMap[".text:_c_int00"] = new Program.SectionSpec();
    Program.sectMap[".text:_c_int00"].loadSegment = "DDR";
    Program.sectMap[".text:_c_int00"].loadAlign = 0x400;

    var Hwi = xdc.useModule('ti.sysbios.family.c64p.Hwi');

    var Cache = xdc.useModule('ti.sysbios.family.c64p.Cache');
    /* Set 0xc4000000 -> 0xc4ffffff to be non-cached for shared memory IPC */
    Cache.MAR192_223 = 0x00000010;

    Program.global.sysMinBufSize = 0x8000;
    SysMin.bufSize  =  Program.global.sysMinBufSize;

    var Timer = xdc.useModule('ti.sysbios.timers.timer64.Timer');
    var Clock = xdc.useModule('ti.sysbios.knl.Clock');
    Timer.timerSettings[1].master = true;
    Timer.defaultHalf = Timer.Half_LOWER;
    Clock.timerId = 1;

    /*  COMMENT OUT TO SHUT OFF LOG FOR BENCHMARKS: */
    /*
    Diags.setMaskMeta("ti.ipc.family.omapl138.Interrupt", Diags.USER1,
        Diags.ALWAYS_ON);
    Diags.setMaskMeta("ti.ipc.family.omapl138.VirtQueue", Diags.USER1,
        Diags.ALWAYS_ON);
    */

    Program.sectMap[".tracebuf"] = "DDR";
}
else if (Program.platformName.match(/6614/)) {
    var VirtQueue = xdc.useModule('ti.ipc.family.tci6614.VirtQueue');
    var Interrupt = xdc.useModule('ti.ipc.family.tci6614.Interrupt');

    /* Note: MultiProc_self is set during VirtQueue_init based on DNUM. */
    var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
    MultiProc.setConfig(null, ["HOST", "CORE0", "CORE1", "CORE2", "CORE3"]);

    Program.sectMap[".text:_c_int00"] = new Program.SectionSpec();
    Program.sectMap[".text:_c_int00"].loadSegment = "L2SRAM";
    Program.sectMap[".text:_c_int00"].loadAlign = 0x400;

    Program.sectMap[".tracebuf"] = "DDR";

    var Hwi = xdc.useModule('ti.sysbios.family.c64p.Hwi');

    /* This makes the vrings address range 0xa0000000 to 0xa1ffffff uncachable.
       We assume the rest is to be left cacheable.
       Per sprugw0b.pdf
        0184 8280h MAR160 Memory Attribute Register 160 A000 0000h - A0FF FFFFh
        0184 8284h MAR161 Memory Attribute Register 161 A100 0000h - A1FF FFFFh
    */
    var Cache = xdc.useModule('ti.sysbios.family.c66.Cache');
    /*  This doesn't work:
         Cache.MAR160_191 = 0xFFFFFFFC;
         So, need to do this:
    */
    Cache.setMarMeta(0xA0000000, 0x1FFFFFF, 0);

    Program.global.sysMinBufSize = 0x8000;
    SysMin.bufSize  =  Program.global.sysMinBufSize;

    /* Enable Memory Translation module that operates on the Resource Table */
    var Resource = xdc.useModule('ti.ipc.remoteproc.Resource');
    Resource.loadSegment = Program.platform.dataMemory;

    /*  COMMENT OUT TO SHUT OFF LOG FOR BENCHMARKS: */
    /*
    Diags.setMaskMeta("ti.ipc.family.tci6614.Interrupt", Diags.USER1,
        Diags.ALWAYS_ON);
    Diags.setMaskMeta("ti.ipc.family.tci6614.VirtQueue", Diags.USER1,
        Diags.ALWAYS_ON);
    Diags.setMaskMeta("ti.ipc.transports.TransportRpmsg",
        Diags.INFO|Diags.USER1|Diags.STATUS,
        Diags.ALWAYS_ON);
    Diags.setMaskMeta("ti.ipc.namesrv.NameServerRemoteRpmsg", Diags.INFO,
        Diags.ALWAYS_ON);
    */
}
else if (Program.platformName.match(/simKepler/) ||
        Program.cpu.deviceName.match(/^TMS320C66AK2E05$/) ||
        Program.cpu.deviceName.match(/^TCI66AK2G02$/) ||
        Program.cpu.deviceName.match(/^TMS320C66AK2H12$/) ||
        Program.cpu.deviceName.match(/^TMS320TCI663(0K2L|6|8)$/)) {
    var VirtQueue = xdc.useModule('ti.ipc.family.tci6638.VirtQueue');

    /* Note: MultiProc_self is set during VirtQueue_init based on DNUM. */
    var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');

    switch (Program.cpu.deviceName) {
        case "TMS320C66AK2E05":
        case "TCI66AK2G02":
            MultiProc.setConfig(null, ["HOST", "CORE0"]);
            break;

        case "TMS320TCI6630K2L":
            MultiProc.setConfig(null,
                    ["HOST", "CORE0", "CORE1", "CORE2", "CORE3"]);
            break;

        case "TMS320TCI6636":
        case "TMS320TCI6638":
        case "TMS320C66AK2H12":
            MultiProc.setConfig(null,
                    ["HOST", "CORE0", "CORE1", "CORE2", "CORE3",
                    "CORE4", "CORE5", "CORE6", "CORE7"]);
            break;
    }

    Program.sectMap[".text:_c_int00"] = new Program.SectionSpec();
    Program.sectMap[".text:_c_int00"].loadSegment = "L2SRAM";
    Program.sectMap[".text:_c_int00"].loadAlign = 0x400;

    Program.sectMap[".tracebuf"] = "L2SRAM";

    var Hwi = xdc.useModule('ti.sysbios.family.c64p.Hwi');

    /* This makes the vrings address range 0xa0000000 to 0xa1ffffff uncachable.
       We assume the rest is to be left cacheable.
       Per sprugw0b.pdf
        0184 8280h MAR160 Memory Attribute Register 160 A000 0000h - A0FF FFFFh
        0184 8284h MAR161 Memory Attribute Register 161 A100 0000h - A1FF FFFFh
    */
    var Cache = xdc.useModule('ti.sysbios.family.c66.Cache');
    /*  This doesn't work:
         Cache.MAR160_191 = 0xFFFFFFFC;
         So, need to do this:
    */
    /* TBD: Update for Kepler: */
    Cache.setMarMeta(0xA0000000, 0x1FFFFFF, 0);

    Program.global.sysMinBufSize = 0x2000;
    SysMin.bufSize  =  Program.global.sysMinBufSize;

    /* Enable Memory Translation module that operates on the Resource Table */
    var Resource = xdc.useModule('ti.ipc.remoteproc.Resource');
    Resource.loadSegment = Program.platform.dataMemory;

    /*  COMMENT OUT TO SHUT OFF LOG FOR BENCHMARKS: */
    /*
    Diags.setMaskMeta("ti.ipc.family.tci6638.VirtQueue", Diags.USER1,
        Diags.ALWAYS_ON);
    Diags.setMaskMeta("ti.ipc.transports.TransportRpmsg",
        Diags.INFO|Diags.USER1|Diags.STATUS,
        Diags.ALWAYS_ON);
    Diags.setMaskMeta("ti.ipc.namesrv.NameServerRemoteRpmsg", Diags.INFO,
        Diags.ALWAYS_ON);
    */
}
else if (Program.platformName.match(/^ti\.platforms\.cortexR:AM65X/) &&
         Program.cpu.attrs.cpuCore.match(/^R5$/)) {

/* TODO: Need check on defaultHeapSize */
//    Memory.defaultHeapSize = 0x20000;
    var VirtQueue = xdc.useModule('ti.ipc.family.am65xx.VirtQueue');

    /* Enable Memory Translation module that operates on the Resource Table */
    var Resource = xdc.useModule('ti.ipc.remoteproc.Resource');

    Resource.loadSymbol = "__RESOURCE_TABLE";

    var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc');
    MultiProc.setConfig("R5F-0", ["HOST", "R5F-0", "R5F-1"]);

    xdc.loadCapsule("R5fmpu_am65xx.cfg");

    var Hwi = xdc.useModule('ti.sysbios.family.arm.v7r.keystone3.Hwi');
/* TODO: Need to check on equivalent for K3 */
/*     Hwi.enableException = true; */

    SysMin.bufSize  = 0x8000;

    Program.sectMap[".tracebuf"] = "TRACE_BUF";

    var dmTimer = xdc.useModule('ti.sysbios.timers.dmtimer.Timer');
    /* Skip the Timer frequency verification check. Need to remove this later */
    dmTimer.checkFrequency = false;

    /* Match this to the SYS_CLK frequency sourcing the dmTimers.
     * Not needed once the appropriate build target is used (Make sure
     * SYS/BIOS family settings are updated */
    dmTimer.intFreq.hi = 0;
    dmTimer.intFreq.lo = 25000000;
}else {
    throw("ping_rpmsg_common.cfg: Did not match any platform!"
          + " platform:" +  Program.platformName + "cpuCore:"
          + Program.cpu.attrs.cpuCore );
}

xdc.useModule('ti.ipc.ipcmgr.IpcMgr');
BIOS.addUserStartupFunction('&IpcMgr_rpmsgStartup');

xdc.loadPackage('ti.ipc.rpmsg');

var HeapBuf   = xdc.useModule('ti.sysbios.heaps.HeapBuf');
var List      = xdc.useModule('ti.sdo.utils.List');

xdc.useModule('ti.sysbios.xdcruntime.GateThreadSupport');
var GateSwi   = xdc.useModule('ti.sysbios.gates.GateSwi');

var Assert = xdc.useModule('xdc.runtime.Assert');
var Defaults = xdc.useModule('xdc.runtime.Defaults');
var Diags = xdc.useModule('xdc.runtime.Diags');
var LoggerSys = xdc.useModule('xdc.runtime.LoggerSys');
var LoggerSysParams = new LoggerSys.Params();

/* Enable Logger: */
Defaults.common$.logger = LoggerSys.create(LoggerSysParams);
// FOR BENCHMARKING: Defaults.common$.logger = null;

/* Enable runtime Diags_setMask() for non-XDC spec'd modules: */
var Text = xdc.useModule('xdc.runtime.Text');
Text.isLoaded = true;
var Registry = xdc.useModule('xdc.runtime.Registry');
/*
Registry.common$.diags_INFO  = Diags.ALWAYS_ON;
Registry.common$.diags_STATUS = Diags.ALWAYS_ON;
Registry.common$.diags_LIFECYCLE = Diags.ALWAYS_ON;
*/
Diags.setMaskEnabled = true;

var Main = xdc.useModule('xdc.runtime.Main');
Main.common$.diags_ASSERT = Diags.ALWAYS_ON;
Main.common$.diags_INTERNAL = Diags.ALWAYS_ON;