forked from alanc98/rki
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathramdisk.c
49 lines (39 loc) · 791 Bytes
/
ramdisk.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
* ramdisk.c
*
* RTEMS Project (http://www.rtems.org/)
*
* Copyright 2007 Chris Johns ([email protected])
*/
#include "rki_config.h"
#include <rtems/ramdisk.h>
#include <rtems/blkdev.h>
#include <rtems/libio.h>
#ifdef RKI_INCLUDE_RAMDISK
#define RAMDISK_BLOCK_SIZE (512)
#define RAMDISK_BLOCK_COUNT RAM_DISK_0_BLOCKS
#define RAMDISK_PATH "/dev/ramdisk"
dev_t dev = 0;
int setup_ramdisk (void)
{
int rc = 0;
rc = rtems_disk_io_initialize ();
if ( rc == RTEMS_SUCCESSFUL )
{
rc = ramdisk_register (RAMDISK_BLOCK_SIZE, RAMDISK_BLOCK_COUNT,
false, RAMDISK_PATH, &dev);
if ( rc == RTEMS_SUCCESSFUL )
{
return(0);
}
else
{
return(rc);
}
}
else
{
return(rc);
}
}
#endif