JP2011034125A - Information processing method, information processor, and program - Google Patents

Information processing method, information processor, and program Download PDF

Info

Publication number
JP2011034125A
JP2011034125A JP2009176667A JP2009176667A JP2011034125A JP 2011034125 A JP2011034125 A JP 2011034125A JP 2009176667 A JP2009176667 A JP 2009176667A JP 2009176667 A JP2009176667 A JP 2009176667A JP 2011034125 A JP2011034125 A JP 2011034125A
Authority
JP
Japan
Prior art keywords
data
area
block
block number
stored
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.)
Granted
Application number
JP2009176667A
Other languages
Japanese (ja)
Other versions
JP2011034125A5 (en
JP5633125B2 (en
Inventor
Hideo Yamamoto
英雄 山本
Tetsuo Akaida
徹郎 赤井田
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.)
Sony Corp
Original Assignee
Sony Corp
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 Sony Corp filed Critical Sony Corp
Priority to JP2009176667A priority Critical patent/JP5633125B2/en
Publication of JP2011034125A publication Critical patent/JP2011034125A/en
Publication of JP2011034125A5 publication Critical patent/JP2011034125A5/ja
Application granted granted Critical
Publication of JP5633125B2 publication Critical patent/JP5633125B2/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Techniques For Improving Reliability Of Storages (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To reduce the time required for writing data, while handling memory corruption. <P>SOLUTION: A physical block number of all updating blocks in a data area is referred to be recognized as updating blocks in the data area, in step S34. All the updating blocks recognized as the updating blocks in the data area are erased all together in step S35. Processing time is shortened as compared with the case where the data is erased every time the data are written in the physical block. The present invention is applicable when writing the data into a recording medium, such as an EEPROM, where the data recorded in a recording area cannot be overwritten, and the new data are recorded after erasing the data already recorded. <P>COPYRIGHT: (C)2011,JPO&INPIT

Description

本発明は、情報処理方法、情報処理装置、およびプログラムに関し、特に、例えば、EEPROM(electrically erasable programmable ROM)のように、記録領域に既に記録されているデータに上書きすることができず、既に記録されているデータを消去してから新たなデータを記録しなければならない記録媒体に対してデータ記録する場合に用いて好適な情報処理方法、情報処理装置、およびプログラムに関する。   The present invention relates to an information processing method, an information processing apparatus, and a program, and in particular, data that has already been recorded in a recording area, such as EEPROM (electrically erasable programmable ROM), cannot be overwritten and has already been recorded. The present invention relates to an information processing method, an information processing apparatus, and a program suitable for recording data on a recording medium on which new data must be recorded after erasing the recorded data.

現在、FeliCa(商標)に代表される非接触通信システムが広く実用化されている。   Currently, contactless communication systems represented by FeliCa (trademark) are widely put into practical use.

既存の非接触通信システムにおいては、リーダ/ライタ(以下、R/Wと略記する)が、コントローラからの制御に従って、ICカードとデータを非接触で通信する。   In an existing contactless communication system, a reader / writer (hereinafter abbreviated as R / W) communicates data with an IC card in a contactless manner according to control from a controller.

このICカードは、記録媒体を内蔵しており、例えば、非接触通信システムが電子マネーシステムに利用される場合においては、プリペイドマネーの残高や購買履歴などの情報が記録され、駅改札システムに利用される場合においては、定期券情報や乗降履歴情報が記録される。   This IC card has a built-in recording medium. For example, when a non-contact communication system is used in an electronic money system, information such as a prepaid money balance and purchase history is recorded and used in a station ticket gate system. In such a case, commuter pass information and boarding / exiting history information are recorded.

ICカードに内蔵される記録媒体としては、不揮発性メモリのEEPROMが適用されることが多い。EEPROMは、その特性として、データを書き込む場合、記録領域に既に記録されているデータに上書きすることができず、既に記録されているデータを消去してから新たなデータを記録しなければならない。   As a recording medium built in the IC card, an EEPROM of a nonvolatile memory is often applied. As a characteristic of the EEPROM, when data is written, the data already recorded in the recording area cannot be overwritten, and new data must be recorded after erasing the already recorded data.

ところで、ICカードには、自らはバッテリを有していないバッテリレス型のICカードがあり、このようなバッテリレス型のICカードは、R/Wから放射される電磁波を利用した電磁誘導により駆動電力を取得できるようになされている。   By the way, there is a battery-less IC card that does not have a battery by itself, and such a battery-less IC card is driven by electromagnetic induction using electromagnetic waves radiated from the R / W. It has been made to be able to get power.

しかしながら、ICカードとR/Wとの間でデータを非接触で通信する場合、ICカードが内蔵するメモリにアクセスしている途中で、電磁波の受信状態が不良になると十分な駆動電力を取得することができなくなり、メモリにおけるデータの整合性に欠陥が生じてしまうことが発生し得る。以下、メモリにおけるデータの整合性に欠陥が生じた状態を、メモリコラプション(Memory Corruption)と称する。   However, when data is communicated between the IC card and the R / W in a non-contact manner, sufficient drive power is acquired if the electromagnetic wave reception state becomes poor while accessing the memory built in the IC card. And the data consistency in the memory may be defective. Hereinafter, a state in which a defect occurs in data consistency in the memory is referred to as a memory corruption.

また、非接触通信に限らず、ICカードとR/Wとを接触させてデータの送受信を行う場合においても、ユーザが、ICカードを、R/Wに対して自由に抜き差しすることができるときには、メモリにアクセスしている途中で、ICカードがR/Wから抜かれると、やはり、メモリコラプションが生じてしまうことが起こり得た。   In addition to non-contact communication, when the user can freely insert / remove the IC card into / from the R / W even when the IC card is in contact with the R / W to transmit / receive data. If the IC card is removed from the R / W while accessing the memory, memory corruption may occur.

そこで従来から、メモリコラプションに対する様々な対処方法が提案されている。   Thus, various countermeasures for memory corruption have been proposed.

例えば、本出願人は、ICカードに、前回の通信結果のデータと前々回の通信結果のデータを記録しておき、古い方のデータ(前々回のデータ)を、今回の通信結果のデータで更新するようにし、更新の処理を良好に行うことができなかった場合(古いデータが破壊されてしまった場合)でも、前回の有効なデータが残るようにした方法を提案している(特許文献1参照)。   For example, the applicant records the previous communication result data and the previous communication result data in the IC card, and updates the older data (previous data) with the current communication result data. Thus, even when the update process cannot be performed satisfactorily (when old data is destroyed), a method is proposed in which the previous valid data remains (see Patent Document 1). ).

特開平11−25003号公報Japanese Patent Laid-Open No. 11-25003

特許文献1の方法によれば、古い方のデータを更新中に例えば電源が遮断されたとしても、少なくとも前々回のデータまたは前回のデータの一方を安定して読み出すことができる。   According to the method of Patent Document 1, even if the power is shut off while updating the older data, at least one of the previous data or the previous data can be stably read.

しかしながら、特許文献1の方法には、データの書込み処理において、その所要時間をより短縮できる余地が残されていた。   However, the method of Patent Document 1 leaves room for further reduction in the time required for data write processing.

本発明は、このような状況に鑑みてなされたものであり、データを書き込む場合、記録領域に既に記録されているデータに上書きすることができず、既に記録されているデータを消去してから新たなデータを記録しなければならないEEPROMなどの記録媒体に対し、データの書込み処理に要する時間を短縮できるようにするものである。   The present invention has been made in view of such a situation, and when data is written, the data already recorded in the recording area cannot be overwritten, and the already recorded data is erased. It is intended to reduce the time required for data writing processing on a recording medium such as EEPROM in which new data must be recorded.

本発明の一側面である情報処理方法は、所定のブロック単位で情報が記録される記録媒体を用いた情報処理装置の情報処理方法において、前記記録媒体は、複数のブロックから構成され、前記ブロック単位でデータを記憶するデータ領域と、前記データ領域の各ブロックに割当てられた複数のブロック番号を記憶するポインタ領域と、更新前のデータが記憶されている前記データ領域の対象ブロックを指示する前記ポインタ領域のブロック番号を示す第1のブロック番号、更新後のデータが記憶される前記データ領域の更新ブロックを指示する前記ポインタ領域のブロック番号を示す第2のブロック番号、並びに記憶内容の新しさに関する最新情報とを記憶する第1の領域とを有し、前記情報処理装置による、前記第1の領域に記憶されている前記第2のブロック番号に対応する前記ポインタ領域が記憶するブロック番号に対応する前記データ領域の全ての前記更新ブロックに記憶されているデータを一括して消去させる第1の消去ステップと、一括して消去された、前記第2のブロック番号に対応する前記ポインタ領域が記憶するブロック番号に対応する前記データ領域の全ての前記更新ブロックの少なくとも一部に更新後のデータを書込ませる書込みステップと、前記更新後のデータが書き込まれたデータ領域のブロックのブロック番号を、前記ポインタ領域の前記第1のブロック番号に対応するブロックに記憶させる第1の記憶ステップと、データ領域のブロック番号を記憶させたポインタ領域の第1のブロック番号を、前記第1の領域に記憶させる第2の記憶ステップとを含む。   An information processing method according to one aspect of the present invention is an information processing method for an information processing apparatus using a recording medium on which information is recorded in units of predetermined blocks. The recording medium includes a plurality of blocks. A data area for storing data in units, a pointer area for storing a plurality of block numbers assigned to each block of the data area, and a target block of the data area for storing data before update The first block number indicating the block number of the pointer area, the second block number indicating the block number of the pointer area indicating the update block of the data area in which the updated data is stored, and the newness of the stored contents And a first area for storing the latest information on the information stored in the first area by the information processing apparatus. A first erasing step for collectively erasing data stored in all the update blocks in the data area corresponding to the block number stored in the pointer area corresponding to the second block number; A write step of writing updated data into at least a part of all the update blocks in the data area corresponding to the block number stored in the pointer area corresponding to the second block number, A first storage step of storing the block number of the block of the data area in which the updated data is written in a block corresponding to the first block number of the pointer area; and storing the block number of the data area A second storage step of storing the first block number of the pointer area in the first area; No.

前記記録媒体は、さらに、更新前のデータが記憶されている前記データ領域の対象ブロックを指示する前記ポインタ領域のブロック番号を示す第1のブロック番号、更新後のデータが記憶される前記データ領域の更新ブロックを指示する前記ポインタ領域のブロック番号を示す第2のブロック番号、並びに記憶内容の新しさに関する最新情報とを記憶する第2の領域を有し、前記情報処理装置による、前記第1の消去ステップは、前記最新情報に基づいて選択された前記第1または第2の領域の一方に記憶されている前記第2のブロック番号に対応する前記ポインタ領域が記憶するブロック番号に対応する前記データ領域の全ての前記更新ブロックに記憶されているデータを一括して消去させ、前記第2の記憶ステップは、データ領域のブロック番号を記憶させたポインタ領域の第1のブロック番号を、前記第1または第2の領域の他方に記憶させるようにすることができる。情報処理方法は、前記第2の記憶ステップの後、前記第1または第2の領域の前記一方に記憶されている前記第1および第2のブロック番号、並びに前記最新情報を消去させる第2の消去ステップをさらに含むことができる。   The recording medium further includes a first block number indicating a block number of the pointer area indicating the target block of the data area in which data before update is stored, and the data area in which data after update is stored A second block number indicating the block number of the pointer area indicating the updated block, and a second area for storing the latest information on the freshness of the stored contents. In the erasing step, the block area corresponding to the block number stored in the pointer area corresponding to the second block number stored in one of the first or second area selected based on the latest information The data stored in all the update blocks in the data area is erased at once, and the second storage step is a block of the data area. A first block number of the pointer region in which to store the metric number, can be made to be stored in the other of said first or second regions. In the information processing method, after the second storing step, the first and second block numbers stored in the one of the first and second areas and the latest information are deleted. An erasing step can further be included.

前記第1の消去ステップの処理、および前記書込みステップの処理は、書込みコマンドに応じて実行されるようにすることができる。   The processing of the first erasing step and the processing of the writing step can be executed in response to a write command.

前記書込みステップの処理は、書込みコマンドに応じて実行され、前記第1の消去ステップの処理は、前記書込みコマンドの有無に拘わらず、前記書込みステップの処理に先行した所定タイミングで実行されるようにすることができる。   The processing of the writing step is executed according to a writing command, and the processing of the first erasing step is executed at a predetermined timing preceding the processing of the writing step regardless of the presence or absence of the writing command. can do.

本発明の一側面である情報処理装置は、所定のブロック単位で情報が記録される記録媒体に対して情報を記録する情報処理装置において、前記記録媒体は、複数のブロックから構成され、前記ブロック単位でデータを記憶するデータ領域と、前記データ領域の各ブロックに割当てられた複数のブロック番号を記憶するポインタ領域と、更新前のデータが記憶されている前記データ領域の対象ブロックを指示する前記ポインタ領域のブロック番号を示す第1のブロック番号、更新後のデータが記憶される前記データ領域の更新ブロックを指示する前記ポインタ領域のブロック番号を示す第2のブロック番号、並びに記憶内容の新しさに関する最新情報とを記憶する第1の領域とを有し、前記第1の領域に記憶されている前記第2のブロック番号に対応する前記ポインタ領域が記憶するブロック番号に対応する前記データ領域の全ての前記更新ブロックに記憶されているデータを一括して消去させる第1の消去手段と、一括して消去された、前記第2のブロック番号に対応する前記ポインタ領域が記憶するブロック番号に対応する前記データ領域の全ての前記更新ブロックの少なくとも一部に更新後のデータを書込ませる書込み手段と、前記更新後のデータが書き込まれたデータ領域のブロックのブロック番号を、前記ポインタ領域の前記第1のブロック番号に対応するブロックに記憶させる第1の記憶手段と、データ領域のブロック番号を記憶させたポインタ領域の第1のブロック番号を、前記第1の領域に記憶させる第2の記憶手段とを含む。   An information processing apparatus according to an aspect of the present invention is an information processing apparatus that records information on a recording medium on which information is recorded in a predetermined block unit. The recording medium includes a plurality of blocks, and the block A data area for storing data in units, a pointer area for storing a plurality of block numbers assigned to each block of the data area, and a target block of the data area for storing data before update The first block number indicating the block number of the pointer area, the second block number indicating the block number of the pointer area indicating the update block of the data area in which the updated data is stored, and the newness of the stored contents And the second block number stored in the first area. First erasure means for collectively erasing data stored in all the update blocks of the data area corresponding to a block number stored in the corresponding pointer area; Write means for writing the updated data in at least a part of all the update blocks in the data area corresponding to the block number stored in the pointer area corresponding to the block number of 2, and the updated data First storage means for storing the block number of the block of the written data area in the block corresponding to the first block number of the pointer area, and the first of the pointer area storing the block number of the data area Second storage means for storing the block number in the first area.

本発明のプログラムは、所定のブロック単位で情報が記録される記録媒体を用いた情報処理装置の制御用のプログラムであって、前記記録媒体は、複数のブロックから構成され、前記ブロック単位でデータを記憶するデータ領域と、前記データ領域の各ブロックに割当てられた複数のブロック番号を記憶するポインタ領域と、更新前のデータが記憶されている前記データ領域の対象ブロックを指示する前記ポインタ領域のブロック番号を示す第1のブロック番号、更新後のデータが記憶される前記データ領域の更新ブロックを指示する前記ポインタ領域のブロック番号を示す第2のブロック番号、並びに記憶内容の新しさに関する最新情報とを記憶する第1の領域とを有し、前記第1の領域に記憶されている前記第2のブロック番号に対応する前記ポインタ領域が記憶するブロック番号に対応する前記データ領域の全ての前記更新ブロックに記憶されているデータを一括して消去させる第1の消去ステップと、一括して消去された、前記第2のブロック番号に対応する前記ポインタ領域が記憶するブロック番号に対応する前記データ領域の全ての前記更新ブロックの少なくとも一部に更新後のデータを書込ませる書込みステップと、前記更新後のデータが書き込まれたデータ領域のブロックのブロック番号を、前記ポインタ領域の前記第1のブロック番号に対応するブロックに記憶させる第1の記憶ステップと、データ領域のブロック番号を記憶させたポインタ領域の第1のブロック番号を、前記第1の領域に記憶させる第2の記憶ステップとを含む処理を情報処理装置のコンピュータに実行させる。   The program of the present invention is a program for controlling an information processing apparatus using a recording medium in which information is recorded in predetermined block units, and the recording medium is composed of a plurality of blocks, and data in the block units. A data area for storing data, a pointer area for storing a plurality of block numbers assigned to each block of the data area, and a pointer area for indicating a target block of the data area for storing data before update The first block number indicating the block number, the second block number indicating the block number of the pointer area indicating the update block of the data area in which the updated data is stored, and the latest information on the newness of the stored contents Corresponding to the second block number stored in the first area. A first erasure step for erasing data stored in all the update blocks in the data area corresponding to a block number stored in the pointer area, and the second erasure A write step for writing the updated data in at least a part of all the update blocks in the data area corresponding to the block number stored in the pointer area corresponding to the block number; and the updated data is written A first storage step for storing the block number of the block in the data area in a block corresponding to the first block number in the pointer area, and a first block in the pointer area in which the block number of the data area is stored A process including a second storage step of storing a number in the first area. To be executed by the data.

本発明の一側面においては、前記第1の領域に記憶されている前記第2のブロック番号に対応する前記ポインタ領域が記憶するブロック番号に対応する前記データ領域の全ての前記更新ブロックに記憶されているデータが一括して消去され、一括して消去された、前記第2のブロック番号に対応する前記ポインタ領域が記憶するブロック番号に対応する前記データ領域の全ての前記更新ブロックの少なくとも一部に更新後のデータが書込まれ、前記更新後のデータが書き込まれたデータ領域のブロックのブロック番号が、前記ポインタ領域の前記第1のブロック番号に対応するブロックに記憶され、データ領域のブロック番号を記憶させたポインタ領域の第1のブロック番号が、前記第1の領域に記憶される。   In one aspect of the present invention, the data is stored in all the update blocks in the data area corresponding to the block number stored in the pointer area corresponding to the second block number stored in the first area. At least a part of all the update blocks in the data area corresponding to the block number stored in the pointer area corresponding to the second block number, the data being erased all at once The updated data is written in, and the block number of the block of the data area in which the updated data is written is stored in the block corresponding to the first block number of the pointer area, and the block of the data area The first block number of the pointer area in which the number is stored is stored in the first area.

本発明の一側面によれば、メモリコラプションに対処することができる。   According to one aspect of the present invention, memory corruption can be addressed.

また、本発明の一側面によれば、メモリコラプションに対処しつつ、データの書込み処理に要する時間を短縮することが可能となる。   In addition, according to one aspect of the present invention, it is possible to reduce the time required for data write processing while coping with memory corruption.

本発明を適用した非接触通信システムの構成例を示すブロック図である。It is a block diagram which shows the structural example of the non-contact communication system to which this invention is applied. 図1のリーダ/ライタの構成例を示すブロック図である。FIG. 2 is a block diagram illustrating a configuration example of a reader / writer in FIG. 1. 図1のICカードの構成例を示すブロック図である。It is a block diagram which shows the structural example of the IC card of FIG. メモリコラプションに対する対処方法の基本原理を説明する図である。It is a figure explaining the basic principle of the coping method with respect to memory corruption. シングルポインタ方式を説明する図である。It is a figure explaining a single pointer system. シングルポインタ方式を説明する図である。It is a figure explaining a single pointer system. ダブルポインタ方式を説明する図である。It is a figure explaining a double pointer system. ダブルポインタ方式を説明する図である。It is a figure explaining a double pointer system. ダブルポインタ方式に対応する読み出し処理を説明するフローチャートである。It is a flowchart explaining the read-out process corresponding to a double pointer system. ダブルポインタ方式に対応する書込み処理を説明するフローチャートである。It is a flowchart explaining the write-in process corresponding to a double pointer system.

以下、発明を実施するための最良の形態(以下、実施の形態と称する)について、図面を参照しながら詳細に説明する。   Hereinafter, the best mode for carrying out the invention (hereinafter referred to as an embodiment) will be described in detail with reference to the drawings.

<1.実施の形態>
[非接触通信システムの構成例]
図1は、本発明の実施の形態であるICカードを含む非接触通信システムの構成例を示している。
<1. Embodiment>
[Configuration example of non-contact communication system]
FIG. 1 shows a configuration example of a contactless communication system including an IC card according to an embodiment of the present invention.

この非接触通信システム10は、コントローラ11、R/W(リーダ/ライタ)12、およびICカード13から構成される。R/W12は、コントローラ11からの制御に従い、ICカード13との間で、電磁波を利用した非接触通信を行う。   The non-contact communication system 10 includes a controller 11, an R / W (reader / writer) 12, and an IC card 13. The R / W 12 performs non-contact communication using an electromagnetic wave with the IC card 13 according to control from the controller 11.

すなわち、コントローラ11がR/W12に対してICカード13との通信を指示するコマンドを送信すると、R/W12が、所定のコマンドをICカード13に送信する。当該所定のコマンドを受信したICカード13は、そのコマンドに対応する処理を行い、処理結果を示す応答データをR/W12に送信するようになされている。   That is, when the controller 11 transmits a command for instructing the R / W 12 to communicate with the IC card 13, the R / W 12 transmits a predetermined command to the IC card 13. The IC card 13 that has received the predetermined command performs processing corresponding to the command, and transmits response data indicating the processing result to the R / W 12.

[R/W12の構成例]
図2は、図1のR/W12の構成例を示している。
[Configuration example of R / W12]
FIG. 2 shows a configuration example of the R / W 12 of FIG.

R/W12は、IC21、フラッシュメモリ22、変調部23、発振部24、復調部25、およびアンテナ26から構成される。   The R / W 12 includes an IC 21, a flash memory 22, a modulation unit 23, an oscillation unit 24, a demodulation unit 25, and an antenna 26.

IC21は、DPU(Data Processing Unit)31、SPU(Signal Processing Unit)32、SCC33、およびメモリ部34がバス35を介して相互に接続されて構成される。   The IC 21 is configured by connecting a DPU (Data Processing Unit) 31, an SPU (Signal Processing Unit) 32, an SCC 33, and a memory unit 34 to each other via a bus 35.

また、バス35には、所定のデータを記憶するフラッシュメモリ22も接続されている。   In addition, a flash memory 22 for storing predetermined data is also connected to the bus 35.

DPU31は、ICカード13に送信するコマンドをSPU32に出力するとともに、ICカード13から受信した応答データをSPU32から取得する。   The DPU 31 outputs a command to be transmitted to the IC card 13 to the SPU 32 and acquires response data received from the IC card 13 from the SPU 32.

SPU32は、ICカード13に送信するコマンドに対して所定の変調符号化処理(例えば、BPSK(Binary Phase Shift Keying)変調符号化処理など)を行った後、変調部23に出力するとともに、ICカード13により送信されてきた応答データを復調部25から取得し、そのデータに対して変調復号処理(BPSK変調の復号処理など)を行う。   The SPU 32 performs a predetermined modulation and coding process (for example, BPSK (Binary Phase Shift Keying) modulation and coding process) on the command transmitted to the IC card 13, and then outputs the command to the modulation unit 23 and the IC card. 13 is obtained from the demodulator 25, and a modulation decoding process (such as a BPSK modulation decoding process) is performed on the data.

変調部23は、発振部24より供給された所定の周波数(例えば13.56MHz)の搬送波を、SPU32より供給されたデータで、ASK(Amplitude Shift Keying)変調し、生成された変調波を、アンテナ27を介して、電磁波としてICカード13に出力する。このとき、変調部23は、変調度を1未満にして、ASK変調を行う。すなわち、データがローレベルのときにおいても、変調波の最大振幅がゼロにならないようにする。   The modulation unit 23 performs ASK (Amplitude Shift Keying) modulation on a carrier wave having a predetermined frequency (for example, 13.56 MHz) supplied from the oscillation unit 24 with data supplied from the SPU 32, and the generated modulated wave is transmitted to the antenna. 27 is output as an electromagnetic wave to the IC card 13 via 27. At this time, the modulation unit 23 performs ASK modulation with a modulation degree of less than 1. That is, the maximum amplitude of the modulated wave is prevented from becoming zero even when the data is at a low level.

復調部25は、アンテナ27を介して受信した変調波(ASK変調波)を復調し、復調されたデータをSPU32に出力する。   The demodulator 25 demodulates the modulated wave (ASK modulated wave) received via the antenna 27 and outputs the demodulated data to the SPU 32.

[ICカード13の構成例]
図3は、図1のICカード13の構成例を示している。
[Configuration Example of IC Card 13]
FIG. 3 shows a configuration example of the IC card 13 of FIG.

ICカード13は、IC51、コンデンサ52、およびアンテナ53から構成される。   The IC card 13 includes an IC 51, a capacitor 52, and an antenna 53.

IC51は、R/W12により送信された変調波を、アンテナ53を介して受信する。コンデンサ52は、アンテナ53とともにLC回路を構成し、所定の周波数(キャリア周波数)の電磁波に同調(共振)するようになされている。   The IC 51 receives the modulated wave transmitted by the R / W 12 via the antenna 53. The capacitor 52 forms an LC circuit together with the antenna 53, and is tuned (resonated) with an electromagnetic wave having a predetermined frequency (carrier frequency).

IC51は、RFインタフェース部61、BPSK復調部、PLL(Phase Locked Loop)部63、演算部64、ROM65、EEPROM(Electrically Erasable and Programmable ROM)66、RAM67、およびBPSK変調部68から構成される。   The IC 51 includes an RF interface unit 61, a BPSK demodulation unit, a PLL (Phase Locked Loop) unit 63, a calculation unit 64, a ROM 65, an EEPROM (Electrically Erasable and Programmable ROM) 66, a RAM 67, and a BPSK modulation unit 68.

RFインタフェース部61は、さらに、ASK復調部81、電圧レギュレータ82、発振部83、およびASK変調部84に細分化されている。   The RF interface unit 61 is further subdivided into an ASK demodulation unit 81, a voltage regulator 82, an oscillation unit 83, and an ASK modulation unit 84.

RFインタフェース部61は、ASK復調部81がアンテナ53を介して受信した変調波(ASK変調波)を検波して復調し、復調後のデータをBPSK復調部62およびPLL部63に出力する。また、RFインタフェース部62は、電圧レギュレータ82によってASK復調部81が検波した信号を安定化し、その結果得られる直流電力をIC51の各部に駆動電力として供給する。さらに、RFインタフェース部61は、発振部83でデータのクロック周波数と同一の周波数の信号を発振し、その信号をPLL部63に出力する。   The RF interface unit 61 detects and demodulates the modulated wave (ASK modulated wave) received by the ASK demodulator 81 via the antenna 53, and outputs the demodulated data to the BPSK demodulator 62 and the PLL unit 63. Further, the RF interface unit 62 stabilizes the signal detected by the ASK demodulating unit 81 by the voltage regulator 82 and supplies the DC power obtained as a result to each unit of the IC 51 as driving power. Further, the RF interface unit 61 oscillates a signal having the same frequency as the data clock frequency in the oscillation unit 83 and outputs the signal to the PLL unit 63.

そして、RFインタフェース部61のASK変調部84は、演算部64より供給されたデータに対応して、ICカード13の電源としてのアンテナ53の負荷を変動させる(例えば、データに対応して所定のスイッチング素子をオン/オフさせ、スイッチング素子がオン状態であるときだけ所定の負荷をアンテナ53に並列に接続させる)ことにより、アンテナ53を介して受信している変調波をASK変調し、アンテナ53を介してR/W12に送信する。   Then, the ASK modulation unit 84 of the RF interface unit 61 varies the load of the antenna 53 as the power source of the IC card 13 corresponding to the data supplied from the calculation unit 64 (for example, a predetermined value corresponding to the data) The switching element is turned on / off, and a predetermined load is connected in parallel to the antenna 53 only when the switching element is in an on state), whereby the modulated wave received via the antenna 53 is ASK modulated, and the antenna 53 Is transmitted to the R / W 12 via.

