CN103150124B - A kind of method and device solving SD agreement time-out - Google Patents

A kind of method and device solving SD agreement time-out Download PDF

Info

Publication number
CN103150124B
CN103150124B CN201310034253.6A CN201310034253A CN103150124B CN 103150124 B CN103150124 B CN 103150124B CN 201310034253 A CN201310034253 A CN 201310034253A CN 103150124 B CN103150124 B CN 103150124B
Authority
CN
China
Prior art keywords
write
page
main frame
mark
spatial cache
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.)
Active
Application number
CN201310034253.6A
Other languages
Chinese (zh)
Other versions
CN103150124A (en
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.)
Shenzhen SiliconGo Semiconductor Co., Ltd.
Original Assignee
SiliconGo Microelectronics 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 SiliconGo Microelectronics Co Ltd filed Critical SiliconGo Microelectronics Co Ltd
Priority to CN201310034253.6A priority Critical patent/CN103150124B/en
Publication of CN103150124A publication Critical patent/CN103150124A/en
Application granted granted Critical
Publication of CN103150124B publication Critical patent/CN103150124B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Memory System Of A Hierarchy Structure (AREA)

Abstract

The invention provides a kind of method and the device that solve SD agreement time-out.Wherein, in the data writing process of flash memory, if after judging that the residual capacity of spatial cache is less than certain value, enter take-back model, the present invention adopts the data often writing a blank page, then to be recycled piece is just obtained, and by specify the valid data of number of pages to move in be recycled piece blank page on, then HOST is responded, complete write-once operation, the several design parameter according to flash memory of specific page of data-moving is arranged, can not TIMEOUT time of specifying of operating protocol to ensure to write in each write operation data and T.T. of number of pages of moving.Due to data write mode and, all there will not be time-out in take-back model, therefore well solve the problem of SD agreement time-out.<!--1-->

Description

