JP2008310596A - Portable electronic equipment and control method for potable electronic equipment - Google Patents

Portable electronic equipment and control method for potable electronic equipment Download PDF

Info

Publication number
JP2008310596A
JP2008310596A JP2007157871A JP2007157871A JP2008310596A JP 2008310596 A JP2008310596 A JP 2008310596A JP 2007157871 A JP2007157871 A JP 2007157871A JP 2007157871 A JP2007157871 A JP 2007157871A JP 2008310596 A JP2008310596 A JP 2008310596A
Authority
JP
Japan
Prior art keywords
data
area
written
card
block
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.)
Pending
Application number
JP2007157871A
Other languages
Japanese (ja)
Inventor
Satoru Sekiya
哲 関谷
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.)
Toshiba Corp
Original Assignee
Toshiba 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 Toshiba Corp filed Critical Toshiba Corp
Priority to JP2007157871A priority Critical patent/JP2008310596A/en
Publication of JP2008310596A publication Critical patent/JP2008310596A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Techniques For Improving Reliability Of Storages (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To provide an IC card 1 and an IC card processing system for easily detecting a region in a non-written state, and for efficiently resuming write-in processing even when an error such as a communication error is occurred in the middle of the write processing of data whose size is large. <P>SOLUTION: In performing the write processing of data whose size is so large that the data cannot be completely stored in a working memory 13 as a buffer memory in a batch in a data memory 14, an IC card 1 sets each flag set so as to be associated with each block each time the write processing of each block acquired by dividing a data area in which the data are stored into a plurality of blocks is completed. In investigating the position in a non-written state in the data area, the IC card 1 decides the region (block) in the non-written state by checking each flag in the data area. <P>COPYRIGHT: (C)2009,JPO&INPIT

Description

本発明は、例えば、個人情報あるいは取引情報などが記憶されているICチップが内蔵されているICカードあるいはICタグなどの携帯可能電子装置、および、上記携帯可能電子装置の制御方法などに関する。   The present invention relates to a portable electronic device such as an IC card or IC tag in which an IC chip storing personal information or transaction information is stored, and a control method for the portable electronic device.

近年、ICカードなどの携帯可能電子装置は、様々な用途に利用されている。このようなICカードには、使用用途に応じた個人情報や金銭的な取引情報などの種々のデータが記憶される。上記のようなデータは、通常、ICカード内に設けられているEEPROMやフラッシュROMなどの不揮発性メモリに書込まれる。また、ICカードは、外部装置からのコマンドに応じて不揮発性メモリへのデータ書込み処理などを実行するようになっている。不揮発性メモリに書込むべきデータの量が多い場合、上記ICカード内の受信データ格納用のメモリ(受信バッファ)では、全ての書込みデータを保持することができない。このため、ICカードでは、分割された書込みデータを順次受信して不揮発性メモリへの書込み処理を行う。上記のような大量のデータを不揮発性メモリに書込み処理は、長い処理時間を要する。このため、不揮発性メモリへのデータ書込みに要する処理時間を短縮したり、処理を簡略化する技術が要望されている。   In recent years, portable electronic devices such as IC cards have been used for various purposes. Such an IC card stores various data such as personal information and financial transaction information according to usage. The above data is usually written in a nonvolatile memory such as an EEPROM or a flash ROM provided in the IC card. Further, the IC card executes data write processing to the nonvolatile memory in response to a command from an external device. When the amount of data to be written in the nonvolatile memory is large, all the write data cannot be held in the reception data storage memory (reception buffer) in the IC card. For this reason, the IC card sequentially receives the divided write data and performs a write process to the nonvolatile memory. Writing such a large amount of data into the nonvolatile memory requires a long processing time. Therefore, there is a demand for a technique for shortening the processing time required for writing data to the nonvolatile memory and simplifying the processing.

従来、受信バッファに格納しきれないような大量のデータを不揮発性メモリに書込み処理としては、ICカードにおいて不揮発性メモリへのデータ書込み処理と外部装置とのデータ通信(書込みデータの受信処理)とを並行して行う技術が提案されている(たとえば、特許文献1)。このような技術では、不揮発性メモリにデータを書込む処理と並行して書込みデータの受信処理を行うことにより、全データの書込み処理に要する時間を短縮することが目的となっている。しかしながら、上記のような技術を適用しても、従来のICカードでは、データの書込み処理が途中でエラーとなってしまった場合、最初から書込み処理を再実行するか、エラーが発生した位置を精査してエラーが発生した位置から書込み処理を行う必要がある。
特開2002−352747号公報
Conventionally, as a process of writing a large amount of data that cannot be stored in the reception buffer to the nonvolatile memory, the data writing process to the nonvolatile memory in the IC card and the data communication with the external device (the reception process of the write data) A technique for performing the above in parallel has been proposed (for example, Patent Document 1). The purpose of such a technique is to reduce the time required for the writing process of all data by performing the receiving process of the writing data in parallel with the process of writing the data to the nonvolatile memory. However, even if the above-described technology is applied, in the case of a conventional IC card, if an error occurs in the data writing process, the writing process is re-executed from the beginning or the position where the error has occurred is determined. It is necessary to perform the writing process from the position where the error occurred after careful examination.
JP 2002-352747 A

この発明の一形態は、サイズの大きなデータをメモリに書込む処理を効率的に行うことができる携帯可能電子装置および携帯可能電子装置の制御方法を提供することを目的とする。   An object of one embodiment of the present invention is to provide a portable electronic device and a method for controlling the portable electronic device that can efficiently perform processing of writing large-size data into a memory.

この発明の一形態としての携帯可能電子装置は、外部装置から供給されるコマンドに応じて動作するものにおいて、複数のブロック領域と各ブロックに対応づけられている複数のフラグ領域とからなるデータ領域を有する記憶手段と、前記外部装置から前記データ領域へのデータの書込みを要求する命令が与えられた場合、各ブロック領域にデータを書込むごとに対応する各フラグ領域にデータが書込み済みであることを示す情報を書込む書込み手段と、前記フラグ領域に格納されている情報に基づいて前記データ領域における各ブロック領域のうちデータが未書込み状態のブロック領域を検出する検出手段と、この検出手段により検出された未書込み状態のブロック領域を示す情報を前記外部装置へ出力する出力手段とを有する。   A portable electronic device according to one aspect of the present invention operates in response to a command supplied from an external device, and includes a data region including a plurality of block regions and a plurality of flag regions associated with each block. When an instruction for requesting writing of data to the data area is given from the external device and data is written to each corresponding flag area every time data is written to each block area Writing means for writing information indicating that, detecting means for detecting a block area in which no data is written among the block areas in the data area based on the information stored in the flag area, and the detecting means Output means for outputting to the external device information indicating the unwritten block area detected by.

この発明の一形態としての携帯可能電子装置の制御方法は、外部装置から供給されるコマンドに応じて動作する携帯可能電子装置に用いられる方法であって、前記外部装置から複数のブロック領域と各ブロック領域に対応づけられている複数のフラグ領域とを有するデータ領域へのデータの書込みを要求する命令が与えられた場合、前記データを各ブロック領域に順次書込み、前記各ブロック領域にデータを書込むごとに対応する各フラグ領域にデータが書込み済みであることを示す情報を書込み、前記データ領域への前記データの書込みがエラーとなった場合、前記各フラグ領域に格納されている情報に基づいて前記データ領域における各ブロック領域のうちデータが未書込み状態のブロック領域を検出し、この検出された未書込み状態のブロック領域を示す情報を前記外部装置へ出力する。   A method for controlling a portable electronic device according to an aspect of the present invention is a method used for a portable electronic device that operates in response to a command supplied from an external device, and includes a plurality of block regions and each of the blocks from the external device. When an instruction is given to write data to a data area having a plurality of flag areas associated with the block area, the data is sequentially written to each block area and the data is written to each block area. Information indicating that data has already been written to each corresponding flag area, and when writing the data to the data area results in an error, based on the information stored in each flag area The block area in which the data is not yet written is detected from the block areas in the data area, and the detected unwritten state is detected. Information indicating the lock area output to the external device.

この発明の一形態によれば、サイズの大きなデータをメモリに書込む処理を効率的に行うことができる携帯可能電子装置および携帯可能電子装置の制御方法を提供できる。   According to one embodiment of the present invention, it is possible to provide a portable electronic device and a method for controlling the portable electronic device that can efficiently perform processing for writing large-size data into a memory.

以下、この発明に係る実施の形態について図面を参照しつつ説明する。
図1は、この発明の実施の形態に係る携帯可能電子装置としてのICカード1およびICカード1を含むICカードシステムの構成例を示すブロック図である。
上記ICカード1は、外部装置としてのICカード処理装置2からの電源供給により動作可能な状態となる。動作可能となったICカード1は、上記ICカード処理装置2からのコマンドに応じて種々の処理を行う。上記ICカード処理装置2は、ICカード1を動作させるための電源を供給するとともに、当該ICカード1に対して種々の処理を要求するコマンドを供給する。上記ICカード処理装置2がICカード1に対して供給するコマンドは、用途あるいは運用形態などに応じた処理を要求するものである。
Embodiments according to the present invention will be described below with reference to the drawings.
FIG. 1 is a block diagram showing a configuration example of an IC card 1 as a portable electronic device and an IC card system including the IC card 1 according to an embodiment of the present invention.
The IC card 1 becomes operable by power supply from the IC card processing device 2 as an external device. The operable IC card 1 performs various processes in response to commands from the IC card processing device 2. The IC card processing device 2 supplies power for operating the IC card 1 and supplies commands for requesting various processing to the IC card 1. The command that the IC card processing device 2 supplies to the IC card 1 requests processing according to the application or operation mode.

また、上記ICカード1は、アンテナあるいは無線通信部等により上記ICカード処理装置2と非接触の状態で無線通信を行う非接触式の携帯可能電子装置(非接触式ICカード)であっても良し、上記ICカード処理装置2と物理的に接触して通信を行う接触式の携帯可能電子装置(接触式ICカード)であっても良い。さらには、上記ICカード1は、非接触式ICカードとしての通信機能と接触式ICカードとしての通信機能とを有する複合型のICカード(デュアルインターフェースICカード)であっても良い。なお、この実施の形態では、主に、非接触式ICカードを想定して説明する。非接触式ICカードと接触式ICカードとはICカード処理装置2との通信方式等が異なるだけである。このため、以下に説明する実施の形態は、接触式ICカードにも同様に適用できる。   The IC card 1 may be a non-contact portable electronic device (non-contact IC card) that performs wireless communication in a non-contact state with the IC card processing device 2 by an antenna or a wireless communication unit. A contact-type portable electronic device (contact-type IC card) that performs physical contact with the IC card processing device 2 may be used. Furthermore, the IC card 1 may be a composite IC card (dual interface IC card) having a communication function as a non-contact IC card and a communication function as a contact IC card. In this embodiment, a description will be given mainly assuming a non-contact IC card. The non-contact type IC card and the contact type IC card differ only in the communication method and the like with the IC card processing device 2. For this reason, the embodiment described below can be similarly applied to a contact type IC card.

上記ICカード1の構成例について説明する。
図1に示すように、上記ICカード1は、制御素子11、プログラムメモリ12、ワーキングメモリ13、データメモリ14、通信制御部15、電源部16、および、インターフェース(アンテナあるいはコンタクト部)17などを有している。
また、上記ICカード1は、カード状の本体Cにより構成される。上記ICカード1を形成するカード状の本体Cには、1つ(あるいは複数)のICチップ1aとインターフェース17とが埋設される。上記ICチップ1aは、制御素子11、プログラムメモリ12、ワーキングメモリ13、データメモリ14、通信制御部15および電源部16などを有している。上記ICチップ1aは、上記インターフェース17に接続された状態でモジュール化され、当該ICカード1を形成するカード状の本体C内に埋設される。たとえば、図2は、非接触式ICカード全体の構成例を示す図である。図2に示す非接触式ICカードは、カード状の本体Cを有している。この本体C内には、図2に点線で示すように、1つ(あるいは複数)のICチップ1aとインターフェース17としてのアンテナとを有するモジュールMが埋め込まれている。
A configuration example of the IC card 1 will be described.
As shown in FIG. 1, the IC card 1 includes a control element 11, a program memory 12, a working memory 13, a data memory 14, a communication control unit 15, a power supply unit 16, an interface (antenna or contact unit) 17, and the like. Have.
The IC card 1 includes a card-like main body C. One (or a plurality) of IC chips 1 a and an interface 17 are embedded in the card-like main body C forming the IC card 1. The IC chip 1a includes a control element 11, a program memory 12, a working memory 13, a data memory 14, a communication control unit 15, a power supply unit 16, and the like. The IC chip 1a is modularized while being connected to the interface 17, and is embedded in a card-like main body C that forms the IC card 1. For example, FIG. 2 is a diagram illustrating a configuration example of the entire non-contact type IC card. The noncontact IC card shown in FIG. 2 has a card-like main body C. A module M having one (or a plurality) of IC chips 1a and an antenna as an interface 17 is embedded in the main body C, as indicated by a dotted line in FIG.

上記制御素子11は、ICカード1全体の制御を司るものである。上記制御素子11は、上記プログラムメモリ12あるいはデータメモリ14に記憶されている制御プログラムおよび制御データなどに基づいて動作する。たとえば、上記制御素子11は、上記プログラムメモリ12に記憶されている基本的な動作を司る制御プログラムを実行することにより、外部装置から与えられるコマンドに応じた処理を実行する。これにより、外部装置から上記データメモリ14へのデータの書込みを要求するコマンドが与えられれば、上記制御素子11は、上記データメモリ14へのデータの書き込み処理を実行する。また、外部装置から上記データメモリ14に記憶されているデータの読み出しを要求するコマンドが与えられれば、上記制御素子11は、上記データメモリ14からのデータの読み出し処理を実行する。さらに、上記制御素子11は、当該ICカード1の用途などに応じてインストールされる処理プログラムを実行することにより、用途に応じた処理を実現するようになっている。   The control element 11 controls the entire IC card 1. The control element 11 operates based on a control program and control data stored in the program memory 12 or the data memory 14. For example, the control element 11 executes a process according to a command given from an external device by executing a control program for performing basic operations stored in the program memory 12. Accordingly, when a command for requesting data writing to the data memory 14 is given from an external device, the control element 11 executes a data writing process to the data memory 14. Further, when a command for requesting reading of data stored in the data memory 14 is given from an external device, the control element 11 executes a process of reading data from the data memory 14. Further, the control element 11 realizes processing according to the use by executing a processing program installed according to the use of the IC card 1 or the like.

上記プログラムメモリ12は、読み出し専用のメモリ(ROM:リードオンリーメモリ)により構成される。上記プログラムメモリ12には、予め基本動作を司る制御プログラムおよび制御データなどが記憶されている。上記プログラムメモリ12には、予め当該ICカード1の仕様に応じた制御プログラム及び制御データが記憶される。たとえば、上記制御素子11は、上記プログラムメモリ12に記憶される制御プログラムにより外部から与えられるコマンドに応じた処理を実現する。また、上記プログラムメモリ12には、データメモリ14におけるメモリ領域の属性(たとえば、1回書込み領域などを指定する情報)などを指定するための情報なども記憶するようにしても良い。   The program memory 12 is constituted by a read-only memory (ROM: read-only memory). The program memory 12 stores in advance a control program for controlling basic operations, control data, and the like. In the program memory 12, a control program and control data according to the specifications of the IC card 1 are stored in advance. For example, the control element 11 realizes processing according to a command given from the outside by a control program stored in the program memory 12. The program memory 12 may also store information for designating attributes of a memory area in the data memory 14 (for example, information for designating a one-time write area).

上記ワーキングメモリ13は、揮発性のメモリ(RAM;ランダムアクセスメモリ)により構成される。上記ワーキングメモリ13は、データを一時保管するバッファメモリとして機能する。例えば、上記ワーキングメモリ13には、ICカード処理装置(外部装置)2との通信処理において、送受信されるデータが一時的に保管される。また、上記ワーキングメモリ13には、種々の書込みデータなどを一時的に保持するメモリとしても利用される。   The working memory 13 is composed of a volatile memory (RAM; random access memory). The working memory 13 functions as a buffer memory for temporarily storing data. For example, the working memory 13 temporarily stores data transmitted and received in the communication process with the IC card processing device (external device) 2. The working memory 13 is also used as a memory for temporarily storing various write data.

上記データメモリ(不揮発性メモリ)14は、データの書き込みが可能な不揮発性のメモリである。上記データメモリ14は、例えば、EEPROMあるいはフラッシュメモリなどにより構成される。上記データメモリ14には、当該ICカード1の使用目的に応じた種々の情報が記憶される。
たとえば、当該ICカードの使用目的に応じたアプリケーション(処理プログラムおよび運用データなど)は、各種の用途に応じた使用を可能するための発行処理において、上記データメモリ14に書込まれる。上記のような発行処理において上記データメモリ14に書込むべきアプリケーションデータは、通常、データサイズが大きく、特定の書込みコマンドによって書込み処理が実行される。また、発行処理以外であっても、サイズが大きいデータをデータメモリに書込む場合、特定の書込みコマンドによって書込み処理が実行されれる。
The data memory (nonvolatile memory) 14 is a nonvolatile memory capable of writing data. The data memory 14 is composed of, for example, an EEPROM or a flash memory. The data memory 14 stores various information corresponding to the purpose of use of the IC card 1.
For example, an application (processing program, operation data, etc.) according to the purpose of use of the IC card is written into the data memory 14 in an issuing process for enabling use according to various uses. Application data to be written to the data memory 14 in the issuing process as described above usually has a large data size, and the writing process is executed by a specific writing command. Even if the process is not an issuance process, when a large data is written to the data memory, the write process is executed by a specific write command.

なお、当該ICカード1が複数の使用目的に使用される場合、上記データメモリ14には、各使用目的に応じた複数のアプリケーションが記憶される。また、当該ICカード1の使用目的に応じたアプリケーションは、上記データメモリ14上に定義された使用目的ごとのプログラムファイルおよびデータファイルなどの各ファイルに記憶される。このようなファイル構造は、たとえば、ISO/IEC7816−4に基づくものである。つまり、上記ICカード1のデータメモリ14には、種々のアプリケーションおよび種々の運用データが記憶可能である。   When the IC card 1 is used for a plurality of usage purposes, the data memory 14 stores a plurality of applications corresponding to the usage purposes. An application corresponding to the purpose of use of the IC card 1 is stored in each file such as a program file and a data file for each purpose of use defined on the data memory 14. Such a file structure is based on, for example, ISO / IEC7816-4. That is, various applications and various operation data can be stored in the data memory 14 of the IC card 1.

上記通信制御部15は、上記インターフェース17を介して外部装置(たとえば、ICカード処理装置2)とのデータ通信を制御するものである。たとえば、当該ICカードが非接触型のICカードであれば、外部装置からデータを受信する場合、上記通信制御部15は、インターフェース17としてのアンテナにより受信した電波としての送信データを復調し、復調した信号を上記制御素子11に供給する。また、外部装置へデータを送信する場合、上記通信制御部15は、上記制御素子11から与えられるデータを変調し、変調したデータを上記インターフェース17としてのアンテナにより電波として発信する。なお、接触式ICカードでは、インターフェース17として、アンテナの代わりに、外部装置の接触端子部と物理的・電気的に接触するコンタクト部を介して外部装置とのデータ通信を行う。   The communication control unit 15 controls data communication with an external device (for example, the IC card processing device 2) via the interface 17. For example, if the IC card is a contactless IC card, when receiving data from an external device, the communication control unit 15 demodulates and demodulates transmission data as radio waves received by an antenna as the interface 17. The signal is supplied to the control element 11. When data is transmitted to an external device, the communication control unit 15 modulates data provided from the control element 11 and transmits the modulated data as radio waves by an antenna as the interface 17. In the contact IC card, the interface 17 performs data communication with the external device via a contact portion that physically and electrically contacts the contact terminal portion of the external device instead of the antenna.

上記電源部16は、当該ICカード1の各部を動作させるための上記インターフェース17を介して受信する電力およびクロックパルスを供給する。たとえば、当該ICカードが非接触型のICカードであれば、上記電源部16は、上記インターフェース17としてのアンテナにより受信した電波から電力およびクロックパルスを生成し、当該ICカード内の各部に供給するようになっている。また、上記電源部16からの電力供給により起動した場合、上記制御素子11は、当該ICカード1の処理状態をリセットする処理を行うようになっている。なお、当該ICカード1が接触型のICカードであれば、上記電源部16はインターフェース17を介して外部装置から直接的に供給される電力およびクロックパルスにより各部へ供給するようになっている。   The power supply unit 16 supplies power and clock pulses received via the interface 17 for operating each unit of the IC card 1. For example, if the IC card is a non-contact type IC card, the power supply unit 16 generates power and clock pulses from the radio wave received by the antenna as the interface 17 and supplies it to each unit in the IC card. It is like that. Further, when activated by the power supply from the power supply unit 16, the control element 11 performs a process of resetting the processing state of the IC card 1. If the IC card 1 is a contact type IC card, the power supply unit 16 is supplied to each unit by power and clock pulses supplied directly from an external device via the interface 17.

次に、上記ICカード処理装置2について説明する。
上記ICカード処理装置2は、図1に示すように、制御装置21およびカードリーダライタ22を有している。上記制御装置21は、パーソナルコンピュータ(PC)などにより構成される。上記制御装置21は、CPUなどの演算処理部、RAM、ROM、不揮発性メモリおよびハードディスクドライブなどの各種メモリ、通信インターフェースなどの各種インターフェースなどにより構成される。上記制御装置21では、上記演算処理部がメモリに記憶されている各種の制御プログラムを実行することにより各種の処理を実現している。また、上記制御装置21は、ICカード1とのデータ通信を行う上記カードリーダライタ22とのデータの入出力を行うようになっている。
Next, the IC card processing apparatus 2 will be described.
The IC card processing device 2 includes a control device 21 and a card reader / writer 22 as shown in FIG. The control device 21 is configured by a personal computer (PC) or the like. The control device 21 includes an arithmetic processing unit such as a CPU, various memories such as a RAM, a ROM, a nonvolatile memory, and a hard disk drive, and various interfaces such as a communication interface. In the control device 21, the arithmetic processing unit implements various processes by executing various control programs stored in the memory. The control device 21 inputs and outputs data to and from the card reader / writer 22 that performs data communication with the IC card 1.

たとえば、上記制御装置21には、上記ICカード1を用いた各種の処理に応じた制御プログラムが予め記憶されている。上記制御装置21では、上記のような制御プログラムを実行することにより上記ICカード1を用いた各種の処理を実行する。たとえば、上記ICカード1を用いた各種の処理において、上記制御装置21は、所定のコマンドを所定の手順で供給する。上記制御装置21では、上記のような各コマンドに対するICカード1からの各レスポンス(コマンドに対する処理結果等を示す情報)に基づいて各種の処理を行うようになっている。   For example, the control device 21 stores in advance a control program corresponding to various processes using the IC card 1. The control device 21 executes various processes using the IC card 1 by executing the control program as described above. For example, in various processes using the IC card 1, the control device 21 supplies a predetermined command according to a predetermined procedure. The control device 21 performs various processes based on the responses from the IC card 1 to the commands as described above (information indicating the processing results for the commands).

上記カードリーダライタ22は、上記ICカード1とのデータ通信を行う通信手段として機能する。上記カードリーダライタ22は、上記ICカード1の通信方式に応じた通信方式によるデータ通信を行うためのものである。つまり、上記カードリーダライタ22を介して制御装置21は、上記ICカード1とのデータ通信を実現している。   The card reader / writer 22 functions as a communication unit that performs data communication with the IC card 1. The card reader / writer 22 is for performing data communication by a communication method corresponding to the communication method of the IC card 1. That is, the control device 21 implements data communication with the IC card 1 via the card reader / writer 22.

上記ICカード1が非接触型のICカードである場合、上記カードリーダライタ22は、上記ICカード1との無線によるデータ通信を行うためのアンテナおよび通信制御部(変復調回路等)などにより構成される。非接触型のICカード1へデータを送信する場合、上記カードリーダライタ22では、通信制御部により上記制御装置21から与えられる送信データを変調し、変調した信号を電波としてアンテナにより発信する。また、非接触型のICカード1からデータを受信する場合、上記カードリーダライタ22では、アンテナにより受信した電波としての信号を通信制御部により復調し、復調したデータを受信データとして上記制御装置21へ供給する。また、上記カードリーダライタ22では、上記のようなデータの送受信とともに、上記ICカード1を動作させるための電源およびクロックパルスとなる電波をアンテナにより発信するようになっている。   When the IC card 1 is a non-contact type IC card, the card reader / writer 22 includes an antenna for performing wireless data communication with the IC card 1 and a communication control unit (modem / demodulation circuit, etc.). The When data is transmitted to the non-contact type IC card 1, the card reader / writer 22 modulates transmission data provided from the control device 21 by the communication control unit, and transmits the modulated signal as a radio wave by an antenna. When data is received from the non-contact type IC card 1, the card reader / writer 22 demodulates a signal as a radio wave received by the antenna by the communication control unit, and uses the demodulated data as received data. To supply. The card reader / writer 22 transmits and receives the data as described above, and transmits a power source for operating the IC card 1 and a radio wave as a clock pulse by an antenna.

また、上記ICカード1が接触型のICカードである場合、上記カードリーダライタ22は、ICカード1と物理的に接触してデータ通信を行うためのコンタクト部および通信制御部などにより構成される。接触型のICカードとのデータの送受信を行う場合、上記カードリーダライタ22では、上記コンタクト部がICカード1側に設けられているコンタクト部と物理的に接触して各種のデータ通信を行う。また、上記カードリーダライタ22では、ICカード1に物理的に接触しているコンタクト部を介して当該ICカード1に対して電力およびクロックパルスを供給するようになっている。   When the IC card 1 is a contact type IC card, the card reader / writer 22 includes a contact unit and a communication control unit for performing data communication in physical contact with the IC card 1. . When transmitting / receiving data to / from a contact-type IC card, the card reader / writer 22 performs various data communications by physically contacting the contact portion with a contact portion provided on the IC card 1 side. The card reader / writer 22 supplies power and clock pulses to the IC card 1 through a contact portion that is in physical contact with the IC card 1.

次に、上記ICカード1内のデータメモリ14へのデータの書込み処理について説明する。
図3は、データメモリ14におけるデータAの書込み領域(データA領域)40の構成例を示している。
図3に示すように、データAの書込み領域40は、所定のデータ長からなる複数の領域(以下、これの領域をブロックと称する)41a、41b、…ごとにフラグ領域42a、42b、…が設けられている。すなわち、データAの書込み領域40は、それぞれにフラグ領域42a、42b、…が設けられている複数のブロック41a、41b、…から構成されている。
Next, a data write process to the data memory 14 in the IC card 1 will be described.
FIG. 3 shows a configuration example of a data A write area (data A area) 40 in the data memory 14.
As shown in FIG. 3, the write area 40 for data A has flag areas 42a, 42b,... For each of a plurality of areas (hereinafter referred to as blocks) 41a, 41b,. Is provided. That is, the data A write area 40 is composed of a plurality of blocks 41a, 41b,... Each provided with flag areas 42a, 42b,.

ここでは、各ブロック(各ブロック領域)は、データメモリ14に一度に書込めるデータ長ごとの領域として設定されているものとする。たとえば、32バイト、64バイト、128バイトごとに、データメモリ14へデータを書込む仕様であれば、各ブロック41a、41b、…としては、32バイト、64バイト、128バイトごとの領域が設けられる。すなわち、当該ICカード1では、所定のデータサイズごとにデータメモリ14における各ブロック41a、41b、…に対して書込み処理を行う。   Here, it is assumed that each block (each block area) is set as an area for each data length that can be written to the data memory 14 at a time. For example, if the specification is to write data to the data memory 14 every 32 bytes, 64 bytes, or 128 bytes, each block 41a, 41b,... Has an area for every 32 bytes, 64 bytes, or 128 bytes. . That is, the IC card 1 performs a writing process on each block 41a, 41b,... In the data memory 14 for each predetermined data size.

各フラグ領域42a、42b、…は、それぞれ対応する各ブロック41a、41b、…へのデータの書込み状態を示す情報が格納される。すなわち、各ブロック41a、41b、…へのデータの書込みが完了するごとに、対応する各フラグ領域42a、42b、…には、データ書込みが完了していることを示す情報(図3に示す例では「1」)が格納される。また、各フラグ領域42a、42b、…は、初期状態において、対応する各ブロック41a、41b、…へのデータ書込みが未了であることを示す情報(図3に示す例では「0」)が格納されている。   Each of the flag areas 42a, 42b,... Stores information indicating a data write state to each corresponding block 41a, 41b,. That is, every time data writing to each block 41a, 41b,... Is completed, information indicating that data writing has been completed in the corresponding flag areas 42a, 42b,... (Example shown in FIG. 3). In this case, “1”) is stored. In each flag area 42a, 42b,..., Information ("0" in the example shown in FIG. 3) indicating that data writing to the corresponding blocks 41a, 41b,. Stored.

