You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
907 B
33 lines
907 B
#ifndef _RAMDEV_H_
|
|
#define _RAMDEV_H_
|
|
|
|
#include "riscv.h"
|
|
#include "util/types.h"
|
|
|
|
#define RAMDISK_BLOCK_COUNT 128
|
|
#define RAMDISK_BLOCK_SIZE PGSIZE
|
|
|
|
#define MAX_RAMDISK_COUNT 10
|
|
|
|
#define RAMDISK_FREE 0
|
|
#define RAMDISK_USED 1
|
|
|
|
struct rfs_device {
|
|
void *d_address; // the ramdisk base address
|
|
int d_blocks; // the number of blocks of the device
|
|
int d_blocksize; // the blocksize (bytes) per block
|
|
void *iobuffer; // iobuffer for write/read
|
|
int (*d_write)(struct rfs_device *rdev, int blkno); // device write funtion
|
|
int (*d_read)(struct rfs_device *rdev, int blkno); // device read funtion
|
|
};
|
|
|
|
#define dop_write(rdev, blkno) ((rdev)->d_write(rdev, blkno))
|
|
#define dop_read(rdev, blkno) ((rdev)->d_read(rdev, blkno))
|
|
|
|
struct device *init_rfs_device(const char *dev_name);
|
|
struct rfs_device *alloc_rfs_device(void);
|
|
|
|
extern struct rfs_device *rfs_device_list[MAX_RAMDISK_COUNT];
|
|
|
|
#endif
|