Home |
The ISO 9660 File System Structure The exFAT File System Structure RTFiles-32 in Embedded Applications RAM Disk Driver |
RAM Disk DriverThe RAM disk driver does not require any hardware. It uses function malloc to allocate space to store files. The device configuration specifies the maximum size the RAM disk should have, but the driver will only allocate sectors as they are used. Thus, even if you request a RAM disk of 256M, for example, but write files with only 3M size to the RAM disk, only those 3M (plus some overhead for FAT and directories) will be allocated. When files are deleted, the space previously allocated to the files is deallocated with function free. RAM disks format themselves automatically as an FAT-12 or FAT-16 volume when the disk is mounted. The application can reformat RAM disks as FAT-32, if desired. Any number of RAM disks can be installed. The RAMDisk driver is reentrant as long as malloc and free can be called simultaneously from several tasks. Device flag RTF_DEVICE_NEW_LOCK is supported for each RAM disk. RTFDevice.DeviceTypeRTFDevice.DeviceType may be set to either RTF_DEVICE_FLOPPY or RTF_DEVICE_FDISK. RTFDevice.DeviceNumberThis field is ignored and should be set to 0, even if several RAM disks are used. RTFDevice.DeviceFlagsThe RAM disk driver does not define any device dependent device flags. Note that device independent flag RTF_DEVICE_SINGLE_FAT is not required, because the RAM disk driver will format the RAM disk with a file system with a single FAT by default. All other device independent flags documented in section Device List are supported. RTFDevice.DriverThis field must point to RTFDrvRAM. RTFDevice.DriverDataThe RAM disk driver requires a pointer to a structure of type RTFDrvRAMData for RTFDevice.DriverData with the following layout: typedef struct { DWORD Sectors; ... } RTFDrvRAMData; RTFDrvRAMData.Sectors specifies the maximum size of the RAM disk, in sectors of 512 bytes. If set to 0, a RAM disk with a maximum size of approximately 4M is set up. The other fields of RTFDrvRAMData are for the driver's internal use and should be left uninitialized or initialized to 0.
|