CN1299096A - High-capacity moving storage of universal serial bus interface and its implementation method - Google Patents

High-capacity moving storage of universal serial bus interface and its implementation method Download PDF

Info

Publication number
CN1299096A
CN1299096A CN 01100541 CN01100541A CN1299096A CN 1299096 A CN1299096 A CN 1299096A CN 01100541 CN01100541 CN 01100541 CN 01100541 A CN01100541 A CN 01100541A CN 1299096 A CN1299096 A CN 1299096A
Authority
CN
China
Prior art keywords
file
flash
state
data
memory card
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN 01100541
Other languages
Chinese (zh)
Inventor
常促宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
XIANFENG BOCHUANG SCINECE & TECHNOLOGY DEVELOPMENT Co Ltd BEIJING
Original Assignee
Individual
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Individual filed Critical Individual
Priority to CN 01100541 priority Critical patent/CN1299096A/en
Publication of CN1299096A publication Critical patent/CN1299096A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Stored Programmes (AREA)

Abstract

A large coapacity mobile storage for universal serival bus interface is composed of two units, one mobile storage inserted board constituted by the hard ware circuit and control software embedded in the terminal of PC host and the driver program in the terminal of PC host, the mobile storage inserted board contains the microprocessor CPU and two flash memorys, one spare EEPROM memory connected with the CPU, power source, crystal vibrator and USB inter face connected with PC host. The present invention has high transmission speed and access speed of USB interface.

Description

