]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Include/Library/SmbusLib.h
Use doxygen comment style for document entity such as struct, enum, variable that...
[mirror_edk2.git] / MdePkg / Include / Library / SmbusLib.h
index 55aae1211ed677995ed33f77aeb63bad98f0c0e4..c59f0bb4cf334944f2febbe9f4fa10f3193be459 100644 (file)
@@ -1,22 +1,25 @@
 /** @file\r
-       SMBUS Functions\r
+  SMBUS Functions\r
 \r
-       Copyright (c) 2006, Intel Corporation\r
-       All rights reserved. This program and the accompanying materials\r
-       are licensed and made available under the terms and conditions of the BSD License\r
-       which accompanies this distribution.  The full text of the license may be found at\r
-       http://opensource.org/licenses/bsd-license.php\r
+  Copyright (c) 2006, Intel Corporation\r
+  All rights reserved. This program and the accompanying materials\r
+  are licensed and made available under the terms and conditions of the BSD License\r
+  which accompanies this distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php\r
 \r
-       THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-       WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
-       Module Name:    SmbusLib.h\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
 **/\r
 \r
 #ifndef __SMBUS_LIB__\r
 #define __SMBUS_LIB__\r
 \r
+///\r
+/// PEC BIT is bit 22 in SMBUS address\r
+///\r
+#define SMBUS_LIB_PEC_BIT   (1 << 22)\r
+\r
 /**\r
   Macro that converts SMBUS slave address, SMBUS command, SMBUS data length,\r
   and PEC to a value that can be passed to the SMBUS Library functions.\r
 \r
 **/\r
 #define SMBUS_LIB_ADDRESS(SlaveAddress,Command,Length,Pec)  \\r
