This application claims priority to Taiwan Application Serial Number 97135679, filed Sep. 17, 2008, which is herein incorporated by reference.
1. Field of Invention
The present invention relates to a method for operating a memory device. More particularly, the present invention relates to a method for operating a memory card.
2. Description of Related Art
A memory card or flash memory card is a solid-state electronic flash memory data storage device used with digital cameras, handheld and Mobile computers, telephones, music players, video game consoles, and other electronics. They offer high re-record-ability, power-free storage, small form factor, and rugged environmental specifications. There are also non-solid-state memory cards that do not use flash memory, and there are different types of flash memory.
The memory card includes a controller and a flash memory, where the flash memory includes a lot of memory cells. In practice, a plurality of procedure files, such as above-mentioned command file and response files, are preloaded in the memory card. The controller can control the memory card to execute specific functions by means of these procedure files.
However, the user may operate the memory card with a careless mistake, which results in that the procedure files may be deleted or modified. For the foregoing reasons, there is a need for a new method for operating a memory card to prevent that procedure files are modified or deleted. The present disclosure meets this need.
It is therefore an objective of the present invention to provide a method for operating a memory card including a file allocation table having at least one first sector and a description block having a plurality of second sectors.
In accordance with an embodiment of the present disclosure, the method comprise following step:
(1) A file is preloaded in the first sector of the file allocation table and the second sectors of the description block, wherein the file at least including first data, second data and third data, wherein the first sector is filled up with the first data, only one of the second sectors is not filled up with the second data and the other second sectors are filled up with the third data.
(2) A command is received, where the command is capable of updating the file.
(3) The command for the first sector is ignored.
(4) The only one of the second sectors is updated according to the command.
(5) The command for the other second sectors is ignored.
(6) The second data of the only one of the second sectors are recovered.
It is to be understood that both the foregoing general description and the following detailed description are by examples, and are intended to provide further explanation of the invention as claimed.
For a more complete understanding of the present invention, and the advantages thereof, reference is now made to the following descriptions taken in conjunction with the accompanying drawing, in which:
Reference will now be made in detail to the present preferred embodiments of the invention, examples of which are illustrated in the accompanying drawings. Wherever possible, the same reference numbers are used in the drawings and the description to refer to the same or like parts.
Please refer to
(1) Step 110: a file is preloaded in the first sector of the file allocation table and the second sectors of the description block, wherein the file at least including first data, second data and third data, wherein the first sector is filled up with the first data, only one of the second sectors is not filled up with the second data and the other second sectors are filled up with the third data.
(2) Step 120: a command is received, where the command is capable of updating the file.
(3) Step 130: the command for the first sector is ignored.
(4) Step 140: the command for the other second sectors is ignored.
(5) Step 150: the only one of the second sectors is updated according to the command.
(6) Step 160: the second data of the only one of the second sectors are recovered.
Therefore, the file in the memory card is protected by the method 100, so that the file can't be modified or deleted. Besides, the file that is not protected may be read, wrote, searched, modified or deleted.
In practice, the capacity of the above-mentioned first sector of the file allocation table is 512 bytes. Additionally, the capacity of each the second sectors of the description block is 512 bytes.
Generally, the speed of ignoring the command is faster than the speed of data recovering. Thus, the first data of the file filled with the first sector of the file allocation table in step 110. Then, the command for the first sector is ignored in step 130.
However, the first data of the file filled with the first sector of the file allocation table in step 110, which signifies that only one second sector of the second sectors is not filled up with the second data of the file and the other second sectors are filled up with the third data of the file. In other words, the only one sector may include the second data of the file. Besides, the particular sector may further include other data. Thus, the second data of the only one of second sectors are recovered by means of data recovering in step 160.
Moreover, only one particular sector of the second sectors is not filled up with the second data of the file and the other second sectors are filled up with the third data of the file in step 110. Thus, the command for the other second sectors are ignored in step 150.
Accordingly, the second data of the only second sector are recovered and the command for the other second sectors and the first sector are ignored when the memory card receives the command. Thus, the method 100 with high executing speed is capable of protecting the file that can't be modified or deleted.
For a more complete understanding step 160 of the method 400 to execute data recovering, please refer to
Accordingly, the file could be recovered in step 160.
It will be apparent to those skilled in the art that various modifications and variations can be made to the structure of the present invention without departing from the scope or spirit of the invention. In view of the foregoing, it is intended that the present invention cover modifications and variations of this invention provided they fall within the scope of the following claims and their equivalents.
Number | Date | Country | Kind |
---|---|---|---|
97135679 | Sep 2008 | TW | national |