Porting lwIP to MPC5200

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

Porting lwIP to MPC5200

Amir Bukhari-2

I am working on porting lwIP to MPC5200 using uCII. I can write the port for
netif and sys_arch
But I can't find how the whole lwIP is initialized. For example what is the
sequence to do until application can send data across network.
Can someone give me a brief guide about this?

-Amir


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

RE: Porting lwIP to MPC5200

Amir Bukhari-2
I have got a good understanding of the code, it was cleanly writen and
simple to understands. I will begin porting and I will post any question
here.
For example if I want to use TCPIP i should do the following in:
 sys_init();
 mem_init();
 memp_init();
 pbuf_init();
 etharp_init();
 tcpip_init();
 someif = netif_add(&netif_0, &ip_this_addr, &ip_net_mask, &ip_gw_addr,
                   NULL, net_if_init,tcpip_input);
 netif_set_default(someif);

And then use API netconn_*
Is that correct?

-Amir

> lwip-users-bounces+christiaan.simons=[hidden email] wrote on
> lwip-users-bounces+18-10-2005
> 22:02:39:
>
> > But I can't find how the whole lwIP is initialized. For
> example what
> > is
> the
> > sequence to do until application can send data across network.
> > Can someone give me a brief guide about this?
>
> If you're going to use the 'raw api' this can be the init sequence:
>
> #ifdef STATS
> stats_init();
> #endif
> sys_init();
> mem_init();
> memp_init();
> pbuf_init();
> etharp_init();
> ip_init();
> udp_init();
> tcp_init();
> someif = netif_add(&netif_0, &ip_this_addr, &ip_net_mask, &ip_gw_addr,
>                   NULL, net_if_init, ip_input);
> netif_set_default(someif); som_pcb = udp_new();
>
> and call netif_set_up(someif);
>
> Note this also depends on how you're going to use or
> configure lwip (lwipopts.h).
> E.g. no TCP -> no TCP init etc.
>
> Also runtime IP configuration
> (manual IP / DHCP selection) plays a role here.
> Have a look at the contrib/ports to get an idea.
>
> Bye,
>
> Christiaan Simons
>
> Hardware / Software Engineer
> Axon Digital Design
>
> +31 (0)13 511 66 66
> +31 (0)13 511 41 51
>
> http://www.axon.tv
>
> This email and any files transmitted with it are confidential
> and intended solely for the use of the individual or entity
> to whom they are addressed.
> If you have received this email in error please notify the
> system manager.
> This message contains confidential information and is
> intended only for the individual named.  If you are not the
> named addressee you should not disseminate, distribute or
> copy this e-mail.
>
>
>
> _______________________________________________
> 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: Porting lwIP to MPC5200

Christiaan Simons

lwip-users-bounces+christiaan.simons=[hidden email] wrote on 20-10-2005
12:38:21:

> And then use API netconn_*
> Is that correct?

Almost, I'm unfamiliar with the netconn / socket API.

You may need to call an init function, setup a timer thread etc,
for this API as well.

Christiaan




This email and any files transmitted with it are confidential and intended
solely for the use of the individual or entity to whom they are addressed.
If you have received this email in error please notify the system manager.
This message contains confidential information and is intended only for the
individual named.  If you are not the named addressee you should not
disseminate, distribute or copy this e-mail.



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

RE: Porting lwIP to MPC5200

Amir Bukhari-2
In reply to this post by Amir Bukhari-2
 
I have some issue with getting FEC to work. I have configured SDMA
(Bestcomm) on MPC5200 to receive ethernet packet. I got the SDMA interrupt
for receiving but the buffer which should store the frame data is always
zero.
I can't find why this, does my FEC receive zero packet???
The packet -I receive- length is always 64 byte (icmp).

I will be thank if anyone has ported MPC5200 to lwip can help me getting
this.

Here is a part of the SDMA interrupt handler:

if (TaskIntStatus(rxTaskId) == rxTaskId ) // FEC TaskID
    {
        // get current BD
          TaskBD1_t *bd = (TaskBD1_t*) TaskGetBD(rxTaskId, rxBdPtr);
          /*
         * Clear the task interrupt.
         */
        TaskIntClear( rxTaskId );
               
          // multiple RX frames can be hidden after this interrupt
          while(!(bd->Status & (1<<SDMA_BD_BIT_READY)))
                {
                    sdma_callback_input((uint8 *)bd->DataPtr[0],
(uint16)(bd->Status & 0xFFFF));
                   
                        /*
             * Finished with the buffer descriptor.
             */
            rxBdPtr = TaskBDRelease( rxTaskId );
            /*
             * Assign a new, empty buffer to the RX ring.
             */
            TaskBDAssign( rxTaskId,
                rxBuff[rxBdPtr],
                NULL, RXBUFFLEN, 0);
            bd = (TaskBD1_t *)TaskGetBD( rxTaskId, rxBdPtr );
                       
                        rxPktCnt++;
                       
                }
               
    }

#########
Here also my configuration for FEC
/*.
    FEC Configuration
--------------------------------------------
    Physical Address: 00D09306C525
    Ethernet Interface: 18-wire 10/100 Mb/s mode
    RX Duplex Mode: Full Duplex (Receiver operates independently on Tx)
    TX Full Duplex mode (ignore Carrier Sense and Collision inputs): No
    Flow Control Enable (detect & process 'Pause' frames): No
    Perform Heartbeat check after each transmission: No
    Internal Loopback Mode: Disabled
    Maximum Frame Length: 1518
    Promiscuous mode (receive everything): Yes
    Reject Broadcast frames: No
    Heartbeat Error Interrupt: Enabled
    Babbling Receiver Interrupt: Enabled
    Babbling Transmitter Interrupt: Enabled
    Graceful Stop Interrupt: Enabled
    Transmit Frame Interrupt: Enabled
    MII Interrupt Enable: Disabled
    Late Collision Enable: Enabled
    Collision Retry Limit Interrupt: Enabled
    TX FIFO Underrun Interrupt: Enabled
    TX FIFO Error Interrupt: Enabled
    RX FIFO Error Interrupt: Enabled
.*/
#define FEC_ECNTRL_INIT                   0x00100001
#define FEC_X_CNTRL_INIT                  0x00000000
#define FEC_R_CNTRL_INIT                  0x05EE000C
#define FEC_IMASK_INIT                    0xF83E0000
#define FEC_PADDR1_INIT                   0x00D09306
#define FEC_PADDR2_INIT                   0xC5258808
#define FEC_MII_PHY_ADDR                  0x00
#define FEC_ECNTRL_INIT                   0x00100001
#define FEC_X_CNTRL_INIT                  0x00000000
#define FEC_R_CNTRL_INIT                  0x05EE0004
#define FEC_IMASK_INIT                    0xF83E0000
#define FEC_PADDR1_INIT                   0x00D09306
#define FEC_PADDR2_INIT                   0xC5258808
#define FEC_MII_PHY_ADDR                  0x00
#define FEC_MII_SPEED_INIT                0x0000001C
#define FEC_PHY_DO_SETUP                  1
#define FEC_PHY_CONTROL_INIT              0x3100
#define FEC_PHY_ANADV_INIT                0x0101
#define FEC_PHY_WAIT_AN_DONE              1
#define FEC_PHY_CUSTOMCTL0                0x00141422
#define FEC_MIB_DO_CLEAR                  128
#define FEC_XMIT_FSM_INIT                 0x03000000

/*.
    FEC Configuration
--------------------------------------------
    TX FIFO Watermark Level: 256 bytes
    TX FIFO Granularity    : Full - 28 bytes
    TX FIFO Alarm Level    : 0
    RX FIFO Granularity    : FIFO Empty
    RX FIFO Alarm Level    : 800
.*/
#define FEC_X_WMRK_INIT                   0x00000003
#define FEC_RFIFO_CNTRL_INIT              0x00000000
#define FEC_RFIF0_ALARM_INIT              0x00000320
#define FEC_TFIFO_CNTRL_INIT              0x0F000000

-Amir
_______________________________________________
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