A kind of method and device solving SD agreement time-out
Technical field
The present invention relates to flash memory technology field, particularly relate to a kind of method and the device that solve SD agreement time-out.
Background technology
Response time maximum in regulation write operation process in SD agreement is 250ms, if exceed this time SD card and main frame (HOST) Communications failure just may occur, and occurs problem incompatible each other.Therefore, in the flash disk operation of SD card controls, just need, according to being defined in the fixed time of agreement, data are write flash memory, and HOST is responded.
Flash memory management comprises write mode and take-back model.Wherein, write mode carries out write operation in units of page, because the base unit of operation is a page, therefore, there will not be the phenomenon of time-out.But if flash memory is not when having enough spatial caches, will enter take-back model from write flow process, take-back model can reclaim the invalid data in empty block, and is moved on new page by valid data.After take-back model process, flash memory can vacate the write operation that the empty block of part carries out next step.Along with updating of flash technology, when carrying out the operation of take-back model by existing flash-management algorithm, also corresponding longer when the time that valid data are all moved, invalid data is all wiped, this will exist and exceedes agreement official hour and then cause flash data bust this, occur incompatible problem.
Summary of the invention
Fundamental purpose of the present invention is to provide a kind of method solving SD agreement time-out, is intended to solve take-back model in flash memory management and completes the problem that all reclaimer operations time used exceedes the response time specified in agreement.
Another object of the present invention is to provide a kind of device solving SD agreement time-out.
To achieve these goals, the invention provides a kind of method solving SD agreement time-out, comprise following concrete steps: S1, judge whether the residual capacity of spatial cache is greater than the first preset value; If so, in units of page, carry out write operation, after completing the write of current page, response main frame, completes write-once operation; Otherwise, write operation is carried out in units of page, after completing the write of current page, statistics page status table, find out to be recycled piece of minimum valid data and mark reclaims mark, moving in blank page, after having moved to the described valid data being labeled the appointment number of pages of to be recycled piece of upper recovery mark, response main frame, completes write-once operation.
Preferably, also comprise step S10 before step S1: in units of page, carry out write operation, after completing the write of current page, response main frame, completes write-once operation.
Preferably, after step S1, also comprise step S11: judge whether main frame sends stopping data transfer command, if so, terminate all write operations, otherwise, after continuing to receive data to be written from main frame, go to step S10.
Preferably, the method for described solution SD agreement time-out, comprises following concrete steps:
A, from main frame, receive one page data to be written to spatial cache, after a blank page of write current block, judge whether current block is finished, if so, then refresh page state table, gets an empty block as current block, goes to step E; Otherwise go to step B;
B, judge whether to be labeled to be recycled piece that reclaims mark, if so, go to step C; Otherwise, judge whether the residual capacity of spatial cache is greater than the first preset value, if so, proceeds to E, otherwise statistics page status table, find out to be recycled piece of minimum valid data and mark reclaims mark, going to step C;
C, enter reclaimer operation, by the data-moving in the described valid data page being labeled the predetermined number of to be recycled piece reclaiming mark to blank page, be labeled valid data in be recycled piece that reclaims mark described in judgement whether all to move, if so, then this to be recycled piece is wiped, and remove recovery mark, then added to spatial cache, go to step D, otherwise, go to step E;
D, judge whether the residual capacity of spatial cache is greater than the second preset value, if so, goes to step E; Otherwise statistics page status table, finds out to be recycled piece of minimum valid data and after the upper recovery mark of mark, goes to step E;
E, response main frame, complete when previous write operation, judge whether main frame sends stopping data transfer command, if so, terminate all write operations, otherwise after continuing to receive data to be written from main frame, go to step A.
Preferably, in step D, described second preset value is greater than the first preset value.
Solve a device for SD agreement time-out, comprise write operation unit, the first spatial cache reading unit and reclaimer operation unit, wherein,
Described first spatial cache reading unit, for judging whether the residual capacity of spatial cache is greater than the first preset value, if, then enter said write operating unit, otherwise statistics page status table, find out to be recycled piece of minimum valid data and mark reclaims mark, entering described reclaimer operation unit;
Said write operating unit, for carrying out write operation in units of page, after completing the write of current page, response main frame, completes write-once operation;
Described reclaimer operation unit, for carrying out write operation in units of page, after completing the write of current page, move in blank page to the described valid data being labeled the appointment number of pages of to be recycled piece of upper recovery mark, after having moved, response main frame, completes write-once operation.
Preferably, the device of described solution SD agreement time-out also comprises main frame write judging unit, for judging whether main frame sends stopping data transfer command, if so, all write operations are terminated, otherwise, after continuing to receive data to be written from main frame, enter said write operating unit.
Preferably, the device of described solution SD agreement time-out also comprises to be recycled piece of recognition unit, the second spatial cache reading unit and main frame write judging unit; Wherein,
Said write operating unit, specifically for receiving one page data to be written to spatial cache from main frame, after a blank page of write current block, judge whether current block is finished, if so, then refresh page state table, get an empty block as current block, enter described main frame write judging unit; Otherwise enter to be recycled piece of recognition unit;
Described to be recycled piece of recognition unit, being labeled upper to be recycled piece of reclaiming mark for judging whether, if so, entering described reclaimer operation unit; Otherwise, enter the first spatial cache reading unit;
Described first spatial cache reading unit, specifically for judging whether the residual capacity of spatial cache is greater than the first preset value, if, enter described main frame write judging unit, otherwise statistics page status table, find out to be recycled piece of minimum valid data and mark reclaims mark, entering described reclaimer operation unit;
Described reclaimer operation unit, specifically for by described be labeled reclaim mark the predetermined number of to be recycled piece valid data page in data-moving to blank page, be labeled valid data in be recycled piece that reclaims mark described in judgement whether all to move, if so, then this to be recycled piece is wiped, and remove recovery mark, then added to spatial cache, enter described second spatial cache reading unit, otherwise, enter described main frame write judging unit;
Described second spatial cache reading unit, for judging whether the residual capacity of spatial cache is greater than the second preset value, if so, enters described main frame write judging unit; Otherwise statistics page status table, finds out to be recycled piece of minimum valid data and after the upper recovery mark of mark, enters described main frame write judging unit;
Described main frame write judging unit, for judging whether main frame sends stopping data transfer command, if so, terminates all write operations, otherwise, after continuing to receive data to be written from main frame, enter said write operating unit.
The invention provides a kind of method and the device that solve SD agreement time-out.In the data writing process of flash memory, if after judging that the residual capacity of spatial cache is less than the first preset value, need to enter take-back model, the present invention adopts the data often writing a blank page, then to be recycled piece is just obtained, and by specify the valid data of number of pages to move in be recycled piece blank page on, then HOST is responded, complete write-once operation, the several design parameter according to flash memory of specific page of data-moving is arranged, can not TIMEOUT time of specifying of operating protocol to ensure to write in each write operation data and T.T. of number of pages of moving.
Accompanying drawing explanation
Fig. 1 is the workflow diagram of method one embodiment of solution SD agreement time-out of the present invention.
Fig. 2 is the structural representation of the device of solution SD agreement time-out of the present invention.
The realization of the object of the invention, functional characteristics and advantage will in conjunction with the embodiments, are described further with reference to accompanying drawing.
Embodiment
Should be appreciated that specific embodiment described herein only in order to explain the present invention, be not intended to limit the present invention.
Solution for embodiment of the invention is mainly: the method and the device that solve SD agreement time-out.In the data writing process of flash memory, if after judging that the residual capacity of spatial cache is less than the first preset value, need to enter take-back model, the present invention adopts the data often writing a blank page, then to be recycled piece is just obtained, and by specify the valid data of number of pages to move in be recycled piece blank page on, then HOST is responded, complete write-once operation, the several design parameter according to flash memory of specific page of data-moving is arranged, can not TIMEOUT time of specifying of operating protocol to ensure to write in each write operation data and T.T. of number of pages of moving.
Please with reference to shown in Fig. 1 to Fig. 2, wherein, Fig. 1 is the workflow diagram of method one embodiment of solution SD agreement time-out of the present invention; Fig. 2 is the structural representation of the device of solution SD agreement time-out of the present invention.The method of solution SD agreement time-out of the present invention comprises following concrete steps:
S1, from main frame, receive one page data to be written to spatial cache (S10), after a blank page (S11) of write current block, judge whether current block is finished (S12), if, then refresh page state table, get an empty block as current block (S13), go to step S5; Otherwise go to step S2;
S2, judge whether to be labeled to be recycled piece (S20) reclaiming mark, if so, go to step S3; Otherwise, judge whether the residual capacity of spatial cache is greater than the first preset value (S21), if, go to step S5, otherwise statistics page status table, finds out to be recycled piece of minimum valid data and mark reclaims mark (S22), going to step S3;
S3, enter reclaimer operation, by the data-moving in the described valid data page being labeled the predetermined number of to be recycled piece reclaiming mark to blank page (S30), be labeled valid data in be recycled piece that reclaims mark described in judgement whether all to move (S31), if so, then this to be recycled piece is wiped, and remove recovery mark, then added to spatial cache (S32), go to step S4, otherwise, go to step S5;
D, judge whether the residual capacity of spatial cache is greater than the second preset value (S40), if so, goes to step S5; Otherwise statistics page status table, finds out to be recycled piece of minimum valid data and after mark reclaims mark (S41), goes to step S5;
S5, response main frame, complete as previous write operation (S50), judge whether main frame sends stopping data transfer command, if so, terminate all write operations (S51), otherwise after continuing to receive data to be written from main frame, go to step S1.
In actual application of the present invention, in step S3, the blank page number of described specified quantity can be arranged according to the design parameter of flash memory, to ensure that the time of the number of pages moved and write data can not the time-out time that specifies of operating protocol at every turn, generally speaking, the blank page number of this specified quantity is 4 pages, and the second preset value is greater than the first preset value.
As shown in Figure 2, one embodiment of the invention proposes a kind of device solving SD agreement time-out, comprises write operation unit 1, to be recycled piece of recognition unit 2, first spatial cache reading unit 3, reclaimer operation unit 4, second spatial cache reading unit 5 and main frame write judging unit 6; Wherein,
Write operation unit 1, for receiving one page data to be written to spatial cache from main frame, after a blank page of write current block, judge whether current block is finished, if so, then refresh page state table, get an empty block as current block, enter main frame write judging unit 6; Otherwise enter to be recycled piece of recognition unit 2.
To be recycled piece of recognition unit 2, being labeled upper to be recycled piece of reclaiming mark for judging whether, if so, entering reclaimer operation unit 4; Otherwise, enter the first spatial cache reading unit 3;
First spatial cache reading unit 3, specifically for judging whether the residual capacity of spatial cache is greater than the first preset value, if, enter main frame write judging unit 6, otherwise statistics page status table, finds out to be recycled piece of minimum valid data and mark reclaims mark, entering reclaimer operation unit 4;
Reclaimer operation unit 4, specifically for will be labeled reclaim mark the predetermined number of to be recycled piece valid data page in data-moving to blank page, be labeled valid data in be recycled piece that reclaims mark described in judgement whether all to move, if so, then this to be recycled piece is wiped, and remove recovery mark, then added to spatial cache, enter the second spatial cache reading unit 5, otherwise, enter main frame write judging unit 6;
Second spatial cache reading unit 5, for judging whether the residual capacity of spatial cache is greater than the second preset value, if so, enters main frame write judging unit 6; Otherwise statistics page status table, finds out to be recycled piece of minimum valid data and after the upper recovery mark of mark, enters main frame write judging unit 6.
Main frame write judging unit 6, for judging whether main frame sends stopping data transfer command, if so, terminates all write operations, otherwise, after continuing to receive data to be written from main frame, enter write operation unit 1.
Shortcoming and defect compared to existing technology, the present invention has following beneficial effect: in the method take-back model of solution SD agreement time-out of the present invention, the time used is controlled, ensure in data write Flash-process, can not cause because of during spatial cache residual capacity deficiency the problem writing time-out.
Should be understood that, the present invention can summarize with other the concrete form without prejudice to spirit of the present invention or principal character.Therefore, no matter from which point, the above embodiment of the present invention can only be thought explanation of the present invention and can not limit the present invention, claims indicate scope of the present invention, and scope of the present invention is not pointed out in above-mentioned explanation, therefore any change in the implication suitable with claims of the present invention and scope, all should think to be included in the scope of claims.