PLL部63は、ASK復調部81より供給されたデータより、そのデータに同期したクロック信号を生成し、そのクロック信号をBPSK復調部62およびBPSK変調部68に出力する。BPSK復調部62は、ASK復調部81で復調されたデータがBPSK変調されている場合、PLL部63より供給されたクロック信号に従って、そのデータの復調(マンチェスタコードのデコード)を行い、復調したデータを演算部64に出力する。   The PLL unit 63 generates a clock signal synchronized with the data from the data supplied from the ASK demodulation unit 81, and outputs the clock signal to the BPSK demodulation unit 62 and the BPSK modulation unit 68. When the data demodulated by the ASK demodulator 81 is BPSK modulated, the BPSK demodulator 62 demodulates the data (decodes Manchester code) in accordance with the clock signal supplied from the PLL unit 63 and demodulates the data. Is output to the calculation unit 64.

演算部64は、シーケンス部91、暗号/復号部92、およびパリティ演算部93から成り、BPSK復調部62より供給されたデータが暗号化されている場合、そのデータを暗号/復号部92で復号化した後、その復号結果のデータをシーケンサ91で処理する。BPSK復調部62より供給されたデータが暗号化されていない場合、BPSK復調部62より供給されたデータは、暗号/復号部92を介さず、シーケンサ91に直接供給される。   The calculation unit 64 includes a sequence unit 91, an encryption / decryption unit 92, and a parity calculation unit 93. When the data supplied from the BPSK demodulation unit 62 is encrypted, the data is decrypted by the encryption / decryption unit 92. Then, the sequencer 91 processes the data of the decoding result. When the data supplied from the BPSK demodulator 62 is not encrypted, the data supplied from the BPSK demodulator 62 is directly supplied to the sequencer 91 without going through the encryption / decryption unit 92.

シーケンサ91は、そこに供給されるコマンドとしてのデータに対応する処理を行う。すなわち、例えば、シーケンサ91は、EEPROM66に対するデータの書込みや読み出しなどの処理を行う。さらに、シーケンサ91は、コマンドとしてのデータに対応する処理を行った後、その処理に対応する応答データ(R/W12に送信するデータ)を生成してBPSK変調部68に出力する。   The sequencer 91 performs processing corresponding to data as a command supplied thereto. That is, for example, the sequencer 91 performs processing such as data writing to and reading from the EEPROM 66. Furthermore, the sequencer 91 performs a process corresponding to the data as the command, generates response data (data to be transmitted to the R / W 12) corresponding to the process, and outputs the response data to the BPSK modulator 68.

パリティ演算部93は、EEPROM66に記憶されるデータや、EEPROM66に記憶されているデータから、パリティとして、リードソロモン符号を算出する。   The parity calculation unit 93 calculates a Reed-Solomon code as parity from the data stored in the EEPROM 66 or the data stored in the EEPROM 66.

BPSK変調部68は、演算部64より供給されたデータをBPSK変調し、変調後のデータをRFインタフェース部61のASK変調部84に出力する。   The BPSK modulation unit 68 BPSK modulates the data supplied from the calculation unit 64 and outputs the modulated data to the ASK modulation unit 84 of the RF interface unit 61.

ROM65は、シーケンサ91が行うべき処理プログラムその他の必要なデータを記憶している。RAM67は、シーケンサ91が処理を行うとき、処理の途中のデータなどを、一時的に記憶する。EEPROM66は、不揮発性のメモリであり、ICカード13がR/W12との通信を終了し、電力供給が停止した後も、記憶しているデータを消失することなく保持するようになされている。   The ROM 65 stores a processing program to be executed by the sequencer 91 and other necessary data. The RAM 67 temporarily stores data in the middle of processing when the sequencer 91 performs processing. The EEPROM 66 is a non-volatile memory, and retains stored data without loss even after the IC card 13 ends communication with the R / W 12 and power supply is stopped.

[メモリコラプションに対する対処方法]
次に、ICカード13のシーケンサ91による、EEPROM66に対するデータの読み書き処理について説明するが、その前に、その前段階の準備として、メモリに記憶されている情報が破壊されてしまうことを意味するメモリコラプション(Memory Corruption)に対する対処方法について説明する。
[Corrective action against memory corruption]
Next, a data read / write process with respect to the EEPROM 66 by the sequencer 91 of the IC card 13 will be described. Before that, as a preparation for the previous stage, a memory that means that information stored in the memory is destroyed. Explain how to deal with corruption (Memory Corruption).

まず、メモリコラプションに対する対処方法の基本原理について説明する。   First, the basic principle of a method for dealing with memory corruption will be described.

例えば、メモリ(EEPROM66に相当)に対して、情報の読み書きが所定のブロック単位で行われるとし、あるブロックB1に記憶されたデータを更新する(ブロックB1に記憶されているデータを、他のデータに書き換える)ことを考える。   For example, assuming that reading and writing of information is performed on a memory (corresponding to EEPROM 66) in a predetermined block unit, data stored in a certain block B1 is updated (the data stored in the block B1 is changed to other data). To rewrite).

この場合、ブロックB1自体に、新たなデータを書き込むと、ブロックB1に既に記憶されているデータに上書きすることになり、この書込みの最中に、ICカードへの電力の供給が不足したりした場合、新たなデータは完全には書き込まれないことになす。さらに、ブロックB1に記憶されていたデータは破壊されることになり、メモリコラプションが生じてしまう。   In this case, if new data is written in the block B1 itself, the data already stored in the block B1 is overwritten, and power supply to the IC card is insufficient during the writing. If so, the new data will not be completely written. Furthermore, the data stored in the block B1 is destroyed, resulting in memory corruption.

このような事態の発生を防止するためには、ブロックB1に書き込むべき新たなデータを、そのブロックB1とは異なるブロックB2に書き込むようにすればよい。これにより、ブロックB2への書込みの最中にメモリコラプションが生じた場合には、新たなデータの書込みは完全に行われず、その有効性は保証されないものの、少なくとも、ブロックB1に記憶されていたデータの破壊は防止することができる。そして、ブロックB2への書込みが終了した後、ブロックB1に記憶されているデータを消去する。   In order to prevent such a situation from occurring, new data to be written to the block B1 may be written to a block B2 different from the block B1. As a result, when a memory corruption occurs during writing to the block B2, new data is not completely written and the validity is not guaranteed, but at least the data stored in the block B1. Can be prevented. Then, after the writing to the block B2 is completed, the data stored in the block B1 is erased.

