w5100s.lst
247 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
3615
3616
3617
3618
3619
3620
3621
3622
3623
3624
3625
3626
3627
3628
3629
3630
3631
3632
3633
3634
3635
3636
3637
3638
3639
3640
3641
3642
3643
3644
3645
3646
3647
3648
3649
3650
3651
3652
3653
3654
3655
3656
3657
3658
3659
3660
3661
3662
3663
3664
3665
3666
3667
3668
3669
3670
3671
3672
3673
3674
3675
3676
3677
3678
3679
3680
3681
3682
3683
3684
3685
3686
3687
3688
3689
3690
3691
3692
3693
3694
3695
3696
3697
3698
3699
3700
3701
3702
3703
3704
3705
3706
3707
3708
3709
3710
3711
3712
3713
3714
3715
3716
3717
3718
3719
3720
3721
3722
3723
3724
3725
3726
3727
3728
3729
3730
3731
3732
3733
3734
3735
3736
3737
3738
3739
3740
3741
3742
3743
3744
3745
3746
3747
3748
3749
3750
3751
3752
3753
3754
3755
3756
3757
3758
3759
3760
3761
3762
3763
3764
3765
3766
3767
3768
3769
3770
3771
3772
3773
3774
3775
3776
3777
3778
3779
3780
3781
3782
3783
3784
3785
3786
3787
3788
3789
3790
3791
3792
3793
3794
3795
3796
3797
3798
3799
3800
3801
3802
3803
3804
3805
3806
3807
3808
3809
3810
3811
3812
3813
3814
3815
3816
3817
3818
3819
3820
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835
3836
3837
3838
3839
3840
3841
3842
3843
3844
3845
3846
3847
3848
3849
3850
3851
3852
3853
3854
3855
3856
3857
3858
3859
3860
3861
3862
3863
3864
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877
3878
3879
3880
3881
3882
3883
3884
3885
3886
3887
3888
3889
3890
3891
3892
3893
3894
3895
3896
3897
3898
3899
3900
3901
3902
3903
3904
3905
3906
3907
3908
3909
3910
3911
3912
3913
3914
3915
3916
3917
3918
3919
3920
3921
3922
3923
3924
3925
3926
3927
3928
3929
3930
3931
3932
3933
3934
3935
3936
3937
3938
3939
3940
3941
3942
3943
3944
3945
3946
3947
3948
3949
3950
3951
3952
3953
3954
3955
3956
3957
3958
3959
3960
3961
3962
3963
3964
3965
3966
3967
3968
3969
3970
3971
3972
3973
3974
3975
3976
3977
3978
3979
3980
3981
3982
3983
3984
3985
3986
3987
3988
3989
3990
3991
3992
3993
3994
3995
3996
3997
3998
3999
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
4010
4011
4012
4013
4014
4015
4016
4017
4018
4019
4020
4021
4022
4023
4024
4025
4026
4027
4028
4029
4030
4031
4032
4033
4034
4035
4036
4037
4038
4039
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
4050
4051
4052
4053
4054
4055
4056
4057
4058
4059
4060
4061
4062
4063
4064
4065
4066
4067
4068
4069
4070
4071
4072
4073
4074
4075
4076
4077
4078
4079
4080
4081
4082
4083
4084
4085
4086
4087
4088
4089
4090
4091
4092
4093
4094
4095
4096
4097
4098
4099
4100
4101
4102
4103
4104
4105
4106
4107
4108
4109
4110
4111
4112
4113
4114
4115
4116
4117
4118
4119
4120
4121
4122
4123
4124
4125
4126
4127
4128
4129
4130
4131
4132
4133
4134
4135
4136
4137
4138
4139
4140
4141
4142
4143
4144
4145
4146
4147
4148
4149
4150
4151
4152
4153
4154
4155
4156
4157
4158
4159
4160
4161
4162
4163
4164
4165
4166
4167
4168
4169
4170
4171
4172
4173
4174
4175
4176
4177
4178
4179
4180
4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
4239
4240
4241
4242
4243
4244
4245
4246
4247
4248
4249
4250
4251
4252
4253
4254
4255
4256
4257
4258
4259
4260
4261
4262
4263
4264
4265
4266
4267
4268
4269
4270
4271
4272
4273
4274
4275
4276
4277
4278
4279
4280
4281
4282
4283
4284
4285
4286
4287
4288
4289
4290
4291
4292
4293
4294
4295
4296
4297
4298
4299
4300
4301
4302
4303
4304
4305
4306
4307
4308
4309
4310
4311
4312
4313
4314
4315
4316
4317
4318
4319
4320
4321
4322
4323
4324
4325
4326
4327
4328
4329
4330
4331
4332
4333
4334
4335
4336
4337
4338
4339
4340
4341
4342
4343
4344
4345
4346
4347
4348
4349
4350
4351
4352
4353
4354
4355
4356
4357
4358
4359
4360
4361
4362
4363
4364
4365
4366
4367
4368
4369
4370
4371
4372
4373
4374
4375
4376
4377
4378
4379
4380
4381
4382
4383
4384
4385
4386
4387
4388
4389
4390
4391
4392
4393
4394
4395
4396
4397
4398
4399
4400
4401
4402
4403
4404
4405
4406
4407
4408
4409
4410
4411
4412
4413
4414
4415
4416
4417
4418
4419
4420
4421
4422
4423
4424
4425
4426
4427
4428
4429
4430
4431
4432
4433
4434
4435
4436
4437
4438
4439
4440
4441
4442
4443
4444
4445
4446
4447
4448
4449
4450
4451
4452
4453
4454
4455
4456
4457
4458
4459
4460
4461
4462
4463
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473
4474
4475
4476
4477
4478
4479
4480
4481
4482
4483
4484
4485
4486
4487
4488
4489
4490
4491
4492
4493
4494
4495
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
4518
4519
4520
4521
4522
4523
4524
4525
4526
4527
4528
4529
4530
4531
4532
4533
4534
4535
4536
4537
4538
4539
4540
4541
4542
4543
4544
4545
4546
4547
4548
4549
4550
4551
4552
4553
4554
4555
4556
4557
4558
4559
4560
4561
4562
4563
4564
4565
4566
4567
4568
4569
4570
4571
4572
4573
4574
4575
4576
4577
4578
4579
4580
4581
4582
4583
4584
4585
4586
4587
4588
4589
4590
4591
4592
4593
4594
4595
4596
4597
4598
4599
4600
4601
4602
4603
4604
4605
4606
4607
4608
4609
4610
4611
4612
4613
4614
4615
4616
4617
4618
4619
4620
4621
4622
4623
4624
4625
4626
4627
4628
4629
4630
4631
4632
4633
4634
4635
4636
4637
4638
4639
4640
4641
4642
4643
4644
4645
4646
4647
4648
4649
4650
4651
4652
4653
4654
4655
4656
4657
4658
4659
4660
4661
4662
4663
4664
4665
4666
4667
4668
4669
4670
4671
4672
4673
4674
4675
4676
4677
4678
4679
4680
4681
4682
4683
4684
4685
4686
4687
4688
4689
4690
4691
4692
4693
4694
4695
4696
4697
4698
4699
4700
4701
4702
4703
4704
4705
4706
4707
4708
4709
4710
4711
4712
4713
4714
4715
4716
4717
4718
4719
4720
4721
4722
4723
4724
4725
4726
4727
4728
4729
4730
4731
4732
4733
4734
4735
4736
4737
4738
4739
4740
4741
4742
4743
4744
4745
4746
4747
4748
4749
4750
4751
4752
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
4809
4810
4811
4812
4813
4814
4815
4816
4817
4818
4819
4820
4821
4822
4823
4824
4825
4826
4827
4828
4829
4830
4831
4832
4833
4834
4835
4836
4837
4838
4839
4840
4841
4842
4843
4844
4845
4846
4847
4848
4849
4850
4851
4852
4853
4854
4855
4856
4857
4858
4859
4860
4861
4862
4863
4864
4865
4866
4867
4868
4869
4870
4871
4872
4873
4874
4875
4876
4877
4878
4879
4880
4881
4882
4883
4884
4885
4886
4887
4888
4889
4890
4891
4892
4893
4894
4895
4896
4897
4898
4899
4900
4901
4902
4903
4904
4905
4906
4907
4908
4909
4910
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
4965
4966
4967
4968
4969
4970
4971
4972
4973
4974
4975
4976
4977
4978
4979
4980
4981
4982
4983
4984
4985
4986
4987
4988
4989
4990
4991
4992
4993
4994
4995
4996
4997
4998
4999
5000
5001
5002
5003
5004
5005
5006
5007
5008
5009
5010
5011
5012
5013
5014
5015
5016
5017
5018
5019
5020
5021
5022
5023
5024
5025
5026
5027
5028
5029
5030
5031
5032
5033
5034
5035
5036
5037
5038
5039
5040
5041
5042
5043
5044
5045
5046
5047
5048
5049
5050
5051
5052
5053
5054
5055
5056
5057
5058
5059
5060
5061
5062
5063
5064
5065
5066
5067
5068
5069
5070
5071
5072
5073
5074
5075
5076
5077
5078
5079
5080
5081
5082
5083
5084
5085
5086
5087
5088
5089
5090
5091
5092
5093
5094
5095
5096
5097
5098
5099
5100
5101
5102
5103
5104
5105
5106
5107
5108
5109
5110
5111
5112
5113
5114
5115
5116
5117
5118
5119
5120
5121
5122
5123
5124
5125
5126
5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
5139
5140
5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
5153
5154
5155
5156
5157
5158
5159
5160
5161
5162
5163
5164
5165
5166
5167
5168
5169
5170
5171
5172
5173
5174
5175
5176
5177
5178
5179
5180
5181
5182
5183
5184
5185
5186
5187
5188
5189
5190
5191
5192
5193
5194
5195
5196
5197
5198
5199
5200
5201
5202
5203
5204
5205
5206
5207
5208
5209
5210
5211
5212
5213
5214
5215
5216
5217
5218
5219
5220
5221
5222
5223
5224
5225
5226
5227
5228
5229
5230
5231
5232
5233
5234
5235
5236
5237
5238
5239
5240
5241
5242
5243
5244
5245
5246
5247
5248
5249
5250
5251
5252
5253
5254
5255
5256
5257
5258
5259
5260
5261
5262
5263
5264
5265
5266
5267
5268
5269
5270
5271
5272
5273
5274
5275
5276
5277
5278
5279
5280
5281
5282
5283
5284
5285
5286
5287
5288
5289
5290
5291
5292
5293
5294
5295
5296
5297
5298
5299
5300
5301
5302
5303
5304
5305
5306
5307
5308
5309
5310
5311
5312
5313
5314
5315
5316
5317
5318
5319
5320
5321
5322
5323
5324
5325
5326
5327
5328
5329
5330
5331
5332
5333
5334
5335
5336
5337
5338
5339
5340
5341
5342
5343
5344
5345
5346
5347
5348
5349
5350
5351
5352
5353
5354
5355
5356
5357
5358
5359
5360
5361
5362
5363
5364
5365
5366
5367
5368
5369
5370
5371
5372
5373
5374
5375
5376
5377
5378
5379
5380
5381
5382
5383
5384
5385
5386
5387
5388
5389
5390
5391
5392
5393
5394
5395
5396
5397
5398
5399
5400
5401
5402
5403
5404
5405
5406
5407
5408
5409
5410
5411
5412
5413
5414
5415
5416
5417
5418
5419
5420
5421
5422
5423
5424
5425
5426
5427
5428
5429
5430
5431
5432
5433
5434
5435
5436
5437
5438
5439
5440
5441
5442
5443
5444
5445
5446
5447
5448
5449
5450
5451
5452
5453
5454
5455
5456
5457
5458
5459
5460
5461
5462
5463
5464
5465
5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
5476
5477
5478
5479
5480
5481
5482
5483
5484
5485
5486
5487
5488
5489
5490
5491
5492
5493
5494
5495
5496
5497
5498
5499
5500
5501
5502
5503
5504
5505
5506
5507
5508
5509
5510
5511
5512
5513
5514
5515
5516
5517
5518
5519
5520
5521
5522
5523
5524
5525
5526
5527
5528
5529
5530
5531
5532
5533
5534
5535
5536
5537
5538
5539
5540
5541
5542
5543
5544
5545
5546
5547
5548
5549
5550
5551
5552
5553
5554
5555
5556
5557
5558
5559
5560
5561
5562
5563
5564
5565
5566
5567
5568
5569
5570
5571
5572
5573
5574
5575
5576
5577
5578
5579
5580
5581
5582
5583
5584
5585
5586
5587
5588
5589
5590
5591
5592
5593
5594
5595
5596
5597
5598
5599
5600
5601
5602
5603
5604
5605
5606
5607
5608
5609
5610
5611
5612
5613
5614
5615
5616
5617
5618
5619
5620
5621
5622
5623
5624
5625
5626
5627
5628
5629
5630
5631
5632
5633
5634
5635
5636
5637
5638
5639
5640
5641
5642
5643
5644
5645
5646
5647
5648
5649
5650
5651
5652
5653
5654
5655
5656
5657
5658
5659
5660
5661
5662
5663
5664
5665
5666
5667
5668
5669
5670
5671
5672
5673
5674
5675
5676
5677
5678
5679
5680
5681
5682
5683
5684
5685
5686
5687
5688
5689
5690
5691
5692
5693
5694
5695
5696
5697
5698
5699
5700
5701
5702
5703
5704
5705
5706
5707
5708
5709
5710
5711
5712
5713
5714
5715
5716
5717
5718
5719
5720
5721
5722
5723
5724
5725
5726
5727
5728
5729
5730
5731
5732
5733
5734
5735
5736
5737
5738
5739
5740
5741
5742
5743
5744
5745
5746
5747
5748
5749
5750
5751
5752
5753
5754
5755
5756
5757
5758
5759
5760
5761
5762
5763
5764
5765
5766
5767
5768
5769
5770
5771
5772
5773
5774
5775
5776
5777
5778
5779
5780
5781
5782
5783
5784
5785
5786
5787
5788
5789
5790
5791
5792
5793
5794
5795
5796
5797
5798
5799
5800
5801
5802
5803
5804
5805
5806
5807
5808
5809
5810
5811
5812
5813
5814
5815
5816
5817
5818
5819
5820
5821
5822
5823
5824
5825
5826
5827
5828
5829
5830
5831
5832
5833
5834
5835
5836
5837
5838
5839
5840
5841
5842
5843
5844
5845
5846
5847
5848
5849
5850
5851
5852
5853
5854
5855
5856
5857
5858
5859
5860
5861
5862
5863
5864
5865
5866
5867
5868
5869
5870
5871
5872
5873
5874
5875
5876
5877
5878
5879
5880
5881
5882
5883
5884
5885
5886
5887
5888
5889
5890
5891
5892
5893
5894
5895
5896
5897
5898
5899
5900
5901
5902
5903
5904
5905
5906
5907
5908
5909
5910
5911
5912
5913
5914
5915
5916
5917
5918
5919
5920
5921
5922
5923
5924
5925
5926
5927
5928
5929
5930
5931
5932
5933
5934
5935
5936
5937
5938
5939
5940
5941
5942
5943
5944
5945
5946
5947
5948
5949
5950
5951
5952
5953
5954
5955
5956
5957
5958
5959
5960
5961
5962
5963
5964
5965
5966
5967
5968
5969
5970
5971
5972
5973
5974
5975
5976
5977
5978
5979
5980
5981
5982
5983
5984
5985
5986
5987
5988
5989
5990
5991
5992
5993
5994
5995
5996
5997
5998
5999
6000
6001
6002
6003
6004
6005
6006
6007
6008
6009
6010
6011
6012
6013
6014
6015
6016
6017
6018
6019
6020
6021
6022
6023
6024
6025
6026
6027
6028
6029
6030
6031
6032
6033
6034
6035
6036
6037
6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
6148
6149
6150
6151
6152
6153
6154
6155
6156
6157
6158
6159
6160
6161
6162
6163
6164
6165
6166
6167
6168
6169
6170
6171
6172
6173
6174
6175
6176
6177
6178
6179
6180
6181
6182
6183
6184
6185
6186
6187
6188
6189
6190
6191
6192
6193
6194
6195
6196
6197
6198
6199
6200
6201
6202
6203
6204
6205
6206
6207
6208
6209
6210
6211
6212
6213
6214
6215
6216
6217
6218
6219
6220
6221
6222
6223
6224
6225
6226
6227
6228
6229
6230
6231
6232
6233
6234
6235
6236
6237
6238
6239
6240
6241
6242
6243
6244
6245
6246
6247
6248
6249
6250
6251
6252
6253
6254
6255
6256
6257
6258
6259
6260
6261
6262
6263
6264
6265
6266
6267
6268
6269
6270
6271
6272
6273
6274
6275
6276
6277
6278
6279
6280
6281
6282
6283
6284
6285
6286
6287
6288
6289
6290
6291
6292
6293
6294
6295
6296
6297
6298
6299
6300
6301
6302
6303
6304
6305
6306
6307
6308
6309
6310
6311
6312
6313
6314
6315
6316
6317
6318
6319
6320
6321
6322
6323
6324
6325
6326
6327
6328
6329
6330
6331
6332
6333
6334
6335
6336
6337
6338
6339
6340
6341
6342
6343
6344
6345
6346
6347
6348
6349
6350
6351
6352
6353
6354
6355
6356
6357
6358
6359
6360
6361
6362
6363
6364
6365
6366
6367
6368
6369
6370
6371
6372
6373
6374
6375
6376
6377
6378
6379
6380
6381
6382
6383
6384
6385
6386
6387
6388
6389
6390
6391
6392
6393
6394
6395
6396
6397
6398
6399
6400
6401
6402
6403
6404
6405
6406
6407
6408
6409
6410
6411
6412
6413
6414
6415
6416
6417
6418
6419
6420
6421
6422
6423
6424
6425
6426
6427
6428
6429
6430
6431
6432
6433
6434
6435
6436
6437
6438
6439
6440
6441
6442
6443
6444
6445
6446
6447
6448
6449
6450
6451
6452
6453
6454
6455
6456
6457
6458
6459
6460
6461
6462
6463
6464
6465
6466
6467
6468
6469
6470
6471
6472
6473
6474
6475
6476
6477
6478
6479
6480
6481
6482
6483
6484
6485
6486
6487
6488
6489
6490
6491
6492
6493
6494
6495
6496
6497
6498
6499
6500
6501
6502
6503
6504
6505
6506
6507
6508
6509
6510
6511
6512
6513
6514
6515
6516
6517
6518
6519
6520
6521
6522
6523
6524
6525
6526
6527
6528
6529
6530
6531
6532
6533
6534
6535
6536
6537
6538
6539
6540
6541
6542
6543
6544
6545
6546
6547
6548
6549
6550
6551
6552
6553
6554
6555
6556
6557
6558
6559
6560
6561
6562
6563
6564
6565
6566
6567
6568
6569
6570
6571
6572
6573
6574
6575
6576
6577
6578
6579
6580
6581
6582
6583
6584
6585
6586
6587
6588
6589
6590
6591
6592
6593
6594
6595
6596
6597
6598
6599
6600
6601
6602
6603
6604
6605
6606
6607
6608
6609
6610
6611
6612
6613
6614
6615
6616
6617
6618
6619
6620
6621
6622
6623
6624
6625
6626
6627
6628
6629
6630
6631
6632
6633
6634
6635
6636
6637
6638
6639
6640
6641
6642
6643
6644
6645
6646
6647
6648
6649
6650
6651
6652
6653
6654
6655
6656
6657
6658
6659
6660
6661
6662
6663
6664
6665
6666
6667
6668
6669
6670
6671
6672
6673
6674
6675
6676
6677
6678
6679
6680
6681
6682
6683
6684
6685
6686
6687
6688
6689
6690
6691
6692
6693
6694
6695
6696
6697
6698
6699
6700
6701
6702
6703
6704
6705
6706
6707
6708
6709
6710
6711
6712
6713
6714
6715
6716
6717
6718
6719
6720
6721
6722
6723
6724
6725
6726
6727
6728
6729
6730
6731
6732
6733
6734
6735
6736
6737
6738
6739
6740
6741
6742
6743
6744
6745
6746
6747
6748
6749
6750
6751
6752
6753
6754
6755
6756
6757
6758
6759
6760
6761
6762
6763
6764
6765
6766
6767
6768
6769
6770
6771
6772
6773
6774
6775
6776
6777
6778
6779
6780
6781
6782
6783
6784
6785
6786
6787
6788
6789
6790
6791
6792
6793
6794
6795
6796
6797
6798
6799
6800
6801
6802
6803
6804
6805
6806
6807
6808
6809
6810
6811
6812
6813
6814
6815
6816
6817
6818
6819
6820
6821
6822
6823
6824
6825
6826
6827
6828
6829
6830
6831
6832
6833
6834
6835
6836
6837
6838
6839
6840
6841
6842
6843
6844
6845
6846
6847
6848
6849
6850
6851
6852
6853
6854
6855
6856
6857
6858
6859
6860
6861
6862
6863
6864
6865
6866
6867
6868
6869
6870
6871
6872
6873
6874
6875
6876
6877
6878
6879
6880
6881
6882
6883
6884
6885
6886
6887
6888
6889
6890
6891
6892
6893
6894
6895
6896
6897
6898
6899
6900
6901
6902
6903
6904
6905
6906
6907
6908
L 1 "..\..\User\W5100S\w5100s.c"
N#include "w5100s.h"
L 1 "..\..\User\W5100S\w5100s.h" 1
N//* ****************************************************************************
N//! \file w5100.h
N//! \brief W5100 HAL Header File.
N//! \version 1.0.0
N//! \date 2013/10/21
N//! \par Revision history
N//! <2013/10/21> 1st Release
N//! \author MidnightCow
N//! \copyright
N//!
N//! Copyright (c) 2013, WIZnet Co., LTD.
N//! All rights reserved.
N//!
N//! Redistribution and use in source and binary forms, with or without
N//! modification, are permitted provided that the following conditions
N//! are met:
N//!
N//! * Redistributions of source code must retain the above copyright
N//! notice, this list of conditions and the following disclaimer.
N//! * Redistributions in binary form must reproduce the above copyright
N//! notice, this list of conditions and the following disclaimer in the
N//! documentation and/or other materials provided with the distribution.
N//! * Neither the name of the <ORGANIZATION> nor the names of its
N//! contributors may be used to endorse or promote products derived
N//! from this software without specific prior written permission.
N//!
N//! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
N//! AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
N//! IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
N//! ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
N//! LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
N//! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
N//! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
N//! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
N//! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
N//! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
N//! THE POSSIBILITY OF SUCH DAMAGE.
N//
N//*****************************************************************************
N
N#ifndef _W5100S_H_
N#define _W5100S_H_
N#include <stdint.h>
L 1 "C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h" 1
N/* Copyright (C) ARM Ltd., 1999,2014 */
N/* All rights reserved */
N
N/*
N * RCS $Revision$
N * Checkin $Date$
N * Revising $Author: agrant $
N */
N
N#ifndef __stdint_h
N#define __stdint_h
N#define __ARMCLIB_VERSION 5060037
N
N #ifdef __INT64_TYPE__
S /* armclang predefines '__INT64_TYPE__' and '__INT64_C_SUFFIX__' */
S #define __INT64 __INT64_TYPE__
N #else
N /* armcc has builtin '__int64' which can be used in --strict mode */
N #define __INT64 __int64
N #define __INT64_C_SUFFIX__ ll
N #endif
N #define __PASTE2(x, y) x ## y
N #define __PASTE(x, y) __PASTE2(x, y)
N #define __INT64_C(x) __ESCAPE__(__PASTE(x, __INT64_C_SUFFIX__))
N #define __UINT64_C(x) __ESCAPE__(__PASTE(x ## u, __INT64_C_SUFFIX__))
N #if defined(__clang__) || (defined(__ARMCC_VERSION) && !defined(__STRICT_ANSI__))
X #if 0L || (1L && !0L)
N /* armclang and non-strict armcc allow 'long long' in system headers */
N #define __LONGLONG long long
N #else
S /* strict armcc has '__int64' */
S #define __LONGLONG __int64
N #endif
N
N #ifndef __STDINT_DECLS
N #define __STDINT_DECLS
N
N #undef __CLIBNS
N
N #ifdef __cplusplus
S namespace std {
S #define __CLIBNS std::
S extern "C" {
N #else
N #define __CLIBNS
N #endif /* __cplusplus */
N
N
N/*
N * 'signed' is redundant below, except for 'signed char' and if
N * the typedef is used to declare a bitfield.
N */
N
N /* 7.18.1.1 */
N
N /* exact-width signed integer types */
Ntypedef signed char int8_t;
Ntypedef signed short int int16_t;
Ntypedef signed int int32_t;
Ntypedef signed __INT64 int64_t;
Xtypedef signed __int64 int64_t;
N
N /* exact-width unsigned integer types */
Ntypedef unsigned char uint8_t;
Ntypedef unsigned short int uint16_t;
Ntypedef unsigned int uint32_t;
Ntypedef unsigned __INT64 uint64_t;
Xtypedef unsigned __int64 uint64_t;
N
N /* 7.18.1.2 */
N
N /* smallest type of at least n bits */
N /* minimum-width signed integer types */
Ntypedef signed char int_least8_t;
Ntypedef signed short int int_least16_t;
Ntypedef signed int int_least32_t;
Ntypedef signed __INT64 int_least64_t;
Xtypedef signed __int64 int_least64_t;
N
N /* minimum-width unsigned integer types */
Ntypedef unsigned char uint_least8_t;
Ntypedef unsigned short int uint_least16_t;
Ntypedef unsigned int uint_least32_t;
Ntypedef unsigned __INT64 uint_least64_t;
Xtypedef unsigned __int64 uint_least64_t;
N
N /* 7.18.1.3 */
N
N /* fastest minimum-width signed integer types */
Ntypedef signed int int_fast8_t;
Ntypedef signed int int_fast16_t;
Ntypedef signed int int_fast32_t;
Ntypedef signed __INT64 int_fast64_t;
Xtypedef signed __int64 int_fast64_t;
N
N /* fastest minimum-width unsigned integer types */
Ntypedef unsigned int uint_fast8_t;
Ntypedef unsigned int uint_fast16_t;
Ntypedef unsigned int uint_fast32_t;
Ntypedef unsigned __INT64 uint_fast64_t;
Xtypedef unsigned __int64 uint_fast64_t;
N
N /* 7.18.1.4 integer types capable of holding object pointers */
N#if __sizeof_ptr == 8
X#if 4 == 8
Stypedef signed __INT64 intptr_t;
Stypedef unsigned __INT64 uintptr_t;
N#else
Ntypedef signed int intptr_t;
Ntypedef unsigned int uintptr_t;
N#endif
N
N /* 7.18.1.5 greatest-width integer types */
Ntypedef signed __LONGLONG intmax_t;
Xtypedef signed long long intmax_t;
Ntypedef unsigned __LONGLONG uintmax_t;
Xtypedef unsigned long long uintmax_t;
N
N
N#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)
X#if !0L || 0L
N
N /* 7.18.2.1 */
N
N /* minimum values of exact-width signed integer types */
N#define INT8_MIN -128
N#define INT16_MIN -32768
N#define INT32_MIN (~0x7fffffff) /* -2147483648 is unsigned */
N#define INT64_MIN __INT64_C(~0x7fffffffffffffff) /* -9223372036854775808 is unsigned */
N
N /* maximum values of exact-width signed integer types */
N#define INT8_MAX 127
N#define INT16_MAX 32767
N#define INT32_MAX 2147483647
N#define INT64_MAX __INT64_C(9223372036854775807)
N
N /* maximum values of exact-width unsigned integer types */
N#define UINT8_MAX 255
N#define UINT16_MAX 65535
N#define UINT32_MAX 4294967295u
N#define UINT64_MAX __UINT64_C(18446744073709551615)
N
N /* 7.18.2.2 */
N
N /* minimum values of minimum-width signed integer types */
N#define INT_LEAST8_MIN -128
N#define INT_LEAST16_MIN -32768
N#define INT_LEAST32_MIN (~0x7fffffff)
N#define INT_LEAST64_MIN __INT64_C(~0x7fffffffffffffff)
N
N /* maximum values of minimum-width signed integer types */
N#define INT_LEAST8_MAX 127
N#define INT_LEAST16_MAX 32767
N#define INT_LEAST32_MAX 2147483647
N#define INT_LEAST64_MAX __INT64_C(9223372036854775807)
N
N /* maximum values of minimum-width unsigned integer types */
N#define UINT_LEAST8_MAX 255
N#define UINT_LEAST16_MAX 65535
N#define UINT_LEAST32_MAX 4294967295u
N#define UINT_LEAST64_MAX __UINT64_C(18446744073709551615)
N
N /* 7.18.2.3 */
N
N /* minimum values of fastest minimum-width signed integer types */
N#define INT_FAST8_MIN (~0x7fffffff)
N#define INT_FAST16_MIN (~0x7fffffff)
N#define INT_FAST32_MIN (~0x7fffffff)
N#define INT_FAST64_MIN __INT64_C(~0x7fffffffffffffff)
N
N /* maximum values of fastest minimum-width signed integer types */
N#define INT_FAST8_MAX 2147483647
N#define INT_FAST16_MAX 2147483647
N#define INT_FAST32_MAX 2147483647
N#define INT_FAST64_MAX __INT64_C(9223372036854775807)
N
N /* maximum values of fastest minimum-width unsigned integer types */
N#define UINT_FAST8_MAX 4294967295u
N#define UINT_FAST16_MAX 4294967295u
N#define UINT_FAST32_MAX 4294967295u
N#define UINT_FAST64_MAX __UINT64_C(18446744073709551615)
N
N /* 7.18.2.4 */
N
N /* minimum value of pointer-holding signed integer type */
N#if __sizeof_ptr == 8
X#if 4 == 8
S#define INTPTR_MIN INT64_MIN
N#else
N#define INTPTR_MIN INT32_MIN
N#endif
N
N /* maximum value of pointer-holding signed integer type */
N#if __sizeof_ptr == 8
X#if 4 == 8
S#define INTPTR_MAX INT64_MAX
N#else
N#define INTPTR_MAX INT32_MAX
N#endif
N
N /* maximum value of pointer-holding unsigned integer type */
N#if __sizeof_ptr == 8
X#if 4 == 8
S#define UINTPTR_MAX UINT64_MAX
N#else
N#define UINTPTR_MAX UINT32_MAX
N#endif
N
N /* 7.18.2.5 */
N
N /* minimum value of greatest-width signed integer type */
N#define INTMAX_MIN __ESCAPE__(~0x7fffffffffffffffll)
N
N /* maximum value of greatest-width signed integer type */
N#define INTMAX_MAX __ESCAPE__(9223372036854775807ll)
N
N /* maximum value of greatest-width unsigned integer type */
N#define UINTMAX_MAX __ESCAPE__(18446744073709551615ull)
N
N /* 7.18.3 */
N
N /* limits of ptrdiff_t */
N#if __sizeof_ptr == 8
X#if 4 == 8
S#define PTRDIFF_MIN INT64_MIN
S#define PTRDIFF_MAX INT64_MAX
N#else
N#define PTRDIFF_MIN INT32_MIN
N#define PTRDIFF_MAX INT32_MAX
N#endif
N
N /* limits of sig_atomic_t */
N#define SIG_ATOMIC_MIN (~0x7fffffff)
N#define SIG_ATOMIC_MAX 2147483647
N
N /* limit of size_t */
N#if __sizeof_ptr == 8
X#if 4 == 8
S#define SIZE_MAX UINT64_MAX
N#else
N#define SIZE_MAX UINT32_MAX
N#endif
N
N /* limits of wchar_t */
N /* NB we have to undef and redef because they're defined in both
N * stdint.h and wchar.h */
N#undef WCHAR_MIN
N#undef WCHAR_MAX
N
N#if defined(__WCHAR32) || (defined(__ARM_SIZEOF_WCHAR_T) && __ARM_SIZEOF_WCHAR_T == 4)
X#if 0L || (0L && __ARM_SIZEOF_WCHAR_T == 4)
S #define WCHAR_MIN 0
S #define WCHAR_MAX 0xffffffffU
N#else
N #define WCHAR_MIN 0
N #define WCHAR_MAX 65535
N#endif
N
N /* limits of wint_t */
N#define WINT_MIN (~0x7fffffff)
N#define WINT_MAX 2147483647
N
N#endif /* __STDC_LIMIT_MACROS */
N
N#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS)
X#if !0L || 0L
N
N /* 7.18.4.1 macros for minimum-width integer constants */
N#define INT8_C(x) (x)
N#define INT16_C(x) (x)
N#define INT32_C(x) (x)
N#define INT64_C(x) __INT64_C(x)
N
N#define UINT8_C(x) (x ## u)
N#define UINT16_C(x) (x ## u)
N#define UINT32_C(x) (x ## u)
N#define UINT64_C(x) __UINT64_C(x)
N
N /* 7.18.4.2 macros for greatest-width integer constants */
N#define INTMAX_C(x) __ESCAPE__(x ## ll)
N#define UINTMAX_C(x) __ESCAPE__(x ## ull)
N
N#endif /* __STDC_CONSTANT_MACROS */
N
N #ifdef __cplusplus
S } /* extern "C" */
S } /* namespace std */
N #endif /* __cplusplus */
N #endif /* __STDINT_DECLS */
N
N #ifdef __cplusplus
S #ifndef __STDINT_NO_EXPORTS
S using ::std::int8_t;
S using ::std::int16_t;
S using ::std::int32_t;
S using ::std::int64_t;
S using ::std::uint8_t;
S using ::std::uint16_t;
S using ::std::uint32_t;
S using ::std::uint64_t;
S using ::std::int_least8_t;
S using ::std::int_least16_t;
S using ::std::int_least32_t;
S using ::std::int_least64_t;
S using ::std::uint_least8_t;
S using ::std::uint_least16_t;
S using ::std::uint_least32_t;
S using ::std::uint_least64_t;
S using ::std::int_fast8_t;
S using ::std::int_fast16_t;
S using ::std::int_fast32_t;
S using ::std::int_fast64_t;
S using ::std::uint_fast8_t;
S using ::std::uint_fast16_t;
S using ::std::uint_fast32_t;
S using ::std::uint_fast64_t;
S using ::std::intptr_t;
S using ::std::uintptr_t;
S using ::std::intmax_t;
S using ::std::uintmax_t;
S #endif
N #endif /* __cplusplus */
N
N#undef __INT64
N#undef __LONGLONG
N
N#endif /* __stdint_h */
N
N/* end of stdint.h */
L 44 "..\..\User\W5100S\w5100s.h" 2
N#include "wizchip_conf.h"
L 1 "..\..\User\W5100S\wizchip_conf.h" 1
N//*****************************************************************************
N//
N//! \file wizchip_conf.h
N//! \brief WIZCHIP Config Header File.
N//! \version 1.0.0
N//! \date 2013/10/21
N//! \par Revision history
N//! <2015/02/05> Notice
N//! The version history is not updated after this point.
N//! Download the latest version directly from GitHub. Please visit the our GitHub repository for ioLibrary.
N//! >> https://github.com/Wiznet/ioLibrary_Driver
N//! <2013/10/21> 1st Release
N//! \author MidnightCow
N//! \copyright
N//!
N//! Copyright (c) 2013, WIZnet Co., LTD.
N//! All rights reserved.
N//!
N//! Redistribution and use in source and binary forms, with or without
N//! modification, are permitted provided that the following conditions
N//! are met:
N//!
N//! * Redistributions of source code must retain the above copyright
N//! notice, this list of conditions and the following disclaimer.
N//! * Redistributions in binary form must reproduce the above copyright
N//! notice, this list of conditions and the following disclaimer in the
N//! documentation and/or other materials provided with the distribution.
N//! * Neither the name of the <ORGANIZATION> nor the names of its
N//! contributors may be used to endorse or promote products derived
N//! from this software without specific prior written permission.
N//!
N//! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
N//! AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
N//! IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
N//! ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
N//! LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
N//! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
N//! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
N//! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
N//! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
N//! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
N//! THE POSSIBILITY OF SUCH DAMAGE.
N//
N//*****************************************************************************
N
N/**
N * @defgroup extra_functions 2. WIZnet Extra Functions
N *
N * @brief These functions is optional function. It could be replaced at WIZCHIP I/O function because they were made by WIZCHIP I/O functions.
N * @details There are functions of configuring WIZCHIP, network, interrupt, phy, network information and timer. \n
N *
N */
N
N#ifndef _WIZCHIP_CONF_H_
N#define _WIZCHIP_CONF_H_
N
N#include <stdint.h>
N/**
N * @brief Select WIZCHIP.
N * @todo You should select one, \b W5100, \b W5100S, \b W5200, \b W5300, \b W5500 or etc. \n\n
N * ex> <code> #define \_WIZCHIP_ W5500 </code>
N */
N
N#define W5100S 5105
N
N#define _WIZCHIP_ W5100S // W5100, W5100S, W5200, W5300, W5500
N
N#define _WIZCHIP_IO_MODE_NONE_ 0x0000
N#define _WIZCHIP_IO_MODE_BUS_ 0x0100 /**< Bus interface mode */
N#define _WIZCHIP_IO_MODE_SPI_ 0x0200 /**< SPI interface mode */
N#define _WIZCHIP_IO_MODE_BUS_DIR_ (_WIZCHIP_IO_MODE_BUS_ + 1) /**< BUS interface mode for direct */
N#define _WIZCHIP_IO_MODE_BUS_INDIR_ (_WIZCHIP_IO_MODE_BUS_ + 2) /**< BUS interface mode for indirect */
N#define _WIZCHIP_IO_MODE_SPI_VDM_ (_WIZCHIP_IO_MODE_SPI_ + 1) /**< SPI interface mode for variable length data*/
N#define _WIZCHIP_IO_MODE_SPI_FDM_ (_WIZCHIP_IO_MODE_SPI_ + 2) /**< SPI interface mode for fixed length data mode*/
N#define _WIZCHIP_IO_MODE_SPI_5500_ (_WIZCHIP_IO_MODE_SPI_ + 3) /**< SPI interface mode for fixed length data mode*/
N
N
N#define _WIZCHIP_ID_ "W5100S\0"
N/**
N* @brief Define interface mode.
N* @todo you should select interface mode as chip. Select one of @ref \_WIZCHIP_IO_MODE_SPI_ , @ref \_WIZCHIP_IO_MODE_BUS_INDIR_144 or @ref \_WIZCHIP_IO_MODE_BUS_INDIR_
N*/
N// #define _WIZCHIP_IO_MODE_ _WIZCHIP_IO_MODE_BUS_INDIR_ // Ô³ÌÐòÊÇÑ¡ÔñBUS
N #define _WIZCHIP_IO_MODE_ _WIZCHIP_IO_MODE_SPI_ // 2020-2-1 ¸ÄΪSPI
N
N
Ntypedef uint8_t iodata_t;
N#include "w5100s.h"
L 1 "..\..\User\W5100S\w5100s.h" 1
N//* ****************************************************************************
N//! \file w5100.h
N//! \brief W5100 HAL Header File.
N//! \version 1.0.0
N//! \date 2013/10/21
N//! \par Revision history
N//! <2013/10/21> 1st Release
N//! \author MidnightCow
N//! \copyright
N//!
N//! Copyright (c) 2013, WIZnet Co., LTD.
N//! All rights reserved.
N//!
N//! Redistribution and use in source and binary forms, with or without
N//! modification, are permitted provided that the following conditions
N//! are met:
N//!
N//! * Redistributions of source code must retain the above copyright
N//! notice, this list of conditions and the following disclaimer.
N//! * Redistributions in binary form must reproduce the above copyright
N//! notice, this list of conditions and the following disclaimer in the
N//! documentation and/or other materials provided with the distribution.
N//! * Neither the name of the <ORGANIZATION> nor the names of its
N//! contributors may be used to endorse or promote products derived
N//! from this software without specific prior written permission.
N//!
N//! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
N//! AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
N//! IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
N//! ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
N//! LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
N//! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
N//! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
N//! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
N//! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
N//! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
N//! THE POSSIBILITY OF SUCH DAMAGE.
N//
N//*****************************************************************************
N
N#ifndef _W5100S_H_
S#define _W5100S_H_
S#include <stdint.h>
S#include "wizchip_conf.h"
S
S#define _WIZCHIP_SN_BASE_ (0x0400)
S#define _WIZCHIP_SN_SIZE_ (0x0100)
S#define _WIZCHIP_IO_TXBUF_ (0x4000) /* Internal Tx buffer address of the iinchip */
S#define _WIZCHIP_IO_RXBUF_ (0x6000) /* Internal Rx buffer address of the iinchip */
S
S
S#define WIZCHIP_CREG_BLOCK 0x00 ///< Common register block
S#define WIZCHIP_SREG_BLOCK(N) (_WIZCHIP_SN_BASE_+ _WIZCHIP_SN_SIZE_*N) ///< Socket N register block
S#define WIZCHIP_OFFSET_INC(ADDR, N) (ADDR + N) ///< Increase offset address
S
S#if (_WIZCHIP_IO_MODE_ == _WIZCHIP_IO_MODE_BUS_INDIR_)
S #define IDM_OR ((_WIZCHIP_IO_BASE + 0x0000))
S #define IDM_AR0 ((_WIZCHIP_IO_BASE_ + 0x0001))
S #define IDM_AR1 ((_WIZCHIP_IO_BASE_ + 0x0002))
S #define IDM_DR ((_WIZCHIP_IO_BASE_ + 0x0003))
S #define _W5100S_IO_BASE_ 0x0000
S#elif (_WIZCHIP_IO_MODE_ & _WIZCHIP_IO_MODE_SPI_)
S #define _W5100S_IO_BASE_ 0x0000
S#endif
S
S///////////////////////////////////////
S// Definition For Legacy Chip Driver //
S///////////////////////////////////////
S#define IINCHIP_READ(ADDR) WIZCHIP_READ(ADDR) ///< The defined for legacy chip driver
S#define IINCHIP_WRITE(ADDR,VAL) WIZCHIP_WRITE(ADDR,VAL) ///< The defined for legacy chip driver
S#define IINCHIP_READ_BUF(ADDR,BUF,LEN) WIZCHIP_READ_BUF(ADDR,BUF,LEN) ///< The defined for legacy chip driver
S#define IINCHIP_WRITE_BUF(ADDR,BUF,LEN) WIZCHIP_WRITE(ADDR,BUF,LEN) ///< The defined for legacy chip driver
S
S
S//----------- defgroup --------------------------------
S
S/**
S * @defgroup W5100 W5100
S * @brief WHIZCHIP register defines and I/O functions of @b W5100.
S *
S * - @ref WIZCHIP_register_W5100 : @ref Common_register_group_W5100S and @ref Socket_register_group_W5100S
S * - @ref WIZCHIP_IO_Functions_W5100 : @ref Basic_IO_function_W5100S, @ref Common_register_access_function_W5100S and @ref Socket_register_group_W5100S
S */
S
S /**
S * @defgroup WIZCHIP_register_W5100 WIZCHIP register
S * @ingroup W5100
S * @brief WIZCHIP register defines register group of <b> W5100 </b>.
S *
S * - \ref Common_register_group_W5100S : Common register group W5100
S * - \ref Socket_register_group_W5100S : \c SOCKET n register group W5100
S */
S
S
S/**
S * @defgroup WIZCHIP_IO_Functions_W5100 WIZCHIP I/O functions
S * @ingroup W5100
S * @brief This supports the basic I/O functions for \ref WIZCHIP_register_W5100.
S *
S * - <b> Basic I/O function </b> \n
S * WIZCHIP_READ(), WIZCHIP_WRITE(), WIZCHIP_READ_BUF(), WIZCHIP_WRITE_BUF() \n\n
S *
S * - \ref Common_register_group_W5100S <b>access functions</b> \n
S * -# @b Mode \n
S * getMR(), setMR()
S * -# @b Interrupt \n
S * getIR(), setIR(), getIMR(), setIMR(),
S * -# <b> Network Information </b> \n
S * getSHAR(), setSHAR(), getGAR(), setGAR(), getSUBR(), setSUBR(), getSIPR(), setSIPR()
S * -# @b Retransmission \n
S * getRCR(), setRCR(), getRTR(), setRTR()
S * -# @b PPPoE \n
S * getPTIMER(), setPTIMER(), getPMAGIC(), getPMAGIC()
S *
S * - \ref Socket_register_group_W5100S <b>access functions</b> \n
S * -# <b> SOCKET control</b> \n
S * getSn_MR(), setSn_MR(), getSn_CR(), setSn_CR(), getSn_IR(), setSn_IR()
S * -# <b> SOCKET information</b> \n
S * getSn_SR(), getSn_DHAR(), setSn_DHAR(), getSn_PORT(), setSn_PORT(), getSn_DIPR(), setSn_DIPR(), getSn_DPORT(), setSn_DPORT()
S * getSn_MSSR(), setSn_MSSR()
S * -# <b> SOCKET communication </b> \n
S * getSn_RXMEM_SIZE(), setSn_RXMEM_SIZE(), getSn_TXMEM_SIZE(), setSn_TXMEM_SIZE() \n
S * getSn_TX_RD(), getSn_TX_WR(), setSn_TX_WR() \n
S * getSn_RX_RD(), setSn_RX_RD(), getSn_RX_WR() \n
S * getSn_TX_FSR(), getSn_RX_RSR()
S * -# <b> IP header field </b> \n
S * getSn_FRAG(), setSn_FRAG(), getSn_TOS(), setSn_TOS() \n
S * getSn_TTL(), setSn_TTL()
S */
S
S/**
S * @defgroup Common_register_group_W5100S Common register
S * @ingroup WIZCHIP_register_W5100
S * @brief Common register group\n
S * It set the basic for the networking\n
S * It set the configuration such as interrupt, network information, ICMP, etc.
S * @details
S * @sa MR : Mode register.
S * @sa GAR, SUBR, SHAR, SIPR
S * @sa IR, Sn_IR, _IMR_ : Interrupt.
S * @sa _RTR_, _RCR_ : Data retransmission.
S * @sa PTIMER, PMAGIC : PPPoE.
S */
S
S
S /**
S * @defgroup Socket_register_group_W5100S Socket register
S * @ingroup WIZCHIP_register_W5100
S * @brief Socket register group\n
S * Socket register configures and control SOCKETn which is necessary to data communication.
S * @details
S * @sa Sn_MR, Sn_CR, Sn_IR : SOCKETn Control
S * @sa Sn_SR, Sn_PORT, Sn_DHAR, Sn_DIPR, Sn_DPORT : SOCKETn Information
S * @sa Sn_MSSR, Sn_TOS, Sn_TTL, Sn_FRAGR : Internet protocol.
S * @sa Sn_RXMEM_SIZE, Sn_TXMEM_SIZE, Sn_TX_FSR, Sn_TX_RD, Sn_TX_WR, Sn_RX_RSR, Sn_RX_RD, Sn_RX_WR : Data communication
S */
S
S /**
S * @defgroup Basic_IO_function_W5100S Basic I/O function
S * @ingroup WIZCHIP_IO_Functions_W5100
S * @brief These are basic input/output functions to read values from register or write values to register.
S */
S
S/**
S * @defgroup Common_register_access_function_W5100S Common register access functions
S * @ingroup WIZCHIP_IO_Functions_W5100
S * @brief These are functions to access <b>common registers</b>.
S */
S
S/**
S * @defgroup Socket_register_access_function_W5100S Socket register access functions
S * @ingroup WIZCHIP_IO_Functions_W5100
S * @brief These are functions to access <b>socket registers</b>.
S */
S
S //-----------------------------------------------------------------------------------
S
S//----------------------------- W5100 Common Registers IOMAP -----------------------------
S/**
S * @ingroup Common_register_group_W5100S
S * @brief Mode Register address(R/W)\n
S * \ref MR is used for S/W reset, ping block mode, PPPoE mode and etc.
S * @details Each bit of \ref MR defined as follows.
S * <table>
S * <tr> <td>7</td> <td>6</td> <td>5</td> <td>4</td> <td>3</td> <td>2</td> <td>1</td> <td>0</td> </tr>
S * <tr> <td>RST</td> <td>Reserved</td> <td>WOL</td> <td>PB</td> <td>PPPoE</td> <td>Reserved</td> <td>AI</td> <td>IND</td> </tr>
S * </table>
S * - \ref MR_RST : Reset
S * - \ref MR_PB : Ping block
S * - \ref MR_PPPOE : PPPoE mode
S * - \ref MR_AI : Address Auto-Increment in Indirect Bus Interface
S * - \ref MR_IND : Indirect Bus Interface mode
S */
S#if _WIZCHIP_IO_MODE_ == _WIZCHIP_IO_MODE_BUS_INDIR_
S #define MR (_WIZCHIP_IO_BASE_ + (0x0000)) // Mode
S#else
S #define MR (_W5100S_IO_BASE_ + (0x0000)) // Mode
S#endif
S
S/**
S * @ingroup Common_register_group_W5100S
S * @brief Gateway IP Register address(R/W)
S * @details \ref GAR configures the default gateway address.
S */
S#define GAR (_W5100S_IO_BASE_ + (0x0001)) // GW Address
S
S/**
S * @ingroup Common_register_group_W5100S
S * @brief Subnet mask Register address(R/W)
S * @details \ref SUBR configures the subnet mask address.
S */
S#define SUBR (_W5100S_IO_BASE_ + (0x0005)) // SN Mask Address
S
S/**
S * @ingroup Common_register_group_W5100S
S * @brief Source MAC Register address(R/W)
S * @details \ref SHAR configures the source hardware address.
S */
S#define SHAR (_W5100S_IO_BASE_ + (0x0009)) // Source Hardware Address
S
S/**
S * @ingroup Common_register_group_W5100S
S * @brief Source IP Register address(R/W)
S * @details \ref SIPR configures the source IP address.
S */
S#define SIPR (_W5100S_IO_BASE_ + (0x000F)) // Source IP Address
S
S// Reserved (_W5100S_IO_BASE_ + (0x0013))
S// Reserved (_W5100S_IO_BASE_ + (0x0014))
S
S/**
S * @ingroup Common_register_group_W5100S
S * @brief Interrupt Register(R/W)
S * @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.
S * If \ref IR is not equal to x00 INTn PIN is asserted to low until it is x00\n\n
S * Each bit of \ref IR defined as follows.
S * <table>
S * <tr> <td>7</td> <td>6</td> <td>5</td> <td>4</td> <td>3</td> <td>2</td> <td>1</td> <td>0</td> </tr>
S * <tr> <td>CONFLICT</td> <td>UNREACH</td> <td>PPPoE</td> <td>Reserved</td> <td>S3_INT</td> <td>S2_INT</td> <td>S1_INT</td> <td>S0_INT</td> </tr>
S * </table>
S * - \ref IR_CONFLICT : IP conflict
S * - \ref IR_UNREACH : Destination unreachable
S * - \ref IR_PPPoE : PPPoE connection close
S * - \ref IR_SOCK(3) : SOCKET 3 Interrupt
S * - \ref IR_SOCK(2) : SOCKET 2 Interrupt
S * - \ref IR_SOCK(1) : SOCKET 1 Interrupt
S * - \ref IR_SOCK(0) : SOCKET 0 Interrupt
S */
S#define IR (_W5100S_IO_BASE_ + (0x0015)) // Interrupt
S
S/**
S * @ingroup Common_register_group_W5100S
S * @brief Socket Interrupt Mask Register(R/W)
S * @details Each bit of \ref _IMR_ corresponds to each bit of \ref IR.
S * When a bit of \ref _IMR_ is and the corresponding bit of \ref IR is set, Interrupt will be issued.
S */
S#define _IMR_ (_W5100S_IO_BASE_ + (0x0016)) // Socket Interrupt Mask
S
S/**
S * @ingroup Common_register_group_W5100S
S * @brief Timeout register address( 1 is 100us )(R/W)
S * @details \ref _RTR_ configures the retransmission timeout period. The unit of timeout period is 100us and the default of \ref _RTR_ is x07D0or 000
S * And so the default timeout period is 200ms(100us X 2000). During the time configured by \ref _RTR_, W5100 waits for the peer response
S * to the packet that is transmitted by \ref Sn_CR (CONNECT, DISCON, CLOSE, SEND, SEND_MAC, SEND_KEEP command).
S * If the peer does not respond within the \ref _RTR_ time, W5100 retransmits the packet or issues timeout.
S */
S#define _RTR_ (_W5100S_IO_BASE_ + (0x0017)) // Retry Time
S
S/**
S * @ingroup Common_register_group_W5100S
S * @brief Retry count register(R/W)
S * @details \ref _RCR_ configures the number of time of retransmission.
S * When retransmission occurs as many as ref _RCR_+1 Timeout interrupt is issued (\ref Sn_IR_TIMEOUT = '1').
S */
S#define _RCR_ (_W5100S_IO_BASE_ + (0x0019)) // Retry Count
S#define RMSR (_W5100S_IO_BASE_ + (0x001A)) // Receicve Memory Size
S#define TMSR (_W5100S_IO_BASE_ + (0x001B)) // Trnasmit Memory Size
S
S
S/**
S * @ingroup Common_register_group_W5100S
S * @brief PPP LCP Request Timer register in PPPoE mode(R)
S * @details \ref PATR notifies authentication method that has been agreed at the connection with
S * PPPoE Server. W5100 supports two types of Authentication method - PAP and CHAP.
S */
S#define PATR (_W5100S_IO_BASE_ + (0x001C))
S
S/*
S * @ingroup Common_register_group_W5100S
S * @brief IR2
S * @details \reg
S */
S#define IR2 (_W5100S_IO_BASE_ + (0x0020))
S
S/*
S * @ingroup Common_register_group_W5100S
S * @brief IMR2
S * @details \reg
S */
S#define IMR2 (_W5100S_IO_BASE_ + (0x0021))
S
S
S/**
S * @ingroup Common_register_group_W5100S
S * @brief PPP LCP Request Timer register in PPPoE mode(R)
S * @details \ref PTIMER configures the time for sending LCP echo request. The unit of time is 25ms.
S */
S#define PTIMER (_W5100S_IO_BASE_ + (0x0028)) // PPP LCP RequestTimer
S
S/**
S * @ingroup Common_register_group_W5100S
S * @brief PPP LCP Magic number register in PPPoE mode(R)
S * @details \ref PMAGIC configures the 4bytes magic number to be used in LCP negotiation.
S */
S#define PMAGIC (_W5100S_IO_BASE_ + (0x0029)) // PPP LCP Magic number
S
S#define UIPR (_W5100S_IO_BASE_ + (0x002A))
S
S#define UPORTR (_W5100S_IO_BASE_ + (0x002E))
S
S/* register for W5100S only */
S
S/*------------------------------------------ Common registers ------------------------------------------*/
S
S/*
S * @ingroup Common_register_group_W5100S
S * @brief MR2
S * @details \reg
S */
S#define MR2 (_W5100S_IO_BASE_ + (0x0030))
S
S
S/*
S * @ingroup Common_register_group_W5100S
S * @brief MR2
S * @details \reg
S */
S#define PHAR (_W5100S_IO_BASE_ + (0x0032))
S
S/*
S * @ingroup Common_register_group_W5100S
S * @brief MR2
S * @details \reg
S */
S#define PSIDR (_W5100S_IO_BASE_ + (0x0038))
S
S/*
S * @ingroup Common_register_group_W5100S
S * @brief PMRUR
S * @details \reg
S */
S#define PMRUR (_W5100S_IO_BASE_ + (0x003A))
S
S
S/*------------------------------------------ PHY registers ------------------------------------------*/
S
S/*
S * @ingroup Common_register_group_W5100S
S * @brief PHYSR0
S * @details \reg
S */
S#define PHYSR (_W5100S_IO_BASE_ + (0x003C))
S
S/*
S * @ingroup Common_register_group_W5100S
S * @brief PHYSR1
S * @details \reg
S */
S#define PHYSR1 (_W5100S_IO_BASE_ + (0x003D))
S
S/*
S * @ingroup Common_register_group_W5100S
S * @brief PHYAR
S * @details \reg
S */
S#define PHYAR (_W5100S_IO_BASE_ + (0x003E))
S
S/*
S * @ingroup Common_register_group_W5100S
S * @brief PHYRR
S * @details \reg
S */
S#define PHYRR (_W5100S_IO_BASE_ + (0x003F))
S
S/*
S * @ingroup Common_register_group_W5100S
S * @brief PHYDIR
S * @details \reg
S */
S#define PHYDIR (_W5100S_IO_BASE_ + (0x0040))
S
S/*
S * @ingroup Common_register_group_W5100S
S * @brief PHYDOR
S * @details \reg
S */
S#define PHYDOR (_W5100S_IO_BASE_ + (0x0042))
S
S/*
S * @ingroup Common_register_group_W5100S
S * @brief PHYACR
S * @details \reg
S */
S#define PHYACR (_W5100S_IO_BASE_ + (0x0044))
S
S/*
S * @ingroup Common_register_group_W5100S
S * @brief PHYDIVR
S * @details \reg
S */
S#define PHYDIVR (_W5100S_IO_BASE_ + (0x0045))
S
S/*
S * @ingroup Common_register_group_W5100S
S * @brief PHYCR0
S * @details \reg
S */
S#define PHYCR0 (_W5100S_IO_BASE_ + (0x0046))
S/*
S * @ingroup Common_register_group_W5100S
S * @brief PHYCR1
S * @details \reg
S */
S#define PHYCR1 (_W5100S_IO_BASE_ + (0x0047))
S
S/*------------------------------------------ RMC registers ------------------------------------------*/
S
S/*
S * @ingroup Common_register_group_W5100S
S * @brief SLCR
S * @details \reg
S */
S#define SLCR (_W5100S_IO_BASE_ + (0x004C))
S
S/*
S * @ingroup Common_register_group_W5100S
S * @brief SLRTR
S * @details \reg
S */
S#define SLRTR (_W5100S_IO_BASE_ + (0x004D))
S
S
S/*
S * @ingroup Common_register_group_W5100S
S * @brief SLRCR
S * @details \reg
S */
S#define SLRCR (_W5100S_IO_BASE_ + (0x004F))
S
S/*
S * @ingroup Common_register_group_W5100S
S * @brief Request command peer IP address register
S * @details \reg
S */
S#define SLPIPR (_W5100S_IO_BASE_ + (0x0050))
S
S/*
S * @ingroup Common_register_group_W5100S
S * @brief Request command peer hardware address register
S * @details \reg
S */
S#define SLPHAR (_W5100S_IO_BASE_ + (0x0054))
S
S/*
S * @ingroup Common_register_group_W5100S
S * @brief Request command ping sequence number register
S * @details \reg
S */
S#define PINGSEQR (_W5100S_IO_BASE_ + (0x005A))
S
S/*
S * @ingroup Common_register_group_W5100S
S * @brief Request command ping ID register
S * @details \reg
S */
S#define PINGIDR (_W5100S_IO_BASE_ + (0x005C))
S
S/*
S * @ingroup Common_register_group_W5100S
S * @brief Request command interrupt mask register
S * @details \reg
S */
S#define SLIMR (_W5100S_IO_BASE_ + (0x005E))
S
S/*
S * @ingroup Common_register_group_W5100S
S * @brief Request command interrupt register
S * @details \reg
S */
S#define SLIR (_W5100S_IO_BASE_ + (0x005F))
S
S/*
S * @ingroup Common_register_group_W5100S
S * @brief DBGOUT
S * @details \reg
S */
S#define DBGOUT (_W5100S_IO_BASE_ + (0x0060))
S
S/*
S * @ingroup Common_register_group_W5100S
S * @brief NICMAXCOLR
S * @details \reg
S */
S#define NICMAXCOLR (_W5100S_IO_BASE_ + (0x0063))
S/*------------------------------------------ CFG registers ------------------------------------------*/
S
S/*
S * @ingroup Common_register_group_W5100S
S * @brief Chip Configuration locking register
S * @details \reg
S */
S#define CHIPLCKR (_W5100S_IO_BASE_ + (0x0070))
S
S/*
S * @ingroup Common_register_group_W5100S
S * @brief Network Configuration locking register
S * @details \reg
S */
S#define NETLCKR (_W5100S_IO_BASE_ + (0x0071))
S
S/*
S * @ingroup Common_register_group_W5100S
S * @brief PHY Configuration locking register
S * @details \reg
S */
S#define PHYLCKR (_W5100S_IO_BASE_ + (0x0072))
S
S/*
S * @ingroup Common_register_group_W5100S
S * @brief version register
S * @details \reg
S */
S#define VERR (_W5100S_IO_BASE_ + (0x0080))
S
S/*
S * @ingroup Common_register_group_W5100S
S * @brief Core 100us Counter register
S * @details \reg
S */
S#define TCNTR (_W5100S_IO_BASE_ + (0x0082))
S
S/*
S * @ingroup Common_register_group_W5100S
S * @brief Core 100us Counter clear register
S * @details \reg
S */
S#define TCNTCLKR (_W5100S_IO_BASE_ + (0x0088))
S
S//----------------------------- W5100 Socket Registers -----------------------------
S
S//--------------------------- For Backward Compatibility ---------------------------
S
S/**
S * @ingroup Socket_register_group_W5100S
S * @brief socket Mode register(R/W)
S * @details \ref Sn_MR configures the option or protocol type of Socket n.\n\n
S * Each bit of \ref Sn_MR defined as the following.
S * <table>
S * <tr> <td>7</td> <td>6</td> <td>5</td> <td>4</td> <td>3</td> <td>2</td> <td>1</td> <td>0</td> </tr>
S * <tr> <td>MULTI</td> <td>MF</td> <td>ND/MC</td> <td>Reserved</td> <td>Protocol[3]</td> <td>Protocol[2]</td> <td>Protocol[1]</td> <td>Protocol[0]</td> </tr>
S * </table>
S * - \ref Sn_MR_MULTI : Support UDP Multicasting
S * - \ref Sn_MR_MF : Support MACRAW
S * - \ref Sn_MR_ND : No Delayed Ack(TCP) flag
S * - \ref Sn_MR_MC : IGMP version used <b>in UDP mulitcasting</b>
S * - <b>Protocol</b>
S * <table>
S * <tr> <td><b>Protocol[3]</b></td> <td><b>Protocol[2]</b></td> <td><b>Protocol[1]</b></td> <td><b>Protocol[0]</b></td> <td>@b Meaning</td> </tr>
S * <tr> <td>0</td> <td>0</td> <td>0</td> <td>0</td> <td>Closed</td> </tr>
S * <tr> <td>0</td> <td>0</td> <td>0</td> <td>1</td> <td>TCP</td> </tr>
S * <tr> <td>0</td> <td>0</td> <td>1</td> <td>0</td> <td>UDP</td> </tr>
S * <tr> <td>0</td> <td>1</td> <td>0</td> <td>0</td> <td>MACRAW</td> </tr>
S * </table>
S * - <b>In case of Socket 0</b>
S * <table>
S * <tr> <td><b>Protocol[3]</b></td> <td><b>Protocol[2]</b></td> <td><b>Protocol[1]</b></td> <td><b>Protocol[0]</b></td> <td>@b Meaning</td> </tr>
S * <tr> <td>0</td> <td>1</td> <td>0</td> <td>0</td> <td>MACRAW</td> </tr>
S * <tr> <td>0</td> <td>1</td> <td>0</td> <td>1</td> <td>PPPoE</td> </tr>
S * </table>
S * - \ref Sn_MR_MACRAW : MAC LAYER RAW SOCK \n
S * - \ref Sn_MR_UDP : UDP
S * - \ref Sn_MR_TCP : TCP
S * - \ref Sn_MR_CLOSE : Unused socket
S * @note MACRAW mode should be only used in Socket 0.
S */
S#define Sn_MR(sn) (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x0000)) // socket Mode register
S
S/**
S * @ingroup Socket_register_group_W5100S
S * @brief Socket command register(R/W)
S * @details This is used to set the command for Socket n such as OPEN, CLOSE, CONNECT, LISTEN, SEND, and RECEIVE.\n
S * After W5100 accepts the command, the \ref Sn_CR register is automatically cleared to 0x00.
S * Even though \ref Sn_CR is cleared to 0x00, the command is still being processed.\n
S * To check whether the command is completed or not, please check the \ref Sn_IR or \ref Sn_SR.
S * - \ref Sn_CR_OPEN : Initialize or open socket.
S * - \ref Sn_CR_LISTEN : Wait connection request in TCP mode(<b>Server mode</b>)
S * - \ref Sn_CR_CONNECT : Send connection request in TCP mode(<b>Client mode</b>)
S * - \ref Sn_CR_DISCON : Send closing request in TCP mode.
S * - \ref Sn_CR_CLOSE : Close socket.
S * - \ref Sn_CR_SEND : Update TX buffer pointer and send data.
S * - \ref Sn_CR_SEND_MAC : Send data with MAC address, so without ARP process.
S * - \ref Sn_CR_SEND_KEEP : Send keep alive message.
S * - \ref Sn_CR_RECV : Update RX buffer pointer and receive data.
S * - <b>In case of S0_MR(P3:P0) = S0_MR_PPPoE</b>
S * <table>
S * <tr> <td><b>Value</b></td> <td><b>Symbol</b></td> <td><b>Description</b></td></tr>
S * <tr> <td>0x23</td> <td>PCON</td> <td>PPPoE connection begins by transmitting PPPoE discovery packet</td> </tr>
S * <tr> <td>0x24</td> <td>PDISCON</td> <td>Closes PPPoE connection</td> </tr>
S * <tr> <td>0x25</td> <td>PCR</td> <td>In each phase, it transmits REQ message.</td> </tr>
S * <tr> <td>0x26</td> <td>PCN</td> <td>In each phase, it transmits NAK message.</td> </tr>
S * <tr> <td>0x27</td> <td>PCJ</td> <td>In each phase, it transmits REJECT message.</td> </tr>
S * </table>
S */
S#define Sn_CR(sn) (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x0001)) // channel Sn_CR register
S
S/**
S * @ingroup Socket_register_group_W5100S
S * @brief Socket interrupt register(R)
S * @details \ref Sn_IR indicates the status of Socket Interrupt such as establishment, termination, receiving data, timeout).\n
S * When an interrupt occurs and the corresponding bit \ref IR_SOCK(N) in \ref _IMR_ are set, \ref IR_SOCK(N) in \ref IR becomes '1'.\n
S * In order to clear the \ref Sn_IR bit, the host should write the bit to \n
S * <table>
S * <tr> <td>7</td> <td>6</td> <td>5</td> <td>4</td> <td>3</td> <td>2</td> <td>1</td> <td>0</td> </tr>
S * <tr> <td>PRECV</td> <td>PFAIL</td> <td>PNEXT</td> <td>SEND_OK</td> <td>TIMEOUT</td> <td>RECV</td> <td>DISCON</td> <td>CON</td> </tr>
S * </table>
S * - \ref Sn_IR_PRECV : <b>PPP Receive Interrupt</b>
S * - \ref Sn_IR_PFAIL : <b>PPP Fail Interrupt</b>
S * - \ref Sn_IR_PNEXT : <b>PPP Next Phase Interrupt</b>
S * - \ref Sn_IR_SENDOK : <b>SEND_OK Interrupt</b>
S * - \ref Sn_IR_TIMEOUT : <b>TIMEOUT Interrupt</b>
S * - \ref Sn_IR_RECV : <b>RECV Interrupt</b>
S * - \ref Sn_IR_DISCON : <b>DISCON Interrupt</b>
S * - \ref Sn_IR_CON : <b>CON Interrupt</b>
S */
S#define Sn_IR(sn) (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x0002)) // channel interrupt register
S
S/**
S * @ingroup Socket_register_group_W5100S
S * @brief Socket status register(R)
S * @details \ref Sn_SR indicates the status of Socket n.\n
S * The status of Socket n is changed by \ref Sn_CR or some special control packet as SYN, FIN packet in TCP.
S * @par Normal status
S * - \ref SOCK_CLOSED : Closed
S * - \ref SOCK_INIT : Initiate state
S * - \ref SOCK_LISTEN : Listen state
S * - \ref SOCK_ESTABLISHED : Success to connect
S * - \ref SOCK_CLOSE_WAIT : Closing state
S * - \ref SOCK_UDP : UDP socket
S * - \ref SOCK_MACRAW : MAC raw mode socket
S *@par Temporary status during changing the status of Socket n.
S * - \ref SOCK_SYNSENT : This indicates Socket n sent the connect-request packet (SYN packet) to a peer.
S * - \ref SOCK_SYNRECV : It indicates Socket n successfully received the connect-request packet (SYN packet) from a peer.
S * - \ref SOCK_FIN_WAIT : Connection state
S * - \ref SOCK_CLOSING : Closing state
S * - \ref SOCK_TIME_WAIT : Closing state
S * - \ref SOCK_LAST_ACK : Closing state
S */
S#define Sn_SR(sn) (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x0003)) // channel status register
S
S/**
S * @ingroup Socket_register_group_W5100S
S * @brief source port register(R/W)
S * @details \ref Sn_PORT configures the source port number of Socket n.
S * It is valid when Socket n is used in TCP/UDP mode. It should be set before OPEN command is ordered.
S*/
S#define Sn_PORT(sn) (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x0004)) // source port register
S
S/**
S * @ingroup Socket_register_group_W5100S
S * @brief Peer MAC register address(R/W)
S * @details \ref Sn_DHAR configures the destination hardware address of Socket n when using SEND_MAC command in UDP mode or
S * it indicates that it is acquired in ARP-process by CONNECT/SEND command.
S */
S#define Sn_DHAR(sn) (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x0006)) // Peer MAC register address
S
S/**
S * @ingroup Socket_register_group_W5100S
S * @brief Peer IP register address(R/W)
S * @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.
S * In TCP client mode, it configures an IP address of TCP server before CONNECT command.
S * In TCP server mode, it indicates an IP address of TCP client after successfully establishing connection.
S * In UDP mode, it configures an IP address of peer to be received the UDP packet by SEND or SEND_MAC command.
S */
S#define Sn_DIPR(sn) (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x000C)) // Peer IP register address
S
S/**
S * @ingroup Socket_register_group_W5100S
S * @brief Peer port register address(R/W)
S * @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.
S * In TCP clientmode, it configures the listen port number of TCP server before CONNECT command.
S * In TCP Servermode, it indicates the port number of TCP client after successfully establishing connection.
S * In UDP mode, it configures the port number of peer to be transmitted the UDP packet by SEND/SEND_MAC command.
S */
S#define Sn_DPORT(sn) (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x0010)) // Peer port register address
S
S/**
S * @ingroup Socket_register_group_W5100S
S * @brief Maximum Segment Size(Sn_MSSR0) register address(R/W)
S * @details \ref Sn_MSSR configures or indicates the MTU(Maximum Transfer Unit) of Socket n.
S */
S#define Sn_MSSR(sn) (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x0012)) // Maximum Segment Size(Sn_MSSR0) register address
S
S/**
S * @ingroup Socket_register_group_W5100S
S * @brief IP Protocol(PROTO) Register(R/W)
S * @details \ref Sn_PROTO that sets the protocol number field of the IP header at the IP layer. It is
S * valid only in IPRAW mode, and ignored in other modes.
S */
S#define Sn_PROTO(sn) (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x0014)) // Protocol of IP Header field register in IP raw mode
S
S/**
S * @ingroup Socket_register_group_W5100S
S * @brief IP Type of Service(TOS) Register(R/W)
S * @details \ref Sn_TOS configures the TOS(Type Of Service field in IP Header) of Socket n.
S * It is set before OPEN command.
S */
S#define Sn_TOS(sn) (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + 0x0015) // IP Type of Service(TOS) Register
S
S/**
S * @ingroup Socket_register_group_W5100S
S * @brief IP Time to live(TTL) Register(R/W)
S * @details \ref Sn_TTL configures the TTL(Time To Live field in IP header) of Socket n.
S * It is set before OPEN command.
S */
S#define Sn_TTL(sn) (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x0016)) // IP Time to live(TTL) Register
S
S// Reserved (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x0017))
S// Reserved (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x0018))
S// Reserved (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x0019))
S// Reserved (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x001A))
S// Reserved (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x001B))
S// Reserved (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x001C))
S// Reserved (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x001D))
S
S/**
S * @ingroup Socket_register_group_W5100S
S * @brief Transmit free memory size register(R)
S * @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_TXMEM_SIZE.
S * 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.
S * Therefore, check before saving the data to the Socket n TX Buffer, and if data is equal or smaller than its checked size,
S * 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,
S * transmit the data after dividing into the checked size and saving in the Socket n TX buffer.
S */
S#define Sn_TX_FSR(sn) (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x0020)) // Transmit free memory size register
S
S/**
S * @ingroup Socket_register_group_W5100S
S * @brief Transmit memory read pointer register address(R)
S * @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.
S * After its initialization, it is auto-increased by SEND command.
S * 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.
S * After transmitting the saved data, the SEND command increases the \ref Sn_TX_RD as same as the \ref Sn_TX_WR.
S * If its increment value exceeds the maximum value 0xFFFF, (greater than 0x10000 and the carry bit occurs),
S * then the carry bit is ignored and will automatically update with the lower 16bits value.
S */
S#define Sn_TX_RD(sn) (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x0022)) // Transmit memory read pointer register address
S
S/**
S * @ingroup Socket_register_group_W5100S
S * @brief Transmit memory write pointer register address(R/W)
S * @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
S * It should be read or be updated like as follows.\n
S * 1. Read the starting address for saving the transmitting data.\n
S * 2. Save the transmitting data from the starting address of Socket n TX buffer.\n
S * 3. After saving the transmitting data, update \ref Sn_TX_WR to the increased value as many as transmitting data size.
S * If the increment value exceeds the maximum value 0xFFFF(greater than 0x10000 and the carry bit occurs),
S * then the carry bit is ignored and will automatically update with the lower 16bits value.\n
S * 4. Transmit the saved data in Socket n TX Buffer by using SEND/SEND command
S */
S#define Sn_TX_WR(sn) (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x0024)) // Transmit memory write pointer register address
S
S/**
S * @ingroup Socket_register_group_W5100S
S * @brief Received data size register(R)
S * @details \ref Sn_RX_RSR indicates the data size received and saved in Socket n RX Buffer.
S * \ref Sn_RX_RSR does not exceed the \ref Sn_RXMEM_SIZE and is calculated as the difference between
S * Socket n RX Write Pointer (\ref Sn_RX_WR)and Socket n RX Read Pointer (\ref Sn_RX_RD)
S */
S#define Sn_RX_RSR(sn) (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x0026)) // Received data size register
S
S/**
S * @ingroup Socket_register_group_W5100S
S * @brief Read point of Receive memory(R/W)
S * @details \ref Sn_RX_RD is initialized by OPEN command. Make sure to be read or updated as follows.\n
S * 1. Read the starting save address of the received data.\n
S * 2. Read data from the starting address of Socket n RX Buffer.\n
S * 3. After reading the received data, Update \ref Sn_RX_RD to the increased value as many as the reading size.
S * If the increment value exceeds the maximum value 0xFFFF, that is, is greater than 0x10000 and the carry bit occurs,
S * update with the lower 16bits value ignored the carry bit.\n
S * 4. Order RECV command is for notifying the updated \ref Sn_RX_RD to W5100.
S */
S#define Sn_RX_RD(sn) (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x0028)) // Read point of Receive memory
S
S/**
S * @ingroup Socket_register_group_W5100S
S * @brief Write point of Receive memory(R)
S * @details \ref Sn_RX_WR is initialized by OPEN command and it is auto-increased by the data reception.
S * If the increased value exceeds the maximum value 0xFFFF, (greater than 0x10000 and the carry bit occurs),
S * then the carry bit is ignored and will automatically update with the lower 16bits value.
S */
S#define Sn_RX_WR(sn) (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x002A)) // Write point of Receive memory
S
S
S//todo
S#define Sn_IMR(sn) (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x002C))
S
S#define Sn_FRAGR(sn) (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x002D)) // and +1
S
S#define Sn_MR2(sn) (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x002F))
S
S#define Sn_KPALVTR(sn) (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x0030))
S
S#define Sn_TSR(sn) (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x0031))
S
S#define Sn_RTR(sn) (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x0032))
S
S#define Sn_RCR(sn) (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x0034))
S
S
S/*----------------------------- W5100S Register values -----------------------------*/
S
S/* MODE register values */
S/**
S * @brief Reset
S * @details If this bit is All internal registers will be initialized. It will be automatically cleared as after S/W reset.
S */
S#define MR_RST 0x80 ///< reset
S
S
S/**
S * @brief Ping block
S * @details 0 : Disable Ping block\n
S * 1 : Enable Ping block\n
S * If the bit is it blocks the response to a ping request.
S */
S#define MR_PB 0x10 ///< ping block
S
S/**
S * @brief Enable PPPoE
S * @details 0 : DisablePPPoE mode\n
S * 1 : EnablePPPoE mode\n
S * If you use ADSL, this bit should be '1'.
S */
S#define MR_PPPOE 0x08 ///< enable pppoe
S
S/**
S * @brief Address Auto-Increment in Indirect Bus Interface
S * @details 0 : Disable auto-increment \n
S * 1 : Enable auto-incremente \n
S * At the Indirect Bus Interface mode, if this bit is set as éæ¤æ·1éæ¤æ·, the address will
S * be automatically increased by 1 whenever read and write are performed.
S */
S#define MR_AI 0x02 ///< auto-increment in indirect mode
S
S/**
S * @brief Indirect Bus Interface mode
S * @details 0 : Disable Indirect bus Interface mode \n
S * 1 : Enable Indirect bus Interface mode \n
S * If this bit is set as éæ¤æ·1éæ¤æ·, Indirect Bus Interface mode is set.
S */
S#define MR_IND 0x01 ///< enable indirect mode
S
S/* IR register values */
S/**
S * @brief Check IP conflict.
S * @details Bit is set as when own source IP address is same with the sender IP address in the received ARP request.
S */
S#define IR_CONFLICT 0x80 ///< check ip confict
S
S/**
S * @brief Get the destination unreachable message in UDP sending.
S * @details When receiving the ICMP (Destination port unreachable) packet, this bit is set as
S * When this bit is Destination Information such as IP address and Port number may be checked with the corresponding @ref UIPR & @ref UPORTR.
S */
S#define IR_UNREACH 0x40 ///< check destination unreachable
S
S/**
S * @brief Get the PPPoE close message.
S * @details When PPPoE is disconnected during PPPoE mode, this bit is set.
S */
S#define IR_PPPoE 0x20 ///< get the PPPoE close message
S
S/**
S * @brief Socket interrupt bit
S * @details Indicates whether each socket interrupt has occured.
S */
S#define IR_SOCK(sn) (0x01 << sn) ///< check socket interrupt
S
S/**
S * @brief IP conflict interrupt mask bit
S * @details If this bit is set, IP conflict interrupt is enabled.
S */
S#define IMR_CONFLICT 0x80
S
S/**
S * @brief Destination port unreachable interrupt mask bit
S * @details If this bit is set, destination port unreachable interrupt is enabled.
S */
S#define IMR_UNREACH 0x40
S
S/**
S * @brief PADT/LCPT interrupt mask bit
S * @details If this bit is set, PADT/LCPT interrupt is enabled.
S */
S#define IMR_PADT 0x20
S
S/**
S * @brief Socket interrupt mask bit
S * @details If this bit is set, each socket interrupt is enabled.
S */
S#define IMR_SOCK(sn) (0x01 << sn)
S
S/**
S * @brief Magic packet interrupt mask bit
S * @details If this bit is set, each socket interrupt is enabled.
S */
S#define IMR2_MGCPAK 0x01
S
S/**
S * @brief Request command register bit
S * @details ARP command
S */
S#define RQCMD_ARP (1<<1)
S
S/**
S * @brief Request command register bit
S * @details ARP command
S */
S#define RQCMD_PING (1<<0)
S
S/**
S * @brief Request command interrupt and interrupt mask register bit
S * @details Request command time out interrupt and interrupt mask
S */
S#define RQCMD_TIMEOUT (1<<2)
S
S/**
S * @brief Request command interrupt and interrupt mask register bit
S * @details Request command ARP interrupt and interrupt mask
S */
S#define RQCMD_ARP (1<<1)
S
S/**
S * @brief Request command interrupt and interrupt mask register bit
S * @details Request command PING interrupt and interruptmask
S */
S#define RQCMD_PING (1<<0)
S
S
S// Sn_MR values
S/* Sn_MR Default values */
S/**
S * @brief Unused socket
S * @details This configures the protocol mode of Socket n.
S */
S#define Sn_MR_CLOSE 0x00 ///< unused socket
S
S/**
S * @brief TCP
S * @details This configures the protocol mode of Socket n.
S */
S#define Sn_MR_TCP 0x01 ///< TCP
S
S/**
S * @brief UDP
S * @details This configures the protocol mode of Socket n.
S */
S#define Sn_MR_UDP 0x02 ///< UDP
S#define Sn_MR_IPRAW 0x03 ///< IP LAYER RAW SOCK
S
S/**
S * @brief MAC LAYER RAW SOCK
S * @details This configures the protocol mode of Socket n.
S * @note MACRAW mode should be only used in Socket 0.
S */
S#define Sn_MR_MACRAW 0x04 ///< MAC LAYER RAW SOCK
S
S/**
S * @brief PPPoE
S * @details This configures the protocol mode of Socket n.
S * @note PPPoE mode should be only used in Socket 0.
S */
S#define Sn_MR_PPPoE 0x05 ///< PPPoE
S
S/**
S * @brief No Delayed Ack(TCP), Multicast flag
S * @details 0 : Disable No Delayed ACK option\n
S * 1 : Enable No Delayed ACK option\n
S * This bit is applied only during TCP mode (P[3:0] = 001).\n
S * When this bit is It sends the ACK packet without delay as soon as a Data packet is received from a peer.\n
S * When this bit is It sends the ACK packet after waiting for the timeout time configured by \ref _RTR_.
S */
S#define Sn_MR_ND 0x20 ///< No Delayed Ack(TCP) flag
S
S/**
S * @brief Support UDP Multicasting
S * @details 0 : using IGMP version 2\n
S * 1 : using IGMP version 1\n
S * This bit is applied only during UDP mode(P[3:0] = 010 and MULTI = '1')
S * It configures the version for IGMP messages (Join/Leave/Report).
S */
S#define Sn_MR_MC Sn_MR_ND ///< Select IGMP version 1(0) or 2(1)
S
S/**
S * @brief MAC filter enable in @ref Sn_MR_MACRAW mode
S * @details 0 : disable MAC Filtering\n
S * 1 : enable MAC Filtering\n
S * This bit is applied only during MACRAW mode(P[3:0] = 100.\n
S * When set as W5100 can only receive broadcasting packet or packet sent to itself.
S * When this bit is W5100 can receive all packets on Ethernet.
S * If user wants to implement Hybrid TCP/IP stack,
S * it is recommended that this bit is set as for reducing host overhead to process the all received packets.
S */
S#define Sn_MR_MF 0x40 ///< Use MAC filter
S#define Sn_MR_MFEN Sn_MR_MF
S
S
S/* Sn_MR Default values */
S/**
S * @brief Support UDP Multicasting
S * @details 0 : disable Multicasting\n
S * 1 : enable Multicasting\n
S * This bit is applied only during UDP mode(P[3:0] = 010).\n
S * To use multicasting, \ref Sn_DIPR & \ref Sn_DPORT should be respectively configured with the multicast group IP address & port number
S * before Socket n is opened by OPEN command of \ref Sn_CR.
S */
S#define Sn_MR_MULTI 0x80 ///< support multicating
S
S/* Sn_CR values */
S/**
S * @brief Initialize or open socket
S * @details Socket n is initialized and opened according to the protocol selected in Sn_MR(P3:P0).
S * The table below shows the value of \ref Sn_SR corresponding to \ref Sn_MR.\n
S * <table>
S * <tr> <td>\b Sn_MR (P[3:0])</td> <td>\b Sn_SR</td> </tr>
S * <tr> <td>Sn_MR_CLOSE (000)</td> <td>--</td> </tr>
S * <tr> <td>Sn_MR_TCP (001)</td> <td>SOCK_INIT (0x13)</td> </tr>
S * <tr> <td>Sn_MR_UDP (010)</td> <td>SOCK_UDP (0x22)</td> </tr>
S * <tr> <td>S0_MR_IPRAW (011)</td> <td>SOCK_IPRAW (0x32)</td> </tr>
S * <tr> <td>S0_MR_MACRAW (100)</td> <td>SOCK_MACRAW (0x42)</td> </tr>
S * <tr> <td>S0_MR_PPPoE (101)</td> <td>SOCK_PPPoE (0x5F)</td> </tr>
S * </table>
S */
S#define Sn_CR_OPEN 0x01 ///< initialize or open socket
S
S/**
S * @brief Wait connection request in TCP mode(Server mode)
S * @details This is valid only in TCP mode (Sn_MR(P3:P0) = \ref Sn_MR_TCP).//
S * In this mode, Socket n operates as a 'TCP server' and waits for connection-request (SYN packet) from any 'TCP client'.//
S * The \ref Sn_SR changes the state from SOCK_INIT to SOCKET_LISTEN.//
S * When a 'TCP client' connection request is successfully established,
S * the \ref Sn_SR changes from SOCK_LISTEN to SOCK_ESTABLISHED and the Sn_IR(0) becomes
S * But when a 'TCP client' connection request is failed, Sn_IR(3) becomes and the status of \ref Sn_SR changes to SOCK_CLOSED.
S */
S#define Sn_CR_LISTEN 0x02 ///< wait connection request in tcp mode(Server mode)
S
S/**
S * @brief Send connection request in TCP mode(Client mode)
S * @details To connect, a connect-request (SYN packet) is sent to <b>TCP server</b>configured by \ref Sn_DIPR & Sn_DPORT(destination address & port).
S * If the connect-request is successful, the \ref Sn_SR is changed to \ref SOCK_ESTABLISHED and the Sn_IR(0) becomes \n\n
S * The connect-request fails in the following three cases.\n
S * 1. When a @b ARPTO occurs (\ref Sn_IR[3] = '1') because destination hardware address is not acquired through the ARP-process.\n
S * 2. When a @b SYN/ACK packet is not received and @b TCPTO (Sn_IR(3) ='1')\n
S * 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.
S * @note This is valid only in TCP mode and operates when Socket n acts as <b>TCP client</b>
S */
S#define Sn_CR_CONNECT 0x04 ///< send connection request in tcp mode(Client mode)
S
S/**
S * @brief Send closing request in TCP mode
S * @details Regardless of <b>TCP server</b>or <b>TCP client</b> the DISCON command processes the disconnect-process (<b>Active close</b>or <b>Passive close</b>.\n
S * @par Active close
S * it transmits disconnect-request(FIN packet) to the connected peer\n
S * @par Passive close
S * When FIN packet is received from peer, a FIN packet is replied back to the peer.\n
S * @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
S * Otherwise, TCPTO occurs (Sn_IR(3)='1') and then \ref Sn_SR is changed to \ref SOCK_CLOSED.
S * @note Valid only in TCP mode.
S */
S#define Sn_CR_DISCON 0x08 ///< send closing reqeuset in tcp mode
S
S/**
S * @brief Close socket
S * @details Sn_SR is changed to \ref SOCK_CLOSED.
S */
S#define Sn_CR_CLOSE 0x10
S
S/**
S * @brief Update TX buffer pointer and send data
S * @details SEND transmits all the data in the Socket n TX buffer.\n
S * For more details, please refer to Socket n TX Free Size Register (\ref Sn_TX_FSR), Socket n,
S * TX Write Pointer Register(\ref Sn_TX_WR), and Socket n TX Read Pointer Register(\ref Sn_TX_RD).
S */
S#define Sn_CR_SEND 0x20
S
S/**
S * @brief Send data with MAC address, so without ARP process
S * @details The basic operation is same as SEND.\n
S * Normally SEND transmits data after destination hardware address is acquired by the automatic ARP-process(Address Resolution Protocol).\n
S * But SEND_MAC transmits data without the automatic ARP-process.\n
S * In this case, the destination hardware address is acquired from \ref Sn_DHAR configured by host, instead of APR-process.
S * @note Valid only in UDP mode.
S */
S#define Sn_CR_SEND_MAC 0x21
S
S/**
S * @brief Send keep alive message
S * @details It checks the connection status by sending 1byte keep-alive packet.\n
S * If the peer can not respond to the keep-alive packet during timeout time, the connection is terminated and the timeout interrupt will occur.
S * @note Valid only in TCP mode.
S */
S#define Sn_CR_SEND_KEEP 0x22
S
S/**
S * @brief Update RX buffer pointer and receive data
S * @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
S * 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),
S * and Socket n RX Read Pointer Register (\ref Sn_RX_RD).
S */
S#define Sn_CR_RECV 0x40
S
S/**
S * @brief PPPoE connection
S * @details PPPoE connection begins by transmitting PPPoE discovery packet
S */
S#define Sn_CR_PCON 0x23
S
S/**
S * @brief Closes PPPoE connection
S * @details Closes PPPoE connection
S */
S#define Sn_CR_PDISCON 0x24
S
S/**
S * @brief REQ message transmission
S * @details In each phase, it transmits REQ message.
S */
S#define Sn_CR_PCR 0x25
S
S/**
S * @brief NAK massage transmission
S * @details In each phase, it transmits NAK message.
S */
S#define Sn_CR_PCN 0x26
S
S/**
S * @brief REJECT message transmission
S * @details In each phase, it transmits REJECT message.
S */
S#define Sn_CR_PCJ 0x27
S
S/* Sn_IR values */
S/**
S * @brief PPP Receive Interrupt
S * @details PPP Receive Interrupts when the option which is not supported is received.
S */
S#define Sn_IR_PRECV 0x80
S
S/**
S * @brief PPP Fail Interrupt
S * @details PPP Fail Interrupts when PAP Authentication is failed.
S */
S#define Sn_IR_PFAIL 0x40
S
S/**
S * @brief PPP Next Phase Interrupt
S * @details PPP Next Phase Interrupts when the phase is changed during ADSL connection process.
S */
S#define Sn_IR_PNEXT 0x20
S
S/**
S * @brief SEND_OK Interrupt
S * @details This is issued when SEND command is completed.
S */
S#define Sn_IR_SENDOK 0x10 ///< complete sending
S
S/**
S * @brief TIMEOUT Interrupt
S * @details This is issued when ARPTO or TCPTO occurs.
S */
S#define Sn_IR_TIMEOUT 0x08 ///< assert timeout
S
S/**
S * @brief RECV Interrupt
S * @details This is issued whenever data is received from a peer.
S */
S#define Sn_IR_RECV 0x04
S
S/**
S * @brief DISCON Interrupt
S * @details This is issued when FIN or FIN/ACK packet is received from a peer.
S */
S#define Sn_IR_DISCON 0x02
S
S/**
S * @brief CON Interrupt
S * @details This is issued one time when the connection with peer is successful and then \ref Sn_SR is changed to \ref SOCK_ESTABLISHED.
S */
S#define Sn_IR_CON 0x01
S
S/* Sn_SR values */
S/**
S * @brief Closed
S * @details This indicates that Socket n is released.\n
S * When DICON, CLOSE command is ordered, or when a timeout occurs, it is changed to \ref SOCK_CLOSED regardless of previous status.
S */
S#define SOCK_CLOSED 0x00 ///< closed
S
S/**
S * @brief Initiate state
S * @details This indicates Socket n is opened with TCP mode.\n
S * It is changed to \ref SOCK_INIT when Sn_MR(P[3:0]) = 001)and OPEN command is ordered.\n
S * After \ref SOCK_INIT, user can use LISTEN /CONNECT command.
S */
S#define SOCK_INIT 0x13 ///< init state
S
S/**
S * @brief Listen state
S * @details This indicates Socket n is operating as <b>TCP server</b>mode and waiting for connection-request (SYN packet) from a peer (<b>TCP client</b>).\n
S * It will change to \ref SOCK_ESTABLISHED when the connection-request is successfully accepted.\n
S * Otherwise it will change to \ref SOCK_CLOSED after TCPTO occurred (Sn_IR(TIMEOUT) = '1').
S */
S#define SOCK_LISTEN 0x14
S
S/**
S * @brief Connection state
S * @details This indicates Socket n sent the connect-request packet (SYN packet) to a peer.\n
S * It is temporarily shown when \ref Sn_SR is changed from \ref SOCK_INIT to \ref SOCK_ESTABLISHED by CONNECT command.\n
S * If connect-accept(SYN/ACK packet) is received from the peer at SOCK_SYNSENT, it changes to \ref SOCK_ESTABLISHED.\n
S * Otherwise, it changes to \ref SOCK_CLOSED after TCPTO (\ref Sn_IR[TIMEOUT] = '1') is occurred.
S */
S#define SOCK_SYNSENT 0x15
S
S/**
S * @brief Connection state
S * @details It indicates Socket n successfully received the connect-request packet (SYN packet) from a peer.\n
S * If socket n sends the response (SYN/ACK packet) to the peer successfully, it changes to \ref SOCK_ESTABLISHED. \n
S * If not, it changes to \ref SOCK_CLOSED after timeout occurs (\ref Sn_IR[TIMEOUT] = '1').
S */
S#define SOCK_SYNRECV 0x16
S
S/**
S * @brief Success to connect
S * @details This indicates the status of the connection of Socket n.\n
S * It changes to \ref SOCK_ESTABLISHED when the <b>TCP SERVER</b>processed the SYN packet from the <b>TCP CLIENT</b>during \ref SOCK_LISTEN, or
S * when the CONNECT command is successful.\n
S * During \ref SOCK_ESTABLISHED, DATA packet can be transferred using SEND or RECV command.
S */
S#define SOCK_ESTABLISHED 0x17
S
S/**
S * @brief Closing state
S * @details These indicate Socket n is closing.\n
S * These are shown in disconnect-process such as active-close and passive-close.\n
S * When Disconnect-process is successfully completed, or when timeout occurs, these change to \ref SOCK_CLOSED.
S */
S#define SOCK_FIN_WAIT 0x18
S
S/**
S * @brief Closing state
S * @details These indicate Socket n is closing.\n
S * These are shown in disconnect-process such as active-close and passive-close.\n
S * When Disconnect-process is successfully completed, or when timeout occurs, these change to \ref SOCK_CLOSED.
S */
S#define SOCK_CLOSING 0x1A
S
S/**
S * @brief Closing state
S * @details These indicate Socket n is closing.\n
S * These are shown in disconnect-process such as active-close and passive-close.\n
S * When Disconnect-process is successfully completed, or when timeout occurs, these change to \ref SOCK_CLOSED.
S */
S#define SOCK_TIME_WAIT 0x1B
S
S/**
S * @brief Closing state
S * @details This indicates Socket n received the disconnect-request (FIN packet) from the connected peer.\n
S * This is half-closing status, and data can be transferred.\n
S * For full-closing, DISCON command is used. But For just-closing, @ref Sn_CR_CLOSE command is used.
S */
S#define SOCK_CLOSE_WAIT 0x1C
S
S/**
S * @brief Closing state
S * @details This indicates Socket n is waiting for the response (FIN/ACK packet) to the disconnect-request (FIN packet) by passive-close.\n
S * It changes to \ref SOCK_CLOSED when Socket n received the response successfully, or when timeout occurs (\ref Sn_IR[TIMEOUT] = '1').
S */
S#define SOCK_LAST_ACK 0x1D
S
S/**
S * @brief UDP socket
S * @details This indicates Socket n is opened in UDP mode(Sn_MR(P[3:0]) = 010).\n
S * It changes to SOCK_UDP when Sn_MR(P[3:0]) = 010 and @ref Sn_CR_OPEN command is ordered.\n
S * Unlike TCP mode, data can be transfered without the connection-process.
S */
S#define SOCK_UDP 0x22 ///< udp socket
S
S/**
S * @brief IP raw mode socket
S * @details TThe socket is opened in IPRAW mode. The SOCKET status is change to SOCK_IPRAW when @ref Sn_MR (P3:P0) is
S * Sn_MR_IPRAW and @ref Sn_CR_OPEN command is used.\n
S * IP Packet can be transferred without a connection similar to the UDP mode.
S*/
S#define SOCK_IPRAW 0x32 ///< ip raw mode socket
S
S/**
S * @brief MAC raw mode socket
S * @details This indicates Socket 0 is opened in MACRAW mode (@ref Sn_MR(P[3:0]) = '100' and n=0) and is valid only in Socket 0.\n
S * It changes to SOCK_MACRAW when @ref Sn_MR(P[3:0]) = '100' and @ref Sn_CR_OPEN command is ordered.\n
S * Like UDP mode socket, MACRAW mode Socket 0 can transfer a MAC packet (Ethernet frame) without the connection-process.
S */
S#define SOCK_MACRAW 0x42 ///< mac raw mode socket
S
S/**
S * @brief PPPoE mode socket
S * @details It is the status that SOCKET0 is open as PPPoE mode. It is changed to SOCK_PPPoE in case of S0_CR=OPEN and S0_MR
S * (P3:P0)=S0_MR_PPPoE.\n
S * It is temporarily used at the PPPoE
Sconnection.
S */
S#define SOCK_PPPOE 0x5F ///< pppoe socket
S
S// IP PROTOCOL
S#define IPPROTO_IP 0 ///< Dummy for IP
S#define IPPROTO_ICMP 1 ///< Control message protocol
S#define IPPROTO_IGMP 2 ///< Internet group management protocol
S#define IPPROTO_GGP 3 ///< GW^2 (deprecated)
S#define IPPROTO_TCP 6 ///< TCP
S#define IPPROTO_PUP 12 ///< PUP
S#define IPPROTO_UDP 17 ///< UDP
S#define IPPROTO_IDP 22 ///< XNS idp
S#define IPPROTO_ND 77 ///< UNOFFICIAL net disk protocol
S#define IPPROTO_RAW 255 ///< Raw IP packet
S
S
S
S/*----------------------------- W5100S !!Only!! Register values -----------------------------*/
S
S/* MODE2 register values */
S
S/**
S * @brief
S * @details
S */
S#define MR2_CLKSEL (1<<7)
S
S/**
S * @brief
S * @details
S */
S#define MR2_G_IEN (1<<6)
S
S
S/**
S * @brief
S * @details
S */
S#define MR2_NOTCPRST (1<<5)
S
S/**
S * @brief
S * @details
S */
S#define MR2_UDPURB (1<<4)
S
S/**
S * @brief
S * @details
S */
S#define MR2_WOL (1<<3)
S
S/**
S * @brief
S * @details
S */
S#define MR2_MNOSCHK (1<<2)
S
S/**
S * @brief
S * @details
S */
S#define MR2_UDPFARP (1<<1)
S
S/**
S * @brief
S * @details
S */
S#define MR2_SSRCHA (1<<0)
S
S
S
S/* Common interrupt register 2 values */
S
S/**
S * @brief magic packet
S * @details
S */
S#define IR2_MGC (1<<1)
S
S/**
S * @brief
S * @details
S */
S//#define IR2_MGD (1<<1) /* Reserved */
S
S
S/* PHY status register 0 values */
S
S/**
S * @brief
S * @details
S */
S#define PHYSR_CABOFF (1<<7)
S
S/**
S * @brief
S * @details
S */
S#define PHYSR_MD2 (1<<5)
S
S/**
S * @brief
S * @details
S */
S#define PHYSR_MD1 (1<<4)
S
S/**
S * @brief
S * @details
S */
S#define PHYSR_MD0 (1<<3)
S
S/**
S * @brief
S * @details
S */
S#define PHYSR_DUP (1<<2)
S
S/**
S * @brief
S * @details
S */
S#define PHYSR_SPD (1<<1)
S
S/**
S * @brief LINKDONE register
S * @details If 1 Linked successfully, if 0 no link
S */
S#define PHYSR_LNK (1<<0)
S
S
S/* PHY status register 10 values */
S
S/**
S * @brief
S * @details
S */
S#define PHYSR1_RXPG (1<<2)
S
S/**
S * @brief
S * @details
S */
S#define PHYSR1_LPI (1<<1)
S
S/**
S * @brief
S * @details
S */
S#define PHYSR1_CLDN (1<<0)
S
S#define PHYCR_AUTONEGO_ENABLE (0<<2)
S#define PHYCR_AUTONEGO_DISABLE (1<<2)
S
S#define PHYCR_SPD_10 (1<<1)
S#define PHYCR_SPD_100 (0<<1)
S
S#define PHYCR_HALF_DUP (1<<0)
S#define PHYCR_FULL_DUP (0<<0)
S
S
S/*----------------------------For PHY Control-------------------------------*/
S
S/********************/
S/* Register Address */
S/********************/
S
S//Basic mode control register, basic register
S#define PHYMDIO_BMCR 0x00
S
S//Basic mode status register, basic register
S#define PHYMDIO_BMSR 0x01
S
S//--------------------------------------Not used-------------------------------------------//
S////PHY identifier register 1, extended register
S//#define PHY_IDR1 0x02 //not used
S//
S////PHY identifier register 2, extended register
S//#define PHY_IDR2 0x03 //not used
S//
S////Auto-negotiation advertisement register, extended register
S//#define PHY_ANAR 0x04 //not used
S//
S////Auto-negotiation link partner ability register, extended register
S//#define PHY_ANLPAR 0x05 //not used
S//
S////Auto-negotiation expansion register, extended register
S//#define PHY_ANER 0x06 //not used
S//
S////Auto-negotiation next page transmit
S//#define PHY_ANNP 0x07 //not used
S//
S////Auto-negotiation link partner of the next page receive
S//#define PHY_ANLPNP 0x08 //not used
S//
S////MMD access control register
S//#define PHY_REGCR 0x09 //not used
S//
S////MMD access address data register
S//#define PHY_ADDAR 0x0e //not used
S//--------------------------------------Not used-------------------------------------------//
S
S/********************/
S/* Bit definitions */
S/********************/
S
S//For BMCR register
S#define BMCR_RESET (1<<15)
S#define BMCR_MLOOPBACK (1<<14)
S#define BMCR_SPEED (1<<13)
S#define BMCR_AUTONEGO (1<<12)
S#define BMCR_PWDN (1<<11)
S#define BMCR_ISOLATE (1<<10)
S#define BMCR_RSTNEGO (1<<9)
S#define BMCR_DUP (1<<8)
S#define BMCR_COLTEST (1<<7)
S
S//For BMSR register
S#define BMSR_AUTONEGO_COMPL (1<<5)
S#define BMSR_REMOTE_FAULT (1<<4)
S#define BMSR_LINK_STATUS (1<<2)
S#define BMSR_JAB_DETECT (1<<1)
S#define EXTENDED_CAPA (1<<0)
S
S//--------------------------------------Not used-------------------------------------------//
S////For ANAR register
S//#define ANAR_NP (1<<15)
S//#define ANAR_ACK (1<<14)
S//#define ANAR_RF (1<<13)
S//#define ANAR_ASM (3<<10)
S//#define ANAR_T4 (1<<9)
S//#define ANAR_TX_FD (1<<8)
S//#define ANAR_TX_HD (1<<7)
S//#define ANAR_10_FD (1<<6)
S//#define ANAR_10_HD (1<<5)
S//#define ANAR_SELECTOR (0x1F<<0)
S//
S////For ANAR register
S//#define ANLPAR_NP (1<<15)
S//#define ANLPAR_ACK (1<<14)
S//#define ANLPAR_RF (1<<13)
S//#define ANLPAR_LP_DIR (1<<11)
S//#define ANLPAR_PAUSE (1<<10)
S//#define ANLPAR_T4 (1<<9)
S//#define ANLPAR_TX_FD (1<<8)
S//#define ANLPAR_TX_HD (1<<7)
S//#define ANLPAR_10_FD (1<<6)
S//#define ANLPAR_10_HD (1<<5)
S//#define ANLPAR_SELECTOR (0x1F<<0)
S
S/**/
S/* MDIO register*/
S//PCS_CTL_1 | PCS control 1 register
S//PCS_STS_1 | PCS status 1 register
S//EEE_ABILITY | EEE capability register
S//WAKE_ER_CNTR | EEE wake error counter
S//EEE_ADVR | EEE Advertisement register
S//EEE_LPAR | EEE link partner ability register
S
S//--------------------------------------Not used-------------------------------------------//
S
S/********************/
S/*Functions for PHY */
S/********************/
S//todo move this definition to bit area
S#define PHYACR_READ 0x02
S#define PHYACR_WRITE 0x01
S
S
S
S
S/**
S * @brief Enter a critical section
S *
S * @details It is provided to protect your shared code which are executed without distribution. \n \n
S *
S * In non-OS environment, It can be just implemented by disabling whole interrupt.\n
S * In OS environment, You can replace it to critical section api supported by OS.
S *
S * \sa WIZCHIP_READ(), WIZCHIP_WRITE(), WIZCHIP_READ_BUF(), WIZCHIP_WRITE_BUF()
S * \sa WIZCHIP_CRITICAL_EXIT()
S */
S#define WIZCHIP_CRITICAL_ENTER() WIZCHIP.CRIS._enter()
S
S#ifdef _exit
S#undef _exit
S#endif
S
S/**
S * @brief Exit a critical section
S *
S * @details It is provided to protect your shared code which are executed without distribution. \n\n
S *
S * In non-OS environment, It can be just implemented by disabling whole interrupt. \n
S * In OS environment, You can replace it to critical section api supported by OS.
S *
S * @sa WIZCHIP_READ(), WIZCHIP_WRITE(), WIZCHIP_READ_BUF(), WIZCHIP_WRITE_BUF()
S * @sa WIZCHIP_CRITICAL_ENTER()
S */
S#define WIZCHIP_CRITICAL_EXIT() WIZCHIP.CRIS._exit()
S
S
S
S////////////////////////
S// Basic I/O Function //
S////////////////////////
S//
S//M20150601 : uint16_t AddrSel --> uint32_t AddrSel
S//
S/**
S * @ingroup Basic_IO_function_W5100S
S * @brief It reads 1 byte value from a register.
S * @param AddrSel Register address
S * @return The value of register
S */
Suint8_t WIZCHIP_READ (uint32_t AddrSel);
S
S/**
S * @ingroup Basic_IO_function_W5100S
S * @brief It writes 1 byte value to a register.
S * @param AddrSel Register address
S * @param wb Write data
S * @return void
S */
Svoid WIZCHIP_WRITE(uint32_t AddrSel, uint8_t wb );
S
S/**
S * @ingroup Basic_IO_function_W5100S
S * @brief It reads sequence data from registers.
S * @param AddrSel Register address
S * @param pBuf Pointer buffer to read data
S * @param len Data length
S */
Svoid WIZCHIP_READ_BUF (uint32_t AddrSel, uint8_t* pBuf, uint16_t len);
S
S/**
S * @ingroup Basic_IO_function_W5100S
S * @brief It writes sequence data to registers.
S * @param AddrSel Register address
S * @param pBuf Pointer buffer to write data
S * @param len Data length
S */
Svoid WIZCHIP_WRITE_BUF(uint32_t AddrSel, uint8_t* pBuf, uint16_t len);
S
S
S/////////////////////////////////
S// Common Register IO function //
S/////////////////////////////////
S
S/**
S * @ingroup Common_register_access_function_W5100S
S * @brief Set Mode Register
S * @param (uint8_t)mr The value to be set.
S * @sa getMR()
S */
S#if (_WIZCHIP_IO_MODE_ & _WIZCHIP_IO_MODE_SPI_)
S #define setMR(mr) WIZCHIP_WRITE(MR,mr)
S#else
S #define setMR(mr) (*((uint8_t*)MR) = mr)
S#endif
S
S/**
S * @ingroup Common_register_access_function_W5100S
S * @brief Get @ref MR.
S * @return uint8_t. The value of Mode register.
S * @sa setMR()
S */
S#if (_WIZCHIP_IO_MODE_ & _WIZCHIP_IO_MODE_SPI_)
S #define getMR() WIZCHIP_READ(MR)
S#else
S #define getMR() (*(uint8_t*)MR)
S#endif
S
S/**
S * @ingroup Common_register_access_function_W5100S
S * @brief Set @ref GAR.
S * @param (uint8_t*)gar Pointer variable to set gateway IP address. It should be allocated 4 bytes.
S * @sa getGAR()
S */
S#define setGAR(gar) \
S WIZCHIP_WRITE_BUF(GAR,gar,4)
X#define setGAR(gar) WIZCHIP_WRITE_BUF(GAR,gar,4)
S
S/**
S * @ingroup Common_register_access_function_W5100S
S * @brief Get @ref GAR.
S * @param (uint8_t*)gar Pointer variable to get gateway IP address. It should be allocated 4 bytes.
S * @sa setGAR()
S */
S#define getGAR(gar) \
S WIZCHIP_READ_BUF(GAR,gar,4)
X#define getGAR(gar) WIZCHIP_READ_BUF(GAR,gar,4)
S
S/**
S * @ingroup Common_register_access_function_W5100S
S * @brief Set @ref SUBR.
S * @param (uint8_t*)subr Pointer variable to set subnet mask address. It should be allocated 4 bytes.
S * @note If subr is null pointer, set the backup subnet to SUBR. \n
S * If subr is 0.0.0.0, back up SUBR and clear it. \n
S * Otherwize, set subr to SUBR
S * @sa getSUBR()
S */
S#define setSUBR(subr) \
S WIZCHIP_WRITE_BUF(SUBR,subr,4)
X#define setSUBR(subr) WIZCHIP_WRITE_BUF(SUBR,subr,4)
S
S/**
S * @ingroup Common_register_access_function_W5100S
S * @brief Get @ref SUBR.
S * @param (uint8_t*)subr Pointer variable to get subnet mask address. It should be allocated 4 bytes.
S * @sa setSUBR()
S */
S#define getSUBR(subr) \
S WIZCHIP_READ_BUF(SUBR, subr, 4)
X#define getSUBR(subr) WIZCHIP_READ_BUF(SUBR, subr, 4)
S
S/**
S * @ingroup Common_register_access_function_W5100S
S * @brief Set @ref SHAR.
S * @param (uint8_t*)shar Pointer variable to set local MAC address. It should be allocated 6 bytes.
S * @sa getSHAR()
S */
S#define setSHAR(shar) \
S WIZCHIP_WRITE_BUF(SHAR, shar, 6)
X#define setSHAR(shar) WIZCHIP_WRITE_BUF(SHAR, shar, 6)
S
S/**
S * @ingroup Common_register_access_function_W5100S
S * @brief Get @ref SHAR.
S * @param (uint8_t*)shar Pointer variable to get local MAC address. It should be allocated 6 bytes.
S * @sa setSHAR()
S */
S#define getSHAR(shar) \
S WIZCHIP_READ_BUF(SHAR, shar, 6)
X#define getSHAR(shar) WIZCHIP_READ_BUF(SHAR, shar, 6)
S
S/**
S * @ingroup Common_register_access_function_W5100S
S * @brief Set @ref SIPR.
S * @param (uint8_t*)sipr Pointer variable to set local IP address. It should be allocated 4 bytes.
S * @sa getSIPR()
S*/
S#define setSIPR(sipr) \
S WIZCHIP_WRITE_BUF(SIPR, sipr, 4)
X#define setSIPR(sipr) WIZCHIP_WRITE_BUF(SIPR, sipr, 4)
S
S/**
S * @ingroup Common_register_access_function_W5100S
S * @brief Get @ref SIPR.
S * @param (uint8_t*)sipr Pointer variable to get local IP address. It should be allocated 4 bytes.
S * @sa setSIPR()
S */
S#define getSIPR(sipr) \
S WIZCHIP_READ_BUF(SIPR, sipr, 4)
X#define getSIPR(sipr) WIZCHIP_READ_BUF(SIPR, sipr, 4)
S
S/**
S * @ingroup Common_register_access_function_W5100S
S * @brief Set \ref IR register
S * @param (uint8_t)ir Value to set \ref IR register.
S * @sa getIR()
S */
S#define setIR(ir) \
S WIZCHIP_WRITE(IR, (ir & 0xE0)) //peter 2016.11.07 unreachable interrupt bit added
X#define setIR(ir) WIZCHIP_WRITE(IR, (ir & 0xE0))
S //WIZCHIP_WRITE(IR, (ir & 0xA0))
S/**
S * @ingroup Common_register_access_function_W5100S
S * @brief Get \ref IR register
S * @return uint8_t. Value of \ref IR register.
S * @sa setIR()
S */
S#define getIR() \
S (WIZCHIP_READ(IR) & 0xE0) //peter 2016.11.07 unreachable interrupt bit added
X#define getIR() (WIZCHIP_READ(IR) & 0xE0)
S //(WIZCHIP_READ(IR) & 0xA0)
S
S/**
S * @ingroup Common_register_access_function_W5100S
S * @brief Set \ref _IMR_ register
S * @param (uint8_t)imr Value to set @ref _IMR_ register.
S * @sa getIMR()
S */
S#define setIMR(imr) \
S WIZCHIP_WRITE(_IMR_, imr)
X#define setIMR(imr) WIZCHIP_WRITE(_IMR_, imr)
S
S/**
S * @ingroup Common_register_access_function_W5100S
S * @brief Get \ref _IMR_ register
S * @return uint8_t. Value of @ref _IMR_ register.
S * @sa setIMR()
S */
S#define getIMR() \
S WIZCHIP_READ(_IMR_)
X#define getIMR() WIZCHIP_READ(_IMR_)
S
S/**
S * @ingroup Common_register_access_function_W5100S
S * @brief Set \ref _RTR_ register
S * @param (uint16_t)rtr Value to set @ref _RTR_ register.
S * @sa getRTR()
S */
S#define setRTR(rtr) {\
S WIZCHIP_WRITE(_RTR_, (uint8_t)(rtr >> 8)); \
S WIZCHIP_WRITE(WIZCHIP_OFFSET_INC(_RTR_,1), (uint8_t) rtr); \
S }
X#define setRTR(rtr) { WIZCHIP_WRITE(_RTR_, (uint8_t)(rtr >> 8)); WIZCHIP_WRITE(WIZCHIP_OFFSET_INC(_RTR_,1), (uint8_t) rtr); }
S
S/**
S * @ingroup Common_register_access_function_W5100S
S * @brief Get \ref _RTR_ register
S * @return uint16_t. Value of @ref _RTR_ register.
S * @sa setRTR()
S */
S#define getRTR() \
S (((uint16_t)WIZCHIP_READ(_RTR_) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(_RTR_,1)))
X#define getRTR() (((uint16_t)WIZCHIP_READ(_RTR_) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(_RTR_,1)))
S
S/**
S * @ingroup Common_register_access_function_W5100S
S * @brief Set \ref _RCR_ register
S * @param (uint8_t)rcr Value to set @ref _RCR_ register.
S * @sa getRCR()
S */
S#define setRCR(rcr) \
S WIZCHIP_WRITE(_RCR_, rcr)
X#define setRCR(rcr) WIZCHIP_WRITE(_RCR_, rcr)
S
S/**
S * @ingroup Common_register_access_function_W5100S
S * @brief Get \ref _RCR_ register
S * @return uint8_t. Value of @ref _RCR_ register.
S * @sa setRCR()
S */
S#define getRCR() \
S WIZCHIP_READ(_RCR_)
X#define getRCR() WIZCHIP_READ(_RCR_)
S
S/**
S * @ingroup Common_register_access_function_W5100S
S * @brief Get \ref RMSR register
S * @sa getRMSR()
S */
S#define setRMSR(rmsr) \
S WIZCHIP_WRITE(RMSR,rmsr) // Receicve Memory Size
X#define setRMSR(rmsr) WIZCHIP_WRITE(RMSR,rmsr)
S
S/**
S * @ingroup Common_register_access_function_W5100S
S * @brief Get \ref RMSR register
S * @return uint8_t. Value of @ref RMSR register.
S * @sa setRMSR()
S */
S #define getRMSR() \
S WIZCHIP_READ(RMSR) // Receicve Memory Size
X #define getRMSR() WIZCHIP_READ(RMSR)
S
S/**
S * @ingroup Common_register_access_function_W5100S
S * @brief Get \ref TMSR register
S * @sa getTMSR()
S */
S#define setTMSR(tmsr) \
S WIZCHIP_WRITE(TMSR,tmsr) // Receicve Memory Size
X#define setTMSR(tmsr) WIZCHIP_WRITE(TMSR,tmsr)
S
S/**
S * @ingroup Common_register_access_function_W5100S
S * @brief Get \ref TMSR register
S * @return uint8_t. Value of @ref TMSR register.
S * @sa setTMSR()
S */
S#define getTMSR() \
S WIZCHIP_READ(TMSR)
X#define getTMSR() WIZCHIP_READ(TMSR)
S
S
S/**
S * @ingroup Common_register_access_function_W5100S
S * @brief Get \ref PATR register
S * @return uint16_t. Value to set \ref PATR register
S */
S#define getPATR() \
S (((uint16_t)WIZCHIP_READ(PATR) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(PATR,1)))
X#define getPATR() (((uint16_t)WIZCHIP_READ(PATR) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(PATR,1)))
S
S/**
S * @ingroup Common_register_access_function_W5100S
S * @brief Get \ref PPPALGO register
S * @return uint8_t. Value to set \ref PPPALGO register
S */
S#define getPPPALGO() \
S WIZCHIP_READ(PPPALGO)
X#define getPPPALGO() WIZCHIP_READ(PPPALGO)
S
S
S/**
S * @ingroup Common_register_access_function_W5100S
S * @brief Set \ref PTIMER register
S * @param (uint8_t)ptimer Value to set \ref PTIMER register.
S * @sa getPTIMER()
S */
S#define setPTIMER(ptimer) \
S WIZCHIP_WRITE(PTIMER, ptimer)
X#define setPTIMER(ptimer) WIZCHIP_WRITE(PTIMER, ptimer)
S
S/**
S * @ingroup Common_register_access_function_W5100S
S * @brief Get \ref PTIMER register
S * @return uint8_t. Value of @ref PTIMER register.
S * @sa setPTIMER()
S */
S#define getPTIMER() \
S WIZCHIP_READ(PTIMER)
X#define getPTIMER() WIZCHIP_READ(PTIMER)
S
S/**
S * @ingroup Common_register_access_function_W5100S
S * @brief Set \ref PMAGIC register
S * @param (uint8_t)pmagic Value to set @ref PMAGIC register.
S * @sa getPMAGIC()
S */
S#define setPMAGIC(pmagic) \
S WIZCHIP_WRITE(PMAGIC, pmagic)
X#define setPMAGIC(pmagic) WIZCHIP_WRITE(PMAGIC, pmagic)
S
S/**
S * @ingroup Common_register_access_function_W5100S
S * @brief Get \ref PMAGIC register
S * @return uint8_t. Value of @ref PMAGIC register.
S * @sa setPMAGIC()
S */
S#define getPMAGIC() \
S WIZCHIP_READ(PMAGIC)
X#define getPMAGIC() WIZCHIP_READ(PMAGIC)
S
S
S//todo Functions for W5100S
S
S/*----------------------------------------------------------------------*/
S/* W5100S only */
S/*----------------------------------------------------------------------*/
S
S#define setIR2(ir2) \
S WIZCHIP_WRITE(IR2, ir2)
X#define setIR2(ir2) WIZCHIP_WRITE(IR2, ir2)
S
S#define getIR2() \
S WIZCHIP_READ(IR2)
X#define getIR2() WIZCHIP_READ(IR2)
S
S#define setIMR2(imr2) \
S WIZCHIP_WRITE(IMR2,imr2)
X#define setIMR2(imr2) WIZCHIP_WRITE(IMR2,imr2)
S
S#define getIMR2() \
S WIZCHIP_READ(IMR2)
X#define getIMR2() WIZCHIP_READ(IMR2)
S
S#define setUIPR(uipr) \
S WIZCHIP_WRITE_BUF(UIPR,uipr,4)
X#define setUIPR(uipr) WIZCHIP_WRITE_BUF(UIPR,uipr,4)
S
S#define getUIPR(uipr) \
S WIZCHIP_READ_BUF(UIPR,uipr,4)
X#define getUIPR(uipr) WIZCHIP_READ_BUF(UIPR,uipr,4)
S
S#define setUPORTR(uportr) {\
S WIZCHIP_WRITE(UPORTR, (uint8_t)(uportr >> 8)); \
S WIZCHIP_WRITE(UPORTR+1, (uint8_t) uportr); \
S }
X#define setUPORTR(uportr) { WIZCHIP_WRITE(UPORTR, (uint8_t)(uportr >> 8)); WIZCHIP_WRITE(UPORTR+1, (uint8_t) uportr); }
S
S#define getUPORTR() \
S (((uint16_t)WIZCHIP_READ(UPORTR) << 8) + WIZCHIP_READ(UPORTR+1))
X#define getUPORTR() (((uint16_t)WIZCHIP_READ(UPORTR) << 8) + WIZCHIP_READ(UPORTR+1))
S
S#define setMR2(mr2) \
S WIZCHIP_WRITE(MR2,mr2)
X#define setMR2(mr2) WIZCHIP_WRITE(MR2,mr2)
S
S#define getMR2() \
S WIZCHIP_READ(MR2)
X#define getMR2() WIZCHIP_READ(MR2)
S
S#define setPHAR(phar) \
S WIZCHIP_WRITE_BUF(PHAR,phar,6)
X#define setPHAR(phar) WIZCHIP_WRITE_BUF(PHAR,phar,6)
S
S#define getPHAR(phar) \
S WIZCHIP_READ_BUF(PHAR,phar,6)
X#define getPHAR(phar) WIZCHIP_READ_BUF(PHAR,phar,6)
S
S#define setPSIDR(psidr) {\
S WIZCHIP_WRITE(PSIDR, (uint8_t)(psidr >> 8)); \
S WIZCHIP_WRITE(PSIDR+1, (uint8_t) psidr); \
S }
X#define setPSIDR(psidr) { WIZCHIP_WRITE(PSIDR, (uint8_t)(psidr >> 8)); WIZCHIP_WRITE(PSIDR+1, (uint8_t) psidr); }
S
S#define getPSIDR() \
S (((uint16_t)WIZCHIP_READ(PSIDR) << 8) + WIZCHIP_READ(PSIDR+1))
X#define getPSIDR() (((uint16_t)WIZCHIP_READ(PSIDR) << 8) + WIZCHIP_READ(PSIDR+1))
S
S#define setPMRUR(pmrur) {\
S WIZCHIP_WRITE(PMRUR, (uint8_t)(pmrur >> 8)); \
S WIZCHIP_WRITE(PMRUR+1, (uint8_t) pmrur); \
S }
X#define setPMRUR(pmrur) { WIZCHIP_WRITE(PMRUR, (uint8_t)(pmrur >> 8)); WIZCHIP_WRITE(PMRUR+1, (uint8_t) pmrur); }
S
S#define getPMRUR() \
S (((uint16_t)WIZCHIP_READ(PMRUR) << 8) + WIZCHIP_READ(PMRUR+1))
X#define getPMRUR() (((uint16_t)WIZCHIP_READ(PMRUR) << 8) + WIZCHIP_READ(PMRUR+1))
S
S#define getPHYSR() \
S WIZCHIP_READ(PHYSR)
X#define getPHYSR() WIZCHIP_READ(PHYSR)
S
S#define getPHYSR1() \
S WIZCHIP_READ(PHYSR1)
X#define getPHYSR1() WIZCHIP_READ(PHYSR1)
S
S//The address of the PHY is fixed as "0x0A".
S#define getPHYAR() \
S WIZCHIP_READ(PHYAR)
X#define getPHYAR() WIZCHIP_READ(PHYAR)
S
S//read the value of the phy address register
S#define getPHYRR() \
S WIZCHIP_READ(PHYRR)
X#define getPHYRR() WIZCHIP_READ(PHYRR)
S
S//write the value to the phy address register
S#define setPHYRR(phyrr) \
S WIZCHIP_WRITE(PHYRR, phyrr)
X#define setPHYRR(phyrr) WIZCHIP_WRITE(PHYRR, phyrr)
S
S
S//read the value of the phy data input register
S#define getPHYDIR() \
S (((uint16_t)WIZCHIP_READ(PHYDIR+1) << 8) + WIZCHIP_READ(PHYDIR))
X#define getPHYDIR() (((uint16_t)WIZCHIP_READ(PHYDIR+1) << 8) + WIZCHIP_READ(PHYDIR))
S
S//write the value of the phy data input register
S#define setPHYDIR(phydir) {\
S WIZCHIP_WRITE(PHYDIR+1, (uint8_t)(phydir >> 8)); \
S WIZCHIP_WRITE(PHYDIR, (uint8_t) phydir); \
S }
X#define setPHYDIR(phydir) { WIZCHIP_WRITE(PHYDIR+1, (uint8_t)(phydir >> 8)); WIZCHIP_WRITE(PHYDIR, (uint8_t) phydir); }
S
S//read the value of the phy data output register
S#define getPHYDOR() \
S (((uint16_t)WIZCHIP_READ(PHYDOR+1) << 8) + WIZCHIP_READ(PHYDOR))
X#define getPHYDOR() (((uint16_t)WIZCHIP_READ(PHYDOR+1) << 8) + WIZCHIP_READ(PHYDOR))
S
S//write the value of the phy data output register
S#define setPHYDOR(phydor) {\
S WIZCHIP_WRITE(PHYDOR, (uint8_t)(phydor >> 8)); \
S WIZCHIP_WRITE(PHYDOR+1, (uint8_t) phydor); \
S }
X#define setPHYDOR(phydor) { WIZCHIP_WRITE(PHYDOR, (uint8_t)(phydor >> 8)); WIZCHIP_WRITE(PHYDOR+1, (uint8_t) phydor); }
S
S//read the value of the phy action register ***meaningless because of this register will be cleared automatically***
S#define getPHYACR() \
S WIZCHIP_READ(PHYACR)
X#define getPHYACR() WIZCHIP_READ(PHYACR)
S
S//write the value of the phy action register
S#define setPHYACR(phyacr) \
S WIZCHIP_WRITE(PHYACR,phyacr)
X#define setPHYACR(phyacr) WIZCHIP_WRITE(PHYACR,phyacr)
S
S
S#define setPHYDIVR(phydivr) \
S WIZCHIP_WRITE(PHYDIVR, phydivr)
X#define setPHYDIVR(phydivr) WIZCHIP_WRITE(PHYDIVR, phydivr)
S
S#define getPHYDIVR() \
S WIZCHIP_READ(PHYDIVR)
X#define getPHYDIVR() WIZCHIP_READ(PHYDIVR)
S
S#define setPHYCR0(phych0) \
S WIZCHIP_WRITE(PHYCR0,phych0)
X#define setPHYCR0(phych0) WIZCHIP_WRITE(PHYCR0,phych0)
S
S#define getPHYCR0() \
S WIZCHIP_READ(PHYCR0)
X#define getPHYCR0() WIZCHIP_READ(PHYCR0)
S
S#define setPHYCR1(phycr1) \
S WIZCHIP_WRITE(PHYCR1,phycr1)
X#define setPHYCR1(phycr1) WIZCHIP_WRITE(PHYCR1,phycr1)
S
S#define getPHYCR1() \
S WIZCHIP_READ(PHYCR1)
X#define getPHYCR1() WIZCHIP_READ(PHYCR1)
S
S#define setSLCR(rqcr) \
S WIZCHIP_WRITE(SLCR, rqcr)
X#define setSLCR(rqcr) WIZCHIP_WRITE(SLCR, rqcr)
S
S#define getSLCR() \
S WIZCHIP_READ(RQCR)
X#define getSLCR() WIZCHIP_READ(RQCR)
S
S#define setSLRTR(slrtr) \
S WIZCHIP_WRITE(SLRTR, (uint8_t)(slrtr >> 8)); \
S WIZCHIP_WRITE(SLRTR+1, (uint8_t) slrtr); \
S
X#define setSLRTR(slrtr) WIZCHIP_WRITE(SLRTR, (uint8_t)(slrtr >> 8)); WIZCHIP_WRITE(SLRTR+1, (uint8_t) slrtr);
S#define getSLRTR() \
S (((uint16_t)WIZCHIP_READ(SLRTR) << 8) + WIZCHIP_READ(SLRTR+1))
X#define getSLRTR() (((uint16_t)WIZCHIP_READ(SLRTR) << 8) + WIZCHIP_READ(SLRTR+1))
S
S#define setSLRCR(slrcr) \
S WIZCHIP_WRITE(SLRCR,slrcr)
X#define setSLRCR(slrcr) WIZCHIP_WRITE(SLRCR,slrcr)
S
S#define getSLRCR() \
S WIZCHIP_READ(SLRCR)
X#define getSLRCR() WIZCHIP_READ(SLRCR)
S
S#define setSLPIPR(slpipr) \
S WIZCHIP_WRITE_BUF(SLPIPR,slpipr,4)
X#define setSLPIPR(slpipr) WIZCHIP_WRITE_BUF(SLPIPR,slpipr,4)
S
S#define getSLPIPR(slpipr) \
S WIZCHIP_READ_BUF(SLPIPR,slpipr,4)
X#define getSLPIPR(slpipr) WIZCHIP_READ_BUF(SLPIPR,slpipr,4)
S
S#define setSLPHAR(slphar) \
S WIZCHIP_WRITE_BUF(SLPHAR,slphar,6)
X#define setSLPHAR(slphar) WIZCHIP_WRITE_BUF(SLPHAR,slphar,6)
S
S#define getSLPHAR(rqphar) \
S WIZCHIP_READ_BUF(SLPHAR,slphar,6)
X#define getSLPHAR(rqphar) WIZCHIP_READ_BUF(SLPHAR,slphar,6)
S
S#define setPINGSEQR(pingseqr) {\
S WIZCHIP_WRITE(PINGSEQR, (uint8_t)(pingseqr >> 8)); \
S WIZCHIP_WRITE(PINGSEQR+1, (uint8_t) pingseqr); \
S }
X#define setPINGSEQR(pingseqr) { WIZCHIP_WRITE(PINGSEQR, (uint8_t)(pingseqr >> 8)); WIZCHIP_WRITE(PINGSEQR+1, (uint8_t) pingseqr); }
S
S#define getPINGSEQR() \
S (((uint16_t)WIZCHIP_READ(PINGSEQR) << 8) + WIZCHIP_READ(PINGSEQR+1))
X#define getPINGSEQR() (((uint16_t)WIZCHIP_READ(PINGSEQR) << 8) + WIZCHIP_READ(PINGSEQR+1))
S
S#define setPINGIDR(pingidr) {\
S WIZCHIP_WRITE(PINGIDR, (uint8_t)(pingidr >> 8)); \
S WIZCHIP_WRITE(PINGIDR+1, (uint8_t) pingidr); \
S }
X#define setPINGIDR(pingidr) { WIZCHIP_WRITE(PINGIDR, (uint8_t)(pingidr >> 8)); WIZCHIP_WRITE(PINGIDR+1, (uint8_t) pingidr); }
S
S#define getPINGIDR() \
S (((uint16_t)WIZCHIP_READ(PINGIDR) << 8) + WIZCHIP_READ(PINGIDR+1))
X#define getPINGIDR() (((uint16_t)WIZCHIP_READ(PINGIDR) << 8) + WIZCHIP_READ(PINGIDR+1))
S
S#define setSLIMR(slimr) \
S WIZCHIP_WRITE(SLIMR, slimr)
X#define setSLIMR(slimr) WIZCHIP_WRITE(SLIMR, slimr)
S
S#define getSLIMR() \
S WIZCHIP_READ(SLIMR)
X#define getSLIMR() WIZCHIP_READ(SLIMR)
S
S#define setSLIR(slir) \
S WIZCHIP_WRITE(SLIR, slir)
X#define setSLIR(slir) WIZCHIP_WRITE(SLIR, slir)
S
S#define getSLIR() \
S WIZCHIP_READ(SLIR)
X#define getSLIR() WIZCHIP_READ(SLIR)
S
S/*Hidden functions for W5100S*/
S#define setDBGOUT(dbgout) {\
S WIZCHIP_WRITE(DBGOUT,(uint8_t)(dbgout >> 16)); \
S WIZCHIP_WRITE(DBGOUT,(uint8_t)(dbgout >> 8)); \
S WIZCHIP_WRITE(DBGOUT,(uint8_t)(dbgout)); \
S }
X#define setDBGOUT(dbgout) { WIZCHIP_WRITE(DBGOUT,(uint8_t)(dbgout >> 16)); WIZCHIP_WRITE(DBGOUT,(uint8_t)(dbgout >> 8)); WIZCHIP_WRITE(DBGOUT,(uint8_t)(dbgout)); }
S
S#define setNICMAXCOLR(nicmaxcolr) \
S WIZCHIP_WRITE(NICMAXCOLR,nicmaxcolr)
X#define setNICMAXCOLR(nicmaxcolr) WIZCHIP_WRITE(NICMAXCOLR,nicmaxcolr)
S
S#define getNICMAXCOLR() \
S WIZCHIP_READ(NICMAXCOLR)
X#define getNICMAXCOLR() WIZCHIP_READ(NICMAXCOLR)
S
S/*Clock lock/unlock*/
S
S#define CHIPLOCK() \
S WIZCHIP_WRITE(CHIPLCKR,0xff)
X#define CHIPLOCK() WIZCHIP_WRITE(CHIPLCKR,0xff)
S
S#define CHIPUNLOCK() \
S WIZCHIP_WRITE(CHIPLCKR,0xCE)
X#define CHIPUNLOCK() WIZCHIP_WRITE(CHIPLCKR,0xCE)
S
S/*Network information lock/unlock*/
S#define NETLOCK() \
S WIZCHIP_WRITE(NETLCKR,0x3A)
X#define NETLOCK() WIZCHIP_WRITE(NETLCKR,0x3A)
S
S#define NETUNLOCK() \
S WIZCHIP_WRITE(NETLCKR,0xC5)
X#define NETUNLOCK() WIZCHIP_WRITE(NETLCKR,0xC5)
S
S/*PHY CR0,CR1 lock/unlock*/
S#define PHYLOCK() \
S WIZCHIP_WRITE(PHYLCKR,0xff)
X#define PHYLOCK() WIZCHIP_WRITE(PHYLCKR,0xff)
S
S#define PHYUNLOCK() \
S WIZCHIP_WRITE(PHYLCKR,0x53)
X#define PHYUNLOCK() WIZCHIP_WRITE(PHYLCKR,0x53)
S
S/**
S * @ingroup Version register_access_function_W5100SS
S * @brief Get version information.
S * @return uint16_t. It must be "0x51"
S */
S#define getVER() \
S (WIZCHIP_READ(VERR))
X#define getVER() (WIZCHIP_READ(VERR))
S
S/*Get 100us internal counter*/
S#define getTCNTR() \
S (((uint16_t)WIZCHIP_READ(TCNTR) << 8) + WIZCHIP_READ(TCNTR+1))
X#define getTCNTR() (((uint16_t)WIZCHIP_READ(TCNTR) << 8) + WIZCHIP_READ(TCNTR+1))
S
S/*Reset 100us internal counter(TCNTR)*/
S#define setTCNTCLKR(var) \
S WIZCHIP_WRITE(TCNTCLKR, var)
X#define setTCNTCLKR(var) WIZCHIP_WRITE(TCNTCLKR, var)
S
S/*w5100s only end*/
S
S
S
S
S
S///////////////////////////////////
S// Socket N register I/O function //
S///////////////////////////////////
S/**
S * @ingroup Socket_register_access_function_W5100S
S * @brief Set @ref Sn_MR register
S * @param sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b> expect <b>bit 4</b>.
S * @param mr Value to set @ref Sn_MR
S * @sa getSn_MR()
S */
S#define setSn_MR(sn, mr) \
S WIZCHIP_WRITE(Sn_MR(sn),mr)
X#define setSn_MR(sn, mr) WIZCHIP_WRITE(Sn_MR(sn),mr)
S
S/**
S * @ingroup Socket_register_access_function_W5100S
S * @brief Get @ref Sn_MR register
S * @param sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b> expect <b>bit 4</b>.
S * @return Value of @ref Sn_MR.
S * @sa setSn_MR()
S */
S#define getSn_MR(sn) \
S WIZCHIP_READ(Sn_MR(sn))
X#define getSn_MR(sn) WIZCHIP_READ(Sn_MR(sn))
S
S/**
S * @ingroup Socket_register_access_function_W5100S
S * @brief Set @ref Sn_CR register
S * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
S * @param (uint8_t)cr Value to set @ref Sn_CR
S * @sa getSn_CR()
S */
S#define setSn_CR(sn, cr) \
S WIZCHIP_WRITE(Sn_CR(sn), cr)
X#define setSn_CR(sn, cr) WIZCHIP_WRITE(Sn_CR(sn), cr)
S
S/**
S * @ingroup Socket_register_access_function_W5100S
S * @brief Get @ref Sn_CR register
S * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
S * @return uint8_t. Value of @ref Sn_CR.
S * @sa setSn_CR()
S */
S#define getSn_CR(sn) \
S WIZCHIP_READ(Sn_CR(sn))
X#define getSn_CR(sn) WIZCHIP_READ(Sn_CR(sn))
S
S/**
S * @ingroup Socket_register_access_function_W5100S
S * @brief Set @ref Sn_IR register
S * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
S * @param (uint8_t)ir Value to set @ref Sn_IR
S * @sa getSn_IR()
S */
S#define setSn_IR(sn, ir) \
S WIZCHIP_WRITE(Sn_IR(sn), ir)
X#define setSn_IR(sn, ir) WIZCHIP_WRITE(Sn_IR(sn), ir)
S
S/**
S * @ingroup Socket_register_access_function_W5100S
S * @brief Get @ref Sn_IR register
S * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
S * @return uint8_t. Value of @ref Sn_IR.
S * @sa setSn_IR()
S */
S#define getSn_IR(sn) \
S WIZCHIP_READ(Sn_IR(sn))
X#define getSn_IR(sn) WIZCHIP_READ(Sn_IR(sn))
S
S/**
S * @ingroup Socket_register_access_function_W5100S
S * @brief Get @ref Sn_SR register
S * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
S * @return uint8_t. Value of @ref Sn_SR.
S */
S#define getSn_SR(sn) \
S WIZCHIP_READ(Sn_SR(sn))
X#define getSn_SR(sn) WIZCHIP_READ(Sn_SR(sn))
S
S/**
S * @ingroup Socket_register_access_function_W5100S
S * @brief Set @ref Sn_PORT register
S * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
S * @param (uint16_t)port Value to set @ref Sn_PORT.
S * @sa getSn_PORT()
S */
S#define setSn_PORT(sn, port) { \
S WIZCHIP_WRITE(Sn_PORT(sn), (uint8_t)(port >> 8)); \
S WIZCHIP_WRITE(WIZCHIP_OFFSET_INC(Sn_PORT(sn),1), (uint8_t) port); \
S }
X#define setSn_PORT(sn, port) { WIZCHIP_WRITE(Sn_PORT(sn), (uint8_t)(port >> 8)); WIZCHIP_WRITE(WIZCHIP_OFFSET_INC(Sn_PORT(sn),1), (uint8_t) port); }
S
S/**
S * @ingroup Socket_register_access_function_W5100S
S * @brief Get @ref Sn_PORT register
S * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
S * @return uint16_t. Value of @ref Sn_PORT.
S * @sa setSn_PORT()
S */
S#define getSn_PORT(sn) \
S (((uint16_t)WIZCHIP_READ(Sn_PORT(sn)) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_PORT(sn),1)))
X#define getSn_PORT(sn) (((uint16_t)WIZCHIP_READ(Sn_PORT(sn)) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_PORT(sn),1)))
S
S/**
S * @ingroup Socket_register_access_function_W5100S
S * @brief Set @ref Sn_DHAR register
S * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
S * @param (uint8_t*)dhar Pointer variable to set socket n destination hardware address. It should be allocated 6 bytes.
S * @sa getSn_DHAR()
S */
S#define setSn_DHAR(sn, dhar) \
S WIZCHIP_WRITE_BUF(Sn_DHAR(sn), dhar, 6)
X#define setSn_DHAR(sn, dhar) WIZCHIP_WRITE_BUF(Sn_DHAR(sn), dhar, 6)
S
S/**
S * @ingroup Socket_register_access_function_W5100S
S * @brief Get @ref Sn_DHAR register
S * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
S * @param (uint8_t*)dhar Pointer variable to get socket n destination hardware address. It should be allocated 6 bytes.
S * @sa setSn_DHAR()
S */
S#define getSn_DHAR(sn, dhar) \
S WIZCHIP_READ_BUF(Sn_DHAR(sn), dhar, 6)
X#define getSn_DHAR(sn, dhar) WIZCHIP_READ_BUF(Sn_DHAR(sn), dhar, 6)
S
S/**
S * @ingroup Socket_register_access_function_W5100S
S * @brief Set @ref Sn_DIPR register
S * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
S * @param (uint8_t*)dipr Pointer variable to set socket n destination IP address. It should be allocated 4 bytes.
S * @sa getSn_DIPR()
S */
S#define setSn_DIPR(sn, dipr) \
S WIZCHIP_WRITE_BUF(Sn_DIPR(sn), dipr, 4)
X#define setSn_DIPR(sn, dipr) WIZCHIP_WRITE_BUF(Sn_DIPR(sn), dipr, 4)
S
S/**
S * @ingroup Socket_register_access_function_W5100S
S * @brief Get @ref Sn_DIPR register
S * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
S * @param (uint8_t*)dipr Pointer variable to get socket n destination IP address. It should be allocated 4 bytes.
S * @sa SetSn_DIPR()
S */
S#define getSn_DIPR(sn, dipr) \
S WIZCHIP_READ_BUF(Sn_DIPR(sn), dipr, 4)
X#define getSn_DIPR(sn, dipr) WIZCHIP_READ_BUF(Sn_DIPR(sn), dipr, 4)
S
S/**
S * @ingroup Socket_register_access_function_W5100S
S * @brief Set @ref Sn_DPORT register
S * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
S * @param (uint16_t)dport Value to set @ref Sn_DPORT
S * @sa getSn_DPORT()
S */
S#define setSn_DPORT(sn, dport) { \
S WIZCHIP_WRITE(Sn_DPORT(sn), (uint8_t) (dport>>8)); \
S WIZCHIP_WRITE(WIZCHIP_OFFSET_INC(Sn_DPORT(sn),1), (uint8_t) dport); \
S }
X#define setSn_DPORT(sn, dport) { WIZCHIP_WRITE(Sn_DPORT(sn), (uint8_t) (dport>>8)); WIZCHIP_WRITE(WIZCHIP_OFFSET_INC(Sn_DPORT(sn),1), (uint8_t) dport); }
S
S/**
S * @ingroup Socket_register_access_function_W5100S
S * @brief Get @ref Sn_DPORT register
S * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
S * @return uint16_t. Value of @ref Sn_DPORT.
S * @sa setSn_DPORT()
S */
S#define getSn_DPORT(sn) \
S (((uint16_t)WIZCHIP_READ(Sn_DPORT(sn)) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_DPORT(sn),1)))
X#define getSn_DPORT(sn) (((uint16_t)WIZCHIP_READ(Sn_DPORT(sn)) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_DPORT(sn),1)))
S
S/**
S * @ingroup Socket_register_access_function_W5100S
S * @brief Set @ref Sn_MSSR register
S * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
S * @param (uint16_t)mss Value to set @ref Sn_MSSR
S * @sa setSn_MSSR()
S */
S#define setSn_MSSR(sn, mss) { \
S WIZCHIP_WRITE(Sn_MSSR(sn), (uint8_t)(mss>>8)); \
S WIZCHIP_WRITE(WIZCHIP_OFFSET_INC(Sn_MSSR(sn),1), (uint8_t) mss); \
S }
X#define setSn_MSSR(sn, mss) { WIZCHIP_WRITE(Sn_MSSR(sn), (uint8_t)(mss>>8)); WIZCHIP_WRITE(WIZCHIP_OFFSET_INC(Sn_MSSR(sn),1), (uint8_t) mss); }
S
S/**
S * @ingroup Socket_register_access_function_W5100S
S * @brief Get @ref Sn_MSSR register
S * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
S * @return uint16_t. Value of @ref Sn_MSSR.
S * @sa setSn_MSSR()
S */
S#define getSn_MSSR(sn) \
S (((uint16_t)WIZCHIP_READ(Sn_MSSR(sn)) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_MSSR(sn),1)))
X#define getSn_MSSR(sn) (((uint16_t)WIZCHIP_READ(Sn_MSSR(sn)) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_MSSR(sn),1)))
S
S/**
S * @ingroup Socket_register_access_function_W5100S
S * @brief Set @ref Sn_PROTO register
S * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
S * @param (uint8_t)proto Value to set \ref Sn_PROTO
S * @sa getSn_PROTO()
S */
S#define setSn_PROTO(sn, proto) \
S WIZCHIP_WRITE(Sn_PROTO(sn), proto)
X#define setSn_PROTO(sn, proto) WIZCHIP_WRITE(Sn_PROTO(sn), proto)
S
S/**
S * @ingroup Socket_register_access_function_W5100S
S * @brief Get @ref Sn_PROTO register
S * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
S * @return uint8_t. Value of @ref Sn_PROTO.
S * @sa setSn_PROTO()
S */
S#define getSn_PROTO(sn) \
S WIZCHIP_READ(Sn_PROTO(sn))
X#define getSn_PROTO(sn) WIZCHIP_READ(Sn_PROTO(sn))
S
S/**
S * @ingroup Socket_register_access_function_W5100S
S * @brief Set @ref Sn_TOS register
S * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
S * @param (uint8_t)tos Value to set @ref Sn_TOS
S * @sa getSn_TOS()
S */
S#define setSn_TOS(sn, tos) \
S WIZCHIP_WRITE(Sn_TOS(sn), tos)
X#define setSn_TOS(sn, tos) WIZCHIP_WRITE(Sn_TOS(sn), tos)
S
S/**
S * @ingroup Socket_register_access_function_W5100S
S * @brief Get @ref Sn_TOS register
S * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_ </b>.
S * @return uint8_t. Value of Sn_TOS.
S * @sa setSn_TOS()
S */
S#define getSn_TOS(sn) \
S WIZCHIP_READ(Sn_TOS(sn))
X#define getSn_TOS(sn) WIZCHIP_READ(Sn_TOS(sn))
S
S/**
S * @ingroup Socket_register_access_function_W5100S
S * @brief Set @ref Sn_TTL register
S * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_ </b>.
S * @param (uint8_t)ttl Value to set @ref Sn_TTL
S * @sa getSn_TTL()
S */
S#define setSn_TTL(sn, ttl) \
S WIZCHIP_WRITE(Sn_TTL(sn), ttl)
X#define setSn_TTL(sn, ttl) WIZCHIP_WRITE(Sn_TTL(sn), ttl)
S
S/**
S * @ingroup Socket_register_access_function_W5100S
S * @brief Get @ref Sn_TTL register
S * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_ </b>.
S * @return uint8_t. Value of @ref Sn_TTL.
S * @sa setSn_TTL()
S */
S#define getSn_TTL(sn) \
S WIZCHIP_READ(Sn_TTL(sn))
X#define getSn_TTL(sn) WIZCHIP_READ(Sn_TTL(sn))
S
S/**
S * @ingroup Socket_register_access_function_W5100S
S * @brief Set @ref Sn_RXMEM_SIZE register
S * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_ </b>.
S * @param (uint8_t)rxmemsize Value to set \ref Sn_RXMEM_SIZE
S * @sa getSn_RXMEM_SIZE()
S */
S#define setSn_RXMEM_SIZE(sn, rxmemsize) \
S WIZCHIP_WRITE(RMSR, (WIZCHIP_READ(RMSR) & ~(0x03 << (2*sn))) | (rxmemsize << (2*sn)))
X#define setSn_RXMEM_SIZE(sn, rxmemsize) WIZCHIP_WRITE(RMSR, (WIZCHIP_READ(RMSR) & ~(0x03 << (2*sn))) | (rxmemsize << (2*sn)))
S#define setSn_RXBUF_SIZE(sn,rxmemsize) setSn_RXMEM_SIZE(sn,rxmemsize)
S
S/**
S * @ingroup Socket_register_access_function_W5100S
S * @brief Get @ref Sn_RXMEM_SIZE register
S * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
S * @return uint8_t. Value of @ref Sn_RXMEM.
S * @sa setSn_RXMEM_SIZE()
S */
S#define getSn_RXMEM_SIZE(sn) \
S ((WIZCHIP_READ(RMSR) & (0x03 << (2*sn))) >> (2*sn))
X#define getSn_RXMEM_SIZE(sn) ((WIZCHIP_READ(RMSR) & (0x03 << (2*sn))) >> (2*sn))
S#define getSn_RXBUF_SIZE(sn) getSn_RXMEM_SIZE(sn)
S
S/**
S * @ingroup Socket_register_access_function_W5100S
S * @brief Set @ref Sn_TXMEM_SIZE register
S * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
S * @param (uint8_t)txmemsize Value to set \ref Sn_TXMEM_SIZE
S * @sa getSn_TXMEM_SIZE()
S */
S#define setSn_TXMEM_SIZE(sn, txmemsize) \
S WIZCHIP_WRITE(TMSR, (WIZCHIP_READ(TMSR) & ~(0x03 << (2*sn))) | (txmemsize << (2*sn)))
X#define setSn_TXMEM_SIZE(sn, txmemsize) WIZCHIP_WRITE(TMSR, (WIZCHIP_READ(TMSR) & ~(0x03 << (2*sn))) | (txmemsize << (2*sn)))
S#define setSn_TXBUF_SIZE(sn, txmemsize) setSn_TXMEM_SIZE(sn,txmemsize)
S
S/**
S * @ingroup Socket_register_access_function_W5100S
S * @brief Get @ref Sn_TXMEM_SIZE register
S * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
S * @return uint8_t. Value of @ref Sn_TXMEM_SIZE.
S * @sa setSn_TXMEM_SIZE()
S */
S#define getSn_TXMEM_SIZE(sn) \
S ((WIZCHIP_READ(TMSR) & (0x03 << (2*sn))) >> (2*sn))
X#define getSn_TXMEM_SIZE(sn) ((WIZCHIP_READ(TMSR) & (0x03 << (2*sn))) >> (2*sn))
S#define getSn_TXBUF_SIZE(sn) getSn_TXMEM_SIZE(sn)
S
S/**
S * @ingroup Socket_register_access_function_W5100S
S * @brief Get @ref Sn_TX_FSR register
S * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
S * @return uint16_t. Value of @ref Sn_TX_FSR.
S */
Suint16_t getSn_TX_FSR(uint8_t sn);
S
S/**
S * @ingroup Socket_register_access_function_W5100S
S * @brief Get @ref Sn_TX_RD register
S * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
S * @return uint16_t. Value of @ref Sn_TX_RD.
S */
S#define getSn_TX_RD(sn) \
S (((uint16_t)WIZCHIP_READ(Sn_TX_RD(sn)) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_TX_RD(sn),1)))
X#define getSn_TX_RD(sn) (((uint16_t)WIZCHIP_READ(Sn_TX_RD(sn)) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_TX_RD(sn),1)))
S
S/**
S * @ingroup Socket_register_access_function_W5100S
S * @brief Set @ref Sn_TX_WR register
S * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
S * @param (uint16_t)txwr Value to set @ref Sn_TX_WR
S * @sa GetSn_TX_WR()
S */
S#define setSn_TX_WR(sn, txwr) { \
S WIZCHIP_WRITE(Sn_TX_WR(sn), (uint8_t)(txwr>>8)); \
S WIZCHIP_WRITE(WIZCHIP_OFFSET_INC(Sn_TX_WR(sn),1), (uint8_t) txwr); \
S }
X#define setSn_TX_WR(sn, txwr) { WIZCHIP_WRITE(Sn_TX_WR(sn), (uint8_t)(txwr>>8)); WIZCHIP_WRITE(WIZCHIP_OFFSET_INC(Sn_TX_WR(sn),1), (uint8_t) txwr); }
S
S/**
S * @ingroup Socket_register_access_function_W5100S
S * @brief Get @ref Sn_TX_WR register
S * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
S * @return uint16_t. Value of @ref Sn_TX_WR.
S * @sa setSn_TX_WR()
S */
S#define getSn_TX_WR(sn) \
S (((uint16_t)WIZCHIP_READ(Sn_TX_WR(sn)) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_TX_WR(sn),1)))
X#define getSn_TX_WR(sn) (((uint16_t)WIZCHIP_READ(Sn_TX_WR(sn)) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_TX_WR(sn),1)))
S
S/**
S * @ingroup Socket_register_access_function_W5100S
S * @brief Get @ref Sn_RX_RSR register
S * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
S * @return uint16_t. Value of @ref Sn_RX_RSR.
S */
Suint16_t getSn_RX_RSR(uint8_t sn);
S
S/**
S * @ingroup Socket_register_access_function_W5100S
S * @brief Set @ref Sn_RX_RD register
S * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
S * @param (uint16_t)rxrd Value to set @ref Sn_RX_RD
S * @sa getSn_RX_RD()
S */
S#define setSn_RX_RD(sn, rxrd) { \
S WIZCHIP_WRITE(Sn_RX_RD(sn), (uint8_t)(rxrd>>8)); \
S WIZCHIP_WRITE(WIZCHIP_OFFSET_INC(Sn_RX_RD(sn),1), (uint8_t) rxrd); \
S }
X#define setSn_RX_RD(sn, rxrd) { WIZCHIP_WRITE(Sn_RX_RD(sn), (uint8_t)(rxrd>>8)); WIZCHIP_WRITE(WIZCHIP_OFFSET_INC(Sn_RX_RD(sn),1), (uint8_t) rxrd); }
S
S/**
S * @ingroup Socket_register_access_function_W5100S
S * @brief Get @ref Sn_RX_RD register
S * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
S * @regurn uint16_t. Value of @ref Sn_RX_RD.
S * @sa setSn_RX_RD()
S */
S#define getSn_RX_RD(sn) \
S (((uint16_t)WIZCHIP_READ(Sn_RX_RD(sn)) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_RX_RD(sn),1)))
X#define getSn_RX_RD(sn) (((uint16_t)WIZCHIP_READ(Sn_RX_RD(sn)) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_RX_RD(sn),1)))
S
S/**
S * @ingroup Socket_register_access_function_W5100S
S * @brief Set @ref Sn_RX_WR register
S * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
S * @param (uint16_t)rxwr Value to set \ref Sn_RX_WR
S * @sa getSn_RX_WR()
S */
S#define setSn_RX_WR(sn, rxwr) { \
S WIZCHIP_WRITE(Sn_RX_WR(sn), (uint8_t)(rxwr>>8)); \
S WIZCHIP_WRITE(WIZCHIP_OFFSET_INC(Sn_RX_WR(sn),1), (uint8_t) rxwr); \
S }
X#define setSn_RX_WR(sn, rxwr) { WIZCHIP_WRITE(Sn_RX_WR(sn), (uint8_t)(rxwr>>8)); WIZCHIP_WRITE(WIZCHIP_OFFSET_INC(Sn_RX_WR(sn),1), (uint8_t) rxwr); }
S
S
S/**
S * @ingroup Socket_register_access_function_W5100S
S * @brief Get @ref Sn_RX_WR register
S * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
S * @return uint16_t. Value of @ref Sn_RX_WR.
S */
S#define getSn_RX_WR(sn) \
S (((uint16_t)WIZCHIP_READ(Sn_RX_WR(sn)) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_RX_WR(sn),1)))
X#define getSn_RX_WR(sn) (((uint16_t)WIZCHIP_READ(Sn_RX_WR(sn)) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_RX_WR(sn),1)))
S
S/**
S * @ingroup Socket_register_access_function_W5100S
S * @brief Set @ref Sn_FRAGR register
S * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
S * @param (uint16_t)frag Value to set \ref Sn_FRAGR
S * @sa getSn_FRAG()
S */
S#define setSn_FRAGR(sn, fragr) { \
S WIZCHIP_WRITE(Sn_FRAGR(sn), (uint8_t)(fragr >>8)); \
S WIZCHIP_WRITE(WIZCHIP_OFFSET_INC(Sn_FRAGR(sn),1), (uint8_t) fragr); \
S }
X#define setSn_FRAGR(sn, fragr) { WIZCHIP_WRITE(Sn_FRAGR(sn), (uint8_t)(fragr >>8)); WIZCHIP_WRITE(WIZCHIP_OFFSET_INC(Sn_FRAGR(sn),1), (uint8_t) fragr); }
S
S/**
S * @ingroup Socket_register_access_function_W5100S
S * @brief Get @ref Sn_FRAGR register
S * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
S * @return uint16_t. Value of @ref Sn_FRAGR.
S * @sa setSn_FRAG()
S */
S#define getSn_FRAGR(sn) \
S (((uint16_t)WIZCHIP_READ(Sn_FRAGR(sn)) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_FRAGR(sn),1)))
X#define getSn_FRAGR(sn) (((uint16_t)WIZCHIP_READ(Sn_FRAGR(sn)) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_FRAGR(sn),1)))
S
S/**
S * @ingroup Socket_register_access_function_W5100S
S * @brief Get the max RX buffer size of socket sn
S * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
S * @return uint16_t. Max buffer size
S */
S#define getSn_RxMAX(sn) \
S ((uint16_t)(1 << getSn_RXMEM_SIZE(sn)) << 10) //getSn_RXMEM_SIZE(sn) è·å对åºSOCKETæ¥æ¶ç¼å大å°
X#define getSn_RxMAX(sn) ((uint16_t)(1 << getSn_RXMEM_SIZE(sn)) << 10)
S
S
S/**
S * @ingroup Socket_register_access_function_W5100S
S * @brief Get the max TX buffer size of socket sn
S * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
S * @return uint16_t. Max buffer size
S */
S#define getSn_TxMAX(sn) \
S ((uint16_t)(1 << getSn_TXMEM_SIZE(sn)) << 10)
X#define getSn_TxMAX(sn) ((uint16_t)(1 << getSn_TXMEM_SIZE(sn)) << 10)
S
S/**
S * @ingroup Socket_register_access_function_W5100S
S * @brief Get the mask of socket sn RX buffer.
S * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
S * @return uint16_t. Mask value
S */
S#define getSn_RxMASK(sn) \
S (getSn_RxMAX(sn) - 1)
X#define getSn_RxMASK(sn) (getSn_RxMAX(sn) - 1)
S
S/**
S * @ingroup Socket_register_access_function_W5100S
S * @brief Get the mask of socket sn TX buffer
S * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
S * @return uint16_t. Mask value
S */
S#define getSn_TxMASK(sn) \
S (getSn_TxMAX(sn) - 1)
X#define getSn_TxMASK(sn) (getSn_TxMAX(sn) - 1)
S
S
S/**
S * @ingroup Socket_register_access_function_W5100S
S * @brief Get the base address of socket sn RX buffer.
S * @param sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
S * @return uint16_t. Value of Socket n RX buffer base address.
S */
Suint32_t getSn_RxBASE(uint8_t sn);
S
S/**
S * @ingroup Socket_register_access_function_W5100S
S * @brief Get the base address of socket sn TX buffer.
S * @param sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
S * @return uint16_t. Value of Socket n TX buffer base address.
S */
Suint32_t getSn_TxBASE(uint8_t sn);
S
S/*socket register W5100S only*/
S
S#define setSn_IMR(sn,imr) \
S WIZCHIP_WRITE(Sn_IMR(sn),imr)
X#define setSn_IMR(sn,imr) WIZCHIP_WRITE(Sn_IMR(sn),imr)
S
S#define getSn_IMR(sn) \
S WIZCHIP_WRITE(Sn_IMR(sn))
X#define getSn_IMR(sn) WIZCHIP_WRITE(Sn_IMR(sn))
S
S#define setSn_MR2(sn,mr2) \
S WIZCHIP_WRITE(Sn_MR2(sn), mr2)
X#define setSn_MR2(sn,mr2) WIZCHIP_WRITE(Sn_MR2(sn), mr2)
S
S#define getSn_MR2(sn) \
S WIZCHIP_READ(Sn_MR2(sn))
X#define getSn_MR2(sn) WIZCHIP_READ(Sn_MR2(sn))
S
S#define setSn_KPALVTR(sn,kpalvtr) \
S WIZCHIP_WRITE(Sn_KPALVTR(sn), kpalvtr)
X#define setSn_KPALVTR(sn,kpalvtr) WIZCHIP_WRITE(Sn_KPALVTR(sn), kpalvtr)
S
S#define getSn_KPALVTR(sn) \
S WIZCHIP_READ(Sn_KPALVTR(sn))
X#define getSn_KPALVTR(sn) WIZCHIP_READ(Sn_KPALVTR(sn))
S
S#define getSn_TSR(sn) \
S WIZCHIP_READ(Sn_TSR(sn))
X#define getSn_TSR(sn) WIZCHIP_READ(Sn_TSR(sn))
S
S#define setSn_RTR(sn,rtr) { \
S WIZCHIP_WRITE(Sn_RTR(sn), (uint8_t)(rtr >> 8)); \
S WIZCHIP_WRITE(WIZCHIP_OFFSET_INC(Sn_RTR(sn),1), (uint8_t) rtr); \
S }
X#define setSn_RTR(sn,rtr) { WIZCHIP_WRITE(Sn_RTR(sn), (uint8_t)(rtr >> 8)); WIZCHIP_WRITE(WIZCHIP_OFFSET_INC(Sn_RTR(sn),1), (uint8_t) rtr); }
S
S#define getSn_RTR(sn) \
S (((uint16_t)WIZCHIP_READ(Sn_RTR(sn)) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_RTR(sn),1)))
X#define getSn_RTR(sn) (((uint16_t)WIZCHIP_READ(Sn_RTR(sn)) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_RTR(sn),1)))
S
S#define setSn_RCR(sn,rcr) \
S WIZCHIP_WRITE(Sn_RCR(sn),rcr)
X#define setSn_RCR(sn,rcr) WIZCHIP_WRITE(Sn_RCR(sn),rcr)
S
S#define getSn_RCR(sn) \
S WIZCHIP_READ(Sn_RCR(sn))
X#define getSn_RCR(sn) WIZCHIP_READ(Sn_RCR(sn))
S
S/////////////////////////////////////
S// Sn_TXBUF & Sn_RXBUF IO function //
S/////////////////////////////////////
S/**
S * @ingroup Basic_IO_function_W5100S
S * @brief It copies data to internal TX memory
S *
S * @details This function reads the Tx write pointer register and after that,
S * it copies the <i>wizdata(pointer buffer)</i> of the length of <i>len(variable)</i> bytes to internal TX memory
S * and updates the Tx write pointer register.
S * This function is being called by send() and sendto() function also.
S *
S * @param sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
S * @param wizdata Pointer buffer to write data
S * @param len Data length
S * @sa wiz_recv_data()
S */
Svoid wiz_send_data(uint8_t sn, uint8_t *wizdata, uint16_t len);
S
S/**
S * @ingroup Basic_IO_function_W5100S
S * @brief It copies data to your buffer from internal RX memory
S *
S * @details This function read the Rx read pointer register and after that,
S * it copies the received data from internal RX memory
S * to <i>wizdata(pointer variable)</i> of the length of <i>len(variable)</i> bytes.
S * This function is being called by recv() also.
S *
S * @param sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
S * @param wizdata Pointer buffer to read data
S * @param len Data length
S * @sa wiz_send_data()
S */
Svoid wiz_recv_data(uint8_t sn, uint8_t *wizdata, uint16_t len);
S
S/**
S * @ingroup Basic_IO_function_W5100S
S * @brief It discard the received data in RX memory.
S * @details It discards the data of the length of <i>len(variable)</i> bytes in internal RX memory.
S * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
S * @param len Data length
S */
Svoid wiz_recv_ignore(uint8_t sn, uint16_t len);
S
S//todo comment nedded
Svoid wiz_mdio_write(uint8_t PHYMDIO_regadr, uint16_t var);
S
Suint16_t wiz_mdio_read(uint8_t PHYMDIO_regadr);
S
S// add code 2020-2-1
Sextern uint8_t wizchip_spi_readbyte(void); // add code 2020-2-1
Sextern void wizchip_spi_writebyte(uint8_t wb); // add code 2020-2-1
S/// @cond DOXY_APPLY_CODE
S
S/// @endcond
S
N#endif //_W5100_H_
N
N
L 89 "..\..\User\W5100S\wizchip_conf.h" 2
N
N
N#ifndef _WIZCHIP_IO_MODE_
S #error "Undefined _WIZCHIP_IO_MODE_. You should define it !!!"
N#endif
N
N/**
N * @brief Define I/O base address when BUS IF mode.
N * @todo Should re-define it to fit your system when BUS IF Mode (@ref \_WIZCHIP_IO_MODE_BUS_,
N * @ref \_WIZCHIP_IO_MODE_BUS_DIR_, @ref \_WIZCHIP_IO_MODE_BUS_INDIR_). \n\n
N * ex> <code> #define \_WIZCHIP_IO_BASE_ 0x00008000 </code>
N */
N#define _WIZCHIP_IO_BASE_ 0x60000000 // for 5100S IND
N//#define _WIZCHIP_IO_BASE_ 0x00000000 // for 5100S SPI
N
N//M20150401 : Typing Error
N#if _WIZCHIP_IO_MODE_ & _WIZCHIP_IO_MODE_BUS_
X#if 0x0200 & 0x0100
S #ifndef _WIZCHIP_IO_BASE_
S #error "You should be define _WIZCHIP_IO_BASE to fit your system memory map."
S #endif
N#endif
N
N
N#define _WIZCHIP_SOCK_NUM_ 4 ///< The count of independant socket of @b WIZCHIP
N
N
N
N/********************************************************
N* WIZCHIP BASIC IF functions for SPI, SDIO, I2C , ETC.
N*********************************************************/
N/**
N * @ingroup DATA_TYPE
N * @brief The set of callback functions for W5500:@ref WIZCHIP_IO_Functions W5200:@ref WIZCHIP_IO_Functions_W5200
N */
Ntypedef struct __WIZCHIP
N{
N uint16_t if_mode; ///< host interface mode
N uint8_t id[8]; ///< @b WIZCHIP ID such as @b 5100, @b 5200, @b 5500, and so on.
N /**
N * The set of critical section callback func.
N */
N struct _CRIS
N {
N void (*_enter) (void); ///< crtical section enter
N void (*_exit) (void); ///< critial section exit
N }CRIS;
N /**
N * The set of @ref \_WIZCHIP_ select control callback func.
N */
N struct _CS
N {
N void (*_select) (void); ///< @ref \_WIZCHIP_ selected
N void (*_deselect)(void); ///< @ref \_WIZCHIP_ deselected
N }CS;
N /**
N * The set of interface IO callback func.
N */
N union _IF
N {
N /**
N * For BUS interface IO
N */
N //M20156501 : Modify the function name for integrating with W5300
N
N struct
N {
N iodata_t (*_read_data) (uint32_t AddrSel);
N void (*_write_data) (uint32_t AddrSel, iodata_t wb);
N }BUS;
N
N /**
N * For SPI interface IO
N */
N struct
N {
N uint8_t (*_read_byte) (void);
N void (*_write_byte) (uint8_t wb);
N void (*_read_burst) (uint8_t* pBuf, uint16_t len);
N void (*_write_burst) (uint8_t* pBuf, uint16_t len);
N }SPI;
N }IF;
N}_WIZCHIP;
N
Nextern _WIZCHIP WIZCHIP;
N
N/**
N * @ingroup DATA_TYPE
N * WIZCHIP control type enumration used in @ref ctlwizchip().
N */
Ntypedef enum
N{
N CW_RESET_WIZCHIP, ///< Resets WIZCHIP by softly
N CW_INIT_WIZCHIP, ///< Initializes to WIZCHIP with SOCKET buffer size 2 or 1 dimension array typed uint8_t.
N CW_GET_INTERRUPT, ///< Get Interrupt status of WIZCHIP
N CW_CLR_INTERRUPT, ///< Clears interrupt
N CW_SET_INTRMASK, ///< Masks interrupt
N CW_GET_INTRMASK, ///< Get interrupt mask
N CW_SET_INTRTIME, ///< Set interval time between the current and next interrupt.
N CW_GET_INTRTIME, ///< Set interval time between the current and next interrupt.
N CW_GET_ID, ///< Gets WIZCHIP name.
N CW_RESET_PHY, ///< Resets internal PHY. Valid Only W5500
N CW_SET_PHYCONF, ///< When PHY configured by internal register, PHY operation mode (Manual/Auto, 10/100, Half/Full). Valid Only W5000
N CW_GET_PHYCONF, ///< Get PHY operation mode in internal register. Valid Only W5500
N CW_GET_PHYSTATUS, ///< Get real PHY status on operating. Valid Only W5500
N CW_SET_PHYPOWMODE, ///< Set PHY power mode as normal and down when PHYSTATUS.OPMD == 1. Valid Only W5500
N CW_GET_PHYPOWMODE, ///< Get PHY Power mode as down or normal, Valid Only W5100, W5200
N CW_GET_PHYLINK ///< Get PHY Link status, Valid Only W5100, W5200
N}ctlwizchip_type;
N
N/**
N * @ingroup DATA_TYPE
N * Network control type enumration used in @ref ctlnetwork().
N */
Ntypedef enum
N{
N CN_SET_NETINFO, ///< Set Network with @ref wiz_NetInfo
N CN_GET_NETINFO, ///< Get Network with @ref wiz_NetInfo
N CN_SET_NETMODE, ///< Set network mode as WOL, PPPoE, Ping Block, and Force ARP mode
N CN_GET_NETMODE, ///< Get network mode as WOL, PPPoE, Ping Block, and Force ARP mode
N CN_SET_TIMEOUT, ///< Set network timeout as retry count and time.
N CN_GET_TIMEOUT, ///< Get network timeout as retry count and time.
N}ctlnetwork_type;
N
N/**
N * @ingroup DATA_TYPE
N * Interrupt kind when CW_SET_INTRRUPT, CW_GET_INTERRUPT, CW_SET_INTRMASK
N * and CW_GET_INTRMASK is used in @ref ctlnetwork().
N * It can be used with OR operation.
N */
Ntypedef enum
N{
N IK_PPPOE_TERMINATED = (1 << 5), ///< PPPoE Disconnected
N IK_DEST_UNREACH = (1 << 6), ///< Destination IP & Port Unreachable, No use in W5200
N IK_IP_CONFLICT = (1 << 7), ///< IP conflict occurred
N IK_SOCK_0 = (1 << 8), ///< Socket 0 interrupt
N IK_SOCK_1 = (1 << 9), ///< Socket 1 interrupt
N IK_SOCK_2 = (1 << 10), ///< Socket 2 interrupt
N IK_SOCK_3 = (1 << 11), ///< Socket 3 interrupt
N IK_SOCK_ALL = (0x0F << 8) ///< All Socket interrupt
N
N}intr_kind;
N
N#define PHY_CONFBY_HW 0 ///< Configured PHY operation mode by HW pin
N#define PHY_CONFBY_SW 1 ///< Configured PHY operation mode by SW register
N#define PHY_MODE_MANUAL 0 ///< Configured PHY operation mode with user setting.
N#define PHY_MODE_AUTONEGO 1 ///< Configured PHY operation mode with auto-negotiation
N#define PHY_SPEED_10 0 ///< Link Speed 10
N#define PHY_SPEED_100 1 ///< Link Speed 100
N#define PHY_DUPLEX_HALF 0 ///< Link Half-Duplex
N#define PHY_DUPLEX_FULL 1 ///< Link Full-Duplex
N#define PHY_LINK_OFF 0 ///< Link Off
N#define PHY_LINK_ON 1 ///< Link On
N#define PHY_POWER_NORM 0 ///< PHY power normal mode
N#define PHY_POWER_DOWN 1 ///< PHY power down mode
N
N/**
N * @ingroup DATA_TYPE
N * It configures PHY configuration when CW_SET PHYCONF or CW_GET_PHYCONF in W5500,
N * and it indicates the real PHY status configured by HW or SW in all WIZCHIP. \n
N * Valid only in W5500.
N */
Ntypedef struct wiz_PhyConf_t
N{
N uint8_t by; ///< set by @ref PHY_CONFBY_HW or @ref PHY_CONFBY_SW
N uint8_t mode; ///< set by @ref PHY_MODE_MANUAL or @ref PHY_MODE_AUTONEGO
N uint8_t speed; ///< set by @ref PHY_SPEED_10 or @ref PHY_SPEED_100
N uint8_t duplex; ///< set by @ref PHY_DUPLEX_HALF @ref PHY_DUPLEX_FULL
N
N}wiz_PhyConf;
N
N
N/**
N * @ingroup DATA_TYPE
N * It used in setting dhcp_mode of @ref wiz_NetInfo.
N */
Ntypedef enum
N{
N NETINFO_STATIC = 1, ///< Static IP configuration by manually.
N NETINFO_DHCP ///< Dynamic IP configruation from a DHCP sever
N}dhcp_mode;
N
N/**
N * @ingroup DATA_TYPE
N * Network Information for WIZCHIP
N */
Ntypedef struct wiz_NetInfo_t
N{
N uint8_t mac[6]; ///< Source Mac Address
N uint8_t ip[4]; ///< Source IP Address
N uint8_t sn[4]; ///< Subnet Mask
N uint8_t gw[4]; ///< Gateway IP Address
N uint8_t dns[4]; ///< DNS server IP Address
N dhcp_mode dhcp; ///< 1 - Static, 2 - DHCP
N}wiz_NetInfo;
N
N/**
N * @ingroup DATA_TYPE
N * Network mode
N */
Ntypedef enum
N{
N NM_WAKEONLAN = (1<<5), ///< Wake On Lan
N NM_PINGBLOCK = (1<<4), ///< Block ping-request
N NM_PPPOE = (1<<3), ///< PPPoE mode
N}netmode_type;
N
N/**
N * @ingroup DATA_TYPE
N * Used in CN_SET_TIMEOUT or CN_GET_TIMEOUT of @ref ctlwizchip() for timeout configruation.
N */
Ntypedef struct wiz_NetTimeout_t
N{
N uint8_t retry_cnt; ///< retry count
N uint16_t time_100us; ///< time unit 100us
N}wiz_NetTimeout;
N
N/**
N *@brief Registers call back function for critical section of I/O functions such as
N *\ref WIZCHIP_READ, @ref WIZCHIP_WRITE, @ref WIZCHIP_READ_BUF and @ref WIZCHIP_WRITE_BUF.
N *@param cris_en : callback function for critical section enter.
N *@param cris_ex : callback function for critical section exit.
N *@todo Describe @ref WIZCHIP_CRITICAL_ENTER and @ref WIZCHIP_CRITICAL_EXIT marco or register your functions.
N *@note If you do not describe or register, default functions(@ref wizchip_cris_enter & @ref wizchip_cris_exit) is called.
N */
Nvoid reg_wizchip_cris_cbfunc(void(*cris_en)(void), void(*cris_ex)(void));
N
N
N/**
N *@brief Registers call back function for WIZCHIP select & deselect.
N *@param cs_sel : callback function for WIZCHIP select
N *@param cs_desel : callback fucntion for WIZCHIP deselect
N *@todo Describe @ref wizchip_cs_select and @ref wizchip_cs_deselect function or register your functions.
N *@note If you do not describe or register, null function is called.
N */
Nvoid reg_wizchip_cs_cbfunc(void(*cs_sel)(void), void(*cs_desel)(void));
N
N/**
N *@brief Registers call back function for bus interface.
N *@param bus_rb : callback function to read byte data using system bus
N *@param bus_wb : callback function to write byte data using system bus
N *@todo Describe @ref wizchip_bus_readbyte and @ref wizchip_bus_writebyte function
N *or register your functions.
N *@note If you do not describe or register, null function is called.
N */
N//M20150601 : For integrating with W5300
Nvoid reg_wizchip_bus_cbfunc(iodata_t (*bus_rb)(uint32_t addr), void (*bus_wb)(uint32_t addr, iodata_t wb));
N
N/**
N *@brief Registers call back function for SPI interface.
N *@param spi_rb : callback function to read byte using SPI
N *@param spi_wb : callback function to write byte using SPI
N *@todo Describe \ref wizchip_spi_readbyte and \ref wizchip_spi_writebyte function
N *or register your functions.
N *@note If you do not describe or register, null function is called.
N */
Nvoid reg_wizchip_spi_cbfunc(uint8_t (*spi_rb)(void), void (*spi_wb)(uint8_t wb));
N
N/**
N *@brief Registers call back function for SPI interface.
N *@param spi_rb : callback function to burst read using SPI
N *@param spi_wb : callback function to burst write using SPI
N *@todo Describe \ref wizchip_spi_readbyte and \ref wizchip_spi_writebyte function
N *or register your functions.
N *@note If you do not describe or register, null function is called.
N */
Nvoid reg_wizchip_spiburst_cbfunc(void (*spi_rb)(uint8_t* pBuf, uint16_t len), void (*spi_wb)(uint8_t* pBuf, uint16_t len));
N
N/**
N * @ingroup extra_functions
N * @brief Controls to the WIZCHIP.
N * @details Resets WIZCHIP & internal PHY, Configures PHY mode, Monitor PHY(Link,Speed,Half/Full/Auto),
N * controls interrupt & mask and so on.
N * @param cwtype : Decides to the control type
N * @param arg : arg type is dependent on cwtype.
N * @return 0 : Success \n
N * -1 : Fail because of invalid \ref ctlwizchip_type or unsupported \ref ctlwizchip_type in WIZCHIP
N */
Nint8_t ctlwizchip(ctlwizchip_type cwtype, void* arg);
N
N/**
N * @ingroup extra_functions
N * @brief Controls to network.
N * @details Controls to network environment, mode, timeout and so on.
N * @param cntype : Input. Decides to the control type
N * @param arg : Inout. arg type is dependent on cntype.
N * @return -1 : Fail because of invalid \ref ctlnetwork_type or unsupported \ref ctlnetwork_type in WIZCHIP \n
N * 0 : Success
N */
Nint8_t ctlnetwork(ctlnetwork_type cntype, void* arg);
N
N
N/*
N * The following functions are implemented for internal use.
N * but You can call these functions for code size reduction instead of ctlwizchip() and ctlnetwork().
N */
N
N/**
N * @ingroup extra_functions
N * @brief Reset WIZCHIP by softly.
N */
Nvoid wizchip_sw_reset(void);
N
N/**
N * @ingroup extra_functions
N * @brief Initializes WIZCHIP with socket buffer size
N * @param txsize Socket tx buffer sizes. If null, initialized the default size 2KB.
N * @param rxsize Socket rx buffer sizes. If null, initialized the default size 2KB.
N * @return 0 : succcess \n
N * -1 : fail. Invalid buffer size
N */
Nint8_t wizchip_init(uint8_t* txsize, uint8_t* rxsize);
N
N/**
N * @ingroup extra_functions
N * @brief Clear Interrupt of WIZCHIP.
N * @param intr : @ref intr_kind value operated OR. It can type-cast to uint16_t.
N */
Nvoid wizchip_clrinterrupt(intr_kind intr);
N
N/**
N * @ingroup extra_functions
N * @brief Get Interrupt of WIZCHIP.
N * @return @ref intr_kind value operated OR. It can type-cast to uint16_t.
N */
Nintr_kind wizchip_getinterrupt(void);
N
N/**
N * @ingroup extra_functions
N * @brief Mask or Unmask Interrupt of WIZCHIP.
N * @param intr : @ref intr_kind value operated OR. It can type-cast to uint16_t.
N */
Nvoid wizchip_setinterruptmask(intr_kind intr);
N
N/**
N * @ingroup extra_functions
N * @brief Get Interrupt mask of WIZCHIP.
N * @return : The operated OR vaule of @ref intr_kind. It can type-cast to uint16_t.
N */
Nintr_kind wizchip_getinterruptmask(void);
N
N
Nint8_t wizphy_getphylink(void); ///< get the link status of phy in WIZCHIP. No use in W5100
Nint8_t wizphy_getphypmode(void); ///< get the power mode of PHY in WIZCHIP. No use in W5100
N
N
N
N void wizphy_reset(void); ///< Reset phy. Vailid only in W5500
N/**
N * @ingroup extra_functions
N * @brief Set the phy information for WIZCHIP without power mode
N * @param phyconf : @ref wiz_PhyConf
N */
N void wizphy_setphyconf(wiz_PhyConf* phyconf);
N /**
N * @ingroup extra_functions
N * @brief Get phy configuration information.
N * @param phyconf : @ref wiz_PhyConf
N */
N void wizphy_getphyconf(wiz_PhyConf* phyconf);
N /**
N * @ingroup extra_functions
N * @brief Get phy status.
N * @param phyconf : @ref wiz_PhyConf
N */
N void wizphy_getphystat(wiz_PhyConf* phyconf);
N /**
N * @ingroup extra_functions
N * @brief set the power mode of phy inside WIZCHIP. Refer to @ref PHYCFGR in W5500, @ref PHYSTATUS in W5200
N * @param pmode Settig value of power down mode.
N */
N int8_t wizphy_setphypmode(uint8_t pmode);
N
N
N/**
N* @ingroup extra_functions
N * @brief Set the network information for WIZCHIP
N * @param pnetinfo : @ref wizNetInfo
N */
Nvoid wizchip_setnetinfo(wiz_NetInfo* pnetinfo);
N
N/**
N * @ingroup extra_functions
N * @brief Get the network information for WIZCHIP
N * @param pnetinfo : @ref wizNetInfo
N */
Nvoid wizchip_getnetinfo(wiz_NetInfo* pnetinfo);
N
N/**
N * @ingroup extra_functions
N * @brief Set the network mode such WOL, PPPoE, Ping Block, and etc.
N * @param pnetinfo Value of network mode. Refer to @ref netmode_type.
N */
Nint8_t wizchip_setnetmode(netmode_type netmode);
N
N/**
N * @ingroup extra_functions
N * @brief Get the network mode such WOL, PPPoE, Ping Block, and etc.
N * @return Value of network mode. Refer to @ref netmode_type.
N */
Nnetmode_type wizchip_getnetmode(void);
N
N/**
N * @ingroup extra_functions
N * @brief Set retry time value(@ref _RTR_) and retry count(@ref _RCR_).
N * @details @ref _RTR_ configures the retransmission timeout period and @ref _RCR_ configures the number of time of retransmission.
N * @param nettime @ref _RTR_ value and @ref _RCR_ value. Refer to @ref wiz_NetTimeout.
N */
Nvoid wizchip_settimeout(wiz_NetTimeout* nettime);
N
N/**
N * @ingroup extra_functions
N * @brief Get retry time value(@ref _RTR_) and retry count(@ref _RCR_).
N * @details @ref _RTR_ configures the retransmission timeout period and @ref _RCR_ configures the number of time of retransmission.
N * @param nettime @ref _RTR_ value and @ref _RCR_ value. Refer to @ref wiz_NetTimeout.
N */
Nvoid wizchip_gettimeout(wiz_NetTimeout* nettime);
N
N#endif // _WIZCHIP_CONF_H_
L 45 "..\..\User\W5100S\w5100s.h" 2
N
N#define _WIZCHIP_SN_BASE_ (0x0400)
N#define _WIZCHIP_SN_SIZE_ (0x0100)
N#define _WIZCHIP_IO_TXBUF_ (0x4000) /* Internal Tx buffer address of the iinchip */
N#define _WIZCHIP_IO_RXBUF_ (0x6000) /* Internal Rx buffer address of the iinchip */
N
N
N#define WIZCHIP_CREG_BLOCK 0x00 ///< Common register block
N#define WIZCHIP_SREG_BLOCK(N) (_WIZCHIP_SN_BASE_+ _WIZCHIP_SN_SIZE_*N) ///< Socket N register block
N#define WIZCHIP_OFFSET_INC(ADDR, N) (ADDR + N) ///< Increase offset address
N
N#if (_WIZCHIP_IO_MODE_ == _WIZCHIP_IO_MODE_BUS_INDIR_)
X#if (0x0200 == (0x0100 + 2))
S #define IDM_OR ((_WIZCHIP_IO_BASE + 0x0000))
S #define IDM_AR0 ((_WIZCHIP_IO_BASE_ + 0x0001))
S #define IDM_AR1 ((_WIZCHIP_IO_BASE_ + 0x0002))
S #define IDM_DR ((_WIZCHIP_IO_BASE_ + 0x0003))
S #define _W5100S_IO_BASE_ 0x0000
N#elif (_WIZCHIP_IO_MODE_ & _WIZCHIP_IO_MODE_SPI_)
X#elif (0x0200 & 0x0200)
N #define _W5100S_IO_BASE_ 0x0000
N#endif
N
N///////////////////////////////////////
N// Definition For Legacy Chip Driver //
N///////////////////////////////////////
N#define IINCHIP_READ(ADDR) WIZCHIP_READ(ADDR) ///< The defined for legacy chip driver
N#define IINCHIP_WRITE(ADDR,VAL) WIZCHIP_WRITE(ADDR,VAL) ///< The defined for legacy chip driver
N#define IINCHIP_READ_BUF(ADDR,BUF,LEN) WIZCHIP_READ_BUF(ADDR,BUF,LEN) ///< The defined for legacy chip driver
N#define IINCHIP_WRITE_BUF(ADDR,BUF,LEN) WIZCHIP_WRITE(ADDR,BUF,LEN) ///< The defined for legacy chip driver
N
N
N//----------- defgroup --------------------------------
N
N/**
N * @defgroup W5100 W5100
N * @brief WHIZCHIP register defines and I/O functions of @b W5100.
N *
N * - @ref WIZCHIP_register_W5100 : @ref Common_register_group_W5100S and @ref Socket_register_group_W5100S
N * - @ref WIZCHIP_IO_Functions_W5100 : @ref Basic_IO_function_W5100S, @ref Common_register_access_function_W5100S and @ref Socket_register_group_W5100S
N */
N
N /**
N * @defgroup WIZCHIP_register_W5100 WIZCHIP register
N * @ingroup W5100
N * @brief WIZCHIP register defines register group of <b> W5100 </b>.
N *
N * - \ref Common_register_group_W5100S : Common register group W5100
N * - \ref Socket_register_group_W5100S : \c SOCKET n register group W5100
N */
N
N
N/**
N * @defgroup WIZCHIP_IO_Functions_W5100 WIZCHIP I/O functions
N * @ingroup W5100
N * @brief This supports the basic I/O functions for \ref WIZCHIP_register_W5100.
N *
N * - <b> Basic I/O function </b> \n
N * WIZCHIP_READ(), WIZCHIP_WRITE(), WIZCHIP_READ_BUF(), WIZCHIP_WRITE_BUF() \n\n
N *
N * - \ref Common_register_group_W5100S <b>access functions</b> \n
N * -# @b Mode \n
N * getMR(), setMR()
N * -# @b Interrupt \n
N * getIR(), setIR(), getIMR(), setIMR(),
N * -# <b> Network Information </b> \n
N * getSHAR(), setSHAR(), getGAR(), setGAR(), getSUBR(), setSUBR(), getSIPR(), setSIPR()
N * -# @b Retransmission \n
N * getRCR(), setRCR(), getRTR(), setRTR()
N * -# @b PPPoE \n
N * getPTIMER(), setPTIMER(), getPMAGIC(), getPMAGIC()
N *
N * - \ref Socket_register_group_W5100S <b>access functions</b> \n
N * -# <b> SOCKET control</b> \n
N * getSn_MR(), setSn_MR(), getSn_CR(), setSn_CR(), getSn_IR(), setSn_IR()
N * -# <b> SOCKET information</b> \n
N * getSn_SR(), getSn_DHAR(), setSn_DHAR(), getSn_PORT(), setSn_PORT(), getSn_DIPR(), setSn_DIPR(), getSn_DPORT(), setSn_DPORT()
N * getSn_MSSR(), setSn_MSSR()
N * -# <b> SOCKET communication </b> \n
N * getSn_RXMEM_SIZE(), setSn_RXMEM_SIZE(), getSn_TXMEM_SIZE(), setSn_TXMEM_SIZE() \n
N * getSn_TX_RD(), getSn_TX_WR(), setSn_TX_WR() \n
N * getSn_RX_RD(), setSn_RX_RD(), getSn_RX_WR() \n
N * getSn_TX_FSR(), getSn_RX_RSR()
N * -# <b> IP header field </b> \n
N * getSn_FRAG(), setSn_FRAG(), getSn_TOS(), setSn_TOS() \n
N * getSn_TTL(), setSn_TTL()
N */
N
N/**
N * @defgroup Common_register_group_W5100S Common register
N * @ingroup WIZCHIP_register_W5100
N * @brief Common register group\n
N * It set the basic for the networking\n
N * It set the configuration such as interrupt, network information, ICMP, etc.
N * @details
N * @sa MR : Mode register.
N * @sa GAR, SUBR, SHAR, SIPR
N * @sa IR, Sn_IR, _IMR_ : Interrupt.
N * @sa _RTR_, _RCR_ : Data retransmission.
N * @sa PTIMER, PMAGIC : PPPoE.
N */
N
N
N /**
N * @defgroup Socket_register_group_W5100S Socket register
N * @ingroup WIZCHIP_register_W5100
N * @brief Socket register group\n
N * Socket register configures and control SOCKETn which is necessary to data communication.
N * @details
N * @sa Sn_MR, Sn_CR, Sn_IR : SOCKETn Control
N * @sa Sn_SR, Sn_PORT, Sn_DHAR, Sn_DIPR, Sn_DPORT : SOCKETn Information
N * @sa Sn_MSSR, Sn_TOS, Sn_TTL, Sn_FRAGR : Internet protocol.
N * @sa Sn_RXMEM_SIZE, Sn_TXMEM_SIZE, Sn_TX_FSR, Sn_TX_RD, Sn_TX_WR, Sn_RX_RSR, Sn_RX_RD, Sn_RX_WR : Data communication
N */
N
N /**
N * @defgroup Basic_IO_function_W5100S Basic I/O function
N * @ingroup WIZCHIP_IO_Functions_W5100
N * @brief These are basic input/output functions to read values from register or write values to register.
N */
N
N/**
N * @defgroup Common_register_access_function_W5100S Common register access functions
N * @ingroup WIZCHIP_IO_Functions_W5100
N * @brief These are functions to access <b>common registers</b>.
N */
N
N/**
N * @defgroup Socket_register_access_function_W5100S Socket register access functions
N * @ingroup WIZCHIP_IO_Functions_W5100
N * @brief These are functions to access <b>socket registers</b>.
N */
N
N //-----------------------------------------------------------------------------------
N
N//----------------------------- W5100 Common Registers IOMAP -----------------------------
N/**
N * @ingroup Common_register_group_W5100S
N * @brief Mode Register address(R/W)\n
N * \ref MR is used for S/W reset, ping block mode, PPPoE mode and etc.
N * @details Each bit of \ref MR defined as follows.
N * <table>
N * <tr> <td>7</td> <td>6</td> <td>5</td> <td>4</td> <td>3</td> <td>2</td> <td>1</td> <td>0</td> </tr>
N * <tr> <td>RST</td> <td>Reserved</td> <td>WOL</td> <td>PB</td> <td>PPPoE</td> <td>Reserved</td> <td>AI</td> <td>IND</td> </tr>
N * </table>
N * - \ref MR_RST : Reset
N * - \ref MR_PB : Ping block
N * - \ref MR_PPPOE : PPPoE mode
N * - \ref MR_AI : Address Auto-Increment in Indirect Bus Interface
N * - \ref MR_IND : Indirect Bus Interface mode
N */
N#if _WIZCHIP_IO_MODE_ == _WIZCHIP_IO_MODE_BUS_INDIR_
X#if 0x0200 == (0x0100 + 2)
S #define MR (_WIZCHIP_IO_BASE_ + (0x0000)) // Mode
N#else
N #define MR (_W5100S_IO_BASE_ + (0x0000)) // Mode
N#endif
N
N/**
N * @ingroup Common_register_group_W5100S
N * @brief Gateway IP Register address(R/W)
N * @details \ref GAR configures the default gateway address.
N */
N#define GAR (_W5100S_IO_BASE_ + (0x0001)) // GW Address
N
N/**
N * @ingroup Common_register_group_W5100S
N * @brief Subnet mask Register address(R/W)
N * @details \ref SUBR configures the subnet mask address.
N */
N#define SUBR (_W5100S_IO_BASE_ + (0x0005)) // SN Mask Address
N
N/**
N * @ingroup Common_register_group_W5100S
N * @brief Source MAC Register address(R/W)
N * @details \ref SHAR configures the source hardware address.
N */
N#define SHAR (_W5100S_IO_BASE_ + (0x0009)) // Source Hardware Address
N
N/**
N * @ingroup Common_register_group_W5100S
N * @brief Source IP Register address(R/W)
N * @details \ref SIPR configures the source IP address.
N */
N#define SIPR (_W5100S_IO_BASE_ + (0x000F)) // Source IP Address
N
N// Reserved (_W5100S_IO_BASE_ + (0x0013))
N// Reserved (_W5100S_IO_BASE_ + (0x0014))
N
N/**
N * @ingroup Common_register_group_W5100S
N * @brief Interrupt Register(R/W)
N * @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.
N * If \ref IR is not equal to x00 INTn PIN is asserted to low until it is x00\n\n
N * Each bit of \ref IR defined as follows.
N * <table>
N * <tr> <td>7</td> <td>6</td> <td>5</td> <td>4</td> <td>3</td> <td>2</td> <td>1</td> <td>0</td> </tr>
N * <tr> <td>CONFLICT</td> <td>UNREACH</td> <td>PPPoE</td> <td>Reserved</td> <td>S3_INT</td> <td>S2_INT</td> <td>S1_INT</td> <td>S0_INT</td> </tr>
N * </table>
N * - \ref IR_CONFLICT : IP conflict
N * - \ref IR_UNREACH : Destination unreachable
N * - \ref IR_PPPoE : PPPoE connection close
N * - \ref IR_SOCK(3) : SOCKET 3 Interrupt
N * - \ref IR_SOCK(2) : SOCKET 2 Interrupt
N * - \ref IR_SOCK(1) : SOCKET 1 Interrupt
N * - \ref IR_SOCK(0) : SOCKET 0 Interrupt
N */
N#define IR (_W5100S_IO_BASE_ + (0x0015)) // Interrupt
N
N/**
N * @ingroup Common_register_group_W5100S
N * @brief Socket Interrupt Mask Register(R/W)
N * @details Each bit of \ref _IMR_ corresponds to each bit of \ref IR.
N * When a bit of \ref _IMR_ is and the corresponding bit of \ref IR is set, Interrupt will be issued.
N */
N#define _IMR_ (_W5100S_IO_BASE_ + (0x0016)) // Socket Interrupt Mask
N
N/**
N * @ingroup Common_register_group_W5100S
N * @brief Timeout register address( 1 is 100us )(R/W)
N * @details \ref _RTR_ configures the retransmission timeout period. The unit of timeout period is 100us and the default of \ref _RTR_ is x07D0or 000
N * And so the default timeout period is 200ms(100us X 2000). During the time configured by \ref _RTR_, W5100 waits for the peer response
N * to the packet that is transmitted by \ref Sn_CR (CONNECT, DISCON, CLOSE, SEND, SEND_MAC, SEND_KEEP command).
N * If the peer does not respond within the \ref _RTR_ time, W5100 retransmits the packet or issues timeout.
N */
N#define _RTR_ (_W5100S_IO_BASE_ + (0x0017)) // Retry Time
N
N/**
N * @ingroup Common_register_group_W5100S
N * @brief Retry count register(R/W)
N * @details \ref _RCR_ configures the number of time of retransmission.
N * When retransmission occurs as many as ref _RCR_+1 Timeout interrupt is issued (\ref Sn_IR_TIMEOUT = '1').
N */
N#define _RCR_ (_W5100S_IO_BASE_ + (0x0019)) // Retry Count
N#define RMSR (_W5100S_IO_BASE_ + (0x001A)) // Receicve Memory Size
N#define TMSR (_W5100S_IO_BASE_ + (0x001B)) // Trnasmit Memory Size
N
N
N/**
N * @ingroup Common_register_group_W5100S
N * @brief PPP LCP Request Timer register in PPPoE mode(R)
N * @details \ref PATR notifies authentication method that has been agreed at the connection with
N * PPPoE Server. W5100 supports two types of Authentication method - PAP and CHAP.
N */
N#define PATR (_W5100S_IO_BASE_ + (0x001C))
N
N/*
N * @ingroup Common_register_group_W5100S
N * @brief IR2
N * @details \reg
N */
N#define IR2 (_W5100S_IO_BASE_ + (0x0020))
N
N/*
N * @ingroup Common_register_group_W5100S
N * @brief IMR2
N * @details \reg
N */
N#define IMR2 (_W5100S_IO_BASE_ + (0x0021))
N
N
N/**
N * @ingroup Common_register_group_W5100S
N * @brief PPP LCP Request Timer register in PPPoE mode(R)
N * @details \ref PTIMER configures the time for sending LCP echo request. The unit of time is 25ms.
N */
N#define PTIMER (_W5100S_IO_BASE_ + (0x0028)) // PPP LCP RequestTimer
N
N/**
N * @ingroup Common_register_group_W5100S
N * @brief PPP LCP Magic number register in PPPoE mode(R)
N * @details \ref PMAGIC configures the 4bytes magic number to be used in LCP negotiation.
N */
N#define PMAGIC (_W5100S_IO_BASE_ + (0x0029)) // PPP LCP Magic number
N
N#define UIPR (_W5100S_IO_BASE_ + (0x002A))
N
N#define UPORTR (_W5100S_IO_BASE_ + (0x002E))
N
N/* register for W5100S only */
N
N/*------------------------------------------ Common registers ------------------------------------------*/
N
N/*
N * @ingroup Common_register_group_W5100S
N * @brief MR2
N * @details \reg
N */
N#define MR2 (_W5100S_IO_BASE_ + (0x0030))
N
N
N/*
N * @ingroup Common_register_group_W5100S
N * @brief MR2
N * @details \reg
N */
N#define PHAR (_W5100S_IO_BASE_ + (0x0032))
N
N/*
N * @ingroup Common_register_group_W5100S
N * @brief MR2
N * @details \reg
N */
N#define PSIDR (_W5100S_IO_BASE_ + (0x0038))
N
N/*
N * @ingroup Common_register_group_W5100S
N * @brief PMRUR
N * @details \reg
N */
N#define PMRUR (_W5100S_IO_BASE_ + (0x003A))
N
N
N/*------------------------------------------ PHY registers ------------------------------------------*/
N
N/*
N * @ingroup Common_register_group_W5100S
N * @brief PHYSR0
N * @details \reg
N */
N#define PHYSR (_W5100S_IO_BASE_ + (0x003C))
N
N/*
N * @ingroup Common_register_group_W5100S
N * @brief PHYSR1
N * @details \reg
N */
N#define PHYSR1 (_W5100S_IO_BASE_ + (0x003D))
N
N/*
N * @ingroup Common_register_group_W5100S
N * @brief PHYAR
N * @details \reg
N */
N#define PHYAR (_W5100S_IO_BASE_ + (0x003E))
N
N/*
N * @ingroup Common_register_group_W5100S
N * @brief PHYRR
N * @details \reg
N */
N#define PHYRR (_W5100S_IO_BASE_ + (0x003F))
N
N/*
N * @ingroup Common_register_group_W5100S
N * @brief PHYDIR
N * @details \reg
N */
N#define PHYDIR (_W5100S_IO_BASE_ + (0x0040))
N
N/*
N * @ingroup Common_register_group_W5100S
N * @brief PHYDOR
N * @details \reg
N */
N#define PHYDOR (_W5100S_IO_BASE_ + (0x0042))
N
N/*
N * @ingroup Common_register_group_W5100S
N * @brief PHYACR
N * @details \reg
N */
N#define PHYACR (_W5100S_IO_BASE_ + (0x0044))
N
N/*
N * @ingroup Common_register_group_W5100S
N * @brief PHYDIVR
N * @details \reg
N */
N#define PHYDIVR (_W5100S_IO_BASE_ + (0x0045))
N
N/*
N * @ingroup Common_register_group_W5100S
N * @brief PHYCR0
N * @details \reg
N */
N#define PHYCR0 (_W5100S_IO_BASE_ + (0x0046))
N/*
N * @ingroup Common_register_group_W5100S
N * @brief PHYCR1
N * @details \reg
N */
N#define PHYCR1 (_W5100S_IO_BASE_ + (0x0047))
N
N/*------------------------------------------ RMC registers ------------------------------------------*/
N
N/*
N * @ingroup Common_register_group_W5100S
N * @brief SLCR
N * @details \reg
N */
N#define SLCR (_W5100S_IO_BASE_ + (0x004C))
N
N/*
N * @ingroup Common_register_group_W5100S
N * @brief SLRTR
N * @details \reg
N */
N#define SLRTR (_W5100S_IO_BASE_ + (0x004D))
N
N
N/*
N * @ingroup Common_register_group_W5100S
N * @brief SLRCR
N * @details \reg
N */
N#define SLRCR (_W5100S_IO_BASE_ + (0x004F))
N
N/*
N * @ingroup Common_register_group_W5100S
N * @brief Request command peer IP address register
N * @details \reg
N */
N#define SLPIPR (_W5100S_IO_BASE_ + (0x0050))
N
N/*
N * @ingroup Common_register_group_W5100S
N * @brief Request command peer hardware address register
N * @details \reg
N */
N#define SLPHAR (_W5100S_IO_BASE_ + (0x0054))
N
N/*
N * @ingroup Common_register_group_W5100S
N * @brief Request command ping sequence number register
N * @details \reg
N */
N#define PINGSEQR (_W5100S_IO_BASE_ + (0x005A))
N
N/*
N * @ingroup Common_register_group_W5100S
N * @brief Request command ping ID register
N * @details \reg
N */
N#define PINGIDR (_W5100S_IO_BASE_ + (0x005C))
N
N/*
N * @ingroup Common_register_group_W5100S
N * @brief Request command interrupt mask register
N * @details \reg
N */
N#define SLIMR (_W5100S_IO_BASE_ + (0x005E))
N
N/*
N * @ingroup Common_register_group_W5100S
N * @brief Request command interrupt register
N * @details \reg
N */
N#define SLIR (_W5100S_IO_BASE_ + (0x005F))
N
N/*
N * @ingroup Common_register_group_W5100S
N * @brief DBGOUT
N * @details \reg
N */
N#define DBGOUT (_W5100S_IO_BASE_ + (0x0060))
N
N/*
N * @ingroup Common_register_group_W5100S
N * @brief NICMAXCOLR
N * @details \reg
N */
N#define NICMAXCOLR (_W5100S_IO_BASE_ + (0x0063))
N/*------------------------------------------ CFG registers ------------------------------------------*/
N
N/*
N * @ingroup Common_register_group_W5100S
N * @brief Chip Configuration locking register
N * @details \reg
N */
N#define CHIPLCKR (_W5100S_IO_BASE_ + (0x0070))
N
N/*
N * @ingroup Common_register_group_W5100S
N * @brief Network Configuration locking register
N * @details \reg
N */
N#define NETLCKR (_W5100S_IO_BASE_ + (0x0071))
N
N/*
N * @ingroup Common_register_group_W5100S
N * @brief PHY Configuration locking register
N * @details \reg
N */
N#define PHYLCKR (_W5100S_IO_BASE_ + (0x0072))
N
N/*
N * @ingroup Common_register_group_W5100S
N * @brief version register
N * @details \reg
N */
N#define VERR (_W5100S_IO_BASE_ + (0x0080))
N
N/*
N * @ingroup Common_register_group_W5100S
N * @brief Core 100us Counter register
N * @details \reg
N */
N#define TCNTR (_W5100S_IO_BASE_ + (0x0082))
N
N/*
N * @ingroup Common_register_group_W5100S
N * @brief Core 100us Counter clear register
N * @details \reg
N */
N#define TCNTCLKR (_W5100S_IO_BASE_ + (0x0088))
N
N//----------------------------- W5100 Socket Registers -----------------------------
N
N//--------------------------- For Backward Compatibility ---------------------------
N
N/**
N * @ingroup Socket_register_group_W5100S
N * @brief socket Mode register(R/W)
N * @details \ref Sn_MR configures the option or protocol type of Socket n.\n\n
N * Each bit of \ref Sn_MR defined as the following.
N * <table>
N * <tr> <td>7</td> <td>6</td> <td>5</td> <td>4</td> <td>3</td> <td>2</td> <td>1</td> <td>0</td> </tr>
N * <tr> <td>MULTI</td> <td>MF</td> <td>ND/MC</td> <td>Reserved</td> <td>Protocol[3]</td> <td>Protocol[2]</td> <td>Protocol[1]</td> <td>Protocol[0]</td> </tr>
N * </table>
N * - \ref Sn_MR_MULTI : Support UDP Multicasting
N * - \ref Sn_MR_MF : Support MACRAW
N * - \ref Sn_MR_ND : No Delayed Ack(TCP) flag
N * - \ref Sn_MR_MC : IGMP version used <b>in UDP mulitcasting</b>
N * - <b>Protocol</b>
N * <table>
N * <tr> <td><b>Protocol[3]</b></td> <td><b>Protocol[2]</b></td> <td><b>Protocol[1]</b></td> <td><b>Protocol[0]</b></td> <td>@b Meaning</td> </tr>
N * <tr> <td>0</td> <td>0</td> <td>0</td> <td>0</td> <td>Closed</td> </tr>
N * <tr> <td>0</td> <td>0</td> <td>0</td> <td>1</td> <td>TCP</td> </tr>
N * <tr> <td>0</td> <td>0</td> <td>1</td> <td>0</td> <td>UDP</td> </tr>
N * <tr> <td>0</td> <td>1</td> <td>0</td> <td>0</td> <td>MACRAW</td> </tr>
N * </table>
N * - <b>In case of Socket 0</b>
N * <table>
N * <tr> <td><b>Protocol[3]</b></td> <td><b>Protocol[2]</b></td> <td><b>Protocol[1]</b></td> <td><b>Protocol[0]</b></td> <td>@b Meaning</td> </tr>
N * <tr> <td>0</td> <td>1</td> <td>0</td> <td>0</td> <td>MACRAW</td> </tr>
N * <tr> <td>0</td> <td>1</td> <td>0</td> <td>1</td> <td>PPPoE</td> </tr>
N * </table>
N * - \ref Sn_MR_MACRAW : MAC LAYER RAW SOCK \n
N * - \ref Sn_MR_UDP : UDP
N * - \ref Sn_MR_TCP : TCP
N * - \ref Sn_MR_CLOSE : Unused socket
N * @note MACRAW mode should be only used in Socket 0.
N */
N#define Sn_MR(sn) (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x0000)) // socket Mode register
N
N/**
N * @ingroup Socket_register_group_W5100S
N * @brief Socket command register(R/W)
N * @details This is used to set the command for Socket n such as OPEN, CLOSE, CONNECT, LISTEN, SEND, and RECEIVE.\n
N * After W5100 accepts the command, the \ref Sn_CR register is automatically cleared to 0x00.
N * Even though \ref Sn_CR is cleared to 0x00, the command is still being processed.\n
N * To check whether the command is completed or not, please check the \ref Sn_IR or \ref Sn_SR.
N * - \ref Sn_CR_OPEN : Initialize or open socket.
N * - \ref Sn_CR_LISTEN : Wait connection request in TCP mode(<b>Server mode</b>)
N * - \ref Sn_CR_CONNECT : Send connection request in TCP mode(<b>Client mode</b>)
N * - \ref Sn_CR_DISCON : Send closing request in TCP mode.
N * - \ref Sn_CR_CLOSE : Close socket.
N * - \ref Sn_CR_SEND : Update TX buffer pointer and send data.
N * - \ref Sn_CR_SEND_MAC : Send data with MAC address, so without ARP process.
N * - \ref Sn_CR_SEND_KEEP : Send keep alive message.
N * - \ref Sn_CR_RECV : Update RX buffer pointer and receive data.
N * - <b>In case of S0_MR(P3:P0) = S0_MR_PPPoE</b>
N * <table>
N * <tr> <td><b>Value</b></td> <td><b>Symbol</b></td> <td><b>Description</b></td></tr>
N * <tr> <td>0x23</td> <td>PCON</td> <td>PPPoE connection begins by transmitting PPPoE discovery packet</td> </tr>
N * <tr> <td>0x24</td> <td>PDISCON</td> <td>Closes PPPoE connection</td> </tr>
N * <tr> <td>0x25</td> <td>PCR</td> <td>In each phase, it transmits REQ message.</td> </tr>
N * <tr> <td>0x26</td> <td>PCN</td> <td>In each phase, it transmits NAK message.</td> </tr>
N * <tr> <td>0x27</td> <td>PCJ</td> <td>In each phase, it transmits REJECT message.</td> </tr>
N * </table>
N */
N#define Sn_CR(sn) (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x0001)) // channel Sn_CR register
N
N/**
N * @ingroup Socket_register_group_W5100S
N * @brief Socket interrupt register(R)
N * @details \ref Sn_IR indicates the status of Socket Interrupt such as establishment, termination, receiving data, timeout).\n
N * When an interrupt occurs and the corresponding bit \ref IR_SOCK(N) in \ref _IMR_ are set, \ref IR_SOCK(N) in \ref IR becomes '1'.\n
N * In order to clear the \ref Sn_IR bit, the host should write the bit to \n
N * <table>
N * <tr> <td>7</td> <td>6</td> <td>5</td> <td>4</td> <td>3</td> <td>2</td> <td>1</td> <td>0</td> </tr>
N * <tr> <td>PRECV</td> <td>PFAIL</td> <td>PNEXT</td> <td>SEND_OK</td> <td>TIMEOUT</td> <td>RECV</td> <td>DISCON</td> <td>CON</td> </tr>
N * </table>
N * - \ref Sn_IR_PRECV : <b>PPP Receive Interrupt</b>
N * - \ref Sn_IR_PFAIL : <b>PPP Fail Interrupt</b>
N * - \ref Sn_IR_PNEXT : <b>PPP Next Phase Interrupt</b>
N * - \ref Sn_IR_SENDOK : <b>SEND_OK Interrupt</b>
N * - \ref Sn_IR_TIMEOUT : <b>TIMEOUT Interrupt</b>
N * - \ref Sn_IR_RECV : <b>RECV Interrupt</b>
N * - \ref Sn_IR_DISCON : <b>DISCON Interrupt</b>
N * - \ref Sn_IR_CON : <b>CON Interrupt</b>
N */
N#define Sn_IR(sn) (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x0002)) // channel interrupt register
N
N/**
N * @ingroup Socket_register_group_W5100S
N * @brief Socket status register(R)
N * @details \ref Sn_SR indicates the status of Socket n.\n
N * The status of Socket n is changed by \ref Sn_CR or some special control packet as SYN, FIN packet in TCP.
N * @par Normal status
N * - \ref SOCK_CLOSED : Closed
N * - \ref SOCK_INIT : Initiate state
N * - \ref SOCK_LISTEN : Listen state
N * - \ref SOCK_ESTABLISHED : Success to connect
N * - \ref SOCK_CLOSE_WAIT : Closing state
N * - \ref SOCK_UDP : UDP socket
N * - \ref SOCK_MACRAW : MAC raw mode socket
N *@par Temporary status during changing the status of Socket n.
N * - \ref SOCK_SYNSENT : This indicates Socket n sent the connect-request packet (SYN packet) to a peer.
N * - \ref SOCK_SYNRECV : It indicates Socket n successfully received the connect-request packet (SYN packet) from a peer.
N * - \ref SOCK_FIN_WAIT : Connection state
N * - \ref SOCK_CLOSING : Closing state
N * - \ref SOCK_TIME_WAIT : Closing state
N * - \ref SOCK_LAST_ACK : Closing state
N */
N#define Sn_SR(sn) (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x0003)) // channel status register
N
N/**
N * @ingroup Socket_register_group_W5100S
N * @brief source port register(R/W)
N * @details \ref Sn_PORT configures the source port number of Socket n.
N * It is valid when Socket n is used in TCP/UDP mode. It should be set before OPEN command is ordered.
N*/
N#define Sn_PORT(sn) (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x0004)) // source port register
N
N/**
N * @ingroup Socket_register_group_W5100S
N * @brief Peer MAC register address(R/W)
N * @details \ref Sn_DHAR configures the destination hardware address of Socket n when using SEND_MAC command in UDP mode or
N * it indicates that it is acquired in ARP-process by CONNECT/SEND command.
N */
N#define Sn_DHAR(sn) (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x0006)) // Peer MAC register address
N
N/**
N * @ingroup Socket_register_group_W5100S
N * @brief Peer IP register address(R/W)
N * @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.
N * In TCP client mode, it configures an IP address of TCP server before CONNECT command.
N * In TCP server mode, it indicates an IP address of TCP client after successfully establishing connection.
N * In UDP mode, it configures an IP address of peer to be received the UDP packet by SEND or SEND_MAC command.
N */
N#define Sn_DIPR(sn) (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x000C)) // Peer IP register address
N
N/**
N * @ingroup Socket_register_group_W5100S
N * @brief Peer port register address(R/W)
N * @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.
N * In TCP clientmode, it configures the listen port number of TCP server before CONNECT command.
N * In TCP Servermode, it indicates the port number of TCP client after successfully establishing connection.
N * In UDP mode, it configures the port number of peer to be transmitted the UDP packet by SEND/SEND_MAC command.
N */
N#define Sn_DPORT(sn) (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x0010)) // Peer port register address
N
N/**
N * @ingroup Socket_register_group_W5100S
N * @brief Maximum Segment Size(Sn_MSSR0) register address(R/W)
N * @details \ref Sn_MSSR configures or indicates the MTU(Maximum Transfer Unit) of Socket n.
N */
N#define Sn_MSSR(sn) (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x0012)) // Maximum Segment Size(Sn_MSSR0) register address
N
N/**
N * @ingroup Socket_register_group_W5100S
N * @brief IP Protocol(PROTO) Register(R/W)
N * @details \ref Sn_PROTO that sets the protocol number field of the IP header at the IP layer. It is
N * valid only in IPRAW mode, and ignored in other modes.
N */
N#define Sn_PROTO(sn) (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x0014)) // Protocol of IP Header field register in IP raw mode
N
N/**
N * @ingroup Socket_register_group_W5100S
N * @brief IP Type of Service(TOS) Register(R/W)
N * @details \ref Sn_TOS configures the TOS(Type Of Service field in IP Header) of Socket n.
N * It is set before OPEN command.
N */
N#define Sn_TOS(sn) (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + 0x0015) // IP Type of Service(TOS) Register
N
N/**
N * @ingroup Socket_register_group_W5100S
N * @brief IP Time to live(TTL) Register(R/W)
N * @details \ref Sn_TTL configures the TTL(Time To Live field in IP header) of Socket n.
N * It is set before OPEN command.
N */
N#define Sn_TTL(sn) (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x0016)) // IP Time to live(TTL) Register
N
N// Reserved (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x0017))
N// Reserved (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x0018))
N// Reserved (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x0019))
N// Reserved (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x001A))
N// Reserved (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x001B))
N// Reserved (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x001C))
N// Reserved (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x001D))
N
N/**
N * @ingroup Socket_register_group_W5100S
N * @brief Transmit free memory size register(R)
N * @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_TXMEM_SIZE.
N * 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.
N * Therefore, check before saving the data to the Socket n TX Buffer, and if data is equal or smaller than its checked size,
N * 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,
N * transmit the data after dividing into the checked size and saving in the Socket n TX buffer.
N */
N#define Sn_TX_FSR(sn) (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x0020)) // Transmit free memory size register
N
N/**
N * @ingroup Socket_register_group_W5100S
N * @brief Transmit memory read pointer register address(R)
N * @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.
N * After its initialization, it is auto-increased by SEND command.
N * 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.
N * After transmitting the saved data, the SEND command increases the \ref Sn_TX_RD as same as the \ref Sn_TX_WR.
N * If its increment value exceeds the maximum value 0xFFFF, (greater than 0x10000 and the carry bit occurs),
N * then the carry bit is ignored and will automatically update with the lower 16bits value.
N */
N#define Sn_TX_RD(sn) (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x0022)) // Transmit memory read pointer register address
N
N/**
N * @ingroup Socket_register_group_W5100S
N * @brief Transmit memory write pointer register address(R/W)
N * @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
N * It should be read or be updated like as follows.\n
N * 1. Read the starting address for saving the transmitting data.\n
N * 2. Save the transmitting data from the starting address of Socket n TX buffer.\n
N * 3. After saving the transmitting data, update \ref Sn_TX_WR to the increased value as many as transmitting data size.
N * If the increment value exceeds the maximum value 0xFFFF(greater than 0x10000 and the carry bit occurs),
N * then the carry bit is ignored and will automatically update with the lower 16bits value.\n
N * 4. Transmit the saved data in Socket n TX Buffer by using SEND/SEND command
N */
N#define Sn_TX_WR(sn) (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x0024)) // Transmit memory write pointer register address
N
N/**
N * @ingroup Socket_register_group_W5100S
N * @brief Received data size register(R)
N * @details \ref Sn_RX_RSR indicates the data size received and saved in Socket n RX Buffer.
N * \ref Sn_RX_RSR does not exceed the \ref Sn_RXMEM_SIZE and is calculated as the difference between
N * Socket n RX Write Pointer (\ref Sn_RX_WR)and Socket n RX Read Pointer (\ref Sn_RX_RD)
N */
N#define Sn_RX_RSR(sn) (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x0026)) // Received data size register
N
N/**
N * @ingroup Socket_register_group_W5100S
N * @brief Read point of Receive memory(R/W)
N * @details \ref Sn_RX_RD is initialized by OPEN command. Make sure to be read or updated as follows.\n
N * 1. Read the starting save address of the received data.\n
N * 2. Read data from the starting address of Socket n RX Buffer.\n
N * 3. After reading the received data, Update \ref Sn_RX_RD to the increased value as many as the reading size.
N * If the increment value exceeds the maximum value 0xFFFF, that is, is greater than 0x10000 and the carry bit occurs,
N * update with the lower 16bits value ignored the carry bit.\n
N * 4. Order RECV command is for notifying the updated \ref Sn_RX_RD to W5100.
N */
N#define Sn_RX_RD(sn) (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x0028)) // Read point of Receive memory
N
N/**
N * @ingroup Socket_register_group_W5100S
N * @brief Write point of Receive memory(R)
N * @details \ref Sn_RX_WR is initialized by OPEN command and it is auto-increased by the data reception.
N * If the increased value exceeds the maximum value 0xFFFF, (greater than 0x10000 and the carry bit occurs),
N * then the carry bit is ignored and will automatically update with the lower 16bits value.
N */
N#define Sn_RX_WR(sn) (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x002A)) // Write point of Receive memory
N
N
N//todo
N#define Sn_IMR(sn) (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x002C))
N
N#define Sn_FRAGR(sn) (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x002D)) // and +1
N
N#define Sn_MR2(sn) (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x002F))
N
N#define Sn_KPALVTR(sn) (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x0030))
N
N#define Sn_TSR(sn) (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x0031))
N
N#define Sn_RTR(sn) (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x0032))
N
N#define Sn_RCR(sn) (_W5100S_IO_BASE_ + WIZCHIP_SREG_BLOCK(sn) + (0x0034))
N
N
N/*----------------------------- W5100S Register values -----------------------------*/
N
N/* MODE register values */
N/**
N * @brief Reset
N * @details If this bit is All internal registers will be initialized. It will be automatically cleared as after S/W reset.
N */
N#define MR_RST 0x80 ///< reset
N
N
N/**
N * @brief Ping block
N * @details 0 : Disable Ping block\n
N * 1 : Enable Ping block\n
N * If the bit is it blocks the response to a ping request.
N */
N#define MR_PB 0x10 ///< ping block
N
N/**
N * @brief Enable PPPoE
N * @details 0 : DisablePPPoE mode\n
N * 1 : EnablePPPoE mode\n
N * If you use ADSL, this bit should be '1'.
N */
N#define MR_PPPOE 0x08 ///< enable pppoe
N
N/**
N * @brief Address Auto-Increment in Indirect Bus Interface
N * @details 0 : Disable auto-increment \n
N * 1 : Enable auto-incremente \n
N * At the Indirect Bus Interface mode, if this bit is set as éæ¤æ·1éæ¤æ·, the address will
N * be automatically increased by 1 whenever read and write are performed.
N */
N#define MR_AI 0x02 ///< auto-increment in indirect mode
N
N/**
N * @brief Indirect Bus Interface mode
N * @details 0 : Disable Indirect bus Interface mode \n
N * 1 : Enable Indirect bus Interface mode \n
N * If this bit is set as éæ¤æ·1éæ¤æ·, Indirect Bus Interface mode is set.
N */
N#define MR_IND 0x01 ///< enable indirect mode
N
N/* IR register values */
N/**
N * @brief Check IP conflict.
N * @details Bit is set as when own source IP address is same with the sender IP address in the received ARP request.
N */
N#define IR_CONFLICT 0x80 ///< check ip confict
N
N/**
N * @brief Get the destination unreachable message in UDP sending.
N * @details When receiving the ICMP (Destination port unreachable) packet, this bit is set as
N * When this bit is Destination Information such as IP address and Port number may be checked with the corresponding @ref UIPR & @ref UPORTR.
N */
N#define IR_UNREACH 0x40 ///< check destination unreachable
N
N/**
N * @brief Get the PPPoE close message.
N * @details When PPPoE is disconnected during PPPoE mode, this bit is set.
N */
N#define IR_PPPoE 0x20 ///< get the PPPoE close message
N
N/**
N * @brief Socket interrupt bit
N * @details Indicates whether each socket interrupt has occured.
N */
N#define IR_SOCK(sn) (0x01 << sn) ///< check socket interrupt
N
N/**
N * @brief IP conflict interrupt mask bit
N * @details If this bit is set, IP conflict interrupt is enabled.
N */
N#define IMR_CONFLICT 0x80
N
N/**
N * @brief Destination port unreachable interrupt mask bit
N * @details If this bit is set, destination port unreachable interrupt is enabled.
N */
N#define IMR_UNREACH 0x40
N
N/**
N * @brief PADT/LCPT interrupt mask bit
N * @details If this bit is set, PADT/LCPT interrupt is enabled.
N */
N#define IMR_PADT 0x20
N
N/**
N * @brief Socket interrupt mask bit
N * @details If this bit is set, each socket interrupt is enabled.
N */
N#define IMR_SOCK(sn) (0x01 << sn)
N
N/**
N * @brief Magic packet interrupt mask bit
N * @details If this bit is set, each socket interrupt is enabled.
N */
N#define IMR2_MGCPAK 0x01
N
N/**
N * @brief Request command register bit
N * @details ARP command
N */
N#define RQCMD_ARP (1<<1)
N
N/**
N * @brief Request command register bit
N * @details ARP command
N */
N#define RQCMD_PING (1<<0)
N
N/**
N * @brief Request command interrupt and interrupt mask register bit
N * @details Request command time out interrupt and interrupt mask
N */
N#define RQCMD_TIMEOUT (1<<2)
N
N/**
N * @brief Request command interrupt and interrupt mask register bit
N * @details Request command ARP interrupt and interrupt mask
N */
N#define RQCMD_ARP (1<<1)
N
N/**
N * @brief Request command interrupt and interrupt mask register bit
N * @details Request command PING interrupt and interruptmask
N */
N#define RQCMD_PING (1<<0)
N
N
N// Sn_MR values
N/* Sn_MR Default values */
N/**
N * @brief Unused socket
N * @details This configures the protocol mode of Socket n.
N */
N#define Sn_MR_CLOSE 0x00 ///< unused socket
N
N/**
N * @brief TCP
N * @details This configures the protocol mode of Socket n.
N */
N#define Sn_MR_TCP 0x01 ///< TCP
N
N/**
N * @brief UDP
N * @details This configures the protocol mode of Socket n.
N */
N#define Sn_MR_UDP 0x02 ///< UDP
N#define Sn_MR_IPRAW 0x03 ///< IP LAYER RAW SOCK
N
N/**
N * @brief MAC LAYER RAW SOCK
N * @details This configures the protocol mode of Socket n.
N * @note MACRAW mode should be only used in Socket 0.
N */
N#define Sn_MR_MACRAW 0x04 ///< MAC LAYER RAW SOCK
N
N/**
N * @brief PPPoE
N * @details This configures the protocol mode of Socket n.
N * @note PPPoE mode should be only used in Socket 0.
N */
N#define Sn_MR_PPPoE 0x05 ///< PPPoE
N
N/**
N * @brief No Delayed Ack(TCP), Multicast flag
N * @details 0 : Disable No Delayed ACK option\n
N * 1 : Enable No Delayed ACK option\n
N * This bit is applied only during TCP mode (P[3:0] = 001).\n
N * When this bit is It sends the ACK packet without delay as soon as a Data packet is received from a peer.\n
N * When this bit is It sends the ACK packet after waiting for the timeout time configured by \ref _RTR_.
N */
N#define Sn_MR_ND 0x20 ///< No Delayed Ack(TCP) flag
N
N/**
N * @brief Support UDP Multicasting
N * @details 0 : using IGMP version 2\n
N * 1 : using IGMP version 1\n
N * This bit is applied only during UDP mode(P[3:0] = 010 and MULTI = '1')
N * It configures the version for IGMP messages (Join/Leave/Report).
N */
N#define Sn_MR_MC Sn_MR_ND ///< Select IGMP version 1(0) or 2(1)
N
N/**
N * @brief MAC filter enable in @ref Sn_MR_MACRAW mode
N * @details 0 : disable MAC Filtering\n
N * 1 : enable MAC Filtering\n
N * This bit is applied only during MACRAW mode(P[3:0] = 100.\n
N * When set as W5100 can only receive broadcasting packet or packet sent to itself.
N * When this bit is W5100 can receive all packets on Ethernet.
N * If user wants to implement Hybrid TCP/IP stack,
N * it is recommended that this bit is set as for reducing host overhead to process the all received packets.
N */
N#define Sn_MR_MF 0x40 ///< Use MAC filter
N#define Sn_MR_MFEN Sn_MR_MF
N
N
N/* Sn_MR Default values */
N/**
N * @brief Support UDP Multicasting
N * @details 0 : disable Multicasting\n
N * 1 : enable Multicasting\n
N * This bit is applied only during UDP mode(P[3:0] = 010).\n
N * To use multicasting, \ref Sn_DIPR & \ref Sn_DPORT should be respectively configured with the multicast group IP address & port number
N * before Socket n is opened by OPEN command of \ref Sn_CR.
N */
N#define Sn_MR_MULTI 0x80 ///< support multicating
N
N/* Sn_CR values */
N/**
N * @brief Initialize or open socket
N * @details Socket n is initialized and opened according to the protocol selected in Sn_MR(P3:P0).
N * The table below shows the value of \ref Sn_SR corresponding to \ref Sn_MR.\n
N * <table>
N * <tr> <td>\b Sn_MR (P[3:0])</td> <td>\b Sn_SR</td> </tr>
N * <tr> <td>Sn_MR_CLOSE (000)</td> <td>--</td> </tr>
N * <tr> <td>Sn_MR_TCP (001)</td> <td>SOCK_INIT (0x13)</td> </tr>
N * <tr> <td>Sn_MR_UDP (010)</td> <td>SOCK_UDP (0x22)</td> </tr>
N * <tr> <td>S0_MR_IPRAW (011)</td> <td>SOCK_IPRAW (0x32)</td> </tr>
N * <tr> <td>S0_MR_MACRAW (100)</td> <td>SOCK_MACRAW (0x42)</td> </tr>
N * <tr> <td>S0_MR_PPPoE (101)</td> <td>SOCK_PPPoE (0x5F)</td> </tr>
N * </table>
N */
N#define Sn_CR_OPEN 0x01 ///< initialize or open socket
N
N/**
N * @brief Wait connection request in TCP mode(Server mode)
N * @details This is valid only in TCP mode (Sn_MR(P3:P0) = \ref Sn_MR_TCP).//
N * In this mode, Socket n operates as a 'TCP server' and waits for connection-request (SYN packet) from any 'TCP client'.//
N * The \ref Sn_SR changes the state from SOCK_INIT to SOCKET_LISTEN.//
N * When a 'TCP client' connection request is successfully established,
N * the \ref Sn_SR changes from SOCK_LISTEN to SOCK_ESTABLISHED and the Sn_IR(0) becomes
N * But when a 'TCP client' connection request is failed, Sn_IR(3) becomes and the status of \ref Sn_SR changes to SOCK_CLOSED.
N */
N#define Sn_CR_LISTEN 0x02 ///< wait connection request in tcp mode(Server mode)
N
N/**
N * @brief Send connection request in TCP mode(Client mode)
N * @details To connect, a connect-request (SYN packet) is sent to <b>TCP server</b>configured by \ref Sn_DIPR & Sn_DPORT(destination address & port).
N * If the connect-request is successful, the \ref Sn_SR is changed to \ref SOCK_ESTABLISHED and the Sn_IR(0) becomes \n\n
N * The connect-request fails in the following three cases.\n
N * 1. When a @b ARPTO occurs (\ref Sn_IR[3] = '1') because destination hardware address is not acquired through the ARP-process.\n
N * 2. When a @b SYN/ACK packet is not received and @b TCPTO (Sn_IR(3) ='1')\n
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.
N * @note This is valid only in TCP mode and operates when Socket n acts as <b>TCP client</b>
N */
N#define Sn_CR_CONNECT 0x04 ///< send connection request in tcp mode(Client mode)
N
N/**
N * @brief Send closing request in TCP mode
N * @details Regardless of <b>TCP server</b>or <b>TCP client</b> the DISCON command processes the disconnect-process (<b>Active close</b>or <b>Passive close</b>.\n
N * @par Active close
N * it transmits disconnect-request(FIN packet) to the connected peer\n
N * @par Passive close
N * When FIN packet is received from peer, a FIN packet is replied back to the peer.\n
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
N * Otherwise, TCPTO occurs (Sn_IR(3)='1') and then \ref Sn_SR is changed to \ref SOCK_CLOSED.
N * @note Valid only in TCP mode.
N */
N#define Sn_CR_DISCON 0x08 ///< send closing reqeuset in tcp mode
N
N/**
N * @brief Close socket
N * @details Sn_SR is changed to \ref SOCK_CLOSED.
N */
N#define Sn_CR_CLOSE 0x10
N
N/**
N * @brief Update TX buffer pointer and send data
N * @details SEND transmits all the data in the Socket n TX buffer.\n
N * For more details, please refer to Socket n TX Free Size Register (\ref Sn_TX_FSR), Socket n,
N * TX Write Pointer Register(\ref Sn_TX_WR), and Socket n TX Read Pointer Register(\ref Sn_TX_RD).
N */
N#define Sn_CR_SEND 0x20
N
N/**
N * @brief Send data with MAC address, so without ARP process
N * @details The basic operation is same as SEND.\n
N * Normally SEND transmits data after destination hardware address is acquired by the automatic ARP-process(Address Resolution Protocol).\n
N * But SEND_MAC transmits data without the automatic ARP-process.\n
N * In this case, the destination hardware address is acquired from \ref Sn_DHAR configured by host, instead of APR-process.
N * @note Valid only in UDP mode.
N */
N#define Sn_CR_SEND_MAC 0x21
N
N/**
N * @brief Send keep alive message
N * @details It checks the connection status by sending 1byte keep-alive packet.\n
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.
N * @note Valid only in TCP mode.
N */
N#define Sn_CR_SEND_KEEP 0x22
N
N/**
N * @brief Update RX buffer pointer and receive data
N * @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
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),
N * and Socket n RX Read Pointer Register (\ref Sn_RX_RD).
N */
N#define Sn_CR_RECV 0x40
N
N/**
N * @brief PPPoE connection
N * @details PPPoE connection begins by transmitting PPPoE discovery packet
N */
N#define Sn_CR_PCON 0x23
N
N/**
N * @brief Closes PPPoE connection
N * @details Closes PPPoE connection
N */
N#define Sn_CR_PDISCON 0x24
N
N/**
N * @brief REQ message transmission
N * @details In each phase, it transmits REQ message.
N */
N#define Sn_CR_PCR 0x25
N
N/**
N * @brief NAK massage transmission
N * @details In each phase, it transmits NAK message.
N */
N#define Sn_CR_PCN 0x26
N
N/**
N * @brief REJECT message transmission
N * @details In each phase, it transmits REJECT message.
N */
N#define Sn_CR_PCJ 0x27
N
N/* Sn_IR values */
N/**
N * @brief PPP Receive Interrupt
N * @details PPP Receive Interrupts when the option which is not supported is received.
N */
N#define Sn_IR_PRECV 0x80
N
N/**
N * @brief PPP Fail Interrupt
N * @details PPP Fail Interrupts when PAP Authentication is failed.
N */
N#define Sn_IR_PFAIL 0x40
N
N/**
N * @brief PPP Next Phase Interrupt
N * @details PPP Next Phase Interrupts when the phase is changed during ADSL connection process.
N */
N#define Sn_IR_PNEXT 0x20
N
N/**
N * @brief SEND_OK Interrupt
N * @details This is issued when SEND command is completed.
N */
N#define Sn_IR_SENDOK 0x10 ///< complete sending
N
N/**
N * @brief TIMEOUT Interrupt
N * @details This is issued when ARPTO or TCPTO occurs.
N */
N#define Sn_IR_TIMEOUT 0x08 ///< assert timeout
N
N/**
N * @brief RECV Interrupt
N * @details This is issued whenever data is received from a peer.
N */
N#define Sn_IR_RECV 0x04
N
N/**
N * @brief DISCON Interrupt
N * @details This is issued when FIN or FIN/ACK packet is received from a peer.
N */
N#define Sn_IR_DISCON 0x02
N
N/**
N * @brief CON Interrupt
N * @details This is issued one time when the connection with peer is successful and then \ref Sn_SR is changed to \ref SOCK_ESTABLISHED.
N */
N#define Sn_IR_CON 0x01
N
N/* Sn_SR values */
N/**
N * @brief Closed
N * @details This indicates that Socket n is released.\n
N * When DICON, CLOSE command is ordered, or when a timeout occurs, it is changed to \ref SOCK_CLOSED regardless of previous status.
N */
N#define SOCK_CLOSED 0x00 ///< closed
N
N/**
N * @brief Initiate state
N * @details This indicates Socket n is opened with TCP mode.\n
N * It is changed to \ref SOCK_INIT when Sn_MR(P[3:0]) = 001)and OPEN command is ordered.\n
N * After \ref SOCK_INIT, user can use LISTEN /CONNECT command.
N */
N#define SOCK_INIT 0x13 ///< init state
N
N/**
N * @brief Listen state
N * @details This indicates Socket n is operating as <b>TCP server</b>mode and waiting for connection-request (SYN packet) from a peer (<b>TCP client</b>).\n
N * It will change to \ref SOCK_ESTABLISHED when the connection-request is successfully accepted.\n
N * Otherwise it will change to \ref SOCK_CLOSED after TCPTO occurred (Sn_IR(TIMEOUT) = '1').
N */
N#define SOCK_LISTEN 0x14
N
N/**
N * @brief Connection state
N * @details This indicates Socket n sent the connect-request packet (SYN packet) to a peer.\n
N * It is temporarily shown when \ref Sn_SR is changed from \ref SOCK_INIT to \ref SOCK_ESTABLISHED by CONNECT command.\n
N * If connect-accept(SYN/ACK packet) is received from the peer at SOCK_SYNSENT, it changes to \ref SOCK_ESTABLISHED.\n
N * Otherwise, it changes to \ref SOCK_CLOSED after TCPTO (\ref Sn_IR[TIMEOUT] = '1') is occurred.
N */
N#define SOCK_SYNSENT 0x15
N
N/**
N * @brief Connection state
N * @details It indicates Socket n successfully received the connect-request packet (SYN packet) from a peer.\n
N * If socket n sends the response (SYN/ACK packet) to the peer successfully, it changes to \ref SOCK_ESTABLISHED. \n
N * If not, it changes to \ref SOCK_CLOSED after timeout occurs (\ref Sn_IR[TIMEOUT] = '1').
N */
N#define SOCK_SYNRECV 0x16
N
N/**
N * @brief Success to connect
N * @details This indicates the status of the connection of Socket n.\n
N * It changes to \ref SOCK_ESTABLISHED when the <b>TCP SERVER</b>processed the SYN packet from the <b>TCP CLIENT</b>during \ref SOCK_LISTEN, or
N * when the CONNECT command is successful.\n
N * During \ref SOCK_ESTABLISHED, DATA packet can be transferred using SEND or RECV command.
N */
N#define SOCK_ESTABLISHED 0x17
N
N/**
N * @brief Closing state
N * @details These indicate Socket n is closing.\n
N * These are shown in disconnect-process such as active-close and passive-close.\n
N * When Disconnect-process is successfully completed, or when timeout occurs, these change to \ref SOCK_CLOSED.
N */
N#define SOCK_FIN_WAIT 0x18
N
N/**
N * @brief Closing state
N * @details These indicate Socket n is closing.\n
N * These are shown in disconnect-process such as active-close and passive-close.\n
N * When Disconnect-process is successfully completed, or when timeout occurs, these change to \ref SOCK_CLOSED.
N */
N#define SOCK_CLOSING 0x1A
N
N/**
N * @brief Closing state
N * @details These indicate Socket n is closing.\n
N * These are shown in disconnect-process such as active-close and passive-close.\n
N * When Disconnect-process is successfully completed, or when timeout occurs, these change to \ref SOCK_CLOSED.
N */
N#define SOCK_TIME_WAIT 0x1B
N
N/**
N * @brief Closing state
N * @details This indicates Socket n received the disconnect-request (FIN packet) from the connected peer.\n
N * This is half-closing status, and data can be transferred.\n
N * For full-closing, DISCON command is used. But For just-closing, @ref Sn_CR_CLOSE command is used.
N */
N#define SOCK_CLOSE_WAIT 0x1C
N
N/**
N * @brief Closing state
N * @details This indicates Socket n is waiting for the response (FIN/ACK packet) to the disconnect-request (FIN packet) by passive-close.\n
N * It changes to \ref SOCK_CLOSED when Socket n received the response successfully, or when timeout occurs (\ref Sn_IR[TIMEOUT] = '1').
N */
N#define SOCK_LAST_ACK 0x1D
N
N/**
N * @brief UDP socket
N * @details This indicates Socket n is opened in UDP mode(Sn_MR(P[3:0]) = 010).\n
N * It changes to SOCK_UDP when Sn_MR(P[3:0]) = 010 and @ref Sn_CR_OPEN command is ordered.\n
N * Unlike TCP mode, data can be transfered without the connection-process.
N */
N#define SOCK_UDP 0x22 ///< udp socket
N
N/**
N * @brief IP raw mode socket
N * @details TThe socket is opened in IPRAW mode. The SOCKET status is change to SOCK_IPRAW when @ref Sn_MR (P3:P0) is
N * Sn_MR_IPRAW and @ref Sn_CR_OPEN command is used.\n
N * IP Packet can be transferred without a connection similar to the UDP mode.
N*/
N#define SOCK_IPRAW 0x32 ///< ip raw mode socket
N
N/**
N * @brief MAC raw mode socket
N * @details This indicates Socket 0 is opened in MACRAW mode (@ref Sn_MR(P[3:0]) = '100' and n=0) and is valid only in Socket 0.\n
N * It changes to SOCK_MACRAW when @ref Sn_MR(P[3:0]) = '100' and @ref Sn_CR_OPEN command is ordered.\n
N * Like UDP mode socket, MACRAW mode Socket 0 can transfer a MAC packet (Ethernet frame) without the connection-process.
N */
N#define SOCK_MACRAW 0x42 ///< mac raw mode socket
N
N/**
N * @brief PPPoE mode socket
N * @details It is the status that SOCKET0 is open as PPPoE mode. It is changed to SOCK_PPPoE in case of S0_CR=OPEN and S0_MR
N * (P3:P0)=S0_MR_PPPoE.\n
N * It is temporarily used at the PPPoE
Nconnection.
N */
N#define SOCK_PPPOE 0x5F ///< pppoe socket
N
N// IP PROTOCOL
N#define IPPROTO_IP 0 ///< Dummy for IP
N#define IPPROTO_ICMP 1 ///< Control message protocol
N#define IPPROTO_IGMP 2 ///< Internet group management protocol
N#define IPPROTO_GGP 3 ///< GW^2 (deprecated)
N#define IPPROTO_TCP 6 ///< TCP
N#define IPPROTO_PUP 12 ///< PUP
N#define IPPROTO_UDP 17 ///< UDP
N#define IPPROTO_IDP 22 ///< XNS idp
N#define IPPROTO_ND 77 ///< UNOFFICIAL net disk protocol
N#define IPPROTO_RAW 255 ///< Raw IP packet
N
N
N
N/*----------------------------- W5100S !!Only!! Register values -----------------------------*/
N
N/* MODE2 register values */
N
N/**
N * @brief
N * @details
N */
N#define MR2_CLKSEL (1<<7)
N
N/**
N * @brief
N * @details
N */
N#define MR2_G_IEN (1<<6)
N
N
N/**
N * @brief
N * @details
N */
N#define MR2_NOTCPRST (1<<5)
N
N/**
N * @brief
N * @details
N */
N#define MR2_UDPURB (1<<4)
N
N/**
N * @brief
N * @details
N */
N#define MR2_WOL (1<<3)
N
N/**
N * @brief
N * @details
N */
N#define MR2_MNOSCHK (1<<2)
N
N/**
N * @brief
N * @details
N */
N#define MR2_UDPFARP (1<<1)
N
N/**
N * @brief
N * @details
N */
N#define MR2_SSRCHA (1<<0)
N
N
N
N/* Common interrupt register 2 values */
N
N/**
N * @brief magic packet
N * @details
N */
N#define IR2_MGC (1<<1)
N
N/**
N * @brief
N * @details
N */
N//#define IR2_MGD (1<<1) /* Reserved */
N
N
N/* PHY status register 0 values */
N
N/**
N * @brief
N * @details
N */
N#define PHYSR_CABOFF (1<<7)
N
N/**
N * @brief
N * @details
N */
N#define PHYSR_MD2 (1<<5)
N
N/**
N * @brief
N * @details
N */
N#define PHYSR_MD1 (1<<4)
N
N/**
N * @brief
N * @details
N */
N#define PHYSR_MD0 (1<<3)
N
N/**
N * @brief
N * @details
N */
N#define PHYSR_DUP (1<<2)
N
N/**
N * @brief
N * @details
N */
N#define PHYSR_SPD (1<<1)
N
N/**
N * @brief LINKDONE register
N * @details If 1 Linked successfully, if 0 no link
N */
N#define PHYSR_LNK (1<<0)
N
N
N/* PHY status register 10 values */
N
N/**
N * @brief
N * @details
N */
N#define PHYSR1_RXPG (1<<2)
N
N/**
N * @brief
N * @details
N */
N#define PHYSR1_LPI (1<<1)
N
N/**
N * @brief
N * @details
N */
N#define PHYSR1_CLDN (1<<0)
N
N#define PHYCR_AUTONEGO_ENABLE (0<<2)
N#define PHYCR_AUTONEGO_DISABLE (1<<2)
N
N#define PHYCR_SPD_10 (1<<1)
N#define PHYCR_SPD_100 (0<<1)
N
N#define PHYCR_HALF_DUP (1<<0)
N#define PHYCR_FULL_DUP (0<<0)
N
N
N/*----------------------------For PHY Control-------------------------------*/
N
N/********************/
N/* Register Address */
N/********************/
N
N//Basic mode control register, basic register
N#define PHYMDIO_BMCR 0x00
N
N//Basic mode status register, basic register
N#define PHYMDIO_BMSR 0x01
N
N//--------------------------------------Not used-------------------------------------------//
N////PHY identifier register 1, extended register
N//#define PHY_IDR1 0x02 //not used
N//
N////PHY identifier register 2, extended register
N//#define PHY_IDR2 0x03 //not used
N//
N////Auto-negotiation advertisement register, extended register
N//#define PHY_ANAR 0x04 //not used
N//
N////Auto-negotiation link partner ability register, extended register
N//#define PHY_ANLPAR 0x05 //not used
N//
N////Auto-negotiation expansion register, extended register
N//#define PHY_ANER 0x06 //not used
N//
N////Auto-negotiation next page transmit
N//#define PHY_ANNP 0x07 //not used
N//
N////Auto-negotiation link partner of the next page receive
N//#define PHY_ANLPNP 0x08 //not used
N//
N////MMD access control register
N//#define PHY_REGCR 0x09 //not used
N//
N////MMD access address data register
N//#define PHY_ADDAR 0x0e //not used
N//--------------------------------------Not used-------------------------------------------//
N
N/********************/
N/* Bit definitions */
N/********************/
N
N//For BMCR register
N#define BMCR_RESET (1<<15)
N#define BMCR_MLOOPBACK (1<<14)
N#define BMCR_SPEED (1<<13)
N#define BMCR_AUTONEGO (1<<12)
N#define BMCR_PWDN (1<<11)
N#define BMCR_ISOLATE (1<<10)
N#define BMCR_RSTNEGO (1<<9)
N#define BMCR_DUP (1<<8)
N#define BMCR_COLTEST (1<<7)
N
N//For BMSR register
N#define BMSR_AUTONEGO_COMPL (1<<5)
N#define BMSR_REMOTE_FAULT (1<<4)
N#define BMSR_LINK_STATUS (1<<2)
N#define BMSR_JAB_DETECT (1<<1)
N#define EXTENDED_CAPA (1<<0)
N
N//--------------------------------------Not used-------------------------------------------//
N////For ANAR register
N//#define ANAR_NP (1<<15)
N//#define ANAR_ACK (1<<14)
N//#define ANAR_RF (1<<13)
N//#define ANAR_ASM (3<<10)
N//#define ANAR_T4 (1<<9)
N//#define ANAR_TX_FD (1<<8)
N//#define ANAR_TX_HD (1<<7)
N//#define ANAR_10_FD (1<<6)
N//#define ANAR_10_HD (1<<5)
N//#define ANAR_SELECTOR (0x1F<<0)
N//
N////For ANAR register
N//#define ANLPAR_NP (1<<15)
N//#define ANLPAR_ACK (1<<14)
N//#define ANLPAR_RF (1<<13)
N//#define ANLPAR_LP_DIR (1<<11)
N//#define ANLPAR_PAUSE (1<<10)
N//#define ANLPAR_T4 (1<<9)
N//#define ANLPAR_TX_FD (1<<8)
N//#define ANLPAR_TX_HD (1<<7)
N//#define ANLPAR_10_FD (1<<6)
N//#define ANLPAR_10_HD (1<<5)
N//#define ANLPAR_SELECTOR (0x1F<<0)
N
N/**/
N/* MDIO register*/
N//PCS_CTL_1 | PCS control 1 register
N//PCS_STS_1 | PCS status 1 register
N//EEE_ABILITY | EEE capability register
N//WAKE_ER_CNTR | EEE wake error counter
N//EEE_ADVR | EEE Advertisement register
N//EEE_LPAR | EEE link partner ability register
N
N//--------------------------------------Not used-------------------------------------------//
N
N/********************/
N/*Functions for PHY */
N/********************/
N//todo move this definition to bit area
N#define PHYACR_READ 0x02
N#define PHYACR_WRITE 0x01
N
N
N
N
N/**
N * @brief Enter a critical section
N *
N * @details It is provided to protect your shared code which are executed without distribution. \n \n
N *
N * In non-OS environment, It can be just implemented by disabling whole interrupt.\n
N * In OS environment, You can replace it to critical section api supported by OS.
N *
N * \sa WIZCHIP_READ(), WIZCHIP_WRITE(), WIZCHIP_READ_BUF(), WIZCHIP_WRITE_BUF()
N * \sa WIZCHIP_CRITICAL_EXIT()
N */
N#define WIZCHIP_CRITICAL_ENTER() WIZCHIP.CRIS._enter()
N
N#ifdef _exit
S#undef _exit
N#endif
N
N/**
N * @brief Exit a critical section
N *
N * @details It is provided to protect your shared code which are executed without distribution. \n\n
N *
N * In non-OS environment, It can be just implemented by disabling whole interrupt. \n
N * In OS environment, You can replace it to critical section api supported by OS.
N *
N * @sa WIZCHIP_READ(), WIZCHIP_WRITE(), WIZCHIP_READ_BUF(), WIZCHIP_WRITE_BUF()
N * @sa WIZCHIP_CRITICAL_ENTER()
N */
N#define WIZCHIP_CRITICAL_EXIT() WIZCHIP.CRIS._exit()
N
N
N
N////////////////////////
N// Basic I/O Function //
N////////////////////////
N//
N//M20150601 : uint16_t AddrSel --> uint32_t AddrSel
N//
N/**
N * @ingroup Basic_IO_function_W5100S
N * @brief It reads 1 byte value from a register.
N * @param AddrSel Register address
N * @return The value of register
N */
Nuint8_t WIZCHIP_READ (uint32_t AddrSel);
N
N/**
N * @ingroup Basic_IO_function_W5100S
N * @brief It writes 1 byte value to a register.
N * @param AddrSel Register address
N * @param wb Write data
N * @return void
N */
Nvoid WIZCHIP_WRITE(uint32_t AddrSel, uint8_t wb );
N
N/**
N * @ingroup Basic_IO_function_W5100S
N * @brief It reads sequence data from registers.
N * @param AddrSel Register address
N * @param pBuf Pointer buffer to read data
N * @param len Data length
N */
Nvoid WIZCHIP_READ_BUF (uint32_t AddrSel, uint8_t* pBuf, uint16_t len);
N
N/**
N * @ingroup Basic_IO_function_W5100S
N * @brief It writes sequence data to registers.
N * @param AddrSel Register address
N * @param pBuf Pointer buffer to write data
N * @param len Data length
N */
Nvoid WIZCHIP_WRITE_BUF(uint32_t AddrSel, uint8_t* pBuf, uint16_t len);
N
N
N/////////////////////////////////
N// Common Register IO function //
N/////////////////////////////////
N
N/**
N * @ingroup Common_register_access_function_W5100S
N * @brief Set Mode Register
N * @param (uint8_t)mr The value to be set.
N * @sa getMR()
N */
N#if (_WIZCHIP_IO_MODE_ & _WIZCHIP_IO_MODE_SPI_)
X#if (0x0200 & 0x0200)
N #define setMR(mr) WIZCHIP_WRITE(MR,mr)
N#else
S #define setMR(mr) (*((uint8_t*)MR) = mr)
N#endif
N
N/**
N * @ingroup Common_register_access_function_W5100S
N * @brief Get @ref MR.
N * @return uint8_t. The value of Mode register.
N * @sa setMR()
N */
N#if (_WIZCHIP_IO_MODE_ & _WIZCHIP_IO_MODE_SPI_)
X#if (0x0200 & 0x0200)
N #define getMR() WIZCHIP_READ(MR)
N#else
S #define getMR() (*(uint8_t*)MR)
N#endif
N
N/**
N * @ingroup Common_register_access_function_W5100S
N * @brief Set @ref GAR.
N * @param (uint8_t*)gar Pointer variable to set gateway IP address. It should be allocated 4 bytes.
N * @sa getGAR()
N */
N#define setGAR(gar) \
N WIZCHIP_WRITE_BUF(GAR,gar,4)
X#define setGAR(gar) WIZCHIP_WRITE_BUF(GAR,gar,4)
N
N/**
N * @ingroup Common_register_access_function_W5100S
N * @brief Get @ref GAR.
N * @param (uint8_t*)gar Pointer variable to get gateway IP address. It should be allocated 4 bytes.
N * @sa setGAR()
N */
N#define getGAR(gar) \
N WIZCHIP_READ_BUF(GAR,gar,4)
X#define getGAR(gar) WIZCHIP_READ_BUF(GAR,gar,4)
N
N/**
N * @ingroup Common_register_access_function_W5100S
N * @brief Set @ref SUBR.
N * @param (uint8_t*)subr Pointer variable to set subnet mask address. It should be allocated 4 bytes.
N * @note If subr is null pointer, set the backup subnet to SUBR. \n
N * If subr is 0.0.0.0, back up SUBR and clear it. \n
N * Otherwize, set subr to SUBR
N * @sa getSUBR()
N */
N#define setSUBR(subr) \
N WIZCHIP_WRITE_BUF(SUBR,subr,4)
X#define setSUBR(subr) WIZCHIP_WRITE_BUF(SUBR,subr,4)
N
N/**
N * @ingroup Common_register_access_function_W5100S
N * @brief Get @ref SUBR.
N * @param (uint8_t*)subr Pointer variable to get subnet mask address. It should be allocated 4 bytes.
N * @sa setSUBR()
N */
N#define getSUBR(subr) \
N WIZCHIP_READ_BUF(SUBR, subr, 4)
X#define getSUBR(subr) WIZCHIP_READ_BUF(SUBR, subr, 4)
N
N/**
N * @ingroup Common_register_access_function_W5100S
N * @brief Set @ref SHAR.
N * @param (uint8_t*)shar Pointer variable to set local MAC address. It should be allocated 6 bytes.
N * @sa getSHAR()
N */
N#define setSHAR(shar) \
N WIZCHIP_WRITE_BUF(SHAR, shar, 6)
X#define setSHAR(shar) WIZCHIP_WRITE_BUF(SHAR, shar, 6)
N
N/**
N * @ingroup Common_register_access_function_W5100S
N * @brief Get @ref SHAR.
N * @param (uint8_t*)shar Pointer variable to get local MAC address. It should be allocated 6 bytes.
N * @sa setSHAR()
N */
N#define getSHAR(shar) \
N WIZCHIP_READ_BUF(SHAR, shar, 6)
X#define getSHAR(shar) WIZCHIP_READ_BUF(SHAR, shar, 6)
N
N/**
N * @ingroup Common_register_access_function_W5100S
N * @brief Set @ref SIPR.
N * @param (uint8_t*)sipr Pointer variable to set local IP address. It should be allocated 4 bytes.
N * @sa getSIPR()
N*/
N#define setSIPR(sipr) \
N WIZCHIP_WRITE_BUF(SIPR, sipr, 4)
X#define setSIPR(sipr) WIZCHIP_WRITE_BUF(SIPR, sipr, 4)
N
N/**
N * @ingroup Common_register_access_function_W5100S
N * @brief Get @ref SIPR.
N * @param (uint8_t*)sipr Pointer variable to get local IP address. It should be allocated 4 bytes.
N * @sa setSIPR()
N */
N#define getSIPR(sipr) \
N WIZCHIP_READ_BUF(SIPR, sipr, 4)
X#define getSIPR(sipr) WIZCHIP_READ_BUF(SIPR, sipr, 4)
N
N/**
N * @ingroup Common_register_access_function_W5100S
N * @brief Set \ref IR register
N * @param (uint8_t)ir Value to set \ref IR register.
N * @sa getIR()
N */
N#define setIR(ir) \
N WIZCHIP_WRITE(IR, (ir & 0xE0)) //peter 2016.11.07 unreachable interrupt bit added
X#define setIR(ir) WIZCHIP_WRITE(IR, (ir & 0xE0))
N //WIZCHIP_WRITE(IR, (ir & 0xA0))
N/**
N * @ingroup Common_register_access_function_W5100S
N * @brief Get \ref IR register
N * @return uint8_t. Value of \ref IR register.
N * @sa setIR()
N */
N#define getIR() \
N (WIZCHIP_READ(IR) & 0xE0) //peter 2016.11.07 unreachable interrupt bit added
X#define getIR() (WIZCHIP_READ(IR) & 0xE0)
N //(WIZCHIP_READ(IR) & 0xA0)
N
N/**
N * @ingroup Common_register_access_function_W5100S
N * @brief Set \ref _IMR_ register
N * @param (uint8_t)imr Value to set @ref _IMR_ register.
N * @sa getIMR()
N */
N#define setIMR(imr) \
N WIZCHIP_WRITE(_IMR_, imr)
X#define setIMR(imr) WIZCHIP_WRITE(_IMR_, imr)
N
N/**
N * @ingroup Common_register_access_function_W5100S
N * @brief Get \ref _IMR_ register
N * @return uint8_t. Value of @ref _IMR_ register.
N * @sa setIMR()
N */
N#define getIMR() \
N WIZCHIP_READ(_IMR_)
X#define getIMR() WIZCHIP_READ(_IMR_)
N
N/**
N * @ingroup Common_register_access_function_W5100S
N * @brief Set \ref _RTR_ register
N * @param (uint16_t)rtr Value to set @ref _RTR_ register.
N * @sa getRTR()
N */
N#define setRTR(rtr) {\
N WIZCHIP_WRITE(_RTR_, (uint8_t)(rtr >> 8)); \
N WIZCHIP_WRITE(WIZCHIP_OFFSET_INC(_RTR_,1), (uint8_t) rtr); \
N }
X#define setRTR(rtr) { WIZCHIP_WRITE(_RTR_, (uint8_t)(rtr >> 8)); WIZCHIP_WRITE(WIZCHIP_OFFSET_INC(_RTR_,1), (uint8_t) rtr); }
N
N/**
N * @ingroup Common_register_access_function_W5100S
N * @brief Get \ref _RTR_ register
N * @return uint16_t. Value of @ref _RTR_ register.
N * @sa setRTR()
N */
N#define getRTR() \
N (((uint16_t)WIZCHIP_READ(_RTR_) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(_RTR_,1)))
X#define getRTR() (((uint16_t)WIZCHIP_READ(_RTR_) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(_RTR_,1)))
N
N/**
N * @ingroup Common_register_access_function_W5100S
N * @brief Set \ref _RCR_ register
N * @param (uint8_t)rcr Value to set @ref _RCR_ register.
N * @sa getRCR()
N */
N#define setRCR(rcr) \
N WIZCHIP_WRITE(_RCR_, rcr)
X#define setRCR(rcr) WIZCHIP_WRITE(_RCR_, rcr)
N
N/**
N * @ingroup Common_register_access_function_W5100S
N * @brief Get \ref _RCR_ register
N * @return uint8_t. Value of @ref _RCR_ register.
N * @sa setRCR()
N */
N#define getRCR() \
N WIZCHIP_READ(_RCR_)
X#define getRCR() WIZCHIP_READ(_RCR_)
N
N/**
N * @ingroup Common_register_access_function_W5100S
N * @brief Get \ref RMSR register
N * @sa getRMSR()
N */
N#define setRMSR(rmsr) \
N WIZCHIP_WRITE(RMSR,rmsr) // Receicve Memory Size
X#define setRMSR(rmsr) WIZCHIP_WRITE(RMSR,rmsr)
N
N/**
N * @ingroup Common_register_access_function_W5100S
N * @brief Get \ref RMSR register
N * @return uint8_t. Value of @ref RMSR register.
N * @sa setRMSR()
N */
N #define getRMSR() \
N WIZCHIP_READ(RMSR) // Receicve Memory Size
X #define getRMSR() WIZCHIP_READ(RMSR)
N
N/**
N * @ingroup Common_register_access_function_W5100S
N * @brief Get \ref TMSR register
N * @sa getTMSR()
N */
N#define setTMSR(tmsr) \
N WIZCHIP_WRITE(TMSR,tmsr) // Receicve Memory Size
X#define setTMSR(tmsr) WIZCHIP_WRITE(TMSR,tmsr)
N
N/**
N * @ingroup Common_register_access_function_W5100S
N * @brief Get \ref TMSR register
N * @return uint8_t. Value of @ref TMSR register.
N * @sa setTMSR()
N */
N#define getTMSR() \
N WIZCHIP_READ(TMSR)
X#define getTMSR() WIZCHIP_READ(TMSR)
N
N
N/**
N * @ingroup Common_register_access_function_W5100S
N * @brief Get \ref PATR register
N * @return uint16_t. Value to set \ref PATR register
N */
N#define getPATR() \
N (((uint16_t)WIZCHIP_READ(PATR) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(PATR,1)))
X#define getPATR() (((uint16_t)WIZCHIP_READ(PATR) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(PATR,1)))
N
N/**
N * @ingroup Common_register_access_function_W5100S
N * @brief Get \ref PPPALGO register
N * @return uint8_t. Value to set \ref PPPALGO register
N */
N#define getPPPALGO() \
N WIZCHIP_READ(PPPALGO)
X#define getPPPALGO() WIZCHIP_READ(PPPALGO)
N
N
N/**
N * @ingroup Common_register_access_function_W5100S
N * @brief Set \ref PTIMER register
N * @param (uint8_t)ptimer Value to set \ref PTIMER register.
N * @sa getPTIMER()
N */
N#define setPTIMER(ptimer) \
N WIZCHIP_WRITE(PTIMER, ptimer)
X#define setPTIMER(ptimer) WIZCHIP_WRITE(PTIMER, ptimer)
N
N/**
N * @ingroup Common_register_access_function_W5100S
N * @brief Get \ref PTIMER register
N * @return uint8_t. Value of @ref PTIMER register.
N * @sa setPTIMER()
N */
N#define getPTIMER() \
N WIZCHIP_READ(PTIMER)
X#define getPTIMER() WIZCHIP_READ(PTIMER)
N
N/**
N * @ingroup Common_register_access_function_W5100S
N * @brief Set \ref PMAGIC register
N * @param (uint8_t)pmagic Value to set @ref PMAGIC register.
N * @sa getPMAGIC()
N */
N#define setPMAGIC(pmagic) \
N WIZCHIP_WRITE(PMAGIC, pmagic)
X#define setPMAGIC(pmagic) WIZCHIP_WRITE(PMAGIC, pmagic)
N
N/**
N * @ingroup Common_register_access_function_W5100S
N * @brief Get \ref PMAGIC register
N * @return uint8_t. Value of @ref PMAGIC register.
N * @sa setPMAGIC()
N */
N#define getPMAGIC() \
N WIZCHIP_READ(PMAGIC)
X#define getPMAGIC() WIZCHIP_READ(PMAGIC)
N
N
N//todo Functions for W5100S
N
N/*----------------------------------------------------------------------*/
N/* W5100S only */
N/*----------------------------------------------------------------------*/
N
N#define setIR2(ir2) \
N WIZCHIP_WRITE(IR2, ir2)
X#define setIR2(ir2) WIZCHIP_WRITE(IR2, ir2)
N
N#define getIR2() \
N WIZCHIP_READ(IR2)
X#define getIR2() WIZCHIP_READ(IR2)
N
N#define setIMR2(imr2) \
N WIZCHIP_WRITE(IMR2,imr2)
X#define setIMR2(imr2) WIZCHIP_WRITE(IMR2,imr2)
N
N#define getIMR2() \
N WIZCHIP_READ(IMR2)
X#define getIMR2() WIZCHIP_READ(IMR2)
N
N#define setUIPR(uipr) \
N WIZCHIP_WRITE_BUF(UIPR,uipr,4)
X#define setUIPR(uipr) WIZCHIP_WRITE_BUF(UIPR,uipr,4)
N
N#define getUIPR(uipr) \
N WIZCHIP_READ_BUF(UIPR,uipr,4)
X#define getUIPR(uipr) WIZCHIP_READ_BUF(UIPR,uipr,4)
N
N#define setUPORTR(uportr) {\
N WIZCHIP_WRITE(UPORTR, (uint8_t)(uportr >> 8)); \
N WIZCHIP_WRITE(UPORTR+1, (uint8_t) uportr); \
N }
X#define setUPORTR(uportr) { WIZCHIP_WRITE(UPORTR, (uint8_t)(uportr >> 8)); WIZCHIP_WRITE(UPORTR+1, (uint8_t) uportr); }
N
N#define getUPORTR() \
N (((uint16_t)WIZCHIP_READ(UPORTR) << 8) + WIZCHIP_READ(UPORTR+1))
X#define getUPORTR() (((uint16_t)WIZCHIP_READ(UPORTR) << 8) + WIZCHIP_READ(UPORTR+1))
N
N#define setMR2(mr2) \
N WIZCHIP_WRITE(MR2,mr2)
X#define setMR2(mr2) WIZCHIP_WRITE(MR2,mr2)
N
N#define getMR2() \
N WIZCHIP_READ(MR2)
X#define getMR2() WIZCHIP_READ(MR2)
N
N#define setPHAR(phar) \
N WIZCHIP_WRITE_BUF(PHAR,phar,6)
X#define setPHAR(phar) WIZCHIP_WRITE_BUF(PHAR,phar,6)
N
N#define getPHAR(phar) \
N WIZCHIP_READ_BUF(PHAR,phar,6)
X#define getPHAR(phar) WIZCHIP_READ_BUF(PHAR,phar,6)
N
N#define setPSIDR(psidr) {\
N WIZCHIP_WRITE(PSIDR, (uint8_t)(psidr >> 8)); \
N WIZCHIP_WRITE(PSIDR+1, (uint8_t) psidr); \
N }
X#define setPSIDR(psidr) { WIZCHIP_WRITE(PSIDR, (uint8_t)(psidr >> 8)); WIZCHIP_WRITE(PSIDR+1, (uint8_t) psidr); }
N
N#define getPSIDR() \
N (((uint16_t)WIZCHIP_READ(PSIDR) << 8) + WIZCHIP_READ(PSIDR+1))
X#define getPSIDR() (((uint16_t)WIZCHIP_READ(PSIDR) << 8) + WIZCHIP_READ(PSIDR+1))
N
N#define setPMRUR(pmrur) {\
N WIZCHIP_WRITE(PMRUR, (uint8_t)(pmrur >> 8)); \
N WIZCHIP_WRITE(PMRUR+1, (uint8_t) pmrur); \
N }
X#define setPMRUR(pmrur) { WIZCHIP_WRITE(PMRUR, (uint8_t)(pmrur >> 8)); WIZCHIP_WRITE(PMRUR+1, (uint8_t) pmrur); }
N
N#define getPMRUR() \
N (((uint16_t)WIZCHIP_READ(PMRUR) << 8) + WIZCHIP_READ(PMRUR+1))
X#define getPMRUR() (((uint16_t)WIZCHIP_READ(PMRUR) << 8) + WIZCHIP_READ(PMRUR+1))
N
N#define getPHYSR() \
N WIZCHIP_READ(PHYSR)
X#define getPHYSR() WIZCHIP_READ(PHYSR)
N
N#define getPHYSR1() \
N WIZCHIP_READ(PHYSR1)
X#define getPHYSR1() WIZCHIP_READ(PHYSR1)
N
N//The address of the PHY is fixed as "0x0A".
N#define getPHYAR() \
N WIZCHIP_READ(PHYAR)
X#define getPHYAR() WIZCHIP_READ(PHYAR)
N
N//read the value of the phy address register
N#define getPHYRR() \
N WIZCHIP_READ(PHYRR)
X#define getPHYRR() WIZCHIP_READ(PHYRR)
N
N//write the value to the phy address register
N#define setPHYRR(phyrr) \
N WIZCHIP_WRITE(PHYRR, phyrr)
X#define setPHYRR(phyrr) WIZCHIP_WRITE(PHYRR, phyrr)
N
N
N//read the value of the phy data input register
N#define getPHYDIR() \
N (((uint16_t)WIZCHIP_READ(PHYDIR+1) << 8) + WIZCHIP_READ(PHYDIR))
X#define getPHYDIR() (((uint16_t)WIZCHIP_READ(PHYDIR+1) << 8) + WIZCHIP_READ(PHYDIR))
N
N//write the value of the phy data input register
N#define setPHYDIR(phydir) {\
N WIZCHIP_WRITE(PHYDIR+1, (uint8_t)(phydir >> 8)); \
N WIZCHIP_WRITE(PHYDIR, (uint8_t) phydir); \
N }
X#define setPHYDIR(phydir) { WIZCHIP_WRITE(PHYDIR+1, (uint8_t)(phydir >> 8)); WIZCHIP_WRITE(PHYDIR, (uint8_t) phydir); }
N
N//read the value of the phy data output register
N#define getPHYDOR() \
N (((uint16_t)WIZCHIP_READ(PHYDOR+1) << 8) + WIZCHIP_READ(PHYDOR))
X#define getPHYDOR() (((uint16_t)WIZCHIP_READ(PHYDOR+1) << 8) + WIZCHIP_READ(PHYDOR))
N
N//write the value of the phy data output register
N#define setPHYDOR(phydor) {\
N WIZCHIP_WRITE(PHYDOR, (uint8_t)(phydor >> 8)); \
N WIZCHIP_WRITE(PHYDOR+1, (uint8_t) phydor); \
N }
X#define setPHYDOR(phydor) { WIZCHIP_WRITE(PHYDOR, (uint8_t)(phydor >> 8)); WIZCHIP_WRITE(PHYDOR+1, (uint8_t) phydor); }
N
N//read the value of the phy action register ***meaningless because of this register will be cleared automatically***
N#define getPHYACR() \
N WIZCHIP_READ(PHYACR)
X#define getPHYACR() WIZCHIP_READ(PHYACR)
N
N//write the value of the phy action register
N#define setPHYACR(phyacr) \
N WIZCHIP_WRITE(PHYACR,phyacr)
X#define setPHYACR(phyacr) WIZCHIP_WRITE(PHYACR,phyacr)
N
N
N#define setPHYDIVR(phydivr) \
N WIZCHIP_WRITE(PHYDIVR, phydivr)
X#define setPHYDIVR(phydivr) WIZCHIP_WRITE(PHYDIVR, phydivr)
N
N#define getPHYDIVR() \
N WIZCHIP_READ(PHYDIVR)
X#define getPHYDIVR() WIZCHIP_READ(PHYDIVR)
N
N#define setPHYCR0(phych0) \
N WIZCHIP_WRITE(PHYCR0,phych0)
X#define setPHYCR0(phych0) WIZCHIP_WRITE(PHYCR0,phych0)
N
N#define getPHYCR0() \
N WIZCHIP_READ(PHYCR0)
X#define getPHYCR0() WIZCHIP_READ(PHYCR0)
N
N#define setPHYCR1(phycr1) \
N WIZCHIP_WRITE(PHYCR1,phycr1)
X#define setPHYCR1(phycr1) WIZCHIP_WRITE(PHYCR1,phycr1)
N
N#define getPHYCR1() \
N WIZCHIP_READ(PHYCR1)
X#define getPHYCR1() WIZCHIP_READ(PHYCR1)
N
N#define setSLCR(rqcr) \
N WIZCHIP_WRITE(SLCR, rqcr)
X#define setSLCR(rqcr) WIZCHIP_WRITE(SLCR, rqcr)
N
N#define getSLCR() \
N WIZCHIP_READ(RQCR)
X#define getSLCR() WIZCHIP_READ(RQCR)
N
N#define setSLRTR(slrtr) \
N WIZCHIP_WRITE(SLRTR, (uint8_t)(slrtr >> 8)); \
N WIZCHIP_WRITE(SLRTR+1, (uint8_t) slrtr); \
N
X#define setSLRTR(slrtr) WIZCHIP_WRITE(SLRTR, (uint8_t)(slrtr >> 8)); WIZCHIP_WRITE(SLRTR+1, (uint8_t) slrtr);
N#define getSLRTR() \
N (((uint16_t)WIZCHIP_READ(SLRTR) << 8) + WIZCHIP_READ(SLRTR+1))
X#define getSLRTR() (((uint16_t)WIZCHIP_READ(SLRTR) << 8) + WIZCHIP_READ(SLRTR+1))
N
N#define setSLRCR(slrcr) \
N WIZCHIP_WRITE(SLRCR,slrcr)
X#define setSLRCR(slrcr) WIZCHIP_WRITE(SLRCR,slrcr)
N
N#define getSLRCR() \
N WIZCHIP_READ(SLRCR)
X#define getSLRCR() WIZCHIP_READ(SLRCR)
N
N#define setSLPIPR(slpipr) \
N WIZCHIP_WRITE_BUF(SLPIPR,slpipr,4)
X#define setSLPIPR(slpipr) WIZCHIP_WRITE_BUF(SLPIPR,slpipr,4)
N
N#define getSLPIPR(slpipr) \
N WIZCHIP_READ_BUF(SLPIPR,slpipr,4)
X#define getSLPIPR(slpipr) WIZCHIP_READ_BUF(SLPIPR,slpipr,4)
N
N#define setSLPHAR(slphar) \
N WIZCHIP_WRITE_BUF(SLPHAR,slphar,6)
X#define setSLPHAR(slphar) WIZCHIP_WRITE_BUF(SLPHAR,slphar,6)
N
N#define getSLPHAR(rqphar) \
N WIZCHIP_READ_BUF(SLPHAR,slphar,6)
X#define getSLPHAR(rqphar) WIZCHIP_READ_BUF(SLPHAR,slphar,6)
N
N#define setPINGSEQR(pingseqr) {\
N WIZCHIP_WRITE(PINGSEQR, (uint8_t)(pingseqr >> 8)); \
N WIZCHIP_WRITE(PINGSEQR+1, (uint8_t) pingseqr); \
N }
X#define setPINGSEQR(pingseqr) { WIZCHIP_WRITE(PINGSEQR, (uint8_t)(pingseqr >> 8)); WIZCHIP_WRITE(PINGSEQR+1, (uint8_t) pingseqr); }
N
N#define getPINGSEQR() \
N (((uint16_t)WIZCHIP_READ(PINGSEQR) << 8) + WIZCHIP_READ(PINGSEQR+1))
X#define getPINGSEQR() (((uint16_t)WIZCHIP_READ(PINGSEQR) << 8) + WIZCHIP_READ(PINGSEQR+1))
N
N#define setPINGIDR(pingidr) {\
N WIZCHIP_WRITE(PINGIDR, (uint8_t)(pingidr >> 8)); \
N WIZCHIP_WRITE(PINGIDR+1, (uint8_t) pingidr); \
N }
X#define setPINGIDR(pingidr) { WIZCHIP_WRITE(PINGIDR, (uint8_t)(pingidr >> 8)); WIZCHIP_WRITE(PINGIDR+1, (uint8_t) pingidr); }
N
N#define getPINGIDR() \
N (((uint16_t)WIZCHIP_READ(PINGIDR) << 8) + WIZCHIP_READ(PINGIDR+1))
X#define getPINGIDR() (((uint16_t)WIZCHIP_READ(PINGIDR) << 8) + WIZCHIP_READ(PINGIDR+1))
N
N#define setSLIMR(slimr) \
N WIZCHIP_WRITE(SLIMR, slimr)
X#define setSLIMR(slimr) WIZCHIP_WRITE(SLIMR, slimr)
N
N#define getSLIMR() \
N WIZCHIP_READ(SLIMR)
X#define getSLIMR() WIZCHIP_READ(SLIMR)
N
N#define setSLIR(slir) \
N WIZCHIP_WRITE(SLIR, slir)
X#define setSLIR(slir) WIZCHIP_WRITE(SLIR, slir)
N
N#define getSLIR() \
N WIZCHIP_READ(SLIR)
X#define getSLIR() WIZCHIP_READ(SLIR)
N
N/*Hidden functions for W5100S*/
N#define setDBGOUT(dbgout) {\
N WIZCHIP_WRITE(DBGOUT,(uint8_t)(dbgout >> 16)); \
N WIZCHIP_WRITE(DBGOUT,(uint8_t)(dbgout >> 8)); \
N WIZCHIP_WRITE(DBGOUT,(uint8_t)(dbgout)); \
N }
X#define setDBGOUT(dbgout) { WIZCHIP_WRITE(DBGOUT,(uint8_t)(dbgout >> 16)); WIZCHIP_WRITE(DBGOUT,(uint8_t)(dbgout >> 8)); WIZCHIP_WRITE(DBGOUT,(uint8_t)(dbgout)); }
N
N#define setNICMAXCOLR(nicmaxcolr) \
N WIZCHIP_WRITE(NICMAXCOLR,nicmaxcolr)
X#define setNICMAXCOLR(nicmaxcolr) WIZCHIP_WRITE(NICMAXCOLR,nicmaxcolr)
N
N#define getNICMAXCOLR() \
N WIZCHIP_READ(NICMAXCOLR)
X#define getNICMAXCOLR() WIZCHIP_READ(NICMAXCOLR)
N
N/*Clock lock/unlock*/
N
N#define CHIPLOCK() \
N WIZCHIP_WRITE(CHIPLCKR,0xff)
X#define CHIPLOCK() WIZCHIP_WRITE(CHIPLCKR,0xff)
N
N#define CHIPUNLOCK() \
N WIZCHIP_WRITE(CHIPLCKR,0xCE)
X#define CHIPUNLOCK() WIZCHIP_WRITE(CHIPLCKR,0xCE)
N
N/*Network information lock/unlock*/
N#define NETLOCK() \
N WIZCHIP_WRITE(NETLCKR,0x3A)
X#define NETLOCK() WIZCHIP_WRITE(NETLCKR,0x3A)
N
N#define NETUNLOCK() \
N WIZCHIP_WRITE(NETLCKR,0xC5)
X#define NETUNLOCK() WIZCHIP_WRITE(NETLCKR,0xC5)
N
N/*PHY CR0,CR1 lock/unlock*/
N#define PHYLOCK() \
N WIZCHIP_WRITE(PHYLCKR,0xff)
X#define PHYLOCK() WIZCHIP_WRITE(PHYLCKR,0xff)
N
N#define PHYUNLOCK() \
N WIZCHIP_WRITE(PHYLCKR,0x53)
X#define PHYUNLOCK() WIZCHIP_WRITE(PHYLCKR,0x53)
N
N/**
N * @ingroup Version register_access_function_W5100SS
N * @brief Get version information.
N * @return uint16_t. It must be "0x51"
N */
N#define getVER() \
N (WIZCHIP_READ(VERR))
X#define getVER() (WIZCHIP_READ(VERR))
N
N/*Get 100us internal counter*/
N#define getTCNTR() \
N (((uint16_t)WIZCHIP_READ(TCNTR) << 8) + WIZCHIP_READ(TCNTR+1))
X#define getTCNTR() (((uint16_t)WIZCHIP_READ(TCNTR) << 8) + WIZCHIP_READ(TCNTR+1))
N
N/*Reset 100us internal counter(TCNTR)*/
N#define setTCNTCLKR(var) \
N WIZCHIP_WRITE(TCNTCLKR, var)
X#define setTCNTCLKR(var) WIZCHIP_WRITE(TCNTCLKR, var)
N
N/*w5100s only end*/
N
N
N
N
N
N///////////////////////////////////
N// Socket N register I/O function //
N///////////////////////////////////
N/**
N * @ingroup Socket_register_access_function_W5100S
N * @brief Set @ref Sn_MR register
N * @param sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b> expect <b>bit 4</b>.
N * @param mr Value to set @ref Sn_MR
N * @sa getSn_MR()
N */
N#define setSn_MR(sn, mr) \
N WIZCHIP_WRITE(Sn_MR(sn),mr)
X#define setSn_MR(sn, mr) WIZCHIP_WRITE(Sn_MR(sn),mr)
N
N/**
N * @ingroup Socket_register_access_function_W5100S
N * @brief Get @ref Sn_MR register
N * @param sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b> expect <b>bit 4</b>.
N * @return Value of @ref Sn_MR.
N * @sa setSn_MR()
N */
N#define getSn_MR(sn) \
N WIZCHIP_READ(Sn_MR(sn))
X#define getSn_MR(sn) WIZCHIP_READ(Sn_MR(sn))
N
N/**
N * @ingroup Socket_register_access_function_W5100S
N * @brief Set @ref Sn_CR register
N * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
N * @param (uint8_t)cr Value to set @ref Sn_CR
N * @sa getSn_CR()
N */
N#define setSn_CR(sn, cr) \
N WIZCHIP_WRITE(Sn_CR(sn), cr)
X#define setSn_CR(sn, cr) WIZCHIP_WRITE(Sn_CR(sn), cr)
N
N/**
N * @ingroup Socket_register_access_function_W5100S
N * @brief Get @ref Sn_CR register
N * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
N * @return uint8_t. Value of @ref Sn_CR.
N * @sa setSn_CR()
N */
N#define getSn_CR(sn) \
N WIZCHIP_READ(Sn_CR(sn))
X#define getSn_CR(sn) WIZCHIP_READ(Sn_CR(sn))
N
N/**
N * @ingroup Socket_register_access_function_W5100S
N * @brief Set @ref Sn_IR register
N * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
N * @param (uint8_t)ir Value to set @ref Sn_IR
N * @sa getSn_IR()
N */
N#define setSn_IR(sn, ir) \
N WIZCHIP_WRITE(Sn_IR(sn), ir)
X#define setSn_IR(sn, ir) WIZCHIP_WRITE(Sn_IR(sn), ir)
N
N/**
N * @ingroup Socket_register_access_function_W5100S
N * @brief Get @ref Sn_IR register
N * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
N * @return uint8_t. Value of @ref Sn_IR.
N * @sa setSn_IR()
N */
N#define getSn_IR(sn) \
N WIZCHIP_READ(Sn_IR(sn))
X#define getSn_IR(sn) WIZCHIP_READ(Sn_IR(sn))
N
N/**
N * @ingroup Socket_register_access_function_W5100S
N * @brief Get @ref Sn_SR register
N * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
N * @return uint8_t. Value of @ref Sn_SR.
N */
N#define getSn_SR(sn) \
N WIZCHIP_READ(Sn_SR(sn))
X#define getSn_SR(sn) WIZCHIP_READ(Sn_SR(sn))
N
N/**
N * @ingroup Socket_register_access_function_W5100S
N * @brief Set @ref Sn_PORT register
N * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
N * @param (uint16_t)port Value to set @ref Sn_PORT.
N * @sa getSn_PORT()
N */
N#define setSn_PORT(sn, port) { \
N WIZCHIP_WRITE(Sn_PORT(sn), (uint8_t)(port >> 8)); \
N WIZCHIP_WRITE(WIZCHIP_OFFSET_INC(Sn_PORT(sn),1), (uint8_t) port); \
N }
X#define setSn_PORT(sn, port) { WIZCHIP_WRITE(Sn_PORT(sn), (uint8_t)(port >> 8)); WIZCHIP_WRITE(WIZCHIP_OFFSET_INC(Sn_PORT(sn),1), (uint8_t) port); }
N
N/**
N * @ingroup Socket_register_access_function_W5100S
N * @brief Get @ref Sn_PORT register
N * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
N * @return uint16_t. Value of @ref Sn_PORT.
N * @sa setSn_PORT()
N */
N#define getSn_PORT(sn) \
N (((uint16_t)WIZCHIP_READ(Sn_PORT(sn)) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_PORT(sn),1)))
X#define getSn_PORT(sn) (((uint16_t)WIZCHIP_READ(Sn_PORT(sn)) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_PORT(sn),1)))
N
N/**
N * @ingroup Socket_register_access_function_W5100S
N * @brief Set @ref Sn_DHAR register
N * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
N * @param (uint8_t*)dhar Pointer variable to set socket n destination hardware address. It should be allocated 6 bytes.
N * @sa getSn_DHAR()
N */
N#define setSn_DHAR(sn, dhar) \
N WIZCHIP_WRITE_BUF(Sn_DHAR(sn), dhar, 6)
X#define setSn_DHAR(sn, dhar) WIZCHIP_WRITE_BUF(Sn_DHAR(sn), dhar, 6)
N
N/**
N * @ingroup Socket_register_access_function_W5100S
N * @brief Get @ref Sn_DHAR register
N * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
N * @param (uint8_t*)dhar Pointer variable to get socket n destination hardware address. It should be allocated 6 bytes.
N * @sa setSn_DHAR()
N */
N#define getSn_DHAR(sn, dhar) \
N WIZCHIP_READ_BUF(Sn_DHAR(sn), dhar, 6)
X#define getSn_DHAR(sn, dhar) WIZCHIP_READ_BUF(Sn_DHAR(sn), dhar, 6)
N
N/**
N * @ingroup Socket_register_access_function_W5100S
N * @brief Set @ref Sn_DIPR register
N * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
N * @param (uint8_t*)dipr Pointer variable to set socket n destination IP address. It should be allocated 4 bytes.
N * @sa getSn_DIPR()
N */
N#define setSn_DIPR(sn, dipr) \
N WIZCHIP_WRITE_BUF(Sn_DIPR(sn), dipr, 4)
X#define setSn_DIPR(sn, dipr) WIZCHIP_WRITE_BUF(Sn_DIPR(sn), dipr, 4)
N
N/**
N * @ingroup Socket_register_access_function_W5100S
N * @brief Get @ref Sn_DIPR register
N * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
N * @param (uint8_t*)dipr Pointer variable to get socket n destination IP address. It should be allocated 4 bytes.
N * @sa SetSn_DIPR()
N */
N#define getSn_DIPR(sn, dipr) \
N WIZCHIP_READ_BUF(Sn_DIPR(sn), dipr, 4)
X#define getSn_DIPR(sn, dipr) WIZCHIP_READ_BUF(Sn_DIPR(sn), dipr, 4)
N
N/**
N * @ingroup Socket_register_access_function_W5100S
N * @brief Set @ref Sn_DPORT register
N * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
N * @param (uint16_t)dport Value to set @ref Sn_DPORT
N * @sa getSn_DPORT()
N */
N#define setSn_DPORT(sn, dport) { \
N WIZCHIP_WRITE(Sn_DPORT(sn), (uint8_t) (dport>>8)); \
N WIZCHIP_WRITE(WIZCHIP_OFFSET_INC(Sn_DPORT(sn),1), (uint8_t) dport); \
N }
X#define setSn_DPORT(sn, dport) { WIZCHIP_WRITE(Sn_DPORT(sn), (uint8_t) (dport>>8)); WIZCHIP_WRITE(WIZCHIP_OFFSET_INC(Sn_DPORT(sn),1), (uint8_t) dport); }
N
N/**
N * @ingroup Socket_register_access_function_W5100S
N * @brief Get @ref Sn_DPORT register
N * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
N * @return uint16_t. Value of @ref Sn_DPORT.
N * @sa setSn_DPORT()
N */
N#define getSn_DPORT(sn) \
N (((uint16_t)WIZCHIP_READ(Sn_DPORT(sn)) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_DPORT(sn),1)))
X#define getSn_DPORT(sn) (((uint16_t)WIZCHIP_READ(Sn_DPORT(sn)) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_DPORT(sn),1)))
N
N/**
N * @ingroup Socket_register_access_function_W5100S
N * @brief Set @ref Sn_MSSR register
N * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
N * @param (uint16_t)mss Value to set @ref Sn_MSSR
N * @sa setSn_MSSR()
N */
N#define setSn_MSSR(sn, mss) { \
N WIZCHIP_WRITE(Sn_MSSR(sn), (uint8_t)(mss>>8)); \
N WIZCHIP_WRITE(WIZCHIP_OFFSET_INC(Sn_MSSR(sn),1), (uint8_t) mss); \
N }
X#define setSn_MSSR(sn, mss) { WIZCHIP_WRITE(Sn_MSSR(sn), (uint8_t)(mss>>8)); WIZCHIP_WRITE(WIZCHIP_OFFSET_INC(Sn_MSSR(sn),1), (uint8_t) mss); }
N
N/**
N * @ingroup Socket_register_access_function_W5100S
N * @brief Get @ref Sn_MSSR register
N * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
N * @return uint16_t. Value of @ref Sn_MSSR.
N * @sa setSn_MSSR()
N */
N#define getSn_MSSR(sn) \
N (((uint16_t)WIZCHIP_READ(Sn_MSSR(sn)) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_MSSR(sn),1)))
X#define getSn_MSSR(sn) (((uint16_t)WIZCHIP_READ(Sn_MSSR(sn)) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_MSSR(sn),1)))
N
N/**
N * @ingroup Socket_register_access_function_W5100S
N * @brief Set @ref Sn_PROTO register
N * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
N * @param (uint8_t)proto Value to set \ref Sn_PROTO
N * @sa getSn_PROTO()
N */
N#define setSn_PROTO(sn, proto) \
N WIZCHIP_WRITE(Sn_PROTO(sn), proto)
X#define setSn_PROTO(sn, proto) WIZCHIP_WRITE(Sn_PROTO(sn), proto)
N
N/**
N * @ingroup Socket_register_access_function_W5100S
N * @brief Get @ref Sn_PROTO register
N * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
N * @return uint8_t. Value of @ref Sn_PROTO.
N * @sa setSn_PROTO()
N */
N#define getSn_PROTO(sn) \
N WIZCHIP_READ(Sn_PROTO(sn))
X#define getSn_PROTO(sn) WIZCHIP_READ(Sn_PROTO(sn))
N
N/**
N * @ingroup Socket_register_access_function_W5100S
N * @brief Set @ref Sn_TOS register
N * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
N * @param (uint8_t)tos Value to set @ref Sn_TOS
N * @sa getSn_TOS()
N */
N#define setSn_TOS(sn, tos) \
N WIZCHIP_WRITE(Sn_TOS(sn), tos)
X#define setSn_TOS(sn, tos) WIZCHIP_WRITE(Sn_TOS(sn), tos)
N
N/**
N * @ingroup Socket_register_access_function_W5100S
N * @brief Get @ref Sn_TOS register
N * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_ </b>.
N * @return uint8_t. Value of Sn_TOS.
N * @sa setSn_TOS()
N */
N#define getSn_TOS(sn) \
N WIZCHIP_READ(Sn_TOS(sn))
X#define getSn_TOS(sn) WIZCHIP_READ(Sn_TOS(sn))
N
N/**
N * @ingroup Socket_register_access_function_W5100S
N * @brief Set @ref Sn_TTL register
N * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_ </b>.
N * @param (uint8_t)ttl Value to set @ref Sn_TTL
N * @sa getSn_TTL()
N */
N#define setSn_TTL(sn, ttl) \
N WIZCHIP_WRITE(Sn_TTL(sn), ttl)
X#define setSn_TTL(sn, ttl) WIZCHIP_WRITE(Sn_TTL(sn), ttl)
N
N/**
N * @ingroup Socket_register_access_function_W5100S
N * @brief Get @ref Sn_TTL register
N * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_ </b>.
N * @return uint8_t. Value of @ref Sn_TTL.
N * @sa setSn_TTL()
N */
N#define getSn_TTL(sn) \
N WIZCHIP_READ(Sn_TTL(sn))
X#define getSn_TTL(sn) WIZCHIP_READ(Sn_TTL(sn))
N
N/**
N * @ingroup Socket_register_access_function_W5100S
N * @brief Set @ref Sn_RXMEM_SIZE register
N * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_ </b>.
N * @param (uint8_t)rxmemsize Value to set \ref Sn_RXMEM_SIZE
N * @sa getSn_RXMEM_SIZE()
N */
N#define setSn_RXMEM_SIZE(sn, rxmemsize) \
N WIZCHIP_WRITE(RMSR, (WIZCHIP_READ(RMSR) & ~(0x03 << (2*sn))) | (rxmemsize << (2*sn)))
X#define setSn_RXMEM_SIZE(sn, rxmemsize) WIZCHIP_WRITE(RMSR, (WIZCHIP_READ(RMSR) & ~(0x03 << (2*sn))) | (rxmemsize << (2*sn)))
N#define setSn_RXBUF_SIZE(sn,rxmemsize) setSn_RXMEM_SIZE(sn,rxmemsize)
N
N/**
N * @ingroup Socket_register_access_function_W5100S
N * @brief Get @ref Sn_RXMEM_SIZE register
N * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
N * @return uint8_t. Value of @ref Sn_RXMEM.
N * @sa setSn_RXMEM_SIZE()
N */
N#define getSn_RXMEM_SIZE(sn) \
N ((WIZCHIP_READ(RMSR) & (0x03 << (2*sn))) >> (2*sn))
X#define getSn_RXMEM_SIZE(sn) ((WIZCHIP_READ(RMSR) & (0x03 << (2*sn))) >> (2*sn))
N#define getSn_RXBUF_SIZE(sn) getSn_RXMEM_SIZE(sn)
N
N/**
N * @ingroup Socket_register_access_function_W5100S
N * @brief Set @ref Sn_TXMEM_SIZE register
N * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
N * @param (uint8_t)txmemsize Value to set \ref Sn_TXMEM_SIZE
N * @sa getSn_TXMEM_SIZE()
N */
N#define setSn_TXMEM_SIZE(sn, txmemsize) \
N WIZCHIP_WRITE(TMSR, (WIZCHIP_READ(TMSR) & ~(0x03 << (2*sn))) | (txmemsize << (2*sn)))
X#define setSn_TXMEM_SIZE(sn, txmemsize) WIZCHIP_WRITE(TMSR, (WIZCHIP_READ(TMSR) & ~(0x03 << (2*sn))) | (txmemsize << (2*sn)))
N#define setSn_TXBUF_SIZE(sn, txmemsize) setSn_TXMEM_SIZE(sn,txmemsize)
N
N/**
N * @ingroup Socket_register_access_function_W5100S
N * @brief Get @ref Sn_TXMEM_SIZE register
N * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
N * @return uint8_t. Value of @ref Sn_TXMEM_SIZE.
N * @sa setSn_TXMEM_SIZE()
N */
N#define getSn_TXMEM_SIZE(sn) \
N ((WIZCHIP_READ(TMSR) & (0x03 << (2*sn))) >> (2*sn))
X#define getSn_TXMEM_SIZE(sn) ((WIZCHIP_READ(TMSR) & (0x03 << (2*sn))) >> (2*sn))
N#define getSn_TXBUF_SIZE(sn) getSn_TXMEM_SIZE(sn)
N
N/**
N * @ingroup Socket_register_access_function_W5100S
N * @brief Get @ref Sn_TX_FSR register
N * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
N * @return uint16_t. Value of @ref Sn_TX_FSR.
N */
Nuint16_t getSn_TX_FSR(uint8_t sn);
N
N/**
N * @ingroup Socket_register_access_function_W5100S
N * @brief Get @ref Sn_TX_RD register
N * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
N * @return uint16_t. Value of @ref Sn_TX_RD.
N */
N#define getSn_TX_RD(sn) \
N (((uint16_t)WIZCHIP_READ(Sn_TX_RD(sn)) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_TX_RD(sn),1)))
X#define getSn_TX_RD(sn) (((uint16_t)WIZCHIP_READ(Sn_TX_RD(sn)) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_TX_RD(sn),1)))
N
N/**
N * @ingroup Socket_register_access_function_W5100S
N * @brief Set @ref Sn_TX_WR register
N * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
N * @param (uint16_t)txwr Value to set @ref Sn_TX_WR
N * @sa GetSn_TX_WR()
N */
N#define setSn_TX_WR(sn, txwr) { \
N WIZCHIP_WRITE(Sn_TX_WR(sn), (uint8_t)(txwr>>8)); \
N WIZCHIP_WRITE(WIZCHIP_OFFSET_INC(Sn_TX_WR(sn),1), (uint8_t) txwr); \
N }
X#define setSn_TX_WR(sn, txwr) { WIZCHIP_WRITE(Sn_TX_WR(sn), (uint8_t)(txwr>>8)); WIZCHIP_WRITE(WIZCHIP_OFFSET_INC(Sn_TX_WR(sn),1), (uint8_t) txwr); }
N
N/**
N * @ingroup Socket_register_access_function_W5100S
N * @brief Get @ref Sn_TX_WR register
N * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
N * @return uint16_t. Value of @ref Sn_TX_WR.
N * @sa setSn_TX_WR()
N */
N#define getSn_TX_WR(sn) \
N (((uint16_t)WIZCHIP_READ(Sn_TX_WR(sn)) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_TX_WR(sn),1)))
X#define getSn_TX_WR(sn) (((uint16_t)WIZCHIP_READ(Sn_TX_WR(sn)) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_TX_WR(sn),1)))
N
N/**
N * @ingroup Socket_register_access_function_W5100S
N * @brief Get @ref Sn_RX_RSR register
N * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
N * @return uint16_t. Value of @ref Sn_RX_RSR.
N */
Nuint16_t getSn_RX_RSR(uint8_t sn);
N
N/**
N * @ingroup Socket_register_access_function_W5100S
N * @brief Set @ref Sn_RX_RD register
N * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
N * @param (uint16_t)rxrd Value to set @ref Sn_RX_RD
N * @sa getSn_RX_RD()
N */
N#define setSn_RX_RD(sn, rxrd) { \
N WIZCHIP_WRITE(Sn_RX_RD(sn), (uint8_t)(rxrd>>8)); \
N WIZCHIP_WRITE(WIZCHIP_OFFSET_INC(Sn_RX_RD(sn),1), (uint8_t) rxrd); \
N }
X#define setSn_RX_RD(sn, rxrd) { WIZCHIP_WRITE(Sn_RX_RD(sn), (uint8_t)(rxrd>>8)); WIZCHIP_WRITE(WIZCHIP_OFFSET_INC(Sn_RX_RD(sn),1), (uint8_t) rxrd); }
N
N/**
N * @ingroup Socket_register_access_function_W5100S
N * @brief Get @ref Sn_RX_RD register
N * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
N * @regurn uint16_t. Value of @ref Sn_RX_RD.
N * @sa setSn_RX_RD()
N */
N#define getSn_RX_RD(sn) \
N (((uint16_t)WIZCHIP_READ(Sn_RX_RD(sn)) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_RX_RD(sn),1)))
X#define getSn_RX_RD(sn) (((uint16_t)WIZCHIP_READ(Sn_RX_RD(sn)) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_RX_RD(sn),1)))
N
N/**
N * @ingroup Socket_register_access_function_W5100S
N * @brief Set @ref Sn_RX_WR register
N * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
N * @param (uint16_t)rxwr Value to set \ref Sn_RX_WR
N * @sa getSn_RX_WR()
N */
N#define setSn_RX_WR(sn, rxwr) { \
N WIZCHIP_WRITE(Sn_RX_WR(sn), (uint8_t)(rxwr>>8)); \
N WIZCHIP_WRITE(WIZCHIP_OFFSET_INC(Sn_RX_WR(sn),1), (uint8_t) rxwr); \
N }
X#define setSn_RX_WR(sn, rxwr) { WIZCHIP_WRITE(Sn_RX_WR(sn), (uint8_t)(rxwr>>8)); WIZCHIP_WRITE(WIZCHIP_OFFSET_INC(Sn_RX_WR(sn),1), (uint8_t) rxwr); }
N
N
N/**
N * @ingroup Socket_register_access_function_W5100S
N * @brief Get @ref Sn_RX_WR register
N * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
N * @return uint16_t. Value of @ref Sn_RX_WR.
N */
N#define getSn_RX_WR(sn) \
N (((uint16_t)WIZCHIP_READ(Sn_RX_WR(sn)) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_RX_WR(sn),1)))
X#define getSn_RX_WR(sn) (((uint16_t)WIZCHIP_READ(Sn_RX_WR(sn)) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_RX_WR(sn),1)))
N
N/**
N * @ingroup Socket_register_access_function_W5100S
N * @brief Set @ref Sn_FRAGR register
N * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
N * @param (uint16_t)frag Value to set \ref Sn_FRAGR
N * @sa getSn_FRAG()
N */
N#define setSn_FRAGR(sn, fragr) { \
N WIZCHIP_WRITE(Sn_FRAGR(sn), (uint8_t)(fragr >>8)); \
N WIZCHIP_WRITE(WIZCHIP_OFFSET_INC(Sn_FRAGR(sn),1), (uint8_t) fragr); \
N }
X#define setSn_FRAGR(sn, fragr) { WIZCHIP_WRITE(Sn_FRAGR(sn), (uint8_t)(fragr >>8)); WIZCHIP_WRITE(WIZCHIP_OFFSET_INC(Sn_FRAGR(sn),1), (uint8_t) fragr); }
N
N/**
N * @ingroup Socket_register_access_function_W5100S
N * @brief Get @ref Sn_FRAGR register
N * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
N * @return uint16_t. Value of @ref Sn_FRAGR.
N * @sa setSn_FRAG()
N */
N#define getSn_FRAGR(sn) \
N (((uint16_t)WIZCHIP_READ(Sn_FRAGR(sn)) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_FRAGR(sn),1)))
X#define getSn_FRAGR(sn) (((uint16_t)WIZCHIP_READ(Sn_FRAGR(sn)) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_FRAGR(sn),1)))
N
N/**
N * @ingroup Socket_register_access_function_W5100S
N * @brief Get the max RX buffer size of socket sn
N * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
N * @return uint16_t. Max buffer size
N */
N#define getSn_RxMAX(sn) \
N ((uint16_t)(1 << getSn_RXMEM_SIZE(sn)) << 10) //getSn_RXMEM_SIZE(sn) è·å对åºSOCKETæ¥æ¶ç¼å大å°
X#define getSn_RxMAX(sn) ((uint16_t)(1 << getSn_RXMEM_SIZE(sn)) << 10)
N
N
N/**
N * @ingroup Socket_register_access_function_W5100S
N * @brief Get the max TX buffer size of socket sn
N * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
N * @return uint16_t. Max buffer size
N */
N#define getSn_TxMAX(sn) \
N ((uint16_t)(1 << getSn_TXMEM_SIZE(sn)) << 10)
X#define getSn_TxMAX(sn) ((uint16_t)(1 << getSn_TXMEM_SIZE(sn)) << 10)
N
N/**
N * @ingroup Socket_register_access_function_W5100S
N * @brief Get the mask of socket sn RX buffer.
N * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
N * @return uint16_t. Mask value
N */
N#define getSn_RxMASK(sn) \
N (getSn_RxMAX(sn) - 1)
X#define getSn_RxMASK(sn) (getSn_RxMAX(sn) - 1)
N
N/**
N * @ingroup Socket_register_access_function_W5100S
N * @brief Get the mask of socket sn TX buffer
N * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
N * @return uint16_t. Mask value
N */
N#define getSn_TxMASK(sn) \
N (getSn_TxMAX(sn) - 1)
X#define getSn_TxMASK(sn) (getSn_TxMAX(sn) - 1)
N
N
N/**
N * @ingroup Socket_register_access_function_W5100S
N * @brief Get the base address of socket sn RX buffer.
N * @param sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
N * @return uint16_t. Value of Socket n RX buffer base address.
N */
Nuint32_t getSn_RxBASE(uint8_t sn);
N
N/**
N * @ingroup Socket_register_access_function_W5100S
N * @brief Get the base address of socket sn TX buffer.
N * @param sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
N * @return uint16_t. Value of Socket n TX buffer base address.
N */
Nuint32_t getSn_TxBASE(uint8_t sn);
N
N/*socket register W5100S only*/
N
N#define setSn_IMR(sn,imr) \
N WIZCHIP_WRITE(Sn_IMR(sn),imr)
X#define setSn_IMR(sn,imr) WIZCHIP_WRITE(Sn_IMR(sn),imr)
N
N#define getSn_IMR(sn) \
N WIZCHIP_WRITE(Sn_IMR(sn))
X#define getSn_IMR(sn) WIZCHIP_WRITE(Sn_IMR(sn))
N
N#define setSn_MR2(sn,mr2) \
N WIZCHIP_WRITE(Sn_MR2(sn), mr2)
X#define setSn_MR2(sn,mr2) WIZCHIP_WRITE(Sn_MR2(sn), mr2)
N
N#define getSn_MR2(sn) \
N WIZCHIP_READ(Sn_MR2(sn))
X#define getSn_MR2(sn) WIZCHIP_READ(Sn_MR2(sn))
N
N#define setSn_KPALVTR(sn,kpalvtr) \
N WIZCHIP_WRITE(Sn_KPALVTR(sn), kpalvtr)
X#define setSn_KPALVTR(sn,kpalvtr) WIZCHIP_WRITE(Sn_KPALVTR(sn), kpalvtr)
N
N#define getSn_KPALVTR(sn) \
N WIZCHIP_READ(Sn_KPALVTR(sn))
X#define getSn_KPALVTR(sn) WIZCHIP_READ(Sn_KPALVTR(sn))
N
N#define getSn_TSR(sn) \
N WIZCHIP_READ(Sn_TSR(sn))
X#define getSn_TSR(sn) WIZCHIP_READ(Sn_TSR(sn))
N
N#define setSn_RTR(sn,rtr) { \
N WIZCHIP_WRITE(Sn_RTR(sn), (uint8_t)(rtr >> 8)); \
N WIZCHIP_WRITE(WIZCHIP_OFFSET_INC(Sn_RTR(sn),1), (uint8_t) rtr); \
N }
X#define setSn_RTR(sn,rtr) { WIZCHIP_WRITE(Sn_RTR(sn), (uint8_t)(rtr >> 8)); WIZCHIP_WRITE(WIZCHIP_OFFSET_INC(Sn_RTR(sn),1), (uint8_t) rtr); }
N
N#define getSn_RTR(sn) \
N (((uint16_t)WIZCHIP_READ(Sn_RTR(sn)) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_RTR(sn),1)))
X#define getSn_RTR(sn) (((uint16_t)WIZCHIP_READ(Sn_RTR(sn)) << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_RTR(sn),1)))
N
N#define setSn_RCR(sn,rcr) \
N WIZCHIP_WRITE(Sn_RCR(sn),rcr)
X#define setSn_RCR(sn,rcr) WIZCHIP_WRITE(Sn_RCR(sn),rcr)
N
N#define getSn_RCR(sn) \
N WIZCHIP_READ(Sn_RCR(sn))
X#define getSn_RCR(sn) WIZCHIP_READ(Sn_RCR(sn))
N
N/////////////////////////////////////
N// Sn_TXBUF & Sn_RXBUF IO function //
N/////////////////////////////////////
N/**
N * @ingroup Basic_IO_function_W5100S
N * @brief It copies data to internal TX memory
N *
N * @details This function reads the Tx write pointer register and after that,
N * it copies the <i>wizdata(pointer buffer)</i> of the length of <i>len(variable)</i> bytes to internal TX memory
N * and updates the Tx write pointer register.
N * This function is being called by send() and sendto() function also.
N *
N * @param sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
N * @param wizdata Pointer buffer to write data
N * @param len Data length
N * @sa wiz_recv_data()
N */
Nvoid wiz_send_data(uint8_t sn, uint8_t *wizdata, uint16_t len);
N
N/**
N * @ingroup Basic_IO_function_W5100S
N * @brief It copies data to your buffer from internal RX memory
N *
N * @details This function read the Rx read pointer register and after that,
N * it copies the received data from internal RX memory
N * to <i>wizdata(pointer variable)</i> of the length of <i>len(variable)</i> bytes.
N * This function is being called by recv() also.
N *
N * @param sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
N * @param wizdata Pointer buffer to read data
N * @param len Data length
N * @sa wiz_send_data()
N */
Nvoid wiz_recv_data(uint8_t sn, uint8_t *wizdata, uint16_t len);
N
N/**
N * @ingroup Basic_IO_function_W5100S
N * @brief It discard the received data in RX memory.
N * @details It discards the data of the length of <i>len(variable)</i> bytes in internal RX memory.
N * @param (uint8_t)sn Socket number. It should be <b>0 ~ @ref \_WIZCHIP_SOCK_NUM_</b>.
N * @param len Data length
N */
Nvoid wiz_recv_ignore(uint8_t sn, uint16_t len);
N
N//todo comment nedded
Nvoid wiz_mdio_write(uint8_t PHYMDIO_regadr, uint16_t var);
N
Nuint16_t wiz_mdio_read(uint8_t PHYMDIO_regadr);
N
N// add code 2020-2-1
Nextern uint8_t wizchip_spi_readbyte(void); // add code 2020-2-1
Nextern void wizchip_spi_writebyte(uint8_t wb); // add code 2020-2-1
N/// @cond DOXY_APPLY_CODE
N
N/// @endcond
N
N#endif //_W5100_H_
N
N
L 2 "..\..\User\W5100S\w5100s.c" 2
N#if (_WIZCHIP_ == W5100S)
X#if (5105 == 5105)
N
Nvoid WIZCHIP_WRITE(uint32_t AddrSel, uint8_t wb )
N{
N WIZCHIP_CRITICAL_ENTER();
X WIZCHIP . CRIS . _enter();
N WIZCHIP.CS._select();
N
N#if( (_WIZCHIP_IO_MODE_ == _WIZCHIP_IO_MODE_SPI_))
X#if( (0x0200 == 0x0200))
N WIZCHIP.IF.SPI._write_byte(0xF0);
N WIZCHIP.IF.SPI._write_byte((AddrSel & 0xFF00) >> 8);
N WIZCHIP.IF.SPI._write_byte((AddrSel & 0x00FF) >> 0);
N WIZCHIP.IF.SPI._write_byte(wb); // Data write (write 1byte data)
N#elif ( (_WIZCHIP_IO_MODE_ == _WIZCHIP_IO_MODE_BUS_INDIR_) )
S WIZCHIP.IF.BUS._write_data(IDM_AR0,(AddrSel & 0xFF00) >> 8);
S WIZCHIP.IF.BUS._write_data(IDM_AR1,(AddrSel & 0x00FF));
S WIZCHIP.IF.BUS._write_data(IDM_DR,wb);
N#endif
N WIZCHIP.CS._deselect();
N WIZCHIP_CRITICAL_EXIT();
X WIZCHIP . CRIS . _exit();
N}
N
Nuint8_t WIZCHIP_READ(uint32_t AddrSel)
N{
N uint8_t ret;
N
N WIZCHIP_CRITICAL_ENTER();
X WIZCHIP . CRIS . _enter();
N WIZCHIP.CS._select();
N
N#if( (_WIZCHIP_IO_MODE_ == _WIZCHIP_IO_MODE_SPI_))
X#if( (0x0200 == 0x0200))
N WIZCHIP.IF.SPI._write_byte(0x0F); // 0X0F--¶Á 0XF0--д
N WIZCHIP.IF.SPI._write_byte((AddrSel & 0xFF00) >> 8);
N WIZCHIP.IF.SPI._write_byte((AddrSel & 0x00FF) >> 0);
N ret = WIZCHIP.IF.SPI._read_byte();
N#elif ( (_WIZCHIP_IO_MODE_ == _WIZCHIP_IO_MODE_BUS_INDIR_) )
S WIZCHIP.IF.BUS._write_data(IDM_AR0,(AddrSel & 0xFF00) >> 8);
S WIZCHIP.IF.BUS._write_data(IDM_AR1,(AddrSel & 0x00FF));
S ret = WIZCHIP.IF.BUS._read_data(IDM_DR);
N#endif
N WIZCHIP.CS._deselect();
N WIZCHIP_CRITICAL_EXIT();
X WIZCHIP . CRIS . _exit();
N return ret;
N}
N
Nvoid WIZCHIP_WRITE_BUF(uint32_t AddrSel, uint8_t* pBuf, uint16_t len)
N{
N uint16_t i = 0;
N
N WIZCHIP_CRITICAL_ENTER();
X WIZCHIP . CRIS . _enter();
N WIZCHIP.CS._select(); //M20150601 : Moved here.
N
N#if ((_WIZCHIP_IO_MODE_ == _WIZCHIP_IO_MODE_SPI_))
X#if ((0x0200 == 0x0200))
N
N WIZCHIP.IF.SPI._write_byte(0xF0); // 0XF0--д 0x0F---¶ÁÃüÁî
N WIZCHIP.IF.SPI._write_byte((((uint16_t)(AddrSel+i)) & 0xFF00) >> 8);
N WIZCHIP.IF.SPI._write_byte((((uint16_t)(AddrSel+i)) & 0x00FF) >> 0);
N
N for(i = 0; i < len; i++) // ÒÀ´ÎдÈë¶à¸ö×Ö½Ú
N {
N WIZCHIP.IF.SPI._write_byte(pBuf[i]); // Data write (write 1byte data)
N }
N#elif ( (_WIZCHIP_IO_MODE_ == _WIZCHIP_IO_MODE_BUS_INDIR_) )
S setMR(getMR()|MR_AI);
S WIZCHIP.IF.BUS._write_data(IDM_AR0,(AddrSel & 0xFF00) >> 8);
S WIZCHIP.IF.BUS._write_data(IDM_AR1,(AddrSel & 0x00FF));
S for(i = 0 ; i < len; i++)
S WIZCHIP.IF.BUS._write_data(IDM_DR,pBuf[i]);
S setMR(getMR() & ~MR_AI);
S
S
N#endif
N
N WIZCHIP.CS._deselect(); //M20150601 : Moved here.
N WIZCHIP_CRITICAL_EXIT();
X WIZCHIP . CRIS . _exit();
N}
N
N
Nvoid WIZCHIP_READ_BUF (uint32_t AddrSel, uint8_t* pBuf, uint16_t len)
N{
N uint16_t i = 0;
N WIZCHIP_CRITICAL_ENTER();
X WIZCHIP . CRIS . _enter();
N WIZCHIP.CS._select(); //M20150601 : Moved here.
N
N#if ( (_WIZCHIP_IO_MODE_ == _WIZCHIP_IO_MODE_SPI_) )
X#if ( (0x0200 == 0x0200) )
N
N WIZCHIP.IF.SPI._write_byte(0x0F);
N WIZCHIP.IF.SPI._write_byte((uint16_t)((AddrSel+i) & 0xFF00) >> 8);
N WIZCHIP.IF.SPI._write_byte((uint16_t)((AddrSel+i) & 0x00FF) >> 0);
N
N for(i = 0; i < len; i++)
N {
N pBuf[i] = WIZCHIP.IF.SPI._read_byte();
N }
N#elif ( (_WIZCHIP_IO_MODE_ == _WIZCHIP_IO_MODE_BUS_INDIR_) )
S setMR(getMR() | MR_AI);
S WIZCHIP.IF.BUS._write_data(IDM_AR0,(AddrSel & 0xFF00) >> 8);
S WIZCHIP.IF.BUS._write_data(IDM_AR1,(AddrSel & 0x00FF));
S for(i = 0 ; i < len; i++)
S pBuf[i] = WIZCHIP.IF.BUS._read_data(IDM_DR);
S setMR(getMR() & ~MR_AI);
N#endif
N WIZCHIP.CS._deselect(); //M20150601 : Moved Here.
N WIZCHIP_CRITICAL_EXIT();
X WIZCHIP . CRIS . _exit();
N}
N
N///////////////////////////////////
N// Socket N regsiter IO function //
N///////////////////////////////////
N
Nuint16_t getSn_TX_FSR(uint8_t sn)
N{
N uint16_t val=0,val1=0;
N do
N {
N val1 = WIZCHIP_READ(Sn_TX_FSR(sn));
X val1 = WIZCHIP_READ((0x0000 + ((0x0400)+ (0x0100)*sn) + (0x0020)));
N val1 = (val1 << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_TX_FSR(sn),1));
X val1 = (val1 << 8) + WIZCHIP_READ(((0x0000 + ((0x0400)+ (0x0100)*sn) + (0x0020)) + 1));
N if (val1 != 0)
N {
N val = WIZCHIP_READ(Sn_TX_FSR(sn));
X val = WIZCHIP_READ((0x0000 + ((0x0400)+ (0x0100)*sn) + (0x0020)));
N val = (val << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_TX_FSR(sn),1));
X val = (val << 8) + WIZCHIP_READ(((0x0000 + ((0x0400)+ (0x0100)*sn) + (0x0020)) + 1));
N }
N }while (val != val1);
N return val;
N}
N
N
Nuint16_t getSn_RX_RSR(uint8_t sn)
N{
N uint16_t val=0,val1=0;
N do
N {
N val1 = WIZCHIP_READ(Sn_RX_RSR(sn)); // ¶ÁÈ¡½ÓÊÕÊý¾Ý´óС ¸ß8
X val1 = WIZCHIP_READ((0x0000 + ((0x0400)+ (0x0100)*sn) + (0x0026)));
N val1 = (val1 << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_RX_RSR(sn),1));
X val1 = (val1 << 8) + WIZCHIP_READ(((0x0000 + ((0x0400)+ (0x0100)*sn) + (0x0026)) + 1));
N if (val1 != 0)
N {
N val = WIZCHIP_READ(Sn_RX_RSR(sn));
X val = WIZCHIP_READ((0x0000 + ((0x0400)+ (0x0100)*sn) + (0x0026)));
N val = (val << 8) + WIZCHIP_READ(WIZCHIP_OFFSET_INC(Sn_RX_RSR(sn),1));
X val = (val << 8) + WIZCHIP_READ(((0x0000 + ((0x0400)+ (0x0100)*sn) + (0x0026)) + 1));
N }
N }while (val != val1);
N return val;
N}
N
N/////////////////////////////////////
N// Sn_TXBUF & Sn_RXBUF IO function //
N/////////////////////////////////////
Nuint32_t getSn_RxBASE(uint8_t sn)
N{
N int8_t i;
N#if ( _WIZCHIP_IO_MODE_ == _WIZCHIP_IO_MODE_BUS_DIR_)
X#if ( 0x0200 == (0x0100 + 1))
S uint32_t rxbase = _W5100_IO_BASE_ + _WIZCHIP_IO_RXBUF_;
N#else
N uint32_t rxbase = _WIZCHIP_IO_RXBUF_;
X uint32_t rxbase = (0x6000);
N#endif
N for(i = 0; i < sn; i++)
N rxbase += getSn_RxMAX(i);
X rxbase += ((uint16_t)(1 << ((WIZCHIP_READ((0x0000 + (0x001A))) & (0x03 << (2*i))) >> (2*i))) << 10);
N
N return rxbase;
N}
N
Nuint32_t getSn_TxBASE(uint8_t sn)
N{
N int8_t i;
N#if ( _WIZCHIP_IO_MODE_ == _WIZCHIP_IO_MODE_BUS_DIR_)
X#if ( 0x0200 == (0x0100 + 1))
S uint32_t txbase = _W5100_IO_BASE_ + _WIZCHIP_IO_TXBUF_;
N#else
N uint32_t txbase = _WIZCHIP_IO_TXBUF_;
X uint32_t txbase = (0x4000);
N#endif
N for(i = 0; i < sn; i++)
N txbase += getSn_TxMAX(i);
X txbase += ((uint16_t)(1 << ((WIZCHIP_READ((0x0000 + (0x001B))) & (0x03 << (2*i))) >> (2*i))) << 10);
N return txbase;
N}
N
N/**
N@brief This function is being called by send() and sendto() function also. for copy the data form application buffer to Transmite buffer of the chip.
N
NThis function read the Tx write pointer register and after copy the data in buffer update the Tx write pointer
Nregister. User should read upper byte first and lower byte later to get proper value.
NAnd this function is being used for copy the data form application buffer to Transmite
Nbuffer of the chip. It calculate the actual physical address where one has to write
Nthe data in transmite buffer. Here also take care of the condition while it exceed
Nthe Tx memory uper-bound of socket.
N
N*/
Nvoid wiz_send_data(uint8_t sn, uint8_t *wizdata, uint16_t len)
N{
N uint16_t ptr;
N uint16_t size;
N uint16_t dst_mask;
N uint16_t dst_ptr;
N
N ptr = getSn_TX_WR(sn); // »ñÈ¡·¢ËÍдָÕë¼Ä´æÆ÷Öµ
X ptr = (((uint16_t)WIZCHIP_READ((0x0000 + ((0x0400)+ (0x0100)*sn) + (0x0024))) << 8) + WIZCHIP_READ(((0x0000 + ((0x0400)+ (0x0100)*sn) + (0x0024)) + 1)));
N
N dst_mask = ptr & getSn_TxMASK(sn);
X dst_mask = ptr & (((uint16_t)(1 << ((WIZCHIP_READ((0x0000 + (0x001B))) & (0x03 << (2*sn))) >> (2*sn))) << 10) - 1);
N dst_ptr = getSn_TxBASE(sn) + dst_mask;
N
N if (dst_mask + len > getSn_TxMAX(sn))
X if (dst_mask + len > ((uint16_t)(1 << ((WIZCHIP_READ((0x0000 + (0x001B))) & (0x03 << (2*sn))) >> (2*sn))) << 10))
N {
N size = getSn_TxMAX(sn) - dst_mask;
X size = ((uint16_t)(1 << ((WIZCHIP_READ((0x0000 + (0x001B))) & (0x03 << (2*sn))) >> (2*sn))) << 10) - dst_mask;
N WIZCHIP_WRITE_BUF(dst_ptr, wizdata, size);
N wizdata += size;
N size = len - size;
N dst_ptr = getSn_TxBASE(sn);
N WIZCHIP_WRITE_BUF(dst_ptr, wizdata, size);
N }
N else
N {
N WIZCHIP_WRITE_BUF(dst_ptr, wizdata, len);
N }
N
N ptr += len;
N
N setSn_TX_WR(sn, ptr);
X { WIZCHIP_WRITE((0x0000 + ((0x0400)+ (0x0100)*sn) + (0x0024)), (uint8_t)(ptr>>8)); WIZCHIP_WRITE(((0x0000 + ((0x0400)+ (0x0100)*sn) + (0x0024)) + 1), (uint8_t) ptr); };
N}
N
N
N/**
N@brief This function is being called by recv() also. This function is being used for copy the data form Receive buffer of the chip to application buffer.
N
NThis function read the Rx read pointer register
Nand after copy the data from receive buffer update the Rx write pointer register.
NUser should read upper byte first and lower byte later to get proper value.
NIt calculate the actual physical address where one has to read
Nthe data from Receive buffer. Here also take care of the condition while it exceed
Nthe Rx memory uper-bound of socket.
N*/
Nvoid wiz_recv_data(uint8_t sn, uint8_t *wizdata, uint16_t len)
N{
N uint16_t ptr;
N uint16_t size;
N uint16_t src_mask;
N uint16_t src_ptr;
N
N ptr = getSn_RX_RD(sn); // ¶ÁÈ¡ ½ÓÊÕ¶ÁÖ¸Õë¼Ä´æÆ÷Öµ
X ptr = (((uint16_t)WIZCHIP_READ((0x0000 + ((0x0400)+ (0x0100)*sn) + (0x0028))) << 8) + WIZCHIP_READ(((0x0000 + ((0x0400)+ (0x0100)*sn) + (0x0028)) + 1)));
N
N src_mask = (uint32_t)ptr & getSn_RxMASK(sn); // getSn_RxMASK(sn)--½ÓÊÕ»º´æ´óС-1
X src_mask = (uint32_t)ptr & (((uint16_t)(1 << ((WIZCHIP_READ((0x0000 + (0x001A))) & (0x03 << (2*sn))) >> (2*sn))) << 10) - 1);
N src_ptr = (getSn_RxBASE(sn) + src_mask);
N
N
N if( (src_mask + len) > getSn_RxMAX(sn) )
X if( (src_mask + len) > ((uint16_t)(1 << ((WIZCHIP_READ((0x0000 + (0x001A))) & (0x03 << (2*sn))) >> (2*sn))) << 10) )
N {
N size = getSn_RxMAX(sn) - src_mask;
X size = ((uint16_t)(1 << ((WIZCHIP_READ((0x0000 + (0x001A))) & (0x03 << (2*sn))) >> (2*sn))) << 10) - src_mask;
N WIZCHIP_READ_BUF((uint32_t)src_ptr, (uint8_t*)wizdata, size);
N wizdata += size;
N size = len - size;
N src_ptr = getSn_RxBASE(sn);
N WIZCHIP_READ_BUF(src_ptr, (uint8_t*)wizdata, size);
N }
N else
N {
N WIZCHIP_READ_BUF(src_ptr, (uint8_t*)wizdata, len);
N }
N
N ptr += len;
N
N setSn_RX_RD(sn, ptr);
X { WIZCHIP_WRITE((0x0000 + ((0x0400)+ (0x0100)*sn) + (0x0028)), (uint8_t)(ptr>>8)); WIZCHIP_WRITE(((0x0000 + ((0x0400)+ (0x0100)*sn) + (0x0028)) + 1), (uint8_t) ptr); };
N}
N
Nvoid wiz_recv_ignore(uint8_t sn, uint16_t len)
N{
N uint16_t ptr;
N
N ptr = getSn_RX_RD(sn);
X ptr = (((uint16_t)WIZCHIP_READ((0x0000 + ((0x0400)+ (0x0100)*sn) + (0x0028))) << 8) + WIZCHIP_READ(((0x0000 + ((0x0400)+ (0x0100)*sn) + (0x0028)) + 1)));
N
N ptr += len;
N setSn_RX_RD(sn,ptr);
X { WIZCHIP_WRITE((0x0000 + ((0x0400)+ (0x0100)*sn) + (0x0028)), (uint8_t)(ptr>>8)); WIZCHIP_WRITE(((0x0000 + ((0x0400)+ (0x0100)*sn) + (0x0028)) + 1), (uint8_t) ptr); };
N}
N
N//todo comment needed
Nvoid wiz_mdio_write(uint8_t PHYMDIO_regadr, uint16_t var)
N{
N //set the address to write
N setPHYRR(PHYMDIO_regadr);
X WIZCHIP_WRITE((0x0000 + (0x003F)), PHYMDIO_regadr);
N //set the data to write
N setPHYDIR(var);
X { WIZCHIP_WRITE((0x0000 + (0x0040))+1, (uint8_t)(var >> 8)); WIZCHIP_WRITE((0x0000 + (0x0040)), (uint8_t) var); };
N //write command
N setPHYACR(PHYACR_WRITE);
X WIZCHIP_WRITE((0x0000 + (0x0044)),0x01);
N
N while(getPHYACR() != 0){
X while(WIZCHIP_READ((0x0000 + (0x0044))) != 0){
N //wait until command executed.
N }
N}
N
Nuint16_t wiz_mdio_read(uint8_t PHYMDIO_regadr)
N{
N setPHYRR(PHYMDIO_regadr);
X WIZCHIP_WRITE((0x0000 + (0x003F)), PHYMDIO_regadr);
N setPHYACR(PHYACR_READ);
X WIZCHIP_WRITE((0x0000 + (0x0044)),0x02);
N while(getPHYACR() != 0){
X while(WIZCHIP_READ((0x0000 + (0x0044))) != 0){
N //wait until command executed.
N }
N return getPHYDOR();
X return (((uint16_t)WIZCHIP_READ((0x0000 + (0x0042))+1) << 8) + WIZCHIP_READ((0x0000 + (0x0042))));
N}
N
N#endif