Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Anchor10465221046522 Using the RAM Disk Driver Anchor10465231046523To use the RAM disk driver, two files, in addition to the generic FS files, must be included in the build: Anchor10465241046524

...

The file fs_dev_ramdisk.h must also be #included in any application or header files that directly reference the driver (for example, by registering the device driver). The following directory must be on the project include path: Anchor10465271046527

...

Anchor10465281046528A single RAM disk is opened as shown in . The file system initialization (FS_Init()) function must have previously been called. Anchor10478931047893

ROM/RAM characteristics and performance benchmarks of the RAM disk driver can be found in section 911-1-1 “Driver Characterization” on page 113. For more information about the FS_DEV_RAM_CFG structure, see section D-4 “FS_DEV_RAM_CFG” on page 488. Anchor10479501047950  

...

...

Listing 13-1 Opening a RAM disk volume

L13-1(1) The sector size and number of sectors in the RAM disk must be defined. The sector size should be 512, 1024, 2048 or 4096; the number of sectors will be determined by your application requirements. This defines a 24-MB RAM disk (49152 512-B sectors). On most CPUs, it is beneficial to 32-bit align the RAM disk, since this will speed up access.

...

L13-1(2) Register the RAM disk driver FSDev_RAM.

...

L13-1(3) The RAM disk parameters—sector size, size (in sectors) and pointer to the disk—should be assigned to a FS_DEV_RAM_CFG structure.

...

L13-1(4) FSDev_Open() opens/initializes a file system device. The parameters are the device name (3a) and a pointer to a device driver-specific configuration structure (3b). The device name (3a) s composed of a device driver name (“ram”), a single colon, an ASCII-formatted integer (the unit number) and another colon.

...

L13-1(5) FSVol_Open() opens/mounts a volume. The parameters are the volume name (5a), the device name (5b) and the partition that will be opened (5c). There is no restriction on the volume name (5a); however, it is typical to give the volume the same name as the underlying device. If the default partition is to be opened, or if the device is not partition, then the partition number (5c) should be zero.

...

L13-1(6) FSVol_Fmt() formats a file system volume. If the RAM disk is in volatile RAM, it have no file system on it after it is opened (it will be unformatted) and must be formatted before a volume on it is opened.

Anchor10465841046584If the RAM disk initialization succeeds, the file system will produce the trace output as shown in Figure 11 Figure 13-1 (if a sufficiently high trace level is configured). See section E-9 “Trace Configuration” on page 507 about configuring the trace level. Anchor10478691047869 Image Removed

...

Image Added

Figure 13-1 RAM disk initialization trace output

...

Anchor10464061046406