1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @ingroup rtems_ramdisk |
---|
5 | * |
---|
6 | * RAM disk block device. |
---|
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> |
---|
21 | #include <rtems/blkdev.h> |
---|
22 | |
---|
23 | #ifdef __cplusplus |
---|
24 | extern "C" { |
---|
25 | #endif |
---|
26 | |
---|
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 | */ |
---|
38 | typedef struct rtems_ramdisk_config { |
---|
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; |
---|
54 | } rtems_ramdisk_config; |
---|
55 | |
---|
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. |
---|
69 | */ |
---|
70 | extern size_t rtems_ramdisk_configuration_size; |
---|
71 | |
---|
72 | /** |
---|
73 | * RAM disk driver initialization entry point. |
---|
74 | */ |
---|
75 | rtems_device_driver ramdisk_initialize( |
---|
76 | rtems_device_major_number major, |
---|
77 | rtems_device_minor_number minor, |
---|
78 | void *arg |
---|
79 | ); |
---|
80 | |
---|
81 | /** |
---|
82 | * RAM disk driver table entry. |
---|
83 | */ |
---|
84 | #define RAMDISK_DRIVER_TABLE_ENTRY \ |
---|
85 | { \ |
---|
86 | .initialization_entry = ramdisk_initialize, \ |
---|
87 | RTEMS_GENERIC_BLOCK_DEVICE_DRIVER_ENTRIES \ |
---|
88 | } |
---|
89 | |
---|
90 | /** @} */ |
---|
91 | |
---|
92 | #ifdef __cplusplus |
---|
93 | } |
---|
94 | #endif |
---|
95 | |
---|
96 | #endif |
---|