-  ( ((Pec) ? MAX_BIT : 0)          | \\r
-    (((SlaveAddress) & 0x7f) << 1) | \\r
-    (((Command) & 0xff) << 8)      | \\r
-    (((Length) & 0x1f) << 16)        \\r
+  ( ((Pec) ? SMBUS_LIB_PEC_BIT: 0)      | \\r
+    (((SlaveAddress) & 0x7f) << 1)      | \\r
+    (((Command)      & 0xff) << 8)      | \\r
+    (((Length)       & 0x3f) << 16)       \\r
   )\r
 \r
 /**\r
@@ -60,8 +63,7 @@ EFIAPI
 SmBusQuickRead (\r
   IN  UINTN                     SmBusAddress,\r
   OUT RETURN_STATUS             *Status       OPTIONAL\r
-  )\r
-;\r
+  );\r
 \r
 /**\r
   Executes an SMBUS quick write command.\r
@@ -80,13 +82,12 @@ SmBusQuickRead (
                           This is an optional parameter and may be NULL.\r
 \r
 **/\r
-BOOLEAN\r
+VOID\r
 EFIAPI\r
 SmBusQuickWrite (\r
   IN  UINTN                     SmBusAddress,\r
   OUT RETURN_STATUS             *Status       OPTIONAL\r
-  )\r
-;\r
+  );\r
 \r
 /**\r
   Executes an SMBUS receive byte command.\r
@@ -112,8 +113,7 @@ EFIAPI
 SmBusReceiveByte (\r
   IN  UINTN          SmBusAddress,\r
   OUT RETURN_STATUS  *Status        OPTIONAL\r
-  )\r
-;\r
+  );\r
 \r
 /**\r
   Executes an SMBUS send byte command.\r
@@ -141,8 +141,7 @@ SmBusSendByte (
   IN  UINTN          SmBusAddress,\r
   IN  UINT8          Value,\r
   OUT RETURN_STATUS  *Status        OPTIONAL\r
-  )\r
-;\r
+  );\r
 \r
 /**\r
   Executes an SMBUS read data byte command.\r
@@ -167,8 +166,7 @@ EFIAPI
 SmBusReadDataByte (\r
   IN  UINTN          SmBusAddress,\r
   OUT RETURN_STATUS  *Status        OPTIONAL\r
-  )\r
-;\r
+  );\r
 \r
 /**\r
   Executes an SMBUS write data byte command.\r
@@ -196,8 +194,7 @@ SmBusWriteDataByte (
   IN  UINTN          SmBusAddress,\r
   IN  UINT8          Value,\r
   OUT RETURN_STATUS  *Status        OPTIONAL\r
-  )\r
-;\r
+  );\r
 \r
 /**\r
   Executes an SMBUS read data word command.\r
@@ -222,8 +219,7 @@ EFIAPI
 SmBusReadDataWord (\r
   IN  UINTN          SmBusAddress,\r
   OUT RETURN_STATUS  *Status        OPTIONAL\r
-  )\r
-;\r
+  );\r
 \r
 /**\r
   Executes an SMBUS write data word command.\r
@@ -251,8 +247,7 @@ SmBusWriteDataWord (
   IN  UINTN          SmBusAddress,\r
   IN  UINT16         Value,\r
   OUT RETURN_STATUS  *Status        OPTIONAL\r
-  )\r
-;\r
+  );\r
 \r
 /**\r
   Executes an SMBUS process call command.\r
@@ -280,8 +275,7 @@ SmBusProcessCall (
   IN  UINTN          SmBusAddress,\r
   IN  UINT16         Value,\r
   OUT RETURN_STATUS  *Status        OPTIONAL\r
-  )\r
-;\r
+  );\r
 \r
 /**\r
   Executes an SMBUS read block command.\r
@@ -291,7 +285,7 @@ SmBusProcessCall (
   Bytes are read from the SMBUS and stored in Buffer.\r
   The number of bytes read is returned, and will never return a value larger than 32-bytes.\r
   If Status is not NULL, then the status of the executed command is returned in Status.\r
-  It is the caller¡¯s responsibility to make sure Buffer is large enough for the total number of bytes read.\r
+  It is the caller's responsibility to make sure Buffer is large enough for the total number of bytes read.\r
   SMBUS supports a maximum transfer size of 32 bytes, so Buffer does not need to be any larger than 32 bytes.\r
   If Length in SmBusAddress is not zero, then ASSERT().\r
   If Buffer is NULL, then ASSERT().\r
@@ -312,8 +306,7 @@ SmBusReadBlock (
   IN  UINTN          SmBusAddress,\r
   OUT VOID           *Buffer,\r
   OUT RETURN_STATUS  *Status        OPTIONAL\r
-  )\r
-;\r
+  );\r
 \r
 /**\r
   Executes an SMBUS write block command.\r
@@ -342,27 +335,26 @@ SmBusWriteBlock (
   IN  UINTN          SmBusAddress,\r
   OUT VOID           *Buffer,\r
   OUT RETURN_STATUS  *Status        OPTIONAL\r
-  )\r
-;\r
+  );\r
 \r
 /**\r
   Executes an SMBUS block process call command.\r
 \r
   Executes an SMBUS block process call command on the SMBUS device specified by SmBusAddress.\r
   The SMBUS slave address, SMBUS command, and SMBUS length fields of SmBusAddress are required.\r
-  Bytes are written to the SMBUS from OutBuffer.  Bytes are then read from the SMBUS into InBuffer.\r
+  Bytes are written to the SMBUS from WriteBuffer.  Bytes are then read from the SMBUS into ReadBuffer.\r
   If Status is not NULL, then the status of the executed command is returned in Status.\r
-  It is the caller¡¯s responsibility to make sure InBuffer is large enough for the total number of bytes read.\r
+  It is the caller's responsibility to make sure ReadBuffer is large enough for the total number of bytes read.\r
   SMBUS supports a maximum transfer size of 32 bytes, so Buffer does not need to be any larger than 32 bytes.\r
-  If OutBuffer is NULL, then ASSERT().\r
-  If InBuffer is NULL, then ASSERT().\r
+  If Length in SmBusAddress is zero or greater than 32, then ASSERT().\r
+  If WriteBuffer is NULL, then ASSERT().\r
+  If ReadBuffer is NULL, then ASSERT().\r
   If any reserved bits of SmBusAddress are set, then ASSERT().\r
 \r
-\r
   @param  SmBusAddress    Address that encodes the SMBUS Slave Address,\r
                           SMBUS Command, SMBUS Data Length, and PEC.\r
-  @param  OutBuffer       Pointer to the buffer of bytes to write to the SMBUS.\r
-  @param  InBuffer        Pointer to the buffer of bytes to read from the SMBUS.\r
+  @param  WriteBuffer     Pointer to the buffer of bytes to write to the SMBUS.\r
+  @param  ReadBuffer      Pointer to the buffer of bytes to read from the SMBUS.\r
   @param  Status          Return status for the executed command.\r
                           This is an optional parameter and may be NULL.\r
 \r
@@ -373,102 +365,10 @@ UINTN
 EFIAPI\r
 SmBusBlockProcessCall (\r
   IN  UINTN          SmBusAddress,\r
-  OUT VOID           *OutBuffer,\r
-  OUT VOID           *InBuffer,\r
+  IN  VOID           *WriteBuffer,\r
+  OUT VOID           *ReadBuffer,\r
   OUT RETURN_STATUS  *Status        OPTIONAL\r
-  )\r
-;\r
-\r
-/**\r
-  Enumerates the SMBUS and assigns slave addresses.\r
-\r
-  Executes the SMBUS enumeration algorithm and assigns a valid address to all SMBUS slave devices.\r
-  The total number of SMBUS slave devices detected is returned.\r
-  The status of the executed command is returned.\r
-  If Slave Address in SmBusAddress is not zero, then ASSERT().\r
-  If Command in SmBusAddress is not zero, then ASSERT().\r
-  If Length in SmBusAddress is not zero, then ASSERT().\r
-  If PEC in SmBusAddress is set, then ASSERT().\r
-  If any reserved bits of SmBusAddress are set, then ASSERT().\r
-\r
-  @param  SmBusAddress        Address that encodes the SMBUS Slave Address,\r
-                              SMBUS Command, SMBUS Data Length, and PEC.\r
-\r
-  @retval RETURN_SUCCESS      The SMBUS command was executed.\r
-  @retval RETURN_TIMEOUT      A timeout occurred while executing the SMBUS command.\r
-  @retval RETURN_DEVICE_ERROR The request was not completed because a failure reflected\r
-                              in the Host Status Register bit.\r
-                              Device errors are a result of a transaction collision, illegal command field,\r
-                              unclaimed cycle (host initiated), or bus errors (collisions).\r
-\r
-**/\r
-RETURN_STATUS\r
-EFIAPI\r
-SmBusArpAll (\r
-  IN UINTN  SmBusAddress\r
-  )\r
-;\r
-\r
-/**\r
-  Assigns an SMBUS slave addresses.\r
-\r
-  Assigns the SMBUS device specified by Uuid the slave address specified by SmBusAddress.\r
-  The status of the executed command is returned.\r
-  If Command in SmBusAddress is not zero, then ASSERT().\r
-  If Length in SmBusAddress is not zero, then ASSERT().\r
-  If PEC in SmBusAddress is set, then ASSERT().\r
-  If any reserved bits of SmBusAddress are set, then ASSERT().\r
-\r
-  @param  SmBusAddress        Address that encodes the SMBUS Slave Address,\r
-                              SMBUS Command, SMBUS Data Length, and PEC.\r
-  @param  Uuid                Pointer to the UUID of the device to assign a slave address.\r
-\r
-  @retval RETURN_SUCCESS      The SMBUS command was executed.\r
-  @retval RETURN_TIMEOUT      A timeout occurred while executing the SMBUS command.\r
-  @retval RETURN_DEVICE_ERROR The request was not completed because a failure reflected\r
-                              in the Host Status Register bit.\r
-                              Device errors are a result of a transaction collision, illegal command field,\r
-                              unclaimed cycle (host initiated), or bus errors (collisions).\r
-\r
-**/\r
-RETURN_STATUS\r
-EFIAPI\r
-SmBusArpDevice (\r
-  IN UINTN       SmBusAddress,\r
-  IN CONST GUID  *Uuid\r
-  )\r
-;\r
-\r
-/**\r
-  Retrieves the UUID associated with an SMBUS slave device.\r
+  );\r
 \r
-  Retrieves the UUID associated with the slave address specified\r
-  by SmBusAddress and returns the UUID in Uuid.\r
-  The status of the executed command is returned.\r
-  If Command in SmBusAddress is not zero, then ASSERT().\r
-  If Length in SmBusAddress is not zero, then ASSERT().\r
-  If PEC in SmBusAddress is set, then ASSERT().\r
-  If Uuid is NULL, then ASSERT().\r
-  If any reserved bits of SmBusAddress are set, then ASSERT().\r
-\r
-  @param  SmBusAddress        Address that encodes the SMBUS Slave Address,\r
-                              SMBUS Command, SMBUS Data Length, and PEC.\r
-  @param  Uuid                Pointer to the UUID retrieved from the SMBUS slave device.\r
-\r
-  @retval RETURN_SUCCESS      The SMBUS command was executed.\r
-  @retval RETURN_TIMEOUT      A timeout occurred while executing the SMBUS command.\r
-  @retval RETURN_DEVICE_ERROR The request was not completed because a failure reflected\r
-                              in the Host Status Register bit.\r
-                              Device errors are a result of a transaction collision, illegal command field,\r
-                              unclaimed cycle (host initiated), or bus errors (collisions).\r
-\r
-**/\r
-RETURN_STATUS\r
-EFIAPI\r
-SmBusGetUuid (\r
-  IN  UINTN  SmBusAddress,\r
-  OUT GUID   *Uuid\r
-  )\r
-;\r
 \r
 #endif\r