[d7001e47] | 1 | /** |
---|
[d0c3b38b] | 2 | * @file |
---|
| 3 | * |
---|
[4670d91] | 4 | * @ingroup rtems_ramdisk |
---|
| 5 | * |
---|
[d0c3b38b] | 6 | * RAM disk block device. |
---|
[d7001e47] | 7 | */ |
---|
| 8 | |
---|
| 9 | /* |
---|
| 10 | * Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia |
---|
| 11 | * Author: Victor V. Vengerov <vvv@oktet.ru> |
---|
| 12 | * |
---|
| 13 | * @(#) $Id$ |
---|
| 14 | */ |
---|
| 15 | |
---|
| 16 | #ifndef _RTEMS_RAMDISK_H |
---|
| 17 | #define _RTEMS_RAMDISK_H |
---|
| 18 | |
---|
| 19 | |
---|
| 20 | #include <rtems.h> |
---|
[90b2c072] | 21 | #include <rtems/blkdev.h> |
---|
[d7001e47] | 22 | |
---|
[90b2c072] | 23 | #ifdef __cplusplus |
---|
| 24 | extern "C" { |
---|
| 25 | #endif |
---|
[d7001e47] | 26 | |
---|
[d0c3b38b] | 27 | /** |
---|
| 28 | * @defgroup rtems_ramdisk RAM Disk Device |
---|
| 29 | * |
---|
| 30 | * @ingroup rtems_blkdev |
---|
| 31 | * |
---|
| 32 | * @{ |
---|
| 33 | */ |
---|
| 34 | |
---|
| 35 | /** |
---|
| 36 | * RAM disk configuration table entry. |
---|
| 37 | */ |
---|
[d7001e47] | 38 | typedef struct rtems_ramdisk_config { |
---|
[d0c3b38b] | 39 | /** |
---|
| 40 | * RAM disk block size (must be a power of two). |
---|
| 41 | */ |
---|
| 42 | uint32_t block_size; |
---|
| 43 | |
---|
| 44 | /** |
---|
| 45 | * Number of blocks on this RAM disk. |
---|
| 46 | */ |
---|
| 47 | rtems_blkdev_bnum block_num; |
---|
| 48 | |
---|
| 49 | /** |
---|
| 50 | * RAM disk location or @c NULL if RAM disk memory should be allocated |
---|
| 51 | * dynamically. |
---|
| 52 | */ |
---|
| 53 | void *location; |
---|
[d7001e47] | 54 | } rtems_ramdisk_config; |
---|
| 55 | |
---|
[d0c3b38b] | 56 | /** |
---|
| 57 | * External reference to the RAM disk configuration table describing each RAM |
---|
| 58 | * disk in the system. |
---|
| 59 | * |
---|
| 60 | * The configuration table is provided by the application. |
---|
| 61 | */ |
---|
| 62 | extern rtems_ramdisk_config rtems_ramdisk_configuration []; |
---|
| 63 | |
---|
| 64 | /** |
---|
| 65 | * External reference the size of the RAM disk configuration table |
---|
| 66 | * @ref rtems_ramdisk_configuration. |
---|
| 67 | * |
---|
| 68 | * The configuration table size is provided by the application. |
---|
[d7001e47] | 69 | */ |
---|
| 70 | extern size_t rtems_ramdisk_configuration_size; |
---|
| 71 | |
---|
[d0c3b38b] | 72 | /** |
---|
| 73 | * RAM disk driver initialization entry point. |
---|
[d7001e47] | 74 | */ |
---|
[d0c3b38b] | 75 | rtems_device_driver ramdisk_initialize( |
---|
| 76 | rtems_device_major_number major, |
---|
| 77 | rtems_device_minor_number minor, |
---|
| 78 | void *arg |
---|
| 79 | ); |
---|
[d7001e47] | 80 | |
---|
[d0c3b38b] | 81 | /** |
---|
| 82 | * RAM disk driver table entry. |
---|
| 83 | */ |
---|
[d7001e47] | 84 | #define RAMDISK_DRIVER_TABLE_ENTRY \ |
---|
[d0c3b38b] | 85 | { \ |
---|
| 86 | .initialization_entry = ramdisk_initialize, \ |
---|
| 87 | RTEMS_GENERIC_BLOCK_DEVICE_DRIVER_ENTRIES \ |
---|
| 88 | } |
---|
| 89 | |
---|
| 90 | /** @} */ |
---|
[d7001e47] | 91 | |
---|
| 92 | #ifdef __cplusplus |
---|
| 93 | } |
---|
| 94 | #endif |
---|
| 95 | |
---|
| 96 | #endif |
---|