change log for rtems (2011-05-26)

rtems-vc at rtems.org rtems-vc at rtems.org
Fri May 27 00:10:13 UTC 2011


 *ccj* (on branch rtems-4-10-branch):
2011-05-27      Bo Hansen <mdboha at gmail.com>

        PR 1776/networking
        * libnetworking/rtems/rtems_glue.c: Higher resolution microtime()
        for SO_TIMESTAMP.

M 1.2346.2.92  cpukit/ChangeLog
M 1.52.2.1  cpukit/libnetworking/rtems/rtems_glue.c

diff -u rtems/cpukit/ChangeLog:1.2346.2.91 rtems/cpukit/ChangeLog:1.2346.2.92
--- rtems/cpukit/ChangeLog:1.2346.2.91	Wed May 25 09:18:10 2011
+++ rtems/cpukit/ChangeLog	Thu May 26 18:33:59 2011
@@ -1,3 +1,9 @@
+2011-05-27	Bo Hansen <mdboha at gmail.com>
+
+	PR 1776/networking
+	* libnetworking/rtems/rtems_glue.c: Higher resolution microtime()
+	for SO_TIMESTAMP.
+	
 2011-05-25	Ralf Corsépius <ralf.corsepius at rtems.org>
 
 	* include/rtems/bspIo.h, include/rtems/concat.h,

diff -u rtems/cpukit/libnetworking/rtems/rtems_glue.c:1.52 rtems/cpukit/libnetworking/rtems/rtems_glue.c:1.52.2.1
--- rtems/cpukit/libnetworking/rtems/rtems_glue.c:1.52	Thu Dec 17 14:26:09 2009
+++ rtems/cpukit/libnetworking/rtems/rtems_glue.c	Thu May 26 18:34:00 2011
@@ -676,11 +676,7 @@
 void
 microtime (struct timeval *t)
 {
-	rtems_interval now;
-
-	now = rtems_clock_get_ticks_since_boot();
-	t->tv_sec = now / rtems_bsdnet_ticks_per_second;
-	t->tv_usec = (now % rtems_bsdnet_ticks_per_second) * rtems_bsdnet_microseconds_per_tick;
+	rtems_clock_get_tod_timeval(t);
 }
 
 unsigned long


 *ccj* (on branch rtems-4-10-branch):
2011-05-27      Chris Johns <chrisj at rtems.org>

        * samples/fileio/init.c, samples/fileio/system.h: Add support for
        create a RAM disk from the shell to aid bug testing on the 4.10
        branch.

M 1.164.2.5  testsuites/ChangeLog
M 1.30.2.1  testsuites/samples/fileio/init.c
M 1.16.2.1  testsuites/samples/fileio/system.h

diff -u rtems/testsuites/ChangeLog:1.164.2.4 rtems/testsuites/ChangeLog:1.164.2.5
--- rtems/testsuites/ChangeLog:1.164.2.4	Tue Feb  8 00:40:11 2011
+++ rtems/testsuites/ChangeLog	Thu May 26 18:37:16 2011
@@ -1,3 +1,9 @@
+2011-05-27	Chris Johns <chrisj at rtems.org>
+
+	* samples/fileio/init.c, samples/fileio/system.h: Add support for
+	create a RAM disk from the shell to aid bug testing on the 4.10
+	branch.
+	
 2011-02-08	Ralf Corsépius <ralf.corsepius at rtems.org>
 
 	* support/include/tmacros.h: Remove PRIxblksize_t, PRIxblkcnt_t.

diff -u rtems/testsuites/samples/fileio/init.c:1.30 rtems/testsuites/samples/fileio/init.c:1.30.2.1
--- rtems/testsuites/samples/fileio/init.c:1.30	Tue Jun  1 19:47:15 2010
+++ rtems/testsuites/samples/fileio/init.c	Thu May 26 18:37:16 2011
@@ -29,14 +29,138 @@
 #include <errno.h>
 #include <rtems.h>
 #include <fcntl.h>
+#include <inttypes.h>
 #include <rtems/error.h>
 #include <rtems/dosfs.h>
 #include <ctype.h>
 #include <rtems/bdpart.h>
 #include <rtems/libcsupport.h>
 #include <rtems/fsmount.h>