Large capacity movable memory and its implementation of USB
The invention belongs to field of computer technology, particularly to the design of movable storage device.
At present the movable storage device that generally used of computer still with the floppy drive of 1.44MB as main flow, some new memories have also appearred in the while, such as ZIP, MO, CD writer, external hard disk etc. But these equipment all exist very large defective as mobile memory: the employed floppy disk low price of floppy drive, but reliability extreme difference, and capacity is little, and speed is slow, and short, easily damage of life-span is inconvenient to carry, and does not have the data security guarantee; Other Novel movable memories are then on the high side, and install and carry inconvenience, the standard disunity, and generally adopt serial paralled interface, speed is slow, does not also have data security to guarantee.
The objective of the invention is in order to solve the weak point of prior art, a kind of mobile memory of USB interface is proposed, in conjunction with FLASH memory technology and two state-of-the-art technologies of USB interface, program is deposited in the PC end driver, when equipment access, automatically download and carry out; Adopt the double buffering memory technology, greatly improved the transmission speed of USB interface; The Rapid storage technique that adopts body to intersect has greatly improved data storage speed; And data transfer had advantage reliable, that the side is portable and cheap with carrying.
The large capacity movable memory of a kind of USB that the present invention proposes is characterized in that, comprises the mobile memory plate that is made of hardware circuit, and control software and the driver two parts in the PC main frame end of embedding PC main frame end form; Wherein, the mobile memory plate comprises microprocessor CPU and coupled two Flash memories, alternative eeprom memory, the USB interface that is connected with the PC main frame, crystal oscillator input pin by microprocessor CPU provides the crystal oscillator of working pulse for it, supply with the power supply of said CPU, Flash memory or EEPROM voltage, said Flash memory connects with CPU by the IO port of data/address bus and CPU; Said alternative eeprom memory links to each other with CPU by the I2C bus; The control software of said embedding PC main frame end is by the system mode machine, and the IO driver of usb protocol stack and Flash forms; Driver in the said PC main frame is by the driver of downloading code, and the device driver of normal operation and IO port drivers form.
Function of the present invention and characteristics:
Reliability and safe:
Basic function of the present invention is reliable, safety, copies easily and fast, carries data file; Because its memory adopts erasable flash memory---FLASH, the reliability of save data is high, and effectively erase-write cycles is greater than 1,000,000 times; The data that deposit in can be can safe storage in the situation that does not need power supply more than 10 years; And owing to there is not mechanical transmission component, its anti-seismic performance is excellent, can guarantee to carry the safety of middle data.
Speed is fast, low in energy consumption:
The present support usb protocol 1.0 of this memory, the transmission speed of the USB interface of realization is 8Mbps: even the writing speed of serial Flash is slower, but the memory technology that the present invention adopts body to intersect improves systematic function greatly. Actual access speed of the present invention is: writing rate 3.2Mbps-5Mbps, read-out speed are 5.6Mbps-7.2Mbps (speed of actual speed rate and PC main frame has relation); Use in the future FLASH more at a high speed, and be upgraded to the transfer rate that usb protocol 2.0 can be supported the 360-480Mb per second; Maximum power dissipation of the present invention is 1W, and energy-saving mode is arranged.
Memory capacity is large:
Since adopted the FLASH (being the multiplexing FLASH of data address bus) of serial, 8051 cheap processors namely can be adopted, and broken through the restriction of its 64K addressing space, the easily capacity of spread F LASH memory; The present serial capacity of the present invention is 8MB~512MB; But termination capacity of the present invention only is subjected to the monolithic capacity of memory and the restriction of cost; Along with the increase of FLASH monolithic capacity, the present invention is the extension storage capacity thereupon.
Function is strong, and upgrading is convenient:
Microprocessor-based control program of the present invention is not to solidify in ROM, but be arranged in driver, when system power-up, the operating system of PC main frame drives according to the ID loading equipemtn that obtains from the present invention, driver of the present invention arranges by default usb protocol the microprocessor-based control program is downloaded among the RAM of the present invention by USB interface, and then system starts working. This characteristic makes the present invention realize control, interruption, batch transmission and four kinds of transmission modes of synchronous transfer in the usb protocol by different driver, any upgrading to usb protocol, microprocessor any arranged adjustment, and all only needing more, newer driver gets final product.
Easy to use:
In PC main frame unlatching situation, only need the USB joint is inserted and can use; Support hot plug of the present invention (namely not needing shuts down computer just can plug this equipment), support real plug and play, behind access the present invention, the operating system of PC main frame will be written into driver of the present invention automatically; Simultaneously the present invention does not need external power source, and system power supply is directly supplied with by USB interface; The present invention only has the chewing gum size, is fit to very much carry; Drive and disc (storage chip) unification, versatility is good.
Compatible good, extended capability is strong:
Along with the extensive use of USB technology, the present invention can extensive work on various equipment with USB interface, such as the PC main frame, notebook, Macintosh etc., its applicable PC host operating system is Win98, Win2000, WinCE, Linux etc. Memory span of the present invention can expand easily, only needs to change the FLAH chip and gets final product; What is more important, the present invention has the good extended capability of USB interface, can connect simultaneously 64 the present invention on usb bus, has broken through string, a parallel port and can only connect a restriction of the present invention.
System cost is low:
The present invention about 80% cost concentrates on core memory FLASH; Why adopting the higher FLASH of present cost as memory, mainly is the good application prospect of high reliability, convenience and existence of considering FLASH; Just owing to FLASH these characteristics as memory device, the at present application of FLASH is increasingly extensive, and the core memory of the equipment such as computer BIOS, MP3 walkman, digital camera is FLASH. At present in the world main memory device manufacturer is all in the production capacity of large-scale spread F LASH, so FLASH is about to become follow-on main flow storage medium.
Because this memory has and drives and disc unification, life-span grow, do not need that every computer all disposes a driver as the floppy drive, reality has reduced the whole system cost; And along with the decline of core memory FLASH production cost, the present invention is expected to become following main flow movable storage device.
Market potential is huge:
Quantitative according to mole, core memory Flash capacity is with exponent increase, and cost is index decreased then, and this product will become the high desirable mobile memory of the ratio of performance to price; Simultaneously, along with the increasingly extensive application of USB technology and the excellent properties of this product, this mobile memory will progressively be obtained the BIOS support of each mainboard manufacturer and the driving support of PC host operating system, realization is from the startup of this driver and direct memory function, thereby can thoroughly eliminate floppy disk and become the standard configuration of computer.
Compare with other data storage devices, characteristics of the present invention are:
1, reliability: erase-write cycles 000 time, is higher than ZIP, MO dish greater than 1,000;
2, operation convenience: do not need to install, support hot plug, the operation most convenient;
3, versatility: driver and memory one are adapted to the computer equipment of any USB of having, RS232 interface;
4, volume: much smaller than floppy disk, hard disk, ZIP, MO disk drive;
5, speed: be 50 times of floppy drive; Adopt USB2.0 will reach the speed of high speed hard-disk;
6, capacity: far above floppy disk, can reach ZIP, MO dish capacity;
7, cost: be higher than floppy drive, far below ZIP, MO disk drive;
Brief Description Of Drawings:
Fig. 1 is the circuit theory diagrams of the mobile memory hardware architecture of USB interface of the present invention.
Fig. 2 is the control software of embedding PC main frame end of the present invention and the overall structure schematic diagram of the driver in the PC main frame end.
Fig. 3 is the example structure schematic diagram of the control software of embedding PC main frame end of the present invention.
Fig. 4 is the conversion program schematic diagram of state machine state of the present invention.
Fig. 5 is usb protocol stack state figure of the present invention.
Fig. 6 is the automatic download embodiment schematic flow sheet of program of the present invention.
Fig. 7 is the embodiment workflow schematic diagram of the transmission data of ping-pong buffer of the present invention.
Fig. 8 is the embodiment schematic flow sheet of ping-pong buffer receive data of the present invention.
Fig. 9 is the embodiment write-in program flow chart of built-in end body interleaved of the present invention.
Figure 10 is the embodiment flow chart of the present invention's driver of downloading code.
Figure 11 is access-in management program embodiment flow chart of the present invention.
Figure 12 is the program embodiment flow chart that the present invention realizes the IO control program.
Figure 13 is that the data of PC end body interleaved mode of the present invention send program embodiment flow chart.
The large capacity movable memory embodiment of the USB interface of the present invention's design comprises the mobile memory plate that is made of hardware circuit, and control software and the driver two parts in the PC main frame end of embedding PC main frame end form. Wherein, the general structure of mobile memory plate as shown in Figure 1, among the figure:
1, J1 is the USB interface plug among the figure, is the joint that this memory card is connected with the USB interface of PC main frame, and its type is the male joint of USB-A mouth; D+ in the usb bus and D-are a pair of holding wire of checking the mark, and directly link to each other with the usb signal spool pin of CPU.
2, U6 (CMPWR) device is the CMPWR150 chip, this chip from the VCC of usb bus (+5V) line obtains power supply, and is converted into the output voltage of 3.3V, to supply with CPU, Flash memory or EEPROM.
3, U1 (EZUSB_80) is microprocessor AN2131QC; This processor passes through 8 data/address bus, and general output port links to each other with Flash memory (U3, U4), links to each other with EEPROM (U8) by the I2C bus. Its major function is to realize the USB interface agreement, carries out exchanges data with the PC main frame by usb bus, simultaneously by output timing control the Flash memory read-write, the operation such as wipe; Also can be by the startup of I2C bus realization from EEPROM. Because the present invention can realize the function that downloads from the PC main frame, so this EEPROM is an alternative devices.
4, U3, U4 (KM29U128T) are the Flash memory, and it connects with CPU by 8 data/address bus and the IO port of CPU; Its major function is to carry out data storage.
5, U8 (24LC00/01/64) is alternative EEPROM, links to each other with CPU by the I2C bus, and the executable program of storage CPU is finished the startup of CPU, to accelerate the toggle speed of this memory card during its Main Function.
6, Y1 is the crystal oscillator of 12MHz, and the working pulse of 12MHz is provided for CPU by the crystal oscillator input pin of CPU.
7, J2, J3, J4 are the hardware configuration wire jumper of this memory card, by wire jumper, can identify capacity and the sheet number of Flash memory.
Embodiment and the function of the main device of this memory card are respectively described below:
Microprocessor: the AN2131QC that adopts Cypress company; The kernel of this microprocessor is general 8051CPU, but 51 processors of a enhancement mode, cpu frequency is 24MHz, the instruction cycle is 4CLK; And this CPU is integrated USB interface engine and transceiver is a very high processor of the ratio of performance to price of the present invention that is suitable for. Its inner integrated module comprises: 8051 microprocessors of USB difference transceiver, USB SIE, enhancement mode and the RAM memory of 8K byte.
Flash memory: the Flash memory of the TC58256 series of the KM29U6400T of employing Samsung company~KM29U256T series or Toshiba company, this memory is the FLASH chip of a kind of address and multiplexed data bus, be characterized in storage density large (the monolithic capacity can not wait to the 128M byte from the 8M byte), little (20mm * the 12mm * 2mm) of volume, (chip pin compatibility of different capabilities) easy to use, low price, 8,051 two chip selection signals that provide can be provided, can be realized by an IO port all SECO of FLASH fully.
Power supply chip: realize that the 5V of USB interface is to the 3.3V voltage of microprocessor and Flash needs, adoptable model mainly contains the Max882 of Maxim company or the CMPWR150 of California Micro Devices company, and its rated operational current is 500mA.
EEPROM: this memory card hardware itself is a bare machine, its control program can be in access PC main frame downloading-running in the automatic slave driver; The upgrading of the very convenient program of these characteristics, and effectively reduce the cost of system; But shortcoming is exactly the process need 1-2 second of downloading. In order to consider different user's requests, this memory card has kept the position of ROM of the I2C of a 8KB, to make things convenient for the user to select, the characteristics of using EEPROM are exactly to start (just having realized startup in the time of access PC main frame) moment, also possess the characteristics that can upgrade at any time, shortcoming is exactly that cost slightly is improved. The model of the EEPROM that present embodiment adopts is AT24LC64 or the CAT24WC08 of Atmel company.
Other devices mainly are 1 of the crystal oscillators of 12MHz, 1 of light emitting diode, and resistance, electric capacity are some, and the function of these devices and the model of selecting all belong to general general knowledge, in this outline.
Software of the present invention comprises that the driver that runs on PC main frame end and the control program that moves sub-memory card hardware end consist of, because the automatic download of the control program that the present invention can realize the memory card hardware end from the PC main frame, so running on the control program of memory card hardware end actual is to leave in the driver of download code of PC main frame end, only in the USB interface of memory card hardware access PC main frame of the present invention, just automatically download to memory card and move, be called " the control software that embeds PC main frame end " so will run on the control program of memory card hardware end of the present invention. The control software of embedding PC main frame end and the overall structure of the driver embodiment in the PC main frame are as shown in Figure 2. Wherein, embed the control software of PC main frame end by the system mode machine, the IO driver of usb protocol stack and Flash forms; Driver in the PC main frame of the present invention is by the driver that is implemented in the download code of the present invention on the PC host operating system usb protocol stack, and device driver and IO port drivers three parts of the present invention of the present invention's normal operation form.
The control software that embeds PC main frame end refers to that mainly computing and the control program of 8051 little processing of this memory card, the main thought of design are the thought that adopts micro-kernel; Because the disposal ability of 8051CPU is limited, design philosophy of the present invention is 8051 only to be used for realizing basic, the simplest usb protocol and data transport service, and the realization of the function that other are complicated is placed on the powerful PC main frame end of disposal ability and realizes.
Example structure and the function of the control software of embedding PC main frame end of the present invention are shown as shown in Figure 3. Mainly comprise following three parts:
(1) system mode machine;
(2) usb protocol stack;
(3) the IO driver of Flash.
Wherein, state machine is the control main program, and it is responsible for dispatching the work of usb protocol stack and Flash driver; The USB protocol stack mainly be responsible for to be processed the agreement of USB, realizes data transmit-receive with the driver of PC main frame by usb bus, comprises the order that sends to state machine and common file data in the data; The Flash driver is responsible for mainly realizing and the communication of Flash that the machine that is main state realizes carrying out with Flash the passage of exchanges data, namely by the SECO of Flash, realizes that data are to the storage of Flash and from the upper reading out data of Flash.
State machine is the control main program of the control software of this embedding PC main frame end, mainly safeguards the functions such as the mutual exclusion between each treatment state, mutual conversion, realizes the scheduling of task. The implementation method embodiment of this state machine comprises:
1. definition status:
1) idle condition (Idle), CPU does not have task carrying out;
2) query State (Quest), CPU responds the querying command of PC
3) Flash erase status (Erase), CPU carries out the erase operation of Flash
4) Flash read states (Read), CPU carries out the operation of reading Flash
5) Flash writes state (Write), and CPU carries out the operation of writing Flash
2. define 2 operations:
1) remove current state operation (Clear), CPU compulsory withdrawal current state is returned idle condition;
2) reset operation (Reset), under any state, the equal executive system reset function of CPU
3. realize the conversion of state machine state, as shown in Figure 4, may further comprise the steps:
1) the wiping of state machine, read and write enter state and can only enter under idle condition;
2) query State can enter under any state;
3) under the idle condition, receive the Erase order, then enter erase status; All can not enter erase status under other states; After executing the Erase order, return idle condition;
4) under the idle condition, receive the Read order, then enter reading state; All can not enter reading state under other states; After executing the Read order, return idle condition;
5) under the idle condition, receive the Write order, then enter write state; All can not enter write state under other states; After executing the Write order, return idle condition;
6) at idle condition, erase status, read states and write state, if receive the Quest order, enter at once query State, until after executing query manipulation, return the front state of query State that enters.
7) between each state of state machine mutual exclusion mechanism is set, namely as long as current state does not finish (comprising that nature finishes and force to finish), state machine just can not carry out the state switching so. Mutual exclusion mechanism is the basic guarantee that guarantees each read-write operation integrality and correctness.
Above-mentioned mutual exclusion mechanism embodiment adopts the token method, specifically comprises the steps:
1) PC end program is carried out certain operation (such as reading and writing, wiping etc.) at needs, before entering certain state, must by the order pipeline, send a Quest order, application tokens to the present invention;
2) this memory card is received the Quest order, returns at once current token attribute, namely belongs to that state;
3) PC end program need to check the attribute of token, if current operation token number Idel state, PC end program has the right to apply for tokens so, otherwise PC end program must wait for, until the token attribute is Idel;
4) if it is Idel that PC end detects the token attribute that this memory card returns, program needs again to submit to this memory card by the order pipeline so needs the operation carried out, apply for simultaneously tokens;
5) after this memory card is received this application, check resource, check current token, if it is enough to meet resource, and current state is just carried out state switching, juxtaposition token attribute by the operation of application when being Idel;
6) after PC end program is submitted operation application, for guaranteeing to apply for successfully, still need to carry out a Quest order before each operation, confirm current token attribute to one's name.
This usb protocol stack mainly comprises the USB1.0 standard protocol stack; Three partial contents of ping-pong buffer are downloaded and arranged to program automatically: wherein, it is the new function that increases on USB standard protocol stack basis that program downloads automatically; In order to improve the speed of transfer of data, definition data transmit-receive buffering area is set to ping-pong buffer in the usb protocol stack. The concrete methods of realizing embodiment of each several part is described as follows:
The implementation method of USB1.0 standard protocol stack may further comprise the steps as shown in Figure 5:
Be connection status when 1) this memory card accesses usb bus, if there is the HUB of USB, the present invention just enters powering state so; When powering state, if HUB resets, perhaps lose the connection of HUB, the present invention returns connection status so;
2) at powering state, if receive the reset command of usb bus, the present invention enters default setting;
3) at default setting, if receive Address Assigned (configuration address) order of PC main frame, then the present invention enters adressed state;
4) in adressed state, if receive the inquiry of PC main frame or the order of configuration is set, the present invention just enters the configuration shape
5) when default setting, addressing attitude and configuration attitude, if power interruptions all will be returned powering state; If receive the reset command of USB bus, all will return default attitude;
6) when powering state, default attitude, addressing attitude and configuration attitude, if usb bus does not have signal transmission, then the present invention enters suspended state, with saves energy.
The purpose that realizes this function is exactly to finish the initialization operation of the present invention and PC main frame, is called " enumerating " (Enumeration) in usb protocol, and detailed process is as follows: connection status
This state refers to that this memory card can be connected on the USB interface or disconnects from interface, is first step that this memory card is started working.
Powering state (Powered):
The working power of this memory card is that 5V power supply from USB interface obtains, therefore, after the USB interface of this memory card access PC end, obtain the 5V power supply from the power line of usb bus, conversion chip by DC-DC, being converted to the operating voltage of 3.3V, supplying with the AN2131 microprocessor, is that microprocessor is started working; The operating current that this memory card needs is about 60mA.
Default setting:
After this memory card powers up, before receiving reset signal from bus, it should not respond the bus transmission. After receiving reset signal, the present invention's addressable that just becomes at the default addresses for use place.
Address state:
Before entering address state, the PC main frame at first must be identified the present invention number (ID) of this memory card, whether to differentiate a legal USB device, this operation is to be 0 by sending the address to usb bus, end points is " obtaining device context " (Get Descriptor) order of 0 (endpoint0), possesses end points 0 (endpoint0) because any equipment is all default, and must be that 0 packet responds to the address, therefore this memory card returns oneself device context to the PC main frame, and the description list content of this memory card is as shown in table 1:
Table 1
Side-play amount The territory Size Value Describe
0  Blength  1  0x12 The byte number of this description list
1  BdecriptorType  1  0x01 The description list kind is equipment
2  BcdUSB  2  0x0001 USB device explanation version number's (binary-coded decimal) of this equipment and description list compatibility
4  BdeviceClass  1  0x00 If the value in this territory of equipment class code be 0 one each interface be set down point out its class, and individual interface works alone separately. If the value in this territory is between 1~FEH, then equipment is supported different classes at different interfaces. And these interfaces may not work alone. This value has been pointed out, the class definition of these interface collectives. If this territory is made as FFH, then the class of this equipment is defined by manufacturer.
5  BdeviceSubClass  1  0x00 The concrete meaning of these code values of subclass code is according to the bDeviceClass territory. Be zero such as the bDeviceClass territory, this territory also must be for zero being FFH such as the bDeviceClass territory, all values reservation in this territory.
6  BDevicePortocol  1  00x00 The value of these yards of agreement code is decided on the value of bDeviceClass and bDevieeSubClass. If the agreement that the class on the equipment support equipment basis is relevant, this code mark the value in the equipment class explanation.
If the value in this territory is zero, this equipment relevant agreement of support equipment class on Equipment Foundations not then. Yet, it may be on interface basis the relevant agreement of support equipment class. If the value in this territory is FFH, this equipment uses the agreement of manufacturer's definition.
    7  BMaxPacketSize0  1  0x40 The maximum bag size (only 8,16,32,64 is legal value) of end points 0
    8  IdVendor  2  0x0547 Manufacturer's sign (by the USB standard value of paying)
    10  IdProduct  2  0x1002 Product marking (by manufacturer's value of paying)
    12  BcdDevice  0x0001 Equipment issue number (binary-coded decimal)
    14  IManufacturer  0x01 The index of the word string of manufacturer's information is described.
    15  IProduct  0x02 The index of the word string of product information is described.
    16  ISerialNumber  0x00 The index of the word string of equipment Serial Number information is described.
    17  BNumConfiguratio  0x01 The possible number that arranges
After the PC main frame is received the device context of this memory card, number load corresponding driver of the present invention according to the device id in the table, if success, the PC main frame sends a SetAddress order by end points 0 and address 0 to this memory card again, distribute a unique USB address for this memory card, after this memory card is received PC main frame SetAddress order, the address that the PC main frame is given deposits register in, later on this mobile memory of PC host access all uses this address, and this memory card is also only to the response package of this address. Configured (configuration status)
Before the normal operation of this memory card, the present invention must correctly be disposed. The content of configuration is exactly that PC is by sending " obtaining allocation list " (GetConfiguration ()), obtain content the allocation list from this memory card, and carry out resource distribution by this content at PC end, perhaps to this allocation list make amendment (SetConfiguration). The allocation list content of this memory card is as shown in table 2:
Table 2
Side-play amount The territory Size Value Describe
    0     bLength     1     0x01 The byte number of this description list.
    1  BDescriptorType     1     0x02 Configuration description list type
    2  WTotalLength     2     0x002e The overall length of this configuration information (comprising configuration, interface, the description list of end points and equipment class and manufacturer's definition)
    4  BNumInterfaces     1     0x01 The interface number that this configuration is supported
    5  BCongfigurationValue     1     0x01 In SetConfiguration () request, be used as parameter and select this configuration.
    6  IConfiguration     1     0x03 The word string description list index of this configuration is described
    7  BmAttributes     1     0xa0 Configuration feature: D7: keep (being made as one) D6: self-supporting power D5: Remote Wake Up D4..0: keep (being made as one) one not only with the bus power supply but also there is the equipment of self-supporting power can point out in the MaxPower territory electric weight that need to get from bus. And D6 is set is one. Run time the practical power pattern can be obtained by GetStatus (DEVICE) request.
    8  MaxPower     1     0x30 The bus power supply amount of expending under this configuration. Take 2mA as a unit.
Abort state
For saving power supply, this memory card enters abort state automatically when detection is transmitted less than bus. When ending, the internal state of this memory card maintenance itself comprises its address and configuration.
The automatic download of program is important characteristics of the present invention, the performing a programme that is 8051 microprocessors in the memory card of the present invention does not need ROM to preserve, but can leave in the driver of the present invention of PC main frame end, and finish the download of program and bring into operation in the moment of this memory card access usb bus. The core concept that realizes this function is to utilize the AN2131 microprocessor (to have device id 1 as a default initial USB device, PID=0x2131) access PC main frame, the PC main frame loads the device drives corresponding to ID1, and this driver mainly comprises program from default end points endpoint0 to this memory card that download performing a programme by; After this memory card is received performing a programme, move at once this program, then carry out reset (the usb bus reseting pin by AN2131 carries out) of usb bus, the PC main frame is identified this memory card equipment again, this moment this memory card Returning equipment ID2 (the real device id of this memory card, PID)=0x1002), the PC main frame loads the final driver of this memory card according to this ID, thereby makes this memory card begin normal operation. The realization of this function is to have utilized characteristics a: AN2131 of AN2131 microprocessor not when working procedure, can be used as the default USB equipment with equipment VID=0x2131, this equipment has the default configuration of usb protocol, namely have end points 0, can the data of end points 0 be responded.
Program of the present invention is downloaded concrete methods of realizing embodiment as shown in Figure 6 automatically, may further comprise the steps:
1) when this memory card access usb bus, the PC main frame will to transmissions Get Descriptor (obtaining description list) order, require USB device Returning equipment number and trading company of factory;
2) this memory card at first returns the VID=0547 (ID of production firm) of initialization apparatus, PID=2131 (product IDs):
3) after the PC main frame obtains the original equipment ID of this memory card, will in the USB device Driver Library of PC host operating system, search the device drives (this ID is corresponding to the driver that downloads of the present invention) corresponding to above-mentioned ID, and load;
4) in a single day the PC host operating system loads the driving that downloads of this memory card, and the data pipe that this program provides by this memory card initialization apparatus at once is to this memory card download executable programs;
5) after this memory card is received the program of download, move at once and become the equipment of this memory card normal operation;
6) this memory card produces once the signal of new USB device access bus, makes the PC main frame again identify this memory card;
7) the PC main frame is received the signal of new equipment access, repeat 1,2,3 above-mentioned steps, load corresponding to VID=0547 the device drives of PID=1002, device drives when this driving is the normal operation of this memory card, thus the process that program is downloaded automatically finished.
Because the present invention possesses the function of hardware implement program dynamic download, thereby makes it to possess state-of-the-art software upgrading function; For traditional hardware system, program generally is stored among the erasable EEPROM or Flash, the user is in upgrade software, in case accidental interruption operation midway or the wrong program of having upgraded, with the physical fault that causes hardware device correctly not start. And program of the present invention is to leave PC main frame end in, and the user can arbitrarily change and drive and the unlikely physical equipment that affects.
The design of ping-pong buffers mainly is in order to accelerate data transmit-receive of the present invention; Because very fast of the processing speed of PC main frame, and the transfer rate of usb bus is unusual height also, reach as high as 12Mbps, but the speed of the microprocessor of this memory card is relatively just slow, if each end points only uses a buffering area, data transfer speed will greatly be reduced, and design principle is as follows:
Condition:
1, the actual transfer rate of usb bus is 900Kbyte/S (being 7.2Mbps);
2, buffering position 64 bytes of end points (can only equal length 64 bytes of the maximum packet of USB);
3, the mean instruction execution time of AN2131 is 160nS;
4,64 byte datas are sent into Flash, on average need to carry out 400 instructions.
Calculate:
The 64B data are at the transmission time of usb bus T1=64/900K=69444nS,
AN2131 processes the time T 2=400 of 64 bytes * 160=64000nS.
If end points only uses a buffering area, after the PC main frame must wait for that this memory card is handled 64 byte datas of receiving so, could send the data of next 64 bytes, this moment, actual message transmission rate was:
V=64/(T1+T2)=468Kbyte/S
Data transfer speed is far below the transfer rate of the 900Kbyte/S of usb bus at this moment; If use 2 buffering areas, clearly, because usb bus transmits the time 69444nS of 64 bytes greater than the processing time 64000nS of microprocessor, therefore, behind the buffering area of complete 64 bytes of microprocessor processes, the PC main frame is not also finished to the transfer of data of another one buffering area, so the data transmission bauds of this moment just equals the transmission speed 900Kbye/S of usb bus. Therefore, the use of ping-pong buffer, the message transmission rate that roughly can double.
Ping-pong buffer program of the present invention comprises the sending and receiving of data, wherein sends the implementation method embodiment of data as shown in Figure 7, comprises the steps:
1) this memory card is received the data of usb bus, inquire about at once the flag bit of Buffer1 (buffering area 1), if empty, then write the data packet Buffer1, the flag bit of this buffering area of juxtaposition was 1 (expiring), and the most backward PC main frame sends and receives successful handshake ACK;
2) if Buffer1 is full, then then inquiry Buffer2, if Buffer2 is empty, then repeat and same operation during the Buffer1 sky; If Buffer2 also is full, then represent the excessive velocities that the PC main frame sends, this memory card is processed and is not come, and then abandons the data of this reception, and returns the unsuccessful handshake NAK of reception to the PC main frame.
The method of the receive data of the ping-pong buffer of present embodiment comprises the steps: as shown in Figure 8
1) microprocessor of this memory card at first checks the sign of Buffer1, if Busy1=1, representing that this buffering area receives has expired data, so these data is write Flash, and juxtaposition is masked as 0 (expression Buffer1 is for empty); If Busy1=0, expression does not have data, then directly enters following operation;
2) handle Buffer1 after, then check the sign of Buffer2, if data are arranged, then write Flash, then empty flag bit; If there are not data, then repeat the operation of the first step.
The IO driver of the Flash of present embodiment has mainly been set up the wiring method that body intersects on the basis of Flash standard time sequence. Owing to the design feature of Flash, determined the asymmetry of Flash access time; Take the KM29U128T chip of Samsung company as example, the time of reading a page data (512 byte) is 10uS, and be 350uS the average time that writes a page data; One page data is sent to the data/address bus of Flash from usb bus, perhaps from the average time that the data/address bus of Flash is sent to usb bus be 300uS, therefore:
Inside of the present invention read transfer rate=512/ (300+10)=12.6Mbps
Inside of the present invention write transfer rate=512/ (300+350)=6Mbps
This shows, Flash to write time-delay be the bottleneck of writing speed of the present invention, if do not take measures, add the time delay of the transfer of data of USB bus and PC main frame end, actual writing speed can only reach 3~4Mbps.
The core concept of body interleaving techniques is exactly to utilize the parallel work-flow of multi-disc Flash to improve writing speed; Because Flash has the flowing water of reading, so the body interleaving techniques does not improve read operation. Because volume of the present invention is very little, so generally only adopt two Flash.
The write operation realization flow that the body of present embodiment intersects as shown in Figure 9. Comprise that step is as follows:
1) enter page write operation after, at first judge whether recto of page address to be written, if it is prepare data are write among the Flash1; Otherwise prepare data are write among the Flash2;
2) the R/B pin of inspection Flash1 judges whether Flash1 is idle; If idle, data write Flash, otherwise continue query State, until write after the free time;
3) write the operation of Flash2 with the operation that writes Flash1.
Because the read operation of Flash has the flowing water characteristic, thus the process of reading still employing sequentially read, namely run through first the data on the Flash1, then read the data on the Flash2. Certainly, if realize complete file body interleaving access, also need the support of the driver of PC end.
Driver in the PC main frame of the present invention comprises the driver of standard usb protocol stack of PC host operating system and the present invention's driver itself.
The driver of the standard usb protocol stack of PC host operating system mainly comprises:
The USB physical interface of PCI-Enumeriator:PC main frame is connected with CPU by pci bus;
The driving of the usb protocol stack of OpenHCI.SYS:PC host operating system, open PC console controller interface
Drive (Open Host Controller Interface);
The driving of the usb protocol stack of UHCD.SYS:PC host operating system, the USBPC console controller drives
        (USB host controller drivers);
