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