/*
    testtimer.c, Copyright  (c) by Matthias Gries,
    Swiss Federal Institute of Technology,
    Computer Engineering and Networks Laboratory.
 
    TOPSY -- A Teachable Operating System.
             Implementation of a tiny and simple
             micro kernel for teaching purposes.
 
    For further information, please visit http://www.tik.ee.ethz.ch/~topsy
 
    This software is provided under the terms of the GNU General Public Licence.
 
    A full copy of the GNU GPL is provided in the file COPYING found in the 
    development root of Topsy.
*/
/*
	
	File:                  $Source: /home/ruf/cvs_Topsy/cvs/Topsy/User/testtimer.c,v $
 	Author(s):             Matthias Gries
 	Affiliation:           ETH Zuerich, TIK
 	Version:               $Revision: 2936 $
 	Creation Date:         
 	Last Date of Change:   $Date: 2007-03-21 15:23:42 +0100 (Mit, 21 Mär 2007) $      by: $Author: baderma $
	
	
*/

#include "testtimer.h"

void test_timer()
{
  ThreadId from, console, timerthread, dummy;
  Message timermsg, msg;
  char hello[] = "\n  Console Init\n";
  int size = 0, i = 0;

  if (IO_OPENOK != ioOpen(IO_CONSOLE, &console)) /* Open and initialise serial IO */
    return;
  else
    ioInit(console);
  size = stringLength(hello); /* Hello message */
  ioWrite(console, hello, (unsigned long int*) &size);

  if (tmGetInfo(SELF, &from, &dummy) != TM_INFOOK)
    display(console,"tmGetInfo failed\n");

  /* timermsg.from =      ;
  timermsg.id =        ;
  timermsg.msg.ioTimer.period = 1500; */ /* 1500 ms */
  /*CLEAR_MSGENV(timermsg);
  CLEAR_MSGENV(msg);*/

  /* if (IO_OPENOK != ioOpen(        ,           ))*/ /* Open and initialise timer1 */
  /*  {
      display(console, "unable to open timer1\n");
      return;
    }

  ioInit(                 );      

  for (i = 1; i < 10; i++)
    {
      if (tmMsgSend(           ,             ) == TM_MSGSENDFAILED) 
  display(console, "timermsg send fails in thread test_timer\n");
      else display(console,"timer set, waiting for an answer\n");
      
      from = ANY;
      tmMsgRecv(&from, ANYMSGTYPE, &msg, INFINITY);    
      
      if ((msg.from ==              ) && (msg.id ==                 ))  
  display(console, "count down finished\n");
      else display(console, "another msg\n");
    } */ /* for */

  /* ioClose(                  ); */
  ioClose(console);
}