なお、さらに新たなデータが供給されたときには、そのデータは、ブロックB2とは異なるブロックである、例えばブロックB1に書き込まれる。このように、新たなデータが供給された場合には、前回書き込まれたデータが記憶されているブロック以外のブロックに、その新たなデータを書き込むようにする。これにより、少なくとも、新たなデータの書込みによって、前回書き込まれたデータが破壊されないようにし、これにより、ICカードが最悪の場合でも、使用不可にならないようにする。   When new data is supplied, the data is written in a block different from the block B2, for example, the block B1. As described above, when new data is supplied, the new data is written in a block other than the block in which the previously written data is stored. Accordingly, at least the previously written data is prevented from being destroyed by writing new data, so that the IC card is not disabled even in the worst case.

次に、図4を参照して、以上のような基本原理を適用したメモリの読み書き方法について説明する。   Next, a memory read / write method to which the above basic principle is applied will be described with reference to FIG.

図4においては説明の便宜上、1ブロックが、1バイト(8ビット)の最新性情報、8バイトのデータ、および2バイトの有効性情報が、その先頭から順次配置された11バイトで構成されているものとする。ただし、1ブロックのビット数、さらには、最新性情報、データ、および有効性情報に割り当てるビット数は、上述したものに特に限定されるものではない。   In FIG. 4, for convenience of explanation, one block is composed of 1 byte (8 bits) up-to-date information, 8 bytes of data, and 2 bytes of validity information sequentially arranged from the head of 11 bytes. It shall be. However, the number of bits in one block, and further, the number of bits allocated to the freshness information, data, and validity information are not particularly limited to those described above.

最新性情報は、そのブロックの記憶内容の新しさを示すもので、例えば、絶対的な日付および時刻や、シーケンシャルな番号その他を用いることができる。すなわち、絶対的な日付および時刻を用いる場合には、データが記憶された日付および時刻を最新性情報として記憶するようにすれば、その最新性情報により、データの記憶がなされた最新のブロックを検出することができる。   The up-to-date information indicates the newness of the stored contents of the block. For example, an absolute date and time, a sequential number, or the like can be used. That is, when using an absolute date and time, if the date and time at which the data is stored is stored as the latest information, the latest block in which the data is stored is determined based on the newness information. Can be detected.

また、シーケンシャルな番号を用いる場合には、データの書込みが行われるたびに、例えばインクリメントされる番号を最新性情報として記憶するようにすれば、その値の最も大きいブロックが、データの書込みがなされた最新のものということになる。   Also, when sequential numbers are used, each time data is written, for example, if the incremented number is stored as the freshness information, the block with the largest value is written with data. It will be the latest.

なお、ここでは、少なくとも2つのブロックのうちのいずれが新しいかを認識できれば充分であり、従って、最新性情報は、少なくとも3つの状態を表すことができればよい。すなわち、例えば、いま、3つの状態を表すことのできる最新性情報として、0,1,2の3値を用いることにすると、2つのブロックのうちのいずれかに書込みが行われる毎に、0,1,2,0,・・・を、その書込みが行われたブロックの最新性情報として書き込むようにすればよい。   Here, it is sufficient if it is possible to recognize which of at least two blocks is new. Therefore, it is sufficient that the up-to-date information can represent at least three states. That is, for example, if the three values 0, 1, and 2 are used as the up-to-date information that can represent the three states, 0 is written each time one of the two blocks is written. , 1, 2, 0,... May be written as the freshness information of the block in which the writing has been performed.

この場合、2つのブロックの最新性情報が0と1ならば1のブロックの方が新しく、1と2ならば2のブロックの方が新しく、2と0ならば0のブロックの方が新しいということになる。このように、最新性情報として、0,1,2の3値を用いる場合には、そのビット数は2ビットで済む。その他、例えば、最新性情報としては、1ビットのフラグを3個用い、ブロックの書込みが行われる毎に、ビットをたてるフラグを順次変化させるようにしてもよい。   In this case, if the up-to-date information of the two blocks is 0 and 1, the block of 1 is newer. If it is 1 and 2, the block of 2 is newer. If it is 2 and 0, the block of 0 is newer. It will be. As described above, when the three values 0, 1, and 2 are used as the up-to-date information, the number of bits is two. In addition, for example, as the up-to-date information, three 1-bit flags may be used, and each time the block is written, the bit-setting flag may be changed sequentially.

以下、最新性情報として、上述した0,1,2の3値を用いることにする。   Hereinafter, the three values 0, 1, and 2 described above are used as the freshness information.

有効性情報は、そのブロックの最新性情報およびデータの書込みが正常に終了したかどうかを示す、いわば、最新性情報およびデータの有効性(有効であるのか無効であるのか)を示すもので、例えば、RS(リードソロモン)符号などを用いることができる。   The validity information indicates whether or not the writing of the latestness information and data of the block has been completed normally, that is, the validity information and validity of the data (whether it is valid or invalid) For example, an RS (Reed Solomon) code can be used.

なお、有効性情報は、RS符号などの誤り訂正符号に限定されるものではない。すなわち、有効性情報は、上述のように最新性情報およびデータが有効であるのか、または無効であるのかを表すことができればよい。従って、有効性情報は、例えば、最新性情報およびデータを書込みながら計算されるパリティであっても、また、例えば、最新性情報およびデータが正常に書き込まれた後に付加される1ビットのフラグなどであってもよい。   The validity information is not limited to error correction codes such as RS codes. In other words, the validity information only needs to represent whether the latestness information and data are valid or invalid as described above. Therefore, the validity information is, for example, parity calculated while writing the freshness information and data, or, for example, a 1-bit flag added after the freshness information and data are normally written. It may be.

図4では、メモリが、第1および第2の領域としての2つのブロックを有しており、同図Aは、第1の領域の8バイトのデータとして01,02,03,04,05,06,07,08(各値はそれぞれ16進数とする)が既に記憶されており、第2の領域は、全てのデータが消去されている様子を示している。   In FIG. 4, the memory has two blocks as first and second areas, and FIG. 4A shows 01, 02, 03, 04, 05, 06, 07, 08 (each value is a hexadecimal number) has already been stored, and the second area shows that all data has been erased.

この状態において、新たに書き込むべきデータ11乃至18が供給されると、まず、第1および第2の領域としての2つのブロックの有効性が、それぞれの有効性情報に基づいて判定される。なお、ここでは、第1の領域としてのブロックのみが有効であると判定される。   In this state, when data 11 to 18 to be newly written are supplied, first, the validity of the two blocks as the first and second areas is determined based on the validity information. Here, it is determined that only the block as the first area is valid.

新たなデータの書込みを行う場合、上述したように、前回書き込まれたデータを破壊しないようにするために、現状でデータが記録されていないブロックに、新たなデータの書込みを行う。従って、同図Bに示すように、新たなデータ11乃至18は、第2の領域としてのブロックに書き込まれる。データ11乃至18の書込みの終了後は、まず、その書込みが行われたブロックの最新性情報を更新する。すなわち、それまで最新のブロックであった、第1の領域としてのブロックの最新性情報が01であったので、いま書込みが行われた第2の領域としてのブロックの最新性情報として、第1の領域としてのブロックの最新性情報01に1を加算した値02が書き込まれ、さらに、最新性情報02の有効性を表す有効性情報の書込みが行われる。   When new data is written, as described above, new data is written to a block in which no data is currently recorded in order not to destroy previously written data. Therefore, as shown in FIG. B, new data 11 to 18 are written in the block as the second area. After the writing of the data 11 to 18 is finished, first, the latestness information of the block in which the writing has been performed is updated. That is, since the up-to-date information of the block as the first area, which was the most recent block, was 01, the up-to-date information of the block as the second area that has been written is A value 02 obtained by adding 1 to the freshness information 01 of the block as the area of the current area is written, and further, validity information indicating the validity of the freshness information 02 is written.

そして、第2の領域としてのブロックへの書込みが全て終了した後、同図Cに示すように、第1の領域としてのブロックに記録されている全てのデータが消去される。   Then, after all the writing to the block as the second area is completed, as shown in FIG. 5C, all the data recorded in the block as the first area is erased.

ところで、図4の第1および第2の領域としての2つのブロックは、外部からは、同一の論理的なブロックである論理ブロックとして認識されるようになされている。すなわち、第1および第2の領域としてのブロックは、物理的に存在するブロックである物理ブロックであり、各物理ブロックには、その識別のために、ユニークな番号である物理ブロック番号が割り当てられている。そして、第1および第2の領域としての物理ブロックの物理ブロック番号には、いずれにも、論理ブロックを識別するための論理ブロック番号として、同一の番号が対応付けられており、これにより、第1および第2の領域としての物理ブロックは、外部からは1つの論理ブロックとして認識されるようになされている。   By the way, the two blocks as the first and second areas in FIG. 4 are recognized as logical blocks which are the same logical block from the outside. That is, the blocks as the first and second areas are physical blocks that are physically present, and each physical block is assigned a unique physical block number for identification. ing. The physical block numbers of the physical blocks as the first and second areas are associated with the same number as the logical block number for identifying the logical block. The physical blocks as the first and second areas are recognized as one logical block from the outside.

つまり、図4において、第1および第2の領域としての物理ブロックの物理ブロック番号は異なるが、いずれにも、同一の論理ブロック番号が割り当てられており、外部からは、そのような論理ブロック番号を有する論理ブロックにアクセスの要求がなされる。そして、メモリ側では、論理ブロックへのアクセスの要求があると、それに対応する物理ブロック番号のブロック、すなわち、第1および第2の領域に対してデータの読み出し処理、またはデータの書込み処理が行われる。   That is, in FIG. 4, the physical block numbers of the physical blocks as the first and second areas are different, but the same logical block number is assigned to both, and such a logical block number is externally assigned. A request for access is made to a logical block having On the memory side, when there is a request for access to a logical block, a data read process or a data write process is performed on a block having a physical block number corresponding to the request, that is, the first and second areas. Is called.

なお、以下では、物理ブロック番号および論理ブロック番号のいずれも1バイトで表されるものとする。   In the following, it is assumed that both the physical block number and the logical block number are represented by 1 byte.

次に、上述の場合においては、1の物理ブロックのデータの書込みの終了後に、その物理ブロックの最新性情報と有効性情報が更新されるため、関連する複数ブロック分のデータを、複数の物理ブロックに書き込む場合においては、新旧混在したデータが生じることがある。   Next, in the above-described case, after the completion of writing of data of one physical block, the latestness information and validity information of the physical block are updated. When writing to a block, mixed data may be generated.

すなわち、外部から見た場合において、複数の論理ブロックに、複数ブロック分のデータを書き込んでいる最中にメモリコラプションが生じると、メモリコラプションが生じる前に書込みが完了した論理ブロックには、新しいデータが存在することになるが、メモリコラプションが生じた最中に書込みを行っている論理ブロック以降には、古いデータが存在することになる。   In other words, when memory corruption occurs when data for a plurality of blocks is being written to a plurality of logical blocks when viewed from the outside, new data is written to the logical block for which writing has been completed before the memory corruption occurs. However, old data exists after the logical block in which writing is performed during the occurrence of memory corruption.

関連する複数ブロック分のデータが一括で意味のあるものであり、従って、それ全体で有用なものである場合においては、上述のように、その中に、新しいものと古いものとが混在すると、その整合性がとれなくなる。すなわち、関連する複数ブロック分のデータが、例えば、前述したように、乗車した駅と時刻、降車した駅と時刻、乗降車した駅間の運賃などである場合において、乗車した駅については新しいデータが書き込まれ、乗車した時刻については古いデータのままでは、その整合性がとれず、意味のないものとなる。   If the related blocks of data are meaningful in a lump and are useful in their entirety, as described above, if new and old are mixed, That consistency is lost. That is, when the data for a plurality of related blocks are, for example, as described above, the station and time of boarding, the station and time of getting off, the fare between the boarding and exiting stations, etc., new data for the boarding station Is written, and the time of boarding will be meaningless if the old data remains as it is.

従って、複数の論理ブロックに、関連する複数ブロック分のデータが書き込まれる場合において、その複数ブロック分のデータの書込みが終了するまでにメモリコラプションが生じたときには、外部からは、論理ブロックにその関連する複数ブロック分の古いデータが存在するように認識させる必要がある。   Therefore, when data for a plurality of related blocks is written in a plurality of logical blocks, if a memory corruption occurs before the writing of the data for the plurality of blocks is completed, the relationship from the outside is related to the logical block. It is necessary to make it recognize that there is old data for a plurality of blocks.

[シングルポインタ方式の説明]
そこで、メモリを、例えば、図5に示すように構成する。すなわち、メモリを、データを記憶するデータ領域としての物理ブロックと、データ領域を構成する物理ブロックの物理ブロック番号を記憶する第1および第2の領域としての物理ブロックとで構成する。
[Description of single pointer method]
Therefore, the memory is configured as shown in FIG. 5, for example. That is, the memory is configured with physical blocks as data areas for storing data and physical blocks as first and second areas for storing physical block numbers of physical blocks constituting the data area.

なお、図5においても、図4における場合と同様に、1個の物理ブロック(同図における横1列)は、11バイトで構成されている。   In FIG. 5 as well, as in the case of FIG. 4, one physical block (one horizontal row in the figure) is composed of 11 bytes.

データ領域を構成する各物理ブロックは、11バイト単位でデータを記憶するようになされており、同図の場合、データ領域は、物理ブロック番号#00乃至#07それぞれが割り当てられた8個の物理ブロックで構成されている(#は、物理ブロック番号であることを表す)。   Each physical block constituting the data area stores data in units of 11 bytes. In the case of the figure, the data area includes eight physical blocks to which physical block numbers # 00 to # 07 are assigned. It is composed of blocks (# represents a physical block number).

また、同図の場合、第1の領域の物理ブロック番号には#FEが割り当てられており、第2の領域の物理ブロック番号には#FFが割り当てられている。   In the case of the figure, #FE is assigned to the physical block number of the first area, and #FF is assigned to the physical block number of the second area.

なお、同図のように構成されたメモリは、外部からは4個の論理ブロックが認識されるようになされており、その4個の論理ブロックそれぞれには、論理ブロック番号として%00乃至%03が割り当てられている。なお、同図の場合、論理ブロック番号%00乃至%03には、物理ブロック番号#00乃至#03が対応付けられている。   Note that the memory configured as shown in the figure recognizes four logical blocks from the outside, and each of the four logical blocks has a logical block number of% 00 to% 03. Is assigned. In the figure, physical block numbers # 00 to # 03 are associated with logical block numbers% 00 to% 03.

同図に示された第1および第2の領域としての物理ブロックは、図4の場合と同様、その先頭の1バイトが最新性情報に、終わりの2バイトが有効性情報に、それぞれ割り当てられている。ただし、最新性情報と有効性情報との間の8バイトには、データ領域の物理ブロックの物理ブロック番号、すなわち、データ領域を構成する物理ブロックへのポインタが配置される。   As in the case of FIG. 4, the physical block as the first and second areas shown in the figure is allocated with the first 1 byte as the latestness information and the last 2 bytes as the validity information. ing. However, the physical block number of the physical block in the data area, that is, a pointer to the physical block constituting the data area is arranged in 8 bytes between the freshness information and the validity information.

データ領域を構成する物理ブロックへのポインタが配置される8バイトのうち、前半の4バイトには、データ領域の対象ブロックの物理ブロック番号が配置され、後半の4バイトには、データ領域の更新ブロックの物理ブロック番号が配置される。   Of the 8 bytes in which pointers to physical blocks constituting the data area are arranged, the physical block number of the target block in the data area is arranged in the first 4 bytes, and the data area is updated in the latter 4 bytes. The physical block number of the block is arranged.

ここで、対象ブロックとは、情報を書き込む場合に、本来、その書込みの対象となるべき物理ブロックを意味する。すなわち、例えば、上述した基本原理においては、ブロックB1に記憶されたデータを新しいデータに書き換える場合、その新しいデータをブロック1に書き込まず、ブロックB2に書き込むが、この場合において、本来、新しいデータを書き込むべきブロックB1が対象ブロックに相当する。   Here, the target block means a physical block that should originally be a target of writing when information is written. That is, for example, in the basic principle described above, when data stored in the block B1 is rewritten to new data, the new data is not written to the block 1 but written to the block B2. The block B1 to be written corresponds to the target block.

また、更新ブロックとは、ある物理ブロックに情報を書込み、その記憶内容を更新するときに用いられる更新用の物理ブロックを意味する。すなわち、例えば、上述した基本原理においては、ブロックB1に記憶されたデータを新しいデータに書き換える場合、その新しいデータをブロックB1に書き込まず、ブロックB2に書き込むが、この場合において、新しいデータを書き込むブロックB2が更新ブロックに相当する。   The update block means an update physical block used when information is written to a certain physical block and its stored contents are updated. That is, for example, in the basic principle described above, when the data stored in the block B1 is rewritten to new data, the new data is not written in the block B1, but is written in the block B2, but in this case, the block in which the new data is written B2 corresponds to an update block.

