Hi ,
MCSDK version : 2.2.1.03
IPC Version: ipc_1_25_03_15
Bios Version : bios_6_35_04_50
XDC version : xdctools_3_25_03_72
We are trying out interrupt based Message_get() . Since Message_put() and Message_get() uses signal() and wait() functions which are more like polling .
So we thought of using notify to send an interrupt as soon as the put happens to the remote proc . But unfortunately the code is not calling the callback function.
In ROV we saw Notify event registration is successful for both the cores.
Core 0 : Puts the message and send the event
Core1: Is in indefinite run state .
Core 0 code snippet :
status = MessageQ_put(remoteQueueId, msgTx); if (status < 0) { System_abort("MessageQ_put had a failure/error\n"); } System_printf("Msg Core1 put \n"); status = Notify_sendEvent(nextProcId, LINEID, eventId, NULL, TRUE);
core 1 code snippet :
attachAll(Num_Processor) ; status = Notify_registerEventSingle(nextProcId, LINEID, eventId,(Notify_FnNotifyCbck)Core0_Interrupt, NULL);
void Core0_Interrupt(UInt16 procId, UInt16 lineId,UInt32 eventId, UArg arg, UInt32 payload) { int status ; status = MessageQ_get(messageQ, &msgRX, MessageQ_FOREVER); if (status < 0) { // System_abort("This should not happen since timeout is forever\n"); } core1msg = (Core1Struct*)msgRX; // System_printf("Msg Core1 Got :: %d\n" ,core1msg->test_val1); status = MessageQ_free(msgRX); if(status == MessageQ_E_FAIL ) { // System_printf("Msg free failed\n"); } }
.cfg file :
/* --COPYRIGHT--,BSD * Copyright (c) 2011, Texas Instruments Incorporated * 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. * --/COPYRIGHT--*/ /* Benchmark Task */ var Task = xdc.useModule('ti.sysbios.knl.Task'); var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore'); Semaphore.supportsEvents = false; //var Agent = xdc.useModule('ti.sysbios.rta.Agent'); //Agent.transport = Agent.Transport_STOP_MODE_ONLY; //var Load = xdc.useModule('ti.sysbios.utils.Load'); //Load.hwiEnabled = false; //Load.swiEnabled = false; //Load.taskEnabled = false; var System = xdc.useModule('xdc.runtime.System'); var Startup = xdc.useModule('xdc.runtime.Startup'); var SysStd = xdc.useModule('xdc.runtime.SysStd'); System.SupportProxy = SysStd; System.extendedFormats = "%f"; var BIOS = xdc.useModule('ti.sysbios.BIOS'); BIOS.clockEnabled = false; BIOS.heapSize = 0x8000; var Timestamp = xdc.useModule("xdc.runtime.Timestamp"); var PlatformLib = xdc.loadPackage('ti.platform.evmtci6614'); /* ** Register an EVM Init handler with BIOS. This will initialize the hardware. BIOS calls before it starts. ** ** If debugging with CCS, then this function will execute as CCS loads it if the option in your ** Target Configuration file (.ccxml) has the option set to execute all code before Main. That is the ** default. */ var cslSettings = xdc.useModule ('ti.csl.Settings'); var cacheEnabled = true; var cacheLineSize = 128; var procName = null; var procNameList = []; var Settings = xdc.module('ti.sdo.ipc.family.Settings'); var Cache = xdc.useModule('ti.sysbios.family.c66.Cache'); var MessageQ = xdc.module('ti.sdo.ipc.MessageQ'); var Notify = xdc.module('ti.sdo.ipc.Notify'); var Ipc = xdc.useModule('ti.sdo.ipc.Ipc'); var HeapBufMP = xdc.useModule('ti.sdo.ipc.heaps.HeapBufMP'); Notify.SetupProxy = xdc.module(Settings.getNotifySetupDelegate()); MessageQ.SetupTransportProxy= xdc.module(Settings.getMessageQSetupDelegate()); /* Use shared memory IPC */ Notify.SetupProxy = xdc.module('ti.sdo.ipc.family.c647x.NotifyCircSetup'); MessageQ.SetupTransportProxy = xdc.module('ti.sdo.ipc.transports.TransportShmNotifySetup'); /* Synchronize all processors (this will be done in Ipc_start) */ Ipc.procSync = Ipc.ProcSync_ALL; /* Set to disable error printouts */ /* var Error = xdc.useModule('xdc.runtime.Error'); */ /* Error.raiseHook = null; */ Program.global.NOTIFYSETUP = Notify.SetupProxy.delegate$.$name; Program.global.TRANSPORTSETUP = MessageQ.SetupTransportProxy.delegate$.$name; //switch (Program.platformName) { // case "ti.platforms.evm6614": // Program.global.USING_TCI6614 = 1; //procNameList = ["CORE0", "CORE1"]; //Program.global.shmBase = 0x0C000000; //Program.global.shmSize = 0x00050000; /* Sized for greater than 2000 128 byte messageQ messages */ // break; //default: // throw("Unsupported platform: " + Program.platformName); //} // procName = "CORE1"; procNameList = ["CORE0","CORE1"]; var MultiProc = xdc.useModule('ti.sdo.utils.MultiProc'); MultiProc.setConfig(null, procNameList); Program.global.DEVICENAME = Program.cpu.deviceName; Program.global.PROCNAMES = procNameList.join(","); Program.global.BUILDPROFILE = Program.build.profile; var SharedRegion = xdc.useModule('ti.sdo.ipc.SharedRegion'); SharedRegion.translate = false; SharedRegion.setEntryMeta(0, { base: 0x0c000000, len: 0x00100000, ownerProcId: 0, isValid: true, cacheEnable: cacheEnabled, cacheLineSize: cacheLineSize, /* Aligns allocated messages to a cache line */ createHeap: true, name: "internal_shared_mem", }); /* Optimization stuff */ Diags = xdc.useModule("xdc.runtime.Diags"); var Defaults = xdc.useModule('xdc.runtime.Defaults'); //Defaults.common$.diags_ASSERT = Diags.ALWAYS_OFF; Defaults.common$.logger = null; //Semaphore.supportsEvents = false; var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore'); Program.global.semHandle = Semaphore.create(0);
# We tried semaphore_pend and post to handle the interrupt flow : but both core was getting into an indefinite run state (Deadlock) .
PS : WIthout the notify functionality the code was working fine with MessageQ_get in BLOCKING mode.
1# Can MessageQ_get() can be called inside the Callback function ?
2# Is default value for EventId and LineId is 0 or any values can be assigned ?
Regards ,
Vinodh