• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ M2M_ERR函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中M2M_ERR函数的典型用法代码示例。如果您正苦于以下问题:C++ M2M_ERR函数的具体用法?C++ M2M_ERR怎么用?C++ M2M_ERR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了M2M_ERR函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: m2m_wifi_request_scan_ssid

sint8 m2m_wifi_request_scan_ssid(uint8 ch,char* pcssid)
{
	sint8	s8Ret = M2M_ERR_SCAN_IN_PROGRESS;

	if(!gu8scanInProgress)
	{
		tstrM2MScan strtmp;
		m2m_memset((uint8*)&strtmp,0,sizeof(tstrM2MScan));
		strtmp.u8ChNum = ch;
		if(pcssid)
		{
			uint8 len =	m2m_strlen((uint8 *)pcssid);
			m2m_memcpy(strtmp.au8SSID,(uint8 *)pcssid,len+1);
		}
		s8Ret = hif_send(M2M_REQ_GRP_WIFI, M2M_WIFI_REQ_SCAN, (uint8*)&strtmp, sizeof(tstrM2MScan),NULL, 0,0);

		if(s8Ret == M2M_SUCCESS)
		{
			gu8scanInProgress = 1;
		}
		else
		{
			M2M_ERR("SCAN Failed Ret = %d\n",s8Ret);
		}
	}
	else
	{
		M2M_ERR("SCAN In Progress\n");
	}
	return s8Ret;
}
开发者ID:zhengwang721,项目名称:ASF,代码行数:31,代码来源:m2m_wifi.c


示例2: m2m_validate_scan_options

static sint8 m2m_validate_scan_options(tstrM2MScanOption* ptstrM2MScanOption)
{
	sint8 s8Ret = M2M_SUCCESS;
	/* Check for incoming pointer */
	if(ptstrM2MScanOption == NULL)
	{
		M2M_ERR("INVALID POINTER\n");
		s8Ret = M2M_ERR_FAIL;
	}	
	/* Check for valid No of slots */
	 if(ptstrM2MScanOption->u8NumOfSlot < 1)
	{
		M2M_ERR("INVALID No of scan slots!\n");
		s8Ret = M2M_ERR_FAIL;
	}	
	/* Check for valid time of slots */
	 if(ptstrM2MScanOption->u8SlotTime < 1)
	{
		M2M_ERR("INVALID scan slot time!\n");
		s8Ret = M2M_ERR_FAIL;
	}	
	/* Check for valid No of probe requests per slot */
	 if((ptstrM2MScanOption->u8ProbesPerSlot < 0)||(ptstrM2MScanOption->u8ProbesPerSlot > M2M_SCAN_DEFAULT_NUM_PROBE))
	{
		M2M_ERR("INVALID No of probe requests per scan slot\n");
		s8Ret = M2M_ERR_FAIL;
	}	
	/* Check for valid RSSI threshold */
	 if((ptstrM2MScanOption->s8RssiThresh  < -99) || (ptstrM2MScanOption->s8RssiThresh >= 0))
	{
		M2M_ERR("INVALID RSSI threshold %d \n",ptstrM2MScanOption->s8RssiThresh);
		s8Ret = M2M_ERR_FAIL;
	}	
	return s8Ret;
}
开发者ID:JacobV90,项目名称:Embedded_Project,代码行数:35,代码来源:m2m_wifi.c


示例3: nm_drv_deinit

/*
*	@fn		nm_drv_deinit
*	@brief	Deinitialize NMC1000 driver
*	@author	M. Abdelmawla
*	@date	17 July 2012
*	@version	1.0
*/
sint8 nm_drv_deinit(void * arg)
{
    (void)arg; // Silence "unused" warning

    sint8 ret;

    ret = chip_deinit();
    if (M2M_SUCCESS != ret) {
        M2M_ERR("[nmi stop]: chip_deinit fail\n");
        goto ERR1;
    }

    ret = nm_bus_iface_deinit();
    if (M2M_SUCCESS != ret) {
        M2M_ERR("[nmi stop]: fail init bus\n");
        goto ERR1;
    }
#ifdef CONF_WINC_USE_SPI
    /* Must do this after global reset to set SPI data packet size. */
    nm_spi_deinit();
#endif

ERR1:
    return ret;
}
开发者ID:shampliu,项目名称:ideahacks,代码行数:32,代码来源:nmdrv.c


