CN103135735B - Power down protection control method and system - Google Patents

Power down protection control method and system Download PDF

Info

Publication number
CN103135735B
CN103135735B CN201110382102.0A CN201110382102A CN103135735B CN 103135735 B CN103135735 B CN 103135735B CN 201110382102 A CN201110382102 A CN 201110382102A CN 103135735 B CN103135735 B CN 103135735B
Authority
CN
China
Prior art keywords
power down
power
mark
field data
data
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.)
Active
Application number
CN201110382102.0A
Other languages
Chinese (zh)
Other versions
CN103135735A (en
Inventor
陈皓
侯丙营
聂慧萍
张磊
余彦
张福军
高阳
张晓佳
张卉
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.)
Aisino Corp
Original Assignee
Aisino 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 Aisino Corp filed Critical Aisino Corp
Priority to CN201110382102.0A priority Critical patent/CN103135735B/en
Publication of CN103135735A publication Critical patent/CN103135735A/en
Application granted granted Critical
Publication of CN103135735B publication Critical patent/CN103135735B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The invention discloses a method and a system of power down protection control. If the system judges that the main power supply powers off, a power down mark is positioned, and site data is stored through power supplied by a backup power supply. The site data comprises power down data, a current process mark and a power down mark. The system restores the system through the stored site data. The method and the system of the power down protection control solve the problem of incomplete machine data due to sudden power down of the machine.

Description

