Index: cpukit/libblock/Makefile.am
===================================================================
--- cpukit/libblock/Makefile.am	(revision 809e91e1d60827bda63f9dd37e7fa2edea253043)
+++ cpukit/libblock/Makefile.am	(revision 1560d12d0141710c3aa63f3409ce0d0b4a41dc30)
@@ -8,5 +8,9 @@
 noinst_LIBRARIES = libblock.a
 libblock_a_SOURCES = src/bdbuf.c src/blkdev.c src/diskdevs.c src/flashdisk.c \
-    src/ramdisk.c src/ide_part_table.c src/nvdisk.c \
+    src/ramdisk-driver.c \
+    src/ramdisk-init.c \
+    src/ramdisk-config.c \
+    src/ide_part_table.c \
+    src/nvdisk.c \
     src/nvdisk-sram.c \
     src/bdpart.c \
Index: cpukit/libblock/include/rtems/ramdisk.h
===================================================================
--- cpukit/libblock/include/rtems/ramdisk.h	(revision 809e91e1d60827bda63f9dd37e7fa2edea253043)
+++ cpukit/libblock/include/rtems/ramdisk.h	(revision 1560d12d0141710c3aa63f3409ce0d0b4a41dc30)
@@ -4,5 +4,5 @@
  * @ingroup rtems_ramdisk
  *
- * RAM disk block device.
+ * @brief RAM disk block device API.
  */
 
