1 /*
2  * (C) Copyright 2007 Michal Simek
3  *
4  * Michal  SIMEK <monstr@monstr.cz>
5  *
6  * See file CREDITS for list of people who contributed to this
7  * project.
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License as
11  * published by the Free Software Foundation; either version 2 of
12  * the License, or (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
22  * MA 02111-1307 USA
23  */
24 
25 #define TIMER_ENABLE_ALL    0x400 /* ENALL */
26 #define TIMER_PWM           0x200 /* PWMA0 */
27 #define TIMER_INTERRUPT     0x100 /* T0INT */
28 #define TIMER_ENABLE        0x080 /* ENT0 */
29 #define TIMER_ENABLE_INTR   0x040 /* ENIT0 */
30 #define TIMER_RESET         0x020 /* LOAD0 */
31 #define TIMER_RELOAD        0x010 /* ARHT0 */
32 #define TIMER_EXT_CAPTURE   0x008 /* CAPT0 */
33 #define TIMER_EXT_COMPARE   0x004 /* GENT0 */
34 #define TIMER_DOWN_COUNT    0x002 /* UDT0 */
35 #define TIMER_CAPTURE_MODE  0x001 /* MDT0 */
36 
37 typedef volatile struct microblaze_timer_t {
38 	int control; /* control/statuc register TCSR */
39 	int loadreg; /* load register TLR */
40 	int counter; /* timer/counter register */
41 } microblaze_timer_t;
42 
43 int timer_init(void);
44 
45