A kind of control method of power down protection and system
Technical field
The present invention relates to data protection and recover field and in particular to a kind of control method of power down protection and system.
Background technology
Under the overall background of national " golden tax project ", in the past few years tax-control cash register, network are all being promoted successively in all parts of the country The tax-controlling devices such as billing machine, are beaten and electronic management with the machine realizing invoice issuing.Such product is related to state tax revenue, to machine In interior data, ic card, the integrality of data, printing invoice data etc. has very strict requirements.The national standard of tax-control cash register Also clear stipulaties need to carry out power down protection the controlling cashier power-cut-off contiuous printing and it needs to realize invoice to invoice data, tax-control data.Tax control Cashing machine is a complicated embedded computer system, realizes the safety of data by the tax control ic card of filling AES Storage and the control of authority of making out an invoice, the related business operation of tax control is required for mutually being verified with ic card and just can complete, and needs Want ic card that data is digitally signed.So, all of tax control business operation be required for carrying out power down protection it is ensured that machine with The uniformity of data and integrality in ic card.Network billing machine is a class derived product of tax-control cash register, and it does not use tax control Ic card, and realize the security controls such as data encryption, signature using usbkey.
From the aforegoing it can be seen that the tax control implement such as tax-control cash register, network billing machine is distributed, is imported in invoice, invoice start, Produced data in the business procedures such as data declaration, needs the encryption through tax control ic card or usbkey built-in algorithms or label Name, data needs are each in tax control implement and ic card/usbkey simultaneously stores portion.In the event of system in these business procedures Suddenly power down, if the technical scheme of the perfect protection of neither one and recovery is it is easy to machine and ic card (or usbkey) The inconsistent situation of middle data, or lead to machine data imperfect.
Content of the invention
The technical problem to be solved is to provide a kind of control method of power down protection and system, to solve machine The unexpected power down of device leads to the incomplete problem of machine data.
In order to solve the above problems, the invention provides a kind of control method of power down protection, comprising:
If system judges main power source power down, set power down identifies, and carries out storage scene by the power supply of stand-by power supply Data, described field data includes the data of power down, active procedure mark and power down mark;
System passes through the described field data of storage, and system is recovered.
Further, said method may also include that described active procedure mark includes current main procedure mark and this main mistake The subprocess mark having completed in journey.
Further, said method may also include that described system passes through the described field data of storage, system is carried out extensive Multiple step, comprising:
Described system reads the described field data of storage, if judging power down mark set.Then extract described scene number According to the subprocess mark having completed in the data of middle power down, current main procedure mark and this main procedure, execute this currently main mistake The subprocess not completed in journey, after complete paired systems are recovered, removes power down mark.
Further, after said method may also include that described system completes to store field data and power down mark, also include Turn off the power supply of stand-by power supply.
Present invention also offers a kind of control system of power down protection, comprising: main control module, memory module and standby electricity Source module, wherein,
Described main control module, if for judging main power source power down, set power down identifies, and passes through described stand-by power supply The power supply of module carries out storing field data;By the described field data of storage, system is recovered;
Described memory module, for storing field data, described field data includes the data of power down, active procedure mark Know and power down mark;
Described standby power supply module, for providing the electric energy needed for power down protection process.
Further, said system may also include that active procedure mark described in the field data that described memory module stores Know the subprocess mark including having completed in current main procedure mark and this main procedure.
Further, said system may also include that described main control module passes through the described field data of storage, to system Recovered, referred to:
Described main control module reads the described field data of storage, if judging power down mark set.Then extract described The subprocess mark having completed in the data of power down, current main procedure mark and this main procedure in field data, execution is deserved The subprocess not completed in front main procedure, after complete paired systems are recovered, removes power down mark.
Further, said system may also include that described main control module, is additionally operable to complete to store field data and power down After mark, turn off the power supply of stand-by power supply.
Further, said system may also include that described standby power supply module is capacity cell.
Compared with prior art, apply the present invention, solve the unexpected power down of machine and lead to the incomplete problem of machine data. The control method of the present invention not only achieves the power-down data protection of tax control business well and start recovers it is ensured that business is grasped The integrality made and the uniformity of machine card data are moreover it is possible to realize the controlling cashier power-cut-off contiuous printing of invoice well.The method realize simple, can Lean on, there is stronger versatility simultaneously, can apply and similar need to do in data and the system of process protection at other.
Brief description
Fig. 1 is the flow chart of the control method of power down protection of the present invention.
Fig. 2 is the structural representation of the control system of power down protection of the present invention.
Specific embodiment
The invention will be further described with reference to the accompanying drawings and detailed description.
The method of the present invention can be used for the power down protection of tax-controlling device, but is not limited to tax control field it can also be used to other classes As need power-down data protection and recover system (for example need scene protection with start recover embedded system) in.Should Control method is made up of two large divisions: power down protection process and start recovery process.Power down protection process, is to occur to break in system When electric trigger power-fail interrupt, backup battery provide short time power-on time in it would be desirable to protection field data data Store in nonvolatile storage such as flash, turn off backup battery afterwards.Start recovery process, is during system boot The power down mark of detection power down memory block and field data, field data (the power-off scene position according to the storage of power down protection process Put, critical data etc.), jump to power-off scene critical data and continue executing with, so that there is the process operation data of power down Can recover and normally be finished it is ensured that the integrality of data manipulation.If there is power down again in recovery process, can be again Execution protection process, i.e. this mechanism support multilayer nest protection.Start recovery process is finished backed off after random, continues normal startup System.
The control method of the present invention not only achieve well tax control business power-down data protection and start recover it is ensured that The uniformity of the integrality of business operation and machine card data is moreover it is possible to realize the controlling cashier power-cut-off contiuous printing of invoice well.The method is realized Simply, reliable, there is stronger versatility simultaneously, can apply and similar need to do the system of data and process protection at other In.
As shown in figure 1, a kind of control method of power down protection of the present invention, comprising:
If step 110, system judge main power source power down, set power down identifies, and is carried out by the power supply of stand-by power supply Storage field data, described field data includes the data of power down, active procedure mark and power down mark;
Described active procedure mark includes the subprocess mark having completed in current main procedure mark and this main procedure, its In a main procedure may include multiple subprocess.
The main procedure big business operation of correspondence, such as initialization, invoice distribution, invoice importing, invoice issuing, declare, pay taxes It is then that main procedure implements step and further segments Deng, subprocess.One main procedure comprises multiple subprocess, each height Process is a minimum atomic operation.So-called atomic operation is exactly that it executes once being necessary for completely terminating, and does not allow It is interrupted.One section of operation being surrounded by " pass power-fail interrupt " and " opening power-fail interrupt " a pair of operation is exactly atomic operation.By This is visible, just can respond power-fail interrupt between each subprocess of one main procedure of composition.For ensureing the real-time of interrupt response, Atomic operation is more short better.
The data of described power down is critical data, i.e. input data needed for residing main procedure.
Step 120, system pass through the described field data of storage, and system is recovered.
Described system passes through the described field data of storage, the step that system is recovered, comprising:
Described system reads the described field data of storage, if judging power down mark set.Then extract described scene number According to the subprocess mark having completed in the data of middle power down, current main procedure mark and this main procedure, execute this currently main mistake The subprocess not completed in journey, after complete paired systems are recovered, removes power down mark.Recover to ensure that business is grasped by system The integrality made and the uniformity of machine card data are moreover it is possible to realize the controlling cashier power-cut-off contiuous printing of invoice well.
Also include: after described system completes to store field data and power down mark, also include turning off the power supply of stand-by power supply, To keep its electricity.
As shown in Fig. 2 present invention also offers a kind of control system of power down protection, including main control module 21, storing Module 22 and standby power supply module 23, wherein,
Described main control module 21, if for judging main power source power down, set power down identifies, and by described standby electricity The power supply of source module 23 carries out storing field data;By the described field data of storage, system is recovered;
Described memory module 22, for storing field data, described field data includes the data of power down, active procedure Mark and power down mark;
Described standby power supply module 23, for providing the electric energy needed for power down protection process.
Described in the field data of described memory module 22 storage, active procedure mark includes current main procedure mark and is somebody's turn to do The subprocess mark having completed in main procedure, described memory module can include internal memory ram and nonvolatile storage flash Deng.
Described main control module passes through the described field data of storage, system is recovered, refers to:
Described main control module reads the described field data of storage, if judging power down mark set.Then extract described The subprocess mark having completed in the data of power down, current main procedure mark and this main procedure in field data, execution is deserved The subprocess not completed in front main procedure, after complete paired systems are recovered, removes power down mark.
Described main control module 21, after being additionally operable to complete to store field data and power down mark, turns off the confession of stand-by power supply Electricity.
Described standby power supply module is capacity cell, and capacity cell can be that the farad capacitor of 1-3f (can provide the 2-3 second Power supply) or kuf rank electrochemical capacitor (circuit stability to be protected can be provided more than 0.5 second to power) etc..
With reference to example, this method is illustrated using flow process.
The enforcement of the present invention essentially consists in the design of the business software of protected system, but also relies on hardware one Individual backup battery circuit, provides the electric energy needed for power down protection process.Stand-by power supply circuit discharge and recharge can control, and typically may be used Do energy storage device with the farad capacitor of 1-3f, according to the power consumption of circuit to be protected, energy storage device provides the power supply of 2-3 second, that is, The needs of power down protection can be met, and leave larger surplus.Circuit to be protected includes cpu, internal memory ram, non-volatile memory Device flash etc..In general, using the teaching of the invention it is possible to provide circuit stability to be protected powers more than 0.5 second (or even can be with shorter time) Ensure the normal work of power-down protection, therefore energy storage device also can use the electrochemical capacitor of kuf rank.This circuit realiration letter Single, with low cost.
In normal system operation, while main power source charges to stand-by power supply, provide after stand-by power supply circuit Cpu, ram etc. use, and main power source is also monitored by cpu simultaneously.During system accident power-off, power sense circuit provides power-fail interrupt letter Number give cpu, main power source turns simultaneously is provided by stand-by power supply.After cpu receives interrupt requests, complete within the time that stand-by power supply provides Become the work such as the field data storage of power down protection.After completing scene protection, cpu can also actively turn off the confession of stand-by power supply Electricity, to keep its electricity.
Power down protection and recovery process need software to realize.It would be desirable to an independent business of protection is grasped on software It is defined as a main procedure, such as invoice distribution main procedure, invoice issuing main procedure, data declaration main procedure etc..Each main mistake Some operating procedures that journey is comprised according to it again, are divided into several subprocess.Give one to each main procedure, subprocess Unique process number, such as: main procedure 1,2 ..n, subprocess 11,12,1n of No. 1 main procedure etc..
Power down protection process, comprising: the order execution of several subprocess constitutes a main procedure.One subprocess is opened During the beginning, first check whether to preserve the input data (critical data) needed for residing main procedure to power failure data structure In, such as do not preserve and then execute preservation.Shield power-fail interrupt afterwards, to ensure its atomicity;Then main procedure mark will be presently in Know and subprocess mark write power failure data structure, and set power down mark;Next execution subprocess operation, end of operation After open power-fail interrupt.So, a complete subprocess operation is carried out finishing.Due to can only be in the afterbody of a subprocess Response power-fail interrupt, therefore when system occurs power down to carry out interrupt processing, in power failure data structure, always stored power down Critical data, current main procedure mark, completed subprocess mark and power down mark, interrupt processing can be by power down Data Cun Chudao power down file or the power down subregion of nonvolatile storage flash, so that start recovery process uses.As all In subprocess implementation procedure, if there is not power down, power down mark can be removed at main procedure end, to prevent execution start extensive Multiple.So far, a complete main business process is disposed.When there is not power down in normal execution, power down mark will not set, just Often operation is unaffected by removing electrical power;Once there is power down in intermediate link, can be by field data (critical data, the boss in this moment Process identifier, power down mark etc.) write power down file or power failure data area in interrupt processing, thus it is existing to realize complete power down Script holder records.
Start recovery process, comprising: in system boot initialization procedure, has the subprocess that a step power down checks and recovers. Read power down file or power failure data area information first, check that power down identifies whether set.As this subprocess is then jumped out in non-set, Continue executing with other initialization steps;As set, then continue to extract the main procedure mark of power down and subprocess mark, jump to phase The field position answered, completes the execution of this main procedure residue subprocess, thus ensureing main procedure data and behaviour using critical data The integrality made, finally ensures the uniformity of data and integrality in machine, ic card, usbkey.After the completion of recovering subprocess, continue Continuous other initialization steps of execution, completion system normally starts.
The above, the only present invention preferably specific embodiment, but protection scope of the present invention is not limited thereto, Any people being familiar with this technology disclosed herein technical scope in, the change or replacement that can readily occur in, all should cover Within protection scope of the present invention.Therefore, protection scope of the present invention should be defined by scope of the claims.

