The disclosures of the following priority applications are herein incorporated by reference:
1. Field of the Invention
The present invention relates to a storage control device under control by which data are recorded for storage in a storage medium.
2. Description of Related Art
Today, an electronic device such as a digital camera is typically used in conjunction with a storage medium constituted with a memory card or a memory stick loaded therein. The storage media used in such applications include rewritable storage media and write-once storage media into which data can be written only once. It is to be noted that Japanese Laid Open Patent Publication No. 2007-18528 and Japanese Laid Open Patent Publication No. 2003-196142 each disclose a file management technology that may be adopted in conjunction with write-once storage media.
The storage medium loaded in the digital camera as described above, e.g., a memory card, is normally formatted by adopting the FAT (file allocation table) filing system. Files recorded into data storage areas are managed based upon file management information referred to as “FAT” in the FAT filing system. The FAT is constituted with FAT entries each corresponding to a data storage area allocated to a given cluster. In the FAT entry for a given cluster in which file data are stored, the cluster number corresponding to the cluster to be read out next, following the given cluster, is recorded to indicate the order with which final data are read out, and in the FAT entry corresponding to the cluster which is to be read out last, a terminating end symbol is recorded.
In order to record data originating at a host device such as a PC or a digital camera into a storage medium, e.g., a memory card, adopting such a FAT filing system, the host device first temporarily stores the recording-target file data into its internal memory. The host device procures specific clusters by referencing the FAT each time data in the internal memory are to be recorded into the storage medium. Then, the host device records the read-out order and the terminating end symbol in the FAT entries corresponding to the clusters having been procured, and records the data into the clusters.
A data file with content such as movie image, the file size of which cannot be estimated while the recording session is in progress, is stored in a plurality of installments. Under such circumstances, the host device needs to update the FAT entries each time an installment of data is recorded so that the FAT entry terminating end symbol for the file data is set in the FAT entry corresponding to the very last cluster of data among the clusters of data having been written thus far. In addition, the host device needs to update the FAT entries by resetting the terminating end symbol each time an installment of data is recorded, as described above, when a given set of file data are stored in a plurality of installments so as to, for instance, allow another type of processing to interrupt the recording of the file data in progress.
However, the terminating end symbol having been recorded in the FAT entry corresponding to the current last cluster cannot be reset when recording file data such as movie data expressing, for instance, a movie image, the volume of which is greater than the capacity of the internal memory, into a write-once type storage medium, giving rise to the following problem. Namely, if the read-out order and the terminating end symbol are recorded in the FAT entries each time file data stored in the internal memory are recorded, the single set of file data cannot be stored in a plurality of installments.
According to the 1st aspect of the present invention, a storage control device comprises: a memory in which a data file is temporarily stored; a read-out unit that sequentially reads out data segments obtained by dividing the data file stored in the memory into equal data segments matching a predetermined unit; a storage medium that includes data storage areas made up with a plurality of small areas all assuming a predetermined size and a plurality of data management areas each corresponding to one of the plurality of small areas, so as to store each of the data segments into small areas and store at least one of first link information and second link information into the data management areas, the first link information indicating a read-out order with which the data segments stored in the small areas are to be read out and the second link information indicating an end of the read of the data segments; a first instruction unit that issues an instruction for procuring a plurality of consecutive data management areas in correspondence to a data size of data segments having been read out by the read-out unit; a second instruction unit that issues an instruction for writing the first link information into the data management areas excluding a trailing-end data management area among the procured data management areas; and a third instruction unit that issues an instruction for sequentially writing the data segment having been read out by the read-out unit into the data storage areas corresponding to the procured data management areas.
According to the 2nd aspect of the present invention, it is preferred that the storage control device according to the 1st aspect further comprises: a fourth instruction unit that issues an instruction for writing the second link information into the trailing-end data management area among the data management areas procured in correspondence to the data size of the data segment read out last among all the data segments in the data file.
According to the 3rd aspect of the present invention, it is preferred that the storage control device according to the 1st aspect further comprises a fourth instruction unit that issues an instruction for writing the second link information into the trailing-end data management area among the procured data management areas if a write error occurs while the data segment is being written into the data storage areas, and in the storage control device, the read-out unit reads out the data file stored in the memory again in the data segments all matching the predetermined unit; the first instruction unit issues an instruction for re-procuring the data management areas in correspondence to the data size of each data segment having been read out again; the second instruction unit issues an instruction for writing the first link information into the data management areas excluding the trailing-end data management area among the re-procured data management areas; and the third instruction unit issues an instruction for writing the data segment having been read again into the data storage areas corresponding to the re-procured data management areas.
According to the 4th aspect of the present invention, it is preferred that in the storage control device according to the 3rd aspect, if a data storage area where the write error has occurred corresponds to the trailing-end data management area among the procured data storage areas, the fourth instruction unit issues an instruction for writing the second link information into the trailing-end data management area among the procured data management areas; if the data storage area where the write error has occurred does not correspond to the trailing-end data management area among the procured data management areas, the read-out unit reads out the data file stored in the memory again in the predetermined unit; the first instruction unit issues an instruction for re-procuring the data management areas corresponding to data storage areas succeeding the data storage area where the write error has occurred; the second instruction unit issues an instruction for writing the first link information into the data management areas excluding the trailing-end data management area among the re-procured data management areas; and the third instruction unit issues an instruction for writing each data segment having been read out again into the data storage areas corresponding to the re-procured data management areas.
According to the 5th aspect of the present invention, it is preferred that the storage control device according to the 4th aspect further comprises a fifth instruction unit that issues an instruction for recording a data file read-out start position at which read of the data file to be stored in the data storage areas starts, into a specific data storage area, and in the storage control device, the fourth instruction unit issues an instruction for writing the second link information into the trailing-end data management area among the data management areas re-procured in correspondence to the data size of the last data segment having been read out again among all the data segments in the data file; and the fifth instruction unit issues an instruction for writing into the specific data storage area information on the data storage area at which a write of the data segments having been read out again starts as information indicating the data file read-out start position.
According to the 6th aspect of the present invention, the storage control device according to the 1st aspect may further comprise: a decision-making unit that makes a decision as to whether a storage medium is a write-once storage medium or a non-write-once-type storage medium and a fourth instruction unit that issues an instruction for writing the second link information into the trailing-end data management area among the data management areas procured in correspondence to the data size of the data segment each time a data segment is read out, if a storage medium is judged to be a non-write-once storage medium.
According to the 7th aspect of the present invention, a storage control device comprises: a memory in which a data file is temporarily stored; a read-out unit that sequentially reads out data segments obtained by dividing the data file stored in the memory into equal data segments matching a predetermined unit; a storage medium that includes data storage areas made up with a plurality of small areas all assuming a predetermined size and a plurality of data management areas each corresponding to one of the plurality of small areas, so as to store each of the data segments into small areas and store at least one of first link information and second information into the data management area, the first link information indicating a read-out order with which the data segments stored in the small areas are to be read out second link information indicating an end of the read of the data segments; a first instruction unit that issues an instruction for procuring a plurality of consecutive data management areas in correspondence to a data size of data segments having been read out by the read-out unit and a subsequent data management area following the consecutive data management areas; a second instruction unit that issues an instruction for writing the first link information in the data management areas excluding a trailing-end data management area among the procured data management areas; and a third instruction unit that issues an instruction for sequentially writing the data segment, having been read out by the read-out unit into the data storage areas corresponding to the data management areas in which the first link information has been written, excluding the trailing-end data management area.
According to the 8th aspect of the present invention, the storage control device according to the 7th aspect may further comprise: a fourth instruction unit that issues an instruction for writing the second link information into the trailing-end data management area among the data management areas procured for the data segment read out last among all the data segments in the data file.
According to the 9th aspect of the present invention, it is preferred that the storage control device according to the 8th aspect further comprise a fifth instruction unit that issues an instruction for recording a data file read-out start position at which read of the data file to be stored in the data storage areas starts, into a specific data storage area, and in the storage control device, if a write error occurs while write of the data segment into the data storage areas corresponding to the procured data management areas is in progress; the read-out unit again reads out the data stored in the memory in the data segments all matching the predetermined unit; the first instruction unit issues an instruction for re-procuring the data management areas following the trailing-end data management area among the data management areas having been procured immediately before occurrence of the write error; the second instruction unit issues an instruction for writing the first link information into the data management areas excluding the trailing-end data management area among the re-procured data management areas; the third instruction unit issues an instruction for executing rewrite processing for writing again each data segment read out again into the data storage areas corresponding to the data management areas in which the first link information is written, excluding the trailing-end data management area among the re-procured data management areas; the fourth instruction unit issues an instruction for writing the second link information into the trailing-end data management area among the data management areas procured at an end of the rewrite processing executed for all the data segments in the data file; and the fifth instruction unit issues an instruction for writing information on the data storage area at which the rewrite processing starts into the specific data storage area as information indicating the data file read-out start position.
According to the 10th aspect of the present invention, it is preferred that the storage control device according to the 8th aspect further comprises a fifth instruction unit that issues an instruction for recording a data file read-out start position at which read of the data file to be stored in the data storage areas starts, into a specific data storage are at and in the storage control device, if a write error occurs while write of the data segment into the data storage areas corresponding to the procured data management areas is in progress; the first instruction unit issues an instruction for re-procuring the data management areas corresponding to the data storage areas succeeding a data storage area where the write error has occurred; the second instruction unit issues an instruction for writing the first link information into the data management areas excluding the trailing-end data management area among the re-procured data management areas; the third instruction unit issues an instruction for executing rewrite processing for writing again each data segment read out again into the data storage areas corresponding to the data management areas in which the first link information is written, excluding the trailing-end data management area among the re-procured data management areas; the fourth instruction unit issues an instruction for writing the second link information into the trailing-end data management area among the data management areas procured at an end of the rewrite processing executed for all the data segments in the data file; and the fifth instruction unit issues an instruction for writing information on the data storage area at which the rewrite processing starts into the specific data storage area as information indicating the data file read-out start position.
According to the 11th aspect of the present invention, it is preferred that the storage control device according to the 7th aspect further comprises: a decision-making unit that makes the decision as to whether a storage medium is a write-once-type storage medium or a non-write-once storage medium; and a fourth instruction unit that issues an instruction for writing the second link information into the trailing-end data management area among the data management areas procured for each data segment that is read out, if the storage medium is judged to be a non-write-once type storage medium.
The following is a description of a camera that includes the storage control device achieved in the first embodiment of the present invention. In reference to the embodiment, the processing executed in the camera to record a still image file containing a single still image, into a memory card in a plurality of installments is described.
The CCD 12 stores electrical charges corresponding to the brightness of a subject by capturing an image formed with the subject light via the photographic lens 11, and outputs analog signals constituted with the stored electrical charges to the preprocess circuit 14 under control executed by the CCD driver 13. The analog signals output from the CCD 12 are amplified at the preprocess circuit 14, which then executes analog processing such as noise removal and black level adjustment on the signals. The A/D conversion circuit 15 converts the analog signals having undergone the analog processing at the preprocess circuit 14 to digital signals. The ASIC 16 generates image data by executing image processing such as outline compensation and gamma correction on the digital signals resulting from the conversion at the A/D conversion circuit 15. The ASIC 16 also creates, in compliance with the exif (exchangeable image file format) standard header information data that include information indicating the image data photographing date, information indicating the shutter speed and compression information and thumbnail image data generated by reducing the image data having undergone the image processing to a predetermined size. The ASIC 16 then creates an image file by compressing the header information data, the thumbnail image data and the image data resulting from the image processing (hereafter referred to as “main image data”) in a specific format such as JPEG.
In the memory 17 constituted with a DRAM (dynamic random access memory) and used as a work area when the CPU 10 executes a program, the image data having undergone the image processing and the like are temporarily stored. At the color monitor 18 which is a liquid crystal display unit, images, camera setting information and the like are displayed. The operation unit 19 that includes operation buttons such as a power switch and a shutter release switch is a user operation interface.
The memory card I/F 20 is a connection interface via which a detachable memory card 30 is connected. Read/write commands, data and the like exchanged between the loaded memory card and the camera 1 are relayed via the memory card I/F 20. The external I/F 21 is a connection interface such as a USB via which a device such as a PC is connected. Communication between the connected device and the camera 1 is relayed via the external I/F 21.
The memory card 30 includes a flash memory where data are stored, a memory controller that executes control for data write or data read and a register where card attribute information is stored. In response to a read/write command transmitted from the camera 1 via the memory card I/F 20, the memory controller in the memory card 30 executes data write control or data read control. The card attribute information includes data write unit information and information indicating whether the card is a write-once medium or a non-write-once medium. The memory card 30 is formatted in a FAT filing system. It is to be noted that in response to a command received from the camera 1, the memory card 30 transmits a command response to the camera 1 and that it also transmits a data response to the camera 1 each time data are written. It is assumed that data are written into the memory card 30 in a three-cluster unit in the embodiment.
The CPU 10 controls the various units constituting the camera 1 by executing a program stored in a ROM (not shown). The CPU 10 issues a write command or a read command and enables data transfer between the camera and the memory card 30 by using the FAT filing system in the memory card 30. In response to the write command, an image file (data file) read-out from the memory 17 is written into the memory card 30 in compliance with the DCF standard, whereas in response to the read command, an image file stored in the memory card 30 is read out. It is to be noted that when writing image data contained in an image file stored in the memory 17 into the memory card 30, the CPU 10 reads out the image data over a plurality of separate segments and issues the write command each time a data segment is read out.
In addition, the CPU 10 is equipped with the following functional units; a read functional unit 10a, a procuring functional unit 10b, a write functional unit 10c, a read-out order write functional unit 10d, a terminating end symbol write functional unit 10e and a decision-making functional unit 10f. When recording the image data into the memory card 30 as described above, the read functional unit 10a divides the image data in the image file stored in the memory 17 into data segments each corresponding to a predetermined unit and reads out the individual data segments. The procuring functional unit 10b issues an instruction for procuring an area where at least either information indicating the data read-out order or information indicating the read-out end is to be written in the FAT filing system to be described later.
The write functional unit 10c issues an instruction for writing image data (a data segment) read out by the read functional unit 10a into a data storage area in the FAT filing system. In addition, the write functional unit 10c issues an instruction for writing file information indicating the image file name and the image file start position into a specific region of the data storage area when the read functional unit 10a ends the read of the image data in the image file from the memory 17. The read-out order write functional unit 10d issues an instruction for writing the information indicating the read-out order into the area having been procured in response to the instruction issued by the procuring functional unit 10b. The terminating end symbol write functional unit 10e issues an instruction for writing the information indicating the read-out end into the area having been procured in response to the instruction issued by the procuring functional unit 10b. The decision-making functional unit 10f makes a decision based upon the card attribute information obtained from the memory card 30 as to whether or not the memory card 30 is a write-once medium.
In the root 230, the root directory folder name and the cluster number assigned to the cluster, in which the sub directory directly under the root directory is stored, are stored. Fat entries 221 in the FAT 220, each corresponding to one of the clusters in the data storage area 240, are set in the order matching the order with which the cluster numbers are assigned to the corresponding clusters. For instance, a FAT entry 222 corresponds to cluster 2, whereas FAT entry 223 corresponds to cluster 3. In addition, in each FAT entry 221, the cluster number assigned to the cluster to be read out after the corresponding cluster is stored to indicate the read-out order.
The data storage area 240 is made up with a plurality of clusters assigned with cluster numbers in ascending order, with the leading cluster assigned with cluster number “2”. File data such as JPEG data or raw data are stored in each cluster.
Next, the operation executed in the camera 1 is described in reference to the flowchart presented in
If it is decided that the memory card 30 is not loaded at the memory card I/F 20 (step S12: N), the CPU 10 ends the processing. However, if it is judged that the memory card 30 is loaded (step S12: Y), the CPU 10 obtains the card attribute information and the FAT filing system from the memory card 30 and stores them into the memory 17 (step S13).
Upon deciding that the shutter release button at the operation unit 19 has been pressed all the way down by the user (step S14: Y), the CPU 10 generates image data based upon imaging signals output from the CCD 12 by capturing an image formed with the subject light and outputs the image data thus generated to the memory 17 (step S15). The ASIC 16 executes the image processing on the image data stored in the memory 17, generates thumbnail image data and compresses both the main image data and the thumbnail image data in the JPEG format (step S16). The CPU 10 stores image data that include the header information for the image frame and the compressed thumbnail image data and main image data into the memory 17 (step S17). The CPU 10 then executes processing for recording the single frame of image data, having been stored in the memory 17, into the memory card 30 (step S18).
The read functional unit 10a reads out from the memory 17 image data (data segment) corresponding to three clusters constituting a single write unit by referencing the write units indicated in the card attribute information (step S201).
The procuring functional unit 10b procures clusters 4 through 6 making up a single write unit in the FAT 220. The read-out order write functional unit 10d then sequentially allocates the image data having been read out to the procured clusters 4 through 6. Namely, the read-out order write functional unit 10d sets cluster number “5” in the FAT entry of cluster 4 and cluster number “6” in the FAT entry of cluster 5 to indicate the read-out order (step S202). The read-out order write functional unit 10d issues a write command for writing the read-out order in the FAT entries excluding the FAT entry for the trailing-end cluster 6 among the procured clusters, i.e., in the FAT entries of clusters 4 and 5. The write functional unit 10c issues a write command as a form of instruction for writing the image data into the procured clusters 4 through 6. In addition, the write functional unit 10c transmits the image data having been read out to the memory card 30 (step S203).
Upon receiving the write commands and the image data via the memory card I/F 20, the memory card 30 transmits a command response to the camera 1. Based upon the received write commands, the memory card 30 writes the read-out order in the FAT entries and writes the image data sequentially starting at the leading sector in the data storage area corresponding to cluster 4. Subsequently, the memory card 30 transmits a data response via the memory card I/F 20 (step S204).
Until the read functional unit 10a ends the image data read from the memory 17 (step S201), the CPU 10 repeatedly executes the processing in steps S201˜S204 so as to write data in the FAT entries and write the main image data in the three-cluster units in the memory card 30.
When the read of the image data in the image file from the memory 17 by the read functional unit 10a ends (step S205: Y), i.e., when the trailing-end data segment among the data segments constituting the image data has been read out, the terminating end symbol write functional unit 10e issues a write command. In response to this write command, the terminating end symbol is written in the FAT entry corresponding to the trailing-end cluster 15 among the most recently procured clusters. In addition, the write functional unit 10c issues a write command, in response to which the image file name “DSC—0001.JPG” and the starting cluster number “4” are written as file information of cluster 3 designated as the directory entry area (step S206). The write commands issued in step S206 are received at the memory card 30 via the memory card I/F 20 and then the memory card 30 transmits a command response via the memory card I/F 20. In conformance to the received write commands, the terminating end symbol is written in the FAT entry corresponding to cluster 15 and the file information indicating the file name “DSC—0001.JPG” and the starting cluster number “4” is written into the data storage area of cluster 3 at the memory card 30. The memory card 30 then transmits the data response via the memory card I/F 20 (step S207).
It is to be noted that the CPU 10 disallows issuance of a write command for other main image data while the main image data are being written into the write-once-type memory card 30. As a result, since no terminating end symbol is written in the FAT entry corresponding to the trailing-end cluster among the most recently procured clusters until the read ends, it is ensured that any single FAT entry is never used twice for the write of the read-out order corresponding to a set of main image data and the write of the read-out order corresponding to another set of main image data.
By reading out the file information in the directory entry area and the FAT entries in
The procuring functional unit 10b procures clusters corresponding to a single write unit (clusters 4˜6 for the first write session) in the FAT 220. The read-out order write functional unit 10d sequentially allocates the image data having been read out to the procured clusters. It is to be noted that in the case of the first write session, the read-out order write functional unit 10d sets cluster number “5” in the FAT entry of cluster 4 and cluster number “6” in the FAT entry of cluster 5, whereas the terminating end symbol write functional unit 10e sets the terminating end symbol “E” in the FAT entry of cluster 6. Through this process, the read-out order write functional unit 10d sets the read-out order and the terminating end symbol write functional unit 10e sets the terminating end symbol in the FAT entry corresponding to the last cluster (step S102). The read-out order write functional unit 10d issues a write command for writing the read-out order in the specific FAT entries among the FAT entries corresponding to the procured clusters. The terminating end symbol write functional unit 10e issues a write command for writing the terminating end symbol in the FAT entry corresponding to the trailing-end cluster among the procured clusters. The write functional unit 10c issues a write command for writing the image data having been read out in step S101 into the data storage areas of the clusters having been set as described above. The write functional unit 10c also transmits the image data having been read out to the memory card 30 (step S103).
It is to be noted that if the current write session is not the first write session, the read-out order write functional unit 10d issues the following write command. Namely, it issues a command for rewriting the terminating end symbol written in the FAT entry corresponding to the last cluster among the clusters having been procured for the preceding write so as to replace it with the cluster number indicating the leading cluster for the current write session (e.g., in the case of the second write session, the terminating end symbol “E” in the FAT entry of cluster 6 is replaced with cluster number “7”).
Upon receiving the write commands and the image data via the memory card I/F 20, the memory card 30 transmits a command response to the camera 1. Based upon the received write commands, the memory card 30 writes the read-out order in the FAT entries and writes the image data sequentially starting at the leading sector in the data storage area corresponding to cluster 4. Subsequently, the memory card 30 transmits a data response via the memory card I/F 20 (step S104).
As long as the image data read from the memory 17 by the read functional unit 10a is still underway (step S105: N), the CPU 10 repeatedly executes the processing in steps S101˜S104 so as to write data in the FAT entries and the main image data in the three-cluster unit at the memory card 30.
When the read of the image data in the image file from the memory 17 by the read functional unit 10a ends (step S105: Y), the write functional unit 10c issues a write command (step S106). In response to this write command, the image file name “DSC—0001.JPG” and the starting cluster number “4” assigned to the starting cluster 4 among the clusters in which the image file is stored, are written as the file information of cluster 3 designated as the directory entry area. The write command issued in step S107 is received at the memory card 30 via the memory card I/F 20 and the memory card 30 then transmits a command response via the memory card I/F 20. In conformance to the received write command, the file information indicating the file name “DSC—0001.JPG” and the starting cluster number “4” is written into the data storage area of cluster 3 at the memory card 30. The memory card 30 then transmits a data response via the memory card I/F 20 (step S107).
Thus, by reading out the file information in the directory entry area and the FAT entries in
In the first embodiment described above, control is executed so as not to enter the terminating end symbol in the FAT entry corresponding to the trailing-end cluster among the clusters procured in the FAT for each write session until the write of the image data in the image file is completed even though the image data is recorded into a write-once type memory card in a plurality of installments. Under the control executed in the embodiment, image data contained in a given file can be recorded in a plurality of successive installments.
Next, variations of the first embodiment explained above are described.
First Variation
The first embodiment is described above by assuming that no write error occurs while the write of the image data into the memory card 30 is in progress. Now, in reference to this particular variation, error processing that may be executed after a write error occurs in the memory card 30 is described. It is to be noted that components identical to those in the first embodiment are referred to by quoting the same reference numerals. In addition, the variation is described by assuming that in the event of a write error in the memory card 30, the memory card 30 transmits a write error event message to the camera 1.
The procuring functional unit 10b procures clusters 4˜6 as available areas by referencing the FAT 220 in
If the CPU 10 receives a write error event message response from the memory card 30 (step S305: Y) after the condition in
The CPU 10 executes the processing in steps S301˜S304 explained earlier after step S307. Namely, the read functional unit 10a reads out the image data again from the memory 17 and the procuring functional unit 10b procures clusters in the FAT 220 again. Then, the read-out order write functional unit 10d issues a write command for writing the read-out order into the specific FAT entries among the FAT entries corresponding to the re-procured clusters. The write functional unit 10c issues a write command as a form of instruction for writing the image data into the procured clusters and transmits the image data. As in the first embodiment, the terminating end symbol write functional unit 10e issues a write command for writing the terminating end symbol in the FAT entry corresponding to the trailing-end cluster, among the re-procured clusters, when the read of the image data in the image file ends. In addition, the write functional unit 10c issues a write command for writing the file information into the directly entry area.
In the first variation described above, even if image data are not written in the data storage area of a cluster where no error has occurred among the procured clusters, new available areas are procured without rewriting image data into the particular storage area. As a result, no FAT/data storage area mismatch occurs immediately after the occurrence of the error. In addition, since the file information indicating the image file name and the starting cluster is written at the end of the image file write, the file name remaining unchanged from that assumed before the occurrence of the write error, can be set for the image file when rewriting the image data following the occurrence of the write error.
Second Variation
The second variation of the embodiment is now described. In this variation, error processing different from that executed in the first variation is executed in the event of a write error in the memory card 30. It is to be noted that components identical to those in the first embodiment are referred to by quoting the same reference numerals. In addition, the variation is described by assuming that in the event of a write error in the memory card 30, the memory card 30 transmits a write error event message that includes the cluster number assigned to the error cluster where the write error has occurred, to the camera 1.
If the CPU 10 decides in step S405 that a write error event message originating from the memory card 30 has been received (step S405: Y), the CPU 10 makes a decision as to whether or not the error cluster number included in the error event message matches the cluster number assigned to the trailing-end cluster among the procured clusters (step S406). It is to be noted that the error, the occurrence of which is detected in step S405, will have occurred as the memory card 30 attempted to write image data into the data storage area of the cluster specified in the write command issued by the write functional unit 10c in step S403, where other data had actually been stored.
If it is decided that the error cluster number does not match the cluster number assigned to the trailing-end cluster (step S406: N), the read functional unit 10a reads out the image data (data segment) from the memory 17 again (step S407). The procuring functional unit 10b re-procures, in the FAT 220, clusters making up a single write unit, starting with the cluster immediately following the error cluster (step S408) and executes the processing in step S403 and subsequent steps.
If, on the other hand, the CPU decides that the error cluster number matches the cluster number assigned to the trailing-end cluster among the procured clusters (step S406: Y), the terminating end symbol write functional unit 10e issues a write command for writing the terminating end symbol in the FAT entry corresponding to the trailing-end cluster among the procured clusters (step S409). In conformance to the write command issued by the camera 1, the memory card 30 writes the terminating end symbol in the FAT entry corresponding to the trailing-end cluster (step S410). The CPU 10 then executes the processing in step S401 and subsequent steps.
As long as the error cluster where a write error occurs while an image data write into the memory card 30 is in progress, is not the trailing-end cluster among the procured clusters, the image data can be allocated to clusters corresponding to the write unit, procured starting with the cluster immediately following the error cluster in the variation. Thus, compared with procuring a new set of clusters corresponding to the write unit regardless of the location of the error, the extent of cluster wastage is minimized.
In reference to drawings, a camera that includes the storage control device achieved in the second embodiment of the present invention is described. The following explanation focuses on the differences from the first embodiment by assigning the same reference numerals to components identical to those in the first embodiment. The essential components constituting the camera 1 in the second embodiment are similar to those of the camera 1 in the first embodiment shown in
The decision-making functional unit 10f determines, based upon the card attribute information obtained in step S13, that the memory card 30 is a write-once type medium. The read functional unit 10a reads out from the memory 17 image data (data segment) corresponding to three clusters constituting a single write unit by referencing the write unit indicated in the card attribute information (step S501).
The procuring functional unit 10b references the FAT 220 in
The read-out order write functional unit 10d issues a write command. In response to this write command, the read-out order is written in the FAT entries except for the FAT entry corresponding to the trailing-end cluster 7, i.e., in the FAT entries corresponding to clusters 4˜6, among the procured clusters. The write functional unit 10c issues a write command for writing the image data having been read out in step S501 into the individual data storage areas of clusters 4˜6. The write functional unit 10c then transmits the image data having been readout to the memory card 30 (step S503).
Upon receiving the write commands and the image data via the memory card I/F 20, the memory card 30 transmits a command response to the camera 1. Based upon the received write commands, the memory card 30 writes the read-out order in the FAT entries and writes the image data sequentially starting at the leading sector in the data storage area corresponding to cluster 4. Subsequently, the memory card 30 transmits a data response via the memory card I/F 20 (step S504).
As long as the read of the image data in the memory 17 by the read functional unit 10a is underway (step S505: N), the CPU 10 repeatedly executes the processing in steps S501˜S504. For each image data read session, the procuring functional unit 10b procures the FAT entries corresponding to four clusters, i.e., three clusters making up the write unit plus an extra cluster. The read-out order write functional unit 10d issues a write command as a form of instruction for writing the read-out order in the FAT entries corresponding to specific clusters among the procured clusters The write functional unit 10c transmits main image data, the volume of which matches three clusters making up the write unit.
When the read of the image data in the image file from the memory 17 by the read functional unit 10a ends (step S505: Y) in the processing shown in
In the second embodiment described above, as data into predetermined size are read out from the memory, one extra cluster is procured in addition to the number of clusters needed to write the data in the predetermined size having been read out. Until the write of the entire file is completed, no data are written in the FAT entry corresponding to the extra cluster procured in correspondence to each data read session. Thus, data can be continuously written until the entire data write is completed and the data in the file can be written in a plurality of installments.
In addition, while the terminating end symbol is recorded in the FAT entry corresponding to the trailing-end cluster among the most recently procured clusters when the data write processing ends, the write processing is terminated without recording any data into the data storage area of the particular cluster in the second embodiment. Thus, the data storage area in the cluster will be wasted. However, the FAT entry and the data storage area corresponding to each cluster is controlled so as to assume matching data storage states. As a result, even if interrupt processing such as disengagement of the memory card occurs while the record processing is in progress, the orderly storage condition within the file system is not disrupted.
Next, variations of the second embodiment explained above are described.
Third Variation
The second embodiment is described above by assuming that no write error occurs while the write of image data into the memory card 30 is in progress. Now, in reference to this particular variation, error processing that may be executed after a write error occurs in the memory card 30 is described. It is to be noted that components identical to those described in the embodiment are referred to by quoting the same reference numerals. In addition, the variation is described by assuming that in the event of a write error in the memory card 30, the memory card 30 transmits a write error event message to the camera 1.
As the CPU 10 receives a write error event message response from the memory card 30 (step S605: Y) in the processing shown in
When the read of the image data in the image file by the read functional unit 10a ends, i.e., when the image file write ends (step S606:Y) in the processing shown in
In the third variation described above, no read-out order or terminating end symbol is recorded in the FAT entry corresponding to the trailing-end cluster, i.e., the extra cluster procured for each read session. As a result, in the event of a write error, error processing can be executed by resuming the data write at the trailing-end cluster among the clusters having been procured immediately before the occurrence of the error. Thus, even in the event of a write error, interrupt processing or the like, the cluster area procured as an extra in correspondence to each data read session can be utilized fully without causing any disruption in the orderly state of the filing system. In addition, the same file name, unchanged from that set before the occurrence of the error, can be set for the data, the write of which resumes after the occurrence of the write error, by writing the file information indicating the image file name and the starting cluster when the image file write is completed.
Fourth Variation
The fourth variation of the embodiment is now described. In this variation, error processing different from that executed in the third variation is executed in the event of a write error in the memory card 30. It is to be noted that components identical to those in the embodiment are referred to by quoting the same reference numerals. In addition, the variation is described by assuming that in the event of a write error in the memory card 30, the memory card 30 transmits a write error event message that includes the error cluster number assigned to the error cluster where the write error has occurred, to the camera 1.
As is the third variation described above, the fourth variation is described by assuming that the CPU 10 receives a write error event message from the memory card 30 (step S705: Y). It is assumed that the error indicated in the write error event message has occurred as the memory card 30 has attempted to write image data into the data storage area in the cluster specified by the write command having been issued by the CPU 10, where data are already stored.
In this variation, the read functional unit 10a reads image data again from the memory 17 (step S706). The procuring functional unit 10b re-procures four clusters, i.e., one extra cluster in addition to the three clusters making up the write unit, selected from clusters succeeding the error cluster in the FAT (step S707) and then the CPU 10 executes the processing in steps S703 and S704.
In the event of a write error occurring while image data are being written into the memory card 30, the image data write can be resumed by re-procuring clusters selected from clusters succeeding the error cluster in the variation. Thus, as long as the write error does not occur at the last cluster in each set of three clusters making up the write unit, the number of wasted clusters can be reduced over the third variation.
It is to be noted that while the storage control device according to the present invention having been described in reference to the first and second embodiments and the first through fourth variations is included in a camera, the present invention may instead be adopted in an information device such as a portable telephone, a PDA unit or a PC, at which at least either a write-once-type storage medium or a non-write-once type storage medium can be loaded.
In addition, while an explanation is given above in reference to the embodiments and the variations on an example in which the file data recorded into the memory card are still image data compressed in the JPEG format, the file data recorded in the memory card may be image data in the TIFF format, raw image data, video image data or audio data.
The above described embodiments are examples and various modifications can be made without departing from the scope of the invention.
Number | Date | Country | Kind |
---|---|---|---|
2008-165937 | Jun 2008 | JP | national |
2008-180916 | Jul 2008 | JP | national |