Xilinx PowerPC receive udp messages

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Xilinx PowerPC receive udp messages

Peter Kampmann
Hi everyone,

after trying various ways to receive an udp-packet to the powerPC, I want to ask if somebody of you sees perhaps the missing or wrong code that makes my code refusing to accept udp packages.


static u8_t my_timer = 0;

struct ip_addr ipaddr, netmask, gw;
char macAdress[6];
char port = 9050;
struct netif * networkInterface;
struct pbuf *pb;
int waiting_for_timer = 1;
XTime ml_base, ml_new, ml_offset;

extern XEmacIf_Config XEmacIf_ConfigTable[];

struct udp_pcb *pcb;

//init the lwip services
void init()
{
        err_t err;
        macAdress[0] = 0x00;
        macAdress[1] = 0x0A;
        macAdress[2] = 0x35;
        macAdress[3] = 0x00;
        macAdress[4] = 0x22;
        macAdress[5] = 0x21;
       
        //we need a timer
       
        //init the lwip parts
        sys_init();
       
        mem_init();
        xil_printf("heap initialised\r\n");
       
        memp_init();
        xil_printf("memp initialised\r\n");
       
        pbuf_init();
        xil_printf("pbuf init done\r\n");
       
        xil_printf("Wait some time, for initialising\r\n");
       
        unsigned int init_wait = 15000000;
        while(init_wait--);
       
        //set the Hardware MAC-Address
        xemacif_setmac(0,(u8_t *) macAdress );
       
        //set up the ipAddress, Netmask and Gateway
        IP4_ADDR(&gw, 0,0,0,0);
        IP4_ADDR(&ipaddr, 192,168,1,1);
        IP4_ADDR(&netmask, 255,255,255,0);
       
        //init netif
        netif_init();
        xil_printf("netif_init done\r\n");
       
        ip_init();
       
        //tcp_init();
       
        udp_init();
       
        //allocate memory for the netif
        networkInterface = (netif*)mem_malloc(sizeof(struct netif));
       
        //add a new network interface.
        networkInterface = netif_add(networkInterface,
                                                                                        &ipaddr,
                                                                                        &netmask,
                                                                                        &gw,
                                                                                        &XEmacIf_ConfigTable[0],
                                                                                        xemacif_init,
                                                                                        ip_input);
       
        xil_printf("wait for network to start...\r\n");
        init_wait = 15000000;
        while(init_wait--);
       
        netif_set_default(networkInterface);
       
        xil_printf("Network started up!\r\n");

        pcb = udp_new();
       
  err = udp_bind(pcb, IP_ADDR_ANY, port);
  //err = udp_bind(pcb, &ipaddr, port);

        if (err == ERR_OK)
        {
                xil_printf("NOTICE, Successfuly bound to port\r\n");
               
        }
        else
        {
                xil_printf("ERROR, Could not bound to port\r\n");
        }

}

void echo_udp_init(void)
{
 struct udp_pcb *pcb;

 pcb = udp_new();
 udp_bind( pcb, IP_ADDR_ANY, port );
 udp_recv( pcb, &echo_udp_recv, NULL );
}


static void echo_udp_recv( void* arg, struct udp_pcb *pcb, struct pbuf *p, struct ip_addr *addr, u16_t port )
{
       
 xil_printf("receive...\r\n");
       
 err_t err;

 err = udp_connect( pcb, addr, port );
 if (err != ERR_OK)
 {
   printf( "ERROR:  udp_connect() error:  %d\n", err );
 }
 err = udp_send( pcb, p );
 if (err != ERR_OK)
 {
   printf( "ERROR:  udp_send() error:  %d\n", err );
 }
 pbuf_free( p );
 udp_remove( pcb );
 echo_udp_init();
 return;
}

int main()
{
   init();
   
   echo_udp_init();
       
   // Get the current Time-Base Register Value
   //    offset it by ml_offset
   XTime_SetTime(0);
   XTime_GetTime(&ml_base);
   ml_base += ml_offset;
       
   while (1) {
      while (waiting_for_timer) {
         xemacif_input(networkInterface);
         XTime_GetTime(&ml_new);
         if ( ml_new >= ml_base ) {
            waiting_for_timer = 0;
            ml_base = ml_new + ml_offset;
         }
      }
      // Call my_tmr() every ml_offset cycles
      my_tmr();
      waiting_for_timer = 1;
     
   }
   return(1);
}

As far as I understand the raw API, after calling the function echo_udp_init()
the function echo_udp_recv is registered as a callback function, when a udp package arrives, the function is then called automatically.

Instead of registering the callback function like udp_recv( pcb, &echo_udp_recv, NULL ); I tried also udp_recv( pcb, &echo_udp_recv, networkInterface );
But that didn't work, too.

Does this code not work in the stand-alone version? Do I need to use the xilkernel?

Hope somebody can help me.

Thanks and regards,
Peter
Reply | Threaded
Open this post in threaded view
|

Re: Xilinx PowerPC receive udp messages

Sathya Thammanur
Hi Peter,
Xilkernel is needed when you want to use the sockets API of lwIP. The kernel provides the semaphores and mailboxes feature required for the sockets mode operation. However, the RAW API works using callback functions. The code definitely is different for Sockets mode vs Raw mode. Mixing the two modes will not work correctly. A TCP echo server example using the RAW API mode is attached.

