summaryrefslogtreecommitdiff
path: root/timer.h
blob: 2b99de6e8cee7b6a85e62473b3b6ff3f3ae11ba2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
 * Copyright (C) 2010 Tobias Klauser <tklauser@distanz.ch>
 * Copyright (C) 2010 chysun2000@gmail.com
 *
 * This file is part of nios2sim-ng.
 *
 * This file is subject to the terms and conditions of the GNU General Public
 * License. See the file "COPYING" in the main directory of this archive
 * for more details.
 */

#ifndef _TIMER_H_
#define _TIMER_H_

#include "device.h"

#define TIMER_BASE	0x84842000
#define TIMER_SIZE	48
#define TIMER_IRQ	IRQ_TIMER
#define TIMER_REG_COUNT	(TIMER_SIZE / sizeof(uint32_t))

#define TIMER_STATUS_REG	0
#define TIMER_CTRL_REG		1
#define TIMER_PERIODL_REG	2
#define TIMER_PERIODH_REG	3
#define TIMER_SNAPL_REG		4
#define TIMER_SNAPH_REG		5

#define TIMER_STATUS_TO_MASK	0x01
#define TIMER_STATUS_RUN_MASK	0x02

#define TIMER_CTRL_ITO_MASK	0x01
#define TIMER_CTRL_CONT_MASK	0x02
#define TIMER_CTRL_START_MASK	0x04
#define TIMER_CTRL_STOP_MASK	0x08

extern struct device timer_core;

#endif /* _TIMER_H_ */