SMBus协议总结(翻译).pdf_第1页
SMBus协议总结(翻译).pdf_第2页
SMBus协议总结(翻译).pdf_第3页
SMBus协议总结(翻译).pdf_第4页
SMBus协议总结(翻译).pdf_第5页
已阅读5页,还剩6页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

SMBus 协议总结 1 SMBus 协议总结 本文将对 SMBUS 协议进行总结 本文针对该协议的所有修订版 包括 1 0 1 1 2 0 具 体的协议特性将在本文最后进行介绍 一些 I2C 适配器仅仅兼容 SMBus 协议 System Management Bus 系统管理总线 而 SMBus 只是 I2C 协议的子集 幸运的是 大部分设备都使用相同的子集 故可以将它们放置 同一个 SMBus 中 如果你为一个 I2C 设备写驱动程序 而该设备仅仅使用 I2C 协议的子集 那么推荐你尽 可能使用 SMBus 协议的命令 这样这个驱动程序既可以在 SMBus 适配器上使用 也可以在 I2C 适配器上使用 当在 I2C 适配器上时 SMBus 格式会自动转换为 I2C 格式 而 SMBus 适 配器大多无法处理单纯的 I2C 格式 下文将列举 SMBus 的操作时序 以及执行该时序的函数 注意 一下使用的函数名称 可能会因不同的 SMBus 协议规格而不尽相同 每个处理都对应一个标识 在调用处理函数是 驱动程序应该总要检查一次对应的标识 以确保底层的 I2C 适配器支持改处理 具体详见 各个字符的描述 标识 位数 bit 描述 S 1 起始位 P 1 停止位 Rd Wr 1 读写标志位 1 读 0 写 A NA 1 响应 不响应位 Addr 7 I2C 设备地址 可能扩充为 10 位 Comm 8 命令字节 通常是设备内寄存 器的地址 Data 8 数据字节 有时分为高 低两 个字节的 16 位数据 Count 8 描述块操作长度的数据字节 由 I2C 设备发送 主机接收的 字节 SMBus 快速命令 SMBus Quick Command 向设备发送一个位 即读写位 A Addr Rd Wr A P 功能标识 I2C FUNC SMBUS QUICK SMBus 读取一个字节 i2c smbus read byte 向设备读取一个字节 没有说明读取的寄存器地址 一些设备十分简单 仅通过该命令 即可实现操作 对其他设备 可以在使用 SMBus 指定了寄存器地址后使用该函数实现对同 一个寄存器的重复读取 S Addr Rd A Data NA P 功能标识 I2C FUNC SMBUS READ BYTE SMBus 协议总结 2 SMBus 发送一个字节 i2c smbus write byte 该函数与读取一个字节的函数功能相反 它向设备发送一个字节 具体参见 读取一个 字节 函数 S Addr Wr A Data A P 功能标识 I2C FUNC SMBUS WRITE BYTE SMBus 读取字节寄存器 i2c smbus read byte data 该函数从设备读取指定了地址的寄存器 Comm 字节指定寄存器地址 S Addr Wr A Comm A S Addr Rd A Data NA P 功能标识 I2C FUNC SMBUS READ BYTE DATA SMBus 读取字寄存器 i2c smbus read word data 该函数与读取字节寄存器函数类似 只是读的是 16 位的字 Comm 依旧为指定的字寄 存器地址 S Addr Wr A Comm A S Addr Rd A DataLow A DataHigh NA P 功能标识 I2C FUNC SMBUS READ WORD DATA 注意 还有一个读取字寄存器的函数 i2c smbus read word swapped 使用于当寄存器 两个字节排列方式不同时的情况 虽然与 SMBus 不兼容 但使用得十分普遍 SMBus 写字节寄存器 i2c smbus write byte data 向指定的字节寄存器写数据 寄存器地址由 Comm 指定 该函数与 读字节寄存器 函数正好相反 S Addr Wr A Comm A Data A P 功能标识 I2C FUNC SMBUS WRITE BYTE DATA SMBus 写字寄存器 i2c smbus write word data 该函数与 读取字寄存器 函数正好相反 S Addr Wr A Comm A DataLow A DataHigh A P 功能标识 I2C FUNC SMBUS WRITE WORD DATA 注意 还有一个写字寄存器的函数 i2c smbus write word swapped 使用于当寄存器两 个字节排列方式不同时的情况 虽然与 SMBus 不兼容 但使用得十分普遍 SMBus 字读取写入调用 SMBus Process Call 向设备寄存器 由 Comm 指定 发送 16 位数据 之后读取其返回值 S Addr A Wr Comm A DataLow A DataHigh A S Addr Rd A DataLow A DataHigh NA P SMBus 协议总结 3 功能标识 flag I2C FUNC SMBUS PROC CALL SMBus 块读取 i2c smbus read block data 该函数向设备读取多于 32 字节的块数据 由 Comm 指定寄存器地址 设备通过 Count 说明要读取的字节数 S Addr Wr A Comm A S Addr Rd A Count A Data A Data A A Data NA P 功能标识 I2C FUNC SMBUS READ BLOCK DATA SMBus 块写入 i2c smbus write block data 与 块读取 函数功能相反 Comm 指定需要写入的寄存器地址 Count 说明写入的字 节数 S Addr Wr A Comm A Count A Data A Data A A Data A P 功能标识 I2C FUNC SMBUS WRITE BLOCK DATA SMBus 块读写处理调用 SMBus Block Write Block Read Process Call 该函数包含于修订版 2 0 中 该函数通过 Comm 指定寄存器地址 向设备写入 1 到 31 个字节 之后返回 1 到 31 个 字节 S Addr Wr A Comm A Count A Data A S Addr Rd A Count A Data A P 功能标识 I2C FUNC SMBUS BLOCK PROC CALL SMBus 主机转变通知 SMBus Host Notify 该函数由设备发送 通知主机即将转变主从角色 设备成为主机 主机成为设备 该函 数与 写 16 位字 函数类似 只是将命令码替换为设备地址 S HostAddr Wr A DevAddr A DataLow A DataHigh A P 包错误校验 Packet Error Checking PEC 包错误校验包含于修订版 1 1 中 该功能在传完数据之后 结束位之前添加 CRC 8 校验 码 地址解析协议 ARP ARP 由修订版 2 0 引入 它是更高一层的协议 ARP 向协议添加了设备枚举及动态地址 SMBus 协议总结 4 分配功能 所有 ARP 通信使用 0 x61 从地址并且需要包错误校验 SMBus 警报 SMBus Alert 警报功能由修订版 1 0 引入 该功能允许设备公用同一个主机的中断引脚 而主机依旧 可以辨别出是哪个设备触发中断 在 Linux 内核中应该使用以下方法使用该功能 支持 SMBus 报警的 I2C 总线驱动程序 应通过调用 i2c setup smbus alert 设置 SMBus 警报 支持 SMBus 报警的 I2C 总线驱动程序可选择是否响应 alert 回调 I2C 块处理 I2C Block Transactions 以下 I2C 块处理也被 SMBus 层支持 为了文档的完整性 在下文进行说明 注意它们注意它们 并未在并未在 SMBus 中被声明中被声明 I2C 块处理中并未对块大小进行限定 但 SMBus 将块大小限制在 32 字节内 I2C 块读取 i2c smbus read i2c block data 该函数由 Comm 指定的寄存器中读取数据 S Addr Wr A Comm A S Addr Rd A Count A Data A Data A A Data NA P 功能标识 I2C FUNC SMBUS READ I2C BLOCK I2C 块写入 i2c smbus write i2c block data 该函数与 I2C 块读取 函数功能相反 向指定寄存器写入块数据 注意 由于数据长 度难以区分 故命令长度可以为 0 2 或更多 S Addr Wr A Comm A Count A Data A Data A A Data A P 功能标识 I2C FUNC SMBUS WRITE I2C BLOCK Translated By B4 SMBus 协议总结 5 英文原文 SMBus Protocol Summary The following is a summary of the SMBus protocol It applies to all revisions of the protocol 1 0 1 1 and 2 0 Certain protocol features which are not supported by this package are briefly described at the end of this document Some adapters understand only the SMBus System Management Bus protocol which is a subset from the I2C protocol Fortunately many devices use only the same subset which makes it possible to put them on an SMBus If you write a driver for some I2C device please try to use the SMBus commands if at all possible if the device uses only that subset of the I2C protocol This makes it possible to use the device driver on both SMBus adapters and I2C adapters the SMBus command set is automatically translated to I2C on I2C adapters but plain I2C commands can not be handled at all on most pure SMBus adapters Below is a list of SMBus protocol operations and the functions executing them Note that the names used in the SMBus protocol specifications usually don t match these function names For some of the operations which pass a single data byte the functions using SMBus protocol operation names execute a different protocol operation entirely Each transaction type corresponds to a functionality flag Before calling a transaction function a device driver should always check just once for the corresponding functionality flag to ensure that the underlying I2C adapter supports the transaction in question See for the details Key to symbols S 1 bit Start bit P 1 bit Stop bit Rd Wr 1 bit Read Write bit Rd equals 1 Wr equals 0 A NA 1 bit Accept and reverse accept bit Addr 7 bits I2C 7 bit address Note that this can be expanded as usual to get a 10 bit I2C address Comm 8 bits Command byte a data byte which often selects a register on the device SMBus 协议总结 6 Data 8 bits A plain data byte Sometimes I write DataLow DataHigh for 16 bit data Count 8 bits A data byte containing the length of a block operation Data sent by I2C device as opposed to data sent by the host adapter SMBus Quick Command This sends a single bit to the device at the place of the Rd Wr bit A Addr Rd Wr A P Functionality flag I2C FUNC SMBUS QUICK SMBus Receive Byte i2c smbus read byte This reads a single byte from a device without specifying a device register Some devices are so simple that this interface is enough for others it is a shorthand if you want to read the same register as in the previous SMBus command S Addr Rd A Data NA P Functionality flag I2C FUNC SMBUS READ BYTE SMBus Send Byte i2c smbus write byte This operation is the reverse of Receive Byte it sends a single byte to a device See Receive Byte for more information S Addr Wr A Data A P Functionality flag I2C FUNC SMBUS WRITE BYTE SMBus Read Byte i2c smbus read byte data SMBus 协议总结 7 This reads a single byte from a device from a designated register The register is specified through the Comm byte S Addr Wr A Comm A S Addr Rd A Data NA P Functionality flag I2C FUNC SMBUS READ BYTE DATA SMBus Read Word i2c smbus read word data This operation is very like Read Byte again data is read from a device from a designated register that is specified through the Comm byte But this time the data is a complete word 16 bits S Addr Wr A Comm A S Addr Rd A DataLow A DataHigh NA P Functionality flag I2C FUNC SMBUS READ WORD DATA Note the convenience function i2c smbus read word swapped is available for reads where the two data bytes are the other way around not SMBus compliant but very popular SMBus Write Byte i2c smbus write byte data This writes a single byte to a device to a designated register The register is specified through the Comm byte This is the opposite of the Read Byte operation S Addr Wr A Comm A Data A P Functionality flag I2C FUNC SMBUS WRITE BYTE DATA SMBus Write Word i2c smbus write word data This is the opposite of the Read Word operation 16 bits of data is written to a device to the designated register that is specified through the Comm byte S Addr Wr A Comm A DataLow A DataHigh A P SMBus 协议总结 8 Functionality flag I2C FUNC SMBUS WRITE WORD DATA Note the convenience function i2c smbus write word swapped is available for writes where the two data bytes are the other way around not SMBus compliant but very popular SMBus Process Call This command selects a device register through the Comm byte sends 16 bits of data to it and reads 16 bits of data in return S Addr Wr A Comm A DataLow A DataHigh A S Addr Rd A DataLow A DataHigh NA P Functionality flag I2C FUNC SMBUS PROC CALL SMBus Block Read i2c smbus read block data This command reads a block of up to 32 bytes from a device from a designated register that is specified through the Comm byte The amount of data is specified by the device in the Count byte S Addr Wr A Comm A S Addr Rd A Count A Data A Data A A Data NA P Functionality flag I2C FUNC SMBUS READ BLOCK DATA SMBus Block Write i2c smbus write block data The opposite of the Block Read command this writes up to 32 bytes to a device to a designated register that is specified through the Comm byte The amount of data is specified in the Count byte S Addr Wr A Comm A Count A Data A Data A A Data A P Functionality flag I2C FUNC SMBUS WRITE BLOCK DATA SMBus 协议总结 9 SMBus Block Write Block Read Process Call SMBus Block Write Block Read Process Call was introduced in Revision 2 0 of the specification This command selects a device register through the Comm byte sends 1 to 31 bytes of data to it and reads 1 to 31 bytes of data in return S Addr Wr A Comm A Count A Data A S Addr Rd A Count A Data A P Functionality flag I2C FUNC SMBUS BLOCK PROC CALL SMBus Host Notify This command is sent from a SMBus device acting as a master to the SMBus host acting as a slave It is the same form as Write Word with the command code replaced by the alerting device s address S HostAddr Wr A DevAddr A DataLow A DataHigh A P Packet Error Checking PEC Packet Error Checking was introduced in Revision 1 1 of the specification PEC adds a CRC 8 error checking byte to transfers using it immediately before the terminating STOP Address Resolution Protocol ARP The Address Resolution Protocol was introduced in Revision 2 0 of the specification It is a higher layer protocol which uses the messages above ARP adds device enumeration and dynamic address assignment to SMBus 协议总结 10 the protocol All ARP communications use slave address 0 x61 and require PEC checksums SMBus Alert SMBus Alert was introduced in Revision 1 0 of the specification The SMBus alert protocol allows several SMBus slave devices to share a single interrupt pin on the SMBus master while still allowing the master to know which slave triggered the interrupt This is implemented the following way in the Linux ker

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论