change log for examples-v2 (2011-03-11)

rtems-vc at rtems.org rtems-vc at rtems.org
Fri Mar 11 19:10:04 UTC 2011


 *joel*:
2011-03-11	Joel Sherrill <joel.sherrill at oarcorp.com>

	* fat_ramdisk/.cvsignore, fat_ramdisk/Makefile, fat_ramdisk/README,
	fat_ramdisk/init.c, fat_ramdisk/rootfs/shell-init: New files.

M    1.6  file_io/ChangeLog
A    1.1  file_io/fat_ramdisk/.cvsignore
A    1.1  file_io/fat_ramdisk/Makefile
A    1.1  file_io/fat_ramdisk/README
A    1.1  file_io/fat_ramdisk/init.c
A    1.1  file_io/fat_ramdisk/rootfs/shell-init

diff -u examples-v2/file_io/ChangeLog:1.5 examples-v2/file_io/ChangeLog:1.6
--- examples-v2/file_io/ChangeLog:1.5	Fri Mar 11 11:35:58 2011
+++ examples-v2/file_io/ChangeLog	Fri Mar 11 12:37:57 2011
@@ -1,5 +1,10 @@
 2011-03-11	Joel Sherrill <joel.sherrill at oarcorp.com>
 
+	* fat_ramdisk/.cvsignore, fat_ramdisk/Makefile, fat_ramdisk/README,
+	fat_ramdisk/init.c, fat_ramdisk/rootfs/shell-init: New files.
+
+2011-03-11	Joel Sherrill <joel.sherrill at oarcorp.com>
+
 	* Makefile: Add new example of untar to load initial contents of IMFS.
 	* crc/.cvsignore, crc/LICENSE, crc/Makefile, crc/README, crc/crc.h,
 	crc/crc_32.c, crc/init.c, crc/sniptype.h, crc/rootfs/image.img: New

diff -u /dev/null examples-v2/file_io/fat_ramdisk/.cvsignore:1.1
--- /dev/null	Fri Mar 11 13:10:04 2011
+++ examples-v2/file_io/fat_ramdisk/.cvsignore	Fri Mar 11 12:37:57 2011
@@ -0,0 +1,4 @@
+o-optimize
+FilesystemImage
+FilesystemImage.c
+FilesystemImage.h

diff -u /dev/null examples-v2/file_io/fat_ramdisk/Makefile:1.1
--- /dev/null	Fri Mar 11 13:10:04 2011
+++ examples-v2/file_io/fat_ramdisk/Makefile	Fri Mar 11 12:37:57 2011
@@ -0,0 +1,41 @@
+#
+#  $Id$
+#
+
+#
+#  RTEMS_MAKEFILE_PATH is typically set in an environment variable
+#
+
+PGM=${ARCH}/fat_ramdisk.exe
+
+# optional managers required
+MANAGERS=all
+
+# C source names
+CSRCS = init.c FilesystemImage.c
+COBJS = $(CSRCS:%.c=${ARCH}/%.o)
+
+CLEAN_ADDITIONS += stamp-fs-image
+CLEAN_ADDITIONS += FilesystemImage FilesystemImage.c FilesystemImage.h
+
+include $(RTEMS_MAKEFILE_PATH)/Makefile.inc
+include $(RTEMS_CUSTOM)
+include $(PROJECT_ROOT)/make/leaf.cfg
+
+OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS)
+
+all:    ${ARCH} $(OBJS) $(PGM)
+
+$(ARCH)/init.o: init.c stamp-fs-image
+
+FilesystemImage: $(ARCH) rootfs/shell-init
+	cd rootfs ; \
+	    tar cf ../FilesystemImage --exclude CVS --exclude .cvsignore .
+
+stamp-fs-image: $(ARCH) FilesystemImage
+	$(PROJECT_ROOT)/bin/rtems-bin2c FilesystemImage FilesystemImage
+	ls -l Filesystem*
+	touch stamp-fs-image
+
+$(PGM): $(OBJS)
+	$(make-exe)

diff -u /dev/null examples-v2/file_io/fat_ramdisk/README:1.1
--- /dev/null	Fri Mar 11 13:10:04 2011
+++ examples-v2/file_io/fat_ramdisk/README	Fri Mar 11 12:37:57 2011
@@ -0,0 +1,9 @@
+#
+#  $Id$
+#
+
+This is a simple example which illustrates how to use the
+In-Memory File System (IMFS) in conjunction with "untar" to
+load the initial contents.
+
+Thanks to Gedare Bloom for the code this is based upon.

