CN103049706A - Method for improving data operation speed - Google Patents

Method for improving data operation speed Download PDF

Info

Publication number
CN103049706A
CN103049706A CN2012104770463A CN201210477046A CN103049706A CN 103049706 A CN103049706 A CN 103049706A CN 2012104770463 A CN2012104770463 A CN 2012104770463A CN 201210477046 A CN201210477046 A CN 201210477046A CN 103049706 A CN103049706 A CN 103049706A
Authority
CN
China
Prior art keywords
value
data
pointer
operating
operating pointer
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN2012104770463A
Other languages
Chinese (zh)
Other versions
CN103049706B (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.)
Feitian Technologies Co Ltd
Original Assignee
Feitian Technologies Co Ltd
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 Feitian Technologies Co Ltd filed Critical Feitian Technologies Co Ltd
Priority to CN201210477046.3A priority Critical patent/CN103049706B/en
Publication of CN103049706A publication Critical patent/CN103049706A/en
Application granted granted Critical
Publication of CN103049706B publication Critical patent/CN103049706B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Information Transfer Systems (AREA)

Abstract

The invention discloses a method for improving data operation speed and belongs to the field of information security. The method includes: 1, performing universal serial bus (USB) Key electrifying initializing; 2, judging whether the deviation value of a receiving indicator and a first operation indicator is smaller than the length of a treaty head, waiting for the receiving endpoint to be suspended and returning to execute step 2 continuously if the deviation value is smaller than the length of the treaty head, and otherwise, analyzing the content of the treaty head and updating the first operation indicator to execute the step 3; 3, judging whether the deviation value of the receiving indicator and the first operation indicator is smaller than a second preset value, waiting for the receiving endpoint to be suspended and returning to execute step 3 continuously if the deviation value is smaller than the second preset value, and otherwise, performing corresponding operations to obtain result data according to operation type identifications and updating the first operation indicator to execute step 4; and step 4, judging whether the value of the receiving indicator is equal to the value of the first operation indicator, transmitting the obtained result data if the value of the receiving indicator is equal to the value of the first operation indicator, and otherwise, returning to step 5. The method for improving data operation speed has the advantages of achieving synchronous data transceiving and treatment, reducing the waiting time of the USB Key and improving the data operation speed.

Description