Claims (7)

1. a kind of control method of power down protection is it is characterised in that include:
If system judges main power source power down, set power down identifies, and sends power-fail interrupt signal to cpu, and passes through stand-by power supply Power supply carry out store field data, described field data includes the data of power down, current main procedure identify and this main procedure In completed subprocess mark, power down mark;Wherein, each subprocess is an atomic operation;
In start process upon power-up of the system, detect power down mark condition and the field data of power down memory block, according to power down protection The field data of process storage, jumps to power-off scene, continues executing with operation with the field data of described storage, recovers and normal It is finished and the atomic operation process of power down occurs, system is recovered.
2. the method for claim 1 it is characterised in that
The described step that system is recovered, comprising:
Described system reads the described field data of storage, if judging power down mark set, extracts in described field data The subprocess mark having completed in the data of power down, current main procedure mark and this main procedure, executes in this current main procedure Undone subprocess, after complete paired systems are recovered, removes power down mark.
3. the method for claim 1 it is characterised in that
Also include: after described system completes to store field data and power down mark, also include turning off the power supply of stand-by power supply.
4. a kind of control system of power down protection is it is characterised in that include: main control module, memory module and stand-by power supply mould Block, wherein,
Described main control module, if for judging main power source power down, set power down identifies, and sends power-fail interrupt signal to cpu, And carry out storing field data by the power supply of described standby power supply module;By the described field data of storage, in system In start process after electricity, detect power down mark condition and the field data of power down memory block, according to showing of power down protection process storage Field data, jumps to power-off scene, continues executing with operation with the field data of described storage, recover and the generation that is normally finished The atomic operation process of power down, recovers to system;
Described memory module, for storing field data, described field data includes the data of power down, current main procedure mark And the subprocess mark having completed in this main procedure, power down identify;Wherein, each subprocess is an atomic operation;
Described standby power supply module, for providing the electric energy needed for power down protection process.
5. system as claimed in claim 4 it is characterised in that
Described system is recovered, refer to:
Described main control module reads the described field data of storage, if judging power down mark set, extracts described scene The subprocess mark having completed in the data of power down, current main procedure mark and this main procedure in data, executes this current master During do not complete subprocess, after complete paired systems are recovered, remove power down mark.
6. system as claimed in claim 4 it is characterised in that
Described main control module, after being additionally operable to complete to store field data and power down mark, turns off the power supply of stand-by power supply.
7. system as claimed in claim 4 it is characterised in that
Described standby power supply module is capacity cell.
CN201110382102.0A 2011-11-25 2011-11-25 Power down protection control method and system Active CN103135735B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201110382102.0A CN103135735B (en) 2011-11-25 2011-11-25 Power down protection control method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201110382102.0A CN103135735B (en) 2011-11-25 2011-11-25 Power down protection control method and system