+#include <rtems/ramdisk.h>
+#include <rtems/nvdisk.h>
+#include <rtems/nvdisk-sram.h>
 
 #if FILEIO_BUILD
+
+/**
+ * Let the IO system allocation the next available major number.
+ */
+#define RTEMS_DRIVER_AUTO_MAJOR (0)
+
+/*
+ * RAM disk driver so you can create a RAM disk from the shell prompt.
+ */
+/**
+ * The RAM Disk configuration.
+ */
+rtems_ramdisk_config rtems_ramdisk_configuration[] =
+{
+  {
+    block_size: 512,
+    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
+};
+
+/**
+ * The NV Device descriptor. For this test it is just DRAM.
+ */
+rtems_nvdisk_device_desc rtems_nv_heap_device_descriptor[] =
+{
+  {
+    flags:  0,
+    base:   0,
+    size:   1 * 1024 * 1024,
+    nv_ops: &rtems_nvdisk_sram_handlers
+  }
+};
+
+/**
+ * The NV Disk configuration.
+ */
+const rtems_nvdisk_config rtems_nvdisk_configuration[] =
+{
+  {
+    block_size:         512,
+    device_count:       1,
+    devices:            &rtems_nv_heap_device_descriptor[0],
+    flags:              0,
+    info_level:         0
+  }
+};
+
+/**
+ * The number of NV Disk configurations.
+ */
+uint32_t rtems_nvdisk_configuration_size = 1;
+
+/**
+ * Create the NV Disk Driver entry.
+ */
+rtems_driver_address_table rtems_nvdisk_io_ops = {
+  initialization_entry: rtems_nvdisk_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
+};
+
+int
+setup_nvdisk (const char* mntpath)
+{
+  rtems_device_major_number major;
+  rtems_status_code         sc;
+
+  /*
+   * For our test we do not have any static RAM or EEPROM devices so
+   * we allocate the memory from the heap.
+   */
+  rtems_nv_heap_device_descriptor[0].base =
+    malloc (rtems_nv_heap_device_descriptor[0].size);
+
+  if (!rtems_nv_heap_device_descriptor[0].base)
+  {
+    printf ("error: no memory for NV disk\n");
+    return 1;
+  }
+  
+  /*
+   * Register the NV Disk driver.
+   */
+  printf ("Register NV Disk Driver: ");
+  sc = rtems_io_register_driver (RTEMS_DRIVER_AUTO_MAJOR,
+                                 &rtems_nvdisk_io_ops,
+                                 &major);
+  if (sc != RTEMS_SUCCESSFUL)
+  {
+    printf ("error: nvdisk driver not initialised: %s\n",
+            rtems_status_text (sc));
+    return 1;
+  }
+  
+  printf ("successful\n");
+
+  return 0;
+}
+
 /*
  * Table of FAT file systems that will be mounted
  * with the "fsmount" function.
@@ -100,6 +224,384 @@
 #ifdef USE_SHELL
 #include <rtems/shell.h>
 
+int
+shell_nvdisk_trace (int argc, char* argv[])
+{
+  const char* driver;
+  int         level;
+
+  if (argc != 3)
+  {
+    printf ("error: invalid number of options\n");
+    return 1;
+  }
+
+  driver = argv[1];
+  level  = strtoul (argv[2], 0, 0);
+  
+  int fd = open (driver, O_WRONLY, 0);
+  if (fd < 0)
+  {
+    printf ("error: driver open failed: %s\n", strerror (errno));
+    return 1;
+  }
+  
+  if (ioctl (fd, RTEMS_NVDISK_IOCTL_INFO_LEVEL, level) < 0)
+  {
+    printf ("error: driver set level failed: %s\n", strerror (errno));
+    return 1;
+  }
+  
+  close (fd);
+  
+  return 0;
+}
+
+int
+shell_nvdisk_erase (int argc, char* argv[])
+{
+  const char* driver = NULL;
+  int         arg;
+  int         fd;
+  
+  for (arg = 1; arg < argc; arg++)
+  {
+    if (argv[arg][0] == '-')
+    {
+      printf ("error: invalid option: %s\n", argv[arg]);
+      return 1;
+    }
+    else
+    {
+      if (!driver)
+        driver = argv[arg];
+      else
+      {
+        printf ("error: only one driver name allowed: %s\n", argv[arg]);
+        return 1;
+      }
+    }
+  }
+  
+  printf ("erase nv disk: %s\n", driver);
+  
+  fd = open (driver, O_WRONLY, 0);
+  if (fd < 0)
+  {
+    printf ("error: nvdisk driver open failed: %s\n", strerror (errno));
+    return 1;
+  }
+  
+  if (ioctl (fd, RTEMS_NVDISK_IOCTL_ERASE_DISK) < 0)
+  {
+    printf ("error: nvdisk driver erase failed: %s\n", strerror (errno));
+    return 1;
+  }
+  
+  close (fd);
+  
+  printf ("nvdisk erased successful\n");
+
+  return 0;
+}
+
+int
+shell_bdbuf_trace (int argc, char* argv[])
+{
+#if RTEMS_BDBUF_TRACE
+  extern bool rtems_bdbuf_tracer;
+  rtems_bdbuf_tracer = !rtems_bdbuf_tracer;
+  printf ("bdbuf trace: %d\n", rtems_bdbuf_tracer);
+#else
+  printf ("bdbuf trace disabled. Rebuild with enabled.\n");
+#endif
+  return 0;
+}
+
+int
+disk_test_set_block_size (dev_t dev, size_t size)
+{
+  rtems_disk_device* dd;
+  int                rc;
+  
+  dd = rtems_disk_obtain (dev);
+  if (!dd)
+  {
+    printf ("error: cannot obtain disk\n");
+    return 1;
+  }
+  
+  rc = dd->ioctl (dd, RTEMS_BLKIO_SETBLKSIZE, &size);
+
+  rtems_disk_release (dd);
+
+  return rc;
+}
+
+int
+disk_test_write_blocks (dev_t dev, int start, int count, size_t size)
+{
+  int                 block;
+  uint32_t*           ip;
+  uint32_t            value = 0;
+  int                 i;
+  rtems_bdbuf_buffer* bd;
+  rtems_status_code   sc;
+  
+  if (disk_test_set_block_size (dev, size) < 0)
+  {
+    printf ("error: set block size failed: %s\n", strerror (errno));
+    return 1;
+  }
+
+  for (block = start; block < (start + count); block++)
+  {
+    sc = rtems_bdbuf_read (dev, block, &bd);
+    if (sc != RTEMS_SUCCESSFUL)
+    {
+      printf ("error: get block %d bd failed: %s\n",
+              block, rtems_status_text (sc));
+      return 1;
+    }
+
+    ip = (uint32_t*) bd->buffer;
+    for (i = 0; i < (size / sizeof (uint32_t)); i++, ip++, value++)
+      *ip = (size << 16) | value;
+
+    sc = rtems_bdbuf_release_modified (bd);
+    if (sc != RTEMS_SUCCESSFUL)
+    {
+      printf ("error: release block %d bd failed: %s\n",
+              block, rtems_status_text (sc));
+      return 1;
+    }
+  }
+
+  return 0;
+}
+
+int
+disk_test_block_sizes (int argc, char *argv[])
+{
+  struct stat st;
+  char*       name;
+  int         start;
+  int         count;
+  int         size;
+  
+  if (argc != (4 + 1))
+  {
+    printf ("error: need to supply a device path, start, block and size\n");
+    return 1;
+  }
+
+  name = argv[1];
+  
+  if (stat (name, &st) < 0)
+  {
+    printf ("error: stat '%s' failed: %s\n", name, strerror (errno));
+    return 1;
+  }
+
+  start = strtoul (argv[2], 0, 0);
+  count = strtoul (argv[3], 0, 0);
+  size  = strtoul (argv[4], 0, 0);
+  
+  return disk_test_write_blocks (st.st_rdev, start, count, size);
+}
+
+size_t
+parse_size_arg (const char* arg)
+{
+  size_t size;
+  size_t scalar = 1;
+  
+  size = strtoul (arg, 0, 0);
+  switch (arg[strlen (arg) - 1])
+  {
+    case 'M':
+      scalar = 1000 * 1024;
+      break;
+    case 'm':
+      scalar = 1000000;
+      break;
+    case 'K':
+      scalar = 1024;
+      break;
+    case 'k':
+      scalar = 1000;
+      break;
+    default:
+      printf ("error: invalid scalar (M/m/K/k): %c\n", arg[strlen (arg) - 1]);
+      return 0;
+  }
+  return size * scalar;
+ }
+
+int
+create_ramdisk (int argc, char *argv[])
+{
+  rtems_device_major_number major;
+  rtems_status_code         sc;
+  int                       arg;
+  size_t                    size = 0;
+  size_t                    block_size = 0;
+
+  for (arg = 0; arg < argc; ++arg)
+  {
+    if (argv[arg][0] == '-')
+    {
+      switch (argv[arg][0])
+      {
+        case 's':
+          ++arg;
+          if (arg == argc)
+          {
+            printf ("error: -s needs a size\n");
+            return 1;
+          }
+          size = parse_size_arg (argv[arg]);
+          if (size == 0)
+            return 1;
+          break;
+        case 'b':
+          ++arg;
+          if (arg == argc)
+          {
+            printf ("error: -b needs a size\n");
+            return 1;
+          }
+          block_size = parse_size_arg (argv[arg]);
+          if (size == 0)
+            return 1;
+          break;
+        default:
+          printf ("error: invalid option: %s\n", argv[arg]);
+          return 1;
+      }
+    }
+  }
+
+  if (block_size)
+    rtems_ramdisk_configuration[0].block_size = block_size;
+  if (size)
+    rtems_ramdisk_configuration[0].block_num =
+      size / rtems_ramdisk_configuration[0].block_size;
+    
+  /*
+   * Register the RAM Disk driver.
+   */
+  printf ("Register RAM Disk Driver [blocks=%" PRIu32 \
+          " block-size=%" PRIu32"]:",
+          rtems_ramdisk_configuration[0].block_num,
+          rtems_ramdisk_configuration[0].block_size);
+  
+  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;
+}
+
+int
+create_nvdisk (int argc, char *argv[])
+{
+  rtems_device_major_number major;
+  rtems_status_code         sc;
+  int                       arg;
+  size_t                    size = 0;
+#if ADD_WHEN_NVDISK_HAS_CHANGED
+  size_t                    block_size = 0;
+#endif
+  
+  for (arg = 0; arg < argc; ++arg)
+  {
+    if (argv[arg][0] == '-')
+    {
+      switch (argv[arg][0])
+      {
+        case 's':
+          ++arg;
+          if (arg == argc)
+          {
+            printf ("error: -s needs a size\n");
+            return 1;
+          }
+          size = parse_size_arg (argv[arg]);
+          if (size == 0)
+            return 1;
+          break;
+#if ADD_WHEN_NVDISK_HAS_CHANGED
+        case 'b':
+          ++arg;
+          if (arg == argc)
+          {
+            printf ("error: -b needs a size\n");
+            return 1;
+          }
+          block_size = parse_size_arg (argv[arg]);
+          if (size == 0)
+            return 1;
+          break;
+#endif
+        default:
+          printf ("error: invalid option: %s\n", argv[arg]);
+          return 1;
+      }
+    }
+  }
+
+#if ADD_WHEN_NVDISK_HAS_CHANGED
+  if (block_size)
+    rtems_nvdisk_configuration[0].block_size = block_size;
+#endif
+  if (size)
+    rtems_nv_heap_device_descriptor[0].size = size;
+    
+  /*
+   * For our test we do not have any static RAM or EEPROM devices so
+   * we allocate the memory from the heap.
+   */
+  rtems_nv_heap_device_descriptor[0].base =
+    malloc (rtems_nv_heap_device_descriptor[0].size);
+
+  if (!rtems_nv_heap_device_descriptor[0].base)
+  {
+    printf ("error: no memory for NV disk\n");
+    return 1;
+  }
+  
+  /*
+   * Register the RAM Disk driver.
+   */
+  printf ("Register NV Disk Driver [size=%" PRIu32 \
+          " block-size=%" PRIu32"]:",
+          rtems_nv_heap_device_descriptor[0].size,
+          rtems_nvdisk_configuration[0].block_size);
+  
+  sc = rtems_io_register_driver (RTEMS_DRIVER_AUTO_MAJOR,
+                                 &rtems_nvdisk_io_ops,
+                                 &major);
+  if (sc != RTEMS_SUCCESSFUL)
+  {
+    printf ("error: nvdisk driver not initialised: %s\n",
+            rtems_status_text (sc));
+    return 1;
+  }
+  
+  printf ("successful\n");
+
+  return 0;
+}
+
 static void writeFile(
   const char *name,
   mode_t      mode,
@@ -182,7 +684,30 @@
     "echo j2   DOES NOT have the magic first line\n"
   );
 
