base/include/asm-arm/arch-ep9301/rtai_timer.h

Go to the documentation of this file.
00001 /*
00002  * ARM/EP9301 specific timer related stuff
00003  *
00004  * Copyright (c) 2004-2005 Michael Neuhauser, Firmix Software GmbH (mike@firmix.at)
00005  *
00006  * Acknowledgements:
00007  *  Paolo Mantegazza <mantegazza@aero.polimi.it>, creator of RTAI 
00008  *
00009  *
00010  * This program is free software; you can redistribute it and/or modify it under
00011  * the terms of the GNU General Public License as published by the Free Software
00012  * Foundation, Inc., 675 Mass Ave, Cambridge MA 02139, USA; either version 2 of
00013  * the License, or (at your option) any later version.
00014  *
00015  * This program is distributed in the hope that it will be useful, but WITHOUT
00016  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00017  * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
00018  * details.
00019  *
00020  * You should have received a copy of the GNU General Public License along with
00021  * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
00022  * Place, Suite 330, Boston, MA  02111-1307  USA
00023  */
00024 #ifndef _ASM_ARCH_RTAI_TIMER_H_
00025 #define _ASM_ARCH_RTAI_TIMER_H_
00026 
00027 #include <asm/hardware.h>
00028 #include <asm/io.h>
00029 #include <asm/arch/ep93xx_tsc.h>
00030 
00031 /* acknowledge & unmask timer interrupt */
00032 extern inline int
00033 rtai_timer_irq_ack(void)
00034 {
00035     rt_unmask_irq(RTAI_TIMER_IRQ);
00036     /* *TODO* when return -1? (return < 0 => abort rt_timer_handler() for this interrupt) */
00037     return 0;
00038 }
00039 
00040 /* read time-stamp-counter */
00041 #define rtai_rdtsc()        ep93xx_rdtsc()
00042 
00043 /* set irq-timer's delay */
00044 extern inline void
00045 rt_set_timer_delay(unsigned int delay)
00046 {
00047     ADEOS_PARANOIA_ASSERT(adeos_hw_irqs_disabled());
00048     if (delay) {
00049     /*
00050      * one-shot mode: reprogramm timer
00051      */
00052     outl(0, TIMER1CONTROL);     /* stop timer */
00053     outl(delay - 1, TIMER1LOAD);    /* set load value */
00054     outl(0x88, TIMER1CONTROL);  /* set 508 kHz clock, free running mode & enable timer */
00055     } else {
00056     /*
00057      * periodic mode: nothing to do as the timer reloads itself
00058      * with the value set in rt_request_timer()
00059      */
00060     }
00061 }
00062 
00063 #endif /* _ASM_ARCH_RTAI_TIMER_H_ */

Generated on Tue Feb 2 17:46:04 2010 for RTAI API by  doxygen 1.4.7