Changeset 1560d12 in rtems for cpukit/libblock
- Timestamp:
- 10/16/09 08:44:51 (14 years ago)
- Branches:
- 4.10, 4.11, 5, master
- Children:
- c20f690
- Parents:
- fdaa1354
- Location:
- cpukit/libblock
- Files:
-
- 3 added
- 1 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
cpukit/libblock/Makefile.am
rfdaa1354 r1560d12 8 8 noinst_LIBRARIES = libblock.a 9 9 libblock_a_SOURCES = src/bdbuf.c src/blkdev.c src/diskdevs.c src/flashdisk.c \ 10 src/ramdisk.c src/ide_part_table.c src/nvdisk.c \ 10 src/ramdisk-driver.c \ 11 src/ramdisk-init.c \ 12 src/ramdisk-config.c \ 13 src/ide_part_table.c \ 14 src/nvdisk.c \ 11 15 src/nvdisk-sram.c \ 12 16 src/bdpart.c \ -
cpukit/libblock/include/rtems/ramdisk.h
rfdaa1354 r1560d12 4 4 * @ingroup rtems_ramdisk 5 5 * 6 * RAM disk block device.6 * @brief RAM disk block device API. 7 7 */ 8 8 … … 34 34 35 35 /** 36 * RAM disk configuration table entry. 36 * @name Static Configuration 37 * 38 * @{ 39 */ 40 41 /** 42 * @brief RAM disk configuration table entry. 37 43 */ 38 44 typedef struct rtems_ramdisk_config { 39 45 /** 40 * RAM disk block size (must be a power of two).46 * @brief RAM disk block size. 41 47 */ 42 48 uint32_t block_size; 43 49 44 50 /** 45 * Number of blocks on this RAM disk.51 * @brief Number of blocks on this RAM disk. 46 52 */ 47 53 rtems_blkdev_bnum block_num; 48 54 49 55 /** 50 * RAM disk location or @c NULL if RAM disk memory should be allocated56 * @brief RAM disk location or @c NULL if RAM disk memory should be allocated 51 57 * dynamically. 52 58 */ … … 55 61 56 62 /** 57 * External reference to the RAM disk configuration table describing each RAM58 * disk in the system.63 * @brief External reference to the RAM disk configuration table describing 64 * each RAM disk in the system. 59 65 * 60 66 * The configuration table is provided by the application. … … 63 69 64 70 /** 65 * External reference the size of the RAM disk configuration table66 * @refrtems_ramdisk_configuration.71 * @brief External reference the size of the RAM disk configuration table @ref 72 * rtems_ramdisk_configuration. 67 73 * 68 74 * The configuration table size is provided by the application. … … 70 76 extern size_t rtems_ramdisk_configuration_size; 71 77 72 /** 73 * RAM disk driver initialization entry point. 78 int ramdisk_ioctl(rtems_disk_device *dd, uint32_t req, void *argp); 79 80 /** 81 * @brief RAM disk driver initialization entry point. 74 82 */ 75 83 rtems_device_driver ramdisk_initialize( … … 88 96 } 89 97 98 #define RAMDISK_DEVICE_BASE_NAME "/dev/rd" 99 100 /** @} */ 101 102 /** 103 * @name Runtime Configuration 104 * 105 * @{ 106 */ 107 108 /** 109 * @brief RAM disk descriptor. 110 */ 111 typedef struct ramdisk { 112 /** 113 * @brief RAM disk block size, the media size. 114 */ 115 uint32_t block_size; 116 117 /** 118 * @brief Number of blocks on this RAM disk. 119 */ 120 rtems_blkdev_bnum block_num; 121 122 /** 123 * @brief RAM disk memory area. 124 */ 125 void *area; 126 127 /** 128 * @brief RAM disk is initialized. 129 */ 130 bool initialized; 131 132 /** 133 * @brief Indicates if memory is allocated by malloc() for this RAM disk. 134 */ 135 bool malloced; 136 137 /** 138 * @brief Trace enable. 139 */ 140 bool trace; 141 } ramdisk; 142 143 extern const rtems_driver_address_table ramdisk_ops; 144 145 /** 146 * @brief Allocates and initializes a RAM disk descriptor. 147 * 148 * The block size will be @a block_size. The block count will be @a 149 * block_count. The disk storage area begins at @a area_begin. If @a 150 * area_begin is @c NULL, the memory will be allocated and zeroed. Sets the 151 * trace enable to @a trace. 152 * 153 * @return Pointer to allocated and initialized ramdisk structure, or @c NULL 154 * if no memory is available. 155 * 156 * @code 157 * rtems_status_code create_ramdisk( 158 * const char *disk_name_path, 159 * uint32_t block_size, 160 * rtems_blkdev_bnum block_count 161 * ) 162 * { 163 * rtems_status_code sc = RTEMS_SUCCESSFUL; 164 * rtems_device_major_number major = 0; 165 * ramdisk *rd = NULL; 166 * dev_t dev = 0; 167 * 168 * sc = rtems_io_register_driver(0, &ramdisk_ops, &major); 169 * if (sc != RTEMS_SUCCESSFUL) { 170 * return RTEMS_UNSATISFIED; 171 * } 172 * 173 * rd = ramdisk_allocate(NULL, block_size, block_count, false); 174 * if (rd == NULL) { 175 * rtems_io_unregister_driver(major); 176 * 177 * return RTEMS_UNSATISFIED; 178 * } 179 * 180 * dev = rtems_filesystem_make_dev_t(major, 0); 181 * 182 * sc = rtems_disk_create_phys( 183 * dev, 184 * block_size, 185 * block_count, 186 * ramdisk_ioctl, 187 * rd, 188 * disk_name_path 189 * ); 190 * if (sc != RTEMS_SUCCESSFUL) { 191 * ramdisk_free(rd); 192 * rtems_io_unregister_driver(major); 193 * 194 * return RTEMS_UNSATISFIED; 195 * } 196 * 197 * return RTEMS_SUCCESSFUL; 198 * } 199 * @endcode 200 */ 201 ramdisk *ramdisk_allocate( 202 void *area_begin, 203 uint32_t block_size, 204 rtems_blkdev_bnum block_count, 205 bool trace 206 ); 207 208 void ramdisk_free(ramdisk *rd); 209 210 /** @} */ 211 90 212 /** @} */ 91 213
Note: See TracChangeset
for help on using the changeset viewer.