]> rtime.felk.cvut.cz Git - pes-rpp/rpp-test-sw.git/blob - rpp-test-sw/commands/cmd_netstats.c
Test software functionality temporarily reduced for SCI peripheral only
[pes-rpp/rpp-test-sw.git] / rpp-test-sw / commands / cmd_netstats.c
1 /*
2  * Copyright (C) 2012-2013 Czech Technical University in Prague
3  *
4  * Created on: Aug 23, 2013
5  *
6  * Authors:
7  *     - Jan Dolezal <pm.jenik@gmail.com>
8  *
9  * This document contains proprietary information belonging to Czech
10  * Technical University in Prague. Passing on and copying of this
11  * document, and communication of its contents is not permitted
12  * without prior written authorization.
13  *
14  * File : cmd_netstats.c
15  *
16  * Abstract:
17  *      This file contains commands for net statistics (ethernet interface and LwIP)
18  *
19  */
20
21 #include "cmd_netstats.h"
22
23 #ifndef DOCGEN
24
25 #include <string.h>
26
27 #include "rpp/rpp.h"
28 #include "drv/emac.h"
29 #include "lwip/opt.h"
30 #include "lwip/stats.h"
31
32 #define INTERFACE_INSTANCE_NUMBER 0
33
34 int cmd_do_read_linkstat(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
35 {
36         if (!isPostInitialized()) {
37                 rpp_sci_printf("Eth not initialized run 'ethinit' command first.\n");
38                 return FAILURE;
39         }
40         struct netif *netif = rpp_eth_get_netif(INTERFACE_INSTANCE_NUMBER);
41         if (rpp_eth_phylinkstat(INTERFACE_INSTANCE_NUMBER))
42                 rpp_sci_printf("%c%c%d : UP\r\n", netif->name[0], netif->name[1], netif->num);
43         else
44                 rpp_sci_printf("%c%c%d : DOWN\r\n", netif->name[0], netif->name[1], netif->num);
45         return SUCCESS;
46 }
47
48 int cmd_do_read_mac(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
49 {
50         if (!isPostInitialized()) {
51                 rpp_sci_printf("Eth not initialized run 'ethinit' command first.\n");
52                 return FAILURE;
53         }
54         uint8_t macaddr[18];
55         rpp_eth_get_macAddrStr(INTERFACE_INSTANCE_NUMBER,macaddr);
56         rpp_sci_printf((const char *)"%s\n", macaddr);
57         return SUCCESS;
58 }
59
60 int cmd_do_read_ip(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
61 {
62         if (!isPostInitialized()) {
63                 rpp_sci_printf("Eth not initialized run 'ethinit' command first.\n");
64                 return FAILURE;
65         }
66         struct netif *netif = rpp_eth_get_netif(INTERFACE_INSTANCE_NUMBER);
67         uint8_t ipString[16];
68         rpp_eth_getIPDecimalStr(netif->ip_addr, ipString);
69         rpp_sci_printf("Address: %s\r\n", ipString);
70         rpp_eth_getIPDecimalStr(netif->netmask, ipString);
71         rpp_sci_printf("Netmask: %s\r\n", ipString);
72         rpp_eth_getIPDecimalStr(netif->gw, ipString);
73         rpp_sci_printf("Gateway: %s\r\n", ipString);
74         return SUCCESS;
75 }
76
77
78
79
80 /*      --- EMAC DESCRIPTOR FORMAT ---
81  *                                         bit fields
82  * WORD   |
83  * OFFSET | 31                               16 | 15                                 0
84  * ------------------------------------------------------------------------------------
85  *    0   |                         *Next Descriptor Pointer
86  *    1   |                           *Data Buffer Pointer
87  *    2   |            Buffer Offset            |            Buffer Length
88  *    3   |                Flags                |            Packet Length
89  *    4   |                                  *pbuf
90  */
91
92 boolean_t bd_SOP(volatile struct emac_tx_bd *bufferDescriptor)
93 {
94         return (bufferDescriptor->flags_pktlen & EMAC_DSC_FLAG_SOP);
95 }
96
97 boolean_t bd_EOP(volatile struct emac_tx_bd *bufferDescriptor)
98 {
99         return (bufferDescriptor->flags_pktlen & EMAC_DSC_FLAG_EOP);
100 }
101
102 boolean_t bd_OWNER(volatile struct emac_tx_bd *bufferDescriptor)
103 {
104         return (bufferDescriptor->flags_pktlen & EMAC_DSC_FLAG_OWNER);
105 }
106
107 boolean_t bd_EOQ(volatile struct emac_tx_bd *bufferDescriptor)
108 {
109         return (bufferDescriptor->flags_pktlen & EMAC_DSC_FLAG_EOQ);
110 }
111
112 uint32_t bd_addr(uint16_t bd_num)
113 {
114         return EMAC_CTRL_RAM_BASE_m(0) + bd_num*sizeof(struct emac_tx_bd);
115 }
116
117 volatile struct emac_tx_bd *findPreviousBD(volatile struct emac_tx_bd *bufferDescriptor)
118 {
119         volatile struct emac_tx_bd *temporary = bufferDescriptor - 1;
120
121         /* first try space before given bd */
122         if ((uint32_t)temporary >= EMAC_CTRL_RAM_BASE_m(0) && temporary->next == bufferDescriptor)
123                 return temporary;
124         temporary = bufferDescriptor->next;
125         while (temporary != bufferDescriptor && temporary != NULL) {
126                 if (temporary->next == bufferDescriptor)
127                         return temporary;
128                 temporary = (temporary + 1); /* going through memory, if you want to go through bd chains put here 'temporary = temporary->next;' */
129                 if ( (uint32_t)(temporary+1) > EMAC_CTRL_RAM_BASE_m(0)+SIZE_EMAC_CTRL_RAM) /* when out of CPPI RAM */
130                         temporary = (struct emac_tx_bd *)EMAC_CTRL_RAM_BASE_m(0);  /* continue scanning from the beginning */
131         }
132         return (struct emac_tx_bd *)-1;  /* not found */
133 }
134
135 void print_bd_content(volatile struct emac_tx_bd *bufferDescriptor, boolean_t humanReadable)
136 {
137         uint16_t data;
138
139         rpp_sci_printf("Buffer Descriptor at 0x%08x\n", bufferDescriptor);
140         rpp_sci_printf("Next BD:\t0x%08x\n", bufferDescriptor->next);
141         rpp_sci_printf("Data ptr:\t0x%08x\n", bufferDescriptor->bufptr);
142         rpp_sci_printf("Buf offset:\t%d\tBuf length:\t%d\n", (bufferDescriptor->bufoff_len >> 16), (bufferDescriptor->bufoff_len & 0xffff));
143         if (!humanReadable)
144                 rpp_sci_printf("Flags:\t\t0x%04x\t", (bufferDescriptor->flags_pktlen >> 16));
145         else
146         {
147                 data = bufferDescriptor->flags_pktlen;
148                 rpp_sci_printf("Flags:\t%s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s\n", (data & EMAC_DSC_FLAG_SOP) ? "SOP" : "", (data & EMAC_DSC_FLAG_EOP) ? "EOP" : "", (data & EMAC_DSC_FLAG_OWNER) ? "OWNER" : "", (data & EMAC_DSC_FLAG_EOQ) ? "EOQ" : "", (data & EMAC_DSC_FLAG_TDOWNCMPLT) ? "TDWN" : "", (data & EMAC_DSC_FLAG_PASSCRC) ? "PSCRC" : "", (data & EMAC_DSC_FLAG_JABBER) ? "JBR" : "", (data & EMAC_DSC_FLAG_OVERSIZE) ? "OVSZ" : "", (data & EMAC_DSC_FLAG_FRAGMENT) ? "FRGM" : "", (data & EMAC_DSC_FLAG_UNDERSIZED) ? "UNSZ" : "", (data & EMAC_DSC_FLAG_CONTROL) ? "CTRL" : "", (data & EMAC_DSC_FLAG_OVERRUN) ? "OVRUN" : "", (data & EMAC_DSC_FLAG_CODEERROR) ? "CODEERR" : "", (data & EMAC_DSC_FLAG_ALIGNERROR) ? "ALGNERR" : "", (data & EMAC_DSC_FLAG_CRCERROR) ? "CRCERR" : "", (data & EMAC_DSC_FLAG_NOMATCH) ? "NOMATCH" : "");
149         }
150         rpp_sci_printf("Pkt length:\t%d\n", (bufferDescriptor->flags_pktlen & 0xffff));
151         rpp_sci_printf("Pbuf ptr:\t0x%08x\n", bufferDescriptor->pbuf);
152 }
153
154 /*
155  * mode: 0 flags -> param says which flag (0-15)
156  *       1 bd->next == NULL, no param
157  */
158 void print_bds_state(uint8_t mode, uint8_t param)
159 {
160         volatile struct emac_tx_bd *bufferDescriptor = (struct emac_tx_bd *)EMAC_CTRL_RAM_BASE_m(0);
161         uint16_t index = 0;
162
163         rpp_sci_printf("TX:");
164         while (index < 409) {
165                 if (!(index%10)) {
166                         rpp_sci_printf(" ");
167                         if (!(index%50)) rpp_sci_printf("\n");
168                 }
169                 if (index == 204)
170                         rpp_sci_printf("\nRX: ");
171                 if      (mode == 0) {
172                         if (bufferDescriptor->flags_pktlen & ((1 << 15) >> (param%16)))
173                                 rpp_sci_printf("f");
174                         else
175                                 rpp_sci_printf(".");
176                 }
177                 else if (mode == 1) {
178                         if (bufferDescriptor->next == NULL)
179                                 rpp_sci_printf("0");
180                         else
181                                 rpp_sci_printf(".");
182                 }
183                 else return;
184                 bufferDescriptor++;
185                 index++;
186         }
187         rpp_sci_printf("\n");
188 }
189
190 #define BUF_SIZE 15
191
192 unsigned long readNum(uint8_t minamount, uint8_t maxamount, boolean_t hex)
193 {
194         unsigned long out = 0;
195         uint8_t input_buffer[BUF_SIZE];
196         uint8_t buf_index = 0;
197         uint8_t input;
198
199         do {
200                 input = rpp_sci_getc();
201                 if (input == '\b' && buf_index > 0) {
202                         input_buffer[buf_index] = '\0';
203                         buf_index--;
204                         echo('\b');
205                         echo( ' ');
206                         echo('\b');
207                 }
208                 else if (buf_index >= maxamount)
209                         continue;
210                 else if (input <= '9' && input >= '0') {
211                         input_buffer[buf_index] = input - '0';
212                         echo(input);
213                         buf_index++;
214                 }
215                 else if (hex && (input <= 'f' && input >= 'a')) {
216                         input_buffer[buf_index] = input - ('a' - 10);
217                         echo(input);
218                         buf_index++;
219                 }
220                 else if (hex && (input <= 'F' && input >= 'A')) {
221                         input_buffer[buf_index] = input - ('A' - 10);
222                         echo((input + ('a' - 'A')));
223                         buf_index++;
224                 }
225         } while ( (input != '\r' && input != '\n' && buf_index < BUF_SIZE) || buf_index < minamount);
226         input = 0; /* use as index */
227         while (input < buf_index) {
228                 if (hex)
229                         out = (out << 4) + input_buffer[input];
230                 else
231                         out = (out*10) + input_buffer[input];
232                 input++;
233         }
234         return out;
235 }
236
237 int cmd_do_bufferdescriptors(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
238 {
239         uint8_t pindex;
240         uint8_t input;
241         volatile struct emac_tx_bd *bufferDescriptor;
242         boolean_t run = TRUE, interactive = FALSE, overview = FALSE;
243
244 #if RPP_ETH_STATS
245         boolean_t isrRun = FALSE, rb = FALSE, tb = FALSE;
246 #endif
247
248         /* if eth not initialized return */
249         if (!isPostInitialized()) {
250                 rpp_sci_printf("Eth not initialized run 'ethinit' command first.\n");
251                 return FAILURE;
252         }
253
254         /* examine parameters */
255         for (pindex = 1; param[pindex] != 0; pindex++) {
256                 if        (strncmp((char *)param[pindex], "-i", 3) == 0) {
257                         interactive = TRUE;
258                         break;
259                 }
260                 else if (strncmp((char *)param[pindex], "-o", 3) == 0) {
261                         overview = TRUE;
262                         break;
263                 }
264 #if RPP_ETH_STATS
265                 else if (strncmp((char *)param[pindex], "-r", 3) == 0) {
266                         isrRun = TRUE;
267                         break;
268                 }
269                 else if (strncmp((char *)param[pindex], "-rb", 4) == 0) {
270                         rb = TRUE;
271                         break;
272                 }
273                 else if (strncmp((char *)param[pindex], "-tb", 4) == 0) {
274                         tb = TRUE;
275                         break;
276                 }
277 #endif
278         }
279         struct netif *netif = rpp_eth_get_netif(INTERFACE_INSTANCE_NUMBER);
280         if (netif == NULL) {
281                 rpp_sci_printf("netif err\n");
282                 return -1;
283         }
284
285         if (interactive)
286                 while (run) {
287                         input = rpp_sci_getc();
288
289                         if (input == 'b') { /* print buffer descriptor at given address */
290                                 rpp_sci_printf("-? 0x");
291                                 bufferDescriptor = (struct emac_tx_bd *)readNum(8,8,TRUE);
292                                 rpp_sci_printf("\n");
293                                 /* check it fits EMAC CPPI RAM */
294                                 /*if(bufferDescriptor >= EMAC_CTRL_RAM_BASE_m(INTERFACE_INSTANCE_NUMBER) && (bufferDescriptor + sizeof(struct emac_tx_bd)) <= EMAC_CTRL_RAM_BASE_m(INTERFACE_INSTANCE_NUMBER) + SIZE_EMAC_CTRL_RAM)
295                                    {*/
296                                 print_bd_content(bufferDescriptor, FALSE);
297                                 /*}
298                                    else
299                                    {
300                                     rpp_sci_printf("address not from BD CPPI RAM range\n");
301                                    }*/
302                                 while (1) {
303                                         input = rpp_sci_getc();
304                                         if      (input == 'n') { /* next */
305                                                 bufferDescriptor = bufferDescriptor->next;
306                                                 if (bufferDescriptor != NULL)
307                                                         print_bd_content(bufferDescriptor, FALSE);
308                                                 else {
309                                                         rpp_sci_printf("NULL\n");
310                                                         break;
311                                                 }
312                                         }
313                                         else if (input == 'p') { /* previous */
314                                                 bufferDescriptor = findPreviousBD(bufferDescriptor);
315                                                 if ((int32_t)bufferDescriptor != -1) {
316                                                         if (bufferDescriptor == NULL) {
317                                                                 rpp_sci_printf("NULL\n");
318                                                                 break;
319                                                         }
320                                                         else
321                                                                 print_bd_content(bufferDescriptor, FALSE);
322                                                 }
323                                                 else
324                                                 {
325                                                         rpp_sci_printf("not found\n");
326                                                         break;
327                                                 }
328                                         }
329                                         else if (input == 'r') { /* reprint */
330                                                 if ((int32_t)bufferDescriptor == -1 || bufferDescriptor == NULL) break;
331                                                 print_bd_content(bufferDescriptor, FALSE);
332                                         }
333                                         else break;
334                                 }
335                         }
336
337                         if      (input == 'q') { /* quit */
338                                 run = FALSE;
339                                 continue;
340                         }
341 #if RPP_ETH_STATS
342                         else if (input == 's') /* general statistics */
343                                 printStatistics();
344                         else if (input == 't') { /* print tx channel */
345                                 print_tx_channel_stat();
346                                 continue;
347                         }
348                         else if (input == 'r') { /* print rx channel */
349                                 print_rx_channel_stat();
350                                 continue;
351                         }
352 #endif
353                         else if (input == 'a') { /* autocheck consistency of buffer descriptors */
354
355                         }
356                         else if (input == 'o') { /* overview */
357                                 uint8_t mode = rpp_sci_getc() - '0';
358                                 uint8_t param = rpp_sci_getc() - '0';
359                                 print_bds_state(mode, param);
360                         }
361                         else if (input == 'c')  /* convert */
362                                 rpp_sci_printf("0x%08x", bd_addr((uint16_t)readNum(1, 3, FALSE)));
363                 }
364         else
365         {
366                 if (overview) {
367                         rpp_sci_printf(" --- OVERVIEWS ---\n");
368                         rpp_sci_printf("bd->next points to NULL\n");
369                         print_bds_state(1, 0);
370                         rpp_sci_printf("bds with EMAC_DSC_FLAG_SOP\n");
371                         print_bds_state(0, 0);
372                         rpp_sci_printf("bds with EMAC_DSC_FLAG_EOP\n");
373                         print_bds_state(0, 1);
374                         rpp_sci_printf("bds with EMAC_DSC_FLAG_OWNER\n");
375                         print_bds_state(0, 2);
376                         rpp_sci_printf("bds with EMAC_DSC_FLAG_EOQ\n");
377                         print_bds_state(0, 3);
378                         rpp_sci_printf("bds with EMAC_DSC_FLAG_TDOWNCMPLT\n");
379                         print_bds_state(0, 4);
380                         rpp_sci_printf("bds with EMAC_DSC_FLAG_PASSCRC\n");
381                         print_bds_state(0, 5);
382                         rpp_sci_printf("\nPress any key ...\r");
383                         rpp_sci_getc();
384                         /* These flags are not so much important */
385                         rpp_sci_printf("bds with EMAC_DSC_FLAG_JABBER\n");
386                         print_bds_state(0, 6);
387                         rpp_sci_printf("bds with EMAC_DSC_FLAG_OVERSIZE\n");
388                         print_bds_state(0, 7);
389                         rpp_sci_printf("bds with EMAC_DSC_FLAG_FRAGMENT\n");
390                         print_bds_state(0, 8);
391                         rpp_sci_printf("bds with EMAC_DSC_FLAG_UNDERSIZED\n");
392                         print_bds_state(0, 9);
393                         rpp_sci_printf("bds with EMAC_DSC_FLAG_CONTROL\n");
394                         print_bds_state(0, 10);
395                         rpp_sci_printf("bds with EMAC_DSC_FLAG_OVERRUN\n");
396                         print_bds_state(0, 11);
397                         rpp_sci_printf("bds with EMAC_DSC_FLAG_CODEERROR\n");
398                         print_bds_state(0, 12);
399                         rpp_sci_printf("bds with EMAC_DSC_FLAG_ALIGNERROR\n");
400                         print_bds_state(0, 13);
401                         rpp_sci_printf("bds with EMAC_DSC_FLAG_CRCERROR\n");
402                         print_bds_state(0, 14);
403                         rpp_sci_printf("bds with EMAC_DSC_FLAG_NOMATCH\n");
404                         print_bds_state(0, 15);
405                 }
406 #if RPP_ETH_STATS
407                 if (isrRun) {
408                         rpp_sci_printf(" --- NUMBER OF ISR RUNS ---\n");
409                         rpp_sci_printf("TxIsr: %d", countEMACCore0TxIsr);
410                         rpp_sci_printf("RxIsr: %d", countEMACCore0RxIsr);
411                 }
412 #endif
413
414
415         }
416         return ERR_OK;
417 }
418
419 #if LWIP_DHCP
420 int cmd_do_dhcp(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
421 {
422         if (!isPostInitialized()) {
423                 rpp_sci_printf("Eth not initialized run 'ethinit' command first.\n");
424                 return FAILURE;
425         }
426         rpp_sci_printf("not implemented yet.");
427         return ERR_OK;
428 }
429 #endif
430
431 #if LWIP_STATS_DISPLAY
432 int cmd_do_lwip(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
433 {
434         if (!isPostInitialized()) {
435                 rpp_sci_printf("Eth not initialized run 'ethinit' command first.\n");
436                 return FAILURE;
437         }
438         stats_display();
439         rpp_sci_printf("\n");
440         return ERR_OK;
441 }
442 #endif
443
444 int cmd_do_ethinit(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
445 {
446         int8_t retVal = rpp_eth_init_postInit(0, NULL); /* post OS startup init of eth (LwIP) for application usage -- waits for a while, for auto-negotiation of ethernet speed and DHCP if used */
447
448         switch (retVal) {
449         case FAILURE:
450                 rpp_sci_printf("already initialized\n");
451                 break;
452         case NETIF_ADD_ERR:
453                 rpp_sci_printf("initialization of physical part of ethernet failed\n");
454                 break;
455         case DHCP_MEM_ERR:
456                 rpp_sci_printf("DHCP couldn't be started due to insufficient memory\n");
457                 break;
458         case PHY_LINK_DOWN:
459                 rpp_sci_printf("cable is not connected\n");
460                 break;
461         default:
462                 rpp_sci_printf("ethinit DONE\n");
463         }
464         return retVal;
465 }
466
467 #endif  /* DOCGEN */
468
469 cmd_des_t const cmd_des_linkstat = {
470         0,0,
471         "ethlinkstat","Print current status of ethernet interface",
472
473         "### Command syntax ###\n"
474         "\n"
475         "    ethlinkstat\n"
476         "\n"
477         "### Description ###\n"
478         "\n"
479         "This command reads PHY link status assigned to ethernet interface and\n"
480         "prints interface name and informs about PHY's status to the output.\n"
481         "\n"
482         "### Example ###\n"
483         "\n"
484         "    --> ethlinkstat\n"
485         "    et0 : UP\n"
486         "\n"
487         "    --> ethlinkstat\n"
488         "    et0 : DOWN\n",
489         CMD_HANDLER(cmd_do_read_linkstat), (void *)&cmd_list_netstats
490 };
491
492 cmd_des_t const cmd_des_mac = {
493         0,0,
494         "ethmac","Print current MAC address of ethernet interface",
495
496         "### Command syntax ###\n"
497         "\n"
498         "    ethmac\n"
499         "\n"
500         "### Description ###\n"
501         "\n"
502         "This command obtains MAC address from ethernet interface structure\n"
503         "and prints it to the output.\n"
504         "\n"
505         "### Example ###\n"
506         "\n"
507         "    --> ethmac\n"
508         "    12:34:56:78:9a:bc\n",
509         CMD_HANDLER(cmd_do_read_mac), (void *)&cmd_list_netstats
510 };
511
512 cmd_des_t const cmd_des_ip = {
513         0,0,
514         "ethip","Print current IP address of network interface",
515
516         "### Command syntax ###\n"
517         "\n"
518         "    ethip\n"
519         "\n"
520         "### Description ###\n"
521         "\n"
522         "This command reads current IP address, netmask and gateway of network\n"
523         "interface and prints these to the output.\n"
524         "\n"
525         "### Example ###\n"
526         "\n"
527         "    --> ethip\n"
528         "    Address: 192.168.247.1\n"
529         "    Netmask: 255.255.255.0\n"
530         "    Gateway: 192.168.247.255\n",
531         CMD_HANDLER(cmd_do_read_ip), (void *)&cmd_list_netstats
532 };
533
534 cmd_des_t const cmd_des_bufferdescriptors = {
535         0,CDESM_SPACE_SEP,
536         "ethbd","Examine emac buffer descriptors",
537
538         "### Command syntax ###\n"
539         "\n"
540         "    ethbd\n"
541         "\n"
542         "### Description ###\n"
543         "After startup you use keys to control what will be done.\n"
544         "\n"
545         "- q - quit\n"
546         "- s - general statistics\n"
547         "- t - transmit channel status\n"
548         "- r - receive channel status\n"
549         "- b - after giving address of bd it prints bd content\n"
550         "- a - checks consistency of buffer descriptors\n"
551         "\n"
552         "\n"
553         "### Example ###\n"
554         "\n"
555         "    --> ethbd\n",
556         CMD_HANDLER(cmd_do_bufferdescriptors), (void *)&cmd_list_netstats
557 };
558
559 #if LWIP_DHCP
560 cmd_des_t const cmd_des_dhcp = {
561         0,0,
562         "dhcp","Prints and controls DHCP",
563
564         "### Command syntax ###\n"
565         "\n"
566         "    dhcp\n"
567         "\n"
568         "### Description ###\n"
569         "\n"
570         "\n"
571         ".\n"
572         "\n"
573         "### Example ###\n"
574         "\n"
575         "    --> dhcp\n"
576         "    \n",
577         CMD_HANDLER(cmd_do_dhcp), (void *)&cmd_list_netstats
578 };
579 #endif
580
581 #if LWIP_STATS_DISPLAY
582 cmd_des_t const cmd_des_lwip = {
583         0,0,
584         "lwip","Prints statistics for the LwIP stack",
585
586         "### Command syntax ###\n"
587         "\n"
588         "    lwip\n"
589         "\n"
590         "### Description ###\n"
591         "\n"
592         "Sections printed:\n"
593         "LINK\n"
594         "ETHARP\n"
595         "IP\n"
596         "ICMP\n"
597         "UDP\n"
598         "TCP\n"
599         "MEM HEAP\n"
600         "MEM RAW_PCB\n"
601         "MEM UDP_PCB\n"
602         "MEM TCP_PCB\n"
603         "MEM TCP_PCB_LISTEN\n"
604         "MEM TCP_SEB\n"
605         "MEM NETBUF\n"
606         "MEM NETCONN\n"
607         "MEM TCPIP_MSG_API\n"
608         "MEM TCPIP_MSG_INPKT\n"
609         "MEM SYS_TIMEOUT\n"
610         "MEM PBUF_REF/ROM\n"
611         "MEM PBUF_POOL\n"
612         "SYS\n"
613         ".\n"
614         "Shown sections depends on modules compiled in.\n"
615         "    \n",
616         CMD_HANDLER(cmd_do_lwip), (void *)&cmd_list_netstats
617 };
618 #endif /* if LWIP_STATS_DISPLAY */
619
620 cmd_des_t const cmd_des_ethinit = {
621         0,0,
622         "ethinit","Post OS startup eth initialization",
623
624         "### Command syntax ###\n"
625         "\n"
626         "    ethinit\n"
627         "\n"
628         "### Description ###\n"
629         "This command finishes autonegotiation of PHY and initialize LwIP stack.\n"
630         "\n"
631         "\n"
632         "### Example ###\n"
633         "\n"
634         "    --> ethinit\n"
635         "    \n",
636         CMD_HANDLER(cmd_do_ethinit), (void *)&cmd_list_netstats
637 };
638
639 /** List of commands for lwip, defined as external */
640 cmd_des_t const *cmd_list_netstats[] = {
641         &cmd_des_linkstat,
642         &cmd_des_mac,
643         &cmd_des_ip,
644         &cmd_des_bufferdescriptors,
645 #if LWIP_DHCP
646         &cmd_des_dhcp,
647 #endif
648 #if LWIP_STATS_DISPLAY
649         &cmd_des_lwip,
650 #endif
651         &cmd_des_ethinit,
652         NULL
653 };