Socket APIs: Ethernet/W5300/w5300.h File Reference

Wiznet Socket API

w5300.h File Reference

W5300 HAL implement File. More...

#include <stdint.h> #include "wizchip_conf.h"

Go to the source code of this file.

Macros

#define _WIZCHIP_SN_BASE_   (0x0200)
 
#define _WIZCHIP_SN_SIZE_   (0x0040)
 
#define WIZCHIP_CREG_BLOCK   0x00
 Common register block. More...
 
#define WIZCHIP_SREG_BLOCK(N)   (_WIZCHIP_SN_BASE_+ _WIZCHIP_SN_SIZE_*N)
 Socket N register block. More...
 
#define WIZCHIP_OFFSET_INC(ADDR, N)   (ADDR + N)
 Increase offset address. More...
 
#define _W5300_IO_BASE_   _WIZCHIP_IO_BASE_
 
#define IINCHIP_READ(ADDR)   WIZCHIP_READ(ADDR)
 The defined for legacy chip driver. More...
 
#define IINCHIP_WRITE(ADDR, VAL)   WIZCHIP_WRITE(ADDR,VAL)
 The defined for legacy chip driver. More...
 
#define MR   (_WIZCHIP_IO_BASE_)
 Mode Register address(R/W)
MR is used for S/W reset, ping block mode, PPPoE mode and etc. More...
 
#define IR   (_W5300_IO_BASE_ + 0x02)
 Interrupt Register(R/W) More...
 
#define _IMR_   (_W5300_IO_BASE_ + 0x04)
 Socket Interrupt Mask Register(R/W) More...
 
#define SHAR   (_W5300_IO_BASE_ + 0x08)
 Source MAC Register address(R/W) More...
 
#define GAR   (_W5300_IO_BASE_ + 0x10)
 Gateway IP Register address(R/W) More...
 
#define SUBR   (_W5300_IO_BASE_ + 0x14)
 Subnet mask Register address(R/W) More...
 
#define SIPR   (_W5300_IO_BASE_ + 0x18)
 Source IP Register address(R/W) More...
 
#define _RTR_   (_W5300_IO_BASE_ + 0x1C)
 Timeout register address( 1 is 100us )(R/W) More...
 
#define _RCR_   (_W5300_IO_BASE_ + 0x1E)
 Retry count register(R/W) More...
 
#define TMS01R   (_W5300_IO_BASE_ + 0x20)
 TX memory size of SOCKET 0 & 1. More...
 
#define TMS23R   (TMS01R + 2)
 TX memory size of SOCKET 2 & 3. More...
 
#define TMS45R   (TMS01R + 4)
 TX memory size of SOCKET 4 & 5. More...
 
#define TMS67R   (TMS01R + 6)
 TX memory size of SOCKET 6 & 7. More...
 
#define TMSR0   TMS01R
 TX memory size of SOCKET 0. More...
 
#define TMSR1   (TMSR0 + 1)
 TX memory size of SOCKET 1. More...
 
#define TMSR2   (TMSR0 + 2)
 TX memory size of SOCKET 2. More...
 
#define TMSR3   (TMSR0 + 3)
 TX memory size of SOCKET 3. More...
 
#define TMSR4   (TMSR0 + 4)
 TX memory size of SOCKET 4. More...
 
#define TMSR5   (TMSR0 + 5)
 TX memory size of SOCKET 5. More...
 
#define TMSR6   (TMSR0 + 6)
 TX memory size of SOCKET 6. More...
 
#define TMSR7   (TMSR0 + 7)
 TX memory size of SOCKET 7. More...
 
#define RMS01R   (_W5300_IO_BASE_ + 0x28)
 RX memory size of SOCKET 0 & 1. More...
 
#define RMS23R   (RMS01R + 2)
 RX memory size of SOCKET 2 & 3. More...
 
#define RMS45R   (RMS01R + 4)
 RX memory size of SOCKET 4 & 5. More...
 
#define RMS67R   (RMS01R + 6)
 RX memory size of SOCKET 6 & 7. More...
 
#define RMSR0   RMS01R
 RX memory size of SOCKET 0. More...
 
#define RMSR1   (RMSR0 + 1)
 RX memory size of SOCKET 1. More...
 
#define RMSR2   (RMSR0 + 2)
 RX memory size of SOCKET 2. More...
 
#define RMSR3   (RMSR0 + 3)
 RX memory size of SOCKET 3. More...
 
#define RMSR4   (RMSR0 + 4)
 RX memory size of SOCKET 4. More...
 
#define RMSR5   (RMSR0 + 5)
 RX memory size of SOCKET 5. More...
 
#define RMSR6   (RMSR0 + 6)
 RX memory size of SOCKET 6. More...
 
#define RMSR7   (RMSR0 + 7)
 RX memory size of SOCKET 7. More...
 
#define MTYPER   (_W5300_IO_BASE_ + 0x30)
 Memory Type Register. More...
 
#define PATR   (_W5300_IO_BASE_ + 0x32)
 PPPoE Authentication Type register. More...
 
#define PTIMER   (_W5300_IO_BASE_ + 0x36)
 PPP Link Control Protocol Request Timer Register. More...
 
#define PMAGICR   (_W5300_IO_BASE_ + 0x38)
 PPP LCP magic number register. More...
 
#define PSIDR   (_W5300_IO_BASE_ + 0x3C)
 PPPoE session ID register. More...
 
#define PDHAR   (_W5300_IO_BASE_ + 0x40)
 PPPoE destination hardware address register. More...
 
#define UIPR   (_W5300_IO_BASE_ + 0x48)
 Unreachable IP address register. More...
 
#define UPORTR   (_W5300_IO_BASE_ + 0x4C)
 Unreachable port number register. More...
 
#define FMTUR   (_W5300_IO_BASE_ + 0x4E)
 Fragment MTU register. More...
 
#define Pn_BRDYR(n)   (_W5300_IO_BASE_ + 0x60 + n*4)
 PIN 'BRDYn' configure register. More...
 
#define Pn_BDPTHR(n)   (_W5300_IO_BASE_ + 0x60 + n*4 + 2)
 PIN 'BRDYn' buffer depth Register. More...
 
#define IDR   (_W5300_IO_BASE_ + 0xFE)
 W5300 identification register. More...
 
#define VERSIONR   IDR
 
#define Sn_MR(n)   (_W5300_IO_BASE_ + WIZCHIP_SREG_BLOCK(n) + 0x00)
 Socket Mode register(R/W) More...
 
#define Sn_CR(n)   (_W5300_IO_BASE_ + WIZCHIP_SREG_BLOCK(n) + 0x02)
 Socket command register(R/W) More...
 
#define Sn_IMR(n)   (_W5300_IO_BASE_ + WIZCHIP_SREG_BLOCK(n) + 0x04)
 socket interrupt mask register(R) More...
 
#define Sn_IR(n)   (_W5300_IO_BASE_ + WIZCHIP_SREG_BLOCK(n) + 0x06)
 Socket interrupt register(R) More...
 
#define Sn_SSR(n)   (_W5300_IO_BASE_ + WIZCHIP_SREG_BLOCK(n) + 0x08)
 Socket status register(R) More...
 
#define Sn_SR(n)   Sn_SSR(n)
 For Compatible ioLibrary. Refer to Sn_SSR(n) More...
 
#define Sn_PORTR(n)   (_W5300_IO_BASE_ + WIZCHIP_SREG_BLOCK(n) + 0x0A)
 source port register(R/W) More...
 
#define Sn_PORT(n)   Sn_PORTR(n)
 For compatible ioLibrary. Refer to Sn_PORTR(n). More...
 
