Changeset 48680bb1 in rtems for cpukit/libblock


Ignore:
Timestamp:
Oct 26, 2012, 7:30:40 PM (7 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
9dffa384
Parents:
0d68d8f2
Message:

libblock: ramdisk documentation

Location:
cpukit/libblock
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • cpukit/libblock/include/rtems/ramdisk.h

    r0d68d8f2 r48680bb1  
    6767
    6868/**
    69  * @brief External reference the size of the RAM disk configuration table @ref
    70  * rtems_ramdisk_configuration.
     69 * @brief External reference the size of the RAM disk configuration table
     70 * @ref rtems_ramdisk_configuration.
    7171 *
    7272 * The configuration table size is provided by the application.
     
    149149 * @brief Allocates and initializes a RAM disk descriptor.
    150150 *
    151  * The block size will be @a block_size.  The block count will be @a
    152  * block_count.  The disk storage area begins at @a area_begin.  If @a
    153  * area_begin is @c NULL, the memory will be allocated and zeroed.  Sets the
     151 * The block size will be @a media_block_size.  The block count will be
     152 * @a media_block_count.  The disk storage area begins at @a area_begin.  If
     153 * @a area_begin is @c NULL, the memory will be allocated and zeroed.  Sets the
    154154 * trace enable to @a trace.
    155155 *
     
    160160 * Runtime configuration example:
    161161 * @code
    162  * #include <rtems.h>
    163  * #include <rtems/libio.h>
    164162 * #include <rtems/ramdisk.h>
    165163 *
    166164 * rtems_status_code create_ramdisk(
    167  *   const char *disk_name_path,
    168  *   uint32_t block_size,
    169  *   rtems_blkdev_bnum block_count
     165 *   const char *device,
     166 *   uint32_t media_block_size,
     167 *   rtems_blkdev_bnum media_block_count
    170168 * )
    171169 * {
    172  *   rtems_status_code sc = RTEMS_SUCCESSFUL;
    173  *   rtems_device_major_number major = 0;
    174  *   ramdisk *rd = NULL;
    175  *   dev_t dev = 0;
    176  *
    177  *   sc = rtems_io_register_driver(0, &ramdisk_ops, &major);
    178  *   if (sc != RTEMS_SUCCESSFUL) {
    179  *     return RTEMS_UNSATISFIED;
     170 *   rtems_status_code sc;
     171 *   ramdisk *rd;
     172 *
     173 *   rd = ramdisk_allocate(NULL, media_block_size, media_block_count, false);
     174 *   if (rd != NULL) {
     175 *     sc = rtems_blkdev_create(
     176 *       device,
     177 *       media_block_size,
     178 *       media_block_count,
     179 *       ramdisk_ioctl,
     180 *       rd
     181 *     );
     182 *   } else {
     183 *     sc = RTEMS_UNSATISFIED;
    180184 *   }
    181185 *
    182  *   rd = ramdisk_allocate(NULL, block_size, block_count, false);
    183  *   if (rd == NULL) {
    184  *     rtems_io_unregister_driver(major);
    185  *
    186  *     return RTEMS_UNSATISFIED;
    187  *   }
    188  *
    189  *   dev = rtems_filesystem_make_dev_t(major, 0);
    190  *
    191  *   sc = rtems_disk_create_phys(
    192  *     dev,
    193  *     block_size,
    194  *     block_count,
    195  *     ramdisk_ioctl,
    196  *     rd,
    197  *     disk_name_path
    198  *   );
    199  *   if (sc != RTEMS_SUCCESSFUL) {
    200  *     ramdisk_free(rd);
    201  *     rtems_io_unregister_driver(major);
    202  *
    203  *     return RTEMS_UNSATISFIED;
    204  *   }
    205  *
    206  *   return RTEMS_SUCCESSFUL;
     186 *   return sc;
    207187 * }
    208188 * @endcode
     
    210190ramdisk *ramdisk_allocate(
    211191  void *area_begin,
    212   uint32_t block_size,
    213   rtems_blkdev_bnum block_count,
     192  uint32_t media_block_size,
     193  rtems_blkdev_bnum media_block_count,
    214194  bool trace
    215195);
     
    225205 * @brief Allocates, initializes and registers a RAM disk.
    226206 *
    227  * The block size will be @a block_size.  The block count will be @a
    228  * block_count.  The disk storage will be allocated.  Sets the trace enable to
    229  * @a trace.  Registers a device node with disk name path @a disk.  The
    230  * registered device number will be returned in @a dev.
     207 * The block size will be @a media_block_size.  The block count will be
     208 * @a media_block_count.  The disk storage will be allocated.  Sets the trace
     209 * enable to @a trace.  Registers a device node with disk name path @a disk.
     210 * The registered device number will be returned in @a dev.
    231211 *
    232212 * @retval RTEMS_SUCCESSFUL Successful operation.
     
    234214 */
    235215rtems_status_code ramdisk_register(
    236   uint32_t block_size,
    237   rtems_blkdev_bnum block_count,
     216  uint32_t media_block_size,
     217  rtems_blkdev_bnum media_block_count,
    238218  bool trace,
    239219  const char *disk,
  • cpukit/libblock/src/ramdisk-init.c

    r0d68d8f2 r48680bb1  
    3232ramdisk *ramdisk_allocate(
    3333  void *area_begin,
    34   uint32_t block_size,
    35   rtems_blkdev_bnum block_count,
     34  uint32_t media_block_size,
     35  rtems_blkdev_bnum media_block_count,
    3636  bool trace
    3737)
     
    4444
    4545  if (area_begin == NULL) {
    46     area_begin = calloc(block_count, block_size);
     46    area_begin = calloc(media_block_count, media_block_size);
    4747    if (area_begin == NULL) {
    4848      free(rd);
     
    5454    rd->malloced = false;
    5555  }
    56   rd->block_size = block_size;
    57   rd->block_num = block_count;
     56  rd->block_size = media_block_size;
     57  rd->block_num = media_block_count;
    5858  rd->area = area_begin;
    5959  rd->trace = trace;
  • cpukit/libblock/src/ramdisk-register.c

    r0d68d8f2 r48680bb1  
    3434
    3535rtems_status_code ramdisk_register(
    36   uint32_t block_size,
    37   rtems_blkdev_bnum block_count,
     36  uint32_t media_block_size,
     37  rtems_blkdev_bnum media_block_count,
    3838  bool trace,
    3939  const char *disk,
     
    5151  }
    5252
    53   rd = ramdisk_allocate(NULL, block_size, block_count, trace);
     53  rd = ramdisk_allocate(NULL, media_block_size, media_block_count, trace);
    5454  if (rd == NULL) {
    5555    rtems_io_unregister_driver(major);
     
    6262  sc = rtems_disk_create_phys(
    6363    dev,
    64     block_size,
    65     block_count,
     64    media_block_size,
     65    media_block_count,
    6666    ramdisk_ioctl,
    6767    rd,
Note: See TracChangeset for help on using the changeset viewer.