A kind of method that improves data manipulation speed
Technical field
The present invention relates to information security field, particularly a kind of method that improves data manipulation speed.
Background technology
The USBKey(intelligent cipher key equipment) is a kind of hardware device of USB interface.Its built-in single-chip microcomputer or intelligent card chip has certain storage space, can store user's private key and digital certificate, utilizes built-in public key algorithm realization to the authentication of user identity.
Prior art is in the USBKey production run, need to carry out to data the processing such as encryption and decryption, detailed process is the data that the USBKey Receiving Host sends, process according to data again, and the data after will processing and state return to main frame, the inventor finds main frame in the process of the result data that repeatedly send order and wait USBKey in realizing process of the present invention, USBKey is in idle state when waiting for receive data, has caused operation rate low.
Summary of the invention
For addressing the above problem, the invention provides a kind of method that improves data manipulation speed.
The technical scheme that the embodiment of the invention adopts is as follows:
A kind of method that improves data manipulation speed comprises:
1, a kind of method that improves data manipulation speed is characterized in that, comprises operational processes and interrupt to process, 1. wherein said operational processes specifically comprise-4.:
1., USBKey powers on and carries out initialization;
2., described USBKey judges that whether the deviate of current reception pointer and current the first operating pointer is less than protocol header length, to wait for that then receiving end points interrupts entering the receive interruption processing, wait interrupting returning rear continuation execution in step 2., otherwise the content of analysis protocol head is also upgraded described the first operating pointer, and execution in step 3.;
3., described USBKey judge current reception pointer and current the first operating pointer deviate whether less than the second preset value, be to wait for that then receiving end points interrupts entering receive interruption and process, wait interrupting returning rear continuation execution in step 3.; Otherwise carry out corresponding operation according to the action type sign, obtain result data, and upgrade described the first operating pointer, execution in step 4.;
4., described USBKey judges whether the value of current reception pointer equates with the value of current the first operating pointer, if equate then send the result data that obtains; If unequal then return step 3.;
Enter the receive interruption processing when described USBKey receives to receive when end points interrupts, comprising:
5., described USBKey is with data mobile to the first buffer area that receives and upgrade described reception pointer, and interrupt returning.
Further:
Described USBKey carries out initialization, specifically comprises: described USBKey is set to respectively the base address of the first buffer area with the value of reception pointer and the first operating pointer, opens to receive end points and interrupt, and waits for that receiving end points interrupts entering receive interruption and process; Wherein, described reception pointer is used to indicate the position of the data of reception; Described the first operating pointer is used to indicate the position of service data;
2. described step specifically comprises: judge that whether the deviate of current reception pointer and current the first operating pointer is less than 31, to wait for that then receiving end points interrupts entering the receive interruption processing, wait interrupting returning rear continuation execution in step 2., otherwise the content of analysis protocol head is also upgraded described the first operating pointer, and execution in step 3.; Further, the content of described analysis protocol head is also upgraded described the first operating pointer and is specially: obtain the content of described protocol header from described the first buffer area, obtain described data length from 8-11 byte of described protocol header; Obtain direction signs from the 12nd byte of described protocol header, carry out corresponding operating according to the value of described direction signs; Obtain described command operation type from 16-19 byte of described protocol header, according to the command operation type described action type sign is set; The value of described the first operating pointer is updated to its currency adds 31; Again further, described value execution corresponding operating according to described direction signs is specially: judge the value of described direction signs, if the value of described direction signs is the first numerical value, then execution in step 3.; If the value of described direction signs is second value, then execution in step 5.;
Perhaps, 2. described step specifically comprises: judge that whether the deviate of current reception pointer and current the first operating pointer is less than 10, to wait for that then receiving end points interrupts entering the receive interruption processing, wait interrupting returning rear continuation execution in step 2., otherwise the content of analysis protocol head is also upgraded described the first operating pointer, execution in step 3., further, described analysis protocol head content is also upgraded described the first operating pointer and is specially: the content of obtaining described protocol header from described the first buffer area, obtain described command operation type from the 1st byte of described protocol header, according to the command operation type described action type sign is set; Obtain described data length from 2-5 byte of described protocol header, the value of described the first operating pointer is updated to its currency adds 10;
Described the second preset value is specially the data length of each processing;
The content of described analysis protocol head is also upgraded described the first operating pointer and is specifically comprised: obtain described protocol header content and it is resolved from the first buffer area and obtain data length and command operation type, according to command operation type setting operation type identification, the value of described the first operating pointer is updated to its currency adds protocol header length;
The described execution accordingly according to the action type sign operates, obtain result data, and upgrade described the first operating pointer, be specially: judge according to described action type sign whether the current operation data are the encryption and decryption data type, be then to carry out encryption and decryption to process, and the value of described the first operating pointer is updated to its currency adds the above second preset value; Otherwise carry out corresponding operating according to data type, and the value of the first operating pointer is updated to its currency adds the above second preset value;
The described reception pointer of described renewal is specially: the value of described reception pointer is updated to the length that its currency adds this receive data;
The executing state that comprises order in the described result data, further, the executing state of described order specifically comprises: the 0x01 of the 0x00 of expression order successful execution, the failure of expression command execution and the 0x02 of expression stage mistake;
In addition, described method also is provided with and sends the end points interruption, and be correspondingly provided with the second operating pointer and send finger, wherein, described the second operating pointer is used to indicate the position of the result data that obtains after the operation, and described send finger is used to indicate the position of the data of transmission, correspondingly, described step obtains result data in 3., upgrades described the first operating pointer and comprises also and upgrade the second operating pointer that the value that is specially described the second operating pointer is updated to the length that its currency adds result data;
Further, when being provided with the interruption of transmission end points; The result data that described transmission obtains specifically comprises:
6., described USBKey judges whether the value of current the second operating pointer equates with the value of current send finger, if equate then to return step 2., if unequally wait for that then sending end points interrupts entering sending and interrupt processing, wait interrupting returning rear continuation execution in step 6.;
Interrupt processing when described USBKey receives to send to enter when end points interrupts to send, comprising:
7., described USBKey judge current transmission data variable value whether less than the 3rd preset value, be then to carry out corresponding transmission processing and upgrade described transmission data variable and described send finger, return step 2.; Otherwise execution in step 8.;
8., described USBKey judge current the second operating pointer and current send finger difference whether greater than the 3rd preset value, be then to carry out corresponding transmission processing and upgrade described transmission data variable and described send finger, and interrupt returning; Otherwise interrupt returning.
Further:
Also comprise when described USBKey carries out initialization opening and send the end points interruption; Perhaps, do not comprise when described USBKey carries out initialization opening and send the end points interruption, described step 6. in when the value of the value of current the second operating pointer and current send finger is unequal, at first open and send the end points interruption, and then wait for that the transmission end points interrupts entering transmission and interrupts processing, return rear continuation execution in step 6. until interruption;
Described the 3rd preset value is specially the length of each transmission data;
The described transmission data variable of described renewal and described send finger specifically comprise: the value of described send finger is updated to its currency adds that this sends the length of data, the value of described transmission data variable is updated to its currency deducts the length that this sends data.
Described result data is stored in the second buffer area, described the second operating pointer specifically be used to indicate the result data that obtains after the operation in the second buffer area the position, comprise also when described USBKey carries out initialization that the value of described USBKey send finger and the second operating pointer is set to the base address of the second buffer area.
Described transmission processing is specially the data mobile in described the second buffer area is sent to sending buffer area.
Beneficial effect: when the embodiment of the invention is encrypted processing for USBkey equipment to data, receive/send data by the end points interrupt mode, the transmitting-receiving and the data processing that realize data are synchronous, reduce the stand-by period of USBkey equipment, have improved data manipulation speed.
Description of drawings
A kind of method flow diagram that improves data manipulation speed that Fig. 1-a provides for the embodiment of the invention two;
Fig. 1-b receives to receive to enter the detailed process figure that receive interruption is processed when end points interrupts;
Fig. 1-c receives to send to enter when end points interrupts to send the detailed process figure that interrupts processing;
A kind of method flow diagram that improves data manipulation speed that Fig. 2 provides for the embodiment of the invention three;
A kind of method flow diagram that improves data manipulation speed that Fig. 3 provides for the embodiment of the invention four.
Embodiment
The embodiment of the invention provides a kind of method that improves data manipulation speed, below in conjunction with accompanying drawing the embodiment of the invention is described in detail.
Embodiment one
The embodiment of the invention one provides a kind of method that improves data manipulation speed, and described method comprises operational processes and interrupt processing that wherein said operational processes specifically comprises step S1-S4, interrupts processing comprising step S5, and particular content is as follows:
Step S1:USBKey powers on and carries out initialization;
Step S2: described USBKey judges that whether the deviate of current reception pointer and current the first operating pointer is less than protocol header length, to wait for that then receiving end points interrupts entering the receive interruption processing, wait interrupting returning rear continuation execution in step S2, otherwise the content of analysis protocol head is also upgraded described the first operating pointer, execution in step S3;
Step S3: whether described USBKey judges the deviate of current reception pointer and current the first operating pointer less than the second preset value, is to wait for that then receiving end points interrupts entering the receive interruption processing, wait interrupting returning rear continuation execution in step S3; Otherwise carry out corresponding operation according to the action type sign, obtain result data, and upgrade described the first operating pointer, execution in step S4;
Step S4: described USBKey judges whether the value of current reception pointer equates with the value of current the first operating pointer, if result data equal then that transmission obtains; If unequal then return step S3;
Particularly, the result data that obtains of described transmission sends buffer area and sends for result data is moved to;
Enter the receive interruption processing when described USBKey receives to receive when end points interrupts, comprising:
Step S5: described USBKey is with data mobile to the first buffer area that receives and upgrade described reception pointer, and interrupts returning.
Embodiment two
The embodiment of the invention two provides a kind of method that improves data manipulation speed, below in conjunction with Fig. 1-a, Fig. 1-b and Fig. 1-c described method is introduced.
Shown in Fig. 1-a, the embodiment of the invention two provides a kind of method that improves data manipulation speed, specifically may further comprise the steps:
Step 101:USBkey device power;
Step 102: described USBkey equipment interconnection is received pointer, send finger, the first operating pointer and the second operating pointer and is carried out initialization, open to receive the end points interruption and send end points and interrupt, wait for that receiving end points interrupts entering the receive interruption processing, wait interrupting returning rear execution in step 103;
In the present embodiment, described USBkey equipment interconnection is received pointer, send finger, the first operating pointer and the second operating pointer and carried out initialization and be specially: the value of described reception pointer and described the first operating pointer is set to respectively the base address of the first buffer area, and the value of described send finger and described the second operating pointer is set to the base address of the second buffer area; Described reception pointer is used to indicate the position of the data of reception; Described send finger is used to indicate the position of the data of transmission; Described the first operating pointer is used to indicate the position of service data; Described the second operating pointer be used to indicate the data that obtain after the operation in the second buffer area the position.
Particularly, referring to Fig. 1-b, in the present embodiment, described USBkey equipment enters the receive interruption processing when receiving the interruption of reception end points and specifically comprises:
A-1: will receive data mobile to the first buffer area that end points receives;
A-2: upgrade reception pointer and receive data variable, interrupt returning;
Particularly, described renewal reception pointer is specially: the value of described reception pointer is updated to the length that its currency adds the data that this receives; Described renewal receive data variable is specially: the value of described receive data variable is updated to the length that its currency adds the data of this reception;
Need to prove, after USBkey equipment executes the receive interruption processing, then do not return the step of processing when master routine continuation execution receives the interruption of reception end points if receive other look-at-me;
Step 103: whether described USBkey equipment judges the deviate of current reception pointer and current the first operating pointer greater than protocol header length, is execution in step 104 then; Otherwise wait for that receiving end points interrupts entering the receive interruption processing, wait interrupting returning rear continuation execution in step 103;
The length of protocol header described in the present embodiment is determined according to Data Transport Protocol;
Step 104: the content of described USBkey device parses protocol header, and upgrade the first operating pointer;
In the present embodiment, described renewal the first operating pointer is specially: the value of described the first operating pointer is updated to the length that its currency adds the above protocol header;
Step 105: whether described USBkey equipment judges the deviate of current reception pointer and current the first operating pointer greater than the first preset value, is execution in step 106 then; Otherwise wait for that receiving end points interrupts entering the receive interruption processing, wait interrupting returning rear continuation execution in step 105;
The first preset value refers to command header length described in the present embodiment;
Step 106: described USBkey equipment obtains the command operation type of the current command from command header, and according to described command operation type setting operation type identification, upgrades described the first operating pointer;
In the present embodiment, upgrading described the first operating pointer is specially: the value of described operating pointer is updated to its currency adds the above first preset value;
Step 107: whether described USBkey equipment judges the deviate of current reception pointer and current the first operating pointer greater than the second preset value, is execution in step 108 then; Otherwise wait for that receiving end points interrupts entering the receive interruption processing, wait interrupting returning rear continuation step 107;
In the present embodiment, described the second preset value is each data length of processing;
Step 108: described USBkey equipment is according to the type of action type sign decision operation data, if the type of described service data is the encryption and decryption data type, then execution in step 109; If the type of described service data is other data types, then execution in step 110;
Step 109: described USBkey equipment carries out the encryption and decryption processing to described service data and obtains result data, and upgrades the first operating pointer and the second operating pointer, execution in step 111;
In the present embodiment, described renewal the first operating pointer is specially value with described the first operating pointer and is updated to its currency and adds the second preset value; The value that described renewal the second operating pointer is specially described the second operating pointer is updated to the length that its currency adds result data;
Step 110: described USBkey equipment is carried out corresponding operation according to the type of described service data and is obtained result data, and upgrades the first operating pointer and the second operating pointer;
In the present embodiment, the value of described the first operating pointer is updated to its currency adds the second preset value; The value of described the second operating pointer is updated to the length that its currency adds result data;
Step 111: described USBkey equipment judges whether the value of current reception pointer equates with the value of current the first operating pointer, is execution in step 112 then; Otherwise return step 107;
Step 112: described USBkey equipment judges whether the value of current the second operating pointer equates with the value of current send finger, is then to return step 103; Otherwise wait for that sending end points interrupts, enter to send and interrupt processing.
In the present embodiment, referring to Fig. 1-C, described USBkey equipment receives to send to enter when end points interrupts to send to interrupt processing and is specially:
Step B-1: judge that the value that sends data variable whether less than the 3rd preset value, is then to carry out corresponding transmission processing and upgrade described transmission data variable and described send finger, return step 103; Otherwise execution in step B-2;
The 3rd preset value refers to send the length of data at every turn in the present embodiment, and the corresponding transmission processing of described execution is also upgraded described transmission data variable and described send finger is specially:
Step B-1-1: the data mobile of the second buffer area is sent to main frame to sending buffer area;
Step B-1-2: upgrade described send finger and described transmission data variable;
In the present embodiment, the value of described send finger is updated to its currency adds that this sends the length of data, the value of described transmission data variable is updated to its currency deducts the length that this sends data;
Step B-2: whether judging the difference of current the second operating pointer and current send finger greater than the 3rd preset value, is execution in step B-3 then; Otherwise interrupt returning;
Step B-3: carry out corresponding transmission processing and upgrade described transmission data variable and described send finger, interrupt returning;
Carry out corresponding transmission processing in the present embodiment and upgrade described transmission data variable and described send finger is specifically seen step B-1-1 to B-1-2, do not repeat them here;
Need to prove, can not comprise in the step 102 opening sending end points and interrupting, when the equipment of USBkey described in the step 112 judges that the value of current the second operating pointer is unequal with the value of current send finger, just open and send the end points interruption; After USBkey equipment executes the interrupt operation of transmission end points, then do not return the step of processing when master routine continues to carry out the receive interruption signal if receive other look-at-me; The step of processing during described receive interruption signal can be arbitrary steps;
When the embodiment of the invention is encrypted processing for USBkey equipment to data, receive/send data by the end points interrupt mode, realize that the transmitting-receiving of data and data processing are synchronous, reduce the stand-by period of USBkey equipment, improved data manipulation speed.
Embodiment three
The embodiment of the invention three provides a kind of method that improves data manipulation speed, below in conjunction with Fig. 2 described method is introduced.
As shown in Figure 2, a kind of method that improves data manipulation speed specifically may further comprise the steps:
Step 201:USBKey device power;
Step 202:USBKey equipment interconnection is received pointer, send finger, the first operating pointer and the second operating pointer and is carried out initialization, open to receive the end points interruption and send end points and interrupt, wait for that receiving end points interrupts entering the receive interruption processing, wait interrupting returning rear execution in step 203;
In the present embodiment, described USBkey equipment interconnection is received pointer, send finger, the first operating pointer and the second operating pointer and carried out initialization and be specially: the value of described reception pointer and described the first operating pointer is set to respectively the base address of the first buffer area, and the value of described send finger and described the second operating pointer is set to the base address of the second buffer area; Described reception pointer is used to indicate the position of the data of reception; Described send finger is used to indicate the position of the data of transmission; Described the first operating pointer is used to indicate the position of service data; Described the second operating pointer be used to indicate the data that obtain after the operation in the second buffer area the position.
Particularly, in the present embodiment, described USBkey equipment enters the receive interruption processing when receiving the interruption of reception end points and specifically comprises:
A-1: will receive data mobile to the first buffer area that end points receives;
A-2: upgrade reception pointer and receive data variable, interrupt returning;
Particularly, the value with described reception pointer is updated to the length that its currency adds the data of this reception; The value of described receive data variable is updated to the length that its currency adds the data of this reception;
Need to prove, after USBkey equipment executes the receive interruption processing, then do not return the step of processing when master routine continuation execution receives the interruption of reception end points if receive other look-at-me;
Whether step 203:USBKey equipment judges the deviate of current reception pointer and current the first operating pointer greater than protocol header length, is execution in step 204 then; Otherwise wait for that receiving end points interrupts entering the receive interruption processing, wait interrupting returning rear continuation execution in step 203;
Particularly, the length of protocol header described in the present embodiment is 31;
Step 204:USBKey equipment obtains protocol header and it is resolved from the first buffer area, obtains data length, direction signs and command operation type;
Protocol header described in the present embodiment comprises 31 bytes, and particularly, 8-11 byte obtaining described protocol header obtains data length, and the 12nd byte obtaining described protocol header obtains direction signs; 16-19 byte obtaining described protocol header obtains described command operation type;
Need to prove that described command operation type can also be obtained by the resolve command head;
Step 205:USBKey equipment upgrades the receive data variable according to described data length, according to described command operation type setting operation type identification, and upgrades described the first operating pointer;
Step 206:USBKey equipment is judged the value of described direction signs, if the value of described direction signs is the first numerical value, then execution in step 207; If the value of described direction signs is second value, then execution in step 212;
Particularly, in the present embodiment, the value of described the first numerical value is 0; The value of described second value is 1;
Whether step 207:USBKey equipment judges the deviate of current reception pointer and current the first operating pointer greater than the second preset value, is execution in step 208 then; Otherwise wait for that receiving end points interrupts entering the receive interruption processing, wait interrupting returning rear continuation execution in step 207;
In the present embodiment, described the second preset value is each data length of processing, and determines the second preset value according to described action type sign;
Step 208:USBKey equipment is according to the type of the described service data of described action type sign judgement, if described operation data type is the encryption and decryption data type, then execution in step 209; If described operation data type is other data types, then execution in step 210;
Step 209:USBKey equipment carries out the encryption and decryption processing to described service data and obtains result data, and upgrades described the first operating pointer and described the second operating pointer, execution in step 211;
In the present embodiment, the value of described the first operating pointer is updated to its currency adds the second preset value; The value of described the second operating pointer is updated to the length that its currency adds result data;
Step 210:USBKey equipment is carried out corresponding operation according to the data type of described service data and is obtained result data, and upgrades described the first operating pointer and described the second operating pointer, order execution in step 211;
In the present embodiment, the value of described the first operating pointer is updated to its currency adds the second preset value; The value of described the second operating pointer is updated to the length that its currency adds result data;
Step 211:USBKey equipment judges whether the value of current reception pointer equates with the value of described the first operating pointer, is execution in step 212 then; Otherwise return step 207;
Step 212:USBKey equipment judges whether current the second operating pointer equates with the value of current send finger, is then to return step 203; Otherwise wait for that the transmission end points interrupts entering transmission and interrupts processing, return rear continuation execution in step 212 until interruption;
In the present embodiment, described USBkey equipment receives to send to enter when end points interrupts to send to interrupt processing and is specially:
Step B-1: described USBKey equipment judges that the value that sends data variable whether less than the 3rd preset value, is then to carry out corresponding transmit operation and upgrade described transmission data variable and described send finger, returns step 203; Otherwise execution in step B-2;
The 3rd preset value refers to send the length of data at every turn in the present embodiment, carries out corresponding transmit operation and upgrades described transmission data variable and described send finger is specially:
Step B-1-1: the data mobile of the second buffer area is sent to main frame to sending buffer area;
In the present embodiment, described USBKey equipment returns to main frame with the executing state of order, and concrete 0x00 represents to order successful execution, and 0x01 represents the command execution failure, and 0x02 represents the stage mistake;
Need to prove that order can both be successfully completed usually, only two fields in front need to be set is that corresponding value can meet the demands;
Concrete in the present embodiment described protocol header has been resolved the data that return to main frame and has been specially 13 bytes, specifically comprises: field identification, the label of coomand mode, the spare word joint number when order is finished etc.;
Step B-1-2: upgrade described send finger and described transmission data variable;
In the present embodiment, the value of described send finger is updated to its currency adds that this sends the length of data, the value of described transmission data variable is updated to its currency deducts the length that this sends data;
Step B-2: whether described USBKey equipment judges the deviate of current the second operating pointer and current send finger greater than the 3rd preset value, is execution in step B-3 then; Otherwise interrupt returning;
Step B-3: described USBKey equipment is carried out corresponding transmit operation and is upgraded described transmission data variable and described send finger, interrupts returning;
Carry out corresponding transmit operation in the present embodiment and upgrade described transmission data variable and described send finger is specifically seen step B-1-1 to B-1-2, do not repeat them here.
Need to prove, can not comprise in the step 202 opening sending end points and interrupting, when the equipment of USBkey described in the step 212 judges that the value of current the second operating pointer is unequal with the value of current send finger, just open and send the end points interruption; After USBkey equipment executes the interrupt operation of transmission end points, then do not return the step of processing when master routine continues to carry out the receive interruption signal if receive other look-at-me; The step of processing during described receive interruption signal can be arbitrary steps;
When the embodiment of the invention is encrypted processing for USBkey equipment to data, receive/send data by the end points interrupt mode, realize that the transmitting-receiving of data and data processing are synchronous, reduce the stand-by period of USBkey equipment, improved data manipulation speed.
Embodiment four
The embodiment of the invention four provides a kind of method that improves data manipulation speed, below in conjunction with Fig. 3 described method is introduced.
As shown in Figure 3, a kind of method that improves data manipulation speed specifically may further comprise the steps:
Step 301:USBKey device power;
Step 302:USBKey equipment interconnection is received pointer, send finger, the first operating pointer and the second operating pointer and is carried out initialization, open to receive the end points interruption and send end points and interrupt, wait for that receiving end points interrupts entering the receive interruption processing, wait interrupting returning rear execution in step 303;
In the present embodiment, described USBkey equipment interconnection is received pointer, send finger, the first operating pointer and the second operating pointer and carried out initialization and be specially: the value of described reception pointer and described the first operating pointer is set to respectively the base address of the first buffer area, and the value of described send finger and described the second operating pointer is set to the base address of the second buffer area; Described reception pointer is used to indicate the position of the data of reception; Described send finger is used to indicate the position of the data of transmission; Described the first operating pointer is used to indicate the position of service data; Described the second operating pointer be used to indicate the data that obtain after the operation in the second buffer area the position.
Particularly, in the present embodiment, described USBkey equipment enters the receive interruption processing when receiving the interruption of reception end points and specifically comprises:
A-1: will receive data mobile to the first buffer area that end points receives;
A-2: upgrade reception pointer and receive data variable, interrupt returning;
Particularly, the value with described reception pointer is updated to the length that its currency adds the data of this reception; The value of described receive data variable is updated to the length that its currency adds the data of this reception;
Whether step 303:USBKey equipment judges the deviate of current reception pointer and current the first operating pointer greater than protocol header length, is execution in step 304 then; Otherwise wait for that receiving end points interrupts entering the receive interruption processing, wait interrupting returning rear continuation execution in step 303;
Particularly, the length of protocol header described in the present embodiment is 10;
Step 304:USBKey equipment obtains protocol header and it is resolved from the first buffer area, obtain data length and command operation type;
In the present embodiment, described protocol header comprises 10 bytes, and the 1st byte obtaining particularly described protocol header obtains described command operation type, obtains 2-5 byte and obtains data length;
Step 305:USBKey equipment upgrades the receive data variable according to described data length, according to described command operation type setting operation type identification, and upgrades described the first operating pointer;
In the present embodiment, described action type sign is used for the marking command action type, and described the first operating pointer of described renewal is specially: the value of described the first operating pointer is updated to the length that its currency adds protocol header;
Whether step 306:USBKey equipment judges the deviate of current reception pointer and current the first operating pointer greater than the second preset value, is execution in step 307 then; Otherwise wait for that receiving end points interrupts entering the receive interruption processing, wait interrupting returning rear continuation execution in step 306;
In the present embodiment, described the second preset value is each data length of processing;
Step 307:USBKey equipment is according to the type of the described service data of action type sign judgement, if the type of described service data is the encryption and decryption data type, then execution in step 308; If the type of described service data is other data types, then execution in step 309;
Step 308:USBKey equipment carries out the encryption and decryption processing to described service data and obtains result data, and upgrades described the first operating pointer and the second operating pointer, execution in step 310;
In the present embodiment, the value of described the first operating pointer is updated to its currency adds the above second preset value, the value of described the second operating pointer is updated to the length that its currency adds result data;
Step 309:USBKey equipment is carried out corresponding operation according to the data type of described service data and is obtained result data, and upgrades described the first operating pointer and described the second operating pointer, order execution in step 310;
In the present embodiment, the value of described the first operating pointer is updated to its currency adds the above second preset value, the value of described the second operating pointer is updated to the length that its currency adds result data;
Step 310:USBKey equipment judges whether current reception pointer equates with the value of current the first operating pointer, is execution in step 311 then; Otherwise return step 306;
Step 311:USBKey equipment judges whether described the second operating pointer equates with the value of described send finger, is then to return step 303; Otherwise wait for that the transmission end points interrupts entering transmission and interrupts processing, return rear continuation execution in step 311 until interruption;
In the present embodiment, described USBkey equipment receives to send to enter when end points interrupts to send to interrupt processing and is specially:
Step B-1: described USBKey equipment judges that the value that sends data variable whether less than the 3rd preset value, is then to carry out corresponding transmit operation and upgrade described transmission data variable and described send finger, returns step 303; Otherwise execution in step B-2;
The 3rd preset value refers to send the length of data at every turn in the present embodiment, carries out corresponding transmission processing and upgrades described transmission data variable and described send finger is specially:
Step B-1-1: the data mobile of the second buffer area is sent to main frame to sending buffer area;
Step B-1-2: upgrade described send finger and described transmission data variable;
In the present embodiment, the value of described send finger is updated to its currency adds that this sends the length of data, the value of described transmission data variable is updated to its currency deducts the length that this sends data;
Step B-2: whether described USBKey equipment judges the deviate of current the second operating pointer and current send finger greater than the 3rd preset value, is execution in step B-3 then; Otherwise interrupt returning;
Step B-3: described USBKey equipment is carried out corresponding transmit operation and is upgraded described transmission data variable and described send finger, interrupts returning;
Carry out corresponding transmit operation in the present embodiment and upgrade described transmission data variable and described send finger is specifically seen step B-1-1 to B-1-2, do not repeat them here.
Need to prove, can not comprise in the step 302 opening sending end points and interrupting, when the equipment of USBkey described in the step 311 judges that the value of current the second operating pointer is unequal with the value of current send finger, just open and send the end points interruption; After USBkey equipment executes the interrupt operation of transmission end points, then do not return the step of processing when master routine continues to carry out the receive interruption signal if receive other look-at-me; The step of processing during described receive interruption signal can be arbitrary steps;
When the embodiment of the invention is encrypted processing for USBkey equipment to data, receive/send data by the end points interrupt mode, realize that the transmitting-receiving of data and data processing are synchronous, reduce the stand-by period of USBkey equipment, improved data manipulation speed.
The above; only for the better embodiment of the present invention, but protection scope of the present invention is not limited to this, anyly is familiar with those skilled in the art in technical scope disclosed by the invention; the variation that can expect easily or replacement all should be encompassed within protection scope of the present invention.Therefore, protection scope of the present invention should be as the criterion with the protection domain of claim.

