5.5.2.4.6. 声明 GenericSerialBus 操作区域
对于 GenericSerialBus 操作区域,OperationRegion 术语的语法(来自 OperationRegion(声明操作区域))如下所述:
OperationRegion (
RegionName, // NameString
RegionSpace, // RegionSpaceKeyword
Offset, // TermArg=>Integer
Length // TermArg=>Integer
)
其中:
RegionName 指定该区域的名称(例如TOP1)。
RegionSpace必须设置为GenericSerialBus(操作区域类型值0x09)。
Offset 指定目标设备的初始命令值偏移。例如,值 0x00 表示命令值偏移量为零 (0)。原始协议忽略该值。
长度设置为0x100(256),表示可能的命令值的最大数量。
操作区域必须在串行总线控制器设备的范围内声明。
以下ASL代码显示了“OperationRegion”、“Field”和“Offset”术语应用于SPB空间时的用法。
Scope(\_SB.I2C)
{
Name (SDB0, ResourceTemplate()
{
I2CSerialBusV2(0x4a,,100000,,"
\\_SB.I2C",,,,,RawDataBuffer(){1,2,3,4,5,6})
})
操作区域(TOP1,GenericSerialBus,0x00,0x100) // GenericSerialBus device at command offset 0x00 Field(TOP1, BufferAcc, NoLock, Preserve) { Connection(SDB0), // Use the Resource Descriptor defined above AccessAs(BufferAcc, AttribWord), // Use the GenericSerialBus Read/Write Word protocol FLD0, 8, // Virtual register at command value 0. FLD1, 8 // Virtual register at command value 1. }
Field(TOP1, BufferAcc, NoLock, Preserve)
{
Connection(I2CSerialBusV2(0x5a,,100000,,"
\\_SB.I2C",,,,,RawDataBuffer(){1,6})),
AccessAs(BufferAcc, AttribBytes (16)),
FLD2, 8 // Virtual register at command value 0.
}
// Create the GenericSerialBus data buffer
Name(BUFF, Buffer(34){}) // Create GenericSerialBus data buffer as BUFF
CreateByteField(BUFF, 0x00, STAT) // STAT = Status (Byte)
CreateWordField(BUFF, 0x02, DATA) // DATA = Data (Word)
}
本例中的操作区域是在目标控制器设备I2C的范围内定义的。
GenericSerialBus 区域只能通过字段术语访问(请参阅声明字段对象)。 GenericSerialBus 协议在字段定义中使用 AccessAs 术语(参见“ASL 宏”)分配给字段元素。
| 表 5.151 访问器类型值 访问器类型 | 价值 | 描述 |
|---|---|---|
| 快速属性 | 0x02 | 0x02读/写快速协议 |
| 属性发送接收 | 0x04 | 0x04发送/接收字节协议 |
| 属性字节 | 0x06 | 0x06读/写字节协议 |
| 属性词 | 0x08 | 0x08读/写字协议 |
| 属性块 | 0x0A | 0x0A读/写块协议 |
| 属性字节 | 0x0B | 0x0B读/写 N 字节协议 |
| 属性进程调用 | 0x0C | 0x0C进程调用协议 |
| AttribBlockProcessCall | 属性块进程调用0x0D | 0x0D写块-读块进程调用协议 |
| AttribRawBytes | 属性0x0E | 原始读/写 N 字节协议 |
| AttribRawProcessBytes | AttribRawProcessBytes | 0x0F |