Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

To use the NOR driver, five files, in addition to the generic file system files, must be included in the build:

  • fs_dev_nor.c.
  • fs_dev_nor.h.
  • fs_dev_nor_bsp.c (located in the user application or BSP).
  • A physical-layer driver (e.g., as provided in \Micrium\Software\uC-FS\Dev\NOR\PHY)

The file fs_dev_nor.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 directories must be on the project include path:

  • \Micrium\Software\uC-FS\Dev\NOR
  • \Micrium\Software\uC-FS\Dev\NOR\PHY

A single NOR volume is opened as shown in . The file system initialization (FS_Init()) function must have previously been called.

ROM characteristics and performance benchmarks of the NOR driver can be found in section Driver Characterization. The NOR driver also provides interface functions to perform low-level operations (see section FAT System Driver Functions).

Listing 16-1 Opening a NOR device volume

L16-1(1) Register the NOR device driver FSDev_NOR.

L16-1(2) The NOR device configuration should be assigned. For more information about these parameters, see section D-3 “FS_DEV_NOR_CFG”.

L16-1(3) 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 (“nor”), a single colon, an ASCII-formatted integer (the unit number) and another colon.

L16-1(4) FSDev_NOR_LowFmt() low-level formats a NOR. If the NOR has never been used with µC/FS, it must be low-level formatted before being used. Low-level formatting will associate logical sectors with physical areas of the device.

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.

FSVol_Fmt() formats a file system device. If the NOR has just been low-level format, it will have no file system on it after it is opened (it will be unformatted) and must be formatted before files can be created or accessed.

If the NOR initialization succeeds, the file system will produce the trace output as shown in Figure 16-1 (if a sufficiently high trace level is configured). See section E-9 “Trace Configuration” about configuring the trace level.

  • No labels