また、図3に示す例では、データA領域40において、各フラグ領域42a、42b、…は、1番目からn番目までの各ブロック41a、41b、…、41nへのデータの書込みが完了し、n+1番目以降の各ブロック41n+1、…にはデータが書込まれていない状態を示している。たとえば、ICカード1には、各ブロック41a、41b、…に書込むべきデータAを各ブロックのサイズごとに分割したデータがICカード処理装置2から順次供給されるものとする。このような場合、n+1番目のブロック41n+1に書込むべきデータの受信中に通信エラーが発生すると、データA領域40は、図3に示すような状態となる。   In the example shown in FIG. 3, in the data A area 40, each flag area 42a, 42b,... Has completed writing data to the first to nth blocks 41a, 41b,. In this case, no data is written in each of the (n + 1) th and subsequent blocks 41n + 1,. For example, it is assumed that data obtained by dividing data A to be written in each block 41a, 41b,... For each block size is sequentially supplied from the IC card processing device 2 to the IC card 1. In such a case, if a communication error occurs during reception of data to be written in the (n + 1) th block 41n + 1, the data A area 40 is in a state as shown in FIG.

次に、上記ICカード1に供給されるコマンドについて説明する。
図1に示すようなシステムにおいて、上記ICカード1は、上記ICカード処理装置2から供給されるコマンドに応じた処理を実行するようになっている。上記ICカード1が実行可能なコマンドには、種々のコマンドがある。たとえば、データの書込みを要求するコマンド(ライトコマンド)あるいはデータの書換えを要求するコマンド(アップデートコマンド)には、一般に、バイナリ系のコマンドとレコード系のコマンドとがある。上記バイナリ系のコマンドは、主に、バイナリのデータ領域(データファイル)に対してデータの書込みあるいは書換えなどを要求するのに用いられる。上記バイナリ系のコマンドでは、データファイルにおけるデータの位置をオフセットで指定する。これに対して、上記レコード系のコマンドは、主に、レコード形式のデータ領域(データファイル)に対してデータの書込みあるいは書換えなどを要求するのに用いられる。上記レコード系のコマンドでは、データファイルへのアクセスをレコードを示す情報で指定する。なお、以下の説明では、主に、バイナリ系のライトコマンドによりサイズが大きいデータをデータメモリ14に書込む処理を想定するものとする。
Next, commands supplied to the IC card 1 will be described.
In the system as shown in FIG. 1, the IC card 1 executes processing according to a command supplied from the IC card processing device 2. There are various commands that can be executed by the IC card 1. For example, a command for requesting data writing (write command) or a command for requesting data rewriting (update command) generally includes a binary command and a record command. The binary commands are mainly used for requesting data writing or rewriting to a binary data area (data file). In the binary command, the position of data in the data file is specified by an offset. On the other hand, the record-type command is mainly used to request data writing or rewriting for a data area (data file) in a record format. In the record command, access to the data file is specified by information indicating a record. In the following description, it is mainly assumed that data having a large size is written to the data memory 14 by a binary write command.

