CS452 - Real-Time Programming - Spring 2008

Lecture 20 - AwaitEvent


Questions & Comment

  1. 16550 UART

AwaitEvent

Low-level primitive

int AwaitEvent( int EventType );

Implementation notes

  1. Event may already have occurred
  2. What does AwaitEvent( ) return?
  3. AwaitEvent( ) can service the device.
  4. Need to think of priorities when you partition the work

What do we do when there is no task ready to be scheduled?

  1. Kernel has interrupts turned off
  2. What does IdleTask( ) do?
    void IdleTask( ) {
      FOREVER ;
    }
        

    But in reality it could do anything


Clock Server

Hardware

Intel decided exactly how you should use the timers when they designed the south bridge.

Interrupt controller we already discussed.

General description of clock and PIC included in 82801 documentation.

Software

What is the structure of the service regime?

Who should initialize timer?

Server

void ClockServer( ) {
  Tid requester;
  RegisterAs( "ClockServer" );
  notifier = Create( ... );
  if( notifier < 0 ) 
    // handle error
  FOREVER {
    length = Receive( *requester, request, requestlen );
    if ( length < 0 )
      // handle error
    else if (!( type = decode( request ) ) )
     // handle error
    else {
      switch( type ) {
      case TICK:
        time++;
        // service queues
        break;
      case XXX:
        // et cetera
    }
  }
}

Notifier

void TickNotifier( ) {
  server = WhoIs( "clockserver" );
  if ( server < 0 )
    //handle error
  FOREVER {
    error = AwaitInterrupt( TIMER );
    if ( error < 0 )
      //handle error
    error = Send( server, nullmessage );
    if ( error < 0 )
      //handle error
  }
}

All the error handling code should be telling you something. What?


Serial Server

Policy issues

  1. One or two servers?
  2. How should screen echo be handled?
  3. How should the buffers in the UART be handled?
  4. Who will initialize the hardware?
  5. What traffic do I expect through the server?
  6. Should the be I/O units above the single character level?

As a general policy we would like to concentrate the hardware dependence

Hardware

Stubs

Software


Return to: