]> git.cryptolib.org Git - arm-crypto-lib.git/blob - test_src/hw_gptm.h
switching to dedicated endian switching function
[arm-crypto-lib.git] / test_src / hw_gptm.h
1 /* hw_gpt.h */
2 /*
3     This file is part of the ARM-Crypto-Lib.
4     Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
5
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.
10
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.
15
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/>.
18 */
19
20 #ifndef HW_GPT_H_
21 #define HW_GPT_H_
22
23 #define TIMER0 0
24 #define TIMER1 1
25 #define TIMER2 2
26 #define TIMER3 3
27
28
29 #define TIMER0_BASE 0x40030000
30 #define TIMER1_BASE 0x40031000
31 #define TIMER2_BASE 0x40032000
32 #define TIMER3_BASE 0x40033000
33
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
52
53 #define GPTM_TAEN       0
54 #define GPTM_TASTALL    1
55 #define GPTM_TAEVENT    2
56 #define GPTM_RTCEN      4
57 #define GPTM_TAOTE      5
58 #define GPTM_TAPWML     6
59 #define GPTM_TBEN       8
60 #define GPTM_TBSTALL    9
61 #define GPTM_TBEVENT   10
62 #define GPTM_TBOTE     13
63 #define GPTM_TBPWML    14
64
65 #define GPTM_MODE_ONESHOT  1
66 #define GPTM_MODE_PERIODIC 2
67 #define GPTM_MODE_CAPTURE  3
68
69
70
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);
80
81
82
83 #endif /* HW_GPT_H_ */