示例4: m2m_wifi_request_scan

sint8 m2m_wifi_request_scan(uint8 ch)
{
	sint8	s8Ret = M2M_ERR_SCAN_IN_PROGRESS;

	if(!gu8scanInProgress)
	{
		tstrM2MScan strtmp;
		strtmp.u8ChNum = ch;
		s8Ret = hif_send(M2M_REQ_GRP_WIFI, M2M_WIFI_REQ_SCAN, (uint8*)&strtmp, sizeof(tstrM2MScan),NULL, 0,0);

		if(s8Ret == M2M_SUCCESS)
		{
			gu8scanInProgress = 1;
		}
		else
		{
			M2M_ERR("SCAN Failed Ret = %d\n",s8Ret);
		}
	}
	else
	{
		M2M_ERR("SCAN In Progress\n");
	}
	return s8Ret;
}
开发者ID:InSoonPark,项目名称:asf,代码行数:25,代码来源:m2m_wifi.c


示例5: sslSetSockOpt

/*********************************************************************
Function
		setsockopt

Description

Return
		None.

Author
		Abdelrahman Diab

Version
		1.0

Date
		9 September 2014
*********************************************************************/
sint8 sslSetSockOpt(SOCKET sock, uint8  u8Opt, const void *pvOptVal, uint16 u16OptLen)
{
	sint8	s8Ret = SOCK_ERR_INVALID_ARG;
	if(sock < TCP_SOCK_MAX)
	{
		if(gastrSockets[sock].u8SSLFlags & SSL_FLAGS_ACTIVE)
		{
			if(u8Opt == SO_SSL_BYPASS_X509_VERIF)
			{
				int	optVal = *((int*)pvOptVal);
				if(optVal)
				{
					gastrSockets[sock].u8SSLFlags |= SSL_FLAGS_BYPASS_X509;
				}
				else
				{
					gastrSockets[sock].u8SSLFlags &= ~SSL_FLAGS_BYPASS_X509;
				}
				s8Ret = SOCK_ERR_NO_ERROR;
			}
			else if(u8Opt == SO_SSL_SNI)
			{
				if(u16OptLen < HOSTNAME_MAX_SIZE)
				{
					uint8					*pu8SNI = (uint8*)pvOptVal;
					tstrSSLSetSockOptCmd	strCmd;

					strCmd.sock			= sock;
					strCmd.u16SessionID	= gastrSockets[sock].u16SessionID;
					strCmd.u8Option		= u8Opt;
					strCmd.u32OptLen	= u16OptLen;
					m2m_memcpy(strCmd.au8OptVal, pu8SNI, HOSTNAME_MAX_SIZE);
					
					if(SOCKET_REQUEST(SOCKET_CMD_SSL_SET_SOCK_OPT, (uint8*)&strCmd, sizeof(tstrSSLSetSockOptCmd),
						0, 0, 0) == M2M_ERR_MEM_ALLOC)
					{
						s8Ret = SOCKET_REQUEST(SOCKET_CMD_SSL_SET_SOCK_OPT | M2M_REQ_DATA_PKT, 
							(uint8*)&strCmd, sizeof(tstrSSLSetSockOptCmd), 0, 0, 0);
					}
					s8Ret = SOCK_ERR_NO_ERROR;
				}
				else
				{
					M2M_ERR("SNI Exceeds Max Length\n");
				}
			}
			else
			{
				M2M_ERR("Unknown SSL Socket Option %d\n",u8Opt);
			}
		}
		else
		{
			M2M_ERR("Not SSL Socket\n");
		}
	}
	return s8Ret;
}
开发者ID:TobiasBog100,项目名称:Arduino,代码行数:76,代码来源:socket.c


