lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] OS-less Active Web Server with RAW API.


From: Larry Piggins
Subject: Re: [lwip-users] OS-less Active Web Server with RAW API.
Date: Thu, 8 Jul 2004 11:35:39 -0700 (PDT)

Hello,

This is a standard problem in embedded systems when
you try to do multiple tasks simultaneously in a
single thread of execution.

What you need to do is break your long task into a
state machine - do part of the work, return to call
tcp_fasttmr, do the next part of the work, etc.

(simplified) example:

typedef enum { STATE1, STATE2, STATE3 } state;
void init() { state = STATE1; }
void task() {
   switch (state) {
      case STATE1: 
        /*do some work*/ 
        state = STATE2; 
        break;
      case STATE2: 
        /*do some work*/ 
        state = STATE3; 
        break;
      case STATE3: 
        /*do some work*/ 
        state = STATE1; 
        break;
   }
}
void main() {
   init();
   while (1) {
      task();
      tcp_tmr(); /*called 3 times as often*/
   }
}

I'm running LWIP in this manner in a product that
executes a lot (and I mean a lot) of other tasks, all
in one thread.

HTH
Larry

--- Welson Sun <address@hidden> wrote:
> Hi,
>  
> I am trying to use lwip's raw API to implement an
> active webserver on a
> Xilinx Virtex II Pro chip (which has PowerPC
> embedded). The webserver serves
> as a GUI and the user can select test items with a
> web browser. After the
> webserver gets the test request, it parses the URL
> and do the requested
> tests and sends the test result back as webpages.
>  
> My current question is: without an OS, the whole
> program is a single
> process. If the test takes some time, how can I call
> the tcp_fasttmr() and
> tcp_slowtmr() according to the requirements?
> 
> 
> 
> _______________________________________________
> lwip-users mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/lwip-users
> 



                
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail 




reply via email to

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