#define Sn_DHAR(n)   (_W5300_IO_BASE_ + WIZCHIP_SREG_BLOCK(n) + 0x0C)
 Peer MAC register address(R/W) More...
 
#define Sn_DPORTR(n)   (_W5300_IO_BASE_ + WIZCHIP_SREG_BLOCK(n) + 0x12)
 Peer port register address(R/W) More...
 
#define Sn_DPORT(n)   Sn_DPORTR(n)
 For compatible ioLibrary. Refer to Sn_DPORTR. More...
 
#define Sn_DIPR(n)   (_W5300_IO_BASE_ + WIZCHIP_SREG_BLOCK(n) + 0x14)
 Peer IP register address(R/W) More...
 
#define Sn_MSSR(n)   (_W5300_IO_BASE_ + WIZCHIP_SREG_BLOCK(n) + 0x18)
 Maximum Segment Size(Sn_MSSR0) register address(R/W) More...
 
#define Sn_KPALVTR(n)   (_W5300_IO_BASE_ + WIZCHIP_SREG_BLOCK(n) + 0x1A)
 Keep Alive Timer register(R/W) More...
 
#define Sn_PROTOR(n)   Sn_KPALVTR(n)
 IP Protocol(PROTO) Register(R/W) More...
 
#define Sn_TOSR(n)   (_W5300_IO_BASE_ + WIZCHIP_SREG_BLOCK(n) + 0x1C)
 IP Type of Service(TOS) Register(R/W) More...
 
#define Sn_TOS(n)   Sn_TOSR(n)
 For compatible ioLibrary. Refer to Sn_TOSR. More...
 
#define Sn_TTLR(n)   (_W5300_IO_BASE_ + WIZCHIP_SREG_BLOCK(n) + 0x1E)
 IP Time to live(TTL) Register(R/W) More...
 
#define Sn_TTL(n)   Sn_TTLR(n)
 For compatible ioLibrary. Refer to Sn_TTLR. More...
 
#define Sn_TX_WRSR(n)   (_W5300_IO_BASE_ + WIZCHIP_SREG_BLOCK(n) + 0x20)
 SOCKETn TX write size register(R/W) More...
 
#define Sn_TX_FSR(n)   (_W5300_IO_BASE_ + WIZCHIP_SREG_BLOCK(n) + 0x0024)
 Transmit free memory size register(R) More...
 
#define Sn_RX_RSR(n)   (_W5300_IO_BASE_ + WIZCHIP_SREG_BLOCK(n) + 0x0028)
 Received data size register(R) More...
 
#define Sn_FRAGR(n)   (_W5300_IO_BASE_ + WIZCHIP_SREG_BLOCK(n) + 0x002C)
 Fragment field value in IP header register(R/W) More...
 
#define Sn_FRAG(n)   Sn_FRAGR(n)
 
#define Sn_TX_FIFOR(n)   (_W5300_IO_BASE_ + WIZCHIP_SREG_BLOCK(n) + 0x2E)
 SOCKET n TX FIFO regsiter. More...
 
#define Sn_RX_FIFOR(n)   (_W5300_IO_BASE_ + WIZCHIP_SREG_BLOCK(n) + 0x30)
 SOCKET n RX FIFO register. More...
 
#define MR_DBW   (1 << 15)
 
#define MR_MPF   (1 << 14)
 
#define MR_WDF(X)   ((X & 0x07) << 11)
 
#define MR_RDH   (1 << 10)
 
#define MR_FS   (1 << 8)
 
#define MR_RST   (1 << 7)
 
#define MR_MT   (1 << 5)
 
#define MR_PB   (1 << 4)
 
#define MR_PPPoE   (1 << 3)
 
#define MR_DBS   (1 << 2)
 
#define MR_IND   (1 << 0)
 
#define IR_IPCF   (1 << 15)
 
#define IR_DPUR   (1 << 14)
 
#define IR_PPPT   (1 << 13)
 
#define IR_FMTU   (1 << 12)
 
#define IR_SnINT(n)   (0x01 << n)
 
#define Pn_PEN   (1 << 7)
 
#define Pn_MT   (1 << 6)
 
#define Pn_PPL   (1 << 5)
 
#define Pn_SN(n)   ((n & 0x07) << 0)
 
#define Sn_MR_ALIGN   (1 << 8)
 Alignment bit of Sn_MR. More...
 
#define Sn_MR_MULTI   (1 << 7)
 Multicasting bit of Sn_MR. More...
 
#define Sn_MR_MF   (1 << 6)
 MAC filter bit of Sn_MR. More...
 
#define Sn_MR_IGMPv   (1 << 5)
 IGMP version bit of Sn_MR details It is valid in case of Sn_MR_MULTI='1' and UDP(Sn_MR_UDP). It configures IGMP version to send IGMP message such as Join/Leave/Report to multicast-group.
0 : IGMPv2, 1 : IGMPv1. More...
 
#define Sn_MR_MC   Sn_MR_IGMPv
 For compatible ioLibrary. More...
 
#define Sn_MR_ND   (1 << 5)
 No delayed ack bit of Sn_MR. More...
 
#define Sn_MR_CLOSE   0x00
 No mode. More...
 
#define Sn_MR_TCP   0x01
 TCP mode. More...
 
#define Sn_MR_UDP   0x02
 UDP mode. More...
 
#define Sn_MR_IPRAW   0x03
 IP LAYER RAW mode. More...
 
#define Sn_MR_MACRAW   0x04
 MAC LAYER RAW mode. More...
 
#define Sn_MR_PPPoE   0x05
 PPPoE mode. More...
 
#define SOCK_STREAM   Sn_MR_TCP
 
#define SOCK_DGRAM   Sn_MR_UDP
 
#define Sn_CR_OPEN   0x01
 Initialize or open a socket. More...
 
#define Sn_CR_LISTEN   0x02
 Wait connection request in TCP mode(Server mode) More...
 
#define Sn_CR_CONNECT   0x04
 Send connection request in TCP mode(Client mode) More...
 
#define Sn_CR_DISCON   0x08
 Send closing request in TCP mode. More...
 
#define Sn_CR_CLOSE   0x10
 Close socket. More...
 
#define Sn_CR_SEND   0x20
 Update TX buffer pointer and send data. More...
 
#define Sn_CR_SEND_MAC   0x21
 Send data with MAC address, so without ARP process. More...
 
#define Sn_CR_SEND_KEEP   0x22
 Send keep alive message. More...
 
#define Sn_CR_RECV   0x40
 Update RX buffer pointer and receive data. More...
 
#define Sn_CR_PCON   0x23
 
#define Sn_CR_PDISCON   0x24
 
#define Sn_CR_PCR   0x25
 
#define Sn_CR_PCN   0x26
 
#define Sn_CR_PCJ   0x27
 
#define Sn_IR_PRECV   0x80
 
#define Sn_IR_PFAIL   0x40
 
#define Sn_IR_PNEXT   0x20
 
#define Sn_IR_SENDOK   0x10
 
#define Sn_IR_TIMEOUT   0x08
 
#define Sn_IR_RECV   0x04
 
#define Sn_IR_DISCON   0x02
 
#define Sn_IR_CON   0x01
 
#define SOCK_CLOSED   0x00
 The state of SOCKET intialized or closed. More...
 
#define SOCK_ARP   0x01
 The state of ARP process. More...
 
#define SOCK_INIT   0x13
 Initiate state in TCP. More...
 
#define SOCK_LISTEN   0x14
 Listen state. More...
 
#define SOCK_SYNSENT   0x15
 Connection state. More...
 
#define SOCK_SYNRECV   0x16
 Connection state. More...
 
