RTEMS: cpukit/include/rtems/ramdisk.h Source File

| RTEMS 5.4-rc2

Loading...
Searching...
No Matches
ramdisk.h
Go to the documentation of this file.
1
7/*
8 * Copyright (C) 2001 OKTET Ltd., St.-Petersburg, Russia
9 * Author: Victor V. Vengerov <vvv@oktet.ru>
10 */
11
12#ifndef _RTEMS_RAMDISK_H
13#define _RTEMS_RAMDISK_H
14
15
16#include <rtems.h>
17#include <rtems/blkdev.h>
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
39 typedef struct rtems_ramdisk_config {
43 uint32_t block_size;
44
48 rtems_blkdev_bnum block_num;
49
54 void *location;
55} rtems_ramdisk_config;
56
63extern rtems_ramdisk_config rtems_ramdisk_configuration [];
64
71extern size_t rtems_ramdisk_configuration_size;
72
76 rtems_device_driver ramdisk_initialize(
77 rtems_device_major_number major,
78 rtems_device_minor_number minor,
79 void *arg
80);
81
85#define RAMDISK_DRIVER_TABLE_ENTRY \
86 { \
87 ramdisk_initialize, \
88 NULL, NULL, NULL, NULL, NULL \
89 }
90
91#define RAMDISK_DEVICE_BASE_NAME "/dev/rd"
92
103 typedef struct ramdisk {
107 uint32_t block_size;
108
112 rtems_blkdev_bnum block_num;
113
117 void *area;
118
122 bool initialized;
123
127 bool malloced;
128
132 bool trace;
133
137 bool free_at_delete_request;
138} ramdisk;
139
140int ramdisk_ioctl(rtems_disk_device *dd, uint32_t req, void *argp);
141
184 ramdisk *ramdisk_allocate(
185 void *area_begin,
186 uint32_t media_block_size,
187 rtems_blkdev_bnum media_block_count,
188 bool trace
189);
190
191void ramdisk_free(ramdisk *rd);
192
193static inline void ramdisk_enable_free_at_delete_request(ramdisk *rd)
194{
195 rd->free_at_delete_request = true;
196}
197
209 rtems_status_code ramdisk_register(
210 uint32_t media_block_size,
211 rtems_blkdev_bnum media_block_count,
212 bool trace,
213 const char *disk
214);
215
220#ifdef __cplusplus
221}
222#endif
223
224#endif
blkdev.h
Block Device Management.
rtems_status_code
rtems_status_code
Classic API Status.
Definition: status.h:43
rtems_blkdev_bnum
uint32_t rtems_blkdev_bnum
Block device block index type.
Definition: diskdevs.h:45
ramdisk_register
rtems_status_code ramdisk_register(uint32_t media_block_size, rtems_blkdev_bnum media_block_count, bool trace, const char *disk)
Allocates, initializes and registers a RAM disk.
Definition: ramdisk-register.c:29
rtems_ramdisk_configuration
rtems_ramdisk_config rtems_ramdisk_configuration[]
External reference to the RAM disk configuration table describing each RAM disk in the system.
ramdisk_allocate
ramdisk * ramdisk_allocate(void *area_begin, uint32_t media_block_size, rtems_blkdev_bnum media_block_count, bool trace)
Allocates and initializes a RAM disk descriptor.
Definition: ramdisk-init.c:32
ramdisk_initialize
rtems_device_driver ramdisk_initialize(rtems_device_major_number major, rtems_device_minor_number minor, void *arg)
RAM disk driver initialization entry point.
rtems_ramdisk_configuration_size
size_t rtems_ramdisk_configuration_size
External reference the size of the RAM disk configuration table rtems_ramdisk_configuration.
rtems.h
ramdisk
RAM disk descriptor.
Definition: ramdisk.h:103
ramdisk::block_num
rtems_blkdev_bnum block_num
Number of blocks on this RAM disk.
Definition: ramdisk.h:112
ramdisk::block_size
uint32_t block_size
RAM disk block size, the media size.
Definition: ramdisk.h:107
ramdisk::initialized
bool initialized
RAM disk is initialized.
Definition: ramdisk.h:122
ramdisk::malloced
bool malloced
Indicates if memory is allocated by malloc() for this RAM disk.
Definition: ramdisk.h:127
ramdisk::free_at_delete_request
bool free_at_delete_request
Free the RAM disk at the block device delete request.
Definition: ramdisk.h:137
ramdisk::trace
bool trace
Trace enable.
Definition: ramdisk.h:132
ramdisk::area
void * area
RAM disk memory area.
Definition: ramdisk.h:117
rtems_disk_device
Description of a disk device (logical and physical disks).
Definition: diskdevs.h:157
rtems_ramdisk_config
RAM disk configuration table entry.
Definition: ramdisk.h:39
rtems_ramdisk_config::location
void * location
RAM disk location or NULL if RAM disk memory should be allocated dynamically.
Definition: ramdisk.h:54
rtems_ramdisk_config::block_num
rtems_blkdev_bnum block_num
Number of blocks on this RAM disk.
Definition: ramdisk.h:48
rtems_ramdisk_config::block_size
uint32_t block_size
RAM disk block size.
Definition: ramdisk.h:43