第1および第2の領域における最新性情報と有効性情報との間の8バイトのうちの前半の4バイトに配置される4個の物理ブロック番号は、論理ブロック番号と対応付けられるようになされている。すなわち、例えば、その1乃至4バイト目に配置される物理ブロック番号は、それぞれ論理ブロック番号%00乃至%03に対応付けられている。   The four physical block numbers arranged in the first 4 bytes of the 8 bytes between the freshness information and the validity information in the first and second areas are associated with the logical block numbers. ing. That is, for example, the physical block number arranged in the first to fourth bytes is associated with the logical block numbers% 00 to% 03, respectively.

図5に示されたように構成されるメモリにおいては、関連する4ブロック分のデータが物理ブロック#00(物理ブロック番号が#00の物理ブロック)乃至#03に記憶されている。そして、その物理ブロック番号#00乃至#03が、第1の領域における最新性情報と有効性情報との間の8バイトのうちの前半の4バイト(以下、適宜、データ領域の対象ブロックへのポインタの欄と称する)に、その順番で配置されている。   In the memory configured as shown in FIG. 5, related four blocks of data are stored in physical block # 00 (physical block whose physical block number is # 00) to # 03. The physical block numbers # 00 to # 03 are the first 4 bytes of the 8 bytes between the freshness information and the validity information in the first area (hereinafter referred to as appropriate for the target block in the data area). (Referred to as a pointer column) in that order.

従って、例えば、第1の領域における、データ領域の対象ブロックへのポインタの欄に注目した場合、論理ブロック番号%00乃至%03には物理ブロック番号#00乃至03が対応付けられている。   Therefore, for example, when attention is paid to the column of the pointer to the target block of the data area in the first area, the physical block numbers # 00 to 03 are associated with the logical block numbers% 00 to% 03.

ここで、第1の領域に注目した場合においては、論理ブロック%00(論理ブロック番号が%00の論理ブロック)乃至%03に対応付けられた物理ブロック#00乃至#03のうちのいずれかが、アクセスの対象となるべきブロック、すなわち、対象ブロックとなる。   Here, when attention is paid to the first area, any one of the physical blocks # 00 to # 03 associated with the logical block% 00 (logical block whose logical block number is% 00) to% 03 is associated. The block to be accessed, that is, the target block.

更新ブロックには、その時点で対象ブロックではないデータ領域の物理ブロック、すなわち、空き領域となっている物理ブロックがなり得る。従って、図5において、第1の領域に注目した場合には、物理ブロック#04乃至#07が更新ブロックとなり得るので、その第1の領域における最新性情報と有効性情報との間の8バイトのうちの後半の4バイト(以下、適宜、データ領域の更新ブロックへのポインタの欄と称する)には、それらの更新ブロックの物理ブロック番号#04乃至#07が配置されている。   The update block can be a physical block of the data area that is not the target block at that time, that is, a physical block that is a free area. Therefore, in FIG. 5, when attention is paid to the first area, the physical blocks # 04 to # 07 can be update blocks, and therefore, 8 bytes between the freshness information and the validity information in the first area. In the latter 4 bytes (hereinafter, referred to as a column of pointers to update blocks in the data area as appropriate), physical block numbers # 04 to # 07 of these update blocks are arranged.

ここで、例えば、第1または第2の領域のうちの第1の領域のみが有効であるとして、外部から、論理ブロック番号%00と%02に対応する論理ブロックそれぞれに、関連する2ブロック分のデータの書込みの要求があったとする。   Here, for example, assuming that only the first area of the first or second area is valid, two blocks corresponding to each of the logical blocks corresponding to the logical block numbers% 00 and% 02 are externally provided. Suppose that there is a request to write data.

この場合、有効である第1の領域のうちの、データ領域の対象ブロックへのポインタの欄を参照することにより、論理ブロック番号%00と%02に対応する物理ブロック番号として#00と#02が認識される。そして、物理ブロック#00および#02が、関連する2ブロック分のデータそれぞれを書き込むべき対象ブロックとして認識される。   In this case, by referring to the column of the pointer to the target block in the data area in the valid first area, the physical block numbers corresponding to the logical block numbers% 00 and% 02 are # 00 and # 02. Is recognized. Then, physical blocks # 00 and # 02 are recognized as target blocks to which each of the related two blocks of data is to be written.

さらに、第1の領域のうちの、データ領域の更新ブロックへのポインタの欄を参照することで、全ての更新ブロックの物理ブロック番号が認識される。いまの場合、物理ブロック番号#04,#05,#06,#07が認識される。そして、更新ブロックとして認識された全ての物理ブロック番号にそれぞれ対応する物理ブロック(いまの場合、物理ブロック#04,#05,#06,#07)が一括して消去される。なお、複数の物理ブロックを一括して消去するための要する時間は、1個の物理ブロックを消去するための要する時間と同等である。   Further, the physical block numbers of all the update blocks are recognized by referring to the column of pointers to the update blocks in the data area in the first area. In this case, physical block numbers # 04, # 05, # 06, and # 07 are recognized. Then, physical blocks respectively corresponding to all physical block numbers recognized as update blocks (in this case, physical blocks # 04, # 05, # 06, # 07) are erased collectively. Note that the time required for erasing a plurality of physical blocks at the same time is equivalent to the time required for erasing one physical block.

この後、対象ブロックの数(いまの場合、2)と同数の更新ブロックの物理ブロック番号が、例えば、データ領域の更新ブロックへのポインタの欄の左から配置されているものから順番に認識され、本来ならば、対象ブロックである物理ブロック#00または#02に書き込むべき2ブロック分のデータが、図6に示すように、更新ブロックである物理ブロック#04または#05それぞれに書き込まれる。   Thereafter, the physical block numbers of the same number of update blocks as the number of target blocks (in this case, 2) are recognized in order from, for example, those arranged from the left of the column of pointers to the update blocks in the data area. Originally, two blocks of data to be written in the physical block # 00 or # 02 as the target block are written into the physical block # 04 or # 05 as the update block, respectively, as shown in FIG.

このように、全ての更新ブロックとされた物理ブロックを一括して消去することにより、物理ブロックにデータを書込み毎に、その都度、物理ブロックのデータを消去する場合に比較して、処理時間を短縮することができる。   In this way, by erasing all the physical blocks that have been designated as update blocks, the processing time can be reduced as compared with the case of erasing the physical block data each time data is written to the physical block. It can be shortened.

ここで、図6は、論理ブロック番号%00と%02に対応する物理ブロック番号#00と#02に書き込むべき2つのデータが、それぞれ40,41,・・・,4Aと50,51,・・・,5Aであったとして、これらが、更新ブロックである物理ブロック#04と#05それぞれに書き込まれた状態を示している。   6 shows that the two data to be written in the physical block numbers # 00 and # 02 corresponding to the logical block numbers% 00 and% 02 are 40, 41,..., 4A and 50, 51,. .., 5A, these indicate the states written in the physical blocks # 04 and # 05, which are update blocks.

物理ブロック#04と#05それぞれにデータ書き込まれた後、更新ブロックであった物理ブロックのブロック番号#04と#05とが、これまで無効であった第2の領域におけるデータ領域の対象ブロックへのポインタの欄に書き込まれる。すなわち、第1の領域におけるデータ領域の対象ブロックへのポインタの欄の記載#00,#01,#02,#03が第2の領域にコピーされ、このうち、対象ブロックの物理ブロック番号#00と#02が、同図に示すように、実際にデータが書き込まれた更新ブロックの物理ブロック番号#04と#05にそれぞれ書き換えられる。   After the data is written to each of the physical blocks # 04 and # 05, the block numbers # 04 and # 05 of the physical block that was the update block are changed to the target block of the data area in the second area that has been invalid until now. Is written in the pointer field. That is, descriptions # 00, # 01, # 02, and # 03 in the column of the pointer to the target block of the data area in the first area are copied to the second area, and among these, the physical block number # 00 of the target block And # 02 are rewritten to physical block numbers # 04 and # 05 of the update block in which data is actually written, respectively, as shown in FIG.

この結果、第2の領域に注目した場合、論理ブロック番号%00が物理ブロック番号#04に対応付けられ、論理ブロック番号%02が物理ブロック番号#02に対応付けられたことがわかる。   As a result, when focusing on the second area, it can be seen that the logical block number% 00 is associated with the physical block number # 04, and the logical block number% 02 is associated with the physical block number # 02.

また、データを書き込むべきであった物理ブロック#00と#02は更新ブロックとされ、その物理ブロック番号#00と#02が、第2の領域におけるデータ領域の更新ブロックへのポインタの欄に書き込まれる。すなわち、第1の領域におけるデータ領域の更新ブロックへのポインタの欄の記載#04,#05,#06,#07が、第2の領域にコピーされ、このうち、データが書き込まれた物理ブロックの物理ブロック番号#04と#05が、同図に示すように、対象ブロックの物理ブロック番号#00と#02にそれぞれ書き換えられる。   Also, the physical blocks # 00 and # 02 to which data should have been written are update blocks, and the physical block numbers # 00 and # 02 are written in the pointer field to the update block of the data area in the second area. It is. That is, descriptions # 04, # 05, # 06, and # 07 in the column of the pointer to the update block of the data area in the first area are copied to the second area, and among these, the physical block in which the data is written The physical block numbers # 04 and # 05 are rewritten to the physical block numbers # 00 and # 02 of the target block, respectively, as shown in FIG.

この結果、第2の領域に注目した場合、物理ブロック#00および#02が新たに更新ブロックとされたことがわかる。   As a result, when attention is paid to the second area, it is understood that the physical blocks # 00 and # 02 are newly updated blocks.

以上のようにして、第2の領域の、データ領域の対象ブロックへのポインタと、データ領域の更新ブロックへのポインタが更新された後、その第2の領域における最新性情報と有効性情報とが順次書き込まれ(書き換えられ)、その後、第1の領域のデータが全て消去される。   As described above, after the pointer to the target block in the data area and the pointer to the update block in the data area in the second area are updated, the up-to-date information and validity information in the second area are updated. Are sequentially written (rewritten), and then all the data in the first area is erased.

従って、この場合、第2の領域について、データ領域の対象ブロックへのポインタの欄の書込みが終了しないと、有効である旨の有効性情報は書き込まれない。すなわち、上述の場合においては、2つの論理ブロック%00と%02へのデータの書込みが両方とも終了しなければ、第2の領域には、有効である旨の有効性情報は書き込まれない。   Accordingly, in this case, validity information indicating that the second area is valid is not written unless the writing of the pointer column to the target block in the data area is completed. In other words, in the above-described case, if the data writing to the two logical blocks% 00 and% 02 is not completed, the validity information indicating that the data is valid is not written in the second area.

その結果、2つの論理ブロック%00と%02へのデータの書込みが行われている間にメモリコラプションが生じた場合には、第1の領域のみが有効な状態となったままになり、論理ブロック%00と%02からは、有効である第1の領域を参照することで、その論理ブロック%00と%02にそれぞれ対応付けられている物理ブロック#00と#02に記憶されている古いデータが読み出されることになる。   As a result, if memory corruption occurs while data is being written to the two logical blocks% 00 and% 02, only the first area remains valid, From the blocks% 00 and% 02, the old areas stored in the physical blocks # 00 and # 02 respectively associated with the logical blocks% 00 and% 02 are referred to by referring to the valid first area. Data will be read out.

一方、2つの論理ブロック%00と%02へのデータの書込みが終了し、第2の領域における最新性情報と有効性情報の更新が行われ、第1の領域のデータが全て消去された場合には、論理ブロック%00と%02からは、唯一有効である第2の領域を参照することで、その論理ブロック%00と%02にそれぞれ対応付けられている物理ブロック#04と#05に記憶されている新しいデータが読み出されることになる。   On the other hand, when the data writing to the two logical blocks% 00 and% 02 is completed, the latestness information and the validity information in the second area are updated, and all the data in the first area is erased The logical blocks% 00 and% 02 refer to the only valid second area, so that the physical blocks # 04 and # 05 respectively associated with the logical blocks% 00 and% 02 are referred to. New stored data will be read out.

従って、この場合、論理ブロック%00と%02に記憶される、複数のデータとしての2つデータが関連性を有するものであるときには、メモリコラプションが生じても、個々のデータの整合性とともに、その2つのデータの間の整合性を維持することが可能となる。   Accordingly, in this case, when two pieces of data as a plurality of data stored in the logical blocks% 00 and% 02 are related, even if a memory corruption occurs, the consistency of the individual data is It becomes possible to maintain the consistency between the two data.

なお、図5および図6を参照して上述したメモリに対する読み書き方式は、データ領域への1段階のポインタを利用したものなので、以下、適宜、シングルポインタ方式と称する。   The read / write method for the memory described above with reference to FIGS. 5 and 6 uses a one-step pointer to the data area, and is hereinafter referred to as a single pointer method as appropriate.

ところで、図5および図6に示されたシングルポインタ方式では、データ領域の対象ブロックへのポインタの欄として、4つの物理ブロック番号を記載できるようになされている。また、データ領域の更新ブロックへのポインタの欄も、データ領域の対象ブロックへのポインタの欄と同様に、4つの物理ブロック番号を記載できるようになされている。これにより、最大4ブロック分のデータの整合性を維持することができる。   By the way, in the single pointer method shown in FIGS. 5 and 6, four physical block numbers can be described as a column of the pointer to the target block in the data area. Also, the pointer column to the update block in the data area can describe four physical block numbers in the same manner as the pointer column to the target block in the data area. As a result, data consistency for a maximum of 4 blocks can be maintained.

しかしながら、逆に言えば、図5および図6に示されたシングルポインタ方式では、4ブロックよりも多いブロック分の整合性の維持を図ることは困難である。   In other words, however, it is difficult to maintain the consistency of more than four blocks with the single pointer method shown in FIGS.

すなわち、図5および図6に示されたシングルポインタ方式では、データの整合性を維持することができるブロックの数が、データ領域の対象ブロックへのポインタのブロックの数に制限されてしまう。   That is, in the single pointer method shown in FIGS. 5 and 6, the number of blocks that can maintain data consistency is limited to the number of blocks of pointers to the target block in the data area.

[ダブルポインタ方式の説明]
そこで、データの整合性を維持することができるブロック数の制限を解除するため、メモリの構成を、例えば図7に示すように拡張する。
[Description of double pointer method]
Therefore, in order to remove the restriction on the number of blocks that can maintain data consistency, the memory configuration is expanded as shown in FIG. 7, for example.

すなわち、ここでは、メモリを、データを記憶するデータ領域としての物理ブロック#00乃至#17と、データ領域を構成する物理ブロックへのポインタとしての、そのブロック番号を記憶するポインタ領域としての物理ブロック#18乃至#1Dと、ポインタ領域を構成する物理ブロックへのポインタとしての、そのブロック番号を記憶する第1および第2の領域としての物理ブロック#1Eおよび#1Fとで構成する。   That is, here, the memory includes physical blocks # 00 to # 17 as data areas for storing data, and physical blocks as pointer areas for storing the block numbers as pointers to physical blocks constituting the data area. It is composed of # 18 to # 1D and physical blocks # 1E and # 1F as first and second areas for storing the block numbers as pointers to physical blocks constituting the pointer area.

なお、図7では、図示の都合上、1つの物理ブロックを8バイトで構成している。   In FIG. 7, one physical block is composed of 8 bytes for convenience of illustration.

データ領域を構成する各物理ブロックは、8バイト単位でデータを記憶するようになされており、図7においては、データ領域は、物理ブロック番号として#00乃至#17それぞれが割り当てられた24個の物理ブロックで構成されている。   Each physical block constituting the data area is configured to store data in units of 8 bytes. In FIG. 7, the data area has 24 physical blocks assigned # 00 to # 17 as physical block numbers. Consists of physical blocks.

なお、外部からは、16個の論理ブロックが認識されるようになされており、その16個の論理ブロックそれぞれには、論理ブロック番号として%00乃至%0Fが割り当てられている。   Note that 16 logical blocks are recognized from the outside, and each of the 16 logical blocks is assigned% 00 to% 0F as a logical block number.

ただし、説明の都合上、データ領域を構成する物理ブロックの数(24個)と同数だけ論理ブロックが存在するものとし、外部から論理ブロックとして認識される物理ブロック以外の8個の物理ブロックそれぞれに、論理ブロック番号として%10乃至%17を仮に割り当てておく。図7の例では、論理ブロック番号%00乃至%17と、物理ブロック番号#00乃至#17とがそれぞれ対応付けられている。   However, for the convenience of explanation, it is assumed that there are as many logical blocks as the number of physical blocks (24) constituting the data area, and there are 8 physical blocks other than the physical blocks recognized as logical blocks from the outside. As a logical block number,% 10 to% 17 are temporarily allocated. In the example of FIG. 7, logical block numbers% 00 to% 17 and physical block numbers # 00 to # 17 are associated with each other.

ポインタ領域(ブロック番号領域)を構成する各物理ブロックは、8バイト単位でデータ領域を構成する物理ブロックへのポインタとして、その物理ブロック番号を記憶する。図7の場合、ポインタ領域は、物理ブロック番号として#18乃至#1Dそれぞれが割り当てられた6個の物理ブロックで構成されている。ここでは、ポインタ領域を構成する各物理ブロックは、8バイト単位で物理ブロック番号を記憶するようになされており、物理ブロック番号は1バイトで表されるので、1個の物理ブロックには、8個の物理ブロック番号が記憶される。   Each physical block constituting the pointer area (block number area) stores the physical block number as a pointer to the physical block constituting the data area in units of 8 bytes. In the case of FIG. 7, the pointer area is composed of six physical blocks to which # 18 to # 1D are assigned as physical block numbers. Here, each physical block constituting the pointer area stores a physical block number in units of 8 bytes, and the physical block number is represented by 1 byte. The physical block numbers are stored.

