40 #define NMI_GLB_RESET_0 (NMI_PERIPH_REG_BASE + 0x400) 41 #define NMI_INTR_REG_BASE (NMI_PERIPH_REG_BASE + 0xa00) 42 #define NMI_PIN_MUX_0 (NMI_PERIPH_REG_BASE + 0x408) 43 #define NMI_INTR_ENABLE (NMI_INTR_REG_BASE) 44 #define GET_UINT32(X,Y) (X[0+Y] + ((uint32)X[1+Y]<<8) + ((uint32)X[2+Y]<<16) +((uint32)X[3+Y]<<24)) 49 #define TIMEOUT (2000) 50 #define M2M_DISABLE_PS 0xD0UL 68 #ifdef __ENABLE_SLEEP_CLK_SRC_RTC__ 70 #elif defined __ENABLE_SLEEP_CLK_SRC_XO__ 73 #ifdef __ENABLE_EXT_PA_INV_TX_RX__ 76 #ifdef __ENABLE_LEGACY_RF_SETTINGS__ 79 #ifdef __DISABLE_FIRMWARE_LOGS__ 109 uint32 reg, clk_status_reg,trials = 0;
115 M2M_ERR(
"Bus error (1). Wake up failed\n");
132 if (keeptrying) --keeptrying;
149 M2M_ERR(
"Bus error (2). Wake up failed\n");
157 while( ((clk_status_reg & 0x4) == 0) && (((++trials) %3) == 0) && keeptrying)
168 if ((clk_status_reg & 0x4) == 0)
170 M2M_ERR(
"clocks still OFF. Wake up failed\n");
174 if((clk_status_reg & 0x4) == 0)
179 }
while((clk_status_reg & 0x4) == 0 && keeptrying);
183 M2M_ERR(
"Wake up failed - out of retries\n");
236 reg |= ((
uint32) 1 << 16);
261 M2M_ERR(
"[nmi start]: fail read reg 0x1118 ...\n");
267 if ((reg & (1ul << 10)) == (1ul << 10)) {
294 if(chipid == 0x1002a0) {
295 if (rfrevid == 0x1) {
299 }
else if(chipid == 0x1002b0) {
301 }
else if(rfrevid == 4) {
306 }
else if(chipid == 0x1000f0) {
310 #define rBT_CHIP_ID_REG (0x3b0000) 315 if(chipid == 0x3000d0) {
319 else if(rfrevid == 2) {
329 flashid = probe_spi_flash();
330 if((chipid & 0xf00000) == 0x300000) {
331 if(flashid == 0x1440ef) {
332 chipid &= ~(0x0f0000);
336 if(flashid == 0x1230ef) {
337 chipid &= ~(0x0f0000);
340 if(flashid == 0xc21320c2) {
341 chipid &= ~(0x0f0000);
348 if((chipid & 0xf00000) == 0x300000) {
349 chipid &= ~(0x0f0000);
352 chipid &= ~(0x0f0000);
429 M2M_ERR(
"[nmi start]: fail read reg 0x1118 ...\n");
434 if ((reg & (1ul << 10)) == (1ul << 10)) {
456 #ifndef CONF_WINC_USE_UART 463 #ifndef CONF_WINC_USE_UART 477 if (reg & 0x80000000) {
496 M2M_DBG(
"failed to load firmware from flash.\n");
542 while (checkValue != reg)
553 M2M_DBG(
"Time out for wait firmware Run\n");
577 M2M_ERR(
"failed to de-initialize\n");
583 M2M_ERR(
"Error while writing reg\n");
590 M2M_ERR(
"Error while reading reg\n");
594 if ((reg & (1 << 10))) {
595 M2M_DBG(
"Bit 10 not reset retry %d\n", timeout);
619 val32 |= (1ul << gpio);
621 val32 &= ~(1ul << gpio);
638 val32 |= (1ul << gpio);
640 val32 &= ~(1ul << gpio);
657 *val = (
uint8)((val32 >> gpio) & 0x01);
669 M2M_ERR(
"[pullup_ctrl]: failed to read\n");
679 M2M_ERR(
"[pullup_ctrl]: failed to write\n");
699 u32RegValue = strgp.u32Mac_efuse_mib;
711 if(pu8IsValid) *pu8IsValid = 1;
715 if(pu8IsValid) *pu8IsValid = 0;
731 u32RegValue = strgp.u32Mac_efuse_mib;
733 u32RegValue &=0x0000ffff;
sint8 enable_interrupts(void)
NMI_API void m2m_memcpy(uint8 *pDst, uint8 *pSrc, uint32 sz)
Copy specified number of bytes from source buffer to destination buffer.
#define M2M_ATE_FW_IS_UP_VALUE
#define M2M_WAIT_FOR_HOST_REG
#define rHAVE_EXT_PA_INV_TX_RX
sint8 nm_read_block(uint32 u32Addr, uint8 *puBuf, uint32 u32Sz)
This module contains common APIs declarations.
sint8 get_gpio_val(uint8 gpio, uint8 *val)
signed char sint8
Range of values between -128 to 127.
sint8 nmi_get_otp_mac_address(uint8 *pu8MacAddr, uint8 *pu8IsValid)
sint8 nm_read_reg_with_ret(uint32 u32Addr, uint32 *pu32RetVal)
#define rHAVE_USE_PMU_BIT
#define rHAVE_SLEEP_CLK_SRC_RTC_BIT
#define EFUSED_MAC(value)
#define M2M_ATE_FW_START_VALUE
#define M2M_FINISH_BOOT_ROM
uint32 nmi_get_rfrevid(void)
static uint32 clk_status_reg_adr
sint8 chip_reset_and_cpu_halt(void)
#define rHAVE_LEGACY_RF_SETTINGS
sint8 wait_for_bootrom(uint8 arg)
This module contains WINC3400 ASIC specific internal APIs.
void nm_bsp_sleep(uint32 u32TimeMsec)
NMI_API void m2m_memset(uint8 *pBuf, uint8 val, uint32 sz)
Set specified number of data bytes in specified data buffer to specified value.
sint8 nm_write_reg(uint32 u32Addr, uint32 u32Val)
#define M2M_FINISH_INIT_STATE
#define M2M_START_FIRMWARE
sint8 set_gpio_val(uint8 gpio, uint8 val)
sint8 wait_for_firmware_start(uint8 arg)
void nmi_update_pll(void)
sint8 chip_apply_conf(uint32 u32Conf)
uint32 nmi_get_chipid(void)
This module contains WINC3400 bus APIs implementation.
void restore_pmu_settings_after_global_reset(void)
sint8 set_gpio_dir(uint8 gpio, uint8 dir)
#define rHAVE_LOGS_DISABLED_BIT
unsigned long uint32
Range of values between 0 to 4294967295.
sint8 pullup_ctrl(uint32 pinmask, uint8 enable)
This module contains WINC3400 BSP APIs declarations.
sint8 nmi_get_mac_address(uint8 *pu8MacAddr)
unsigned char uint8
Range of values between 0 to 255.
void enable_rf_blocks(void)
void nmi_set_sys_clk_src_to_xo(void)
sint8 nm_clkless_wake(void)
Wakeup the chip using clockless registers.
uint32 nm_read_reg(uint32 u32Addr)
#define rHAVE_SLEEP_CLK_SRC_XO_BIT