CN103885828B - A kind of changing method of hardware resource - Google Patents
A kind of changing method of hardware resource Download PDFInfo
- Publication number
- CN103885828B CN103885828B CN201410137427.6A CN201410137427A CN103885828B CN 103885828 B CN103885828 B CN 103885828B CN 201410137427 A CN201410137427 A CN 201410137427A CN 103885828 B CN103885828 B CN 103885828B
- Authority
- CN
- China
- Prior art keywords
- hardware resource
- module
- current
- card
- instruction
- 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.)
- Expired - Fee Related
Links
- 238000000034 method Methods 0.000 title claims abstract description 33
- 238000004891 communication Methods 0.000 claims abstract description 75
- 238000012545 processing Methods 0.000 claims abstract description 8
- 238000009434 installation Methods 0.000 claims abstract description 5
- 238000012795 verification Methods 0.000 claims description 6
- 238000004321 preservation Methods 0.000 claims description 3
- 238000007599 discharging Methods 0.000 claims description 2
- 238000012986 modification Methods 0.000 claims 2
- 230000004048 modification Effects 0.000 claims 2
- 230000001680 brushing effect Effects 0.000 claims 1
- 230000009286 beneficial effect Effects 0.000 abstract description 2
- 230000003139 buffering effect Effects 0.000 description 19
- 230000005540 biological transmission Effects 0.000 description 4
- 238000005516 engineering process Methods 0.000 description 2
- 238000004088 simulation Methods 0.000 description 2
- 230000007423 decrease Effects 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 230000005611 electricity Effects 0.000 description 1
- 238000002360 preparation method Methods 0.000 description 1
- 239000002699 waste material Substances 0.000 description 1
Landscapes
- Telephone Function (AREA)
- Information Transfer Between Computers (AREA)
Abstract
The invention discloses a kind of hardware resource changing method, belong to information security field.Methods described includes:Initialize installation is carried out, communication mark is resetted, open communication is interrupted and timer interruption;Total interruption is opened, samsara query communication mark carries out communication instruction processing when the communication mark set, and reset the communication mark;When detecting communication disruption, the communication instruction bag that receiving module is sent, set communication mark is interrupted and returned;When detecting timer interruption, update hardware resource can holding time, interrupt return.The beneficial effects of the present invention are:The hardware resource sharing of multifunctional equipment is realized by the switching of hardware resource, the volume of equipment is reduced, the convenience used is improved, resource is saved.
Description
Technical field
The present invention relates to information security field, more particularly to a kind of changing method of hardware resource.
Background technology
In information security field, the protection of information security can be usually realized by hardware device, such as intelligent key is set
Standby, token etc..Use, from allowing user to carry excessive hardware device, multiple hardware devices are combined for the ease of user
Multifunctional equipment together arises at the historic moment, and this is bringing certain convenience on to user, but because hardware device needs
Using various hardware resources, especially with identical hardware resource, such as keyboard, display screen, if not solving hardware money
The sharing problem in source, but be simply combined together multiple hardware devices, equipment volume will necessarily be caused big, not side is used
Just, and resource waste the problems such as.
The content of the invention
The invention aims to overcome the defect of prior art, a kind of changing method of hardware resource is proposed.
The inventive method is achieved through the following technical solutions:
A kind of changing method of hardware resource, its basic implementation process is as follows:
Step A, progress Initialize installation;
Step B, reset communication mark, open communication are interrupted and timer interruption;
Step C, the total interruption of unlatching, samsara query communication mark are carried out at communication instruction when the communication mark set
Reason, and reset the communication mark;
When detecting communication disruption, the communication instruction bag that receiving module is sent, set communication mark, interruption is returned
Return;When detecting timer interruption, update hardware resource can holding time, interrupt return;
The communication instruction processing is specifically included:
Step C1, the type of the instruction parsed in communication instruction bag, if the right to use instruction of application hardware resource is then performed
Step C2;If discharging the instruction of the hardware resource right to use then performs step C3;
Step C2, determined according to the application hardware resource right to use instruction Current hardware resource, current functional module with
And application holding time, judge whether Current hardware resource is taken by the functional module beyond current functional module, be to apply
Failure, performs step C4, otherwise sets Current hardware resource to be communicated to current functional module, and according to the application holding time
Update Current hardware resource can holding time, apply successfully, execution step C4;
Step C3, Current hardware resource and current functional module determined according to the release hardware resource right to use instruction,
Judge whether Current hardware resource is taken by the functional module beyond current functional module, be then release failure, perform step C4,
Otherwise set Current hardware resource disconnected with current functional module, change Current hardware resource can holding time be default
Value, discharges successfully, performs step C4;
Step C4, to current functional module return communication instruct result.
Further, the Initialize installation includes:The occupancy situation for setting each hardware resource is unoccupied, and initially
Change each hardware resource can holding time be preset value;
Also include after the communication instruction bag that the receiving module is sent:Verify the communication instruction bag received;If
Verification passes through, then communication mark described in set, interrupts and returns, if verification does not pass through, interrupts and returns;
When detecting timer interruption, the renewal hardware resource can also include after holding time:If hardware is provided
Source can holding time reach preset value, then the occupancy situation of hardware resource is set to be unoccupied;Further, it is described more
New hardware resource can holding time, if hardware resource can holding time reach preset value, the occupancy of hardware resource is set
Situation is unoccupied, is specifically included:
Whether the hardware resource that step D1, selection one do not judge judges Current hardware resource as Current hardware resource
It is occupied, it is then to perform step D2, otherwise performs step D4;
Step D2, judge Current hardware resource can holding time whether be preset value, be then execution step D4, otherwise press
According to preset algorithm change Current hardware resource can holding time, perform step D3;
Step D3, judge Current hardware resource can holding time whether reach preset value, be then set Current hardware provide
The occupancy situation in source is unoccupied, performs step D4, otherwise performs step D4;
Step D4, judge whether the hardware resource that does not judge also, be then return to step D1, otherwise check that renewal terminates;
In the step C2, when Current hardware resource is not taken by the functional module beyond current functional module, set and work as
Preceding hardware resource also includes before being communicated to current functional module:Judge whether Current hardware resource is occupied, is, continue to hold
OK, otherwise according to the application holding time update Current hardware resource can holding time, apply successfully, execution step C4;
In the step C3, when Current hardware resource is not taken by the functional module beyond current functional module, set and work as
Preceding hardware resource also includes before being disconnected with current functional module:Judge whether Current hardware resource occupied, be then after
It is continuous to perform, otherwise discharge successfully, perform step C4;
It is described to judge whether Current hardware resource is occupied and specifically include:Judge whether Current hardware resource is communicated to hardware
The default feature module of resource, is that then Current hardware resource is unoccupied, otherwise Current hardware resource is occupied;It is described to set hard
The occupancy situation of part resource specifically includes to be unoccupied:Hardware resource is set to be communicated to the default feature module of hardware resource;
The setting Current hardware resource is communicated to current functional module and specifically included:Control analog switch causes current hard
Part resource is communicated to current functional module;The setting Current hardware resource is disconnected with current functional module to be specifically included:
The analog switch is controlled so that Current hardware resource is disconnected with current functional module;
Also include in the step C1:If the type of the instruction in the communication instruction bag refers to for inquiry hardware resource state
Order then performs step C5:Current hardware resource is determined according to the inquiry hardware resource status command, inquiry takes Current hardware
The functional module of resource and Current hardware resource can holding time, and return to Query Result to current functional module;
Also include in the step C1:If the type of the instruction in the communication instruction bag is setting RTC(Real-Time
Clock, real-time clock)Time command then performs step C6:Instructed according to the setting real-time clock time and determine current function
Module, judges whether current functional module has and sets real-time clock time authority, be then from the setting real-time clock time
The time is obtained in instruction, the clocking value of real-time clock module is updated with time for getting, is set successfully, execution step C4 is no
Then setup failed, performs step C4;
Also include in the step C1:If the type of the instruction in the communication instruction bag refers to obtain real-time clock time
Order then performs step C7:Current functional module is determined according to the acquisition real-time clock time instruction, real-time clock module is obtained
Clocking value, return to the clocking value that gets to current functional module;
Also include in the step C1:If the instruction in the communication instruction bag type swiped the card for request instruction if perform
Step C8~C10:
Step C8, the current functional module of instruction determination of being swiped the card according to the request;
Step C9, acquisition swipe the card the state of module, judge described in the swipe the card state of module whether be idle condition, be to set
The state for putting the module of swiping the card is state of swiping the card, and preserves the module No. of current functional module, performs step C10, no
Then request is swiped the card unsuccessfully, performs step C4;
Step C10, the initialization module of swiping the card, set described in the swipe the card state of module swiped the card state for wait, ask
Swipe the card success, perform step C4;
Also include in the step C1:If the instruction in the communication instruction bag type swiped the card for cancellation instruction if perform
Step C11:Swiped the card to instruct according to the cancellation and determine current functional module, the state for module of being swiped the card described in acquisition, and judge institute
Whether the state for stating module of swiping the card is idle condition, is, cancels success of swiping the card, and performs step C4;Otherwise current function mould is checked
Whether the module No. of block is identical with the module No. of the preservation, module of being swiped the card if identical described in reset, mould of being swiped the card described in setting
The state of block is idle condition, cancels success of swiping the card, and performs step C4, cancels if differing and swiping the card unsuccessfully, performs step C4;
Also include in the step C1:If the type of the instruction in the communication instruction bag refers to for acquisition module status of swiping the card
Order then performs step C12:The current functional module of module status instruction determination of swiping the card is obtained according to described, the shape for module of swiping the card is obtained
State, the state of the module of swiping the card got is returned to current functional module;
Also include in the step C1:If the type of the instruction in the communication instruction bag is reads card image instruction
Perform step C13:Current functional module is determined according to the reading card image instruction, the state for module of swiping the card is obtained, judges
Whether the state of the module of swiping the card got is that wait is swiped the card state, is that to set the state of the module of swiping the card be free time shape
State, obtains the card image that the module of swiping the card is read, and the card image got to the return of current functional module, otherwise
Failure is read, step C4 is performed.
The beneficial effect of the inventive method is that the hardware resource for realizing multifunctional equipment by the switching of hardware resource is total to
Enjoy, reduce the volume of equipment, improve the convenience used, save resource.
Brief description of the drawings
, below will be to embodiment or existing for the clearer explanation embodiment of the present invention or technical scheme of the prior art
The accompanying drawing to be used needed for having technology description is briefly described, it should be apparent that, drawings in the following description are only this
Some embodiments of invention, for those of ordinary skill in the art, on the premise of not paying creative work, can be with
Other accompanying drawings are obtained according to these accompanying drawings.
Fig. 1 is a kind of schematic diagram of hardware resource switching device provided in an embodiment of the present invention;
Fig. 2 is a kind of flow chart of hardware resource changing method provided in an embodiment of the present invention;
Fig. 3 is the particular flow sheet that switching control module provided in an embodiment of the present invention performs communication interruption service program;
Fig. 4 is the idiographic flow that switching control module provided in an embodiment of the present invention performs timer interrupt service program
Figure;
Fig. 5 and Fig. 6 is the specific stream that switching control module provided in an embodiment of the present invention performs communication instruction processing routine
Cheng Tu.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is carried out clear, complete
Site preparation is described, it is clear that described embodiment is only a part of embodiment of the invention, rather than whole embodiments.It is based on
Embodiment in the present invention, the every other implementation that those skilled in the art are obtained under the premise of creative work is not made
Example, belongs to the scope of protection of the invention.
The embodiment of the present invention provides a kind of changing method of hardware resource, and methods described is applied to device as shown in Figure 1,
Described device includes switching control module, and the switching control module has some control I/O interfaces and some communication I/O ports,
Each functional module(1、2、3...n)Communication I/O port with the switching control module is connected, and is also wrapped in the switching device
At least one analog switch is included, each functional module is also connected with the analog switch, and the control IO of the switching control module connects
Mouth is connected with the analog switch and fractional hardware resource (RTC block, module of swiping the card), remaining hardware resource(Display screen,
Keyboard, Flash...)It is connected with the analog switch.Referring to Fig. 2, methods described specifically includes electric in above-mentioned switching control module
After perform following steps:
Step 101:The state of I/O interface will be controlled to be set to output state, the state of communication I/O port is set to input
State;
Step 102:The state for setting analog switch is illegal state;
Step 103:Hardware resource is communicated in the functional module of acquiescence, the value of initializing variable " occupancy module No. " is
The module No. of default feature module, the value of initializing variable " can holding time " is preset value;
Be that each hardware resource writes sequence number in the present embodiment, such as 1,2,3...n, be that each hardware resource sets variable " to account for
With module No. ", mark takes the functional module of the hardware resource, sets variable " can holding time ", identifies the hardware resource energy
The enough time taken by above-mentioned functions module;Each hardware resource possesses a default feature module.Set respectively in step 103
Each hardware resource is communicated in its default feature module, and the value for initializing the corresponding variable " occupancy module No. " of each hardware resource is
The module No. of its default feature module, the value for initializing the corresponding variable of each hardware resource " can holding time " is preset value.
For example, setting the hardware resource of serial number 1 to be communicated in its functional module of default feature module first, it is initialized
The value of corresponding variable " occupancy module No. " is 1, and the value for initializing its corresponding variable " can holding time " is preset value;Set
The hardware resource of serial number 2 is communicated in its functional module of default feature module second, is initialized its corresponding variable and " is taken mould
The value of block number " is 2, and the value for initializing its corresponding variable " can holding time " is preset value;The hardware resource of serial number 3 is set
It is communicated in its functional module of default feature module first, the value for initializing its corresponding variable " occupancy module No. " is 1, initially
The value for changing its corresponding variable " can holding time " is preset value;
The value of the preset value is 0 etc..
Step 104:Analog switch is enabled, communication mark is resetted, open communication is interrupted and timer interruption;
Step 105:Total interruption is opened, communication interruption service program is performed when detecting communication disruption, step is performed
106, timer interrupt service program is performed when detecting timer interruption, step 106 is performed;
Step 106:Samsara query communication mark, performs communication instruction processing journey whenever communication mark set is inquired
Sequence, resets communication mark.
Referring to Fig. 3, the execution communication interruption service program is specifically included:
Step 201:The communication instruction bag that receiving module is sent;
Step 202:The communication instruction bag received is verified, step 203 is performed if if verification, if verification not if
Perform step 204;
Step 203:Set communication mark, performs step 204;
Step 204:Interrupt and return.
Referring to Fig. 4, the execution timer interrupt service program is specifically included:
Step 301:The hardware resource that selection one does not judge;
Step 302:Whether the value for judging the corresponding variable of the hardware resource " occupancy module No. " is the hardware resource
Default feature module module No., be then execution step 307, otherwise perform step 303;
For example, the hardware resource is the hardware resource of serial number 1, the numbering of its default feature module is 1, step 302
In, whether the value for judging the corresponding variable of the hardware resource " occupancy module No. " is 1, is then to perform step 307, otherwise performs
Step 303.
Step 303:Whether the value for judging the corresponding variable of the hardware resource " can holding time " is preset value, is to hold
Row step 307, otherwise performs step 304;
For example, preset value is 0, in step 303, judging the value of the corresponding variable of the hardware resource " can holding time " is
No is 0, is then to perform step 307, otherwise performs step 304.
Step 304:The value of the corresponding variable of the hardware resource " can holding time " is changed according to preset algorithm;
In the present embodiment, the preset algorithm is successively decreases, in step 304, and changing the corresponding variable of the hardware resource " can
The value of holding time " subtracts 1 for its currency.
Step 305:Whether the value for judging the corresponding variable of the hardware resource " can holding time " is preset value, is to hold
Row step 306, otherwise performs step 307;
For example, preset value is 0, in step 305, judging the value of the corresponding variable of the hardware resource " can holding time " is
No is 0, is then to perform step 306, otherwise performs step 307.
Step 306:Set the hardware resource to be communicated in its default feature module, update the hardware resource corresponding
Variable " occupancy module No. ", performs step 307;
For example, the hardware resource is the hardware resource of serial number 1, the numbering of its default feature module is 1, step 306
In, set the hardware resource to be communicated in the first functional module.
Step 307:Judge whether the hardware resource not judged also, be then to return to perform step 301, otherwise perform step
308;
Step 308:Interrupt and return.
Referring to Fig. 5 and Fig. 6, the execution communication instruction processing routine is specifically included:
Step 401:The type of the instruction in communication instruction bag is parsed, if inquiry hardware resource status command then performs step
Rapid 402, if the right to use instruction of application hardware resource then performs step 404, if the right to use instruction of release hardware resource is then held
Row step 411, if setting RTC time to instruct then performs step 418;If obtaining RTC time instruction then performs step 422;
If module status is swiped the card in acquisition, instruction then performs step 423;If request is swiped the card, instruction then performs step 424;If reading
Card image instruction then performs step 429;If cancelling instruction of swiping the card then performs step 433, if other are then at communication instruction
Manage EP (end of program);
In the present embodiment, according to the type of the first byte decision instruction of instruction, when the first byte is the first numerical value, refer to
Make as inquiry hardware resource status command;When the first byte is second value, instruct as application hardware resource right to use instruction;
When the first byte is third value, instruct as release hardware resource right to use instruction;When the first byte is four numerical value, refer to
Make setting RTC time to instruct;When the first byte is five numerical value, instruct to obtain RTC time instruction;When the first byte is
During six numerical value, instruct for acquisition swipe the card module status instruction;When the first byte is seven numerical value, instructs and swiped the card finger for request
Order;When the first byte is eight numerical value, instruct to read card image instruction;When the first byte is nine numerical value, instruction
To cancel instruction of swiping the card;
For example, the first numerical value is 0x01, second value is 0x02, and third value is 0x03, and the 4th numerical value is 0x04, the 5th
Numerical value is 0x05, and the 6th numerical value is 0x06, and the 7th numerical value is 0x07, and the 8th numerical value is 0x08, and the 9th numerical value is 0x09.
Step 402:The module No. and hardware resource sequence number of functional module are obtained from instruction, the hardware resource sequence is inquired about
The value of the value and variable " can holding time " of number corresponding variable " occupancy module No. ";
In the present embodiment, hardware resource sequence number is obtained according to the 3rd byte of instruction, the 3rd byte of such as instruction is
0x01, then can get hardware resource serial number 1.
Step 403:The module No. of the functional module, the variable " occupancy module No. " are write in buffering area to sending
The value of value and variable " can holding time ", performs step 439;
Step 404:The module No. and hardware resource sequence number of functional module are obtained from instruction, according to the hardware resource sequence
The value of number corresponding variable " occupancy module No. " of inquiry;
In the present embodiment, the module No. of functional module is obtained according to the 3rd byte of instruction, according to the nybble of instruction
Hardware resource sequence number is obtained, for example, the 3rd byte of instruction is 0x02, nybble is 0x03, then can get functional module
Module No. be the second functional module, hardware resource serial number 3.
Step 405:Whether the value for judging the variable " occupancy module No. " is the corresponding hardware of the hardware resource sequence number
The module No. of the default feature module of resource, is then to perform step 406, otherwise performs step 407;
Step 406:The corresponding hardware resource of the hardware resource sequence number is set to be communicated to the module No. of the functional module
In corresponding functional module, the value for changing the variable " occupancy module No. " is the module No. of the functional module, performs step
409;
In the present embodiment, the corresponding hardware resource of the hardware resource sequence number is set to be communicated to the module of the functional module
Specifically included in number corresponding functional module:Control analog switch so that the corresponding hardware resource of the hardware resource sequence number connects
Lead in the corresponding functional module of the functional module number;
Specifically, included in analog switch comprising switch is put multi-channel analog hilted broadsword if putting switch simulation hilted broadsword per road more more
Dry control end, for controlling a hardware resource and the connection of some functional modules, for example, being used to control display in analog switch
Switch being put screen and the hilted broadsword of simulation all the way connected of three functional modules, comprising two control ends, when two control ends are more
During low level, display screen is connected with functional module 1, when first control end is that low level, second control end are high level,
Display screen is connected with functional module 2, when first control end is that high level, second control end are low level, display screen with
Functional module 3 is connected.
Step 407:Judge the variable " occupancy module No. " value whether be the functional module module No., be to hold
Row step 409, otherwise performs step 408;
Step 408:The module No. that the functional module is write in buffering area to sending is used with expression application hardware resource
The state value of failure is weighed, step 439 is performed;
For example, the state value for representing application hardware resource failure is 0x01.
Step 409:Application use time is obtained from instruction, changing the corresponding variable of the hardware resource sequence number " can account for
With the time " value be the application use time;
In the present embodiment, application use time is obtained according to the 5th byte of instruction and the 6th byte, for example, the of instruction
Five bytes and the 6th byte are 0x001E, then it is 30 seconds that can get application use time.
Step 410:The module No. that the functional module is write in buffering area to sending is used with expression application hardware resource
Successful state value is weighed, step 439 is performed;
For example, representing that the successful state value of the application hardware resource right to use is 0x02.
Step 411:The module No. of functional module and the sequence number of hardware resource are obtained from instruction, according to the hardware resource
Sequence number inquire about the value of corresponding variable " occupancy module No. ";
In the present embodiment, the module No. of functional module is obtained according to the 3rd byte of instruction, according to the nybble of instruction
Hardware resource sequence number is obtained, for example, the 3rd byte of instruction is 0x03, nybble is 0x02, then can get functional module
Module No. be the 3rd functional module, hardware resource serial number 2.
Step 412:Whether the value for judging the variable " occupancy module No. " is the corresponding hardware of the hardware resource sequence number
The module No. of the default feature module of resource, is then to perform step 413, otherwise performs step 414;
Step 413:The module No. and expression hardware resource that the functional module is write in buffering area to sending are unoccupied
State value, perform step 439;
For example, representing that the unappropriated state value of hardware resource is 0x03.
Step 414:Judge the variable " occupancy module No. " value whether be the functional module module No., be to hold
Row step 415, otherwise performs step 417;
Step 415:The corresponding hardware resource of the hardware resource sequence number is set to be communicated to the hardware resource sequence number correspondence
Hardware resource default feature module on, the value for changing the corresponding variable of the hardware resource sequence number " can holding time " is pre-
If value;
Step 416:The module No. that the functional module is write in buffering area to sending is used with expression release hardware resource
Successful state value is weighed, step 439 is performed;
For example, representing that the successful state value of the release hardware resource right to use is 0x04.
Step 417:The state of module No. and expression without release power that the functional module is write in buffering area to sending
Value, performs step 439;
For example, representing that the state value without release power is 0x05.
Step 418:The module No. of functional module is obtained from instruction, when judging whether the functional module has setting RTC
Between authority, be then execution step 419, otherwise perform step 421;
Step 419:The time is obtained from instruction, the time that the clocking value of RTC block is updated to get;
Step 420:The module value that the functional module is write in buffering area to sending and expression setting RTC time are successful
State value, performs step 439;
For example, representing that it is 0x06 to set the successful state value of RTC time.
Step 421:The module value that the functional module is write in buffering area to sending and expression setting RTC time failure
State value, performs step 439;
For example, the state value for representing to set RTC time failure is 0x07.
Step 422:The module No. of functional module is obtained from instruction, the clocking value of RTC block is obtained, to transmission buffering area
The module No. and the clocking value of the middle write-in functional module, perform step 439;
Step 423:The module No. of functional module is obtained from instruction, the state for module of swiping the card is obtained, to transmission buffering area
The module No. of the middle write-in functional module and the state of the module of swiping the card, perform step 439;
Step 424:The module No. of functional module is obtained from instruction, the state for module of swiping the card is obtained;
Step 425:Whether the state for module of being swiped the card described in judging is idle condition, is then to perform step 426, otherwise performs
Step 428;
Step 426:The state for module of being swiped the card described in setting is state of swiping the card, and preserves the module of the functional module
Number, initialization is swiped the card module, set described in the swipe the card state of module swiped the card state for wait;
Step 427:The functional module is write in buffering area to sending module No. and represent that request is swiped the card successful shape
State value, performs step 439;
For example, representing that request swipes the card successful state value for 0x08.
Step 428:The functional module is write in buffering area to sending module No. and represent that request is swiped the card the shape of failure
State value, performs step 439;
For example, representing that the state value for asking to swipe the card failure is 0x09.
Step 429:The module No. of functional module is obtained from instruction, the state for module of swiping the card is obtained;
Step 430:Judge whether the module of swiping the card is that wait is swiped the card state, is then to perform step 431, otherwise performs step
Rapid 432;
Step 431:The state for module of being swiped the card described in setting is idle condition, obtains the card letter that module of swiping the card is read
Breath, and transmission buffering area is written to, perform step 439;
Step 432:The module No. that the functional module is write in buffering area to sending and shape of the expression without card image
State value, performs step 439;
For example, representing that the state value without card image is 0x0A.
Step 433:The module No. of functional module is obtained from instruction, the state for module of swiping the card is obtained;
Step 434:Whether the state for module of being swiped the card described in judging is idle condition, is then to perform step 437, otherwise performs
Step 435;
Step 435:Judge whether the module No. of the functional module is identical with the module No. of the functional module of preservation, is then
Step 436 is performed, step 438 is otherwise performed;
Step 436:Reset is swiped the card module, and the state for setting the module of swiping the card is idle condition, execution step 437;
Step 437:The functional module is write in buffering area to sending module No. and represent that cancellation is swiped the card successful shape
State value, performs step 439;
For example, representing that cancellation swipes the card successful state value for 0x0B.
Step 438:The module No. that the functional module is write in buffering area to sending cancels the shape for failure of swiping the card with expression
State value, performs step 439;
For example, representing that the state value for cancelling failure of swiping the card is 0x0C.
Step 439:Communication response is generated according to the data tissue sent in buffering area, and returned to sending in buffering area
Functional module module No. to functional module, empty transmission buffering area.
Communication instruction processing routine terminates.
In the changing method of above-mentioned hardware resource, when being worked first after electricity in switching control module, hardware resource correspondence
The value of variable " can holding time " when reaching preset value and during the release right to use, set hardware resource to be communicated to its and give tacit consent to work(
In energy module, if this hair can equally be realized by setting hardware resource not connected with any functional module in the case of above-mentioned three kinds
Bright goal of the invention.
Embodiment described above is the present invention more preferably embodiment, and those skilled in the art is in this hair
The usual variations and alternatives carried out in the range of bright technical scheme all should be comprising within the scope of the present invention.
Claims (17)
1. a kind of hardware resource changing method, it is characterised in that including:
Step A, progress Initialize installation;
Step B, reset communication mark, open communication are interrupted and timer interruption;
Step C, the total interruption of unlatching, samsara query communication mark carry out communication instruction processing when the communication mark set, and
Reset the communication mark;
When detecting communication disruption, the communication instruction bag that receiving module is sent, set communication mark is interrupted and returned;When
When detecting timer interruption, update hardware resource can holding time, if hardware resource can holding time reach preset value,
It is unoccupied, interruption return then to set the occupancy situation of hardware resource;
The communication instruction processing is specifically included:
Step C1, the type of the instruction parsed in communication instruction bag, if the right to use instruction of application hardware resource then performs step
C2;If discharging the instruction of the hardware resource right to use then performs step C3;
Step C2, Current hardware resource, current functional module and Shen determined according to the application hardware resource right to use instruction
Please holding time, judge Current hardware resource whether by beyond current functional module functional module take, be then application failure,
Step C4 is performed, otherwise sets Current hardware resource to be communicated to current functional module, and updated according to the application holding time
Current hardware resource can holding time, apply successfully, performing step C4;
Step C3, Current hardware resource and current functional module determined according to the release hardware resource right to use instruction, judged
Whether Current hardware resource is taken by the functional module beyond current functional module, is then release failure, performs step C4, otherwise
Set Current hardware resource disconnected with current functional module, modification Current hardware resource can holding time be preset value,
Discharge successfully, perform step C4;
Step C4, to current functional module return communication instruct result.
2. according to the method described in claim 1, it is characterised in that the Initialize installation includes:Each hardware resource is set
Occupancy situation to be unoccupied, and initialize each hardware resource can holding time be preset value.
3. according to the method described in claim 1, it is characterised in that after the communication instruction bag that the receiving module is sent
Also include:Verify the communication instruction bag received;
If verification passes through, communication mark described in set, interrupt and return, if verification does not pass through, interrupt and return.
4. according to the method described in claim 1, it is characterised in that it is described update hardware resource can holding time, if hardware
Resource can holding time reach preset value, then set the occupancy situation of hardware resource to be unoccupied, specifically include:
The hardware resource that step D1, selection one do not judge judges whether Current hardware resource is occupied as Current hardware resource
With being then execution step D2, otherwise perform step D4;
Step D2, judge Current hardware resource can holding time whether be preset value, be then execution step D4, otherwise according to pre-
Imputation method modification Current hardware resource can holding time, perform step D3;
Step D3, judge Current hardware resource can holding time whether reach preset value, be then setting Current hardware resource
Occupancy situation is unoccupied, performs step D4, otherwise performs step D4;
Step D4, judge whether the hardware resource that does not judge also, be then return to step D1, otherwise check that renewal terminates.
5. according to the method described in claim 1, it is characterised in that in the step C2, Current hardware resource is not by current work(
When functional module beyond energy module takes, Current hardware resource is set also to include before being communicated to current functional module:Judge
Whether Current hardware resource is occupied, is, continues executing with, and otherwise updates Current hardware resource according to the application holding time
Can holding time, apply successfully, performing step C4.
6. according to the method described in claim 1, it is characterised in that in the step C3, Current hardware resource is not by current work(
When functional module beyond energy module takes, Current hardware resource is set also to include before being disconnected with current functional module:
Judge whether Current hardware resource is occupied, is, continues executing with, otherwise discharge successfully, perform step C4.
7. the method according to claim 5 or 6, it is characterised in that described to judge the whether occupied apparatus of Current hardware resource
Body includes:Judge whether Current hardware resource is communicated to the default feature module of hardware resource, be then Current hardware resource not by
Take, otherwise Current hardware resource is occupied.
8. method according to claim 7, it is characterised in that the occupancy situation of the setting hardware resource is unoccupied
Specifically include:Hardware resource is set to be communicated to the default feature module of hardware resource.
9. according to the method described in claim 1, it is characterised in that the setting Current hardware resource is communicated to current function mould
Block is specifically included:Control analog switch make it that Current hardware resource is communicated to current functional module.
10. method according to claim 9, it is characterised in that the setting Current hardware resource and current functional module
Disconnect and specifically include:The analog switch is controlled so that Current hardware resource is disconnected with current functional module.
11. according to the method described in claim 1, it is characterised in that also include in the step C1:If the communication instruction bag
In instruction type for inquiry hardware resource status command then perform step C5;
The step C5 is specifically included:Current hardware resource is determined according to the inquiry hardware resource status command, inquiry takes
The functional module of Current hardware resource and Current hardware resource can holding time, and return to inquiry knot to current functional module
Really.
12. according to the method described in claim 1, it is characterised in that also include in the step C1:If the communication instruction bag
In the type of instruction then perform step C6 to set real-time clock time to instruct;
The step C6 is specifically included:Instructed according to the setting real-time clock time and determine current functional module, judge current
Whether functional module, which has, sets real-time clock time authority, is, when being obtained in being instructed from the setting real-time clock time
Between, the clocking value of real-time clock module is updated with the time got, sets successfully, performs step C4, otherwise setup failed, holds
Row step C4.
13. according to the method described in claim 1, it is characterised in that also include in the step C1:If the communication instruction bag
In the type of instruction then perform step C7 to obtain real-time clock time instruction;
The step C7 is specifically included:Current functional module is determined according to the acquisition real-time clock time instruction, obtains real-time
The clocking value of clock module, the clocking value got is returned to current functional module.
14. according to the method described in claim 1, it is characterised in that also include in the step C1:If the communication instruction bag
In the type of instruction then perform step C8~C10 for request instruction of swiping the card;
Step C8, the current functional module of instruction determination of being swiped the card according to the request;
Step C9, acquisition swipe the card the state of module, judge described in the swipe the card state of module whether be idle condition, be that institute is set
It is state of swiping the card to state the state for module of swiping the card, and preserves the module No. of current functional module, performs step C10, otherwise please
Ask and swipe the card unsuccessfully, perform step C4;
Step C10, the initialization module of swiping the card, the state of module of swiping the card described in setting are swiped the card state for wait, and request is swiped the card
Success, performs step C4.
15. method according to claim 14, it is characterised in that also include in the step C1:If the communication instruction
The type of instruction in bag swipes the card to instruct for cancellation then performs step C11;
The step C11 is specifically included:Swiped the card to instruct according to the cancellation and determine current functional module, module of being swiped the card described in acquisition
State, and judge that whether the state of the module of swiping the card is idle condition, is, cancellation is swiped the card success, execution step C4;It is no
Then check whether the module No. of current functional module is identical with the module No. of the preservation, mould of being swiped the card if identical described in reset
Block, the state for setting the module of swiping the card is idle condition, and cancellation is swiped the card success, is performed step C4, is cancelled if differing and brushing
Card crash, performs step C4.
16. according to the method described in claim 1, it is characterised in that also include in the step C1:If the communication instruction bag
In the type of instruction then perform step C12 for acquisition module status instruction of swiping the card;
The step C12 is specifically included:The current functional module of module status instruction determination of swiping the card is obtained according to described, acquisition is swiped the card
The state of module, the state of the module of swiping the card got is returned to current functional module.
17. according to the method described in claim 1, it is characterised in that also include in the step C1:If the communication instruction bag
In the type of instruction then perform step C13 to read card image instruction;
The step C13 is specifically included:Current functional module is determined according to the reading card image instruction, module of swiping the card is obtained
State, whether judge the state of module of swiping the card got is that wait is swiped the card state, be set described in swipe the card the shape of module
State is idle condition, the card image that module of being swiped the card described in acquisition is read, and the card got is returned to current functional module
Piece information, otherwise reads failure, performs step C4.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201410137427.6A CN103885828B (en) | 2014-04-08 | 2014-04-08 | A kind of changing method of hardware resource |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201410137427.6A CN103885828B (en) | 2014-04-08 | 2014-04-08 | A kind of changing method of hardware resource |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN103885828A CN103885828A (en) | 2014-06-25 |
| CN103885828B true CN103885828B (en) | 2017-07-14 |
Family
ID=50954737
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201410137427.6A Expired - Fee Related CN103885828B (en) | 2014-04-08 | 2014-04-08 | A kind of changing method of hardware resource |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN103885828B (en) |
Families Citing this family (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN105930133B (en) * | 2016-04-19 | 2018-08-17 | 南京亚派科技股份有限公司 | A kind of sending method of the serial command based on SCM system |
Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101699416A (en) * | 2009-10-30 | 2010-04-28 | 北京飞天诚信科技有限公司 | Communication method and system between host computer and card reader with multiple card holders |
| CN103488953A (en) * | 2013-10-08 | 2014-01-01 | 飞天诚信科技股份有限公司 | Intelligent switching method applied to multifunctional equipment |
Family Cites Families (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP2005242806A (en) * | 2004-02-27 | 2005-09-08 | Renesas Technology Corp | Data processor |
| US7020090B2 (en) * | 2004-06-21 | 2006-03-28 | Cisco Technology, Inc. | System and method for loadbalancing in a network environment using feedback information |
-
2014
- 2014-04-08 CN CN201410137427.6A patent/CN103885828B/en not_active Expired - Fee Related
Patent Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101699416A (en) * | 2009-10-30 | 2010-04-28 | 北京飞天诚信科技有限公司 | Communication method and system between host computer and card reader with multiple card holders |
| CN103488953A (en) * | 2013-10-08 | 2014-01-01 | 飞天诚信科技股份有限公司 | Intelligent switching method applied to multifunctional equipment |
Non-Patent Citations (1)
| Title |
|---|
| "云计算环境下基于关联量的数据部署与任务调度";郭力争 等;《计算机工程与科学》;20130831;第35卷(第8期);第3页第1栏2.2 * |
Also Published As
| Publication number | Publication date |
|---|---|
| CN103885828A (en) | 2014-06-25 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN103272382B (en) | Bluetooth gamepad simulation intelligent terminal touch screen controls method and the device of game | |
| CN103246839B (en) | A kind of method of work of intelligent cipher key equipment | |
| CN102281254A (en) | Server serial port design system and method | |
| CN102611801A (en) | System and method for controlling mobile phone interaction based on eye movement trajectory | |
| CN107528922A (en) | A kind of information push method, terminal and computer-readable recording medium | |
| CN204759403U (en) | System based on data pass realization equipment internal module thoroughly and upgrade | |
| CN104038803B (en) | A kind of modularization intelligent TV and the exchange method applied to modularization intelligent TV | |
| CN106293262A (en) | A kind of interactive teaching large-size screen monitors touch-control repeater system and method | |
| CN107766145A (en) | EMS memory management process and device under dual system | |
| CN110418358A (en) | The bluetooth test method and device of circuit board | |
| CN103885828B (en) | A kind of changing method of hardware resource | |
| CN107634998A (en) | A kind of temporary parking method, mobile terminal and computing device | |
| CN109388241A (en) | Implementation method, device and the electronic equipment of VR equipment low-power consumption | |
| CN109343944A (en) | Data processing method, device, terminal and storage medium of eSIM card | |
| CN108399136A (en) | A kind of control method of serial line interface, device and host | |
| CN108434728A (en) | Operation control adaptation method and device, electronic equipment and storage medium | |
| CN204989857U (en) | Remote control device based on pioneer robot | |
| CN107402762A (en) | The implementation method and device of finger print navigation | |
| CN107580138A (en) | Instant messaging processing method, mobile terminal and storage medium based on dual system | |
| CN108405012A (en) | A kind of wisdom laboratory operation plateform system and its control method | |
| CN107239419A (en) | It is a kind of that the adaptive method of network interface is realized under PowerPC DPAA patterns | |
| CN204390293U (en) | A kind of bluetooth earphone, Bluetooth of mobile phone payment authentication system | |
| CN106355084A (en) | Android group authority management method and system based on callback mechanism | |
| CN107729136A (en) | A kind of processing priority collocation method and device based on FPGA | |
| CN103176879A (en) | Keyboard automatic test method and keyboard automatic test system applying same |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| C06 | Publication | ||
| PB01 | Publication | ||
| C10 | Entry into substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant | ||
| CF01 | Termination of patent right due to non-payment of annual fee | ||
| CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20170714 |