Claims (7)

1. solve a method for SD agreement time-out, it is characterized in that: comprise following concrete steps:
S1, judge whether the residual capacity of spatial cache is greater than the first preset value; If so, in units of page, carry out write operation, after completing the write of current page, response main frame, completes write-once operation; Otherwise, write operation is carried out in units of page, after completing the write of current page, statistics page status table, find out to be recycled piece of minimum valid data and mark reclaims mark, moving in blank page, after having moved to the described valid data being labeled the appointment number of pages of to be recycled piece of upper recovery mark, response main frame, completes write-once operation.
2. the method for solution SD agreement time-out according to claim 1, also comprises step S10 before it is characterized in that step S1: in units of page, carry out write operation, and after completing the write of current page, response main frame, completes write-once operation.
3. the method for solution SD agreement time-out according to claim 2, also comprises step S11 after it is characterized in that step S1: judge whether main frame sends stopping data transfer command, if, terminate all write operations, otherwise, after continuing to receive data to be written from main frame, go to step S10.
4. the method for solution SD agreement time-out according to claim 3, is characterized in that comprising following concrete steps:
A, from main frame, receive one page data to be written to spatial cache, after a blank page of write current block, judge whether current block is finished, if so, then refresh page state table, gets an empty block as current block, goes to step E; Otherwise go to step B;
B, judge whether to be labeled to be recycled piece that reclaims mark, if so, go to step C; Otherwise, judge whether the residual capacity of spatial cache is greater than the first preset value, if so, proceeds to E, otherwise statistics page status table, find out to be recycled piece of minimum valid data and mark reclaims mark, going to step C;
C, enter reclaimer operation, by the data-moving in the described valid data page being labeled the predetermined number of to be recycled piece reclaiming mark to blank page, be labeled valid data in be recycled piece that reclaims mark described in judgement whether all to move, if so, then this to be recycled piece is wiped, and remove recovery mark, then added to spatial cache, go to step D, otherwise, go to step E;
D, judge whether the residual capacity of spatial cache is greater than the second preset value, if so, goes to step E; Otherwise statistics page status table, finds out to be recycled piece of minimum valid data and after the upper recovery mark of mark, goes to step E;
E, response main frame, complete when previous write operation, judge whether main frame sends stopping data transfer command, if so, terminate all write operations, otherwise after continuing to receive data to be written from main frame, go to step A.
5. the method for solution SD agreement time-out according to claim 4, it is characterized in that: in step D, described second preset value is greater than the first preset value.
6. solve a device for SD agreement time-out, it is characterized in that: comprise write operation unit, the first spatial cache reading unit and reclaimer operation unit, wherein,
Described first spatial cache reading unit, for judging whether the residual capacity of spatial cache is greater than the first preset value, if, then enter said write operating unit, otherwise statistics page status table, find out to be recycled piece of minimum valid data and mark reclaims mark, entering described reclaimer operation unit;
Said write operating unit, for carrying out write operation in units of page, after completing the write of current page, response main frame, completes write-once operation;
Described reclaimer operation unit, for carrying out write operation in units of page, after completing the write of current page, move in blank page to the described valid data being labeled the appointment number of pages of to be recycled piece of upper recovery mark, after having moved, response main frame, completes write-once operation.
7. the device of solution SD agreement time-out according to claim 6, is characterized in that: also comprise to be recycled piece of recognition unit, the second spatial cache reading unit and main frame write judging unit; Wherein,
Said write operating unit, specifically for receiving one page data to be written to spatial cache from main frame, after a blank page of write current block, judge whether current block is finished, if so, then refresh page state table, get an empty block as current block, enter described main frame write judging unit; Otherwise enter to be recycled piece of recognition unit;
Described to be recycled piece of recognition unit, being labeled upper to be recycled piece of reclaiming mark for judging whether, if so, entering described reclaimer operation unit; Otherwise, enter the first spatial cache reading unit;
Described first spatial cache reading unit, specifically for judging whether the residual capacity of spatial cache is greater than the first preset value, if, enter described main frame write judging unit, otherwise statistics page status table, find out to be recycled piece of minimum valid data and mark reclaims mark, entering described reclaimer operation unit;
Described reclaimer operation unit, specifically for by described be labeled reclaim mark the predetermined number of to be recycled piece valid data page in data-moving to blank page, be labeled valid data in be recycled piece that reclaims mark described in judgement whether all to move, if so, then this to be recycled piece is wiped, and remove recovery mark, then added to spatial cache, enter described second spatial cache reading unit, otherwise, enter described main frame write judging unit;
Described second spatial cache reading unit, for judging whether the residual capacity of spatial cache is greater than the second preset value, if so, enters described main frame write judging unit; Otherwise statistics page status table, finds out to be recycled piece of minimum valid data and after the upper recovery mark of mark, enters described main frame write judging unit;
Described main frame write judging unit, for judging whether main frame sends stopping data transfer command, if so, terminates all write operations, otherwise, after continuing to receive data to be written from main frame, enter said write operating unit.
CN201310034253.6A 2013-01-29 2013-01-29 A kind of method and device solving SD agreement time-out Active CN103150124B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310034253.6A CN103150124B (en) 2013-01-29 2013-01-29 A kind of method and device solving SD agreement time-out

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310034253.6A CN103150124B (en) 2013-01-29 2013-01-29 A kind of method and device solving SD agreement time-out

