/* 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: /usr/drwho/vault/cvs/topsy/Topsy/User/testtimer.c,v $ Author(s): Matthias Gries Affiliation: ETH Zuerich, TIK Version: $Revision: 1.5 $ Creation Date: Last Date of Change: $Date: 1999/12/13 21:48:44 $ by: $Author: ruf $ */ #include "testtimer.h" void test_timer() { ThreadId from, console, timerthread, dummy; Message timermsg, msg; char hello[] = "\n Console Init\n"; int size, i; 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 */ /* 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); }