<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/rpp-lib/lwip/src/include/ipv6}""/>
</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 <id> 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>
/* Include files */
#include "cmdproc_freertos_tms570.h"
#include "rpp/sci.h"
-#include "rpp/eth.h"
/** cmdProc task handler */
xTaskHandle processCmdHandler;
* @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);
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);
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;
}
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;
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);
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 */
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;
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;
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;
tcp_sent(tpcb, nc_sent_callback);
connected = TRUE;
- rpp_sci_printk((const char *) "connected\n");
+ rpp_sci_printk("connected\n");
return ERR_OK;
}
{
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;
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;
*/
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;
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;
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;
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;
/* 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;
}
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){
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 */
{
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;
}
}
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;
}
}
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;
}
}
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;
}
}
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);
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);
}
/*
{
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);
}
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;
}
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)
{*/
/*}
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();
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 */
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);
}
else
{
- rpp_sci_printf((const char *) "not found\n");
+ rpp_sci_printf("not found\n");
break;
}
}else if(input == 'r'){ /* reprint */
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);
}
#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={
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",
" \n",
CMD_HANDLER(cmd_do_dhcp), (void *)&cmd_list_netstats
};
+#endif
#if LWIP_STATS_DISPLAY
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
};
-Subproject commit 5f34c41b4f1d01f26d21023166cea4c55ab47f54
+Subproject commit ae895f96e346f582e43995e75a57f0b544304df3