diff -u /dev/null examples-v2/file_io/fat_ramdisk/init.c:1.1
--- /dev/null	Fri Mar 11 13:10:04 2011
+++ examples-v2/file_io/fat_ramdisk/init.c	Fri Mar 11 12:37:57 2011
@@ -0,0 +1,163 @@
+/*
+ *  COPYRIGHT (c) 1989-2011.
+ *  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$
+ */
+
+
+#include <bsp.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <rtems/ramdisk.h>
+#include <rtems/error.h>
+#include <rtems/untar.h>
+#include <rtems/shell.h>
+
+#include "FilesystemImage.h"
+
+
+/**
+ * The RAM Disk configuration.
+ */
+rtems_ramdisk_config rtems_ramdisk_configuration[] =
+{
+  {
+    block_size: 256,
+    block_num:  1024,
+    location:   NULL
+  }
+};
+
+/**
+ * The number of RAM Disk configurations.
+ */
+size_t rtems_ramdisk_configuration_size = 1;
+
+/**
+ * Create the RAM Disk Driver entry.
+ */
+rtems_driver_address_table rtems_ramdisk_io_ops = {
+  initialization_entry: ramdisk_initialize,
+  open_entry:           rtems_blkdev_generic_open,
+  close_entry:          rtems_blkdev_generic_close,
+  read_entry:           rtems_blkdev_generic_read,
+  write_entry:          rtems_blkdev_generic_write,
+  control_entry:        rtems_blkdev_generic_ioctl
+};
+
+#define RTEMS_DRIVER_AUTO_MAJOR (0)
+
+int setup_ramdisk (const char* mntpath)
+{
+  rtems_device_major_number major;
+  rtems_status_code         sc;
+  
+  /*
+   * Register the RAM Disk driver.
+   */
+  printf ("Register RAM Disk Driver: ");
+  sc = rtems_io_register_driver (RTEMS_DRIVER_AUTO_MAJOR,
+                                 &rtems_ramdisk_io_ops,
+                                 &major);
+  if (sc != RTEMS_SUCCESSFUL) {
+    printf ("error: ramdisk driver not initialised: %s\n",
+            rtems_status_text (sc));
+    return 1;
+  }
+
+  printf ("successful\n");
+  return 0;
+}
+
+/**
+ * Run the /shell-init script.
+ */
+void shell_init_script(void)
+{
+  rtems_status_code sc;
+  printf("Running /shell-init....\n\n");
+  sc = rtems_shell_script("fstst", 60 * 1024, 160, "/shell-init", "stdout",
+                           0, 1, 1);
+  if (sc != RTEMS_SUCCESSFUL)
+    printf("error: running shell script: %s (%d)\n",
+             rtems_status_text (sc), sc);
+}
+
+/**
+ * Start the RTEMS Shell.
+ */
+void shell_start ()
+{
+  rtems_status_code sc;
+  printf ("Starting shell....\n\n");
+  sc = rtems_shell_init ("fstst", 60 * 1024, 150, "/dev/console", 0, 1, NULL);
+  if (sc != RTEMS_SUCCESSFUL)
+    printf ("error: starting shell: %s (%d)\n", rtems_status_text (sc), sc);
+}
+
+
+
+rtems_task Init(
+  rtems_task_argument ignored
+)
+{
+  int ret;
+
+  puts( "\n\n*** ramdisk/fat example ***" );
+
+  printf("Unpacking tar filesystem\nThis may take awhile...\n");
+  if(Untar_FromMemory(FilesystemImage, FilesystemImage_size) != 0) {
+    printf("Can't unpack tar filesystem\n");
+    exit(1);
+  }
+
+  ret = setup_ramdisk ("/mnt/ramdisk");
+  if (ret)
+    exit (ret);
+
+  shell_init_script();
+  shell_start();
+
+  printf( "*** end of demonstration ***\n" );
+  exit( 0 );
+}
+
+
+/* configuration */
+
+#define CONFIGURE_SHELL_COMMANDS_INIT
+#define CONFIGURE_SHELL_COMMANDS_ALL
+#define CONFIGURE_SHELL_MOUNT_MSDOS
+
+#include <rtems/shellconfig.h>
+
+/* drivers */
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
+
+/* filesystem */
+#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
+#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS   40
+#define CONFIGURE_IMFS_MEMFILE_BYTES_PER_BLOCK    512
+#define CONFIGURE_MAXIMUM_DRIVERS                  10
+
+#define CONFIGURE_APPLICATION_NEEDS_LIBBLOCK
+#define CONFIGURE_SWAPOUT_TASK_PRIORITY            10
+
+#define CONFIGURE_MAXIMUM_TASKS                    rtems_resource_unlimited (10)
+#define CONFIGURE_MAXIMUM_SEMAPHORES               rtems_resource_unlimited (10)
+#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES           rtems_resource_unlimited (5)
+#define CONFIGURE_MAXIMUM_PARTITIONS               rtems_resource_unlimited (2)
+#define CONFIGURE_UNIFIED_WORK_AREAS
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_INIT
+#include <rtems/confdefs.h>
+/* end of file */

diff -u /dev/null examples-v2/file_io/fat_ramdisk/rootfs/shell-init:1.1
--- /dev/null	Fri Mar 11 13:10:04 2011
+++ examples-v2/file_io/fat_ramdisk/rootfs/shell-init	Fri Mar 11 12:37:57 2011
@@ -0,0 +1,3 @@
+mkdos /dev/ramdisk0
+mkdir /rd
+mount -t msdos /dev/ramdisk0 /rd



--

Generated by Deluxe Loginfo [http://www.codewiz.org/projects/index.html#loginfo] 2.122 by Bernardo Innocenti <bernie at develer.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/vc/attachments/20110311/686b59ae/attachment-0001.html>


More information about the vc mailing list