ポインタ領域の各物理ブロックに配置される8個の物理ブロック番号は、論理ブロック番号と対応付けられる。すなわち、その1乃至8バイト目に配置される物理ブロック番号は、ある論理ブロック番号(後述するように、%00,%08、または%10)を基準として0乃至7だけオフセットした論理ブロック番号に対応付けられる。   Eight physical block numbers arranged in each physical block in the pointer area are associated with logical block numbers. That is, the physical block number arranged in the first to eighth bytes is a logical block number that is offset by 0 to 7 with respect to a certain logical block number (% 00,% 08, or% 10 as will be described later). It is associated.

第1および第2の領域としてのブロックは、その先頭の1バイトが最新性情報に割り当てられ、終わりの1バイトが有効性情報に割り当てられている。そして、最新性情報と有効性情報との間の6バイトには、ポインタ領域の物理ブロックへのポインタとしての、その物理ブロック番号が配置されている。   In the blocks as the first and second areas, the first byte is assigned to the freshness information, and the last byte is assigned to the validity information. In 6 bytes between the freshness information and the validity information, the physical block number as a pointer to the physical block in the pointer area is arranged.

第1および第2の領域における最新性情報と有効性情報との間の6バイトのうち、前半の3バイト(以下、適宜、ポインタ領域の対象ブロックへのポインタの欄と称する)には、ポインタ領域の対象ブロックの物理ブロック番号が配置され、その後半の3バイト(以下、適宜、ポインタ領域の更新ブロックへのポインタの欄と称する)には、ポインタ領域の更新ブロックの物理ブロック番号が配置される。   Of the 6 bytes between the freshness information and the validity information in the first and second areas, the first 3 bytes (hereinafter referred to as a pointer field to the target block in the pointer area as appropriate) have a pointer. The physical block number of the target block in the area is arranged, and the physical block number of the update block in the pointer area is arranged in the latter three bytes (hereinafter referred to as a pointer column to the update block in the pointer area as appropriate). The

第1および第2の領域におけるポインタ領域の対象ブロックへのポインタの欄に配置される3つの物理ブロック番号に対応するポインタ領域の物理ブロックが記憶している物理ブロック番号は、論理ブロック番号と対応付けられている。すなわち、例えば、その1乃至3バイト目に配置される物理ブロック番号に対応するポインタ領域の物理ブロックが記憶している物理ブロック番号は、それぞれ論理ブロック番号%00乃至%07、%08乃至%0F、または%10乃至%17に対応付けられている。   The physical block numbers stored in the physical blocks of the pointer area corresponding to the three physical block numbers arranged in the pointer column to the target block of the pointer area in the first and second areas correspond to the logical block numbers. It is attached. That is, for example, the physical block numbers stored in the physical block of the pointer area corresponding to the physical block number arranged in the first to third bytes are the logical block numbers% 00 to% 07 and% 08 to% 0F, respectively. Or% 10 to% 17.

具体的には、図7の場合、第1の領域においては、ポインタ領域の対象ブロックへのポインタの欄における1バイト目の物理ブロック番号#18が指しているポインタ領域の物理ブロック#18の1乃至8バイト目に配置された物理ブロック番号#00乃至#07は、第1の領域におけるポインタ領域の対象ブロックへのポインタの欄における1バイト目に対応する論理ブロック番号%00乃至%07にそれぞれ対応付けられる。   Specifically, in the case of FIG. 7, in the first area, 1 in the physical block # 18 in the pointer area pointed to by the physical block number # 18 in the first byte in the pointer field to the target block in the pointer area. The physical block numbers # 00 to # 07 arranged in the 8th byte to the 8th byte respectively correspond to the logical block numbers% 00 to% 07 corresponding to the 1st byte in the column of the pointer to the target block in the pointer area in the first area. It is associated.

また、ポインタ領域の対象ブロックへのポインタの欄における2バイト目の物理ブロック番号#19が指しているポインタ領域の物理ブロック#19の1乃至8バイト目に配置された物理ブロック番号#08乃至#0Fは、第1の領域におけるポインタ領域の対象ブロックへのポインタの欄における2バイト目に対応付けられた論理ブロック番号%08乃至%0Fにそれぞれ対応付けられる。   Also, the physical block numbers # 08 to ## arranged in the 1st to 8th bytes of the physical block # 19 of the pointer area pointed to by the physical block number # 19 of the second byte in the pointer field to the target block of the pointer area 0F is associated with each of logical block numbers% 08 to% 0F associated with the second byte in the column of the pointer to the target block in the pointer area in the first area.

同様に、ポインタ領域の対象ブロックへのポインタの欄における3バイト目の物理ブロック番号#1Aが指すポインタ領域の物理ブロック#1Aの1乃至8バイト目に配置された物理ブロック番号#10乃至#17は、論理ブロック番号%10乃至%17にそれぞれ対応付けられる。   Similarly, the physical block numbers # 10 to # 17 arranged in the 1st to 8th bytes of the physical block # 1A of the pointer area pointed to by the physical block number # 1A of the 3rd byte in the pointer field to the target block of the pointer area Are associated with logical block numbers% 10 to% 17, respectively.

以上のように構成されるメモリにおいて、例えば、第1の領域に注目した場合には、ポインタ領域の対象ブロックへのポインタの欄に記述された物理ブロック番号に対応する物理ブロックが、アクセス対象となるべきポインタ領域の対象ブロックとなる。   In the memory configured as described above, for example, when attention is paid to the first area, the physical block corresponding to the physical block number described in the pointer column to the target block in the pointer area is the access target. It becomes the target block of the pointer area that should be.

従って、図7の場合、ポインタ領域の物理ブロック#18乃至#1Aがポインタ領域の対象ブロックとなっており、残りの物理ブロック#1B乃至#1Dが、ポインタ領域の更新のための更新ブロックとなっている。これにより、その物理ブロック番号#1B乃至#1Dが、第1の領域におけるポインタ領域の更新ブロックへのポインタの欄に記述されている。   Therefore, in the case of FIG. 7, the physical blocks # 18 to # 1A in the pointer area are the target blocks in the pointer area, and the remaining physical blocks # 1B to # 1D are update blocks for updating the pointer area. ing. Thus, the physical block numbers # 1B to # 1D are described in the pointer column to the update block of the pointer area in the first area.

さらに、ポインタ領域の対象ブロックに記述された物理ブロック番号に対応する、データ領域の物理ブロックのうち、例えば、論理ブロック%00乃至%0Fに対応するものがデータ領域の対象ブロックとされている。いまの場合、論理ブロック%00乃至%0Fに対応する物理ブロック#00乃至#0Fがデータ領域の対象ブロックとなり、データ領域の残りの物理ブロック(論理ブロック%10乃至%17に対応する物理ブロック)#10乃至#17が、データ領域の更新のための更新ブロックとなっている。   Further, among the physical blocks in the data area corresponding to the physical block number described in the target block in the pointer area, for example, the blocks corresponding to the logical blocks% 00 to% 0F are the target blocks in the data area. In this case, physical blocks # 00 to # 0F corresponding to the logical blocks% 00 to% 0F are the target blocks of the data area, and the remaining physical blocks in the data area (physical blocks corresponding to the logical blocks% 10 to% 17) # 10 to # 17 are update blocks for updating the data area.

ここで、上述したように、ポインタ領域の更新ブロックは、その物理ブロック番号が、第1または第2の領域の、ポインタ領域の更新ブロックへのポインタの欄に記述されているので、その欄を参照することで認識することができる。一方、データ領域の更新ブロックは、論理ブロック%10乃至%17に対応する物理ブロックであるから、ポインタ領域の対象ブロックへのポインタの欄の3バイト目に記述されている物理ブロック番号に対応するポインタ領域の物理ブロックを参照することで、そこに記述されている物理ブロック番号から認識することができる。   Here, as described above, since the physical block number of the update block of the pointer area is described in the column of the pointer to the update block of the pointer area in the first or second area, It can be recognized by referring to it. On the other hand, since the update block in the data area is a physical block corresponding to the logical blocks% 10 to% 17, it corresponds to the physical block number described in the third byte of the pointer field to the target block in the pointer area. By referring to the physical block in the pointer area, it can be recognized from the physical block number described there.

いま、第1または第2の領域のうち、第1の領域のみが有効であると仮定し、外部から、例えば、論理ブロック番号%00と%02に対応する物理ブロックそれぞれに、関連する2ブロック分のデータの書込みの要求があったとする。   Now, assuming that only the first area is valid among the first or second areas, for example, two blocks related to the physical blocks corresponding to the logical block numbers% 00 and% 02 from the outside, for example. Suppose that there is a request to write data for the minute.

この場合、有効である第1の領域の、ポインタ領域の対象ブロックへのポインタの欄を参照し、さらに、そこに記述されている物理ブロック番号に対応する物理ブロックを参照することで、関連する2ブロック分のデータを書き込むべきデータ領域の物理ブロックである対象ブロックが認識される。この後、データ領域の更新ブロックが認識される。   In this case, it is related by referring to the column of the pointer to the target block in the pointer area of the first area that is valid, and further referring to the physical block corresponding to the physical block number described therein. A target block that is a physical block in a data area in which data for two blocks is to be written is recognized. Thereafter, an update block in the data area is recognized.

具体的には、第1の領域におけるポインタ領域の対象ブロックへのポインタの欄の1バイト目を参照することで、論理ブロック%00と%02に対応するデータ領域の物理ブロックの物理ブロック番号が記述された、ポインタ領域の物理ブロック#18を認識することができる。そして、その物理ブロック#18の1バイト目と3バイト目を参照することで、論理ブロック%00と%02に対応するデータ領域の物理ブロック(対象ブロック)の物理ブロック番号#00と#02をそれぞれ認識することができる。   Specifically, the physical block number of the physical block in the data area corresponding to the logical blocks% 00 and% 02 is obtained by referring to the first byte of the pointer area to the target block in the pointer area in the first area. The written physical block # 18 in the pointer area can be recognized. Then, by referring to the first byte and the third byte of the physical block # 18, the physical block numbers # 00 and # 02 of the physical block (target block) in the data area corresponding to the logical blocks% 00 and% 02 are obtained. Each can be recognized.

さらに、第1の領域におけるポインタ領域の対象ブロックへのポインタの欄の3バイト目を参照することで、データ領域の更新ブロックとなる論理ブロック%10乃至%17に対応する物理ブロックの物理ブロック番号が記述された、ポインタ領域の物理ブロック#1Aを認識することができる。   Further, the physical block number of the physical block corresponding to the logical blocks% 10 to% 17 that become the update block of the data area by referring to the third byte of the pointer field to the target block of the pointer area in the first area Can be recognized in the pointer area physical block # 1A.

そして、その物理ブロック#1Aを参照することで、データ領域の更新ブロックとなっている全ての物理ブロックの物理ブロック番号#10乃至#17を認識することができ、更新ブロックとされた全ての物理ブロック#10乃至#17が一括して消去される。なお、複数の物理ブロックを一括して消去するための要する時間は、1個の物理ブロックを消去するための要する時間と同等である。   Then, by referring to the physical block # 1A, it is possible to recognize the physical block numbers # 10 to # 17 of all the physical blocks that are the update blocks of the data area, and it is possible to recognize all the physical blocks that are the update blocks. Blocks # 10 to # 17 are erased collectively. Note that the time required for erasing a plurality of physical blocks at the same time is equivalent to the time required for erasing one physical block.

この後、一括消去されたデータ領域の全ての更新ブロックのうち、データの書込み対象である、データ領域の対象ブロックの数と同数の物理ブロック番号が、物理ブロック#1Aの、例えば左から順次参照されて、データを書き込む更新ブロックとして認識され。いまの場合、物理ブロック番号#10と#11に対応する、データ領域の物理ブロック#10および#11がデータを書き込む更新ブロックとされる。   After that, among all the update blocks in the data area erased in batch, the physical block numbers that are the same as the number of target blocks in the data area, to which data is to be written, are sequentially referred to from the left of the physical block # 1A, for example. And recognized as an update block for writing data. In this case, the physical blocks # 10 and # 11 in the data area corresponding to the physical block numbers # 10 and # 11 are update blocks to which data is written.

そして、本来ならば、論理ブロック%00と%02に対応する、データ領域の対象ブロックである物理ブロック#00と#02に書き込むべき2つのデータが、図8に示すように、データ領域の更新ブロックである物理ブロック#10と#11に書き込まれる。   Originally, the two data to be written in the physical blocks # 00 and # 02, which are the target blocks of the data area, corresponding to the logical blocks% 00 and% 02 are updated as shown in FIG. It is written in physical blocks # 10 and # 11 which are blocks.

すなわち、図8は、論理ブロック番号%00と%02に対応する物理ブロック番号#00と#02に書き込むべき2つのデータが、00,00,00,00,00,00,00,00と02,02,02,02,02,02,02,02であったとして、それらが、データ領域の更新ブロックである物理ブロック#10と#11それぞれに書き込まれた状態を示している。   That is, FIG. 8 shows that two data to be written in the physical block numbers # 00 and # 02 corresponding to the logical block numbers% 00 and% 02 are 00, 00, 00, 00, 00, 00, 00, 00 and 02. , 02, 02, 02, 02, 02, 02, 02, they are written in physical blocks # 10 and # 11, which are update blocks in the data area, respectively.

以上のようにして、データ領域の更新ブロックである物理ブロック#10と#11にデータを書き込んだ後、その物理ブロック番号#10と#11が、ポインタ領域の更新ブロックに書き込まれるとともに、本来ならばデータが書き込まれたはずであったデータ領域の物理ブロック(対象ブロック)の物理ブロック番号#00および#02が、ポインタ領域の、他の更新ブロックに書き込まれる。   As described above, after data is written in the physical blocks # 10 and # 11 which are update blocks in the data area, the physical block numbers # 10 and # 11 are written in the update block in the pointer area and For example, the physical block numbers # 00 and # 02 of the physical block (target block) in the data area where data should have been written are written in other update blocks in the pointer area.

すなわち、まず、第1の領域の、ポインタ領域の更新ブロックへのポインタの欄を参照することで、ポインタ領域の更新ブロックが認識される。なお、ここでは、ポインタ領域の更新ブロックとして、ポインタ領域の対象ブロックのうち、上述のようなデータ領域への書込みに伴って変更(更新)する必要のある対象ブロックの数と同数の物理ブロックが、ポインタ領域の更新ブロックへのポインタの欄を、例えば左から順次参照することで認識される。   That is, first, an update block in the pointer area is recognized by referring to the column of the pointer to the update block in the pointer area in the first area. Here, as the update blocks of the pointer area, the same number of physical blocks as the number of target blocks that need to be changed (updated) with the writing to the data area as described above among the target blocks of the pointer area. The pointer field to the update block in the pointer area is recognized by sequentially referring, for example, from the left.

従って、いまの場合、本来、データが書き込まれるべき物理ブロック(データ領域の対象ブロック)の物理ブロック番号#00と#02が記憶されている、ポインタ領域の物理ブロック#18、および実際にデータが書き込まれた物理ブロックの物理ブロック番号#10と#11が記憶されている、ポインタ領域の物理ブロック#1Aの2個の物理ブロックを変更する必要があるので、第1の領域の、ポインタ領域の更新ブロックへのポインタの欄が左から2バイト分だけ参照され、物理ブロック#1Bと#1Cが更新ブロックとして認識される。   Therefore, in the present case, the physical block # 18 and the physical block # 18 of the pointer area in which the physical block numbers # 00 and # 02 of the physical block (the target block of the data area) to which data is to be originally written are stored. Since it is necessary to change the two physical blocks of the physical block # 1A in the pointer area in which the physical block numbers # 10 and # 11 of the written physical block are stored, the pointer area in the first area The update block pointer field is referenced by 2 bytes from the left, and physical blocks # 1B and # 1C are recognized as update blocks.

そして、認識されたポインタ領域の更新ブロック#1Bまたは#1Cのうち、一方の更新ブロック#1Bには、データ領域の対象ブロックの物理ブロック番号#00と#02が記憶されている、ポインタ領域の物理ブロック#18の記憶内容がコピーされ、そのうちの、データ領域の対象ブロックの物理ブロック番号#00と#02が、実際にデータが書き込まれたデータ領域の更新ブロックの物理ブロック番号#10と#11に書き換えられる。   Of the recognized update blocks # 1B or # 1C in the pointer area, one update block # 1B stores the physical block numbers # 00 and # 02 of the target block in the data area. The storage contents of the physical block # 18 are copied, of which the physical block numbers # 00 and # 02 of the target block of the data area are the physical block numbers # 10 and # of the update block of the data area where the data is actually written. 11 is rewritten.

