index 2f1854a05bedd8f7ecf633fa033f7f2d51e12bd8..8fd693c948e3c91c948e4a396f677cf962b94e45 100644 (file)
/*
- * Copyright (c) 2012-2013, Texas Instruments Incorporated
+ * Copyright (c) 2012-2014 Texas Instruments Incorporated - http://www.ti.com
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
var SyncSem = null;
var instCount = 0; /* use to determine if processing last instance */
-var sharedCreateId = new Array();
/*
* ======== module$meta$init ========
if (xdc.om.$name != "cfg") {
return;
}
-
- /* Initialize the shared CreateId array */
- var MultiProc = xdc.module('ti.sdo.utils.MultiProc');
- sharedCreateId.length != MultiProc.numProcessors;
-
- for (var i = 0; i < sharedCreateId.length; i++) {
- sharedCreateId[i] = 1;
- }
}
/*
List = xdc.useModule("ti.sdo.utils.List");
MultiProc = xdc.useModule("ti.sdo.utils.MultiProc");
NameServer = xdc.useModule('ti.sdo.utils.NameServer');
- GateThread = xdc.useModule("xdc.runtime.knl.GateThread");
- SyncSem = xdc.useModule("ti.sysbios.syncs.SyncSem");
+ GateThread = xdc.useModule('xdc.runtime.knl.GateThread');
+ SyncSem = xdc.useModule('ti.sysbios.syncs.SyncSem');
+
+ xdc.useModule('ti.sdo.ipc.interfaces.ITransport');
+ xdc.useModule('ti.sdo.ipc.interfaces.IMessageQTransport');
+ xdc.useModule('ti.sdo.ipc.interfaces.INetworkTransport');
+ xdc.useModule('ti.sdo.ipc.transports.TransportNetworkDummy');
/* Plug the SetupTransportProxy for the MessageQ transport */
if (MessageQ.SetupTransportProxy == null) {
* ======== module$static$init ========
* Initialize module values.
*/
-function module$static$init(mod, params)
+function module$static$init(state, mod)
{
/* initialize the NameServer param to be used now or later */
- MessageQ.nameSrvPrms.maxRuntimeEntries = params.maxRuntimeEntries;
- MessageQ.nameSrvPrms.tableSection = params.tableSection;
- MessageQ.nameSrvPrms.maxNameLen = params.maxNameLen;
+ MessageQ.nameSrvPrms.maxRuntimeEntries = mod.maxRuntimeEntries;
+ MessageQ.nameSrvPrms.tableSection = mod.tableSection;
+ MessageQ.nameSrvPrms.maxNameLen = mod.maxNameLen;
/*
* Get the current number of created static instances of this module.
/* create NameServer here only if no static instances are created */
if (instCount == 0) {
- mod.nameServer = NameServer.create("MessageQ",
- MessageQ.nameSrvPrms);
+ state.nameServer = NameServer.create("MessageQ", MessageQ.nameSrvPrms);
}
else {
- mod.nameServer = null;
+ state.nameServer = null;
}
/*
* If no growth allowed, pre-allocate the max length
+ * Also pre-allocate if numReservedEntries is not zero.
+ * maxRuntimeEntries < numReservedEntries is caught in validate.
*/
- mod.numQueues = this.$instances.length;
- if (params.maxRuntimeEntries != NameServer.ALLOWGROWTH) {
- mod.numQueues += params.maxRuntimeEntries;
+ state.numQueues = this.$instances.length;
+ if (mod.maxRuntimeEntries != NameServer.ALLOWGROWTH) {
+ state.numQueues += mod.maxRuntimeEntries;
}
- mod.queues.length = mod.numQueues;
- mod.canFreeQueues = false;
+ else if (mod.numReservedEntries != 0){
+ state.numQueues += mod.numReservedEntries;
+ }
+
+ state.queues.length = state.numQueues;
+ state.canFreeQueues = false;
+ state.freeHookFxn = mod.freeHookFxn;
+ state.putHookFxn = mod.putHookFxn;
- if (params.nameTableGate == null) {
- mod.gate = null;
+ if (mod.nameTableGate == null) {
+ state.gate = null;
}
else {
- mod.gate = params.nameTableGate;
+ state.gate = mod.nameTableGate;
}
var messsageQParams = new this.Params;
/* Initial the seqNum used for tracing */
- mod.seqNum = 0;
+ state.seqNum = 0;
/* Set the length of the heaps array */
- mod.numHeaps = params.numHeaps;
- mod.heaps.length = mod.numHeaps;
+ state.numHeaps = mod.numHeaps;
+ state.heaps.length = state.numHeaps;
/* Initialize the heaps array to null */
- for (var i = 0; i < mod.heaps.length; i++) {
- mod.heaps[i] = null;
+ for (var i = 0; i < state.heaps.length; i++) {
+ state.heaps[i] = null;
}
/*
* Sort the static heaps by heap id into the heaps array
*/
- for (var i = 0; i < params.staticHeaps.length; i++) {
+ for (var i = 0; i < mod.staticHeaps.length; i++) {
/* Make sure the id is not too big */
- if (params.staticHeaps[i].heapId >= mod.numHeaps) {
- MessageQ.$logError("Out of range heapId (" +
- params.staticHeaps[i].heapId +
- "). Max heapId is " + (params.numHeaps - 1) +
- " (MessageQ.numHeaps - 1).", this);
+ if (mod.staticHeaps[i].heapId >= state.numHeaps) {
+ MessageQ.$logError("Out of range heapId ("
+ + mod.staticHeaps[i].heapId + "). Max heapId is "
+ + (mod.numHeaps - 1) + " (MessageQ.numHeaps - 1).", this);
}
/* Make sure the same id is not used twice */
- if (mod.heaps[params.staticHeaps[i].heapId] != null) {
- MessageQ.$logError("Cannot register multiple heaps to heapId " +
- params.staticHeaps[i].heapId + ".", this);
+ if (state.heaps[mod.staticHeaps[i].heapId] != null) {
+ MessageQ.$logError("Cannot register multiple heaps to heapId "
+ + mod.staticHeaps[i].heapId + ".", this);
}
- mod.heaps[params.staticHeaps[i].heapId] = params.staticHeaps[i].heap;
+ state.heaps[mod.staticHeaps[i].heapId] = mod.staticHeaps[i].heap;
}
/* Set the length of the transport array */
- mod.transports.length = MultiProc.numProcessors;
+ state.transports.length = MultiProc.numProcessors;
/* Initialize all the transports to null */
- for (var i = 0; i < mod.transports.length; i++) {
- mod.transports[i][0] = null;
- mod.transports[i][1] = null;
+ for (var i = 0; i < state.transports.length; i++) {
+ state.transports[i][0] = null;
+ state.transports[i][1] = null;
}
/*
* Sort the static Transports by processor id into the
* transport array
*/
- for (var i = 0; i < params.staticTransports.length; i++) {
+ for (var i = 0; i < mod.staticTransports.length; i++) {
/* Make sure the procId is not too big */
- if (params.staticTransports[i].procId >= MultiProc.numProcessors) {
- MessageQ.$logError("MessageQ Out of range procId (" +
- params.staticTransports[i].procId +
- "). Max procId is " +
- (MultiProc.numProcessors) +
- " (MultiProc.numProcessors).", this);
+ if (mod.staticTransports[i].procId >= MultiProc.numProcessors) {
+ MessageQ.$logError("MessageQ Out of range procId ("
+ + mod.staticTransports[i].procId + "). Max procId is "
+ + (MultiProc.numProcessors) + " (MultiProc.numProcessors).",
+ this);
}
/* Make sure the same id is not used twice */
- if (mod.transports[params.staticTransports[i].procId] != null) {
- MessageQ.$logError("Cannot register multiple transports to one" +
- " remote processor " +
- params.staticTransports[i].procId + ".", this);
+ if (state.transports[mod.staticTransports[i].procId] != null) {
+ MessageQ.$logError("Cannot register multiple transports to one"
+ + " remote processor " + mod.staticTransports[i].procId
+ + ".", this);
}
- mod.transports[params.staticTransports[i].procId] =
- params.staticTransports[i].transport;
+ state.transports[mod.staticTransports[i].procId] =
+ mod.staticTransports[i].transport;
+ }
+
+ /* initialize the registered transport array */
+ for (var i = 0; i < state.regTrans.length; i++) {
+ state.regTrans[i].transport = null;
+ state.regTrans[i].type = mod.TransportType_Invalid;
}
}
* that will be used.
*/
view.nextSeqNum = mod.seqNum;
+
+ /* Display the freeHookFxn if there is one. */
+ if (Number(mod.freeHookFxn) != 0 ) {
+ view.freeHookFxn = Program.lookupFuncName(Number(mod.freeHookFxn));
+ }
+}
+
+function module$validate()
+{
+ if ((MessageQ.maxRuntimeEntries != NameServer.ALLOWGROWTH) &&
+ (MessageQ.maxRuntimeEntries < MessageQ.numReservedEntries)) {
+ MessageQ.$logFatal(
+ "If MessageQ.maxRuntimeEntries is not NameServer.ALLOWGROWTH, " +
+ "it cannot be less than MessageQ.numReservedEntries.",
+ MessageQ);
+ }
}