您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 管理学资料 > CP2112-HID-USB-TO-SMBUS-API-SPECIFICATION
Rev.0.211/10Copyright©2010bySiliconLaboratoriesAN496AN496CP2112HIDUSB-TO-SMBUSAPISPECIFICATION1.IntroductionTheSiliconLabsHIDUSB-to-SMBusinterfacelibraryprovidesasimpleAPItoconfigureandoperateCP2112devices.ThelibraryprovidesinterfaceabstractionsothatuserscandeveloptheirapplicationwithoutwritinganyUSBHIDCode.ClibrariesimplementingtheCP2112InterfaceSpecificationareprovidedforWindows2000andlaterandMacOSX10.5andlater.Similarly,variousincludefilesareprovidedtoimportlibraryfunctionsintoC#.NET,andVisualBasic.NET.Refertothetablebelowforcompletedetails.Figure1.SystemArchitectureDiagramTable1.CP2112IncludeFilesOperatingSystemLibraryIncludeFilesVersionWindows2000andlaterSLABHIDtoSMBus.dll*SLABCP2112.h(C/C++)SLABCP2112.cs(C#.NET)SLABCP2112.vb(VB.NET)1.2MacOSX10.5andlaterlibSLABHIDtoSMBus.dylibSLABCP2112.h(C,C++,Obj-C)Types.h(Compatibility)1.0*Note:RequiresSLABHIDDevice.dllversion1.5duringruntime.PCUserApplicationHIDtoSMBusLibraryHIDDriver(ProvidedbyOS)USBRootHubCP2112HIDUSB-to-SMBusBridgeSMBusDevicesUSBAN4962Rev.0.22.APIFunctionsTable2.APIFunctionsTableDefinitionDescriptionPage#HidSmbus_GetNumDevices()Returnsthenumberofdevicesconnected3HidSmbus_GetString()Returnsastringforadevicebyindex4HidSmbus_GetOpenedString()Returnsastringforadevicebydeviceobjectpointer5HidSmbus_GetIndexedString()ReturnsanindexedUSBstringdescriptorbyindex(WindowsOnly)6HidSmbus_GetOpenedIndexedString()ReturnsanindexedUSBstringdescriptorbydeviceobjectpointer(WindowsOnly)6HidSmbus_GetAttributes()ReturnstheVID,PID,andreleasenumberforadevicebyindex7HidSmbus_GetOpenedAttributes()ReturnstheVID,PIDandreleasenumberforadevicebydeviceobjectpointer7HidSmbus_Open()Opensadeviceandreturnsadeviceobjectpointer8HidSmbus_Close()CancelspendingIOandclosesadevice8HidSmbus_IsOpened()Returnsthedeviceopenedstatus9HidSmbus_ReadRequest()Initiatesafixedlengthreadrequesttothedesiredslavedevice9HidSmbus_AddressReadRequest()Initiatesafixedlengthreadrequesttothedesiredslavedevicespecifyingthememoryaddresstoread10HidSmbus_ForceReadResponse()Forcesthedevicetogenerateandsendareadresponse11HidSmbus_GetReadResponse()Returnsareadresponseifavailable12HidSmbus_WriteRequest()Initiatesawriterequesttothedesiredslavedevice13HidSmbus_TransferStatusRequest()Requeststhestatusofthecurrentreadorwriterequest13HidSmbus_GetTransferStatusResponse()Returnsthestatusofthecurrentreadorwriterequest14HidSmbus_CancelTransfer()Cancelsthecurrentreadorwriterequest15HidSmbus_CancelIo()CancelspendingHIDreadsandwrites(WindowsOnly)16HidSmbus_SetTimeouts()Setstheresponsetimeoutsforadevice16HidSmbus_GetTimeouts()Getstheresponsetimeoutsforadevice16HidSmbus_SetSmbusConfig()Setsthebitrate,masteraddress,timeouts,andtransfersettings17HidSmbus_GetSmbusConfig()Getsthebitrate,masteraddress,timeouts,andtransfersettings18AN496Rev.0.232.1.HidSmbus_GetNumDevicesDescription:ThisfunctionreturnsthenumberofdevicesconnectedtothehostwithmatchingvendorandproductID(VID,PID).Prototype:HID_SMBUS_STATUSHidSmbus_GetNumDevices(DWORD*numDevices,WORDvid,WORDpid)Parameters:1.numDevicesreturnsthenumberofdevicesconnectedonreturn.2.vidfiltersdeviceresultsbyvendorID.Ifbothvidandpidaresetto0x0000,thenHIDdeviceswillnotbefilteredbyVID/PID.3.pidfiltersdeviceresultsbyproductID.Ifbothvidandpidaresetto0x0000,thenHIDdeviceswillnotbefilteredbyVID/PID.ReturnValue:HID_SMBUS_STATUS=HID_SMBUS_SUCCESSHID_SMBUS_INVALID_PARAMETERHidSmbus_Reset()Resetsthedevicewithre-enumeration18HidSmbus_SetGpioConfig()SetsGPIOdirectionandmodeconfiguration19HidSmbus_GetGpioConfig()GetsGPIOdirectionandmodeconfiguration20HidSmbus_ReadLatch()GetstheGPIOlatchvalue21HidSmbus_WriteLatch()SetstheGPIOlatchvalueusingabitmask21HidSmbus_GetPartNumber()Getsthedevicepartnumberandversion22HidSmbus_GetLibraryVersion()GetstheDLLLibraryversion22HidSmbus_GetHidLibraryVersion()GetstheHIDDeviceInterfaceLibraryversion22HidSmbus_GetHidGuid()GetstheHIDGUID(Windows®only)22Table2.APIFunctionsTable(Continued)DefinitionDescriptionPage#AN4964Rev.0.22.2.HidSmbus_GetStringDescription:Thisfunctionreturnsanull-terminatedvendorIDstring,productIDstring,serialstring,devicepathstring,manufacturerstring,orproductstringforthedevicespecifiedbyanindexpassedindeviceNum.Theindexforthefirstdeviceis0,andthelastdeviceisthevaluereturnedbyHidSmbus_GetNumDevices()–1.Prototype:HID_SMBUS_STATUSHidSmbus_GetString(DWORDdeviceNum,WORDvid,WORDpid,char*deviceString,DWORDoptions)Parameters:1.deviceNumistheindexofthedeviceforwhichthestringisdesired.2.vidfiltersdeviceresultsbyvendorID.Ifbothvidandpidaresetto0x0000,thenHIDdeviceswillnotbefilteredbyVID/PID.3.pidfiltersdeviceresultsbyproductID.Ifbothvidandpidaresetto0x0000,thenHIDdeviceswillnotbefilteredbyVID/PID.4.deviceStringisavariableoftypeHID_SMBUS_DEVICE_STR,whichwillcontainanull-terminatedASCIIdevicestringonreturn.Thestringis260bytesonWindowsand512bytesonMacOSX.5.optionsdeterminesifdeviceStringwillcontainavendorIDstring,productIDstring,serialstring,devicepathstring,manufacturerstring,orproductstring.ReturnValue:HID_SMBUS_STATUS=HID_SMBUS_SUCCESSHID_SMBUS_DEVICE_NOT_FOUNDHID_SMBUS_IN
本文标题:CP2112-HID-USB-TO-SMBUS-API-SPECIFICATION
链接地址:https://www.777doc.com/doc-3192828 .html