Claims (19)

1. a method that improves data manipulation speed is characterized in that, comprises operational processes and interrupt to process, 1. wherein said operational processes specifically comprise-4.:
1., USBKey powers on and carries out initialization;
2., described USBKey judges that whether the deviate of current reception pointer and current the first operating pointer is less than protocol header length, to wait for that then receiving end points interrupts entering the receive interruption processing, wait interrupting returning rear continuation execution in step 2., otherwise the content of analysis protocol head is also upgraded described the first operating pointer, and execution in step 3.;
3., described USBKey judge current reception pointer and current the first operating pointer deviate whether less than the second preset value, be to wait for that then receiving end points interrupts entering receive interruption and process, wait interrupting returning rear continuation execution in step 3.; Otherwise carry out corresponding operation according to the action type sign, obtain result data, and upgrade described the first operating pointer, execution in step 4.;
4., described USBKey judges whether the value of current reception pointer equates with the value of current the first operating pointer, if equate then send the result data that obtains; If unequal then return step 3.;
Enter the receive interruption processing when described USBKey receives to receive when end points interrupts, comprising:
5., described USBKey is with data mobile to the first buffer area that receives and upgrade described reception pointer, and interrupt returning.
2. the method for claim 1 is characterized in that, described USBKey carries out initialization, specifically comprises:
Described USBKey is set to respectively the base address of the first buffer area with the value of reception pointer and the first operating pointer, opens to receive end points and interrupt, and waits for that receiving end points interrupts entering receive interruption and process;
Wherein, described reception pointer is used to indicate the position of the data of reception; Described the first operating pointer is used to indicate the position of service data.
3. the method for claim 1 is characterized in that, 2. described step specifically comprises:
Judge that whether the deviate of current reception pointer and current the first operating pointer is less than 31, to wait for that then receiving end points interrupts entering the receive interruption processing, wait interrupting returning rear continuation execution in step 2., otherwise the content of analysis protocol head and upgrade described the first operating pointer, execution in step is 3..
4. the method for claim 1 is characterized in that, 2. described step specifically comprises:
Judge that whether the deviate of current reception pointer and current the first operating pointer is less than 10, to wait for that then receiving end points interrupts entering the receive interruption processing, wait interrupting returning rear continuation execution in step 2., otherwise the content of analysis protocol head and upgrade described the first operating pointer, execution in step is 3..
5. the method for claim 1 is characterized in that, described the second preset value is specially the data length of each processing.
6. the method for claim 1 is characterized in that, the content of described analysis protocol head is also upgraded described the first operating pointer and specifically comprised:
From the first buffer area, obtain described protocol header content and it is resolved and obtain data length and command operation type, according to command operation type setting operation type identification, the value of described the first operating pointer is updated to its currency adds protocol header length.
7. method as claimed in claim 3 is characterized in that, the content of described analysis protocol head is also upgraded described the first operating pointer and is specially:
From described the first buffer area, obtain the content of described protocol header, obtain described data length from 8-11 byte of described protocol header; Obtain direction signs from the 12nd byte of described protocol header, carry out corresponding operating according to the value of described direction signs; Obtain described command operation type from 16-19 byte of described protocol header, according to the command operation type described action type sign is set; The value of described the first operating pointer is updated to its currency adds 31.
8. method as claimed in claim 7 is characterized in that, described value according to described direction signs is carried out corresponding operating and is specially:
Judge the value of described direction signs, if the value of described direction signs is the first numerical value, then execution in step 3.; If the value of described direction signs is second value, then execution in step 5..
9. method as claimed in claim 4 is characterized in that, described analysis protocol head content is also upgraded described the first operating pointer and is specially:
From described the first buffer area, obtain the content of described protocol header, obtain described command operation type from the 1st byte of described protocol header, according to the command operation type described action type sign is set; Obtain described data length from 2-5 byte of described protocol header, the value of described the first operating pointer is updated to its currency adds 10.
10. the method for claim 1 is characterized in that, the described execution accordingly according to the action type sign operates, and obtains result data, and upgrades described the first operating pointer, is specially:
Judging according to described action type sign whether the current operation data are the encryption and decryption data type, is then to carry out the encryption and decryption processing, and the value of described the first operating pointer is updated to its currency adds the above second preset value; Otherwise carry out corresponding operating according to data type, and the value of the first operating pointer is updated to its currency adds the above second preset value.
11. the method for claim 1 is characterized in that, the described reception pointer of described renewal is specially:
The value of described reception pointer is updated to the length that its currency adds this receive data.
12. the method for claim 1 is characterized in that, comprises the executing state of order in the described result data.
13. method as claimed in claim 12 is characterized in that, the executing state of described order specifically comprises:
The 0x01 of the 0x00 of expression order successful execution, the failure of expression command execution and the 0x02 of expression stage mistake.
14. method according to claim 1, it is characterized in that, also be provided with and send the end points interruption, and be correspondingly provided with the second operating pointer and send finger, wherein, described the second operating pointer is used to indicate the position of the result data that obtains after the operation, described send finger is used to indicate the position of the data of transmission, correspondingly, described step obtains result data in 3., upgrades described the first operating pointer and also comprises and upgrade the second operating pointer;
The result data that described transmission obtains specifically comprises:
6., described USBKey judges whether the value of current the second operating pointer equates with the value of current send finger, if equate then to return step 2., if unequally wait for that then sending end points interrupts entering sending and interrupt processing, wait interrupting returning rear continuation execution in step 6.;
Interrupt processing when described USBKey receives to send to enter when end points interrupts to send, comprising:
7., described USBKey judge current transmission data variable value whether less than the 3rd preset value, be then to carry out corresponding transmission processing and upgrade described transmission data variable and described send finger, return step 2.; Otherwise execution in step 8.;
8., described USBKey judge current the second operating pointer and current send finger difference whether greater than the 3rd preset value, be then to carry out corresponding transmission processing and upgrade described transmission data variable and described send finger, and interrupt returning; Otherwise interrupt returning.
15. method as claimed in claim 14 is characterized in that, also comprises when described USBKey carries out initialization opening sending the end points interruption.
16. method as claimed in claim 14, it is characterized in that, described step 6. in when the value of the value of current the second operating pointer and current send finger is unequal, at first open and send the end points interruption, and then wait for that the transmission end points interrupts entering transmission and interrupts processing, return rear continuation execution in step 6. until interruption.
17. method as claimed in claim 14 is characterized in that:
Described the 3rd preset value is specially the length of each transmission data;
The described transmission data variable of described renewal and described send finger specifically comprise: the value of described send finger is updated to its currency adds that this sends the length of data, the value of described transmission data variable is updated to its currency deducts the length that this sends data.
18. method as claimed in claim 14, it is characterized in that, described result data is stored in the second buffer area, described the second operating pointer specifically be used to indicate the result data that obtains after the operation in the second buffer area the position, comprise also when described USBKey carries out initialization that the value of described USBKey send finger and the second operating pointer is set to the base address of the second buffer area.
19. method as claimed in claim 18 is characterized in that, described transmission processing is specially the data mobile in described the second buffer area is sent to sending buffer area.
CN201210477046.3A 2012-11-21 2012-11-21 Method for improving data operation speed Expired - Fee Related CN103049706B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210477046.3A CN103049706B (en) 2012-11-21 2012-11-21 Method for improving data operation speed

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210477046.3A CN103049706B (en) 2012-11-21 2012-11-21 Method for improving data operation speed

Publications (2)

Publication Number Publication Date
CN103049706A true CN103049706A (en) 2013-04-17
CN103049706B CN103049706B (en) 2015-06-17

Family

ID=48062339

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210477046.3A Expired - Fee Related CN103049706B (en) 2012-11-21 2012-11-21 Method for improving data operation speed

Country Status (1)

Country Link
CN (1) CN103049706B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108231131A (en) * 2016-12-15 2018-06-29 北京兆易创新科技股份有限公司 A kind of eMMC test methods and device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030037152A1 (en) * 2001-08-15 2003-02-20 Carry Computer Eng. Co., Ltd. Double interfaced storage communication network card with a communication protocol device
CN101227689A (en) * 2007-12-27 2008-07-23 华为技术有限公司 Method and apparatus for reporting information
CN101271387A (en) * 2008-04-28 2008-09-24 北京中星微电子有限公司 Automatic relieving method and device for data caching flux
CN101339498A (en) * 2007-07-05 2009-01-07 华东师范大学 Singlechip adopting RISC structure
CN101777979A (en) * 2009-12-28 2010-07-14 北京飞天诚信科技有限公司 Operating method and system for intelligent key device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030037152A1 (en) * 2001-08-15 2003-02-20 Carry Computer Eng. Co., Ltd. Double interfaced storage communication network card with a communication protocol device
CN101339498A (en) * 2007-07-05 2009-01-07 华东师范大学 Singlechip adopting RISC structure
CN101227689A (en) * 2007-12-27 2008-07-23 华为技术有限公司 Method and apparatus for reporting information
CN101271387A (en) * 2008-04-28 2008-09-24 北京中星微电子有限公司 Automatic relieving method and device for data caching flux
CN101777979A (en) * 2009-12-28 2010-07-14 北京飞天诚信科技有限公司 Operating method and system for intelligent key device

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108231131A (en) * 2016-12-15 2018-06-29 北京兆易创新科技股份有限公司 A kind of eMMC test methods and device

Also Published As

Publication number Publication date
CN103049706B (en) 2015-06-17

Similar Documents

Publication Publication Date Title
US9661479B2 (en) Communication device, program, and communication method
US8516232B2 (en) Method and memory device for performing an operation on data
US9633211B2 (en) Method for realizing secure communication
US20110016310A1 (en) Secure serial interface with trusted platform module
CN101072100A (en) Authenticating system and method utilizing reliable platform module
EP3311290B1 (en) Extended message signaled interrupts (msi) message data
CN104318201A (en) Fingerprint processing method, chip and terminal
CN201015047Y (en) Split type RF CPU card meter controller
CN107908940A (en) The method and terminal device of a kind of fingerprint recognition
CN108182576B (en) Security authentication method and system
CN107346257A (en) A kind of implementation method and device for turning JTAG renewal FPGA programs based on Shen prestige server USB
CN103049706A (en) Method for improving data operation speed
CN103207964A (en) Multifunctional intelligent key device and operating method thereof
CN103455462A (en) Usb host controller and scheduling methods thereof
CN104102871A (en) Electronic signature verification extension equipment and information processing method
CN104102869B (en) Electron underwriting authentication expansion equipment and information processing method
CN104102870B (en) Electron underwriting authentication expansion equipment and information processing method
CN102938034A (en) Working method for conversion device
CN102932193A (en) Network device, management terminal and configuration management system
CN101127716B (en) A CNU registration method for EOC system and its EOC system
CN103544011B (en) A kind of dynamic creation is also used the method for functional object
CN107548058B (en) Equipment access method and intelligent terminal
Wu et al. The research and design of ATM PIN pad based on triple DES
CN104156761A (en) ID card data transmission system and method
CN113037509B (en) Serial communication method and electric energy meter 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
C14 Grant of patent or utility model
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: 20150617