]> rtime.felk.cvut.cz Git - pes-rpp/rpp-test-sw.git/commitdiff
eth post OS init moved to dedicated command; removed casts to (const char *) from...
authorJan Dolezal <pm.jenik@gmail.com>
Fri, 13 Sep 2013 11:12:13 +0000 (13:12 +0200)
committerJan Dolezal <pm.jenik@gmail.com>
Fri, 13 Sep 2013 11:12:13 +0000 (13:12 +0200)
.cproject
.gitignore
cmdproc/src/cmdproc_freertos_tms570.c
commands/cmd_lwip.c
commands/cmd_netstats.c
rpp-lib

index 40e9c32251129f672f1d579eb57c1276ace868bf..9c9e1ad1f51eba53872e72b64162bf4cebacefe7 100644 (file)
--- a/.cproject
+++ b/.cproject
                                                                        <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rpp-lib/lwip/src/include/ipv6}&quot;"/>
                                                                </option>
                                                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_5.0.compilerID.GCC.795138235" name="Enable support for GCC extensions (--gcc)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.0.compilerID.GCC" value="true" valueType="boolean"/>
-                                                               <option id="com.ti.ccstudio.buildDefinitions.TMS470_5.0.compilerID.DEFINE.35615475" name="Pre-define NAME (--define, -D)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.0.compilerID.DEFINE" valueType="definedSymbols"/>
+                                                               <option id="com.ti.ccstudio.buildDefinitions.TMS470_5.0.compilerID.DEFINE.35615475" name="Pre-define NAME (--define, -D)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.0.compilerID.DEFINE" valueType="definedSymbols">
+                                                                       <listOptionValue builtIn="false" value="DEBUG"/>
+                                                                       <listOptionValue builtIn="false" value="LWIP_DEBUG"/>
+                                                               </option>
                                                                <option id="com.ti.ccstudio.buildDefinitions.TMS470_5.0.compilerID.DIAG_WARNING.1682379727" name="Treat diagnostic &lt;id&gt; as warning (--diag_warning, -pdsw)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.0.compilerID.DIAG_WARNING" valueType="stringList">
                                                                        <listOptionValue builtIn="false" value="225"/>
                                                                </option>
                </project-mappings>
        </storageModule>
        <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+       <storageModule moduleId="org.eclipse.cdt.make.core.buildtargets"/>
 </cproject>
index f240e723ebcd754f600bba416bb6df516026a695..1618598faba0859570c51202f443c208b58649a9 100644 (file)
@@ -1 +1,2 @@
 Debug/
+.metadata/
index ff3699a8991e47bd9692405e6d1480e1f7b1ead2..d81438759a7416e0becefff7f75ddac304a42b56 100644 (file)
@@ -29,7 +29,6 @@
 /* Include files */
 #include "cmdproc_freertos_tms570.h"
 #include "rpp/sci.h"
-#include "rpp/eth.h"
 
 /** cmdProc task handler */
 xTaskHandle processCmdHandler;