#define SOCK_ESTABLISHED   0x17
 Success to connect. More...
 
#define SOCK_FIN_WAIT   0x18
 Closing state. More...
 
#define SOCK_CLOSING   0x1A
 Closing state. More...
 
#define SOCK_TIME_WAIT   0x1B
 Closing state. More...
 
#define SOCK_CLOSE_WAIT   0x1C
 Closing state. More...
 
#define SOCK_LAST_ACK   0x1D
 Closing state. More...
 
#define SOCK_UDP   0x22
 UDP socket. More...
 
#define SOCK_IPRAW   0x32
 IP raw mode socket. More...
 
#define SOCK_MACRAW   0x42
 MAC raw mode socket. More...
 
#define SOCK_PPPoE   0x5F
 PPPoE mode socket. More...
 
#define IPPROTO_IP   0
 
#define IPPROTO_ICMP   1
 
#define IPPROTO_IGMP   2
 
#define IPPROTO_GGP   3
 
#define IPPROTO_TCP   6
 
#define IPPROTO_PUP   12
 
#define IPPROTO_UDP   17
 
#define IPPROTO_IDP   22
 
#define IPPROTO_ND   77
 
#define IPPROTO_RAW   255
 
#define WIZCHIP_CRITICAL_ENTER()   WIZCHIP.CRIS._enter()
 Enter a critical section. More...
 
#define WIZCHIP_CRITICAL_EXIT()   WIZCHIP.CRIS._exit()
 Exit a critical section. More...
 
#define setIR(ir)   WIZCHIP_WRITE(IR, ir & 0xF0FF)
 Set Mode Register. More...
 
#define getIR()   (WIZCHIP_READ(IR) & 0xF0FF)
 Get IR register. More...
 
#define setIMR(imr)   WIZCHIP_WRITE(_IMR_, imr & 0xF0FF)
 Set IMR register. More...
 
#define getIMR()   (WIZCHIP_READ(_IMR_) & 0xF0FF)
 Get IMR register. More...
 
#define setSHAR(shar)
 Set local MAC address. More...
 
#define getSHAR(shar)
 Get local MAC address. More...
 
#define setGAR(gar)
 Set gateway IP address. More...
 
#define getGAR(gar)
 Get gateway IP address. More...
 
#define setSUBR(subr)
 Set subnet mask address. More...
 
#define getSUBR(subr)
 Get subnet mask address. More...
 
#define setSIPR(sipr)
 Set local IP address. More...
 
#define getSIPR(sipr)
 Get local IP address. More...
 
#define setRTR(rtr)   WIZCHIP_WRITE(_RTR_, rtr)
 Set RTR register. More...
 
#define getRTR()   WIZCHIP_READ(_RTR_)
 Get RTR register. More...
 
#define setRCR(rcr)   WIZCHIP_WRITE(_RCR_, ((uint16_t)rcr)&0x00FF)
 Set RCR register. More...
 
#define getRCR()   ((uint8_t)(WIZCHIP_READ(_RCR_) & 0x00FF))
 Get RCR register. More...
 
#define setTMS01R(tms01r)   WIZCHIP_WRITE(TMS01R,tms01r)
 Set TMS01R register. More...
 
#define getTMS01R()   WIZCHIP_READ(TMS01R)
 Get TMS01R register. More...
 
#define setTMS23R(tms23r)   WIZCHIP_WRITE(TMS23R,tms23r)
 Set TMS23R register. More...
 
#define getTMS23R()   WIZCHIP_READ(TMS23R)
 Get TMS23R register. More...
 
#define setTMS45R(tms45r)   WIZCHIP_WRITE(TMS45R,tms45r)
 Set TMS45R register. More...
 
#define getTMS45R()   WIZCHIP_READ(TMS45R)
 Get TMS45R register. More...
 
#define setTMS67R(tms67r)   WIZCHIP_WRITE(TMS67R,tms67r)
 Set TMS67R register. More...
 
#define getTMS67R()   WIZCHIP_READ(TMS67R)
 Get TMS67R register. More...
 
#define setSn_TXBUF_SIZE(sn, tmsr)   setTMSR(sn, tmsr)
 For compatible ioLibrary. More...
 
#define getSn_TXBUF_SIZE(sn)   getTMSR(sn)
 For compatible ioLibrary. More...
 
#define setRMS01R(rms01r)   WIZCHIP_WRITE(RMS01R,rms01r)
 Set RMS01R register. More...
 
#define getRMS01R()   WIZCHIP_READ(RMS01R)
 Get RMS01R register. More...
 
#define setRMS23R(rms23r)   WIZCHIP_WRITE(RMS23R,rms23r)
 Set RMS23R register. More...
 
#define getRMS23R()   WIZCHIP_READ(RMS23R)
 Get RMS23R register. More...
 
#define setRMS45R(rms45r)   WIZCHIP_WRITE(RMS45R,rms45r)
 Set RMS45R register. More...
 
#define getRMS45R()   WIZCHIP_READ(RMS45R)
 Get RMS45R register. More...
 
#define setRMS67R(rms67r)   WIZCHIP_WRITE(RMS67R,rms67r)
 Set RMS67R register. More...
 
#define getRMS67R()   WIZCHIP_READ(RMS67R)
 Get RMS67R register. More...
 
#define setSn_RXBUF_SIZE(sn, rmsr)   setRMSR(sn, rmsr)
 For compatible ioLibrary. More...
 
#define getSn_RXBUF_SIZE(sn)   getRMSR(sn)
 For compatible ioLibrary. More...
 
#define setMTYPER(mtype)   WIZCHIP_WRITE(MTYPER, mtype)
 Set MTYPER register. More...
 
#define getMTYPER()   WIZCHIP_READ(MTYPER)
 Get MTYPER register. More...
 
#define getPATR()   WIZCHIP_READ(PATR)
 Get RATR register. More...
 
#define setPTIMER(ptimer)   WIZCHIP_WRITE(PTIMER, ((uint16_t)ptimer) & 0x00FF)
 Set PTIMER register. More...
 
#define getPTIMER()   ((uint8_t)(WIZCHIP_READ(PTIMER) & 0x00FF))
 Get PTIMER register. More...
 
#define setPMAGIC(pmagic)   WIZCHIP_WRITE(PMAGIC, ((uint16_t)pmagic) & 0x00FF)
 Set PMAGIC register. More...
 
#define getPMAGIC()   ((uint8_t)(WIZCHIP_READ(PMAGIC) & 0x00FF))
 Get PMAGIC register. More...
 
#define getPSIDR()   WIZCHIP_READ(PSIDR)
 Get PSID register. More...
 
#define getPDHAR(pdhar)
 Get PDHAR register. More...
 
#define getUIPR(uipr)
 Get unreachable IP address. UIPR. More...
 
#define getUPORTR()   WIZCHIP_READ(UPORTR)
 Get UPORTR register. More...
 
#define getFMTUR()   WIZCHIP_READ(FMTUR)
 Get FMTUR register. More...
 
#define getPn_BRDYR(p)   ((uint8_t)(WIZCHIP_READ(Pn_BRDYR(p)) & 0x00FF))
 Get Pn_BRDYR register. More...
 
#define setPn_BRDYR(p, brdyr)   WIZCHIP_WRITE(Pn_BRDYR(p), brdyr & 0x00E7)
 Set Pn_BRDYR register. More...
 
#define getPn_BDPTHR(p)   WIZCHIP_READ(Pn_BDPTHR(p))
 Get Pn_BDPTHR register. More...
 
#define setPn_BDPTHR(p, bdpthr)   WIZCHIP_WRITE(Pn_BDPTHR(p),bdpthr)
 Set Pn_BDPTHR register. More...
 
