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

219 行
5.4 KiB

  1. /**
  2. *
  3. * \file
  4. *
  5. * \brief This module contains NMC1500 ASIC specific internal APIs.
  6. *
  7. * Copyright (c) 2015 - 2017 Atmel Corporation. All rights reserved.
  8. *
  9. * \asf_license_start
  10. *
  11. * \page License
  12. *
  13. * Redistribution and use in source and binary forms, with or without
  14. * modification, are permitted provided that the following conditions are met:
  15. *
  16. * 1. Redistributions of source code must retain the above copyright notice,
  17. * this list of conditions and the following disclaimer.
  18. *
  19. * 2. Redistributions in binary form must reproduce the above copyright notice,
  20. * this list of conditions and the following disclaimer in the documentation
  21. * and/or other materials provided with the distribution.
  22. *
  23. * 3. The name of Atmel may not be used to endorse or promote products derived
  24. * from this software without specific prior written permission.
  25. *
  26. * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
  27. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  28. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
  29. * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
  30. * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  31. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  32. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  33. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  34. * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
  35. * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  36. * POSSIBILITY OF SUCH DAMAGE.
  37. *
  38. * \asf_license_stop
  39. *
  40. */
  41. #ifndef _NMASIC_H_
  42. #define _NMASIC_H_
  43. #include "common/include/nm_common.h"
  44. #define NMI_PERIPH_REG_BASE 0x1000
  45. #define NMI_CHIPID (NMI_PERIPH_REG_BASE)
  46. #define rNMI_GP_REG_0 (0x149c)
  47. #define rNMI_GP_REG_1 (0x14A0)
  48. #define rNMI_GP_REG_2 (0xc0008)
  49. #define rNMI_GLB_RESET (0x1400)
  50. #define rNMI_BOOT_RESET_MUX (0x1118)
  51. #define NMI_STATE_REG (0x108c)
  52. #define BOOTROM_REG (0xc000c)
  53. #define NMI_REV_REG (0x207ac) /*Also, Used to load ATE firmware from SPI Flash and to ensure that it is running too*/
  54. #define NMI_REV_REG_ATE (0x1048) /*Revision info register in case of ATE FW*/
  55. #define M2M_WAIT_FOR_HOST_REG (0x207bc)
  56. #define M2M_FINISH_INIT_STATE 0x02532636UL
  57. #define M2M_FINISH_BOOT_ROM 0x10add09eUL
  58. #define M2M_START_FIRMWARE 0xef522f61UL
  59. #define M2M_START_PS_FIRMWARE 0x94992610UL
  60. #define M2M_ATE_FW_START_VALUE (0x3C1CD57D) /*Also, Change this value in boot_firmware if it will be changed here*/
  61. #define M2M_ATE_FW_IS_UP_VALUE \
  62. (0xD75DC1C3) /*Also, Change this value in ATE (Burst) firmware if it will be changed here*/
  63. #define REV_2B0 (0x2B0)
  64. #define REV_B0 (0x2B0)
  65. #define REV_3A0 (0x3A0)
  66. #define GET_CHIPID() nmi_get_chipid()
  67. #define ISNMC1000(id) ((((id)&0xfffff000) == 0x100000) ? 1 : 0)
  68. #define ISNMC1500(id) ((((id)&0xfffff000) == 0x150000) ? 1 : 0)
  69. #define ISNMC3000(id) ((((id)&0xfff00000) == 0x300000) ? 1 : 0)
  70. #define REV(id) (((id)&0x00000fff))
  71. #define EFUSED_MAC(value) (value & 0xffff0000)
  72. #define rHAVE_SDIO_IRQ_GPIO_BIT (NBIT0)
  73. #define rHAVE_USE_PMU_BIT (NBIT1)
  74. #define rHAVE_SLEEP_CLK_SRC_RTC_BIT (NBIT2)
  75. #define rHAVE_SLEEP_CLK_SRC_XO_BIT (NBIT3)
  76. #define rHAVE_EXT_PA_INV_TX_RX (NBIT4)
  77. #define rHAVE_LEGACY_RF_SETTINGS (NBIT5)
  78. #define rHAVE_LOGS_DISABLED_BIT (NBIT6)
  79. #define rHAVE_ETHERNET_MODE_BIT (NBIT7)
  80. #define rHAVE_RESERVED1_BIT (NBIT8)
  81. #define rHAVE_RESERVED2_BIT (NBIT9)
  82. #define rHAVE_XO_XTALGM2_DIS_BIT (NBIT10)
  83. typedef struct {
  84. uint32 u32Mac_efuse_mib;
  85. uint32 u32Firmware_Ota_rev;
  86. } tstrGpRegs;
  87. #ifdef __cplusplus
  88. extern "C" {
  89. #endif
  90. /*
  91. * @fn cpu_halt
  92. * @brief
  93. */
  94. sint8 cpu_halt(void);
  95. /*
  96. * @fn chip_sleep
  97. * @brief
  98. */
  99. sint8 chip_sleep(void);
  100. /*
  101. * @fn chip_wake
  102. * @brief
  103. */
  104. sint8 chip_wake(void);
  105. /*
  106. * @fn chip_idle
  107. * @brief
  108. */
  109. void chip_idle(void);
  110. /*
  111. * @fn enable_interrupts
  112. * @brief
  113. */
  114. sint8 enable_interrupts(void);
  115. /*
  116. * @fn cpu_start
  117. * @brief
  118. */
  119. sint8 cpu_start(void);
  120. /*
  121. * @fn nmi_get_chipid
  122. * @brief
  123. */
  124. uint32 nmi_get_chipid(void);
  125. /*
  126. * @fn nmi_get_rfrevid
  127. * @brief
  128. */
  129. uint32 nmi_get_rfrevid(void);
  130. /*
  131. * @fn restore_pmu_settings_after_global_reset
  132. * @brief
  133. */
  134. void restore_pmu_settings_after_global_reset(void);
  135. /*
  136. * @fn nmi_update_pll
  137. * @brief
  138. */
  139. void nmi_update_pll(void);
  140. /*
  141. * @fn nmi_set_sys_clk_src_to_xo
  142. * @brief
  143. */
  144. void nmi_set_sys_clk_src_to_xo(void);
  145. /*
  146. * @fn chip_reset
  147. * @brief
  148. */
  149. sint8 chip_reset(void);
  150. /*
  151. * @fn wait_for_bootrom
  152. * @brief
  153. */
  154. sint8 wait_for_bootrom(uint8);
  155. /*
  156. * @fn wait_for_firmware_start
  157. * @brief
  158. */
  159. sint8 wait_for_firmware_start(uint8);
  160. /*
  161. * @fn chip_deinit
  162. * @brief
  163. */
  164. sint8 chip_deinit(void);
  165. /*
  166. * @fn chip_reset_and_cpu_halt
  167. * @brief
  168. */
  169. sint8 chip_reset_and_cpu_halt(void);
  170. /*
  171. * @fn set_gpio_dir
  172. * @brief
  173. */
  174. sint8 set_gpio_dir(uint8 gpio, uint8 dir);
  175. /*
  176. * @fn set_gpio_val
  177. * @brief
  178. */
  179. sint8 set_gpio_val(uint8 gpio, uint8 val);
  180. /*
  181. * @fn get_gpio_val
  182. * @brief
  183. */
  184. sint8 get_gpio_val(uint8 gpio, uint8 *val);
  185. /*
  186. * @fn pullup_ctrl
  187. * @brief
  188. */
  189. sint8 pullup_ctrl(uint32 pinmask, uint8 enable);
  190. /*
  191. * @fn nmi_get_otp_mac_address
  192. * @brief
  193. */
  194. sint8 nmi_get_otp_mac_address(uint8 *pu8MacAddr, uint8 *pu8IsValid);
  195. /*
  196. * @fn nmi_get_mac_address
  197. * @brief
  198. */
  199. sint8 nmi_get_mac_address(uint8 *pu8MacAddr);
  200. /*
  201. * @fn chip_apply_conf
  202. * @brief
  203. */
  204. sint8 chip_apply_conf(uint32 u32conf);
  205. #ifdef __cplusplus
  206. }
  207. #endif
  208. #endif /*_NMASIC_H_*/