Chinaunix首页 | 论坛 | 博客
  • 博客访问: 433161
  • 博文数量: 72
  • 博客积分: 1583
  • 博客等级: 上尉
  • 技术积分: 775
  • 用 户 组: 普通用户
  • 注册时间: 2010-09-23 09:36
文章分类

全部博文(72)

文章存档

2011年(72)

我的朋友

分类: LINUX

2011-01-26 13:39:29

A block device is a storage device that supports reading and (optionally) writing data in fixed-size blocks, sectors, or clusters. These blocks are generally 512 bytes or a multiple thereof in size. The term is often used in contrast with a word-addressed device which supports reading and writing data a word at a time, where a word is usually 1 to 8 bytes in size.

  • Block devices using rotating media(旋转介质)
    • Floppy disk drives
    • Hard drives
    • Optical drives such as CD-ROM, DVD-ROM, UMD-ROM
  • Block devices using solid-state media
    • NAND flash memory, such as CompactFlash, SmartMedia, Memory Stick, and Secure Digital cards, and the internal storage of some cameras, phones, and PDAs
    • Some NOR flash memory and ROM parts, especially those used on small handheld devices (such as cameras or the Nintendo DS) or devices that are also designed to use other block devices such as NAND flash memory
  • Word-addressed devices using solid-state media
    • Other NOR flash memory and ROM parts, such as NES, Super NES, N64, Game Boy, Game Boy Color, and Game Boy Advance Game Paks
    • Nearly all RAM
Advantages

A block device generally requires fewer pins and can thus be placed in a smaller package than a word-addressed device. In addition, a block device interface to slower forms of memory, such as rotating media and NAND flash, is much easier to build than a word-addressed interface.

Drawbacks

For some purposes, a block device based on a given solid-state memory is slower than a word-addressed device based on the same memory because a read or write must start at the beginning of the block. Therefore, to read any part of the block, one must seek to the start of the block, read the whole block, and discard the other data if it will not be used. To write part of the block, one must seek to the start of the block, read the whole block into memory, change the data, seek to the start of the block again, and write the whole block back to the device. This is in addition to the typically longer seek times of storage technologies used on block devices.

Simulating ROM using a block device

Because a CPU generally needs random access to individual bytes of program and data memory, a program stored on a block device needs to be copied to a word-addressed memory before it can be used. The N-Gage, GP32, and Nintendo DS systems, as well as all home computers and disc-based consoles, play games stored on block devices and have enough RAM to hold enough of a program in memory at once that loading rarely interrupts game play. Programs for those systems are designed to wait until the system finishes loading data before doing anything with the data, either by freezing game play briefly or by playing one part of a map while loading another.

But on a system expecting a large word-addressed read-only memory, such as an NES, a GBC, a GBA, or any of several other video game systems, an adapter for a block device needs to contain enough NOR flash or RAM to hold a program. Copying from a block device to RAM is quicker than copying it to NOR flash, but NOR flash generally uses less power than RAM and retains the last program copied to it even when the power is turned off.

Implementations in practice

The first device that could copy programs from a block device to RAM and then run them on a GBA was the GBACD, an ATA interface designed by Michal Lysek and Tobias Persson, two students from Halmstad University in Sweden. A program running on a microcontroller could read games from a hard drive or CD and run them. It was designed as a proof of concept, not as an all-in-one piracy solution, but the foundation was laid for Supercard, especially as CompactFlash is electrically identical to ATA.

The Supercard and M3 adapters contain 32 MB of RAM and a slot for a CF or SD card. They can play nearly all homebrew and pirated GBA games by copying them from the NAND memory to the faster memory and then handing control over to the GBA, though some do require patching so that savegames can be copied to the NAND memory. The EZ-Flash III and EFA II contain 32 MB of NOR flash memory used in a similar way, along with a much larger built-in NAND memory that can be rewritten but not swapped.

The GBA Movie Player, on the other hand, was not designed to run pirated GBA games. It has only 512 kilobytes of NOR memory, enough to store the firmware, which reads from CF. This lets it run only multiboot programs on the GBA, although some multiboot programs such as the built-in audio and video players and special versions of PocketNES and Goomba use an ATA driver to read and write from the CF card, swapping data in and out of RAM as needed. However, this swapping can sometimes create game play delays, especially with larger games in PocketNES, as the original games were not designed to wait for loading.

阅读(1929) | 评论(0) | 转发(0) |
0

上一篇:loop设备简介

下一篇:文件同步系统 DRBD

给主人留下些什么吧!~~