示例6: nm_uart_reconfigure

/**
*	@fn			nm_uart_reconfigure
*	@brief		Reconfigures the UART interface
*	@param [in]	ptr
*				Pointer to a DWORD containing baudrate at this moment.
*	@return		M2M_SUCCESS in case of success and M2M_ERR_BUS_FAIL in case of failure
*	@author		Viswanathan Murugesan
*	@date		22 OCT 2014
*	@version	1.0
*/
sint8 nm_uart_reconfigure(void *ptr)
{
	tstrNmUartDefault strUart;
	sint8 s8Ret = M2M_SUCCESS;
	uint8 b[HDR_SZ+1];

	/*write reg*/
	b[0] = 0xa5;
	b[1] = 5;
	b[2] = 0;
	b[3] = 0;
	b[4] = 0;
	b[5] = 0;
	b[6] = 0;
	b[7] = 0;
	b[8] = 0;
	b[9] = (uint8)((*(unsigned long *)ptr) & 0x000000ff);
	b[10] = (uint8)(((*(unsigned long *)ptr) & 0x0000ff00)>>8);
	b[11] = (uint8)(((*(unsigned long *)ptr) & 0x00ff0000)>>16);
	b[12] = (uint8)(((*(unsigned long *)ptr) & 0xff000000)>>24);

	b[2] = get_cs(&b[1],HDR_SZ);

	get_cs(&b[1],HDR_SZ);

	strUart.pu8Buf = b;
	strUart.u16Sz = sizeof(b);

	if(M2M_SUCCESS != nm_bus_ioctl(NM_BUS_IOCTL_W, &strUart))
	{
		M2M_ERR("write error\n");
		s8Ret = M2M_ERR_BUS_FAIL;
	}
	else
	{
		if(!nm_bus_get_chip_type())
		{
			//check for the ack from the SAMD21 for the packet reception.
			strUart.u16Sz = 1;
			if(M2M_SUCCESS != nm_bus_ioctl(NM_BUS_IOCTL_R, &strUart))
			{
				s8Ret = M2M_ERR_BUS_FAIL;
			}
			if(b[0] == 0xAC)
			{
				M2M_DBG("Successfully sent the UART reconfigure command\n");
			}
			else
			{
				M2M_ERR("write error\n");
				s8Ret = M2M_ERR_BUS_FAIL;
			}
		}
	}

	return s8Ret;
}
开发者ID:bedomo,项目名称:thethings.iO-atmel-sdk,代码行数:67,代码来源:nmuart.c


示例7: m2m_ota_test

NMI_API sint8 m2m_ota_test(void)
{
	uint32 page  = 0;
	uint8 buffer[1500];
	uint32 u32Sz = 0;
	sint8 ret = M2M_SUCCESS;
	FILE *fp =NULL;
	fp = fopen(M2M_OTA_FILE,"rb");
	if(fp)
	{
		fseek(fp, 0L, SEEK_END);
		u32Sz = ftell(fp);
		fseek(fp, 0L, SEEK_SET);

		while(u32Sz > 0)
		{
			{
				page = (rand()%1400);

				if((page<100)||(page>1400)) page  = 1400;
			}

			if(u32Sz>page)
			{
				u32Sz-=page;
			}
			else
			{
				page = u32Sz;
				u32Sz = 0;
			}
			printf("page %d\n", (int)page);
			fread(buffer,page,1,fp);
			ret = hif_send(M2M_REQ_GROUP_OTA,M2M_OTA_REQ_TEST|M2M_REQ_DATA_PKT,NULL,0,(uint8*)&buffer,page,0);
			if(ret != M2M_SUCCESS)
			{
				M2M_ERR("\n");
			}
			nm_bsp_sleep(1);
		}

	}
	else
	{
		M2M_ERR("nO err\n");
	}
	return ret;
}
开发者ID:zhengwang721,项目名称:ASF,代码行数:48,代码来源:m2m_ota.c


示例8: nm_i2c_write_block

