#ifndef __CB_BDK_TWSI_H__ #define __CB_BDK_TWSI_H__ /***********************license start*********************************** * Copyright (c) 2003-2017 Cavium Inc. (support@cavium.com). All rights * reserved. * * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * * * Neither the name of Cavium Inc. nor the names of * its contributors may be used to endorse or promote products * derived from this software without specific prior written * permission. * * This Software, including technical data, may be subject to U.S. export * control laws, including the U.S. Export Administration Act and its * associated regulations, and may be subject to export or import * regulations in other countries. * * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS" * AND WITH ALL FAULTS AND CAVIUM INC. MAKES NO PROMISES, REPRESENTATIONS OR * WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT * TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY * REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT * DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES * OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR * PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, * QUIET POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE ENTIRE RISK * ARISING OUT OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU. ***********************license end**************************************/ /** * @file * * Interface to the TWSI / I2C bus * * Note: Currently on 7 bit device addresses are supported * *
$Revision: 49448 $
* * @addtogroup hal * @{ */ #include /** * Do a twsi read from a 7 bit device address using an (optional) * internal address. Up to 4 bytes can be read at a time. * * @param node Node to use in a Numa setup. Can be an exact ID or a special * value. * @param twsi_id which TWSI bus to use * @param dev_addr Device address (7 bit) * @param internal_addr * Internal address. Can be 0, 1 or 2 bytes in width * @param num_bytes Number of data bytes to read (1-4) * @param ia_width_bytes * Internal address size in bytes (0, 1, or 2) * * @return Read data, or -1 on failure */ extern int64_t bdk_twsix_read_ia(bdk_node_t node, int twsi_id, uint8_t dev_addr, uint16_t internal_addr, int num_bytes, int ia_width_bytes); /** * Write 1-8 bytes to a TWSI device using an internal address. * * @param node Node to use in a Numa setup. Can be an exact ID or a special * value. * @param twsi_id which TWSI interface to use * @param dev_addr TWSI device address (7 bit only) * @param internal_addr * TWSI internal address (0, 8, or 16 bits) * @param num_bytes Number of bytes to write (1-8) * @param ia_width_bytes * internal address width, in bytes (0, 1, 2) * @param data Data to write. Data is written MSB first on the twsi bus, and * only the lower num_bytes bytes of the argument are valid. (If * a 2 byte write is done, only the low 2 bytes of the argument is * used. * * @return Zero on success, -1 on error */ extern int bdk_twsix_write_ia(bdk_node_t node, int twsi_id, uint8_t dev_addr, uint16_t internal_addr, int num_bytes, int ia_width_bytes, uint64_t data); /** @} */ #endif /* !__CB_BDK_TWSI_H__ */