lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] help: how to use interrupt in RAW_API mode under Xilinx


From: Sathya Thammanur
Subject: Re: [lwip-users] help: how to use interrupt in RAW_API mode under Xilinx-V2
Date: Thu, 19 Oct 2006 08:04:47 -0700

Hi Ye Wu,
As the current implementation stands, the RAW API cannot be used with xilkernel. The Sockets API is what is supported with xilkernel. Hence, the code written above will not work. The RAW API adapter has been optimized and hence will offer the best performance that you are looking for. The Sockets API is not optimized and hence the data rates seen is very much expected. As it stands today, you can choose to use the RAW API and go for the performance or you can work with Sockets API for ease of use of programming. You will need to make the choice based on your requirements.

Sathya


On 10/19/06, ye wu <address@hidden> wrote:
Hi, all

I\'m using a Xilinx-Viterx2 with PowerPC 405 address@hidden

I\'v just start the develop under Xilinx-Viterx2 within a month and now got big problems with the use of lwip in that platform.

At first, i set up a Echo server just follow the example of xilinx\'s echo server under SOCKET_API. As it was discussed a lot in the forum, the trans speed is unbearable, i can get only 10-20kB/s at most, even set the systmr_interval to 1. I\'m not sure about the systmr_interval\'s function for the lwip under SOCKET_API mode, could any one tell me why the speed increased as the value of systmr_interval decrease? And is there any tricks to improve the speen under SOCKET_API mode?

And then i wrote a udp program use RAW_API mode, it works well in the polling mode. As we see, RAW_API are used mainly under standlone kernel, but i think we can use it under xilkernel too. i can get about 300kB/s with that mode. i see in the forum that if we use interrupt instead of polling, we can get much fast, so i write a program (as bellow) but it not work at all, i can not even ping the target from my PC. I don\'t know what wrong, could anyone help me?

1. There were mail messages that use the Standalone Board Support Package for set the interrupt, Can we use the RAW_API in interrupt mode under xilkernel, and registe the irq in xilkernel as we do in SOCKTE_API mode?

2. I\'ve read from the forum that the interupt was used to replase the \'xemacif_input\' in the while loop, so i just set the interupt and cancel the \'xemacif_input\', leave while a null loop to wait for interrupt after setup udp, is that right?

Could anybody help me why it not work? Really appreciate for your help.


the programe is:


void *receiveUDP(void *arg, struct udp_pcb *upcb, struct pbuf *p, struct ip_addr *addr, u16_t port)
{
    udp_send(udpstructreceive,p);
    pbuf_free(p);
}

void* main_main()
{    
    char low_mac[3] = {0x00,0x22,0x20};
    char fullmac[6] = {XILINX_MAC_OUI0, XILINX_MAC_OUI1, XILINX_MAC_OUI2,
                      low_mac[0], low_mac[2], low_mac[3]};

    char ip[4] = {192,168,0,102};
    //char remoteIP[4] = {192,168,0,6};
    char subnet[4] = {255,255,255,0};
    char gateway[4] = {192,168,0,254};
    char sendtoip[4] = {192,168,0,2};
    
    u16_t listenport,sendport;
    listenport = 5001;
    sendport = 5001;

    #ifdef STATS
        stats_init();
    #endif /* STATS */
    xil_printf(\"Initializing Memory Structures.\");
    sys_init();
    mem_init();
    xil_printf(\".\");
    memp_init();
    xil_printf(\".\");
    pbuf_init();
    xil_printf(\" done.\\r\\n\");

    xemacif_setmac(0, (u8_t *) fullmac); //Set MAC

    netif_init();
    udp_init();

    XEmacIf_Config *xemacif_ptr = &XEmacIf_ConfigTable[0];

    IP4_ADDR(&gw, 192,168,0,254); //Set gateway
    IP4_ADDR(&ipaddr, ip[0],ip[1],ip[2],ip[3]); //Set ip
    IP4_ADDR(&sendtoipaddr, sendtoip[0],sendtoip[1],sendtoip[2],sendtoip[3]); //Set ip
    IP4_ADDR(&netmask,subnet[0],subnet[1],subnet[2],subnet[3]); //Set subnet msk


    default_netif = mem_malloc(sizeof(struct netif));

    default_netif = netif_add(default_netif, &ipaddr, &netmask, &gw, &XEmacIf_ConfigTable[0], xemacif_init, ip_input);
    netif_set_default(default_netif);

    ret = register_int_handler(XPAR_OPB_INTC_0_ETHERNET_MAC_IP2INTC_IRPT_INTR,
                         (XInterruptHandler)XEmac_IntrHandlerFifo,
                         xemacif_ptr->instance_ptr);

    enable_interrupt(XPAR_OPB_INTC_0_ETHERNET_MAC_IP2INTC_IRPT_INTR);

    udpstructreceive = udp_new();

    udp_bind(udpstructreceive,IP_ADDR_ANY,listenport);

    udp_connect(udpstructreceive,&sendtoipaddr,sendport);

    udp_recv(udpstructreceive, receiveUDP, NULL);

    while(1){
        ;//xemacif_input(default_netif);
    }

    return 0;
}

int main(){
    xilkernel_main();
}


Thanks very much!
Ye Wu
_______________________________________________
lwip-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/lwip-users



reply via email to

[Prev in Thread] Current Thread [Next in Thread]