NNN50 WIFI_API library

Dependents:   NNN50_CE_Test_UDP NNN50_linux_firmware NNN50_SoftAP_HelloWorld NNN50_BLEWIFISensor ... more

This is mbed compatible EthernetInterface lib exclude for Delta DFCM-NNN50 platform.

Additional information and examples can be found in mbed Handbook

Files at this revision

API Documentation at this revision

Comitter:
tsungta
Date:
Mon Jun 19 17:40:26 2017 +0000
Parent:
23:ba0727e15160
Child:
25:2008b3bae5ca
Commit message:
44:2a253f7

Changed in this revision

wifi_host_driver/bsp/source/nm_bsp_mbed_platform.o Show annotated file Show diff for this revision Revisions of this file
wifi_host_driver/bus_wrapper/include/nm_bus_wrapper.h Show annotated file Show diff for this revision Revisions of this file
wifi_host_driver/bus_wrapper/source/nm_bus_wrapper_mbed_platform.o Show annotated file Show diff for this revision Revisions of this file
wifi_host_driver/common/include/nm_debug.h Show annotated file Show diff for this revision Revisions of this file
Binary file wifi_host_driver/bsp/source/nm_bsp_mbed_platform.o has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/wifi_host_driver/bus_wrapper/include/nm_bus_wrapper.h	Mon Jun 19 17:40:26 2017 +0000
@@ -0,0 +1,181 @@
+/**
+ *
+ * \file
+ *
+ * \brief This module contains NMC1000 bus wrapper APIs declarations.
+ *
+ * Copyright (c) 2015 Atmel Corporation. All rights reserved.
+ *
+ * \asf_license_start
+ *
+ * \page License
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ * 3. The name of Atmel may not be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
+ * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * \asf_license_stop
+ *
+ */
+
+#ifndef _NM_BUS_WRAPPER_H_
+#define _NM_BUS_WRAPPER_H_
+
+#define USE_MBED_SPI_API    0
+
+#include "common/include/nm_common.h"
+
+/**
+	BUS Type
+**/
+#define  NM_BUS_TYPE_I2C	((uint8)0)
+#define  NM_BUS_TYPE_SPI	((uint8)1)
+#define  NM_BUS_TYPE_UART	((uint8)2)
+/**
+	IOCTL commands
+**/
+#define NM_BUS_IOCTL_R			((uint8)0)	/*!< Read only ==> I2C/UART. Parameter:tstrNmI2cDefault/tstrNmUartDefault */
+#define NM_BUS_IOCTL_W			((uint8)1)	/*!< Write only ==> I2C/UART. Parameter type tstrNmI2cDefault/tstrNmUartDefault*/
+#define NM_BUS_IOCTL_W_SPECIAL	((uint8)2)	/*!< Write two buffers within the same transaction
+												(same start/stop conditions) ==> I2C only. Parameter:tstrNmI2cSpecial */
+#define NM_BUS_IOCTL_RW			((uint8)3)	/*!< Read/Write at the same time ==> SPI only. Parameter:tstrNmSpiRw */
+
+#define NM_BUS_IOCTL_WR_RESTART	((uint8)4)				/*!< Write buffer then made restart condition then read ==> I2C only. parameter:tstrNmI2cSpecial */ 
+/**
+*	@struct	tstrNmBusCapabilities
+*	@brief	Structure holding bus capabilities information
+*	@sa	NM_BUS_TYPE_I2C, NM_BUS_TYPE_SPI
+*/ 
+typedef struct
+{
+	uint16	u16MaxTrxSz;	/*!< Maximum transfer size. Must be >= 16 bytes*/
+} tstrNmBusCapabilities;
+
+/**
+*	@struct	tstrNmI2cDefault
+*	@brief	Structure holding I2C default operation parameters
+*	@sa		NM_BUS_IOCTL_R, NM_BUS_IOCTL_W
+*/ 
+typedef struct
+{
+	uint8 u8SlaveAdr;
+	uint8	*pu8Buf;	/*!< Operation buffer */
+	uint16	u16Sz;		/*!< Operation size */
+} tstrNmI2cDefault;
+
+/**
+*	@struct	tstrNmI2cSpecial
+*	@brief	Structure holding I2C special operation parameters
+*	@sa		NM_BUS_IOCTL_W_SPECIAL
+*/ 
+typedef struct
+{
+	uint8 u8SlaveAdr;
+	uint8	*pu8Buf1;	/*!< pointer to the 1st buffer */
+	uint8	*pu8Buf2;	/*!< pointer to the 2nd buffer */	
+	uint16	u16Sz1;		/*!< 1st buffer size */
+	uint16	u16Sz2;		/*!< 2nd buffer size */
+} tstrNmI2cSpecial;
+
+/**
+*	@struct	tstrNmSpiRw
+*	@brief	Structure holding SPI R/W parameters
+*	@sa		NM_BUS_IOCTL_RW
+*/ 
+typedef struct
+{
+	uint8	*pu8InBuf;		/*!< pointer to input buffer. 
+							Can be set to null and in this case zeros should be sent at MOSI */
+	uint8	*pu8OutBuf;		/*!< pointer to output buffer. 
+							Can be set to null and in this case data from MISO can be ignored  */
+	uint16	u16Sz;			/*!< Transfere size */	
+} tstrNmSpiRw;
+
+
+/**
+*	@struct	tstrNmUartDefault
+*	@brief	Structure holding UART default operation parameters
+*	@sa		NM_BUS_IOCTL_R, NM_BUS_IOCTL_W
+*/ 
+typedef struct
+{
+	uint8	*pu8Buf;	/*!< Operation buffer */
+	uint16	u16Sz;		/*!< Operation size */
+} tstrNmUartDefault;
+/*!< Bus capabilities. This structure must be declared at platform specific bus wrapper */
+extern tstrNmBusCapabilities egstrNmBusCapabilities;
+
+
+#ifdef __cplusplus
+     extern "C" {
+ #endif
+/**
+*	@fn		nm_bus_init
+*	@brief	Initialize the bus wrapper
+*	@return	ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure
+*/ 
+sint8 nm_bus_init(void *);
+
+/**
+*	@fn		nm_bus_ioctl
+*	@brief	send/receive from the bus
+*	@param [in]	u8Cmd
+*					IOCTL command for the operation
+*	@param [in]	pvParameter
+*					Arbitrary parameter depending on IOCTL
+*	@return	ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure
+*	@note	For SPI only, it's important to be able to send/receive at the same time
+*/ 
+sint8 nm_bus_ioctl(uint8 u8Cmd, void* pvParameter);
+
+/**
+*	@fn		nm_bus_deinit
+*	@brief	De-initialize the bus wrapper
+*	@return	ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure
+*/ 
+sint8 nm_bus_deinit(void);
+
+/*
+*	@fn			nm_bus_reinit
+*	@brief		re-initialize the bus wrapper
+*	@param [in]	void *config
+*					re-init configuration data
+*	@return		ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure
+*/
+sint8 nm_bus_reinit(void *);
+/*
+*	@fn			nm_bus_get_chip_type
+*	@brief		get chip type
+*	@return		ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure
+*/ 
+#ifdef CONF_WINC_USE_UART
+uint8 nm_bus_get_chip_type(void);
+#endif
+#ifdef __cplusplus
+	 }
+ #endif
+
+#endif	/*_NM_BUS_WRAPPER_H_*/
+
+
Binary file wifi_host_driver/bus_wrapper/source/nm_bus_wrapper_mbed_platform.o has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/wifi_host_driver/common/include/nm_debug.h	Mon Jun 19 17:40:26 2017 +0000
@@ -0,0 +1,97 @@
+/**
+ *
+ * \file
+ *
+ * \brief This module contains debug APIs declarations.
+ *
+ * Copyright (c) 2015 Atmel Corporation. All rights reserved.
+ *
+ * \asf_license_start
+ *
+ * \page License
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *
+ * 3. The name of Atmel may not be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
+ * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * \asf_license_stop
+ *
+ */
+
+#ifndef _NM_DEBUG_H_
+#define _NM_DEBUG_H_
+
+#include "bsp/include/nm_bsp.h"
+//Tsungta	#include "bsp/include/nm_bsp_internal.h"
+
+/**@defgroup  DebugDefines DebugDefines
+ * @ingroup WlanDefines
+ */
+/**@{*/
+
+
+#define M2M_LOG_NONE									0
+#define M2M_LOG_ERROR									1
+#define M2M_LOG_INFO									2
+#define M2M_LOG_REQ										3
+#define M2M_LOG_DBG										4
+
+#if (defined __APS3_CORTUS__)
+#define M2M_LOG_LEVEL									M2M_LOG_INFO
+#else
+#define M2M_LOG_LEVEL									M2M_LOG_REQ
+#endif
+
+
+#define M2M_ERR error
+#define M2M_INFO(...)
+#define M2M_REQ(...)
+#define M2M_DBG(...)
+#define M2M_PRINT(...)
+
+#if (CONF_WINC_DEBUG == 1)
+#undef M2M_PRINT
+#define M2M_PRINT(...)							do{CONF_WINC_PRINTF(__VA_ARGS__);CONF_WINC_PRINTF("\r");}while(0)
+#if (M2M_LOG_LEVEL >= M2M_LOG_ERROR)
+#undef M2M_ERR
+#define M2M_ERR(...)							do{CONF_WINC_PRINTF("(APP)(ERR)[%s][%d]",__FUNCTION__,__LINE__); CONF_WINC_PRINTF(__VA_ARGS__);CONF_WINC_PRINTF("\r");}while(0)
+#if (M2M_LOG_LEVEL >= M2M_LOG_INFO)
+#undef M2M_INFO
+#define M2M_INFO(...)							do{CONF_WINC_PRINTF("(APP)(INFO)"); CONF_WINC_PRINTF(__VA_ARGS__);CONF_WINC_PRINTF("\r");}while(0)
+#if (M2M_LOG_LEVEL >= M2M_LOG_REQ)
+#undef M2M_REQ
+#define M2M_REQ(...)							do{CONF_WINC_PRINTF("(APP)(R)"); CONF_WINC_PRINTF(__VA_ARGS__);CONF_WINC_PRINTF("\r");}while(0)
+#if (M2M_LOG_LEVEL >= M2M_LOG_DBG)
+#undef M2M_DBG
+#define M2M_DBG(...)							do{CONF_WINC_PRINTF("(APP)(DBG)[%s][%d]",__FUNCTION__,__LINE__); CONF_WINC_PRINTF(__VA_ARGS__);CONF_WINC_PRINTF("\r");}while(0)
+#endif /*M2M_LOG_DBG*/
+#endif /*M2M_LOG_REQ*/
+#endif /*M2M_LOG_INFO*/
+#endif /*M2M_LOG_ERROR*/
+#endif /*CONF_WINC_DEBUG */
+
+/**@}*/
+#endif /* _NM_DEBUG_H_ */
+
+