/*
*	@fn		nm_i2c_write_block
*	@brief	Write block of data
*	@param [in]	u32Addr
*				Start address
*	@param [in]	puBuf
*				Pointer to the buffer holding the data to be written
*	@param [in]	u16Sz
*				Number of bytes to write. The buffer size must be >= u16Sz
*	@return	M2M_SUCCESS in case of success and M2M_ERR_BUS_FAIL in case of failure
*	@author	M. Abdelmawla
*	@date	11 July 2012
*	@version	1.0
*/
sint8 nm_i2c_write_block(uint32 u32Addr, uint8 *pu8Buf, uint16 u16Sz)
{
	uint8 au8Buf[7];
	tstrNmI2cSpecial strI2c;
	sint8 s8Ret = M2M_SUCCESS;

	au8Buf[0] = 0x12;
	au8Buf[1] = (uint8)(u32Addr >> 24);
	au8Buf[2] = (uint8)(u32Addr >> 16);
	au8Buf[3] = (uint8)(u32Addr >> 8);
	au8Buf[4] = (uint8)(u32Addr);
	au8Buf[5] = (uint8)(u16Sz >> 8);
	au8Buf[6] = (uint8)(u16Sz);

	strI2c.pu8Buf1 = au8Buf;
	strI2c.pu8Buf2 = pu8Buf;
	strI2c.u16Sz1 = sizeof(au8Buf);
	strI2c.u16Sz2 = u16Sz;

	if(M2M_SUCCESS != nm_bus_ioctl(NM_BUS_IOCTL_W_SPECIAL, &strI2c))
	{
		M2M_ERR("write error\n");
		s8Ret = M2M_ERR_BUS_FAIL;
	}

	return s8Ret;
}
开发者ID:runtimeinc,项目名称:mynewt_arduino_zero,代码行数:41,代码来源:nmi2c.c


示例9: chip_reset_and_cpu_halt

sint8 chip_reset_and_cpu_halt(void)
{
	sint8 ret = M2M_SUCCESS;
	uint32 reg = 0;

	ret = chip_wake();
	if(ret != M2M_SUCCESS) {
		return ret;
	}
	chip_reset();
	ret = nm_read_reg_with_ret(0x1118, &reg);
	if (M2M_SUCCESS != ret) {
		ret = M2M_ERR_BUS_FAIL;
		M2M_ERR("[nmi start]: fail read reg 0x1118 ...\n");
	}
	reg |= (1 << 0);
	ret = nm_write_reg(0x1118, reg);
	ret += nm_read_reg_with_ret(NMI_GLB_RESET_0, &reg);
	if ((reg & (1ul << 10)) == (1ul << 10)) {
		reg &= ~(1ul << 10);
		ret += nm_write_reg(NMI_GLB_RESET_0, reg);
		ret += nm_read_reg_with_ret(NMI_GLB_RESET_0, &reg);
	}
#if 0
	reg |= (1ul << 10);
	ret += nm_write_reg(NMI_GLB_RESET_0, reg);
	ret += nm_read_reg_with_ret(NMI_GLB_RESET_0, &reg);
#endif
	nm_write_reg(BOOTROM_REG,0);
	nm_write_reg(NMI_STATE_REG,0);
	nm_write_reg(NMI_REV_REG,0);
	nm_write_reg(NMI_PIN_MUX_0, 0x11111000);
	return ret;
}
开发者ID:Meronw,项目名称:shipiot-samd21-winc1500,代码行数:34,代码来源:nmasic.c


示例10: m2m_wifi_start_provision_mode

