summaryrefslogtreecommitdiff
path: root/dsp
diff options
context:
space:
mode:
Diffstat (limited to 'dsp')
-rw-r--r--dsp/Makefile27
-rw-r--r--dsp/bridge.s59
-rw-r--r--dsp/node.h38
-rw-r--r--dsp/threshold.c71
4 files changed, 195 insertions, 0 deletions
diff --git a/dsp/Makefile b/dsp/Makefile
new file mode 100644
index 0000000..2828921
--- /dev/null
+++ b/dsp/Makefile
@@ -0,0 +1,27 @@
+CL6X := $(DSP_CGT)/bin/cl6x
+LNK6X := $(DSP_CGT)/bin/lnk6x
+DLLCREATE := $(DSP_DOFFBUILD)/bin/DLLcreate
+
+CFLAGS := -O3 -I$(DSP_CGT)/include
+OBJECTS := bridge.o64P threshold.o64P
+
+all: threshold.dll64P
+
+threshold.x64P: $(OBJECTS)
+
+# pretty print
+%.o64P: %.s
+ $(CL6X) $(CFLAGS) -mv=64p -eo.o64P -c $<
+
+%.o64P: %.c
+ $(CL6X) $(CFLAGS) -mv=64p -eo.o64P -c $<
+
+%.x64P:
+ $(LNK6X) -r -cr --localize='$$bss' -o $@ $+
+
+%.dll64P: %.x64P
+ $(DLLCREATE) $< -o=$@
+
+clean:
+ $(RM) *.o64P *.x64P *.dll64P
+
diff --git a/dsp/bridge.s b/dsp/bridge.s
new file mode 100644
index 0000000..0564c0d
--- /dev/null
+++ b/dsp/bridge.s
@@ -0,0 +1,59 @@
+ .sect ".3DAC26D0_6D4B_11DD_AD8B_0800200C9A66"
+ .string "1024," ; cbstruct (NOT USED);
+ .string "3DAC26D0_6D4B_11DD_AD8B_0800200C9A66," ; uuid;
+ .string "threshold," ; name;
+ .string "1," ; type;
+
+ .string "0," ; (NOT USED);
+ .string "1024," ; (NOT USED);
+ .string "512," ; (NOT USED);
+ .string "128," ; (NOT USED);
+ .string "3072," ; (NOT USED);
+ .string "5," ; (NOT USED);
+ .string "3," ; (NOT USED);
+ .string "1000," ; (NOT USED);
+ .string "100," ; (NOT USED);
+ .string "10," ; (NOT USED);
+ .string "1," ; priority;
+ .string "1024," ; stack size;
+ .string "16," ; system stack size (arbitrary)
+
+ .string "0," ; stack segment;
+ .string "3," ; max message depth queued to node;
+ .string "1," ; # of input streams;
+ .string "1," ; # of output streams;
+ .string "3e8H," ; timeout value of GPP blocking calls;
+
+ .string "threshold_create," ; create phase name;
+ .string "threshold_execute," ; execute phase name;
+ .string "threshold_delete," ; delete phase name;
+
+ .string "0," ; message segment;
+ .string "32768," ; (NOT USED);
+
+ .string "none," ; XDAIS algorithm structure name;
+ .string "1," ; dynamic loading flag;
+
+ .string "ff3f3f3fH," ; dynamic load data mem seg mask;
+ .string "ff3f3f3fH," ; dynamic load code mem seg mask;
+ .string "16," ; max # of node profiles supported;
+ .string "0," ; node profile 0;
+ .string "0," ; node profile 1;
+ .string "0," ; node profile 2;
+ .string "0," ; node profile 3;
+ .string "0," ; node profile 4;
+ .string "0," ; node profile 5;
+ .string "0," ; node profile 6;
+ .string "0," ; node profile 7;
+ .string "0," ; node profile 8;
+ .string "0," ; node profile 9;
+ .string "0," ; node profile 10;
+ .string "0," ; node profile 11;
+ .string "0," ; node profile 12;
+ .string "0," ; node profile 13;
+ .string "0," ; node profile 14;
+ .string "0," ; node profile 15;
+ .string "none," ; stackSegName segment;
+
+ .sect ".dcd_register";
+ .string "3DAC26D0_6D4B_11DD_AD8B_0800200C9A66:0,";
diff --git a/dsp/node.h b/dsp/node.h
new file mode 100644
index 0000000..94f7c1e
--- /dev/null
+++ b/dsp/node.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2008 Texas Instruments, Incorporated
+ * Copyright (C) 2008-2009 Nokia Corporation.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation
+ * version 2.1 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef NODE_H
+#define NODE_H
+
+#include <stdint.h>
+
+typedef struct {
+ uint32_t cmd;
+ uint32_t arg_1;
+ uint32_t arg_2;
+} dsp_msg_t;
+
+extern unsigned short NODE_getMsg(void *node, dsp_msg_t *msg, unsigned int timeout);
+extern unsigned short NODE_putMsg(void *node, void *dest, dsp_msg_t *msg, unsigned int timeout);
+
+extern void BCACHE_inv(void *ptr, size_t size, unsigned short wait);
+extern void BCACHE_wbInv(void *ptr, size_t size, unsigned short wait);
+
+#endif /* NODE_H */
diff --git a/dsp/threshold.c b/dsp/threshold.c
new file mode 100644
index 0000000..f5eb7f1
--- /dev/null
+++ b/dsp/threshold.c
@@ -0,0 +1,71 @@
+/*
+ * OMAP3 DSP sample image threshold algorithm
+ *
+ * Copyright (C) 2010-2011 Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <stddef.h>
+#include "node.h"
+
+unsigned int threshold_create(void)
+{
+ return 0x8000;
+}
+
+unsigned int threshold_delete(void)
+{
+ return 0x8000;
+}
+
+static void threshold_process(uint16_t *data, unsigned int size)
+{
+ unsigned int i;
+
+ for (i = 0; i < size / 2; ++i)
+ data[i] = data[i] >= 512 ? 1023 : 0;
+}
+
+unsigned int threshold_execute(void *env)
+{
+ unsigned char done = 0;
+ unsigned int size;
+ dsp_msg_t msg;
+ void *buffer;
+
+ while (!done) {
+ NODE_getMsg(env, &msg, (unsigned) -1);
+
+ switch (msg.cmd) {
+ case 0:
+ buffer = (void *)msg.arg_1;
+ size = (unsigned int)msg.arg_2;
+
+ BCACHE_inv(buffer, size, 1);
+ threshold_process(buffer, size);
+ BCACHE_wb(buffer, size, 1);
+
+ NODE_putMsg(env, NULL, &msg, 0);
+ break;
+
+ case 0x80000000:
+ done = 1;
+ break;
+ }
+ }
+
+ return 0x8000;
+}