PS2鼠标规范说明.docx
《PS2鼠标规范说明.docx》由会员分享,可在线阅读,更多相关《PS2鼠标规范说明.docx(10页珍藏版)》请在冰点文库上搜索。
PS2鼠标规范说明
PS/2ModeSpecification
Operatingmode
TherearefouroperatingmodesinPS/2mouse:
A.ResetMode:
Inthismodeaself-testisinitiatedduringpower-onorbyaResetcommand.Afterresetsignal,PS/2mousewillsend:
1).CompletioncodeAA&IDcode00.
2).Setdefault:
samplingrate:
100reports/s
non-autospeed
2dot/count
disable
B.StreamMode:
Themaximumrateoftransferistheprogrammedsamplerate.Datareportistransmittedif
1).switchispressed
2).movementhasbeendetect
C.RemoteMode:
DataistransmittedonlyinresponsetoaReadDatacommand.
D.WrapMode:
Anybyteofdatabythesystem,excepthexEC(Resetwrapmode)orhexFF(Reset),isreturnedbyMouseController.
PS/2MouseDataReport:
A.Instreammode:
Adatareportissentattheendofasampleinterval.
B.Inremotemode:
AdatareportissentinresponsetoReadDatacommand.
C.Datareportformat:
Byte
Bit
Description
1
0
Leftbuttonstatus;1=pressed
1
Rightbuttonstatus;1=pressed
2
Middlebuttonstatus;1=pressed
3
Reserve
4
Xdatasign;1=negative
5
Ydatasign;1=negative
6
Reserve
7
Reserve
2
0-7
Xdata(D0-D7)
3
0-7
Ydata(D0-D7)
PS/2MouseDataTransmission:
D.MouseControllergeneratestheclockingsignalwhensendingdatatoandreceivingdatafromthesystem.
E.ThesystemrequestsMouseControllerreceivesystemdataoutputbyforcingtheDATAlinetoaninactivelevelandallowingCLKlinetogotoanactivelevel.
F.Datatransmissionframe:
Bit
Function
1
Startbit(always0)
2-9
Databits(D0-D7)
10
Paritybit(oddparity)
11
Stopbit(always1)
G.DataOutput(datafromMouseControllertosystem):
IfCLKislow(inhibitstatus),dataisnotransmission.IfCLKishighandDATAislow(request-to-send),dataisupdated.DataisreceivedfromthesystemandnotransmissionarestartedbyMouseControlleruntilCLKandDATAbothhigh.
IfCLKandDATAarebothHigh,thetransmissionisready.DATAisvalidpriortothefallingedgeofCLKandbeyondtherisingedgeofCLK.Duringtransmission,MouseControllercheckforlinecontentionbycheckingforaninactivelevelonCLKatintervalsnottoexceed100usec.ContentionoccurswhenthesystemlowersCLKtoinhibitMOUSEControlleroutputafterMouseControllerhasstartedatransmission.Ifthisoccursbeforetherisingedgeofthetenthclock,MouseControllerinternalstoreitsdatainitsbufferandreturnsDATAandCLKtoanactivelevel.Ifthecontentiondoesnotoccurbythetenthclock,thetransmissioniscomplete.
Followingatransmission,thesysteminhibitsMouseControllerbyholdingCLKlowuntilcanservicetheinputoruntilthesystemreceivesarequesttosendaresponsefromMouseController.
H.DataInput(fromsystemtoMouseController):
First,SystemchecksifMouseControlleristransmittingdata.IfMouseControlleristransmitting,thesystemcanoverridetheoutputforcingCLKtoaninactivelevelpriortothetenthclock.IfMouseControllertransmissionisbeyondthetenthclock,thesystemreceivesthedata.
IfMouseControllerisnottransmittingorifthesystemchoosetooverridetheoutput,thesystemforceCLKtoaninactivelevelforaperiodofnotlessthen100usecwhilepreparingforoutput.Whenthesystemisreadytooutputstartbit(0),itallowsCLKgotoactivelevel.
Ifrequest-tosendisdetected,MouseControllerclocks11bits.Followingthetenthclock,MouseControllerchecksforanactivelevelontheDATAline,andiffound,forceDATAlow,andclockoncemore.Ifoccursframingerror,MouseControllercontinuetoclockuntilDATAishigh,thenclocksthelinecontrolbitandrequestaResend.
Whenthesystemsendsoutacommandordatatransmissionthatrequiresaresponse,thesystemwaitsforMouseControllertoresponsebeforesendingitsnextoutput.
PS/2MouseErrorHandling:
A.AResendcommand(FE)followingreceiptofaninvalidinputoranyinputwithincorrectpolarity.
B.Iftwoinvalidinputsarereceivedinsuccession,anerrorcodeofhexFCsendtothesystem.
C.Thecountaccumulatorsareclearedafterreceivinganycommandexcept"Resend".
D.MouseControllerreceivesaResendcommand(FE),ittransmititslastpacketofdata.
E.Instreammode,"Resend"isreceivedbyMouseControlleranda3-bytedatapacketwillfollowtotransmittothesystem.MouseControllerresendsthe3-bytedatapacketpriortoclearingthecounter.
F.Aresponseissentwithin25msif
I.Thesystemrequiresaresponse
⒑.Anerrorisdetectedinthetransmission
G.Whenacommandrequiringaresponseisissuedbythesystem,anothercommandshouldnotbeissueuntileithertheresponseisreceivedor25mshaspassed.
PS/2MouseCommandsDescription:
Thereare16validcommandsthattransmittsbetweenthesystemandMouseController.The"FA"codeisalwaysthefirstresponsetoanyvalidinputreceivedfromthesystemotherthanaSetWrapModeorResendcommand.Followingtableisthelistofcommands:
MouseController
HexCode
Command
echocode
FF
Reset
FA,AA,00
FE
Resend
XX,(XX,XX)
F6
SetDefault
FA
F5
Disable
FA
F4
Enable
FA
F3,XX
SetSamplingRate
FA,FA
F2
ReadDeviceType
FA,00
F0
SetRemoteMode
FA
EE
SetWrapMode
FA
EC
ReseWrapMode
FA
EB
ReadData
FA,XX,XX,XX
EA
SetStreamMode
FA
E9
StatusRequest
FA,XX,XX,XX
E8,XX
SetResolution
FA,FA
E7
SetAutospeed
FA
E6
ResetAutospeed
FA
Thefollowingdescribesvalidcommands:
A.Reset(FF)
MouseControlleroperation:
⒐.Completionthereset.
⒑.TransmittedFA,AA,00tothesystem.
⒒.Setdefault:
samplingrate:
100reports/s
non-autospeed
streammode
2dot/count
disable
B.Resend(FE)
⒐.AnytimeMouseControllerreceivesaninvalidcommand,itreturnsaResendcommandtothesystem.
⒑.WhenMouseControllerreceivesaResendcommand,itretransmitsitslastpacketofdata.IfthelastpacketwasaResendcommand,ittransmitsthepacketjustpriortotheResendcommand.
⒒.Instreammode,ifaResendcommandisreceivedbyMouseControllerimmediatelyfollowinga3-bytedatapackettransmissiontothesystem.
C.SetDefault(F6)
Thecommandreinitializesallconditionstothepower-ondefaults.
D.Disable(F5)
ThiscommandisusedinthestreammodetostoptransmissionsfromMouseController.
E.Enable(F4)
Beginstransmissions,ifinstreammode.
F.SetSamplingRate(F3,XX)
Instreammode,thiscommandsetthesamplingratetothevalueindicatedbybytehexXX,showninfollowing:
Second
byteXX
SampleRate
0A
10/sec
14
20/sec
28
40/sec
3C
60/sec
50
80/sec
64
100/sec
C8
200/sec
default100/sec
G.ReadDeviceType(F2)
MouseControlleralwaysechoes"FA,00"followingthiscommand.
H.SetRemoteMode(F0)
DatavaluesarereportedonlyinresponsetoaReadDatacommand.
I.SetWrapMode(EE)
WrapmoderemainsuntilReset(FF)orResetWrapMode(EC)isreceived.
J.ResetWrapMode(EC)
MouseControllerreturnstothepreviousmodeofoperationafterreceivingthiscommand.
K.ReadData(EB)
Thiscommandisexecutedineitherremoteorstreammode.Thedataistransmittedeveniftherehasbeennomovementsincethelastreportorthebuttonstatusisunchanged.FollowingaReadDatacommand,theregistersareclearedafteradatatransmission.
L.SetStreamMode(EA)
ThiscommandsetsMouseControllerinstreammode.
M.StatusRequest(E9)
Whenthiscommandisissuedbythesystem,MouseControllerrespondswitha3-bytestatusreportasfollows:
Byte
Bit
Description
1
0
1=Rightbuttonpressed
1
1=Middlebuttonpressed
2
1=Leftbuttonpressed
3
Reserved
4
0=Normalspeed,1=Autospeed
5
0=Disabled,1=Enabled
6
0=Streammode,1=Remotemode
7
Reserved
2
0-7
Currentresolutionsetting(D0-D7)
3
0-7
Currentsamplingrate(D0-D7)
N.SetResolution(E8,XX)
MouseControllerprovidesfourresolutionsselectedbythesecondbytethesecondbyteofthiscommandasfollows:
Second
ByteXX
Resolution
00
8dot/count
01
4dot/count
02
2dot/count
03
1dot/count
O.SetAutospeed(E7)
Attheendofasampleintervalinthestreammode,thecurrentXandYdatavaluesareconvertednewvalues.Thesignbitearenotinvolvedinthisconversion.Theconversionisonlyinstreammode.Therelationshipbetweentheinputandoutputcountfollows:
Input
Output
0
0
1
1
2
1
3
3
4
6
5
9
N(6)
2.0*N
P.ResetAutospeed(E6)
Thiscommandrestoretonormalspeed.
SerialModeSpecification
InMicrosoftmode,thetransmissioncycleconsistsofthreebytes.Eachbytesisdividedintoonestartbit,sevendatabitsandtwostopbits.Thefirstbytecontains"L","R"switchstatusandfourbitsofthetwomostsignificantbitsinhorizontalcounterandverticalcounter,Thenextbyterepresentsthevalueaccumulatedbyhorizontalcounter,thelastbyteisthedataoftheverticalcount.
Outputbytearrange
bitno.....6543210
1stbyte.....1LRV7'V6'H7H6
2ndbyte.....0H5H4H3H2H1H0
3rdbyte.....0V5'V4'V3'V2'V1'V0'
TimingDiagram