Some media types have built-in copy-protection capabilities. For example, an SD Card can be configured to require authentication before allowing access to the card’s contents, and a card can restrict the number of allowed copies.
Removable Media and Devices
A device can have removable media, and an entire device can be removable from the computer that communicates with the device.
In a drive with removable media, users can easily insert and remove media in the drive. CD and DVD drives have removable media because you can easily swap discs. A memory-card reader with a card slot has removable media. Hard drives and flash drives have non-removable media because you can’t easily remove the hard disk from its drive or the flash memory from its circuit board. A device reports whether it has removable media in the response to a SCSI INQUIRY command. Some flash drives with non-removable media report that they have removable media. Chapter 6 has more about the INQUIRY command.
An entire storage device can also be removable or non-removable from the computer that accesses the drive. USB drives are removable. An internal drive is considered non-removable because removing the drive requires more work than detaching a cable.
A user can detach a USB device or remove a flash-memory card at any time. If a device or card is removed while the host is writing to the media, the device and host should detect the removal and handle it as gracefully as possible.
A storage device can support one or more interfaces to its storage media. In most cases, the device’s CPU doesn’t access the media directly. Instead, the CPU communicates with an intelligent controller embedded in a drive or flash-memory card. In devices that support USB, the CPU also interfaces to a USB device controller.
When you need a lot of storage, a hard drive is the most economical choice. At this writing, a megabyte of hard-drive storage is 50 to 100 times cheaper than a megabyte in a flash-memory card. Prices for both media continue to fall, and the price differential may change over time, but for the near future, hard drives are likely to continue to be the favored solution for storing very large amounts of data.
Because they use mechanical drive components, hard drives tend to be more fragile than completely electronic media such as flash memory. Modern drives are much more rugged than in the past, however. For embedded systems that need to fit in a small space, tiny hard drives are available in the USB key-drive form factor and in Type II CompactFlash cards.
The most common interface between a hard drive and its CPU is the Parallel AT Attachment (ATA) interface, also known as the Integrated Drive Electronics (IDE) interface. A drive that uses ATA must have an intelligent controller embedded in the unit. The ATA specification defines the cables and connectors, signals, and registers and commands for communicating with the drive’s controller. ATA devices must support logical block addressing. A single ATA interface on a host computer can connect to up to two storage devices. The host computer communicates by reading and writing to registers in the device.
ATA with Packet Interface (ATAPI) is an extension to ATA that defines a protocol for sending SCSI and other commands to an ATA device in structures called command packets. CD and DVD drives use the ATAPI protocol. More information about ATA/ATAPI and links to the standard documents are at www.ncits.org.
Flash memory is non-volatile, electrically erasable storage available as chips and in cards that incorporate memory chips and a controller.