The automatic method for identifying signal interfaces of electronic equipment
[technical field]
The present invention relates to a kind of automatic method for identifying signal interfaces of electronic equipment, particularly about a kind of automatic identifying method that is used to connect the USB/PS2 interface of peripherals and computer host system.
[background technology]
Along with the fast development of computer technology, circulation and processing that increasing electronic equipment can be connected with computer host system and realize data by identical or different interfaces.For example, keyboard and mouse as the input equipment of host computer system, mainly be to be connected with main frame by USB (Universal Serial Bus, USB (universal serial bus)) interface or PS2 (Personal System/2, the ps interface of IBM exploitation) interface.The PS2 interface once was a basic standard that connects keyboard/mouse and main frame for a long time, but develop the usb bus framework of the hot plug function of support in Intel Company after, USB interface is widely used in connecting peripherals such as keyboard, mouse, printer, flash memory device, digital camera in recent years, for the shared interface of multiple peripherals, USB interface has become the standing interface of many peripherals and computer host system as a kind of.For the peripherals of multiple interfaces such as compatible USB/PS2, it must have the function of automatic recognition interface, so that adopt corresponding communications protocol to realize and being connected of main frame.
USB has different data-transmission modes with the PS2 interface, USB interface is to carry out data transmission by the digital signal of a pair of difference between peripherals and host computer system, and PS2 carries out data transmission by data-signal and clock signal between peripherals and host computer system, therefore, the hardware and software of the two requires to have nothing in common with each other.At United States Patent (USP) the 6th, 460, in the patent documentation of 094B1 number disclosed " can detect the peripherals of the interface type that himself connects ", USB and PS2 interface architecture have been disclosed, as Figure 1A, Figure 1B and shown in Figure 2.Wherein, the USB interface shown in Figure 1A is used for the high-speed peripheral of 12Mbps, and USB interface shown in Figure 1B is used for the low speed peripherals of 1.5Mbps.In Figure 1A and Figure 1B, USB device 100,120 is connected to USB connector 112 by two leads 104,106 respectively, is connected to usb 1 02 by lead 108,110 again, and then is connected with the primary processor 21 of computing machine 20.Lead 104,106 signals that transmitted are marked as D+, D-respectively in USB device, signal D+, D-are the differential digital data-signals.In high speed USB equipment, the D+ signal is moved to the logic high potential (as VCC) of about 3.3V by pull-up resistor 114, and in the low speed USB device, the D-signal is moved to logic high potential by pull-up resistor 122.In usb 1 02, signal D+, the D-in the lead 108,110 is pulled down to low level by two pull down resistors 116,118 with the logic current potential respectively.
After USB peripherals connects, signal D+ or D-are drawn high, main frame is found to know have equipment to connect behind this high level signal, the low level signal that the sends 10MS peripherals that resets provides first command and is provided with according to corresponding BIOS etc. and carries out next step and dispose to normal mode of operation after finishing.
Fig. 2 has shown the framework that peripherals 124 is connected with computing machine 20 by PS2 interface 126, and peripherals 124 is connected to PS2 connector 128 by two leads 104,106, is connected to PS2 interface 126 and then is connected with primary processor 21 through lead 108,110.Lead 104,108 is corresponding to data-signal, lead 106,110 is corresponding to clock signal, lead 104,106 is connected respectively to transistor 131,133, and they are set to open collector switch or open-drain switch by the microprocessor control of peripherals 124.In PS2 peripherals 124, lead 104,106 signals that transmitted are moved logic high to by resistance 130,132 respectively.In PS2 interface 126, lead 108,110 signals that transmitted are moved to logic high by resistance 134,136 respectively, and utilize transistor 138,140 coupling ground connection respectively.In the PS2 interface, clock signal is no matter how the transmission direction of data is provided by peripherals all the time on the data line.
PS2 peripherals sends self check bag (0xAA) earlier after connecting energising, and main frame knows have equipment to connect after seeing this self check bag, is provided with according to corresponding BIOS etc. then and carries out next step and dispose to normal mode of operation.
Above-mentioned United States Patent (USP) the 6th, 460, the USB/PS2 interface recognition methods of 094B1 number proposition is to judge the recognition interface type according to the current potential of two signal wires.But this mode belongs to disposable determination methods, may cause wrong diagnosis in case signal is subjected to noise jamming in deterministic process, and this erroneous judgement is irrecoverable.Therefore this recognition methods also requires further improvement and is perfect.
Therefore, develop the USB/PS2 interface automatic identification technology that a kind of accurate sign indicating number is declared, thereby make the peripherals can two kinds of interfaces of automatic compatible USB/PS2, really expected by electronic industry.
[summary of the invention]
One of purpose of the present invention is to provide a kind of automatic identifying method of USB/PS2 interface, can discern the USB and the PS2 interface of peripherals like clockwork automatically, thereby and correspondingly interface modes automatically is set makes the peripherals can compatible USB and two kinds of interface modes of PS2 interface.
Two of purpose of the present invention is to provide a kind of automatic method for identifying signal interfaces of electronic equipment, can discern the peripheral interface type of computer host system like clockwork automatically, and the corresponding interface pattern is set automatically, thereby make the interface that peripherals can compatible number of different types.
One of purpose of the present invention is achieved through the following technical solutions: a kind of automatic identifying method of USB/PS2 interface, be applicable to the peripherals of compatible USB and PS2 interface and have the host computer system of USB and PS2 interface, wherein USB and PS2 interface have first signal conductor and secondary signal lead respectively, the signal mode of peripherals comprises power mode, USB pattern and PS2 pattern, it is characterized in that this method comprises:
(1) power up, peripherals are plugged on the USB or PS2 interface of host computer system, and system enters the electrification reset state, and the signal mode of peripherals is last power mode;
(2) judge process in advance, peripherals is judged first signal conductor at host interface place and the current potential of secondary signal lead, if wherein one of signal conductor or whole current potentials are high, what then preliminary judgement was connected is the PS2 interface, the signal mode of peripherals is set to the PS2 pattern, enters pre-PS2 state; Otherwise the signal mode of peripherals is set to the USB pattern, enters pre-USB state;
(3) confirm deterministic process, comprising:
Under pre-PS2 state, peripherals waits for that host computer system sends first command: if find to occur on first and second signal conductor the feature of USB interface, then peripherals is transferred to pre-USB state; Otherwise after receiving the first command that main frame sends, enter the PS2 state;
Under pre-USB state, peripherals waits for that host computer system sends first command: if find to occur on first and second signal conductor the feature of PS2 interface, then peripherals is transferred to pre-PS2 state; Otherwise after receiving the first command that main frame sends, enter the USB state;
(4) lock-out state process will be judged errorless USB state or the locking of PS2 state through confirming deterministic process, and peripherals is connected with host computer system by USB pattern or PS2 pattern.
Two of purpose of the present invention is achieved through the following technical solutions: a kind of automatic method for identifying signal interfaces of electronic equipment, be applicable to the peripherals and the host computer system that has a first kind interface and one second interface at least of the compatible first kind interface at least and second class interface, wherein, first and second class interface includes first signal conductor and secondary signal lead respectively, the signal mode of this peripherals comprises power mode, first kind pattern and second quasi-mode at least, and this method comprises:
(1) power up, peripherals are plugged in the first kind interface or second class interface of host computer system, and system enters reset mode behind the electrifying startup, and the signal mode of peripherals is last power mode;
(2) judge process in advance, peripherals detects judgement to the current potential of first and second signal conductor in first or two class interfaces of host computer system, if the current potential that a signal conductor is wherein arranged is for high, the interface that then preliminary judgement is connected is a first kind interface, the signal mode that peripherals is set is a first kind pattern, and peripherals enters pre-first kind Interface status; Otherwise the signal mode that peripherals is set is second quasi-mode, and peripherals enters the pre-second class interface state;
(3) confirm deterministic process, comprising:
Under pre-first kind Interface status, peripherals waits for that host computer system sends first command: if find to occur on first and second signal conductor the feature of second class interface, then peripherals is transferred to the pre-second class interface state, otherwise enters first kind Interface status after receiving the first command that main frame sends;
Under the pre-second class interface state, peripherals waits for that host computer system sends first command: if find to occur on first and second signal conductor the feature of first kind interface, then peripherals is transferred to pre-first kind Interface status, otherwise enters the second class interface state after receiving the first command that main frame sends;
(4) locking process will be judged errorless first kind Interface status or the locking of the second class interface state through confirming deterministic process.
The interface automatic identifying method that the present invention proposes by pre-judgement, mistake then automatically the affirmation of redirect judge, receive processes such as corresponding communication instruction back lock-out state, the interface type of discerning peripherals automatically and being connected.For example, when the present invention is used for discerning the USB/PS2 interface automatically, because the communication instruction of USB and PS2 is diverse, so in case locking, then explanation judge errorless, and before lock-out state, by flexibly automatically redirect mechanism guarantee whole judgement normally, correctly carry out.Therefore, the present invention can realize accurately, not have the automatic recognition effect of interface of erroneous judgement, effectively prevents to make false judgment because of signal disturbs.
[description of drawings]
Figure 1A is the high speed USB peripherals of routine and the link composition of USB interface of computer.
Figure 1B is the low speed USB peripherals of routine and the link composition of USB interface of computer.
Fig. 2 is the link composition of the PS2 interface of conventional PS2 peripherals and computing machine.
Fig. 3 is the process flow diagram of the automatic identifying method of USB/PS2 interface of the present invention.
[embodiment]
As described in preamble " background technology " part and consult United States Patent (USP) the 6th, 460,094B1 number related content as can be known, no matter these two kinds of interface modes of USB and PS2 are this host-host protocol or electrical specification aspect, its difference is clearly, but also has the general character of physics and use-pattern aspect.Therefore, as long as judgment mode is reasonable, it is attainable that the peripherals of compatible two kinds of interface modes is integrated together.
The interface type automatic identifying method that the present invention promptly provides a kind of reliability height, can not judge by accident, be applicable to the peripherals and the host computer system that has a first kind interface and one second interface at least of the compatible first kind interface at least and second class interface, wherein, first and second class interface includes first signal conductor (L1) and secondary signal lead (L2) respectively, and the signal mode of this peripherals comprises power mode, first kind pattern and second quasi-mode at least; This method comprises: (1) power up, peripherals are plugged in the first kind interface or second class interface of host computer system, and system enters reset mode behind the electrifying startup, and the signal mode of peripherals is last power mode; (2) judge process in advance, peripherals detects judgement to the L1 in first or two class interfaces of host computer system, the current potential of L2, if the current potential that a signal conductor is wherein arranged is for high, the interface that then preliminary judgement is connected is a first kind interface, the signal mode that peripherals is set is a first kind pattern, and peripherals enters pre-first kind Interface status; Otherwise the signal mode that peripherals is set is second quasi-mode, and peripherals enters the pre-second class interface state; (3) confirm deterministic process, comprise: under pre-first kind Interface status, peripherals waits for that host computer system sends first command: if find the feature of the last appearance of L1, L2 second class interface, then peripherals is transferred to the pre-second class interface state, otherwise enters first kind Interface status after receiving the first command that main frame sends; Under the pre-second class interface state, peripherals waits for that host computer system sends first command: if find to occur on L1, the L2 feature of first kind interface, then peripherals is transferred to pre-first kind Interface status, otherwise enters the second class interface state after receiving the first command that main frame sends; (4) locking process will be judged errorless first kind Interface status or the locking of the second class interface state through confirming deterministic process.
Peripherals utilizes the present invention can accurately discern the host interface type that it connected, thereby realizes the integrated form design of compatible dissimilar interfaces.Be example promptly below, describe the specific embodiment of the present invention in detail with the automatic identifying method of USB/PS2 interface.
See also Fig. 3 and cooperate Figure 1A, Figure 1B and Fig. 2 reference, need at first clear and definite to be, for simplicity, the clock lead on D+ on the USB interface and the PS2 interface is called L1 in deterministic process, and the data conductor on D-on the USB interface and the PS2 interface is called L2.In addition, peripherals also is provided with a mode signal MODE, and it is defined as follows:
Below describe the implementation process that the present invention knows other method of phase in detail.
Process 1, peripherals are inserted on the USB or PS2 interface of main frame, and system enters the electrification reset state, finish to enter process 2 after resetting.In process 1, the signal mode MODE of peripherals is 11, represents that promptly current peripherals is placed in (POWER UP) state that powers on.
Process 2, because peripherals just powers on, therefore host computer system may be set earlier and wait about 100 milliseconds also at reset mode, stable with waiting system.At this moment, the state of external device does not change, and its signal mode MODE is 11.Next step enters process 3.
Process 3, peripherals is judged the L1 at host interface place, the current potential of L2.Wherein, in process 301, peripherals is judged the current potential of L1, is high as the L1 current potential, then can tentatively judge it is that the host interface that is connected is the PS2 interface, and the signal mode MODE that peripherals is set is 01, enters pre-PS2 pattern, and next step enters process 5; Otherwise, enter process 302 to judge the current potential of L2, if the current potential of L2 is high, then can tentatively judge it is that the host interface that is connected is the PS2 interface, the signal mode MODE that peripherals is set is 01, enters pre-PS2 pattern, next step enters process 5; Otherwise, can tentatively judge USB interface in the host interface that is connected, the signal mode MODE that peripherals is set is 10, enters pre-USB pattern, next step enters process 4.
Process 4 and process 6 under pre-USB pattern, have pull-up resistor (as pull-up resistor among Figure 1A, Figure 1B 114,122) to draw high the current potential of L1 or L2 in peripherals, and this moment, system was under the USB pattern, wait for that usb host sends first command.In process 6, three kinds of situations may appear:
(1) if occur the feature of PS2 on L1, the L2 in the peripherals discovery host interface, for example two lines of L1 and L2 all are noble potential, then jump to process 5 immediately, and peripherals enters pre-PS2 pattern.
(2) as described above process 3 judge errorless, receive that then usb host sends article one instruction after, peripherals enters process 8, promptly real USB state.
(3) if above-mentioned two kinds of situations do not occur, it is constant that then peripherals remains on pre-USB pattern, turns back to process 4.
Process 5 and process 7, under pre-PS2 pattern, the pull-up resistor in the external device (as the pull-up resistor among Fig. 2 130,132) is in the state of being under an embargo, and do not have pull-up resistor to draw high L1 or L2 this moment, and system is in the PS2 pattern.In process 7, the situation that may occur comprises:
(1) if occur the feature of USB on L1, the L2 in the peripherals discovery host interface, for example two lines of L1, L2 all are that low level surpasses two clock period, then jump to process 4 immediately, and peripherals enters pre-USB pattern.
(2) errorless if aforementioned process 3 is judged, receive that then the PS2 main frame sends article one instruction after, peripherals enters process 9, promptly real PS2 state.
(3) if above-mentioned two kinds of situations do not occur, then to remain on the PS2 state constant for peripherals, turns back to process 5.
Process 8 enters real USB state, and judgement is finished, and peripherals locking signal pattern MODE is 10, i.e. the USB pattern.
Process 9 enters real PS2 state, and judgement is finished, and peripherals locking signal pattern MODE is 01, i.e. the PS2 pattern.
Interface automatic identifying method of the present invention by the then automatically redirect of pre-judgement, mistake, receive process such as corresponding communication instruction back lock-out state, automatically the interface type of discerning peripherals and being connected, because the communication instruction of USB and PS2 is diverse, so in case locking, then explanation is judged errorless, and before lock-out state, by flexibly automatically redirect mechanism guarantee whole judgement normally, correctly carry out.Therefore, the invention provides a kind of very accurately, do not have a USB/PS2 interface automatic identifying method of erroneous judgement.
Understand easily, technical scheme of the present invention is not limited to discern automatically the USB/PS2 interface, proposes according to the present invention
Principle, one of ordinary skill in the art expects that easily the present invention also can be used for discerning automatically the interface of other types, for example is used for discerning automatically VGA interface and DVI interface, HDMI interface and DVI interface etc.Therefore, one of ordinary skill in the art is according to technical scheme of the present invention, and wherein a certain or multinomial technical characterictic is carried out that equivalence is replaced or omission etc. and improvement and the variation made all should be encompassed in the claim scope of patent of the present invention.