CN104866236A - Data reading method and equipment for storage media - Google Patents

Data reading method and equipment for storage media Download PDF

Info

Publication number
CN104866236A
CN104866236A CN201510207732.2A CN201510207732A CN104866236A CN 104866236 A CN104866236 A CN 104866236A CN 201510207732 A CN201510207732 A CN 201510207732A CN 104866236 A CN104866236 A CN 104866236A
Authority
CN
China
Prior art keywords
host computer
handheld device
block
information
usb
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
CN201510207732.2A
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.)
Hisense Mobile Communications Technology Co Ltd
Original Assignee
Hisense Mobile Communications Technology Co Ltd
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 Hisense Mobile Communications Technology Co Ltd filed Critical Hisense Mobile Communications Technology Co Ltd
Publication of CN104866236A publication Critical patent/CN104866236A/en
Pending legal-status Critical Current

Links

Landscapes

  • Storage Device Security (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention relates to the field of data storage, in particular to a data reading method and equipment for storage media, and is used for solving the problem that storage media in handheld devices cannot be used as USB mounting media to be communicated with upper computers. The method comprises the following steps: a handheld device is connected with an upper computer through a USB, and sends information of a block storing preset content and information of a page to the upper computer after receiving a query command from the upper computer; the handheld device reads the stored preset content according to the information of the block after receiving a reading command from the upper computer, and sends the preset content to the upper computer through the USB; the handheld device sends a reading operation accomplishment command to the upper computer after determining the fact that the volume of data transmitted to the upper computer reaches the data volume required to be read. According to the invention, as a fat file system is not required to be loaded in the process that the upper computer performs reading operation on the storage media in the handheld device, the problem that storage media in handheld devices cannot be used as USB mounting media to be communicated with upper computers is solved.

Description

The method for reading data of storage medium and equipment
The divisional application that the present patent application is the applying date is on July 10th, 2012, application number is 201210237930.X, denomination of invention is the patent application of " method for reading data of storage medium and equipment ".
Technical field
The present invention relates to field of data storage, particularly relate to a kind of method for reading data and equipment of storage medium.
Background technology
As an Open Source Code and free operating system, linux system has been widely used in various built-in field.USB (universal serial bus) (Univeral Serial Bus, USB), due to its transmission speed at a high speed and versatility in industry, has become the very important method of embedded device and other devices communicatings.
Such as, after using the handheld device (such as mobile phone) of (SuSE) Linux OS to be connected with host computer (such as PC) by USB, can transmission data at a high speed, can be used for again charging, handheld device is made to play memory device, the several functions such as wireless network card and debugging.
At present, after handheld device is connected with PC by USB, the flow process transmitting data to PC is roughly as follows:
Step one: PC sends data read command to handheld device;
Step 2: after handheld device receives data read command, resolves this data read command, obtains the address information etc. of the storage medium (such as TF card) for storing data;
Step 3: handheld device calls fat file system, because fat file system management has the information of each storage medium in handheld device, therefore fat file system can find corresponding storage medium according to resolving the address information obtained, and by performing the data in read operation reading storage medium, the data read are delivered to USB; Data are passed to PC by USB;
Step 4: PC performs the display operation etc. to these data after receiving the data that USB passes over.
By using the storage medium that can be transmitted data in the handheld device of (SuSE) Linux OS by USB to PC, be called the USB carry medium under Linux.To the requirement of the USB carry medium under Linux be, can conduct interviews to this medium through fat file system, this just itself has an increased restriction to storage medium, for other storage mediums being generally used for embedded device, such as nand flash, due to the restriction of its storage organization etc., fat file system cannot be loaded, thus this storage medium cannot be communicated with PC as USB carry medium.
Summary of the invention
The embodiment of the present invention provides a kind of method for reading data and equipment of storage medium, for solving storage medium in handheld device owing to cannot loading fat file system and cannot carrying out as USB carry medium and host computer the problem that communicates.
Embodiments provide a kind of method for reading data of storage medium, comprising:
Handheld device is connected with host computer by general-purpose serial bus USB, after the querying command receiving described host computer, the information of the information and storage medium page that store the block of prefabricated content is sent to described host computer;
Described handheld device receives the reading order of described host computer, reads the prefabricated content stored, and described prefabricated content is sent to host computer by USB according to the information of described piece;
The data volume that described handheld device determines to be transferred to described host computer reaches the data volume that the needs that generate according to the information of described page read, and sends read operation complete order to described host computer.
Because the handheld device of the embodiment of the present invention is after being connected with host computer by USB, after receiving the querying command of host computer, by the information reporting of the information of this block, page to host computer, after receiving the reading order of host computer, can according to the information of block, read in this block the prefabricated content stored, and the prefabricated content read is transferred to host computer by USB.Therefore, the read operation of the storage medium in host computer handheld device is achieved in the embodiment of the present invention, and do not need in this process to load fat file system, thus solve storage medium in handheld device and cannot carry out as USB carry medium and host computer the problem that communicates due to fat file system cannot be loaded.
Optionally, after described prefabricated content is sent to host computer by USB by USB, also comprise:
The data volume that described handheld device determines to be transferred to described host computer does not reach the data volume that the needs that generate according to the information of described page read, and continues to perform the step reading the prefabricated content stored according to the information of described piece.
Optionally, described handheld device before the querying command receiving described host computer, is also comprised after being connected with host computer by general-purpose serial bus USB:
The inner nuclear layer of described handheld device reports USB to insert event to client layer, after client layer receives this USB insertion event, from the mtd partition list safeguarded, read the address storing the mtd subregion of prefabricated content, and the address of the mtd subregion read is sent to inner nuclear layer;
The inner nuclear layer of described handheld device receives the address of the described mtd subregion that client layer sends, and performs the read operation to mtd subregion corresponding to this address, obtains the information of the block storing described prefabricated content in described mtd subregion.
Optionally, described handheld device reads according to the information of described piece the prefabricated content stored, and specifically comprises:
Described handheld device is according to the information formation logic block address LBA of described piece, and the address offset amount described LBA converted on storage medium, determine the block in the described mtd subregion pointed by described address offset amount, read the prefabricated content stored in the block determined.
Optionally, described handheld device is also comprised before being connected with host computer by USB:
Described handheld device obtains the address of the mtd subregion storing prefabricated content in this handheld device in storage medium, the subregion corresponding to this address by the bad block management function of mtd equipment scans, determine the bad block in mtd subregion, and the information of bad block is recorded in static array;
Described handheld device, after determining the block in the described mtd subregion pointed by the side-play amount of address, before reading the prefabricated content stored in the block determined, also comprises:
Described handheld device, according to the information of the bad block of record, determines that the block pointed by described address offset amount is not bad block.
Optionally, if described handheld device determines that the block pointed by described address offset amount is bad block, then described handheld device is after determining that the block pointed by described address offset amount is bad block, also comprises:
After current address offset amount is updated to the address offset amount of the good block of the next one of current block by described handheld device, read the prefabricated content of a page size in the block pointed by address offset amount after upgrading, and the prefabricated content read is transferred to host computer by USB.
Embodiments provide a kind of handheld device, comprising:
Information reporting unit, for being connected with host computer by general-purpose serial bus USB, after the querying command receiving described host computer, sends to described host computer by the information of the information and storage medium page that store the block of prefabricated content;
Digital independent reports unit, for receiving the reading order of described host computer, reading the prefabricated content stored, and described prefabricated content is sent to host computer by USB according to the information of described piece; And after the data volume determining to be transferred to described host computer reaches the data volume that the needs that generate according to the information of described page read, send read operation to described host computer and complete order.
Optionally, described digital independent reports unit, also for:
After described prefabricated content is sent to host computer by USB by USB, the data volume determining to be transferred to described host computer does not reach the data volume of the needs reading generated according to the information of described page, continues the step of execution according to the prefabricated content of the information reading storage of described piece.
Optionally, also comprise:
Inner nuclear layer unit, after being connected with host computer by general-purpose serial bus USB, before the querying command receiving described host computer, after this handheld device is connected with host computer by general-purpose serial bus USB, reports USB to insert event to client layer unit; Receive the address of the mtd subregion that client layer unit is sent, perform the read operation to mtd subregion corresponding to this address, obtain the information of the block storing described prefabricated content in described mtd subregion;
Client layer unit, after receiving described USB insertion event, reads the address storing the mtd subregion of prefabricated content, and the address of the mtd subregion read is sent to inner nuclear layer unit from the mtd partition list safeguarded.
Optionally, described digital independent report unit also for:
Described handheld device is according to the information formation logic block address LBA of described piece, and the address offset amount described LBA converted on storage medium, determine the block in the described mtd subregion pointed by described address offset amount, read the prefabricated content stored in the block determined.
Accompanying drawing explanation
The method flow schematic diagram that Fig. 1 provides for the embodiment of the present invention;
Fig. 2 is the digital independent schematic flow sheet of the embodiment of the present invention;
The device structure schematic diagram that Fig. 3 provides for the embodiment of the present invention.
Embodiment
In order to solve storage medium in handheld device owing to cannot loading fat file system and cannot carrying out as USB carry medium and host computer the problem that communicates, the embodiment of the present invention provides a kind of method for reading data of storage medium.This storage medium comprises at least one memory process equipment (mtd) subregion, and each mtd subregion comprises at least one block, and each piece comprises and at least comprise a page.
See Fig. 1, the method for reading data of the storage medium that the embodiment of the present invention provides, comprises the following steps:
Step 10: handheld device is after being connected with host computer by USB, obtain the address of the mtd subregion storing prefabricated content in the storage medium of this handheld device, obtain according to this address information the information storing the block of prefabricated content in this mtd subregion, specifically can comprise the number of the block storing prefabricated content;
Step 11: handheld device receives the querying command of host computer, by the information reporting of this block to host computer;
Step 12: handheld device receives the reading order of host computer, LBA (Logical Block Addressing) (LBA) information that host computer generates according to the information of this block is carried in this reading order, determine the block stored in the mtd subregion of prefabricated content pointed by this LBA information, read the prefabricated content stored in the block determined, and the prefabricated content read is transferred to host computer by USB.
Preferably, after handheld device to be connected with host computer by USB and before obtaining the address of the mtd subregion storing prefabricated content in the storage medium of this handheld device, handheld device notifies that in the enumeration process of host computer to this handheld device the device type of this handheld device of host computer is read-only type.This read-only type can be CD cdrom etc.
Concrete, obtain the address of the mtd subregion storing prefabricated content in the storage medium of this handheld device, obtain according to this address information the information storing the block of prefabricated content in this mtd subregion, concrete methods of realizing can be as follows:
The inner nuclear layer of handheld device reports USB to insert event to client layer, after client layer receives this USB insertion event, from the mtd partition list safeguarded, read the address storing the mtd subregion of prefabricated content, and the address of the mtd subregion read is sent to inner nuclear layer;
Inner nuclear layer receives the address of the described mtd subregion that client layer sends, and performs the read operation to mtd subregion corresponding to this address, obtains the information of the block storing described prefabricated content in described mtd subregion.
Preferably, in step 11 handheld device by the information reporting of block to while host computer, also the information of the page of storage medium is sent to host computer, accordingly, the information of the data volume that host computer reads according to the needs that the information of page generates can also be carried in the reading order that in step 12, handheld device receives;
So, in step 12, handheld device is after being transferred to host computer by the prefabricated content read by USB, the data volume transmitting the reading of host computer needs can be judged whether according to the information of this data volume, if, then send read operation to host computer and complete order, otherwise, proceed the reading of prefabricated content, and the prefabricated content read is transferred to host computer by USB, until the data volume being transferred to host computer reaches the data volume that host computer needs to read.
Preferably, handheld device is before being connected with host computer by USB in step 10, handheld device can obtain the address of the mtd subregion storing prefabricated content in the storage medium of this handheld device, the mtd subregion corresponding to this address scans, determine the bad block in this mtd subregion according to scanning result, and record the information of bad block;
Accordingly, in step 12, handheld device is after determining the block in the mtd subregion pointed by LBA information and before reading the prefabricated content stored in the block determined, can according to the information of bad block of record, judge whether this block pointed by LBA information is bad block;
When judging the block pointed by this LBA information not as bad block, read the prefabricated content stored in the block determined;
When judging that the block pointed by this LBA information is bad block, determining that the next one of this block pointed by LBA information is not marked as the block of bad block, reading in this block the prefabricated content stored, and the prefabricated content read is transferred to host computer by USB.
In this method, storage medium can be nand flash or built-in multimedia storage card (EmbeddedMultiMediaCard, EMC) etc.
Specific embodiment is as follows:
In the present embodiment, need in advance by prefabricated content programming in the relevant mtd subregion in nand flash, and by the address information of this mtd subregion write mtd partition list.As shown in Figure 2, follow-up flow process is as follows:
Step 20: after handheld device starting up, the address of the mtd subregion storing prefabricated content in the nand flash of this handheld device is read from the mtd partition list safeguarded, the mtd subregion corresponding to this address scans, obtain and record the information of the bad block in this mtd subregion, specifically can the information of bad block be recorded in static array;
Here, mtd subregion is scanned, obtain and record the information of the bad block in this mtd subregion, specific implementation can be: scanned each piece of current bay by the bad block management function of mtd equipment, if current block is bad block, then the address offset amount of this block is increased in a bad block array, in order to judge whether the current block that will read is bad block when subsequent read operation.
Step 21: after handheld device is connected with host computer by USB, host computer sets up the data transmission path between USB; By USB, the inner nuclear layer of handheld device notifies that the device type of this handheld device of host computer is read-only type, be such as cdrom; Host computer performs the enumeration process to this handheld device;
Step 22: the address of mtd subregion loads as medium mount point by handheld device, concrete, the inner nuclear layer of handheld device reports USB to insert event to client layer, after client layer receives this USB insertion event, from the mtd partition list safeguarded, read the address storing the mtd subregion of prefabricated content, and the address of the mtd subregion read is sent to inner nuclear layer;
Step 23: inner nuclear layer receives the address of the mtd subregion that client layer sends, and performs the read operation to mtd subregion corresponding to this address, obtains the number storing the block of prefabricated content in this mtd subregion; The number storing the block of prefabricated content can be stored in first block of this mtd subregion in advance;
Inner nuclear layer carries out initialization to the content that reports read capacity command (Read capacity Command) and read address command (Read TocCommand) these two order, obtains the correct page size of nand flash to make host computer and stores the number of block of prefabricated content.Small computer system interface (small computer system interface, the scsi) order of Read capacity Command to be code be 0x25, the scsi order of ReadToc Command to be code be 0x43.
After initialization completes, inner nuclear layer can send to host computer the notice that initialization completes;
Here, the content that reports of Read capacity Command mainly comprises the number of the block storing prefabricated content and the page size of nand flash.
The content that reports of Read Toc Command mainly comprises LBA (Logical Block Addressing) (logical blockadressing, LBA) and every minute and second frame (Minute, Second, Frame, MSF) information.The value of the LBA after initialization equals the number of the block storing prefabricated content in mtd subregion; MSF information is that the prefabricated content in mtd subregion is carried out as media total playing duration information of playing, and total playing duration information comprises frame minute, second, frame information.
Step 24: host computer sends Read capacity Command and Read TocCommand these two orders successively to handheld device;
After handheld device receives Read capacity Command, by the information reporting of the number and page size that store the block of prefabricated content in the mtd subregion after initialization to host computer;
After handheld device receives Read Toc Command, by the LBA information after initialization and MSF information reporting to host computer.
Step 25: after host computer obtains relevant information, send reading order to handheld device, such as read_10 order, to carry out read operation to nand flash; Host computer is carried according to the LBA of number generation of block and the information of the data volume of needs reading that store prefabricated content in reading order;
The value of the LBA carried in reading order be store the block of prefabricated content in the mtd subregion that in 0 to step 24, handheld device sends number between integer, such as, the number storing the block of prefabricated content in mtd subregion is 5, host computer if desired reads the content of the 1st block in mtd subregion, the value of the LBA then carried in reading order is 1, if desired read the content of the 2nd block in mtd subregion, then the value of the LBA carried in reading order is 2, the like.The data volume that the needs carried in reading order read is the integral multiple of page size or page size in nandflash, because be read the data in nand flash in units of page.The scsi order of read_10 order to be code be 0x28;
The LBA carried in reading order is converted to the address offset amount on nand flash by handheld device, and obtain the size of the data volume that host computer needs read, address offset amount after conversion points to host computer needs the block storing prefabricated content in the mtd subregion read, conversion method is as follows: because the block size of nand flash is generally 2048byte or 4096byte, LBA is the number of block, then the address offset amount after conversion equals the size that LBA is multiplied by a block in mtd subregion.
Step 26: whether as well handheld device, according to the information of the bad block of record in step 20, judges if so, then to arrive step 27 by the block block that current address side-play amount is pointed to, otherwise, to step 28;
Step 27: handheld device reads the prefabricated content of a page size in the block of current address side-play amount sensing, and the prefabricated content read is put into buffer area, to step 29;
Step 28: the address offset amount current address offset amount being updated to the good block of the next one of current block, returns step 27;
Step 29: the prefabricated content in buffer area is sent to host computer by USB;
Step 30: handheld device judges whether current read operation completes, namely judges whether the data volume transferring the reading of host computer needs, if so, then arrives step 31, otherwise, to step 32:
Here, handheld device judges whether current read operation completes, and is specially: upgrade the data volume needing to read, and the data volume that the needs after renewal read equals data volume-this data volume read that the needs before upgrading read; If the data volume that the needs after upgrading read equals 0, then current read operation completes, otherwise does not complete.
Step 31: handheld device sends read operation to host computer and completes order, this time read operation of notice host computer completes, and this flow process terminates;
Step 32: current address offset amount upgraded, the address offset amount after renewal equals the address offset amount before upgrading and deducts a page size, returns step 26.
Handheld device in the present embodiment can adopt the operating system of linux 2.6 version, and the page size of nand flash is 2kB, and total volume is 512MB.
The present embodiment, by directly accessing the method for nand flash, coordinates the configuration to scsi order, makes host computer obtain its desired data smoothly, thus all prefabricated content of complete reading mtd subregion, present to user in the mode of cdrom.Due to the characteristic that cdrom is read-only, so directly write operation can not be carried out to nand flash, also just without the need to increasing load-balancing algorithm to prefabricated content.By the operation of prefabricated content to nandflash, reduce the cost of handheld device, provide the use-pattern of close friend to user, extend the using method of USB.
See Fig. 3, the embodiment of the present invention also provides a kind of handheld device, comprises storage medium, and this storage medium comprises at least one memory process equipment mtd subregion, and each mtd subregion comprises at least one block, and each piece comprises at least one page; This handheld device also comprises:
Information acquisition unit 31, for after this handheld device is connected with host computer by general-purpose serial bus USB, obtain the address of the mtd subregion storing prefabricated content in the storage medium of this handheld device, obtain the information of the block storing described prefabricated content in described mtd subregion according to this address information;
Information reporting unit 32, for receiving the querying command of host computer, by the information reporting of described piece to host computer;
Digital independent reports unit 33, for receiving the reading order of host computer, the LBA (Logical Block Addressing) LBA information of host computer according to the information generation of described piece is carried in this reading order, determine the block in the described mtd subregion pointed by this LBA information, read the prefabricated content stored in the block determined, and the prefabricated content read is transferred to host computer by USB.
Further, this handheld device also comprises:
Type reports unit 34, for before obtaining the address of the mtd subregion storing prefabricated content in the storage medium of this handheld device, notifying that in the enumeration process of host computer to this handheld device the device type of this handheld device of host computer is read-only type after this handheld device to be connected with host computer by USB.
Further, described information acquisition unit 31 comprises:
Inner nuclear layer unit, after this handheld device is connected with host computer by general-purpose serial bus USB, reports USB to insert event to client layer unit; Receive the address of the mtd subregion that client layer unit is sent, perform the read operation to mtd subregion corresponding to this address, obtain the information of the block storing described prefabricated content in described mtd subregion.
Client layer unit, after receiving described USB insertion event, reads the address storing the mtd subregion of prefabricated content, and the address of the mtd subregion read is sent to inner nuclear layer unit from the mtd partition list safeguarded.
Further, described information reporting unit 32 by the information reporting of described piece to host computer while, also the information of the page of described storage medium is sent to host computer; The information of the data volume that host computer reads according to the needs that the information of described page generates also is carried in described reading order;
Described digital independent report unit 33 also for: by read prefabricated content be transferred to host computer by USB after, the data volume transmitting the reading of host computer needs is judged whether according to the information of described data volume, if, then send read operation to host computer and complete order, otherwise, proceed the reading of prefabricated content, and the prefabricated content read is transferred to host computer by USB, until the data volume being transferred to host computer reaches the described data volume needing to read.
Further, this handheld device also comprises:
Bad block indexing unit 35, for in handheld device before being connected with host computer by USB, obtain the address of the mtd subregion storing prefabricated content in the storage medium of this handheld device, the mtd subregion corresponding to this address scans, determine the bad block in this mtd subregion according to scanning result, and record the information of bad block;
Described digital independent report unit 33 also for: after determining the block in the described mtd subregion pointed by this LBA information and before reading the prefabricated content stored in the block determined, according to the information of bad block of record, judge whether this block pointed by LBA information is bad block; When judging the block pointed by this LBA information not as bad block, read the prefabricated content stored in the block determined.
Further, described digital independent report unit 33 also for:
When judging that the block pointed by this LBA information is bad block, determining that the next one of this block pointed by LBA information is not marked as the block of bad block, reading in this block the prefabricated content stored, and the prefabricated content read is transferred to host computer by USB.
Further, described storage medium is nand flash.
To sum up, beneficial effect of the present invention comprises:
In the scheme that the embodiment of the present invention provides, handheld device is after being connected with host computer by USB, obtain the address of the mtd subregion storing prefabricated content in the storage medium of this handheld device, the information storing the block of prefabricated content in this mtd subregion is obtained according to this address information, after receiving the querying command of host computer, by the information reporting of this block to host computer, after receiving the reading order of host computer, determine the block storing prefabricated content pointed by LBA information that the information according to this block of carrying in this reading order generates, read in this block the prefabricated content stored, and the prefabricated content read is transferred to host computer by USB.Visible, the read operation of the storage medium in host computer handheld device is achieved in this programme, and do not need in this process to load fat file system, thus solve storage medium in handheld device and cannot carry out as USB carry medium and host computer the problem that communicates due to fat file system cannot be loaded.
The feature that the present invention utilizes cdrom read-only, by the path of USB, cdrom direct carry mtd subregion, establish host computer directly accesses nand flash path by USB, make jumbo nandflash can prefabricated content, and without the need to load document system.Be connected with host computer by USB, cdrom, directly read the method for the prefabricated content in mtd subregion, reduce the cost of handheld device, improve utilization rate and USB carry Jie qualitative diversity of nandflash.
The present invention describes with reference to according to the process flow diagram of the method for the embodiment of the present invention, equipment (system) and computer program and/or block scheme.Should understand can by the combination of the flow process in each flow process in computer program instructions realization flow figure and/or block scheme and/or square frame and process flow diagram and/or block scheme and/or square frame.These computer program instructions can being provided to the processor of multi-purpose computer, special purpose computer, Embedded Processor or other programmable data processing device to produce a machine, making the instruction performed by the processor of computing machine or other programmable data processing device produce device for realizing the function of specifying in process flow diagram flow process or multiple flow process and/or block scheme square frame or multiple square frame.
These computer program instructions also can be stored in can in the computer-readable memory that works in a specific way of vectoring computer or other programmable data processing device, the instruction making to be stored in this computer-readable memory produces the manufacture comprising command device, and this command device realizes the function of specifying in process flow diagram flow process or multiple flow process and/or block scheme square frame or multiple square frame.
These computer program instructions also can be loaded in computing machine or other programmable data processing device, make on computing machine or other programmable devices, to perform sequence of operations step to produce computer implemented process, thus the instruction performed on computing machine or other programmable devices is provided for the step realizing the function of specifying in process flow diagram flow process or multiple flow process and/or block scheme square frame or multiple square frame.
Although describe the preferred embodiments of the present invention, those skilled in the art once obtain the basic creative concept of cicada, then can make other change and amendment to these embodiments.So claims are intended to be interpreted as comprising preferred embodiment and falling into all changes and the amendment of the scope of the invention.
Obviously, those skilled in the art can carry out various change and modification to the present invention and not depart from the spirit and scope of the present invention.Like this, if these amendments of the present invention and modification belong within the scope of the claims in the present invention and equivalent technologies thereof, then the present invention is also intended to comprise these change and modification.

Claims (10)

1. a method for reading data for storage medium, is characterized in that, comprising:
Handheld device is connected with host computer by general-purpose serial bus USB, after the querying command receiving described host computer, the information of the information and storage medium page that store the block of prefabricated content is sent to described host computer;
Described handheld device receives the reading order of described host computer, reads the prefabricated content stored, and described prefabricated content is sent to host computer by USB according to the information of described piece;
The data volume that described handheld device determines to be transferred to described host computer reaches the data volume that the needs that generate according to the information of described page read, and sends read operation complete order to described host computer.
2. the method for claim 1, is characterized in that, after described prefabricated content is sent to host computer by USB by USB, also comprises:
The data volume that described handheld device determines to be transferred to described host computer does not reach the data volume that the needs that generate according to the information of described page read, and continues to perform the step reading the prefabricated content stored according to the information of described piece.
3. method as claimed in claim 1 or 2, is characterized in that, described handheld device before the querying command receiving described host computer, is also comprised after being connected with host computer by general-purpose serial bus USB:
The inner nuclear layer of described handheld device reports USB to insert event to client layer, after client layer receives this USB insertion event, from the mtd partition list safeguarded, read the address storing the mtd subregion of prefabricated content, and the address of the mtd subregion read is sent to inner nuclear layer;
The inner nuclear layer of described handheld device receives the address of the described mtd subregion that client layer sends, and performs the read operation to mtd subregion corresponding to this address, obtains the information of the block storing described prefabricated content in described mtd subregion.
4. the method for claim 1, is characterized in that, described handheld device reads according to the information of described piece the prefabricated content stored, and specifically comprises:
Described handheld device is according to the information formation logic block address LBA of described piece, and the address offset amount described LBA converted on storage medium, determine the block in the described mtd subregion pointed by described address offset amount, read the prefabricated content stored in the block determined.
5. method as claimed in claim 4, is characterized in that, described handheld device is also comprised before being connected with host computer by USB:
Described handheld device obtains the address of the mtd subregion storing prefabricated content in this handheld device in storage medium, the subregion corresponding to this address by the bad block management function of mtd equipment scans, determine the bad block in mtd subregion, and the information of bad block is recorded in static array;
Described handheld device, after determining the block in the described mtd subregion pointed by the side-play amount of address, before reading the prefabricated content stored in the block determined, also comprises:
Described handheld device, according to the information of the bad block of record, determines that the block pointed by described address offset amount is not bad block.
6. method as claimed in claim 5, it is characterized in that, if described handheld device determines that the block pointed by described address offset amount is bad block, then described handheld device is after determining that the block pointed by described address offset amount is bad block, also comprises:
After current address offset amount is updated to the address offset amount of the good block of the next one of current block by described handheld device, read the prefabricated content of a page size in the block pointed by address offset amount after upgrading, and the prefabricated content read is transferred to host computer by USB.
7. a handheld device, is characterized in that, comprising:
Information reporting unit, for being connected with host computer by general-purpose serial bus USB, after the querying command receiving described host computer, sends to described host computer by the information of the information and storage medium page that store the block of prefabricated content;
Digital independent reports unit, for receiving the reading order of described host computer, reading the prefabricated content stored, and described prefabricated content is sent to host computer by USB according to the information of described piece; And after the data volume determining to be transferred to described host computer reaches the data volume that the needs that generate according to the information of described page read, send read operation to described host computer and complete order.
8. handheld device as claimed in claim 7, it is characterized in that, described digital independent reports unit, also for:
After described prefabricated content is sent to host computer by USB by USB, the data volume determining to be transferred to described host computer does not reach the data volume of the needs reading generated according to the information of described page, continues the step of execution according to the prefabricated content of the information reading storage of described piece.
9. handheld device as claimed in claim 7 or 8, is characterized in that, also comprise:
Inner nuclear layer unit, after being connected with host computer by general-purpose serial bus USB, before the querying command receiving described host computer, after this handheld device is connected with host computer by general-purpose serial bus USB, reports USB to insert event to client layer unit; Receive the address of the mtd subregion that client layer unit is sent, perform the read operation to mtd subregion corresponding to this address, obtain the information of the block storing described prefabricated content in described mtd subregion;
Client layer unit, after receiving described USB insertion event, reads the address storing the mtd subregion of prefabricated content, and the address of the mtd subregion read is sent to inner nuclear layer unit from the mtd partition list safeguarded.
10. handheld device as claimed in claim 7, is characterized in that, described digital independent report unit also for:
Described handheld device is according to the information formation logic block address LBA of described piece, and the address offset amount described LBA converted on storage medium, determine the block in the described mtd subregion pointed by described address offset amount, read the prefabricated content stored in the block determined.
CN201510207732.2A 2012-07-10 2012-07-10 Data reading method and equipment for storage media Pending CN104866236A (en)

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210237930.XA CN102819514B (en) 2012-07-10 2012-07-10 Data reading method and device for storage medium

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
CN201210237930.XA Division CN102819514B (en) 2012-07-10 2012-07-10 Data reading method and device for storage medium

Publications (1)

Publication Number Publication Date
CN104866236A true CN104866236A (en) 2015-08-26

Family

ID=47303632

Family Applications (2)

Application Number Title Priority Date Filing Date
CN201210237930.XA Active CN102819514B (en) 2012-07-10 2012-07-10 Data reading method and device for storage medium
CN201510207732.2A Pending CN104866236A (en) 2012-07-10 2012-07-10 Data reading method and equipment for storage media

Family Applications Before (1)

Application Number Title Priority Date Filing Date
CN201210237930.XA Active CN102819514B (en) 2012-07-10 2012-07-10 Data reading method and device for storage medium

Country Status (1)

Country Link
CN (2) CN102819514B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105204781A (en) * 2015-09-28 2015-12-30 华为技术有限公司 Compression method, device and equipment

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1304509A (en) * 1999-04-05 2001-07-18 M-系统快闪盘开拓者公司 Architecture for universal serial bus-based PC flash disk
CN201780792U (en) * 2010-09-20 2011-03-30 谢坦 Self-starting multi-functional safety universal serial bus (USB) flash drive based on Linux kernel

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100735774B1 (en) * 2005-09-23 2007-07-06 엘지노텔 주식회사 Data backup method for embedded system

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1304509A (en) * 1999-04-05 2001-07-18 M-系统快闪盘开拓者公司 Architecture for universal serial bus-based PC flash disk
CN201780792U (en) * 2010-09-20 2011-03-30 谢坦 Self-starting multi-functional safety universal serial bus (USB) flash drive based on Linux kernel

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
胡勇其等: "嵌入式Linux下NAND存储系统的设计与实现", 《计算机工程》 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105204781A (en) * 2015-09-28 2015-12-30 华为技术有限公司 Compression method, device and equipment
CN105204781B (en) * 2015-09-28 2019-04-12 华为技术有限公司 Compression method, device and equipment

Also Published As

Publication number Publication date
CN102819514A (en) 2012-12-12
CN102819514B (en) 2015-05-06

Similar Documents

Publication Publication Date Title
CN111124305B (en) Solid state disk wear leveling method and device and computer readable storage medium
US20080195833A1 (en) Systems, methods and computer program products for operating a data processing system in which a file system's unit of memory allocation is coordinated with a storage system's read/write operation unit
CN109901794A (en) The device and method of garbage collection are operated using Host Idle
CN104199706A (en) Firmware upgrade method and device for eMMC
CN103136136A (en) Method and system for performing data transmission of flash memory media
CN108777158B (en) Method and device for testing Trim performance of solid state disk and computer equipment
CN109542495A (en) A kind of method for upgrading software and device
EP3518111A1 (en) Information acquisition method and apparatus, and memory release method and apparatus
WO2021115177A1 (en) Application installation method and apparatus, terminal device, server and storage medium
CN102945275B (en) File defragmentation method, device and equipment
CN103677885A (en) ARM FLASH simple program programming method
CN105426322B (en) A kind of forecasting method and device of data
CN104281413A (en) Command queue management method, memorizer controller and memorizer storage device
CN110543435B (en) Mixed mapping operation method, device and equipment of storage unit and storage medium
CN104133743B (en) A kind of by burning file to the method for EMMC chip and device
CN105389268A (en) Data storage system and operating method thereof
CN110262810A (en) A kind of method and apparatus of installation application
CN102819514B (en) Data reading method and device for storage medium
CN102117245B (en) Embedded device and method for loading and starting operation of cutting system executable file thereof
CN101977231A (en) Method for downloading mapping file
US20120303879A1 (en) Memory Device and Method for Programming Flash Memory Utilizing Spare Blocks
CN112596949B (en) High-efficiency SSD (solid State disk) deleted data recovery method and system
KR20200095010A (en) Apparatus and method for transmitting map information in memory system
CN106648751B (en) Method for rapidly upgrading embedded software and embedded equipment
CN102760061B (en) The method of shielding solid state hard disc memory interface difference and storage system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
EXSB Decision made by sipo to initiate substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20150826

RJ01 Rejection of invention patent application after publication