summaryrefslogtreecommitdiffstats
path: root/rtems/freebsd/rtems/rtems-bsd-init.c
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@oarcorp.com>2012-03-07 09:52:04 -0600
committerJoel Sherrill <joel.sherrill@oarcorp.com>2012-03-07 09:52:04 -0600
commita9153ec3040f54fa52b68e14dafed2aba7b780ae (patch)
treefda80e3380dfebf7d97868507aa185757852e882 /rtems/freebsd/rtems/rtems-bsd-init.c
downloadrtems-libbsd-a9153ec3040f54fa52b68e14dafed2aba7b780ae.tar.bz2
Initial import
Code is based on FreeBSD 8.2 with USB support from Sebastian Huber and Thomas Doerfler. Initial TCP/IP stack work is from Kevel Kirspel.
Diffstat (limited to 'rtems/freebsd/rtems/rtems-bsd-init.c')
-rw-r--r--rtems/freebsd/rtems/rtems-bsd-init.c65
1 files changed, 65 insertions, 0 deletions
diff --git a/rtems/freebsd/rtems/rtems-bsd-init.c b/rtems/freebsd/rtems/rtems-bsd-init.c
new file mode 100644
index 00000000..347d6710
--- /dev/null
+++ b/rtems/freebsd/rtems/rtems-bsd-init.c
@@ -0,0 +1,65 @@
+/**
+ * @file
+ *
+ * @ingroup rtems_bsd_rtems
+ *
+ * @brief TODO.
+ */
+
+/*
+ * Copyright (c) 2009, 2010 embedded brains GmbH. All rights reserved.
+ *
+ * embedded brains GmbH
+ * Obere Lagerstr. 30
+ * 82178 Puchheim
+ * Germany
+ * <rtems@embedded-brains.de>
+ *
+ * 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.
+ */
+
+#include <rtems/freebsd/machine/rtems-bsd-config.h>
+
+#include <rtems/freebsd/sys/param.h>
+#include <rtems/freebsd/sys/types.h>
+#include <rtems/freebsd/sys/systm.h>
+#include <rtems/freebsd/sys/kernel.h>
+#include <rtems/freebsd/sys/lock.h>
+#include <rtems/freebsd/sys/mutex.h>
+#include <rtems/freebsd/sys/proc.h>
+
+#include <rtems/freebsd/bsd.h>
+
+/* In FreeBSD this is a local function */
+void mi_startup(void);
+
+int hz;
+int tick;
+int maxusers; /* base tunable */
+
+rtems_status_code
+rtems_bsd_initialize(void)
+{
+ rtems_status_code sc = RTEMS_SUCCESSFUL;
+
+ hz = (int) rtems_clock_get_ticks_per_second();
+ tick = 1000000 / hz;
+ maxusers = 1;
+
+ sc = rtems_timer_initiate_server(
+ BSD_TASK_PRIORITY_TIMER,
+ BSD_MINIMUM_TASK_STACK_SIZE,
+ RTEMS_DEFAULT_ATTRIBUTES
+ );
+ if (sc != RTEMS_SUCCESSFUL) {
+ return RTEMS_UNSATISFIED;
+ }
+
+ mutex_init();
+
+ mi_startup();
+
+ return RTEMS_SUCCESSFUL;
+}