The driving of the usb protocol stack of USBD.SYS:PC host operating system, USB device drives;
The driving of the usb protocol stack of USBHUB.SYS:PC host operating system, the hub of USB drives;
The present invention's driver itself comprises:
EDStart.SYS: the driver of download code of the present invention;
EasyDisk.SYS: the device driver of the present invention's normal operation;
EDIOSP.SYS: IO port driver of the present invention (IOS Port).
The driver of download code of the present invention and the device driver of normal operation all adopt the exploitation of WDM form, have good compatibility.
The major function of downloading the driver of code is exactly to download executable programs of the present invention, carries out the initialization of equipment. Download the driver flow process of code as shown in figure 10, may further comprise the steps:
1) IRP_MJ_POWER and IRP_MJ_PNP all are IRP parameters of PC host operating system, when this memory card accessed, the driving USBD.SYS of PC host operating system can transmit these parameters by the entrance function DriverEntry () of EDStart.SYS;
2) the miscellaneous function code is the usb protocol stack acquisition by the PC host operating system equally;
3) when the miscellaneous function code is sweep equipment, represent that this memory card thrown off usb bus, the function IoDetachDevice () and the IoDeleteDevice () that call the sweep equipment that PC host operating system usb protocol stack provides this moment come sweep equipment;
4) when the miscellaneous function code is other, download of the present invention this moment drives does not carry out any action, only simply returns;
5) the present invention and download to this memory card of resetting in the flow chart is by the USBD.SYS Transfer Parameters of URB parameter block to lower floor, use in the usb protocol VenderRequest (producer's request command) order with
It is as follows that the URB structure that the driver of code uses is downloaded in communication of the present invention, the present invention:
urb→UrbHeader.Length=                        sizeof(struct
_URB_CONTROL_VENDOR_OR_CLASS_REQUEST)
urb→UrbHeader.Function=URB_FUNCTION_VENDOR_DEVICE
urb→UrbControlVendorClassRequest.TransferBufferLength=1
urb→UrbControlVendorClassRequest.TransferBuffer=&resetBit;
urb→UrbControlVendorClassRequest.TransferBufferMDL=NULL
urb→UrbControlVendorClassRequest.Request=EZDSK_LOAD_INTERNAL
urb→UrbControlVendorClassRequest.Value=CPUCS_REG;
urb→UrbControlVendorClassRequest.Index=0;
The device driver of normal operation of the present invention realizes by PC host operating system standard driver form. The device driver of this normal operation is the present invention's employed driving that works; Finish the download of program as the present invention after, just start working with the equipment of a new access, this moment, the PC host operating system just loaded the device driver of normal operation of the present invention. The device driver of normal operation of the present invention mainly comprises: the management of access device and provide IO operation for upper layer application.
The management of access device mainly comprises: the plug and play management of equipment and the power management of equipment.
The power management of present device does not carry out a lot of works for the treatment of, only obtains power supply type of the present invention from the USB driving of bottom PC host operating system, and power supply status is not processed and revised.
Obtain to such an extent that the IRP parameter of power supply mainly contains from bottom:
IRP_MN_SET_POWER (the IRP parameter of power attributes is set)
IRP_MN_QUERY_POWER (the IRP parameter of inquiry power attributes)
Can also know power supply status and the power supply content of equipment by the auxiliary parameter of these IRP parameters.
Plug and play of the present invention (Plug and Play, be called for short PNP) management is a very important function, the access of main treatment facility, stops and deleting; The present invention has fully inherited usb bus and has supported the characteristics that many equipment access simultaneously, can effectively realize accessing simultaneously 64 the present invention; Although usb protocol regulation, at most can 127 equipment of cascade on the bus, but because all equipment all needs to share bandwidth, and the maximum bandwidth of usb bus is 12Mbps, put that in fact to access 127 equipment substantially nonsensical, thereby the present invention's access when only having accomplished to support 64 equipment. Access-in management flow process of the present invention may further comprise the steps as shown in figure 11:
When 1) the present invention accesses usb bus, the PC host operating system will load driver of the present invention, and the PNP message of the present invention's access is passed to driver EasyDisk.SYS of the present invention;
2) driver receives the message of PNP, will enter PNP and process routine;
3) driving checks that at first whether the present device of current driven management is greater than 64;
4) if greater than 64 then return the mistake that surpasses maximum number of devices, otherwise enter next step operation;
5) if less than 64, create so a new equipment, device name is " EZDSK-X ", X represents the number of current example, for example first device name is " EZDSK-0 ", and a plurality of equipment of follow-up access are called after " EZDSl-1 " successively, " EZDSK-2 " etc.;
6) if establishment equipment success is then called IoCreateSymbolicLink () function and set up symbol and connect, the equipment handle that is about to device name and reality carries out related, creates unsuccessfully otherwise return;
7) set up symbol and connect after, return successful sign.
In addition, PNP management of the present invention also needs to process following three IRP of system message:
IRP_MN_START_DEVICE
The function of this IRP is to initialize the present device that has just accessed. By the URB parameter block is set, the USBD.SYS that calls the Pc host operating system by function IoCallDriver () drives, and sends initialization command to the present invention. The structure of URB and content have description in 2.1.1, no longer describe in detail.
IRP_MN_STOP_DEVICE
The function of this IRP is to suspend work of the present invention. Implementation method remains the parameter block by URB, calls the USB driving and transmits.
IRP_MN_REMOVE_DEVICE
The function of this IRP is the present device of oneself disengaging usb bus of deletion, and implementation method is the same.
The most important function of the device driver of the present invention's normal operation is exactly to provide basic IO operation to upper layer application of the present invention, and for this reason, driving of the present invention has defined the control program of some IO operations, uses to make things convenient for upper level applications. The application program on upper strata only needs calling system DeviceIoControl () function, and specifies therein the equipment handle just invented and the IO control program of response, just can call driving of the present invention and carry out IO and operated.
The present invention has defined abundant IO control code, and to finish various IO controls and system mode inquiry, the IO control code is defined as follows:
IOCTL_EZDSK_GET_PIPE_INFO: obtain all transmission pipeline information of the present invention
IOCTL_EZDSK_GET_DEVICE_DESCRIPTOR: obtain device context information
IOCTL_EZDSK_GET_CONFIGURATION_DESCRIPTOR: obtain equipment allocation list information
IOCTL_EZDSK_BULK_WRITE: the write operation of batch transmission
IOCTL_EZDSK_BULK_READ: the read operation of batch transmission
IOCTL_EZDSK_VENDOR_REQUEST: obtain manufacturer's information
IOCTL_EZDSK_GET_CURRENT_CONFIG: obtain current configuration
IOCTL_EZDSK_DOWNLOAD: to download executable programs of the present invention
IOCTL_EZDSK_GET_STRING_DESCRIPTOR: obtain character description list information
IOCTL_EZDSK_RESET: present device resets
IOCTL_EZDSK_GET_CURRENT_FRA_NUMBER: obtain the present frame numbering
The present invention provides IO operation realization flow as shown in figure 12 for upper layer application.
Program procedure is as follows: 1) obtain first the upper strata and call the IO control program parameter that passes over; 2) then set up corresponding URP parameter block according to the IO control program; 3) USB that calls at last bottom drives to carry out the operation of response.
The call method on upper strata:
After finishing the device driver of normal operation, calling of upper layer application is very simple, only need to just can realize corresponding operation by the equipment I O control function of standard, and rules in function calling is as follows:
BOOL DeviceIoControl(
HANDLE hDevice, ∥ points to the handle of present device
DWORD dwIoControlCode, ∥ IO control program
LPVOID lpInBuffer, the buffer pointer of ∥ input data/parameter
DWORD nInBufferSize, the size of the buffering area of ∥ input data/parameter
LPVOID lpOutBuffer, the buffer pointer of ∥ receive data
DWORD nOutBufferSize, the size of the buffering area of ∥ receive data
LPDWORD lpBytesReturned, the byte number of the actual data that receive of ∥
LPOVERLAPPED lpOverlapped ∥ points to the structure of an asynchronous operation)
The major function of IO port drivers EDIOSP.SYS of the present invention is exactly to set up a virtual storage device driver, makes the user operate the present invention as the local hard drive in the operation computer. The device Driver Development for Embedded flow process of the exploitation of this driver and the normal operation of USB is similar, only need to write according to the WDM template of writing the memory device driver among the DDK to get final product. Port drivers is except finishing the virtual memory facilities driving, and its most important function remains the realization of IO operation of the present invention. It to the effect that realizes file system of the present invention.
File system of the present invention comprises the definition of file system and the operation of file system
File system of the present invention is defined as follows:
1) base unit of presents system definition file storage is 16KB.
2) whole dish is comprised of a bootstrap block and follow-up data block;
3) bootstrap block is from the 0th BOB(beginning of block), the 1st the non-bad physical block that finds. In order to raise the efficiency, the regulation bootstrap block can only be positioned at front 10 physical blocks. Like this, if front 10 physical blocks all are bad, this dish can't be used for the presents system so; The data structure of bootstrap block is as shown in table 3: table 3
The address Content
0~7B, 8 bytes Beginning flag " EzDisk "
8~17B, 10 bytes The file system type sign, " Interleave " expression body intersection form, " Normal " represents normal format
18~8K-1B, the 8K-18 byte Keep
8K~12K-1 byte Bad piece reflection, 1 physical block of per 1 bit representation, this position is that 1 expression is bad piece. Can represent altogether 32K piece, namely the heap(ed) capacity of institute's support disc is 512MB;
12K~16K-1 byte Take the piece reflection, 1 physical block of per 1 bit representation, this position is that 1 expression is occupied. Can represent altogether 32K piece, namely the heap(ed) capacity of institute's support disc is 512MB.
Illustrate: if capacity of the present invention greater than 512MB, boot section so of the present invention will take two Block, the space 8K of second Block is used for bad piece map, 8K is with taking the piece map. The capacity that can support this moment will reach 1.5GB.
4) because upward there is the physical block that breaks down unavoidably in Flash, so the presents system has taked to walk around the design of bad piece storage file; File is Coutinuous store on dish, and each file is comprised of a series of continuous physical blocks. Wherein bad piece may be arranged, but file system can be videoed according to bad piece in when access and automatically skipped these bad pieces. For example, the file header of a file and data are added up and should be taken n piece, and the starting block address of depositing of this document is a, and this document should take from a piece to the a+n-1 piece the altogether interval of n physical block so. If but in this interval, bad piece arranging, this interval will be extended backward so, until all good pieces can just put down this file in interval. Like this, if this document has taken the interval from a piece to the a+n-1+t piece, illustrating has t bad piece in this interval; 5) the 1st of first piece of storing documents the page the space of totally 512 bytes be used for the storing documents head, since the 2nd page of data that are only file itself. Like this, if the size of a file on the PC main frame is m byte, on dish, will take so (m+512-1)/16K+1 good piece; Data structure such as the table 4 of file header: table 4
6) 0 ~ 7B, 8 bytes 7) beginning flag " EzFile "
8) 8~11B, 4 bytes 9) file size, unit: byte can represent less than 4GB's
10) 12 ~ 19B, 8 bytes 11) file " modification time
12) 20~23B, 4 bytes 13) file " attribute "
14) 24 ~ 487B, 464 words 15) filename character string comprises full directory information
16) 488~507B, 20 words 17) file password string
18) 508 ~ 511B, 4 bytes 19) file type sign " MP3 " is shown not mp3 file, " PCM " recording file, and " * * * " represents other file
20) owing to the problem of " reading continuously ", last 1 physical block of every Flash does not adopt in the presents system. The institute
With in fact available 1023 physical blocks of the dish of 16MB, and in fact available 2046 physical blocks of the dish of 32MB. 21) in order to improve access speed, in the present invention's access, driver will create this in the internal memory of PC main frame
The map of the boot partition of invention; Know the information of user's action need modification boot partition, driver just can
Upgrade the boot partition table among the Flash. 22) the present invention supports long filenames, multistage catalogue; Filename and directory information all leave the file name word of file header in
In the symbol string. 23) file system of the file system of body interleaved mode and normal mode is basically identical, and main difference is exactly each
All there is an independently file system in sheet Flash, and each file be divided into two independently file deposit.
The operation that file system offers the user mainly comprises: the present invention format, and the writing of file, the reading of file, the deletion of file, rename operation and the defragmentation of the present invention of file operate.
The major function of format manipulation rebulids file system of the present invention exactly, in the first use of the present invention, and in the situation of file system accidental damage, need to carry out format manipulation. Format manipulation will be wiped all data among the Flash. The flow process of format manipulation of the present invention is very simple, and at first whether identification can set up body intersection file system (by the number of hardware circuit recognition memory), then wipes Flash, detects the fail block of Flash, last writing in files system.
File write operation of the present invention comprises that common writing with the body intersection writes two kinds of operations
Common wiring method step of the present invention is as follows: 1) inquiry boot partition map of the present invention, obtain available memory space and initial address; 2) by the memory space occupied information in the file system modification boot partition; 3) file header and data are write Flash according to the form of file system
Writing with common ablation process that body intersects is substantially similar, and main difference is to need the file to be stored order is divided into two parts before the body interleaved, deposits among the different Flash as file independently respectively. Notice that because may there be fail block at random in Flash, the two-part size that file division becomes may be different, the principle of cutting apart is to equate as far as possible, because such depositing in is most effective. Then need when sending data to intersect transmission to cutting apart good file. The body cross-write enters flow chart as shown in figure 13, and performing step is as follows:
1) enters body interleaved routine shield, check at first whether the remaining continuous space of Flash enough deposits current file; If maximum continuous space is deposited current file not, but remaining physical space is enough, then needs to carry out defragmentation; If the continuous space after having put in order is still inadequate, then expression has produced again some new invalid block, then returns the mistake of insufficient space, withdraws from;
2) if find after checking for the first time that the residue continuous space is enough, perhaps defragmentation complete after, current file is enough deposited in the space, then begins divided file;
3) with file by as far as possible equally the principle order be divided into 2 parts, and beginning sends data take page or leaf as unit
File 1 after alternately transmission is cut apart when 4) sending and 2 data are until be sent
Because the present invention carries out initialized the time at access PC, driver is the file header of automatic scan boot partition of the present invention and All Files, and sets up the map of document location of the present invention in the internal memory of PC. Therefore reading of file only needs simply to send initial address to the present invention, and the content that order is read in file gets final product. Read operation also is divided into the body intersection and reads to read with common, body intersect read with common difference of reading in operation very little, unique different be that body intersects and reads to carry out twice read operation, run through first the file that is arranged in Flash1, then read the file that is arranged in Flash2, the simple merging of two files will reading at last gets final product.
The deletion action of file in fact only needs to discharge the block message that this document takies in the boot partition of the present invention and gets final product.
The rename operation of file only needs the file name in the transaction file head to get final product.
Defragmentation of the present invention is to rearrange the position of All Files in the present invention, makes not have the clear area between the file.
The Specifeca tion speeification of present embodiment is as shown in table 5: table 5
Appearance and size 80mm×22mm×12mm
Memory capacity 8MB-512MB does not wait
Peak transfer rate Write: 4Mbps-6Mbps, read: 6Mbps-8Mbps
The PC host operating system Win95/Win98/Win2000
Storage life Erase-write cycles is greater than 1000,000 times