Hope this helps.

Sathya


On 8/21/06, Peter Kampmann <[hidden email]> wrote:

Hi everyone,

after trying various ways to receive an udp-packet to the powerPC, I want to
ask if somebody of you sees perhaps the missing or wrong code that makes my
code refusing to accept udp packages.


static u8_t my_timer = 0;

struct ip_addr ipaddr, netmask, gw;
char macAdress[6];
char port = 9050;
struct netif * networkInterface;
struct pbuf *pb;
int waiting_for_timer = 1;
XTime ml_base, ml_new, ml_offset;

extern XEmacIf_Config XEmacIf_ConfigTable[];

struct udp_pcb *pcb;

//init the lwip services
void init()
{
        err_t err;
        macAdress[0] = 0x00;
        macAdress[1] = 0x0A;
        macAdress[2] = 0x35;
        macAdress[3] = 0x00;
        macAdress[4] = 0x22;
        macAdress[5] = 0x21;

        //we need a timer

        //init the lwip parts
        sys_init();

        mem_init();
        xil_printf("heap initialised\r\n");

        memp_init();
        xil_printf("memp initialised\r\n");

        pbuf_init();
        xil_printf("pbuf init done\r\n");

        xil_printf("Wait some time, for initialising\r\n");

        unsigned int init_wait = 15000000;
        while(init_wait--);

        //set the Hardware MAC-Address
        xemacif_setmac(0,(u8_t *) macAdress );

        //set up the ipAddress, Netmask and Gateway
        IP4_ADDR(&gw, 0,0,0,0);
        IP4_ADDR(&ipaddr, 192,168,1,1);
        IP4_ADDR(&netmask, 255,255,255,0);

        //init netif
        netif_init();
        xil_printf("netif_init done\r\n");

        ip_init();

        //tcp_init();

        udp_init();

        //allocate memory for the netif
        networkInterface = (netif*)mem_malloc(sizeof(struct netif));

        //add a new network interface.
        networkInterface = netif_add(networkInterface,
                                                                                        &ipaddr,
                                                                                        &netmask,
                                                                                        &gw,
                                                                                        &XEmacIf_ConfigTable[0],
                                                                                        xemacif_init,
                                                                                        ip_input);

        xil_printf("wait for network to start...\r\n");
        init_wait = 15000000;
        while(init_wait--);

        netif_set_default(networkInterface);

        xil_printf("Network started up!\r\n");

        pcb = udp_new();

        err = udp_bind(pcb, IP_ADDR_ANY, port);
        //err = udp_bind(pcb, &ipaddr, port);

        if (err == ERR_OK)
        {
                xil_printf("NOTICE, Successfuly bound to port\r\n");

        }
        else
        {
                xil_printf("ERROR, Could not bound to port\r\n");
        }

}

void echo_udp_init(void)
{
struct udp_pcb *pcb;

pcb = udp_new();
udp_bind( pcb, IP_ADDR_ANY, port );
udp_recv( pcb, &echo_udp_recv, NULL );
}


static void echo_udp_recv( void* arg, struct udp_pcb *pcb, struct pbuf *p,
struct ip_addr *addr, u16_t port )
{

xil_printf("receive...\r\n");

err_t err;

err = udp_connect( pcb, addr, port );
if (err != ERR_OK)
{
   printf( "ERROR:  udp_connect() error:  %d\n", err );
}
err = udp_send( pcb, p );
if (err != ERR_OK)
{
   printf( "ERROR:  udp_send() error:  %d\n", err );
}
pbuf_free( p );
udp_remove( pcb );
echo_udp_init();
return;
}

int main()
{
   init();

   echo_udp_init();

   // Get the current Time-Base Register Value
   //    offset it by ml_offset
   XTime_SetTime(0);
   XTime_GetTime(&ml_base);
   ml_base += ml_offset;

   while (1) {
      while (waiting_for_timer) {
         xemacif_input(networkInterface);
         XTime_GetTime(&ml_new);
         if ( ml_new >= ml_base ) {
            waiting_for_timer = 0;
            ml_base = ml_new + ml_offset;
         }
      }
      // Call my_tmr() every ml_offset cycles
      my_tmr();
      waiting_for_timer = 1;

   }
   return(1);
}

As far as I understand the raw API, after calling the function
echo_udp_init()
the function echo_udp_recv is registered as a callback function, when a udp
package arrives, the function is then called automatically.

Instead of registering the callback function like udp_recv( pcb,
&echo_udp_recv, NULL ); I tried also udp_recv( pcb, &echo_udp_recv,
networkInterface );
But that didn't work, too.

Does this code not work in the stand-alone version? Do I need to use the
xilkernel?

Hope somebody can help me.

Thanks and regards,
Peter
--
View this message in context: http://www.nabble.com/Xilinx-PowerPC-receive-udp-messages-tf2138912.html#a5902800
Sent from the lwip-users forum at Nabble.com.



_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users


_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users