#define getIDR()   WIZCHIP_READ(IDR)
 Get IDR register. More...
 
#define setSn_MR(sn, mr)   WIZCHIP_WRITE(Sn_MR(sn),mr)
 Set Sn_MR register. More...
 
#define getSn_MR(sn)   WIZCHIP_READ(Sn_MR(sn))
 Get Sn_MR register. More...
 
#define setSn_CR(sn, cr)   WIZCHIP_WRITE(Sn_CR(sn), ((uint16_t)cr) & 0x00FF)
 Set Sn_CR register. More...
 
#define getSn_CR(sn)   ((uint8_t)WIZCHIP_READ(Sn_CR(sn)))
 Get Sn_CR register. More...
 
#define setSn_IMR(sn, imr)   WIZCHIP_WRITE(Sn_IMR(sn), ((uint16_t)imr) & 0x00FF)
 Set Sn_IMR register. More...
 
#define getSn_IMR(sn)   ((uint8_t)WIZCHIP_READ(Sn_IMR(sn)))
 Get Sn_IMR register. More...
 
#define setSn_IR(sn, ir)   WIZCHIP_WRITE(Sn_IR(sn), ((uint16_t)ir) & 0x00FF)
 Set Sn_IR register. More...
 
#define getSn_IR(sn)   ((uint8_t)WIZCHIP_READ(Sn_IR(sn)))
 Get Sn_IR register. More...
 
#define getSn_SSR(sn)   ((uint8_t)WIZCHIP_READ(Sn_SR(sn)))
 Get Sn_SR register. More...
 
#define getSn_SR(sn)   getSn_SSR(sn)
 For compatible ioLibrary. Refer to getSn_SSR(). More...
 
#define setSn_PORTR(sn, port)   WIZCHIP_WRITE(Sn_PORTR(sn), port)
 Set Sn_PORTR register. More...
 
#define setSn_PORT(sn, port)   setSn_PORTR(sn, port)
 For compatible ioLibrary. More...
 
#define getSn_PORTR(sn, port)   WIZCHIP_READ(Sn_PORTR(sn))
 Get Sn_PORTR register. More...
 
#define getSn_PORT(sn)   getSn_PORTR(sn)
 For compatible ioLibrary. More...
 
#define setSn_DHAR(sn, dhar)
 Set Sn_DHAR register. More...
 
#define getSn_DHAR(sn, dhar)
 Get Sn_MR register. More...
 
#define setSn_DPORTR(sn, dport)   WIZCHIP_WRITE(Sn_DPORTR(sn),dport)
 Set Sn_DPORT register. More...
 
#define setSn_DPORT(sn, dport)   setSn_DPORTR(sn,dport)
 For compatible ioLibrary. Refer to Sn_DPORTR. More...
 
#define getSn_DPORTR(sn)   WIZCHIP_READ(Sn_DPORTR(sn))
 Get Sn_DPORT register. More...
 
#define getSn_DPORT(sn)   getSn_DPORTR(sn)
 For compatible ioLibrary. Refer to Sn_DPORTR. More...
 
#define setSn_DIPR(sn, dipr)
 Set Sn_DIPR register. More...
 
#define getSn_DIPR(sn, dipr)
 Get Sn_DIPR register. More...
 
#define setSn_MSSR(sn, mss)   WIZCHIP_WRITE(Sn_MSSR(sn), mss)
 Set Sn_MSSR register. More...
 
#define getSn_MSSR(sn)   WIZCHIP_READ(Sn_MSSR(sn))
 Get Sn_MSSR register. More...
 
#define setSn_KPALVTR(sn, kpalvt)   WIZCHIP_WRITE(Sn_KPALVTR(sn), (WIZCHIP_READ(Sn_KPALVTR(sn)) & 0x00FF) | (((uint16_t)kpalvt)<<8))
 Set Sn_KPALVTR register. More...
 
#define getSn_KPALVTR(sn)   ((uint8_t)(WIZCHIP_READ(Sn_KPALVTR(sn)) >> 8))
 Get Sn_KPALVTR register. More...
 
#define setSn_PROTOR(sn, proto)   WIZCHIP_WRITE(Sn_PROTOR(sn),(WIZCHIP_READ(Sn_PROTOR(sn) & 0xFF00) | (((uint16_t)proto) & 0x00FF))
 Set Sn_PROTOR register. More...
 
#define setSn_PROTO(sn, proto)   setSn_PROTOR(sn,proto)
 For compatible ioLibrary. More...
 
#define getSn_PROTOR(sn)   ((uint8_t)WIZCHIP_READ(Sn_PROTOR(sn)))
 Get Sn_PROTOR register. More...
 
#define getSn_PROTO(sn)   getSn_PROTOR(sn)
 For compatible ioLibrary. More...
 
#define setSn_TX_WRSR(sn, txwrs)
 Set Sn_TX_WRSR register. More...
 
#define getSn_TX_WRSR(sn)   ( (((uint32_t)WIZCHIP_READ(Sn_TX_WRSR(sn))) << 16) + (((uint32_t)WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_TX_WRSR(sn),1))) & 0x0000FFFF) )
 Get Sn_TX_WRSR register. More...
 
#define setSn_TX_FIFOR(sn, txfifo)   WIZCHIP_WRITE(Sn_TX_FIFOR(sn), txfifo);
 Set Sn_TX_FIFOR register. More...
 
#define getSn_RX_FIFOR(sn)   WIZCHIP_READ(Sn_RX_FIFOR(sn));
 Get Sn_RX_FIFOR register. More...
 
#define setSn_TOSR(sn, tos)   WIZCHIP_WRITE(Sn_TOS(sn), ((uint16_t)tos) & 0x00FF)
 Set Sn_TOSR register. More...
 
#define setSn_TOS(sn, tos)   setSn_TOSR(sn,tos)
 For compatible ioLibrar. More...
 
#define getSn_TOSR(sn)   ((uint8_t)WIZCHIP_READ(Sn_TOSR(sn)))
 Get Sn_TOSR register. More...
 
#define getSn_TOS(sn)   getSn_TOSR(sn)
 For compatible ioLibrar. More...
 
#define setSn_TTLR(sn, ttl)   WIZCHIP_WRITE(Sn_TTLR(sn), ((uint16_t)ttl) & 0x00FF)
 Set Sn_TTLR register. More...
 
#define setSn_TTL(sn, ttl)   setSn_TTLR(sn,ttl)
 For compatible ioLibrary. More...
 
#define getSn_TTLR(sn)   ((uint8_t)WIZCHIP_READ(Sn_TTL(sn)))
 Get Sn_TTLR register. More...
 
#define getSn_TTL(sn)   getSn_TTLR(sn)
 For compatible ioLibrary. More...
 
#define setSn_FRAGR(sn, frag)   WIZCHIP_WRITE(Sn_FRAGR(sn), (uint16_t)(frag >>8))
 Set Sn_FRAGR register. More...
 
#define setSn_FRAG(sn, frag)   setSn_FRAGR(sn,flag)
 
#define getSn_FRAGR(sn)   (WIZCHIP_READ(Sn_FRAG(sn)) << 8)
 Get Sn_FRAGR register. More...
 
#define getSn_FRAG(sn)   getSn_FRAGR(sn)
 
#define getSn_RxMAX(sn)   (((uint32_t)getSn_RXBUF_SIZE(sn)) << 10)
 Socket_register_access_function_W5300. More...
 
#define getSn_TxMAX(sn)   (((uint32_t)getSn_TXBUF_SIZE(sn)) << 10)
 Socket_register_access_function_W5300. More...
 

