您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

98 行
3.0 KiB

  1. /**
  2. *
  3. * \file
  4. *
  5. * \brief This module contains WINC3400 I2C protocol bus APIs implementation.
  6. *
  7. * Copyright (c) 2017-2018 Microchip Technology Inc. and its subsidiaries.
  8. *
  9. * \asf_license_start
  10. *
  11. * \page License
  12. *
  13. * Subject to your compliance with these terms, you may use Microchip
  14. * software and any derivatives exclusively with Microchip products.
  15. * It is your responsibility to comply with third party license terms applicable
  16. * to your use of third party software (including open source software) that
  17. * may accompany Microchip software.
  18. *
  19. * THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES,
  20. * WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE,
  21. * INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY,
  22. * AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL MICROCHIP BE
  23. * LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, INCIDENTAL OR CONSEQUENTIAL
  24. * LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND WHATSOEVER RELATED TO THE
  25. * SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS BEEN ADVISED OF THE
  26. * POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE FULLEST EXTENT
  27. * ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN ANY WAY
  28. * RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
  29. * THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
  30. *
  31. * \asf_license_stop
  32. *
  33. */
  34. #ifndef _NMI2C_H_
  35. #define _NMI2C_H_
  36. #include "common/include/nm_common.h"
  37. /**
  38. * @fn nm_i2c_read_reg
  39. * @brief Read register
  40. * @param [in] u32Addr
  41. * Register address
  42. * @return Register value
  43. */
  44. uint32 nm_i2c_read_reg(uint32 u32Addr);
  45. /**
  46. * @fn nm_i2c_read_reg_with_ret
  47. * @brief Read register with error code return
  48. * @param [in] u32Addr
  49. * Register address
  50. * @param [out] pu32RetVal
  51. * Pointer to u32 variable used to return the read value
  52. * @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure
  53. */
  54. sint8 nm_i2c_read_reg_with_ret(uint32 u32Addr, uint32* pu32RetVal);
  55. /**
  56. * @fn nm_i2c_write_reg
  57. * @brief write register
  58. * @param [in] u32Addr
  59. * Register address
  60. * @param [in] u32Val
  61. * Value to be written to the register
  62. * @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure
  63. */
  64. sint8 nm_i2c_write_reg(uint32 u32Addr, uint32 u32Val);
  65. /**
  66. * @fn nm_i2c_read_block
  67. * @brief Read block of data
  68. * @param [in] u32Addr
  69. * Start address
  70. * @param [out] puBuf
  71. * Pointer to a buffer used to return the read data
  72. * @param [in] u16Sz
  73. * Number of bytes to read. The buffer size must be >= u16Sz
  74. * @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure
  75. */
  76. sint8 nm_i2c_read_block(uint32 u32Addr, uint8 *puBuf, uint16 u16Sz);
  77. /**
  78. * @fn nm_i2c_write_block
  79. * @brief Write block of data
  80. * @param [in] u32Addr
  81. * Start address
  82. * @param [in] puBuf
  83. * Pointer to the buffer holding the data to be written
  84. * @param [in] u16Sz
  85. * Number of bytes to write. The buffer size must be >= u16Sz
  86. * @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure
  87. */
  88. sint8 nm_i2c_write_block(uint32 u32Addr, uint8 *puBuf, uint16 u16Sz);
  89. #endif /* _NMI2C_H_ */