また、認識されたポインタ領域の更新ブロック#1Bまたは#1Cのうち、他方の更新ブロック#1Cには、実際にデータが書き込まれた物理ブロックの物理ブロック番号#10と#11が記憶されている、ポインタ領域の物理ブロック#1Aの記憶内容がコピーされ、その物理ブロック番号#10と#11が、本来、データが書き込まれるべき物理ブロックの物理ブロック番号(データ領域の対象ブロック)#00と#02に書き換えられる。   Of the recognized update block # 1B or # 1C in the pointer area, the other update block # 1C stores the physical block numbers # 10 and # 11 of the physical block to which data is actually written. The stored contents of the physical block # 1A in the pointer area are copied, and the physical block numbers # 10 and # 11 are the physical block numbers (target blocks in the data area) # 00 and # 11 of the physical block to which data should be originally written. Rewritten to 02.

この後、物理ブロック番号が更新されたポインタ領域の更新ブロックであった物理ブロックのブロック番号#1Bと#1Cが、有効でなかった第2の領域におけるポインタ領域の対象ブロックへのポインタの欄に書き込まれる。すなわち、第1の領域におけるポインタ領域の対象ブロックへのポインタの欄が、第2の領域にコピーされ、そのうちの、論理アドレス%00乃至%07に対応する1バイト目が、ポインタ領域の物理ブロックの物理ブロック番号#1Bに書き換えられるとともに、論理アドレス%10乃至%17に対応する3バイト目が、ポインタ領域の物理ブロックの物理ブロック番号#1Cに書き換えられる。   After this, the block numbers # 1B and # 1C of the physical block that was the updated block of the pointer area whose physical block number has been updated are stored in the column of the pointer to the target block of the pointer area in the second area that was not valid. Written. That is, the column of the pointer to the target block in the pointer area in the first area is copied to the second area, and the first byte corresponding to the logical addresses% 00 to% 07 is the physical block in the pointer area. And the third byte corresponding to the logical addresses% 10 to% 17 is rewritten to the physical block number # 1C of the physical block in the pointer area.

この結果、第2の領域に注目すると、物理ブロック#1B,#19、および#1Cが、ポインタ領域の対象ブロックとなり、これにより、データ領域の更新ブロックであった物理ブロック#10と#11が、データ領域の対象ブロックであった物理ブロック#00と#02が対応付けられていた論理ブロック番号%00と%02に新たに対応付けられる。さらに、データ領域の対象ブロックであった物理ブロック#00と#02は、論理ブロック%10と%11に対応付けられて更新ブロックとされる。   As a result, when focusing on the second area, the physical blocks # 1B, # 19, and # 1C become the target blocks of the pointer area, and thereby the physical blocks # 10 and # 11 that are the update blocks of the data area are changed. The physical blocks # 00 and # 02, which are the target blocks of the data area, are newly associated with the logical block numbers% 00 and% 02 associated with each other. Furthermore, physical blocks # 00 and # 02 that are target blocks in the data area are associated with logical blocks% 10 and% 11 and are updated blocks.

すなわち、第2の領域の、ポインタ領域の対象ブロックへのポインタの欄の1バイト目を参照すると、論理ブロック%00と%02に対応するデータ領域の物理ブロックの物理ブロック番号が記述された、ポインタ領域の物理ブロックは、物理ブロック#1Bということになる。さらに、その物理ブロック#1Bの1バイト目と3バイト目を参照すると、論理ブロック%00と%02に対応するデータ領域の物理ブロックは、それぞれ物理ブロック#10と#11ということになる。   That is, referring to the first byte of the column of the pointer to the target block of the pointer area in the second area, the physical block number of the physical block of the data area corresponding to the logical blocks% 00 and% 02 is described. The physical block in the pointer area is physical block # 1B. Further, referring to the first byte and the third byte of the physical block # 1B, the physical blocks in the data area corresponding to the logical blocks% 00 and% 02 are the physical blocks # 10 and # 11, respectively.

また、第2の領域の、ポインタ領域の対象ブロックへのポインタの欄の3バイト目を参照すると、論理ブロック%10と%11に対応するデータ領域の物理ブロックの物理ブロック番号が記述された、ポインタ領域の物理ブロックは、物理ブロック#1Cということになり、さらに、その物理ブロック#1Cの1バイト目と2バイト目を参照すると、論理ブロック%10と%11に対応するデータ領域の物理ブロック、つまりデータ領域の更新ブロックは、物理ブロック#00と#02ということになる。   Further, referring to the third byte of the pointer field to the target block of the pointer area in the second area, the physical block numbers of the physical blocks of the data area corresponding to the logical blocks% 10 and% 11 are described. The physical block of the pointer area is the physical block # 1C. Further, referring to the first byte and the second byte of the physical block # 1C, the physical block of the data area corresponding to the logical blocks% 10 and% 11 That is, the update blocks in the data area are physical blocks # 00 and # 02.

さらに、ポインタ領域のうちの、本来、データが書き込まれるべき物理ブロックの物理ブロック番号#00と#02が記憶されていた物理ブロックの物理ブロック番号#18、および実際にデータが書き込まれた物理ブロックの物理ブロック番号#10と#11が記憶されていた物理ブロックの物理ブロック番号#1Aが、有効でなかった第2の領域におけるポインタ領域の更新ブロックへのポインタの欄に書き込まれる。   Further, in the pointer area, the physical block number # 18 of the physical block in which the physical block numbers # 00 and # 02 of the physical block to which the data is originally written is stored, and the physical block in which the data is actually written The physical block number # 1A of the physical block in which the physical block numbers # 10 and # 11 are stored is written in the pointer column to the update block of the pointer area in the second area that was not valid.

すなわち、第1の領域におけるポインタ領域の更新ブロックへのポインタの欄が、第2の領域にコピーされ、そのうちの、記憶内容の更新がされたポインタ領域の物理ブロックの物理ブロック番号#1Bまたは#1Cが、図8に示すように、論理アドレス%00乃至%07に対応していた物理ブロック番号が記憶された物理ブロック番号#18、または論理アドレス%10乃至%17に対応していた物理ブロック番号が記憶された物理ブロック番号#1Aに、それぞれ書き換えられる。   That is, the pointer field to the update block in the pointer area in the first area is copied to the second area, and the physical block number # 1B or # of the physical block in the pointer area in which the stored contents are updated is stored. As shown in FIG. 8, 1C is the physical block number # 18 in which the physical block number corresponding to the logical addresses% 00 to% 07 is stored, or the physical block corresponding to the logical addresses% 10 to% 17. Each is rewritten to the physical block number # 1A in which the number is stored.

この結果、第2の領域に注目した場合には、物理ブロック#18,#1A、および#1Dが、ポインタ領域の更新ブロックとなる。   As a result, when attention is paid to the second area, the physical blocks # 18, # 1A, and # 1D become update blocks in the pointer area.

以上のようにして、第2の領域を更新した後は、シングルポインタ方式における場合と同様に、その第2の領域における最新性情報と有効性情報とが順次書き込まれる。   As described above, after the second area is updated, the freshness information and the validity information in the second area are sequentially written in the same manner as in the single pointer method.

そして、その第2の領域における最新性情報と有効性情報とが書き込まれた後に、第1の領域のデータが消去される。   Then, after the latest information and validity information in the second area are written, the data in the first area is erased.

従って、この場合、データ領域、さらにはポインタ領域の書込みが終了しないと、有効である旨の有効性情報は書き込まれない。すなわち、上述の場合においては、2つの論理ブロック%00と%02へのデータの書込みが終了しなければ、第2の領域には、有効である旨の有効性情報は書き込まれない。   Accordingly, in this case, the validity information indicating that the data area is valid is not written unless the writing of the data area and the pointer area is completed. In other words, in the above case, the validity information indicating that the data is valid is not written in the second area unless the data writing to the two logical blocks% 00 and% 02 is completed.

その結果、2つの論理ブロック%00と%02へのデータの書込みが行われている間にメモリコラプションが生じた場合には、第1の領域のみが有効な状態となったままになり、論理ブロック%00と%02からは、有効である第1の領域を参照することで、その論理ブロック%00と%02にそれぞれ対応付けられている物理ブロック#00と#02に記憶されている古いデータが読み出されることになる。   As a result, if memory corruption occurs while data is being written to the two logical blocks% 00 and% 02, only the first area remains valid, From the blocks% 00 and% 02, the old areas stored in the physical blocks # 00 and # 02 respectively associated with the logical blocks% 00 and% 02 are referred to by referring to the valid first area. Data will be read out.

一方、2つの論理ブロック%00と%02へのデータの書込みが終了し、第2の領域における最新性情報と有効性情報の更新が行われた場合には、論理ブロック%00と%02からは、有効であって、且つ、最新である第2の領域を参照することで、その論理ブロック%00と%02にそれぞれ対応付けられている物理ブロック#10と#11に記憶されている新しいデータが読み出されることになる。   On the other hand, when the writing of data to the two logical blocks% 00 and% 02 is completed and the latestness information and validity information in the second area are updated, the logical blocks% 00 and% 02 are updated. Is new and stored in the physical blocks # 10 and # 11 respectively associated with the logical blocks% 00 and% 02 by referring to the second area that is valid and latest. Data will be read out.

従って、この場合、論理ブロック%00と%02に記憶される、複数のデータとしての2つデータが関連性を有するものであるときには、メモリコラプションが生じても、シングルポインタ方式における場合と同様に、その2つのデータの間の整合性を維持することが可能となる。   Therefore, in this case, when two data as a plurality of data stored in the logical blocks% 00 and% 02 are related, even if a memory corruption occurs, the same as in the single pointer method Thus, it becomes possible to maintain the consistency between the two data.

さらに、第1および第2の領域におけるポインタ領域の対象ブロックへのポインタの欄には、ポインタ領域の物理ブロックの3ブロック分の物理ブロック番号を記憶させることができる。また、ポインタ領域の1個の物理ブロックには、データ領域の物理ブロックの8ブロック分の物理ブロック番号を記憶させることができる。   Furthermore, the physical block numbers of three blocks of the physical blocks in the pointer area can be stored in the column of pointers to the target blocks in the pointer area in the first and second areas. In addition, in one physical block in the pointer area, physical block numbers corresponding to 8 blocks in the data area can be stored.

したがって、最大で、データ領域の24(=3×8)個の物理ブロックを管理することができ、そのうちの最大で半分の12ブロックをデータ領域の更新ブロックとすることができる。すなわち、シングルポインタ方式よりも多いブロック数のデータの整合性を維持することができる。   Therefore, 24 (= 3 × 8) physical blocks in the data area can be managed at the maximum, and 12 blocks at the maximum can be used as update blocks in the data area. That is, it is possible to maintain data consistency with a larger number of blocks than in the single pointer method.

なお、図7および図8では、24ブロックのうちの8ブロックを更新ブロックとしてあり、8ブロック分のデータの整合性を維持することができる。   In FIG. 7 and FIG. 8, 8 blocks out of 24 blocks are used as update blocks, and data consistency for 8 blocks can be maintained.

図7および図8を参照して上述したメモリに対する読み書き方式は、データ領域への、いわば2段階のポインタを利用したものであるので、以下、適宜、ダブルポインタ方式と称する。   Since the read / write method for the memory described above with reference to FIGS. 7 and 8 uses a so-called two-stage pointer to the data area, it is hereinafter referred to as a double pointer method as appropriate.

次に、ダブルポインタ方式によるデータの読み書き処理について、図9および図10を参照してさらに説明する。   Next, data read / write processing by the double pointer method will be further described with reference to FIGS.

[ダブルポインタ方式の読み出し処理]
図9は、読み出し処理を説明するフローチャートである。
[Double pointer method read processing]
FIG. 9 is a flowchart for explaining the reading process.

ステップS61において、第1および第2の領域の有効性情報を参照することで、その有効性が判定される。ここで、第1の領域としてのブロックのみが有効であると判定された場合、処理はステップS62に進められる。反対に、第2の領域としてのブロックのみが有効であると判定された場合、処理はステップS65に進められる。なお、第1および第2の領域としてのブロックの両方が無効であると判定された場合、ICカード2のハードウェアとしての寿命(致命的エラー)であるので、読み出しは行われずに処理は終了される(エラー処理が行われる)。   In step S61, the validity is determined by referring to the validity information of the first and second regions. If it is determined that only the block as the first area is valid, the process proceeds to step S62. On the other hand, when it is determined that only the block as the second area is valid, the process proceeds to step S65. If it is determined that both the first and second area blocks are invalid, the life of the IC card 2 as hardware (fatal error) is reached, so the process ends without reading. (Error processing is performed).

第1の領域としてのブロックのみが有効であって、処理がステップS62に進むと、第1の領域におけるポインタ領域の対象ブロックへのポインタの欄を参照することで、読み出すべきデータの論理ブロック番号に対応する物理ブロック番号が記憶されている、ポインタ領域の物理ブロックの物理ブロック番号(ポインタ)が認識される。   When only the block as the first area is valid and the process proceeds to step S62, the logical block number of the data to be read out is referred to by referring to the column of the pointer to the target block in the pointer area in the first area The physical block number (pointer) of the physical block in the pointer area in which the physical block number corresponding to is stored is recognized.

例えば、図7で説明したようにメモリが構成される場合において、読み出すべきデータの論理ブロック番号が%00乃至%07のときには、ポインタ領域の対象ブロックへのポインタの欄の1バイト目に記憶されている物理ブロック番号#18が認識される。また例えば、読み出すべきデータの論理ブロック番号が%08乃至%0Fのときには、ポインタ領域の対象ブロックへのポインタの欄の2バイト目に記憶されている物理ブロック番号#19が認識される。   For example, when the memory is configured as described with reference to FIG. 7, when the logical block number of the data to be read is% 00 to% 07, it is stored in the first byte of the pointer field to the target block in the pointer area. Physical block number # 18 is recognized. For example, when the logical block number of the data to be read is% 08 to% 0F, the physical block number # 19 stored in the second byte of the pointer column to the target block in the pointer area is recognized.

ステップS63においては、ステップS62で認識された物理ブロック番号に対応するポインタ領域の物理ブロックを参照することで、読み出すべきデータの論理ブロック番号に対応する物理ブロック番号が認識される。   In step S63, the physical block number corresponding to the logical block number of the data to be read is recognized by referring to the physical block in the pointer area corresponding to the physical block number recognized in step S62.

すなわち、読み出すべきデータの論理ブロック番号が、ある基準値(図7の場合においては、%00または%08)から0乃至7だけオフセットした値である場合には、ステップS62で認識された物理ブロック番号に対応する物理ブロックの左から、そのオフセット分だけずれた位置に記憶された物理ブロック番号が、読み出すべきデータの論理ブロック番号に対応する物理ブロック番号として認識される。   That is, when the logical block number of the data to be read is a value that is offset by 0 to 7 from a certain reference value (% 00 or% 08 in the case of FIG. 7), the physical block recognized in step S62. The physical block number stored at a position shifted from the left of the physical block corresponding to the number by the offset is recognized as the physical block number corresponding to the logical block number of the data to be read.

ステップS64においては、ステップS63で認識された物理ブロック番号に対応する物理ブロックからデータが読み出されて、この読み出し処理が終了される。   In step S64, data is read from the physical block corresponding to the physical block number recognized in step S63, and this reading process is terminated.

一方、第2の領域としてのブロックのみが有効であって、処理がステップS65に進むと、第2の領域におけるポインタ領域の対象ブロックへのポインタの欄を参照することで、読み2出すべきデータの論理ブロック番号に対応する物理ブロック番号が記憶されている、ポインタ領域の物理ブロックの物理ブロック番号(ポインタ)が認識される。   On the other hand, when only the block as the second area is valid and the process proceeds to step S65, the data to be read out 2 is read by referring to the pointer field to the target block in the pointer area in the second area. The physical block number (pointer) of the physical block in the pointer area in which the physical block number corresponding to the logical block number is stored is recognized.

例えば、図8で説明したようにメモリが構成される場合において、読み出すべきデータの論理ブロック番号が%00乃至%07のときには、ポインタ領域の対象ブロックへのポインタの欄の1バイト目に記憶されている物理ブロック番号#1Bが認識される。また例えば、読み出すべきデータの論理ブロック番号が%08乃至%0Fのときには、ポインタ領域の対象ブロックへのポインタの欄の2バイト目に記憶されている物理ブロック番号#19が認識される。   For example, when the memory is configured as described with reference to FIG. 8, when the logical block number of the data to be read is% 00 to% 07, it is stored in the first byte of the pointer column to the target block in the pointer area. Physical block number # 1B is recognized. For example, when the logical block number of the data to be read is% 08 to% 0F, the physical block number # 19 stored in the second byte of the pointer column to the target block in the pointer area is recognized.

ステップS66においては、ステップS65で認識された物理ブロック番号に対応するポインタ領域の物理ブロックを参照することで、読み出すべきデータの論理ブロック番号に対応する物理ブロック番号が認識される。   In step S66, the physical block number corresponding to the logical block number of the data to be read is recognized by referring to the physical block in the pointer area corresponding to the physical block number recognized in step S65.