sint8 m2m_wifi_start_provision_mode(tstrM2MAPConfig *pstrAPConfig, char *pcHttpServerDomainName, uint8 bEnableHttpRedirect)
{
	sint8	s8Ret = M2M_ERR_FAIL;

	if((pstrAPConfig != NULL))
	{
		tstrM2MProvisionModeConfig	strProvConfig;
		if(M2M_SUCCESS == m2m_validate_ap_parameters(pstrAPConfig))
		{
			m2m_memcpy((uint8*)&strProvConfig.strApConfig, (uint8*)pstrAPConfig, sizeof(tstrM2MAPConfig));
			if((m2m_strlen((uint8 *)pcHttpServerDomainName) <= 0) || (NULL == pcHttpServerDomainName))
			{
				M2M_ERR("INVALID DOMAIN NAME\n");
				goto ERR1;
			}
			m2m_memcpy((uint8*)strProvConfig.acHttpServerDomainName, (uint8*)pcHttpServerDomainName, 64);
			strProvConfig.u8EnableRedirect = bEnableHttpRedirect;

			/* Stop Scan if it is ongoing.
			*/
			gu8scanInProgress = 0;
			s8Ret = hif_send(M2M_REQ_GRP_WIFI, M2M_WIFI_REQ_START_PROVISION_MODE | M2M_REQ_DATA_PKT,
						(uint8*)&strProvConfig, sizeof(tstrM2MProvisionModeConfig), NULL, 0, 0);
		}
		else
		{
			/*goto ERR1;*/
		}
	}
ERR1:
	return s8Ret;
}
开发者ID:JacobV90,项目名称:Embedded_Project,代码行数:32,代码来源:m2m_wifi.c


示例11: nm_i2c_write_reg

/*
*	@fn		nm_i2c_write_reg
*	@brief	write register
*	@param [in]	u32Addr
*				Register address
*	@param [in]	u32Val
*				Value to be written to the register
*	@return	M2M_SUCCESS in case of success and M2M_ERR_BUS_FAIL in case of failure
*	@author	M. Abdelmawla
*	@date	11 July 2012
*	@version	1.0
*/
sint8 nm_i2c_write_reg(uint32 u32Addr, uint32 u32Val)
{
	tstrNmI2cDefault strI2c;
	uint8 b[16];
	sint8 s8Ret = M2M_SUCCESS;

	if(u32Addr < 0xff) { /* clockless i2c */
		b[0] = 0x19;
		b[1] = (uint8)(u32Addr);
		b[2] = (uint8)(u32Val);
		strI2c.u16Sz = 3;
	} else {
		b[0] = 0x90;
		b[1] = (uint8)(u32Addr >> 24);
		b[2] = (uint8)(u32Addr >> 16);
		b[3] = (uint8)(u32Addr >> 8);
		b[4] = (uint8)u32Addr;
		b[5] = 0x04;
		b[6] = (uint8)u32Val;
		b[7] = (uint8)(u32Val >> 8);
		b[8] = (uint8)(u32Val >> 16);
		b[9] = (uint8)(u32Val >> 24);
		strI2c.u16Sz = 10;
	}

	strI2c.pu8Buf = b;

	if(M2M_SUCCESS != nm_bus_ioctl(NM_BUS_IOCTL_W, &strI2c))
	{
		M2M_ERR("write error\n");
		s8Ret = M2M_ERR_BUS_FAIL;
	}

	return s8Ret;
}
开发者ID:runtimeinc,项目名称:mynewt_arduino_zero,代码行数:47,代码来源:nmi2c.c


示例12: cpu_start

sint8 cpu_start(void) {
	uint32 reg;
	sint8 ret;

	/**
	reset regs
	*/
	nm_write_reg(BOOTROM_REG,0);
	nm_write_reg(NMI_STATE_REG,0);
	nm_write_reg(NMI_REV_REG,0);

	/**
	Go...
	**/
	ret = nm_read_reg_with_ret(0x1118, &reg);
	if (M2M_SUCCESS != ret) {
		ret = M2M_ERR_BUS_FAIL;
		M2M_ERR("[nmi start]: fail read reg 0x1118 ...\n");
	}
	reg |= (1 << 0);
	ret = nm_write_reg(0x1118, reg);
	ret = nm_write_reg(0x150014, 0x1);
	ret += nm_read_reg_with_ret(NMI_GLB_RESET_0, &reg);
	if ((reg & (1ul << 10)) == (1ul << 10)) {
		reg &= ~(1ul << 10);
		ret += nm_write_reg(NMI_GLB_RESET_0, reg);
	}

	reg |= (1ul << 10);
	ret += nm_write_reg(NMI_GLB_RESET_0, reg);
	nm_bsp_sleep(1); /* TODO: Why bus error if this delay is not here. */
	return ret;
}
开发者ID:Meronw,项目名称:shipiot-samd21-winc1500,代码行数:33,代码来源:nmasic.c