また、ICカード処理装置2からICカード1に供給されるコマンドは、通常、所定のデータ長で構成される。例えば、各コマンドは、「CLA」部、「INS」部、「P1」部、「P2」部、「Lc」部、「Data」部などから構成される。上記「CLA」部および上記「INS」部には、コマンドの種類を示す情報が格納される。上記「P1」部および上記「P2」部には、当該コマンドの処理パラメータを示す情報が格納される。また、ライトコマンドの「P1」部には、データの書込み対象となるデータファイル(データ領域)を指定する情報(たとえば、図3ではデータA領域を示す情報)が格納される。また、ライトコマンドの「P2」部には、上記「P1」部で指定されるデータ領域におけるデータの書込む位置(アドレス)を示す情報としてのオフセット値(当該データ領域(データファイル)の先頭からのアドレス)が格納される。また、上記「Lc」部には、書込むべきデータ全体の長さを示す情報が格納される。上記「Data」部には、書込むべきデータあるいは書込むべきデータのうちの最初の部分のデータが格納される。ここでは、コマンド全体が所定のデータ長であることを想定しているため、「Data」部には、所定の長さまでのデータが格納される。このため、書込むべきデータ全体の長さが「Data」部に格納しきれない長さであれば、「Data」には、書込むべきデータのうち最初の部分のデータが格納される。   The command supplied from the IC card processing device 2 to the IC card 1 is usually configured with a predetermined data length. For example, each command includes a “CLA” portion, an “INS” portion, a “P1” portion, a “P2” portion, an “Lc” portion, a “Data” portion, and the like. In the “CLA” part and the “INS” part, information indicating the type of command is stored. In the “P1” part and the “P2” part, information indicating processing parameters of the command is stored. In the “P1” portion of the write command, information (for example, information indicating the data A area in FIG. 3) specifying a data file (data area) to which data is to be written is stored. The “P2” portion of the write command includes an offset value (information from the beginning of the data region (data file)) as information indicating a data writing position (address) in the data region specified by the “P1” portion. Address) is stored. In the “Lc” portion, information indicating the length of the entire data to be written is stored. The “Data” portion stores data to be written or data of the first part of the data to be written. Here, since it is assumed that the entire command has a predetermined data length, data up to a predetermined length is stored in the “Data” portion. For this reason, if the length of the entire data to be written is a length that cannot be stored in the “Data” portion, “Data” stores the first part of the data to be written.

