00001 /****************************************************************************** 00002 ** Copyright (C) 2007 Pablo Garcia 00003 ** 00004 ** This library is free software; you can redistribute it and/or 00005 ** modify it under the terms of the GNU Lesser General Public 00006 ** License as published by the Free Software Foundation; either 00007 ** version 2.1 of the License, or (at your option) any later version. 00008 00009 ** This library is distributed in the hope that it will be useful, 00010 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 ** Lesser General Public License for more details. 00013 00014 ** You should have received a copy of the GNU Lesser General Public 00015 ** License along with this library; if not, write to the Free Software 00016 ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00017 ******************************************************************************/ 00018 00029 //----------------------------------------------------------------------------- 00030 // Define 00031 //----------------------------------------------------------------------------- 00032 00033 #ifndef CPUTIMERS_H 00034 #define CPUTIMERS_H 00035 00036 //----------------------------------------------------------------------------- 00037 // Includes 00038 //----------------------------------------------------------------------------- 00039 #include "TIMotorLIB.h" 00040 #include GENERATE_FLEX_INC(Device.h) 00041 00042 //----------------------------------------------------------------------------- 00043 // typedefs 00044 // ---------------------------------------------------------------------------- 00046 typedef enum { 00047 CPUTIMER0, 00048 CPUTIMER1, 00049 CPUTIMER2 00050 } CPUTIMERSEnum; 00051 00052 00053 //----------------------------------------------------------------------------- 00054 // variables 00055 // ---------------------------------------------------------------------------- 00056 00059 struct CPUTIMER_VARSIQ { 00060 volatile struct CPUTIMER_REGS *RegsAddr; 00061 Uint16 CPUFreqInMHz; 00062 Uint32 PeriodInUSec; 00063 }; 00064 00065 00066 extern struct CPUTIMER_VARSIQ TIMLCpuTimer0; 00067 // CpuTimer 1 and CpuTimer2 are reserved for DSP BIOS & other RTOS. Comment out CpuTimer1 and CpuTimer2 if using DSP BIOS or other RTOS 00068 extern struct CPUTIMER_VARSIQ TIMLCpuTimer1; 00069 extern struct CPUTIMER_VARSIQ TIMLCpuTimer2; 00070 00071 //----------------------------------------------------------------------------- 00072 // Implemented Functions 00073 //----------------------------------------------------------------------------- 00074 00075 //----------------------------------------------------------------------------- 00078 //----------------------------------------------------------------------------- 00079 void InitCpuTimers(void); 00080 00081 //----------------------------------------------------------------------------- 00084 //----------------------------------------------------------------------------- 00085 void InitCpuTimer(CPUTIMERSEnum cpuTimer); 00086 00087 //----------------------------------------------------------------------------- 00092 //----------------------------------------------------------------------------- 00093 void ConfigureCpuTimer(CPUTIMERSEnum cpuTimer, Uint32 Period, void(*interruptFCN)(void)); 00094 00095 00096 //----------------------------------------------------------------------------- 00099 //----------------------------------------------------------------------------- 00100 static inline void Timer0PIEAck(void); 00101 00102 00103 //----------------------------------------------------------------------------- 00104 // Inline function implementation 00105 //----------------------------------------------------------------------------- 00106 static inline void Timer0PIEAck(void) 00107 { 00108 PieCtrlRegs.PIEACK.all |= PIEACK_GROUP1; 00109 } 00110 00111 //----------------------------------------------------------------------------- 00112 00113 #endif 00114 00115 00116 //----------------------------------------------------------------------------- 00117 // End Of File 00118 //----------------------------------------------------------------------------- 00119