00001 /*! \file timer.h \brief Timer Support Library for AT91SAM7S. */ 00002 //***************************************************************************** 00003 // 00004 // File Name : 'timer.h' 00005 // Title : Timer Support Library for AT91SAM7S 00006 // Author : Pascal Stang - Copyright (C) 2005-2006 00007 // Created : 2005.05.26 00008 // Revised : 2006.07.27 00009 // Version : 0.1 00010 // Target MCU : Atmel ARM AT91SAM7S Series 00011 // Editor Tabs : 4 00012 // 00013 // NOTE: This code is currently below version 1.0, and therefore is considered 00014 // to be lacking in some functionality or documentation, or may not be fully 00015 // tested. Nonetheless, you can expect most functions to work. 00016 // 00017 /// \ingroup driver_arm_at91 00018 /// \defgroup timer_at91 Timer Support Library for AT91SAM7S (armlib/arch/at91/timer.c) 00019 /// \code #include "timer.h" \endcode 00020 /// \par Overview 00021 /// To be written... 00022 // 00023 // This code is distributed under the GNU Public License 00024 // which can be found at http://www.gnu.org/licenses/gpl.txt 00025 // 00026 //***************************************************************************** 00027 //@{ 00028 00029 #ifndef ARMLIB_TIMER_H 00030 #define ARMLIB_TIMER_H 00031 00032 #include "global.h" 00033 00034 // timer interrupt handler indexes 00035 #define TIMER_PITOVERFLOW_INT 0 00036 #define TIMER_NUM_INTERRUPTS 1 00037 00038 // short-duration delay loop 00039 // (traditionally included in the timer library) 00040 void delay_us(unsigned long t); 00041 00042 // initialize timers in general 00043 // sets default pit rate to 1000Hz 00044 void timerInit(void); 00045 00046 // initialize PIT timer (specify overflow 'rate' in Hz) 00047 void timerInitPit(int rate); 00048 00049 // Attach a user function to a timer interrupt 00050 void timerAttach(u08 interruptNum, void (*userFunc)(void) ); 00051 00052 // timerPause busy-waits for the specified number of milliseconds 00053 // (if PIT rate is modified from default of 1000Hz, units of 'pause' will be PIT intervals) 00054 void timerPause(int pause); 00055 00056 00057 // interrupt handlers for timers 00058 00059 // interrupt handler for pit 00060 void timerServicePit(void); 00061 00062 00063 #endif 00064 //@} 00065 00066