//****************************************************************************/ //! //! \file wizchip_conf.c //! \brief WIZCHIP Config Header File. //! \version 1.0.1 //! \date 2013/10/21 //! \par Revision history //! <2015/02/05> Notice //! The version history is not updated after this point. //! Download the latest version directly from GitHub. Please visit the our GitHub repository for ioLibrary. //! >> https://github.com/Wiznet/ioLibrary_Driver //! <2014/05/01> V1.0.1 Refer to M20140501 //! 1. Explicit type casting in wizchip_bus_readdata() & wizchip_bus_writedata() // Issued by Mathias ClauBen. //! uint32_t type converts into ptrdiff_t first. And then recoverting it into uint8_t* //! For remove the warning when pointer type size is not 32bit. //! If ptrdiff_t doesn't support in your complier, You should must replace ptrdiff_t into your suitable pointer type. //! <2013/10/21> 1st Release //! \author MidnightCow //! \copyright //! //! Copyright (c) 2013, WIZnet Co., LTD. //! All rights reserved. //! //! Redistribution and use in source and binary forms, with or without //! modification, are permitted provided that the following conditions //! are met: //! //! * Redistributions of source code must retain the above copyright //! notice, this list of conditions and the following disclaimer. //! * 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. //! * Neither the name of the nor the names of its //! contributors may be used to endorse or promote products derived //! from this software without specific prior written permission. //! //! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" //! AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE //! IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE //! ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 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. // //*****************************************************************************/ //A20140501 : for use the type - ptrdiff_t /*****************************************************************************/ /* stddef.h v16.9.3 */ /* */ /* Copyright (c) 1993-2017 Texas Instruments Incorporated */ /* http://www.ti.com/ */ /* */ /* Redistribution and use in source and binary forms, with or without */ /* modification, are permitted provided that the following conditions */ /* are met: */ /* */ /* Redistributions of source code must retain the above copyright */ /* notice, this list of conditions and the following disclaimer. */ /* */ /* 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. */ /* */ /* Neither the name of Texas Instruments Incorporated nor the names */ /* of its contributors may be used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */ /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */ /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */ /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */ /* OWNER OR CONTRIBUTORS 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. */ /* */ /*****************************************************************************/ #pragma diag_push #pragma CHECK_MISRA("-19.7") /* macros required for implementation */ #pragma CHECK_MISRA("-20.1") /* standard headers must define standard names */ #pragma CHECK_MISRA("-20.2") /* standard headers must define standard names */ typedef int ptrdiff_t; typedef unsigned size_t; typedef unsigned short wchar_t; #pragma diag_push #pragma CHECK_MISRA("-19.10") /* need types as macro arguments */ #pragma diag_pop #pragma diag_push #pragma CHECK_MISRA("-19.15") /* code outside guard; see below comment */ /*-----------------------------------------------------------------------*/ /* Define _win_t, for compiling GCC libraries with the TI compiler. */ /* GCC's library (newlib) expects wint_t to be defined here, in stddef.h,*/ /* which is arguably incorrect, but we go along for compatibility. */ /* This is outside the _STDDEF guard in case this file has already */ /* been included without __need_wint_t. */ /*-----------------------------------------------------------------------*/ #pragma diag_pop // //***************************************************************************** // //! \file wizchip_conf.h //! \brief WIZCHIP Config Header File. //! \version 1.0.0 //! \date 2013/10/21 //! \par Revision history //! <2015/02/05> Notice //! The version history is not updated after this point. //! Download the latest version directly from GitHub. Please visit the our GitHub repository for ioLibrary. //! >> https://github.com/Wiznet/ioLibrary_Driver //! <2013/10/21> 1st Release //! \author MidnightCow //! \copyright //! //! Copyright (c) 2013, WIZnet Co., LTD. //! All rights reserved. //! //! Redistribution and use in source and binary forms, with or without //! modification, are permitted provided that the following conditions //! are met: //! //! * Redistributions of source code must retain the above copyright //! notice, this list of conditions and the following disclaimer. //! * 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. //! * Neither the name of the nor the names of its //! contributors may be used to endorse or promote products derived //! from this software without specific prior written permission. //! //! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" //! AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE //! IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE //! ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 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. // //***************************************************************************** /** * @defgroup extra_functions 2. WIZnet Extra Functions * * @brief These functions is optional function. It could be replaced at WIZCHIP I/O function because they were made by WIZCHIP I/O functions. * @details There are functions of configuring WIZCHIP, network, interrupt, phy, network information and timer. \n * */ /*****************************************************************************/ /* STDINT.H v16.9.3 */ /* */ /* Copyright (c) 2002-2017 Texas Instruments Incorporated */ /* http://www.ti.com/ */ /* */ /* Redistribution and use in source and binary forms, with or without */ /* modification, are permitted provided that the following conditions */ /* are met: */ /* */ /* Redistributions of source code must retain the above copyright */ /* notice, this list of conditions and the following disclaimer. */ /* */ /* 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. */ /* */ /* Neither the name of Texas Instruments Incorporated nor the names */ /* of its contributors may be used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */ /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */ /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */ /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */ /* OWNER OR CONTRIBUTORS 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. */ /* */ /*****************************************************************************/ /* 7.18.1.1 Exact-width integer types */ typedef signed char int8_t; typedef unsigned char uint8_t; typedef short int16_t; typedef unsigned short uint16_t; typedef int int32_t; typedef unsigned int uint32_t; typedef long long int64_t; typedef unsigned long long uint64_t; /* 7.18.1.2 Minimum-width integer types */ typedef int8_t int_least8_t; typedef uint8_t uint_least8_t; typedef int16_t int_least16_t; typedef uint16_t uint_least16_t; typedef int32_t int_least32_t; typedef uint32_t uint_least32_t; typedef int64_t int_least64_t; typedef uint64_t uint_least64_t; /* 7.18.1.3 Fastest minimum-width integer types */ typedef int32_t int_fast8_t; typedef uint32_t uint_fast8_t; typedef int32_t int_fast16_t; typedef uint32_t uint_fast16_t; typedef int32_t int_fast32_t; typedef uint32_t uint_fast32_t; typedef int64_t int_fast64_t; typedef uint64_t uint_fast64_t; /* 7.18.1.4 Integer types capable of holding object pointers */ typedef int intptr_t; typedef unsigned int uintptr_t; /* 7.18.1.5 Greatest-width integer types */ typedef long long intmax_t; typedef unsigned long long uintmax_t; /* According to footnotes in the 1999 C standard, "C++ implementations should define these macros only when __STDC_LIMIT_MACROS is defined before is included." */ /* 7.18.2 Limits of specified width integer types */ /* 7.18.3 Limits of other integer types */ /* 7.18.4.1 Macros for minimum-width integer constants */ /* There is a defect report filed against the C99 standard concerning how the (U)INTN_C macros should be implemented. Please refer to -- http://wwwold.dkuug.dk/JTC1/SC22/WG14/www/docs/dr_209.htm for more information. These macros are implemented according to the suggestion given at this web site. */ /* 7.18.4.2 Macros for greatest-width integer constants */ /** * @brief Select WIZCHIP. * @ You should select one, \b 5100, \b 5200, \b 5300, \b 5500 or etc. \n\n * ex> #define \_WIZCHIP_ 5500 */ //#define _WIZCHIP_IO_MODE_IIC_ 0x0400 //#define _WIZCHIP_IO_MODE_SDIO_ 0x0800 // Add to // /** * @brief Define interface mode. \n * @todo Should select interface mode as chip. * - @ref \_WIZCHIP_IO_MODE_SPI_ \n * -@ref \_WIZCHIP_IO_MODE_SPI_VDM_ : Valid only in @ref \_WIZCHIP_ == 5500 \n * -@ref \_WIZCHIP_IO_MODE_SPI_FDM_ : Valid only in @ref \_WIZCHIP_ == 5500 \n * - @ref \_WIZCHIP_IO_MODE_BUS_ \n * - @ref \_WIZCHIP_IO_MODE_BUS_DIR_ \n * - @ref \_WIZCHIP_IO_MODE_BUS_INDIR_ \n * - Others will be defined in future. \n\n * ex> #define \_WIZCHIP_IO_MODE_ \_WIZCHIP_IO_MODE_SPI_VDM_ * */ //#define _WIZCHIP_IO_MODE_ _WIZCHIP_IO_MODE_SPI_FDM_ //A20150601 : Define the unit of IO DATA. typedef uint8_t iodata_t; //***************************************************************************** // //! \file w5500.h //! \brief W5500 HAL Header File. //! \version 1.0.0 //! \date 2013/10/21 //! \par Revision history //! <2015/02/05> Notice //! The version history is not updated after this point. //! Download the latest version directly from GitHub. Please visit the our GitHub repository for ioLibrary. //! >> https://github.com/Wiznet/ioLibrary_Driver //! <2013/10/21> 1st Release //! \author MidnightCow //! \copyright //! //! Copyright (c) 2013, WIZnet Co., LTD. //! All rights reserved. //! //! Redistribution and use in source and binary forms, with or without //! modification, are permitted provided that the following conditions //! are met: //! //! * Redistributions of source code must retain the above copyright //! notice, this list of conditions and the following disclaimer. //! * 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. //! * Neither the name of the nor the names of its //! contributors may be used to endorse or promote products derived //! from this software without specific prior written permission. //! //! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" //! AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE //! IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE //! ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 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. // //***************************************************************************** // //***************************************************************************** // //! \file wizchip_conf.h //! \brief WIZCHIP Config Header File. //! \version 1.0.0 //! \date 2013/10/21 //! \par Revision history //! <2015/02/05> Notice //! The version history is not updated after this point. //! Download the latest version directly from GitHub. Please visit the our GitHub repository for ioLibrary. //! >> https://github.com/Wiznet/ioLibrary_Driver //! <2013/10/21> 1st Release //! \author MidnightCow //! \copyright //! //! Copyright (c) 2013, WIZnet Co., LTD. //! All rights reserved. //! //! Redistribution and use in source and binary forms, with or without //! modification, are permitted provided that the following conditions //! are met: //! //! * Redistributions of source code must retain the above copyright //! notice, this list of conditions and the following disclaimer. //! * 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. //! * Neither the name of the nor the names of its //! contributors may be used to endorse or promote products derived //! from this software without specific prior written permission. //! //! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" //! AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE //! IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE //! ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 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. // //***************************************************************************** /** * @defgroup extra_functions 2. WIZnet Extra Functions * * @brief These functions is optional function. It could be replaced at WIZCHIP I/O function because they were made by WIZCHIP I/O functions. * @details There are functions of configuring WIZCHIP, network, interrupt, phy, network information and timer. \n * */ /// @cond DOXY_APPLY_CODE /// @endcond /////////////////////////////////////// // Definition For Legacy Chip Driver // /////////////////////////////////////// ////////////////////////////// //-------------------------- defgroup --------------------------------- /** * @defgroup W5500 W5500 * * @brief WHIZCHIP register defines and I/O functions of @b W5500. * * - @ref WIZCHIP_register : @ref Common_register_group and @ref Socket_register_group * - @ref WIZCHIP_IO_Functions : @ref Basic_IO_function, @ref Common_register_access_function and @ref Socket_register_access_function */ /** * @defgroup WIZCHIP_register WIZCHIP register * @ingroup W5500 * * @brief WHIZCHIP register defines register group of @b W5500. * * - @ref Common_register_group : Common register group * - @ref Socket_register_group : \c SOCKET n register group */ /** * @defgroup WIZCHIP_IO_Functions WIZCHIP I/O functions * @ingroup W5500 * * @brief This supports the basic I/O functions for @ref WIZCHIP_register. * * - Basic I/O function \n * WIZCHIP_READ(), WIZCHIP_WRITE(), WIZCHIP_READ_BUF(), WIZCHIP_WRITE_BUF() \n\n * * - @ref Common_register_group access functions \n * -# @b Mode \n * getMR(), setMR() * -# @b Interrupt \n * getIR(), setIR(), getIMR(), setIMR(), getSIR(), setSIR(), getSIMR(), setSIMR(), getINTLEVEL(), setINTLEVEL() * -# Network Information \n * getSHAR(), setSHAR(), getGAR(), setGAR(), getSUBR(), setSUBR(), getSIPR(), setSIPR() * -# @b Retransmission \n * getRCR(), setRCR(), getRTR(), setRTR() * -# @b PPPoE \n * getPTIMER(), setPTIMER(), getPMAGIC(), getPMAGIC(), getPSID(), setPSID(), getPHAR(), setPHAR(), getPMRU(), setPMRU() * -# ICMP packet \n * getUIPR(), getUPORTR() * -# @b etc. \n * getPHYCFGR(), setPHYCFGR(), getVERSIONR() \n\n * * - \ref Socket_register_group access functions \n * -# SOCKET control \n * getSn_MR(), setSn_MR(), getSn_CR(), setSn_CR(), getSn_IMR(), setSn_IMR(), getSn_IR(), setSn_IR() * -# SOCKET information \n * getSn_SR(), getSn_DHAR(), setSn_DHAR(), getSn_PORT(), setSn_PORT(), getSn_DIPR(), setSn_DIPR(), getSn_DPORT(), setSn_DPORT() * getSn_MSSR(), setSn_MSSR() * -# SOCKET communication \n * getSn_RXBUF_SIZE(), setSn_RXBUF_SIZE(), getSn_TXBUF_SIZE(), setSn_TXBUF_SIZE() \n * getSn_TX_RD(), getSn_TX_WR(), setSn_TX_WR() \n * getSn_RX_RD(), setSn_RX_RD(), getSn_RX_WR() \n * getSn_TX_FSR(), getSn_RX_RSR(), getSn_KPALVTR(), setSn_KPALVTR() * -# IP header field \n * getSn_FRAG(), setSn_FRAG(), getSn_TOS(), setSn_TOS() \n * getSn_TTL(), setSn_TTL() */ /** * @defgroup Common_register_group Common register * @ingroup WIZCHIP_register * * @brief Common register group\n * It set the basic for the networking\n * It set the configuration such as interrupt, network information, ICMP, etc. * @details * @sa MR : Mode register. * @sa GAR, SUBR, SHAR, SIPR * @sa INTLEVEL, IR, IMR, SIR, SIMR : Interrupt. * @sa _RTR_, _RCR_ : Data retransmission. * @sa PTIMER, PMAGIC, PHAR, PSID, PMRU : PPPoE. * @sa UIPR, UPORTR : ICMP message. * @sa PHYCFGR, VERSIONR : etc. */ /** * @defgroup Socket_register_group Socket register * @ingroup WIZCHIP_register * * @brief Socket register group.\n * Socket register configures and control SOCKETn which is necessary to data communication. * @details * @sa Sn_MR, Sn_CR, Sn_IR, Sn_IMR : SOCKETn Control * @sa Sn_SR, Sn_PORT, Sn_DHAR, Sn_DIPR, Sn_DPORT : SOCKETn Information * @sa Sn_MSSR, Sn_TOS, Sn_TTL, Sn_KPALVTR, Sn_FRAG : Internet protocol. * @sa Sn_RXBUF_SIZE, Sn_TXBUF_SIZE, Sn_TX_FSR, Sn_TX_RD, Sn_TX_WR, Sn_RX_RSR, Sn_RX_RD, Sn_RX_WR : Data communication */ /** * @defgroup Basic_IO_function Basic I/O function * @ingroup WIZCHIP_IO_Functions * @brief These are basic input/output functions to read values from register or write values to register. */ /** * @defgroup Common_register_access_function Common register access functions * @ingroup WIZCHIP_IO_Functions * @brief These are functions to access common registers. */ /** * @defgroup Socket_register_access_function Socket register access functions * @ingroup WIZCHIP_IO_Functions * @brief These are functions to access socket registers. */ //------------------------------- defgroup end -------------------------------------------- //----------------------------- W5500 Common Registers IOMAP ----------------------------- /** * @ingroup Common_register_group * @brief Mode Register address(R/W)\n * @ref MR is used for S/W reset, ping block mode, PPPoE mode and etc. * @details Each bit of @ref MR defined as follows. * * * *
7 6 5 4 3 2 1 0
RST Reserved WOL PB PPPoE Reserved FARP Reserved
* - \ref MR_RST : Reset * - \ref MR_WOL : Wake on LAN * - \ref MR_PB : Ping block * - \ref MR_PPPOE : PPPoE mode * - \ref MR_FARP : Force ARP mode */ /** * @ingroup Common_register_group * @brief Gateway IP Register address(R/W) * @details @ref GAR configures the default gateway address. */ /** * @ingroup Common_register_group * @brief Subnet mask Register address(R/W) * @details @ref SUBR configures the subnet mask address. */ /** * @ingroup Common_register_group * @brief Source MAC Register address(R/W) * @details @ref SHAR configures the source hardware address. */ /** * @ingroup Common_register_group * @brief Source IP Register address(R/W) * @details @ref SIPR configures the source IP address. */ /** * @ingroup Common_register_group * @brief Set Interrupt low level timer register address(R/W) * @details @ref INTLEVEL configures the Interrupt Assert Time. */ /** * @ingroup Common_register_group * @brief Interrupt Register(R/W) * @details @ref IR indicates the interrupt status. Each bit of @ref IR will be still until the bit will be written to by the host. * If @ref IR is not equal to x00 INTn PIN is asserted to low until it is x00\n\n * Each bit of @ref IR defined as follows. * * * *
7 6 5 4 3 2 1 0
CONFLICT UNREACH PPPoE MP Reserved Reserved Reserved Reserved
* - \ref IR_CONFLICT : IP conflict * - \ref IR_UNREACH : Destination unreachable * - \ref IR_PPPoE : PPPoE connection close * - \ref IR_MP : Magic packet */ /** * @ingroup Common_register_group * @brief Interrupt mask register(R/W) * @details @ref _IMR_ is used to mask interrupts. Each bit of @ref _IMR_ corresponds to each bit of @ref IR. * When a bit of @ref _IMR_ is and the corresponding bit of @ref IR is an interrupt will be issued. In other words, * if a bit of @ref _IMR_ is an interrupt will not be issued even if the corresponding bit of @ref IR is \n\n * Each bit of @ref _IMR_ defined as the following. * * * *
7 6 5 4 3 2 1 0
IM_IR7 IM_IR6 IM_IR5 IM_IR4 Reserved Reserved Reserved Reserved
* - \ref IM_IR7 : IP Conflict Interrupt Mask * - \ref IM_IR6 : Destination unreachable Interrupt Mask * - \ref IM_IR5 : PPPoE Close Interrupt Mask * - \ref IM_IR4 : Magic Packet Interrupt Mask */ //M20150401 : Rename SYMBOE ( Re-define error in a compile) //#define IMR (_W5500_IO_BASE_ + (0x0016 << 8) + (WIZCHIP_CREG_BLOCK << 3)) /** * @ingroup Common_register_group * @brief Socket Interrupt Register(R/W) * @details @ref SIR indicates the interrupt status of Socket.\n * Each bit of @ref SIR be still until @ref Sn_IR is cleared by the host.\n * If @ref Sn_IR is not equal to x00 the n-th bit of @ref SIR is and INTn PIN is asserted until @ref SIR is x00 */ /** * @ingroup Common_register_group * @brief Socket Interrupt Mask Register(R/W) * @details Each bit of @ref SIMR corresponds to each bit of @ref SIR. * When a bit of @ref SIMR is and the corresponding bit of @ref SIR is Interrupt will be issued. * In other words, if a bit of @ref SIMR is an interrupt will be not issued even if the corresponding bit of @ref SIR is */ /** * @ingroup Common_register_group * @brief Timeout register address( 1 is 100us )(R/W) * @details @ref _RTR_ configures the retransmission timeout period. The unit of timeout period is 100us and the default of @ref _RTR_ is x07D0. * And so the default timeout period is 200ms(100us X 2000). During the time configured by @ref _RTR_, W5500 waits for the peer response * to the packet that is transmitted by \ref Sn_CR (CONNECT, DISCON, CLOSE, SEND, SEND_MAC, SEND_KEEP command). * If the peer does not respond within the @ref _RTR_ time, W5500 retransmits the packet or issues timeout. */ //M20150401 : Rename SYMBOE ( Re-define error in a compile) //#define RTR (_W5500_IO_BASE_ + (0x0019 << 8) + (WIZCHIP_CREG_BLOCK << 3)) /** * @ingroup Common_register_group * @brief Retry count register(R/W) * @details @ref _RCR_ configures the number of time of retransmission. * When retransmission occurs as many as ref _RCR_+1 Timeout interrupt is issued (@ref Sn_IR_TIMEOUT = '1'). */ //M20150401 : Rename SYMBOE ( Re-define error in a compile) //#define RCR (_W5500_IO_BASE_ + (0x001B << 8) + (WIZCHIP_CREG_BLOCK << 3)) /** * @ingroup Common_register_group * @brief PPP LCP Request Timer register in PPPoE mode(R/W) * @details @ref PTIMER configures the time for sending LCP echo request. The unit of time is 25ms. */ /** * @ingroup Common_register_group * @brief PPP LCP Magic number register in PPPoE mode(R/W) * @details @ref PMAGIC configures the 4bytes magic number to be used in LCP negotiation. */ /** * @ingroup Common_register_group * @brief PPP Destination MAC Register address(R/W) * @details @ref PHAR configures the PPPoE server hardware address that is acquired during PPPoE connection process. */ /** * @ingroup Common_register_group * @brief PPP Session Identification Register(R/W) * @details @ref PSID configures the PPPoE sever session ID acquired during PPPoE connection process. */ /** * @ingroup Common_register_group * @brief PPP Maximum Segment Size(MSS) register(R/W) * @details @ref PMRU configures the maximum receive unit of PPPoE. */ /** * @ingroup Common_register_group * @brief Unreachable IP register address in UDP mode(R) * @details W5500 receives an ICMP packet(Destination port unreachable) when data is sent to a port number * which socket is not open and @ref IR_UNREACH bit of @ref IR becomes and @ref UIPR & @ref UPORTR indicates * the destination IP address & port number respectively. */ /** * @ingroup Common_register_group * @brief Unreachable Port register address in UDP mode(R) * @details W5500 receives an ICMP packet(Destination port unreachable) when data is sent to a port number * which socket is not open and @ref IR_UNREACH bit of @ref IR becomes and @ref UIPR & @ref UPORTR * indicates the destination IP address & port number respectively. */ /** * @ingroup Common_register_group * @brief PHY Status Register(R/W) * @details @ref PHYCFGR configures PHY operation mode and resets PHY. In addition, @ref PHYCFGR indicates the status of PHY such as duplex, Speed, Link. */ // Reserved (_W5500_IO_BASE_ + (0x002F << 8) + (WIZCHIP_CREG_BLOCK << 3)) // Reserved (_W5500_IO_BASE_ + (0x0030 << 8) + (WIZCHIP_CREG_BLOCK << 3)) // Reserved (_W5500_IO_BASE_ + (0x0031 << 8) + (WIZCHIP_CREG_BLOCK << 3)) // Reserved (_W5500_IO_BASE_ + (0x0032 << 8) + (WIZCHIP_CREG_BLOCK << 3)) // Reserved (_W5500_IO_BASE_ + (0x0033 << 8) + (WIZCHIP_CREG_BLOCK << 3)) // Reserved (_W5500_IO_BASE_ + (0x0034 << 8) + (WIZCHIP_CREG_BLOCK << 3)) // Reserved (_W5500_IO_BASE_ + (0x0035 << 8) + (WIZCHIP_CREG_BLOCK << 3)) // Reserved (_W5500_IO_BASE_ + (0x0036 << 8) + (WIZCHIP_CREG_BLOCK << 3)) // Reserved (_W5500_IO_BASE_ + (0x0037 << 8) + (WIZCHIP_CREG_BLOCK << 3)) // Reserved (_W5500_IO_BASE_ + (0x0038 << 8) + (WIZCHIP_CREG_BLOCK << 3)) /** * @ingroup Common_register_group * @brief chip version register address(R) * @details @ref VERSIONR always indicates the W5500 version as @b 0x04. */ //----------------------------- W5500 Socket Registers IOMAP ----------------------------- /** * @ingroup Socket_register_group * @brief socket Mode register(R/W) * @details @ref Sn_MR configures the option or protocol type of Socket n.\n\n * Each bit of @ref Sn_MR defined as the following. * * * *
7 6 5 4 3 2 1 0
MULTI/MFEN BCASTB ND/MC/MMB UCASTB/MIP6B Protocol[3] Protocol[2] Protocol[1] Protocol[0]
* - @ref Sn_MR_MULTI : Support UDP Multicasting * - @ref Sn_MR_BCASTB : Broadcast block in UDP Multicasting * - @ref Sn_MR_ND : No Delayed Ack(TCP) flag * - @ref Sn_MR_MC : IGMP version used in UDP mulitcasting * - @ref Sn_MR_MMB : Multicast Blocking in @ref Sn_MR_MACRAW mode * - @ref Sn_MR_UCASTB : Unicast Block in UDP Multicating * - @ref Sn_MR_MIP6B : IPv6 packet Blocking in @ref Sn_MR_MACRAW mode * - Protocol * * * * * * *
Protocol[3] Protocol[2] Protocol[1] Protocol[0] @b Meaning
0 0 0 0 Closed
0 0 0 1 TCP
0 0 1 0 UDP
0 1 0 0 MACRAW
* - @ref Sn_MR_MACRAW : MAC LAYER RAW SOCK \n * - @ref Sn_MR_UDP : UDP * - @ref Sn_MR_TCP : TCP * - @ref Sn_MR_CLOSE : Unused socket * @note MACRAW mode should be only used in Socket 0. */ /** * @ingroup Socket_register_group * @brief Socket command register(R/W) * @details This is used to set the command for Socket n such as OPEN, CLOSE, CONNECT, LISTEN, SEND, and RECEIVE.\n * After W5500 accepts the command, the @ref Sn_CR register is automatically cleared to 0x00. * Even though @ref Sn_CR is cleared to 0x00, the command is still being processed.\n * To check whether the command is completed or not, please check the @ref Sn_IR or @ref Sn_SR. * - @ref Sn_CR_OPEN : Initialize or open socket. * - @ref Sn_CR_LISTEN : Wait connection request in TCP mode(Server mode) * - @ref Sn_CR_CONNECT : Send connection request in TCP mode(Client mode) * - @ref Sn_CR_DISCON : Send closing request in TCP mode. * - @ref Sn_CR_CLOSE : Close socket. * - @ref Sn_CR_SEND : Update TX buffer pointer and send data. * - @ref Sn_CR_SEND_MAC : Send data with MAC address, so without ARP process. * - @ref Sn_CR_SEND_KEEP : Send keep alive message. * - @ref Sn_CR_RECV : Update RX buffer pointer and receive data. */ /** * @ingroup Socket_register_group * @brief Socket interrupt register(R) * @details @ref Sn_IR indicates the status of Socket Interrupt such as establishment, termination, receiving data, timeout).\n * When an interrupt occurs and the corresponding bit of @ref Sn_IMR is the corresponding bit of @ref Sn_IR becomes \n * In order to clear the @ref Sn_IR bit, the host should write the bit to \n * * * *
7 6 5 4 3 2 1 0
Reserved Reserved Reserved SEND_OK TIMEOUT RECV DISCON CON
* - \ref Sn_IR_SENDOK : SEND_OK Interrupt * - \ref Sn_IR_TIMEOUT : TIMEOUT Interrupt * - \ref Sn_IR_RECV : RECV Interrupt * - \ref Sn_IR_DISCON : DISCON Interrupt * - \ref Sn_IR_CON : CON Interrupt */ /** * @ingroup Socket_register_group * @brief Socket status register(R) * @details @ref Sn_SR indicates the status of Socket n.\n * The status of Socket n is changed by @ref Sn_CR or some special control packet as SYN, FIN packet in TCP. * @par Normal status * - @ref SOCK_CLOSED : Closed * - @ref SOCK_INIT : Initiate state * - @ref SOCK_LISTEN : Listen state * - @ref SOCK_ESTABLISHED : Success to connect * - @ref SOCK_CLOSE_WAIT : Closing state * - @ref SOCK_UDP : UDP socket * - @ref SOCK_MACRAW : MAC raw mode socket *@par Temporary status during changing the status of Socket n. * - @ref SOCK_SYNSENT : This indicates Socket n sent the connect-request packet (SYN packet) to a peer. * - @ref SOCK_SYNRECV : It indicates Socket n successfully received the connect-request packet (SYN packet) from a peer. * - @ref SOCK_FIN_WAIT : Connection state * - @ref SOCK_CLOSING : Closing state * - @ref SOCK_TIME_WAIT : Closing state * - @ref SOCK_LAST_ACK : Closing state */ /** * @ingroup Socket_register_group * @brief source port register(R/W) * @details @ref Sn_PORT configures the source port number of Socket n. * It is valid when Socket n is used in TCP/UDP mode. It should be set before OPEN command is ordered. */ /** * @ingroup Socket_register_group * @brief Peer MAC register address(R/W) * @details @ref Sn_DHAR configures the destination hardware address of Socket n when using SEND_MAC command in UDP mode or * it indicates that it is acquired in ARP-process by CONNECT/SEND command. */ /** * @ingroup Socket_register_group * @brief Peer IP register address(R/W) * @details @ref Sn_DIPR configures or indicates the destination IP address of Socket n. It is valid when Socket n is used in TCP/UDP mode. * In TCP client mode, it configures an IP address of TCP serverbefore CONNECT command. * In TCP server mode, it indicates an IP address of TCP clientafter successfully establishing connection. * In UDP mode, it configures an IP address of peer to be received the UDP packet by SEND or SEND_MAC command. */ /** * @ingroup Socket_register_group * @brief Peer port register address(R/W) * @details @ref Sn_DPORT configures or indicates the destination port number of Socket n. It is valid when Socket n is used in TCP/UDP mode. * In TCP clientmode, it configures the listen port number of TCP serverbefore CONNECT command. * In TCP Servermode, it indicates the port number of TCP client after successfully establishing connection. * In UDP mode, it configures the port number of peer to be transmitted the UDP packet by SEND/SEND_MAC command. */ /** * @ingroup Socket_register_group * @brief Maximum Segment Size(Sn_MSSR0) register address(R/W) * @details @ref Sn_MSSR configures or indicates the MTU(Maximum Transfer Unit) of Socket n. */ // Reserved (_W5500_IO_BASE_ + (0x0014 << 8) + (WIZCHIP_SREG_BLOCK(N) << 3)) /** * @ingroup Socket_register_group * @brief IP Type of Service(TOS) Register(R/W) * @details @ref Sn_TOS configures the TOS(Type Of Service field in IP Header) of Socket n. * It is set before OPEN command. */ /** * @ingroup Socket_register_group * @brief IP Time to live(TTL) Register(R/W) * @details @ref Sn_TTL configures the TTL(Time To Live field in IP header) of Socket n. * It is set before OPEN command. */ // Reserved (_W5500_IO_BASE_ + (0x0017 << 8) + (WIZCHIP_SREG_BLOCK(N) << 3)) // Reserved (_W5500_IO_BASE_ + (0x0018 << 8) + (WIZCHIP_SREG_BLOCK(N) << 3)) // Reserved (_W5500_IO_BASE_ + (0x0019 << 8) + (WIZCHIP_SREG_BLOCK(N) << 3)) // Reserved (_W5500_IO_BASE_ + (0x001A << 8) + (WIZCHIP_SREG_BLOCK(N) << 3)) // Reserved (_W5500_IO_BASE_ + (0x001B << 8) + (WIZCHIP_SREG_BLOCK(N) << 3)) // Reserved (_W5500_IO_BASE_ + (0x001C << 8) + (WIZCHIP_SREG_BLOCK(N) << 3)) // Reserved (_W5500_IO_BASE_ + (0x001D << 8) + (WIZCHIP_SREG_BLOCK(N) << 3)) /** * @ingroup Socket_register_group * @brief Receive memory size register(R/W) * @details @ref Sn_RXBUF_SIZE configures the RX buffer block size of Socket n. * Socket n RX Buffer Block size can be configured with 1,2,4,8, and 16 Kbytes. * If a different size is configured, the data cannot be normally received from a peer. * Although Socket n RX Buffer Block size is initially configured to 2Kbytes, * user can re-configure its size using @ref Sn_RXBUF_SIZE. The total sum of @ref Sn_RXBUF_SIZE can not be exceed 16Kbytes. * When exceeded, the data reception error is occurred. */ /** * @ingroup Socket_register_group * @brief Transmit memory size register(R/W) * @details @ref Sn_TXBUF_SIZE configures the TX buffer block size of Socket n. Socket n TX Buffer Block size can be configured with 1,2,4,8, and 16 Kbytes. * If a different size is configured, the data can�t be normally transmitted to a peer. * Although Socket n TX Buffer Block size is initially configured to 2Kbytes, * user can be re-configure its size using @ref Sn_TXBUF_SIZE. The total sum of @ref Sn_TXBUF_SIZE can not be exceed 16Kbytes. * When exceeded, the data transmission error is occurred. */ /** * @ingroup Socket_register_group * @brief Transmit free memory size register(R) * @details @ref Sn_TX_FSR indicates the free size of Socket n TX Buffer Block. It is initialized to the configured size by @ref Sn_TXBUF_SIZE. * Data bigger than @ref Sn_TX_FSR should not be saved in the Socket n TX Buffer because the bigger data overwrites the previous saved data not yet sent. * Therefore, check before saving the data to the Socket n TX Buffer, and if data is equal or smaller than its checked size, * transmit the data with SEND/SEND_MAC command after saving the data in Socket n TX buffer. But, if data is bigger than its checked size, * transmit the data after dividing into the checked size and saving in the Socket n TX buffer. */ /** * @ingroup Socket_register_group * @brief Transmit memory read pointer register address(R) * @details @ref Sn_TX_RD is initialized by OPEN command. However, if Sn_MR(P[3:0]) is TCP mode(001, it is re-initialized while connecting with TCP. * After its initialization, it is auto-increased by SEND command. * SEND command transmits the saved data from the current @ref Sn_TX_RD to the @ref Sn_TX_WR in the Socket n TX Buffer. * After transmitting the saved data, the SEND command increases the @ref Sn_TX_RD as same as the @ref Sn_TX_WR. * If its increment value exceeds the maximum value 0xFFFF, (greater than 0x10000 and the carry bit occurs), * then the carry bit is ignored and will automatically update with the lower 16bits value. */ /** * @ingroup Socket_register_group * @brief Transmit memory write pointer register address(R/W) * @details @ref Sn_TX_WR is initialized by OPEN command. However, if Sn_MR(P[3:0]) is TCP mode(001, it is re-initialized while connecting with TCP.\n * It should be read or be updated like as follows.\n * 1. Read the starting address for saving the transmitting data.\n * 2. Save the transmitting data from the starting address of Socket n TX buffer.\n * 3. After saving the transmitting data, update @ref Sn_TX_WR to the increased value as many as transmitting data size. * If the increment value exceeds the maximum value 0xFFFF(greater than 0x10000 and the carry bit occurs), * then the carry bit is ignored and will automatically update with the lower 16bits value.\n * 4. Transmit the saved data in Socket n TX Buffer by using SEND/SEND command */ /** * @ingroup Socket_register_group * @brief Received data size register(R) * @details @ref Sn_RX_RSR indicates the data size received and saved in Socket n RX Buffer. * @ref Sn_RX_RSR does not exceed the @ref Sn_RXBUF_SIZE and is calculated as the difference between * �Socket n RX Write Pointer (@ref Sn_RX_WR)and �Socket n RX Read Pointer (@ref Sn_RX_RD) */ /** * @ingroup Socket_register_group * @brief Read point of Receive memory(R/W) * @details @ref Sn_RX_RD is initialized by OPEN command. Make sure to be read or updated as follows.\n * 1. Read the starting save address of the received data.\n * 2. Read data from the starting address of Socket n RX Buffer.\n * 3. After reading the received data, Update @ref Sn_RX_RD to the increased value as many as the reading size. * If the increment value exceeds the maximum value 0xFFFF, that is, is greater than 0x10000 and the carry bit occurs, * update with the lower 16bits value ignored the carry bit.\n * 4. Order RECV command is for notifying the updated @ref Sn_RX_RD to W5500. */ /** * @ingroup Socket_register_group * @brief Write point of Receive memory(R) * @details @ref Sn_RX_WR is initialized by OPEN command and it is auto-increased by the data reception. * If the increased value exceeds the maximum value 0xFFFF, (greater than 0x10000 and the carry bit occurs), * then the carry bit is ignored and will automatically update with the lower 16bits value. */ /** * @ingroup Socket_register_group * @brief socket interrupt mask register(R) * @details @ref Sn_IMR masks the interrupt of Socket n. * Each bit corresponds to each bit of @ref Sn_IR. When a Socket n Interrupt is occurred and the corresponding bit of @ref Sn_IMR is * the corresponding bit of @ref Sn_IR becomes When both the corresponding bit of @ref Sn_IMR and @ref Sn_IR are and the n-th bit of @ref IR is * Host is interrupted by asserted INTn PIN to low. */ /** * @ingroup Socket_register_group * @brief Fragment field value in IP header register(R/W) * @details @ref Sn_FRAG configures the FRAG(Fragment field in IP header). */ /** * @ingroup Socket_register_group * @brief Keep Alive Timer register(R/W) * @details @ref Sn_KPALVTR configures the transmitting timer of �KEEP ALIVE(KA)packet of SOCKETn. It is valid only in TCP mode, * and ignored in other modes. The time unit is 5s. * KA packet is transmittable after @ref Sn_SR is changed to SOCK_ESTABLISHED and after the data is transmitted or received to/from a peer at least once. * In case of '@ref Sn_KPALVTR > 0', W5500 automatically transmits KA packet after time-period for checking the TCP connection (Auto-keepalive-process). * In case of '@ref Sn_KPALVTR = 0', Auto-keep-alive-process will not operate, * and KA packet can be transmitted by SEND_KEEP command by the host (Manual-keep-alive-process). * Manual-keep-alive-process is ignored in case of '@ref Sn_KPALVTR > 0'. */ //#define Sn_TSR(N) (_W5500_IO_BASE_ + (0x0030 << 8) + (WIZCHIP_SREG_BLOCK(N) << 3)) //----------------------------- W5500 Register values ----------------------------- /* MODE register values */ /** * @brief Reset * @details If this bit is All internal registers will be initialized. It will be automatically cleared as after S/W reset. */ /** * @brief Wake on LAN * @details 0 : Disable WOL mode\n * 1 : Enable WOL mode\n * If WOL mode is enabled and the received magic packet over UDP has been normally processed, the Interrupt PIN (INTn) asserts to low. * When using WOL mode, the UDP Socket should be opened with any source port number. (Refer to Socket n Mode Register (@ref Sn_MR) for opening Socket.) * @note The magic packet over UDP supported by W5500 consists of 6 bytes synchronization stream (xFFFFFFFFFFFF and * 16 times Target MAC address stream in UDP payload. The options such like password are ignored. You can use any UDP source port number for WOL mode. */ /** * @brief Ping block * @details 0 : Disable Ping block\n * 1 : Enable Ping block\n * If the bit is it blocks the response to a ping request. */ /** * @brief Enable PPPoE * @details 0 : DisablePPPoE mode\n * 1 : EnablePPPoE mode\n * If you use ADSL, this bit should be */ /** * @brief Enable UDP_FORCE_ARP CHECHK * @details 0 : Disable Force ARP mode\n * 1 : Enable Force ARP mode\n * In Force ARP mode, It forces on sending ARP Request whenever data is sent. */ /* IR register values */ /** * @brief Check IP conflict. * @details Bit is set as when own source IP address is same with the sender IP address in the received ARP request. */ /** * @brief Get the destination unreachable message in UDP sending. * @details When receiving the ICMP (Destination port unreachable) packet, this bit is set as * When this bit is Destination Information such as IP address and Port number may be checked with the corresponding @ref UIPR & @ref UPORTR. */ /** * @brief Get the PPPoE close message. * @details When PPPoE is disconnected during PPPoE mode, this bit is set. */ /** * @brief Get the magic packet interrupt. * @details When WOL mode is enabled and receives the magic packet over UDP, this bit is set. */ /* PHYCFGR register value */ /* IMR register values */ /** * @brief IP Conflict Interrupt Mask. * @details 0: Disable IP Conflict Interrupt\n * 1: Enable IP Conflict Interrupt */ /** * @brief Destination unreachable Interrupt Mask. * @details 0: Disable Destination unreachable Interrupt\n * 1: Enable Destination unreachable Interrupt */ /** * @brief PPPoE Close Interrupt Mask. * @details 0: Disable PPPoE Close Interrupt\n * 1: Enable PPPoE Close Interrupt */ /** * @brief Magic Packet Interrupt Mask. * @details 0: Disable Magic Packet Interrupt\n * 1: Enable Magic Packet Interrupt */ /* Sn_MR Default values */ /** * @brief Support UDP Multicasting * @details 0 : disable Multicasting\n * 1 : enable Multicasting\n * This bit is applied only during UDP mode(P[3:0] = 010.\n * To use multicasting, @ref Sn_DIPR & @ref Sn_DPORT should be respectively configured with the multicast group IP address & port number * before Socket n is opened by OPEN command of @ref Sn_CR. */ /** * @brief Broadcast block in UDP Multicasting. * @details 0 : disable Broadcast Blocking\n * 1 : enable Broadcast Blocking\n * This bit blocks to receive broadcasting packet during UDP mode(P[3:0] = 010.\m * In addition, This bit does when MACRAW mode(P[3:0] = 100 */ /** * @brief No Delayed Ack(TCP), Multicast flag * @details 0 : Disable No Delayed ACK option\n * 1 : Enable No Delayed ACK option\n * This bit is applied only during TCP mode (P[3:0] = 001.\n * When this bit is It sends the ACK packet without delay as soon as a Data packet is received from a peer.\n * When this bit is It sends the ACK packet after waiting for the timeout time configured by @ref _RTR_. */ /** * @brief Unicast Block in UDP Multicasting * @details 0 : disable Unicast Blocking\n * 1 : enable Unicast Blocking\n * This bit blocks receiving the unicast packet during UDP mode(P[3:0] = 010 and MULTI = */ /** * @brief MAC LAYER RAW SOCK * @details This configures the protocol mode of Socket n. * @note MACRAW mode should be only used in Socket 0. */ /** * @brief UDP * @details This configures the protocol mode of Socket n. */ /** * @brief TCP * @details This configures the protocol mode of Socket n. */ /** * @brief Unused socket * @details This configures the protocol mode of Socket n. */ /* Sn_MR values used with Sn_MR_MACRAW */ /** * @brief MAC filter enable in @ref Sn_MR_MACRAW mode * @details 0 : disable MAC Filtering\n * 1 : enable MAC Filtering\n * This bit is applied only during MACRAW mode(P[3:0] = 100.\n * When set as W5500 can only receive broadcasting packet or packet sent to itself. * When this bit is W5500 can receive all packets on Ethernet. * If user wants to implement Hybrid TCP/IP stack, * it is recommended that this bit is set as for reducing host overhead to process the all received packets. */ /** * @brief Multicast Blocking in @ref Sn_MR_MACRAW mode * @details 0 : using IGMP version 2\n * 1 : using IGMP version 1\n * This bit is applied only during UDP mode(P[3:0] = 010 and MULTI = * It configures the version for IGMP messages (Join/Leave/Report). */ /** * @brief IPv6 packet Blocking in @ref Sn_MR_MACRAW mode * @details 0 : disable IPv6 Blocking\n * 1 : enable IPv6 Blocking\n * This bit is applied only during MACRAW mode (P[3:0] = 100. It blocks to receiving the IPv6 packet. */ /* Sn_MR value used with Sn_MR_UDP & Sn_MR_MULTI */ /** * @brief IGMP version used in UDP mulitcasting * @details 0 : disable Multicast Blocking\n * 1 : enable Multicast Blocking\n * This bit is applied only when MACRAW mode(P[3:0] = 100. It blocks to receive the packet with multicast MAC address. */ /* Sn_MR alternate values */ /** * @brief For Berkeley Socket API */ /** * @brief For Berkeley Socket API */ /* Sn_CR values */ /** * @brief Initialize or open socket * @details Socket n is initialized and opened according to the protocol selected in Sn_MR(P3:P0). * The table below shows the value of @ref Sn_SR corresponding to @ref Sn_MR.\n * * * * * * *
\b Sn_MR (P[3:0]) \b Sn_SR
Sn_MR_CLOSE (000)
Sn_MR_TCP (001) SOCK_INIT (0x13)
Sn_MR_UDP (010) SOCK_UDP (0x22)
S0_MR_MACRAW (100) SOCK_MACRAW (0x02)
*/ /** * @brief Wait connection request in TCP mode(Server mode) * @details This is valid only in TCP mode (\ref Sn_MR(P3:P0) = \ref Sn_MR_TCP). * In this mode, Socket n operates as a TCP serverand waits for connection-request (SYN packet) from any TCP client * The @ref Sn_SR changes the state from \ref SOCK_INIT to \ref SOCKET_LISTEN. * When a TCP clientconnection request is successfully established, * the @ref Sn_SR changes from SOCK_LISTEN to SOCK_ESTABLISHED and the @ref Sn_IR(0) becomes * But when a TCP clientconnection request is failed, @ref Sn_IR(3) becomes and the status of @ref Sn_SR changes to SOCK_CLOSED. */ /** * @brief Send connection request in TCP mode(Client mode) * @details To connect, a connect-request (SYN packet) is sent to TCP serverconfigured by @ref Sn_DIPR & Sn_DPORT(destination address & port). * If the connect-request is successful, the @ref Sn_SR is changed to @ref SOCK_ESTABLISHED and the Sn_IR(0) becomes \n\n * The connect-request fails in the following three cases.\n * 1. When a @b ARPTO occurs (@ref Sn_IR[3] = ) because destination hardware address is not acquired through the ARP-process.\n * 2. When a @b SYN/ACK packet is not received and @b TCPTO (Sn_IR(3) = )\n * 3. When a @b RST packet is received instead of a @b SYN/ACK packet. In these cases, @ref Sn_SR is changed to @ref SOCK_CLOSED. * @note This is valid only in TCP mode and operates when Socket n acts as TCP client */ /** * @brief Send closing request in TCP mode * @details Regardless of TCP serveror TCP client the DISCON command processes the disconnect-process (b>Active closeor Passive close.\n * @par Active close * it transmits disconnect-request(FIN packet) to the connected peer\n * @par Passive close * When FIN packet is received from peer, a FIN packet is replied back to the peer.\n * @details When the disconnect-process is successful (that is, FIN/ACK packet is received successfully), @ref Sn_SR is changed to @ref SOCK_CLOSED.\n * Otherwise, TCPTO occurs (\ref Sn_IR(3)='1') and then @ref Sn_SR is changed to @ref SOCK_CLOSED. * @note Valid only in TCP mode. */ /** * @brief Close socket * @details Sn_SR is changed to @ref SOCK_CLOSED. */ /** * @brief Update TX buffer pointer and send data * @details SEND transmits all the data in the Socket n TX buffer.\n * For more details, please refer to Socket n TX Free Size Register (@ref Sn_TX_FSR), Socket n, * TX Write Pointer Register(@ref Sn_TX_WR), and Socket n TX Read Pointer Register(@ref Sn_TX_RD). */ /** * @brief Send data with MAC address, so without ARP process * @details The basic operation is same as SEND.\n * Normally SEND transmits data after destination hardware address is acquired by the automatic ARP-process(Address Resolution Protocol).\n * But SEND_MAC transmits data without the automatic ARP-process.\n * In this case, the destination hardware address is acquired from @ref Sn_DHAR configured by host, instead of APR-process. * @note Valid only in UDP mode. */ /** * @brief Send keep alive message * @details It checks the connection status by sending 1byte keep-alive packet.\n * If the peer can not respond to the keep-alive packet during timeout time, the connection is terminated and the timeout interrupt will occur. * @note Valid only in TCP mode. */ /** * @brief Update RX buffer pointer and receive data * @details RECV completes the processing of the received data in Socket n RX Buffer by using a RX read pointer register (@ref Sn_RX_RD).\n * For more details, refer to Socket n RX Received Size Register (@ref Sn_RX_RSR), Socket n RX Write Pointer Register (@ref Sn_RX_WR), * and Socket n RX Read Pointer Register (@ref Sn_RX_RD). */ /* Sn_IR values */ /** * @brief SEND_OK Interrupt * @details This is issued when SEND command is completed. */ /** * @brief TIMEOUT Interrupt * @details This is issued when ARPTO or TCPTO occurs. */ /** * @brief RECV Interrupt * @details This is issued whenever data is received from a peer. */ /** * @brief DISCON Interrupt * @details This is issued when FIN or FIN/ACK packet is received from a peer. */ /** * @brief CON Interrupt * @details This is issued one time when the connection with peer is successful and then @ref Sn_SR is changed to @ref SOCK_ESTABLISHED. */ /* Sn_SR values */ /** * @brief Closed * @details This indicates that Socket n is released.\n * When DICON, CLOSE command is ordered, or when a timeout occurs, it is changed to @ref SOCK_CLOSED regardless of previous status. */ /** * @brief Initiate state * @details This indicates Socket n is opened with TCP mode.\n * It is changed to @ref SOCK_INIT when @ref Sn_MR(P[3:0]) = 001 and OPEN command is ordered.\n * After @ref SOCK_INIT, user can use LISTEN /CONNECT command. */ /** * @brief Listen state * @details This indicates Socket n is operating as TCP servermode and waiting for connection-request (SYN packet) from a peer TCP client.\n * It will change to @ref SOCK_ESTALBLISHED when the connection-request is successfully accepted.\n * Otherwise it will change to @ref SOCK_CLOSED after TCPTO @ref Sn_IR(TIMEOUT) = '1') is occurred. */ /** * @brief Connection state * @details This indicates Socket n sent the connect-request packet (SYN packet) to a peer.\n * It is temporarily shown when @ref Sn_SR is changed from @ref SOCK_INIT to @ref SOCK_ESTABLISHED by CONNECT command.\n * If connect-accept(SYN/ACK packet) is received from the peer at SOCK_SYNSENT, it changes to @ref SOCK_ESTABLISHED.\n * Otherwise, it changes to @ref SOCK_CLOSED after TCPTO (@ref Sn_IR[TIMEOUT] = '1') is occurred. */ /** * @brief Connection state * @details It indicates Socket n successfully received the connect-request packet (SYN packet) from a peer.\n * If socket n sends the response (SYN/ACK packet) to the peer successfully, it changes to @ref SOCK_ESTABLISHED. \n * If not, it changes to @ref SOCK_CLOSED after timeout (@ref Sn_IR[TIMEOUT] = '1') is occurred. */ /** * @brief Success to connect * @details This indicates the status of the connection of Socket n.\n * It changes to @ref SOCK_ESTABLISHED when the TCP SERVERprocessed the SYN packet from the TCP CLIENTduring @ref SOCK_LISTEN, or * when the CONNECT command is successful.\n * During @ref SOCK_ESTABLISHED, DATA packet can be transferred using SEND or RECV command. */ /** * @brief Closing state * @details These indicate Socket n is closing.\n * These are shown in disconnect-process such as active-close and passive-close.\n * When Disconnect-process is successfully completed, or when timeout occurs, these change to @ref SOCK_CLOSED. */ /** * @brief Closing state * @details These indicate Socket n is closing.\n * These are shown in disconnect-process such as active-close and passive-close.\n * When Disconnect-process is successfully completed, or when timeout occurs, these change to @ref SOCK_CLOSED. */ /** * @brief Closing state * @details These indicate Socket n is closing.\n * These are shown in disconnect-process such as active-close and passive-close.\n * When Disconnect-process is successfully completed, or when timeout occurs, these change to @ref SOCK_CLOSED. */ /** * @brief Closing state * @details This indicates Socket n received the disconnect-request (FIN packet) from the connected peer.\n * This is half-closing status, and data can be transferred.\n * For full-closing, DISCON command is used. But For just-closing, CLOSE command is used. */ /** * @brief Closing state * @details This indicates Socket n is waiting for the response (FIN/ACK packet) to the disconnect-request (FIN packet) by passive-close.\n * It changes to @ref SOCK_CLOSED when Socket n received the response successfully, or when timeout(@ref Sn_IR[TIMEOUT] = '1') is occurred. */ /** * @brief UDP socket * @details This indicates Socket n is opened in UDP mode(@ref Sn_MR(P[3:0]) = '010').\n * It changes to SOCK_UDP when @ref Sn_MR(P[3:0]) = '010' and @ref Sn_CR_OPEN command is ordered.\n * Unlike TCP mode, data can be transfered without the connection-process. */ /** * @brief MAC raw mode socket * @details This indicates Socket 0 is opened in MACRAW mode (S0_MR(P[3:0]) = 100and is valid only in Socket 0.\n * It changes to SOCK_MACRAW when S0_MR(P[3:0] = 100and OPEN command is ordered.\n * Like UDP mode socket, MACRAW mode Socket 0 can transfer a MAC packet (Ethernet frame) without the connection-process. */ //#define SOCK_PPPOE 0x5F /* IP PROTOCOL */ /** * @brief Enter a critical section * * @details It is provided to protect your shared code which are executed without distribution. \n \n * * In non-OS environment, It can be just implemented by disabling whole interrupt.\n * In OS environment, You can replace it to critical section api supported by OS. * * \sa WIZCHIP_READ(), WIZCHIP_WRITE(), WIZCHIP_READ_BUF(), WIZCHIP_WRITE_BUF() * \sa WIZCHIP_CRITICAL_EXIT() */ /** * @brief Exit a critical section * * @details It is provided to protect your shared code which are executed without distribution. \n\n * * In non-OS environment, It can be just implemented by disabling whole interrupt. \n * In OS environment, You can replace it to critical section api supported by OS. * * @sa WIZCHIP_READ(), WIZCHIP_WRITE(), WIZCHIP_READ_BUF(), WIZCHIP_WRITE_BUF() * @sa WIZCHIP_CRITICAL_ENTER() */ //////////////////////// // Basic I/O Function // //////////////////////// /** * @ingroup Basic_IO_function * @brief It reads 1 byte value from a register. * @param AddrSel Register address * @return The value of register */ uint8_t WIZCHIP_READ (uint32_t AddrSel); /** * @ingroup Basic_IO_function * @brief It writes 1 byte value to a register. * @param AddrSel Register address * @param wb Write data * @return void */ void WIZCHIP_WRITE(uint32_t AddrSel, uint8_t wb ); /** * @ingroup Basic_IO_function * @brief It reads sequence data from registers. * @param AddrSel Register address * @param pBuf Pointer buffer to read data * @param len Data length */ void WIZCHIP_READ_BUF (uint32_t AddrSel, uint8_t* pBuf, uint16_t len); /** * @ingroup Basic_IO_function * @brief It writes sequence data to registers. * @param AddrSel Register address * @param pBuf Pointer buffer to write data * @param len Data length */ void WIZCHIP_WRITE_BUF(uint32_t AddrSel, uint8_t* pBuf, uint16_t len); ///////////////////////////////// // Common Register I/O function // ///////////////////////////////// /** * @ingroup Common_register_access_function * @brief Set Mode Register * @param (uint8_t)mr The value to be set. * @sa getMR() */ /** * @ingroup Common_register_access_function * @brief Get Mode Register * @return uint8_t. The value of Mode register. * @sa setMR() */ /** * @ingroup Common_register_access_function * @brief Set gateway IP address * @param (uint8_t*)gar Pointer variable to set gateway IP address. It should be allocated 4 bytes. * @sa getGAR() */ /** * @ingroup Common_register_access_function * @brief Get gateway IP address * @param (uint8_t*)gar Pointer variable to get gateway IP address. It should be allocated 4 bytes. * @sa setGAR() */ /** * @ingroup Common_register_access_function * @brief Set subnet mask address * @param (uint8_t*)subr Pointer variable to set subnet mask address. It should be allocated 4 bytes. * @sa getSUBR() */ /** * @ingroup Common_register_access_function * @brief Get subnet mask address * @param (uint8_t*)subr Pointer variable to get subnet mask address. It should be allocated 4 bytes. * @sa setSUBR() */ /** * @ingroup Common_register_access_function * @brief Set local MAC address * @param (uint8_t*)shar Pointer variable to set local MAC address. It should be allocated 6 bytes. * @sa getSHAR() */ /** * @ingroup Common_register_access_function * @brief Get local MAC address * @param (uint8_t*)shar Pointer variable to get local MAC address. It should be allocated 6 bytes. * @sa setSHAR() */ /** * @ingroup Common_register_access_function * @brief Set local IP address * @param (uint8_t*)sipr Pointer variable to set local IP address. It should be allocated 4 bytes. * @sa getSIPR() */ /** * @ingroup Common_register_access_function * @brief Get local IP address * @param (uint8_t*)sipr Pointer variable to get local IP address. It should be allocated 4 bytes. * @sa setSIPR() */ /** * @ingroup Common_register_access_function * @brief Set INTLEVEL register * @param (uint16_t)intlevel Value to set @ref INTLEVEL register. * @sa getINTLEVEL() */ /** * @ingroup Common_register_access_function * @brief Get INTLEVEL register * @return uint16_t. Value of @ref INTLEVEL register. * @sa setINTLEVEL() */ //M20150401 : Type explict declaration /* #define getINTLEVEL() ((WIZCHIP_READ(INTLEVEL) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(INTLEVEL,1))) */ /** * @ingroup Common_register_access_function * @brief Set @ref IR register * @param (uint8_t)ir Value to set @ref IR register. * @sa getIR() */ /** * @ingroup Common_register_access_function * @brief Get @ref IR register * @return uint8_t. Value of @ref IR register. * @sa setIR() */ /** * @ingroup Common_register_access_function * @brief Set @ref _IMR_ register * @param (uint8_t)imr Value to set @ref _IMR_ register. * @sa getIMR() */ /** * @ingroup Common_register_access_function * @brief Get @ref _IMR_ register * @return uint8_t. Value of @ref _IMR_ register. * @sa setIMR() */ /** * @ingroup Common_register_access_function * @brief Set @ref SIR register * @param (uint8_t)sir Value to set @ref SIR register. * @sa getSIR() */ /** * @ingroup Common_register_access_function * @brief Get @ref SIR register * @return uint8_t. Value of @ref SIR register. * @sa setSIR() */ /** * @ingroup Common_register_access_function * @brief Set @ref SIMR register * @param (uint8_t)simr Value to set @ref SIMR register. * @sa getSIMR() */ /** * @ingroup Common_register_access_function * @brief Get @ref SIMR register * @return uint8_t. Value of @ref SIMR register. * @sa setSIMR() */ /** * @ingroup Common_register_access_function * @brief Set @ref _RTR_ register * @param (uint16_t)rtr Value to set @ref _RTR_ register. * @sa getRTR() */ /** * @ingroup Common_register_access_function * @brief Get @ref _RTR_ register * @return uint16_t. Value of @ref _RTR_ register. * @sa setRTR() */ //M20150401 : Type explict declaration /* #define getRTR() ((WIZCHIP_READ(_RTR_) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(_RTR_,1))) */ /** * @ingroup Common_register_access_function * @brief Set @ref _RCR_ register * @param (uint8_t)rcr Value to set @ref _RCR_ register. * @sa getRCR() */ /** * @ingroup Common_register_access_function * @brief Get @ref _RCR_ register * @return uint8_t. Value of @ref _RCR_ register. * @sa setRCR() */ //================================================== test done =========================================================== /** * @ingroup Common_register_access_function * @brief Set @ref PTIMER register * @param (uint8_t)ptimer Value to set @ref PTIMER register. * @sa getPTIMER() */ /** * @ingroup Common_register_access_function * @brief Get @ref PTIMER register * @return uint8_t. Value of @ref PTIMER register. * @sa setPTIMER() */ /** * @ingroup Common_register_access_function * @brief Set @ref PMAGIC register * @param (uint8_t)pmagic Value to set @ref PMAGIC register. * @sa getPMAGIC() */ /** * @ingroup Common_register_access_function * @brief Get @ref PMAGIC register * @return uint8_t. Value of @ref PMAGIC register. * @sa setPMAGIC() */ /** * @ingroup Common_register_access_function * @brief Set @ref PHAR address * @param (uint8_t*)phar Pointer variable to set PPP destination MAC register address. It should be allocated 6 bytes. * @sa getPHAR() */ /** * @ingroup Common_register_access_function * @brief Get @ref PHAR address * @param (uint8_t*)phar Pointer variable to PPP destination MAC register address. It should be allocated 6 bytes. * @sa setPHAR() */ /** * @ingroup Common_register_access_function * @brief Set @ref PSID register * @param (uint16_t)psid Value to set @ref PSID register. * @sa getPSID() */ /** * @ingroup Common_register_access_function * @brief Get @ref PSID register * @return uint16_t. Value of @ref PSID register. * @sa setPSID() */ //uint16_t getPSID(void); //M20150401 : Type explict declaration /* #define getPSID() ((WIZCHIP_READ(PSID) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(PSID,1))) */ /** * @ingroup Common_register_access_function * @brief Set @ref PMRU register * @param (uint16_t)pmru Value to set @ref PMRU register. * @sa getPMRU() */ /** * @ingroup Common_register_access_function * @brief Get @ref PMRU register * @return uint16_t. Value of @ref PMRU register. * @sa setPMRU() */ //M20150401 : Type explict declaration /* #define getPMRU() ((WIZCHIP_READ(PMRU) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(PMRU,1))) */ /** * @ingroup Common_register_access_function * @brief Get unreachable IP address * @param (uint8_t*)uipr Pointer variable to get unreachable IP address. It should be allocated 4 bytes. */ //M20150401 : Size Error of UIPR (6 -> 4) /* #define getUIPR(uipr) WIZCHIP_READ_BUF(UIPR,uipr,6) */ /** * @ingroup Common_register_access_function * @brief Get @ref UPORTR register * @return uint16_t. Value of @ref UPORTR register. */ //M20150401 : Type explict declaration /* #define getUPORTR() ((WIZCHIP_READ(UPORTR) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(UPORTR,1))) */ /** * @ingroup Common_register_access_function * @brief Set @ref PHYCFGR register * @param (uint8_t)phycfgr Value to set @ref PHYCFGR register. * @sa getPHYCFGR() */ /** * @ingroup Common_register_access_function * @brief Get @ref PHYCFGR register * @return uint8_t. Value of @ref PHYCFGR register. * @sa setPHYCFGR() */ /** * @ingroup Common_register_access_function * @brief Get @ref VERSIONR register * @return uint8_t. Value of @ref VERSIONR register. */ ///////////////////////////////////// /////////////////////////////////// // Socket N register I/O function // /////////////////////////////////// /** * @ingroup Socket_register_access_function * @brief Set @ref Sn_MR register * @param (uint8_t)sn Socket number. It should be 0 ~ 7. * @param (uint8_t)mr Value to set @ref Sn_MR * @sa getSn_MR() */ /** * @ingroup Socket_register_access_function * @brief Get @ref Sn_MR register * @param (uint8_t)sn Socket number. It should be 0 ~ 7. * @return uint8_t. Value of @ref Sn_MR. * @sa setSn_MR() */ /** * @ingroup Socket_register_access_function * @brief Set @ref Sn_CR register * @param (uint8_t)sn Socket number. It should be 0 ~ 7. * @param (uint8_t)cr Value to set @ref Sn_CR * @sa getSn_CR() */ /** * @ingroup Socket_register_access_function * @brief Get @ref Sn_CR register * @param (uint8_t)sn Socket number. It should be 0 ~ 7. * @return uint8_t. Value of @ref Sn_CR. * @sa setSn_CR() */ /** * @ingroup Socket_register_access_function * @brief Set @ref Sn_IR register * @param (uint8_t)sn Socket number. It should be 0 ~ 7. * @param (uint8_t)ir Value to set @ref Sn_IR * @sa getSn_IR() */ /** * @ingroup Socket_register_access_function * @brief Get @ref Sn_IR register * @param (uint8_t)sn Socket number. It should be 0 ~ 7. * @return uint8_t. Value of @ref Sn_IR. * @sa setSn_IR() */ /** * @ingroup Socket_register_access_function * @brief Set @ref Sn_IMR register * @param (uint8_t)sn Socket number. It should be 0 ~ 7. * @param (uint8_t)imr Value to set @ref Sn_IMR * @sa getSn_IMR() */ /** * @ingroup Socket_register_access_function * @brief Get @ref Sn_IMR register * @param (uint8_t)sn Socket number. It should be 0 ~ 7. * @return uint8_t. Value of @ref Sn_IMR. * @sa setSn_IMR() */ /** * @ingroup Socket_register_access_function * @brief Get @ref Sn_SR register * @param (uint8_t)sn Socket number. It should be 0 ~ 7. * @return uint8_t. Value of @ref Sn_SR. */ /** * @ingroup Socket_register_access_function * @brief Set @ref Sn_PORT register * @param (uint8_t)sn Socket number. It should be 0 ~ 7. * @param (uint16_t)port Value to set @ref Sn_PORT. * @sa getSn_PORT() */ /** * @ingroup Socket_register_access_function * @brief Get @ref Sn_PORT register * @param (uint8_t)sn Socket number. It should be 0 ~ 7. * @return uint16_t. Value of @ref Sn_PORT. * @sa setSn_PORT() */ //M20150401 : Type explict declaration /* #define getSn_PORT(sn) ((WIZCHIP_READ(Sn_PORT(sn)) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_PORT(sn),1))) */ /** * @ingroup Socket_register_access_function * @brief Set @ref Sn_DHAR register * @param (uint8_t)sn Socket number. It should be 0 ~ 7. * @param (uint8_t*)dhar Pointer variable to set socket n destination hardware address. It should be allocated 6 bytes. * @sa getSn_DHAR() */ /** * @ingroup Socket_register_access_function * @brief Get @ref Sn_MR register * @param (uint8_t)sn Socket number. It should be 0 ~ 7. * @param (uint8_t*)dhar Pointer variable to get socket n destination hardware address. It should be allocated 6 bytes. * @sa setSn_DHAR() */ /** * @ingroup Socket_register_access_function * @brief Set @ref Sn_DIPR register * @param (uint8_t)sn Socket number. It should be 0 ~ 7. * @param (uint8_t*)dipr Pointer variable to set socket n destination IP address. It should be allocated 4 bytes. * @sa getSn_DIPR() */ /** * @ingroup Socket_register_access_function * @brief Get @ref Sn_DIPR register * @param (uint8_t)sn Socket number. It should be 0 ~ 7. * @param (uint8_t*)dipr Pointer variable to get socket n destination IP address. It should be allocated 4 bytes. * @sa setSn_DIPR() */ /** * @ingroup Socket_register_access_function * @brief Set @ref Sn_DPORT register * @param (uint8_t)sn Socket number. It should be 0 ~ 7. * @param (uint16_t)dport Value to set @ref Sn_DPORT * @sa getSn_DPORT() */ /** * @ingroup Socket_register_access_function * @brief Get @ref Sn_DPORT register * @param (uint8_t)sn Socket number. It should be 0 ~ 7. * @return uint16_t. Value of @ref Sn_DPORT. * @sa setSn_DPORT() */ //M20150401 : Type explict declaration /* #define getSn_DPORT(sn) ((WIZCHIP_READ(Sn_DPORT(sn)) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_DPORT(sn),1))) */ /** * @ingroup Socket_register_access_function * @brief Set @ref Sn_MSSR register * @param (uint8_t)sn Socket number. It should be 0 ~ 7. * @param (uint16_t)mss Value to set @ref Sn_MSSR * @sa setSn_MSSR() */ /** * @ingroup Socket_register_access_function * @brief Get @ref Sn_MSSR register * @param (uint8_t)sn Socket number. It should be 0 ~ 7. * @return uint16_t. Value of @ref Sn_MSSR. * @sa setSn_MSSR() */ //M20150401 : Type explict declaration /* #define getSn_MSSR(sn) ((WIZCHIP_READ(Sn_MSSR(sn)) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_MSSR(sn),1))) */ /** * @ingroup Socket_register_access_function * @brief Set @ref Sn_TOS register * @param (uint8_t)sn Socket number. It should be 0 ~ 7. * @param (uint8_t)tos Value to set @ref Sn_TOS * @sa getSn_TOS() */ /** * @ingroup Socket_register_access_function * @brief Get @ref Sn_TOS register * @param (uint8_t)sn Socket number. It should be 0 ~ 7. * @return uint8_t. Value of Sn_TOS. * @sa setSn_TOS() */ /** * @ingroup Socket_register_access_function * @brief Set @ref Sn_TTL register * @param (uint8_t)sn Socket number. It should be 0 ~ 7. * @param (uint8_t)ttl Value to set @ref Sn_TTL * @sa getSn_TTL() */ /** * @ingroup Socket_register_access_function * @brief Get @ref Sn_TTL register * @param (uint8_t)sn Socket number. It should be 0 ~ 7. * @return uint8_t. Value of @ref Sn_TTL. * @sa setSn_TTL() */ /** * @ingroup Socket_register_access_function * @brief Set @ref Sn_RXBUF_SIZE register * @param (uint8_t)sn Socket number. It should be 0 ~ 7. * @param (uint8_t)rxbufsize Value to set @ref Sn_RXBUF_SIZE * @sa getSn_RXBUF_SIZE() */ /** * @ingroup Socket_register_access_function * @brief Get @ref Sn_RXBUF_SIZE register * @param (uint8_t)sn Socket number. It should be 0 ~ 7. * @return uint8_t. Value of @ref Sn_RXBUF_SIZE. * @sa setSn_RXBUF_SIZE() */ /** * @ingroup Socket_register_access_function * @brief Set @ref Sn_TXBUF_SIZE register * @param (uint8_t)sn Socket number. It should be 0 ~ 7. * @param (uint8_t)txbufsize Value to set @ref Sn_TXBUF_SIZE * @sa getSn_TXBUF_SIZE() */ /** * @ingroup Socket_register_access_function * @brief Get @ref Sn_TXBUF_SIZE register * @param (uint8_t)sn Socket number. It should be 0 ~ 7. * @return uint8_t. Value of @ref Sn_TXBUF_SIZE. * @sa setSn_TXBUF_SIZE() */ /** * @ingroup Socket_register_access_function * @brief Get @ref Sn_TX_FSR register * @param (uint8_t)sn Socket number. It should be 0 ~ 7. * @return uint16_t. Value of @ref Sn_TX_FSR. */ uint16_t getSn_TX_FSR(uint8_t sn); /** * @ingroup Socket_register_access_function * @brief Get @ref Sn_TX_RD register * @param (uint8_t)sn Socket number. It should be 0 ~ 7. * @return uint16_t. Value of @ref Sn_TX_RD. */ //M20150401 : Type explict declaration /* #define getSn_TX_RD(sn) ((WIZCHIP_READ(Sn_TX_RD(sn)) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_TX_RD(sn),1))) */ /** * @ingroup Socket_register_access_function * @brief Set @ref Sn_TX_WR register * @param (uint8_t)sn Socket number. It should be 0 ~ 7. * @param (uint16_t)txwr Value to set @ref Sn_TX_WR * @sa GetSn_TX_WR() */ /** * @ingroup Socket_register_access_function * @brief Get @ref Sn_TX_WR register * @param (uint8_t)sn Socket number. It should be 0 ~ 7. * @return uint16_t. Value of @ref Sn_TX_WR. * @sa setSn_TX_WR() */ //M20150401 : Type explict declaration /* #define getSn_TX_WR(sn) ((WIZCHIP_READ(Sn_TX_WR(sn)) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_TX_WR(sn),1))) */ /** * @ingroup Socket_register_access_function * @brief Get @ref Sn_RX_RSR register * @param (uint8_t)sn Socket number. It should be 0 ~ 7. * @return uint16_t. Value of @ref Sn_RX_RSR. */ uint16_t getSn_RX_RSR(uint8_t sn); /** * @ingroup Socket_register_access_function * @brief Set @ref Sn_RX_RD register * @param (uint8_t)sn Socket number. It should be 0 ~ 7. * @param (uint16_t)rxrd Value to set @ref Sn_RX_RD * @sa getSn_RX_RD() */ /** * @ingroup Socket_register_access_function * @brief Get @ref Sn_RX_RD register * @param (uint8_t)sn Socket number. It should be 0 ~ 7. * @return uint16_t. Value of @ref Sn_RX_RD. * @sa setSn_RX_RD() */ //M20150401 : Type explict declaration /* #define getSn_RX_RD(sn) ((WIZCHIP_READ(Sn_RX_RD(sn)) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_RX_RD(sn),1))) */ /** * @ingroup Socket_register_access_function * @brief Get @ref Sn_RX_WR register * @param (uint8_t)sn Socket number. It should be 0 ~ 7. * @return uint16_t. Value of @ref Sn_RX_WR. */ //M20150401 : Type explict declaration /* #define getSn_RX_WR(sn) ((WIZCHIP_READ(Sn_RX_WR(sn)) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_RX_WR(sn),1))) */ /** * @ingroup Socket_register_access_function * @brief Set @ref Sn_FRAG register * @param (uint8_t)sn Socket number. It should be 0 ~ 7. * @param (uint16_t)frag Value to set @ref Sn_FRAG * @sa getSn_FRAD() */ /** * @ingroup Socket_register_access_function * @brief Get @ref Sn_FRAG register * @param (uint8_t)sn Socket number. It should be 0 ~ 7. * @return uint16_t. Value of @ref Sn_FRAG. * @sa setSn_FRAG() */ //M20150401 : Type explict declaration /* #define getSn_FRAG(sn) ((WIZCHIP_READ(Sn_FRAG(sn)) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_FRAG(sn),1))) */ /** * @ingroup Socket_register_access_function * @brief Set @ref Sn_KPALVTR register * @param (uint8_t)sn Socket number. It should be 0 ~ 7. * @param (uint8_t)kpalvt Value to set @ref Sn_KPALVTR * @sa getSn_KPALVTR() */ /** * @ingroup Socket_register_access_function * @brief Get @ref Sn_KPALVTR register * @param (uint8_t)sn Socket number. It should be 0 ~ 7. * @return uint8_t. Value of @ref Sn_KPALVTR. * @sa setSn_KPALVTR() */ ////////////////////////////////////// ///////////////////////////////////// // Sn_TXBUF & Sn_RXBUF IO function // ///////////////////////////////////// /** * @brief Socket_register_access_function * @brief Gets the max buffer size of socket sn passed as parameter. * @param (uint8_t)sn Socket number. It should be 0 ~ 7. * @return uint16_t. Value of Socket n RX max buffer size. */ //M20150401 : Type explict declaration /* #define getSn_RxMAX(sn) (getSn_RXBUF_SIZE(sn) << 10) */ /** * @brief Socket_register_access_function * @brief Gets the max buffer size of socket sn passed as parameters. * @param (uint8_t)sn Socket number. It should be 0 ~ 7. * @return uint16_t. Value of Socket n TX max buffer size. */ //M20150401 : Type explict declaration /* #define getSn_TxMAX(sn) (getSn_TXBUF_SIZE(sn) << 10) */ /** * @ingroup Basic_IO_function * @brief It copies data to internal TX memory * * @details This function reads the Tx write pointer register and after that, * it copies the wizdata(pointer buffer) of the length of len(variable) bytes to internal TX memory * and updates the Tx write pointer register. * This function is being called by send() and sendto() function also. * * @param (uint8_t)sn Socket number. It should be 0 ~ 7. * @param wizdata Pointer buffer to write data * @param len Data length * @sa wiz_recv_data() */ void wiz_send_data(uint8_t sn, uint8_t *wizdata, uint16_t len); /** * @ingroup Basic_IO_function * @brief It copies data to your buffer from internal RX memory * * @details This function read the Rx read pointer register and after that, * it copies the received data from internal RX memory * to wizdata(pointer variable) of the length of len(variable) bytes. * This function is being called by recv() also. * * @param (uint8_t)sn Socket number. It should be 0 ~ 7. * @param wizdata Pointer buffer to read data * @param len Data length * @sa wiz_send_data() */ void wiz_recv_data(uint8_t sn, uint8_t *wizdata, uint16_t len); /** * @ingroup Basic_IO_function * @brief It discard the received data in RX memory. * @details It discards the data of the length of len(variable) bytes in internal RX memory. * @param (uint8_t)sn Socket number. It should be 0 ~ 7. * @param len Data length */ void wiz_recv_ignore(uint8_t sn, uint16_t len); /// @cond DOXY_APPLY_CODE /// @endcond /** * @brief Define I/O base address when BUS IF mode. * @todo Should re-define it to fit your system when BUS IF Mode (@ref \_WIZCHIP_IO_MODE_BUS_, * @ref \_WIZCHIP_IO_MODE_BUS_DIR_, @ref \_WIZCHIP_IO_MODE_BUS_INDIR_). \n\n * ex> #define \_WIZCHIP_IO_BASE_ 0x00008000 */ //M20150401 : Typing Error //#if _WIZCHIP_IO_MODE_ & _WIZCHIP_IO_MODE_BUS /******************************************************** * WIZCHIP BASIC IF functions for SPI, SDIO, I2C , ETC. *********************************************************/ /** * @ingroup DATA_TYPE * @brief The set of callback functions for W5500:@ref WIZCHIP_IO_Functions W5200:@ref WIZCHIP_IO_Functions_W5200 */ typedef struct __WIZCHIP { uint16_t if_mode; ///< host interface mode uint8_t id[6]; ///< @b WIZCHIP ID such as @b 5100, @b 5200, @b 5500, and so on. /** * The set of critical section callback func. */ struct _CRIS { void (*_enter) (void); ///< crtical section enter void (*_exit) (void); ///< critial section exit }CRIS; /** * The set of @ref \_WIZCHIP_ select control callback func. */ struct _CS { void (*_select) (void); ///< @ref \_WIZCHIP_ selected void (*_deselect)(void); ///< @ref \_WIZCHIP_ deselected }CS; /** * The set of interface IO callback func. */ union _IF { /** * For BUS interface IO */ //M20156501 : Modify the function name for integrating with W5300 //struct //{ // uint8_t (*_read_byte) (uint32_t AddrSel); // void (*_write_byte) (uint32_t AddrSel, uint8_t wb); //}BUS; struct { iodata_t (*_read_data) (uint32_t AddrSel); void (*_write_data) (uint32_t AddrSel, iodata_t wb); }BUS; /** * For SPI interface IO */ struct { uint8_t (*_read_byte) (void); void (*_write_byte) (uint8_t wb); void (*_read_burst) (uint8_t* pBuf, uint16_t len); void (*_write_burst) (uint8_t* pBuf, uint16_t len); }SPI; // To be added // }IF; }_WIZCHIP; extern _WIZCHIP WIZCHIP; /** * @ingroup DATA_TYPE * WIZCHIP control type enumration used in @ref ctlwizchip(). */ typedef enum { CW_RESET_WIZCHIP, ///< Resets WIZCHIP by softly CW_INIT_WIZCHIP, ///< Initializes to WIZCHIP with SOCKET buffer size 2 or 1 dimension array typed uint8_t. CW_GET_INTERRUPT, ///< Get Interrupt status of WIZCHIP CW_CLR_INTERRUPT, ///< Clears interrupt CW_SET_INTRMASK, ///< Masks interrupt CW_GET_INTRMASK, ///< Get interrupt mask CW_SET_INTRTIME, ///< Set interval time between the current and next interrupt. CW_GET_INTRTIME, ///< Set interval time between the current and next interrupt. CW_GET_ID, ///< Gets WIZCHIP name. //D20150601 : For no modification your application code //#if _WIZCHIP_ == 5500 CW_RESET_PHY, ///< Resets internal PHY. Valid Only W5500 CW_SET_PHYCONF, ///< When PHY configured by internal register, PHY operation mode (Manual/Auto, 10/100, Half/Full). Valid Only W5000 CW_GET_PHYCONF, ///< Get PHY operation mode in internal register. Valid Only W5500 CW_GET_PHYSTATUS, ///< Get real PHY status on operating. Valid Only W5500 CW_SET_PHYPOWMODE, ///< Set PHY power mode as normal and down when PHYSTATUS.OPMD == 1. Valid Only W5500 //#endif //D20150601 : For no modification your application code //#if _WIZCHIP_ == 5200 || _WIZCHIP_ == 5500 CW_GET_PHYPOWMODE, ///< Get PHY Power mode as down or normal, Valid Only W5100, W5200 CW_GET_PHYLINK ///< Get PHY Link status, Valid Only W5100, W5200 //#endif }ctlwizchip_type; /** * @ingroup DATA_TYPE * Network control type enumration used in @ref ctlnetwork(). */ typedef enum { CN_SET_NETINFO, ///< Set Network with @ref wiz_NetInfo CN_GET_NETINFO, ///< Get Network with @ref wiz_NetInfo CN_SET_NETMODE, ///< Set network mode as WOL, PPPoE, Ping Block, and Force ARP mode CN_GET_NETMODE, ///< Get network mode as WOL, PPPoE, Ping Block, and Force ARP mode CN_SET_TIMEOUT, ///< Set network timeout as retry count and time. CN_GET_TIMEOUT, ///< Get network timeout as retry count and time. }ctlnetwork_type; /** * @ingroup DATA_TYPE * Interrupt kind when CW_SET_INTRRUPT, CW_GET_INTERRUPT, CW_SET_INTRMASK * and CW_GET_INTRMASK is used in @ref ctlnetwork(). * It can be used with OR operation. */ typedef enum { IK_WOL = (1 << 4), ///< Wake On Lan by receiving the magic packet. Valid in W500. IK_PPPOE_TERMINATED = (1 << 5), ///< PPPoE Disconnected IK_DEST_UNREACH = (1 << 6), ///< Destination IP & Port Unreachable, No use in W5200 IK_IP_CONFLICT = (1 << 7), ///< IP conflict occurred IK_SOCK_0 = (1 << 8), ///< Socket 0 interrupt IK_SOCK_1 = (1 << 9), ///< Socket 1 interrupt IK_SOCK_2 = (1 << 10), ///< Socket 2 interrupt IK_SOCK_3 = (1 << 11), ///< Socket 3 interrupt IK_SOCK_4 = (1 << 12), ///< Socket 4 interrupt, No use in 5100 IK_SOCK_5 = (1 << 13), ///< Socket 5 interrupt, No use in 5100 IK_SOCK_6 = (1 << 14), ///< Socket 6 interrupt, No use in 5100 IK_SOCK_7 = (1 << 15), ///< Socket 7 interrupt, No use in 5100 IK_SOCK_ALL = (0xFF << 8) ///< All Socket interrupt }intr_kind; /** * @ingroup DATA_TYPE * It configures PHY configuration when CW_SET PHYCONF or CW_GET_PHYCONF in W5500, * and it indicates the real PHY status configured by HW or SW in all WIZCHIP. \n * Valid only in W5500. */ typedef struct wiz_PhyConf_t { uint8_t by; ///< set by @ref PHY_CONFBY_HW or @ref PHY_CONFBY_SW uint8_t mode; ///< set by @ref PHY_MODE_MANUAL or @ref PHY_MODE_AUTONEGO uint8_t speed; ///< set by @ref PHY_SPEED_10 or @ref PHY_SPEED_100 uint8_t duplex; ///< set by @ref PHY_DUPLEX_HALF @ref PHY_DUPLEX_FULL //uint8_t power; ///< set by @ref PHY_POWER_NORM or @ref PHY_POWER_DOWN //uint8_t link; ///< Valid only in CW_GET_PHYSTATUS. set by @ref PHY_LINK_ON or PHY_DUPLEX_OFF }wiz_PhyConf; /** * @ingroup DATA_TYPE * It used in setting dhcp_mode of @ref wiz_NetInfo. */ typedef enum { NETINFO_STATIC = 1, ///< Static IP configuration by manually. NETINFO_DHCP ///< Dynamic IP configruation from a DHCP sever }dhcp_mode; /** * @ingroup DATA_TYPE * Network Information for WIZCHIP */ typedef struct wiz_NetInfo_t { uint8_t mac[6]; ///< Source Mac Address uint8_t ip[4]; ///< Source IP Address uint8_t sn[4]; ///< Subnet Mask uint8_t gw[4]; ///< Gateway IP Address uint8_t dns[4]; ///< DNS server IP Address dhcp_mode dhcp; ///< 1 - Static, 2 - DHCP }wiz_NetInfo; /** * @ingroup DATA_TYPE * Network mode */ typedef enum { NM_FORCEARP = (1<<1), ///< Force to APP send whenever udp data is sent. Valid only in W5500 NM_WAKEONLAN = (1<<5), ///< Wake On Lan NM_PINGBLOCK = (1<<4), ///< Block ping-request NM_PPPOE = (1<<3), ///< PPPoE mode }netmode_type; /** * @ingroup DATA_TYPE * Used in CN_SET_TIMEOUT or CN_GET_TIMEOUT of @ref ctlwizchip() for timeout configruation. */ typedef struct wiz_NetTimeout_t { uint8_t retry_cnt; ///< retry count uint16_t time_100us; ///< time unit 100us }wiz_NetTimeout; /** *@brief Registers call back function for critical section of I/O functions such as *\ref WIZCHIP_READ, @ref WIZCHIP_WRITE, @ref WIZCHIP_READ_BUF and @ref WIZCHIP_WRITE_BUF. *@param cris_en : callback function for critical section enter. *@param cris_ex : callback function for critical section exit. *@todo Describe @ref WIZCHIP_CRITICAL_ENTER and @ref WIZCHIP_CRITICAL_EXIT marco or register your functions. *@note If you do not describe or register, default functions(@ref wizchip_cris_enter & @ref wizchip_cris_exit) is called. */ void reg_wizchip_cris_cbfunc(void(*cris_en)(void), void(*cris_ex)(void)); /** *@brief Registers call back function for WIZCHIP select & deselect. *@param cs_sel : callback function for WIZCHIP select *@param cs_desel : callback fucntion for WIZCHIP deselect *@todo Describe @ref wizchip_cs_select and @ref wizchip_cs_deselect function or register your functions. *@note If you do not describe or register, null function is called. */ void reg_wizchip_cs_cbfunc(void(*cs_sel)(void), void(*cs_desel)(void)); /** *@brief Registers call back function for bus interface. *@param bus_rb : callback function to read byte data using system bus *@param bus_wb : callback function to write byte data using system bus *@todo Describe @ref wizchip_bus_readbyte and @ref wizchip_bus_writebyte function *or register your functions. *@note If you do not describe or register, null function is called. */ //M20150601 : For integrating with W5300 //void reg_wizchip_bus_cbfunc(uint8_t (*bus_rb)(uint32_t addr), void (*bus_wb)(uint32_t addr, uint8_t wb)); void reg_wizchip_bus_cbfunc(iodata_t (*bus_rb)(uint32_t addr), void (*bus_wb)(uint32_t addr, iodata_t wb)); /** *@brief Registers call back function for SPI interface. *@param spi_rb : callback function to read byte using SPI *@param spi_wb : callback function to write byte using SPI *@todo Describe \ref wizchip_spi_readbyte and \ref wizchip_spi_writebyte function *or register your functions. *@note If you do not describe or register, null function is called. */ void reg_wizchip_spi_cbfunc(uint8_t (*spi_rb)(void), void (*spi_wb)(uint8_t wb)); /** *@brief Registers call back function for SPI interface. *@param spi_rb : callback function to burst read using SPI *@param spi_wb : callback function to burst write using SPI *@todo Describe \ref wizchip_spi_readbyte and \ref wizchip_spi_writebyte function *or register your functions. *@note If you do not describe or register, null function is called. */ void reg_wizchip_spiburst_cbfunc(void (*spi_rb)(uint8_t* pBuf, uint16_t len), void (*spi_wb)(uint8_t* pBuf, uint16_t len)); /** * @ingroup extra_functions * @brief Controls to the WIZCHIP. * @details Resets WIZCHIP & internal PHY, Configures PHY mode, Monitor PHY(Link,Speed,Half/Full/Auto), * controls interrupt & mask and so on. * @param cwtype : Decides to the control type * @param arg : arg type is dependent on cwtype. * @return 0 : Success \n * -1 : Fail because of invalid \ref ctlwizchip_type or unsupported \ref ctlwizchip_type in WIZCHIP */ int8_t ctlwizchip(ctlwizchip_type cwtype, void* arg); /** * @ingroup extra_functions * @brief Controls to network. * @details Controls to network environment, mode, timeout and so on. * @param cntype : Input. Decides to the control type * @param arg : Inout. arg type is dependent on cntype. * @return -1 : Fail because of invalid \ref ctlnetwork_type or unsupported \ref ctlnetwork_type in WIZCHIP \n * 0 : Success */ int8_t ctlnetwork(ctlnetwork_type cntype, void* arg); /* * The following functions are implemented for internal use. * but You can call these functions for code size reduction instead of ctlwizchip() and ctlnetwork(). */ /** * @ingroup extra_functions * @brief Reset WIZCHIP by softly. */ void wizchip_sw_reset(void); /** * @ingroup extra_functions * @brief Initializes WIZCHIP with socket buffer size * @param txsize Socket tx buffer sizes. If null, initialized the default size 2KB. * @param rxsize Socket rx buffer sizes. If null, initialized the default size 2KB. * @return 0 : succcess \n * -1 : fail. Invalid buffer size */ int8_t wizchip_init(uint8_t* txsize, uint8_t* rxsize); /** * @ingroup extra_functions * @brief Clear Interrupt of WIZCHIP. * @param intr : @ref intr_kind value operated OR. It can type-cast to uint16_t. */ void wizchip_clrinterrupt(intr_kind intr); /** * @ingroup extra_functions * @brief Get Interrupt of WIZCHIP. * @return @ref intr_kind value operated OR. It can type-cast to uint16_t. */ intr_kind wizchip_getinterrupt(void); /** * @ingroup extra_functions * @brief Mask or Unmask Interrupt of WIZCHIP. * @param intr : @ref intr_kind value operated OR. It can type-cast to uint16_t. */ void wizchip_setinterruptmask(intr_kind intr); /** * @ingroup extra_functions * @brief Get Interrupt mask of WIZCHIP. * @return : The operated OR vaule of @ref intr_kind. It can type-cast to uint16_t. */ intr_kind wizchip_getinterruptmask(void); int8_t wizphy_getphylink(void); ///< get the link status of phy in WIZCHIP. No use in W5100 int8_t wizphy_getphypmode(void); ///< get the power mode of PHY in WIZCHIP. No use in W5100 void wizphy_reset(void); ///< Reset phy. Vailid only in W5500 /** * @ingroup extra_functions * @brief Set the phy information for WIZCHIP without power mode * @param phyconf : @ref wiz_PhyConf */ void wizphy_setphyconf(wiz_PhyConf* phyconf); /** * @ingroup extra_functions * @brief Get phy configuration information. * @param phyconf : @ref wiz_PhyConf */ void wizphy_getphyconf(wiz_PhyConf* phyconf); /** * @ingroup extra_functions * @brief Get phy status. * @param phyconf : @ref wiz_PhyConf */ void wizphy_getphystat(wiz_PhyConf* phyconf); /** * @ingroup extra_functions * @brief set the power mode of phy inside WIZCHIP. Refer to @ref PHYCFGR in W5500, @ref PHYSTATUS in W5200 * @param pmode Settig value of power down mode. */ int8_t wizphy_setphypmode(uint8_t pmode); /** * @ingroup extra_functions * @brief Set the network information for WIZCHIP * @param pnetinfo : @ref wizNetInfo */ void wizchip_setnetinfo(wiz_NetInfo* pnetinfo); /** * @ingroup extra_functions * @brief Get the network information for WIZCHIP * @param pnetinfo : @ref wizNetInfo */ void wizchip_getnetinfo(wiz_NetInfo* pnetinfo); /** * @ingroup extra_functions * @brief Set the network mode such WOL, PPPoE, Ping Block, and etc. * @param pnetinfo Value of network mode. Refer to @ref netmode_type. */ int8_t wizchip_setnetmode(netmode_type netmode); /** * @ingroup extra_functions * @brief Get the network mode such WOL, PPPoE, Ping Block, and etc. * @return Value of network mode. Refer to @ref netmode_type. */ netmode_type wizchip_getnetmode(void); /** * @ingroup extra_functions * @brief Set retry time value(@ref _RTR_) and retry count(@ref _RCR_). * @details @ref _RTR_ configures the retransmission timeout period and @ref _RCR_ configures the number of time of retransmission. * @param nettime @ref _RTR_ value and @ref _RCR_ value. Refer to @ref wiz_NetTimeout. */ void wizchip_settimeout(wiz_NetTimeout* nettime); /** * @ingroup extra_functions * @brief Get retry time value(@ref _RTR_) and retry count(@ref _RCR_). * @details @ref _RTR_ configures the retransmission timeout period and @ref _RCR_ configures the number of time of retransmission. * @param nettime @ref _RTR_ value and @ref _RCR_ value. Refer to @ref wiz_NetTimeout. */ void wizchip_gettimeout(wiz_NetTimeout* nettime); ///////////// //M20150401 : Remove ; in the default callback function such as wizchip_cris_enter(), wizchip_cs_select() and etc. ///////////// /** * @brief Default function to enable interrupt. * @note This function help not to access wrong address. If you do not describe this function or register any functions, * null function is called. */ //void wizchip_cris_enter(void) {}; void wizchip_cris_enter(void) {} /** * @brief Default function to disable interrupt. * @note This function help not to access wrong address. If you do not describe this function or register any functions, * null function is called. */ //void wizchip_cris_exit(void) {}; void wizchip_cris_exit(void) {} /** * @brief Default function to select chip. * @note This function help not to access wrong address. If you do not describe this function or register any functions, * null function is called. */ //void wizchip_cs_select(void) {}; void wizchip_cs_select(void) {} /** * @brief Default function to deselect chip. * @note This function help not to access wrong address. If you do not describe this function or register any functions, * null function is called. */ //void wizchip_cs_deselect(void) {}; void wizchip_cs_deselect(void) {} /** * @brief Default function to read in direct or indirect interface. * @note This function help not to access wrong address. If you do not describe this function or register any functions, * null function is called. */ //M20150601 : Rename the function for integrating with W5300 //uint8_t wizchip_bus_readbyte(uint32_t AddrSel) { return * ((volatile uint8_t *)((ptrdiff_t) AddrSel)); } iodata_t wizchip_bus_readdata(uint32_t AddrSel) { return * ((volatile iodata_t *)((ptrdiff_t) AddrSel)); } /** * @brief Default function to write in direct or indirect interface. * @note This function help not to access wrong address. If you do not describe this function or register any functions, * null function is called. */ //M20150601 : Rename the function for integrating with W5300 //void wizchip_bus_writebyte(uint32_t AddrSel, uint8_t wb) { *((volatile uint8_t*)((ptrdiff_t)AddrSel)) = wb; } void wizchip_bus_writedata(uint32_t AddrSel, iodata_t wb) { *((volatile iodata_t*)((ptrdiff_t)AddrSel)) = wb; } /** * @brief Default function to read in SPI interface. * @note This function help not to access wrong address. If you do not describe this function or register any functions, * null function is called. */ //uint8_t wizchip_spi_readbyte(void) {return 0;}; uint8_t wizchip_spi_readbyte(void) {return 0;} /** * @brief Default function to write in SPI interface. * @note This function help not to access wrong address. If you do not describe this function or register any functions, * null function is called. */ //void wizchip_spi_writebyte(uint8_t wb) {}; void wizchip_spi_writebyte(uint8_t wb) {} /** * @brief Default function to burst read in SPI interface. * @note This function help not to access wrong address. If you do not describe this function or register any functions, * null function is called. */ //void wizchip_spi_readburst(uint8_t* pBuf, uint16_t len) {}; void wizchip_spi_readburst(uint8_t* pBuf, uint16_t len) {} /** * @brief Default function to burst write in SPI interface. * @note This function help not to access wrong address. If you do not describe this function or register any functions, * null function is called. */ //void wizchip_spi_writeburst(uint8_t* pBuf, uint16_t len) {}; void wizchip_spi_writeburst(uint8_t* pBuf, uint16_t len) {} /** * @\ref _WIZCHIP instance */ // //M20150401 : For a compiler didnot support a member of structure // Replace the assignment of struct members with the assingment of array // /* _WIZCHIP WIZCHIP = { .id = _WIZCHIP_ID_, .if_mode = _WIZCHIP_IO_MODE_, .CRIS._enter = wizchip_cris_enter, .CRIS._exit = wizchip_cris_exit, .CS._select = wizchip_cs_select, .CS._deselect = wizchip_cs_deselect, .IF.BUS._read_byte = wizchip_bus_readbyte, .IF.BUS._write_byte = wizchip_bus_writebyte // .IF.SPI._read_byte = wizchip_spi_readbyte, // .IF.SPI._write_byte = wizchip_spi_writebyte }; */ _WIZCHIP WIZCHIP = { (0x0200 + 1), "W5500\0" , wizchip_cris_enter, wizchip_cris_exit, wizchip_cs_select, wizchip_cs_deselect, //M20150601 : Rename the function //wizchip_bus_readbyte, //wizchip_bus_writebyte wizchip_bus_readdata, wizchip_bus_writedata, // wizchip_spi_readbyte, // wizchip_spi_writebyte }; static uint8_t _DNS_[4]; // DNS server ip address static dhcp_mode _DHCP_; // DHCP mode void reg_wizchip_cris_cbfunc(void(*cris_en)(void), void(*cris_ex)(void)) { if(!cris_en || !cris_ex) { WIZCHIP.CRIS._enter = wizchip_cris_enter; WIZCHIP.CRIS._exit = wizchip_cris_exit; } else { WIZCHIP.CRIS._enter = cris_en; WIZCHIP.CRIS._exit = cris_ex; } } void reg_wizchip_cs_cbfunc(void(*cs_sel)(void), void(*cs_desel)(void)) { if(!cs_sel || !cs_desel) { WIZCHIP.CS._select = wizchip_cs_select; WIZCHIP.CS._deselect = wizchip_cs_deselect; } else { WIZCHIP.CS._select = cs_sel; WIZCHIP.CS._deselect = cs_desel; } } //M20150515 : For integrating with W5300 //void reg_wizchip_bus_cbfunc(uint8_t(*bus_rb)(uint32_t addr), void (*bus_wb)(uint32_t addr, uint8_t wb)) void reg_wizchip_bus_cbfunc(iodata_t(*bus_rb)(uint32_t addr), void (*bus_wb)(uint32_t addr, iodata_t wb)) { while(!(WIZCHIP.if_mode & 0x0100)); //M20150601 : Rename call back function for integrating with W5300 /* if(!bus_rb || !bus_wb) { WIZCHIP.IF.BUS._read_byte = wizchip_bus_readbyte; WIZCHIP.IF.BUS._write_byte = wizchip_bus_writebyte; } else { WIZCHIP.IF.BUS._read_byte = bus_rb; WIZCHIP.IF.BUS._write_byte = bus_wb; } */ if(!bus_rb || !bus_wb) { WIZCHIP.IF.BUS._read_data = wizchip_bus_readdata; WIZCHIP.IF.BUS._write_data = wizchip_bus_writedata; } else { WIZCHIP.IF.BUS._read_data = bus_rb; WIZCHIP.IF.BUS._write_data = bus_wb; } } void reg_wizchip_spi_cbfunc(uint8_t (*spi_rb)(void), void (*spi_wb)(uint8_t wb)) { while(!(WIZCHIP.if_mode & 0x0200)); if(!spi_rb || !spi_wb) { WIZCHIP.IF.SPI._read_byte = wizchip_spi_readbyte; WIZCHIP.IF.SPI._write_byte = wizchip_spi_writebyte; } else { WIZCHIP.IF.SPI._read_byte = spi_rb; WIZCHIP.IF.SPI._write_byte = spi_wb; } } // 20140626 Eric Added for SPI burst operations void reg_wizchip_spiburst_cbfunc(void (*spi_rb)(uint8_t* pBuf, uint16_t len), void (*spi_wb)(uint8_t* pBuf, uint16_t len)) { while(!(WIZCHIP.if_mode & 0x0200)); if(!spi_rb || !spi_wb) { WIZCHIP.IF.SPI._read_burst = wizchip_spi_readburst; WIZCHIP.IF.SPI._write_burst = wizchip_spi_writeburst; } else { WIZCHIP.IF.SPI._read_burst = spi_rb; WIZCHIP.IF.SPI._write_burst = spi_wb; } } int8_t ctlwizchip(ctlwizchip_type cwtype, void* arg) { uint8_t tmp = 0; uint8_t* ptmp[2] = {0,0}; switch(cwtype) { case CW_RESET_WIZCHIP: wizchip_sw_reset(); break; case CW_INIT_WIZCHIP: if(arg != 0) { ptmp[0] = (uint8_t*)arg; ptmp[1] = ptmp[0] + 8; } return wizchip_init(ptmp[0], ptmp[1]); case CW_CLR_INTERRUPT: wizchip_clrinterrupt(*((intr_kind*)arg)); break; case CW_GET_INTERRUPT: *((intr_kind*)arg) = wizchip_getinterrupt(); break; case CW_SET_INTRMASK: wizchip_setinterruptmask(*((intr_kind*)arg)); break; case CW_GET_INTRMASK: *((intr_kind*)arg) = wizchip_getinterruptmask(); break; //M20150601 : This can be supported by W5200, W5500 //#if _WIZCHIP_ > 5100 case CW_SET_INTRTIME: { WIZCHIP_WRITE((0x00000000 + (0x0013 << 8) + (0x00 << 3)), (uint8_t)(*(uint16_t*)arg >> 8)); WIZCHIP_WRITE(((0x00000000 + (0x0013 << 8) + (0x00 << 3)) + (1<<8)), (uint8_t) *(uint16_t*)arg); }; break; case CW_GET_INTRTIME: *(uint16_t*)arg = (((uint16_t)WIZCHIP_READ((0x00000000 + (0x0013 << 8) + (0x00 << 3))) << 8) + WIZCHIP_READ(((0x00000000 + (0x0013 << 8) + (0x00 << 3)) + (1<<8)))); break; case CW_GET_ID: ((uint8_t*)arg)[0] = WIZCHIP.id[0]; ((uint8_t*)arg)[1] = WIZCHIP.id[1]; ((uint8_t*)arg)[2] = WIZCHIP.id[2]; ((uint8_t*)arg)[3] = WIZCHIP.id[3]; ((uint8_t*)arg)[4] = WIZCHIP.id[4]; ((uint8_t*)arg)[5] = 0; break; case CW_RESET_PHY: wizphy_reset(); break; case CW_SET_PHYCONF: wizphy_setphyconf((wiz_PhyConf*)arg); break; case CW_GET_PHYCONF: wizphy_getphyconf((wiz_PhyConf*)arg); break; case CW_GET_PHYSTATUS: break; case CW_SET_PHYPOWMODE: return wizphy_setphypmode(*(uint8_t*)arg); case CW_GET_PHYPOWMODE: tmp = wizphy_getphypmode(); if((int8_t)tmp == -1) return -1; *(uint8_t*)arg = tmp; break; case CW_GET_PHYLINK: tmp = wizphy_getphylink(); if((int8_t)tmp == -1) return -1; *(uint8_t*)arg = tmp; break; default: return -1; } return 0; } int8_t ctlnetwork(ctlnetwork_type cntype, void* arg) { switch(cntype) { case CN_SET_NETINFO: wizchip_setnetinfo((wiz_NetInfo*)arg); break; case CN_GET_NETINFO: wizchip_getnetinfo((wiz_NetInfo*)arg); break; case CN_SET_NETMODE: return wizchip_setnetmode(*(netmode_type*)arg); case CN_GET_NETMODE: *(netmode_type*)arg = wizchip_getnetmode(); break; case CN_SET_TIMEOUT: wizchip_settimeout((wiz_NetTimeout*)arg); break; case CN_GET_TIMEOUT: wizchip_gettimeout((wiz_NetTimeout*)arg); break; default: return -1; } return 0; } void wizchip_sw_reset(void) { uint8_t gw[4], sn[4], sip[4]; uint8_t mac[6]; //A20150601 // WIZCHIP_READ_BUF((0x00000000 + (0x0009 << 8) + (0x00 << 3)), mac, 6); WIZCHIP_READ_BUF((0x00000000 + (0x0001 << 8) + (0x00 << 3)),gw,4); WIZCHIP_READ_BUF((0x00000000 + (0x0005 << 8) + (0x00 << 3)), sn, 4); WIZCHIP_READ_BUF((0x00000000 + (0x000F << 8) + (0x00 << 3)), sip, 4); WIZCHIP_WRITE((0x00000000 + (0x0000 << 8) + (0x00 << 3)),0x80); WIZCHIP_READ((0x00000000 + (0x0000 << 8) + (0x00 << 3))); // for delay //A2015051 : For indirect bus mode // WIZCHIP_WRITE_BUF((0x00000000 + (0x0009 << 8) + (0x00 << 3)), mac, 6); WIZCHIP_WRITE_BUF((0x00000000 + (0x0001 << 8) + (0x00 << 3)),gw,4); WIZCHIP_WRITE_BUF((0x00000000 + (0x0005 << 8) + (0x00 << 3)), sn,4); WIZCHIP_WRITE_BUF((0x00000000 + (0x000F << 8) + (0x00 << 3)), sip, 4); } int8_t wizchip_init(uint8_t* txsize, uint8_t* rxsize) { int8_t i; int8_t tmp = 0; wizchip_sw_reset(); if(txsize) { tmp = 0; //M20150601 : For integrating with W5300 for(i = 0 ; i < 8; i++) { tmp += txsize[i]; if(tmp > 16) return -1; } for(i = 0 ; i < 8; i++) WIZCHIP_WRITE((0x00000000 + (0x001F << 8) + ((1+4*i) << 3)), txsize[i]); } if(rxsize) { tmp = 0; for(i = 0 ; i < 8; i++) { tmp += rxsize[i]; if(tmp > 16) return -1; } for(i = 0 ; i < 8; i++) WIZCHIP_WRITE((0x00000000 + (0x001E << 8) + ((1+4*i) << 3)),rxsize[i]); } return 0; } void wizchip_clrinterrupt(intr_kind intr) { uint8_t ir = (uint8_t)intr; uint8_t sir = (uint8_t)((uint16_t)intr >> 8); WIZCHIP_WRITE((0x00000000 + (0x0015 << 8) + (0x00 << 3)), (ir & 0xF0)); WIZCHIP_WRITE((0x00000000 + (0x0017 << 8) + (0x00 << 3)), sir); } intr_kind wizchip_getinterrupt(void) { uint8_t ir = 0; uint8_t sir = 0; uint16_t ret = 0; ir = (WIZCHIP_READ((0x00000000 + (0x0015 << 8) + (0x00 << 3))) & 0xF0); sir = WIZCHIP_READ((0x00000000 + (0x0017 << 8) + (0x00 << 3))); //M20150601 : For Integrating with W5300 //#if _WIZCHIP_ < 5500 ret = sir; ret = (ret << 8) + ir; return (intr_kind)ret; } void wizchip_setinterruptmask(intr_kind intr) { uint8_t imr = (uint8_t)intr; uint8_t simr = (uint8_t)((uint16_t)intr >> 8); WIZCHIP_WRITE((0x00000000 + (0x0016 << 8) + (0x00 << 3)), imr); WIZCHIP_WRITE((0x00000000 + (0x0018 << 8) + (0x00 << 3)), simr); } intr_kind wizchip_getinterruptmask(void) { uint8_t imr = 0; uint8_t simr = 0; uint16_t ret = 0; imr = WIZCHIP_READ((0x00000000 + (0x0016 << 8) + (0x00 << 3))); simr = WIZCHIP_READ((0x00000000 + (0x0018 << 8) + (0x00 << 3))); ret = simr; ret = (ret << 8) + imr; return (intr_kind)ret; } int8_t wizphy_getphylink(void) { int8_t tmp; if(WIZCHIP_READ((0x00000000 + (0x002E << 8) + (0x00 << 3))) & (1<<0)) tmp = 1; else tmp = 0; return tmp; } int8_t wizphy_getphypmode(void) { int8_t tmp = 0; if(WIZCHIP_READ((0x00000000 + (0x002E << 8) + (0x00 << 3))) & (6<<3)) tmp = 1; else tmp = 0; return tmp; } void wizphy_reset(void) { uint8_t tmp = WIZCHIP_READ((0x00000000 + (0x002E << 8) + (0x00 << 3))); tmp &= ~(1<<7); WIZCHIP_WRITE((0x00000000 + (0x002E << 8) + (0x00 << 3)), tmp); tmp = WIZCHIP_READ((0x00000000 + (0x002E << 8) + (0x00 << 3))); tmp |= ~~(1<<7); WIZCHIP_WRITE((0x00000000 + (0x002E << 8) + (0x00 << 3)), tmp); } void wizphy_setphyconf(wiz_PhyConf* phyconf) { uint8_t tmp = 0; if(phyconf->by == 1) tmp |= (1<<6); else tmp &= ~(1<<6); if(phyconf->mode == 1) tmp |= (7<<3); else { if(phyconf->duplex == 1) { if(phyconf->speed == 1) tmp |= (3<<3); else tmp |= (1<<3); } else { if(phyconf->speed == 1) tmp |= (2<<3); else tmp |= (0<<3); } } WIZCHIP_WRITE((0x00000000 + (0x002E << 8) + (0x00 << 3)), tmp); wizphy_reset(); } void wizphy_getphyconf(wiz_PhyConf* phyconf) { uint8_t tmp = 0; tmp = WIZCHIP_READ((0x00000000 + (0x002E << 8) + (0x00 << 3))); phyconf->by = (tmp & (1<<6)) ? 1 : 0; switch(tmp & (7<<3)) { case (7<<3): case (4<<3): phyconf->mode = 1; break; default: phyconf->mode = 0; break; } switch(tmp & (7<<3)) { case (4<<3): case (3<<3): case (2<<3): phyconf->speed = 1; break; default: phyconf->speed = 0; break; } switch(tmp & (7<<3)) { case (4<<3): case (3<<3): case (1<<3): phyconf->duplex = 1; break; default: phyconf->duplex = 0; break; } } void wizphy_getphystat(wiz_PhyConf* phyconf) { uint8_t tmp = WIZCHIP_READ((0x00000000 + (0x002E << 8) + (0x00 << 3))); phyconf->duplex = (tmp & (1<<2)) ? 1 : 0; phyconf->speed = (tmp & (1<<1)) ? 1 : 0; } int8_t wizphy_setphypmode(uint8_t pmode) { uint8_t tmp = 0; tmp = WIZCHIP_READ((0x00000000 + (0x002E << 8) + (0x00 << 3))); if((tmp & (1<<6))== 0) return -1; tmp &= ~(7<<3); if( pmode == 1) tmp |= (6<<3); else tmp |= (7<<3); WIZCHIP_WRITE((0x00000000 + (0x002E << 8) + (0x00 << 3)), tmp); wizphy_reset(); tmp = WIZCHIP_READ((0x00000000 + (0x002E << 8) + (0x00 << 3))); if( pmode == 1) { if(tmp & (6<<3)) return 0; } else { if(tmp & (7<<3)) return 0; } return -1; } void wizchip_setnetinfo(wiz_NetInfo* pnetinfo) { WIZCHIP_WRITE_BUF((0x00000000 + (0x0009 << 8) + (0x00 << 3)), pnetinfo->mac, 6); WIZCHIP_WRITE_BUF((0x00000000 + (0x0001 << 8) + (0x00 << 3)),pnetinfo->gw,4); WIZCHIP_WRITE_BUF((0x00000000 + (0x0005 << 8) + (0x00 << 3)), pnetinfo->sn,4); WIZCHIP_WRITE_BUF((0x00000000 + (0x000F << 8) + (0x00 << 3)), pnetinfo->ip, 4); _DNS_[0] = pnetinfo->dns[0]; _DNS_[1] = pnetinfo->dns[1]; _DNS_[2] = pnetinfo->dns[2]; _DNS_[3] = pnetinfo->dns[3]; _DHCP_ = pnetinfo->dhcp; } void wizchip_getnetinfo(wiz_NetInfo* pnetinfo) { WIZCHIP_READ_BUF((0x00000000 + (0x0009 << 8) + (0x00 << 3)), pnetinfo->mac, 6); WIZCHIP_READ_BUF((0x00000000 + (0x0001 << 8) + (0x00 << 3)),pnetinfo->gw,4); WIZCHIP_READ_BUF((0x00000000 + (0x0005 << 8) + (0x00 << 3)), pnetinfo->sn, 4); WIZCHIP_READ_BUF((0x00000000 + (0x000F << 8) + (0x00 << 3)), pnetinfo->ip, 4); pnetinfo->dns[0]= _DNS_[0]; pnetinfo->dns[1]= _DNS_[1]; pnetinfo->dns[2]= _DNS_[2]; pnetinfo->dns[3]= _DNS_[3]; pnetinfo->dhcp = _DHCP_; } int8_t wizchip_setnetmode(netmode_type netmode) { uint8_t tmp = 0; if(netmode & ~(NM_WAKEONLAN | NM_PPPOE | NM_PINGBLOCK | NM_FORCEARP)) return -1; tmp = WIZCHIP_READ((0x00000000 + (0x0000 << 8) + (0x00 << 3))); tmp |= (uint8_t)netmode; WIZCHIP_WRITE((0x00000000 + (0x0000 << 8) + (0x00 << 3)),tmp); return 0; } netmode_type wizchip_getnetmode(void) { return (netmode_type) WIZCHIP_READ((0x00000000 + (0x0000 << 8) + (0x00 << 3))); } void wizchip_settimeout(wiz_NetTimeout* nettime) { WIZCHIP_WRITE((0x00000000 + (0x001B << 8) + (0x00 << 3)), nettime ->retry_cnt); { WIZCHIP_WRITE((0x00000000 + (0x0019 << 8) + (0x00 << 3)), (uint8_t)(nettime ->time_100us >> 8)); WIZCHIP_WRITE(((0x00000000 + (0x0019 << 8) + (0x00 << 3)) + (1<<8)), (uint8_t) nettime ->time_100us); }; } void wizchip_gettimeout(wiz_NetTimeout* nettime) { nettime->retry_cnt = WIZCHIP_READ((0x00000000 + (0x001B << 8) + (0x00 << 3))); nettime->time_100us = (((uint16_t)WIZCHIP_READ((0x00000000 + (0x0019 << 8) + (0x00 << 3))) << 8) + WIZCHIP_READ(((0x00000000 + (0x0019 << 8) + (0x00 << 3)) + (1<<8)))); }