上記のように、1つのライトコマンドに格納しきれないデータ長が大きなデータは、所定のデータ長に基づいて分割され、当該ライトコマンドに続いて順次、ICカード1へ供給されるようになっている。これにより、上記ICカード1では、ライトコマンドで書込みが要求されるデータを順次受信する。このようなライトコマンドを用いて順次供給されるデータは、ICカード1内のバッファとして機能するワーキングメモリ13が大容量でなければ、全データを蓄積することができない。一般的に、ICカード1等の携帯可能電子装置では、装置自体の物理的な大きさの制限などにより大容量のワーキングメモリ13を具備することが難しい。   As described above, data having a large data length that cannot be stored in one write command is divided based on a predetermined data length, and is sequentially supplied to the IC card 1 following the write command. Yes. Thereby, the IC card 1 sequentially receives data requested to be written by the write command. Data sequentially supplied using such a write command cannot be stored unless the working memory 13 functioning as a buffer in the IC card 1 has a large capacity. In general, it is difficult for a portable electronic device such as the IC card 1 to include a large-capacity working memory 13 due to a physical size limitation of the device itself.

このため、本実施の形態において、ICカード1は、受信したデータを順次データメモリ14に書込みつつ、書込んだデータに続くデータを順次受信するようになっているものとする。このような処理手順では、データの書込み処理の途中で通信エラー等などが発生した場合、ICカード1のデータメモリ14には、書込み処理中であったデータが途中まで書込まれた状態となる。   Therefore, in the present embodiment, it is assumed that the IC card 1 sequentially receives the data following the written data while sequentially writing the received data to the data memory 14. In such a processing procedure, when a communication error or the like occurs during the data writing process, the data that was being written is written to the data memory 14 of the IC card 1 halfway. .

たとえば、図3に示す構成例では、データメモリ14におけるデータA領域における各ブロック41a、41b、…へのデータAの書込み状態は、各フラグ領域42a、42b、…に格納されているデータにより示される。言い換えれば、各フラグ領域42a、42b、…をチェックすれば、各ブロック41a、41b、…へのデータAの書込み状況がチェックできるようになっている。これにより、データAの書込みが中断された場合、データA領域全体を読み出して照合するなどの調査を行わなくても、エラーが発生した位置、つまり、データの書込みが完了していない領域を容易に判断することが可能となる。   For example, in the configuration example shown in FIG. 3, the write state of data A to each block 41a, 41b,... In the data A area in the data memory 14 is indicated by the data stored in each flag area 42a, 42b,. It is. In other words, if the flag areas 42a, 42b,... Are checked, the writing status of the data A to the blocks 41a, 41b,. As a result, when the writing of data A is interrupted, the location where the error has occurred, that is, the area where data writing has not been completed, can be easily performed without performing an investigation such as reading and collating the entire data A area. It becomes possible to judge.

次に、上記ICカード1におけるデータメモリ14へのデータ書込み処理の手順について説明する。
図4は、上記データメモリ14へのデータ書込み処理の第1の処理例を説明するためのフローチャートである。なお、ここでは、ライトコマンドで指定されるデータメモリ14に書込むべきデータが複数に分割されてICカード1に供給される場合を想定するものとする。
Next, the procedure of data writing processing to the data memory 14 in the IC card 1 will be described.
FIG. 4 is a flowchart for explaining a first processing example of data writing processing to the data memory 14. Here, it is assumed that the data to be written in the data memory 14 specified by the write command is divided into a plurality of parts and supplied to the IC card 1.

まず、上記ICカード処理装置2がICカード1を動作させるための電力およびクロックパルスを当該ICカード1に供給したものとする。上記ICカード処理装置2から電力およびクロックが供給されると、上記ICカード1は、起動処理、および、リセット処理を行う(ステップS11)。上記リセット処理が完了すると、上記ICカード1の制御素子11は、上記ICカード処理装置2に対する初期応答として、初期応答データをICカード処理装置2へ送信する。このような初期応答データを受信したICカード処理装置2では、ICカード1に対してコマンドを送信する。   First, it is assumed that the IC card processing device 2 supplies power and clock pulses for operating the IC card 1 to the IC card 1. When power and a clock are supplied from the IC card processing device 2, the IC card 1 performs a start-up process and a reset process (step S11). When the reset process is completed, the control element 11 of the IC card 1 transmits initial response data to the IC card processing apparatus 2 as an initial response to the IC card processing apparatus 2. The IC card processing device 2 that has received such initial response data transmits a command to the IC card 1.

上記初期応答データを送信したICカード1では、上記ICカード処理装置2からのコマンドの待ちの状態となっている。この状態において上記ICカード処理装置2から送信されたコマンドを上記通信制御部15により受信すると(ステップS12、YES)、上記ICカード1の制御素子11は、受信したコマンドの種類を判別する。たとえば、各コマンドが「CLA」部、「INS」部、「P1」部、「P2」部、「Lc」部、「Data」部で構成される場合、上記ICカード1の制御素子11は、受信したコマンドの「CLA」部及び「INS」部の値に基づいて当該コマンドの種類を判別する。   The IC card 1 that has transmitted the initial response data is waiting for a command from the IC card processing device 2. In this state, when the communication control unit 15 receives a command transmitted from the IC card processing apparatus 2 (step S12, YES), the control element 11 of the IC card 1 determines the type of the received command. For example, when each command is composed of a “CLA” portion, an “INS” portion, a “P1” portion, a “P2” portion, an “Lc” portion, and a “Data” portion, the control element 11 of the IC card 1 The type of the command is determined based on the values of the “CLA” part and “INS” part of the received command.

上記受信したコマンドがデータの書込みを要求するコマンド(ライトコマンド)であると判定した場合(ステップS13、YES)、上記ICカード1の制御素子11は、当該ライトコマンドにおける処理パラメータ(例えば「P1」部及び「P2」部の値)に基づいてデータを書込む対象とするデータファイル(データ領域)および当該データファイルにおける書込み開始位置を判別する。当該コマンドが指定するデータの書込み位置を判別すると、上記制御素子11は、データの書込み位置が未書込み状態か否かを判断する(ステップS14)。すなわち、上記制御素子11は、当該コマンドで指定された書込み位置のブロックが、未書込み状態であるか否か(書込み済みか、未書き込みか)を判断する。指定された書込み位置が未書込み状態であるか否かは、たとえば、指定された書込み位置のブロックに対応するフラグの状態により判断される。   When it is determined that the received command is a command (write command) for requesting data writing (step S13, YES), the control element 11 of the IC card 1 determines the processing parameter (for example, “P1”) in the write command. Data value (data area) to which data is to be written and the write start position in the data file. When the data write position designated by the command is determined, the control element 11 determines whether or not the data write position is in an unwritten state (step S14). That is, the control element 11 determines whether or not the block at the write position specified by the command is in an unwritten state (whether written or not written). Whether or not the designated write position is in an unwritten state is determined by, for example, the state of the flag corresponding to the block at the designated write position.

上記判断により指定されたデータの書込み位置が未書込み状態でないと判断した場合(ステップS14、NO)、上記制御素子11は、所定のエラー処理を行う(ステップS15)。この場合のエラー処理では、指定された書込み位置がデータ書込み済みであるためデータが書込みが不可である旨の通知を当該コマンドに対する応答(レスポンス)としてICカード処理装置2へ送信する。これにより、コマンドの送信元であるICカード処理装置2では、指定した領域が書込済みのためエラーとなったことを認識できるようになっている。   When it is determined that the data write position designated by the determination is not in an unwritten state (step S14, NO), the control element 11 performs a predetermined error process (step S15). In the error processing in this case, a notification that the data cannot be written because the specified writing position has been written is transmitted to the IC card processing device 2 as a response to the command. As a result, the IC card processing apparatus 2 that is the command transmission source can recognize that an error has occurred because the designated area has been written.

また、上記判断により指定されたデータの書込み位置が未書込み状態であると判断した場合(ステップS14、YES)、上記制御素子11は、指定された書込み位置のブロックへのデータの書込み処理を実行する(ステップS16)。この書込み処理を実行する時点では、少なくとも当該ブロックに書込むべきデータがバッファメモリとしてのワーキングメモリ13に格納されているものとする。従って、上記書込み処理では、ワーキングメモリ13に記憶されているデータをデータメモリ14における指定されたデータ領域の各ブロックに順に書込む処理を行う。なお、上記書込み処理においてメモリ不良等のハードウエアの不具合などによりデータの書込みができない場合、上記制御素子11は、その旨をICカード処理装置2へ応答するなどのエラー処理を行う。   In addition, when it is determined that the data write position specified by the determination is in an unwritten state (step S14, YES), the control element 11 executes a data write process to the block at the specified write position. (Step S16). At the time of executing this writing process, it is assumed that at least data to be written to the block is stored in the working memory 13 as a buffer memory. Therefore, in the above writing process, data stored in the working memory 13 is sequentially written into each block of the designated data area in the data memory 14. If data cannot be written due to a hardware defect such as a memory failure in the write process, the control element 11 performs an error process such as responding to the IC card processing device 2 to that effect.

上記書込み処理により指定されたデータ領域のブロックに対するデータの書込みが完了すると、上記制御素子11は、当該ブロックに対応するフラグをオン状態とする(ステップS17)。たとえば、図3に示す構成において、ブロック41aに対するデータの書込みが完了すると、上記制御素子11は、初期状態として「0」となっているフラグ領域42aを「1」に書き換える。   When the writing of data to the block in the data area designated by the writing process is completed, the control element 11 turns on the flag corresponding to the block (step S17). For example, in the configuration shown in FIG. 3, when the data writing to the block 41a is completed, the control element 11 rewrites the flag area 42a, which is “0” as an initial state, to “1”.

上記データの書込み及びフラグのセットが完了すると、上記制御素子11は、ライトコマンドで指定された全データの受信および書込み処理が完了したか否かを判断する(ステップS18)。この判断は、受信したライトコマンドにおけるパラメータで指定されたデータ長(たとえば、当該コマンドの「Lc」部で示される)のデータを指定されたデータファイル(データ領域)に書込んだか否かにより判断される。   When the data writing and flag setting are completed, the control element 11 determines whether or not the reception and writing processing of all the data designated by the write command is completed (step S18). This determination is made based on whether or not data of the data length specified by the parameter in the received write command (for example, indicated by the “Lc” part of the command) is written in the specified data file (data area). Is done.

