201040970 六、發明說明: 【發明所屬之技術領域】 本發明涉及-種資料擦除系統及方法,尤其涉及—種快閃記 憶體資料擦除系統及方法。 【先前技術】 快閃記憶體(Flash memory )是在2〇世紀80年代末逐漸發展201040970 VI. Description of the Invention: [Technical Field] The present invention relates to a data erasing system and method, and more particularly to a flash memory data erasing system and method. [Prior Art] Flash memory was gradually developed in the late 1980s.
起來的種新型非易失性半導體記憶體,它結合了以往EpR〇M Ο Ο 結構鮮、密度高和EPROM在系統的電可擦除性的一些優點, 實現了高密度、低成本和高可靠性。 .目則’大多數通訊裳置採用了快閃記憶體做為儲存介質。所 述快閃記㈣包括多_定大小的區塊,所述區塊大小通常為 ^⑽' 32_、16b_或者,在對快閃記憶 體進行擦畴是以所述區塊為單位進行擦ι正雜除後的 ^憶體處於正常狀態:可寫人新㈣料,並且寫人㈣料格式正 可以被正確@取。但疋’當在擦除過程中出現異常,例如: =訊裝置突贿電,則會造輪除後_塊處於錯誤狀態:不能 式錯誤,不能被正確J新的讀,但是寫入後的資料格 【發明内容】 :::r記紐進行多次擦除,使擦除後的二體及 憶體=======腾裝咖記 初始化拉組,用於當需要對該 201040970 快閃記憶體進行資料擦除時,設置該快閃記憶體中區塊的當前擦 除次數和最大絲讀,並初靴當麵除缝值為g ;捧除模 •組,用於對該快閃記憶體中需進行資料擦除的一個區塊妨一次 •資料擦除,並將當前擦除次數加1 ;設置模組,用於將該進行擦除 後的區塊的第-餘元設置為〇 ;判斷模'组,用於當該擦除後的區 塊中第-個位元以外的其他位元都為χ日寺,判斷是否繼續捧除該 快閃記㈣的其倾塊;及提示模組’用於當雜雜的區塊中 〇除了第-個位元以外的其他位元不全為i,並且該區塊的當前擦除 次數值等於最大擦除次數辦,提示用戶該快閃記紐出現異常。 -種快閃記紐資料擦除方法,應用於絲有快閃記憶體的 通,裝置t ’該方法包括如下步驟:(a)當需要對快閃記憶體進 仃貪料擦除時,設置該㈣記紐中區塊的當前擦除次數和最大 檫除次數值·’⑻初始化當前擦除次數值為Q ; (e)對_記憶體 中而進行祕擦除的-健塊進行—次資料擦除,並將擦除次數 值加1 ;⑷將該進行擦除後的區塊的第一個位元設置為〇 ; (e) ❹判_擦雜的區塊巾第—條元以外的其恤元衫都為丄; jf)當該擦除後的區塊中第一個位元以外的其他位元都為i時, 右而要繼續擦除该快閃記憶體的其他區塊,則返回至步驟(b); 或者’(g)當該擦除後的區塊中除了第一個位元以外的其他位元 不全為1時,判斷該區塊的當前擦除次數值是否小於最大擦除次 數值,00當該擦除後的區塊中除了第一個位元以外的其他位元 不全為1,並且該區塊的當前擦除次數等於最大擦除次數值時,提 八用戶陕閃s己憶體出現異常;或者,當該擦除後的區塊中除了第 個位70以外的其他位元不全為i,並且該區塊的當前擦除次數值 5 201040970 小於最大擦除次數值時,返回至步驟(C)。 相較於習知技術’所述的快閃記憶體資料擦除系統及方法, ' 可以設置快閃記憶體的最大擦除次數,當擦除後快閃記憶體未處 - 於正常狀態並且當前擦除次數小於最大擦除次數時,再次對該快 閃記憶體進行擦除,使擦除後的快閃記憶體處於正常狀態。 【實施方式】 ~ 如圖1所示,係本發明快閃記憶體資料擦除系統的應用環境 圖。所述的快閃記憶體資料擦除系統1〇應用於安裝有快閃記憶體 〇 12的通訊裝置1上。所述的通訊裝置1可以是手機、個人數位助 理(personal digital assistant,簡稱PDA)、掌上電腦或其他任意適 用的移動終端。所述的快閃記憶體12用於儲存通訊裝置χ中的文 檔。所述快閃記憶體資料擦除系統10用於對快閃記憶體12中的 資料進行擦除,使擦除後快閃記憶體12處於正常狀態。 如圖2所示’係本發明快閃記憶體資料擦除系統的功能模組 圖。該快閃記憶體資料擦除系統10包括:初始化模組1〇〇、擦除 ❹模纟且脱、設置模組1〇4、判斷模組106及提示模組1〇8。 所述初始化模組100用於當需要對快閃記憶體12進行資料擦 除時,設置該快閃記憶體中區塊的資料擦除參數。所述快閃記憶 體12包括多個固定大小的區塊,所述區塊大小通常為1281?^四、 64bytes、32bytes、16bytes或者8bytes,在對快閃記憶體12進行 擦除時是以所述區塊為單位進行擦除。所述資料擦除參數包括快 閃圮憶體12的當前擦除次數和最大擦除次數。 所述初始化模組1〇〇還用於初始化設置的資料擦除參數。在 本實施例中,所述初始化模組1〇〇初始化當前擦除次數值為〇,初 6 201040970 始化最大擦除次數值為3。 所述擦除模組102用於對快閃記憶體12中需進行資料擦除的 '一個區塊進行一次資料擦除,並將當前擦除次數值加1。 - 所述没置模組104用於將該進行擦除後的區塊的第一個Bit (位元)設置為〇。快閃記憶體12中每個區塊的第一個Bit用於 標示該區塊的狀態,若區塊的第一 Bit為〇,則表示該區塊處於可 被寫入資料的狀態,若區塊的第一 Bit為卫,則表示該區塊處於不 可被寫入資料的狀態。 〇 所述判斷模組106用於判斷該擦除後的區塊中第一個位元以 外的其他位元是否都為1。若該擦除後的區塊中第一個位元以外的 其他位元都為1,則表示該區塊處於正確格式的狀態;若該擦除後 的區塊中第一個位元以外的其他位元不全為i,則表示該區塊的資 料處於錯誤格式的狀態,例如:亂碼。 所述判斷模組106還用於當該擦除後的區塊中第一個位元以 外的其他位元都為1時’判斷是否繼續擦除該快閃記憶體12的其 〇 他區塊。若需刪除的資料佔用多個區塊,當還有區塊的資料未擦 除時’判斷繼續擦除該快閃記憶體12的其他未擦除區塊;當所有 區塊的資料都擦除完成時,判斷不繼續擦除該快閃記憶體12的其 他區塊。 所述判斷模組106還用於當該擦除後的區塊中第一個位元以 外的其他位元不全為1時,判斷該區塊的當前擦除次數值是否小 於3。 所述提示模組108用於當該擦除後的區塊中除了第一個位元 以外的其他位元不全為1,並且該區塊的當前擦除次數值等於3 7 201040970 以便用戶及時進行相對 時,則提示用戶快閃記憶體12出現異常 應的處理。 如圖3所示,係本發明快閃記憶體資料擦除方法的較佳實施 方式的流程圖。步驟S1G,當需要對快閃記憶體12進行資料擦除 時,初始化模組勘設置該快閃記憶體中區塊的資料擦除束^ 所述資料擦除參數包括㈣記憶體12的當祕除次數和最大擦除 次數。 步驟S12,初始化模組⑽初始化當前擦除次數值為〇,初始 化最大擦除次數值為3。 步驟S14,擦除模、组1〇2對快閃記憶體12中需進行資料擦除 的-個區塊進行-次資料擦除,並將#前擦除次數值加i。 步驟S16,設置模組綱將該進行擦除後的區塊的第一個扯 (位元)設置為0。快閃記憶體12中每個區塊的第一個劭用於 標示該區塊的狀態,若區塊的第一 Bit為0,則表示該區塊處於可 ❹ 被寫入資料的狀態’若區塊的第一拙為丄,則表示該區塊處於不 可被寫入資料的狀態。 步驟S18,判斷模組106判斷該擦除後的區塊中第一個位元以 外的其他位元是否都為1。若該擦除後的區塊中第一個位元以外的 其他位tl都為1 ’則表示該區塊處於正確格式的狀態;若該擦除後 的區塊中除了第—個位元以外的其齡元不全為1,麻示該區塊 的資料處於錯誤格式的狀態,例如:亂碼。 步驟S20,當該擦除後的區塊中第一個位元以外的其他位元都 為1時’判斷模組106判斷是否繼續擦除該快閃記憶體12的其他 區塊。若需刪除的資料佔用的多個區塊,當還有區塊的資料未擦 8 201040970 除時,判斷繼續擦除該快閃記憶體12的其他未擦除區塊;當所有 區塊的資料都擦除完成時,判斷不繼續擦除該快閃記憶體12的且 他區塊。當判斷模組判斷繼續擦除該快閃記憶體12的其他區 塊¥’返回至步驟si2,或者’當判斷模、組1〇6判斷不繼續擦除該 快閃記憶體12的其他區塊時,結束流程。 步驟S22,當該擦除後的區塊t除了第—個位元射卜的其他位 元不全為1時’觸模組⑽判斷該區塊的#前擦除次數值是否A new type of non-volatile semiconductor memory that combines the advantages of previous EpR〇M Ο Ο structure, high density and EPROM in the system's electrical erasability, achieving high density, low cost and high reliability. Sex. The goal is that most communication devices use flash memory as a storage medium. The flash code (4) includes a plurality of sized blocks, the block size is usually ^(10)' 32_, 16b_ or, in the flash memory, the domain is wiped in units of the block. After the hybridization, the memory is in a normal state: the new (four) material can be written, and the write (four) material format can be correctly @taken. But 疋 'When an abnormality occurs during the erasing process, for example: = the device suddenly breaks the brigade, it will be removed after the _ block is in the wrong state: can not be wrong, can not be correctly read J new, but after writing Data grid [invention content] :::r remember to perform multiple erasures, so that the erased two-body and memories ======= 腾装咖记 initialization pull group, when needed for the 201040970 When the flash memory performs data erasing, set the current erasure number and the maximum silk reading of the block in the flash memory, and the front cover is removed by the value of g; the mode group is used to A block in the flash memory that needs to be erased by data may be erased once, and the current erasure count is incremented by one; a module is set to use the first-remaining element of the block to be erased. Set to 〇; determine the mode group, for all the bits other than the first bit in the erased block are the χ日寺, determine whether to continue to remove the flash block (four) of its dump block; And the prompting module 'used to remove all bits except the first bit in the noisy block, and the current erasure of the block Value equal to the maximum number of erase do, prompts the user to remember the flash York abnormal. - a flash flash data erasing method for applying a flash memory with a flash memory, the device t' the method comprises the following steps: (a) when the flash memory is required to be erased, the setting is (4) The current erasure number and the maximum number of erasure times of the block in the middle of the block··(8) Initialize the current erasure count value as Q; (e) Perform the secret erase on the _memory----- Erase and add the value of the erasure count to 1; (4) set the first bit of the erased block to 〇; (e) ❹ _ _ _ _ _ _ _ _ The shirt of the shirt is 丄; jf) When the other bits except the first bit in the erased block are i, the other blocks of the flash memory are to be erased to the right, Returning to step (b); or '(g) when the other blocks except the first bit in the erased block are not all 1, determine whether the current erasure value of the block is less than The maximum erasure count value, 00 when the erased block is not all bits except the first bit, and the current erasure number of the block, etc. When the maximum erasure value is used, the user has an abnormality; or, when the erased block is not all i except the first bit 70, and the current of the block When the erasure count value 5 201040970 is less than the maximum erasure count value, return to step (C). Compared with the flash memory data erasing system and method described in the prior art, 'the maximum number of erasures of the flash memory can be set, and the flash memory is not in the normal state after erasing - in the normal state and currently When the number of erasures is less than the maximum number of erasures, the flash memory is erased again, so that the erased flash memory is in a normal state. [Embodiment] ~ As shown in Fig. 1, it is an application environment diagram of the flash memory data erasing system of the present invention. The flash memory data erasing system 1 is applied to the communication device 1 on which the flash memory 〇 12 is mounted. The communication device 1 can be a mobile phone, a personal digital assistant (PDA), a palmtop computer or any other suitable mobile terminal. The flash memory 12 is used to store documents in the communication device. The flash memory data erasing system 10 is configured to erase data in the flash memory 12 so that the flash memory 12 is in a normal state after erasing. As shown in Fig. 2, it is a functional module diagram of the flash memory data erasing system of the present invention. The flash memory data erasing system 10 includes an initialization module 1A, an erase module, and a set module 1〇4, a determination module 106, and a prompt module 1〇8. The initialization module 100 is configured to set a data erasure parameter of the block in the flash memory when the data is to be erased by the flash memory 12. The flash memory 12 includes a plurality of fixed size blocks, and the block size is usually 1281?^4, 64bytes, 32bytes, 16bytes or 8bytes. When erasing the flash memory 12, it is The block is erased in units. The data erasure parameter includes the current number of erasures and the maximum number of erasures of the flash memory. The initialization module 1〇〇 is also used to initialize the set data erasure parameters. In this embodiment, the initialization module 1 initializes the current erasure count value to 〇, and the initial 6 201040970 initializes the maximum erasure count value to 3. The erasing module 102 is configured to perform a data erasure on the 'one block' of the flash memory 12 to be erased, and add the current erasure value to 1. - The no-module module 104 is configured to set the first bit (bit) of the block to be erased to 〇. The first bit of each block in the flash memory 12 is used to indicate the state of the block. If the first bit of the block is 〇, it indicates that the block is in a state in which data can be written. The first bit of the block is Wei, indicating that the block is in a state in which data cannot be written. The judging module 106 is configured to determine whether all other bits except the first bit in the erased block are 1. If the bit other than the first bit in the erased block is 1, it indicates that the block is in the correct format state; if the erased block is other than the first bit in the block If other bits are not all i, it means that the data of the block is in an error format state, for example: garbled. The determining module 106 is further configured to: determine whether to continue erasing the other block of the flash memory 12 when all the bits other than the first bit in the erased block are 1 . If the data to be deleted occupies multiple blocks, when there is still data of the block is not erased, 'determine to continue erasing other unerased blocks of the flash memory 12; when all the pieces of data are erased Upon completion, it is judged that the other blocks of the flash memory 12 are not erased. The determining module 106 is further configured to determine whether the current erasure value of the block is less than 3 when the other bits other than the first bit in the erased block are not all ones. The prompting module 108 is configured to: when the erased block, the bits other than the first bit are not all 1, and the current erasure number of the block is equal to 3 7 201040970 for the user to perform in time. In the opposite case, the user is prompted to perform the processing of the abnormality of the flash memory 12. 3 is a flow chart of a preferred embodiment of the flash memory data erasing method of the present invention. Step S1G, when data erasure is required for the flash memory 12, the initialization module maps the data erasure bundle of the block in the flash memory. The data erasure parameter includes (4) the secret of the memory 12 Divide times and maximum number of erasures. In step S12, the initialization module (10) initializes the current erasure count value to 〇, and initializes the maximum erasure count value to 3. In step S14, the erase mode and the group 1〇2 perform -subsequent data erasure on the blocks in the flash memory 12 to be erased by data, and add the value of the #pre-erasure number to i. In step S16, the module is set to set the first bit (bit) of the block to be erased to 0. The first frame of each block in the flash memory 12 is used to indicate the state of the block. If the first bit of the block is 0, it indicates that the block is in a state in which the data can be written. The first parameter of the block is 丄, indicating that the block is in a state in which data cannot be written. In step S18, the determining module 106 determines whether all the other bits except the first bit in the erased block are 1. If the bit tl other than the first bit in the erased block is 1 ', the block is in the correct format; if the erased block is in addition to the first bit The age is not all 1, and the data of the block is in the wrong format, for example: garbled. In step S20, when all the bits other than the first bit in the erased block are 1, the determining module 106 determines whether to continue erasing other blocks of the flash memory 12. If the data to be deleted is occupied by multiple blocks, when there is still the data of the block is not erased, the other un-erased blocks of the flash memory 12 are judged to continue to erase; When the erasure is completed, it is judged that the block of the flash memory 12 and the other block are not erased. When the judging module judges to continue to erase other blocks of the flash memory 12, 'return to step si2, or 'when judging mode, group 1〇6 determines not to continue erasing other blocks of the flash memory 12 At the end, the process ends. In step S22, when the erased block t is not all other than the other bits of the first bit, the touch module (10) determines whether the #pre-erasure value of the block is
步驟S24,當該擦除後_塊巾除了第—個位元以外的並他位 兀不全為i ’並麟區塊的當前擦除次數值等於3時提示模电 108提示用戶快閃記憶體12出現異常,以便用戶及時進行相對庫 的處理。或者,細嫌後輪財除了第—條元料的宜他 位疋不全為i,並且籠_#贿除絲值料 驟 S14。 ^ 綜上所述,本發明符合發明專利要件,爰依法提出專利申請。 惟,以上騎者僅為本發明之較佳實袖,本㈣之範圍 上述實施例為限,舉凡熟悉本案技藝之人 作之等效修飾或變化,皆應涵蓋於 $月之精神所 【圖式簡單說明】 卜甲明專利範圍内。 ^ 1係本發·閃記憶體資料擦耗_翻環境圖。 =Γ快閃記憶體資料擦除系統的功能模組圖。 程圖圖係本發明快閃記憶體資料擦除方法的較佳實施方式的流 【主要元件符號說明】 9 201040970 通訊裝置 1 快閃記憶體資料擦除系統 10 快閃記憶體 12 初始化模組 100 擦除模組 102 設置模組 104 判斷模組 106 提示模組 108 οStep S24, when the erasure_block is not the same as the first bit, and the other bit is not the same as the current erasure number of the i-block is equal to 3, the prompt mode 108 prompts the user to flash the memory. 12 An exception occurs so that the user can process the relative library in time. Or, the suspected rear-wheels are not all i, except for the first-order material, and the cage is _# bribes the value of the material S14. ^ In summary, the present invention complies with the requirements of the invention patent and submits a patent application according to law. However, the above rider is only the preferred sleeve of the present invention. The scope of the above (4) is limited to the above embodiments, and equivalent modifications or changes made by those who are familiar with the skill of the present invention should be included in the spirit of the month. Brief description of the formula] Within the scope of the patent. ^ 1 Department of the hair, flash memory data wipe _ turn the environment map. =Γ Functional block diagram of the flash memory data erasing system. The flow diagram of the preferred embodiment of the flash memory data erasing method of the present invention [main component symbol description] 9 201040970 communication device 1 flash memory data erasing system 10 flash memory 12 initialization module 100 The erase module 102 sets the module 104 to determine the module 106 to prompt the module 108.
1010