tcp_echo_raw.zip (7K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Xilinx PowerPC receive udp messages

Mumtaz Ahmad

Hi Sathya

In your attached code i see tcp timers timing different than usually recommended .

Your code implements

Call tcp_fasttmr() every 2 ms

Call tcp_slowtmr() every 5 ms

Why is it so?

Regards

 

----- Original Message -----
Sent: Tuesday, August 22, 2006 11:00 PM
Subject: Re: [lwip-users] Xilinx PowerPC receive udp messages

Hi Peter,
Xilkernel is needed when you want to use the sockets API of lwIP. The kernel provides the semaphores and mailboxes feature required for the sockets mode operation. However, the RAW API works using callback functions. The code definitely is different for Sockets mode vs Raw mode. Mixing the two modes will not work correctly. A TCP echo server example using the RAW API mode is attached.

Hope this helps.

Sathya


On 8/21/06, Peter Kampmann <[hidden email]> wrote:

Hi everyone,

after trying various ways to receive an udp-packet to the powerPC, I want to
ask if somebody of you sees perhaps the missing or wrong code that makes my
code refusing to accept udp packages.


static u8_t my_timer = 0;

struct ip_addr ipaddr, netmask, gw;
char macAdress[6];
char port = 9050;
struct netif * networkInterface;
struct pbuf *pb;
int waiting_for_timer = 1;
XTime ml_base, ml_new, ml_offset;

extern XEmacIf_Config XEmacIf_ConfigTable[];

struct udp_pcb *pcb;

//init the lwip services
void init()
{
        err_t err;
        macAdress[0] = 0x00;
        macAdress[1] = 0x0A;
        macAdress[2] = 0x35;
        macAdress[3] = 0x00;
        macAdress[4] = 0x22;
        macAdress[5] = 0x21;

        //we need a timer

        //init the lwip parts
        sys_init();

        mem_init();
        xil_printf("heap initialised\r\n");

        memp_init();
        xil_printf("memp initialised\r\n");

        pbuf_init();
        xil_printf("pbuf init done\r\n");

        xil_printf("Wait some time, for initialising\r\n");

        unsigned int init_wait = 15000000;
        while(init_wait--);

        //set the Hardware MAC-Address
        xemacif_setmac(0,(u8_t *) macAdress );

        //set up the ipAddress, Netmask and Gateway
        IP4_ADDR(&gw, 0,0,0,0);
        IP4_ADDR(&ipaddr, 192,168,1,1);
        IP4_ADDR(&netmask, 255,255,255,0);

        //init netif
        netif_init();
        xil_printf("netif_init done\r\n");

        ip_init();

        //tcp_init();

        udp_init();

        //allocate memory for the netif
        networkInterface = (netif*)mem_malloc(sizeof(struct netif));

        //add a new network interface.
        networkInterface = netif_add(networkInterface,
                                                                                        &ipaddr,
                                                                                        &netmask,
                                                                                        &gw,
                                                                                        &XEmacIf_ConfigTable[0],
                                                                                        xemacif_init,
                                                                                        ip_input);

        xil_printf("wait for network to start...\r\n");
        init_wait = 15000000;
        while(init_wait--);

        netif_set_default(networkInterface);

        xil_printf("Network started up!\r\n");

        pcb = udp_new();

        err = udp_bind(pcb, IP_ADDR_ANY, port);
        //err = udp_bind(pcb, &ipaddr, port);

        if (err == ERR_OK)
        {
                xil_printf("NOTICE, Successfuly bound to port\r\n");

        }
        else
        {
                xil_printf("ERROR, Could not bound to port\r\n");
        }

}

void echo_udp_init(void)
{
struct udp_pcb *pcb;

pcb = udp_new();
udp_bind( pcb, IP_ADDR_ANY, port );
udp_recv( pcb, &echo_udp_recv, NULL );
}


static void echo_udp_recv( void* arg, struct udp_pcb *pcb, struct pbuf *p,
struct ip_addr *addr, u16_t port )
{

xil_printf("receive...\r\n");

err_t err;

err = udp_connect( pcb, addr, port );
if (err != ERR_OK)
{
   printf( "ERROR:  udp_connect() error:  %d\n", err );
}
err = udp_send( pcb, p );
if (err != ERR_OK)
{
   printf( "ERROR:  udp_send() error:  %d\n", err );
}
pbuf_free( p );
udp_remove( pcb );
echo_udp_init();
return;
}

int main()
{
   init();

   echo_udp_init();

   // Get the current Time-Base Register Value
   //    offset it by ml_offset
   XTime_SetTime(0);
   XTime_GetTime(&ml_base);
   ml_base += ml_offset;

   while (1) {
      while (waiting_for_timer) {
         xemacif_input(networkInterface);
         XTime_GetTime(&ml_new);
         if ( ml_new >= ml_base ) {
            waiting_for_timer = 0;
            ml_base = ml_new + ml_offset;
         }
      }
      // Call my_tmr() every ml_offset cycles
      my_tmr();
      waiting_for_timer = 1;

   }
   return(1);
}

As far as I understand the raw API, after calling the function
echo_udp_init()
the function echo_udp_recv is registered as a callback function, when a udp
package arrives, the function is then called automatically.

Instead of registering the callback function like udp_recv( pcb,
&echo_udp_recv, NULL ); I tried also udp_recv( pcb, &echo_udp_recv,
networkInterface );
But that didn't work, too.

Does this code not work in the stand-alone version? Do I need to use the
xilkernel?

Hope somebody can help me.

Thanks and regards,
Peter
--
View this message in context: http://www.nabble.com/Xilinx-PowerPC-receive-udp-messages-tf2138912.html#a5902800
Sent from the lwip-users forum at Nabble.com.



_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users


--
This message has been scanned for viruses and
dangerous content by Streaming Networks, and is
believed to be clean.


_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users

--
This message has been scanned for viruses and
dangerous content by Streaming Networks, and is
believed to be clean.
_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: Xilinx PowerPC receive udp messages

Peter Kampmann
In reply to this post by Sathya Thammanur
Hi Sathya,

thanks a lot, that example quite helped me.

But as I want to use the lwip in C++ I get an error at

XIntc_RegisterHandler(XPAR_OPB_INTC_0_BASEADDR,
                       XPAR_OPB_INTC_0_ETHERNET_MAC_IP2INTC_IRPT_INTR,
                       (XInterruptHandler)XEmac_IntrHandlerFifo,
                        xemacif_ptr->instance_ptr);

the error is: undefined reference to `XEmac_IntrHandlerFifo'

Even if I tell the C++ Compiler to handle this code as c code via
#ifdef __cplusplus
extern "C" { ...

I get this error. What am I doing wrong?

Regards,
Peter


Sathya Thammanur wrote
Hi Peter,
Xilkernel is needed when you want to use the sockets API of lwIP. The kernel
provides the semaphores and mailboxes feature required for the sockets mode
operation. However, the RAW API works using callback functions. The code
definitely is different for Sockets mode vs Raw mode. Mixing the two modes
will not work correctly. A TCP echo server example using the RAW API mode is
attached.

Hope this helps.

Sathya


On 8/21/06, Peter Kampmann <peter.kampmann@informatik.uni-oldenburg.de>
wrote:
>
>
> Hi everyone,
>
> after trying various ways to receive an udp-packet to the powerPC, I want
> to
> ask if somebody of you sees perhaps the missing or wrong code that makes
> my
> code refusing to accept udp packages.
>
>
> static u8_t my_timer = 0;
>
> struct ip_addr ipaddr, netmask, gw;
> char macAdress[6];
> char port = 9050;
> struct netif * networkInterface;
> struct pbuf *pb;
> int waiting_for_timer = 1;
> XTime ml_base, ml_new, ml_offset;
>
> extern XEmacIf_Config XEmacIf_ConfigTable[];
>
> struct udp_pcb *pcb;
>
> //init the lwip services
> void init()
> {
>         err_t err;
>         macAdress[0] = 0x00;
>         macAdress[1] = 0x0A;
>         macAdress[2] = 0x35;
>         macAdress[3] = 0x00;
>         macAdress[4] = 0x22;
>         macAdress[5] = 0x21;
>
>         //we need a timer
>
>         //init the lwip parts
>         sys_init();
>
>         mem_init();
>         xil_printf("heap initialised\r\n");
>
>         memp_init();
>         xil_printf("memp initialised\r\n");
>
>         pbuf_init();
>         xil_printf("pbuf init done\r\n");
>
>         xil_printf("Wait some time, for initialising\r\n");
>
>         unsigned int init_wait = 15000000;
>         while(init_wait--);
>
>         //set the Hardware MAC-Address
>         xemacif_setmac(0,(u8_t *) macAdress );
>
>         //set up the ipAddress, Netmask and Gateway
>         IP4_ADDR(&gw, 0,0,0,0);
>         IP4_ADDR(&ipaddr, 192,168,1,1);
>         IP4_ADDR(&netmask, 255,255,255,0);
>
>         //init netif
>         netif_init();
>         xil_printf("netif_init done\r\n");
>
>         ip_init();
>
>         //tcp_init();
>
>         udp_init();
>
>         //allocate memory for the netif
>         networkInterface = (netif*)mem_malloc(sizeof(struct netif));
>
>         //add a new network interface.
>         networkInterface = netif_add(networkInterface,
>
>                                                                                         &ipaddr,
>
>                                                                                         &netmask,
>
>                                                                                         &gw,
>
>                                                                                         &XEmacIf_ConfigTable[0],
>
>                                                                                         xemacif_init,
>
>                                                                                         ip_input);
>
>         xil_printf("wait for network to start...\r\n");
>         init_wait = 15000000;
>         while(init_wait--);
>
>         netif_set_default(networkInterface);
>
>         xil_printf("Network started up!\r\n");
>
>         pcb = udp_new();
>
>         err = udp_bind(pcb, IP_ADDR_ANY, port);
>         //err = udp_bind(pcb, &ipaddr, port);
>
>         if (err == ERR_OK)
>         {
>                 xil_printf("NOTICE, Successfuly bound to port\r\n");
>
>         }
>         else
>         {
>                 xil_printf("ERROR, Could not bound to port\r\n");
>         }
>
> }
>
> void echo_udp_init(void)
> {
> struct udp_pcb *pcb;
>
> pcb = udp_new();
> udp_bind( pcb, IP_ADDR_ANY, port );
> udp_recv( pcb, &echo_udp_recv, NULL );
> }
>
>
> static void echo_udp_recv( void* arg, struct udp_pcb *pcb, struct pbuf *p,
> struct ip_addr *addr, u16_t port )
> {
>
> xil_printf("receive...\r\n");
>
> err_t err;
>
> err = udp_connect( pcb, addr, port );
> if (err != ERR_OK)
> {
>    printf( "ERROR:  udp_connect() error:  %d\n", err );
> }
> err = udp_send( pcb, p );
> if (err != ERR_OK)
> {
>    printf( "ERROR:  udp_send() error:  %d\n", err );
> }
> pbuf_free( p );
> udp_remove( pcb );
> echo_udp_init();
> return;
> }
>
> int main()
> {
>    init();
>
>    echo_udp_init();
>
>    // Get the current Time-Base Register Value
>    //    offset it by ml_offset
>    XTime_SetTime(0);
>    XTime_GetTime(&ml_base);
>    ml_base += ml_offset;
>
>    while (1) {
>       while (waiting_for_timer) {
>          xemacif_input(networkInterface);
>          XTime_GetTime(&ml_new);
>          if ( ml_new >= ml_base ) {
>             waiting_for_timer = 0;
>             ml_base = ml_new + ml_offset;
>          }
>       }
>       // Call my_tmr() every ml_offset cycles
>       my_tmr();
>       waiting_for_timer = 1;
>
>    }
>    return(1);
> }
>
> As far as I understand the raw API, after calling the function
> echo_udp_init()
> the function echo_udp_recv is registered as a callback function, when a
> udp
> package arrives, the function is then called automatically.
>
> Instead of registering the callback function like udp_recv( pcb,
> &echo_udp_recv, NULL ); I tried also udp_recv( pcb, &echo_udp_recv,
> networkInterface );
> But that didn't work, too.
>
> Does this code not work in the stand-alone version? Do I need to use the
> xilkernel?
>
> Hope somebody can help me.
>
> Thanks and regards,
> Peter
> --
> View this message in context:
> http://www.nabble.com/Xilinx-PowerPC-receive-udp-messages-tf2138912.html#a5902800
> Sent from the lwip-users forum at Nabble.com.
>
>
>
> _______________________________________________
> lwip-users mailing list
> lwip-users@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/lwip-users
>

_______________________________________________
lwip-users mailing list
lwip-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: Xilinx PowerPC receive udp messages

Pedro Alves-6
Peter Kampmann wrote:

> Hi Sathya,
>
> thanks a lot, that example quite helped me.
>
> But as I want to use the lwip in C++ I get an error at
>
> XIntc_RegisterHandler(XPAR_OPB_INTC_0_BASEADDR,
>                        XPAR_OPB_INTC_0_ETHERNET_MAC_IP2INTC_IRPT_INTR,
>                        (XInterruptHandler)XEmac_IntrHandlerFifo,
>                         xemacif_ptr->instance_ptr);
>
> the error is: undefined reference to `XEmac_IntrHandlerFifo'
>
> Even if I tell the C++ Compiler to handle this code as c code via
> #ifdef __cplusplus
> extern "C" { ...
>
> I get this error. What am I doing wrong?
>

A few ideas:

1)

You wrapped this? :
 > XIntc_RegisterHandler(XPAR_OPB_INTC_0_BASEADDR,
 >                        XPAR_OPB_INTC_0_ETHERNET_MAC_IP2INTC_IRPT_INTR,
 >                        (XInterruptHandler)XEmac_IntrHandlerFifo,
 >                         xemacif_ptr->instance_ptr);

or the declaration of XEmac_IntrHandlerFifo?

You need to wrap XEmac_IntrHandlerFifo.

No idea what the function looks like, but probably like this?
extern "C" void XEmac_IntrHandlerFifo(void*);

2)
Is the function really defined?
Try checking with the map file, if you have one,
or with something equivalent of nm or objdump.

