44 * 
55 * \brief This module contains NMC1000 bus wrapper APIs declarations. 
66 * 
7-  * Copyright (c) 2016-2017 Atmel Corporation. All rights reserved . 
7+  * Copyright (c) 2016-2021 Microchip Technology Inc. and its subsidiaries . 
88 * 
99 * \asf_license_start 
1010 * 
1111 * \page License 
1212 * 
13-  * Redistribution and use in source and binary forms, with or without 
14-  * modification, are permitted provided that the following conditions are met: 
13+  * Subject to your compliance with these terms, you may use Microchip 
14+  * software and any derivatives exclusively with Microchip products. 
15+  * It is your responsibility to comply with third party license terms applicable 
16+  * to your use of third party software (including open source software) that 
17+  * may accompany Microchip software. 
1518 * 
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. 
19+  * THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, 
20+  * WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, 
21+  * INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, 
22+  * AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL MICROCHIP BE 
23+  * LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, INCIDENTAL OR CONSEQUENTIAL 
24+  * LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND WHATSOEVER RELATED TO THE 
25+  * SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS BEEN ADVISED OF THE 
26+  * POSSIBILITY OR THE DAMAGES ARE FORESEEABLE.  TO THE FULLEST EXTENT 
27+  * ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN ANY WAY 
28+  * RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY, 
29+  * THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE. 
3730 * 
3831 * \asf_license_stop 
3932 * 
5952												(same start/stop conditions) ==> I2C only. Parameter:tstrNmI2cSpecial */ 
6053#define  NM_BUS_IOCTL_RW 			((uint8)3)	/*!< Read/Write at the same time ==> SPI only. Parameter:tstrNmSpiRw */ 
6154
62- #define  NM_BUS_IOCTL_WR_RESTART 	((uint8)4)				/*!< Write buffer then made restart condition then read ==> I2C only. parameter:tstrNmI2cSpecial */ 
55+ #define  NM_BUS_IOCTL_WR_RESTART 	((uint8)4)				/*!< Write buffer then made restart condition then read ==> I2C only. parameter:tstrNmI2cSpecial */   
6356/** 
6457*	@struct	tstrNmBusCapabilities 
6558*	@brief	Structure holding bus capabilities information 
6659*	@sa	NM_BUS_TYPE_I2C, NM_BUS_TYPE_SPI 
67- */ 
60+ */   
6861typedef  struct 
6962{
7063	uint16 	u16MaxTrxSz ;	/*!< Maximum transfer size. Must be >= 16 bytes*/ 
@@ -74,7 +67,7 @@ typedef struct
7467*	@struct	tstrNmI2cDefault 
7568*	@brief	Structure holding I2C default operation parameters 
7669*	@sa		NM_BUS_IOCTL_R, NM_BUS_IOCTL_W 
77- */ 
70+ */   
7871typedef  struct 
7972{
8073	uint8  u8SlaveAdr ;
@@ -86,12 +79,12 @@ typedef struct
8679*	@struct	tstrNmI2cSpecial 
8780*	@brief	Structure holding I2C special operation parameters 
8881*	@sa		NM_BUS_IOCTL_W_SPECIAL 
89- */ 
82+ */   
9083typedef  struct 
9184{
9285	uint8  u8SlaveAdr ;
9386	uint8 	* pu8Buf1 ;	/*!< pointer to the 1st buffer */ 
94- 	uint8 	* pu8Buf2 ;	/*!< pointer to the 2nd buffer */ 
87+ 	uint8 	* pu8Buf2 ;	/*!< pointer to the 2nd buffer */ 	 
9588	uint16 	u16Sz1 ;		/*!< 1st buffer size */ 
9689	uint16 	u16Sz2 ;		/*!< 2nd buffer size */ 
9790} tstrNmI2cSpecial ;
@@ -100,22 +93,22 @@ typedef struct
10093*	@struct	tstrNmSpiRw 
10194*	@brief	Structure holding SPI R/W parameters 
10295*	@sa		NM_BUS_IOCTL_RW 
103- */ 
96+ */   
10497typedef  struct 
10598{
106- 	uint8 	* pu8InBuf ;		/*!< pointer to input buffer. 
99+ 	uint8 	* pu8InBuf ;		/*!< pointer to input buffer.   
107100							Can be set to null and in this case zeros should be sent at MOSI */ 
108- 	uint8 	* pu8OutBuf ;		/*!< pointer to output buffer. 
101+ 	uint8 	* pu8OutBuf ;		/*!< pointer to output buffer.   
109102							Can be set to null and in this case data from MISO can be ignored  */ 
110- 	uint16 	u16Sz ;			/*!< Transfere size */ 
103+ 	uint16 	u16Sz ;			/*!< Transfere size */ 	 
111104} tstrNmSpiRw ;
112105
113106
114107/** 
115108*	@struct	tstrNmUartDefault 
116109*	@brief	Structure holding UART default operation parameters 
117110*	@sa		NM_BUS_IOCTL_R, NM_BUS_IOCTL_W 
118- */ 
111+ */   
119112typedef  struct 
120113{
121114	uint8 	* pu8Buf ;	/*!< Operation buffer */ 
@@ -132,7 +125,7 @@ extern tstrNmBusCapabilities egstrNmBusCapabilities;
132125*	@fn		nm_bus_init 
133126*	@brief	Initialize the bus wrapper 
134127*	@return	ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure 
135- */ 
128+ */   
136129sint8  nm_bus_init (void  * );
137130
138131/** 
@@ -144,14 +137,14 @@ sint8 nm_bus_init(void *);
144137*					Arbitrary parameter depending on IOCTL 
145138*	@return	ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure 
146139*	@note	For SPI only, it's important to be able to send/receive at the same time 
147- */ 
140+ */   
148141sint8  nm_bus_ioctl (uint8  u8Cmd , void *  pvParameter );
149142
150143/** 
151144*	@fn		nm_bus_deinit 
152145*	@brief	De-initialize the bus wrapper 
153146*	@return	ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure 
154- */ 
147+ */   
155148sint8  nm_bus_deinit (void );
156149
157150/* 
@@ -166,11 +159,24 @@ sint8 nm_bus_reinit(void *);
166159*	@fn			nm_bus_get_chip_type 
167160*	@brief		get chip type 
168161*	@return		ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure 
169- */ 
162+ */   
170163#ifdef  CONF_WINC_USE_UART 
171164uint8  nm_bus_get_chip_type (void );
172165sint8  nm_bus_break (void );
173166#endif 
167+ 
168+ /** 
169+  *  @fn         spi_rw 
170+  *  @brief      Process SPI Read/Write operation 
171+  *  @param      pu8Mosi TX Data buffer 
172+  *  @param      pu8Miso RX Data buffer 
173+  *  @param      u16Sz Transfer length 
174+  *  @return     ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure 
175+  */ 
176+ #ifdef  CONF_WINC_USE_SPI 
177+ sint8  nm_spi_rw (uint8 *  pu8Mosi , uint8 *  pu8Miso , uint16  u16Sz );
178+ #endif 
179+ 
174180#ifdef  __cplusplus 
175181	 }
176182 #endif 
0 commit comments