- InternalSmBusQuick (SmBusAddress | SMBUS_B_WRITE, Status);\r
-}\r
-\r
-/**\r
- Executes an SMBUS byte or word command.\r
-\r
- This internal function executes an .\r
- Only the SMBUS slave address field of SmBusAddress is required.\r
- If Status is not NULL, then the status of the executed command is returned in Status.\r
-\r
- @param HostControl The value of Host Control Register to set. \r
- @param SmBusAddress Address that encodes the SMBUS Slave Address,\r
- SMBUS Command, SMBUS Data Length, and PEC.\r
- @param Value The byte/word write to the SMBUS.\r
- @param Status Return status for the executed command.\r
- This is an optional parameter and may be NULL.\r
-\r
- @return The byte/word read from the SMBUS.\r
-\r
-**/\r
-UINT16\r
-InternalSmBusByteWord (\r
- IN UINT8 HostControl,\r
- IN UINTN SmBusAddress,\r
- IN UINT16 Value,\r
- OUT RETURN_STATUS *Status\r
- )\r
-{\r
- RETURN_STATUS ReturnStatus;\r
- UINT8 AuxiliaryControl;\r
-\r
- ReturnStatus = InternalSmBusAcquire ();\r
- if (RETURN_ERROR (ReturnStatus)) {\r
- goto Done;\r
- }\r
-\r
- AuxiliaryControl = 0;\r
- if (SMBUS_LIB_PEC (SmBusAddress)) {\r
- AuxiliaryControl |= SMBUS_B_AAC;\r
- HostControl |= SMBUS_B_PEC_EN;\r
- }\r
- \r
- //\r
- // Set commond register\r
- //\r
- InternalSmBusIoWrite8 (SMBUS_R_HST_CMD, (UINT8) SMBUS_LIB_COMMAND (SmBusAddress));\r
-\r
- InternalSmBusIoWrite8 (SMBUS_R_HST_D0, (UINT8) Value);\r
- InternalSmBusIoWrite8 (SMBUS_R_HST_D1, (UINT8) (Value >> 8));\r
-\r
- //\r
- // Set Auxiliary Control Regiester.\r
- //\r
- InternalSmBusIoWrite8 (SMBUS_R_AUX_CTL, AuxiliaryControl);\r
- //\r
- // Set SMBus slave address for the device to send/receive from.\r
- //\r
- InternalSmBusIoWrite8 (SMBUS_R_XMIT_SLVA, (UINT8) SmBusAddress);\r
- //\r
- // Set Control Register (Initiate Operation, Interrupt disabled)\r
- //\r
- InternalSmBusIoWrite8 (SMBUS_R_HST_CTL, HostControl + SMBUS_B_START);\r
-\r
- //\r
- // Wait for the end\r
- //\r
- ReturnStatus = InternalSmBusWait ();\r
- \r
- Value = InternalSmBusIoRead8 (SMBUS_R_HST_D1) << 8;\r
- Value |= InternalSmBusIoRead8 (SMBUS_R_HST_D0);\r
-\r
- //\r
- // Clear status register and exit\r
- //\r
- InternalSmBusIoWrite8 (SMBUS_R_HST_STS, SMBUS_B_HSTS_ALL);;\r
-\r
-Done:\r
- if (Status != NULL) {\r
- *Status = ReturnStatus;\r
- }\r
-\r
- return Value;\r