-  printf(" =========================\n");
+  rtems_shell_add_cmd ("mkrd", "files",
+                       "Create a RAM disk driver", create_ramdisk);
+  rtems_shell_add_cmd ("mknvd", "files",
+                       "Create a NV disk driver", create_nvdisk);
+  rtems_shell_add_cmd ("nverase", "misc",
+                       "nverase driver", shell_nvdisk_erase);
+  rtems_shell_add_cmd ("nvtrace", "misc",
+                       "nvtrace driver level", shell_nvdisk_trace);
+  rtems_shell_add_cmd ("bdbuftrace", "files",
+                       "bdbuf trace toggle", shell_bdbuf_trace);
+  rtems_shell_add_cmd ("td", "files",
+                       "Test disk", disk_test_block_sizes);
+#if RTEMS_RFS_TRACE
+  rtems_shell_add_cmd ("rfs", "files",
+                       "RFS trace",
+                       rtems_rfs_trace_shell_command);
+#endif
+#if RTEMS_RFS_RTEMS_TRACE
+  rtems_shell_add_cmd ("rrfs", "files",
+                       "RTEMS RFS trace",
+                       rtems_rfs_rtems_trace_shell_command);
+#endif
+
+  printf("\n =========================\n");
   printf(" starting shell\n");
   printf(" =========================\n");
   rtems_shell_init(
@@ -192,7 +717,7 @@
     "/dev/console",                  /* devname */
     false,                           /* forever */
     true,                            /* wait */
-    rtems_shell_login_check          /* login */
+    NULL                             /* login */
   );
 }
 #endif /* USE_SHELL */

