No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 
 
 

149 líneas
4.9 KiB

  1. /*******************************************************************************
  2. This module contains WINC3400 ASIC specific internal APIs.
  3. File Name:
  4. nmasic.h
  5. Summary:
  6. This module contains WINC3400 ASIC specific internal APIs.
  7. Description:
  8. This module contains WINC3400 ASIC specific internal APIs.
  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 _NMASIC_H_
  35. #define _NMASIC_H_
  36. #include "nm_common.h"
  37. #define NMI_PERIPH_REG_BASE 0x1000
  38. #define NMI_CHIPID (NMI_PERIPH_REG_BASE)
  39. #define rNMI_GP_REG_0 (0x149c)
  40. #define rNMI_GP_REG_1 (0x14A0)
  41. #define rNMI_GLB_RESET (0x1400)
  42. #define rNMI_BOOT_RESET_MUX (0x1118)
  43. #define NMI_STATE_REG (0x108c)
  44. #define BOOTROM_REG (0xc000c)
  45. #define NMI_REV_REG (0x207ac) /*Also, Used to load ATE firmware from SPI Flash and to ensure that it is running too*/
  46. #define M2M_WAIT_FOR_HOST_REG (0x207bc)
  47. #define M2M_FINISH_INIT_STATE 0x02532636UL
  48. #define M2M_FINISH_BOOT_ROM 0x10add09eUL
  49. #define M2M_START_FIRMWARE 0xef522f61UL
  50. #define M2M_START_PS_FIRMWARE 0x94992610UL
  51. #define M2M_ATE_FW_START_VALUE (0x3C1CD57D) /*Also, Change this value in boot_firmware if it will be changed here*/
  52. #define M2M_ATE_FW_IS_UP_VALUE (0xD75DC1C3) /*Also, Change this value in ATE (Burst) firmware if it will be changed here*/
  53. #define REV_2B0 (0x2B0)
  54. #define REV_B0 (0x2B0)
  55. #define REV_3A0 (0x3A0)
  56. #define CHIP_ID_3000D (0x3000D0)
  57. #define GET_CHIPID() nmi_get_chipid()
  58. #define ISNMC1000(id) (((id & 0xfffff000) == 0x100000) ? 1 : 0)
  59. #define ISNMC1500(id) (((id & 0xfffff000) == 0x150000) ? 1 : 0)
  60. #define ISNMC3400(id) (((id & 0xfff0f000) == 0x300000) ? 1 : 0)
  61. #define REV(id) ( ((id) & 0x00000fff ) )
  62. #define EFUSED_MAC(value) (value & 0xffff0000)
  63. #define rHAVE_SDIO_IRQ_GPIO_BIT (NBIT0)
  64. #define rHAVE_USE_PMU_BIT (NBIT1)
  65. #define rHAVE_SLEEP_CLK_SRC_RTC_BIT (NBIT2)
  66. #define rHAVE_SLEEP_CLK_SRC_XO_BIT (NBIT3)
  67. #define rHAVE_EXT_PA_INV_TX_RX (NBIT4)
  68. #define rHAVE_LEGACY_RF_SETTINGS (NBIT5)
  69. #define rHAVE_LOGS_DISABLED_BIT (NBIT6)
  70. #define rHAVE_ETHERNET_MODE_BIT (NBIT7)
  71. typedef struct {
  72. uint32_t u32Mac_efuse_mib;
  73. uint32_t u32Firmware_Ota_rev;
  74. } tstrGpRegs;
  75. #ifdef __cplusplus
  76. extern "C" {
  77. #endif
  78. /**
  79. * @fn nm_clkless_wake
  80. * @brief Wakeup the chip using clockless registers
  81. * @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure
  82. */
  83. int8_t nm_clkless_wake(void);
  84. int8_t chip_wake(void);
  85. int8_t chip_sleep(void);
  86. void chip_idle(void);
  87. void enable_rf_blocks(void);
  88. int8_t enable_interrupts(void);
  89. int8_t cpu_start(void);
  90. uint32_t nmi_get_chipid(void);
  91. uint32_t nmi_get_rfrevid(void);
  92. void restore_pmu_settings_after_global_reset(void);
  93. void nmi_update_pll(void);
  94. void nmi_set_sys_clk_src_to_xo(void);
  95. int8_t chip_reset(void);
  96. int8_t wait_for_bootrom(uint8_t);
  97. int8_t wait_for_firmware_start(uint8_t);
  98. int8_t chip_deinit(void);
  99. int8_t chip_reset_and_cpu_halt(void);
  100. int8_t set_gpio_dir(uint8_t gpio, uint8_t dir);
  101. int8_t set_gpio_val(uint8_t gpio, uint8_t val);
  102. int8_t get_gpio_val(uint8_t gpio, uint8_t* val);
  103. int8_t pullup_ctrl(uint32_t pinmask, uint8_t enable);
  104. int8_t nmi_get_otp_mac_address(uint8_t *pu8MacAddr, uint8_t * pu8IsValid);
  105. int8_t nmi_get_mac_address(uint8_t *pu8MacAddr);
  106. int8_t chip_apply_conf(uint32_t u32conf);
  107. #ifdef __cplusplus
  108. }
  109. #endif
  110. #endif /*_NMASIC_H_*/