summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
authorBernd Schmidt <bernds_cb1@t-online.de>2008-01-18 13:53:10 +0000
committerBernd Schmidt <bernds_cb1@t-online.de>2008-01-18 13:53:10 +0000
commitd22976dd5e16e8719abd5c542e17427eeece7ff6 (patch)
tree1ed5337d956a7f83d22a8c5b23280043091aad36 /libc
parent0375e472c58b5734a73ae5bf3ba8973fd2e38f8a (diff)
L1 memory support for the Blackfin. A couple new syscalls to manage L1
allocations, dma_memcpy to move stuff between L1 and main memory, and a new structure to describe the global data in L1 scratchpad memory.
Diffstat (limited to 'libc')
-rw-r--r--libc/sysdeps/linux/bfin/Makefile.arch5
-rw-r--r--libc/sysdeps/linux/bfin/bfin_l1layout.h17
-rw-r--r--libc/sysdeps/linux/bfin/bfin_sram.h30
-rw-r--r--libc/sysdeps/linux/bfin/bits/bfin_sram.h12
-rw-r--r--libc/sysdeps/linux/bfin/dma-memcpy.c6
-rw-r--r--libc/sysdeps/linux/bfin/sram-alloc.c6
-rw-r--r--libc/sysdeps/linux/bfin/sram-free.c6
7 files changed, 69 insertions, 13 deletions
diff --git a/libc/sysdeps/linux/bfin/Makefile.arch b/libc/sysdeps/linux/bfin/Makefile.arch
index 7a428b380..e8ff306ff 100644
--- a/libc/sysdeps/linux/bfin/Makefile.arch
+++ b/libc/sysdeps/linux/bfin/Makefile.arch
@@ -5,8 +5,11 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-CSRC := brk.c bsdsetjmp.c clone.c syscall.c
+CSRC := brk.c bsdsetjmp.c clone.c syscall.c mmap.c \
+ sram-alloc.c sram-free.c dma-memcpy.c
SSRC := __longjmp.S setjmp.S bsd-_setjmp.S vfork.S
+ARCH_HEADERS := bfin_l1layout.h bfin_sram.h
+
include $(top_srcdir)libc/sysdeps/linux/Makefile.commonarch
diff --git a/libc/sysdeps/linux/bfin/bfin_l1layout.h b/libc/sysdeps/linux/bfin/bfin_l1layout.h
new file mode 100644
index 000000000..00efd2358
--- /dev/null
+++ b/libc/sysdeps/linux/bfin/bfin_l1layout.h
@@ -0,0 +1,17 @@
+#define L1_SCRATCH_START 0xFFB00000
+
+/* Data that is "mapped" into the process VM at the start of the L1 scratch
+ memory, so that each process can access it at a fixed address. Used for
+ stack checking. */
+struct l1_scratch_task_info
+{
+ /* Points to the start of the stack. */
+ void *stack_start;
+ /* Not updated by the kernel; a user process can modify this to
+ keep track of the lowest address of the stack pointer during its
+ runtime. */
+ void *lowest_sp;
+};
+
+/* A pointer to the structure in memory. */
+#define L1_SCRATCH_TASK_INFO ((struct l1_scratch_task_info *)L1_SCRATCH_START)
diff --git a/libc/sysdeps/linux/bfin/bfin_sram.h b/libc/sysdeps/linux/bfin/bfin_sram.h
new file mode 100644
index 000000000..eea729b05
--- /dev/null
+++ b/libc/sysdeps/linux/bfin/bfin_sram.h
@@ -0,0 +1,30 @@
+/*
+ * bfin_sram.h - userspace interface to L1 memory allocator
+ *
+ * Copyright (c) 2007 Analog Devices Inc.
+ *
+ * Licensed under the GPL-2 or later.
+ */
+
+#ifndef __BFIN_SRAM_H__
+#define __BFIN_SRAM_H__
+
+#include <features.h>
+#include <sys/types.h>
+
+__BEGIN_DECLS
+
+#define L1_INST_SRAM 0x00000001
+#define L1_DATA_A_SRAM 0x00000002
+#define L1_DATA_B_SRAM 0x00000004
+#define L1_DATA_SRAM 0x00000006
+
+extern void *sram_alloc(size_t size, unsigned long flags)
+ __attribute_malloc__ __attribute_warn_unused_result__;
+extern int sram_free(const void *addr);
+extern void *dma_memcpy(void *dest, const void *src, size_t len)
+ __nonnull((1, 2));
+
+__END_DECLS
+
+#endif
diff --git a/libc/sysdeps/linux/bfin/bits/bfin_sram.h b/libc/sysdeps/linux/bfin/bits/bfin_sram.h
deleted file mode 100644
index 1ac066a10..000000000
--- a/libc/sysdeps/linux/bfin/bits/bfin_sram.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef BFIN_SRAM_H
-#define BFIN_SRAM_H
-
-#define L1_INST_SRAM 0x00000001
-#define L1_DATA_A_SRAM 0x00000002
-#define L1_DATA_B_SRAM 0x00000004
-#define L1_DATA_SRAM 0x00000006
-extern void *sram_alloc(size_t size, unsigned long flags);
-extern int sram_free(const void *addr);
-extern void *dma_memcpy(void *dest, const void *src, size_t len);
-
-#endif
diff --git a/libc/sysdeps/linux/bfin/dma-memcpy.c b/libc/sysdeps/linux/bfin/dma-memcpy.c
new file mode 100644
index 000000000..6d7a5b855
--- /dev/null
+++ b/libc/sysdeps/linux/bfin/dma-memcpy.c
@@ -0,0 +1,6 @@
+#include <unistd.h>
+#include <errno.h>
+#include <sys/syscall.h>
+
+_syscall3 (__ptr_t, dma_memcpy, __ptr_t, dest, __ptr_t, src, size_t, len);
+
diff --git a/libc/sysdeps/linux/bfin/sram-alloc.c b/libc/sysdeps/linux/bfin/sram-alloc.c
new file mode 100644
index 000000000..f0e8bce65
--- /dev/null
+++ b/libc/sysdeps/linux/bfin/sram-alloc.c
@@ -0,0 +1,6 @@
+#include <unistd.h>
+#include <errno.h>
+#include <sys/syscall.h>
+
+_syscall2 (__ptr_t, sram_alloc, size_t, len, unsigned long, flags);
+
diff --git a/libc/sysdeps/linux/bfin/sram-free.c b/libc/sysdeps/linux/bfin/sram-free.c
new file mode 100644
index 000000000..02bf5d52e
--- /dev/null
+++ b/libc/sysdeps/linux/bfin/sram-free.c
@@ -0,0 +1,6 @@
+#include <unistd.h>
+#include <errno.h>
+#include <sys/syscall.h>
+
+_syscall1 (__ptr_t, sram_free, __ptr_t, addr);
+