すなわち、読み出すべきデータの論理ブロック番号が、ある基準値(図8の場合においては、%00または%08)から0乃至7だけオフセットした値である場合には、ステップS65で認識された物理ブロック番号に対応する物理ブロックの左から、そのオフセット分だけずれた位置に記憶された物理ブロック番号が、読み出すべきデータの論理ブロック番号に対応する物理ブロック番号として認識される。   That is, when the logical block number of the data to be read is a value that is offset by 0 to 7 from a certain reference value (% 00 or% 08 in the case of FIG. 8), the physical block recognized in step S65. The physical block number stored at a position shifted from the left of the physical block corresponding to the number by the offset is recognized as the physical block number corresponding to the logical block number of the data to be read.

ステップS67においては、ステップS66で認識された物理ブロック番号に対応する物理ブロックからデータが読み出されて、この読み出し処理が終了される。   In step S67, data is read from the physical block corresponding to the physical block number recognized in step S66, and this reading process is terminated.

[ダブルポインタ方式の書込み処理]
次に、図10は、書込み処理を説明するフローチャートである。
[Double pointer writing]
Next, FIG. 10 is a flowchart for explaining the writing process.

ステップS31において、第1および第2の領域の有効性情報を参照することで、その有効性が判定される。ここで、第1の領域としてのブロックのみが有効であると判定された場合、処理はステップS32に進められる。反対に、第2の領域としてのブロックのみが有効であると判定された場合、処理はステップS40に進められる。なお、第1および第2の領域としてのブロックの両方が無効であると判定された場合、ICカード2のハードウェアとしての寿命(致命的エラー)であるので、書込みは行われずに処理は終了される(エラー処理が行われる)。   In step S31, the validity is determined by referring to the validity information of the first and second regions. If it is determined that only the block as the first area is valid, the process proceeds to step S32. Conversely, if it is determined that only the block as the second area is valid, the process proceeds to step S40. If it is determined that both of the blocks as the first and second areas are invalid, the life of the IC card 2 as hardware (fatal error) is reached, so the processing ends without writing. (Error processing is performed).

第1の領域のみが有効であって、処理がステップS32に進むと、有効ではない第2の領域のデータが消去されているか否かが判定される。消去されていないと判定された場合、処理はステップS50に進められ、有効ではない第2の領域のデータが消去された後、処理がステップS33に進められる。反対に、消去されていると判定された場合、ステップS50はスキップされて、処理はステップS33に進められる。   When only the first area is valid and the process proceeds to step S32, it is determined whether or not the data of the second area that is not valid has been erased. If it is determined that it has not been erased, the process proceeds to step S50, and after the data in the second area that is not valid is erased, the process proceeds to step S33. On the other hand, if it is determined that it has been erased, step S50 is skipped, and the process proceeds to step S33.

ステップS33においては、第1の領域におけるポインタ領域の対象ブロックへのポインタの欄が参照され、更新ブロックとすることができるデータ領域の物理ブロックの物理ブロック番号が記憶されたポインタ領域の物理ブロックの物理ブロック番号が認識される。すなわち、例えば、図7に示したようにメモリが構成される場合においては、第1の領域におけるポインタ領域の対象ブロックへのポインタの欄の3バイト目に記憶された物理ブロック番号#1Aが認識される。   In step S33, the pointer field to the target block of the pointer area in the first area is referred to and the physical block number of the pointer area in which the physical block number of the physical block of the data area that can be used as the update block is stored. The physical block number is recognized. That is, for example, when the memory is configured as shown in FIG. 7, the physical block number # 1A stored in the third byte of the pointer field to the target block in the pointer area in the first area is recognized. Is done.

