--- /dev/null
+/* Init
+ *
+ * This routine is the initialization task for this test program.
+ * It is called from init_exec and has the responsibility for creating
+ * and starting the tasks that make up the test. If the time of day
+ * clock is required for the test, it should also be set to a known
+ * value by this function.
+ *
+ * Input parameters: NONE
+ *
+ * Output parameters: NONE
+ *
+ * COPYRIGHT (c) 1989-1999.
+ * 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: init.c,v 1.12.4.1 2003/09/04 18:46:30 joel Exp $
+ */
+
+#define CONFIGURE_INIT
+#include <system_def.h>
+#include "system.h"
+#include "app_def.h"
+#include "appl_config.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <rtems/error.h>
+#include <rtems/monitor.h>
+#include <rtems/shell.h>
+#include <rtems/untar.h>
+
+#ifdef CONFIG_OC_APP_APPDL_NET
+#include <rtems/rtems_bsdnet.h>
+
+#include "networkconfig.h"
+#endif /*CONFIG_OC_APP_APPDL_NET*/
+
+#include <sys/types.h>
+
+#ifdef CONFIG_OC_APP_APPDL_NET
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <arpa/inet.h>
+#endif /*CONFIG_OC_APP_APPDL_NET*/
+
+#include <string.h>
+#include <unistd.h>
+
+#define CONFIGURE_SHELL_COMMANDS_INIT
+#define CONFIGURE_SHELL_COMMANDS_ALL
+#define CONFIGURE_SHELL_COMMANDS_ALL_NETWORKING
+#define CONFIGURE_SHELL_MOUNT_MSDOS
+#define CONFIGURE_SHELL_MOUNT_NFS
+
+#include <rtems/shellconfig.h>
+
+#define BUILD_VERSION_STRING(major,minor,patch) \
+ __XSTRING(major) "." __XSTRING(minor) "." __XSTRING(patch)
+
+#define RTEMS_VER_CODE VER_CODE(__RTEMS_MAJOR__ ,__RTEMS_MINOR__ ,__RTEMS_REVISION__)
+
+#if RTEMS_VER_CODE < VER_CODE(4,7,99)
+ #define rtems_shell_add_cmd shell_add_cmd
+ #define rtems_shell_init(m_task_name,m_task_stacksize,m_task_priority,m_devname,m_forever,m_wait,m_login_check) \
+ shell_init(m_task_name,m_task_stacksize,m_task_priority,m_devname,B19200 | CS8,m_forever)
+#elif RTEMS_VER_CODE < VER_CODE(4,9,99)
+ #define rtems_shell_init(m_task_name,m_task_stacksize,m_task_priority,m_devname,m_forever,m_wait,m_login_check) \
+ rtems_shell_init(m_task_name,m_task_stacksize,m_task_priority,m_devname,m_forever,m_wait)
+#endif
+
+extern int _binary_rootfs_tarfile_start;
+extern int _binary_rootfs_tarfile_size;
+#define TARFILE_START _binary_rootfs_tarfile_start
+#define TARFILE_SIZE _binary_rootfs_tarfile_size
+
+#ifdef CONFIG_OC_APP_APPDL_TELNETD
+#include <rtems/telnetd.h>
+
+rtems_telnetd_config_table rtems_telnetd_config;
+
+void run_telnetd_command(char *device_name, void *arg)
+{
+ rtems_shell_env_t shell_env;
+
+ rtems_shell_dup_current_env(&shell_env);
+ shell_env.taskname = NULL;
+ shell_env.devname = device_name;
+ rtems_shell_main_loop(&shell_env);
+}
+#endif /*CONFIG_OC_APP_APPDL_TELNETD*/
+
+void
+bad_rtems_status(rtems_status_code status, int fail_level, const char *text)
+{
+ printf("ERROR: %s status %s", text, rtems_status_text(status));
+ status = rtems_task_delete( RTEMS_SELF );
+}
+
+int testcmd_forshell(int argc, char **argv)
+{
+ int i;
+ printf("Command %s called\n",argv[0]);
+ for(i=1;i<argc;i++)
+ if(argv[i])
+ printf("%s",argv[i]);
+ printf("\n");
+ return 0;
+}
+
+rtems_task Init(
+ rtems_task_argument ignored
+)
+{
+ rtems_status_code status;
+
+ printf( "\n\nRTEMS v "
+ BUILD_VERSION_STRING(__RTEMS_MAJOR__ ,__RTEMS_MINOR__ ,__RTEMS_REVISION__)
+ "\n");
+
+ rtems_monitor_init(RTEMS_MONITOR_SUSPEND|RTEMS_MONITOR_GLOBAL);
+ /*rtems_capture_cli_init (0);*/
+
+ #ifdef CONFIG_OC_APP_APPDL_NET
+ if (rtems_bsdnet_initialize_network() < 0)
+ printf( "Network initialization failed\n");
+ else
+ printf( "Network initialization OK\n");
+ #endif /*CONFIG_OC_APP_APPDL_NET*/
+
+
+ printf( "Starting application " SW_VER_ID " v "
+ BUILD_VERSION_STRING(SW_VER_MAJOR,SW_VER_MINOR,SW_VER_PATCH)
+ "\n" );
+
+ status = Untar_FromMemory((unsigned char *)(&TARFILE_START), (long)&TARFILE_SIZE);
+
+ printf("Untar_FromMemory returned %s\n",rtems_status_text(status));
+
+ Task_1_name = rtems_build_name( 'T', 'S', 'K', '1' );
+
+ status = rtems_task_create(
+ Task_1_name,
+ TASK_1_PRIORITY,
+ RTEMS_MINIMUM_STACK_SIZE+0x10000,
+ RTEMS_DEFAULT_MODES /*& ~(RTEMS_TIMESLICE_MASK) | RTEMS_TIMESLICE*/,
+ RTEMS_DEFAULT_ATTRIBUTES,
+ &Task_1_id
+ );
+ check_rtems_status(status, 0, "rtems_task_create of Task_1");
+
+ status = rtems_task_start( Task_1_id, Task_1, 0 );
+ check_rtems_status(status, 0, "rtems_task_start of Task_1\n");
+
+ rtems_shell_init("SHLL",RTEMS_MINIMUM_STACK_SIZE+0x1000,
+ SHELL_TASK_PRIORITY,"/dev/console",1,0, NULL);
+
+ rtems_shell_add_cmd("testcmd", "app",
+ "test command for shell",
+ testcmd_forshell);
+
+ //rtems_monitor_wakeup();
+
+ #ifdef CONFIG_OC_APP_APPDL_TELNETD
+ rtems_telnetd_config.command = run_telnetd_command;
+ rtems_telnetd_config.arg = NULL;
+ rtems_telnetd_config.priority = SHELL_TASK_PRIORITY;
+ rtems_telnetd_config.stack_size = RTEMS_MINIMUM_STACK_SIZE+0x1000;
+ rtems_telnetd_config.login_check = NULL;
+ rtems_telnetd_config.keep_stdio = 0;
+
+ status = rtems_telnetd_initialize();
+ check_rtems_status(status, 0, "rtems_telnetd_initialize\n");
+ #endif /*CONFIG_OC_APP_APPDL_TELNETD*/
+
+ status = rtems_task_delete( RTEMS_SELF );
+
+ printf( "*** END OF TEST2 ***\n" );
+ exit( 0 );
+}
--- /dev/null
+#ifndef __NETWORKCONFIG_H__
+#define __NETWORKCONFIG_H__
+
+#include <rtems/rtems_bsdnet.h>
+#include <rtems/rtems_dhcp_failsafe.h>
+#include <bsp.h>
+
+static char ethernet_address[6] = {0x00, 0x04, 0x9F, 0x00, 0x27, 0x50 };
+
+static struct rtems_bsdnet_ifconfig netdriver_config = {
+ .name = RTEMS_BSP_NETWORK_DRIVER_NAME,
+ .attach = RTEMS_BSP_NETWORK_DRIVER_ATTACH,
+ .next = NULL,
+ .ip_address = "192.168.2.66",
+ .ip_netmask = "255.255.255.0",
+ .hardware_address = ethernet_address,
+ .ignore_broadcast = 0,
+ .mtu = 0,
+ .rbuf_count = 0,
+ .xbuf_count = 0,
+ .port = 0,
+ .irno = 0,
+ .bpar = 0,
+ .drv_ctrl = NULL
+};
+
+struct rtems_bsdnet_config rtems_bsdnet_config = {
+ .ifconfig = &netdriver_config,
+/* .bootp = rtems_bsdnet_do_bootp,*/
+/* .bootp = rtems_bsdnet_do_dhcp,*/
+ .bootp = rtems_bsdnet_do_dhcp_failsafe,
+ .network_task_priority = 0, /* 100 */
+ .mbuf_bytecount = 256 * 1024, /* 64 kbytes */
+ .mbuf_cluster_bytecount = 256 * 1024, /* 128 kbytes */
+ .hostname = NULL,
+ .domainname = NULL,
+ .gateway = "192.168.2.2",
+ .log_host = NULL,
+ .name_server = { "NULL" },
+ .ntp_server = { "NULL" },
+ .sb_efficiency = 0,
+ .udp_tx_buf_size = 0, /* UDP TX: 9216 bytes */
+ .udp_rx_buf_size = 0, /* UDP RX: 40 * (1024 + sizeof(struct sockaddr_in)) */
+ .tcp_tx_buf_size = 0, /* TCP TX: 16 * 1024 bytes */
+ .tcp_rx_buf_size = 0, /* TCP TX: 16 * 1024 bytes */
+};
+
+#endif
+
--- /dev/null
+/* system.h
+ *
+ * This include file contains information that is included in every
+ * function in the test set.
+ *
+ * COPYRIGHT (c) 1989-1999.
+ * 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: system.h,v 1.13.6.1 2003/09/04 18:46:30 joel Exp $
+ */
+
+#include <rtems.h>
+
+/* functions */
+
+rtems_task Init(
+ rtems_task_argument argument
+);
+
+/* configuration information */
+
+#include <bsp.h> /* for device driver prototypes */
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_LIBBLOCK
+
+#define TICKS_PER_SECOND 1000
+
+#define CONFIGURE_MAXIMUM_TIMERS 32
+#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES 32
+#define CONFIGURE_MAXIMUM_SEMAPHORES 32
+#define CONFIGURE_MAXIMUM_TASKS 32
+#define CONFIGURE_MAXIMUM_PERIODS 4
+#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 2
+#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 32
+/*#define CONFIGURE_MAXIMUM_DRIVERS (CONFIGURE_NUMBER_OF_DRIVERS+10)*/
+#define CONFIGURE_MAXIMUM_DRIVERS 32
+
+#ifdef RTEMS_POSIX_API
+#define CONFIGURE_MAXIMUM_POSIX_THREADS 32
+#define CONFIGURE_MAXIMUM_POSIX_MUTEXES 20
+#define CONFIGURE_MAXIMUM_POSIX_SEMAPHORES 10
+#define CONFIGURE_MAXIMUM_POSIX_KEYS 4
+#define CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS 8
+#endif /*RTEMS_POSIX_API*/
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_APPLICATION_NEEDS_NULL_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_ZERO_DRIVER
+
+#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
+/*#define CONFIGURE_USE_MINIIMFS_AS_BASE_FILESYSTEM*/
+#define CONFIGURE_FILESYSTEM_TFTPFS
+#define CONFIGURE_FILESYSTEM_FTPFS
+#define CONFIGURE_FILESYSTEM_NFS
+#define CONFIGURE_FILESYSTEM_DOSFS
+
+#define CONFIGURE_MICROSECONDS_PER_TICK 1000
+
+#define CONFIGURE_EXTRA_TASK_STACKS (10 * (RTEMS_MINIMUM_STACK_SIZE + 2 * 1024))
+
+#define CONFIGURE_INIT_TASK_STACK_SIZE (10*1024)
+#define CONFIGURE_INIT_TASK_PRIORITY 120
+#define CONFIGURE_INIT_TASK_INITIAL_MODES (RTEMS_PREEMPT | \
+ RTEMS_NO_TIMESLICE | \
+ RTEMS_NO_ASR | \
+ RTEMS_INTERRUPT_LEVEL(0))
+
+#include <rtems/confdefs.h>
+
+/* end of include file */