提交 | 用户 | age
|
a7db3c
|
1 |
//*****************************************************************************
|
Q |
2 |
//
|
|
3 |
//! \file wizchip_conf.h
|
|
4 |
//! \brief WIZCHIP Config Header File.
|
|
5 |
//! \version 1.0.0
|
|
6 |
//! \date 2013/10/21
|
|
7 |
//! \par Revision history
|
|
8 |
//! <2013/10/21> 1st Release
|
|
9 |
//! \author MidnightCow
|
|
10 |
//! \copyright
|
|
11 |
//!
|
|
12 |
//! Copyright (c) 2013, WIZnet Co., LTD.
|
|
13 |
//! All rights reserved.
|
|
14 |
//!
|
|
15 |
//! Redistribution and use in source and binary forms, with or without
|
|
16 |
//! modification, are permitted provided that the following conditions
|
|
17 |
//! are met:
|
|
18 |
//!
|
|
19 |
//! * Redistributions of source code must retain the above copyright
|
|
20 |
//! notice, this list of conditions and the following disclaimer.
|
|
21 |
//! * Redistributions in binary form must reproduce the above copyright
|
|
22 |
//! notice, this list of conditions and the following disclaimer in the
|
|
23 |
//! documentation and/or other materials provided with the distribution.
|
|
24 |
//! * Neither the name of the <ORGANIZATION> nor the names of its
|
|
25 |
//! contributors may be used to endorse or promote products derived
|
|
26 |
//! from this software without specific prior written permission.
|
|
27 |
//!
|
|
28 |
//! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
29 |
//! AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
30 |
//! IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
31 |
//! ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
32 |
//! LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
33 |
//! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
34 |
//! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
35 |
//! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
36 |
//! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
37 |
//! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
|
38 |
//! THE POSSIBILITY OF SUCH DAMAGE.
|
|
39 |
//
|
|
40 |
//*****************************************************************************
|
|
41 |
|
|
42 |
/**
|
|
43 |
* @defgroup extra_functions 2. WIZnet Extra Functions
|
|
44 |
*
|
|
45 |
* @brief These functions is optional function. It could be replaced at WIZCHIP I/O function because they were made by WIZCHIP I/O functions.
|
|
46 |
* @details There are functions of configuring WIZCHIP, network, interrupt, phy, network information and timer. \n
|
|
47 |
*
|
|
48 |
*/
|
|
49 |
|
|
50 |
#ifndef _WIZCHIP_CONF_H_
|
|
51 |
#define _WIZCHIP_CONF_H_
|
|
52 |
|
|
53 |
#include <stdint.h>
|
|
54 |
/**
|
|
55 |
* @brief Select WIZCHIP.
|
|
56 |
* @todo You should select one, \b 5100, \b 5200 ,\b 5500 or etc. \n\n
|
|
57 |
* ex> <code> #define \_WIZCHIP_ 5500 </code>
|
|
58 |
*/
|
|
59 |
#define _WIZCHIP_ 5500 // 5100, 5200, 5500
|
|
60 |
|
|
61 |
#define _WIZCHIP_IO_MODE_NONE_ 0x0000
|
|
62 |
#define _WIZCHIP_IO_MODE_BUS_ 0x0100 /**< Bus interface mode */
|
|
63 |
#define _WIZCHIP_IO_MODE_SPI_ 0x0200 /**< SPI interface mode */
|
|
64 |
//#define _WIZCHIP_IO_MODE_IIC_ 0x0400
|
|
65 |
//#define _WIZCHIP_IO_MODE_SDIO_ 0x0800
|
|
66 |
// Add to
|
|
67 |
//
|
|
68 |
|
|
69 |
#define _WIZCHIP_IO_MODE_BUS_DIR_ (_WIZCHIP_IO_MODE_BUS_ + 1) /**< BUS interface mode for direct */
|
|
70 |
#define _WIZCHIP_IO_MODE_BUS_INDIR_ (_WIZCHIP_IO_MODE_BUS_ + 2) /**< BUS interface mode for indirect */
|
|
71 |
|
|
72 |
#define _WIZCHIP_IO_MODE_SPI_VDM_ (_WIZCHIP_IO_MODE_SPI_ + 1) /**< SPI interface mode for variable length data*/
|
|
73 |
#define _WIZCHIP_IO_MODE_SPI_FDM_ (_WIZCHIP_IO_MODE_SPI_ + 2) /**< SPI interface mode for fixed length data mode*/
|
|
74 |
|
|
75 |
|
|
76 |
#if (_WIZCHIP_ == 5100)
|
|
77 |
#define _WIZCHIP_ID_ "W5100\0"
|
|
78 |
/**
|
|
79 |
* @brief Define interface mode.
|
|
80 |
* @todo you should select interface mode as chip. Select one of @ref \_WIZCHIP_IO_MODE_SPI_ , @ref \_WIZCHIP_IO_MODE_BUS_DIR_ or @ref \_WIZCHIP_IO_MODE_BUS_INDIR_
|
|
81 |
*/
|
|
82 |
|
|
83 |
// #define _WIZCHIP_IO_MODE_ _WIZCHIP_IO_MODE_BUS_DIR_
|
|
84 |
// #define _WIZCHIP_IO_MODE_ _WIZCHIP_IO_MODE_BUS_INDIR_
|
|
85 |
#define _WIZCHIP_IO_MODE_ _WIZCHIP_IO_MODE_SPI_
|
|
86 |
|
|
87 |
#elif (_WIZCHIP_ == 5200)
|
|
88 |
#define _WIZCHIP_ID_ "W5200\0"
|
|
89 |
/**
|
|
90 |
* @brief Define interface mode.
|
|
91 |
* @todo you should select interface mode as chip. Select one of @ref \_WIZCHIP_IO_MODE_SPI_ or @ref \_WIZCHIP_IO_MODE_BUS_INDIR_
|
|
92 |
*/
|
|
93 |
// #define _WIZCHIP_IO_MODE_ _WIZCHIP_IO_MODE_BUS_INDIR_
|
|
94 |
#define _WIZCHIP_IO_MODE_ _WIZCHIP_IO_MODE_SPI_
|
|
95 |
#include "W5200/w5200.h"
|
|
96 |
#elif (_WIZCHIP_ == 5500)
|
|
97 |
#define _WIZCHIP_ID_ "W5500\0"
|
|
98 |
|
|
99 |
/**
|
|
100 |
* @brief Define interface mode. \n
|
|
101 |
* @todo Should select interface mode as chip.
|
|
102 |
* - @ref \_WIZCHIP_IO_MODE_SPI_ \n
|
|
103 |
* -@ref \_WIZCHIP_IO_MODE_SPI_VDM_ : Valid only in @ref \_WIZCHIP_ == 5500 \n
|
|
104 |
* -@ref \_WIZCHIP_IO_MODE_SPI_FDM_ : Valid only in @ref \_WIZCHIP_ == 5500 \n
|
|
105 |
* - @ref \_WIZCHIP_IO_MODE_BUS_ \n
|
|
106 |
* - @ref \_WIZCHIP_IO_MODE_BUS_DIR_ \n
|
|
107 |
* - @ref \_WIZCHIP_IO_MODE_BUS_INDIR_ \n
|
|
108 |
* - Others will be defined in future. \n\n
|
|
109 |
* ex> <code> #define \_WIZCHIP_IO_MODE_ \_WIZCHIP_IO_MODE_SPI_VDM_ </code>
|
|
110 |
*
|
|
111 |
*/
|
|
112 |
//#define _WIZCHIP_IO_MODE_ _WIZCHIP_IO_MODE_SPI_FDM_
|
|
113 |
#define _WIZCHIP_IO_MODE_ _WIZCHIP_IO_MODE_SPI_VDM_
|
|
114 |
#include "W5500/w5500.h"
|
|
115 |
#else
|
|
116 |
#error "Unknown defined _WIZCHIP_. You should define one of 5100, 5200, and 5500 !!!"
|
|
117 |
#endif
|
|
118 |
|
|
119 |
#ifndef _WIZCHIP_IO_MODE_
|
|
120 |
#error "Undefined _WIZCHIP_IO_MODE_. You should define it !!!"
|
|
121 |
#endif
|
|
122 |
|
|
123 |
/**
|
|
124 |
* @brief Define I/O base address when BUS IF mode.
|
|
125 |
* @todo Should re-define it to fit your system when BUS IF Mode (@ref \_WIZCHIP_IO_MODE_BUS_,
|
|
126 |
* @ref \_WIZCHIP_IO_MODE_BUS_DIR_, @ref \_WIZCHIP_IO_MODE_BUS_INDIR_). \n\n
|
|
127 |
* ex> <code> #define \_WIZCHIP_IO_BASE_ 0x00008000 </code>
|
|
128 |
*/
|
|
129 |
#define _WIZCHIP_IO_BASE_ 0x00000000 //
|
|
130 |
|
|
131 |
#if _WIZCHIP_IO_MODE_ & _WIZCHIP_IO_MODE_BUS
|
|
132 |
#ifndef _WIZCHIP_IO_BASE_
|
|
133 |
#error "You should be define _WIZCHIP_IO_BASE to fit your system memory map."
|
|
134 |
#endif
|
|
135 |
#endif
|
|
136 |
|
|
137 |
#if _WIZCHIP_ > 5100
|
|
138 |
#define _WIZCHIP_SOCK_NUM_ 8 ///< The count of independant socket of @b WIZCHIP
|
|
139 |
#else
|
|
140 |
#define _WIZCHIP_SOCK_NUM_ 4 ///< The count of independant socket of @b WIZCHIP
|
|
141 |
#endif
|
|
142 |
|
|
143 |
|
|
144 |
/********************************************************
|
|
145 |
* WIZCHIP BASIC IF functions for SPI, SDIO, I2C , ETC.
|
|
146 |
*********************************************************/
|
|
147 |
/**
|
|
148 |
* @ingroup DATA_TYPE
|
|
149 |
* @brief The set of callback functions for W5500:@ref WIZCHIP_IO_Functions W5200:@ref WIZCHIP_IO_Functions_W5200
|
|
150 |
*/
|
|
151 |
typedef struct __WIZCHIP
|
|
152 |
{
|
|
153 |
uint16_t if_mode; ///< host interface mode
|
|
154 |
uint8_t id[6]; ///< @b WIZCHIP ID such as @b 5100, @b 5200, @b 5500, and so on.
|
|
155 |
/**
|
|
156 |
* The set of critical section callback func.
|
|
157 |
*/
|
|
158 |
struct _CRIS
|
|
159 |
{
|
|
160 |
void (*_enter) (void); ///< crtical section enter
|
|
161 |
void (*_exit) (void); ///< critial section exit
|
|
162 |
}CRIS;
|
|
163 |
/**
|
|
164 |
* The set of @ref\_WIZCHIP_ select control callback func.
|
|
165 |
*/
|
|
166 |
struct _CS
|
|
167 |
{
|
|
168 |
void (*_select) (void); ///< @ref \_WIZCHIP_ selected
|
|
169 |
void (*_deselect)(void); ///< @ref \_WIZCHIP_ deselected
|
|
170 |
}CS;
|
|
171 |
/**
|
|
172 |
* The set of interface IO callback func.
|
|
173 |
*/
|
|
174 |
union _IF
|
|
175 |
{
|
|
176 |
/**
|
|
177 |
* For BUS interface IO
|
|
178 |
*/
|
|
179 |
struct
|
|
180 |
{
|
|
181 |
uint8_t (*_read_byte) (uint32_t AddrSel);
|
|
182 |
void (*_write_byte) (uint32_t AddrSel, uint8_t wb);
|
|
183 |
}BUS;
|
|
184 |
/**
|
|
185 |
* For SPI interface IO
|
|
186 |
*/
|
|
187 |
struct
|
|
188 |
{
|
|
189 |
uint8_t (*_read_byte) (void);
|
|
190 |
void (*_write_byte) (uint8_t wb);
|
|
191 |
}SPI;
|
|
192 |
// To be added
|
|
193 |
//
|
|
194 |
}IF;
|
|
195 |
}_WIZCHIP;
|
|
196 |
|
|
197 |
extern _WIZCHIP WIZCHIP;
|
|
198 |
|
|
199 |
/**
|
|
200 |
* @ingroup DATA_TYPE
|
|
201 |
* WIZCHIP control type enumration used in @ref ctlwizchip().
|
|
202 |
*/
|
|
203 |
typedef enum
|
|
204 |
{
|
|
205 |
CW_RESET_WIZCHIP, ///< Resets WIZCHIP by softly
|
|
206 |
CW_INIT_WIZCHIP, ///< Inializes to WIZCHIP with SOCKET buffer size 2 or 1 dimension array typed uint8_t.
|
|
207 |
CW_GET_INTERRUPT, ///< Get Interrupt status of WIZCHIP
|
|
208 |
CW_CLR_INTERRUPT, ///< Clears interrupt
|
|
209 |
CW_SET_INTRMASK, ///< Masks interrupt
|
|
210 |
CW_GET_INTRMASK, ///< Get interrupt mask
|
|
211 |
CW_SET_INTRTIME, ///< Set interval time between the current and next interrupt.
|
|
212 |
CW_GET_INTRTIME, ///< Set interval time between the current and next interrupt.
|
|
213 |
CW_GET_ID, ///< Gets WIZCHIP name.
|
|
214 |
|
|
215 |
#if _WIZCHIP_ == 5500
|
|
216 |
CW_RESET_PHY, ///< Resets internal PHY. Valid Only W5000
|
|
217 |
CW_SET_PHYCONF, ///< When PHY configured by interal register, PHY operation mode (Manual/Auto, 10/100, Half/Full). Valid Only W5000
|
|
218 |
CW_GET_PHYCONF, ///< Get PHY operation mode in interal register. Valid Only W5000
|
|
219 |
CW_GET_PHYSTATUS, ///< Get real PHY status on operating. Valid Only W5000
|
|
220 |
CW_SET_PHYPOWMODE, ///< Set PHY power mode as noraml and down when PHYSTATUS.OPMD == 1. Valid Only W5000
|
|
221 |
#endif
|
|
222 |
CW_GET_PHYPOWMODE, ///< Get PHY Power mode as down or normal
|
|
223 |
CW_GET_PHYLINK ///< Get PHY Link status
|
|
224 |
}ctlwizchip_type;
|
|
225 |
|
|
226 |
/**
|
|
227 |
* @ingroup DATA_TYPE
|
|
228 |
* Network control type enumration used in @ref ctlnetwork().
|
|
229 |
*/
|
|
230 |
typedef enum
|
|
231 |
{
|
|
232 |
CN_SET_NETINFO, ///< Set Network with @ref wiz_NetInfo
|
|
233 |
CN_GET_NETINFO, ///< Get Network with @ref wiz_NetInfo
|
|
234 |
CN_SET_NETMODE, ///< Set network mode as WOL, PPPoE, Ping Block, and Force ARP mode
|
|
235 |
CN_GET_NETMODE, ///< Get network mode as WOL, PPPoE, Ping Block, and Force ARP mode
|
|
236 |
CN_SET_TIMEOUT, ///< Set network timeout as retry count and time.
|
|
237 |
CN_GET_TIMEOUT, ///< Get network timeout as retry count and time.
|
|
238 |
}ctlnetwork_type;
|
|
239 |
|
|
240 |
/**
|
|
241 |
* @ingroup DATA_TYPE
|
|
242 |
* Interrupt kind when CW_SET_INTRRUPT, CW_GET_INTERRUPT, CW_SET_INTRMASK
|
|
243 |
* and CW_GET_INTRMASK is used in @ref ctlnetwork().
|
|
244 |
* It can be used with OR operation.
|
|
245 |
*/
|
|
246 |
typedef enum
|
|
247 |
{
|
|
248 |
#if _WIZCHIP_ > 5200
|
|
249 |
IK_WOL = (1 << 4), ///< Wake On Lan by receiving the magic packet. Valid in W500.
|
|
250 |
#endif
|
|
251 |
|
|
252 |
IK_PPPOE_TERMINATED = (1 << 5), ///< PPPoE Disconnected
|
|
253 |
|
|
254 |
#if _WIZCHIP_ != 5200
|
|
255 |
IK_DEST_UNREACH = (1 << 6), ///< Destination IP & Port Unreable, No use in W5200
|
|
256 |
#endif
|
|
257 |
|
|
258 |
IK_IP_CONFLICT = (1 << 7), ///< IP conflict occurred
|
|
259 |
|
|
260 |
IK_SOCK_0 = (1 << 8), ///< Socket 0 interrupt
|
|
261 |
IK_SOCK_1 = (1 << 9), ///< Socket 1 interrupt
|
|
262 |
IK_SOCK_2 = (1 << 10), ///< Socket 2 interrupt
|
|
263 |
IK_SOCK_3 = (1 << 11), ///< Socket 3 interrupt
|
|
264 |
#if _WIZCHIP_ > 5100
|
|
265 |
IK_SOCK_4 = (1 << 12), ///< Socket 4 interrupt, No use in 5100
|
|
266 |
IK_SOCK_5 = (1 << 13), ///< Socket 5 interrupt, No use in 5100
|
|
267 |
IK_SOCK_6 = (1 << 14), ///< Socket 6 interrupt, No use in 5100
|
|
268 |
IK_SOCK_7 = (1 << 15), ///< Socket 7 interrupt, No use in 5100
|
|
269 |
#endif
|
|
270 |
|
|
271 |
#if _WIZCHIP_ > 5100
|
|
272 |
IK_SOCK_ALL = (0xFF << 8) ///< All Socket interrpt
|
|
273 |
#else
|
|
274 |
IK_SOCK_ALL = (0x0F << 8) ///< All Socket interrpt
|
|
275 |
#endif
|
|
276 |
}intr_kind;
|
|
277 |
|
|
278 |
#define PHY_CONFBY_HW 0 ///< Configured PHY operation mode by HW pin
|
|
279 |
#define PHY_CONFBY_SW 1 ///< Configured PHY operation mode by SW register
|
|
280 |
#define PHY_MODE_MANUAL 0 ///< Configured PHY operation mode with user setting.
|
|
281 |
#define PHY_MODE_AUTONEGO 1 ///< Configured PHY operation mode with auto-negotiation
|
|
282 |
#define PHY_SPEED_10 0 ///< Link Speed 10
|
|
283 |
#define PHY_SPEED_100 1 ///< Link Speed 100
|
|
284 |
#define PHY_DUPLEX_HALF 0 ///< Link Half-Duplex
|
|
285 |
#define PHY_DUPLEX_FULL 1 ///< Link Full-Duplex
|
|
286 |
#define PHY_LINK_OFF 0 ///< Link Off
|
|
287 |
#define PHY_LINK_ON 1 ///< Link On
|
|
288 |
#define PHY_POWER_NORM 0 ///< PHY power normal mode
|
|
289 |
#define PHY_POWER_DOWN 1 ///< PHY power down mode
|
|
290 |
|
|
291 |
|
|
292 |
#if _WIZCHIP_ == 5500
|
|
293 |
/**
|
|
294 |
* @ingroup DATA_TYPE
|
|
295 |
* It configures PHY configuration when CW_SET PHYCONF or CW_GET_PHYCONF in W5500,
|
|
296 |
* and it indicates the real PHY status configured by HW or SW in all WIZCHIP. \n
|
|
297 |
* Valid only in W5500.
|
|
298 |
*/
|
|
299 |
typedef struct wiz_PhyConf_t
|
|
300 |
{
|
|
301 |
uint8_t by; ///< set by @ref PHY_CONFBY_HW or @ref PHY_CONFBY_SW
|
|
302 |
uint8_t mode; ///< set by @ref PHY_MODE_MANUAL or @ref PHY_MODE_AUTONEGO
|
|
303 |
uint8_t speed; ///< set by @ref PHY_SPEED_10 or @ref PHY_SPEED_100
|
|
304 |
uint8_t duplex; ///< set by @ref PHY_DUPLEX_HALF @ref PHY_DUPLEX_FULL
|
|
305 |
//uint8_t power; ///< set by @ref PHY_POWER_NORM or @ref PHY_POWER_DOWN
|
|
306 |
//uint8_t link; ///< Valid only in CW_GET_PHYSTATUS. set by @ref PHY_LINK_ON or PHY_DUPLEX_OFF
|
|
307 |
}wiz_PhyConf;
|
|
308 |
#endif
|
|
309 |
|
|
310 |
/**
|
|
311 |
* @ingroup DATA_TYPE
|
|
312 |
* It used in setting dhcp_mode of @ref wiz_NetInfo.
|
|
313 |
*/
|
|
314 |
typedef enum
|
|
315 |
{
|
|
316 |
NETINFO_STATIC = 1, ///< Static IP configuration by manually.
|
|
317 |
NETINFO_DHCP ///< Dynamic IP configruation from a DHCP sever
|
|
318 |
}dhcp_mode;
|
|
319 |
|
|
320 |
/**
|
|
321 |
* @ingroup DATA_TYPE
|
|
322 |
* Network Information for WIZCHIP
|
|
323 |
*/
|
|
324 |
typedef struct wiz_NetInfo_t
|
|
325 |
{
|
|
326 |
uint8_t mac[6]; ///< Source Mac Address
|
|
327 |
uint8_t ip[4]; ///< Source IP Address
|
|
328 |
uint8_t sn[4]; ///< Subnet Mask
|
|
329 |
uint8_t gw[4]; ///< Gateway IP Address
|
|
330 |
uint8_t dns[4]; ///< DNS server IP Address
|
|
331 |
dhcp_mode dhcp; ///< 1 - Static, 2 - DHCP
|
|
332 |
}wiz_NetInfo;
|
|
333 |
|
|
334 |
/**
|
|
335 |
* @ingroup DATA_TYPE
|
|
336 |
* Network mode
|
|
337 |
*/
|
|
338 |
typedef enum
|
|
339 |
{
|
|
340 |
#if _WIZCHIP_ == 5500
|
|
341 |
NM_FORCEARP = (1<<1), ///< Force to APP send whenever udp data is sent. Valid only in W5500
|
|
342 |
#endif
|
|
343 |
NM_WAKEONLAN = (1<<5), ///< Wake On Lan
|
|
344 |
NM_PINGBLOCK = (1<<4), ///< Block ping-request
|
|
345 |
NM_PPPOE = (1<<3), ///< PPPoE mode
|
|
346 |
}netmode_type;
|
|
347 |
|
|
348 |
/**
|
|
349 |
* @ingroup DATA_TYPE
|
|
350 |
* Used in CN_SET_TIMEOUT or CN_GET_TIMEOUT of @ref ctlwizchip() for timeout configruation.
|
|
351 |
*/
|
|
352 |
typedef struct wiz_NetTimeout_t
|
|
353 |
{
|
|
354 |
uint8_t retry_cnt; ///< retry count
|
|
355 |
uint16_t time_100us; ///< time unit 100us
|
|
356 |
}wiz_NetTimeout;
|
|
357 |
|
|
358 |
/**
|
|
359 |
*@brief Registers call back function for critical section of I/O functions such as
|
|
360 |
*\ref WIZCHIP_READ, @ref WIZCHIP_WRITE, @ref WIZCHIP_READ_BUF and @ref WIZCHIP_WRITE_BUF.
|
|
361 |
*@param cris_en : callback function for critical section enter.
|
|
362 |
*@param cris_ex : callback function for critical section exit.
|
|
363 |
*@todo Describe @ref WIZCHIP_CRITICAL_ENTER and @ref WIZCHIP_CRITICAL_EXIT marco or register your functions.
|
|
364 |
*@note If you do not describe or register, default functions(@ref wizchip_cris_enter & @ref wizchip_cris_exit) is called.
|
|
365 |
*/
|
|
366 |
void reg_wizchip_cris_cbfunc(void(*cris_en)(void), void(*cris_ex)(void));
|
|
367 |
|
|
368 |
|
|
369 |
/**
|
|
370 |
*@brief Registers call back function for WIZCHIP select & deselect.
|
|
371 |
*@param cs_sel : callback function for WIZCHIP select
|
|
372 |
*@param cs_desel : callback fucntion for WIZCHIP deselect
|
|
373 |
*@todo Describe @ref wizchip_cs_select and @ref wizchip_cs_deselect function or register your functions.
|
|
374 |
*@note If you do not describe or register, null function is called.
|
|
375 |
*/
|
|
376 |
void reg_wizchip_cs_cbfunc(void(*cs_sel)(void), void(*cs_desel)(void));
|
|
377 |
|
|
378 |
/**
|
|
379 |
*@brief Registers call back function for bus interface.
|
|
380 |
*@param bus_rb : callback function to read byte data using system bus
|
|
381 |
*@param bus_wb : callback function to write byte data using system bus
|
|
382 |
*@todo Describe @ref wizchip_bus_readbyte and @ref wizchip_bus_writebyte function
|
|
383 |
*or register your functions.
|
|
384 |
*@note If you do not describe or register, null function is called.
|
|
385 |
*/
|
|
386 |
void reg_wizchip_bus_cbfunc(uint8_t (*bus_rb)(uint32_t addr), void (*bus_wb)(uint32_t addr, uint8_t wb));
|
|
387 |
|
|
388 |
/**
|
|
389 |
*@brief Registers call back function for SPI interface.
|
|
390 |
*@param spi_rb : callback function to read byte usig SPI
|
|
391 |
*@param spi_wb : callback function to write byte usig SPI
|
|
392 |
*@todo Describe \ref wizchip_spi_readbyte and \ref wizchip_spi_writebyte function
|
|
393 |
*or register your functions.
|
|
394 |
*@note If you do not describe or register, null function is called.
|
|
395 |
*/
|
|
396 |
void reg_wizchip_spi_cbfunc(uint8_t (*spi_rb)(void), void (*spi_wb)(uint8_t wb));
|
|
397 |
|
|
398 |
/**
|
|
399 |
* @ingroup extra_functions
|
|
400 |
* @brief Controls to the WIZCHIP.
|
|
401 |
* @details Resets WIZCHIP & internal PHY, Configures PHY mode, Monitor PHY(Link,Speed,Half/Full/Auto),
|
|
402 |
* controls interrupt & mask and so on.
|
|
403 |
* @param cwtype : Decides to the control type
|
|
404 |
* @param arg : arg type is dependent on cwtype.
|
|
405 |
* @return 0 : Success \n
|
|
406 |
* -1 : Fail because of invalid \ref ctlwizchip_type or unsupported \ref ctlwizchip_type in WIZCHIP
|
|
407 |
*/
|
|
408 |
int8_t ctlwizchip(ctlwizchip_type cwtype, void* arg);
|
|
409 |
|
|
410 |
/**
|
|
411 |
* @ingroup extra_functions
|
|
412 |
* @brief Controls to network.
|
|
413 |
* @details Controls to network environment, mode, timeout and so on.
|
|
414 |
* @param cntype : Input. Decides to the control type
|
|
415 |
* @param arg : Inout. arg type is dependent on cntype.
|
|
416 |
* @return -1 : Fail because of invalid \ref ctlnetwork_type or unsupported \ref ctlnetwork_type in WIZCHIP \n
|
|
417 |
* 0 : Success
|
|
418 |
*/
|
|
419 |
int8_t ctlnetwork(ctlnetwork_type cntype, void* arg);
|
|
420 |
|
|
421 |
|
|
422 |
/*
|
|
423 |
* The following functions are implemented for internal use.
|
|
424 |
* but You can call these functions for code size reduction instead of ctlwizchip() and ctlnetwork().
|
|
425 |
*/
|
|
426 |
|
|
427 |
/**
|
|
428 |
* @ingroup extra_functions
|
|
429 |
* @brief Reset WIZCHIP by softly.
|
|
430 |
*/
|
|
431 |
void wizchip_sw_reset(void);
|
|
432 |
|
|
433 |
/**
|
|
434 |
* @ingroup extra_functions
|
|
435 |
* @brief Initializes WIZCHIP with socket buffer size
|
|
436 |
* @param txsize Socket tx buffer sizes. If null, initialized the default size 2KB.
|
|
437 |
* @param rxsize Socket rx buffer sizes. If null, initialized the default size 2KB.
|
|
438 |
* @return 0 : succcess \n
|
|
439 |
* -1 : fail. Invalid buffer size
|
|
440 |
*/
|
|
441 |
int8_t wizchip_init(uint8_t* txsize, uint8_t* rxsize);
|
|
442 |
|
|
443 |
/**
|
|
444 |
* @ingroup extra_functions
|
|
445 |
* @brief Clear Interrupt of WIZCHIP.
|
|
446 |
* @param intr : @ref intr_kind value operated OR. It can type-cast to uint16_t.
|
|
447 |
*/
|
|
448 |
void wizchip_clrinterrupt(intr_kind intr);
|
|
449 |
|
|
450 |
/**
|
|
451 |
* @ingroup extra_functions
|
|
452 |
* @brief Get Interrupt of WIZCHIP.
|
|
453 |
* @return @ref intr_kind value operated OR. It can type-cast to uint16_t.
|
|
454 |
*/
|
|
455 |
intr_kind wizchip_getinterrupt(void);
|
|
456 |
|
|
457 |
/**
|
|
458 |
* @ingroup extra_functions
|
|
459 |
* @brief Mask or Unmask Interrupt of WIZCHIP.
|
|
460 |
* @param intr : @ref intr_kind value operated OR. It can type-cast to uint16_t.
|
|
461 |
*/
|
|
462 |
void wizchip_setinterruptmask(intr_kind intr);
|
|
463 |
|
|
464 |
/**
|
|
465 |
* @ingroup extra_functions
|
|
466 |
* @brief Get Interrupt mask of WIZCHIP.
|
|
467 |
* @return : The operated OR vaule of @ref intr_kind. It can type-cast to uint16_t.
|
|
468 |
*/
|
|
469 |
intr_kind wizchip_getinterruptmask(void);
|
|
470 |
|
|
471 |
#if _WIZCHIP_ > 5100
|
|
472 |
int8_t wizphy_getphylink(void); ///< get the link status of phy in WIZCHIP. No use in W5100
|
|
473 |
int8_t wizphy_getphypmode(void); ///< get the power mode of PHY in WIZCHIP. No use in W5100
|
|
474 |
#endif
|
|
475 |
|
|
476 |
#if _WIZCHIP_ == 5500
|
|
477 |
void wizphy_reset(void); ///< Reset phy. Vailid only in W5500
|
|
478 |
/**
|
|
479 |
* @ingroup extra_functions
|
|
480 |
* @brief Set the phy information for WIZCHIP without power mode
|
|
481 |
* @param phyconf : @ref wiz_PhyConf
|
|
482 |
*/
|
|
483 |
void wizphy_setphyconf(wiz_PhyConf* phyconf);
|
|
484 |
/**
|
|
485 |
* @ingroup extra_functions
|
|
486 |
* @brief Get phy configuration information.
|
|
487 |
* @param phyconf : @ref wiz_PhyConf
|
|
488 |
*/
|
|
489 |
void wizphy_getphyconf(wiz_PhyConf* phyconf);
|
|
490 |
/**
|
|
491 |
* @ingroup extra_functions
|
|
492 |
* @brief Get phy status.
|
|
493 |
* @param phyconf : @ref wiz_PhyConf
|
|
494 |
*/
|
|
495 |
void wizphy_getphystat(wiz_PhyConf* phyconf);
|
|
496 |
/**
|
|
497 |
* @ingroup extra_functions
|
|
498 |
* @brief set the power mode of phy inside WIZCHIP. Refer to @ref PHYCFGR in W5500, @ref PHYSTATUS in W5200
|
|
499 |
* @param pmode Settig value of power down mode.
|
|
500 |
*/
|
|
501 |
int8_t wizphy_setphypmode(uint8_t pmode);
|
|
502 |
#endif
|
|
503 |
|
|
504 |
/**
|
|
505 |
* @ingroup extra_functions
|
|
506 |
* @brief Set the network information for WIZCHIP
|
|
507 |
* @param pnetinfo : @ref wizNetInfo
|
|
508 |
*/
|
|
509 |
void wizchip_setnetinfo(wiz_NetInfo* pnetinfo);
|
|
510 |
|
|
511 |
/**
|
|
512 |
* @ingroup extra_functions
|
|
513 |
* @brief Get the network information for WIZCHIP
|
|
514 |
* @param pnetinfo : @ref wizNetInfo
|
|
515 |
*/
|
|
516 |
void wizchip_getnetinfo(wiz_NetInfo* pnetinfo);
|
|
517 |
|
|
518 |
/**
|
|
519 |
* @ingroup extra_functions
|
|
520 |
* @brief Set the network mode such WOL, PPPoE, Ping Block, and etc.
|
|
521 |
* @param pnetinfo Value of network mode. Refer to @ref netmode_type.
|
|
522 |
*/
|
|
523 |
int8_t wizchip_setnetmode(netmode_type netmode);
|
|
524 |
|
|
525 |
/**
|
|
526 |
* @ingroup extra_functions
|
|
527 |
* @brief Get the network mode such WOL, PPPoE, Ping Block, and etc.
|
|
528 |
* @return Value of network mode. Refer to @ref netmode_type.
|
|
529 |
*/
|
|
530 |
netmode_type wizchip_getnetmode(void);
|
|
531 |
|
|
532 |
/**
|
|
533 |
* @ingroup extra_functions
|
|
534 |
* @brief Set retry time value(@ref RTR) and retry count(@ref RCR).
|
|
535 |
* @details @ref RTR configures the retransmission timeout period and @ref RCR configures the number of time of retransmission.
|
|
536 |
* @param nettime @ref RTR value and @ref RCR value. Refer to @ref wiz_NetTimeout.
|
|
537 |
*/
|
|
538 |
void wizchip_settimeout(wiz_NetTimeout* nettime);
|
|
539 |
|
|
540 |
/**
|
|
541 |
* @ingroup extra_functions
|
|
542 |
* @brief Get retry time value(@ref RTR) and retry count(@ref RCR).
|
|
543 |
* @details @ref RTR configures the retransmission timeout period and @ref RCR configures the number of time of retransmission.
|
|
544 |
* @param nettime @ref RTR value and @ref RCR value. Refer to @ref wiz_NetTimeout.
|
|
545 |
*/
|
|
546 |
void wizchip_gettimeout(wiz_NetTimeout* nettime);
|
|
547 |
|
|
548 |
#endif // _WIZCHIP_CONF_H_
|