Cheers,
Pedro Alves


_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: Xilinx PowerPC receive udp messages

Peter Kampmann
Pedro Alves-6 wrote
A few ideas:

1)

You wrapped this? :
 > XIntc_RegisterHandler(XPAR_OPB_INTC_0_BASEADDR,
 >                        XPAR_OPB_INTC_0_ETHERNET_MAC_IP2INTC_IRPT_INTR,
 >                        (XInterruptHandler)XEmac_IntrHandlerFifo,
 >                         xemacif_ptr->instance_ptr);

or the declaration of XEmac_IntrHandlerFifo?
I wrapped the file that includes the above call XIntc_RegisterHandler(..) but that did not help.
All files in lwip and the xilinx emac seem to have the

#ifdef __cplusplus
 extern "C" { ...

around their headers.

Pedro Alves-6 wrote
You need to wrap XEmac_IntrHandlerFifo.

No idea what the function looks like, but probably like this?
extern "C" void XEmac_IntrHandlerFifo(void*);

2)
Is the function really defined?
Try checking with the map file, if you have one,
or with something equivalent of nm or objdump.
The function is defined, when I use Ctrl+clicking onto XEmac_IntrHandlerFifo the Platform Studio SDK points me to the function, which is located in xemac.c.
But the linker does not find it ...

