Toggle navigation
Documentation
The friendly Operating System for the Internet of Things
Loading...
Searching...
No Matches
w5500_regs.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2023 Stefan Schmidt
3
*
4
* This file is subject to the terms and conditions of the GNU Lesser
5
* General Public License v2.1. See the file LICENSE in the top level
6
* directory for more details.
7
*/
8
19
#ifndef W5500_REGS_H
20
#define W5500_REGS_H
21
22
#ifdef __cplusplus
23
extern
"C"
{
24
#endif
25
26
/* The W5500 is accessed by sending a 16 Bit address first, then a 8 bit control byte
27
which determines to which register (common or one of the 8 Sockets) this address shall be
28
applied and finally the data.
29
30
In order to simplify the functions to read and write to the W5500 via SPI the defined register
31
addresses contain the control byte in the upper 5 bits and the actual register address in the
32
lower 13 bits:
33
0b00000 -> common register (0x0xxx)
34
0b00001 -> Socket 0 register (0x08xx)
35
36
The RX and TX buffers are accessed via separate functions in order to be able to access the full
37
16 kB buffers.
38
*/
39
44
#define REG_MODE (0x0000)
45
#define REG_GAR0 (0x0001)
46
#define REG_GAR1 (0x0002)
47
#define REG_GAR2 (0x0003)
48
#define REG_GAR3 (0x0004)
49
#define REG_SUBR0 (0x0005)
50
#define REG_SUBR1 (0x0006)
51
#define REG_SUBR2 (0x0007)
52
#define REG_SUBR3 (0x0008)
53
#define REG_SHAR0 (0x0009)
54
#define REG_SHAR1 (0x000a)
55
#define REG_SHAR2 (0x000b)
56
#define REG_SHAR3 (0x000c)
57
#define REG_SHAR4 (0x000d)
58
#define REG_SHAR5 (0x000e)
59
#define REG_SIPR0 (0x000f)
60
#define REG_SIPR1 (0x0010)
61
#define REG_SIPR2 (0x0011)
62
#define REG_SIPR3 (0x0012)
63
#define REG_INTLEVEL0 (0x0013)
64
#define REG_INTLEVEL1 (0x0014)
65
#define REG_IR (0x0015)
66
#define REG_IMR (0x0016)
67
#define REG_SIR (0x0017)
68
#define REG_SIMR (0x0018)
69
#define REG_RTR0 (0x0019)
70
#define REG_RTR1 (0x001a)
71
#define REG_RCR (0x001b)
72
#define REG_PTIMER (0x001c)
73
#define REG_PMAGIC (0x001d)
74
#define REG_PHAR0 (0x001e)
75
#define REG_PHAR1 (0x001f)
76
#define REG_PHAR2 (0x0020)
77
#define REG_PHAR3 (0x0021)
78
#define REG_PHAR4 (0x0022)
79
#define REG_PHAR5 (0x0023)
80
#define REG_PSID0 (0x0024)
81
#define REG_PSID1 (0x0025)
82
#define REG_PMRU0 (0x0026)
83
#define REG_PMRU1 (0x0027)
84
#define REG_UIPR0 (0x0028)
85
#define REG_UIPR1 (0x0029)
86
#define REG_UIPR2 (0x002a)
87
#define REG_UIPR3 (0x002b)
88
#define REG_UPORT0 (0x002c)
89
#define REG_UPORT1 (0x002d)
90
#define REG_PHYCFGR (0x002e)
91
#define REG_VERSIONR (0x0039)
98
#define REG_S0_MR (0x0800)
99
#define REG_S0_CR (0x0801)
100
#define REG_S0_IR (0x0802)
101
#define REG_S0_SR (0x0803)
102
#define REG_S0_PORT0 (0x0804)
103
#define REG_S0_PORT1 (0x0805)
104
#define REG_S0_DHAR0 (0x0806)
105
#define REG_S0_DHAR1 (0x0807)
106
#define REG_S0_DHAR2 (0x0808)
107
#define REG_S0_DHAR3 (0x0809)
108
#define REG_S0_DHAR4 (0x080a)
109
#define REG_S0_DHAR5 (0x080b)
110
#define REG_S0_DIPR0 (0x080c)
111
#define REG_S0_DIPR1 (0x080d)
112
#define REG_S0_DIPR2 (0x080e)
113
#define REG_S0_DIPR3 (0x080f)
114
#define REG_S0_DPORT0 (0x0810)
115
#define REG_S0_DPORT1 (0x0811)
116
#define REG_S0_MSSR0 (0x0812)
117
#define REG_S0_MSSR1 (0x0813)
118
#define REG_S0_TOS (0x0815)
119
#define REG_S0_TTL (0x0816)
120
#define REG_S0_RXBUF_SIZE (0x081e)
121
#define REG_S0_TXBUF_SIZE (0x081f)
122
#define REG_S0_TX_FSR0 (0x0820)
123
#define REG_S0_TX_FSR1 (0x0821)
124
#define REG_S0_TX_RD0 (0x0822)
125
#define REG_S0_TX_RD1 (0x0823)
126
#define REG_S0_TX_WR0 (0x0824)
127
#define REG_S0_TX_WR1 (0x0825)
128
#define REG_S0_RX_RSR0 (0x0826)
129
#define REG_S0_RX_RSR1 (0x0827)
130
#define REG_S0_RX_RD0 (0x0828)
131
#define REG_S0_RX_RD1 (0x0829)
132
#define REG_S0_RX_WR0 (0x082a)
133
#define REG_S0_RX_WR1 (0x082b)
134
#define REG_S0_IMR (0x082c)
135
#define REG_S0_FRAG0 (0x082d)
136
#define REG_S0_FRAG1 (0x082e)
137
#define REG_S0_KPALVTR (0x082f)
140
#define Sn_RXBUF_SIZE_BASE (0x001E)
141
#define Sn_TXBUF_SIZE_BASE (0x001F)
147
/* Common definitions. */
148
#define MODE_RESET (0x80)
149
#define PHY_LINK_UP (0x01)
150
#define IMR_S0_INT (0x01)
151
#define SPI_CONF SPI_MODE_0
152
#define CHIP_VERSION (0x04)
154
#define ENABLE_MAC_FILTER (0x80)
155
#define ENABLE_BROADCAST_FILTER (0x40)
156
#define ENABLE_MULTICAST_FILTER (0x20)
157
#define MR_MACRAW (0x04)
159
#define CR_OPEN (0x01)
160
#define CR_SEND (0x20)
161
#define CR_RECV (0x40)
163
#define IR_RECV (0x04)
164
#define IR_SEND_OK (0x10)
166
#define CMD_READ (0x00)
167
#define CMD_WRITE (0x04)
168
#define SOCKET0_RX_BUFFER (0x18)
169
#define SOCKET0_TX_BUFFER (0x10)
172
#ifdef __cplusplus
173
}
174
#endif
175
176
#endif
/* W5500_REGS_H */
Generated on Sat Nov 23 2024 01:58:07 by
1.9.8