Functions

uint16_t WIZCHIP_READ (uint32_t AddrSel)
 It reads 1 byte value from a register. More...
 
void WIZCHIP_WRITE (uint32_t AddrSel, uint16_t wb)
 It writes 1 byte value to a register. More...
 
void setTMSR (uint8_t sn, uint8_t tmsr)
 Set TMSR0 ~ TMSR7 register. More...
 
uint8_t getTMSR (uint8_t sn)
 Get TMSR0 ~ TMSR7 register. More...
 
void setRMSR (uint8_t sn, uint8_t rmsr)
 Set RMS01R ~ RMS67R register. More...
 
uint8_t getRMSR (uint8_t sn)
 Get RMS01R ~ RMS67R register. More...
 
uint32_t getSn_TX_FSR (uint8_t sn)
 Get Sn_TX_FSR register. More...
 
uint32_t getSn_RX_RSR (uint8_t sn)
 Get Sn_RX_RSR register. More...
 
void wiz_send_data (uint8_t sn, uint8_t *wizdata, uint32_t len)
 It copies data to internal TX memory. More...
 
void wiz_recv_data (uint8_t sn, uint8_t *wizdata, uint32_t len)
 It copies data to your buffer from internal RX memory. More...
 
void wiz_recv_ignore (uint8_t sn, uint32_t len)
 It discard the received data in RX memory. More...
 

Detailed Description

W5300 HAL implement File.

W5300 HAL Header File.

Version
1.0.0
Date
2015/05/01
Revision history
<2015/05/01> 1st Released for integrating with ioLibrary Download the latest version directly from GitHub. Please visit the our GitHub repository for ioLibrary. >> https://github.com/Wiznet/ioLibrary_Driver
Author
MidnightCow
Copyright

Copyright (c) 2015, 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 <ORGANIZATION> 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.

Definition in file w5300.h.

Macro Definition Documentation

#define _WIZCHIP_SN_BASE_   (0x0200)

Definition at line 53 of file w5300.h.

#define _WIZCHIP_SN_SIZE_   (0x0040)

Definition at line 54 of file w5300.h.

#define WIZCHIP_CREG_BLOCK   0x00

Common register block.

Definition at line 57 of file w5300.h.

#define WIZCHIP_SREG_BLOCK (   N)    (_WIZCHIP_SN_BASE_+ _WIZCHIP_SN_SIZE_*N)

Socket N register block.

Definition at line 58 of file w5300.h.

#define WIZCHIP_OFFSET_INC (   ADDR,
 
)    (ADDR + N)

Increase offset address.

Definition at line 60 of file w5300.h.

#define _W5300_IO_BASE_   _WIZCHIP_IO_BASE_

Definition at line 63 of file w5300.h.

#define IINCHIP_READ (   ADDR)    WIZCHIP_READ(ADDR)

The defined for legacy chip driver.

Definition at line 75 of file w5300.h.

#define IINCHIP_WRITE (   ADDR,
  VAL 
)    WIZCHIP_WRITE(ADDR,VAL)

The defined for legacy chip driver.

Definition at line 76 of file w5300.h.

#define RMSR2   (RMSR0 + 2)

RX memory size of SOCKET 2.

refer to RMS01R

Definition at line 445 of file w5300.h.

#define VERSIONR   IDR

Definition at line 602 of file w5300.h.

#define Sn_SR (   n)    Sn_SSR(n)

For Compatible ioLibrary. Refer to Sn_SSR(n)

Definition at line 726 of file w5300.h.

#define Sn_PORT (   n)    Sn_PORTR(n)

For compatible ioLibrary. Refer to Sn_PORTR(n).

Definition at line 735 of file w5300.h.

#define Sn_DPORT (   n)    Sn_DPORTR(n)

For compatible ioLibrary. Refer to Sn_DPORTR.

Definition at line 754 of file w5300.h.

#define Sn_TOS (   n)    Sn_TOSR(n)

For compatible ioLibrary. Refer to Sn_TOSR.

Definition at line 803 of file w5300.h.

#define Sn_TTL (   n)    Sn_TTLR(n)

For compatible ioLibrary. Refer to Sn_TTLR.

Definition at line 812 of file w5300.h.

#define Sn_RX_RSR (   n)    (_W5300_IO_BASE_ + WIZCHIP_SREG_BLOCK(n) + 0x0028)

Received data size register(R)

Sn_RX_RSR indicates the data size received and saved in Socket n RX Buffer. Sn_RX_RSR does not exceed the RMSR such as RMS01SR and is calculated as the difference between ?Socket n RX Write Pointer (Sn_RX_WR)and Socket n RX Read Pointer (Sn_RX_RD)

Definition at line 841 of file w5300.h.

#define Sn_FRAG (   n)    Sn_FRAGR(n)

Definition at line 849 of file w5300.h.

#define MR_DBW   (1 << 15)

Data bus width bit of MR. Read Only. (0 : 8Bit, 1 : 16Bit)

Definition at line 889 of file w5300.h.

#define MR_MPF   (1 << 14)

Mac layer pause frame bit of MR. (0 : Disable, 1 : Enable)

Definition at line 890 of file w5300.h.

#define MR_WDF (   X)    ((X & 0x07) << 11)

Write data fetch time bit of MR. Fetch Data from DATA bus after PLL_CLK * MR_WDF[2:0]

Definition at line 891 of file w5300.h.

#define MR_RDH   (1 << 10)

Read data hold time bit of MR. Hold Data on DATA bus during 2 * PLL_CLK after CS high

Definition at line 892 of file w5300.h.

#define MR_FS   (1 << 8)

FIFO swap bit of MR. Swap MSB & LSB of Sn_TX_FIFOR & Sn_RX_FIFOR (0 : No swap, 1 : Swap)

Definition at line 893 of file w5300.h.

Referenced by recv(), and recvfrom().

#define MR_RST   (1 << 7)

S/W reset bit of MR. (0 : Normal Operation, 1 : Reset (automatically clear after reset))

Definition at line 894 of file w5300.h.

#define MR_MT   (1 << 5)

Memory test bit of MR. (0 : Normal, 1 : Internal Socket memory write & read Test)

Definition at line 895 of file w5300.h.

#define MR_PB   (1 << 4)

Ping block bit of MR. (0 : Unblock, 1 : Block)

Definition at line 896 of file w5300.h.

#define MR_PPPoE   (1 << 3)

PPPoE bit of MR. (0 : No use PPPoE, 1: Use PPPoE)

Definition at line 897 of file w5300.h.

#define MR_DBS   (1 << 2)

Data bus swap of MR. Valid only 16bit mode (0 : No swap, 1 : Swap)

Definition at line 898 of file w5300.h.

#define MR_IND   (1 << 0)

Indirect mode bit of MR. (0 : Direct mode, 1 : Indirect mode)

Definition at line 899 of file w5300.h.

#define IR_IPCF   (1 << 15)

IP conflict bit of IR. To clear, Write the bit to '1'.

Definition at line 905 of file w5300.h.

#define IR_DPUR   (1 << 14)

Destination port unreachable bit of IR. To clear, Write the bit to '1'.

Definition at line 906 of file w5300.h.

#define IR_PPPT   (1 << 13)

PPPoE terminate bit of IR. To clear, Write the bit to '1'.

Definition at line 907 of file w5300.h.

#define IR_FMTU   (1 << 12)

Fragment MTU bit of IR. To clear, Write the bit to '1'.

Definition at line 908 of file w5300.h.

#define IR_SnINT (   n)    (0x01 << n)

SOCKETn interrupt occurrence bit of IR. To clear, Clear Sn_IR