Claims (6)

1, a kind of large capacity movable memory of USB is characterized in that, comprises the mobile memory plate that is made of hardware circuit, and control software and the driver two parts in the PC main frame end of embedding PC main frame end form; Wherein, the mobile memory plate comprises microprocessor CPU and coupled two Flash memories, alternative eeprom memory, the USB interface that is connected with the PC main frame, crystal oscillator input pin by microprocessor CPU provides the crystal oscillator of working pulse for it, supply with the power supply of said CPU, Flash memory or EEPROM voltage, said Flash memory connects with CPU by the IO port of data/address bus and CPU; Said alternative EEPROM memory links to each other with CPU by the I2C bus; The control software of said embedding PC main frame end is by the system mode machine, and the IO driver of USB protocol stack and Flash forms; Driver in the said PC main frame is by the driver of downloading code, and the device driver of normal operation and IO port drivers form.
2, a kind of for the implementation method of mobile memory as claimed in claim 1, it is characterized in that the implementation method of said state machine comprises:
(1) definition status:
1) idle condition (Idle), CPU does not have task carrying out;
2) query State (Quest), CPU responds the querying command of PC;
3) Flash erase status (Erase), CPU carries out the erase operation of Flash;
4) Flash read states (Read), CPU carries out the operation of reading Flash;
5) Flash writes state (Write), and CPU carries out the operation of writing Flash;
(2) 2 operations of definition:
1) remove current state operation (Clear), CPU compulsory withdrawal current state is returned idle condition;
2) reset operation (Reset), under any state, the equal executive system reset function of CPU;
(3) conversion of realization state machine state as shown in Figure 4, may further comprise the steps:
1) the wiping of state machine, read and write enter state and can only enter under idle condition;
2) query State can enter under any state;
3) under the idle condition, receive the Erase order, then enter erase status; All can not enter erase status under other states; After executing the Erase order, return idle condition;
4) under the idle condition, receive the Read order, then enter reading state; All can not enter reading state under other states; After executing the Read order, return idle condition;
5) under the idle condition, receive the Write order, then enter write state; All can not enter write state under other states; After executing the Write order, return idle condition;
6) at idle condition, erase status, read states and write state, if receive the Quest order, enter at once query State, until after executing query manipulation, return the front state of query State that enters;
7) between each state of state machine mutual exclusion mechanism is set, namely as long as current state does not finish (comprising that nature finishes and force to finish), state machine just can not carry out the state switching so. Mutual exclusion mechanism is the basic guarantee that guarantees each read-write operation integrality and correctness.
3, method as claimed in claim 2 is characterized in that, said mutual exclusion mechanism adopts the token method, specifically comprises the steps:
1) PC end program is carried out certain operation (such as reading and writing, wiping etc.) at needs, before entering certain state, must by the order pipeline, send a Quest order, application tokens to the present invention;
2) this memory card is received the Quest order, returns at once current token attribute, namely belongs to that state;
3) PC end program need to check the attribute of token, if current operation token number Idel state, PC end program has the right to apply for tokens so, otherwise PC end program must wait for, until the token attribute is Idel;
4) if it is Idel that PC end detects the token attribute that this memory card returns, program needs again to submit to this memory card by the order pipeline so needs the operation carried out, apply for simultaneously tokens;
5) after this memory card is received this application, check resource, check current token, if it is enough to meet resource, and current state is just carried out state switching, juxtaposition token attribute by the operation of application when being Idel;
6) after PC end program is submitted operation application, for guaranteeing to apply for successfully, still need to carry out a Quest order before each operation, confirm current token attribute to one's name.
4, a kind ofly it is characterized in that for the implementation method of mobile memory as claimed in claim 1 the implementation method that said program is downloaded automatically may further comprise the steps:
1) when said memory card access usb bus, the PC main frame will to transmission obtain the description list order, require USB device Returning equipment number and trading company of factory;
2) this memory card at first returns the ID of production firm of initialization apparatus, product IDs;
3) after the PC main frame obtains the original equipment ID of this memory card, will in the USB device Driver Library of PC host operating system, search the device drives corresponding to above-mentioned ID, and load;
4) in a single day the PC host operating system loads the driving that downloads of this memory card, and the data pipe that this program provides by this memory card initialization apparatus at once is to this memory card download executable programs;
5) after this memory card is received the program of download, move at once and become the equipment of this memory card normal operation;
6) this memory card produces once the signal of new USB device access bus, makes the PC main frame again identify this memory card;
7) the PC main frame is received the signal of new equipment access, repeat 1,2,3 above-mentioned steps, load corresponding to the ID of production firm the device drives of product IDs, device drives when this driving is this memory card normal operation, thus the process that program is downloaded automatically finished.
5, a kind ofly it is characterized in that for the implementation method of mobile memory as claimed in claim 1 the ping-pong buffer implementation method comprises the method for sending and receiving of data, wherein the implementation method of said transmission data comprises the steps:
1) this memory card is received the data of usb bus, inquire about at once the flag bit of Buffer1 (buffering area 1), if empty, then write the data packet Buffer1, the flag bit of this buffering area of juxtaposition is l (expiring), and the most backward PC main frame sends and receives successful handshake ACK;
2) if Buffer1 is full, then transfer inquiry Buffer2, if Buffer2 is empty, then repeat and same operation during the Buffer1 sky: if Buffer2 also is full, then represent the excessive velocities that the PC main frame sends, this memory card is processed and is not come, and then abandons the data of this reception, and returns the unsuccessful handshake NAK of reception to the PC main frame;
The implementation method of said receive data comprises the steps:
1) microprocessor of this memory card at first checks the sign of Buffer1, if Busy1=1, representing that this buffering area receives has expired data, so these data is write Flash, and juxtaposition is masked as 0 (expression Buffer1 is for empty); If Busy1=0, expression does not have data, then directly enters following operation;
2) handle Buffer1 after, then check the sign of Buffer2, if data are arranged, then write Flash, then empty flag bit; If there are not data, then repeat the operation of the first step.
6, a kind ofly it is characterized in that for the implementation method of mobile memory as claimed in claim 1 the implementation method of file system of the present invention comprises definition, offers user's operation, wherein, said being defined as follows:
1) base unit of file storage is 16KB;
2) whole dish is comprised of a bootstrap block and follow-up data block;
3) bootstrap block is from the 0th BOB(beginning of block), the 1st the non-bad physical block that finds; The regulation bootstrap block can only be positioned at front 10 physical blocks, and file is Coutinuous store on dish, and each file is comprised of a series of continuous physical blocks, wherein bad piece may be arranged, but file system can be videoed according to bad piece in when access and automatically skipped these bad pieces;
The 1st page of first piece of storing documents the space of totally 512 bytes be used for the storing documents head, since the 2nd page of data that are only file itself; Like this, if the size of a file on the PC main frame is m byte, on dish, will take so (m+512-1)/16K+1 good piece; The data structure of file header is:
0~7B, 8 bytes, expression beginning flag " EzFile ";
8~11B, 4 bytes, the expression file size, unit: byte can represent the file less than 4GB:
12~19B, 8 bytes, the expression file " modification time:
20~23B, 4 bytes, expression file " attribute ";
24~487B, 464 bytes, expression filename character string comprises full directory information;
488~507B, 20 bytes, expression file password string;
508~511B, 4 bytes, expression file type sign " MP3 " expression mp3 file, " PCM " represents recording file, " * * * " represents other file:
4) owing to the problem of " reading continuously ", last 1 physical block of every Flash does not adopt in the presents system; In the present invention's access, driver will create the map of boot partition of the present invention in the internal memory of PC main frame; Know the information of user's action need modification boot partition, driver just can upgrade the boot partition table among the Flash:
5) the present invention supports long filenames, multistage catalogue; Filename and directory information all leave in the file name character string of file header;
6) file system of the file system of body interleaved mode and normal mode is basically identical, and main difference is exactly that every a slice Flash all exists an independently file system, and each file be divided into two independently file deposit.
The said user's of offering operation mainly comprises: the present invention format, the writing of file, file read the deletion of file, the rename operation of file and defragmentation operation;
Whether the therapy of said format manipulation can set up body intersection file system at first identifying, and then wipes Flash, detects the fail block of Flash, last writing in files system;
Said file write operation comprises that common writing with the body intersection writes two kinds of methods of operating:
Wherein, this common wiring method step is as follows:
(1) inquiry boot partition map of the present invention is obtained available memory space and initial address;
(2) by the memory space occupied information in the file system modification boot partition;
(3) file header and data are write Flash according to the form of file system;
The performing step of the wiring method that said body intersects is as follows:
(1) enter body interleaved routine after, check at first whether the remaining continuous space of Flash enough deposits current file; If maximum continuous space is deposited current file not, but remaining physical space is enough, then needs to carry out defragmentation; If the continuous space after having put in order is still inadequate, then expression has produced again some new invalid block, then returns the mistake of insufficient space, withdraws from;
(2) if find after checking for the first time that the residue continuous space is enough, perhaps defragmentation complete after, current file is enough deposited in the space, then begins divided file;
(3) with file by as far as possible equally the principle order be divided into 2 parts, and beginning sends data take page or leaf as unit
File 1 after alternately transmission is cut apart when (4) sending and 2 data are until be sent
Said read operation also is divided into the body intersection and reads to read with common, this is common to read in operation and carries out once, and body intersects reads to carry out twice read operation, runs through first the file that is arranged in Flash1, then read the file that is arranged in Flash2, two files will reading at last simply merge;
The deletion action of said file is for discharging the block message that this document takies in the said boot partition;
The rename of said file is operating as the file name in the transaction file head;
Said defragmentation is to rearrange the position of All Files, makes not have the clear area between the file.
CN 01100541 2001-01-12 2001-01-12 High-capacity moving storage of universal serial bus interface and its implementation method Pending CN1299096A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 01100541 CN1299096A (en) 2001-01-12 2001-01-12 High-capacity moving storage of universal serial bus interface and its implementation method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 01100541 CN1299096A (en) 2001-01-12 2001-01-12 High-capacity moving storage of universal serial bus interface and its implementation method