@@ -34,19 +34,25 @@
 
 /**
- * RAM disk configuration table entry.
+ * @name Static Configuration
+ *
+ * @{
+ */
+
+/**
+ * @brief RAM disk configuration table entry.
  */
 typedef struct rtems_ramdisk_config {
   /**
-   * RAM disk block size (must be a power of two).
+   * @brief RAM disk block size.
    */
   uint32_t block_size;
 
   /**
-   * Number of blocks on this RAM disk.
+   * @brief Number of blocks on this RAM disk.
    */
   rtems_blkdev_bnum block_num;
 
   /**
-   * RAM disk location or @c NULL if RAM disk memory should be allocated
+   * @brief RAM disk location or @c NULL if RAM disk memory should be allocated
    * dynamically.
    */
@@ -55,6 +61,6 @@
 
 /**
- * External reference to the RAM disk configuration table describing each RAM
- * disk in the system.
+ * @brief External reference to the RAM disk configuration table describing
+ * each RAM disk in the system.
  *
  * The configuration table is provided by the application.
@@ -63,6 +69,6 @@
 
 /**
- * External reference the size of the RAM disk configuration table
- * @ref rtems_ramdisk_configuration.
+ * @brief External reference the size of the RAM disk configuration table @ref
+ * rtems_ramdisk_configuration.
  *
  * The configuration table size is provided by the application.
@@ -70,6 +76,8 @@
 extern size_t rtems_ramdisk_configuration_size;
 
-/**
- * RAM disk driver initialization entry point.
+int ramdisk_ioctl(rtems_disk_device *dd, uint32_t req, void *argp);
+
+/**
+ * @brief RAM disk driver initialization entry point.
  */
 rtems_device_driver ramdisk_initialize(
@@ -88,4 +96,118 @@
   }
 
+#define RAMDISK_DEVICE_BASE_NAME "/dev/rd"
+
+/** @} */
+
+/**
+ * @name Runtime Configuration
+ *
+ * @{
+ */
+
+/**
+ * @brief RAM disk descriptor.
+ */
+typedef struct ramdisk {
+  /**
+   * @brief RAM disk block size, the media size.
+   */
+  uint32_t block_size;
+
+  /**
+   * @brief Number of blocks on this RAM disk.
+   */
+  rtems_blkdev_bnum block_num;
+
+  /**
+   * @brief RAM disk memory area.
+   */
+  void *area;
+
+  /**
+   * @brief RAM disk is initialized.
+   */
+  bool initialized;
+
+  /**
+   * @brief Indicates if memory is allocated by malloc() for this RAM disk.
+   */
+  bool malloced;
+
+  /**
+   * @brief Trace enable.
+   */
+  bool trace;
+} ramdisk;
+
+extern const rtems_driver_address_table ramdisk_ops;
+
+/**
+ * @brief Allocates and initializes a RAM disk descriptor.
+ *
+ * The block size will be @a block_size.  The block count will be @a
+ * block_count.  The disk storage area begins at @a area_begin.  If @a
+ * area_begin is @c NULL, the memory will be allocated and zeroed.  Sets the
+ * trace enable to @a trace.
+ *
+ * @return Pointer to allocated and initialized ramdisk structure, or @c NULL
+ * if no memory is available.
+ *
+ * @code
+ * rtems_status_code create_ramdisk(
+ *   const char *disk_name_path,
+ *   uint32_t block_size,
+ *   rtems_blkdev_bnum block_count
+ * )
+ * {
+ *   rtems_status_code sc = RTEMS_SUCCESSFUL;
+ *   rtems_device_major_number major = 0;
+ *   ramdisk *rd = NULL;
+ *   dev_t dev = 0;
+ * 
+ *   sc = rtems_io_register_driver(0, &ramdisk_ops, &major);
+ *   if (sc != RTEMS_SUCCESSFUL) {
+ *     return RTEMS_UNSATISFIED;
+ *   }
+ * 
+ *   rd = ramdisk_allocate(NULL, block_size, block_count, false);
+ *   if (rd == NULL) {
+ *     rtems_io_unregister_driver(major);
+ * 
+ *     return RTEMS_UNSATISFIED;
+ *   }
+ * 
+ *   dev = rtems_filesystem_make_dev_t(major, 0);
+ * 
+ *   sc = rtems_disk_create_phys(
+ *     dev,
+ *     block_size,
+ *     block_count,
+ *     ramdisk_ioctl,
+ *     rd,
+ *     disk_name_path
+ *   );
+ *   if (sc != RTEMS_SUCCESSFUL) {
+ *     ramdisk_free(rd);
+ *     rtems_io_unregister_driver(major);
+ * 
+ *     return RTEMS_UNSATISFIED;
+ *   }
+ * 
+ *   return RTEMS_SUCCESSFUL;
+ * }
+ * @endcode
+ */
+ramdisk *ramdisk_allocate(
+  void *area_begin,
+  uint32_t block_size,
+  rtems_blkdev_bnum block_count,
+  bool trace
+);
+
+void ramdisk_free(ramdisk *rd);
+
+/** @} */
+
 /** @} */
 
Index: cpukit/libblock/src/ramdisk-config.c
===================================================================
--- cpukit/libblock/src/ramdisk-config.c	(revision 1560d12d0141710c3aa63f3409ce0d0b4a41dc30)
+++ cpukit/libblock/src/ramdisk-config.c	(revision 1560d12d0141710c3aa63f3409ce0d0b4a41dc30)
@@ -0,0 +1,78 @@
+/**
+ * @file
+ *
+ * @ingroup rtems_ramdisk
+ *
+ * @brief RAM disk block device implementation.
+ */
+
+/*
+ * Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia
+ * Author: Victor V. Vengerov <vvv@oktet.ru>
+ *
+ * @(#) $Id$
+ */
+
+#include <stdlib.h>
+
+#include <rtems.h>
+#include <rtems/libio.h>
+#include <rtems/ramdisk.h>
+
+rtems_device_driver
+ramdisk_initialize(
+    rtems_device_major_number major,
+    rtems_device_minor_number minor __attribute__((unused)),
+    void *arg __attribute__((unused)))
+{
+    rtems_device_minor_number i;
+    rtems_ramdisk_config *c = rtems_ramdisk_configuration;
+    struct ramdisk *r;
+    rtems_status_code rc;
+
+    rc = rtems_disk_io_initialize();
+    if (rc != RTEMS_SUCCESSFUL)
+        return rc;
+
+    r = calloc(rtems_ramdisk_configuration_size, sizeof(struct ramdisk));
+    r->trace = false;
+    for (i = 0; i < rtems_ramdisk_configuration_size; i++, c++, r++)
+    {
+        dev_t dev = rtems_filesystem_make_dev_t(major, i);
+        char name [] = RAMDISK_DEVICE_BASE_NAME "a";
+        name [sizeof(RAMDISK_DEVICE_BASE_NAME)] += i;
+        r->block_size = c->block_size;
+        r->block_num = c->block_num;
+        if (c->location == NULL)
+        {
+            r->malloced = true;
+            r->area = malloc(r->block_size * r->block_num);
+            if (r->area == NULL) /* No enough memory for this disk */
+            {
+                r->initialized = false;
+                continue;
+            }
+            else
+            {
+                r->initialized = true;
+            }
+        }
+        else
+        {
+            r->malloced = false;
+            r->initialized = true;
+            r->area = c->location;
+        }
+        rc = rtems_disk_create_phys(dev, c->block_size, c->block_num,
+                                    ramdisk_ioctl, r, name);
+        if (rc != RTEMS_SUCCESSFUL)
+        {
+            if (r->malloced)
+            {
+                free(r->area);
+            }
+            r->initialized = false;
+        }
+    }
+    return RTEMS_SUCCESSFUL;
+}
Index: cpukit/libblock/src/ramdisk-driver.c
===================================================================
--- cpukit/libblock/src/ramdisk-driver.c	(revision 1560d12d0141710c3aa63f3409ce0d0b4a41dc30)
+++ cpukit/libblock/src/ramdisk-driver.c	(revision 1560d12d0141710c3aa63f3409ce0d0b4a41dc30)
@@ -0,0 +1,111 @@
+/**
+ * @file
+ *
+ * @ingroup rtems_ramdisk
+ *
+ * @brief RAM disk block device implementation.
+ */
+
+/*
+ * Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia
+ * Author: Victor V. Vengerov <vvv@oktet.ru>
+ *
+ * @(#) $Id$
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <string.h>
+#include <inttypes.h>
+
+#include <rtems.h>
+#include <rtems/ramdisk.h>
+
+static void
+rtems_ramdisk_printf (const ramdisk *rd, const char *format, ...)
+{
+  if (rd->trace)
+  {
+    va_list args;
+    va_start (args, format);
+    printf ("ramdisk:");
+    vprintf (format, args);
+    printf ("\n");
+  }
+}
+
+static int
+ramdisk_read(struct ramdisk *rd, rtems_blkdev_request *req)
+{
+    uint8_t *from = rd->area;
+    uint32_t   i;
+    rtems_blkdev_sg_buffer *sg;
+
+    rtems_ramdisk_printf (rd, "ramdisk read: start=%d, blocks=%d",
+                          req->bufs[0].block, req->bufnum);
+
+    for (i = 0, sg = req->bufs; i < req->bufnum; i++, sg++)
+    {
+        rtems_ramdisk_printf (rd, "ramdisk read: buf=%d block=%d length=%d off=%d addr=%p",
+                              i, sg->block, sg->length, sg->block * rd->block_size,
+                              from + (sg->block * rd->block_size));
+        memcpy(sg->buffer, from + (sg->block * rd->block_size), sg->length);
+    }
+    req->req_done(req->done_arg, RTEMS_SUCCESSFUL, 0);
+    return 0;
+}
+
+static int
+ramdisk_write(struct ramdisk *rd, rtems_blkdev_request *req)
+{
+    uint8_t *to = rd->area;
+    uint32_t   i;
+    rtems_blkdev_sg_buffer *sg;
+
+    rtems_ramdisk_printf (rd, "ramdisk write: start=%d, blocks=%d",
+                          req->bufs[0].block, req->bufnum);
+    for (i = 0, sg = req->bufs; i < req->bufnum; i++, sg++)
+    {
+        rtems_ramdisk_printf (rd, "ramdisk write: buf=%d block=%d length=%d off=%d addr=%p",
+                              i, sg->block, sg->length, sg->block * rd->block_size,
+                              to + (sg->block * rd->block_size));
+        memcpy(to + (sg->block * rd->block_size), sg->buffer, sg->length);
+    }
+    req->req_done(req->done_arg, RTEMS_SUCCESSFUL, 0);
+    return 0;
+}
+
+int
+ramdisk_ioctl(rtems_disk_device *dd, uint32_t req, void *argp)
+{
+    switch (req)
+    {
+        case RTEMS_BLKIO_REQUEST:
+        {
+            rtems_blkdev_request *r = argp;
+            struct ramdisk *rd = rtems_disk_driver_data(dd);
+
+            switch (r->req)
+            {
+                case RTEMS_BLKDEV_REQ_READ:
+                    return ramdisk_read(rd, r);
+
+                case RTEMS_BLKDEV_REQ_WRITE:
+                    return ramdisk_write(rd, r);
+
+                default:
+                    errno = EINVAL;
+                    return -1;
+            }
+            break;
+        }
+  
+        default:
+            return rtems_blkdev_ioctl (dd, req, argp);
+            break;
+    }
+
+    errno = EINVAL;
+    return -1;
+}
Index: cpukit/libblock/src/ramdisk-init.c
===================================================================
--- cpukit/libblock/src/ramdisk-init.c	(revision 1560d12d0141710c3aa63f3409ce0d0b4a41dc30)
+++ cpukit/libblock/src/ramdisk-init.c	(revision 1560d12d0141710c3aa63f3409ce0d0b4a41dc30)
@@ -0,0 +1,75 @@
+/**
+ * @file
+ *
+ * @ingroup rtems_ramdisk
+ *
+ * @brief RAM disk block device implementation.
+ */
+
+/*
+ * Copyright (c) 2009
+ * embedded brains GmbH
+ * Obere Lagerstr. 30
+ * D-82178 Puchheim
+ * Germany
+ * <rtems@embedded-brains.de>
+ *
+ * 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 <stdlib.h>
+
+#include <rtems.h>
+#include <rtems/ramdisk.h>
+
+const rtems_driver_address_table ramdisk_ops = {
+  .initialization_entry = NULL,
+  RTEMS_GENERIC_BLOCK_DEVICE_DRIVER_ENTRIES
+};
+
+ramdisk *ramdisk_allocate(
+  void *area_begin,
+  uint32_t block_size,
+  rtems_blkdev_bnum block_count,
+  bool trace
+)
+{
+  struct ramdisk *rd = malloc(sizeof(struct ramdisk));
+
+  if (rd == NULL) {
+    return NULL;
+  }
+
+  if (area_begin == NULL) {
+    area_begin = calloc(block_count, block_size);
+    if (area_begin == NULL) {
+      free(rd);
+
+      return NULL;
+    }
+    rd->malloced = true;
+  } else {
+    rd->malloced = false;
+  }
+  rd->block_size = block_size;
+  rd->block_num = block_count;
+  rd->area = area_begin;
+  rd->trace = trace;
+  rd->initialized = true;
+
+  return rd;
+}
+
+void ramdisk_free(ramdisk *rd)
+{
+  if (rd != NULL) {
+    if (rd->malloced) {
+      free(rd->area);
+    }
+    free(rd);
+  }
+}
Index: cpukit/libblock/src/ramdisk.c
===================================================================
--- cpukit/libblock/src/ramdisk.c	(revision 809e91e1d60827bda63f9dd37e7fa2edea253043)
+++ 	(revision )
@@ -1,271 +1,0 @@
-/**
- * @file
- *
- * @ingroup rtems_ramdisk
- *
- * RAM disk block device.
- */
-
-/*
- * Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia
- * Author: Victor V. Vengerov <vvv@oktet.ru>
- *
- * @(#) $Id$
- */
-
-#if HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <rtems.h>
-#include <rtems/libio.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <inttypes.h>
-
-#include <rtems/blkdev.h>
-#include <rtems/diskdevs.h>
-#include <rtems/ramdisk.h>
-
-/**
- * Control tracing. It can be compiled out of the code for small
- * footprint targets. Leave in by default.
- */
-#if !defined (RTEMS_RAMDISK_TRACE)
-#define RTEMS_RAMDISK_TRACE 0
-#endif
-
-#define RAMDISK_DEVICE_BASE_NAME "/dev/rd"
-
-/* Internal RAM disk descriptor */
-struct ramdisk {
-  uint32_t block_size; /* RAM disk block size, the media size */
-  rtems_blkdev_bnum block_num; /* Number of blocks on this RAM disk */
-  void *area; /* RAM disk memory area */
-  bool initialized; /* RAM disk is initialized */
-  bool malloced; /* != 0, if memory allocated by malloc for this RAM disk */
-#if RTEMS_RAMDISK_TRACE
-  int info_level; /* Trace level */
-#endif
-};
-
-static struct ramdisk *ramdisk;
-static uint32_t nramdisks;
-
-#if RTEMS_RAMDISK_TRACE
-/**
- * Print a message to the ramdisk output and flush it.
- *
- * @param rd The ramdisk control structure.
- * @param format The format string. See printf for details.
- * @param ... The arguments for the format text.
- * @return int The number of bytes written to the output.
- */
-static int
-rtems_ramdisk_printf (struct ramdisk *rd, const char *format, ...)
-{
-  int ret = 0;
-  if (rd->info_level >= 1)
-  {
-    va_list args;
-    va_start (args, format);
-    fprintf (stdout, "ramdisk:");
-    ret =  vfprintf (stdout, format, args);
-    fprintf (stdout, "\n");
-    fflush (stdout);
-  }
-  return ret;
-}
-#endif
-
-/* ramdisk_read --
- *     RAM disk READ request handler. This primitive copies data from RAM
- *     disk to supplied buffer and invoke the callout function to inform
- *     upper layer that reading is completed.
- *
- * PARAMETERS:
- *     req - pointer to the READ block device request info
- *
- * RETURNS:
- *     ioctl return value
- */
-static int
-ramdisk_read(struct ramdisk *rd, rtems_blkdev_request *req)
-{
-    uint8_t *from = rd->area;
-    uint32_t   i;
-    rtems_blkdev_sg_buffer *sg;
-
-#if RTEMS_RAMDISK_TRACE
-    rtems_ramdisk_printf (rd, "ramdisk read: start=%d, blocks=%d",
-                          req->bufs[0].block, req->bufnum);
-#endif
-
-    for (i = 0, sg = req->bufs; i < req->bufnum; i++, sg++)
-    {
-#if RTEMS_RAMDISK_TRACE
-        rtems_ramdisk_printf (rd, "ramdisk read: buf=%d block=%d length=%d off=%d addr=%p",
-                              i, sg->block, sg->length, sg->block * rd->block_size,
-                              from + (sg->block * rd->block_size));
-#endif
-        memcpy(sg->buffer, from + (sg->block * rd->block_size), sg->length);
-    }
-    req->req_done(req->done_arg, RTEMS_SUCCESSFUL, 0);
-    return 0;
-}
-
-/* ramdisk_write --
- *     RAM disk WRITE request handler. This primitive copies data from
- *     supplied buffer to RAM disk and invoke the callout function to inform
- *     upper layer that writing is completed.
- *
- * PARAMETERS:
- *     req - pointer to the WRITE block device request info
- *
- * RETURNS:
- *     ioctl return value
- */
-static int
-ramdisk_write(struct ramdisk *rd, rtems_blkdev_request *req)
-{
-    uint8_t *to = rd->area;
-    uint32_t   i;
-    rtems_blkdev_sg_buffer *sg;
-
-#if RTEMS_RAMDISK_TRACE
-    rtems_ramdisk_printf (rd, "ramdisk write: start=%d, blocks=%d",
-                          req->bufs[0].block, req->bufnum);
-#endif
-    for (i = 0, sg = req->bufs; i < req->bufnum; i++, sg++)
-    {
-#if RTEMS_RAMDISK_TRACE
-        rtems_ramdisk_printf (rd, "ramdisk write: buf=%d block=%d length=%d off=%d addr=%p",
-                              i, sg->block, sg->length, sg->block * rd->block_size,
-                              to + (sg->block * rd->block_size));
-#endif
-        memcpy(to + (sg->block * rd->block_size), sg->buffer, sg->length);
-    }
-    req->req_done(req->done_arg, RTEMS_SUCCESSFUL, 0);
-    return 0;
-}
-
-/* ramdisk_ioctl --
- *     IOCTL handler for RAM disk device.
- *
- * PARAMETERS:
- *      dev  - device number (major, minor number)
- *      req  - IOCTL request code
- *      argp - IOCTL argument
- *
- * RETURNS:
- *     IOCTL return value
- */
-static int
-ramdisk_ioctl(rtems_disk_device *dd, uint32_t req, void *argp)
-{
-    switch (req)
-    {
-        case RTEMS_BLKIO_REQUEST:
-        {
-            rtems_blkdev_request *r = argp;
-            struct ramdisk *rd = rtems_disk_driver_data(dd);
-
-            switch (r->req)
-            {
-                case RTEMS_BLKDEV_REQ_READ:
-                    return ramdisk_read(rd, r);
-
-                case RTEMS_BLKDEV_REQ_WRITE:
-                    return ramdisk_write(rd, r);
-
-                default:
-                    errno = EINVAL;
-                    return -1;
-            }
-            break;
-        }
-  
-        default:
-            return rtems_blkdev_ioctl (dd, req, argp);
-            break;
-    }
-
-    errno = EINVAL;
-    return -1;
-}
-
-/* ramdisk_initialize --
- *     RAM disk device driver initialization. Run through RAM disk
- *     configuration information and configure appropriate RAM disks.
- *
- * PARAMETERS:
- *     major - RAM disk major device number
- *     minor - minor device number, not applicable
- *     arg   - initialization argument, not applicable
- *
- * RETURNS:
- *     none
- */
-rtems_device_driver
-ramdisk_initialize(
-    rtems_device_major_number major,
-    rtems_device_minor_number minor __attribute__((unused)),
-    void *arg __attribute__((unused)))
-{
-    rtems_device_minor_number i;
-    rtems_ramdisk_config *c = rtems_ramdisk_configuration;
-    struct ramdisk *r;
-    rtems_status_code rc;
-
-    rc = rtems_disk_io_initialize();
-    if (rc != RTEMS_SUCCESSFUL)
-        return rc;
-
-    r = ramdisk = calloc(rtems_ramdisk_configuration_size,
-                         sizeof(struct ramdisk));
-#if RTEMS_RAMDISK_TRACE
-    r->info_level = 1;
-#endif   
-    for (i = 0; i < rtems_ramdisk_configuration_size; i++, c++, r++)
-    {
-        dev_t dev = rtems_filesystem_make_dev_t(major, i);
-        char name [] = RAMDISK_DEVICE_BASE_NAME "a";
-        name [sizeof(RAMDISK_DEVICE_BASE_NAME)] += i;
-        r->block_size = c->block_size;
-        r->block_num = c->block_num;
-        if (c->location == NULL)
-        {
-            r->malloced = true;
-            r->area = malloc(r->block_size * r->block_num);
-            if (r->area == NULL) /* No enough memory for this disk */
-            {
-                r->initialized = false;
-                continue;
-            }
-            else
-            {
-                r->initialized = true;
-            }
-        }
-        else
-        {
-            r->malloced = false;
-            r->initialized = true;
-            r->area = c->location;
-        }
-        rc = rtems_disk_create_phys(dev, c->block_size, c->block_num,
-                                    ramdisk_ioctl, r, name);
-        if (rc != RTEMS_SUCCESSFUL)
-        {
-            if (r->malloced)
-            {
-                free(r->area);
-            }
-            r->initialized = false;
-        }
-    }
-    nramdisks = rtems_ramdisk_configuration_size;
-    return RTEMS_SUCCESSFUL;
-}