Publications (2)

Publication Number Publication Date
CN103150124A CN103150124A (en) 2013-06-12
CN103150124B true CN103150124B (en) 2016-01-27

Family

ID=48548232

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310034253.6A Active CN103150124B (en) 2013-01-29 2013-01-29 A kind of method and device solving SD agreement time-out

Country Status (1)

Country Link
CN (1) CN103150124B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108762974A (en) * 2018-04-27 2018-11-06 江苏华存电子科技有限公司 A kind of blank page checking system for flash memory correlation main control end control device

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101923448A (en) * 2010-02-08 2010-12-22 安凯(广州)微电子技术有限公司 Method for reading and writing conversion layer of NAND flash memory
CN102012869A (en) * 2009-09-04 2011-04-13 威刚科技股份有限公司 Data recording method of flash memory storage system

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI499909B (en) * 2007-01-26 2015-09-11 Cheriton David Hierarchical immutable content-addressable memory processor

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102012869A (en) * 2009-09-04 2011-04-13 威刚科技股份有限公司 Data recording method of flash memory storage system
CN101923448A (en) * 2010-02-08 2010-12-22 安凯(广州)微电子技术有限公司 Method for reading and writing conversion layer of NAND flash memory

Also Published As

Publication number Publication date
CN103150124A (en) 2013-06-12