Publications (1)

Publication Number Publication Date
CN1299096A true CN1299096A (en) 2001-06-13

Family

ID=4651674

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 01100541 Pending CN1299096A (en) 2001-01-12 2001-01-12 High-capacity moving storage of universal serial bus interface and its implementation method

Country Status (1)

Country Link
CN (1) CN1299096A (en)

Cited By (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2003005370A1 (en) * 2001-06-30 2003-01-16 Netac Technology Co., Ltd. A multifunction semiconductor storage device and a method for booting a computer
WO2003063174A1 (en) * 2002-01-23 2003-07-31 Tai Guen Enterprise Co., Ltd An usb portable storage capable of being upgraded and capacity-expanded freely by replacement of storage medium
CN1297920C (en) * 2003-12-24 2007-01-31 联想(北京)有限公司 Method for implementing data exchange between PDA and computer
CN100511199C (en) * 2006-11-28 2009-07-08 威盛电子股份有限公司 Hardware accelerater and data transmission method
CN100552627C (en) * 2005-06-24 2009-10-21 深圳Tcl新技术有限公司 A kind of method of electronic product being carried out Data Update
WO2010145487A1 (en) * 2009-06-30 2010-12-23 中兴通讯股份有限公司 Home gateway and method for home gateway implementing universal serial bus (usb) peripheral device drive
CN102929740A (en) * 2012-10-25 2013-02-13 北京星网锐捷网络技术有限公司 Method and device for detecting bad block of storage equipment
CN101000554B (en) * 2006-01-14 2013-04-24 三星电子株式会社 System and method thereof
CN103678180A (en) * 2013-11-29 2014-03-26 武汉天喻信息产业股份有限公司 Intelligent card nonvolatile memory management method
CN103823633A (en) * 2012-11-16 2014-05-28 上海华虹集成电路有限责任公司 Management circuit for small files
WO2016161811A1 (en) * 2015-04-07 2016-10-13 Huawei Technologies Co., Ltd. Method, apparatus and data structure for copying values of table of database
CN109669732A (en) * 2019-02-14 2019-04-23 深圳力维智联技术有限公司 A kind of drive load method for extending out function system and extending out functional hardware
CN112860609A (en) * 2019-11-26 2021-05-28 纳恩博(常州)科技有限公司 Method for realizing I2C communication, scooter and storage medium
CN113504873A (en) * 2021-05-20 2021-10-15 新华三信息安全技术有限公司 Communication equipment and data storage method thereof

Cited By (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7644218B2 (en) 2001-06-30 2010-01-05 Netac Technology Co., Ltd Multifunction semiconductor storage device and a method for booting-up computer host
WO2003005370A1 (en) * 2001-06-30 2003-01-16 Netac Technology Co., Ltd. A multifunction semiconductor storage device and a method for booting a computer
WO2003063174A1 (en) * 2002-01-23 2003-07-31 Tai Guen Enterprise Co., Ltd An usb portable storage capable of being upgraded and capacity-expanded freely by replacement of storage medium
CN1297920C (en) * 2003-12-24 2007-01-31 联想(北京)有限公司 Method for implementing data exchange between PDA and computer
CN100552627C (en) * 2005-06-24 2009-10-21 深圳Tcl新技术有限公司 A kind of method of electronic product being carried out Data Update
CN101000554B (en) * 2006-01-14 2013-04-24 三星电子株式会社 System and method thereof
CN100511199C (en) * 2006-11-28 2009-07-08 威盛电子股份有限公司 Hardware accelerater and data transmission method
WO2010145487A1 (en) * 2009-06-30 2010-12-23 中兴通讯股份有限公司 Home gateway and method for home gateway implementing universal serial bus (usb) peripheral device drive
CN102929740A (en) * 2012-10-25 2013-02-13 北京星网锐捷网络技术有限公司 Method and device for detecting bad block of storage equipment
CN103823633A (en) * 2012-11-16 2014-05-28 上海华虹集成电路有限责任公司 Management circuit for small files
CN103678180A (en) * 2013-11-29 2014-03-26 武汉天喻信息产业股份有限公司 Intelligent card nonvolatile memory management method
CN103678180B (en) * 2013-11-29 2017-11-24 武汉天喻信息产业股份有限公司 The management method of intelligent card nonvolatile memory
WO2016161811A1 (en) * 2015-04-07 2016-10-13 Huawei Technologies Co., Ltd. Method, apparatus and data structure for copying values of table of database
US10621202B2 (en) 2015-04-07 2020-04-14 Huawei Technologies Co., Ltd. Method, apparatus and data structure for copying values of a table of a database
CN109669732A (en) * 2019-02-14 2019-04-23 深圳力维智联技术有限公司 A kind of drive load method for extending out function system and extending out functional hardware
CN112860609A (en) * 2019-11-26 2021-05-28 纳恩博(常州)科技有限公司 Method for realizing I2C communication, scooter and storage medium
CN112860609B (en) * 2019-11-26 2024-04-26 纳恩博(常州)科技有限公司 Method for realizing I2C communication, scooter and storage medium
CN113504873A (en) * 2021-05-20 2021-10-15 新华三信息安全技术有限公司 Communication equipment and data storage method thereof

Similar Documents

Publication Publication Date Title
CN1299096A (en) High-capacity moving storage of universal serial bus interface and its implementation method
CN1299207C (en) Large scale resource memory managing method based on network under SAN environment
CN1122281C (en) Multifunctional semiconductor storage device
CN1197021C (en) Portable information processing terminal unit with low power consumption and large storage capacity
CN1190735C (en) Data exchange and storing method and device
CN1249585C (en) Flash memory system
CN1288530C (en) Metohd and apparatus for restoring memory device channel when exiting low power state
CN1102772C (en) Flash memory based main memory
CN1866202A (en) Drive method for embedded apparatus
CN1760836A (en) Information processing system, information processing method, and program
CN1121014C (en) Eight-bit microcontroller having a RISC architecture
CN1300723C (en) System and method for virtual devices using a plurality of processors
CN1324472C (en) Information providing system
CN1761935A (en) Semiconductor memory card, semiconductor memory control apparatus, and semiconductor memory control method
CN1265274C (en) Storage device control device and control method of storage device control device
CN1291750A (en) Electronic flash storage method and device for data processing system
CN1761346A (en) Method of multi-interfacing between smart card and the storage card and multi-interface card
CN103677885B (en) A kind of method of ARM FLASH simple program programming
CN101052949A (en) Operating systems
CN1596401A (en) Non-volatile storage device control method
CN100555206C (en) A kind of device of binding computational resource and storage resources
CN1617160A (en) Card recognition system for recognizing standard card and non-standard card
CN1613061A (en) Program execution terminal device, program execution method, and program
CN105808167A (en) SR-IOV (Single Root I/O Virtualization)-based linked clone method, storage equipment and system
CN1731402A (en) Method and apparatus for accelerating file system operation by using coprocessor

Legal Events

Date Code Title Description
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C06 Publication
PB01 Publication
ASS Succession or assignment of patent right

Owner name: BEIJING PIONEER BOCHUANG TECHNOLOGY DEVELOPMENT C

Free format text: FORMER OWNER: CHANG CUYU

Effective date: 20020109

C41 Transfer of patent application or patent right or utility model
TA01 Transfer of patent application right

Effective date of registration: 20020109

Address after: 100085, the four section of Xianfeng building, No. 7, Pioneer Road, Haidian District information industry base, Beijing

Applicant after: Xianfeng Bochuang Scinece &. Technology Development Co., Ltd., Beijing

Address before: 100084 Haidian District Tsinghua Yuan, Tsinghua University, Department of computer science, east main building, zone 9, 424, Beijing

Applicant before: Chang Cuyu

C02 Deemed withdrawal of patent application after publication (patent law 2001)
WD01 Invention patent application deemed withdrawn after publication