Regards,
Peter

Pedro Alves-6 wrote
Cheers,
Pedro Alves


_______________________________________________
lwip-users mailing list
lwip-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: Xilinx PowerPC receive udp messages

Pedro Alves-6
Peter Kampmann wrote:

>
> Pedro Alves-6 wrote:
>
>>A few ideas:
>>
>>1)
>>
>>You wrapped this? :
>> > XIntc_RegisterHandler(XPAR_OPB_INTC_0_BASEADDR,
>> >                        XPAR_OPB_INTC_0_ETHERNET_MAC_IP2INTC_IRPT_INTR,
>> >                        (XInterruptHandler)XEmac_IntrHandlerFifo,
>> >                         xemacif_ptr->instance_ptr);
>>
>>or the declaration of XEmac_IntrHandlerFifo?
>>
>
>
> I wrapped the file that includes the above call XIntc_RegisterHandler(..)
> but that did not help.
> All files in lwip and the xilinx emac seem to have the
>
> #ifdef __cplusplus
>  extern "C" { ...
>
> around their headers.
>
>
> Pedro Alves-6 wrote:
>
>>You need to wrap XEmac_IntrHandlerFifo.
>>


>>No idea what the function looks like, but probably like this?
>>extern "C" void XEmac_IntrHandlerFifo(void*);
>>
>>2)
>>Is the function really defined?
>>Try checking with the map file, if you have one,
>>or with something equivalent of nm or objdump.
>>
>
>
> The function is defined, when I use Ctrl+clicking onto XEmac_IntrHandlerFifo
> the Platform Studio SDK points me to the function, which is located in
> xemac.c.
> But the linker does not find it ...
>

