Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 
 

138 řádky
4.7 KiB

  1. /*******************************************************************************
  2. This module contains WINC3400 bus APIs implementation.
  3. File Name:
  4. nmbus.h
  5. Summary:
  6. This module contains WINC3400 bus APIs implementation.
  7. Description:
  8. This module contains WINC3400 bus APIs implementation.
  9. *******************************************************************************/
  10. //DOM-IGNORE-BEGIN
  11. /*******************************************************************************
  12. * Copyright (C) 2021 Microchip Technology Inc. and its subsidiaries.
  13. *
  14. * Subject to your compliance with these terms, you may use Microchip software
  15. * and any derivatives exclusively with Microchip products. It is your
  16. * responsibility to comply with third party license terms applicable to your
  17. * use of third party software (including open source software) that may
  18. * accompany Microchip software.
  19. *
  20. * THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
  21. * EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED
  22. * WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A
  23. * PARTICULAR PURPOSE.
  24. *
  25. * IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
  26. * INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
  27. * WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS
  28. * BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE
  29. * FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN
  30. * ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
  31. * THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
  32. *******************************************************************************/
  33. // DOM-IGNORE-END
  34. #ifndef _NMBUS_H_
  35. #define _NMBUS_H_
  36. #include "nm_common.h"
  37. #ifdef __cplusplus
  38. extern "C" {
  39. #endif
  40. /**
  41. * @fn nm_bus_iface_init
  42. * @brief Initialize bus interface
  43. * @return @ref M2M_SUCCESS in case of success and @ref M2M_ERR_BUS_FAIL in case of failure
  44. */
  45. int8_t nm_bus_iface_init(void *pvInitVal);
  46. /**
  47. * @fn nm_bus_iface_deinit
  48. * @brief Deinitialize bus interface
  49. * @return @ref M2M_SUCCESS in case of success and @ref M2M_ERR_BUS_FAIL in case of failure
  50. */
  51. int8_t nm_bus_iface_deinit(void);
  52. /**
  53. * @fn nm_bus_reset
  54. * @brief Reset bus interface
  55. * @return @ref M2M_SUCCESS in case of success and @ref M2M_ERR_BUS_FAIL in case of failure
  56. * @version 1.0
  57. */
  58. int8_t nm_bus_reset(void);
  59. /**
  60. * @fn nm_bus_iface_reconfigure
  61. * @brief Reconfigure bus interface
  62. * @return @ref M2M_SUCCESS in case of success and @ref M2M_ERR_BUS_FAIL in case of failure
  63. */
  64. int8_t nm_bus_iface_reconfigure(void *ptr);
  65. /**
  66. * @fn nm_read_reg
  67. * @brief Read register
  68. * @param[in] u32Addr
  69. * Register address
  70. * @return Register value
  71. */
  72. uint32_t nm_read_reg(uint32_t u32Addr);
  73. /**
  74. * @fn nm_read_reg_with_ret
  75. * @brief Read register with error code return
  76. * @param[in] u32Addr
  77. * Register address
  78. * @param[out] pu32RetVal
  79. * Pointer to u32 variable used to return the read value
  80. * @return @ref M2M_SUCCESS in case of success and @ref M2M_ERR_BUS_FAIL in case of failure
  81. */
  82. int8_t nm_read_reg_with_ret(uint32_t u32Addr, uint32_t* pu32RetVal);
  83. /**
  84. * @fn nm_write_reg
  85. * @brief Write register
  86. * @param[in] u32Addr
  87. * Register address
  88. * @param[in] u32Val
  89. * Value to be written to the register
  90. * @return @ref M2M_SUCCESS in case of success and @ref M2M_ERR_BUS_FAIL in case of failure
  91. */
  92. int8_t nm_write_reg(uint32_t u32Addr, uint32_t u32Val);
  93. /**
  94. * @fn nm_read_block
  95. * @brief Read block of data
  96. * @param[in] u32Addr
  97. * Start address
  98. * @param[out] puBuf
  99. * Pointer to a buffer used to return the read data
  100. * @param[in] u32Sz
  101. * Number of bytes to read. The buffer size must be >= u32Sz
  102. * @return @ref M2M_SUCCESS in case of success and @ref M2M_ERR_BUS_FAIL in case of failure
  103. */
  104. int8_t nm_read_block(uint32_t u32Addr, uint8_t *puBuf, uint32_t u32Sz);
  105. /**
  106. * @fn nm_write_block
  107. * @brief Write block of data
  108. * @param[in] u32Addr
  109. * Start address
  110. * @param[in] puBuf
  111. * Pointer to the buffer holding the data to be written
  112. * @param[in] u32Sz
  113. * Number of bytes to write. The buffer size must be >= u32Sz
  114. * @return @ref M2M_SUCCESS in case of success and @ref M2M_ERR_BUS_FAIL in case of failure
  115. */
  116. int8_t nm_write_block(uint32_t u32Addr, uint8_t *puBuf, uint32_t u32Sz);
  117. #ifdef __cplusplus
  118. }
  119. #endif
  120. #endif /* _NMBUS_H_ */