@@ -62,7 +61,6 @@ void initCmdProc(unsigned portBASE_TYPE priority) {
  * @param pvParameters Not used, task receives no parameters
  */
 void processCmd(void *pvParameters ) {
-       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 */
        for (;;) {
                rpp_sci_printf("--> ");
                cmd_processor_run(&cmd_io_std_line, cmd_list_main);
index b7a4af8448af1da6cb81dd137b89bc106d26becd..cbae557689ea67b2a734bc6daef6a4f6c832f383 100644 (file)
 
 int cmd_do_read_linkstat(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
 {
+       if(!isPostInitialized())
+       {
+               rpp_sci_printf("Eth not initialized run 'ethinit' command first.\n");
+               return FAILURE;
+       }
        struct netif *netif = rpp_eth_get_netif(INTERFACE_INSTANCE_NUMBER);
        if(rpp_eth_phylinkstat(INTERFACE_INSTANCE_NUMBER))
-        rpp_sci_printf((const char *) "%c%c%d : UP\r\n", netif->name[0], netif->name[1], netif->num);
+        rpp_sci_printf("%c%c%d : UP\r\n", netif->name[0], netif->name[1], netif->num);
     else
-        rpp_sci_printf((const char *) "%c%c%d : DOWN\r\n", netif->name[0], netif->name[1], netif->num);
+        rpp_sci_printf("%c%c%d : DOWN\r\n", netif->name[0], netif->name[1], netif->num);
     return SUCCESS;
 }
 
 int cmd_do_read_mac(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
 {
+       if(!isPostInitialized())
+       {
+               rpp_sci_printf("Eth not initialized run 'ethinit' command first.\n");
+               return FAILURE;
+       }
     uint8_t macaddr[18];
     rpp_eth_get_macAddrStr(INTERFACE_INSTANCE_NUMBER,macaddr);
     rpp_sci_printf((const char*)"%s\n", macaddr);
@@ -65,14 +75,19 @@ int cmd_do_read_mac(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
 
 int cmd_do_read_ip(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
 {
+       if(!isPostInitialized())
+       {
+               rpp_sci_printf("Eth not initialized run 'ethinit' command first.\n");
+               return FAILURE;
+       }
     struct netif *netif = rpp_eth_get_netif(INTERFACE_INSTANCE_NUMBER);
     uint8_t ipString[16];
     rpp_eth_getIPDecimalStr(netif->ip_addr, ipString);
-    rpp_sci_printf((const char *) "Address: %s\r\n", ipString);
+    rpp_sci_printf("Address: %s\r\n", ipString);
     rpp_eth_getIPDecimalStr(netif->netmask, ipString);
-    rpp_sci_printf((const char *) "Netmask: %s\r\n", ipString);
+    rpp_sci_printf("Netmask: %s\r\n", ipString);
     rpp_eth_getIPDecimalStr(netif->gw, ipString);
-    rpp_sci_printf((const char *) "Gateway: %s\r\n", ipString);
+    rpp_sci_printf("Gateway: %s\r\n", ipString);
     return SUCCESS;
 }
 
@@ -358,7 +373,7 @@ void run_nc(void *arg){
                                            payload = p->payload;
                                            while(index<p->len)
                                            {
-                                               rpp_sci_printf((const char *) "%c",payload[index]);
+                                               rpp_sci_printf("%c",payload[index]);
                                                index++;
                                            }
                                                p = p->next;
@@ -441,7 +456,7 @@ void run_nc(void *arg){
                break;
     }
 #ifdef DEBUG
-       if(thread)rpp_sci_printf((const char *) "NC: THREAD NO.%d FINISHED\r\n", thread_inst);
+       if(thread)rpp_sci_printf("NC: THREAD NO.%d FINISHED\r\n", thread_inst);
 #endif
        if(udp && localData != NULL)netbuf_delete(localData);
        if(remoteData != NULL)netbuf_delete(remoteData);
@@ -463,7 +478,7 @@ err_t nc_recv_callback(void *arg, struct tcp_pcb *tpcb, struct pbuf *p, err_t er
     uint8_t *payload;
        if(err == ERR_ABRT)
        {
-               rpp_sci_printk((const char *) "recv abrt\n");
+               rpp_sci_printk("recv abrt\n");
                return ERR_ABRT;
        }
        /* print remote data to SCI */
@@ -473,7 +488,7 @@ err_t nc_recv_callback(void *arg, struct tcp_pcb *tpcb, struct pbuf *p, err_t er
            payload = p->payload;
            while(index<p->len)
            {
-               rpp_sci_printk((const char *) "%c",payload[index]);
+               rpp_sci_printk("%c",payload[index]);
                index++;
            }
         p = p->next;
@@ -492,7 +507,7 @@ void nc_udp_recv_callback(void *arg, struct udp_pcb *pcb, struct pbuf *p, ip_add
            payload = p->payload;
            while(index<p->len)
            {
-               rpp_sci_printk((const char *) "%c",payload[index]);
+               rpp_sci_printk("%c",payload[index]);
                index++;
            }
         p = p->next;
@@ -511,7 +526,7 @@ void nc_udp_listen_recv_callback(void *arg, struct udp_pcb *pcb, struct pbuf *p,
 
 void nc_err_callback(void *arg, err_t err)
 {
-       rpp_sci_printk((const char *) "err clbck\n");
+       rpp_sci_printk("err clbck\n");
        LWIP_DEBUGF(LWIP_DBG_ON, ("nc_err: %s", lwip_strerr(err)));
 
        ncStop = TRUE;
@@ -547,7 +562,7 @@ err_t nc_connected_callback(void *arg, struct tcp_pcb *tpcb, err_t err)
     tcp_sent(tpcb, nc_sent_callback);
 
        connected = TRUE;
-       rpp_sci_printk((const char *) "connected\n");
+       rpp_sci_printk("connected\n");
     return ERR_OK;
 }
 
@@ -555,17 +570,17 @@ err_t nc_tmirror_callback(void *arg, struct tcp_pcb *tpcb, struct pbuf *p, err_t
 {
        if(err == ERR_ABRT)
        {
-               rpp_sci_printk((const char *) "recv abrt\n");
+               rpp_sci_printk("recv abrt\n");
                return ERR_ABRT;
        }
        while(p != NULL)
        {
                if(tcp_write(tpcb, p->payload, p->len, TCP_WRITE_FLAG_COPY)!=ERR_OK){
-               rpp_sci_printk((const char *) "error writing to newpcb - tcp_write\n");
+               rpp_sci_printk("error writing to newpcb - tcp_write\n");
                return -1;
        }
        if(tcp_output(tpcb)!=ERR_OK){ /* when we want to send data immediately */
-               rpp_sci_printk((const char *) "newpcb output err - tcp\n");
+               rpp_sci_printk("newpcb output err - tcp\n");
                return -1;
        }
            p = p->next;
@@ -581,18 +596,18 @@ void nc_umirror_callback(void *arg, struct udp_pcb *pcb, struct pbuf *p, ip_addr
         pbuf = pbuf_alloc(PBUF_TRANSPORT, p->len, PBUF_RAM);
         if(pbuf == NULL)
         {
-               rpp_sci_printk((const char *) "error allocating pbuf - udp_send\n");
+               rpp_sci_printk("error allocating pbuf - udp_send\n");
                //p = p->next;
                continue;
         }
         if(pbuf_take(pbuf, p->payload, p->len)!=ERR_OK)
         {
-               rpp_sci_printk((const char *) "pbuf mem err (small pbuf) - udp_send\n");
+               rpp_sci_printk("pbuf mem err (small pbuf) - udp_send\n");
                continue;
         }
        if(udp_send (pcb, pbuf)!=ERR_OK)
        {
-               rpp_sci_printk((const char *) "error sending to pcb - udp_send\n");
+               rpp_sci_printk("error sending to pcb - udp_send\n");
                continue;
        }
         p = p->next;
@@ -609,6 +624,11 @@ void nc_umirror_callback(void *arg, struct udp_pcb *pcb, struct pbuf *p, ip_addr
  */
 int cmd_do_init_nc(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
 {
+       if(!isPostInitialized())
+       {
+               rpp_sci_printf("Eth not initialized run 'ethinit' command first.\n");
+               return FAILURE;
+       }
     err_t err = ERR_OK;
        uint16_t portNO, srcPortNO = 0;
        ip_addr_t remoteIP;
@@ -652,7 +672,7 @@ int cmd_do_init_nc(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
                srcPortNO = rpp_eth_portStrToInt((uint8_t *)param[++pindex]);
                        if(srcPortNO == 0)
                        {
-                               rpp_sci_printf((const char *) "E wrong portNO, portNO must follow immediately after -l option\r\n");
+                               rpp_sci_printf("E wrong portNO, portNO must follow immediately after -l option\r\n");
                                return BAD_PORT_NO;
                        }
                        srcPortSpec = TRUE;
@@ -660,7 +680,7 @@ int cmd_do_init_nc(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
                srcPortNO = rpp_eth_portStrToInt((uint8_t *)param[++pindex]);
                        if(srcPortNO == 0)
                        {
-                               rpp_sci_printf((const char *) "E wrong portNO, portNO must follow immediately after -p option\r\n");
+                               rpp_sci_printf("E wrong portNO, portNO must follow immediately after -p option\r\n");
                                return BAD_PORT_NO;
                        }
                        srcPortSpec = TRUE;
@@ -672,11 +692,11 @@ int cmd_do_init_nc(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
                portNO = rpp_eth_portStrToInt((uint8_t *)param[++pindex]);
                        if(portNO == 0)
                        {
-                               rpp_sci_printf((const char *) "E wrong portNO, portNO must follow immediately after IP address\r\n");
+                               rpp_sci_printf("E wrong portNO, portNO must follow immediately after IP address\r\n");
                                return BAD_PORT_NO;
                        }
        } else {
-               rpp_sci_printf((const char *) "ERR: check option name, option combination, IP address format\r\n");
+               rpp_sci_printf("ERR: check option name, option combination, IP address format\r\n");
                help = TRUE;
                err = BAD_OPTION;
                break;
@@ -696,14 +716,14 @@ nc -l <port> -d [-u] [-t]
     /* usage of command */
     if(help || !param[1])
     {
-       rpp_sci_printf((const char *) "-u udp, -t thread, -c close tasks, -l listen, -p source port, -m ping/mirror, -d test\r\n\n");
-        rpp_sci_printf((const char *) "usage:\tnc -l <port> [-u] [-m [-t] | -d [-t]]\r\n\t\tlistens on port for connection\r\n");
-        rpp_sci_printf((const char *) "\tnc <address> <port> [-p <port>] [-u] [-m [-t] | -d [-t]]\r\n\t\tconnects to the address on port NO.\r\n");
-        rpp_sci_printf((const char *) "\tnc -c\r\n\t\tdeletes all running threads.\r\n");
-        rpp_sci_printf((const char *) "opts:\t-t run as stand alone task\r\n\t-c close all stand alone tasks\r\n");
-        rpp_sci_printf((const char *) "\t-l <port> listen on given port for incomming connection\r\n\t-p <port> use as local port when connecting to remote node\r\n\t");
-        rpp_sci_printf((const char *) "\t-m send all incomming data back to sender\r\n\t-d sends many testing packets containing packet number in ASCII as data\r\n");
-        rpp_sci_printf((const char *) "Note: when using udp -u and listening -l options, first node data was received from is considered as peer for communication.\r\n");
+       rpp_sci_printf("-u udp, -t thread, -c close tasks, -l listen, -p source port, -m ping/mirror, -d test\r\n\n");
+        rpp_sci_printf("usage:\tnc -l <port> [-u] [-m [-t] | -d [-t]]\r\n\t\tlistens on port for connection\r\n");
+        rpp_sci_printf("\tnc <address> <port> [-p <port>] [-u] [-m [-t] | -d [-t]]\r\n\t\tconnects to the address on port NO.\r\n");
+        rpp_sci_printf("\tnc -c\r\n\t\tdeletes all running threads.\r\n");
+        rpp_sci_printf("opts:\t-t run as stand alone task\r\n\t-c close all stand alone tasks\r\n");
+        rpp_sci_printf("\t-l <port> listen on given port for incomming connection\r\n\t-p <port> use as local port when connecting to remote node\r\n\t");
+        rpp_sci_printf("\t-m send all incomming data back to sender\r\n\t-d sends many testing packets containing packet number in ASCII as data\r\n");
+        rpp_sci_printf("Note: when using udp -u and listening -l options, first node data was received from is considered as peer for communication.\r\n");
        return err;
     }
 
@@ -734,7 +754,7 @@ nc -l <port> -d [-u] [-t]
        taskNameNum = (taskNameNum%100);
        name[2] = (taskNameNum/10) + '0';
        name[3] = (taskNameNum%10) + '0';
-       rpp_sci_printf((const char *) "STARTING THREAD: %s\r\n", name);
+       rpp_sci_printf("STARTING THREAD: %s\r\n", name);
        taskNameNum++;
        /* start thread */
         if((err = xTaskCreate(&run_nc,(const signed char *) name, ncTaskStackSize, &nc_arg, ncTaskPriority, NULL)) == pdPASS){
@@ -822,7 +842,7 @@ nc -l <port> -d [-u] [-t]
                sys_check_timeouts();
                vTaskDelay(10); /* just because we have no other business here */
         }
-        if(!udp && listen && tcp_close(tpcb) != ERR_OK)rpp_sci_printk((const char *) "closing listening tcp pcb err\n"); /* close listening pcb */
+        if(!udp && listen && tcp_close(tpcb) != ERR_OK)rpp_sci_printk("closing listening tcp pcb err\n"); /* close listening pcb */
     }
 
     /* mode handlers in loop, so we can jump out of it on error or finish and clean after us */
@@ -881,11 +901,11 @@ nc -l <port> -d [-u] [-t]
                {
                        sys_check_timeouts();
                        if(tcp_write(tnewpcb, strbuf, strlen, TCP_WRITE_FLAG_COPY)!=ERR_OK){
-                               rpp_sci_printf((const char *) "error writing to newpcb - tcp_write testing\n");
+                               rpp_sci_printf("error writing to newpcb - tcp_write testing\n");
                                break;
                        }
                        if(tcp_output(tnewpcb)!=ERR_OK){ /* when we want to send data immediately */
-                               rpp_sci_printf((const char *) "newpcb output err - tcp testing\n");
+                               rpp_sci_printf("newpcb output err - tcp testing\n");
                                break;
                        }
                }
@@ -894,17 +914,17 @@ nc -l <port> -d [-u] [-t]
                     p = pbuf_alloc(PBUF_TRANSPORT, strlen, PBUF_RAM);
                     if(p == NULL)
                     {
-                               rpp_sci_printf((const char *) "error allocating pbuf - udp_send testing\n");
+                               rpp_sci_printf("error allocating pbuf - udp_send testing\n");
                                continue;
                     }
                     if(pbuf_take(p, strbuf, strlen)!=ERR_OK)
                     {
-                               rpp_sci_printf((const char *) "pbuf mem err (small pbuf) - udp_send testing\n");
+                               rpp_sci_printf("pbuf mem err (small pbuf) - udp_send testing\n");
                                continue;
                     }
                        if(udp_send (pcb, p)!=ERR_OK)
                        {
-                               rpp_sci_printf((const char *) "error sending to pcb - udp_send testing\n");
+                               rpp_sci_printf("error sending to pcb - udp_send testing\n");
                                continue;
                        }
                }
@@ -975,11 +995,11 @@ nc -l <port> -d [-u] [-t]
                 if(!udp)
                {
                        if(tcp_write(tnewpcb, in_buffer, buff_index, TCP_WRITE_FLAG_COPY)!=ERR_OK){
-                               rpp_sci_printf((const char *) "error writing to newpcb - tcp_write\n");
+                               rpp_sci_printf("error writing to newpcb - tcp_write\n");
                                continue;
                        }
                        if(tcp_output(tnewpcb)!=ERR_OK){ /* when we want to send data immediately */
-                               rpp_sci_printf((const char *) "newpcb output err - tcp\n");
+                               rpp_sci_printf("newpcb output err - tcp\n");
                                continue;
                        }
                }
@@ -988,17 +1008,17 @@ nc -l <port> -d [-u] [-t]
                     p = pbuf_alloc(PBUF_TRANSPORT, buff_index, PBUF_RAM);
                     if(p == NULL)
                     {
-                               rpp_sci_printf((const char *) "error allocating pbuf - udp_send\n");
+                               rpp_sci_printf("error allocating pbuf - udp_send\n");
                                continue;
                     }
                     if(pbuf_take(p, in_buffer, buff_index)!=ERR_OK)
                     {
-                               rpp_sci_printf((const char *) "pbuf mem err (small pbuf) - udp_send\n");
+                               rpp_sci_printf("pbuf mem err (small pbuf) - udp_send\n");
                                continue;
                     }
                        if(udp_send (pcb, p)!=ERR_OK)
                        {
-                               rpp_sci_printf((const char *) "error sending to pcb - udp_send\n");
+                               rpp_sci_printf("error sending to pcb - udp_send\n");
                                continue;
                        }
                }
@@ -1017,7 +1037,7 @@ nc -l <port> -d [-u] [-t]
                tcp_recv(tnewpcb, NULL);
                err = tcp_close(tnewpcb);
                if (err != ERR_OK) {
-               rpp_sci_printf((const char *) "newpcb closing error\n");
+               rpp_sci_printf("newpcb closing error\n");
                    /* closing failed, try again later */
                    LWIP_DEBUGF(LWIP_DBG_ON, ("Error %s closing pcb=0x%08X\n", lwip_strerr(err), pcb));
                    tcp_recv(tnewpcb, nc_recv_callback);
index 9455d188f3f5a4603c23e9c9adabf035b8eda696..93f2d89f8a6860de523dc814308b51fa54d5f4fb 100644 (file)
@@ -97,21 +97,21 @@ volatile struct emac_tx_bd *findPreviousBD(volatile struct emac_tx_bd *bufferDes
 void print_bd_content(volatile struct emac_tx_bd *bufferDescriptor, boolean_t humanReadable)
 {
     uint16_t data;
-    rpp_sci_printf((const char *) "Buffer Descriptor at 0x%08x\n", bufferDescriptor);
-    rpp_sci_printf((const char *) "Next BD:\t0x%08x\n", bufferDescriptor->next);
-    rpp_sci_printf((const char *) "Data ptr:\t0x%08x\n", bufferDescriptor->bufptr);
-    rpp_sci_printf((const char *) "Buf offset:\t%d\tBuf length:\t%d\n", (bufferDescriptor->bufoff_len >> 16), (bufferDescriptor->bufoff_len & 0xffff));
+    rpp_sci_printf("Buffer Descriptor at 0x%08x\n", bufferDescriptor);
+    rpp_sci_printf("Next BD:\t0x%08x\n", bufferDescriptor->next);
+    rpp_sci_printf("Data ptr:\t0x%08x\n", bufferDescriptor->bufptr);
+    rpp_sci_printf("Buf offset:\t%d\tBuf length:\t%d\n", (bufferDescriptor->bufoff_len >> 16), (bufferDescriptor->bufoff_len & 0xffff));
     if(!humanReadable)
     {
-    rpp_sci_printf((const char *) "Flags:\t\t0x%04x\t", (bufferDescriptor->flags_pktlen >> 16));
+    rpp_sci_printf("Flags:\t\t0x%04x\t", (bufferDescriptor->flags_pktlen >> 16));
     }
     else
     {
     data = bufferDescriptor->flags_pktlen;
-    rpp_sci_printf((const char *) "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":"");
+    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":"");
     }
-    rpp_sci_printf((const char *) "Pkt length:\t%d\n", (bufferDescriptor->flags_pktlen & 0xffff));
-    rpp_sci_printf((const char *) "Pbuf ptr:\t0x%08x\n", bufferDescriptor->pbuf);
+    rpp_sci_printf("Pkt length:\t%d\n", (bufferDescriptor->flags_pktlen & 0xffff));
+    rpp_sci_printf("Pbuf ptr:\t0x%08x\n", bufferDescriptor->pbuf);
 }
 
 /*
@@ -122,59 +122,59 @@ void print_bds_state(uint8_t mode, uint8_t param)
 {
        volatile struct emac_tx_bd *bufferDescriptor = (struct emac_tx_bd *) EMAC_CTRL_RAM_BASE_m(0);
        uint16_t index = 0;
-       rpp_sci_printf((const char *) "TX:");
+       rpp_sci_printf("TX:");
        while(index < 409)
        {
                if(!(index%10)){
-                       rpp_sci_printf((const char *) " ");
-                       if(!(index%20))rpp_sci_printf((const char *) "\n");
+                       rpp_sci_printf(" ");
+                       if(!(index%20))rpp_sci_printf("\n");
                }
                if(index == 204){
-                       rpp_sci_printf((const char *) "\nRX: ");
+                       rpp_sci_printf("\nRX: ");
                }
            if      (mode == 0){
             if(bufferDescriptor->flags_pktlen & ((1 << 15) >> (param%16))){
-               rpp_sci_printf((const char *) "f");
+               rpp_sci_printf("f");
             }else{
-               rpp_sci_printf((const char *) ".");
+               rpp_sci_printf(".");
             }
            }else if(mode == 1){
             if(bufferDescriptor->next == NULL){
-               rpp_sci_printf((const char *) "0");
+               rpp_sci_printf("0");
             }else{
-               rpp_sci_printf((const char *) ".");
+               rpp_sci_printf(".");
             }
            }else return;
            bufferDescriptor++;
            index++;
        }
-       rpp_sci_printf((const char *) "\n");
+       rpp_sci_printf("\n");
 }
 
 #if RPP_ETH_STATS
 void print_tx_channel_stat()
 {
-       rpp_sci_printf((const char *) "Transmit:\n");
-       rpp_sci_printf((const char *) "\t\tbeforeHandled\tafterHandled\n");
-       rpp_sci_printf((const char *) "active_tail:\t0x%08x\t0x%08x\n",
+       rpp_sci_printf("Transmit:\n");
+       rpp_sci_printf("\t\tbeforeHandled\tafterHandled\n");
+       rpp_sci_printf("active_tail:\t0x%08x\t0x%08x\n",
                        beforeHandled.active_tail, afterHandled.active_tail);
-       rpp_sci_printf((const char *) "free_head:\t0x%08x\t0x%08x\n",
+       rpp_sci_printf("free_head:\t0x%08x\t0x%08x\n",
                        beforeHandled.free_head, afterHandled.free_head);
-       rpp_sci_printf((const char *) "nxt_bd_to_proc:\t0x%08x\t0x%08x\n\n",
+       rpp_sci_printf("nxt_bd_to_proc:\t0x%08x\t0x%08x\n\n",
                beforeHandled.next_bd_to_process, afterHandled.next_bd_to_process);
 }
 
 void print_rx_channel_stat()
 {
-       rpp_sci_printf((const char *) "Receive:\n");
-       rpp_sci_printf((const char *) "\t\tbeforeRecv\tafterRecv\n");
-       rpp_sci_printf((const char *) "active_head:\t0x%08x\t0x%08x\n",
+       rpp_sci_printf("Receive:\n");
+       rpp_sci_printf("\t\tbeforeRecv\tafterRecv\n");
+       rpp_sci_printf("active_head:\t0x%08x\t0x%08x\n",
                        beforeRecv.active_head, afterRecv.active_head);
-       rpp_sci_printf((const char *) "active_tail:\t0x%08x\t0x%08x\n",
+       rpp_sci_printf("active_tail:\t0x%08x\t0x%08x\n",
                        beforeRecv.active_tail, afterRecv.active_tail);
-       rpp_sci_printf((const char *) "free_head:\t0x%08x\t0x%08x\n",
+       rpp_sci_printf("free_head:\t0x%08x\t0x%08x\n",
                        beforeRecv.free_head, afterRecv.free_head);
-       rpp_sci_printf((const char *) "freed_pbuf_len:\t%d\t\t%d\n\n",
+       rpp_sci_printf("freed_pbuf_len:\t%d\t\t%d\n\n",
                        beforeRecv.freed_pbuf_len, afterRecv.freed_pbuf_len);
 }
 
@@ -242,13 +242,18 @@ unsigned long readNum(uint8_t minamount, uint8_t maxamount, boolean_t hex){
 
 int cmd_do_bufferdescriptors(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
 {
+       if(!isPostInitialized())
+       {
+               rpp_sci_printf("Eth not initialized run 'ethinit' command first.\n");
+               return FAILURE;
+       }
        uint8_t input;
        volatile struct emac_tx_bd *bufferDescriptor;
        boolean_t run = TRUE;
        struct netif *netif = rpp_eth_get_netif(INTERFACE_INSTANCE_NUMBER);
        if(netif == NULL)
        {
-               rpp_sci_printf((const char *) "netif err\n");
+               rpp_sci_printf("netif err\n");
                return -1;
        }
 
@@ -256,9 +261,9 @@ int cmd_do_bufferdescriptors(cmd_io_t *cmd_io, const struct cmd_des *des, char *
                input = rpp_sci_getc();
 
                if(input == 'b'){ /* print buffer descriptor at given address */
-                       rpp_sci_printf((const char *) "-? 0x");
+                       rpp_sci_printf("-? 0x");
                        bufferDescriptor = (struct emac_tx_bd *) readNum(8,8,TRUE);
-                       rpp_sci_printf((const char *) "\n");
+                       rpp_sci_printf("\n");
                        /* check it fits EMAC CPPI RAM */
                        /*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)
                        {*/
@@ -266,7 +271,7 @@ int cmd_do_bufferdescriptors(cmd_io_t *cmd_io, const struct cmd_des *des, char *
                        /*}
                        else
                        {
-                               rpp_sci_printf((const char *) "address not from BD CPPI RAM range\n");
+                               rpp_sci_printf("address not from BD CPPI RAM range\n");
                        }*/
                        while(1){
                                input = rpp_sci_getc();
@@ -275,7 +280,7 @@ int cmd_do_bufferdescriptors(cmd_io_t *cmd_io, const struct cmd_des *des, char *
                                        if(bufferDescriptor != NULL){
                                                print_bd_content(bufferDescriptor, FALSE);
                                        }else{
-                                               rpp_sci_printf((const char *) "NULL\n");
+                                               rpp_sci_printf("NULL\n");
                                                break;
                                        }
                                }else if(input == 'p'){ /* previous */
@@ -283,7 +288,7 @@ int cmd_do_bufferdescriptors(cmd_io_t *cmd_io, const struct cmd_des *des, char *
                                        if((int32_t)bufferDescriptor != -1)
                                        {
                         if(bufferDescriptor == NULL){
-                                               rpp_sci_printf((const char *) "NULL\n");
+                                               rpp_sci_printf("NULL\n");
                                                break;
                         }else{
                                print_bd_content(bufferDescriptor, FALSE);
@@ -291,7 +296,7 @@ int cmd_do_bufferdescriptors(cmd_io_t *cmd_io, const struct cmd_des *des, char *
                                        }
                                        else
                                        {
-                                               rpp_sci_printf((const char *) "not found\n");
+                                               rpp_sci_printf("not found\n");
                                                break;
                                        }
                                }else if(input == 'r'){ /* reprint */
@@ -323,23 +328,35 @@ int cmd_do_bufferdescriptors(cmd_io_t *cmd_io, const struct cmd_des *des, char *
             uint8_t param = rpp_sci_getc() - '0';
             print_bds_state(mode, param);
                }else if(input == 'c'){ /* convert */
-                       rpp_sci_printf((const char *) "0x%08x", bd_addr((uint16_t)readNum(1, 3, FALSE)));
+                       rpp_sci_printf("0x%08x", bd_addr((uint16_t)readNum(1, 3, FALSE)));
                }
        }
 
     return ERR_OK;
 }
 
+#if LWIP_DHCP
 int cmd_do_dhcp(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
 {
-    rpp_sci_printf((const char *) "not implemented yet.");
+       if(!isPostInitialized())
+       {
+               rpp_sci_printf("Eth not initialized run 'ethinit' command first.\n");
+               return FAILURE;
+       }
+    rpp_sci_printf("not implemented yet.");
     return ERR_OK;
 }
+#endif
 
 #if LWIP_STATS_DISPLAY
 int cmd_do_lwip(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
 {
-       rpp_sci_printf((const char *) "not implemented yet.");
+       if(!isPostInitialized())
+       {
+               rpp_sci_printf("Eth not initialized run 'ethinit' command first.\n");
+               return FAILURE;
+       }
+       rpp_sci_printf("not implemented yet.");
        void stats_display();
        /*
        void stats_display_proto(struct stats_proto *proto, const char *name);
@@ -351,6 +368,29 @@ int cmd_do_lwip(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
 }
 #endif
 
+int cmd_do_ethinit(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
+{
+       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 */
+
+       switch(retVal){
+       case FAILURE:
+               rpp_sci_printf("already initialized\n");
+               break;
+       case NETIF_ADD_ERR:
+               rpp_sci_printf("initialization of physical part of ethernet failed\n");
+               break;
+       case DHCP_MEM_ERR:
+               rpp_sci_printf("DHCP couldn't be started due to insufficient memory\n");
+               break;
+       case PHY_LINK_DOWN:
+               rpp_sci_printf("cable is not connected\n");
+               break;
+       default:
+               rpp_sci_printf("ethinit DONE\n");
+       }
+       return retVal;
+}
+
 #endif /* DOCGEN */
 
 cmd_des_t const cmd_des_bufferdescriptors={
@@ -378,6 +418,7 @@ cmd_des_t const cmd_des_bufferdescriptors={
     CMD_HANDLER(cmd_do_bufferdescriptors), (void *)&cmd_list_netstats
 };
 
+#if LWIP_DHCP
 cmd_des_t const cmd_des_dhcp={
     0,0,
     "dhcp","Prints and controls DHCP",
@@ -397,6 +438,7 @@ cmd_des_t const cmd_des_dhcp={
     "   \n",
     CMD_HANDLER(cmd_do_dhcp), (void *)&cmd_list_netstats
 };
+#endif
 
 #if LWIP_STATS_DISPLAY
 cmd_des_t const cmd_des_lwip={
@@ -420,12 +462,34 @@ cmd_des_t const cmd_des_lwip={
 };
 #endif
 
+cmd_des_t const cmd_des_ethinit={
+    0,0,
+    "ethinit","Post OS startup eth initialization",
+
+    "=== Command syntax ===\n"
+    "\n"
+    "   ethinit\n"
+    "\n"
+    "=== Description ===\n"
+    "This command finishes autonegotiation of PHY and initialize LwIP stack.\n"
+    "\n"
+    "\n"
+    "=== Example ===\n"
+    "\n"
+    "   --> ethinit\n"
+    "   \n",
+    CMD_HANDLER(cmd_do_ethinit), (void *)&cmd_list_netstats
+};
+
 /** List of commands for lwip, defined as external */
 cmd_des_t const *cmd_list_netstats[]={
   &cmd_des_bufferdescriptors,
-//  &cmd_des_dhcp,
+#if LWIP_DHCP
+  &cmd_des_dhcp,
+#endif
 #if LWIP_STATS_DISPLAY
 //  &cmd_des_lwip,
 #endif
+  &cmd_des_ethinit,
   NULL
 };
diff --git a/rpp-lib b/rpp-lib
index 5f34c41b4f1d01f26d21023166cea4c55ab47f54..ae895f96e346f582e43995e75a57f0b544304df3 160000 (submodule)
--- a/rpp-lib
+++ b/rpp-lib
@@ -1 +1 @@
-Subproject commit 5f34c41b4f1d01f26d21023166cea4c55ab47f54
+Subproject commit ae895f96e346f582e43995e75a57f0b544304df3