上記判断により全データの受信および書込み処理が完了していないと判断した場合(ステップS18、NO)、上記制御素子11は、順次、ライトコマンドに続いてICカード処理装置2から送信される分割された各データを受信し、受信した各データを各ブロックにの書込む処理を行う。また、上記ICカード1の制御素子11は、上記ICカード処理装置2から分割された各データを受信し、受信した各データの各ブロックへの書込みが完了するごとに、各データの書込み完了を示すレスポンスをICカード処理装置2に送信する。これに対して、上記ICカード処理装置2では、ICカード1のレスポンスを確認しつつ、順次データを送信する。   When it is determined that the reception and writing process of all data has not been completed by the above determination (step S18, NO), the control element 11 is sequentially divided from the IC card processing device 2 transmitted following the write command. The received data is received, and the received data is written into each block. The control element 11 of the IC card 1 receives each piece of data divided from the IC card processing device 2, and completes writing of each data every time writing of each received data to each block is completed. The response shown is transmitted to the IC card processing device 2. On the other hand, the IC card processing device 2 sequentially transmits data while checking the response of the IC card 1.

なお、図4に示す例では、説明を簡単にするため、ICカード1は、受信したデータの書込みが完了するごとに、次のデータ(書込んだデータに続くデータ)をICカード処理装置2から受信するようになっている。つまり、図4に示す例では、ICカード処理装置2は、ICカード1からの各データの書込み完了を示すレスポンスに応じて次のデータを送信する処理を行う。ただし、ICカード1における各データの受信処理および書込み処理のタイミングは、これに限定されるものではない。たとえば、上記ICカード1では、上記ICカード1における各ブロックへのデータの書込み処理と並行して分割された各データをICカード処理装置2から受信するようにしても良い。   In the example shown in FIG. 4, for simplicity of explanation, the IC card 1 sends the next data (data following the written data) to the IC card processing device 2 every time writing of the received data is completed. To receive from. That is, in the example shown in FIG. 4, the IC card processing device 2 performs processing for transmitting the next data in response to a response indicating completion of writing of each data from the IC card 1. However, the timing of reception processing and writing processing of each data in the IC card 1 is not limited to this. For example, the IC card 1 may receive each data divided from the IC card processing device 2 in parallel with the data writing process to each block in the IC card 1.

すなわち、上記ICカード処理装置2から次のデータ(ライトコマンドに続く分割されたデータ)が送信されると、上記ICカード1は、上記通信制御部15により当該データを受信する受信処理を行う(ステップS19)。この受信処理において上記ICカード1の制御素子11は、ICカード処理装置2から送信されたデータが正常に受信されているか否かを判断する処理を行っている(ステップS20)。   That is, when the next data (the divided data following the write command) is transmitted from the IC card processing device 2, the IC card 1 performs a reception process for receiving the data by the communication control unit 15 ( Step S19). In this reception process, the control element 11 of the IC card 1 performs a process of determining whether or not the data transmitted from the IC card processing device 2 is normally received (step S20).

上記判断により上記ICカード処理装置2から送信されたデータが正常に受信されたと判断した場合(ステップS20、NO)、当該ICカード1の制御素子11は、上記ステップS16へ戻り、受信した次のデータを指定されたデータ領域における次のブロックに書込む書込み処理を行う。このように、上記ICカード1の制御素子11は、上記ライトコマンドで指定された全データが受信済みと判断されるまで、上記ステップS16〜S20の処理を繰り返し実行する。これにより、通信エラーなどのエラーが発生しなければ、上記ICカード1では、複数に分割されて供給されるデータをライトコマンドで指定された条件に従ってデータメモリ14に書込むことができる。   When it is determined that the data transmitted from the IC card processing device 2 is normally received by the determination (step S20, NO), the control element 11 of the IC card 1 returns to the step S16 and receives the next received Write processing for writing data to the next block in the specified data area. As described above, the control element 11 of the IC card 1 repeatedly executes the processes of steps S16 to S20 until it is determined that all the data designated by the write command has been received. Thereby, if an error such as a communication error does not occur, the IC card 1 can write the data divided and supplied to the data memory 14 in accordance with the conditions specified by the write command.

また、上記判断により上記ICカード処理装置2から送信されたデータの受信処理において通信エラーが発生したと判断した場合、つまり、データの受信途中で通信エラーが発生した場合(ステップS20、YES)、上記制御素子11は、所定のエラー処理を行う(ステップS15)。この場合のエラー処理としては、通信エラーが発生した旨の通知をICカード処理装置2へ送信する処理を行う。たとえば、次のデータが所定の許容時間内に受信できない場合、あるいは、パリティチェックなどにより受信したデータが正常でないと判断された場合、上記制御素子11は、通信エラーが発生したものと判断する。   Further, when it is determined that a communication error has occurred in the reception process of data transmitted from the IC card processing device 2 based on the above determination, that is, when a communication error has occurred during data reception (YES in step S20), The control element 11 performs a predetermined error process (step S15). As error processing in this case, processing for transmitting a notification that a communication error has occurred to the IC card processing device 2 is performed. For example, when the next data cannot be received within a predetermined allowable time, or when it is determined that the received data is not normal by a parity check or the like, the control element 11 determines that a communication error has occurred.

また、上記ステップS18において、全データ(ライトコマンドの「Lc」部で指定されたデータ長の書込みデータ)の受信および書込み処理が完了したと判断した場合(ステップS18、YES)、上記制御素子11は、ライトコマンドで指定された全データの書込み処理が正常に終了したものと判断する。この場合、上記制御素子11は、当該ライトコマンドで指定されていた全データの書込みが正常終了した旨のレスポンスをICカード処理装置2へ送信する正常終了処理を行う(ステップS21)。   If it is determined in step S18 that all data (write data having a data length specified by the “Lc” portion of the write command) has been received and written (step S18, YES), the control element 11 Determines that the writing process of all data designated by the write command has been completed normally. In this case, the control element 11 performs a normal end process of transmitting a response indicating that the writing of all data designated by the write command is normally completed to the IC card processing device 2 (step S21).

また、上記ICカード処理装置2から書込み要求コマンド以外のコマンドを受信した場合(ステップS13、NO)、上記制御素子11は、各コマンドに応じた処理を行う。ここで、特定のデータ領域における未書込み領域の通知を要求するコマンドを受信した場合(ステップS22、YES)、上記制御素子11は、当該コマンドで指定されたデータ領域における各ブロックに対応する各フラグのチェックを行う(ステップS23)。この各フラグのチェック処理では、指定されたデータ領域において未書き込み状態であることを示している最初のフラグを検出する。   When a command other than the write request command is received from the IC card processing device 2 (step S13, NO), the control element 11 performs processing according to each command. When a command requesting notification of an unwritten area in a specific data area is received (step S22, YES), the control element 11 uses each flag corresponding to each block in the data area specified by the command. Is checked (step S23). In the flag check process, the first flag indicating that the designated data area is not yet written is detected.

上記各フラグのチェック処理の結果により未書込み状態の最初のフラグが検出されると、上記制御素子11は、当該データ領域において未書込み状態の最初のフラグが対応するブロックが未書込み状態であると判定する。この判定結果に基づいて、上記制御素子11は、指定されたデータ領域における未書込み領域を示す情報をICカード処理装置2へ通知する処理を行う(ステップS24)。この処理では、たとえば、データ領域における未書込み領域を示す情報として、当該データ領域の先頭からの未書込み領域の先頭のアドレス(未書込みのブロックの先頭アドレス)を通知する。これは、ライトコマンドにおいて指定したデータ領域におけるオフセットアドレス(当該データ領域の先頭からの位置)を書込み開始位置として指定できるためである。   When the first flag in the unwritten state is detected as a result of the check processing of each flag, the control element 11 determines that the block corresponding to the first flag in the unwritten state in the data area is in the unwritten state. judge. Based on the determination result, the control element 11 performs a process of notifying the IC card processing device 2 of information indicating an unwritten area in the designated data area (step S24). In this process, for example, as the information indicating the unwritten area in the data area, the start address of the unwritten area from the start of the data area (the start address of the unwritten block) is notified. This is because the offset address (position from the beginning of the data area) in the data area designated by the write command can be designated as the write start position.

すなわち、この第1の処理例において、通信エラーあるいは書込みエラー等によりデータ全体の書込みが完了しなかった場合、つまり、あるデータ領域に対するデータの書込み処理が途中でエラーとなった場合、上記ICカード処理装置2は、上記ICカード1からのエラー通知を受信する。このようなエラー通知を受信した上記ICカード処理装置2では、当該ICカード1に対して当該データの書込みを再度実行するのであれば、当該データ領域における書込みが失敗した位置(つまり、未書込み領域)を示す情報をICカード1に要求する。   That is, in this first processing example, when the writing of the entire data is not completed due to a communication error or a writing error, that is, when an error occurs during the data writing process to a certain data area, the IC card The processing device 2 receives the error notification from the IC card 1. In the IC card processing device 2 that has received such an error notification, if the writing of the data to the IC card 1 is executed again, the position where the writing in the data area has failed (that is, the unwritten area). ) Is requested to the IC card 1.

言い換えれば、データの書込みが途中でエラーとなった旨の通知を受信したICカード処理装置2は、当該データの書込みをリトライするために、未書込み領域の通知を要求するコマンドをICカード1へ送信する。この未書込み領域の通知を要求するコマンドでは、たとえば、データ領域(データファイル)を指定し、そのデータ領域における未書込み領域の先頭アドレスの通知を要求する。   In other words, the IC card processing apparatus 2 that has received the notification that an error has occurred during the data writing process sends a command requesting notification of the unwritten area to the IC card 1 in order to retry the data writing. Send. In this command for requesting notification of an unwritten area, for example, a data area (data file) is specified, and notification of the start address of the unwritten area in the data area is requested.

このようなコマンドに対して、ICカード1では、上記ステップS23及びS24の処理を実行する。つまり、指定データ領域における未書込み領域の通知を要求するコマンドを受信した場合、上記ICカード1は、当該データ領域における各ブロックの各フラグの状態をチェックし、未書込み状態となっている最初のブロックの先頭アドレスを示す情報を上記コマンドに対するレスポンスとしてICカード処理装置2へ送信する。   In response to such a command, the IC card 1 executes the processes of steps S23 and S24. That is, when a command requesting notification of an unwritten area in the designated data area is received, the IC card 1 checks the state of each flag of each block in the data area, and the first one that is in an unwritten state. Information indicating the head address of the block is transmitted to the IC card processing apparatus 2 as a response to the command.

さらに、上記未書込み領域の通知を要求するコマンドに対するレスポンスとして、上記ICカード1から未書込み状態の先頭アドレスを示す情報を受信すると、上記ICカード処理装置2では、当該データ領域における未書込み状態の位置からデータの書込みを再開させるためのライトコマンドをICカード1へ送信する。この場合、ICカード処理装置2からICカード1へ送信されるライトコマンドでは、ICカード1から通知された未書込み状態の先頭アドレスが書込み開始位置として指定され、当該書込み開始位置から書込まれるべきデータ(例えば、通信エラーとなったデータ以降のデータ)が書込みデータとして指定される。このようなライトコマンドを受信した場合、上記ICカード1では、当該コマンドで指定された位置を書込み開始位置として、上記ステップS13〜21の処理を行う。   Further, when the information indicating the start address of the unwritten state is received from the IC card 1 as a response to the command requesting the notification of the unwritten area, the IC card processing device 2 displays the unwritten state in the data area. A write command for resuming data writing from the position is transmitted to the IC card 1. In this case, in the write command transmitted from the IC card processing device 2 to the IC card 1, the start address of the unwritten state notified from the IC card 1 is designated as the write start position and should be written from the write start position. Data (for example, data after the data that caused the communication error) is designated as write data. When such a write command is received, the IC card 1 performs the processes of steps S13 to S21 with the position specified by the command as the write start position.