diff -u rtems/testsuites/samples/fileio/system.h:1.16 rtems/testsuites/samples/fileio/system.h:1.16.2.1
--- rtems/testsuites/samples/fileio/system.h:1.16	Wed Aug 12 15:50:37 2009
+++ rtems/testsuites/samples/fileio/system.h	Thu May 26 18:37:16 2011
@@ -38,13 +38,21 @@
 #include <libchip/ide_ctrl.h> /* for general ide driver prototype */
 #endif
 
+#define CONFIGURE_MAXIMUM_DRIVERS           4
 #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
 #ifdef RTEMS_BSP_HAS_IDE_DRIVER
 #define CONFIGURE_APPLICATION_NEEDS_IDE_DRIVER
+#define CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER
+#define CONFIGURE_ATA_DRIVER_TASK_PRIORITY  14
 #endif
 #define CONFIGURE_APPLICATION_NEEDS_LIBBLOCK
+#define CONFIGURE_BDBUF_MAX_READ_AHEAD_BLOCKS  2
+#define CONFIGURE_BDBUF_MAX_WRITE_BLOCKS       8
+#define CONFIGURE_SWAPOUT_TASK_PRIORITY        15
 #define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
+#define CONFIGURE_FILESYSTEM_RFS
+#define CONFIGURE_FILESYSTEM_DOSFS
 
 /*
  * XXX: these values are higher than needed...



--

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/20110526/873d87dd/attachment-0001.html>


More information about the vc mailing list