summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d8ed007)
raw | patch | inline | side by side (parent: d8ed007)
author | Ramsey Harris <ramsey@ti.com> | |
Wed, 22 Jul 2015 21:19:07 +0000 (14:19 -0700) | ||
committer | Robert Tivy <rtivy@ti.com> | |
Fri, 24 Jul 2015 20:51:27 +0000 (13:51 -0700) |
Add IHeap interface to support heap abstraction within IPC.
MessageQ uses interface handle to invoke heap alloc and free
methods. Add HeapStd implementation as default heap instance
on Linux. New idHeapStd config param in Ipc module to specify
heapId when registering default heap with MessageQ. Not
supported on QNX.
MessageQ uses interface handle to invoke heap alloc and free
methods. Add HeapStd implementation as default heap instance
on Linux. New idHeapStd config param in Ipc module to specify
heapId when registering default heap with MessageQ. Not
supported on QNX.
12 files changed:
Makefile.am | patch | blob | history | |
hlos_common/include/_MessageQ.h | patch | blob | history | |
linux/include/_Ipc.h | patch | blob | history | |
linux/include/ti/ipc/heaps/HeapStd.h | [new file with mode: 0644] | patch | blob |
linux/include/ti/ipc/interfaces/IHeap.h | [new file with mode: 0644] | patch | blob |
linux/src/api/Ipc.c | patch | blob | history | |
linux/src/api/Makefile.am | patch | blob | history | |
linux/src/api/MessageQ.c | patch | blob | history | |
linux/src/daemon/cfg/IpcCfg.c | patch | blob | history | |
linux/src/daemon/cfg/MessageQCfg.c | patch | blob | history | |
linux/src/heaps/HeapStd.c | [new file with mode: 0644] | patch | blob |
qnx/src/cfg/MessageQCfg.c | patch | blob | history |
diff --git a/Makefile.am b/Makefile.am
index a025329d53b5e6bd6bf83b572772a8e8e5cec811..5272bdbb5336bbbfa620946b0980894093167a79 100644 (file)
--- a/Makefile.am
+++ b/Makefile.am
# where to install common headers on the system
ipcincludedir = $(includedir)/ti/ipc
ipcincludeinterfacesdir = $(includedir)/ti/ipc/interfaces
# where to install common headers on the system
ipcincludedir = $(includedir)/ti/ipc
ipcincludeinterfacesdir = $(includedir)/ti/ipc/interfaces
+ipcincludeheapsdir = $(includedir)/ti/ipc/heaps
# the list of common header files (to be installed later)
ipcinclude_HEADERS = \
# the list of common header files (to be installed later)
ipcinclude_HEADERS = \
ipcincludeinterfaces_HEADERS = \
$(top_srcdir)/linux/include/ti/ipc/interfaces/IMessageQTransport.h \
$(top_srcdir)/linux/include/ti/ipc/interfaces/INetworkTransport.h \
ipcincludeinterfaces_HEADERS = \
$(top_srcdir)/linux/include/ti/ipc/interfaces/IMessageQTransport.h \
$(top_srcdir)/linux/include/ti/ipc/interfaces/INetworkTransport.h \
- $(top_srcdir)/linux/include/ti/ipc/interfaces/ITransport.h
+ $(top_srcdir)/linux/include/ti/ipc/interfaces/ITransport.h \
+ $(top_srcdir)/linux/include/ti/ipc/interfaces/IHeap.h
+
+ipcincludeheaps_HEADERS = \
+ $(top_srcdir)/linux/include/ti/ipc/heaps/HeapStd.h
index 836d74f8a28861e1e4ec6db2823b983a8dbc2b69..eeb4d54d8794f4a06785a89095e349e525c78c97 100644 (file)
* This flag allows the configuration of the default module trace
* settings.
*/
* This flag allows the configuration of the default module trace
* settings.
*/
+ UInt numHeaps;
+ /*!< Number of heapIds in the system */
UInt maxRuntimeEntries;
/*!< Maximum number of MessageQs that can be dynamically created */
UInt maxNameLen;
UInt maxRuntimeEntries;
/*!< Maximum number of MessageQs that can be dynamically created */
UInt maxNameLen;
diff --git a/linux/include/_Ipc.h b/linux/include/_Ipc.h
index f9df0e3428fc3840f94b2f43a3b574959e2ffb4f..51786cedd12534a7923d3d72144fdf7cab33d9e7 100644 (file)
--- a/linux/include/_Ipc.h
+++ b/linux/include/_Ipc.h
typedef struct {
Ipc_ProcSync procSync;
typedef struct {
Ipc_ProcSync procSync;
+ UInt idHeapStd;
} Ipc_Config;
Void Ipc_getConfig(Ipc_Config *cfg);
} Ipc_Config;
Void Ipc_getConfig(Ipc_Config *cfg);
diff --git a/linux/include/ti/ipc/heaps/HeapStd.h b/linux/include/ti/ipc/heaps/HeapStd.h
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2015 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.
+ */
+
+/*
+ * ======== HeapStd.h ========
+ */
+#ifndef ti_ipc_heaps_HeapStd_h
+#define ti_ipc_heaps_HeapStd_h
+
+#include <ti/ipc/interfaces/IHeap.h>
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+#define HeapStd_S_SUCCESS 0
+#define HeapStd_E_FAIL -1
+
+/*
+ * ======== HeapStd_Handle ========
+ * Opaque handle to heap instance object
+ */
+typedef struct HeapStd_Module *HeapStd_Handle;
+
+/*
+ * ======== HeapStd_handle ========
+ * Return the heap handle
+ *
+ * This module does not support instance creation. When the module
+ * is initialized, a single implicit instance is created. This method
+ * returns the handle to this implicit instance.
+ */
+HeapStd_Handle HeapStd_handle(void);
+
+/*
+ * ======== HeapStd_upCast ========
+ * Instance converter, return a handle to the inherited interface
+ */
+IHeap_Handle HeapStd_upCast(HeapStd_Handle inst);
+
+/*
+ * ======== HeapStd_downCast ========
+ * Instance converter, return an opaque handle to the instance object
+ *
+ * It is the caller's responsibility to ensure the underlying object
+ * is of the correct type.
+ */
+HeapStd_Handle HeapStd_downCast(IHeap_Handle base);
+
+
+#if defined (__cplusplus)
+}
+#endif
+#endif
diff --git a/linux/include/ti/ipc/interfaces/IHeap.h b/linux/include/ti/ipc/interfaces/IHeap.h
--- /dev/null
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2015 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.
+ */
+
+/**
+ * @file linux/include/ti/ipc/interfaces/IHeap.h
+ *
+ * @brief Interface to heap functions
+ *
+ * Heap implementations to be registered with MessageQ must inherit
+ * and implement this interface. The heap implementation must have an
+ * API which returns an IHeap_Handle for each heap instance.
+ *
+ * The IHeap interface includes the following instance methods:
+ *
+ * alloc - allocate a block of memory from the heap
+ *
+ * The allocated memory may be either uninitialized or zero-initialized.
+ * The implementation should document the behavior or provide an instance
+ * create parameter to define the behavior.
+ *
+ * free - return a block of memory to the heap
+ *
+ * This method gives back a block of memory to the heap instance. It is
+ * expected to always succeed (i.e. it does not return a failure code).
+ */
+
+/*
+ * ======== IHeap.h ========
+ */
+
+#ifndef ti_ipc_interfaces_IHeap_h
+#define ti_ipc_interfaces_IHeap_h
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+/* opaque instance handle */
+typedef struct IHeap_Object *IHeap_Handle;
+
+/* virtual functions */
+typedef struct IHeap_Fxns {
+ void *(*alloc)(void *handle, size_t size);
+ void (*free)(void *handle, void *block);
+} IHeap_Fxns;
+
+/* abstract instance object */
+typedef struct IHeap_Object {
+ IHeap_Fxns *fxns;
+} IHeap_Object;
+
+/* function stubs */
+static inline
+void *IHeap_alloc(IHeap_Handle inst, size_t size)
+{
+ IHeap_Object *obj = (IHeap_Object *)inst;
+ return obj->fxns->alloc((void *)inst, size);
+}
+
+static inline
+void IHeap_free(IHeap_Handle inst, void *block)
+{
+ IHeap_Object *obj = (IHeap_Object *)inst;
+ obj->fxns->free((void *)inst, block);
+}
+
+#if defined (__cplusplus)
+}
+#endif
+#endif
diff --git a/linux/src/api/Ipc.c b/linux/src/api/Ipc.c
index 8bd74b521a6e426e74de73a1aa9533563ea05800..44b4816a6e981c839977d5253aaae27eb6c0a6d9 100644 (file)
--- a/linux/src/api/Ipc.c
+++ b/linux/src/api/Ipc.c
#include <ti/ipc/Std.h>
#include <ti/ipc/Ipc.h>
#include <ti/ipc/NameServer.h>
#include <ti/ipc/Std.h>
#include <ti/ipc/Ipc.h>
#include <ti/ipc/NameServer.h>
+#include <ti/ipc/heaps/HeapStd.h>
+#include <ti/ipc/interfaces/IHeap.h>
/* User side headers */
#include <ladclient.h>
/* User side headers */
#include <ladclient.h>
.gate = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP,
#endif
.transportFactory = NULL,
.gate = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP,
#endif
.transportFactory = NULL,
- .config.procSync = Ipc_ProcSync_NONE
+ .config.procSync = Ipc_ProcSync_NONE,
+ .config.idHeapStd = 0
};
GateHWSpinlock_Config _GateHWSpinlock_cfgParams;
};
GateHWSpinlock_Config _GateHWSpinlock_cfgParams;
UInt16 baseId;
UInt16 clusterId;
Int i;
UInt16 baseId;
UInt16 clusterId;
Int i;
+ HeapStd_Handle heap;
+ IHeap_Handle iheap;
/* function must be serialized */
pthread_mutex_lock(&Ipc_module.gate);
/* function must be serialized */
pthread_mutex_lock(&Ipc_module.gate);
MessageQ_getConfig(&msgqCfg);
MessageQ_setup(&msgqCfg);
MessageQ_getConfig(&msgqCfg);
MessageQ_setup(&msgqCfg);
+ /* register the standard heap */
+ heap = HeapStd_handle();
+ iheap = HeapStd_upCast(heap);
+ MessageQ_registerHeap((Ptr)iheap, Ipc_module.config.idHeapStd);
+
/* invoke the transport factory create method */
status = Ipc_module.transportFactory->createFxn();
/* invoke the transport factory create method */
status = Ipc_module.transportFactory->createFxn();
Ipc_module.transportFactory->deleteFxn();
Ipc_module.transportFactory->deleteFxn();
+ /* unregister the standard heap */
+ MessageQ_unregisterHeap(Ipc_module.config.idHeapStd);
+
status = MessageQ_destroy();
if (status < 0) {
fprintf(stderr, "Ipc_stop: MessageQ_destroy() failed: %d\n", status);
status = MessageQ_destroy();
if (status < 0) {
fprintf(stderr, "Ipc_stop: MessageQ_destroy() failed: %d\n", status);
index cd94065337c13228d9505eb9ecefea485a9be071..a8e70b4bc8a17da31aead761e223552b20b89bf6 100644 (file)
MessageQ.c \
MultiProc.c \
NameServer.c \
MessageQ.c \
MultiProc.c \
NameServer.c \
- Ipc.c
+ Ipc.c \
+ $(top_srcdir)/linux/include/ti/ipc/heaps/HeapStd.h \
+ $(top_srcdir)/linux/src/heaps/HeapStd.c
if DRA7XX
libtiipc_la_SOURCES += $(top_srcdir)/linux/include/IGateProvider.h \
if DRA7XX
libtiipc_la_SOURCES += $(top_srcdir)/linux/include/IGateProvider.h \
index 8cad46f063ea16b05c6f6149be680d0ca2545708..f82728dcb02ead73a15287ecf2c85b17fe748921 100644 (file)
--- a/linux/src/api/MessageQ.c
+++ b/linux/src/api/MessageQ.c
#define MessageQ_internal 1 /* must be defined before include file */
#include <ti/ipc/MessageQ.h>
#include <_MessageQ.h>
#define MessageQ_internal 1 /* must be defined before include file */
#include <ti/ipc/MessageQ.h>
#include <_MessageQ.h>
+#include <ti/ipc/interfaces/IHeap.h>
#include <ti/ipc/interfaces/ITransport.h>
#include <ti/ipc/interfaces/IMessageQTransport.h>
#include <ti/ipc/interfaces/INetworkTransport.h>
#include <ti/ipc/interfaces/ITransport.h>
#include <ti/ipc/interfaces/IMessageQTransport.h>
#include <ti/ipc/interfaces/INetworkTransport.h>
IMessageQTransport_Handle transports[MultiProc_MAXPROCESSORS][2];
ITransport_Handle transInst[MessageQ_MAXTRANSPORTS];
MessageQ_PutHookFxn putHookFxn;
IMessageQTransport_Handle transports[MultiProc_MAXPROCESSORS][2];
ITransport_Handle transInst[MessageQ_MAXTRANSPORTS];
MessageQ_PutHookFxn putHookFxn;
+ Ptr *heaps;
+ Int numHeaps;
} MessageQ_ModuleObject;
typedef struct MessageQ_CIRCLEQ_ENTRY {
} MessageQ_ModuleObject;
typedef struct MessageQ_CIRCLEQ_ENTRY {
.gate = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP,
#endif
.seqNumGate = PTHREAD_MUTEX_INITIALIZER,
.gate = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP,
#endif
.seqNumGate = PTHREAD_MUTEX_INITIALIZER,
- .putHookFxn = NULL
+ .putHookFxn = NULL,
+ .heaps = NULL,
+ .numHeaps = 0
};
/*!
};
/*!
MessageQ_module->numQueues = cfg->maxRuntimeEntries;
MessageQ_module->queues = calloc(cfg->maxRuntimeEntries,
sizeof(MessageQ_Handle));
MessageQ_module->numQueues = cfg->maxRuntimeEntries;
MessageQ_module->queues = calloc(cfg->maxRuntimeEntries,
sizeof(MessageQ_Handle));
+ MessageQ_module->numHeaps = cfg->numHeaps;
+ MessageQ_module->heaps = calloc(cfg->numHeaps, sizeof(Ptr));
for (i = 0; i < MultiProc_MAXPROCESSORS; i++) {
for (pri = 0; pri < 2; pri++) {
for (i = 0; i < MultiProc_MAXPROCESSORS; i++) {
for (pri = 0; pri < 2; pri++) {
LAD_ClientHandle handle;
struct LAD_CommandObj cmd;
union LAD_ResponseObj rsp;
LAD_ClientHandle handle;
struct LAD_CommandObj cmd;
union LAD_ResponseObj rsp;
+ int i;
/* this entire function must be serialized */
pthread_mutex_lock(&MessageQ_module->gate);
/* this entire function must be serialized */
pthread_mutex_lock(&MessageQ_module->gate);
goto exit;
}
goto exit;
}
+ /* ensure all registered heaps have been unregistered */
+ for (i = 0; i < MessageQ_module->numHeaps; i++) {
+ if (MessageQ_module->heaps[i] != NULL) {
+ PRINTVERBOSE1("MessageQ_destroy: Warning: found heapId=%d", i);
+ }
+ }
+ free(MessageQ_module->heaps);
+ MessageQ_module->heaps = NULL;
+
handle = LAD_findHandle();
if (handle == LAD_MAXNUMCLIENTS) {
PRINTVERBOSE1("MessageQ_destroy: can't find connection to daemon "
handle = LAD_findHandle();
if (handle == LAD_MAXNUMCLIENTS) {
PRINTVERBOSE1("MessageQ_destroy: can't find connection to daemon "
*/
MessageQ_Msg MessageQ_alloc(UInt16 heapId, UInt32 size)
{
*/
MessageQ_Msg MessageQ_alloc(UInt16 heapId, UInt32 size)
{
+ IHeap_Handle heap;
MessageQ_Msg msg;
MessageQ_Msg msg;
- /*
- * heapId not used for local alloc (as this is over a copy transport), but
- * we need to send to other side as heapId is used in BIOS transport.
- */
- msg = (MessageQ_Msg)calloc(1, size);
+ if (heapId > (MessageQ_module->numHeaps - 1)) {
+ PRINTVERBOSE1("MessageQ_alloc: Error: heapId (%d) too large", heapId);
+ return (NULL);
+ }
+ else if (MessageQ_module->heaps[heapId] == NULL) {
+ PRINTVERBOSE1("MessageQ_alloc: Error: heapId (%d) not registered",
+ heapId);
+ return (NULL);
+ }
+ else {
+ heap = (IHeap_Handle)MessageQ_module->heaps[heapId];
+ }
+
+ msg = IHeap_alloc(heap, size);
+
+ if (msg == NULL) {
+ return (NULL);
+ }
+
MessageQ_msgInit(msg);
msg->msgSize = size;
msg->heapId = heapId;
MessageQ_msgInit(msg);
msg->msgSize = size;
msg->heapId = heapId;
- return msg;
+ return (msg);
}
/*
}
/*
Int MessageQ_free(MessageQ_Msg msg)
{
UInt32 status = MessageQ_S_SUCCESS;
Int MessageQ_free(MessageQ_Msg msg)
{
UInt32 status = MessageQ_S_SUCCESS;
+ IHeap_Handle heap;
- /* Check to ensure this was not allocated by user: */
+ /* ensure this was not allocated by user */
if (msg->heapId == MessageQ_STATICMSG) {
status = MessageQ_E_CANNOTFREESTATICMSG;
}
if (msg->heapId == MessageQ_STATICMSG) {
status = MessageQ_E_CANNOTFREESTATICMSG;
}
+ else if (msg->heapId > (MessageQ_module->numHeaps - 1)) {
+ status = MessageQ_E_INVALIDARG;
+ }
+ else if (MessageQ_module->heaps[msg->heapId] == NULL) {
+ status = MessageQ_E_NOTFOUND;
+ }
else {
else {
- free(msg);
+ heap = (IHeap_Handle)MessageQ_module->heaps[msg->heapId];
}
}
- return status;
+ IHeap_free(heap, (void *)msg);
+
+ return (status);
}
}
-/* Register a heap with MessageQ. */
+/*
+ * ======== MessageQ_registerHeap ========
+ */
Int MessageQ_registerHeap(Ptr heap, UInt16 heapId)
{
Int status = MessageQ_S_SUCCESS;
Int MessageQ_registerHeap(Ptr heap, UInt16 heapId)
{
Int status = MessageQ_S_SUCCESS;
- /* Do nothing, as this uses a copy transport */
+ pthread_mutex_lock(&MessageQ_module->gate);
+
+ if (heapId > (MessageQ_module->numHeaps - 1)) {
+ status = MessageQ_E_INVALIDARG;
+ }
+ else if (MessageQ_module->heaps[heapId] != NULL) {
+ status = MessageQ_E_ALREADYEXISTS;
+ }
+ else {
+ MessageQ_module->heaps[heapId] = heap;
+ }
- return status;
+ pthread_mutex_unlock(&MessageQ_module->gate);
+
+ return (status);
}
}
-/* Unregister a heap with MessageQ. */
+/*
+ * ======== MessageQ_unregisterHeap ========
+ */
Int MessageQ_unregisterHeap(UInt16 heapId)
{
Int status = MessageQ_S_SUCCESS;
Int MessageQ_unregisterHeap(UInt16 heapId)
{
Int status = MessageQ_S_SUCCESS;
- /* Do nothing, as this uses a copy transport */
+ pthread_mutex_lock(&MessageQ_module->gate);
- return status;
+ if (heapId > (MessageQ_module->numHeaps - 1)) {
+ status = MessageQ_E_INVALIDARG;
+ }
+ else if (MessageQ_module->heaps[heapId] == NULL) {
+ status = MessageQ_E_NOTFOUND;
+ }
+ else {
+ MessageQ_module->heaps[heapId] = NULL;
+ }
+
+ pthread_mutex_unlock(&MessageQ_module->gate);
+
+ return (status);
}
/* Unblocks a MessageQ */
}
/* Unblocks a MessageQ */
index 1668284f09665dc45b8a440123867165ca25e7c3..d768df235996fc875db1527dde82c08b946682fe 100644 (file)
* The Ipc module configuration object
*/
Ipc_Config ti_ipc_Ipc_config = {
* The Ipc module configuration object
*/
Ipc_Config ti_ipc_Ipc_config = {
- .procSync = Ipc_ProcSync_ALL
+ .procSync = Ipc_ProcSync_ALL,
+ .idHeapStd = 0
};
};
index ff047a0de074cf8e28fc64b2aa08be951a856164..f220624b1dc0cc9bf9833fa65ebc80ecadcf22a6 100644 (file)
* The MessageQ module configuration object
*/
MessageQ_Config ti_ipc_MessageQ_cfg = {
* The MessageQ module configuration object
*/
MessageQ_Config ti_ipc_MessageQ_cfg = {
- .traceFlag = FALSE,
+ .traceFlag = FALSE,
+ .numHeaps = 8, /* must match slave side config */
.maxRuntimeEntries = 32,
.maxRuntimeEntries = 32,
- .maxNameLen = 32,
+ .maxNameLen = 32, /* must match slave side config */
.numReservedEntries = 0
};
.numReservedEntries = 0
};
diff --git a/linux/src/heaps/HeapStd.c b/linux/src/heaps/HeapStd.c
--- /dev/null
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 2015 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.
+ */
+
+/*
+ * ======== HeapStd.c ========
+ */
+
+#include <stdlib.h> /* malloc */
+
+#include <ti/ipc/heaps/HeapStd.h>
+#include <ti/ipc/interfaces/IHeap.h>
+
+
+/*
+ * ======== HeapStd_Module ========
+ */
+typedef struct {
+ IHeap_Object base; /* inheritance */
+} HeapStd_Module;
+
+/*
+ * ======== instance function declarations ========
+ */
+void *HeapStd_alloc(void *handle, size_t size);
+void HeapStd_free(void *handle, void *block);
+
+/*
+ * ======== HeapStd_Fxns ========
+ * The instance function table
+ */
+IHeap_Fxns HeapStd_Fxns = {
+ HeapStd_alloc,
+ HeapStd_free
+};
+
+/*
+ * ======== HeapStd_module ========
+ * The module state object
+ */
+static HeapStd_Module HeapStd_module = {
+ .base.fxns = &HeapStd_Fxns
+};
+
+/*
+ * ======== HeapStd_handle ========
+ */
+HeapStd_Handle HeapStd_handle(void)
+{
+ HeapStd_Handle handle;
+
+ handle = (HeapStd_Handle)&HeapStd_module;
+ return (handle);
+}
+
+/*
+ * ======== HeapStd_upCast ========
+ */
+IHeap_Handle HeapStd_upCast(HeapStd_Handle inst)
+{
+ return ((IHeap_Handle)inst);
+}
+
+/*
+ * ======== HeapStd_downCast ========
+ */
+HeapStd_Handle HeapStd_downCast(IHeap_Handle base)
+{
+ return ((HeapStd_Handle)base);
+}
+
+/*
+ * ======== HeapStd_alloc ========
+ */
+void *HeapStd_alloc(void *handle, size_t size)
+{
+ void *block;
+
+ block = malloc(size);
+ return (block);
+}
+
+/*
+ * ======== HeapStd_free ========
+ */
+void HeapStd_free(void *handle, void *block)
+{
+ free(block);
+}
index 133cb1f56f8915275fcf0cc5f86316a87f04f679..31428d4bfe63fe4cfb98a343b95b2126df4df9d3 100644 (file)
* See documentation for details on the various fields.
*/
MessageQ_Config ti_ipc_MessageQ_cfg = {
* See documentation for details on the various fields.
*/
MessageQ_Config ti_ipc_MessageQ_cfg = {
- .traceFlag = FALSE,
+ .traceFlag = FALSE,
+ .numHeaps = 8,
.maxRuntimeEntries = 32,
.maxNameLen = 32,
.numReservedEntries = 0
.maxRuntimeEntries = 32,
.maxNameLen = 32,
.numReservedEntries = 0