Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 

133 righe
3.7 KiB

  1. /**
  2. *
  3. * \file
  4. *
  5. * \brief This module contains WINC3400 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 _NMBUS_H_
  35. #define _NMBUS_H_
  36. #include "common/include/nm_common.h"
  37. #include "bus_wrapper/include/nm_bus_wrapper.h"
  38. #ifdef __cplusplus
  39. extern "C"{
  40. #endif
  41. /**
  42. * @fn nm_bus_iface_init
  43. * @brief Initialize bus interface
  44. * @return M2M_SUCCESS in case of success and M2M_ERR_BUS_FAIL in case of failure
  45. */
  46. sint8 nm_bus_iface_init(uint8 *pvInitVal, uint32 req_serial_number);
  47. /**
  48. * @fn nm_bus_iface_deinit
  49. * @brief Deinitialize bus interface
  50. * @return M2M_SUCCESS in case of success and M2M_ERR_BUS_FAIL in case of failure
  51. */
  52. sint8 nm_bus_iface_deinit(void);
  53. /**
  54. * @fn nm_bus_iface_reconfigure
  55. * @brief reconfigure bus interface
  56. * @return M2M_SUCCESS in case of success and M2M_ERR_BUS_FAIL in case of failure
  57. */
  58. sint8 nm_bus_iface_reconfigure(void *ptr);
  59. /**
  60. * @fn nm_read_reg
  61. * @brief Read register
  62. * @param [in] u32Addr
  63. * Register address
  64. * @return Register value
  65. */
  66. uint32 nm_read_reg(uint32 u32Addr);
  67. /**
  68. * @fn nm_read_reg_with_ret
  69. * @brief Read register with error code return
  70. * @param [in] u32Addr
  71. * Register address
  72. * @param [out] pu32RetVal
  73. * Pointer to u32 variable used to return the read value
  74. * @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure
  75. */
  76. sint8 nm_read_reg_with_ret(uint32 u32Addr, uint32* pu32RetVal);
  77. /**
  78. * @fn nm_write_reg
  79. * @brief write register
  80. * @param [in] u32Addr
  81. * Register address
  82. * @param [in] u32Val
  83. * Value to be written to the register
  84. * @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure
  85. */
  86. sint8 nm_write_reg(uint32 u32Addr, uint32 u32Val);
  87. /**
  88. * @fn nm_read_block
  89. * @brief Read block of data
  90. * @param [in] u32Addr
  91. * Start address
  92. * @param [out] puBuf
  93. * Pointer to a buffer used to return the read data
  94. * @param [in] u32Sz
  95. * Number of bytes to read. The buffer size must be >= u32Sz
  96. * @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure
  97. */
  98. sint8 nm_read_block(uint32 u32Addr, uint8 *puBuf, uint32 u32Sz);
  99. /**
  100. * @fn nm_write_block
  101. * @brief Write block of data
  102. * @param [in] u32Addr
  103. * Start address
  104. * @param [in] puBuf
  105. * Pointer to the buffer holding the data to be written
  106. * @param [in] u32Sz
  107. * Number of bytes to write. The buffer size must be >= u32Sz
  108. * @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure
  109. */
  110. sint8 nm_write_block(uint32 u32Addr, uint8 *puBuf, uint32 u32Sz);
  111. #ifdef __cplusplus
  112. }
  113. #endif
  114. #endif /* _NMBUS_H_ */