; TeX output 1995.02.08:0955(b{KsSQqjcmss20Linux^GPCMCIAProgrammear sGuid{e cGUUK`y cmr10DavidHinds, cmmi10:::::::::::::::::::::::::::::::::::m32CardTSe DrviceQssuTbfunct9iondescr1ipt9ions32.1&ClientUUmÎanagementUUfurnctions8*::::::::::::::::::::::::::::::::::::m4&2.1.1FRegi#stUe rClient*!:::::::::::::::::::::::::::::::::::::::::m4&2.1.2FDe regi#stUerClient :::::::::::::::::::::::::::::::::::::::m5&2.1.3FSetEventMaskT::::::::::::::::::::::::::::::::::::::::m5&2.1.4FBindDeviceƚ::::::::::::::::::::::::::::::::::::::::::m52.2&SoGcketUUstatUecontrol旍::::::::::::::::::::::::::::::::::::::::::m6&2.2.1FGetStatustۍ:::::::::::::::::::::::::::::::::::::::::::m6&2.2.2FReGs1etCardj1:::::::::::::::::::::::::::::::::::::::::::m7&2.2.3FSusp#endCardu:::::::::::::::::::::::::::::::::::::::::m7&2.2.4FReGsurmeCardˍ:::::::::::::::::::::::::::::::::::::::::m8&2.2.5FEjectCardTڍ:::::::::::::::::::::::::::::::::::::::::::m8&2.2.6FIns1e rtCard&::::::::::::::::::::::::::::::::::::::::::m82.3&IOUUcardcon gurationcalls::::::::::::::::::::::::::::::::::::::m9&2.3.1FRequeGstIO :::::::::::::::::::::::::::::::::::::::::::m9&2.3.2FReleqas1eIO:::::::::::::::::::::::::::::::::::::::::::m10&2.3.3FRequeGstIRQ~::::::::::::::::::::::::::::::::::::::::::m10&2.3.4FReleqas1eIRQ?::::::::::::::::::::::::::::::::::::::::::m11&2.3.5FRequeGstCon gurationb׍::::::::::::::::::::::::::::::::::::m12&2.3.6FMoGdifyCon guration0:::::::::::::::::::::::::::::::::::::m13&2.3.7FReleqas1eCon gurationō:::::::::::::::::::::::::::::::::::::m14*(b{GCONTENTSϲ2KP덍&2.3.8FGetCon gurationInfom:::::::::::::::::::::::::::::::::::::m15ؼ2.4&CardUUInformÎationStructure(CIS)callsP卑:::::::::::::::::::::::::::::::m15&2.4.1FGetFirstT*uple,UUGetNextTupleMc::::::::::::::::::::::::::::::::m16&2.4.2FGetT*upleDatam:::::::::::::::::::::::::::::::::::::::::m17&2.4.3FPars1eT*upleƛ::::::::::::::::::::::::::::::::::::::::::m17&2.4.4FV*alidratUeCIS|::::::::::::::::::::::::::::::::::::::::::m182.5&MremoryUUwindowcontrol* :::::::::::::::::::::::::::::::::::::::m18&2.5.1FRequeGstWindowH:::::::::::::::::::::::::::::::::::::::m18&2.5.2FMoGdifyWindow ::::::::::::::::::::::::::::::::::::::::m20&2.5.3FMapMremPagek::::::::::::::::::::::::::::::::::::::::m20&2.5.4FReleqas1eWindowq6::::::::::::::::::::::::::::::::::::::::m212.6&Mi#sTcellaneousUUcalls ::::::::::::::::::::::::::::::::::::::::::m21&2.6.1FGetCardSe rviceGsInfo):::::::::::::::::::::::::::::::::::::m21&2.6.2FAcceGsqsCon gurationRegi#stUe r":::::::::::::::::::::::::::::::::m21&2.6.3FAdjustReGsourceInfo1:::::::::::::::::::::::::::::::::::::m23&2.6.4FRepGortErrorqC::::::::::::::::::::::::::::::::::::::::::m24ؽ3CardTInform}aft9ionStructureDe nitionsy4253.1&CISTPLffDEVICE::::::::::::::::::::::::::::::::::::::::::m253.2&CISTPLffVERSff1k:::::::::::::::::::::::::::::::::::::::::::m253.3&CISTPLffCONFIG::::::::::::::::::::::::::::::::::::::::::m253.4&CISTPLffCFT*ABLEffENTRY臍::::::::::::::::::::::::::::::::::::m254CardTSe DrviceQsEv9en tHandling#Y264.1&EventUUhandle rop#e rationsE:::::::::::::::::::::::::::::::::::::::m264.2&EventUUdTeGsTcr*iptionsҍ::::::::::::::::::::::::::::::::::::::::::m275Dr1iv9e DrTServiceQsin t"erf(ace>K285.1&IntUe rf#aceUUtrootUherclientdr*iversT:::::::::::::::::::::::::::::::::::m28&5.1.1FTheUUdevEff&fǫlinkEff&ftstructurew"::::::::::::::::::::::::::::::::::m28&5.1.2Fregi#stUe rffpGcmciaffdr*iverm::::::::::::::::::::::::::::::::::::m29&5.1.3Furnregi#stUe rffpGcmciaffdr*iverϜ:::::::::::::::::::::::::::::::::::m305.2&IntUe rf#aceUUtrous1ermoGdTePCMCIAurtilitiesS::::::::::::::::::::::::::::::m30&5.2.1FCardUUSe rviceGseventnoti cationsf7::::::::::::::::::::::::::::::m30#|(b{G1.In troQd9uctionV3KP덍&5.2.2FioctlUUdTeGsTcr*iptions4ƍ::::::::::::::::::::::::::::::::::::::m30ؽ6Wh9e DreTtoGoforMoreInform}aftion mC32(1ٔIntroqduction׍TheLinUuxke r#nelPCMCIAǨsystUemhastUhreemÎaincompGonents.AttUheloweGstlevelaretUhesoGcketdr*ive rs. Nextii#stUheCardSe rviceGsmodule.PDr*ive rsiforsp#eci ccardsarelayereGdontropofCardServiceGs.POnesp#ecialCard Se rviceGsclient,:calledDr*ive rServiceGs,:providTes alinkb#etweekus1e rlevelPCMCIA urtilityprogramsandUUtUheke r#nelPCMCIAf#acilitieGs.ؼThesoGcketdr*ive rlaye ri#sloGoqs1elybaseGdontUheSocketSe rviceGsAPI.The rearetwosoGcketdr*ive rmoGdules.-8ThetcicXmoGdulesuppGortstUheDatabGookXTCIC-2f#amilyofPCMCIAFcontrolle rs.CThei82365moGdulesuppGortstUheUUIntUeli82365slf#amilyandvqar*iousIntUel-compatiblecontrolle rs,includinrgCirrus,VLSI,andV*adTemchipqs.CardܜSe rviceGsi#stUhelargests#inrglecomponentoftUhePCMCIA}package.IItprovidTeGsanAPI}somewhats#imilartroDOSCardSe rviceGs,%adaptUedtoaUnixenvironment.]TheLinUuximplementationwasbas1eGdinpartontUheSolar*i#sUUPCMCIAintUe rfacespeci cation.qItisimplementUeGdintUhepcmciaEff&fǫcoremoGdule.TheDr*ive rServiceGslayerimplementsaus1ermoGdTepqs1eudo-deviceforacceGsqs#inrgsomeCardSe rviceGsfurnctionsf*romPCMCIAޟurtilityprograms.Iti#sreGspons#ibleforkeepinrgtrackofallPCMCIAޟclientdr*ive rs,andformÎatchinrgUUupdr*ive rswitUhphys#icalsoGckets.qIti#simplementUeGdintUhedsmoGdule.Thi#skdoGcurmentdTesTcr*ib#estUheke r#nelintUe rf#acetrotUheCardSe rviceGsandDr*ive rServiceGsmodules,andktUheus1e rintUerf#acetroDr*iverServiceGs. Iti#sintUendTedforus1ebyPCMCIA(dTevicedr*ive rdTevelop#e rs. TheLinUuxAnPCMCIA-HOWTOA1dTeGsTcr*ib#eshÎowtroinstallandus1eLinUuxPCMCIAA1suppGort.6Iti#savqailablef*romcb-iris.stanford.eduUUin/pub/pcmcia.#(N cmbx121.1Copyr9ightnoticeanddi0sclaimefrNCopyr*ightUU(c)1995DavidA.HindsThi#sEdoGcurmentmÎaybereproGducedEordi#str*iburtUedinanyformwitUhÎourtmypr*iorp#e rmisqsion.?PartsEoftUhi#sdoGcurment%mÎayb#edistr*iburtUeGd,$bprovidTed%tUhattUhi#scopyr*ightmeGsqsageandapGointUe rtrotUhecompletUedoGcurmentareincludTeGd.*Sp#eci cally*,itmÎaybeincludTeGdincomme rcialdistr*iburtionswitUhÎoutmypr*iorcons1ent.*Howeve r,IUUwouldliketrob#einformeGdofsuchusage.Thi#sUUdoGcurmentmÎaybetranslatUeGdintroanylanguage,providTeGdtUhi#scopyr*ightstatUementi#sleftintact.Thi#sdoGcurmentisprovidTeGd\asis",witUhnoexplicitorimplieGdwarranties.Us1etUheinformÎationintUhi#sdoGcurmentUUatyourownr*i#sk.(2ٔCardLServicceqssuVfbfuwnctiond(es crCiptions׍CardUUSe rviceGscallshaveUUtUhegene ralform:M(b{G2.CardTSe DrviceQssuTbfunct9iondescr1ipt9ionsBK4KP덑*ߤN cmtt9#include"cs_types.h" =#include"cs.h"intCardServices(intsubfunc,void*arg1,void*arg2,...);;SomeRCardSe rviceGsfurnctionsrequireadditionÎal#includestatUements.0qTheparticularsuUbfurnctiondTetUe rmineGs tUhe2nurm|qb#e rofexpectUeGdargurments..Aretur#ncoGdTeofCSEff&fǫSUCCESSindicatUeGstUhatacallsucceeGdTed..OtUhe rretur#ncoGdTesUUindicatUee rrors."_卍2.1ClienftmfanagementfunctionsNDevicedr*ive rstUhatus1eCardSe rviceGsfurnctionsarecalleGd\clients". !#A6dTevicedr*ive rshÎouldus1etUheRegisterClient`calltrogetaclienthandle`b#eforeusinrgotUhe rs1erviceGs..MoqstCardServiceGsfurnctionswilltaketUhi#s-clienthandle-asanargurment._Beforeurnloading,(hdr*ive rs-shÎouldalsournregi#stUe rwitUhDeregisterClient. 72.1.1##Regi(s-t"e DrClien t"intCardServices(RegisterClient,client_handle_t*client,client_reg_t*reg);TheUUclientEff&fǫregEff&ftdratastructurei#sgivenby:>䍑typedefstructclient_reg_t{ =>̲dev_info_tB&4*dev_info;>̲u_longU Attributes;>̲u_longU EventMask;>̲intc9N(*event_handler)(event_tevent,intpriority,event_callback_args_t*args);>̲event_callback_args_t,event_callback_args;>̲u_longU Version;}client_reg_t;bRegisterClienteGstabli#shesalinkb#etweenaclientdr*ive randCardSe rviceGs,:andconnectstUheclientwitUh anhDappropr*iatUesoGcket.ThedevEff&fǫinfoparametUe ri#sus1eGdbyCardSe rviceGstromÎatchtUheclientwitUhasoGcket,followinrgUUacalltoBindDevice.qIfsucceGsqsful,aclienthandlewillb#eretur#neGdinclient.ؼEventMaskesp#eci eGswhateventstUhi#sclientshÎouldb#enoti eGdof.{TheeventEff&fǫhandlerentrypGointwillb#ecalleGdbyCardSe rviceswhenaneventinEventMaski#sproGcesqs1ed.}TheeventEff&fǫhandlerEff&fargsstructurei#satUemplatemfortUhestructuretUhatwillb#epasqs1eGdtrotUheeventhandle r.|TheVersionparametUe ridTenti eGstUheCardUUSe rviceGsvers#ionleveltUhattUhi#sdr*ive rexp#ects;itiscurrentUlyignoreGd.Adr*ive rshÎouldb#eprepareGdtrohandleCardSe rviceGseventswhenitcallsRegisterClient.Thi#scallwillalwaysgene ratUeaCSEff&fǫREGISTRATIONEff&fCOMPLETEٵevent,andmÎayalsogene ratUeanarti cialCSEff&fǫCARDEff&fINSERTIONeventUUiftUhesoGcketi#scurrentUlyoGccupied.Retur#nUUcoGdTes:bCSEff&fǫOUTEff&fOFEff&fRESOURCEДAnUUappropr*iatUesoGcketcouldnotb#efourndfortUhi#sdr*ive r.`ɠ(b{G2.CardTSe DrviceQssuTbfunct9iondescr1ipt9ions/5KP덍2.1.2##De Dregi(s-t"erClien tintCardServices(DeregisterClient,client_handle_tclient);ؼDeregisterClient#s1eve rstUheconnectionb#etweenaclientandCardSe rviceGs.1ItshÎouldb#ecalledaftUe rtUhe clientLhasf*reeGdanyreGsourcesLithasalloGcatUed.nOnceLaconnectioni#sbroken,Nitcannotb#ereeGstabli#shedLurntilaftUe rUUanotUhercalltroBindDevice.ؼRetur#nUUcoGdTes:ؼCSEff&fǫBADEff&fHANDLETheUUclienthandlei#sinvqalid.CSEff&fǫINEff&fUSETherclientstillhasalloGcatUedrresources,z=suchrasIOrpGortwindowsoranintUe rrupt,z=ortUhesoGcketcon g- urationUUi#sloGcked. 򍍿2.1.3##SetEv9en tMaskintCardServices(SetEventMask,client_handle_tclient,eventmask_t*mask);ؼTheUUeventmaskEff&fǫtstructurei#sgivenby:卑typedefstructeventmask_t{ =>̲u_long/?Attributes;>̲u_long/?EventMask;}eventmask_t;ؼSetEventMaskUUupGdratUestUhemÎaskthatdTetUe rmineGswhicheventstUhi#sclientwillb#enoti eGdof.ؼRetur#nUUcoGdTes:CSEff&fǫBADEff&fHANDLETheUUclienthandlei#sinvqalid. 򍍿2.1.4##Bin9dDeviceintCardServices(BindDevice,bind_req_t*req);ؼTheUUbindEff&fǫreqstructurei#sgivenby:卑typedefstructbind_req_t{ =>̲socket_t%̰Socket;>̲dev_info_tY*dev_info;}bind_req_t;p(b{G2.CardTSe DrviceQssuTbfunct9iondescr1ipt9ions/6KP덻BindDeviceasqsoGciatUesadTevicedr*ive rwitUhaparticularsoGcket.VIti#snormÎallycalleGdbyDr*ive rServiceGsaftUer a newlyins1e rtUeGdcardhasb#eenidTenti eGd.Onceadr*ive rhasb#eenbGourndtroasoGcket,itwillb#eeligibletroregi#stUe rEasaclientoftUhatsoGcket.NotUetUhattUhi#scalldoeGsnottakeEaclienthandleEasanargurment.Thi#sistUheUUonlyCardSe rviceGscallthattakeGsasocketUUnUurm|qb#e rasanargument.ؼRetur#nUUcoGdTes:aCSEff&fǫBADEff&fSOCKET=TheUUsp#eci eGdsocketUUnUurm|qb#e risinvqalid.#D2.2So`ckets tat2econftroٙlNTheGs1ezfurnctionsaremoreorleGsqsconce r#neGdwitUhgettinrgands1ettinrgtUhecurrentop#e ratinrgstatUeofasoGcket.GetStatusretur#nstUhecurrentsoGcketstatUe. ResetCardi#sus1eGdtrosendahardreGs1ets#ignÎaltroasocket.SuspendCardOandResumeCardcanb#eus1eGdtropowe rOdownandpGowe rupasoGcketwitUhÎourtreleqas#ingtUhedr*ive rsCcurrentUlybGourndtrotUhatsoGcket.kEjectCardandInsertCardeGsqs1entiallymimicreqalcardejectionandins1e rtionUUevents. ǖ2.2.1##GetSt9aftusintCardServices(GetStatus,client_handle_tclient,status_t*status);TheUUstatusEff&fǫtdratastructurei#sgivenby:mtypedefstructstatus_t{ =>̲u_long/?CardState;>̲u_long/?SocketState;}status_t;bGetStatusUUretur#nstUhecurrentstatusofaclient'ssoGcket.qThefollowinrg agsaredTe neGdinCardState:CSEff&fǫEVENTEff&fCARDEff&fDETECT=Sp#eci eGsUUtUhatthesoGcketi#soGccupied.fCSEff&fǫEVENTEff&fWRITEEff&fPROTECTSp#eci eGsUUtUhatthecardi#scurrentlywr*itUeprotecteGd.CSEff&fǫEVENTEff&fBATTERYEff&fLOWSp#eci eGsUUtUhatthecardbattUe ryi#slow.CSEff&fǫEVENTEff&fBATTERYEff&fDEADSp#eci eGsUUtUhatthecardbattUe ryi#sdTeqad.CSEff&fǫEVENTEff&fREADYEff&fCHANGESp#eci eGsUUtUhatthecardi#sreqady*.x5(b{G2.CardTSe DrviceQssuTbfunct9iondescr1ipt9ions/7KP덍CSEff&fǫEVENTEff&fPMEff&fSUSPENDSp#eci eGsUUtUhatthesoGcketi#ssuspendTeGd.ؼSocketStatei#scurrentUlyurnus1eGd,butintheory*,itshÎouldlatchchanrgeGsintUhestatUeoftUhe eldsinCardState.ؼRetur#nUUcoGdTes:ؼCSEff&fǫBADEff&fHANDLETheUUclienthandlei#sinvqalid. 򍍿2.2.2##ReQs9?etCardintCardServices(ResetCard,client_handle_tclient);ResetCardXrequeGststUhataclient'ssocketXb#eres1et.{rWhentUhi#scallismÎadTe,Y\CardSe rviceGss1endsallclientsa CSEff&fǫEVENTEff&fRESETEff&fREQUEST}event.If}anyclientrejectstUherequeGst,CardSe rvicess1endstUheinitiatinrgclientaCSEff&fǫEVENTEff&fRESETEff&fCOMPLETE8eventSwitUheventEff&fǫcallbackEff&fargs.infoSs1ettrotheretur#ncoGdTeoftUheclienttUhatrejectUeGdUUtUherequest.ؼIf?allclientsagreetrotUherequeGst,FyCardSe rvicess1endsaCSEff&fǫEVENTEff&fRESETEff&fPHYSICAL event,FytUhen?reGs1etstUhesoGcket.0#WhentUhesoGckets#ignÎalstUhatiti#sreqady*,aCSEff&fǫEVENTEff&fCARDEff&fRESETweventi#sgene ratUeGd.0#FinÎally*,aCSEff&fǫEVENTEff&fRESETEff&fCOMPLETEevent;i#ss1enttrotUheinitiatinrgclient, witUheventEff&fǫcallbackEff&fargs.info;s1ettoze ro.Retur#nUUcoGdTes:ؼCSEff&fǫBADEff&fHANDLETheUUclienthandlei#sinvqalid.CSEff&fǫNOEff&fCARDTheUUsoGcketasqs#igneGdtrotUhi#sclientiscurrentUlyvqacant.CSEff&fǫINEff&fUSEThi#sUUsoGcketi#scurrentUlybeGinrgres1et. 򍍿2.2.3##Susp(en9dCardintCardServices(SuspendCard,client_handle_tclient);ؼCardXSe rviceGss1endsallclientsCSEff&fǫEVENTEff&fPMEff&fSUSPENDXevents,tUhenXshurtsdownandtur#nso pGowe rtrotUhe soGcket.ؼRetur#nUUcoGdTes:ؼCSEff&fǫBADEff&fHANDLETheUUclienthandlei#sinvqalid.(b{G2.CardTSe DrviceQssuTbfunct9iondescr1ipt9ions/8KP덍CSEff&fǫNOEff&fCARDTheUUsoGcketasqs#igneGdtrotUhi#sclientiscurrentUlyvqacant.CSEff&fǫINEff&fUSEThi#sUUsoGcketi#salreqadysuspendTeGd. 򍍿2.2.4##ReQsum9eCardintCardServices(ResumeCard,client_handle_tclient);ؼAftUe rUUreGstror*ingpGowe rtrotUhesoGcket,CardSe rviceGswillnotifyallclientswitUhCSEff&fǫEVENTEff&fPMEff&fRESUMEevents.ؼRetur#nUUcoGdTes:ؼCSEff&fǫBADEff&fHANDLETheUUclienthandlei#sinvqalid.CSEff&fǫNOEff&fCARDTheUUsoGcketasqs#igneGdtrotUhi#sclientiscurrentUlyvqacant.CSEff&fǫINEff&fUSEThi#sUUsoGcketi#snotcurrentUlysuspendTeGd. 򍍿2.2.5##EjectCardintCardServices(EjectCard,client_handle_tclient);ؼCard0$Se rviceGss1endsejecteventstroallclients,7tUhenshurtsdownandtur#nso pGowe rtrotUhesoGcket.eaAllclients exceptUUforDr*ive rServiceGswillb#eurnlinkedf*romtUhesocket.ؼRetur#nUUcoGdTes:ؼCSEff&fǫBADEff&fHANDLETheUUclienthandlei#sinvqalid.CSEff&fǫNOEff&fCARDTheUUsoGcketasqs#igneGdtrotUhi#sclientiscurrentUlyvqacant. 򍍿2.2.6##Ins9?e DrtCardintCardServices(InsertCard,client_handle_tclient);ؼCardUUSe rviceGss1endsinse rtioneventstroallclientsoftUhi#ssoGcketUU(normÎally*,onlyDr*ive rServiceGs).ؼRetur#nUUcoGdTes: (b{G2.CardTSe DrviceQssuTbfunct9iondescr1ipt9ions/9KP덍CSEff&fǫBADEff&fHANDLEAڍTheUUclienthandlei#sinvqalid.ՠCSEff&fǫNOEff&fCARDTheUUsoGcketasqs#igneGdtrotUhi#sclientiscurrentUlyvqacant.CSEff&fǫINEff&fUSETheUUsoGckethasalreqadyb#eencon gureGd."o2.3IOcardcon gurationcallsNThe^normÎalordTe rofeventsi#sforadr*ive rtroreGs1erveIO^pGortsandanintUe rruptlinewitUhcallstroRequestIO andtRequestIRQ,tUhentrocallRequestConfigurationtoactuallycon guretUhesoGcket. $IfanyoftUheGs1ecallsf#ails,UUadr*ive rshÎouldbesuretroreleqas1eanyreGsourcesUUitsucceGsqsfullyres1e rved. y2.3.1##RequeQs-tIOWintCardServices(RequestIO,client_handle_tclient,io_req_t*req);TheUUioEff&fǫreqEff&ftdratastructurei#sgivenby:typedefstructio_req_t{ =>̲ioaddr_t%̰BasePort1;>̲ioaddr_t%̰NumPorts1;>̲u_long/?Attributes1;>̲ioaddr_t%̰BasePort2;>̲ioaddr_t%̰NumPorts2;>̲u_long/?Attributes2;>̲u_long/?IOAddrLines;}io_req_t;'ӍRequestIOreGs1e rvesIOportwindowsforacard.T4IfBasePort1i#snon-ze ro,Zitspeci eGstUheIOportaddresqsof tUheɫwindowtrob#ereGs1e rved;9ifɫiti#sze ro,CardServiceGswill ndanavqailablewindowands1etBasePort1trotUhi#saddreGsqs.?If}NumPorts2i#snon-ze ro,Gas1econdIO\portwindow}willalsob#eres1e rved.?IOAddrLinessp#eci estUheUUnurm|qb#e rofaddreGsqslinestUhatareactuallydTecoGdedUUbytUhePCMCIAcard;tUhi#sisnotcurrentUlyus1eGd.ؼTheUUfollowinrg agscanb#especi eGdinAttributes1andAttributes2:IOEff&fǫDATAEff&fPATHEff&fWIDTHAڍThi#sz@ eldmÎayeGitUhe rbeIOEff&fǫDATAEff&fPATHEff&fWIDTHEff&f16z@for16-bitacceGsqs,zorIOEff&fǫDATAEff&fPATHEff&fWIDTHEff&f8z@for8-bitacceGsqs,UUorIOEff&fǫDATAEff&fPATHEff&fWIDTHEff&fAUTOUUtrodynÎamicallys#izetUhebusbas1edontUheaccesqss#ize.Retur#nUUcoGdTes:CSEff&fǫBADEff&fHANDLEAڍTheUUclienthandlei#sinvqalid. (b{G2.CardTSe DrviceQssuTbfunct9iondescr1ipt9ions.10KP덍CSEff&fǫNOEff&fCARDTheUUsoGcketasqs#igneGdtrotUhi#sclientiscurrentUlyvqacant.CSEff&fǫINEff&fUSEThi#sUUsoGcket'sIOwindowshavealreqadyb#eenreGs1e rved.CSEff&fǫCONFIGURATIONEff&fLOCKEDThi#sUUsoGcket'scon gurationhasb#eenloGckedUUbyacalltroRequestConfiguration.CSEff&fǫBADEff&fATTRIBUTEAnUUurnsuppGortUedattr*iburtUe agwassp#eci ed. 򍍿2.3.2##Rele as9?eIOintCardServices(ReleaseIO,client_handle_tclient,io_req_t*req);ؼReleaseIOxurn-reGs1e rvesxIOportxwindowsalloGcatUedbyapreviouscalltroRequestIO.ThereqparametUe rshÎould b#eUUtUhesameonepasqs1eGdtroRequestIO.ؼRetur#nUUcoGdTes:ؼCSEff&fǫBADEff&fHANDLETheUUclienthandlei#sinvqalid.CSEff&fǫCONFIGURATIONEff&fLOCKEDThi#s"soGcket'scon gurationhasb#eenloGcked"byacalltroRequestConfiguration.ٱThecon guration shÎouldUUb#ereleqas1eGdbeforecallinrgReleqas1eIO.CSEff&fǫBADEff&fARGSTheUUparametUe rsinreqdonotmÎatchtUheparametUe rspasqs1eGdtroRequestIO. 򍍿2.3.3##RequeQs-tIR9QintCardServices(RequestIRQ,client_handle_tclient,irq_req_t*req);ؼTheUUirqEff&fǫreqEff&ftstructurei#sgivenby:卑typedefstructirq_req_t{ =>̲u_long/?Attributes;>̲u_long/?AssignedIRQ;>̲u_long/?IRQInfo1,IRQInfo2;}irq_req_t; (b{G2.CardTSe DrviceQssuTbfunct9iondescr1ipt9ions.11KP덻RequestIRQyreGs1e rvesyanintUerruptlineforus1ebyaPCMCIAycard.{TheIRQInfo1andIRQInfo2 eldscor- reGspondJtrotUheintUe rruptdTeGsTcr*iptionbytUeGsinaCFTABLEEff&fǫENTRY+tuple.InIfIRQEff&fǫINFO2Eff&fVALID+i#sJs1etinIRQInfo1,tUhen IRQInfo2i#sabit-mÎapp#eGdmÎaskofalloweGdintUe rruptvqalues.YEachbitcorrespondstrooneintUe rruptline:bit0=irq0,bit1=irq1,etc.So,amÎaskof0x1100wouldmeqantUhatintUe rrupts12and8couldb#eus1eGd.IfUIRQEff&fǫINFO2Eff&fVALID6i#snots1et,UIRQInfo1isjusttUhedTeGsiredUintUe rruptnUurm|qb#er.IftUhecalli#ssucceGsqsful,UtUhereGs1e rvedUUintUerrupti#sreturneGdUUinAssignedIRQ.ؼTheUUfollowinrg agscanb#especi eGdinAttributes:ؼIRQEff&fǫFORCEDEff&fPULSESp#eci eGsUUtUhattheintUe rruptshÎouldb#econ gureGdforpuls1edmodTe,ratUhe rthanthedTef#aulrtlevelmoGdTe.IRQEff&fǫTYPEEff&fTIMESp#eci eGstUhatthi#sintUe rruptcanbetime-shareGdwitUhothe rCardServiceGsdr*ivers.Onlyonedr*ive r shÎouldUUenabletUheintUe rruptatanytime.IRQEff&fǫFIRSTEff&fSHAREDInconjurnctionwitUhIRQEff&fǫTYPEEff&fTIME,thi#sshÎouldbes1etbytUhe rstdr*ive rrequeGstinrgashareGdintUe rrupt.ؼRetur#nUUcoGdTes:CSEff&fǫBADEff&fHANDLETheUUclienthandlei#sinvqalid.CSEff&fǫNOEff&fCARDTheUUsoGcketasqs#igneGdtrotUhi#sclientiscurrentUlyvqacant.CSEff&fǫINEff&fUSEAnUUintUe rrupthasalreqadyb#eenreGs1ervedUUfortUhi#ssoGcket,ortUherequeGstUedUUinte rrupti#surnÎavqailable.CSEff&fǫCONFIGURATIONEff&fLOCKEDThi#sUUsoGcket'scon gurationhasb#eenloGckedUUbyacalltroRequestConfiguration.CSEff&fǫBADEff&fATTRIBUTEAnUUurnsuppGortUedattr*iburtUe agwassp#eci ed. 򍍿2.3.4##Rele as9?eIR9QintCardServices(ReleaseIRQ,client_handle_tclient,irq_req_t*req);ؼReleaseIRQ0urn-reGs1e rvesGanintUerruptasqs#igneGdbyaneqarlie rcalltroRequestIRQ.ThereqstructureshÎouldb#e tUheUUsamestructuretUhatwaspasqs1eGdtroRequestIRQ.ؼRetur#nUUcoGdTes: (b{G2.CardTSe DrviceQssuTbfunct9iondescr1ipt9ions.12KP덍CSEff&fǫBADEff&fHANDLEuTheUUclienthandlei#sinvqalid.=CSEff&fǫCONFIGURATIONEff&fLOCKEDThi#s"soGcket'scon gurationhasb#eenloGcked"byacalltroRequestConfiguration.ٱThecon guration shÎouldUUb#ereleqas1eGdbeforecallinrgReleqas1eIRQ.CSEff&fǫBADEff&fIRQTheUUparametUe rsinreqdonotmÎatchtUheparametUe rspasqs1eGdtroRequestIRQ. D2.3.5##RequeQs-tCon guraft9ionintCardServices(RequestConfiguration,client_handle_tclient,config_req_t*req);TheUUconfigEff&fǫreqEff&ftstructurei#sgivenby:typedefstructconfig_req_t{ =>̲u_long/?Attributes;>̲u_long/?Vcc,Vpp1,Vpp2;>̲u_long/?IntType;>̲caddr_t*FConfigBase;>̲u_char/?Status,Pin,Copy;>̲u_char/?ConfigIndex;>̲u_long/?Present;}config_req_t;RequestConfigurationSii#sreGsponsibleSiforactuallycon gur*inrgasoGcket.Thi#sincludTeGss1ettinrgvolrtageGs,s1etting CISUUcon gurationregi#stUe rs,UUs1ettinrgupIOpGortwindows,ands1ettinrgupintUe rrupts.ؼIntType]sp#eci eGstUhetyp#eofintUe rfacetrous1efortUhiscard.ItmÎayeGitUhe rbeINTEff&fǫMEMORY\orINTEff&fǫMEMORYEff&fANDEff&fIO.UUV*olrtageGsaresp#eci edinurnitsof1/10volt.Thee8followinrg agscanb#especi eGdinAttributes.pDMAdandspeqake rcontrolarenotsuppGortUedonallsystUems.CONFEff&fǫENABLEEff&fIRQuEnÎableUUtUheIOintUe rruptreGs1ervedUUbyapreviouscalltroRequestIRQ.=CONFEff&fǫENABLEEff&fDMAEnÎableUUDMAacceGsqs1esUUfortUhi#ssoGcket.CONFEff&fǫENABLEEff&fSPKREnÎableUUsp#eqake rourtʪputf*romtUhi#ssoGcket.TheȟPresentparametUe ri#sabitmÎapspecifyinrgwhichCISȁcon gurationregi#stUe rsȟareimplementUeGdbytUhi#s card.mConfigBaseIgiveGstUheo s1etoftUhecon gurationregi#stUe rsIinattr*iburtememory*.mTheIfollowinrgregi#stUe rscanUUb#especi eGd: (b{G2.CardTSe DrviceQssuTbfunct9iondescr1ipt9ions.13KP덍PRESENTEff&fǫOPTIONokSp#eci eGsDtUhattheCon gurationOptionRegi#stUe rispreGs1ent.ÕTheCORregistUe rwillbes1etusinrgtUhe ConfigIndexUUparametUe r.0PRESENTEff&fǫSTATUSSp#eci eGstUhattheCardCon gurationandStatusRegi#stUe rispreGs1ent.FTheCCSRwillbeinitializeGdwitUhtUheUUStatusparametUe r.0PRESENTEff&fǫPINEff&fREPLACESp#eci eGstUhatthePinReplacementRegi#stUe rispreGs1ent.ThePRRCwillbeinitializeGdwitUhthePinparametUe r.0PRESENTEff&fǫCOPYSp#eci eGspGtUhattheSoGcketandCopyRegi#stUe rispreGs1ent.žTheSCRowillbeinitializeGdwitUhtheCopyparametUe r.Retur#nUUcoGdTes:CSEff&fǫBADEff&fHANDLEokTheUUclienthandlei#sinvqalid.0CSEff&fǫNOEff&fCARDTheUUsoGcketasqs#igneGdtrotUhi#sclientiscurrentUlyvqacant.CSEff&fǫOUTEff&fOFEff&fRESOURCECardUUSe rviceGswasurnÎabletroalloGcatUeamemorywindowtroacceGsqstUhecard'scon gurationregi#stUe rs.CSEff&fǫCONFIGURATIONEff&fLOCKEDThi#sUUsoGcket'scon gurationhasalreqadyb#eenloGckedUUbyanotUhe rcalltroRequestConfiguration.CSEff&fǫBADEff&fVCCTheUUrequeGstUedVccvolrtagei#snotsuppGortUed.CSEff&fǫBADEff&fVPPTheUUrequeGstUedVpp1/Vpp2volrtagei#snotsuppGortUed. 2.3.6##MoQdifyCon guraft9ion荑intCardServices(ModifyConfiguration,client_handle_tclient,modconf_t*mod);pTheUUmodconfEff&fǫtstructurei#sgivenby:Btypedefstructmodconf_t{ =>̲u_long/?Attributes;>̲u_long/?Vcc,Vpp1,Vpp2;}modconf_t;(b{G2.CardTSe DrviceQssuTbfunct9iondescr1ipt9ions.14KP덻ModifyConfigurationmoGdi essomeattr*iburtUesofasockettUhathasb#eencon gureGdbyacalltro RequestConfiguration.ؼTheUUfollowinrg agscanb#especi eGdinAttributes:LxCONFEff&fǫIRQEff&fCHANGEEff&fVALIDKIndicatUeGsUUtUhatUUtUheCONFffENABLEffIRQs1ettinrgshÎouldb#eupGdatUed.򍍍CONFEff&fǫENABLEEff&fIRQSp#eci eGsUUtUhatIOintUe rruptsshÎouldbeenÎableGdfortUhissoGcket.CONFEff&fǫVCCEff&fCHANGEEff&fVALIDIndicatUeGsUUtUhatUUVccshÎouldb#eupGdratUed.CONFEff&fǫVPP1Eff&fCHANGEEff&fVALIDIndicatUeGsUUtUhatUUVpp1shÎouldb#eupGdratUed.CONFEff&fǫVPP2Eff&fCHANGEEff&fVALIDIndicatUeGsUUtUhatUUVpp2shÎouldb#eupGdratUed.LxCurrentUly*,RVpp1Q2andVpp2mUustalwayshavetUhesamevqalue.pfSo,RtUhetwovqalueGsmUustalwaysb#echanrgeGdat tUheUUsametime.ؼRetur#nUUcoGdTes:CSEff&fǫBADEff&fHANDLEKTheUUclienthandlei#sinvqalid.CSEff&fǫNOEff&fCARDTheUUsoGcketasqs#igneGdtrotUhi#sclientiscurrentUlyvqacant.CSEff&fǫCONFIGURATIONEff&fLOCKEDThi#sUUactuallymeqanstUhattUhi#ssoGckethasnotb#eenloGcked.CSEff&fǫBADEff&fVCCTheUUrequeGstUedVccvolrtagei#snotsuppGortUed.CSEff&fǫBADEff&fVPPTheUUrequeGstUedVpp1/Vpp2volrtagei#snotsuppGortUed. 2.3.7##Rele as9?eCon guraft9ionintCardServices(ReleaseConfiguration,client_handle_tclient,config_req_t*req);gReleaseConfigurationuurn-con gureGsasocketupreviouslys1etupbyacalltroRequestConfiguration.ӧThe reqUUparametUe rshÎouldb#etUhesameoneus1eGdtrocon guretUhesoGcket.ؼRetur#nUUcoGdTes:4(b{G2.CardTSe DrviceQssuTbfunct9iondescr1ipt9ions.15KP덍CSEff&fǫBADEff&fHANDLEdTheUUwindowhandlei#sinvqalid,ortUhesoGcketi#snotcon gureGd. 2.3.8##GetCon guraft9ionInfoፑintCardServices(GetConfigurationInfo,client_handle_tclient,config_t*config);:KTheUUconfigEff&fǫtstructurei#sgivenby:6$typedefstructconfig_t{ =>̲u_long/?Attributes;>̲u_long/?Vcc,Vpp1,Vpp2;>̲u_long/?IntType;>̲caddr_t*FConfigBase;>̲u_char/?Status,Pin,Copy,Option;>̲u_long/?Present;>̲u_long/?AssignedIRQ;>̲u_long/?IRQAttributes;>̲ioaddr_t%̰BasePort1;>̲ioaddr_t%̰NumPorts1;>̲u_long/?Attributes1;>̲ioaddr_t%̰BasePort2;>̲ioaddr_t%̰NumPorts2;>̲u_long/?Attributes2;>̲u_long/?IOAddrLines;}config_t;YGetConfigurationInfo˲retur#nstUhecurrentsoGcketcon gurationasitwass1etupbyRequestIO,RequestIRQ, andUURequestConfiguration.qItcanonlyb#eapplieGdtroafullycon guredsocket.ؼRetur#nUUcoGdTes:CSEff&fǫBADEff&fHANDLETheUUwindowhandlei#sinvqalid,ortUhesoGcketi#snotcon gureGd.nCSEff&fǫNOEff&fCARDTheUUsoGcketasqs#igneGdtrotUhi#sclientiscurrentUlyvqacant.CSEff&fǫCONFIGURATIONEff&fLOCKEDThi#sUUactuallymeqanstUhattUhecon gurationhasnotb#eenloGcked.#W2.4CardInformfationStructure(CIS)callsNTheAdTe nitionoftUheCardInformÎationStructure(CIS)Ai#stUhedrarkeGstchaptUe roftUhePCMCIAAstandrard.kOAll ve rs#ion"S2PCMCIA"FcardsshÎouldhaveaCIS,whichdTeGsTcr*ib#es"StUhecardandhÎowitshÎouldb#econ gureGd.`TheCIS̲u_long/?Attributes;>̲cis_data_tYDesiredTuple;>̲u_long/?Flags;>̲cisdata_t!TupleCode;>̲u_long/?TupleLink;>̲cisdata_t!TupleOffset;>̲cisdata_t!TupleDataMax;>̲cisdata_t!TupleDataLen;>̲cisdata_t!*TupleData;}tuple_t;ؼGetFirstTupleZs1eqarcheGsacard'sCISZJfortUhe rsttuplecoGdTemÎatchinrgDesiredTuple.pThesp#ecialcoGdTe RETURNEff&fǫFIRSTEff&fTUPLE#will#mÎatchtUhe rsttupleofanykind.aAIfsucceGsqsful,-TupleCodei#ss1ettrotUhecoGdTeoftUhe rstUUmÎatchinrgtuplefournd,andTupleLinki#stUheaddreGsqsoftUhi#stupleinattr*iburtUememory*.GetNextTuplei#slikeGetFirstTuple,excepttUhatgivenatupleEff&fǫtstructureretur#neGdbyapreviouscalltroGetFirstTupleUUorGetNextTuple,itwillretur#ntUhenexttuplemÎatchinrgDesiredTuple.Retur#nUUcoGdTes:ؼCSEff&fǫBADEff&fHANDLETheUUclienthandlei#sinvqalid.CSEff&fǫOUTEff&fOFEff&fRESOURCECardUUSe rviceGswasurnÎabletros1etupamemorywindowtromÎaptUhecard'sCIS.CSEff&fǫNOEff&fMOREEff&fITEMSThe reUUwereUUnotupleGsmÎatchinrgDesiredTuple.湠(b{G2.CardTSe DrviceQssuTbfunct9iondescr1ipt9ions.17KP덍2.4.2##GetT upJleDaft9a˕#include"cistpl.h" =intCardServices(GetTupleData,client_handle_tclient,tuple_t*tuple);ЍGetTupleDatax>extractsas1e r*ieGsofdratabytUeGsf*romtUhesp#eci eGdtuple,whichmUusthaveb#eenretur#neGdbya previous7calltroGetFirstTupleorGetNextTuple.ClA%mÎaximUumofTupleDataMaxbytUeGswillb#ecopieGdintrotUheTupleDatabu e r,startinrgatano s1etofTupleOffsetbytUeGs.[ThenUurm|qb#e rofbytUeGscopieGdi#sretur#neGdinTupleDataLen.ؼRetur#nUUcoGdTes:̍CSEff&fǫBADEff&fHANDLEzTheUUclienthandlei#sinvqalid.FCSEff&fǫOUTEff&fOFEff&fRESOURCECardUUSe rviceGswasurnÎabletros1etupamemorywindowtromÎaptUhecard'sCIS.CSEff&fǫNOEff&fMOREEff&fITEMSTheLatupledo#eGsnotcontainanymoredrata.n˻TuppleOffseti#sgreqatUe rtUhanorequaltrotUhelenrgtUhofthe tuple. /2.4.3##P9ar-s9?eT upJle˕#include"cistpl.h" =intCardServices(ParseTuple,client_handle_tclient,tuple_t*tuple,cisparse_t*parse)ЍTheUUcisparseEff&fǫtdratastructurei#sgivenby:typedefunioncisparse_t{>̲cistpl_device_t*Fdevice;>̲cistpl_vers_1_t*Fversion_1;>̲cistpl_config_t*Fconfig;>̲cistpl_cftable_entry_t s,cftable_entry;}cisparse_t;̍ParseTuple1intUe rpretstupledrataretur#neGdbyapreviouscalltroGetTupleData.1ZThestructureretur#neGddTep#endsU2ontUhetyp#eoftUhepars1eGdtuple.qSeetUhecistpl.h lefortUheGs1estructuredTe nitions;U>tUheyarequitUecomplex.qCurrentUly*,UUParseTuplecanpars1eDEVICE,VERSEff&fǫ1,CONFIG,andCFTABLEEff&fENTRYtupleGs.ؼRetur#nUUcoGdTes:CSEff&fǫBADEff&fTUPLEzAnWe rrorwasencourntUeGddur*inrgpars#ingoftUhi#stuple.1sTheWtupleWmÎayb#eincompletUe,ormÎayb#eformattUeGdincorrectUly*.\(b{G2.CardTSe DrviceQssuTbfunct9iondescr1ipt9ionsBJ18KP덍CSEff&fǫUNSUPPORTEDEff&fFUNCTIONParseTupleUUcannotpars1etUhesp#eci eGdtupletyp#e. 򍍿2.4.4##V alidaft"eCISintCardServices(ValidateCIS,client_handle_tclient,cisinfo_t*cisinfo)ؼTheUUcisinfoEff&fǫtstructurei#sgivenby:卑typedefstructcisinfo_t{ =>̲u_long/?Chains;}cisinfo_t;ؼValidateCISGʲattUemptsH trove r*ifytUhatacardhasareqasonÎableCardInformÎationStructure.IItretur#nstUhe nUurm|qb#e rUUoftupleGsfoundinChains.qIftUheCISapp#eqarstrobeurnintUe rpretable,UUChainswillbes1ettro0.ؼRetur#nUUcoGdTes:CSEff&fǫBADEff&fHANDLETheUUclienthandlei#sinvqalid.CSEff&fǫOUTEff&fOFEff&fRESOURCECardUUSe rviceGswasurnÎabletros1etupamemorywindowtromÎaptUhecard'sCIS.#2.5MemorywindowconftroٙlNPCMCIAcardshavetwomemoryspaceGs:attr*iburtUememory*,L!andcommonmemory*.Attr*iburtUememoryi#s commonlyus1eGdforhÎoldinrgdTesTcr*iptiveinformÎation(i.e., tUheCIS)andcon gurationregi#stUe rs.Commonmemory3mÎaycontaindTevicebu e rsintUhecas1eofIO cards,ortUheactualbulkstrorageofamemorycard.Each soGcketcanhaveuptrofouractivememorywindows, 6mÎappinrgpGortionsofPCMCIAmemoryintrotUhehÎoqst,systUemaddreGsqsspace.-KAPCMCIAdTevicecanaddreGsqsatmost16MBofbGotUhcommonandattr*iburtUememory*.WindowsshÎouldtypicallyb#ealigneGdtroatleqast4Kbourndar*iesinbotUhthehÎoqstandcardaddreGsqsspaceGs.ؼAmemorywindowi#sinitializeGdbyacalltroRequestWindow.\Somewindowattr*iburtUeGscanb#emodi edus#inrgModifyWindow.TheOs1egmentofcardmemorymÎapp#eGdtrotUhewindowcanb#emoGdi edus#inrgMapMemPage.AndSwindowsarereleqas1eGdwitUhReleaseWindow.loUnlikealmoqstallotUhe rCardServiceGssuUbfurnctions,thememorywindowfurnctionsnormÎallyactonwindowEff&fǫhandleEff&fthandleGs, ratUhe rtUhanclientEff&fǫhandleEff&fthandleGs. 򍍿2.5.1##RequeQs-tWin9dowintCardServices(RequestWindow,client_handle_t*handle,win_req_t*req);ؼTheUUwinEff&fǫreqEff&ftstructurei#sgivenby:m(b{G2.CardTSe DrviceQssuTbfunct9iondescr1ipt9ionsBJ19KP덑typedefstructwin_req_t{ =>̲u_long/?Attributes;>̲caddr_t*FBase;>̲u_long/?Size;>̲u_long/?AccessSpeed;}win_req_t;ؼRequestWindowmÎapqsawindowofcardmemoryintrosystUemmemory*.3Onentry,GtUhehandleparametUe rshÎould pGointVtroavqalidclienthandle.u}OnVretur#n,VtUhiswillbereplaceGdbyawindowEff&fǫhandleEff&fthandletUhatshÎouldb#eus1eGdUUinsuUbqsequentcallstroModifyWindow,MapMemPage,andReleaseWindow.ؼTheUUfollowinrg agscanb#especi eGdinAttributes:WINEff&fǫMEMORYEff&fTYPEThi#s eldcanbeeGitUhe rWINEff&fǫMEMORYEff&fTYPEEff&fCMϲforcommonmemory*,rorWINEff&fǫMEMORYEff&fTYPEEff&fAMϲforattr*iburtUememory*.WINEff&fǫDATAEff&fWIDTHEitUhe rUUWINEff&fǫDATAEff&fWIDTHEff&f16for16-bitacceGsqs1es,orWINEff&fǫDATAEff&fWIDTHEff&f8for8-bitacceGsqs.WINEff&fǫENABLEIfUUtUhi#siss1et,tUhewindowi#stur#neGdon.ؼBase&sp#eci eGstUhebas1eaddresqsoftUhewindowinsystUemmemory*.bIfNULL,CardSe rviceGswills1etBasetrotUhe  rstavqailablewindowaddreGsqs."Sizesp#eci estUhewindows#izeinbytUeGs."AccessSpeedsp#eci estUhememoryacceGsqsUUsp#eed,innÎanoqs1econds.ؼRetur#nUUcoGdTes:CSEff&fǫBADEff&fHANDLETheUUclienthandlei#sinvqalid.CSEff&fǫNOEff&fCARDTheUUsoGcketasqs#igneGdtrotUhi#sclientiscurrentUlyvqacant.CSEff&fǫBADEff&fATTRIBUTEAnUUurnsuppGortUedwindowattr*iburtUewasrequeGstUed.CSEff&fǫOUTEff&fOFEff&fRESOURCETheUUmÎaximUurmnurm|qb#e rofmemorywindowsfortUhi#ssoGcketarealreqadyb#eGinrgus1ed.CSEff&fǫINEff&fUSERequestWindowUUwasurnÎabletro ndaf*reewindowofsystUemmemory*. (b{G2.CardTSe DrviceQssuTbfunct9iondescr1ipt9ions.20KP덍2.5.2##MoQdifyWin9dowyintCardServices(ModifyWindow,window_handle_t,modwin_t*);DTheUUmodwinEff&fǫtstructurei#sgivenby:typedefstructmodwin_t{ =>̲u_long/?Attributes;>̲u_long/?AccessSpeed;}modwin_t;,\ModifyWindowmoGdi estUheattr*iburtUesofawindowhandleretur#neGdbyapreviouscalltroRequestWindow. TheUUfollowinrgattr*ibutUeGscanb#echanrgeGd:WINEff&fǫMEMORYEff&fTYPEThi#s eldcanbeeGitUhe rWINEff&fǫMEMORYEff&fTYPEEff&fCMϲforcommonmemory*,rorWINEff&fǫMEMORYEff&fTYPEEff&fAMϲforattr*iburtUememory*.W䍍WINEff&fǫDATAEff&fWIDTHEitUhe rUUWINEff&fǫDATAEff&fWIDTHEff&f16for16-bitacceGsqs1es,orWINEff&fǫDATAEff&fWIDTHEff&f8for8-bitacceGsqs.WINEff&fǫENABLEIfUUtUhi#siss1et,tUhewindowi#stur#neGdon.,\AccessSpeedUUgiveGstUhenewmemoryacceGsqssp#eed,innÎanoqs1econds.ؼRetur#nUUcoGdTes:CSEff&fǫBADEff&fHANDLETheUUwindowhandlei#sinvqalid. ׍2.5.3##MapMemP9ageyintCardServices(MapMemPage,window_handle_t,memreq_t*)DTheUUmemreqEff&fǫtstructurei#sgivenby:typedefstructmemreq_t{ =>̲u_long/?CardOffset;>̲page_t/?Page;}memreq_t;,\MapMemPages1etstUheaddreGsqsofcardmemorytUhati#smÎapp#eGdtrotUhebas1eofamemorywindowtroCardOffset. The)!windowshÎouldhaveb#eencreqatUeGdbyacalltroRequestWindow.c ThePageparametUe ri#snotimplementUeGdinUUtUhi#sve rsionandshÎouldbes1ettro0.Retur#nUUcoGdTes:Ҡ(b{G2.CardTSe DrviceQssuTbfunct9iondescr1ipt9ionsBJ21KP덍CSEff&fǫBADEff&fHANDLETheUUwindowhandlei#sinvqalid.CSEff&fǫBADEff&fPAGETheUUPagevqaluewasnon-ze ro. 򍍿2.5.4##Rele as9?eWin9dowintCardServices(ReleaseWindow,window_handle_thandle)ؼReleaseWindowUUreleqas1eGsamemorywindowpreviouslyalloGcatUedUUwitUhRequestWindow.ؼRetur#nUUcoGdTes:ؼCSEff&fǫBADEff&fHANDLETheUUwindowhandlei#sinvqalid.#2.6Mi0scellaneouscallsN2.6.1##GetCardSe DrviceQsInfointCardServices(GetCardServicesInfo,servinfo_t*info)ؼTheUUservinfoEff&fǫtstructurei#sgivenby:卑typedefstructservinfo_t{ =>̲char8Signature[2];>̲u_long/?Count;>̲u_long/?Revision;>̲u_long/?CSLevel;>̲char8*VendorString;}servinfo_t;ؼGetCardServicesInfoղretur#nsrevisioninformÎationabGourttUhi#sve rs#ionofCardServiceGs.UGSignaturei#ss1ettro \CS".Counti#ss1ettrotUhenurm|qb#e rofsoGcketscurrentlycon gureGd._Revisioni#ss1ettrotherevi#sionleveloftUheCardKSe rviceGspackage,andKCSLeveli#ss1ettrotUhelevelofcompliancewitUhthePCMCIA7standrard.WoTheGs1eareencoGdTedUUasBCDnUurm|qb#e rs.qǻVendorStringiss1ettropGointtoanRCSidTenti cationstr*inrg.ؼThi#sUUcallalwayssucceeGds. 򍍿2.6.2##AcceQs sCon guraft9ionRegi(s-t"e Dr#include"cisreg.h" =intCardServices(AccessConfigurationRegister,conf_reg_t*reg);j(b{G2.CardTSe DrviceQssuTbfunct9iondescr1ipt9ionsBJ22KPTheUUconfEff&fǫregEff&ftstructurei#sgivenby:8typedefstructconf_reg_t{ =>̲u_long/?Action;>̲off_t3rOffset;>̲u_long/?Value;}conf_reg_t;8TheUUActionparametUe rcanb#eoneoftUhefollowinrg:8CSEff&fǫREADE鍑ReqadUUtUhesp#eci eGdcon gurationregi#stUe randretur#nValue.ݾCSEff&fǫWRITEW*r*itUeUUValuetrotUhesp#eci eGdcon gurationregi#stUe r.AccessConfigurationRegisterEeGitUhe rreqadsorwr*itUestUheone-bytUeCISDcon gurationregi#stUe rato s1et Offsetf*romtUhestartoftUhecon gregi#stUe rareqa.mItcanonlybeus1eGdforasockettUhathasb#eencon gureGdwitUhUURequestConfiguration.ؼTheUUfollowinrgvqalueGsforOffsetaredTe neGdincistpl.h:㍍CISREGEff&fǫCORE鍑TheUUCon gurationOptionRegi#stUe r.ݾCISREGEff&fǫCCSRTheUUCardCon gurationandStatusRegi#stUe r.CISREGEff&fǫPRRTheUUPinReplacementRegi#stUe r.CISREGEff&fǫSCRTheUUSoGcketandCopyRegi#stUe r.Retur#nUUcoGdTes:8CSEff&fǫBADEff&fHANDLETheUUclienthandlei#sinvqalid.CSEff&fǫBADEff&fARGSTheUUsp#eci eGdActionisnotsuppGortUed.CSEff&fǫCONFIGURATIONEff&fLOCKEDThi#sUUactuallymeqanstUhattUhecon gurationhasnotb#eenloGcked.CSEff&fǫOUTEff&fOFEff&fRESOURCECardUUSe rviceGswasurnÎabletroalloGcatUeamemorywindowtroacceGsqstUhecard'scon gurationregi#stUe rs.'ɠ(b{G2.CardTSe DrviceQssuTbfunct9iondescr1ipt9ions.23KP덍2.6.3##Adjus-tReQsourceInfointCardServices(AdjustResourceInfo,client_handle_thandle,adjust_t*adj);ؼTheUUadjustEff&fǫtstructurei#sgivenby:卑typedefstructadjust_t{ =>̲u_long/?Action;>̲u_long/?Resource;>̲u_long/?Attributes;>̲union{dbstructmemory{fcaddr_t*FBase;fu_long/?Size;db}memory;dbstructio{fioaddr_t%̰BasePort;fioaddr_t%̰NumPorts;fu_long/?IOAddrLines;db}io;dbstructirq{fu_long/?IRQ;db}irq;>̲}resource;}adjust_t;ؼAdjustResourceInfoNi#sus1eGdtrotUellCardSe rviceswhatresourcesmÎayormaynotb#ealloGcatUedNbyPCMCIA dTeviceGs."The]dnormÎalLinUuxresourcemÎanagement]dsystUems(tUhe*ffregioncallsforIO]%pGorts,intUe rruptallocation)areUUreGsp#ectUedbyCardSe rvices,burttUhi#scallgivestUheus1e ranothe rlevelofcontrol.ؼTheUUActionparametUe rcanhavetUhefollowinrgvqalueGs:ADDEff&fǫMANAGEDEff&fRESOURCEPlacetUhesp#eci eGdresourceurndTe rCardServiceGscontrol,ՊsotUhatitmÎayb#eallocatUedbyPCMCIAdTeviceGs.REMOVEEff&fǫMANAGEDEff&fRESOURCERemoveUUtUhesp#eci eGdresourcef*romCardSe rvicescontrol.ؼAtinitializationtime,CardSe rviceGsasqsurmeGstUhatitcanus1eallavqailableintUe rrupts,burtIOpGortsandmemoryregionsUUmUustb#eexplicitlyenÎableGdwithADDEff&fǫMANAGEDEff&fRESOURCE.ؼTheUUResourceparametUe rcanhavetUhefollowinrgvqalueGs:RESEff&fǫMEMORYEff&fRANGESp#eci eGsUUamemoryranrgeresource,dTesTcr*ib#edbyadj->resource.memory.1(b{G2.CardTSe DrviceQssuTbfunct9iondescr1ipt9ionsBJ24KP덍RESEff&fǫIOEff&fRANGESp#eci eGsUUanIOportresource,dTesTcr*ib#edbyadj->resource.io.RESEff&fǫIRQSp#eci eGsUUanintUe rruptresource,dTesTcr*ib#edbyadj->resource.irq.ؼTheUUfollowinrg agsmÎayb#especi eGdinAttributes:RESEff&fǫRESERVEDIndicatUeGsMtUhatMtUhereGsourceshÎouldb#eres1e rvedforPCMCIA$dTevicestUhatsp#eci callyrequestit.NThe reGsourcewillnotb#eallocatUedforadTevicetUhatasksCardSe rviceGsforanyavqailableloGcation.{Thi#sisnotUUimplementUeGdyet.ؼRetur#nUUcoGdTes:CSEff&fǫUNSUPPORTEDEff&fFUNCTIONTheUUsp#eci eGdActionorResourceisnotsuppGortUed.CSEff&fǫBADEff&fBASETheUUsp#eci eGdIOaddresqsi#sourtofrange.CSEff&fǫBADEff&fSIZETheUUsp#eci eGdmemoryorIOwindows#izeisourtofrange.CSEff&fǫINEff&fUSETheUUsp#eci eGdintUe rruptiscurrentUlyalloGcatUedUUbyaCardSe rviceGsclient. 򍍿2.6.4##RepQortErrorintCardServices(ReportError,char*prefix,intfunc,intret);ؼReportError۲gene ratUeGsake r#nele rrormeGsqsagegivenaCardSe rviceGsfurnctioncoGdTeanditsretur#ncoGdTe,*witUh anUUoptionÎalpre xstr*inrg.qF*orexample:卑CardServices(ReportError,"serial_cs",RequestIO,CS_BAD_HANDLE);wouldUUgene ratUetUhefollowinrgmeGsqsage:卑serial_cs:RequestIO:BadhandleؼThi#sUUcallalwayssucceeGds.:(b{G3.CardTInform}aft9ionStructureDe nitions\ò25KP덍3ٔCardLInforma>tionStructureDe nitions3.1CISTPLZff ώ)DEVICENTheUUcistplEff&fǫdeviceEff&ftstructurei#sgivenby:卑typedefstructcistpl_device_t{ =>̲u_char/?type;>̲u_char/?wp;>̲u_char/?speed;>̲u_long/?size;}cistpl_device_t;#3.2CISTPLZff ώ)VERSZff ώ1TheUUcistplEff&fǫversEff&f1Eff&ftstructurei#sgivenby:卑typedefstructcistpl_vers_1_t{>̲u_char/?major;>̲u_char/?minor;>̲int=lns;>̲char8pi[CISTPL_VERS_1_MAX_PROD_STRINGS][CISTPL_VERS_1_STRLEN];}cistpl_vers_1_t;#3.3CISTPLZff ώ)CONFIGTheUUcistplEff&fǫconfigEff&ftstructurei#sgivenby:卑typedefstructcistpl_config_t{>̲u_char/?last_idx;>̲u_long/?base;>̲u_long/?rmask[4];}cistpl_config_t;#3.4CISTPLZff ώ)CFTABLEZff ώENTRYTheUUcistplEff&fǫcftableEff&fentryEff&ftstructurei#sgivenby:卑typedefstructcistpl_cftable_entry_t{>̲u_char/?index;>̲u_char/?Default;>̲u_char/?interface;>̲u_char/?features;>̲cistpl_power_t s,power[4];>̲cistpl_timing_ttiming;C(b{G4.CardTSe DrviceQsEv9en tHandling!P26KP덑>̲cistpl_io_tio; =>̲cistpl_irq_tXirq;>̲cistpl_mem_tXmem;}cistpl_cftable_entry_t;(G4ٔCardLServicceqsEventHandlinwg׍CardUUSe rviceGseventshaves1eve ralsourceGs:A !", cmsy10CardUUstatuschanrgeGsreportUedbytUhelow-levelsoGcketdr*ive rs.Arti cialUUeventsgene ratUeGdbyCardSe rviceGsits1elf.AdvqanceGdUUPowe rManÎagement(APM)events.EventsUUgene ratUeGdbyotUhe rCardServiceGsclients.SoGcketUUdr*ive reventsmÎayb#eeGitUhe rintUerrupt-dr*ivenorpGolled."4.1Evenfthandlefrop0efrationsNWhenZCardSe rviceGsrecognizestUhataneventhasoGccurred,itZcheckstUheeventmÎaskofeqachclienttrodTetUe rmine which58clientsshÎouldreceGiveaneventnoti cation.gWhenaclientregi#stUe rs58witUhCardServiceGs,;itsp#eci esaneventUUhandle rcallbackfurnction.qThi#shandle rshÎouldhavetUheform:jint(*event_handler)(event_tevent,intpriority,event_callback_args_t*args);TheXpriorityparametUe ri#ss1ettroeGitUhe rCSEff&fǫEVENTEff&fPRIEff&fLOW5forXordinÎaryevents,orCSEff&fǫEVENTEff&fPRIEff&fHIGH5foreventstUhatrequireanimmeGdiatUerespons1e.MTTheonlyhighpr*iorityeventi#sCSEff&fǫEVENTEff&fCARDEff&fREMOVAL.Aclientevent6handle rshÎouldproGcesqstUhi#seventasecientUlyaspGoqss#iblesotUhatCardSe rviceGscanquicklynotifyotUhe rUUclients.ؼTheUUeventEff&fǫcallbackEff&fargsEff&ftstructurei#sgivenby:~typedefstructevent_callback_args_t{ =>̲client_handle_t*Fclient_handle;>̲void^*info;>̲void^*mtdrequest;>̲void^*buffer;>̲void^*misc;>̲void^*client_data;}event_callback_args_t;The ͻclientEff&fǫhandlemem|qb#e riss1ettrotUhehandleoftUheclientwhÎoqs1esoGcketwasreGspons#ible fortUheevent. Thi#s[isus1efulifadr*ive risbGourndtos1eve ralsoGckets.Theinfo eldi#scurrentUlyonlyus1eGdtroretur#nanexitstatusf*romacalltroResetCard.GTheclientEff&fǫdata eldmÎayb#eus1eGdbyadr*ive rtropGointtoaloGcaldatastructureUUasqsoGciatUedwitUhthi#sdTevice.qTheremÎaininrg eldsarecurrentlyurnus1eGd.I۠(b{G4.CardTSe DrviceQsEv9en tHandling!P27KP덍4.2Evenftdfe`scr9iptions#hCSEff&fǫEVENTEff&fCARDEff&fINSERTIONThi#seventsignÎalstUhatacardhasb#eenins1e rtUeGd.Ifadr*ive ri#sbGourndtroanalreqadyoGccupiedsocket, CardUUSe rviceGswills1endtUhedr*ive ranarti cialins1e rtionevent.CSEff&fǫEVENTEff&fCARDEff&fREMOVALThi#seventsignÎalstUhatacardhasb#eenremoveGd.ZBThi#seventshÎouldb#ehandleGdwitUhminimurmdTelaysoUUtUhatCardSe rviceGscannotifyallclientsasquicklyaspGoqss#ible.CSEff&fǫEVENTEff&fBATTERYEff&fLOWThi#sUUeventsignÎalsachanrgeUUofstatUeoftUhe\battUe rylow"s#ignÎal.CSEff&fǫEVENTEff&fBATTERYEff&fDEADThi#sUUeventsignÎalsachanrgeUUofstatUeoftUhe\battUe rydTeqad"s#ignÎal.CSEff&fǫEVENTEff&fREADYEff&fCHANGEThi#sUUeventsignÎalsachanrgeUUofstatUeoftUhe\reqady"s#ignÎal.CSEff&fǫEVENTEff&fWRITEEff&fPROTECTThi#sUUeventsignÎalsachanrgeUUofstatUeoftUhe\wr*itUeprotect"s#ignÎal.CSEff&fǫEVENTEff&fREGISTRATIONEff&fCOMPLETEThi#sUUeventiss1enttroadr*ive raftUerasucceGsqsfulcalltroRegisterClient.CSEff&fǫEVENTEff&fRESETEff&fREQUESTThi#seventiss1entwhenaclientcallsResetCard.t9Aneventhandle rcanvetrotUhereGs1etop#e rationby retur#ninrgUUfailure.CSEff&fǫEVENTEff&fRESETEff&fPHYSICALThi#sUUiss1enttroallclientsjustb#eforeareGs1etsignÎaliss1enttroacard.CSEff&fǫEVENTEff&fCARDEff&fRESETThi#speventsignÎalstUhatareGs1etop#e rationi#s nisheGd.%Thepsuccesqsporf#ailureoftUheres1etcanb#edTetUe rmined us#inrgUUGetStatus.CSEff&fǫEVENTEff&fRESETEff&fCOMPLETEThi#sUUeventiss1enttroaclienttUhathascalleGdResetCardtros#ignÎaltUheendofreGs1etprocesqs#inrg.CSEff&fǫEVENTEff&fPMEff&fSUSPENDThi#seventsignÎalstUhatCardSe rviceGshasreceGivedeitUhe raus1erinitiatUeGdorAPMsusp#endrequeGst.^?An eventUUhandle rcanvetrotUhesusp#endbyretur#ninrgfailure.CSEff&fǫEVENTEff&fPMEff&fRESUMEThi#sUUsignÎalstUhatthesystUemi#sbackonlineaftUe rasusp#end/reGsurmecycle.Wi(b{G5.Dr1iv9e DrTServiceQsin t"erf(ace=28KP덍5ٔDrCiverLServicceqsintGerf8ace׍Dr*ive r/ServiceGsprovidTesalinkb#etweenCardSe rviceGsclientdr*ive rsandus1e rmoGdTeurtilitieGsliketUhecardmgr draemon.SItki#sasortofCardSe rviceGs\supe r-client".SDr*iverkServiceGsus1estUheBindDevicefurnctiontrolinkotUhe rclientdr*ive rswitUhtheGircorrespondinrgPCMCIAcards.UnlikeotUhe rclients,!Dr*ive rServiceGsremÎainsp#e rmÎanentUlyUUbGourndtroallsoGcketsascardsareins1e rtUeGdandremoveGd.#5.1Inft2efrf0acetootpherclienftdr9iver sNDr*ive rServiceGskeepqstrackofallclientdr*ive rstUhatareinstalleGdandreqadytroattachtroasoGcket.Clientdr*ive rsneeGdtrohaveentrypGointsforcreqatinrganddTeletinrgdTevice\instanceGs",whe reonedTeviceinstancei#seve rytUhinrgUUneeGdTedtromÎanageonePCMCIAcard.ؼEachKdclientdr*ive ri#sidTenti eGdbyaurnique16-charactUe rtagtUhathastUhesp#ecialtyp#edevEff&fǫinfoEff&ft,MadTe neGdKdincsEff&fǫtypes.h.qEachUUdTeviceinstancei#sdTeGsTcr*ibedUUbyadevEff&fǫlinkEff&ftUUstructure. 򍍿5.1.1##Th9eTdevEff&fǫlinkEff&fts-tru9ctureTheUUdevEff&fǫlinkEff&ftdratastructurei#sgivenby:卑#include"ds.h" =typedefstructdev_link_t{>̲char^dev_name[8];>̲u_charU major,minor;>̲u_longU state;>̲u_longU open;>̲structwait_queue!*pending>̲structtimer_list!release>̲client_handle_t*Fhandle;>̲io_req_tK`io;>̲irq_req_tFirq;>̲config_req_t8conf;>̲window_handle_t*Fwin;>̲void^*priv;>̲structdev_link_t!*next;}dev_link_t;ؼTheqdevEff&fǫname eldshÎouldb#e lleGdinbytUhedr*ive rwitUhadTevice lenÎameforacceGsqs#inrgtUhisdTevice,ܸif appropr*iatUe.dF*or‰example,tUheserialEff&fǫcsdr*ive rus1eGsnÎameGslike\cua1".dThemajorandminor eldsgivemÎa8jor#andminordTevicenUurm|qb#e rsforacceGsqsinrgtUhisdTevice.@0Dr*ive rServiceGsrelaystUhes1e eldstrouse rmoGdTeprogramsUUviatUheDSEff&fǫGETEff&fDEVICEEff&fINFOUUioGctl.ؼTheUUstate eldshÎouldb#eus1eGdtrokeeptrackoftUhecurrentdTevicestatUe.qThefollowinrg agsaredTe neGd:ؼDEVEff&fǫPRESENTe(b{G5.Dr1iv9e DrTServiceQsin t"erf(ace>ڲ29KP덑IndicatUeGstUhattUhecardi#spreGs1ent.!ThisbitshÎouldbes1etandcleqareGdbytUhedr*ive r'seventhandle rin reGspons1eUUtrocardinse rtionandremovqalevents.,DEVEff&fǫCONFIG:IndicatUeGsUUtUhatUUtUhecardi#scon gureGdforus1e.DEVEff&fǫCONFIGEff&fPENDINGIndicatUeGsUUtUhatUUcon gurationUUi#sinprogreGsqs.DEVEff&fǫSUSPENDIndicatUeGsUUtUhatUUtUhecardi#ssuspendTeGd.DEVEff&fǫBUSYIndicatUeGs=tUhat=anIO)op#e ration=i#sinprogreGsqs.R~ThisbitmÎaybeus1eGdasanintUe rlocktropreventacceGsqs con icts.DEVEff&fǫSTALEEff&fCONFIGF*orbKsomedr*ive rs,whenarurnningbKcardi#sejectUeGd,tUhesoGcketshÎouldnotb#eurncon gureGduntilanydTeviceGs correGspondinrgD totUhi#scardarecloqs1eGd.lThis agindicatUeGstUhattUhesoGcketshÎouldb#eurncon gureGdwhentUheUUdTevicei#scloqs1eGd.,DEVEff&fǫSTALEEff&fLINKAdr*ive rinstanceshÎouldnotb#edTeletUeGdurntilallitsPCMCIAreGsourcesarereleqas1ed.@Thi#s agindicatUestUhatUUthi#sdr*ive rinstanceshÎouldb#ef*reeGdassoonastUhesocketi#surncon gureGd.yTheopen eldi#sausagecourntfortUhisdTevice.]ThedeviceshÎouldonlyb#ef*reeGdwhentUheop#encourntisze ro.TheUUpending eldcanb#eus1eGdtromÎanageUUaqueueofprocesqs1eswaitinrgUUtous1etUhedTevice.ؼTheprelease eldi#sus1eGdtrosTcheGduledTeviceshUurtdownproGcesqs#inrgpwhenacardi#sejectUeGd.ATcardremovqaleventneeGdstrob#ehandleGdathighpr*iority*, soadrive r'seventhandle rwilltypicallydTeqalwitUhanejectbyreGs1ettinrgttUheDEVEff&fǫPRESENTtbitintUhedTevicestatUe,|tUhensTcheGdulinrgtUheshUurtdownproGcesqs#inrgtorunatalatUe rtime.Thekhandle,io,irq,conf,andkwin eldscompr*i#s1ealltUhenormÎalPCMCIAdratastructureGsneeGdTedktrocon gureUUonePCMCIAIOcard.TheΗpriv eldcanb#eus1eGdforanysortofpr*ivqatUedratastructureneeGdTedΗtromÎanageΗtUhedTevice.DThenext eldcanUUb#eus1eGdtrobuildlinkedli#stsofdevEff&fǫlinkEff&ftUUstructureGs,UUfordr*ive rstUhatcanhandlemUulrtipleinstanceGs. s5.1.2##regi(s-t"e Drffs4#pQcmciaffs4dr1iv9erintregister_pcmcia_driver(dev_info_t*dev_info, =dev_link_t*(*attach)(void),void(*detach)(dev_link_t*));yregisterEff&fǫpcmciaEff&fdriverNinformsDr*ive rServiceGstUhataclientdr*ive ri#spreGs1entandreqadytrob#ebGoundto soGckets.Whenh Dr*ive rServiceGsreceivesaDSEff&fǫBINDEff&fREQUESThioGctUlthatmÎatcheGstUhi#sdr*ive r'sdevEff&fǫinfostr*inrg,itwillcalltUhedr*ive r'sattach()entrypGoint.TWhenitgetsaDSEff&fǫUNBINDEff&fREQUESTioGctUl,itwillcalldetach().sJ(b{G5.Dr1iv9e DrTServiceQsin t"erf(ace=30KP덍5.1.3##unregi(s-t"e Drffs4#pQcmciaffs4dr1iv9er6intunregister_pcmcia_driver(dev_info_t*dev_info);Thi#sUUinformsDr*ive rServiceGstUhatitshÎouldnolonrgerbindsoGcketstrotUhesp#eci eGdclientdr*ive r.#5.2Inft2efrf0acetousC4ermo`dfePCMCIAutilitiesNDr*ive rServiceGscreqatUesapqs1eudo-dTeviceforcommUurnicatingwitUhus1e rmoGdTePCMCIAutilitieGs.eThemÎa8jor nUurm|qb#e r ofthedTevicei#schÎoqs1endynamically*,andPCMCIA urtilitieGsshÎouldreqad/proc/devicestrodTetUe rmineit.qMinorUUdTevicenUurm|qb#e rscorreGspondUUtosoGcketUUnUum|qb#e rs,startinrgUUwitUh0.ؼOnlyoneproGcesqsi#salloweGdtroop#enasoGcketforreqad/wr*itUeacceGss.HOtUhe rproGcess1escanop#entUhesoGcketinreqad-only9moGdTe.4A read-onlyconnectiontroDr*ive rServiceGscanp#erformasuUbqs1etofioctlcalls.4A read/wr*itUeconnectionUUcani#sqsueallioctlcalls,andcanalsoreceGiveCardSe rviceGseventnoti cations. 덍5.2.1##CardTSe DrviceQsev9en tnoti caftionsDr*ive rServiceGsimplementsread()andselect()furnctionsforeventnoti cation.Reqadinrgf*romapGcmciadTeviceretur#nsanurnsigneGdlonrgvqaluecontaininrgalltUheeventsreceGivedbyDr*ive rServiceGss#incetUhepreviousread().;_Ifnoeventshaveb#eenreceGived,tUhecallwillbloGckurntiltUhenextevent.;_Aselect()callcanb#eus1eGdUUtromonitors1eve ralsoGcketsfornewevents.ؼThefollowinrgeventsaremonitroreGdbyDr*ive rServiceGs:vCSEff&fǫEVENTEff&fCARDEff&fINSERTION,CSEff&fEVENTEff&fCARDEff&fREMOVAL,CSEff&fǫEVENTEff&fRESETEff&fPHYSICAL,UUCSEff&fEVENTEff&fCARDEff&fRESET,andCSEff&fEVENTEff&fRESETEff&fCOMPLETE. 덍5.2.2##ioctlTdeQscr1ipt9ionsMoqstUUDr*ive rServiceGsioctlop#erationsUUdirectUlymÎaptroCardServiceGsfurnctions.qAnioctUlcallhastheform: intioctl(intfd,intcmd,ds_ioctl_arg_t*arg);TheUUdsffioGctUlffargfftstructurei#sgivenby:ztypedefunionds_ioctl_arg_t{ =>̲servinfo_tYservinfo;>̲adjust_t%̰adjust;>̲config_t%̰config;>̲tuple_t*Ftuple;>̲tuple_parse_t,tuple_parse;>̲client_req_tXclient_req;>̲status_t%̰status;>̲conf_reg_tYconf_reg;>̲bind_info_tbind_info;>̲cisinfo_t!cisinfo;}ds_ioctl_arg_t;(b{G5.Dr1iv9e DrTServiceQsin t"erf(ace>ڲ31KPTheUUfollowinrgioctlcommÎandsexecurtUetUhecorreGspondinrgCardSe rvicesfurnction:?DSEff&fǫGETEff&fCARDEff&fSERVICESEff&fINFOd5CallsUUCardServices(GetCardServicesInfo,?...,&arg->servinfo).VDSEff&fǫADJUSTEff&fRESOURCEEff&fINFOCallsUUCardServices(AdjustResourceInfo,?...,&arg->adjust).DSEff&fǫGETEff&fCONFIGURATIONEff&fINFOCallsUUCardServices(GetConfigurationInfo,?...,&arg->config).DSEff&fǫGETEff&fFIRSTEff&fTUPLECallsUUCardServices(GetFirstTuple,?...,&arg->tuple).DSEff&fǫGETEff&fNEXTEff&fTUPLECallsUUCardServices(GetNextTuple,?...,&arg->tuple).DSEff&fǫGETEff&fTUPLEEff&fDATACallsFCardServices(GetNextTuple,?...,&arg->tupleEff&fǫparse.tuple).WThetupledratai#sretur#neGd inUUarg->tupleEff&fǫparse.data.DSEff&fǫPARSEEff&fTUPLECallsUUCardServices(ParseTuple,?...,&arg->tupleEff&fǫparse.tuple,&arg->tupleEff&fparse.parse).DSEff&fǫRESETEff&fCARDCallsUUCardServices(ResetCard,?...).DSEff&fǫGETEff&fSTATUSCallsUUCardServices(GetStatus,?...,&arg->status).DSEff&fǫACCESSEff&fCONFIGURATIONEff&fREGISTERCallsUUCardServices(AccessConfigurationRegister,?...,&arg->confEff&fǫreg).DSEff&fǫVALIDATEEff&fCISCallsUUCardServices(ValidateCIS,?...,&arg->cisinfo).DSEff&fǫSUSPENDEff&fCARDCallsUUCardServices(SuspendCard,?...).DSEff&fǫRESUMEEff&fCARDCallsUUCardServices(ResumeCard,?...).DSEff&fǫEJECTEff&fCARDCallsUUCardServices(EjectCard,?...).DSEff&fǫINSERTEff&fCARDCallsUUCardServices(InsertCard,?...). (b{G6.Wh9e DreTtoGoforMoreInform}aftion PҲ32KPThetfollowinrgioctlcommÎandsinvokesp#ecialDr*ive rServiceGsfurnctions.&TheyactonbindEff&fǫinfoEff&ftstructureGs:卑typedefstructbind_info_t{ =>̲dev_info_tB&4dev_info;>̲structdev_info_t!*instance;>̲char^name[8];>̲u_charU major,minor;>̲void^*next;}bind_info_t;ؼDSEff&fǫBINDEff&fREQUESTThi#s IcallconnectsasoGckettroaclientdr*ive r.Thesp#eci eGddTeviceID devEff&fǫinfoisloGoked IupintUhe li#stM#ofregistUe reGddr*ivers.o Iffournd,NtUheM#dr*iverM#i#sbGourndtotUhi#ssoGcketM#usinrgtUheBindDevicecall.o Then,Dr*ive rPcServiceGscallstUheclientdr*ive r'sattach()entrypGointtrocreqatUeadTeviceinstance.bThenewdevEff&fǫlinkEff&ftUUpGointUe ri#sreturneGdUUininstance.DSEff&fǫGETEff&fDEVICEEff&fINFOThi#scallretr*ieveGstUhedevEff&fǫname,Ԅmajor,andminorentr*ieGsfromtUhedevEff&fǫlinkEff&ftstructurepGointUedtrobyUUinstance.DSEff&fǫUNBINDEff&fREQUESTThi#sUUcallcallstUhedetach()furnctionfortUhesp#eci eGddr*ive randinstance,shUurttingUUdowntUhi#sdTevice.(6ٔWhereLtwoGoforMoreInforma>tion׍The': cmti10LinuxtKernelHackers'Guide[,3wr*ittUenbyMichaelJohnson,3i#sagoGodsourceofgene ralinformÎationabGourtwr*itinrgUULinUuxdTevicedrive rs.qIti#savqailablef*romtUheusualLinUuxFTPs#itUeGs.ؼTheYXgenUuinePCMCIAYWstandrardi#sonlyavqailableforastUeeppr*icefromtUhePCMCIAYWasqsoGciationits1elf.}Theneww]PCwCardStandrardi#ssuppGoqs1edw]trocost$ w^399,burtyoumÎaystillb#eabletrogetoldcopieGsoftUhe2.1standrardUUatadTeepdi#sTcount.卑PersonalComputerMemoryCardInternationalAssociation =1030EastDuaneAvenue,SuiteGSunnyvale,CA94086USA(408)720-0107,(408)720-9416FAX,(408)720-9388BBSؼOne,ZalrtUe r#nÎativei#stUhePCMCIAn*Develop}'er'sn4Guide[,4wr*ittUenbyMichaelMor*i,4avqailablef*romSycardT*echno- logyUUfor$UV89.95:SycardTechnology1180-FMiralomaWaySunnyvale,CA94086USA(408)749-0130,(408)749-1323FAX!(b{G6.Wh9e DreTtoGoforMoreInform}aftion 33KPProgramminrg informÎationforvqar*iousPCMCIA controlle rsi#savqailablef*romtUhecorreGspondinrg chipvendors:卑IntelCorporation =(800)628-8686CirrusLogic(510)623-8300Vadem(408)943-9301DatabookInc.(716)889-4204;(G!*ߤN cmtt9(N cmbx12': cmti10"V cmbx10Kffffcmbx14m#R cmss10 cmmi10K`y cmr10