Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 
 

120 rindas
3.7 KiB

  1. /**
  2. *
  3. * \file
  4. *
  5. * \brief This module contains WINC3400 UART 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 _NMUART_H_
  35. #define _NMUART_H_
  36. #include "common/include/nm_common.h"
  37. /*
  38. * @fn nm_uart_sync_cmd
  39. * @brief Check COM Port
  40. * @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure
  41. */
  42. sint8 nm_uart_sync_cmd(void);
  43. /**
  44. * @fn nm_uart_read_reg
  45. * @brief Read register
  46. * @param [in] u32Addr
  47. * Register address
  48. * @return Register value
  49. */
  50. uint32 nm_uart_read_reg(uint32 u32Addr);
  51. /**
  52. * @fn nm_uart_reboot_cmd
  53. * @brief Sends a command to the MCU to force the reboot of the WINC
  54. * @return M2M_SUCCESS in case of success and M2M_ERR_BUS_FAIL in case of failure
  55. * @version 1.0
  56. */
  57. sint8 nm_uart_reboot_cmd(void);
  58. /**
  59. * @fn nm_uart_read_reg_with_ret
  60. * @brief Read register with error code return
  61. * @param [in] u32Addr
  62. * Register address
  63. * @param [out] pu32RetVal
  64. * Pointer to u32 variable used to return the read value
  65. * @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure
  66. */
  67. sint8 nm_uart_read_reg_with_ret(uint32 u32Addr, uint32* pu32RetVal);
  68. /**
  69. * @fn nm_uart_write_reg
  70. * @brief write register
  71. * @param [in] u32Addr
  72. * Register address
  73. * @param [in] u32Val
  74. * Value to be written to the register
  75. * @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure
  76. */
  77. sint8 nm_uart_write_reg(uint32 u32Addr, uint32 u32Val);
  78. /**
  79. * @fn nm_uart_read_block
  80. * @brief Read block of data
  81. * @param [in] u32Addr
  82. * Start address
  83. * @param [out] puBuf
  84. * Pointer to a buffer used to return the read data
  85. * @param [in] u16Sz
  86. * Number of bytes to read. The buffer size must be >= u16Sz
  87. * @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure
  88. */
  89. sint8 nm_uart_read_block(uint32 u32Addr, uint8 *puBuf, uint16 u16Sz);
  90. /**
  91. * @fn nm_uart_write_block
  92. * @brief Write block of data
  93. * @param [in] u32Addr
  94. * Start address
  95. * @param [in] puBuf
  96. * Pointer to the buffer holding the data to be written
  97. * @param [in] u16Sz
  98. * Number of bytes to write. The buffer size must be >= u16Sz
  99. * @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure
  100. */
  101. sint8 nm_uart_write_block(uint32 u32Addr, uint8 *puBuf, uint16 u16Sz);
  102. /**
  103. * @fn nm_uart_reconfigure
  104. * @brief Reconfigures the UART interface
  105. * @param [in] ptr
  106. * Pointer to a DWORD containing baudrate at this moment.
  107. * @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure
  108. */
  109. sint8 nm_uart_reconfigure(void *ptr);
  110. #endif /* _NMI2C_H_ */