From 9af02ab015acdf9abf73df357d50bee9703a2aad Mon Sep 17 00:00:00 2001 From: "Matt K. Light" Date: Fri, 13 Jul 2018 11:17:29 -0500 Subject: fapi2 i2c dox update Change-Id: I9383a13e9a6b19dd30a423877c11c6aed95da5f4 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/62411 Reviewed-by: ANDRE A. MARIN Reviewed-by: STEPHEN GLANCY Tested-by: Jenkins Server Reviewed-by: Jennifer A. Stofer Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/65496 Tested-by: Jenkins OP Build CI Tested-by: FSP CI Jenkins Tested-by: Jenkins OP HW Reviewed-by: Christian R. Geddes --- src/import/hwpf/fapi2/include/fapi2_i2c_access.H | 25 ++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/import/hwpf') diff --git a/src/import/hwpf/fapi2/include/fapi2_i2c_access.H b/src/import/hwpf/fapi2/include/fapi2_i2c_access.H index be6d26f15..b02b5a863 100644 --- a/src/import/hwpf/fapi2/include/fapi2_i2c_access.H +++ b/src/import/hwpf/fapi2/include/fapi2_i2c_access.H @@ -41,6 +41,22 @@ namespace fapi2 { /// @brief Reads data via i2c from the target +/// +/// Example use (seeprom read 8 bytes w/ 2-byte address: 0x01B0): +/// std::vector addr = {0x01, 0xB0}; +/// std::vector data; +/// size_t len = 8; +/// FAPI_TRY(getI2c(target, len, addr, data)); +/// data should contain the 8 bytes starting at address 0x01B0 +/// +/// Example use (smbus read 5 bytes w/ 1-byte command: 0x02): +/// std::vector command = {0x02}; +/// std::vector data; +/// size_t len = 5; +/// FAPI_TRY(getI2c(target, len, command, data)); +/// data should contain 5 bytes, first byte with the data length(4) +/// remaining four bytes will be the data requested from the command +/// /// @tparam K the type (Kind) of target, from i_target /// @tparam V the type of the target's Value, from i_target /// @param[in] i_target HW target to operate on. @@ -57,6 +73,15 @@ inline ReturnCode getI2c(const Target& i_target, std::vector& o_data); /// @brief Writes data via i2c to the target. +/// +/// Example use (seeprom write 4 bytes of zeros w/ 2-byte address: 0x0208): +/// std::vector addr_data = {0x02, 0x08, 0x00, 0x00, 0x00, 0x00}; +/// FAPI_TRY(getI2c(target, addr_data)); +/// +/// Example use (smbus write 1 data length byte + 4 bytes of zeros w/ 1-byte command: 0x01): +/// std::vector command_data = {0x01, 0x04, 0x00, 0x00, 0x00, 0x00}; +/// FAPI_TRY(getI2c(target, command_data)); +/// /// @tparam K the type (Kind) of target, from i_target /// @tparam V the type of the target's Value, from i_target /// @param[in] i_target HW target to operate on. -- cgit v1.2.1