上記のように、第1の処理例では、一度にバッファメモリとしてのワーキングメモリ13に格納しきれないようなサイズの大きいデータをデータメモリ14に書込む場合、ICカード1は、当該データを格納するためのデータ領域を複数のブロックに分けた各ブロックの書込み処理が完了するごとに各ブロックに対応づけて設けられている各フラグをセットする。さらに、特定のデータ領域における未書込み状態の領域の通知を要求するコマンドを受信した場合、上記ICカード1は、各ブロックに対応する各フラグをチェックすることにより未書込み状態の領域(ブロック)を判定し、その判定結果を通知する。これにより、サイズの大きいデータの書込み処理の途中で通信エラーなどのエラーが発生した場合であっても、未書込み状態の領域を容易に検出でき、効率的に書込み処理を再開することができる。   As described above, in the first processing example, when writing large data to the data memory 14 that cannot be stored in the working memory 13 as a buffer memory at a time, the IC card 1 stores the data. Each time the writing process of each block in which the data area to be divided into a plurality of blocks is completed, each flag provided in association with each block is set. Further, when a command requesting notification of an unwritten area in a specific data area is received, the IC card 1 checks an unwritten area (block) by checking each flag corresponding to each block. Determine and notify the determination result. As a result, even when an error such as a communication error occurs in the middle of a large data write process, an unwritten region can be easily detected and the write process can be efficiently restarted.

次に、上記データメモリ14へのデータ書込み処理の第2の処理例について説明する。
図5は、上記データメモリ14へのデータ書込み処理の第2の処理例を説明するためのフローチャートである。なお、ここでは、ライトコマンドで指定されるデータメモリ14に書込むべきデータが複数に分割されてICカード1に供給される場合を想定するものとする。
Next, a second processing example of the data writing process to the data memory 14 will be described.
FIG. 5 is a flowchart for explaining a second processing example of the data writing processing to the data memory 14. Here, it is assumed that the data to be written in the data memory 14 specified by the write command is divided into a plurality of parts and supplied to the IC card 1.

図5に示す第2の処理例は、ライトコマンドを受信した場合に、当該ライトコマンドで指定されたデータ領域にデータが書込まれていれば、指定されたデータ領域において未書込み状態の領域をレスポンスとして通知する点が図4に示す第1の処理例と異なる。なお、図5に示すステップS31−S34およびS36−S41は、それぞれ図4に示すステップS11−S14およびS16−S21とほぼ同様であるため、詳細な説明を省略するものとする。   In the second processing example shown in FIG. 5, when a write command is received, if data is written in the data area designated by the write command, an unwritten area is designated in the designated data area. The point of notification as a response is different from the first processing example shown in FIG. Note that steps S31 to S34 and S36 to S41 shown in FIG. 5 are substantially the same as steps S11 to S14 and S16 to S21 shown in FIG.

すなわち、上記ICカード処理装置2から受信したライトコマンドで指定されたデータの書込み位置が未書込み状態でないと判断した場合、つまり、上記ICカード処理装置2から受信したライトコマンドで指定されたデータの書込み位置が書込み済みの状態であると判断した場合(ステップS34、NO)、上記制御素子11は、上記ステップS23と同様に、当該ライトコマンドで指定されたデータ領域における各ブロックに対応する各フラグのチェックを行う(ステップS43)。この各フラグのチェック処理では、指定されたデータ領域において未書き込み状態であることを示している最初のフラグを検出する。   That is, when it is determined that the write position of the data specified by the write command received from the IC card processing apparatus 2 is not in an unwritten state, that is, the data specified by the write command received from the IC card processing apparatus 2 When it is determined that the write position is in a written state (step S34, NO), the control element 11 determines each flag corresponding to each block in the data area specified by the write command, similarly to step S23. Is checked (step S43). In the flag check process, the first flag indicating that the designated data area is not yet written is detected.

上記各フラグのチェック処理の結果により未書込み状態の最初のフラグが検出されると、上記制御素子11は、当該データ領域において未書込み状態の最初のフラグが対応するブロックが未書込み状態であると判定する。この判定結果に基づいて、上記制御素子11は、当該ライトコマンドで指定された書込み位置がデータ書込み済みであるためデータ書込みが不可である旨の通知とともに、当該ライトコマンドで指定されたデータ領域における未書込み領域を示す情報をICカード処理装置2へ通知する処理を行う(ステップS44)。この際、たとえば、データ領域における未書込み領域を示す情報としては、当該データ領域の先頭からの未書込み領域の先頭のアドレス(未書込みのブロックの先頭アドレス)を通知する。   When the first flag in the unwritten state is detected as a result of the check processing of each flag, the control element 11 determines that the block corresponding to the first flag in the unwritten state in the data area is in the unwritten state. judge. Based on the determination result, the control element 11 notifies the fact that data writing is impossible because the write position specified by the write command is already written, and in the data area specified by the write command. Processing for notifying the IC card processing device 2 of information indicating an unwritten area is performed (step S44). At this time, for example, as the information indicating the unwritten area in the data area, the start address of the unwritten area from the start of the data area (the start address of the unwritten block) is notified.

このような通知を受けたICカード処理装置では、ライトコマンドで指定したデータの書込み処理が失敗したことと、当該ライトコマンドで指定したデータ領域における未書込み領域を示す情報とを得る。これにより、上記ICカード処理装置2では、当該データ領域における未書込み状態の位置からデータの書込みを実行させるためのライトコマンドをICカード1へ送信する。このライトコマンドでは、ICカード1から通知された未書込み状態の先頭アドレスが書込み開始位置として指定され、当該書込み開始位置から書込まれるべきデータ(例えば、通信エラーとなったデータ以降のデータ)が書込みデータとして指定される。   Upon receiving such notification, the IC card processing apparatus obtains information indicating that the data writing process designated by the write command has failed and an unwritten area in the data area designated by the write command. As a result, the IC card processing apparatus 2 transmits to the IC card 1 a write command for executing data writing from an unwritten position in the data area. In this write command, the start address of the unwritten state notified from the IC card 1 is designated as the write start position, and data to be written from the write start position (for example, data after the data causing the communication error) is stored. Specified as write data.

このようなライトコマンドを受信した上記ICカード1では、当該コマンドで指定された位置を書込み開始位置として、上記ステップS32〜41の処理を行う。これにより、一度にバッファメモリとしてのワーキングメモリ13に格納しきれないようなサイズの大きいデータの書込み処理の途中で通信エラーなどのエラーが発生した場合であっても、エラーとなった位置から書込み処理を再開することが可能となる。   In the IC card 1 that has received such a write command, the processes specified in steps S32 to S41 are performed with the position specified by the command as the write start position. As a result, even if an error such as a communication error occurs during the process of writing large data that cannot be stored in the working memory 13 as a buffer memory at one time, writing is started from the position where the error occurred. Processing can be resumed.

上記のように、第2の処理例では、サイズの大きいデータをデータメモリ14に書込む場合、ICカード1は、当該データを格納するためのデータ領域を複数のブロックに分けた各ブロックの書込み処理が完了するごとに各ブロックに対応づけて設けられている各フラグをセットする。あるデータ領域へのデータの書込み処理が途中でエラーとなった状態において、再度、当該データ領域に対するデータの書込みコマンドを受信すると、上記ICカード1は、当該コマンドで指定されたデータ領域における各フラグをチェックすることにより未書き込み状態の領域(ブロック)を検出し、その未書き込み状態の領域を示す情報を通知する。この通知した未書込み状態の領域からのデータの書込みを要求するライトコマンドを受信した場合、上記ICカード1は、当該データ領域における未書込み状態の領域からデータの書込みを実行する。   As described above, in the second processing example, when writing large data to the data memory 14, the IC card 1 writes each block by dividing the data area for storing the data into a plurality of blocks. Each time processing is completed, each flag provided in association with each block is set. When a data write command for the data area is received again in a state where an error occurs in the process of writing data to a certain data area, the IC card 1 reads each flag in the data area specified by the command. Is checked, an unwritten area (block) is detected, and information indicating the unwritten area is notified. When the IC card 1 receives a write command for requesting data writing from the notified unwritten area, the IC card 1 executes data writing from the unwritten area in the data area.

また、上記ICカード処理装置2では、あるデータ領域へのデータの書込み処理が途中でエラーとなった旨を通知を受けた場合、再度、当該データ領域を指定したデータの書込みコマンドを送信すれば、そのコマンドに対するレスポンスとして、当該データ領域における未書き込み領域を示す情報を得ることができる。このような情報を取得した場合、上記ICカード処理装置2は、当該データ領域に対して未書込み状態の領域からのデータの書込みを要求する。これにより、上記のようなコマンドを受信したICカードでは、未書込み状態の領域(たとえば、通信エラーによりデータが書込めなかった領域)からのデータ書込み処理を再開することが可能となる。   Further, when the IC card processing apparatus 2 receives a notification that an error has occurred in the data write process to a certain data area, it can send a data write command specifying the data area again. As a response to the command, information indicating an unwritten area in the data area can be obtained. When such information is acquired, the IC card processing device 2 requests the data area to write data from an unwritten area. As a result, in the IC card that has received the command as described above, it is possible to resume the data writing process from an unwritten area (for example, an area in which data cannot be written due to a communication error).

次に、上記データメモリ14へのデータ書込み処理の第3の処理例について説明する。
図6は、上記データメモリ14へのデータ書込み処理の第3の処理例を説明するためのフローチャートである。なお、ここでは、ライトコマンドで指定されるデータメモリ14に書込むべきデータが複数に分割されてICカード1に供給される場合を想定するものとする。また、ここでは、データメモリ14において1回のみデータの書込みを可能するメモリ属性が設定されている領域(以下、1回書込み領域と称する)にデータを書込む処理を想定するものとする。
Next, a third processing example of the data writing process to the data memory 14 will be described.
FIG. 6 is a flowchart for explaining a third processing example of the data writing processing to the data memory 14. Here, it is assumed that the data to be written in the data memory 14 specified by the write command is divided into a plurality of parts and supplied to the IC card 1. Here, it is assumed that data is written in an area (hereinafter referred to as a once-write area) in which a memory attribute that allows data to be written only once is set in the data memory 14.

図6に示す第3の処理例は、書換えコマンド(アップデートコマンド)を受信した場合に、当該書換えコマンドで指定されたデータ領域が1回書込みの領域で、かつ、当該データ領域にデータが書込まれていれば、当該データ領域において未書込み状態の領域を示す情報をレスポンスとして通知する点が図4に示す第1の処理例と異なる。なお、図5に示すステップS51−S61は、それぞれ図4に示すステップS11−S21とほぼ同様であるため、詳細な説明を省略するものとする。   In the third processing example shown in FIG. 6, when a rewrite command (update command) is received, the data area specified by the rewrite command is a one-time write area, and data is written to the data area. If it is rare, it differs from the first processing example shown in FIG. 4 in that information indicating an unwritten area in the data area is notified as a response. Note that steps S51 to S61 shown in FIG. 5 are substantially the same as steps S11 to S21 shown in FIG.

