wizchip_conf.h 20 KB

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