I have no idea what this file is, I never developed with Xilinx stuff.
There are probably others that can give you move advice, but:

- Could it be the other way around? That is, XEmac_IntrHandlerFifo has
c++ mangled signature, so you shouldn't extern "C" it?
- Is that file (xemac.c) part of some lib you need to reference in your
project somewhere?
- If not, is that file being compiled/linked?

Hope that helps,

Cheers,
Pedro Alves

P.S.:
How did you know I come from a royal line and my real last name
is "Alves 6th" :)


_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

RE: Xilinx PowerPC receive udp messages

Matthew Yingling-2
In reply to this post by Peter Kampmann
Is your hardware connected properly?

In order for the EDK to properly detect the use of interrupts for Ethernet,
you need to connect your Ethernet interrupt output to an interrupt
controller or directly to your processor.  Otherwise it won't even try to
link the interrupt code for the EMAC.

Matthew Yingling

-----Original Message-----
From: lwip-users-bounces+matt=[hidden email]
[mailto:lwip-users-bounces+matt=[hidden email]]On Behalf Of
Peter Kampmann
Sent: Wednesday, August 23, 2006 7:28 AM
To: [hidden email]
Subject: Re: [lwip-users] Xilinx PowerPC receive udp messages




Pedro Alves-6 wrote:

>
> A few ideas:
>
> 1)
>
> You wrapped this? :
>  > XIntc_RegisterHandler(XPAR_OPB_INTC_0_BASEADDR,
>  >                        XPAR_OPB_INTC_0_ETHERNET_MAC_IP2INTC_IRPT_INTR,
>  >                        (XInterruptHandler)XEmac_IntrHandlerFifo,
>  >                         xemacif_ptr->instance_ptr);
>
> or the declaration of XEmac_IntrHandlerFifo?
>

I wrapped the file that includes the above call XIntc_RegisterHandler(..)
but that did not help.
All files in lwip and the xilinx emac seem to have the

#ifdef __cplusplus
 extern "C" { ...

around their headers.


Pedro Alves-6 wrote:

>
> You need to wrap XEmac_IntrHandlerFifo.
>
> No idea what the function looks like, but probably like this?
> extern "C" void XEmac_IntrHandlerFifo(void*);
>
> 2)
> Is the function really defined?
> Try checking with the map file, if you have one,
> or with something equivalent of nm or objdump.
>

The function is defined, when I use Ctrl+clicking onto XEmac_IntrHandlerFifo
the Platform Studio SDK points me to the function, which is located in
xemac.c.
But the linker does not find it ...

Regards,
Peter


Pedro Alves-6 wrote:

>
> Cheers,
> Pedro Alves
>
>
> _______________________________________________
> lwip-users mailing list
> [hidden email]
> http://lists.nongnu.org/mailman/listinfo/lwip-users
>
>
>
--
View this message in context:
http://www.nabble.com/Xilinx-PowerPC-receive-udp-messages-tf2138912.html#a59
42607
Sent from the lwip-users forum at Nabble.com.



_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users



_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: Xilinx PowerPC receive udp messages

Sathya Thammanur
Hi Peter,
Matthew is right. Check if your ethernet interrupts are connected correctly and enabled accordingly. All the drivers code from EDK are wrapped with extern C, so this shouldnt be an issue.

Sathya


On 8/23/06, Matthew Yingling <[hidden email]> wrote:
Is your hardware connected properly?

In order for the EDK to properly detect the use of interrupts for Ethernet,
you need to connect your Ethernet interrupt output to an interrupt
controller or directly to your processor.  Otherwise it won't even try to
link the interrupt code for the EMAC.

Matthew Yingling

-----Original Message-----
From: lwip-users-bounces+matt=[hidden email]
[mailto:[hidden email]]On Behalf Of
Peter Kampmann
Sent: Wednesday, August 23, 2006 7:28 AM
To: [hidden email]
Subject: Re: [lwip-users] Xilinx PowerPC receive udp messages