Similar Documents

Publication Publication Date Title
CN106598878B (en) Solid state disk cold and hot data separation method
CN109871333A (en) The method of access flash memory module and relevant flash controller and electronic device
CN102609741B (en) A kind of method of exchanges data between mobile device and inside and outside portion storage card thereof
EP2115595A2 (en) Memory device performance enhancement through pre-erase mechanism
CN103135941B (en) The management method of in-line memory, in-line memory and electronic equipment
KR102517685B1 (en) Memory block recovery method and device
CN104503703A (en) Cache processing method and device
CN105760311A (en) Trim command response method and system and operation system
CN105373338A (en) Control method and controller for FLASH
CN111930301A (en) Garbage recycling optimization method and device, storage medium and electronic equipment
CN109086168A (en) A kind of method and its system using hardware backup solid state hard disk writing rate
CN103150124B (en) A kind of method and device solving SD agreement time-out
CN109144428A (en) It is a kind of applied to the rubbish recovering method of solid state hard disk, equipment and medium
CN102841894A (en) Data storage method of file allocation table
CN109901664A (en) Method, apparatus, system, equipment and the readable storage medium storing program for executing of clock signal are provided
CN103077118A (en) Method and system for recovering invalid data
CN103020672B (en) Wireless electronic tag during train driving and on it carries out the method for data interaction
CN105528314A (en) Data processing method and control equipment
CN111324289B (en) Memory device
CN104571951B (en) EMMC/UFS cards and its method for improving EMMC/UFS card reading performances
CN106649131A (en) Solid state disk, logic address range conflict monitoring method and logic address range conflict monitoring system
KR20210080967A (en) Controller and operation method thereof
CN103729209A (en) Difference upgrading method used for firmware device
CN106021124B (en) A kind of storage method and storage system of data
CN105335095A (en) Flash file system processing method and apparatus

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
CB02 Change of applicant information

Address after: 518057 room 606-608, Changhong science and technology building, twelve South tech Road, Nanshan District hi tech Zone, Shenzhen, Guangdong

Applicant after: SILICONGO MICROELECTRONICS CO., LTD.

Address before: 518057 room 606-608, Changhong science and technology building, twelve South tech Road, Nanshan District hi tech Zone, Shenzhen, Guangdong

Applicant before: Shenzhen SiliconGo Semiconductor Co., Ltd.

COR Change of bibliographic data
GR01 Patent grant
CP03 Change of name, title or address
CP03 Change of name, title or address

Address after: 518057 05-2, 06-08 unit, 6 floor, Changhong science and technology building, 18 Nanshan District science and technology south twelve Road, Shenzhen, Guangdong.

Patentee after: Shenzhen SiliconGo Semiconductor Co., Ltd.

Address before: 518057 Nanshan District science and technology building 606-608, science and technology south twelve Road, Nanshan District hi tech Zone, Shenzhen, Guangdong

Patentee before: SILICONGO MICROELECTRONICS CO., LTD.