Publications (2)

Publication Number Publication Date
CN103135735A CN103135735A (en) 2013-06-05
CN103135735B true CN103135735B (en) 2017-01-25

Family

ID=48495682

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201110382102.0A Active CN103135735B (en) 2011-11-25 2011-11-25 Power down protection control method and system

Country Status (1)

Country Link
CN (1) CN103135735B (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105512056A (en) * 2014-09-24 2016-04-20 中兴通讯股份有限公司 Method and device for data storage, and terminal
CN105938447B (en) 2015-03-06 2018-12-14 华为技术有限公司 Data backup device and method
WO2016141817A1 (en) * 2015-03-06 2016-09-15 华为技术有限公司 Data backup device and method
CN104698945B (en) * 2015-03-20 2018-06-19 国家电网公司 A kind of power module for showing power down time
CN105262632A (en) * 2015-11-25 2016-01-20 武汉微创光电股份有限公司 Network transmission equipment power failure alarming system and method in network video monitoring
CN108532115B (en) * 2018-03-30 2020-10-09 常熟长润智能科技有限公司 PWM control system for controlling circular knitting machine
CN110851312A (en) * 2019-11-13 2020-02-28 深圳忆联信息系统有限公司 Test method and device for rapidly simulating power failure protection and computer equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5414861A (en) * 1991-09-11 1995-05-09 Fujitsu Limited Data protection system using different levels of reserve power to maintain data in volatile memories for any period of time
CN1804907A (en) * 2006-01-18 2006-07-19 成都前锋电子电器集团股份有限公司 Tax controlled cash register
CN2847397Y (en) * 2005-12-23 2006-12-13 成都卫士通信息产业股份有限公司 Tax control cashier machine for core circuit individual power supply
CN101661565A (en) * 2009-09-24 2010-03-03 北京握奇数据系统有限公司 Power-off protection method of intelligent card with Mifare simulation function, device and system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5414861A (en) * 1991-09-11 1995-05-09 Fujitsu Limited Data protection system using different levels of reserve power to maintain data in volatile memories for any period of time
CN2847397Y (en) * 2005-12-23 2006-12-13 成都卫士通信息产业股份有限公司 Tax control cashier machine for core circuit individual power supply
CN1804907A (en) * 2006-01-18 2006-07-19 成都前锋电子电器集团股份有限公司 Tax controlled cash register
CN101661565A (en) * 2009-09-24 2010-03-03 北京握奇数据系统有限公司 Power-off protection method of intelligent card with Mifare simulation function, device and system

Also Published As

Publication number Publication date
CN103135735A (en) 2013-06-05

Similar Documents

Publication Publication Date Title
CN103135735B (en) Power down protection control method and system
CN103207975B (en) The method of protection password and computing machine
CN103425506A (en) Powering off method, starting up method and communication terminal
USRE47621E1 (en) Secure transaction microcontroller with secure boot loader
CN103995578B (en) A kind of device driver with data continuous-mode
TWI221957B (en) Automatic recovery of integrated circuit cards
CN101840365B (en) Safe protection method and system for BIOS (Basic Input/Output System)
CN106227680B (en) A kind of data processing and power fail preventing data guard method
CN106557145A (en) Circuit breaking protective system and its method
DE4337055A1 (en) Protection of user data for battery-powered lap-top or notebook portable personal computer - performs special-operating-system-interruption and BIOS-system-interruption operations depending upon state of power supply switch to store user data on hard disk and status data of computer system in system manager RAM
CN105094876B (en) The upgrade processing method of CPLD, device and system
CN106873990A (en) Multi partition bootstrap technique under embedded system RAM defective patterns
CN105955850A (en) Abnormal reset processing method and system for vehicle control unit
CN104205788A (en) Battery management scheme for nfc
CN106648016A (en) Power supply circuit, power supply equipment and power supply method
CN105528264A (en) Anti-misoperation data recovery method and system
CN105738855A (en) Intelligent electric meter embedded application-orientated test method
CN113608930A (en) System chip and electronic device
JPS6017144B2 (en) Banknote deposit/withdrawal device using credit card
JP2002543492A (en) Protection of the computer core against external manipulation
CN109460982A (en) Digital asset wallet anti-dismantling device and method
CN106654429A (en) Battery control method and system
CN2852489Y (en) Power-off protection circuit of tax-controlled cash register
CN201549015U (en) Selling and charging integrated machine
RU197324U1 (en) INTELLIGENT METER OF ELECTRIC ENERGY WITH REMOTE CONTROL OF ENCRYPTION OF INFORMATION

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant