With regard to existing testing software, in the test process to hardware devices such as modulator-demodular unit (Modem), serial/parallel row mouth, software and hardware drivers, its implementation often earlier directly writes detecting information by computer to tested hardware, wait for response (response) then, and it reception is remake the operation of examination when from tested hardware.In other words, the method for testing of prior art at first passes " detecting information " to " tested hardware " by " computer ", then by " tested hardware " " detecting information " is handed to " primary application program " again and handles to produce one " result ".This " result " passes " computer " back via " tested hardware " again, to write down, to show test results.Said process is shown in " Fig. 1 ", and (after the step 10), (step 11) when then handling detecting information again, must be waited for Hardware Response Delay data (step 12) to transfer to the primary application program processing at first to transmit data to tested hardware to begin test.The 4th step then is the response data (step 13) that shows gained.But (step 14) is carried out the instruction (step 15) of being imported by computer then to do further processing at the 5th step user input instruction.Check at last and whether finished whole test (step 16).If not, then continue to do whole testing process again; If finish, then finish or carry out the test (step 17) of next tested hardware.
From the above mentioned, prior art is to carry out testing process with the method for " serial operation " as can be known.Briefly, the program that each step is carried out is " carrying out successively ", so after each step must wait for that a last step is finished, just can carry out.And this major defect of prior art just.Because need waiting for a step, the execution of each step just can carry out after finishing, therefore slower unavoidably on whole speed.With modulator-demodular unit (Modem) is example, suppose that modulator-demodular unit is with every millisecond of character (character, English character or symbol need the length of bytes " Byte " to store) speed send word string " This is a test. " to application program, totally 15 characters, four individual characters.Application program is distinguished each individual character according to space between English alphabet or punctuation mark.The tupe of application program be with " individual character " as base unit, individual character of its every processing takes 3 milliseconds.Because the speed of internal memory operation (comprising program execution and data access) is fast (is unit with the nanosecond) quite, disregards its shared time so can ignore.
In the serial method of testing of prior art, shown in " Fig. 1 " flow process, after needing to put in order earlier string test character and receiving fully, just can carry out its processing.So the needed time of its modulator-demodular unit is added the time (4 * 3=12 millisecond) of handling four individual characters for receiving the time (15 milliseconds) of 15 characters, 27 milliseconds altogether.
In addition, receive fully owing to need to test character earlier, so its required storage space need have the memory headroom of 15 characters at least.In addition, because this is serial operation, therefore before application program was finished dealing with, the user had no way of learning its present situation.Therefore when wrong or during, often can't learn and lose time when the situation generation of fault.This phenomenon is when the test modulator-demodular unit, because its operating rate variation range very big (by 110 bauds~11520 bauds), therefore the time of response just has very big difference.Particularly when modulator-demodular unit runs on different CPU and the display card, very easily cause the confusion in the sequential cooperation.In addition, the transmission of data always has certain bit error rate, and this mistake can cause the variation that receives data content and length.In order to receive the data of this unknown lengths, adopt art methods " receive----handle----receive again----handle----again until finishing " pattern, can only solve by the method that strengthens temporarily providing room, cause the waste of storage space.
Goal of the invention and general introduction
Fundamental purpose of the present invention is to propose a kind of test module that can improve hardware testing speed, and clearly data flow can be provided, and reduces the required storage space of test.
Spirit of the present invention is to carry out hardware testing in the mode of " parallel work-flow " replacement prior art " serial operation ".In the prior art, after application program need wait for that whole detecting informations receives, could begin these detecting informations are handled.Yet, application programs, the mode that it handles detecting information be with letter handling one by one, and non-once is just handled whole detecting information.In other words, application programs, the process of its information processing only need partly that detecting information just can begin to carry out.So in the present invention, in acceptance test information, just begin to make application program to go to handle by taking out character in the storer.In other words, utilize the characteristic on the application program process information, make the reception of information and information processing to carry out simultaneously, and reduce the required time of whole test.
For this reason, the present invention uses the gimmick of direct intercepting hardware interrupts, cook up an annular working storage earlier, utilize " Put pointer " to reach the access that " Take pointer " comes operation information, and provide one " break in service ", make application program when handling detecting information, the reception program is acceptance test information unceasingly one by one still.
In addition, for application program, because detecting information does not need once just all to read and write in the storer, therefore the space of required storer also can be come fewly than prior art.Simultaneously, owing to utilize annular working storage and " Put pointer ", " Take pointer " two pointers, so application program will go to monitor the present situation of annular working storage with certain frequency.So see through application program, the user also can understand the situation that present test is carried out at any time, the meaningless wait in the time of therefore avoiding contingency to break down (down).
For above-mentioned and other purposes of the present invention, feature and advantage can be become apparent, a preferred embodiment cited below particularly, and conjunction with figs. are described in detail below.
The embodiment explanation
Referring to " Fig. 2 " is the functional block diagram of first embodiment.Planning has several storage unit on the annular working storage 21, and its each all is the each least unit that sends of hardware, and its byte (Byte) number is decided according to the different hardware type.One Put pointer 22 is arranged in addition, its position when demarcating that the information of carrying out deposits at every turn, its can when moving to the bottom, then can return starting point again along with the depositing in to reach of information.Position when having Take pointer 23 to read information in addition in order to demarcation.Be similar to Put pointer 22, Take pointer 23 also can when moving to the bottom, then can return starting point again along with the reading to reach of information.
When carrying out, related data will be passed to interrupt service routine 24 by the storer in the tested hardware, and the indication by Put pointer 22 is deposited in data in the annular working storage 21 successively by reference position.Primary application program 25 then is by Take pointer 23, and information is taken out successively and handled.In case Put pointer 22 or Take pointer 23 surpass the bottom of annular working storage 21, then return the reference position of annular working storage 21 automatically.In the judgement of reading, set if the position of Take pointer 23 is different from Put pointer 22, then representative has the information that does not read; In the judgement that deposits in, set if Put pointer 22 catch up with Take pointer 23, represent that then the space of annular working storage 21 is full.Utilize two above-mentioned judgment principles, can avoid reading excessive or write excessive problem.
" Fig. 3 " is the general flow chart of embodiment.Wherein primary application program 31 is responsible for handling user's input informations, and the state of monitoring communication buffer 33, and carries out reading of data according to this, and by control interrupt service routine 32 the current state of control hardware accordingly.Communication buffer 33 can be accepted the variation of tested hardware working storage and writing of test data.32 of primary application program 31 and interrupt service routines are two parallel programs, but as if the two communication buffer of access (access) simultaneously 33, then will cause the confusion of information.Therefore,, therefore set primary application program when using the ring-type working storage, close interrupt service routine 32 earlier, to stop its writing for communication buffer 33 in order to make interrupt service routine 32 and primary application program 31 both mutual exclusions on communication buffer 33; Open interrupt service routine 32 after finishing again to continue to receive data.
Whether " Fig. 4 " is the break in service process flow diagram, at first at tested hardware, reads in the working storage value in the tested hardware one by one, have data will transmit (step 41) to look it.Judge whether the working storage value changes (step 42), as change and then write down its situation of change and make a mark (step 43) so that primary application program identification.Judge whether to run through all values (step 44),, then return step 41 and continue to read if do not have; If run through all values, then continue to judge whether interrupt service routine receives new data (step 45).If have, then the indication of received data according to the Put pointer deposited in the ring-type working storage, and upgrade the position (step 46) of Put pointer.Then, judge whether working storage will overflow (step 47).If then orders hardware to suspend and send data, and setting hardware is that halted state (step 48) back interrupts returning.If interrupt service routine is not received new data (step 45), then directly return.
" Fig. 5 " reads the flow process that number has deposited the data in the ring-type working storage in for primary application program.After program begins, in the position judgment working storage by monitoring Put pointer and Take pointer whether new data (step 51) is arranged.If have, then close interrupt service routine (step 52), to avoid when primary application program fetches data, there is new data to write again.Then,, change the Take pointer (step 53) of ring-type working storage after finishing, and opens interrupters service routine (step 54) is to continue to receive new data by taking out data by the unit in the ring-type working storage.Set the success mark (step 55) that fetches data then, return then (step 56).If there are not new data in the ring-type working storage, then establish one earlier and fetch data fail flag (step 57) to judge whether hardware is in halted state (step 58).If, then send the instruction that continue to transmit data, and be transmit status (step 59) hardware setting to hardware, return then (step 56); If being in normal condition, hardware directly returns (step 56).
" Fig. 6 " is the data access flow process.At first judge whether pending data (step 61) and then handle the specified data of update mark, remove update mark (step 62) simultaneously up to the processing of finishing all data as if having.Judge then whether hardware has obtained the response of expection, the data of response should identical with the data that transmitted (step 63), if not then time-delay waits for that hardware gives a response (step 64).The time of judge waiting for (step 65), if just receive once more that to the upper limit of stand-by period hardware responds, return information starting point then, the judgement of try again again " whether having new data to handle ".On the contrary, having surpassed the stand-by period upper limit if wait, is overtime (step 66) with setting state then, returns result (step 68) then.If hardware has been made the response of expection, it is provided with hardware response value (step 67), directly returns result (step 68).
If same is example with modulator-demodular unit (Modem), suppose that modulator-demodular unit is with every millisecond of character (Character, needing length is the storage area of a byte Byte) speed send word string " This is a test. " to application program, totally 15 characters, four individual characters.Application program is distinguished each individual character according to space between English alphabet or punctuation mark.The tupe of application program be with " individual character " as base unit, individual character of its every processing takes 3 milliseconds.Because the speed of internal memory operation (comprising program execution and data access) is fast (is unit with the nanosecond) quite, disregards its shared time so can ignore.The capacity of ring-type working storage is 8 Byte.Then present embodiment is that the operation steps of example is as follows with " This is a test ":
1. shown in " Fig. 6 ", under original state, Take pointer and Put pointer refer at the top of ring-type working storage, i.e. the 1st Byte place;
2. interrupt service routine is the data " This " that receive, and the 1st to the 5th Byte of working storage inserted in totally five characters, and the Put pointer moved to deposits character place (this example is the 6th Byte place) next time, and this process takes 5 milliseconds;
3. primary application program judges that the position of the pointer (Take pointer) that fetches data is different from the Put pointer, and it is pending therefore to be judged to be data.Primary application program is read " This ", and has time every " " because of it includes, and therefore a complete individual character has been read in judgement automatically, simultaneously the Take pointer is moved to the next one and gets individual character place (this example is the 6th Byte place);
4. primary application program begins to handle the individual character " This " that is read, this process is with 3 milliseconds consuming time, when primary application program is handled individual character, because interrupt service routine still receives data concurrently, therefore when primary application program is finished the processing of individual character (3 milliseconds), again " is " deposited in the ring-type working storage among the 6th~8 Byte.Overflow for fear of working storage, so the Put pointer is moved to the 1st Byte place again;
5. primary application program takes out " is ", judges that according to " " it receives a complete individual character, and the Take pointer is shifted to the 1st Byte place;
6. primary application program is handled individual character " is ", and " at " that the while interrupt service routine will receive deposits the 1st to the 3rd Byte in, and the Put pointer moved to the 4th Byte, 3 milliseconds consuming time of this process;
7. take out individual character " a ", the Take pointer is shifted to the 3rd Byte.
8. handle individual character " a ", " est " that the while interrupt service routine will receive deposits the in the 4th to the 6th Byte in, and the Put pointer moved to the 7th Byte place, 3 milliseconds consuming time of process;
9. according to the Take pointer, take out " test ", but, show that the data of being taken out may be imperfect, so first opens interrupters service routine is waited for that it receives character late, and remained in monitoring state owing to do not receive space character from the 3rd Byte place;
10. interrupt routine character ". " that the next one is received deposits the 7th Byte in, 1 millisecond consuming time of this process, and the Put pointer moved to the 8th Byte;
11. primary application program is received character ". ", after being judged as space character, expression " test " is a complete individual character, so the Take pointer is moved to the 8th Byte;
12. handle individual character " test ", 3 milliseconds consuming time.Therefore, the total time is 5+3+3+3+1+3=18 (millisecond).Than 27 milliseconds of art methods is fast.Required working storage space also is kept to 8 Byte by 15 Byte simultaneously.Can seem the present invention really can reach pick up speed and lower the purpose in required working storage space.