Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 

177 rader
6.3 KiB

  1. /*******************************************************************************
  2. This module contains WINC3400 M2M driver APIs declarations.
  3. File Name:
  4. nmdrv.h
  5. Summary:
  6. This module contains WINC3400 M2M driver APIs declarations.
  7. Description:
  8. This module contains WINC3400 M2M driver APIs declarations.
  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 _NMDRV_H_
  35. #define _NMDRV_H_
  36. #include "nm_common.h"
  37. /*!
  38. @enum \
  39. tenuNmState
  40. @brief
  41. Enumeration for WINC state
  42. The following is used to track the state of the WINC (not initialized, initialized or started)
  43. @remarks
  44. This is useful when putting the WINC in "download mode" to access the flash via SPI. By using
  45. @ref nm_get_state and checking against the desired state, it is possible to validate whether
  46. it is safe to proceed with SPI Flash access.
  47. */
  48. typedef enum {
  49. NM_STATE_DEINIT,
  50. /*!< WINC is not initialized */
  51. NM_STATE_INIT,
  52. /*!< WINC has been initialized. SPI flash access is possible. */
  53. NM_STATE_START,
  54. /*!< WINC has started */
  55. } tenuNmState;
  56. /**
  57. * @struct tstrM2mRev
  58. * @brief Structure holding firmware version parameters and build date/time
  59. */
  60. typedef struct {
  61. uint16_t u16FirmwareHifInfo; /* Fw HIF Info */
  62. uint8_t u8FirmwareMajor; /* Version Major Number */
  63. uint8_t u8FirmwareRsvd; /* Reserved */
  64. uint8_t u8FirmwareMinor; /* Version Minor */
  65. uint8_t u8FirmwarePatch; /* Patch Number */
  66. uint8_t BuildDate[sizeof(__DATE__)]; // 12 bytes
  67. uint8_t BuildTime[sizeof(__TIME__)]; // 9 bytes
  68. } tstrM2mRev;
  69. #ifdef __cplusplus
  70. extern "C" {
  71. #endif
  72. /**
  73. * @fn nm_get_hif_info(uint16_t *pu16FwHifInfo, uint16_t *pu16OtaHifInfo);
  74. * @brief Get Hif info of images in both partitions (Firmware and Ota).
  75. * @param[out] pu16FwHifInfo
  76. * Pointer holding Hif info of image in the active partition.
  77. * @param[out] pu16OtaHifInfo
  78. * Pointer holding Hif info of image in the inactive partition.
  79. * @return @ref M2M_SUCCESS in case of success and Negative error code in case of failure
  80. */
  81. int8_t nm_get_hif_info(uint16_t *pu16FwHifInfo, uint16_t *pu16OtaHifInfo);
  82. /**
  83. * @fn nm_get_firmware_full_info(tstrM2mRev* pstrRev)
  84. * @brief Get Firmware version info
  85. * @param[out] pstrRev
  86. * Pointer holds address of structure @ref tstrM2mRev that contains the version parameters
  87. * of image in the active partition.
  88. * @return @ref M2M_SUCCESS in case of success and Negative error code in case of failure
  89. */
  90. int8_t nm_get_firmware_full_info(tstrM2mRev* pstrRev);
  91. /**
  92. * @fn nm_get_ota_firmware_info(tstrM2mRev* pstrRev)
  93. * @brief Get Firmware version info
  94. * @param[out] pstrRev
  95. * Pointer holds address of structure @ref tstrM2mRev that contains the version parameters
  96. * of image in the inactive partition.
  97. * @return @ref M2M_SUCCESS in case of success and Negative error code in case of failure
  98. */
  99. int8_t nm_get_ota_firmware_info(tstrM2mRev* pstrRev);
  100. /**
  101. * @fn nm_drv_init_download_mode
  102. * @brief Initialize NMC1000 driver in download mode
  103. * @return @ref M2M_SUCCESS in case of success and Negative error code in case of failure
  104. */
  105. int8_t nm_drv_init_download_mode(void);
  106. /**
  107. * @fn nm_drv_init
  108. * @brief Initialize NMC1000 driver
  109. * @param[in] arg
  110. * Generic argument passed on to nm_drv_init_start
  111. * @return @ref M2M_SUCCESS in case of success and Negative error code in case of failure
  112. */
  113. int8_t nm_drv_init(void* arg);
  114. /**
  115. * @fn nm_drv_init_hold
  116. * @brief First part of nm_drv_init, up to the point of initializing spi for flash access.
  117. * @see nm_drv_init
  118. * @return @ref M2M_SUCCESS in case of success and Negative error code in case of failure
  119. */
  120. int8_t nm_drv_init_hold(void);
  121. /**
  122. * @fn nm_drv_init_start
  123. * @brief Second part of nm_drv_init, continuing from where nm_drv_init_hold left off.
  124. * @see nm_drv_init
  125. * @param[in] arg
  126. * Parameter inherited from nm_drv_init
  127. * @return @ref M2M_SUCCESS in case of success and Negative error code in case of failure
  128. */
  129. int8_t nm_drv_init_start(void* arg);
  130. /**
  131. * @fn nm_drv_deinit
  132. * @brief Deinitialize NMC1000 driver
  133. * @param[in] arg
  134. * Generic argument unused.
  135. * @return @ref M2M_SUCCESS in case of success and Negative error code in case of failure
  136. */
  137. int8_t nm_drv_deinit(void* arg);
  138. /**
  139. * @fn nm_cpu_start(void)
  140. * @brief Start CPU from the WINC module
  141. * @return @ref M2M_SUCCESS in case of success and Negative error code in case of failure
  142. */
  143. int8_t nm_cpu_start(void);
  144. /**
  145. * @fn nm_get_state(void)
  146. * @brief Get the current state of the WINC module
  147. * @return The current state of the WINC module
  148. */
  149. tenuNmState nm_get_state(void);
  150. #ifdef __cplusplus
  151. }
  152. #endif
  153. #endif /*_NMDRV_H_*/