示例13: m2m_ota_cb

/**
*	@fn			m2m_wifi_cb(uint8 u8OpCode, uint16 u16DataSize, uint32 u32Addr, uint8 grp)
*	@brief		WiFi call back function
*	@param [in]	u8OpCode
*					HIF Opcode type.
*	@param [in]	u16DataSize
*					HIF data length.
*	@param [in]	u32Addr
*					HIF address.
*	@param [in]	grp
*					HIF group type.
*	@author
*	@date
*	@version	1.0
*/
static void m2m_ota_cb(uint8 u8OpCode, uint16 u16DataSize, uint32 u32Addr)
{
	sint8 ret = M2M_SUCCESS;
	if(u8OpCode == M2M_OTA_RESP_NOTIF_UPDATE_INFO)
	{
		tstrOtaUpdateInfo strOtaUpdateInfo;
		m2m_memset((uint8*)&strOtaUpdateInfo,0,sizeof(tstrOtaUpdateInfo));
		ret = hif_receive(u32Addr,(uint8*)&strOtaUpdateInfo,sizeof(tstrOtaUpdateInfo),0);
		if(ret == M2M_SUCCESS)
		{
			if(gpfOtaNotifCb)
				gpfOtaNotifCb(&strOtaUpdateInfo);
		}
	}
	else if (u8OpCode == M2M_OTA_RESP_UPDATE_STATUS)
	{
		tstrOtaUpdateStatusResp strOtaUpdateStatusResp;
		m2m_memset((uint8*)&strOtaUpdateStatusResp,0,sizeof(tstrOtaUpdateStatusResp));
		ret = hif_receive(u32Addr, (uint8*) &strOtaUpdateStatusResp,sizeof(tstrOtaUpdateStatusResp), 0);
		if(ret == M2M_SUCCESS)
		{
			if(gpfOtaUpdateCb)
				gpfOtaUpdateCb(strOtaUpdateStatusResp.u8OtaUpdateStatusType,strOtaUpdateStatusResp.u8OtaUpdateStatus);
		}
	}
	else
	{
		M2M_ERR("Invaild OTA resp %d ?\n",u8OpCode);
	}

}
开发者ID:zhengwang721,项目名称:ASF,代码行数:46,代码来源:m2m_ota.c


示例14: m2m_ota_init

/*!
@fn	\
	NMI_API sint8  m2m_ota_init(tpfOtaUpdateCb pfOtaUpdateCb, tpfOtaNotifCb pfOtaNotifCb);

@brief
	Initialize the OTA layer.

@param [in]	pfOtaUpdateCb
				OTA Update callback function

@param [in]	pfOtaNotifCb
				OTA notify callback function

@return
	The function SHALL return 0 for success and a negative value otherwise.
*/
NMI_API sint8  m2m_ota_init(tpfOtaUpdateCb pfOtaUpdateCb, tpfOtaNotifCb pfOtaNotifCb)
{
	sint8 ret = M2M_SUCCESS;

	if(pfOtaUpdateCb){
		gpfOtaUpdateCb = pfOtaUpdateCb;
	}else{
		M2M_ERR("Invaild Ota update cb\n");
	}
	if(pfOtaNotifCb){
		gpfOtaNotifCb = pfOtaNotifCb;
	}else{
		M2M_ERR("Invaild Ota notify cb\n");
	}

	hif_register_cb(M2M_REQ_GROUP_OTA,m2m_ota_cb);

	return ret;
}
开发者ID:zhengwang721,项目名称:ASF,代码行数:35,代码来源:m2m_ota.c


示例15: m2m_wifi_set_scan_list