すなわち、上記ICカード処理装置2から1回書込み領域を指定した書換えコマンドを受信した場合(ステップS62、NO)、上記制御素子11は、当該書換えコマンドで指定されたデータ領域(書換え領域)が1回書込み領域であるか否かを判断する(ステップS63)。この判断により指定された書換え領域が1回書込み領域であると判断した場合(ステップS63、YES)、上記制御素子11は、さらに、指定された書換え領域が未書込み状態であるか否かを判断する(ステップS64)。   That is, when a rewrite command designating a one-time write area is received from the IC card processing apparatus 2 (step S62, NO), the control element 11 has 1 data area (rewrite area) designated by the rewrite command. It is determined whether or not it is a rewrite area (step S63). If it is determined by this determination that the designated rewrite area is a one-time write area (step S63, YES), the control element 11 further determines whether or not the designated rewrite area is in an unwritten state. (Step S64).

この判断により指定された書換え領域が書込み済みであると判断した場合(ステップS64、NO)、つまり、書換えコマンドで指定された書換え領域が書込み済みの1回書込み領域である場合、上記制御素子11は、上記ステップS23と同様に、当該書換えコマンドで指定された書換え領域(データ領域)における各ブロックに対応する各フラグのチェックを行う(ステップS65)。この各フラグのチェック処理では、指定されたデータ領域における各ブロックに対応する各フラグのうち未書き込み状態であることを示している最初のフラグを検出する。   When it is determined by this determination that the designated rewrite area has been written (step S64, NO), that is, when the rewrite area designated by the rewrite command is a written once write area, the control element 11 As in step S23, each flag corresponding to each block in the rewrite area (data area) designated by the rewrite command is checked (step S65). In the flag check process, the first flag indicating that the flag is in an unwritten state is detected among the flags corresponding to the blocks in the designated data area.

上記各フラグのチェック処理の結果により未書込み状態の最初のフラグが検出されると、上記制御素子11は、当該データ領域において未書込み状態の最初のフラグが対応するブロックが未書込み状態であると判定する。この判定結果に基づいて、上記制御素子11は、当該書換えコマンドで指定されたデータの書換えが不可である旨の通知とともに、当該書換えコマンドで指定されたデータ領域における未書込み領域を示す情報をICカード処理装置2へ通知する処理を行う(ステップS66)。この際、たとえば、データ領域における未書込み領域を示す情報としては、当該データ領域の先頭からの未書込み領域の先頭のアドレス(未書込みのブロックの先頭アドレス)を通知する。   When the first flag in the unwritten state is detected as a result of the check processing of each flag, the control element 11 determines that the block corresponding to the first flag in the unwritten state in the data area is in the unwritten state. judge. Based on the determination result, the control element 11 sends information indicating an unwritten area in the data area specified by the rewrite command together with a notification that the data specified by the rewrite command cannot be rewritten. A process of notifying the card processing device 2 is performed (step S66). At this time, for example, as the information indicating the unwritten area in the data area, the start address of the unwritten area from the start of the data area (the start address of the unwritten block) is notified.

このような通知を受けたICカード処理装置2では、書換えコマンドで指定したデータの書換え処理が失敗したことと、当該書換えコマンドで指定したデータ領域における未書込み領域とを示す情報を得る。これにより、上記ICカード処理装置2では、当該データ領域における未書込み状態の位置からデータの書込みを実行させるためのライトコマンドをICカード1へ送信する。このライトコマンドでは、ICカード1から通知された未書込み状態の先頭アドレスが書込み開始位置として指定され、当該書込み開始位置から書込まれるべきデータ(例えば、通信エラーとなったデータ以降のデータ)が書込みデータとして指定される。   Upon receiving such notification, the IC card processing device 2 obtains information indicating that the data rewrite process designated by the rewrite command has failed and the unwritten area in the data area designated by the rewrite command. As a result, the IC card processing apparatus 2 transmits to the IC card 1 a write command for executing data writing from an unwritten position in the data area. In this write command, the start address of the unwritten state notified from the IC card 1 is designated as the write start position, and data to be written from the write start position (for example, data after the data causing the communication error) is stored. Specified as write data.

このようなライトコマンドを受信した上記ICカード1では、当該コマンドで指定された位置を書込み開始位置として、上記ステップS52〜61の処理を行う。これにより、一度にバッファメモリとしてのワーキングメモリ13に格納しきれないようなサイズの大きいデータの書込み処理の途中で通信エラーなどのエラーが発生した場合であっても、エラーとなった位置から書込み処理を再開することが可能となる。   In the IC card 1 that has received such a write command, the processes in steps S52 to S61 are performed with the position specified by the command as the write start position. As a result, even if an error such as a communication error occurs during the process of writing large data that cannot be stored in the working memory 13 as a buffer memory at one time, writing is started from the position where the error occurred. Processing can be resumed.

上記のように、第3の処理例では、サイズの大きいデータをデータメモリ14における1回書込み領域に書込む行う場合、当該データを格納するためのデータ領域を複数のブロックに分けた各ブロックの書込み処理が完了するごとに各ブロックに対応づけて設けられている各フラグをセットする。あるデータ領域へのデータの書込み処理が途中でエラーとなった状態において、再度、当該データ領域に対するデータの書換えコマンドを受信すると、上記ICカード1は、当該書換えコマンドで指定されたデータ領域において各フラグをチェックすることにより未書き込み状態の領域(ブロック)を検出し、その未書込み状態の領域を示す情報を通知する。この通知した未書込み状態の領域からのデータの書込みを要求するライトコマンドを受信した場合、上記ICカード1は、当該データ領域における未書込み状態の領域からデータの書込みを実行する。   As described above, in the third processing example, when large-size data is written into the write area once in the data memory 14, the data area for storing the data is divided into a plurality of blocks. Each time the writing process is completed, each flag provided in association with each block is set. When a data rewrite command for the data area is received again in a state where an error occurs in the process of writing data to a certain data area, the IC card 1 receives each data area specified by the rewrite command. An unwritten area (block) is detected by checking the flag, and information indicating the unwritten area is notified. When the IC card 1 receives a write command for requesting data writing from the notified unwritten area, the IC card 1 executes data writing from the unwritten area in the data area.

また、ICカード処理装置2では、あるデータ領域へのデータの書込み処理が途中でエラーとなった旨を通知を受けた場合、再度、当該データ領域を指定したデータの書換えコマンドを送信すれば、そのコマンドに対するレスポンスとして、当該データ領域における未書き込み状態の領域を示す情報を得ることができる。このような情報を取得した場合、上記ICカード処理装置2は、当該データ領域に対して未書込み状態の領域からのデータの書込みを要求することができる。このようなコマンドを受信したICカードでは、未書込み状態の領域(たとえば、通信エラーによりデータが書込めなかった領域)からのデータ書込み処理を再開することが可能となる。   In addition, in the IC card processing device 2, when receiving a notification that an error has occurred in the data writing process to a certain data area, if the data rewrite command specifying the data area is transmitted again, As a response to the command, information indicating an unwritten area in the data area can be obtained. When such information is acquired, the IC card processing apparatus 2 can request data writing from the unwritten area to the data area. In an IC card that has received such a command, it is possible to resume data writing processing from an unwritten area (for example, an area in which data cannot be written due to a communication error).

上記のように、本実施の形態に係るICカード1は、一度にバッファメモリとしてのワーキングメモリ13に格納しきれないようなサイズの大きいデータをデータメモリ14に書込む場合、当該データを格納するためのデータ領域を複数のブロックに分けて各ブロックの書込み処理が完了するごとに各ブロックに対応づけて設けられている各フラグをセットする。上記データ領域における未書込み状態の位置を調査する場合、ICカード1は、当該データ領域における各フラグをチェックすることにより未書込み状態の領域(ブロック)を判定する。これにより、サイズの大きいデータの書込み処理の途中で通信エラーなどのエラーが発生した場合であっても、未書込み状態の領域を容易に検出でき、効率的に書込み処理を再開することができる。   As described above, when the IC card 1 according to the present embodiment writes large data in the data memory 14 that cannot be stored in the working memory 13 as a buffer memory at a time, the IC card 1 stores the data. Each time the data area is divided into a plurality of blocks and the writing process of each block is completed, each flag provided in association with each block is set. When investigating the position of the unwritten state in the data area, the IC card 1 determines the unwritten area (block) by checking each flag in the data area. As a result, even when an error such as a communication error occurs in the middle of a large data write process, an unwritten region can be easily detected and the write process can be efficiently restarted.

本実施の形態に係るICカードおよびICカードを含むシステムの構成例を示すブロック図。The block diagram which shows the structural example of the system containing the IC card which concerns on this Embodiment, and an IC card. 非接触式ICカードの全体の構成例を示す図。The figure which shows the example of a whole structure of a non-contact-type IC card. データメモリ内においてあるデータを格納するためのデータ領域の構成例を示す図。The figure which shows the structural example of the data area for storing a certain data in a data memory. データメモリへのデータ書込み処理の第1の処理例を説明するためのフローチャート。The flowchart for demonstrating the 1st process example of the data write-in process to a data memory. データメモリへのデータ書込み処理の第2の処理例を説明するためのフローチャート。The flowchart for demonstrating the 2nd process example of the data write-in process to a data memory. データメモリへのデータ書込み処理の第3の処理例を説明するためのフローチャート。The flowchart for demonstrating the 3rd process example of the data write-in process to a data memory.

符号の説明Explanation of symbols

C…本体、M…モジュール、1…ICカード、1a…ICチップ、2…ICカード処理装置、11…制御素子、12…プログラムメモリ、13…ワーキングメモリ、14…データメモリ、15…通信制御部、16…電源部、17…インターフェース、21…制御装置、22…カードリーダライタ、40…データA領域(データ領域、データファイル、記憶手段)、41(41a、41b、…、41n、…)…ブロック領域(ブロック)、42(42a、42b、…、42n、…)…フラグ領域(フラグ)   C ... Main body, M ... Module, 1 ... IC card, 1a ... IC chip, 2 ... IC card processing device, 11 ... Control element, 12 ... Program memory, 13 ... Working memory, 14 ... Data memory, 15 ... Communication control unit , 16 ... power supply unit, 17 ... interface, 21 ... control device, 22 ... card reader / writer, 40 ... data A area (data area, data file, storage means), 41 (41a, 41b, ..., 41n, ...) ... Block area (block), 42 (42a, 42b, ..., 42n, ...) ... Flag area (flag)

Claims (9)