Pedro Alves-6 wrote:

>
> A few ideas:
>
> 1)
>
> You wrapped this? :
>  > XIntc_RegisterHandler(XPAR_OPB_INTC_0_BASEADDR,
>  >                        XPAR_OPB_INTC_0_ETHERNET_MAC_IP2INTC_IRPT_INTR,
>  >                        (XInterruptHandler)XEmac_IntrHandlerFifo,
>  >                         xemacif_ptr->instance_ptr);
>
> or the declaration of XEmac_IntrHandlerFifo?
>

I wrapped the file that includes the above call XIntc_RegisterHandler(..)
but that did not help.
All files in lwip and the xilinx emac seem to have the

#ifdef __cplusplus
extern "C" { ...

around their headers.


Pedro Alves-6 wrote:

>
> You need to wrap XEmac_IntrHandlerFifo.
>
> No idea what the function looks like, but probably like this?
> extern "C" void XEmac_IntrHandlerFifo(void*);
>
> 2)
> Is the function really defined?
> Try checking with the map file, if you have one,
> or with something equivalent of nm or objdump.
>

The function is defined, when I use Ctrl+clicking onto XEmac_IntrHandlerFifo
the Platform Studio SDK points me to the function, which is located in
xemac.c.
But the linker does not find it ...

Regards,
Peter


Pedro Alves-6 wrote:

>
> Cheers,
> Pedro Alves
>
>
> _______________________________________________
> lwip-users mailing list
> [hidden email]
> http://lists.nongnu.org/mailman/listinfo/lwip-users
>
>
>
--
View this message in context:
http://www.nabble.com/Xilinx-PowerPC-receive-udp-messages-tf2138912.html#a59
42607
Sent from the lwip-users forum at Nabble.com.



_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users



_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users


_______________________________________________
lwip-users mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: Xilinx PowerPC receive udp messages

Peter Kampmann
Thanks for your replies.

Perhaps there is a misunderstanding, all the lwip source files have the extern C Wrapping.
I tried the example code from Sathya and all worked fine. Then I use the same project and add another
Application to it, then switched the Compiler to g++ and started to develop the c++ code.
When coming to the point where I have to register the Interrupt using this code fragment from the source code from Sathya's example:

XIntc_RegisterHandler(XPAR_OPB_INTC_0_BASEADDR,
                       XPAR_OPB_INTC_0_ETHERNET_MAC_IP2INTC_IRPT_INTR,
                       (XInterruptHandler)XEmac_IntrHandlerFifo,
                        xemacif_ptr->instance_ptr);

I get the error is: undefined reference to `XEmac_IntrHandlerFifo'

After that, I tried some experiments with declaring the example code as extern C. I hoped then I could call this within the C++ code, but that gives the same error.

Regards,
Peter

Sathya Thammanur wrote
Hi Peter,
Matthew is right. Check if your ethernet interrupts are connected correctly
and enabled accordingly. All the drivers code from EDK are wrapped with
extern C, so this shouldnt be an issue.

Sathya


On 8/23/06, Matthew Yingling <myingling@xenotran.com> wrote:
>
> Is your hardware connected properly?
>
> In order for the EDK to properly detect the use of interrupts for
> Ethernet,
> you need to connect your Ethernet interrupt output to an interrupt
> controller or directly to your processor.  Otherwise it won't even try to
> link the interrupt code for the EMAC.
>
> Matthew Yingling
>
> -----Original Message-----
> From: lwip-users-bounces+matt=xenotran.com@nongnu.org
> [mailto:lwip-users-bounces+matt=xenotran.com@nongnu.org]On Behalf Of
> Peter Kampmann
> Sent: Wednesday, August 23, 2006 7:28 AM
> To: lwip-users@nongnu.org
> Subject: Re: [lwip-users] Xilinx PowerPC receive udp messages
>
>
>
>
> Pedro Alves-6 wrote:
> >
> > A few ideas:
> >
> > 1)
> >
> > You wrapped this? :
> >  > XIntc_RegisterHandler(XPAR_OPB_INTC_0_BASEADDR,
>
> >  >                        XPAR_OPB_INTC_0_ETHERNET_MAC_IP2INTC_IRPT_INTR,
> >  >                        (XInterruptHandler)XEmac_IntrHandlerFifo,
> >  >                         xemacif_ptr->instance_ptr);
> >
> > or the declaration of XEmac_IntrHandlerFifo?
> >
>
> I wrapped the file that includes the above call XIntc_RegisterHandler(..)
> but that did not help.
> All files in lwip and the xilinx emac seem to have the
>
> #ifdef __cplusplus
> extern "C" { ...
>
> around their headers.
>
>
> Pedro Alves-6 wrote:
> >
> > You need to wrap XEmac_IntrHandlerFifo.
> >
> > No idea what the function looks like, but probably like this?
> > extern "C" void XEmac_IntrHandlerFifo(void*);
> >
> > 2)
> > Is the function really defined?
> > Try checking with the map file, if you have one,
> > or with something equivalent of nm or objdump.
> >
>
> The function is defined, when I use Ctrl+clicking onto
> XEmac_IntrHandlerFifo
> the Platform Studio SDK points me to the function, which is located in
> xemac.c.
> But the linker does not find it ...
>
> Regards,
> Peter
>
>
> Pedro Alves-6 wrote:
> >
> > Cheers,
> > Pedro Alves
> >
> >
> > _______________________________________________
> > lwip-users mailing list
> > lwip-users@nongnu.org
> > http://lists.nongnu.org/mailman/listinfo/lwip-users
> >
> >
> >
> --
> View this message in context:
>
> http://www.nabble.com/Xilinx-PowerPC-receive-udp-messages-tf2138912.html#a59
> 42607
> Sent from the lwip-users forum at Nabble.com.
>
>
>
> _______________________________________________
> lwip-users mailing list
> lwip-users@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/lwip-users
>
>
>
> _______________________________________________
> lwip-users mailing list
> lwip-users@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/lwip-users
>

_______________________________________________
lwip-users mailing list
lwip-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: Xilinx PowerPC receive udp messages

Peter Kampmann
Problem is "solved", just tried to compile the code with the fresh EDK 8.2 and I get no errors :)

Regards,
Peter


Peter Kampmann wrote
Thanks for your replies.

Perhaps there is a misunderstanding, all the lwip source files have the extern C Wrapping.
I tried the example code from Sathya and all worked fine. Then I use the same project and add another
Application to it, then switched the Compiler to g++ and started to develop the c++ code.
When coming to the point where I have to register the Interrupt using this code fragment from the source code from Sathya's example:

XIntc_RegisterHandler(XPAR_OPB_INTC_0_BASEADDR,
                       XPAR_OPB_INTC_0_ETHERNET_MAC_IP2INTC_IRPT_INTR,
                       (XInterruptHandler)XEmac_IntrHandlerFifo,
                        xemacif_ptr->instance_ptr);

I get the error is: undefined reference to `XEmac_IntrHandlerFifo'