ステップS34では、ステップS33で認識された物理ブロック番号に対応する物理ブロック(図7の場合、物理ブロック#1A)に記憶された、データ領域の全ての更新ブロックの物理ブロック番号が参照されて、データ領域の更新ブロックとして認識される。   In step S34, the physical block numbers of all the update blocks in the data area stored in the physical block (in the case of FIG. 7, physical block # 1A) corresponding to the physical block number recognized in step S33 are referred to. Recognized as an update block in the data area.

図7の場合、物理ブロック#1Aに記録されている、物理ブロック番号#1A,#11,#12,#13,#14,#15,#16,#17がデータ領域の更新ブロックとして認識される。   In the case of FIG. 7, physical block numbers # 1A, # 11, # 12, # 13, # 14, # 15, # 16, and # 17 recorded in the physical block # 1A are recognized as update blocks in the data area. The

ステップS35において、データ領域の更新ブロックとして認識された全ての物理ブロックにそれぞれ記録されているデータが一括して消去される。ここで、データを一括して消去することにより、物理ブロックにデータを書込み毎に、その都度、物理ブロックのデータを消去する場合に比較して、処理時間を短縮することができる。   In step S35, data recorded in all physical blocks recognized as update blocks in the data area are erased collectively. Here, by erasing the data all at once, the processing time can be shortened as compared with the case where the data of the physical block is erased each time data is written to the physical block.

この後、ステップS36において、外部などから供給された、書き込むべきデータが、データが一括消去された後のデータ領域の更新ブロックに書き込まれる。   Thereafter, in step S36, the data to be written supplied from the outside or the like is written into the update block in the data area after the data is erased at once.

なお、外部から、複数の論理ブロックに書き込むデータが供給された場合には、ステップS34で認識された物理ブロックに対し、例えば、左から右方向に順次データを書き込むようにする。   When data to be written to a plurality of logical blocks is supplied from the outside, the data is sequentially written from left to right, for example, in the physical block recognized in step S34.

この後、処理はステップS37に進められ、データの書込みの対象とした論理ブロックの論理ブロック番号が対応付けられていた物理ブロック番号を記憶していた物理ブロックが、その一部が更新された状態でポインタ領域の更新ブロックにコピーされる。   Thereafter, the process proceeds to step S37, and a part of the physical block that stores the physical block number associated with the logical block number of the logical block that is the target of data writing has been updated. Is copied to the update block in the pointer area.

すなわち、例えば、図7および図8で説明した場合においては、データの書込みの対象とした論理ブロックの論理ブロック番号%00,%02が対応付けられていた物理ブロック番号#00,#02を記憶していた物理ブロック#18が、記憶している物理ブロック番号#00,#02がそれぞれ#10,#11に更新された状態で、ポインタ領域の更新ブロック#1Bにコピーされる。   That is, for example, in the case described with reference to FIGS. 7 and 8, the physical block numbers # 00 and # 02 associated with the logical block numbers% 00 and% 02 of the logical block to which data is written are stored. The stored physical block # 18 is copied to the update block # 1B in the pointer area in a state where the stored physical block numbers # 00 and # 02 are updated to # 10 and # 11, respectively.

さらに、ステップS37では、データ領域の更新ブロックへのポインタ(データ領域の更新ブロックの物理ブロック番号)を記憶している物理ブロックが、その一部が更新された状態でポインタ領域の更新ブロックにコピーされる。   Further, in step S37, the physical block storing the pointer to the update block in the data area (physical block number of the update block in the data area) is copied to the update block in the pointer area with a part thereof updated. Is done.

すなわち、例えば、図7および図8で説明した場合においては、データ領域の更新ブロックの物理ブロック番号#10乃至#17を記憶している物理ブロック#1Aが、記憶している物理ブロック番号#10,#11がそれぞれ#00,#02に更新された状態で、ポインタ領域の更新ブロック#1Cにコピーされる。   That is, for example, in the case described with reference to FIGS. 7 and 8, the physical block # 1A storing the physical block numbers # 10 to # 17 of the update block of the data area is stored in the physical block number # 10. , # 11 are updated to # 00 and # 02, respectively, and copied to the update block # 1C in the pointer area.

そして、ステップS38に進み、第1の領域におけるポインタ領域の対象ブロックへのポインタの欄、およびポインタ領域の更新ブロックへのポインタの欄が更新され、さらに、その最新性情報および有効性情報を更新したものが、第2の領域にコピーされる。   In step S38, the pointer field to the target block in the pointer area and the pointer field to the update block in the pointer area in the first area are updated, and the latestness information and validity information are updated. Is copied to the second area.

すなわち、例えば、図7および図8の場合を例にすれば、第1の領域におけるポインタ領域の対象ブロックへのポインタの欄については、外部から供給されたデータを書き込む論理ブロックに対応付けられていたデータ領域の物理ブロック#00,#02へのポインタのポインタとなっている1バイト目に記憶されていた物理ブロック番号#18が、実際にデータを書き込んだデータ領域の物理ブロック#10,#11へのポインタのポインタである物理ブロック番号#1Bに更新される。   That is, for example, in the case of FIG. 7 and FIG. 8, the column of the pointer to the target block in the pointer area in the first area is associated with the logical block to which data supplied from the outside is written. The physical block number # 18 stored in the first byte, which is the pointer of the pointer to the physical blocks # 00 and # 02 in the data area, is the physical block # 10 and # in the data area where the data is actually written. 11 is updated to physical block number # 1B which is a pointer of the pointer to 11.

また、実際にデータを書き込んだデータ領域の物理ブロック#10,#11へのポインタのポインタとなっていた物理ブロック番号#1Aが、データを書き込む論理ブロックに対応付けられていたデータ領域の物理ブロック#00,#02へのポインタのポインタとなった物理ブロック番号#1Cに更新される。   In addition, the physical block number # 1A that is the pointer of the pointer to the physical blocks # 10 and # 11 in the data area in which the data is actually written is associated with the logical block in which the data is written. It is updated to the physical block number # 1C that becomes the pointer of the pointer to # 00 and # 02.

さらに、第1の領域におけるポインタ領域の更新ブロックへのポインタの欄については、物理ブロック番号の更新されたポインタ領域の物理ブロック(更新ブロックであった物理ブロック)の物理ブロック番号#1B,#1Cが、ポインタ領域の更新ブロックとなった物理ブロックの物理ブロック番号#18,#1Aにそれぞれ更新される。   Further, for the column of the pointer to the update block of the pointer area in the first area, the physical block numbers # 1B and # 1C of the physical block (physical block that was the update block) of the pointer area with the updated physical block number Are updated to the physical block numbers # 18 and # 1A of the physical block that has become the update block of the pointer area, respectively.

またさらに、第1の領域における最新性情報および有効性情報が更新され、以上の更新結果が、第2の領域に書き込まれる。   Furthermore, the latestness information and validity information in the first area are updated, and the above update result is written in the second area.

この後、処理はステップS78に進み、第1の領域の全てのデータが消去されて、書込み処理が終了される。   Thereafter, the process proceeds to step S78, all data in the first area is erased, and the writing process is ended.

一方、ステップS31において、第2の領域が有効と判断された場合は、ステップS40乃至S47,S52において、第1または第2の領域についての処理が、逆に第2または第1の領域についてそれぞれ行われることを除けば、ステップS32乃至S39,S50における場合とそれぞれ同様の処理が行われて、書込み処理が終了される。   On the other hand, if it is determined in step S31 that the second area is valid, in steps S40 to S47 and S52, the processing for the first or second area is reversed for the second or first area, respectively. Except that it is performed, the same processing as in steps S32 to S39 and S50 is performed, and the writing processing is terminated.

なお、上述した処理のうち、ステップS31乃至S35,S50の処理、およびステップS31,S40乃至S43,S52の処理(以下、コマンド非依存の処理と称する)については、書込みコマンドの有無に拘わらず、予め実行しておくことが可能である。   Of the processes described above, the processes in steps S31 to S35 and S50 and the processes in steps S31, S40 to S43 and S52 (hereinafter referred to as command-independent processes) are performed regardless of the presence or absence of a write command. It is possible to execute in advance.

そこで、例えば、R/W12からポーリングを受けた直後にコマンド非依存の処理を実行しておけば、実際に書込みコマンドが指示された場合、書込み処理に要する処理時間を短縮することができる。   Thus, for example, if a command-independent process is executed immediately after receiving a poll from the R / W 12, when a write command is actually instructed, the processing time required for the write process can be shortened.

ところで、メモリコラプションが発生している場合、ステップS31では、第1の領域と第2の領域の両方が有効と判定され、この場合、処理はステップS48に進められる。   By the way, when memory corruption has occurred, it is determined in step S31 that both the first area and the second area are valid, and in this case, the process proceeds to step S48.

ステップS48においては、第1の領域と第2の領域との最新性が判定される。ここで、第1の領域の方が第2の領域より新しいと判定された場合、処理はステップS49に進められ、第2の領域よりも新しい第1の領域としてのブロックに、第2の領域の中のポインタ領域へのポインタが上書きされる。さらに、第1の領域の最新性情報および有効性情報が更新される。この後、処理はステップS50に進められて、それ以降、上述した場合と同様の処理が行われる。   In step S48, the freshness of the first area and the second area is determined. If it is determined that the first area is newer than the second area, the process proceeds to step S49, and the second area is changed to a block as the first area that is newer than the second area. The pointer to the pointer area in is overwritten. Furthermore, the freshness information and validity information of the first area are updated. Thereafter, the process proceeds to step S50, and thereafter, the same process as described above is performed.

反対に、第2の領域の方が第1の領域より新しいと判定された場合、処理はステップS89に進められ、第1の領域よりも新しい第2の領域としてのブロックに、第1の領域の中のポインタ領域へのポインタが上書きされる。さらに、第2の領域の最新性情報および有効性情報が更新される。この後、処理はステップS52に進められて、それ以降、上述した場合と同様の処理が行われる。   On the other hand, when it is determined that the second area is newer than the first area, the process proceeds to step S89, and the first area is changed to a block as a second area that is newer than the first area. The pointer to the pointer area in is overwritten. Further, the latestness information and validity information of the second area are updated. Thereafter, the process proceeds to step S52, and thereafter, the same process as described above is performed.

以上説明した書込み処理によれば、今度においてデータを書き込む可能性があるデータ領域の全ての更新ブロックを、一括して消去するようにしたので、更新ブロックにデータを書き込む都度、消去する場合に比較して、消去に要する処理時間を短くすることができる。よって、書込み処理に要する一連の処理時間を短縮することができる。 According to the writing process described above, all the update blocks in the data area where data may be written will be erased all at once. Compared with the case where data is erased each time data is written to the update block. Thus, the processing time required for erasing can be shortened. Therefore, a series of processing time required for the writing process can be shortened.

また、書込み処理のうち、コマンド非依存の処理を事前に実行するようにすれば、実際に書込みコマンドが指示されてから書込み処理を終了するまでに要する処理時間を短縮することができる。   In addition, if command-independent processing is executed in advance in the write processing, the processing time required from when the write command is actually instructed until the write processing is completed can be shortened.

以上、本発明を非接触通信システムに適用した場合について説明したが、本発明は、EEPROMに代表されるような、データを書き込む場合、データ領域を、その書込みに先立って消去する必要のある記録媒体にデータを書き込むあらゆる装置に適用することができる。   As described above, the case where the present invention is applied to a non-contact communication system has been described. However, the present invention, as represented by an EEPROM, records data that needs to be erased prior to the writing when data is written. It can be applied to any device that writes data to a medium.

また、本発明は、特に、例えば、上述の非接触通信システムや、また、接触型であっても、ユーザがICカードの抜き差しを自由に行うことができるシステムなどの、いわば、データの送受信が不安定な状態で行われるシステムについて、有用である。   In addition, the present invention is particularly capable of transmitting and receiving data such as the above-described contactless communication system and a system that allows a user to freely insert and remove an IC card even in a contact type. Useful for systems that run in an unstable state.

なお、本実施の形態では、有効判定ブロックまたはポインタ領域に、ポインタ領域またはデータ領域の、いわば空き領域としての、ポインタ領域の更新ブロックの物理ブロック番号、またはデータ領域の更新ブロックの物理ブロック番号をそれぞれ記憶させるようにした。しかしながら、これらの更新ブロックの物理ブロック番号は、必ずしも記憶させる必要はない。ただし、更新ブロックの物理ブロック番号を記憶させておかない場合には、データの書込みの際に、更新ブロックとなる物理ブロックを、EEPROM66の記憶内容をサーチすることにより検出する必要があるため、処理の高速化などの観点からは、更新ブロックの物理ブロック番号を記憶させておくようにするのが望ましい。   In the present embodiment, the physical block number of the update block in the pointer area or the physical block number of the update block in the data area as the empty area of the pointer area or the data area, or the physical block number of the update block in the data area is indicated in the validity determination block or pointer area Each was memorized. However, the physical block numbers of these update blocks are not necessarily stored. However, if the physical block number of the update block is not stored, it is necessary to detect the physical block to be the update block by searching the storage content of the EEPROM 66 when data is written. From the standpoint of speeding up, it is desirable to store the physical block number of the update block.

また、本実施の形態では、EEPROM66の所定の位置に、有効判定ブロックを記憶させる領域、ポインタ領域、およびデータ領域を割り当てるようにしたが、これらの領域を割り当てる位置は、特に限定されるものではない。さらに、これらの領域は、EEPROM66に連続した範囲の領域として確保する必要もない。すなわち、有効判定ブロックを記憶させる領域、ポインタ領域、またはデータ領域それぞれは、EEPROM上の不連続な位置に確保することが可能である。   In the present embodiment, an area for storing the validity determination block, a pointer area, and a data area are allocated to predetermined positions in the EEPROM 66. However, the positions to which these areas are allocated are not particularly limited. Absent. Further, it is not necessary to secure these areas as areas in a continuous range with the EEPROM 66. That is, the area for storing the validity determination block, the pointer area, or the data area can be secured at discontinuous positions on the EEPROM.

さらに、本実施の形態では、EEPROM66に、前回の記憶内容のみを保持しておくようにしたが、その他、例えば、前回と前々回の記憶内容を保持しておくようにすることなども可能である。ただし、この場合、より多くの記憶容量が必要となる。   Furthermore, in the present embodiment, only the previous storage contents are stored in the EEPROM 66, but other storage contents, for example, the previous storage time and the previous storage time can also be stored. . In this case, however, more storage capacity is required.

ところで、上述した一連の処理は、ハードウェアにより実行することもできるし、ソフトウェアにより実行することもできる。   By the way, the above-described series of processing can be executed by hardware or can be executed by software.

なお、コンピュータが実行するプログラムは、本明細書で説明する順序に沿って時系列に処理が行われるプログラムであってもよいし、並列に、あるいは呼び出しが行われたとき等の必要なタイミングで処理が行われるプログラムであってもよい。   The program executed by the computer may be a program that is processed in time series in the order described in this specification, or in parallel or at a necessary timing such as when a call is made. It may be a program for processing.

また、プログラムは、1台のコンピュータにより処理されるものであってもよいし、複数のコンピュータによって分散処理されるものであってもよい。さらに、プログラムは、遠方のコンピュータに転送されて実行されるものであってもよい。   The program may be processed by a single computer, or may be distributedly processed by a plurality of computers. Furthermore, the program may be transferred to a remote computer and executed.

また、本明細書において、システムとは、複数の装置により構成される装置全体を表すものである。   Further, in this specification, the system represents the entire apparatus constituted by a plurality of apparatuses.

なお、本発明の実施の形態は、上述した実施の形態に限定されるものではなく、本発明の要旨を逸脱しない範囲において種々の変更が可能である。   The embodiment of the present invention is not limited to the above-described embodiment, and various modifications can be made without departing from the gist of the present invention.

10 非接触通信システム, 11 コントローラ, 12 リーダ/ライタ, 13 ICカード, 64 演算部, 91 シーケンサ, 92 暗号/復号部, 93 パリティ演算部, 66 EEPROM   10 contactless communication system, 11 controller, 12 reader / writer, 13 IC card, 64 operation unit, 91 sequencer, 92 encryption / decryption unit, 93 parity operation unit, 66 EEPROM

Claims (6)

所定のブロック単位で情報が記録される記録媒体を用いた情報処理装置の情報処理方法において、
前記記録媒体は、
複数のブロックから構成され、
前記ブロック単位でデータを記憶するデータ領域と、
前記データ領域の各ブロックに割当てられた複数のブロック番号を記憶するポインタ領域と、
更新前のデータが記憶されている前記データ領域の対象ブロックを指示する前記ポインタ領域のブロック番号を示す第1のブロック番号、更新後のデータが記憶される前記データ領域の更新ブロックを指示する前記ポインタ領域のブロック番号を示す第2のブロック番号、並びに記憶内容の新しさに関する最新情報とを記憶する第1の領域と
を有し、
前記情報処理装置による、
前記第1の領域に記憶されている前記第2のブロック番号に対応する前記ポインタ領域が記憶するブロック番号に対応する前記データ領域の全ての前記更新ブロックに記憶されているデータを一括して消去させる第1の消去ステップと、
一括して消去された、前記第2のブロック番号に対応する前記ポインタ領域が記憶するブロック番号に対応する前記データ領域の全ての前記更新ブロックの少なくとも一部に更新後のデータを書込ませる書込みステップと、
前記更新後のデータが書き込まれたデータ領域のブロックのブロック番号を、前記ポインタ領域の前記第1のブロック番号に対応するブロックに記憶させる第1の記憶ステップと、
データ領域のブロック番号を記憶させたポインタ領域の第1のブロック番号を、前記第1の領域に記憶させる第2の記憶ステップと
を含む情報処理方法。
In an information processing method of an information processing apparatus using a recording medium on which information is recorded in a predetermined block unit,
The recording medium is
Consists of multiple blocks,
A data area for storing data in block units;
A pointer area for storing a plurality of block numbers assigned to each block of the data area;
A first block number indicating a block number of the pointer area indicating the target block of the data area in which data before update is stored, and an update block in the data area in which data after update is stored A first area for storing the second block number indicating the block number of the pointer area, and the latest information on the freshness of the stored contents;
According to the information processing apparatus,
Erase data stored in all the update blocks in the data area corresponding to the block number stored in the pointer area corresponding to the second block number stored in the first area in a batch A first erasing step that causes
Write to which updated data is written in at least a part of all the update blocks in the data area corresponding to the block number stored in the pointer area corresponding to the second block number, which is erased in a batch Steps,
A first storage step of storing a block number of a block of the data area in which the updated data is written in a block corresponding to the first block number of the pointer area;
A second storage step of storing a first block number of the pointer area in which the block number of the data area is stored in the first area.
前記記録媒体は、さらに、
更新前のデータが記憶されている前記データ領域の対象ブロックを指示する前記ポインタ領域のブロック番号を示す第1のブロック番号、更新後のデータが記憶される前記データ領域の更新ブロックを指示する前記ポインタ領域のブロック番号を示す第2のブロック番号、並びに記憶内容の新しさに関する最新情報とを記憶する第2の領域を
有し、
前記情報処理装置による、
前記第1の消去ステップは、前記最新情報に基づいて選択された前記第1または第2の領域の一方に記憶されている前記第2のブロック番号に対応する前記ポインタ領域が記憶するブロック番号に対応する前記データ領域の全ての前記更新ブロックに記憶されているデータを一括して消去させ、
前記第2の記憶ステップは、データ領域のブロック番号を記憶させたポインタ領域の第1のブロック番号を、前記第1または第2の領域の他方に記憶させ、
前記第2の記憶ステップの後、前記第1または第2の領域の前記一方に記憶されている前記第1および第2のブロック番号、並びに前記最新情報を消去させる第2の消去ステップをさらに含む
請求項1に記載の情報処理方法。
The recording medium further includes:
A first block number indicating a block number of the pointer area indicating the target block of the data area in which data before update is stored, and an update block in the data area in which data after update is stored A second area for storing the second block number indicating the block number of the pointer area, and the latest information on the freshness of the stored contents;
According to the information processing apparatus,
The first erasing step uses a block number stored in the pointer area corresponding to the second block number stored in one of the first or second areas selected based on the latest information. The data stored in all the update blocks in the corresponding data area are erased collectively,
The second storing step stores the first block number of the pointer area in which the block number of the data area is stored in the other of the first or second area,
After the second storing step, the method further includes a second erasing step for erasing the first and second block numbers and the latest information stored in the one of the first or second areas. The information processing method according to claim 1.
前記第1の消去ステップの処理、および前記書込みステップの処理は、書込みコマンドに応じて実行される
請求項2に記載の情報処理方法。
The information processing method according to claim 2, wherein the processing of the first erasing step and the processing of the writing step are executed according to a write command.
前記書込みステップの処理は、書込みコマンドに応じて実行され、
前記第1の消去ステップの処理は、前記書込みコマンドの有無に拘わらず、前記書込みステップの処理に先行した所定タイミングで実行される
請求項2に記載の情報処理方法。
The processing of the writing step is executed according to a write command,
3. The information processing method according to claim 2, wherein the process of the first erasing step is executed at a predetermined timing preceding the process of the write step regardless of the presence or absence of the write command.
所定のブロック単位で情報が記録される記録媒体に対して情報を記録する情報処理装置において、
前記記録媒体は、
複数のブロックから構成され、
前記ブロック単位でデータを記憶するデータ領域と、
前記データ領域の各ブロックに割当てられた複数のブロック番号を記憶するポインタ領域と、
更新前のデータが記憶されている前記データ領域の対象ブロックを指示する前記ポインタ領域のブロック番号を示す第1のブロック番号、更新後のデータが記憶される前記データ領域の更新ブロックを指示する前記ポインタ領域のブロック番号を示す第2のブロック番号、並びに記憶内容の新しさに関する最新情報とを記憶する第1の領域と
を有し、
前記第1の領域に記憶されている前記第2のブロック番号に対応する前記ポインタ領域が記憶するブロック番号に対応する前記データ領域の全ての前記更新ブロックに記憶されているデータを一括して消去させる第1の消去手段と、
一括して消去された、前記第2のブロック番号に対応する前記ポインタ領域が記憶するブロック番号に対応する前記データ領域の全ての前記更新ブロックの少なくとも一部に更新後のデータを書込ませる書込み手段と、
前記更新後のデータが書き込まれたデータ領域のブロックのブロック番号を、前記ポインタ領域の前記第1のブロック番号に対応するブロックに記憶させる第1の記憶手段と、
データ領域のブロック番号を記憶させたポインタ領域の第1のブロック番号を、前記第1の領域に記憶させる第2の記憶手段と
を含む情報処理装置。
In an information processing apparatus for recording information on a recording medium on which information is recorded in predetermined block units,
The recording medium is
Consists of multiple blocks,
A data area for storing data in block units;
A pointer area for storing a plurality of block numbers assigned to each block of the data area;
A first block number indicating a block number of the pointer area indicating the target block of the data area in which data before update is stored, and an update block in the data area in which data after update is stored A first area for storing the second block number indicating the block number of the pointer area, and the latest information on the freshness of the stored contents;
Erase data stored in all the update blocks in the data area corresponding to the block number stored in the pointer area corresponding to the second block number stored in the first area in a batch First erasing means for causing,
Write to which updated data is written in at least a part of all the update blocks in the data area corresponding to the block number stored in the pointer area corresponding to the second block number, which is erased in a batch Means,
First storage means for storing a block number of a block of the data area in which the updated data is written in a block corresponding to the first block number of the pointer area;
An information processing apparatus comprising: a second storage unit configured to store a first block number of a pointer area in which a block number of a data area is stored in the first area.
所定のブロック単位で情報が記録される記録媒体を用いた情報処理装置の制御用のプログラムであって、
前記記録媒体は、
複数のブロックから構成され、
前記ブロック単位でデータを記憶するデータ領域と、
前記データ領域の各ブロックに割当てられた複数のブロック番号を記憶するポインタ領域と、
更新前のデータが記憶されている前記データ領域の対象ブロックを指示する前記ポインタ領域のブロック番号を示す第1のブロック番号、更新後のデータが記憶される前記データ領域の更新ブロックを指示する前記ポインタ領域のブロック番号を示す第2のブロック番号、並びに記憶内容の新しさに関する最新情報とを記憶する第1の領域と
を有し、
前記第1の領域に記憶されている前記第2のブロック番号に対応する前記ポインタ領域が記憶するブロック番号に対応する前記データ領域の全ての前記更新ブロックに記憶されているデータを一括して消去させる第1の消去ステップと、
一括して消去された、前記第2のブロック番号に対応する前記ポインタ領域が記憶するブロック番号に対応する前記データ領域の全ての前記更新ブロックの少なくとも一部に更新後のデータを書込ませる書込みステップと、
前記更新後のデータが書き込まれたデータ領域のブロックのブロック番号を、前記ポインタ領域の前記第1のブロック番号に対応するブロックに記憶させる第1の記憶ステップと、
データ領域のブロック番号を記憶させたポインタ領域の第1のブロック番号を、前記第1の領域に記憶させる第2の記憶ステップと
を含む処理を情報処理装置のコンピュータに実行させるプログラム。
A program for controlling an information processing apparatus using a recording medium on which information is recorded in predetermined block units,
The recording medium is
Consists of multiple blocks,
A data area for storing data in block units;
A pointer area for storing a plurality of block numbers assigned to each block of the data area;
A first block number indicating a block number of the pointer area indicating the target block of the data area in which data before update is stored, and an update block in the data area in which data after update is stored A first area for storing the second block number indicating the block number of the pointer area, and the latest information on the freshness of the stored contents;
Erase data stored in all the update blocks in the data area corresponding to the block number stored in the pointer area corresponding to the second block number stored in the first area in a batch A first erasing step that causes
Write to which updated data is written in at least a part of all the update blocks in the data area corresponding to the block number stored in the pointer area corresponding to the second block number, which is erased in a batch Steps,
A first storage step of storing a block number of a block of the data area in which the updated data is written in a block corresponding to the first block number of the pointer area;
A program for causing a computer of an information processing device to execute a process including a second storage step of storing a first block number of a pointer area in which a block number of a data area is stored in the first area.
JP2009176667A 2009-07-29 2009-07-29 Information processing method, information processing apparatus, and program Expired - Fee Related JP5633125B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2009176667A JP5633125B2 (en) 2009-07-29 2009-07-29 Information processing method, information processing apparatus, and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2009176667A JP5633125B2 (en) 2009-07-29 2009-07-29 Information processing method, information processing apparatus, and program

Publications (3)

Publication Number Publication Date
JP2011034125A true JP2011034125A (en) 2011-02-17
JP2011034125A5 JP2011034125A5 (en) 2012-09-06
JP5633125B2 JP5633125B2 (en) 2014-12-03

Family

ID=43763174

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2009176667A Expired - Fee Related JP5633125B2 (en) 2009-07-29 2009-07-29 Information processing method, information processing apparatus, and program

Country Status (1)

Country Link
JP (1) JP5633125B2 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104616467A (en) * 2014-11-12 2015-05-13 江苏大学 Electric vehicle braking energy recovery system data acquisition method
KR20200050379A (en) * 2018-10-31 2020-05-11 이엠. 마이크로일레크트로닉-마린 쏘시에떼 아노님 Anti-tearing protection system for non-volatile memories

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0973798A (en) * 1995-08-31 1997-03-18 Hitachi Ltd Flash memory and data processor
JPH10240631A (en) * 1997-02-28 1998-09-11 Sony Corp Information processing method and information processor
JPH1125003A (en) * 1997-07-09 1999-01-29 Sony Corp Method and device for information processing
JP2002343089A (en) * 2001-05-16 2002-11-29 Toyo Commun Equip Co Ltd Write-in method for data of flash memory
JP2003150458A (en) * 2001-11-14 2003-05-23 Matsushita Electric Ind Co Ltd Fault detector, fault detecting method, program and program recording medium
JP2005235028A (en) * 2004-02-23 2005-09-02 Sony Corp Information processor, information processing method, and computer program

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0973798A (en) * 1995-08-31 1997-03-18 Hitachi Ltd Flash memory and data processor
JPH10240631A (en) * 1997-02-28 1998-09-11 Sony Corp Information processing method and information processor
JPH1125003A (en) * 1997-07-09 1999-01-29 Sony Corp Method and device for information processing
JP2002343089A (en) * 2001-05-16 2002-11-29 Toyo Commun Equip Co Ltd Write-in method for data of flash memory
JP2003150458A (en) * 2001-11-14 2003-05-23 Matsushita Electric Ind Co Ltd Fault detector, fault detecting method, program and program recording medium
JP2005235028A (en) * 2004-02-23 2005-09-02 Sony Corp Information processor, information processing method, and computer program

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104616467A (en) * 2014-11-12 2015-05-13 江苏大学 Electric vehicle braking energy recovery system data acquisition method
KR20200050379A (en) * 2018-10-31 2020-05-11 이엠. 마이크로일레크트로닉-마린 쏘시에떼 아노님 Anti-tearing protection system for non-volatile memories
KR102276774B1 (en) 2018-10-31 2021-07-13 이엠. 마이크로일레크트로닉-마린 쏘시에떼 아노님 Anti-tearing protection system for non-volatile memories
US11392449B2 (en) 2018-10-31 2022-07-19 Em Microelectronic-Marin S.A. Anti-tearing protection system for non-volatile memories

Also Published As

Publication number Publication date
JP5633125B2 (en) 2014-12-03

Similar Documents

Publication Publication Date Title
US7478270B2 (en) Information processing device and information processing method for data recovery after failure
JP3721725B2 (en) Information processing method and information processing apparatus
US9785780B2 (en) Information processing apparatus and method, recording medium, and program
JP2010182270A (en) Mobile electronic apparatus and data management method in mobile electronic apparatus
US7017825B2 (en) IC card and data processing method therefor
KR100498520B1 (en) Information processing method and information processing device
US20020026564A1 (en) Information processing method and information processing apparatus
JP5633125B2 (en) Information processing method, information processing apparatus, and program
KR100273614B1 (en) Ic card
JP4776462B2 (en) Portable electronic device and method for controlling portable electronic device
JP2008310596A (en) Portable electronic equipment and control method for potable electronic equipment
JP5464066B2 (en) Communication device and communication method
JP2007310590A (en) Radio tag system, radio tag data writing method, radio tag reader/writer device and radio tag
JP5742976B2 (en) Communication device, communication method, and wireless tag
US20050262315A1 (en) Mobile electronic device
JPH1027225A (en) Memory management system for non-contact ic card
JP2003178281A (en) Ic card and its information processing method
JP3920166B2 (en) IC card and information processing method thereof
JP5664807B2 (en) Communication device, communication method, and wireless tag
JP2009075816A (en) Portable electronic device, and method of managing data in portable electronic device

Legal Events

Date Code Title Description
A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20120724

A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20120724

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20130809

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20130905

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20131028

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20140318

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20140618

A911 Transfer of reconsideration by examiner before appeal (zenchi)

Free format text: JAPANESE INTERMEDIATE CODE: A911

Effective date: 20140626

A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20140916

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20140929

LAPS Cancellation because of no payment of annual fees