Added RAW sockets.

Fork of WIZnetInterface by WIZnet

Committer:
Dollyparton
Date:
Tue Dec 19 12:49:35 2017 +0000
Revision:
30:3b0481541a06
Parent:
14:2101ab5ee40f
First version.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Soohwan Kim 0:6f28332c466f 1 /* Copyright (C) 2012 mbed.org, MIT License
Soohwan Kim 0:6f28332c466f 2 *
Soohwan Kim 0:6f28332c466f 3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
Soohwan Kim 0:6f28332c466f 4 * and associated documentation files (the "Software"), to deal in the Software without restriction,
Soohwan Kim 0:6f28332c466f 5 * including without limitation the rights to use, copy, modify, merge, publish, distribute,
Soohwan Kim 0:6f28332c466f 6 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
Soohwan Kim 0:6f28332c466f 7 * furnished to do so, subject to the following conditions:
Soohwan Kim 0:6f28332c466f 8 *
Soohwan Kim 0:6f28332c466f 9 * The above copyright notice and this permission notice shall be included in all copies or
Soohwan Kim 0:6f28332c466f 10 * substantial portions of the Software.
Soohwan Kim 0:6f28332c466f 11 *
Soohwan Kim 0:6f28332c466f 12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
Soohwan Kim 0:6f28332c466f 13 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
Soohwan Kim 0:6f28332c466f 14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
Soohwan Kim 0:6f28332c466f 15 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
Soohwan Kim 0:6f28332c466f 16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Soohwan Kim 0:6f28332c466f 17 *
Soohwan Kim 0:6f28332c466f 18 */
Soohwan Kim 0:6f28332c466f 19 #pragma once
Soohwan Kim 0:6f28332c466f 20
Soohwan Kim 0:6f28332c466f 21 #include "mbed.h"
Soohwan Kim 0:6f28332c466f 22 #include "mbed_debug.h"
Soohwan Kim 0:6f28332c466f 23
Soohwan Kim 0:6f28332c466f 24 #define TEST_ASSERT(A) while(!(A)){debug("\n\n%s@%d %s ASSERT!\n\n",__PRETTY_FUNCTION__,__LINE__,#A);exit(1);};
Soohwan Kim 0:6f28332c466f 25
Soohwan Kim 0:6f28332c466f 26 #define DEFAULT_WAIT_RESP_TIMEOUT 500
Soohwan Kim 0:6f28332c466f 27
Soohwan Kim 0:6f28332c466f 28
Soohwan Kim 0:6f28332c466f 29 #define MAX_SOCK_NUM 8
Soohwan Kim 0:6f28332c466f 30
Soohwan Kim 0:6f28332c466f 31 // Peripheral base address
Soohwan Kim 0:6f28332c466f 32 #define W7500x_WZTOE_BASE (0x46000000)
Soohwan Kim 0:6f28332c466f 33 #define W7500x_TXMEM_BASE (W7500x_WZTOE_BASE + 0x00020000)
Soohwan Kim 0:6f28332c466f 34 #define W7500x_RXMEM_BASE (W7500x_WZTOE_BASE + 0x00030000)
Soohwan Kim 0:6f28332c466f 35 // Common register
Soohwan Kim 0:6f28332c466f 36 #define MR (0x2300)
Soohwan Kim 0:6f28332c466f 37 #define GAR (0x6008)
Soohwan Kim 0:6f28332c466f 38 #define SUBR (0x600C)
Soohwan Kim 0:6f28332c466f 39 #define SHAR (0x6000)
Soohwan Kim 0:6f28332c466f 40 #define SIPR (0x6010)
Soohwan Kim 8:4c02de1dbf3a 41
Soohwan Kim 0:6f28332c466f 42 // Added Common register @W7500
Soohwan Kim 0:6f28332c466f 43 #define TIC100US (0x2000)
Soohwan Kim 0:6f28332c466f 44
Soohwan Kim 0:6f28332c466f 45 // Socket register
Soohwan Kim 0:6f28332c466f 46 #define Sn_MR (0x0000)
Soohwan Kim 0:6f28332c466f 47 #define Sn_CR (0x0010)
Soohwan Kim 0:6f28332c466f 48 #define Sn_IR (0x0020) //--Sn_ISR
Soohwan Kim 0:6f28332c466f 49 #define Sn_SR (0x0030)
Soohwan Kim 0:6f28332c466f 50 #define Sn_PORT (0x0114)
Dollyparton 30:3b0481541a06 51 // Geminate Changes
Dollyparton 30:3b0481541a06 52 #define Sn_DHAR0 (0x0118)
Dollyparton 30:3b0481541a06 53 #define Sn_DHAR1 (0x011C)
Dollyparton 30:3b0481541a06 54 #define Sn_RCR (0x6044)
Dollyparton 30:3b0481541a06 55 #define Sn_RTR (0x6040)
Dollyparton 30:3b0481541a06 56 // end
Soohwan Kim 0:6f28332c466f 57 #define Sn_DIPR (0x0124)
Soohwan Kim 0:6f28332c466f 58 #define Sn_DPORT (0x0120)
Soohwan Kim 0:6f28332c466f 59 #define Sn_RXBUF_SIZE (0x0200)
Soohwan Kim 0:6f28332c466f 60 #define Sn_TXBUF_SIZE (0x0220)
Soohwan Kim 0:6f28332c466f 61 #define Sn_TX_FSR (0x0204)
Soohwan Kim 0:6f28332c466f 62 #define Sn_TX_WR (0x020C)
Soohwan Kim 0:6f28332c466f 63 #define Sn_RX_RSR (0x0224)
Soohwan Kim 0:6f28332c466f 64 #define Sn_RX_RD (0x0228)
Soohwan Kim 0:6f28332c466f 65 // added Socket register @W7500
Soohwan Kim 0:6f28332c466f 66 #define Sn_ICR (0x0028)
Soohwan Kim 0:6f28332c466f 67 enum PHYMode {
Soohwan Kim 0:6f28332c466f 68 AutoNegotiate = 0,
Soohwan Kim 0:6f28332c466f 69 HalfDuplex10 = 1,
Soohwan Kim 0:6f28332c466f 70 FullDuplex10 = 2,
Soohwan Kim 0:6f28332c466f 71 HalfDuplex100 = 3,
Soohwan Kim 0:6f28332c466f 72 FullDuplex100 = 4,
Soohwan Kim 0:6f28332c466f 73 };
Soohwan Kim 0:6f28332c466f 74
Soohwan Kim 0:6f28332c466f 75 //bool plink(int wait_time_ms= 3*1000);
Soohwan Kim 0:6f28332c466f 76
Soohwan Kim 0:6f28332c466f 77 class WIZnet_Chip {
Soohwan Kim 0:6f28332c466f 78 public:
Soohwan Kim 0:6f28332c466f 79 enum Protocol {
Soohwan Kim 0:6f28332c466f 80 CLOSED = 0,
Soohwan Kim 0:6f28332c466f 81 TCP = 1,
Soohwan Kim 0:6f28332c466f 82 UDP = 2,
Dollyparton 30:3b0481541a06 83 RAW = 4
Soohwan Kim 0:6f28332c466f 84 };
Soohwan Kim 0:6f28332c466f 85
Soohwan Kim 0:6f28332c466f 86 enum Command {
Soohwan Kim 0:6f28332c466f 87 OPEN = 0x01,
Soohwan Kim 0:6f28332c466f 88 LISTEN = 0x02,
Soohwan Kim 0:6f28332c466f 89 CONNECT = 0x04,
Soohwan Kim 0:6f28332c466f 90 DISCON = 0x08,
Soohwan Kim 0:6f28332c466f 91 CLOSE = 0x10,
Soohwan Kim 0:6f28332c466f 92 SEND = 0x20,
Soohwan Kim 0:6f28332c466f 93 SEND_MAC = 0x21,
Soohwan Kim 0:6f28332c466f 94 SEND_KEEP = 0x22,
Soohwan Kim 0:6f28332c466f 95 RECV = 0x40,
Soohwan Kim 0:6f28332c466f 96
Soohwan Kim 0:6f28332c466f 97 };
Soohwan Kim 0:6f28332c466f 98
Soohwan Kim 0:6f28332c466f 99 enum Interrupt {
Soohwan Kim 0:6f28332c466f 100 INT_CON = 0x01,
Soohwan Kim 0:6f28332c466f 101 INT_DISCON = 0x02,
Soohwan Kim 0:6f28332c466f 102 INT_RECV = 0x04,
Soohwan Kim 0:6f28332c466f 103 INT_TIMEOUT = 0x08,
Soohwan Kim 0:6f28332c466f 104 INT_SEND_OK = 0x10,
Soohwan Kim 0:6f28332c466f 105 };
Soohwan Kim 0:6f28332c466f 106 enum Status {
Soohwan Kim 0:6f28332c466f 107 SOCK_CLOSED = 0x00,
Soohwan Kim 0:6f28332c466f 108 SOCK_INIT = 0x13,
Soohwan Kim 0:6f28332c466f 109 SOCK_LISTEN = 0x14,
Soohwan Kim 0:6f28332c466f 110 SOCK_SYNSENT = 0x15,
Soohwan Kim 0:6f28332c466f 111 SOCK_ESTABLISHED = 0x17,
Soohwan Kim 0:6f28332c466f 112 SOCK_CLOSE_WAIT = 0x1c,
Soohwan Kim 0:6f28332c466f 113 SOCK_UDP = 0x22,
Soohwan Kim 0:6f28332c466f 114 };
Soohwan Kim 0:6f28332c466f 115 enum Mode {
Soohwan Kim 0:6f28332c466f 116 MR_RST = 0x80,
Soohwan Kim 0:6f28332c466f 117 MR_WOL = 0x20,
Soohwan Kim 0:6f28332c466f 118 MR_PB = 0x10,
Soohwan Kim 0:6f28332c466f 119 MR_FARP = 0x02,
Soohwan Kim 0:6f28332c466f 120 };
Soohwan Kim 0:6f28332c466f 121
Soohwan Kim 0:6f28332c466f 122 WIZnet_Chip();
Dollyparton 30:3b0481541a06 123
Dollyparton 30:3b0481541a06 124 // Geminate Changes.
Dollyparton 30:3b0481541a06 125 int get_DHAR0(int socket);
Dollyparton 30:3b0481541a06 126 int get_DHAR1(int socket);
Dollyparton 30:3b0481541a06 127 // End Changes.
Soohwan Kim 0:6f28332c466f 128
Soohwan Kim 0:6f28332c466f 129 /*
Soohwan Kim 8:4c02de1dbf3a 130 * Set MAC Address to W7500x_TOE
Soohwan Kim 8:4c02de1dbf3a 131 *
Soohwan Kim 8:4c02de1dbf3a 132 * @return true if connected, false otherwise
Soohwan Kim 8:4c02de1dbf3a 133 */
Soohwan Kim 8:4c02de1dbf3a 134 bool setmac();
Soohwan Kim 8:4c02de1dbf3a 135
Soohwan Kim 8:4c02de1dbf3a 136 /*
Soohwan Kim 0:6f28332c466f 137 * Connect the W7500 WZTOE to the ssid contained in the constructor.
Soohwan Kim 0:6f28332c466f 138 *
Soohwan Kim 0:6f28332c466f 139 * @return true if connected, false otherwise
Soohwan Kim 0:6f28332c466f 140 */
Soohwan Kim 0:6f28332c466f 141 bool setip();
Soohwan Kim 0:6f28332c466f 142
Soohwan Kim 0:6f28332c466f 143
Soohwan Kim 0:6f28332c466f 144 /*
Soohwan Kim 0:6f28332c466f 145 * Open a tcp connection with the specified host on the specified port
Soohwan Kim 0:6f28332c466f 146 *
Soohwan Kim 0:6f28332c466f 147 * @param host host (can be either an ip address or a name. If a name is provided, a dns request will be established)
Soohwan Kim 0:6f28332c466f 148 * @param port port
Soohwan Kim 0:6f28332c466f 149 * @ returns true if successful
Soohwan Kim 0:6f28332c466f 150 */
Soohwan Kim 0:6f28332c466f 151 bool connect(int socket, const char * host, int port, int timeout_ms = 10*1000);
Soohwan Kim 0:6f28332c466f 152
Soohwan Kim 0:6f28332c466f 153 /*
Soohwan Kim 0:6f28332c466f 154 * Set the protocol (UDP or TCP)
Soohwan Kim 0:6f28332c466f 155 *
Soohwan Kim 0:6f28332c466f 156 * @param p protocol
Soohwan Kim 0:6f28332c466f 157 * @ returns true if successful
Soohwan Kim 0:6f28332c466f 158 */
Soohwan Kim 0:6f28332c466f 159 bool setProtocol(int socket, Protocol p);
Soohwan Kim 0:6f28332c466f 160
Soohwan Kim 0:6f28332c466f 161 /*
Soohwan Kim 0:6f28332c466f 162 * Reset the W7500 WZTOE
Soohwan Kim 0:6f28332c466f 163 */
Soohwan Kim 0:6f28332c466f 164 void reset();
Soohwan Kim 0:6f28332c466f 165
Soohwan Kim 0:6f28332c466f 166 int wait_readable(int socket, int wait_time_ms, int req_size = 0);
Soohwan Kim 0:6f28332c466f 167
Soohwan Kim 0:6f28332c466f 168 int wait_writeable(int socket, int wait_time_ms, int req_size = 0);
Soohwan Kim 0:6f28332c466f 169
Soohwan Kim 0:6f28332c466f 170 /*
Soohwan Kim 0:6f28332c466f 171 * Check if an ethernet link is pressent or not.
Soohwan Kim 0:6f28332c466f 172 *
Soohwan Kim 0:6f28332c466f 173 * @returns true if successful
Soohwan Kim 0:6f28332c466f 174 */
Soohwan Kim 0:6f28332c466f 175 bool link(int wait_time_ms= 3*1000);
Soohwan Kim 0:6f28332c466f 176
Soohwan Kim 0:6f28332c466f 177 /*
Soohwan Kim 0:6f28332c466f 178 * Sets the speed and duplex parameters of an ethernet link.
Soohwan Kim 0:6f28332c466f 179 *
Soohwan Kim 0:6f28332c466f 180 * @returns true if successful
Soohwan Kim 0:6f28332c466f 181 */
Soohwan Kim 0:6f28332c466f 182 void set_link(PHYMode phymode);
Soohwan Kim 0:6f28332c466f 183
Soohwan Kim 0:6f28332c466f 184 /*
Soohwan Kim 0:6f28332c466f 185 * Check if a tcp link is active
Soohwan Kim 0:6f28332c466f 186 *
Soohwan Kim 0:6f28332c466f 187 * @returns true if successful
Soohwan Kim 0:6f28332c466f 188 */
Soohwan Kim 0:6f28332c466f 189 bool is_connected(int socket);
Soohwan Kim 0:6f28332c466f 190
Soohwan Kim 0:6f28332c466f 191 /*
Soohwan Kim 0:6f28332c466f 192 * Close a tcp connection
Soohwan Kim 0:6f28332c466f 193 *
Soohwan Kim 0:6f28332c466f 194 * @ returns true if successful
Soohwan Kim 0:6f28332c466f 195 */
Soohwan Kim 0:6f28332c466f 196 bool close(int socket);
Soohwan Kim 0:6f28332c466f 197
Soohwan Kim 0:6f28332c466f 198 /*
Soohwan Kim 0:6f28332c466f 199 * @param str string to be sent
Soohwan Kim 0:6f28332c466f 200 * @param len string length
Soohwan Kim 0:6f28332c466f 201 */
Soohwan Kim 0:6f28332c466f 202 int send(int socket, const char * str, int len);
Dollyparton 30:3b0481541a06 203 int sendRaw(int socket, const char * str, int len);
Soohwan Kim 0:6f28332c466f 204
Soohwan Kim 0:6f28332c466f 205 int recv(int socket, char* buf, int len);
Soohwan Kim 0:6f28332c466f 206
Soohwan Kim 0:6f28332c466f 207 /*
Soohwan Kim 0:6f28332c466f 208 * Return true if the module is using dhcp
Soohwan Kim 0:6f28332c466f 209 *
Soohwan Kim 0:6f28332c466f 210 * @returns true if the module is using dhcp
Soohwan Kim 0:6f28332c466f 211 */
Soohwan Kim 0:6f28332c466f 212 bool isDHCP() {
Soohwan Kim 0:6f28332c466f 213 return dhcp;
Soohwan Kim 0:6f28332c466f 214 }
Soohwan Kim 0:6f28332c466f 215
Soohwan Kim 0:6f28332c466f 216 bool gethostbyname(const char* host, uint32_t* ip);
Soohwan Kim 0:6f28332c466f 217
Soohwan Kim 0:6f28332c466f 218 static WIZnet_Chip * getInstance() {
Soohwan Kim 0:6f28332c466f 219 return inst;
Soohwan Kim 0:6f28332c466f 220 };
Soohwan Kim 0:6f28332c466f 221
Soohwan Kim 0:6f28332c466f 222 int new_socket();
Soohwan Kim 0:6f28332c466f 223 uint16_t new_port();
Soohwan Kim 0:6f28332c466f 224
Soohwan Kim 0:6f28332c466f 225 void scmd(int socket, Command cmd);
Soohwan Kim 0:6f28332c466f 226
Soohwan Kim 0:6f28332c466f 227 template<typename T>
Soohwan Kim 0:6f28332c466f 228 void sreg(int socket, uint16_t addr, T data) {
Soohwan Kim 0:6f28332c466f 229 reg_wr<T>(addr, (uint8_t)(0x01+(socket<<2)), data);
Soohwan Kim 0:6f28332c466f 230 }
Soohwan Kim 0:6f28332c466f 231
Soohwan Kim 0:6f28332c466f 232 template<typename T>
Soohwan Kim 0:6f28332c466f 233 T sreg(int socket, uint16_t addr) {
Soohwan Kim 0:6f28332c466f 234 return reg_rd<T>(addr, (uint8_t)(0x01+(socket<<2)));
Soohwan Kim 0:6f28332c466f 235 }
Soohwan Kim 0:6f28332c466f 236
Soohwan Kim 0:6f28332c466f 237 template<typename T>
Soohwan Kim 0:6f28332c466f 238 void reg_wr(uint16_t addr, T data) {
Soohwan Kim 0:6f28332c466f 239 return reg_wr(addr, 0x00, data);
Soohwan Kim 0:6f28332c466f 240 }
Soohwan Kim 0:6f28332c466f 241
Soohwan Kim 0:6f28332c466f 242 template<typename T>
Soohwan Kim 0:6f28332c466f 243 void reg_wr(uint16_t addr, uint8_t cb, T data) {
Soohwan Kim 0:6f28332c466f 244 uint8_t buf[sizeof(T)];
Soohwan Kim 0:6f28332c466f 245 *reinterpret_cast<T*>(buf) = data;
Soohwan Kim 0:6f28332c466f 246 /*
Soohwan Kim 0:6f28332c466f 247 for(int i = 0; i < sizeof(buf)/2; i++) { // Little Endian to Big Endian
Soohwan Kim 0:6f28332c466f 248 uint8_t t = buf[i];
Soohwan Kim 0:6f28332c466f 249 buf[i] = buf[sizeof(buf)-1-i];
Soohwan Kim 0:6f28332c466f 250 buf[sizeof(buf)-1-i] = t;
Soohwan Kim 0:6f28332c466f 251 }
Soohwan Kim 0:6f28332c466f 252 */
Soohwan Kim 0:6f28332c466f 253 for(int i = 0; i < sizeof(buf); i++) { // Little Endian to Big Endian
Soohwan Kim 0:6f28332c466f 254 *(volatile uint8_t *)(W7500x_WZTOE_BASE + (uint32_t)((cb<<16)+addr)+i) = buf[i];
Soohwan Kim 0:6f28332c466f 255 }
Soohwan Kim 0:6f28332c466f 256 }
Soohwan Kim 0:6f28332c466f 257
Soohwan Kim 0:6f28332c466f 258 template<typename T>
Soohwan Kim 0:6f28332c466f 259 T reg_rd(uint16_t addr) {
Soohwan Kim 0:6f28332c466f 260 return reg_rd<T>(addr, (uint8_t)(0x00));
Soohwan Kim 0:6f28332c466f 261 }
Soohwan Kim 0:6f28332c466f 262
Soohwan Kim 0:6f28332c466f 263 template<typename T>
Soohwan Kim 0:6f28332c466f 264 T reg_rd(uint16_t addr, uint8_t cb) {
embeddist 14:2101ab5ee40f 265 uint8_t buf[sizeof(T)] = {0,};
Soohwan Kim 0:6f28332c466f 266 for(int i = 0; i < sizeof(buf); i++) { // Little Endian to Big Endian
Soohwan Kim 0:6f28332c466f 267 buf[i] = *(volatile uint8_t *)(W7500x_WZTOE_BASE + (uint32_t)((cb<<16)+addr)+i);
Soohwan Kim 0:6f28332c466f 268 }
Soohwan Kim 0:6f28332c466f 269 /*
Soohwan Kim 0:6f28332c466f 270 for(int i = 0; i < sizeof(buf)/2; i++) { // Big Endian to Little Endian
Soohwan Kim 0:6f28332c466f 271 uint8_t t = buf[i];
Soohwan Kim 0:6f28332c466f 272 buf[i] = buf[sizeof(buf)-1-i];
Soohwan Kim 0:6f28332c466f 273 buf[sizeof(buf)-1-i] = t;
Soohwan Kim 0:6f28332c466f 274 }
Soohwan Kim 0:6f28332c466f 275 */
Soohwan Kim 0:6f28332c466f 276 return *reinterpret_cast<T*>(buf);
Soohwan Kim 0:6f28332c466f 277 }
Soohwan Kim 0:6f28332c466f 278
embeddist 14:2101ab5ee40f 279 void reg_rd_mac(uint16_t addr, uint8_t* data);
embeddist 14:2101ab5ee40f 280
embeddist 14:2101ab5ee40f 281 void reg_wr_ip(uint16_t addr, uint8_t cb, const char* ip);
Soohwan Kim 0:6f28332c466f 282
embeddist 14:2101ab5ee40f 283 void sreg_ip(int socket, uint16_t addr, const char* ip);
Soohwan Kim 0:6f28332c466f 284
embeddist 14:2101ab5ee40f 285 int ethernet_link(void);
embeddist 14:2101ab5ee40f 286
embeddist 14:2101ab5ee40f 287 void ethernet_set_link(int speed, int duplex);
embeddist 14:2101ab5ee40f 288
Soohwan Kim 0:6f28332c466f 289
Soohwan Kim 0:6f28332c466f 290 protected:
Soohwan Kim 0:6f28332c466f 291 uint8_t mac[6];
Soohwan Kim 0:6f28332c466f 292 uint32_t ip;
Soohwan Kim 0:6f28332c466f 293 uint32_t netmask;
Soohwan Kim 0:6f28332c466f 294 uint32_t gateway;
Soohwan Kim 0:6f28332c466f 295 uint32_t dnsaddr;
Soohwan Kim 0:6f28332c466f 296 bool dhcp;
Soohwan Kim 0:6f28332c466f 297
Soohwan Kim 0:6f28332c466f 298 static WIZnet_Chip* inst;
Soohwan Kim 0:6f28332c466f 299
Soohwan Kim 0:6f28332c466f 300 void reg_wr_mac(uint16_t addr, uint8_t* data) {
Soohwan Kim 0:6f28332c466f 301 *(volatile uint8_t *)(W7500x_WZTOE_BASE + (uint32_t)(addr+3)) = data[0] ;
Soohwan Kim 0:6f28332c466f 302 *(volatile uint8_t *)(W7500x_WZTOE_BASE + (uint32_t)(addr+2)) = data[1] ;
Soohwan Kim 0:6f28332c466f 303 *(volatile uint8_t *)(W7500x_WZTOE_BASE + (uint32_t)(addr+1)) = data[2] ;
Soohwan Kim 0:6f28332c466f 304 *(volatile uint8_t *)(W7500x_WZTOE_BASE + (uint32_t)(addr+0)) = data[3] ;
Soohwan Kim 0:6f28332c466f 305 *(volatile uint8_t *)(W7500x_WZTOE_BASE + (uint32_t)(addr+7)) = data[4] ;
Soohwan Kim 0:6f28332c466f 306 *(volatile uint8_t *)(W7500x_WZTOE_BASE + (uint32_t)(addr+6)) = data[5] ;
Soohwan Kim 0:6f28332c466f 307 }
Soohwan Kim 0:6f28332c466f 308 };
Soohwan Kim 0:6f28332c466f 309
Soohwan Kim 0:6f28332c466f 310 extern uint32_t str_to_ip(const char* str);
Soohwan Kim 0:6f28332c466f 311 extern void printfBytes(char* str, uint8_t* buf, int len);
Soohwan Kim 0:6f28332c466f 312 extern void printHex(uint8_t* buf, int len);
Soohwan Kim 0:6f28332c466f 313 extern void debug_hex(uint8_t* buf, int len);