Socket APIs: Socket register

Wiznet Socket API

Socket register

Socket register group.
Socket register configures and control SOCKETn which is necessary to data communication. More...

Macros

#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_PORTR(n)   (_W5300_IO_BASE_ + WIZCHIP_SREG_BLOCK(n) + 0x0A)
 source port register(R/W) 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_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_TTLR(n)   (_W5300_IO_BASE_ + WIZCHIP_SREG_BLOCK(n) + 0x1E)
 IP Time to live(TTL) Register(R/W) 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_FRAGR(n)   (_W5300_IO_BASE_ + WIZCHIP_SREG_BLOCK(n) + 0x002C)
 Fragment field value in IP header register(R/W) More...
 
#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...
 

Detailed Description

Socket register group.
Socket register configures and control SOCKETn which is necessary to data communication.

See also
Sn_MR, Sn_CR, Sn_IR, Sn_IMR : SOCKETn Control
Sn_SR, Sn_PORT, Sn_DHAR, Sn_DIPR, Sn_DPORT : SOCKETn Information
Sn_MSSR, Sn_TOS, Sn_TTL, Sn_KPALVTR, Sn_FRAG : Internet protocol.
Sn_TX_WRSR, Sn_TX_FSR, Sn_TX_RD, Sn_TX_WR, Sn_RX_RSR, Sn_RX_RD, Sn_RX_WR, Sn_TX_FIFOR, Sn_RX_FIFOR : Data communication

Macro Definition Documentation

#define Sn_MR (   n)    (_W5300_IO_BASE_ + WIZCHIP_SREG_BLOCK(n) + 0x00)

Socket Mode register(R/W)

Sn_MR configures the option or protocol type of Socket n.

Each bit of Sn_MR defined as the following.

15 14 13 12 11 10 9 8
Reserved. Read as 0 ALIGN
7 6 5 4 3 2 1 0
MULTI MF ND/IGMPv Reserved PROTOCOL[3:0]
  • Sn_MR_ALIGN : Alignment bit of Sn_MR, Only valid in Sn_MR_TCP. (C0 : Include TCP PACK_INFO, 1 : Not include TCP PACK_INFO)
  • Sn_MR_MULTI : Support UDP Multicasting
  • Sn_MR_MF : Enable MAC Filter (0 : Disable, 1 - Enable), When enabled, W5300 can receive only both own and broadcast packet.
  • Sn_MR_ND : No Delayed Ack(TCP) flag
  • Sn_MR_IGMPv : IGMP version used in UDP mulitcasting. (0 : Version 2, 1 : Version 2)
  • PROTOCOL[3:0]
    Protocol[3] Protocol[2] Protocol[1] Protocol[0] Meaning
    0 0 0 0 Closed
    0 0 0 1 TCP
    0 0 1 0 UDP
    0 0 1 1 IPCRAW
    0 1 0 0 MACRAW
    0 1 0 1 PPPoE

Definition at line 642 of file w5300.h.

#define Sn_CR (   n)    (_W5300_IO_BASE_ + WIZCHIP_SREG_BLOCK(n) + 0x02)

Socket command register(R/W)

This is used to set the command for Socket n such as OPEN, CLOSE, CONNECT, LISTEN, SEND, and RECEIVE.
After W5500 accepts the command, the Sn_CR register is automatically cleared to 0x00. Even though Sn_CR is cleared to 0x00, the command is still being processed.
To check whether the command is completed or not, please check the Sn_IR or Sn_SR.

Definition at line 666 of file w5300.h.

#define Sn_IMR (   n)    (_W5300_IO_BASE_ + WIZCHIP_SREG_BLOCK(n) + 0x04)

socket interrupt mask register(R)

Sn_IMR masks the interrupt of Socket n. Each bit corresponds to each bit of Sn_IR. When a Socket n Interrupt is occurred and the corresponding bit of Sn_IMR is the corresponding bit of Sn_IR becomes When both the corresponding bit of Sn_IMR and Sn_IR are and the n-th bit of IR is Host is interrupted by asserted INTn PIN to low.

Definition at line 676 of file w5300.h.

#define Sn_IR (   n)    (_W5300_IO_BASE_ + WIZCHIP_SREG_BLOCK(n) + 0x06)

Socket interrupt register(R)

Sn_IR indicates the status of Socket Interrupt such as establishment, termination, receiving data, timeout).
When an interrupt occurs and the corresponding bit of Sn_IMR is the corresponding bit of Sn_IR becomes
In order to clear the Sn_IR bit, the host should write the bit to

15 14 13 12 11 10 9 8
Reserved. Read as 0
7 6 5 4 3 2 1 0
PRECV PFAIL PNEXT SENDOK TIMEOUT RECV DISCON CON

Definition at line 699 of file w5300.h.

#define Sn_SSR (   n)    (_W5300_IO_BASE_ + WIZCHIP_SREG_BLOCK(n) + 0x08)

Socket status register(R)

Sn_SSR indicates the status of Socket n.
The status of Socket n is changed by Sn_CR or some special control packet as SYN, FIN packet in TCP.

Normal status
Temporary status during changing the status of Socket n.

Definition at line 725 of file w5300.h.