Definition at line 909 of file w5300.h.

#define Pn_PEN   (1 << 7)

PIN 'BRDYn' enable bit of Pn_BRDYR.

Definition at line 914 of file w5300.h.

#define Pn_MT   (1 << 6)

PIN memory type bit of Pn_BRDYR.

Definition at line 915 of file w5300.h.

#define Pn_PPL   (1 << 5)

PIN Polarity bit of Pn_BRDYR.

Definition at line 916 of file w5300.h.

#define Pn_SN (   n)    ((n & 0x07) << 0)

What socket to monitor.

Definition at line 917 of file w5300.h.

#define Sn_MR_ALIGN   (1 << 8)

Alignment bit of Sn_MR.

It is valid only in the TCP (Sn_MR_TCP) with TCP communication, when every the received DATA packet size is of even number and set as '1', data receiving performance can be improved by removing PACKET-INFO(data size) that is attached to every the received DATA packet.

Definition at line 929 of file w5300.h.

Referenced by recv().

#define Sn_MR_MULTI   (1 << 7)

Multicasting bit of Sn_MR.

It is valid only in UDP (Sn_MR_UDP). In order to implement multicasting, set the IP address and port number in Sn_DIPR and Sn_DPORTR respectively before "OPEN" command(Sn_CR_OPEN).
0 : Disable, 1 : Enable

Definition at line 937 of file w5300.h.

#define Sn_MR_MF   (1 << 6)

MAC filter bit of Sn_MR.

It is valid in MACRAW(Sn_MR_MACRAW). When this bit is set as ‘1’, W5300 can receive packet that is belong in itself or broadcasting. When this bit is set as ‘0’, W5300 can receive all packets on Ethernet. When using the hybrid TCP/IP stack, it is recommended to be set as ‘1’ for reducing the receiving overhead of host.
0 : Disable, 1 : Enable

Definition at line 947 of file w5300.h.

#define Sn_MR_IGMPv   (1 << 5)

IGMP version bit of Sn_MR details It is valid in case of Sn_MR_MULTI='1' and UDP(Sn_MR_UDP). It configures IGMP version to send IGMP message such as Join/Leave/Report to multicast-group.
0 : IGMPv2, 1 : IGMPv1.

Definition at line 955 of file w5300.h.

#define Sn_MR_MC   Sn_MR_IGMPv

For compatible ioLibrary.

Definition at line 956 of file w5300.h.

#define Sn_MR_ND   (1 << 5)

No delayed ack bit of Sn_MR.

It is valid in TCP(Sn_MR_TCP). In case that it is set as '1', ACK packet is transmitted right after receiving DATA packet from the peer. It is recommended to be set as '1' for TCP performance improvement. In case that it is set as '0', ACK packet is transmitted after the time set in RTR regardless of DATA packet receipt.
0 : No use, 1 : Use

Definition at line 966 of file w5300.h.

#define Sn_MR_CLOSE   0x00

No mode.

This configures the protocol mode of Socket n.

See also
Sn_MR

Definition at line 973 of file w5300.h.

#define Sn_MR_TCP   0x01

TCP mode.

This configures the protocol mode of Socket n.

See also
Sn_MR

Definition at line 980 of file w5300.h.

#define Sn_MR_UDP   0x02

UDP mode.

This configures the protocol mode of Socket n.

See also
Sn_MRProtocol bits of Sn_MR.

Definition at line 987 of file w5300.h.

#define Sn_MR_IPRAW   0x03

IP LAYER RAW mode.

This configures the protocol mode of Socket n.

See also
Sn_MR Protocol bits of Sn_MR.

Definition at line 994 of file w5300.h.

#define Sn_MR_MACRAW   0x04

MAC LAYER RAW mode.

This configures the protocol mode of Socket 0.

See also
Sn_MR
Note
MACRAW mode should be only used in Socket 0.

Definition at line 1002 of file w5300.h.

#define Sn_MR_PPPoE   0x05

PPPoE mode.

This configures the protocol mode of Socket 0.

See also
Sn_MR
Note
PPPoE mode should be only used in Socket 0.Protocol bits of Sn_MR.

Definition at line 1010 of file w5300.h.

#define SOCK_STREAM   Sn_MR_TCP

For Berkeley Socket API, Refer to Sn_MR_TCP

Definition at line 1012 of file w5300.h.

#define SOCK_DGRAM   Sn_MR_UDP

For Berkeley Socket API, Refer to Sn_MR_UDP

Definition at line 1013 of file w5300.h.

#define Sn_CR_OPEN   0x01

Initialize or open a socket.

Socket n is initialized and opened according to the protocol selected in Sn_MR(P3:P0). The table below shows the value of Sn_SR corresponding to Sn_MR.

Sn_MR (P[3:0]) Sn_SR
Sn_MR_CLOSE (000)
Sn_MR_TCP (001) SOCK_INIT (0x13)
Sn_MR_UDP (010) SOCK_UDP (0x22)
Sn_MR_IPRAW (010) SOCK_IPRAW (0x32)
Sn_MR_MACRAW (100) SOCK_MACRAW (0x42)
Sn_MR_PPPoE (101) SOCK_PPPoE (0x5F)

Definition at line 1034 of file w5300.h.

#define Sn_CR_LISTEN   0x02

Wait connection request in TCP mode(Server mode)

This is valid only in TCP mode (Sn_MR(P3:P0) = Sn_MR_TCP). In this mode, Socket n operates as a TCP serverand waits for connection-request (SYN packet) from any TCP client The Sn_SR changes the state from SOCK_INIT to SOCKET_LISTEN. When a TCP clientconnection request is successfully established, the Sn_SR changes from SOCK_LISTEN to SOCK_ESTABLISHED and the Sn_IR(0) becomes But when a TCP clientconnection request is failed, Sn_IR(3) becomes and the status of Sn_SR changes to SOCK_CLOSED.

Definition at line 1045 of file w5300.h.

#define Sn_CR_CONNECT   0x04

Send connection request in TCP mode(Client mode)

To connect, a connect-request (SYN packet) is sent to TCP serverconfigured by Sn_DIPR & Sn_DPORT(destination address & port). If the connect-request is successful, the Sn_SR is changed to SOCK_ESTABLISHED and the Sn_IR(0) becomes

The connect-request fails in the following three cases.

  1. When a ARPTO occurs (Sn_IR[3] = '1') because destination hardware address is not acquired through the ARP-process.
  2. When a SYN/ACK packet is not received and TCPTO (Sn_IR(3) = )
  3. When a RST packet is received instead of a SYN/ACK packet. In these cases, Sn_SR is changed to SOCK_CLOSED.
    Note
    This is valid only in TCP mode and operates when Socket n acts as TCP client

Definition at line 1057 of file w5300.h.

#define Sn_CR_DISCON   0x08

Send closing request in TCP mode.

