IM06: SerivceLoop() Issues - My action item

From: Stickley, John <john_stickley@mentorg.com>
Date: Fri Aug 20 2004 - 15:50:10 PDT

ITC Team,

One of my actions was to resolve IM06 - particularly with regard
to Per's e-mail of 6-23-04 "IM06: ServiceLoop() Issues".

At our last meeting I was asked to clarify the revised wording
with pseudo code to more clearly describe ambiguities in the
last proposal for revised wording.

In this e-mail, I'm reiterating the revised wording last
proposed by Per in that e-mail, but slightly modifying it and
augmenting it with a small block of pseudo code that clearly
should spell out operation of the ::ServiceLoop() function.

--- Proposed revised text for section 5.4.3.6 of SceMi revision 1.0.4 ---

   This is the main workhorse method ...

   The return argument is the number of service requests that arrived
   from the HDL side and were processed since the last call to ::ServiceLoop().

   The ::ServiceLoop() first checks for any pending input messages to be sent
   and sends them.

   g()
   If g is NULL, ::ServiceLoop() checks for pending service requests
   and dispatches them, returning immediately afterwards.

   If g() is non-NULL, ::ServiceLoop() enters a loop of checking for
   pending service requests, dispatching them, and calling g()
   for each service request.

   A service request is defined to be one of the following:

     o An arriving message in a SCE-MI message output port that will
       result in a receive callback being called.
     o An input ready notification that will result in an input ready
       callback being called.

   When g() returns 0, control returns from the loop. When g() is called,
   it is passed a pending flag of 1 or 0 indicating whether or not there
   is at least one service request pending.

   context
   The context argument to ::ServiceLoop is passed as the context argument
   to g().

   The following pseudo code illustrates implementation of the ::ServiceLoop()
   according to the semantics described above:

     int SceMi::ServiceLoop(
         SceMiServiceLoopHandler g, void* context, SceMiEC* ec)
     {
         bool exit_service_loop = false;
         int service_request_count = 0;

         while( input messages pending )
             Send them to HDL side.

         while( exit_service_loop == false ) {

             if( input ready notifications pending ){

                 Dispatch input ready callback;
                 service_request_count++;

                 if( g != NULL && g(context, 1) == 0 )
                     exit_service_loop = true;
             }
             else if( output messages pending ){

                 Dispatch message to appropriate receive callback.
                 service_request_count++;

                 if (g != NULL && !g(context, 1))
                     exit_service_loop = true;
             }

             // if( g is not specified ) We kick out of the loop.
             // else we stay in as long as g returns non-zero.
             else if (g == NULL || g(context, 0) == 0)
                 exit_service_loop = true;
         }
         return service_request_count;
     }

---<end of proposed revised text for section 5.4.3.6>---

-- johnS

______________________________/\/ \ \
John Stickley \ \ \
Principal Engineer \ \________________
Mentor Graphics - MED \_
17 E. Cedar Place \ john_stickley@mentor.com
Ramsey, NJ 07446 \ Phone: (201) 818-2585
________________________________________________________________
Received on Fri Aug 20 15:54:11 2004

This archive was generated by hypermail 2.1.8 : Fri Aug 20 2004 - 15:54:12 PDT