summaryrefslogtreecommitdiffstats
path: root/cpukit/libgnat
diff options
context:
space:
mode:
Diffstat (limited to 'cpukit/libgnat')
-rw-r--r--cpukit/libgnat/.cvsignore2
-rw-r--r--cpukit/libgnat/Makefile.am17
-rw-r--r--cpukit/libgnat/ada_intrsupp.c146
-rw-r--r--cpukit/libgnat/adasupp.c36
4 files changed, 201 insertions, 0 deletions
diff --git a/cpukit/libgnat/.cvsignore b/cpukit/libgnat/.cvsignore
new file mode 100644
index 0000000000..282522db03
--- /dev/null
+++ b/cpukit/libgnat/.cvsignore
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
diff --git a/cpukit/libgnat/Makefile.am b/cpukit/libgnat/Makefile.am
new file mode 100644
index 0000000000..85414cb8cb
--- /dev/null
+++ b/cpukit/libgnat/Makefile.am
@@ -0,0 +1,17 @@
+##
+## $Id$
+##
+
+include $(top_srcdir)/automake/compile.am
+
+EXTRA_DIST=
+
+if LIBGNAT
+AM_CPPFLAGS += -D__RTEMS_INSIDE__
+
+noinst_LIBRARIES = libgnat.a
+
+libgnat_a_SOURCES = ada_intrsupp.c adasupp.c
+endif
+
+include $(top_srcdir)/automake/local.am
diff --git a/cpukit/libgnat/ada_intrsupp.c b/cpukit/libgnat/ada_intrsupp.c
new file mode 100644
index 0000000000..5f9c19281f
--- /dev/null
+++ b/cpukit/libgnat/ada_intrsupp.c
@@ -0,0 +1,146 @@
+/*
+ * COPYRIGHT (c) 1989-2010.
+ * On-Line Applications Research Corporation (OAR).
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.com/license/LICENSE.
+ *
+ * $Id$
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <rtems.h>
+#include <rtems/bspIo.h>
+
+rtems_id __gnat_binary_semaphore_create(void)
+{
+ rtems_status_code status;
+ rtems_id semaphore;
+
+ status = rtems_semaphore_create(
+ rtems_build_name( 'A', 'I', 'S', 'R' ),
+ 0,
+ RTEMS_SIMPLE_BINARY_SEMAPHORE | RTEMS_FIFO,
+ 0,
+ &semaphore
+ );
+ if ( status != RTEMS_SUCCESSFUL )
+ printk( "__gnat_binary_semaphore_create failed %d\n", status );
+
+ #if defined(GNAT_DEBUG)
+ printk( "__gnat_binary_semaphore_create\n" );
+ #endif
+ return semaphore;
+}
+
+int __gnat_binary_semaphore_delete(
+ rtems_id semaphore
+)
+{
+ rtems_status_code status;
+
+ #if defined(GNAT_DEBUG)
+ printk( "__gnat_binary_semaphore_delete\n" );
+ #endif
+
+ status = rtems_semaphore_delete( semaphore );
+ if ( status != RTEMS_SUCCESSFUL )
+ printk( "__gnat_binary_semaphore_delete failed %d\n", status );
+
+ return 0;
+}
+
+int __gnat_binary_semaphore_obtain(
+ rtems_id semaphore
+)
+{
+ rtems_status_code status;
+
+ #if defined(GNAT_DEBUG)
+ printk( "__gnat_binary_semaphore_obtain\n" );
+ #endif
+
+ status = rtems_semaphore_obtain( semaphore, RTEMS_WAIT, RTEMS_NO_TIMEOUT );
+ if ( status != RTEMS_SUCCESSFUL )
+ printk( "__gnat_binary_semaphore_obtain failed %d\n", status );
+
+ return 0;
+}
+
+int __gnat_binary_semaphore_release(
+ rtems_id semaphore
+)
+{
+ rtems_status_code status;
+
+ #if defined(GNAT_DEBUG)
+ printk( "__gnat_binary_semaphore_release\n" );
+ #endif
+
+ status = rtems_semaphore_release( semaphore );
+ if ( status != RTEMS_SUCCESSFUL )
+ printk( "__gnat_binary_semaphore_release failed %d\n", status );
+
+ return 0;
+}
+
+int __gnat_binary_semaphore_flush(
+ rtems_id semaphore
+)
+{
+ rtems_status_code status;
+
+ printk( "__gnat_binary_semaphore_flush\n" );
+
+ status = rtems_semaphore_flush( semaphore );
+ if ( status != RTEMS_SUCCESSFUL )
+ printk( "__gnat_binary_semaphore_flush failed %d\n", status );
+
+ return 0;
+}
+
+typedef void (*ISRHandler)(void*);
+ void *set_vector( void *, rtems_vector_number, int );
+
+int __gnat_interrupt_connect(
+ int vector,
+ ISRHandler handler,
+ void *parameter
+)
+{
+ printk( "__gnat_interrupt_connect( %d, %p, %p )\n", vector, handler, parameter );
+ set_vector( handler, vector, 1 );
+ return 0;
+}
+
+int __gnat_interrupt_set(
+ int vector,
+ ISRHandler handler
+)
+{
+ printk( "__gnat_interrupt_set( %d, %p )\n", vector, handler );
+
+ set_vector( handler, vector, 1 );
+ return 0;
+}
+
+ISRHandler __gnat_interrupt_get(
+ int vector
+)
+{
+ printk( "__gnat_interrupt_get( %d )\n", vector );
+ return 0;
+}
+
+int __gnat_interrupt_number_to_vector(
+ int intNum
+)
+{
+ printk( "__gnat_interrupt_number_to_vector( %d )\n", intNum );
+ return intNum;
+}
+
diff --git a/cpukit/libgnat/adasupp.c b/cpukit/libgnat/adasupp.c
new file mode 100644
index 0000000000..5af4730a65
--- /dev/null
+++ b/cpukit/libgnat/adasupp.c
@@ -0,0 +1,36 @@
+/*
+ * $Id$
+ */
+
+#if HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <errno.h>
+#include <pthread.h>
+
+#include <rtems/system.h>
+#include <rtems/config.h>
+#include <rtems/posix/pthread.h>
+
+/*
+ * _ada_pthread_minimum_stack_size
+ *
+ * This routine returns the minimum stack size so the GNAT RTS can
+ * allocate enough stack for Ada tasks.
+ */
+
+size_t _ada_pthread_minimum_stack_size( void )
+{
+ /*
+ * Eventually this may need to include a per cpu family calculation
+ * but for now, this will do.
+ */
+
+ return PTHREAD_MINIMUM_STACK_SIZE * 2;
+}
+
+uint32_t _ada_microseconds_per_tick(void)
+{
+ return rtems_configuration_get_microseconds_per_tick();
+}