4
4
*
5
5
* \brief This module contains NMC1000 bus wrapper APIs declarations.
6
6
*
7
- * Copyright (c) 2016-2017 Atmel Corporation. All rights reserved .
7
+ * Copyright (c) 2016-2021 Microchip Technology Inc. and its subsidiaries .
8
8
*
9
9
* \asf_license_start
10
10
*
11
11
* \page License
12
12
*
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.
15
18
*
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.
37
30
*
38
31
* \asf_license_stop
39
32
*
59
52
(same start/stop conditions) ==> I2C only. Parameter:tstrNmI2cSpecial */
60
53
#define NM_BUS_IOCTL_RW ((uint8)3) /*!< Read/Write at the same time ==> SPI only. Parameter:tstrNmSpiRw */
61
54
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 */
63
56
/**
64
57
* @struct tstrNmBusCapabilities
65
58
* @brief Structure holding bus capabilities information
66
59
* @sa NM_BUS_TYPE_I2C, NM_BUS_TYPE_SPI
67
- */
60
+ */
68
61
typedef struct
69
62
{
70
63
uint16 u16MaxTrxSz ; /*!< Maximum transfer size. Must be >= 16 bytes*/
@@ -74,7 +67,7 @@ typedef struct
74
67
* @struct tstrNmI2cDefault
75
68
* @brief Structure holding I2C default operation parameters
76
69
* @sa NM_BUS_IOCTL_R, NM_BUS_IOCTL_W
77
- */
70
+ */
78
71
typedef struct
79
72
{
80
73
uint8 u8SlaveAdr ;
@@ -86,12 +79,12 @@ typedef struct
86
79
* @struct tstrNmI2cSpecial
87
80
* @brief Structure holding I2C special operation parameters
88
81
* @sa NM_BUS_IOCTL_W_SPECIAL
89
- */
82
+ */
90
83
typedef struct
91
84
{
92
85
uint8 u8SlaveAdr ;
93
86
uint8 * pu8Buf1 ; /*!< pointer to the 1st buffer */
94
- uint8 * pu8Buf2 ; /*!< pointer to the 2nd buffer */
87
+ uint8 * pu8Buf2 ; /*!< pointer to the 2nd buffer */
95
88
uint16 u16Sz1 ; /*!< 1st buffer size */
96
89
uint16 u16Sz2 ; /*!< 2nd buffer size */
97
90
} tstrNmI2cSpecial ;
@@ -100,22 +93,22 @@ typedef struct
100
93
* @struct tstrNmSpiRw
101
94
* @brief Structure holding SPI R/W parameters
102
95
* @sa NM_BUS_IOCTL_RW
103
- */
96
+ */
104
97
typedef struct
105
98
{
106
- uint8 * pu8InBuf ; /*!< pointer to input buffer.
99
+ uint8 * pu8InBuf ; /*!< pointer to input buffer.
107
100
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.
109
102
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 */
111
104
} tstrNmSpiRw ;
112
105
113
106
114
107
/**
115
108
* @struct tstrNmUartDefault
116
109
* @brief Structure holding UART default operation parameters
117
110
* @sa NM_BUS_IOCTL_R, NM_BUS_IOCTL_W
118
- */
111
+ */
119
112
typedef struct
120
113
{
121
114
uint8 * pu8Buf ; /*!< Operation buffer */
@@ -132,7 +125,7 @@ extern tstrNmBusCapabilities egstrNmBusCapabilities;
132
125
* @fn nm_bus_init
133
126
* @brief Initialize the bus wrapper
134
127
* @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure
135
- */
128
+ */
136
129
sint8 nm_bus_init (void * );
137
130
138
131
/**
@@ -144,14 +137,14 @@ sint8 nm_bus_init(void *);
144
137
* Arbitrary parameter depending on IOCTL
145
138
* @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure
146
139
* @note For SPI only, it's important to be able to send/receive at the same time
147
- */
140
+ */
148
141
sint8 nm_bus_ioctl (uint8 u8Cmd , void * pvParameter );
149
142
150
143
/**
151
144
* @fn nm_bus_deinit
152
145
* @brief De-initialize the bus wrapper
153
146
* @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure
154
- */
147
+ */
155
148
sint8 nm_bus_deinit (void );
156
149
157
150
/*
@@ -166,11 +159,24 @@ sint8 nm_bus_reinit(void *);
166
159
* @fn nm_bus_get_chip_type
167
160
* @brief get chip type
168
161
* @return ZERO in case of success and M2M_ERR_BUS_FAIL in case of failure
169
- */
162
+ */
170
163
#ifdef CONF_WINC_USE_UART
171
164
uint8 nm_bus_get_chip_type (void );
172
165
sint8 nm_bus_break (void );
173
166
#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
+
174
180
#ifdef __cplusplus
175
181
}
176
182
#endif
0 commit comments