3 This file is part of the AVR-Crypto-Lib.
4 Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
6 This program is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
29 #define TIMER0_BASE 0x40030000
30 #define TIMER1_BASE 0x40031000
31 #define TIMER2_BASE 0x40032000
32 #define TIMER3_BASE 0x40033000
34 #define GPTM_CFG_OFFSET 0x000
35 #define GPTM_TAMR_OFFSET 0x004
36 #define GPTM_TBMR_OFFSET 0x008
37 #define GPTM_CTL_OFFSET 0x00C
38 #define GPTM_IMR_OFFSET 0x018
39 #define GPTM_RIS_OFFSET 0x01C
40 #define GPTM_MIS_OFFSET 0x020
41 #define GPTM_ICR_OFFSET 0x024
42 #define GPTM_TAILR_OFFSET 0x028
43 #define GPTM_TBILR_OFFSET 0x02C
44 #define GPTM_TAMATCHR_OFFSET 0x030
45 #define GPTM_TBMATCHR_OFFSET 0x034
46 #define GPTM_TAPR_OFFSET 0x038
47 #define GPTM_TBPR_OFFSET 0x03C
48 #define GPTM_TAR_OFFSET 0x048
49 #define GPTM_TBR_OFFSET 0x04C
50 #define GPTM_TAV_OFFSET 0x050
51 #define GPTM_TBV_OFFSET 0x054
54 #define GPTM_TASTALL 1
55 #define GPTM_TAEVENT 2
60 #define GPTM_TBSTALL 9
61 #define GPTM_TBEVENT 10
63 #define GPTM_TBPWML 14
65 #define GPTM_MODE_ONESHOT 1
66 #define GPTM_MODE_PERIODIC 2
67 #define GPTM_MODE_CAPTURE 3
71 uint32_t gptm_read_timer(uint8_t timerno, uint8_t b);
72 void gptm_write_timer(uint8_t timerno, uint8_t b, uint32_t value);
73 void gptm_start_timer(uint8_t timerno, uint8_t b);
74 void gptm_stop_timer(uint8_t timerno, uint8_t b);
75 void gptm_set_timer_prescaler(uint8_t timerno, uint8_t b, uint8_t prescaler);
76 void gptm_set_timer_loadvalue(uint8_t timerno, uint8_t b, uint32_t value);
77 void gptm_set_timer_mode(uint8_t timerno, uint8_t b, uint8_t mode);
78 uint8_t gptm_get_timer_running(uint8_t timerno, uint8_t b);
79 void gptm_set_timer_32periodic(uint8_t timerno);
83 #endif /* HW_GPT_H_ */