Device Operations
The ultimate purpose of a file system device is to hold data. Consequently, two major operations that can occur on a device are the reading and writing of individual sectors. Five additional operations can be performed which affect not just individual sectors, but the whole device:
- A device can be opened. During the opening of a device, it is initialized and its characteristics are determined (sector size, number of sectors, vendor).
- A device can be partitioned. Partitioning divides the final unallocated portion of the device into two parts, so that a volume could be located on each (see Partitions).
- A device can be low-level formatted. Some device must be low-level formatted before being used.
- A device can be (high-level) formatted. (High-level) formatting writes the control information for a file system to a device so that a volume on it can be mounted. Essentially, (high-level) formatting is the process of creating a volume on an empty device or partition.
- A device can be closed. During the closing of a device, it is uninitialized (if necessary) and associated structures are freed.
These operations and the corresponding API functions are discussed in this section. For information about using device names, see µC/FS Device and Volume Names.
Function | Description |
---|---|
FSDev_AccessLock() | Acquire exclusive access to a device. |
FSDev_AccessUnlock() | Release exclusive access to a device. |
| Remove device from file system. |
| Get number of partitions on a device. |
FSDev_Invalidate() | Invalidate files and volumes open on a device. |
| Perform device I/O control operation. |
| Add device to file system. |
| Add partition to device. |
| Find partition on device and get information about partition. |
| Initialize partition on device. |
| Get device information. |
| Read sector on device. |
| Refresh device in file system. |
| Write sector on device. |