Other Parts Discussed in Thread: SYSBIOS
I am working on some code for 3 external CAN device from Microchip. I use Linux for the internal 2 CAN.
The reason for using M4 is that I do not have hardware interrupt connected and was doing polling in my kernel module.
It works fine on Linux until I need to receive many messages.
First I need to test buffer access between the processors. I use an example program ex02_messageq as modified by another TI customer
I modified his code to remove the part about dsp2 since there is not such thing on the dra726
First the code changes (I omit the dsp2 and ipu2 removed directories in the patch) :
------------------------------------------------------------------------------------------------------------------------
diff -rNuw ex02_messageq/dsp1/Dsp1.cfg my_ex02_messageq/dsp1/Dsp1.cfg
--- ex02_messageq/dsp1/Dsp1.cfg 2020-11-18 11:00:52.993251224 -0500
+++ my_ex02_messageq/dsp1/Dsp1.cfg 2020-11-18 10:47:02.390406919 -0500
@@ -61,6 +61,10 @@
var BIOS = xdc.useModule('ti.sysbios.BIOS');
BIOS.addUserStartupFunction('&IpcMgr_ipcStartup');
+/* Override the default resource table to add CMEM */
+var Resource = xdc.useModule('ti.ipc.remoteproc.Resource');
+Resource.customTable = true;
+
/*
* ======== SYS/BIOS Configuration ========
*/
diff -rNuw ex02_messageq/dsp1/MainDsp1.c my_ex02_messageq/dsp1/MainDsp1.c
--- ex02_messageq/dsp1/MainDsp1.c 2020-11-18 11:00:52.993251224 -0500
+++ my_ex02_messageq/dsp1/MainDsp1.c 2020-11-18 10:47:02.390406919 -0500
@@ -47,6 +47,8 @@
#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/knl/Task.h>
+#include "rsc_table_dsp.h"
+
/* local header files */
#include "Server.h"
diff -rNuw ex02_messageq/dsp1/makefile my_ex02_messageq/dsp1/makefile
--- ex02_messageq/dsp1/makefile 2020-11-18 11:00:52.993251224 -0500
+++ my_ex02_messageq/dsp1/makefile 2020-11-18 10:47:02.390406919 -0500
@@ -51,7 +51,6 @@
all: debug release
-
debug:
$(MAKE) PROFILE=debug PROCLIST="$(PROCLIST)" server_dsp1.x
@@ -91,14 +90,6 @@
@$(MKDIR) $(EXEC_DIR)/release
$(CP) bin/release/server_dsp1.xe66 $(EXEC_DIR)/release
-install_rov:
- @$(ECHO) "#"
- @$(ECHO) "# Making $@ ..."
- @$(MKDIR) $(EXEC_DIR)/debug
- $(CP) bin/debug/configuro/package/cfg/Dsp1_pe66.rov.xs $(EXEC_DIR)/debug
- @$(MKDIR) $(EXEC_DIR)/release
- $(CP) bin/release/configuro/package/cfg/Dsp1_pe66.rov.xs $(EXEC_DIR)/release
-
help:
@$(ECHO) "make # build executable"
@$(ECHO) "make clean # clean everything"
diff -rNuw ex02_messageq/dsp1/rsc_table_dsp.h my_ex02_messageq/dsp1/rsc_table_dsp.h
--- ex02_messageq/dsp1/rsc_table_dsp.h 1969-12-31 19:00:00.000000000 -0500
+++ my_ex02_messageq/dsp1/rsc_table_dsp.h 2020-11-18 10:47:02.390406919 -0500
@@ -0,0 +1,330 @@
+/*
+ * Copyright (c) 2012-2014, 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.
+ */
+
+/*
+ * ======== rsc_table_dsp.h ========
+ *
+ * Define the resource table entries for all DSP cores. This will be
+ * incorporated into corresponding base images, and used by the remoteproc
+ * on the host-side to allocated/reserve resources.
+ *
+ */
+
+#ifndef _RSC_TABLE_DSP_H_
+#define _RSC_TABLE_DSP_H_
+
+#include <ti/ipc/remoteproc/rsc_types.h>
+
+/* DSP Memory Map */
+#define L4_DRA7XX_BASE 0x4A000000
+
+#define L4_PERIPHERAL_L4CFG (L4_DRA7XX_BASE)
+#define DSP_PERIPHERAL_L4CFG 0x4A000000
+
+#define L4_PERIPHERAL_L4PER1 0x48000000
+#define DSP_PERIPHERAL_L4PER1 0x48000000
+
+#define L4_PERIPHERAL_L4PER2 0x48400000
+#define DSP_PERIPHERAL_L4PER2 0x48400000
+
+#define L4_PERIPHERAL_L4PER3 0x48800000
+#define DSP_PERIPHERAL_L4PER3 0x48800000
+
+#define L4_PERIPHERAL_L4EMU 0x54000000
+#define DSP_PERIPHERAL_L4EMU 0x54000000
+
+#define L3_PERIPHERAL_DMM 0x4E000000
+#define DSP_PERIPHERAL_DMM 0x4E000000
+
+#define L3_TILER_MODE_0_1 0x60000000
+#define DSP_TILER_MODE_0_1 0x60000000
+
+#define L3_TILER_MODE_2 0x70000000
+#define DSP_TILER_MODE_2 0x70000000
+
+#define L3_TILER_MODE_3 0x78000000
+#define DSP_TILER_MODE_3 0x78000000
+
+#define DSP_MEM_TEXT 0x95000000
+/* Co-locate alongside TILER region for easier flushing */
+#define DSP_MEM_IOBUFS 0x80000000
+#define DSP_MEM_DATA 0x95100000
+#define DSP_MEM_HEAP 0x95200000
+
+#define DSP_MEM_IPC_DATA 0x9F000000
+#define DSP_MEM_IPC_VRING 0xB0000000
+#define DSP_MEM_RPMSG_VRING0 0xB0000000
+#define DSP_MEM_RPMSG_VRING1 0xB0004000
+#define DSP_MEM_VRING_BUFS0 0xB0040000
+#define DSP_MEM_VRING_BUFS1 0xB0080000
+
+#define DSP_MEM_IPC_VRING_SIZE SZ_1M
+#define DSP_MEM_IPC_DATA_SIZE SZ_1M
+#define DSP_MEM_TEXT_SIZE SZ_1M
+#define DSP_MEM_DATA_SIZE SZ_1M
+#define DSP_MEM_HEAP_SIZE (SZ_1M * 3)
+#define DSP_MEM_IOBUFS_SIZE (SZ_1M * 90)
+
+#define DSP_CMEM_IOBUFS 0x85000000
+#define PHYS_CMEM_IOBUFS 0xA0000000
+#define DSP_CMEM_IOBUFS_SIZE (SZ_1M * 192)
+
+#define VAYU_DSP_1
+/*
+ * Assign fixed RAM addresses to facilitate a fixed MMU table.
+ */
+/* See CMA BASE addresses in Linux side: arch/arm/mach-omap2/remoteproc.c */
+#if defined (VAYU_DSP_1)
+#define PHYS_MEM_IPC_VRING 0x99000000
+#elif defined (VAYU_DSP_2)
+#define PHYS_MEM_IPC_VRING 0x9F000000
+#endif
+
+/* Need to be identical to that of IPU */
+#define PHYS_MEM_IOBUFS 0xBA300000
+
+/*
+ * Sizes of the virtqueues (expressed in number of buffers supported,
+ * and must be power of 2)
+ */
+#define DSP_RPMSG_VQ0_SIZE 256
+#define DSP_RPMSG_VQ1_SIZE 256
+
+/* flip up bits whose indices represent features we support */
+#define RPMSG_DSP_C0_FEATURES 1
+
+struct my_resource_table {
+ struct resource_table base;
+
+ UInt32 offset[19]; /* Should match 'num' in actual definition */
+
+ /* rpmsg vdev entry */
+ struct fw_rsc_vdev rpmsg_vdev;
+ struct fw_rsc_vdev_vring rpmsg_vring0;
+ struct fw_rsc_vdev_vring rpmsg_vring1;
+
+ /* text carveout entry */
+ struct fw_rsc_carveout text_cout;
+
+ /* data carveout entry */
+ struct fw_rsc_carveout data_cout;
+
+ /* heap carveout entry */
+ struct fw_rsc_carveout heap_cout;
+
+ /* ipcdata carveout entry */
+ struct fw_rsc_carveout ipcdata_cout;
+
+ /* trace entry */
+ struct fw_rsc_trace trace;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem0;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem1;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem2;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem3;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem4;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem5;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem6;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem7;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem8;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem9;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem10;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem11;
+};
+
+extern char ti_trace_SysMin_Module_State_0_outbuf__A;
+#define TRACEBUFADDR (UInt32)&ti_trace_SysMin_Module_State_0_outbuf__A
+
+#pragma DATA_SECTION(ti_ipc_remoteproc_ResourceTable, ".resource_table")
+#pragma DATA_ALIGN(ti_ipc_remoteproc_ResourceTable, 4096)
+
+struct my_resource_table ti_ipc_remoteproc_ResourceTable = {
+ 1, /* we're the first version that implements this */
+ 18, /* number of entries in the table */
+ 0, 0, /* reserved, must be zero */
+ /* offsets to entries */
+ {
+ offsetof(struct my_resource_table, rpmsg_vdev),
+ offsetof(struct my_resource_table, text_cout),
+ offsetof(struct my_resource_table, data_cout),
+ offsetof(struct my_resource_table, heap_cout),
+ offsetof(struct my_resource_table, ipcdata_cout),
+ offsetof(struct my_resource_table, trace),
+ offsetof(struct my_resource_table, devmem0),
+ offsetof(struct my_resource_table, devmem1),
+ offsetof(struct my_resource_table, devmem2),
+ offsetof(struct my_resource_table, devmem3),
+ offsetof(struct my_resource_table, devmem4),
+ offsetof(struct my_resource_table, devmem5),
+ offsetof(struct my_resource_table, devmem6),
+ offsetof(struct my_resource_table, devmem7),
+ offsetof(struct my_resource_table, devmem8),
+ offsetof(struct my_resource_table, devmem9),
+ offsetof(struct my_resource_table, devmem10),
+ offsetof(struct my_resource_table, devmem11),
+ },
+
+ /* rpmsg vdev entry */
+ {
+ TYPE_VDEV, VIRTIO_ID_RPMSG, 0,
+ RPMSG_DSP_C0_FEATURES, 0, 0, 0, 2, { 0, 0 },
+ /* no config data */
+ },
+ /* the two vrings */
+ { DSP_MEM_RPMSG_VRING0, 4096, DSP_RPMSG_VQ0_SIZE, 1, 0 },
+ { DSP_MEM_RPMSG_VRING1, 4096, DSP_RPMSG_VQ1_SIZE, 2, 0 },
+
+ {
+ TYPE_CARVEOUT,
+ DSP_MEM_TEXT, 0,
+ DSP_MEM_TEXT_SIZE, 0, 0, "DSP_MEM_TEXT",
+ },
+
+ {
+ TYPE_CARVEOUT,
+ DSP_MEM_DATA, 0,
+ DSP_MEM_DATA_SIZE, 0, 0, "DSP_MEM_DATA",
+ },
+
+ {
+ TYPE_CARVEOUT,
+ DSP_MEM_HEAP, 0,
+ DSP_MEM_HEAP_SIZE, 0, 0, "DSP_MEM_HEAP",
+ },
+
+ {
+ TYPE_CARVEOUT,
+ DSP_MEM_IPC_DATA, 0,
+ DSP_MEM_IPC_DATA_SIZE, 0, 0, "DSP_MEM_IPC_DATA",
+ },
+
+ {
+ TYPE_TRACE, TRACEBUFADDR, 0x8000, 0, "trace:dsp",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_MEM_IPC_VRING, PHYS_MEM_IPC_VRING,
+ DSP_MEM_IPC_VRING_SIZE, 0, 0, "DSP_MEM_IPC_VRING",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_MEM_IOBUFS, PHYS_MEM_IOBUFS,
+ DSP_MEM_IOBUFS_SIZE, 0, 0, "DSP_MEM_IOBUFS",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_TILER_MODE_0_1, L3_TILER_MODE_0_1,
+ SZ_256M, 0, 0, "DSP_TILER_MODE_0_1",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_TILER_MODE_2, L3_TILER_MODE_2,
+ SZ_128M, 0, 0, "DSP_TILER_MODE_2",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_TILER_MODE_3, L3_TILER_MODE_3,
+ SZ_128M, 0, 0, "DSP_TILER_MODE_3",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_PERIPHERAL_L4CFG, L4_PERIPHERAL_L4CFG,
+ SZ_16M, 0, 0, "DSP_PERIPHERAL_L4CFG",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_PERIPHERAL_L4PER1, L4_PERIPHERAL_L4PER1,
+ SZ_2M, 0, 0, "DSP_PERIPHERAL_L4PER1",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_PERIPHERAL_L4PER2, L4_PERIPHERAL_L4PER2,
+ SZ_4M, 0, 0, "DSP_PERIPHERAL_L4PER2",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_PERIPHERAL_L4PER3, L4_PERIPHERAL_L4PER3,
+ SZ_8M, 0, 0, "DSP_PERIPHERAL_L4PER3",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_PERIPHERAL_L4EMU, L4_PERIPHERAL_L4EMU,
+ SZ_16M, 0, 0, "DSP_PERIPHERAL_L4EMU",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_PERIPHERAL_DMM, L3_PERIPHERAL_DMM,
+ SZ_1M, 0, 0, "DSP_PERIPHERAL_DMM",
+ },
+
+ {
+ TYPE_DEVMEM,
+ DSP_CMEM_IOBUFS, PHYS_CMEM_IOBUFS,
+ DSP_CMEM_IOBUFS_SIZE, 0, 0, "DSP_CMEM_IOBUFS",
+ },
+};
+
+#endif /* _RSC_TABLE_VAYU_DSP_H_ */
diff -rNuw ex02_messageq/dsp1/Server.c my_ex02_messageq/dsp1/Server.c
--- ex02_messageq/dsp1/Server.c 2020-11-18 11:00:52.993251224 -0500
+++ my_ex02_messageq/dsp1/Server.c 2020-11-18 10:47:02.390406919 -0500
@@ -54,6 +54,7 @@
#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/knl/Task.h>
+#include <ti/ipc/remoteproc/Resource.h>
/* local header files */
#include "../shared/AppCommon.h"
@@ -129,6 +130,11 @@
Bool running = TRUE;
App_Msg * msg;
MessageQ_QueueId queId;
+ Int i, j;
+ uint8_t * data_ptr;
+ UInt32 virtualAddrIn[1];
+ UInt32 virtualAddrOut;
+ uint32_t dataXor;
Log_print0(Diags_ENTRY | Diags_INFO, "--> Server_exec:");
@@ -142,6 +148,28 @@
goto leave;
}
+ for (i = 0; i < 1; i++) {
+ if(Resource_physToVirt(msg->dataInPhys[i], &virtualAddrIn[i]) != Resource_S_SUCCESS) {
+ Log_print1(Diags_INFO, "Server_exec: not found resource for phys 0x%x\n",
+ msg->dataInPhys[i]);
+ continue;
+ }
+ Log_print4(Diags_INFO, "Server_exec: addrPhys[%d] = 0x%x addrIn[%d]=0x%x",
+ i, msg->dataInPhys[i], i, virtualAddrIn[i]);
+
+ data_ptr = (uint8_t*)virtualAddrIn[i];
+
+ dataXor = 0;
+
+ for (j = 0; j < msg->dataByteSize; j++) {
+ dataXor ^= data_ptr[j];
+ }
+
+ Log_print2(Diags_INFO, "Server_exec: xorIn[%d]=0x%x", i, dataXor);
+ }
+
+ msg->outXor = dataXor;
+
if (msg->cmd == App_CMD_SHUTDOWN) {
running = FALSE;
}
@@ -152,6 +180,7 @@
/* send message back */
queId = MessageQ_getReplyQueue(msg); /* type-cast not needed */
MessageQ_put(queId, (MessageQ_Msg)msg);
+
} /* while (running) */
leave:
diff -rNuw ex02_messageq/host/App.c my_ex02_messageq/host/App.c
--- ex02_messageq/host/App.c 2020-11-18 11:00:52.993251224 -0500
+++ my_ex02_messageq/host/App.c 2020-11-18 10:47:02.506408592 -0500
@@ -43,6 +43,9 @@
#include <ti/ipc/Std.h>
#include <ti/ipc/MessageQ.h>
+/* cmem header file */
+#include <ti/cmem.h>
+
/* local header files */
#include "../shared/AppCommon.h"
#include "App.h"
@@ -59,6 +62,8 @@
static App_Module Module;
+#define PAYLOADSIZE (0x100000 * 16) // 16MB
+
/*
* ======== App_create ========
*/
@@ -71,6 +76,16 @@
printf("--> App_create:\n");
+ status = CMEM_init();
+
+ if (status < 0) {
+ printf("CMEM_init failed\n");
+ goto leave;
+ }
+ else {
+ printf("CMEM_init success\n");
+ }
+
/* setting default values */
Module.hostQue = NULL;
Module.slaveQue = MessageQ_INVALIDMESSAGEQ;
@@ -143,15 +158,16 @@
*/
Int App_exec(Void)
{
- Int status;
- Int i;
+ Int status = 0;
+ Int i, j;
App_Msg * msg;
+ CMEM_AllocParams cmemAttrs;
- printf("--> App_exec:\n");
+ cmemAttrs.type = CMEM_HEAP;
+ cmemAttrs.flags = CMEM_NONCACHED;
+ cmemAttrs.alignment = 0;
- /* fill process pipeline */
- for (i = 1; i <= 3; i++) {
- printf("App_exec: sending message %d\n", i);
+ printf("--> App_exec:\n");
/* allocate message */
msg = (App_Msg *)MessageQ_alloc(Module.heapId, Module.msgSize);
@@ -161,61 +177,36 @@
goto leave;
}
- /* set the return address in the message header */
- MessageQ_setReplyQueue(Module.hostQue, (MessageQ_Msg)msg);
-
- /* fill in message payload */
- msg->cmd = App_CMD_NOP;
-
- /* send message */
- MessageQ_put(Module.slaveQue, (MessageQ_Msg)msg);
- }
-
- /* process steady state (keep pipeline full) */
- for (i = 4; i <= 15; i++) {
+ msg->dataByteSize = PAYLOADSIZE;
- /* wait for return message */
- status = MessageQ_get(Module.hostQue, (MessageQ_Msg *)&msg,
- MessageQ_FOREVER);
-
- if (status < 0) {
+ for (i = 0; i < 1; i++) {
+ msg->dataIn[i] = CMEM_allocPool(CMEM_getPool(PAYLOADSIZE), &cmemAttrs);
+ if (msg->dataIn[i] == NULL) {
+ printf("CMEM_alloc() failed (returned NULL)\n");
+ status = -1;
goto leave;
}
+ msg->dataInPhys[i] = CMEM_getPhys(msg->dataIn[i]);
- /* extract message payload */
-
- /* free the message */
- MessageQ_free((MessageQ_Msg)msg);
+ printf("user: %p phys: 0x%x\n", msg->dataIn[i], msg->dataInPhys[i]);
- printf("App_exec: message received, sending message %d\n", i);
+ uint8_t *dataIn = (uint8_t*)msg->dataIn[i];
- /* allocate message */
- msg = (App_Msg *)MessageQ_alloc(Module.heapId, Module.msgSize);
+ msg->inXor[i] = 0;
- if (msg == NULL) {
- status = -1;
- goto leave;
+ for (j = 0; j < PAYLOADSIZE; j++) {
+ dataIn[j] = rand();
+ msg->inXor[i] ^= dataIn[j];
+ }
}
/* set the return address in the message header */
MessageQ_setReplyQueue(Module.hostQue, (MessageQ_Msg)msg);
/* fill in message payload */
- if (i == 15) {
- /* Last message will tell the slave to shutdown */
msg->cmd = App_CMD_SHUTDOWN;
- }
- else {
- msg->cmd = App_CMD_NOP;
- }
- /* send message */
MessageQ_put(Module.slaveQue, (MessageQ_Msg)msg);
- }
-
- /* drain process pipeline */
- for (i = 1; i <= 3; i++) {
- printf("App_exec: message received\n");
/* wait for return message */
status = MessageQ_get(Module.hostQue, (MessageQ_Msg *)&msg,
@@ -225,11 +216,11 @@
goto leave;
}
- /* extract message payload */
+ printf("The size of data is %d MB\n", PAYLOADSIZE / 1024 / 1024);
+ printf("slave data xor result 0x%x, host(arm) 0x%x\n", msg->outXor, msg->inXor[0]);
- /* free the message */
+ CMEM_free(msg->dataIn[0], &cmemAttrs);
MessageQ_free((MessageQ_Msg)msg);
- }
leave:
printf("<-- App_exec: %d\n", status);
diff -rNuw ex02_messageq/host/configure.ac my_ex02_messageq/host/configure.ac
--- ex02_messageq/host/configure.ac 1969-12-31 19:00:00.000000000 -0500
+++ my_ex02_messageq/host/configure.ac 2020-11-18 10:47:02.506408592 -0500
@@ -0,0 +1,37 @@
+# -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+AC_PREREQ([2.69])
+AC_INIT([app_host],[1.0])
+AC_CONFIG_SRCDIR([App.c])
+AM_INIT_AUTOMAKE([subdir-objects])
+AC_CONFIG_HEADERS([config.h])
+AC_CONFIG_MACRO_DIR([m4])
+AC_PREFIX_DEFAULT(/usr)
+
+# Checks for programs.
+AC_PROG_CXX
+AC_PROG_AWK
+AC_PROG_CC
+AC_PROG_CPP
+AC_PROG_INSTALL
+AC_PROG_LN_S
+AC_PROG_MAKE_SET
+
+LT_INIT
+
+# Checks for libraries.
+
+# Checks for header files.
+AC_CHECK_HEADERS([stdlib.h string.h sys/time.h])
+
+# Checks for typedefs, structures, and compiler characteristics.
+AC_TYPE_SIZE_T
+
+# Checks for library functions.
+AC_FUNC_MALLOC
+AC_CHECK_FUNCS([clock_gettime gettimeofday memmove memset])
+
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+
diff -rNuw ex02_messageq/host/makefile my_ex02_messageq/host/makefile
--- ex02_messageq/host/makefile 2020-11-18 11:00:52.993251224 -0500
+++ my_ex02_messageq/host/makefile 1969-12-31 19:00:00.000000000 -0500
@@ -1,163 +0,0 @@
-#
-# Copyright (c) 2013-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.
-#
-
-#
-# ======== Makefile ========
-#
-
-srcs = main_host.c App.c
-
-EXBASE = ..
-include $(EXBASE)/products.mak
--include $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.ov7A.dep,$(srcs)))
-
-objs = $(addprefix bin/$(PROFILE)/obj/,$(patsubst %.c,%.ov7A,$(srcs)))
-
-ifdef LIBS_STATIC
-libs = libtitransportrpmsg.a \
- libtiipc.a \
- libtiipcutils.a
-else
-# Use dynamic or shared libs
-#libs = $(IPC_INSTALL_DIR)/linux/src/api/.libs/libtiipc.so \
-# $(IPC_INSTALL_DIR)/linux/src/utils/.libs/libtiipcutils.so \
-# $(IPC_INSTALL_DIR)/linux/src/transport/.libs/libtitransportrpmsg.so
-libs =
-endif
-
-all:
- @$(ECHO) "#"
- @$(ECHO) "# Making $@ ..."
- $(MAKE) PROFILE=debug app_host
- $(MAKE) PROFILE=release app_host
-
-help:
- @$(ECHO) "make # build executables"
- @$(ECHO) "make clean # clean everything"
-
-install:
- @$(ECHO) "#"
- @$(ECHO) "# Making $@ ..."
- @$(MKDIR) $(EXEC_DIR)/debug
- $(CP) bin/debug/app_host $(EXEC_DIR)/debug
- @$(MKDIR) $(EXEC_DIR)/release
- $(CP) bin/release/app_host $(EXEC_DIR)/release
-
-clean::
- $(RMDIR) bin
-
-
-#
-# ======== rules ========
-#
-app_host: bin/$(PROFILE)/app_host
-bin/$(PROFILE)/app_host: $(objs) $(libs)
- @$(ECHO) "#"
- @$(ECHO) "# Making $@ ..."
- $(LD) $(LDFLAGS) -o $@ $^ $(LDLIBS)
-
-bin/$(PROFILE)/obj/%.ov7A: %.c
- @$(ECHO) "#"
- @$(ECHO) "# Making $@ ..."
- $(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $<
-
-# ======== install validation ========
-ifeq (install,$(MAKECMDGOALS))
-ifeq (,$(EXEC_DIR))
-$(error must specify EXEC_DIR)
-endif
-endif
-
-# ======== toolchain macros ========
-ifndef LINUX_SYSROOT_DIR
-CC = $(TOOLCHAIN_PREFIX)gcc
-AR = $(TOOLCHAIN_PREFIX)ar
-LD = $(TOOLCHAIN_PREFIX)gcc
-CFLAGS =
-CPPFLAGS =
-LDFLAGS = -L$(IPC_INSTALL_DIR)/linux/src/api/.libs/ \
- -L$(IPC_INSTALL_DIR)/linux/src/utils/.libs \
- -L$(IPC_INSTALL_DIR)/linux/src/transport/.libs
-else
-LD = $(CC)
-endif
-
-CFLAGS += -c -MD -MF $@.dep
-ARFLAGS = cr
-
-CPPFLAGS += -D_REENTRANT
-
-CFLAGS += -Wall -ffloat-store -fPIC -Wunused -pthread -Dfar= $(CCPROFILE_$(PROFILE)) \
- -I. -I..
-ifdef LINUX_SYSROOT_DIR
-CFLAGS += -I$(LINUX_SYSROOT_DIR)
-else
-CFLAGS += -I$(IPC_INSTALL_DIR)/linux/include -I$(IPC_INSTALL_DIR)/packages
-endif
-
-LDFLAGS += $(LDPROFILE_$(PROFILE)) -Wall -Wl,-Map=$@.map
-
-LDLIBS = -lpthread -lc -lrt
-ifndef LIBS_STATIC
-LDLIBS +=-ltiipc -ltiipcutils -ltitransportrpmsg
-endif
-CCPROFILE_debug = -ggdb -D DEBUG
-CCPROFILE_release = -O3 -D NDEBUG
-
-LDPROFILE_debug = -ggdb
-LDPROFILE_release = -O3
-
-# ======== standard macros ========
-ifneq (,$(wildcard $(XDC_INSTALL_DIR)/bin/echo.exe))
- # use these on Windows
- CP = $(XDC_INSTALL_DIR)/bin/cp
- ECHO = $(XDC_INSTALL_DIR)/bin/echo
- MKDIR = $(XDC_INSTALL_DIR)/bin/mkdir -p
- RM = $(XDC_INSTALL_DIR)/bin/rm -f
- RMDIR = $(XDC_INSTALL_DIR)/bin/rm -rf
-else
- # use these on Linux
- CP = cp
- ECHO = echo
- MKDIR = mkdir -p
- RM = rm -f
- RMDIR = rm -rf
-endif
-
-# ======== create output directories ========
-ifneq (clean,$(MAKECMDGOALS))
-ifneq (,$(PROFILE))
-ifeq (,$(wildcard bin/$(PROFILE)/obj))
- $(shell $(MKDIR) -p bin/$(PROFILE)/obj)
-endif
-endif
-endif
diff -rNuw ex02_messageq/host/Makefile.am my_ex02_messageq/host/Makefile.am
--- ex02_messageq/host/Makefile.am 1969-12-31 19:00:00.000000000 -0500
+++ my_ex02_messageq/host/Makefile.am 2020-11-18 10:47:02.506408592 -0500
@@ -0,0 +1,8 @@
+AUTOMAKE_OPTIONS = foreign
+ACLOCAL_AMFLAGS = -I m4
+
+bin_PROGRAMS = app_host
+app_host_SOURCES = App.c main_host.c
+
+AM_LDFLAGS = -lrt -ltiipc -ltiipcutils -ltitransportrpmsg -lticmem
+
diff -rNuw ex02_messageq/ipu1/Ipu1.cfg my_ex02_messageq/ipu1/Ipu1.cfg
--- ex02_messageq/ipu1/Ipu1.cfg 2020-11-18 11:00:52.993251224 -0500
+++ my_ex02_messageq/ipu1/Ipu1.cfg 2020-11-18 10:47:02.654410729 -0500
@@ -65,6 +65,10 @@
var BIOS = xdc.useModule('ti.sysbios.BIOS');
BIOS.addUserStartupFunction('&IpcMgr_ipcStartup');
+/* Override the default resource table to add CMEM */
+var Resource = xdc.useModule('ti.ipc.remoteproc.Resource');
+Resource.customTable = true;
+
/*
* ======== SYS/BIOS Configuration ========
*/
diff -rNuw ex02_messageq/ipu1/MainIpu1.c my_ex02_messageq/ipu1/MainIpu1.c
--- ex02_messageq/ipu1/MainIpu1.c 2020-11-18 11:00:52.993251224 -0500
+++ my_ex02_messageq/ipu1/MainIpu1.c 2020-11-18 10:47:02.654410729 -0500
@@ -47,6 +47,8 @@
#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/knl/Task.h>
+#include "rsc_table_ipu.h"
+
/* local header files */
#include "Server.h"
diff -rNuw ex02_messageq/ipu1/makefile my_ex02_messageq/ipu1/makefile
--- ex02_messageq/ipu1/makefile 2020-11-18 11:00:52.993251224 -0500
+++ my_ex02_messageq/ipu1/makefile 2020-11-18 10:47:02.654410729 -0500
@@ -53,13 +53,13 @@
debug:
- $(MAKE) PROFILE=debug PROCLIST="$(PROCLIST)" server_ipu1.x
+ $(MAKE) PROFILE=debug PROCLIST="$(PROCLIST)" dra7-ipu1-fw.x
release:
- $(MAKE) PROFILE=release PROCLIST="$(PROCLIST)" server_ipu1.x
+ $(MAKE) PROFILE=release PROCLIST="$(PROCLIST)" dra7-ipu1-fw.x
-server_ipu1.x: bin/$(PROFILE)/server_ipu1.xem4
-bin/$(PROFILE)/server_ipu1.xem4: $(objs) $(libs) $(CONFIG)/linker.cmd
+dra7-ipu1-fw.x: bin/$(PROFILE)/dra7-ipu1-fw.xem4
+bin/$(PROFILE)/dra7-ipu1-fw.xem4: $(objs) $(libs) $(CONFIG)/linker.cmd
@$(ECHO) "#"
@$(ECHO) "# Making $@ ..."
$(LD) $(LDFLAGS) -o $@ $(objs) \
@@ -88,17 +88,10 @@
@$(ECHO) "#"
@$(ECHO) "# Making $@ ..."
@$(MKDIR) $(EXEC_DIR)/debug
- $(CP) bin/debug/server_ipu1.xem4 $(EXEC_DIR)/debug
+ $(CP) bin/debug/dra7-ipu1-fw.xem4 $(EXEC_DIR)/debug
@$(MKDIR) $(EXEC_DIR)/release
- $(CP) bin/release/server_ipu1.xem4 $(EXEC_DIR)/release
+ $(CP) bin/release/dra7-ipu1-fw.xem4 $(EXEC_DIR)/release
-install_rov:
- @$(ECHO) "#"
- @$(ECHO) "# Making $@ ..."
- @$(MKDIR) $(EXEC_DIR)/debug
- $(CP) bin/debug/configuro/package/cfg/Ipu1_pem4.rov.xs $(EXEC_DIR)/debug
- @$(MKDIR) $(EXEC_DIR)/release
- $(CP) bin/release/configuro/package/cfg/Ipu1_pem4.rov.xs $(EXEC_DIR)/release
help:
@$(ECHO) "make # build executable"
diff -rNuw ex02_messageq/ipu1/rsc_table_ipu.h my_ex02_messageq/ipu1/rsc_table_ipu.h
--- ex02_messageq/ipu1/rsc_table_ipu.h 1969-12-31 19:00:00.000000000 -0500
+++ my_ex02_messageq/ipu1/rsc_table_ipu.h 2020-11-18 10:47:02.654410729 -0500
@@ -0,0 +1,357 @@
+/*
+ * Copyright (c) 2012-2014, 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.
+ */
+
+/*
+ * ======== rsc_table_ipu.h ========
+ *
+ * Define the resource table entries for all IPU cores. This will be
+ * incorporated into corresponding base images, and used by the remoteproc
+ * on the host-side to allocated/reserve resources.
+ *
+ */
+
+#ifndef _RSC_TABLE_IPU_H_
+#define _RSC_TABLE_IPU_H_
+
+#include <ti/ipc/remoteproc/rsc_types.h>
+
+/* IPU Memory Map */
+#define L4_DRA7XX_BASE 0x4A000000
+
+/* L4_CFG & L4_WKUP */
+#define L4_PERIPHERAL_L4CFG (L4_DRA7XX_BASE)
+#define IPU_PERIPHERAL_L4CFG 0x6A000000
+
+#define L4_PERIPHERAL_L4PER1 0x48000000
+#define IPU_PERIPHERAL_L4PER1 0x68000000
+
+#define L4_PERIPHERAL_L4PER2 0x48400000
+#define IPU_PERIPHERAL_L4PER2 0x68400000
+
+#define L4_PERIPHERAL_L4PER3 0x48800000
+#define IPU_PERIPHERAL_L4PER3 0x68800000
+
+#define L4_PERIPHERAL_L4EMU 0x54000000
+#define IPU_PERIPHERAL_L4EMU 0x74000000
+
+#define L3_PERIPHERAL_DMM 0x4E000000
+#define IPU_PERIPHERAL_DMM 0x6E000000
+
+#define L3_IVAHD_CONFIG 0x5A000000
+#define IPU_IVAHD_CONFIG 0x7A000000
+
+#define L3_IVAHD_SL2 0x5B000000
+#define IPU_IVAHD_SL2 0x7B000000
+
+#define L3_TILER_MODE_0_1 0x60000000
+#define IPU_TILER_MODE_0_1 0xA0000000
+
+#define L3_TILER_MODE_2 0x70000000
+#define IPU_TILER_MODE_2 0xB0000000
+
+#define L3_TILER_MODE_3 0x78000000
+#define IPU_TILER_MODE_3 0xB8000000
+
+#define IPU_MEM_TEXT 0x0
+#define IPU_MEM_DATA 0x80000000
+
+#define IPU_MEM_IOBUFS 0x90000000
+
+#define IPU_MEM_IPC_DATA 0x9F000000
+#define IPU_MEM_IPC_VRING 0x60000000
+#define IPU_MEM_RPMSG_VRING0 0x60000000
+#define IPU_MEM_RPMSG_VRING1 0x60004000
+#define IPU_MEM_VRING_BUFS0 0x60040000
+#define IPU_MEM_VRING_BUFS1 0x60080000
+
+#define IPU_MEM_IPC_VRING_SIZE SZ_1M
+#define IPU_MEM_IPC_DATA_SIZE SZ_1M
+
+#define VAYU_IPU_1
+
+#if defined(VAYU_IPU_1)
+#define IPU_MEM_TEXT_SIZE (SZ_1M)
+#elif defined(VAYU_IPU_2)
+#define IPU_MEM_TEXT_SIZE (SZ_1M * 6)
+#endif
+
+#if defined(VAYU_IPU_1)
+#define IPU_MEM_DATA_SIZE (SZ_1M * 5)
+#elif defined(VAYU_IPU_2)
+#define IPU_MEM_DATA_SIZE (SZ_1M * 48)
+#endif
+
+#define IPU_MEM_IOBUFS_SIZE (SZ_1M * 90)
+
+/*
+ * Assign fixed RAM addresses to facilitate a fixed MMU table.
+ * PHYS_MEM_IPC_VRING & PHYS_MEM_IPC_DATA MUST be together.
+ */
+/* See CMA BASE addresses in Linux side: arch/arm/mach-omap2/remoteproc.c */
+#if defined(VAYU_IPU_1)
+#define PHYS_MEM_IPC_VRING 0x9D000000
+#elif defined (VAYU_IPU_2)
+#define PHYS_MEM_IPC_VRING 0x95800000
+#endif
+
+#define IPU_CMEM_IOBUFS 0x85000000
+#define PHYS_CMEM_IOBUFS 0xA0000000
+#define IPU_CMEM_IOBUFS_SIZE (SZ_1M * 192)
+
+#define PHYS_MEM_IOBUFS 0xBA300000
+
+/*
+ * Sizes of the virtqueues (expressed in number of buffers supported,
+ * and must be power of 2)
+ */
+#define IPU_RPMSG_VQ0_SIZE 256
+#define IPU_RPMSG_VQ1_SIZE 256
+
+/* flip up bits whose indices represent features we support */
+#define RPMSG_IPU_C0_FEATURES 1
+
+struct my_resource_table {
+ struct resource_table base;
+
+ UInt32 offset[19]; /* Should match 'num' in actual definition */
+
+ /* rpmsg vdev entry */
+ struct fw_rsc_vdev rpmsg_vdev;
+ struct fw_rsc_vdev_vring rpmsg_vring0;
+ struct fw_rsc_vdev_vring rpmsg_vring1;
+
+ /* text carveout entry */
+ struct fw_rsc_carveout text_cout;
+
+ /* data carveout entry */
+ struct fw_rsc_carveout data_cout;
+
+ /* ipcdata carveout entry */
+ struct fw_rsc_carveout ipcdata_cout;
+
+ /* trace entry */
+ struct fw_rsc_trace trace;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem0;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem1;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem2;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem3;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem4;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem5;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem6;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem7;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem8;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem9;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem10;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem11;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem12;
+
+ /* devmem entry */
+ struct fw_rsc_devmem devmem13;
+};
+
+extern char ti_trace_SysMin_Module_State_0_outbuf__A;
+#define TRACEBUFADDR (UInt32)&ti_trace_SysMin_Module_State_0_outbuf__A
+
+#pragma DATA_SECTION(ti_ipc_remoteproc_ResourceTable, ".resource_table")
+#pragma DATA_ALIGN(ti_ipc_remoteproc_ResourceTable, 4096)
+
+struct my_resource_table ti_ipc_remoteproc_ResourceTable = {
+ 1, /* we're the first version that implements this */
+ 19, /* number of entries in the table */
+ 0, 0, /* reserved, must be zero */
+ /* offsets to entries */
+ {
+ offsetof(struct my_resource_table, rpmsg_vdev),
+ offsetof(struct my_resource_table, text_cout),
+ offsetof(struct my_resource_table, data_cout),
+ offsetof(struct my_resource_table, ipcdata_cout),
+ offsetof(struct my_resource_table, trace),
+ offsetof(struct my_resource_table, devmem0),
+ offsetof(struct my_resource_table, devmem1),
+ offsetof(struct my_resource_table, devmem2),
+ offsetof(struct my_resource_table, devmem3),
+ offsetof(struct my_resource_table, devmem4),
+ offsetof(struct my_resource_table, devmem5),
+ offsetof(struct my_resource_table, devmem6),
+ offsetof(struct my_resource_table, devmem7),
+ offsetof(struct my_resource_table, devmem8),
+ offsetof(struct my_resource_table, devmem9),
+ offsetof(struct my_resource_table, devmem10),
+ offsetof(struct my_resource_table, devmem11),
+ offsetof(struct my_resource_table, devmem12),
+ offsetof(struct my_resource_table, devmem13),
+ },
+
+ /* rpmsg vdev entry */
+ {
+ TYPE_VDEV, VIRTIO_ID_RPMSG, 0,
+ RPMSG_IPU_C0_FEATURES, 0, 0, 0, 2, { 0, 0 },
+ /* no config data */
+ },
+ /* the two vrings */
+ { IPU_MEM_RPMSG_VRING0, 4096, IPU_RPMSG_VQ0_SIZE, 1, 0 },
+ { IPU_MEM_RPMSG_VRING1, 4096, IPU_RPMSG_VQ1_SIZE, 2, 0 },
+
+ {
+ TYPE_CARVEOUT,
+ IPU_MEM_TEXT, 0,
+ IPU_MEM_TEXT_SIZE, 0, 0, "IPU_MEM_TEXT",
+ },
+
+ {
+ TYPE_CARVEOUT,
+ IPU_MEM_DATA, 0,
+ IPU_MEM_DATA_SIZE, 0, 0, "IPU_MEM_DATA",
+ },
+
+ {
+ TYPE_CARVEOUT,
+ IPU_MEM_IPC_DATA, 0,
+ IPU_MEM_IPC_DATA_SIZE, 0, 0, "IPU_MEM_IPC_DATA",
+ },
+
+ {
+ TYPE_TRACE, TRACEBUFADDR, 0x8000, 0, "trace:sysm3",
+ },
+
+ {
+ TYPE_DEVMEM,
+ IPU_MEM_IPC_VRING, PHYS_MEM_IPC_VRING,
+ IPU_MEM_IPC_VRING_SIZE, 0, 0, "IPU_MEM_IPC_VRING",
+ },
+
+ {
+ TYPE_DEVMEM,
+ IPU_MEM_IOBUFS, PHYS_MEM_IOBUFS,
+ IPU_MEM_IOBUFS_SIZE, 0, 0, "IPU_MEM_IOBUFS",
+ },
+
+ {
+ TYPE_DEVMEM,
+ IPU_TILER_MODE_0_1, L3_TILER_MODE_0_1,
+ SZ_256M, 0, 0, "IPU_TILER_MODE_0_1",
+ },
+
+ {
+ TYPE_DEVMEM,
+ IPU_TILER_MODE_2, L3_TILER_MODE_2,
+ SZ_128M, 0, 0, "IPU_TILER_MODE_2",
+ },
+
+ {
+ TYPE_DEVMEM,
+ IPU_TILER_MODE_3, L3_TILER_MODE_3,
+ SZ_128M, 0, 0, "IPU_TILER_MODE_3",
+ },
+
+ {
+ TYPE_DEVMEM,
+ IPU_PERIPHERAL_L4CFG, L4_PERIPHERAL_L4CFG,
+ SZ_16M, 0, 0, "IPU_PERIPHERAL_L4CFG",
+ },
+
+ {
+ TYPE_DEVMEM,
+ IPU_PERIPHERAL_L4PER1, L4_PERIPHERAL_L4PER1,
+ SZ_2M, 0, 0, "IPU_PERIPHERAL_L4PER1",
+ },
+
+ {
+ TYPE_DEVMEM,
+ IPU_PERIPHERAL_L4PER2, L4_PERIPHERAL_L4PER2,
+ SZ_4M, 0, 0, "IPU_PERIPHERAL_L4PER2",
+ },
+
+ {
+ TYPE_DEVMEM,
+ IPU_PERIPHERAL_L4PER3, L4_PERIPHERAL_L4PER3,
+ SZ_8M, 0, 0, "IPU_PERIPHERAL_L4PER3",
+ },
+
+ {
+ TYPE_DEVMEM,
+ IPU_PERIPHERAL_L4EMU, L4_PERIPHERAL_L4EMU,
+ SZ_16M, 0, 0, "IPU_PERIPHERAL_L4EMU",
+ },
+
+ {
+ TYPE_DEVMEM,
+ IPU_IVAHD_CONFIG, L3_IVAHD_CONFIG,
+ SZ_16M, 0, 0, "IPU_IVAHD_CONFIG",
+ },
+
+ {
+ TYPE_DEVMEM,
+ IPU_IVAHD_SL2, L3_IVAHD_SL2,
+ SZ_16M, 0, 0, "IPU_IVAHD_SL2",
+ },
+
+ {
+ TYPE_DEVMEM,
+ IPU_PERIPHERAL_DMM, L3_PERIPHERAL_DMM,
+ SZ_1M, 0, 0, "IPU_PERIPHERAL_DMM",
+ },
+
+ {
+ TYPE_DEVMEM,
+ IPU_CMEM_IOBUFS, PHYS_CMEM_IOBUFS,
+ IPU_CMEM_IOBUFS_SIZE, 0, 0, "IPU_CMEM_IOBUFS",
+ },
+};
+
+#endif /* _RSC_TABLE_VAYU_IPU_H_ */
diff -rNuw ex02_messageq/ipu1/Server.c my_ex02_messageq/ipu1/Server.c
--- ex02_messageq/ipu1/Server.c 2020-11-18 11:00:52.993251224 -0500
+++ my_ex02_messageq/ipu1/Server.c 2020-11-18 10:47:02.654410729 -0500
@@ -54,6 +54,7 @@
#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/knl/Task.h>
+#include <ti/ipc/remoteproc/Resource.h>
/* local header files */
#include "../shared/AppCommon.h"
@@ -129,6 +130,11 @@
Bool running = TRUE;
App_Msg * msg;
MessageQ_QueueId queId;
+ Int i, j;
+ uint8_t * data_ptr;
+ UInt32 virtualAddrIn[1];
+ UInt32 virtualAddrOut;
+ uint32_t dataXor;
Log_print0(Diags_ENTRY | Diags_INFO, "--> Server_exec:");
@@ -142,6 +148,28 @@
goto leave;
}
+ for (i = 0; i < 1; i++) {
+ if(Resource_physToVirt(msg->dataInPhys[i], &virtualAddrIn[i]) != Resource_S_SUCCESS) {
+ Log_print1(Diags_INFO, "Server_exec: not found resource for phys 0x%x\n",
+ msg->dataInPhys[i]);
+ continue;
+ }
+ Log_print4(Diags_INFO, "Server_exec: addrPhys[%d] = 0x%x addrIn[%d]=0x%x",
+ i, msg->dataInPhys[i], i, virtualAddrIn[i]);
+
+ data_ptr = (uint8_t*)virtualAddrIn[i];
+
+ dataXor = 0;
+
+ for (j = 0; j < msg->dataByteSize; j++) {
+ dataXor ^= data_ptr[j];
+ }
+
+ Log_print2(Diags_INFO, "Server_exec: xorIn[%d]=0x%x", i, dataXor);
+ }
+
+ msg->outXor = dataXor;
+
if (msg->cmd == App_CMD_SHUTDOWN) {
running = FALSE;
}
@@ -152,6 +180,7 @@
/* send message back */
queId = MessageQ_getReplyQueue(msg); /* type-cast not needed */
MessageQ_put(queId, (MessageQ_Msg)msg);
+
} /* while (running) */
leave:
diff -rNuw ex02_messageq/makefile my_ex02_messageq/makefile
--- ex02_messageq/makefile 2020-11-18 11:00:52.997251270 -0500
+++ my_ex02_messageq/makefile 2020-11-18 10:47:02.654410729 -0500
@@ -35,10 +35,12 @@
#
# edit PROCLIST list to control how many executables to build
-PROCLIST = dsp1 dsp2 ipu1 ipu2 host
+PROCLIST = dsp1 ipu1
EXBASE = .
+
include $(EXBASE)/products.mak
+
.PHONY: $(PROCLIST)
.PHONY: install
@@ -56,12 +58,7 @@
@$(ECHO) "make install EXEC_DIR=/.../testbench # install folder"
# setup install goal
-ifeq ($(filter $(MAKECMDGOALS),install install_rov),$(MAKECMDGOALS))
-ifeq (,$(EXEC_DIR))
EXEC_DIR=$(CURDIR)/install
-endif
-override EXEC_DIR:=$(EXEC_DIR)/ex02_messageq
-endif
install: $(PROCLIST) $(addsuffix _install,$(PROCLIST))
$(addsuffix _install,$(PROCLIST)):
@@ -87,20 +84,9 @@
# ======== standard macros ========
-ifneq (,$(wildcard $(XDC_INSTALL_DIR)/xdc.exe))
- # use these on Windows
- CP = $(XDC_INSTALL_DIR)/bin/cp
- ECHO = $(XDC_INSTALL_DIR)/bin/echo
- INSTALL = $(XDC_INSTALL_DIR)/bin/cp
- MKDIR = $(XDC_INSTALL_DIR)/bin/mkdir -p
- RM = $(XDC_INSTALL_DIR)/bin/rm -f
- RMDIR = $(XDC_INSTALL_DIR)/bin/rm -rf
-else
- # use these on Linux
CP = cp
ECHO = echo
INSTALL = install
MKDIR = mkdir -p
RM = rm -f
RMDIR = rm -rf
-endif
diff -rNuw ex02_messageq/products.mak my_ex02_messageq/products.mak
--- ex02_messageq/products.mak 2020-11-18 11:00:52.997251270 -0500
+++ my_ex02_messageq/products.mak 2020-11-18 10:47:02.506408592 -0500
@@ -30,53 +30,31 @@
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
-#
-# ======== products.mak ========
-#
+DEPOT = /home/michel/ti
+SDK_DIR = /home/michel/work/custombus-sdk
-# look for other products.mak file to override local settings
-ifneq (,$(wildcard $(EXBASE)/../products.mak))
-include $(EXBASE)/../products.mak
-else
-ifneq (,$(wildcard $(EXBASE)/../../products.mak))
-include $(EXBASE)/../../products.mak
-# Define IPC_INSTALL_DIR since not defined in IPC top-level products.mak
-IPC_INSTALL_DIR = $(word 1,$(subst /examples, examples,$(CURDIR)))
-else
-ifneq (,$(wildcard $(EXBASE)/../../../products.mak))
-# Define IPC_INSTALL_DIR since not defined in IPC top-level products.mak
-IPC_INSTALL_DIR = $(word 1,$(subst /examples, examples,$(CURDIR)))
-include $(EXBASE)/../../../products.mak
-endif
-endif
-endif
-
-# By default, the necessary build variables are found/assigned via
-# ../products.mak or ../../products.mak, included above. If you want to
-# override these variables, or are building this example without
-# ../products.mak or ../../products.mak, uncomment and assign the variables
-# below.
-
-#DEPOT = _your_depot_folder_
#### Linux toolchain ####
-#TOOLCHAIN_LONGNAME = arm-none-linux-gnueabi
-#TOOLCHAIN_INSTALL_DIR = $(DEPOT)/_your_linux_gcc_toolchain_install_
-#TOOLCHAIN_PREFIX = $(TOOLCHAIN_INSTALL_DIR)/bin/$(TOOLCHAIN_LONGNAME)-
+TOOLCHAIN_PREFIX = $(SDK_DIR)/sysroots/x86_64-ACTIA-linux/usr/bin/arm-actia-linux-gnueabi/arm-actia-linux-gnueabi-
#### BIOS-side dependencies ####
-#BIOS_INSTALL_DIR = $(DEPOT)/_your_bios_install_
-#IPC_INSTALL_DIR = $(DEPOT)/_your_ipc_install_
-#XDC_INSTALL_DIR = $(DEPOT)/_your_xdctools_install_
+BIOS_INSTALL_DIR = $(DEPOT)/bios_6_52_00_12
+IPC_INSTALL_DIR = $(DEPOT)/ipc_3_47_01_00
+#XDC_INSTALL_DIR = $(DEPOT)/xdctools_3_32_02_25_core
+XDC_INSTALL_DIR = $(DEPOT)/xdctools_3_50_03_33_core
+#XDC_INSTALL_DIR = $(DEPOT)/xdctools_3_50_07_20_core
+#XDC_INSTALL_DIR = $(DEPOT)/xdctools_3_51_01_18_core
#### BIOS-side toolchains ####
-#ti.targets.arm.elf.M4 = $(DEPOT)/_your_ti_arm_codegen_install_
-#ti.targets.elf.C66 = $(DEPOT)/_your_ti_dsp_codegen_install_
+ti.targets.arm.elf.M4 = $(DEPOT)/ti-cgt-arm_16.9.3.LTS
+ti.targets.elf.C66 = $(DEPOT)/ti-cgt-c6000_8.2.2
# Use this goal to print your product variables.
.show:
+ @echo "LINUX_SYSROOT_DIR = $(TOOLCHAIN_PREFIX)"
@echo "HOST TOOLCHAIN_PREFIX = $(TOOLCHAIN_PREFIX)"
@echo "BIOS_INSTALL_DIR = $(BIOS_INSTALL_DIR)"
@echo "IPC_INSTALL_DIR = $(IPC_INSTALL_DIR)"
@echo "XDC_INSTALL_DIR = $(XDC_INSTALL_DIR)"
@echo "ti.targets.arm.elf.M4 = $(ti.targets.arm.elf.M4)"
@echo "ti.targets.elf.C66 = $(ti.targets.elf.C66)"
+
diff -rNuw ex02_messageq/shared/AppCommon.h my_ex02_messageq/shared/AppCommon.h
--- ex02_messageq/shared/AppCommon.h 2020-11-18 11:00:52.993251224 -0500
+++ my_ex02_messageq/shared/AppCommon.h 2020-11-18 10:47:02.206404268 -0500
@@ -41,6 +41,7 @@
extern "C" {
#endif
+#include <stdint.h>
/*
* ======== Application Configuration ========
@@ -55,6 +56,14 @@
typedef struct {
MessageQ_MsgHeader reserved;
UInt32 cmd;
+ UInt8 payload[8];
+ void* dataIn[1];
+ unsigned long dataInPhys[1];
+ void* dataOut;
+ unsigned long dataOutPhys;
+ uint32_t inXor[1];
+ uint32_t outXor;
+ size_t dataByteSize;
} App_Msg;
#define App_MsgHeapId 0
diff -rNuw ex02_messageq/shared/config.bld my_ex02_messageq/shared/config.bld
--- ex02_messageq/shared/config.bld 2020-11-18 11:00:52.989251172 -0500
+++ my_ex02_messageq/shared/config.bld 2020-11-18 10:47:02.206404268 -0500
@@ -36,7 +36,7 @@
*/
var Build = xdc.useModule('xdc.bld.BuildEnvironment');
-/* Memory Map for ti.platforms.evmDRA7XX:dsp1 and ti.platforms.evmDRA7XX:dsp2
+/* Memory Map for ti.platforms.evmDRA7XX:dsp1
*
* --- External Memory ---
* Virtual Physical Size Comment
@@ -47,7 +47,15 @@
* 9F00_0000 9F00_0000 6_0000 ( 384 kB) TRACE_BUF
* 9F06_0000 9F06_0000 1_0000 ( 64 kB) EXC_DATA
* 9F07_0000 9F07_0000 2_0000 ( 128 kB) PM_DATA (Power mgmt)
+ * A000_0000 A000_0000 C00_0000 (192 MB) CMEM Memory (192 MB)
*/
+
+var evmDRA7XX_CMEM = {
+ name: "CMEM", space: "data", access: "RW",
+ base: 0xA0000000, len: 0xC000000,
+ comment: "CMEM Memory (192 MB)"
+};
+
var evmDRA7XX_ExtMemMapDsp = {
EXT_CODE: {
name: "EXT_CODE",
@@ -91,6 +99,13 @@
space: "data",
access: "RWX" /* should this have execute perm? */
},
+ CMEM: {
+ name: evmDRA7XX_CMEM.name,
+ base: evmDRA7XX_CMEM.base,
+ len: evmDRA7XX_CMEM.len,
+ space: "data",
+ access: "RW"
+ },
};
Build.platformTable["ti.platforms.evmDRA7XX:dsp1"] = {
@@ -101,15 +116,12 @@
[ "TRACE_BUF", evmDRA7XX_ExtMemMapDsp.TRACE_BUF ],
[ "EXC_DATA", evmDRA7XX_ExtMemMapDsp.EXC_DATA ],
[ "PM_DATA", evmDRA7XX_ExtMemMapDsp.PM_DATA ],
+ [ evmDRA7XX_CMEM.name, evmDRA7XX_ExtMemMapDsp.CMEM ],
],
codeMemory: "EXT_CODE",
dataMemory: "EXT_DATA",
stackMemory: "EXT_DATA",
};
-Build.platformTable["ti.platforms.evmDRA7XX:dsp2"] =
- Build.platformTable["ti.platforms.evmDRA7XX:dsp1"];
-
-
/* Memory Map for ti.platforms.evmDRA7XX:ipu2
*
@@ -122,6 +134,7 @@
* 9F00_0000 9F00_0000 6_0000 ( 384 kB) TRACE_BUF
* 9F06_0000 9F06_0000 1_0000 ( 64 kB) EXC_DATA
* 9F07_0000 9F07_0000 2_0000 ( 128 kB) PM_DATA (Power mgmt)
+ * A000_0000 A000_0000 C00_0000 (192 MB) CMEM Memory (192 MB)
*/
var evmDRA7XX_ExtMemMapIpu2 = {
EXT_CODE: {
@@ -165,7 +178,16 @@
len: 0x00020000,
space: "data",
access: "RWX" /* should this have execute perm? */
- }
+ },
+/*
+ CMEM: {
+ name: evmDRA7XX_CMEM.name,
+ base: evmDRA7XX_CMEM.base,
+ len: evmDRA7XX_CMEM.len,
+ space: "data",
+ access: "RW"
+ },
+*/
};
Build.platformTable["ti.platforms.evmDRA7XX:ipu2"] = {
@@ -193,6 +215,7 @@
* 9F00_0000 9F00_0000 6_0000 ( 384 kB) TRACE_BUF
* 9F06_0000 9F06_0000 1_0000 ( 64 kB) EXC_DATA
* 9F07_0000 9F07_0000 2_0000 ( 128 kB) PM_DATA (Power mgmt)
+ * A000_0000 A000_0000 C00_0000 (192 MB) CMEM Memory (192 MB)
*/
var evmDRA7XX_ExtMemMapIpu1 = {
EXT_CODE: {
@@ -236,7 +259,14 @@
len: 0x00020000,
space: "data",
access: "RWX" /* should this have execute perm? */
- }
+ },
+ CMEM: {
+ name: evmDRA7XX_CMEM.name,
+ base: evmDRA7XX_CMEM.base,
+ len: evmDRA7XX_CMEM.len,
+ space: "data",
+ access: "RW"
+ },
};
Build.platformTable["ti.platforms.evmDRA7XX:ipu1"] = {
@@ -246,7 +276,8 @@
[ "EXT_HEAP", evmDRA7XX_ExtMemMapIpu1.EXT_HEAP ],
[ "TRACE_BUF", evmDRA7XX_ExtMemMapIpu1.TRACE_BUF ],
[ "EXC_DATA", evmDRA7XX_ExtMemMapIpu1.EXC_DATA ],
- [ "PM_DATA", evmDRA7XX_ExtMemMapIpu1.PM_DATA ]
+ [ "PM_DATA", evmDRA7XX_ExtMemMapIpu1.PM_DATA ],
+ [ evmDRA7XX_CMEM.name, evmDRA7XX_ExtMemMapIpu1.CMEM ],
],
codeMemory: "EXT_CODE",
dataMemory: "EXT_DATA",
--------------------------------------------
In devicetree
memory {
device_type = "memory";
reg = <0x0 0x80000000
0x0 0x40000000>; /* 1GB */
};
reserved_mem: reserved-memory {
#address-cells = <2>;
#size-cells = <2>;
ranges;
ipu2_cma_pool: ipu2_cma@95800000 {
compatible = "shared-dma-pool";
reg = <0x0 0x95800000 0x0 0x3800000>;
reusable;
status = "okay";
};
dsp1_cma_pool: dsp1_cma@99000000 {
compatible = "shared-dma-pool";
reg = <0x0 0x99000000 0x0 0x4000000>;
reusable;
status = "okay";
};
ipu1_cma_pool: ipu1_cma@9d000000 {
compatible = "shared-dma-pool";
reg = <0x0 0x9d000000 0x0 0x2000000>;
reusable;
status = "okay";
};
cmem_block_mem_0: cmem_block_mem@a0000000 {
reg = <0x0 0xa0000000 0x0 0x0c000000>;
no-map;
status = "okay";
};
};
cmem {
compatible = "ti,cmem";
#address-cells = <1>;
#size-cells = <0>;
#pool-size-cells = <2>;
status = "okay";
cmem_block_0: cmem_block@0 {
reg = <0>;
memory-region = <&cmem_block_mem_0>;
cmem-buf-pools = <1 0x0 0x0c000000>;
};
};
&mailbox5 {
status = "okay";
mbox_ipu1_ipc3x: mbox_ipu1_ipc3x {
status = "okay";
};
mbox_dsp1_ipc3x: mbox_dsp1_ipc3x {
status = "okay";
};
};
&mailbox6 {
status = "okay";
mbox_ipu2_ipc3x: mbox_ipu2_ipc3x {
status = "okay";
};
};
&mmu_ipu1 {
status = "okay";
};
&mmu_ipu2 {
status = "okay";
};
&mmu0_dsp1 {
status = "okay";
};
&mmu1_dsp1 {
status = "okay";
};
&ipu1 {
status = "okay";
memory-region = <&ipu2_cma_pool>;
mboxes = <&mailbox5 &mbox_ipu1_ipc3x>;
timers = <&timer11>;
watchdog-timers = <&timer7>, <&timer8>;
};
&ipu2 {
status = "okay";
memory-region = <&ipu2_cma_pool>;
mboxes = <&mailbox6 &mbox_ipu2_ipc3x>;
timers = <&timer3>;
watchdog-timers = <&timer4>, <&timer9>;
};
&dsp1 {
status = "okay";
memory-region = <&dsp1_cma_pool>;
mboxes = <&mailbox5 &mbox_dsp1_ipc3x>;
timers = <&timer5>;
watchdog-timers = <&timer10>;
};
----------------------------------------------
I get this with dmesg
root@actia-gd:~# dmesg | grep ipu
[ 0.000000] Reserved memory: initialized node ipu2_cma@95800000, compatible id shared-dma-pool
[ 0.000000] Reserved memory: initialized node ipu1_cma@9d000000, compatible id shared-dma-pool
[ 3.510951] omap-rproc 58820000.ipu: assigned reserved memory node ipu2_cma@95800000
[ 3.532419] remoteproc0: 58820000.ipu is available
[ 3.582496] remoteproc0: Direct firmware load for dra7-ipu1-fw.xem4 failed with error -2
[ 3.595935] omap-rproc 55020000.ipu: assigned reserved memory node ipu2_cma@95800000
[ 3.612440] remoteproc1: 55020000.ipu is available
[ 3.662477] remoteproc1: Direct firmware load for dra7-ipu2-fw.xem4 failed with error -2
[ 15.512152] remoteproc1: powering up 55020000.ipu
[ 15.552978] remoteproc1: Booting fw image dra7-ipu2-fw.xem4, size 3739020
[ 15.775976] remoteproc0: powering up 58820000.ipu
[ 15.780795] remoteproc0: Booting fw image dra7-ipu1-fw.xem4, size 3971716
[ 16.001621] omap-rproc 58820000.ipu: dma_alloc_coherent err: 5242880
[ 16.798044] remoteproc1: remote processor 55020000.ipu is now up
root@actia-gd:~# dmesg | grep dsp
[ 0.000000] Reserved memory: initialized node dsp1_cma@99000000, compatible id shared-dma-pool
[ 3.675921] omap-rproc 40800000.dsp: assigned reserved memory node dsp1_cma@99000000
[ 3.692439] remoteproc2: 40800000.dsp is available
[ 3.766448] remoteproc2: Direct firmware load for dra7-dsp1-fw.xe66 failed with error -2
[ 12.557343] remoteproc2: powering up 40800000.dsp
[ 12.660097] remoteproc2: Booting fw image dra7-dsp1-fw.xe66, size 4183496
[ 12.688748] omap_hwmod: mmu0_dsp1: _wait_target_disable failed
[ 13.015374] remoteproc2: remote processor 40800000.dsp is now up
My yocto uses recipes from the one that is used for automotive SDK 3.04, kernel 4.4.45
I will need to get code working on kernel 4.19.73 later but my priority is this old kernel for now.
Michel Catudal
ACTIA Corp