sint8 m2m_wifi_set_scan_list(tstrM2MScanList* pstrScanList)
{
	sint8	s8Ret = M2M_ERR_FAIL;
	s8Ret = hif_send(M2M_REQ_GRP_WIFI, M2M_WIFI_REQ_SET_SCAN_LIST, (uint8*)pstrScanList, sizeof(tstrM2MScanList),NULL, 0,0);
	if(s8Ret != M2M_SUCCESS)
	{
		M2M_ERR("SCAN List Ret = %d\n",s8Ret);
	}
	return s8Ret;
}
开发者ID:zhengwang721,项目名称:ASF,代码行数:10,代码来源:m2m_wifi.c


示例16: chip_deinit

sint8 chip_deinit(void)
{
	uint32 reg = 0;
	sint8 ret;
	uint8 timeout = 10;

	/**
	stop the firmware, need a re-download
	**/
	ret = nm_read_reg_with_ret(NMI_GLB_RESET_0, &reg);
	if (ret != M2M_SUCCESS) {
		M2M_ERR("failed to de-initialize\n");
	}
	reg &= ~(1 << 10);
	ret = nm_write_reg(NMI_GLB_RESET_0, reg);

	if (ret != M2M_SUCCESS) {
		M2M_ERR("Error while writing reg\n");
		return ret;
	}

	do {
		ret = nm_read_reg_with_ret(NMI_GLB_RESET_0, &reg);
		if (ret != M2M_SUCCESS) {
			M2M_ERR("Error while reading reg\n");
			return ret;
		}
		/*Workaround to ensure that the chip is actually reset*/
		if ((reg & (1 << 10))) {
			M2M_DBG("Bit 10 not reset retry %d\n", timeout);
			reg &= ~(1 << 10);
			ret = nm_write_reg(NMI_GLB_RESET_0, reg);
			timeout--;
		} else {
			break;
		}

	} while (timeout);

	return ret;
}
开发者ID:Meronw,项目名称:shipiot-samd21-winc1500,代码行数:41,代码来源:nmasic.c


示例17: m2m_wifi_req_server_init

sint8 m2m_wifi_req_server_init(uint8 ch)
{
	sint8 ret = M2M_SUCCESS;
#ifdef _PS_SERVER_
	tstrM2mServerInit strServer;
	strServer.u8Channel = ch;
	ret = hif_send(M2M_REQ_GRP_WIFI,M2M_WIFI_REQ_SERVER_INIT, (uint8*)&strServer, sizeof(tstrM2mServerInit), NULL, 0, 0);
#else
	M2M_ERR("_PS_SERVER_ is not defined\n");
#endif
	return ret;
}
开发者ID:InSoonPark,项目名称:asf,代码行数:12,代码来源:m2m_wifi.c


示例18: m2m_wifi_req_client_ctrl

sint8 m2m_wifi_req_client_ctrl(uint8 u8Cmd)
{

	sint8 ret = M2M_SUCCESS;
#ifdef _PS_SERVER_
	tstrM2Mservercmd	strCmd;
	strCmd.u8cmd = u8Cmd;
	ret = hif_send(M2M_REQ_GRP_WIFI, M2M_WIFI_REQ_CLIENT_CTRL, (uint8*)&strCmd, sizeof(tstrM2Mservercmd), NULL, 0, 0);
#else
	M2M_ERR("_PS_SERVER_ is not defined\n");
#endif
	return ret;
}
开发者ID:InSoonPark,项目名称:asf,代码行数:13,代码来源:m2m_wifi.c


示例19: pullup_ctrl

sint8 pullup_ctrl(uint32 pinmask, uint8 enable)
{
	sint8 s8Ret;
	uint32 val32;
	s8Ret = nm_read_reg_with_ret(0x142c, &val32);
	if(s8Ret != M2M_SUCCESS) {
		M2M_ERR("[pullup_ctrl]: failed to read\n");
		goto _EXIT;
	}
	if(enable) {
		val32 &= ~pinmask;
		} else {
		val32 |= pinmask;
	}
	s8Ret = nm_write_reg(0x142c, val32);
	if(s8Ret  != M2M_SUCCESS) {
		M2M_ERR("[pullup_ctrl]: failed to write\n");
		goto _EXIT;
	}
_EXIT:
	return s8Ret;
}
开发者ID:Meronw,项目名称:shipiot-samd21-winc1500,代码行数:22,代码来源:nmasic.c