Regardless of TCP serveror TCP client the DISCON command processes the disconnect-process (b>Active closeor Passive close.

Active close
it transmits disconnect-request(FIN packet) to the connected peer
Passive close
When FIN packet is received from peer, a FIN packet is replied back to the peer.

When the disconnect-process is successful (that is, FIN/ACK packet is received successfully), Sn_SR is changed to SOCK_CLOSED.
Otherwise, TCPTO occurs (Sn_IR[3]='1') and then Sn_SR is changed to SOCK_CLOSED.

Note
Valid only in TCP mode.

Definition at line 1070 of file w5300.h.

#define Sn_CR_CLOSE   0x10

Close socket.

Sn_SR is changed to SOCK_CLOSED.

Definition at line 1076 of file w5300.h.

#define Sn_CR_SEND   0x20

Update TX buffer pointer and send data.

SEND command transmits all the data in the Socket n TX buffer thru Sn_TX_FIFOR.
For more details, please refer to Socket n TX Free Size Register (Sn_TX_FSR) and Socket TX Write Size register (Sn_TX_WRSR).

Definition at line 1083 of file w5300.h.

#define Sn_CR_SEND_MAC   0x21

Send data with MAC address, so without ARP process.

The basic operation is same as SEND.
Normally SEND command transmits data after destination hardware address is acquired by the automatic ARP-process(Address Resolution Protocol).
But SEND_MAC command transmits data without the automatic ARP-process.
In this case, the destination hardware address is acquired from Sn_DHAR configured by host, instead of APR-process.

Note
Valid only in UDP mode.

Definition at line 1093 of file w5300.h.

#define Sn_CR_SEND_KEEP   0x22

Send keep alive message.

It checks the connection status by sending 1byte keep-alive packet.
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.

Definition at line 1101 of file w5300.h.

#define Sn_CR_RECV   0x40

Update RX buffer pointer and receive data.

RECV completes the processing of the received data in Socket n RX Buffer thru Sn_RX_FIFOR).
For more details, refer to Socket n RX Received Size Register (Sn_RX_RSR) & Sn_RX_FIFOR.RECV command value of Sn_CR

Definition at line 1108 of file w5300.h.

#define Sn_CR_PCON   0x23

PPPoE connection begins by transmitting PPPoE discovery packet. Refer to Sn_CR

Definition at line 1110 of file w5300.h.

#define Sn_CR_PDISCON   0x24

Closes PPPoE connection. Refer to Sn_CR

Definition at line 1111 of file w5300.h.

#define Sn_CR_PCR   0x25

In each phase, it transmits REQ message. Refer to Sn_CR

Definition at line 1112 of file w5300.h.

#define Sn_CR_PCN   0x26

In each phase, it transmits NAK message. Refer to Sn_CR

Definition at line 1113 of file w5300.h.

#define Sn_CR_PCJ   0x27

In each phase, it transmits REJECT message. Refer to Sn_CR

Definition at line 1114 of file w5300.h.

#define Sn_IR_PRECV   0x80

It is set in the case that option data which is not supported is received. Refer to Sn_IR

Definition at line 1120 of file w5300.h.

#define Sn_IR_PFAIL   0x40

It is set in the case that PAP authentication is failed. Refer to Sn_IR

Definition at line 1121 of file w5300.h.

#define Sn_IR_PNEXT   0x20

It is set in the case that the phase is changed during PPPoE connection process. Sn_IR

Definition at line 1122 of file w5300.h.

#define Sn_IR_SENDOK   0x10

It is set when SEND command is completed. Refer to Sn_IR

Definition at line 1123 of file w5300.h.

#define Sn_IR_TIMEOUT   0x08

It is set when ARPTO or TCPTO is occured. Refer to Sn_IR

Definition at line 1124 of file w5300.h.

#define Sn_IR_RECV   0x04

It is set whenever data is received from a peer. Refer to Sn_IR

Definition at line 1125 of file w5300.h.

#define Sn_IR_DISCON   0x02

It is set when FIN or FIN/ACK packet is received from a peer. Refer to Sn_IR

Definition at line 1126 of file w5300.h.

#define Sn_IR_CON   0x01

It is set one time when the connection is successful and then Sn_SR is changed to SOCK_ESTABLISHED.

Definition at line 1127 of file w5300.h.

#define SOCK_CLOSED   0x00

The state of SOCKET intialized or closed.

This indicates that Socket n is released.
When DICON, CLOSE command is ordered, or when a timeout occurs, it is changed to SOCK_CLOSED regardless of previous status.

Definition at line 1137 of file w5300.h.

#define SOCK_ARP   0x01

The state of ARP process.

It is temporary state for getting a peer MAC address when TCP connect or UDP Data Send
When DICON, CLOSE command is ordered, or when a timeout occurs, it is changed to SOCK_CLOSED regardless of previous status.ARP-request is transmitted in order to acquire destination hardware address.

Definition at line 1144 of file w5300.h.

#define SOCK_INIT   0x13

Initiate state in TCP.

This indicates Socket n is opened with TCP mode.
It is changed to SOCK_INIT when Sn_MR(P[3:0]) = '001' and OPEN command(Sn_CR_OPEN) is ordered.
After SOCK_INIT, user can use LISTEN(Sn_CR_LISTEN)/CONNECT(Sn_CR_CONNET) command.

Definition at line 1152 of file w5300.h.

#define SOCK_LISTEN   0x14

Listen state.

This indicates Socket n is operating as TCP servermode and waiting for connection-request (SYN packet) from a peer TCP client.
It will change to SOCK_ESTALBLISHED when the connection-request is successfully accepted.
Otherwise it will change to SOCK_CLOSED after TCPTO (Sn_IR_TIMEOUT = '1') is occurred.

Definition at line 1160 of file w5300.h.

#define SOCK_SYNSENT   0x15

Connection state.

This indicates Socket n sent the connect-request packet (SYN packet) to a peer.
It is temporarily shown when Sn_SR is changed from SOCK_INIT to SOCK_ESTABLISHED by Sn_CR_CONNECT command.
If connect-accept(SYN/ACK packet) is received from the peer at SOCK_SYNSENT, it changes to SOCK_ESTABLISHED.
Otherwise, it changes to SOCK_CLOSED after TCPTO (Sn_IR_TIMEOUT = '1') is occurred.

Definition at line 1169 of file w5300.h.

#define SOCK_SYNRECV   0x16

Connection state.

It indicates Socket n successfully received the connect-request packet (SYN packet) from a peer.
If socket n sends the response (SYN/ACK packet) to the peer successfully, it changes to SOCK_ESTABLISHED.
If not, it changes to SOCK_CLOSED after timeout (Sn_IR_TIMEOUT = '1') is occurred.

Definition at line 1177 of file w5300.h.

#define SOCK_ESTABLISHED   0x17

Success to connect.

This indicates the status of the connection of Socket n.
It changes to SOCK_ESTABLISHED when the TCP SERVERprocessed the SYN packet from the TCP CLIENTduring SOCK_LISTEN, or when the Sn_CR_CONNECT command is successful.
During SOCK_ESTABLISHED, DATA packet can be transferred using Sn_CR_SEND or Sn_CR_RECV command.

Definition at line 1186 of file w5300.h.

#define SOCK_FIN_WAIT   0x18

Closing state.

These indicate Socket n is closing.
These are shown in disconnect-process such as active-close and passive-close.
When Disconnect-process is successfully completed, or when timeout(Sn_CR_TIMTEOUT = '1') is occurred, these change to SOCK_CLOSED.

Definition at line 1194 of file w5300.h.

#define SOCK_CLOSING   0x1A

Closing state.

These indicate Socket n is closing.
These are shown in disconnect-process such as active-close and passive-close.
When Disconnect-process is successfully completed, or when timeout occurs, these change to SOCK_CLOSED.

Definition at line 1202 of file w5300.h.

#define SOCK_TIME_WAIT   0x1B

Closing state.

These indicate Socket n is closing.
These are shown in disconnect-process such as active-close and passive-close.
When Disconnect-process is successfully completed, or when timeout occurs, these change to SOCK_CLOSED.

Definition at line 1210 of file w5300.h.

#define SOCK_CLOSE_WAIT   0x1C

Closing state.

This indicates Socket n received the disconnect-request (FIN packet) from the connected peer.
This is half-closing status, and data can be transferred.
For full-closing, Sn_CR_DISCON command is used. But For just-closing, Sn_CR_CLOSE command is used.