外部装置から供給されるコマンドに応じて動作する携帯可能電子装置において、
複数のブロック領域と各ブロックに対応づけられている複数のフラグ領域とからなるデータ領域を有する記憶手段と、
前記外部装置から前記データ領域へのデータの書込みを要求する命令が与えられた場合、各ブロック領域にデータを書込むごとに対応する各フラグ領域にデータが書込み済みであることを示す情報を書込む書込み手段と、
前記フラグ領域に格納されている情報に基づいて前記データ領域における各ブロック領域のうちデータが未書込み状態のブロック領域を検出する検出手段と、
この検出手段により検出された未書込み状態のブロック領域を示す情報を前記外部装置へ出力する出力手段と、
を有することを特徴とする携帯可能電子装置。
In a portable electronic device that operates in response to a command supplied from an external device,
A storage means having a data area composed of a plurality of block areas and a plurality of flag areas associated with each block;
When an instruction to write data to the data area is given from the external device, information indicating that data has been written to each corresponding flag area is written each time data is written to each block area. Writing means to include,
Detecting means for detecting a block area in which data is not written among the block areas in the data area based on information stored in the flag area;
Output means for outputting information indicating the unwritten block area detected by the detection means to the external device;
A portable electronic device comprising:
さらに、前記外部装置から前記データ領域においてデータが未書込み状態の領域を示す情報を要求する命令が与えられた場合、前記検出手段により未書き込み状態のブロック領域を検出し、前記出力手段により前記検出手段で検出した未書き込み状態のブロック領域を示す情報を前記外部装置へ出力する制御手段を有する、
ことを特徴とする前記請求項1に記載の携帯可能電子装置。
Further, when an instruction for requesting information indicating an unwritten area in the data area is given from the external device, the detecting section detects the unwritten block area, and the output section detects the detected area. Control means for outputting information indicating the unwritten block area detected by the means to the external device,
The portable electronic device of claim 1, wherein the portable electronic device is a portable electronic device.
さらに、前記外部装置から前記データ領域へのデータの書込みを要求する命令が与えられた場合、前記データ領域にデータが書込まれているか否かを判断する判断手段と、
この判断手段により前記データ領域にデータが書込まれていると判断した場合、前記検出手段により未書き込み状態のブロック領域を検出し、前記出力手段により前記検出手段で検出した未書き込み状態のブロック領域を示す情報を前記外部装置へ出力する制御手段と、を有し、
前記書込み手段は、前記判断手段により前記データ領域にデータが書込まれていないと判断した場合、各ブロック領域にデータを書込むごとに対応する各フラグ領域にデータが書込み済みであることを示す情報を書込む、
ことを特徴とする前記請求項1に記載の携帯可能電子装置。
Further, when an instruction for requesting writing of data to the data area is given from the external device, determination means for determining whether data is written to the data area;
When it is determined by the determining means that data is written in the data area, the detecting means detects the unwritten block area, and the output means detects the unwritten block area. Control means for outputting information indicating the above to the external device,
When the writing means determines that data is not written in the data area, the writing means indicates that data has been written in each corresponding flag area every time data is written in each block area. Write information,
The portable electronic device of claim 1, wherein the portable electronic device is a portable electronic device.
さらに、前記外部装置から前記データ領域に対するデータの書換えを要求する命令が与えられた場合、前記データ領域にデータが書込まれているか否かを判断する判断手段と、
この判断手段により前記データ領域にデータが書込まれていると判断した場合、前記検出手段により未書き込み状態のブロック領域を検出し、前記出力手段により前記検出手段で検出した未書き込み状態のブロック領域を示す情報を前記外部装置へ出力する制御手段と、を有する、
ことを特徴とする前記請求項1に記載の携帯可能電子装置。
Further, when an instruction for requesting rewriting of data for the data area is given from the external device, determination means for determining whether data is written in the data area;
When it is determined by the determination means that data is written in the data area, the detection means detects the unwritten block area, and the output means detects the unwritten block area. Control means for outputting information indicating the above to the external device,
The portable electronic device of claim 1, wherein the portable electronic device is a portable electronic device.
前記出力手段は、前記検出手段により検出された未書込み状態のブロック領域と書込み済みのブロック領域との境界位置を示す情報を前記データ領域における未書込み領域の先頭位置として出力する、
ことを特徴とする前記請求項1乃至4に記載の携帯可能電子装置。
The output means outputs information indicating a boundary position between the unwritten block area detected by the detecting means and the written block area as a start position of the unwritten area in the data area;
The portable electronic device according to claim 1, wherein the portable electronic device is a portable electronic device.
外部装置から供給されるコマンドに応じて動作する携帯可能電子装置に用いられる制御方法であって、
前記外部装置から複数のブロック領域と各ブロック領域に対応づけられている複数のフラグ領域とを有するデータ領域へのデータの書込みを要求する命令が与えられた場合、前記データを各ブロック領域に順次書込み、
前記各ブロック領域にデータを書込むごとに対応する各フラグ領域にデータが書込み済みであることを示す情報を書込み、
前記データ領域への前記データの書込みがエラーとなった場合、前記各フラグ領域に格納されている情報に基づいて前記データ領域における各ブロック領域のうちデータが未書込み状態のブロック領域を検出し、
この検出された未書込み状態のブロック領域を示す情報を前記外部装置へ出力する、
ことを特徴とする携帯可能電子装置の制御方法。
A control method used for a portable electronic device that operates in response to a command supplied from an external device,
When an instruction requesting data writing to a data area having a plurality of block areas and a plurality of flag areas associated with each block area is given from the external device, the data is sequentially transferred to each block area. writing,
Each time data is written to each block area, information indicating that data has been written to each corresponding flag area is written,
When writing of the data to the data area results in an error, based on the information stored in the flag area, the block area in the data area is detected in the block area where the data is not written,
Output information indicating the detected unwritten block area to the external device,
A method for controlling a portable electronic device.
さらに、前記外部装置から前記データ領域においてデータが未書込み状態の領域を示す情報を要求する命令が与えられた場合、前記検出により未書き込み状態のブロック領域を検出し、前記検出により検出した未書き込み状態のブロック領域を示す情報を前記外部装置へ出力する、
ことを特徴とする前記請求項6に記載の携帯可能電子装置の制御方法。
Further, when an instruction for requesting information indicating an unwritten area in the data area is given from the external device, an unwritten block area is detected by the detection, and the unwritten detected by the detection Outputting information indicating the block area of the state to the external device;
The method for controlling a portable electronic device according to claim 6, wherein:
さらに、前記外部装置から前記データ領域へのデータの書込みを要求する命令が与えられた場合、前記データ領域にデータが書込まれているか否かを判断し、
この判断により前記データ領域にデータが書込まれていると判断した場合、前記検出により前記データ領域における未書き込み状態のブロック領域を検出し、前記検出により検出した未書き込み状態のブロック領域を示す情報を前記外部装置へ出力し、
前記各ブロック領域への書込みは、前記判断により前記データ領域にデータが書込まれていないと判断した場合、前記データを各ブロック領域に書込む、
ことを特徴とする前記請求項6に記載の携帯可能電子装置の制御方法。
Further, when an instruction for requesting writing of data to the data area is given from the external device, it is determined whether or not data is written to the data area,
When it is determined by this determination that data is written in the data area, the detection indicates a block area in the data area that is not yet written, and information indicating the block area that is in the unwritten state detected by the detection To the external device,
The writing to each block area, if it is determined by the determination that no data is written to the data area, the data is written to each block area,
The method for controlling a portable electronic device according to claim 6, wherein:
さらに、前記外部装置から前記データ領域に対するデータの書換えを要求する命令が与えられた場合、前記データ領域にデータが書込まれているか否かを判断し、
この判断により前記データ領域にデータが書込まれていると判断した場合、前記検出により前記データ領域における未書き込み状態のブロック領域を検出し、前記検出により検出した未書き込み状態のブロック領域を示す情報を前記外部装置へ出力する、
ことを特徴とする前記請求項6に記載の携帯可能電子装置の制御方法。
Further, when an instruction for requesting data rewriting to the data area is given from the external device, it is determined whether data is written in the data area,
When it is determined by this determination that data is written in the data area, the detection indicates a block area in the data area that is not yet written, and information indicating the block area that is in the unwritten state detected by the detection To the external device,
The method for controlling a portable electronic device according to claim 6, wherein:
JP2007157871A 2007-06-14 2007-06-14 Portable electronic equipment and control method for potable electronic equipment Pending JP2008310596A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2007157871A JP2008310596A (en) 2007-06-14 2007-06-14 Portable electronic equipment and control method for potable electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2007157871A JP2008310596A (en) 2007-06-14 2007-06-14 Portable electronic equipment and control method for potable electronic equipment

Publications (1)

Publication Number Publication Date
JP2008310596A true JP2008310596A (en) 2008-12-25

Family

ID=40238138

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2007157871A Pending JP2008310596A (en) 2007-06-14 2007-06-14 Portable electronic equipment and control method for potable electronic equipment

Country Status (1)

Country Link
JP (1) JP2008310596A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2018049389A (en) * 2016-09-20 2018-03-29 凸版印刷株式会社 Storage medium device and program
JP2019079349A (en) * 2017-10-25 2019-05-23 大日本印刷株式会社 IC card and terminal device
WO2019159715A1 (en) * 2018-02-16 2019-08-22 日立オートモティブシステムズ株式会社 Vehicle control device and program update system
JP7468754B1 (en) 2023-06-01 2024-04-16 大日本印刷株式会社 ELECTRONIC INFORMATION STORAGE MEDIUM, IC CHIP, IC CARD, RECEPTION BLOCK PROCESSING METHOD, AND PROGRAM

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2018049389A (en) * 2016-09-20 2018-03-29 凸版印刷株式会社 Storage medium device and program
JP2019079349A (en) * 2017-10-25 2019-05-23 大日本印刷株式会社 IC card and terminal device
WO2019159715A1 (en) * 2018-02-16 2019-08-22 日立オートモティブシステムズ株式会社 Vehicle control device and program update system
CN111684416A (en) * 2018-02-16 2020-09-18 日立汽车系统株式会社 Vehicle control device and program update system
JPWO2019159715A1 (en) * 2018-02-16 2020-12-03 日立オートモティブシステムズ株式会社 Vehicle control device and program update system
JP7044859B2 (en) 2018-02-16 2022-03-30 日立Astemo株式会社 Vehicle control device and program update system
US11449329B2 (en) 2018-02-16 2022-09-20 Hitachi Astemo, Ltd. Vehicle control device and program update system
CN111684416B (en) * 2018-02-16 2023-09-29 日立安斯泰莫株式会社 Vehicle control device and program update system
JP7468754B1 (en) 2023-06-01 2024-04-16 大日本印刷株式会社 ELECTRONIC INFORMATION STORAGE MEDIUM, IC CHIP, IC CARD, RECEPTION BLOCK PROCESSING METHOD, AND PROGRAM

Similar Documents

Publication Publication Date Title
US20050289291A1 (en) Mobile electronic equipment
JP4896837B2 (en) Portable electronic device and method for controlling portable electronic device
JP2010182270A (en) Mobile electronic apparatus and data management method in mobile electronic apparatus
KR101783526B1 (en) Ic card, electronic device and portable electronic device
JP2008310596A (en) Portable electronic equipment and control method for potable electronic equipment
JP4776462B2 (en) Portable electronic device and method for controlling portable electronic device
US20120234926A1 (en) Portable electronic apparatus
JP6233134B2 (en) Electronic information storage medium, information processing method, and information processing program
US10461971B2 (en) IC card, portable electronic device, program, processing apparatus, and processing system
KR101530479B1 (en) Ic card and portable electronic device
JP4868979B2 (en) Portable electronic device and IC card
JP2006293706A (en) Multi-application ic card with application updating function
JP5341947B2 (en) IC card, control method of IC card, and control method of portable electronic device
JP4965909B2 (en) IC card
JP6325394B2 (en) IC card, portable electronic device, and IC card processing device
JP2004185419A (en) Portable electronic medium, issuing system of portable electronic medium, processing method, and issuing method
JP2014059806A (en) Ic card, portable electronic device, and ic card processor
JP7433886B2 (en) IC cards and IC card control programs
JP5038918B2 (en) Portable electronic device and method for controlling portable electronic device
JP4357327B2 (en) Non-contact IC card system
JP2008305263A (en) Nonvolatile semiconductor storage device and memory management method
JP2017142655A (en) Electronic information storage medium, information processing method, and information processing program
JP6281302B2 (en) Information processing apparatus, IC card, and data processing method
JP2005338924A (en) Nonvolatile memory to be used for portable electronic equipment and portable electronic equipment
JP2009075816A (en) Portable electronic device, and method of managing data in portable electronic device