diff options
author | Joel Sherrill <joel.sherrill@oarcorp.com> | 2012-07-26 07:22:23 -0500 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@oarcorp.com> | 2012-07-26 07:22:23 -0500 |
commit | 7e7dac757b2b733584f573e5c5e2323d85e59379 (patch) | |
tree | cf5d290fcda0250e522158dd361f4c880ba511e2 /testsuite/init01 | |
parent | link01 - Clean up and split so initialization can be reused in other tests (diff) | |
download | rtems-libbsd-7e7dac757b2b733584f573e5c5e2323d85e59379.tar.bz2 |
Rename link01 to init01
Diffstat (limited to 'testsuite/init01')
-rw-r--r-- | testsuite/init01/.gitignore | 1 | ||||
-rw-r--r-- | testsuite/init01/Makefile | 30 | ||||
-rw-r--r-- | testsuite/init01/init.c | 79 | ||||
-rw-r--r-- | testsuite/init01/nic-sysinit.h | 85 | ||||
-rw-r--r-- | testsuite/init01/test_main.c | 23 |
5 files changed, 218 insertions, 0 deletions
diff --git a/testsuite/init01/.gitignore b/testsuite/init01/.gitignore new file mode 100644 index 00000000..adaff0b8 --- /dev/null +++ b/testsuite/init01/.gitignore @@ -0,0 +1 @@ +undefined.txt diff --git a/testsuite/init01/Makefile b/testsuite/init01/Makefile new file mode 100644 index 00000000..1e7ac313 --- /dev/null +++ b/testsuite/init01/Makefile @@ -0,0 +1,30 @@ +# +# $Id$ +# + +include ../../config.inc + +PGM=${ARCH}/init01.exe + +# optional managers required +MANAGERS=all + +# C source names +C_FILES = init.c test_main.c +C_O_FILES = $(C_FILES:%.c=${ARCH}/%.o) + +AM_CPPFLAGS += -I $(INSTALL_BASE)/include +LINK_LIBS += $(INSTALL_BASE)/libbsdc.a +LINK_LIBS += $(INSTALL_BASE)/libbsd.a ${REL_ARGS} + +include $(RTEMS_MAKEFILE_PATH)/Makefile.inc +include $(RTEMS_CUSTOM) +include $(PROJECT_ROOT)/make/leaf.cfg + +OBJS= $(C_O_FILES) +CLEAN_ADDITIONS += undefined.txt + +all: ${ARCH} $(PGM) + +$(PGM): $(OBJS) + -$(make-exe) diff --git a/testsuite/init01/init.c b/testsuite/init01/init.c new file mode 100644 index 00000000..422e7f53 --- /dev/null +++ b/testsuite/init01/init.c @@ -0,0 +1,79 @@ +/* + * Simple test program -- simplified version of sample test hello. + * + * $Id$ + */ + +#include <bsp.h> +#include <stdlib.h> +#include <stdio.h> +#include <freebsd/bsd.h> + +/* XXX temporary until in .h file */ +void rtems_initialize_interfaces(void); + +rtems_task Init( + rtems_task_argument ignored +) +{ + printf( "\n\n*** LIBFREEBSD INITIALIZATION TEST ***\n" ); + /* + * BSD must support the new "shared IRQ PIC implementation" at this point. + * BSPs must also provide rtems_interrupt_server_initialize() which + * just requires including irq-server.[ch] in their build. + */ + + rtems_bsd_initialize_with_interrupt_server(); + + puts( "Initializing interfaces" ); + rtems_initialize_interfaces(); + + puts( "Sleeping to see what happens" ); + sleep( 5 ); + + printf( "*** END OF LIBFREEBSD INITIALIZATION TEST ***\n" ); + exit( 0 ); +} + +/* configuration information */ + +/* NOTICE: the clock driver is explicitly disabled */ +#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER +#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER + +#define CONFIGURE_APPLICATION_NEEDS_LIBBLOCK +#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM + +#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32 + +#define CONFIGURE_UNLIMITED_OBJECTS +#define CONFIGURE_UNIFIED_WORK_AREAS + +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE + +#define CONFIGURE_INIT +#include <rtems/confdefs.h> + +/* + * FreeBSD TCP/IP Initialization + */ + +#include <freebsd/machine/rtems-bsd-sysinit.h> + +#define CONFIGURE_NEED_NET +/* only include FXP and PCI for i386/pc386 for debug on qemu (for now) */ +#if defined(i386) + #define CONFIGURE_NEED_PCIB + #define CONFIGURE_NEED_NET_IF_FXP +#endif + +/* + * This is correct for the PC + */ +char static_hints[] = { + "hint.fxp.0.prefer_iomap=1\0\n" +}; + +#include "nic-sysinit.h" + +/* end of file */ diff --git a/testsuite/init01/nic-sysinit.h b/testsuite/init01/nic-sysinit.h new file mode 100644 index 00000000..dbad732d --- /dev/null +++ b/testsuite/init01/nic-sysinit.h @@ -0,0 +1,85 @@ +/** + * @file + * + * @ingroup demo + * + * @brief TODO. + */ + +/* + * COPYRIGHT (c) 2012. On-Line Applications Research Corporation (OAR). + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + */ + + +#include <freebsd/machine/rtems-bsd-sysinit.h> + +/* + * We "read" that and generate references and nexus devices + */ + +#if defined(CONFIGURE_NEED_NET) + SYSINIT_NEED_FREEBSD_CORE; +#endif +#if defined(CONFIGURE_NEED_USB) + SYSINIT_NEED_USB_CORE; +#endif +#if defined(CONFIGURE_NEED_PCIB) + SYSINIT_NEED_PCIB; +#endif +#if defined(CONFIGURE_NEED_NET_IF_FXP) + SYSINIT_NEED_NET_IF_FXP; +#endif +#if defined(CONFIGURE_NEED_NET_IF_DC) + SYSINIT_NEED_NET_IF_DC; +#endif +#if defined(CONFIGURE_NEED_NET_IF_BFE) + SYSINIT_NEED_NET_IF_BFE; +#endif +#if defined(CONFIGURE_NEED_NET_IF_RE) + SYSINIT_NEED_NET_IF_RE; +#endif +#if defined(CONFIGURE_NEED_NET_IF_EM) + SYSINIT_NEED_NET_IF_EM; +#endif +#if defined(CONFIGURE_NEED_NET_IF_IGB) + SYSINIT_NEED_NET_IF_IGB; +#endif +#if defined(CONFIGURE_NEED_NET_IF_BCE) + SYSINIT_NEED_NET_IF_BCE; +#endif +#if defined(CONFIGURE_NEED_NET_IF_LEM) + SYSINIT_NEED_NET_IF_LEM; +#endif +#if defined(CONFIGURE_NEED_NET_IF_BGE) + SYSINIT_NEED_NET_IF_BGE; // does not link 29 June 2012 +#endif + +const char *const _bsd_nexus_devices [] = { + #if defined(CONFIGURE_NEED_PCIB) + "legacy", + #endif + NULL +}; + diff --git a/testsuite/init01/test_main.c b/testsuite/init01/test_main.c new file mode 100644 index 00000000..3e7c43e8 --- /dev/null +++ b/testsuite/init01/test_main.c @@ -0,0 +1,23 @@ +/* + * This is the body of the test. It does not do much except ensure + * that the target is alive after initializing the TCP/IP stack. + */ + +#include <bsp.h> +#include <stdlib.h> +#include <stdio.h> +#include <freebsd/bsd.h> + +void print_test_name(void) +{ + printf( "\n\n*** LIBFREEBSD INITIALIZATION TEST ***\n" ); +} + +void test_main(void) +{ + puts( "Sleeping to see what happens" ); + sleep( 5 ); + + printf( "*** END OF LIBFREEBSD INITIALIZATION TEST ***\n" ); + exit( 0 ); +} |