
Hi, I uboot - i want to recieve network packets. I wrote a small program using the code available in uboot. However its not working ?. Can anyone point me where i am going wrong ?.
I am trying to write a server kind of a cmd - which recieves some requests from host and carries out some actions.
I just want UdpProtoHandler to be called whenever the ethernet controller recieves a packet.
As a start, i am sending raw ethernet packets on the network.
But, NetReceive Function is not getting called.
Why ?. Am i doing something wrong ?.
Regards,
John
My Code,
static void UdpProtoHandler (uchar * pkt, unsigned dest, unsigned src, unsigned len) ; static void udptimeout (void) { NetSetTimeout (100 * CFG_HZ, udptimeout) ; NetState = NETLOOP_CONTINUE; }
int send_udp (void) { DECLARE_GLOBAL_DATA_PTR;
eth_halt();
if (eth_init(bd) < 0) return(-1);
NetState = NETLOOP_CONTINUE; NetSetTimeout (10 * CFG_HZ, udptimeout); NetSetHandler (UdpProtoHandler) ;
return 1 ; }
static void UdpProtoHandler (uchar * pkt, unsigned dest, unsigned src, unsigned len) {
puts ("handler:-------------------\n") ; printf ("dest : %u src:%u and length : %u\n", dest, src, len) ;
while (len > 0) { printf ("%c", *pkt) ; pkt++ ; len-- ; }
puts ("\ndone\n") ; NetState = NETLOOP_SUCCESS; }