27.10.2015 Views

Advanced Configuration and Power Interface Specification

ACPI_6.0

ACPI_6.0

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Advanced</strong> <strong>Configuration</strong> <strong>and</strong> <strong>Power</strong> <strong>Interface</strong> <strong>Specification</strong><br />

OperationRegion(TOP1, GenericSerialBus, 0x00, 0x100) // GenericSerialBus device at comm<strong>and</strong> value<br />

offset 0<br />

Field(TOP1, BufferAcc, NoLock, Preserve)<br />

{<br />

Connection(I2CSerialBus(0x5a,,100000,,"\_SB.I2C",,,,RawDataBuffer(){1,6}))<br />

AccessAs(BufferAcc, AttribWord)// Use the GenericSerialBus Read/Write Word protocol<br />

FLD0, 8, // Virtual register at comm<strong>and</strong> value 0.<br />

FLD1, 8, // Virtual register at comm<strong>and</strong> value 1.<br />

FLD2, 8 // Virtual register at comm<strong>and</strong> value 2.<br />

}<br />

// Create the GenericSerialBus data buffer<br />

Name(BUFF, Buffer(6){})<br />

// Create GenericSerialBus data buffer as BUFF<br />

CreateByteField(BUFF, 0x00, STAT) // STAT = Status (Byte)<br />

CreateWordField(BUFF, 0x02, DATA) // DATA = Data (Word)<br />

// Read two bytes of data from the device using comm<strong>and</strong> value 1<br />

Store(FLD1, BUFF)<br />

// Invoke a Read Word transaction<br />

If(LEqual(STAT, 0x00))<br />

// Successful?<br />

{<br />

// DATA = Word read from FLD1…<br />

}<br />

// Write the word ‘0x5416’ to the device using comm<strong>and</strong> value 2<br />

Store(0x5416, DATA)<br />

// Save 0x5416 into the data buffer<br />

Store(BUFF, FLD2)<br />

// Invoke a Write Word transaction<br />

In this example, three field elements (FLD0, FLD1, <strong>and</strong> FLD2) are defined to represent the virtual<br />

registers for comm<strong>and</strong> values 0, 1, <strong>and</strong> 2. Access to any of the field elements will cause a<br />

GenericSerialBus transaction to occur to the device. Reading FLD1 results in a Read Word with a<br />

comm<strong>and</strong> value of 1, <strong>and</strong> writing to FLD2 results in a Write Word with comm<strong>and</strong> value 2.<br />

Notice that although accessing each field element transmits a word (16 bits) of data, the fields are<br />

listed as 8 bits each. The actual data size is determined by the protocol. Every field element is<br />

declared with a length of 8 bits so that comm<strong>and</strong> values <strong>and</strong> byte offsets are equivalent.<br />

5.5.2.4.5.3.5 Read/Write Block (AttribBlock)<br />

The GenericSerialBus Read/Write Block protocol (AttribBlock) transfers variable-sized data. This<br />

protocol uses a comm<strong>and</strong> value to reference up to 256 block-sized virtual registers.<br />

The following ASL code illustrates how a device supporting the Read/Write Block protocol should<br />

be accessed:<br />

OperationRegion(TOP1, GenericSerialBus, 0x00, 0x100)<br />

Field(TOP1, BufferAcc, NoLock, Preserve)<br />

{<br />

Connection(I2CSerialBus(0x5a,,100000,,"\_SB.I2C",,,,RawDataBuffer(){1,6}))<br />

Offset(0x0),<br />

AccessAs(BufferAcc, AttribBlock),<br />

TFK1, 8,<br />

TFK2, 8<br />

}<br />

236 April, 2015 Version 6.0

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!