lwip-users
[Top][All Lists]
Advanced

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

Re: Re: [lwip-users] problem in using raw api for avr32uc3ax application


From: Marek Matej
Subject: Re: Re: [lwip-users] problem in using raw api for avr32uc3ax application
Date: Wed, 3 Sep 2008 11:15:48 +0200

IMHO do not follow example from FreeRTOS but rather one from ../src/netif/ethernetif.c
It is much more simple to understand and for modification.
Your mention about OS functions also leads me to draw Your attention on
files lwipopts.h and sys_arch.c, sys_arch.h
where you have to modify settings for your environment - cpu, compiler, etc.
If you are not using OS you should set NO_SYS to 1. If you do not have file lwipopts.h try to
create copy based on some example included in lwip package. Just remember it is used to
complete and/or redefine default settings from opt.h file.
There is one more setting from lwipopt.h (opt.h), which seems to me to be most trickiest thing in
process of connecting network driver with stack. It is ETH_PAD_SIZE which describe padding of bytes
transfered to and from network controller hardware. This define is also used in some important
structures definition, so pay attention on it!

Marek

2008/9/3 jini-2003 <address@hidden>:
> Thx for your reply!I think I understand what you say generally.
> There are several functions in ethernetif.c based FREERTOS(ethernetif.c come
> from an example project) as follows:
> static void low_level_init(struct netif *netif)
> {
> //  struct ethernetif *ethernetif = netif->state;
>   unsigned portBASE_TYPE uxPriority;
>   /* maximum transfer unit */
>   netif->mtu = netifMTU;
>  
>   /* broadcast capability */
>   netif->flags = NETIF_FLAG_BROADCAST;
>  
>   /* Do whatever else is needed to initialize interface. */ 
>   xNetIf = netif;
>   /* Initialise the MACB.  This routine contains code that polls status
> bits.
>   If the Ethernet cable is not plugged in then this can take a considerable
>   time.  To prevent this starving lower priority tasks of processing time we
>   lower our priority prior to the call, then raise it back again once the
>   initialisation is complete. */
>   uxPriority = uxTaskPriorityGet( NULL );
>   vTaskPrioritySet( NULL, tskIDLE_PRIORITY );
>   while( xMACBInit(&AVR32_MACB) == FALSE )
>   {
>     __asm__ __volatile__ ( "nop" );
>   }
>   vTaskPrioritySet( NULL, uxPriority );
>   /* Create the task that handles the MACB. */
>   // xTaskCreate( ethernetif_input, ( signed portCHAR * ) "ETH_INT",
> netifINTERFACE_TASK_STACK_SIZE, NULL, netifINTERFACE_TASK_PRIORITY, NULL );
>   sys_thread_new( ethernetif_input, NULL, netifINTERFACE_TASK_PRIORITY );
> }
>  
> as you see,there are uxTaskPriorityGet,sys_thread_new and so on in this
> function and I really do not know how to deal it if an os not used.
> The similar problem also exist in other functions.
>  
>
> 在2008-09-03,"Marek Matej" <address@hidden> 写道:
>>Hi Jini,
>>I am working on project with lwip 1.3.0 and system with no OS layer.
>>Therefore RAW API is ised.
>>In ethernetif.c, I have implemented :
>>--ethernetif_init(); which is used for init any of netif
>>--mac_init(); which is intended for initiating network hardware
>>--mac_input(); for reading received packets from network controller
>>--mac_output(); gues for what :)
>>--ethernetif_handlepackets(); running in main loop
>>As I understand, implementation of ethernetif.c is user specific and
>>there is only recommendation how to put it together with Your hardware
>>driver. In my case, is like this:
>>Adding netif using function netif_add() needs to pass in argument
>>function for initiating any network interface (ethernetif_init() ) and
>>function intended to start processing any informing data (ip_input()
>>in my case)
>>Next, ethernetif_handlepackets(struct netif*) is reading packets from
>>net. hw. and putting it to process function of IP stack. Thats nearly
>>all from lower side.
>>The higher side of implementation, is using c++ objects to emulate
>>sockets, with using only  RAW API. (due to no OS layer).
>>
>>I try to explain how I deal with ethernetif.c, but I believe there is
>>more even sophisticated way to attach network driver with stack.
>>
>>Mark
>>
>>
>>2008/9/3 jini-2003
>
> ________________________________
> 200万入主万科中粮紫苑155平米8重空间大宅 周周送好礼
> _______________________________________________
> 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]