示例20: nm_bus_init

/*
 *	@fn		nm_bus_init
 *	@brief	Initialize the bus wrapper
 *	@return	M2M_SUCCESS in case of success and M2M_ERR_BUS_FAIL in case of failure
 */
sint8 nm_bus_init(void *pvinit)
{
	sint8 result = M2M_SUCCESS;
#ifdef CONF_WINC_USE_I2C
	twihs_options_t opt;

	/* Enable the peripheral clock for TWI */
	pmc_enable_periph_clk(CONF_WINC_I2C_ID);

	/* Configure the options of TWI driver */
	opt.master_clk = sysclk_get_peripheral_hz();
	opt.speed      = CONF_WINC_TWIHS_CLOCK;

	if (twihs_master_init(CONF_WINC_I2C, &opt) != TWIHS_SUCCESS) {
		M2M_ERR("-E-\tTWI master initialization failed.\r");
		while (1) {
			/* Capture error */
		}
	}

#elif CONF_WINC_USE_SPI
	/* Configure SPI pins. */
	ioport_set_pin_mode(CONF_WINC_SPI_MISO_GPIO, CONF_WINC_SPI_MISO_FLAGS);
	ioport_set_pin_mode(CONF_WINC_SPI_MOSI_GPIO, CONF_WINC_SPI_MOSI_FLAGS);
	ioport_set_pin_mode(CONF_WINC_SPI_CLK_GPIO, CONF_WINC_SPI_CLK_FLAGS);
	ioport_set_pin_mode(CONF_WINC_SPI_CS_GPIO, CONF_WINC_SPI_CS_FLAGS);
	ioport_disable_pin(CONF_WINC_SPI_MISO_GPIO);
	ioport_disable_pin(CONF_WINC_SPI_MOSI_GPIO);
	ioport_disable_pin(CONF_WINC_SPI_CLK_GPIO);
	ioport_disable_pin(CONF_WINC_SPI_CS_GPIO);

	spi_enable_clock(CONF_WINC_SPI);
	spi_disable(CONF_WINC_SPI);
	spi_reset(CONF_WINC_SPI);
	spi_set_master_mode(CONF_WINC_SPI);
	spi_disable_mode_fault_detect(CONF_WINC_SPI);
	spi_set_peripheral_chip_select_value(CONF_WINC_SPI, CONF_WINC_SPI_NPCS);
	spi_set_clock_polarity(CONF_WINC_SPI,
			CONF_WINC_SPI_NPCS, CONF_WINC_SPI_POL);
	spi_set_clock_phase(CONF_WINC_SPI, CONF_WINC_SPI_NPCS, CONF_WINC_SPI_PHA);
	spi_set_bits_per_transfer(CONF_WINC_SPI, CONF_WINC_SPI_NPCS, SPI_CSR_BITS_8_BIT);
	spi_set_baudrate_div(CONF_WINC_SPI, CONF_WINC_SPI_NPCS,
			(sysclk_get_cpu_hz() / CONF_WINC_SPI_CLOCK));
	spi_set_transfer_delay(CONF_WINC_SPI, CONF_WINC_SPI_NPCS, CONF_WINC_SPI_DLYBS,
			CONF_WINC_SPI_DLYBCT);
	spi_enable(CONF_WINC_SPI);

	nm_bsp_reset();
#endif
	return result;
}
开发者ID:malachi-iot,项目名称:asf,代码行数:56,代码来源:nm_bus_wrapper_same70.c



注:本文中的M2M_ERR函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ MAC16_16函数代码示例发布时间:2022-05-30
下一篇:
C++ M函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap