<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>change log for examples-v2 (2010-05-05)</title>
</head>
<body text='#000000' bgcolor='#ffffff'>
<a name='cs1'></a>
<table border='0' cellspacing='0' cellpadding='5' width='100%' bgcolor='#eeeeee'>
<tr><td colspan='3' bgcolor='#dddddd'>
 <font color='#bb2222'><strong>joel</strong></font>
</td></tr>
<tr><td colspan='3' bgcolor='#dddddd'><pre>2010-05-05 Joel Sherrill <joel.sherrill@oarcorp.com>

        * qemu_vfat/.cvsignore, qemu_vfat/Makefile, qemu_vfat/README,
        qemu_vfat/init.c, qemu_vfat/system.h: New files.
</pre></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//examples-v2/misc/ChangeLog.diff?r1=text&tr1=1.9&r2=text&tr2=1.10&diff_format=h">M</a></td><td width='1%'>1.10</td><td width='100%'>misc/ChangeLog</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//examples-v2/misc/qemu_vfat/.cvsignore?rev=1.1&content-type=text/vnd.viewcvs-markup">A</a></td><td width='1%'><font color="#000088">1.1</font></td><td width='100%'><font color="#000088">misc/qemu_vfat/.cvsignore</font></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//examples-v2/misc/qemu_vfat/Makefile?rev=1.1&content-type=text/vnd.viewcvs-markup">A</a></td><td width='1%'><font color="#000088">1.1</font></td><td width='100%'><font color="#000088">misc/qemu_vfat/Makefile</font></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//examples-v2/misc/qemu_vfat/README?rev=1.1&content-type=text/vnd.viewcvs-markup">A</a></td><td width='1%'><font color="#000088">1.1</font></td><td width='100%'><font color="#000088">misc/qemu_vfat/README</font></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//examples-v2/misc/qemu_vfat/init.c?rev=1.1&content-type=text/vnd.viewcvs-markup">A</a></td><td width='1%'><font color="#000088">1.1</font></td><td width='100%'><font color="#000088">misc/qemu_vfat/init.c</font></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//examples-v2/misc/qemu_vfat/system.h?rev=1.1&content-type=text/vnd.viewcvs-markup">A</a></td><td width='1%'><font color="#000088">1.1</font></td><td width='100%'><font color="#000088">misc/qemu_vfat/system.h</font></td></tr>
</table>
<pre>
<font color='#006600'>diff -u examples-v2/misc/ChangeLog:1.9 examples-v2/misc/ChangeLog:1.10
--- examples-v2/misc/ChangeLog:1.9      Thu Apr 15 16:26:11 2010
+++ examples-v2/misc/ChangeLog  Wed May  5 10:06:28 2010
</font><font color='#997700'>@@ -1,3 +1,8 @@
</font><font color='#000088'>+2010-05-05    Joel Sherrill <joel.sherrill@oarcorp.com>
+
+       * qemu_vfat/.cvsignore, qemu_vfat/Makefile, qemu_vfat/README,
+       qemu_vfat/init.c, qemu_vfat/system.h: New files.
+
</font> 2010-04-15        Joel Sherrill <joel.sherrill@oarcorp.com>
 
        * x86_display_cpu/Makefile, x86_display_cpu/test.c: Clean up.

