From f2022a264125bdf3b18e5fe0fe0c2e523cf41ded Mon Sep 17 00:00:00 2001 From: gdisirio Date: Tue, 20 May 2008 14:24:51 +0000 Subject: git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@302 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- demos/ARM7-AT91SAM7X-WEB-GCC/web/webthread.c | 65 ++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 demos/ARM7-AT91SAM7X-WEB-GCC/web/webthread.c (limited to 'demos/ARM7-AT91SAM7X-WEB-GCC/web/webthread.c') diff --git a/demos/ARM7-AT91SAM7X-WEB-GCC/web/webthread.c b/demos/ARM7-AT91SAM7X-WEB-GCC/web/webthread.c new file mode 100644 index 000000000..a4fb3de03 --- /dev/null +++ b/demos/ARM7-AT91SAM7X-WEB-GCC/web/webthread.c @@ -0,0 +1,65 @@ +/* + ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio. + + This file is part of ChibiOS/RT. + + ChibiOS/RT is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/RT is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include +#include +#include + +#include +#include +#include +#include +#include + +static EvTimer evt; +struct EventListener el0, el1, el2; + +void clock_init(void) {} + +clock_time_t clock_time( void ) +{ + return chSysGetTime(); +} + +/* + * Executed as event handler at 1000mS intervals. + */ +static void TimerHandler(eventid_t id) { + + (void)EMACGetLinkStatus(); +} + +msg_t WebThread(void *p) { + static const evhandler_t evhndl[] = { + TimerHandler, + NULL, + NULL + }; + + evtInit(&evt, 1000); /* Initializes an event timer object. */ + evtStart(&evt); /* Starts the event timer. */ + chEvtRegister(&evt.et_es, &el0, 0); /* Registers on the timer event source. */ + chEvtRegister(&EMACFrameTransmitted, &el1, 1); + chEvtRegister(&EMACFrameReceived, &el2, 2); + + while (TRUE) { + chEvtWait(ALL_EVENTS, evhndl); + } + return 0; +} -- cgit v1.2.3