27.10.2015 Views

Advanced Configuration and Power Interface Specification

ACPI_6.0

ACPI_6.0

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

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

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

be accessed:<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, AttribQuick) // Use the GenericSerialBus Read/Write Quick protocol<br />

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

}<br />

/* Create the GenericSerialBus data buffer */<br />

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

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

/* Signal device (e.g. OFF) */<br />

Store(FLD0, BUFF)<br />

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

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

// STAT = Status (Byte)<br />

// Invoke Read Quick transaction<br />

// Successful?<br />

/* Signal device (e.g. ON) */<br />

Store(BUFF, FLD0)<br />

// Invoke Write Quick transaction<br />

In this example, a single field element (FLD0) at offset 0 is defined to represent the protocol’s read/<br />

write bit. Access to FLD0 will cause a GenericSerialBus transaction to occur to the device. Reading<br />

the field results in a Read Quick, <strong>and</strong> writing to the field results in a Write Quick. In either case data<br />

is not transferred—access to the register is simply used as a mechanism to invoke the transaction.<br />

5.5.2.4.5.3.2 Send/Receive Byte (AttribSendReceive)<br />

The GenericSerialBus Send/Receive Byte protocol (AttribSendReceive) transfers a single byte of<br />

data. Like Read/Write Quick, comm<strong>and</strong> values are not used by this protocol <strong>and</strong> thus only a single<br />

element (at offset 0) can be specified in the field definition.<br />

The following ASL code illustrates how a device supporting the Send/Receive Byte protocol should<br />

be accessed:<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, AttribSendReceive) // Use the GenericSerialBus Send/Receive Byte protocol<br />

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

}<br />

// Create the GenericSerialBus data buffer<br />

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

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

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

CreateByteField(BUFF, 0x02, DATA) // DATA = Data (Byte)<br />

// Receive a byte of data from the device<br />

Store(FLD0, BUFF)<br />

// Invoke a Receive Byte transaction<br />

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

// Successful?<br />

{<br />

// DATA = Received byte…<br />

}<br />

234 April, 2015 Version 6.0

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

Saved successfully!

Ooh no, something went wrong!