<font color='#006600'>diff -u /dev/null examples-v2/misc/qemu_vfat/.cvsignore:1.1
--- /dev/null   Wed May  5 10:10:06 2010
+++ examples-v2/misc/qemu_vfat/.cvsignore       Wed May  5 10:06:28 2010
</font><font color='#997700'>@@ -0,0 +1 @@
</font><font color='#000088'>+o-optimize
</font>
<font color='#006600'>diff -u /dev/null examples-v2/misc/qemu_vfat/Makefile:1.1
--- /dev/null   Wed May  5 10:10:06 2010
+++ examples-v2/misc/qemu_vfat/Makefile Wed May  5 10:06:28 2010
</font><font color='#997700'>@@ -0,0 +1,32 @@
</font><font color='#000088'>+#
+#  $Id$
+#
+
+#
+#  RTEMS_MAKEFILE_PATH is typically set in an environment variable
+#
+
+PGM=${ARCH}/qemu_vfat.exe
+
+# optional managers required
+MANAGERS=all
+
+# C source names
+CSRCS = init.c
+COBJS = $(CSRCS:%.c=${ARCH}/%.o)
+
+include $(RTEMS_MAKEFILE_PATH)/Makefile.inc
+include $(RTEMS_CUSTOM)
+include $(PROJECT_ROOT)/make/leaf.cfg
+
+# Define this if you want to run the shell after mounting
+# DEFINES += -DUSE_SHELL
+# Defint this if you want to call start_test() instead
+DEFINES += -DUSE_START_TEST
+
+OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS)
+
+all:    ${ARCH} $(PGM)
+
+$(PGM): $(OBJS)
+       $(make-exe)
</font>
<font color='#006600'>diff -u /dev/null examples-v2/misc/qemu_vfat/README:1.1
--- /dev/null   Wed May  5 10:10:06 2010
+++ examples-v2/misc/qemu_vfat/README   Wed May  5 10:06:28 2010
</font><font color='#997700'>@@ -0,0 +1,19 @@
</font><font color='#000088'>+#
+#  $Id$
+#
+
+This directory contains an example program which should be of use
+in some situations.  It is designed to be used with Qemu's
+virtual FAT file system support.  Qemu can make a directory on
+the host computer appear as a FAT file system to the simulated
+system. This capability appears to have limits on the number
+and size of files as well as some limitations about writes
+from the simulated system appearing in the native file system.
+But this should be useful for testing interpreters like Parrot,
+Mono, or the RTEMS Shell.<span style="background-color: #FF0000">  </span>
+
+When testing an interpreter, you often want to have the same
+executable exercised with different arguments or input files.
+With this setup, you can copy those test support files into<span style="background-color: #FF0000"> </span>
+the host directory and the RTEMS "main" will use those in
+support of the testing.
</font>
<font color='#006600'>diff -u /dev/null examples-v2/misc/qemu_vfat/init.c:1.1
--- /dev/null   Wed May  5 10:10:07 2010
+++ examples-v2/misc/qemu_vfat/init.c   Wed May  5 10:06:28 2010
</font><font color='#997700'>@@ -0,0 +1,164 @@
</font><font color='#000088'>+/*
+ *  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$
+ */
+
+#define CONFIGURE_INIT
+#include "system.h"
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <rtems.h>
+#include <fcntl.h>
+#include <rtems/error.h>
+#include <rtems/dosfs.h>
+#include <ctype.h>
+#include <rtems/bdpart.h>
+#include <rtems/libcsupport.h>
+#include <rtems/fsmount.h>
+
+/*
+ * Table of FAT file systems that will be mounted
+ * with the "rtems_fsmount" function.
+ * See cpukit/libmisc/fsmount for definition of fields
+ */
+fstab_t fs_table[] = {
+  {
+    "/dev/hda1", "/mnt/test",
+    &msdos_ops, RTEMS_FILESYSTEM_READ_WRITE,
+    FSMOUNT_MNT_OK | FSMOUNT_MNTPNT_CRTERR | FSMOUNT_MNT_FAILED,
+    0
+  },
+};
+
+#ifndef USE_SHELL
+void start_test(void);
+#endif
+
+#ifdef USE_SHELL
+#include <rtems/shell.h>
+
+static void writeFile(
+  const char *name,
+  mode_t      mode,
+  const char *contents
+)
+{
+  int sc;
+  sc = setuid(0);
+  if ( sc ) {
+    printf( "setuid failed: %s: %s\n", name, strerror(errno) );
+  }
+
+  rtems_shell_write_file( name, contents );
+
+  sc = chmod ( name, mode );
+  if ( sc ) {
+    printf( "chmod %s: %s\n", name, strerror(errno) );
+  }
+}
+
+#define writeScript( _name, _contents ) \
+        writeFile( _name, 0777, _contents )
+
+static void fileio_start_shell(void)
+{
+  int sc;
+
+  sc = mkdir("/scripts", 0777);
+  if ( sc ) {
+    printf( "mkdir /scripts: %s:\n", strerror(errno) );
+  }
+
+  sc = mkdir("/etc", 0777);
+  if ( sc ) {
+    printf( "mkdir /etc: %s:\n", strerror(errno) );
+  }
+
+  fprintf(
+    stderr,<span style="background-color: #FF0000"> </span>
+    "Creating /etc/passwd and group with three useable accounts\n"
+    "root/pwd , test/pwd, rtems/NO PASSWORD"
+  );
+
+  writeFile(
+    "/etc/passwd",
+    0644,
+    "root:7QR4o148UPtb.:0:0:root::/:/bin/sh\n"
+    "rtems:*:1:1:RTEMS Application::/:/bin/sh\n"
+    "test:8Yy.AaxynxbLI:2:2:test account::/:/bin/sh\n"
+    "tty:!:3:3:tty owner::/:/bin/false\n"
+  );
+  writeFile(
+    "/etc/group",
+    0644,
+    "root:x:0:root\n"
+    "rtems:x:1:rtems\n"
+    "test:x:2:test\n"
+    "tty:x:3:tty\n"
+  );
+
+  rtems_shell_init(
+    "SHLL",                          /* task_name */
+    RTEMS_MINIMUM_STACK_SIZE * 4,    /* task_stacksize */
+    100,                             /* task_priority */
+    "/dev/console",                  /* devname */
+    false,                           /* forever */
+    true,                            /* wait */
+    rtems_shell_login_check          /* login */
+  );
+}
+#endif /* USE_SHELL */
+
+/*
+ * RTEMS Startup Task
+ */
+rtems_task
+Init (rtems_task_argument ignored)
+{
+  rtems_status_code rc;
+
+  puts( "\n\n*** QEMU VFAT AND SHELL TEST ***" );
+
+  rc = rtems_bdpart_register_from_disk("/dev/hda");
+  if ( rc != RTEMS_SUCCESSFUL ) {
+    fprintf( stderr, "Unable to initialize partition table from /dev/hda\n" );
+    exit(1);
+  }
+
+  rc = rtems_fsmount(
+    fs_table,
+    sizeof(fs_table)/sizeof(fs_table[0]),
+    NULL
+  );
+  if ( rc != RTEMS_SUCCESSFUL ) {
+    fprintf( stderr, "Unable to mount /dev/hda1\n" );
+    exit(1);
+  }
+
+#if defined(USE_SHELL)
+  fileio_start_shell ();
+#endif
+#if defined(USE_START_TEST)
+  start_test ();
+#endif
+  puts( "*** END OF QEMU VFAT AND SHELL TEST ***" );
+  exit(0);
+}
+
+#if defined(USE_SHELL)
+
+#define CONFIGURE_SHELL_COMMANDS_INIT
+#define CONFIGURE_SHELL_COMMANDS_ALL
+#define CONFIGURE_SHELL_MOUNT_MSDOS
+
+#include <rtems/shellconfig.h>
+#endif
</font>
<font color='#006600'>diff -u /dev/null examples-v2/misc/qemu_vfat/system.h:1.1
--- /dev/null   Wed May  5 10:10:07 2010
+++ examples-v2/misc/qemu_vfat/system.h Wed May  5 10:06:28 2010
</font><font color='#997700'>@@ -0,0 +1,118 @@
</font><font color='#000088'>+/*  system.h
+ *
+ *  This include file contains information that is included in every
+ *  function in the test set.
+ *
+ *  COPYRIGHT (c) 1989-2009.
+ *  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.
+ *
+ *  system.h,v 1.13 2000/06/12 15:00:12 joel Exp
+ */
+
+#include <rtems.h>
+
+/* functions */
+
+rtems_task Init(
+  rtems_task_argument argument
+);
+
+/* global variables */
+
+
+/* configuration information */
+
+#include <bsp.h> /* for device driver prototypes */
+
+#define FILEIO_BUILD 1
+#if BSP_SMALL_MEMORY
+#undef FILEIO_BUILD
+#endif
+
+#if defined(RTEMS_BSP_HAS_IDE_DRIVER) && !BSP_SMALL_MEMORY
+#include <libchip/ata.h> /* for ata driver prototype */
+#include <libchip/ide_ctrl.h> /* for general ide driver prototype */
+#endif
+
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+#ifdef RTEMS_BSP_HAS_IDE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_IDE_DRIVER
+#endif
+#define CONFIGURE_APPLICATION_NEEDS_LIBBLOCK
+#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
+
+/*
+ * XXX: these values are higher than needed...
+ */
+#define CONFIGURE_MAXIMUM_TASKS             20
+#define CONFIGURE_MAXIMUM_SEMAPHORES        20
+#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES    20
+#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 20
+#define CONFIGURE_STACK_CHECKER_ENABLED
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_EXTRA_TASK_STACKS         (6 * RTEMS_MINIMUM_STACK_SIZE)
+
+#define CONFIGURE_MALLOC_STATISTICS
+
+#define CONFIGURE_UNIFIED_WORK_AREAS
+#include <rtems/confdefs.h>
+
+/*
+ *  Handy macros and static inline functions
+ */
+
+/*
+ *  Macro to hide the ugliness of printing the time.
+ */
+
+#define print_time(_s1, _tb, _s2) \
+  do { \
+    printf( "%s%02d:%02d:%02d   %02d/%02d/%04d%s", \
+       _s1, (_tb)->hour, (_tb)->minute, (_tb)->second, \
+       (_tb)->month, (_tb)->day, (_tb)->year, _s2 ); \
+    fflush(stdout); \
+  } while ( 0 )
+
+/*
+ *  Macro to print an task name that is composed of ASCII characters.
+ *
+ */
+
+#define put_name( _name, _crlf ) \
+  do { \
+    uint32_t   c0, c1, c2, c3; \
+    \
+    c0 = ((_name) >> 24) & 0xff; \
+    c1 = ((_name) >> 16) & 0xff; \
+    c2 = ((_name) >> 8) & 0xff; \
+    c3 = (_name) & 0xff; \
+    putchar( (char)c0 ); \
+    if ( c1 ) putchar( (char)c1 ); \
+    if ( c2 ) putchar( (char)c2 ); \
+    if ( c3 ) putchar( (char)c3 ); \
+    if ( (_crlf) ) \
+      putchar( '\n' ); \
+  } while (0)
+
+/*
+ *  This allows us to view the "Test_task" instantiations as a set
+ *  of numbered tasks by eliminating the number of application
+ *  tasks created.
+ *
+ *  In reality, this is too complex for the purposes of this
+ *  example.  It would have been easier to pass a task argument. :)
+ *  But it shows how rtems_id's can sometimes be used.
+ */
+
+#define task_number( tid ) \
+  ( rtems_object_id_get_index( tid ) - \
+      rtems_configuration_get_rtems_api_configuration()-> \
+        number_of_initialization_tasks )
+
+/* end of include file */
</font></pre>
<p> </p>

<p>--<br />
<small>Generated by <a href="http://www.codewiz.org/projects/index.html#loginfo">Deluxe Loginfo</a> 2.122 by Bernardo Innocenti <bernie@develer.com></small></p>
</body>
</html>