After that, I tried some experiments with declaring the example code as extern C. I hoped then I could call this within the C++ code, but that gives the same error.

Regards,
Peter

Sathya Thammanur wrote
Hi Peter,
Matthew is right. Check if your ethernet interrupts are connected correctly
and enabled accordingly. All the drivers code from EDK are wrapped with
extern C, so this shouldnt be an issue.

Sathya


On 8/23/06, Matthew Yingling <myingling@xenotran.com> wrote:
>
> Is your hardware connected properly?
>
> In order for the EDK to properly detect the use of interrupts for
> Ethernet,
> you need to connect your Ethernet interrupt output to an interrupt
> controller or directly to your processor.  Otherwise it won't even try to
> link the interrupt code for the EMAC.
>
> Matthew Yingling
>
> -----Original Message-----
> From: lwip-users-bounces+matt=xenotran.com@nongnu.org
> [mailto:lwip-users-bounces+matt=xenotran.com@nongnu.org]On Behalf Of
> Peter Kampmann
> Sent: Wednesday, August 23, 2006 7:28 AM
> To: lwip-users@nongnu.org
> Subject: Re: [lwip-users] Xilinx PowerPC receive udp messages
>
>
>
>
> Pedro Alves-6 wrote:
> >
> > A few ideas:
> >
> > 1)
> >
> > You wrapped this? :
> >  > XIntc_RegisterHandler(XPAR_OPB_INTC_0_BASEADDR,
>
> >  >                        XPAR_OPB_INTC_0_ETHERNET_MAC_IP2INTC_IRPT_INTR,
> >  >                        (XInterruptHandler)XEmac_IntrHandlerFifo,
> >  >                         xemacif_ptr->instance_ptr);
> >
> > or the declaration of XEmac_IntrHandlerFifo?
> >
>
> I wrapped the file that includes the above call XIntc_RegisterHandler(..)
> but that did not help.
> All files in lwip and the xilinx emac seem to have the
>
> #ifdef __cplusplus
> extern "C" { ...
>
> around their headers.
>
>
> Pedro Alves-6 wrote:
> >
> > You need to wrap XEmac_IntrHandlerFifo.
> >
> > No idea what the function looks like, but probably like this?
> > extern "C" void XEmac_IntrHandlerFifo(void*);
> >
> > 2)
> > Is the function really defined?
> > Try checking with the map file, if you have one,
> > or with something equivalent of nm or objdump.
> >
>
> The function is defined, when I use Ctrl+clicking onto
> XEmac_IntrHandlerFifo
> the Platform Studio SDK points me to the function, which is located in
> xemac.c.
> But the linker does not find it ...
>
> Regards,
> Peter
>
>
> Pedro Alves-6 wrote:
> >
> > Cheers,
> > Pedro Alves
> >
> >
> > _______________________________________________
> > lwip-users mailing list
> > lwip-users@nongnu.org
> > http://lists.nongnu.org/mailman/listinfo/lwip-users
> >
> >
> >
> --
> View this message in context:
>
> http://www.nabble.com/Xilinx-PowerPC-receive-udp-messages-tf2138912.html#a59
> 42607
> Sent from the lwip-users forum at Nabble.com.
>
>
>
> _______________________________________________
> lwip-users mailing list
> lwip-users@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/lwip-users
>
>
>
> _______________________________________________
> lwip-users mailing list
> lwip-users@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/lwip-users
>

_______________________________________________
lwip-users mailing list
lwip-users@nongnu.org
http://lists.nongnu.org/mailman/listinfo/lwip-users