Definition at line 1218 of file w5300.h.

#define SOCK_LAST_ACK   0x1D

Closing state.

This indicates Socket n is waiting for the response (FIN/ACK packet) to the disconnect-request (FIN packet) by passive-close.
It changes to SOCK_CLOSED when Socket n received the response successfully, or when timeout (Sn_IR_TIMEOUT = '1') is occurred.

Definition at line 1225 of file w5300.h.

#define SOCK_UDP   0x22

UDP socket.

This indicates Socket n is opened in UDP mode(Sn_MR(P[3:0]) = '010').
It changes to SOCK_UDP when Sn_MR(P[3:0]) = '010' and Sn_CR_OPEN command is ordered.
Unlike TCP mode, data can be transfered without the connection-process.

Definition at line 1233 of file w5300.h.

#define SOCK_IPRAW   0x32

IP raw mode socket.

TThe socket is opened in IPRAW mode. The SOCKET status is change to SOCK_IPRAW when Sn_MR (P3:P0) is Sn_MR_IPRAW and Sn_CR_OPEN command is used.
IP Packet can be transferred without a connection similar to the UDP mode.

Definition at line 1241 of file w5300.h.

#define SOCK_MACRAW   0x42

MAC raw mode socket.

This indicates Socket 0 is opened in MACRAW mode (Sn_MR(P[3:0]) = '100' and n = 0) and is valid only in Socket 0.
It changes to SOCK_MACRAW when Sn_MR(P[3:0] = 100)and @ ref Sn_CR_OPEN command is ordered.
Like UDP mode socket, MACRAW mode Socket 0 can transfer a MAC packet (Ethernet frame) without the connection-process.SOCKET0 is open as MACRAW mode.

Definition at line 1249 of file w5300.h.

#define SOCK_PPPoE   0x5F

PPPoE mode socket.

It is the status that SOCKET0 is opened as PPPoE mode. It is changed to SOCK_PPPoE in case of Sn_CR_OPEN command is ordered and Sn_MR(P3:P0)= Sn_MR_PPPoE
It is temporarily used at the PPPoE connection.SOCKET0 is open as PPPoE mode.

Definition at line 1257 of file w5300.h.

#define IPPROTO_IP   0

Definition at line 1260 of file w5300.h.

#define IPPROTO_ICMP   1

Definition at line 1261 of file w5300.h.

#define IPPROTO_IGMP   2

Definition at line 1262 of file w5300.h.

#define IPPROTO_GGP   3

Definition at line 1263 of file w5300.h.

#define IPPROTO_TCP   6

Definition at line 1264 of file w5300.h.

#define IPPROTO_PUP   12

Definition at line 1265 of file w5300.h.

#define IPPROTO_UDP   17

Definition at line 1266 of file w5300.h.

#define IPPROTO_IDP   22

Definition at line 1267 of file w5300.h.

#define IPPROTO_ND   77

Definition at line 1268 of file w5300.h.

#define IPPROTO_RAW   255

Definition at line 1269 of file w5300.h.

#define WIZCHIP_CRITICAL_ENTER ( )    WIZCHIP.CRIS._enter()

Enter a critical section.

It is provided to protect your shared code which are executed without distribution.

In non-OS environment, It can be just implemented by disabling whole interrupt.
In OS environment, You can replace it to critical section api supported by OS.

See also
WIZCHIP_READ(), WIZCHIP_WRITE()
WIZCHIP_CRITICAL_EXIT()

Definition at line 1283 of file w5300.h.

#define WIZCHIP_CRITICAL_EXIT ( )    WIZCHIP.CRIS._exit()

Exit a critical section.

It is provided to protect your shared code which are executed without distribution.

In non-OS environment, It can be just implemented by disabling whole interrupt.
In OS environment, You can replace it to critical section api supported by OS.

See also
WIZCHIP_READ(), WIZCHIP_WRITE()
WIZCHIP_CRITICAL_ENTER()

Definition at line 1300 of file w5300.h.

#define setSn_TXBUF_SIZE (   sn,
  tmsr 
)    setTMSR(sn, tmsr)

For compatible ioLibrary.

Definition at line 1617 of file w5300.h.

#define getSn_TXBUF_SIZE (   sn)    getTMSR(sn)

For compatible ioLibrary.

Definition at line 1627 of file w5300.h.

#define setSn_RXBUF_SIZE (   sn,
  rmsr 
)    setRMSR(sn, rmsr)

For compatible ioLibrary.

Definition at line 1709 of file w5300.h.

#define getSn_RXBUF_SIZE (   sn)    getRMSR(sn)

For compatible ioLibrary.

Definition at line 1719 of file w5300.h.

#define getSn_SR (   sn)    getSn_SSR(sn)

For compatible ioLibrary. Refer to getSn_SSR().

Definition at line 1971 of file w5300.h.

#define setSn_PORT (   sn,
  port 
)    setSn_PORTR(sn, port)

For compatible ioLibrary.

Definition at line 1982 of file w5300.h.

#define getSn_PORT (   sn)    getSn_PORTR(sn)

For compatible ioLibrary.

Definition at line 1993 of file w5300.h.

#define setSn_DPORT (   sn,
  dport 
)    setSn_DPORTR(sn,dport)

For compatible ioLibrary. Refer to Sn_DPORTR.

Definition at line 2033 of file w5300.h.

#define getSn_DPORT (   sn)    getSn_DPORTR(sn)

For compatible ioLibrary. Refer to Sn_DPORTR.

Definition at line 2047 of file w5300.h.

#define setSn_PROTO (   sn,
  proto 
)    setSn_PROTOR(sn,proto)

For compatible ioLibrary.

Definition at line 2124 of file w5300.h.

#define getSn_PROTO (   sn)    getSn_PROTOR(sn)

For compatible ioLibrary.

Definition at line 2135 of file w5300.h.

#define setSn_TOS (   sn,
  tos 
)    setSn_TOSR(sn,tos)

For compatible ioLibrar.

Definition at line 2202 of file w5300.h.

#define getSn_TOS (   sn)    getSn_TOSR(sn)

For compatible ioLibrar.

Definition at line 2213 of file w5300.h.

#define setSn_TTL (   sn,
  ttl 
)    setSn_TTLR(sn,ttl)

For compatible ioLibrary.

Definition at line 2224 of file w5300.h.

#define getSn_TTL (   sn)    getSn_TTLR(sn)

For compatible ioLibrary.

Definition at line 2235 of file w5300.h.

#define setSn_FRAG (   sn,
  frag 
)    setSn_FRAGR(sn,flag)

Definition at line 2246 of file w5300.h.

#define getSn_FRAG (   sn)    getSn_FRAGR(sn)

Definition at line 2257 of file w5300.h.

#define getSn_RxMAX (   sn)    (((uint32_t)getSn_RXBUF_SIZE(sn)) << 10)

Socket_register_access_function_W5300.

Gets the max buffer size of socket sn passed as parameter.

Parameters
(uint8_t)snSocket number. It should be 0 ~ 7.
Returns
uint32_t. Value of Socket n RX max buffer size.

Definition at line 2270 of file w5300.h.

#define getSn_TxMAX (   sn)    (((uint32_t)getSn_TXBUF_SIZE(sn)) << 10)

Socket_register_access_function_W5300.

Gets the max buffer size of socket sn passed as parameters.

Parameters
(uint8_t)snSocket number. It should be 0 ~ 7.
Returns
uint32_t. Value of Socket n TX max buffer size.

Definition at line 2279 of file w5300.h.

Generated on Wed May 4 2016 16:43:59 for Socket APIs by   doxygen 1.8.9.1