#define Sn_PORTR (   n)    (_W5300_IO_BASE_ + WIZCHIP_SREG_BLOCK(n) + 0x0A)

source port register(R/W)

Sn_PORTR configures the source port number of Socket n. It is valid when Socket n is used in TCP/UPD mode. It should be set before OPEN command is ordered.

Definition at line 734 of file w5300.h.

#define Sn_DHAR (   n)    (_W5300_IO_BASE_ + WIZCHIP_SREG_BLOCK(n) + 0x0C)

Peer MAC register address(R/W)

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.

Definition at line 743 of file w5300.h.

#define Sn_DPORTR (   n)    (_W5300_IO_BASE_ + WIZCHIP_SREG_BLOCK(n) + 0x12)

Peer port register address(R/W)

Sn_DPORTR 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.

Definition at line 753 of file w5300.h.

#define Sn_DIPR (   n)    (_W5300_IO_BASE_ + WIZCHIP_SREG_BLOCK(n) + 0x14)

Peer IP register address(R/W)

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.

Definition at line 765 of file w5300.h.

#define Sn_MSSR (   n)    (_W5300_IO_BASE_ + WIZCHIP_SREG_BLOCK(n) + 0x18)

Maximum Segment Size(Sn_MSSR0) register address(R/W)

Sn_MSSR configures or indicates the MTU(Maximum Transfer Unit) of Socket n.

Definition at line 772 of file w5300.h.

#define Sn_KPALVTR (   n)    (_W5300_IO_BASE_ + WIZCHIP_SREG_BLOCK(n) + 0x1A)

Keep Alive Timer register(R/W)

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 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 'Sn_KPALVTR > 0', W5500 automatically transmits KA packet after time-period for checking the TCP connection (Auto-keepalive-process). In case of '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 'Sn_KPALVTR > 0'.

Definition at line 785 of file w5300.h.

#define Sn_PROTOR (   n)    Sn_KPALVTR(n)

IP Protocol(PROTO) Register(R/W)

Sn_PROTO that sets the protocol number field of the IP header at the IP layer. It is valid only in IPRAW mode, and ignored in other modes.

Definition at line 793 of file w5300.h.

#define Sn_TOSR (   n)    (_W5300_IO_BASE_ + WIZCHIP_SREG_BLOCK(n) + 0x1C)

IP Type of Service(TOS) Register(R/W)

Sn_TOSR configures the TOS(Type Of Service field in IP Header) of Socket n. It is set before OPEN command.

Definition at line 802 of file w5300.h.

#define Sn_TTLR (   n)    (_W5300_IO_BASE_ + WIZCHIP_SREG_BLOCK(n) + 0x1E)

IP Time to live(TTL) Register(R/W)

Sn_TTLR configures the TTL(Time To Live field in IP header) of Socket n. It is set before OPEN command.

Definition at line 811 of file w5300.h.

#define Sn_TX_WRSR (   n)    (_W5300_IO_BASE_ + WIZCHIP_SREG_BLOCK(n) + 0x20)

SOCKETn TX write size register(R/W)

It sets the byte size of the data written in internal TX memory through Sn_TX_FIFOR. It is set before SEND or SEND_MAC command, and can't be bigger than internal TX memory size set by TMSR such as TMS01R, TMS23R and etc.

Definition at line 821 of file w5300.h.

#define Sn_TX_FSR (   n)    (_W5300_IO_BASE_ + WIZCHIP_SREG_BLOCK(n) + 0x0024)

Transmit free memory size register(R)

Sn_TX_FSR indicates the free size of Socket n TX Buffer Block. It is initialized to the configured size by TMSR such as TMS01SR. Data bigger than 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.

Definition at line 832 of file w5300.h.

#define Sn_FRAGR (   n)    (_W5300_IO_BASE_ + WIZCHIP_SREG_BLOCK(n) + 0x002C)

Fragment field value in IP header register(R/W)

Sn_FRAGR configures the FRAG(Fragment field in IP header).

Definition at line 848 of file w5300.h.

#define Sn_TX_FIFOR (   n)    (_W5300_IO_BASE_ + WIZCHIP_SREG_BLOCK(n) + 0x2E)

SOCKET n TX FIFO regsiter.

It indirectly accesses internal TX memory of SOCKETn. The internal TX memory can't be accessed directly by the host, but can be accessed through Sn_TX_FIFOR. If MR(MT) = '0', only the Host-Write of internal TX memory is allowed through Sn_TX_FIFOR. But if MR(MT) is '1', both of Host-Read and Host-Write are allowed.

Definition at line 859 of file w5300.h.

#define Sn_RX_FIFOR (   n)    (_W5300_IO_BASE_ + WIZCHIP_SREG_BLOCK(n) + 0x30)

SOCKET n RX FIFO register.

It indirectly accesses to internal RX memory of SOCKETn. The internal RX memory can't be directly accessed by the host, but can be accessed through Sn_RX_FIFOR. If MR(MT) = '0', only the Host-Read of internal RX memory is allowed through Sn_RX_FIFOR. But if MR(MT) is '1', both of Host-Read and Host-Write are allowed.

Definition at line 869 of file w5300.h.

Generated on Wed May 4 2016 16:44:00 for Socket APIs by   doxygen 1.8.9.1