The friendly Operating System for the Internet of Things
cc2538_gptimer.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014 Loci Controls Inc.
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
20 #ifndef GPTIMER_H
21 #define GPTIMER_H
22 
23 #include <stdint.h>
24 
25 #include "cc2538.h"
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 #define GPTIMER_NUMOF 4
32 #define NUM_CHANNELS_PER_GPTIMER 2
34 enum {
38 };
39 
40 enum {
44 };
45 
49 typedef struct {
55  union {
57  struct {
58  cc2538_reg_t TAMR2 : 2;
59  cc2538_reg_t TACMR : 1;
60  cc2538_reg_t TAAMS : 1;
61  cc2538_reg_t TACDIR : 1;
62  cc2538_reg_t TAMIE : 1;
63  cc2538_reg_t TAWOT : 1;
64  cc2538_reg_t TASNAPS : 1;
65  cc2538_reg_t TAILD : 1;
66  cc2538_reg_t TAPWMIE : 1;
67  cc2538_reg_t TAMRSU : 1;
68  cc2538_reg_t TAPLO : 1;
69  cc2538_reg_t RESERVED5 : 20;
70  } TAMRbits;
71  } cc2538_gptimer_tamr;
72 
76  union {
78  struct {
79  cc2538_reg_t TBMR2 : 2;
80  cc2538_reg_t TBCMR : 1;
81  cc2538_reg_t TBAMS : 1;
82  cc2538_reg_t TBCDIR : 1;
83  cc2538_reg_t TBMIE : 1;
84  cc2538_reg_t TBWOT : 1;
85  cc2538_reg_t TBSNAPS : 1;
86  cc2538_reg_t TBILD : 1;
87  cc2538_reg_t TBPWMIE : 1;
88  cc2538_reg_t TBMRSU : 1;
89  cc2538_reg_t TBPLO : 1;
90  cc2538_reg_t RESERVED6 : 20;
91  } TBMRbits;
92  } cc2538_gptimer_tbmr;
93 
97  union {
99  struct {
100  cc2538_reg_t TAEN : 1;
101  cc2538_reg_t TASTALL : 1;
102  cc2538_reg_t TAEVENT : 1;
103  cc2538_reg_t RESERVED1 : 1;
104  cc2538_reg_t TAOTE : 1;
105  cc2538_reg_t TAPWML : 1;
106  cc2538_reg_t RESERVED2 : 1;
107  cc2538_reg_t TBEN : 1;
108  cc2538_reg_t TBSTALL : 1;
109  cc2538_reg_t TBEVENT : 1;
110  cc2538_reg_t RESERVED3 : 1;
111  cc2538_reg_t TBOTE : 1;
112  cc2538_reg_t TBPWML : 1;
113  cc2538_reg_t RESERVED4 : 17;
114  } CTLbits;
115  } cc2538_gptimer_ctl;
116 
118  cc2538_reg_t RESERVED2;
123  union {
125  struct {
126  cc2538_reg_t TATOIM : 1;
127  cc2538_reg_t CAMIM : 1;
128  cc2538_reg_t CAEIM : 1;
129  cc2538_reg_t RESERVED1 : 1;
130  cc2538_reg_t TAMIM : 1;
131  cc2538_reg_t RESERVED2 : 3;
132  cc2538_reg_t TBTOIM : 1;
133  cc2538_reg_t CBMIM : 1;
134  cc2538_reg_t CBEIM : 1;
135  cc2538_reg_t TBMIM : 1;
136  cc2538_reg_t RESERVED3 : 20;
137  } IMRbits;
138  } cc2538_gptimer_imr;
139 
155  cc2538_reg_t RESERVED3;
160  cc2538_reg_t RESERVED[981];
162  cc2538_reg_t RESERVED4[15];
164 
165 #define GPTIMER0 ( (cc2538_gptimer_t*)0x40030000 )
166 #define GPTIMER1 ( (cc2538_gptimer_t*)0x40031000 )
167 #define GPTIMER2 ( (cc2538_gptimer_t*)0x40032000 )
168 #define GPTIMER3 ( (cc2538_gptimer_t*)0x40033000 )
170 void isr_timer0_chan0(void);
171 void isr_timer0_chan1(void);
172 void isr_timer1_chan0(void);
173 void isr_timer1_chan1(void);
174 void isr_timer2_chan0(void);
175 void isr_timer2_chan1(void);
176 void isr_timer3_chan0(void);
177 void isr_timer3_chan1(void);
179 #ifdef __cplusplus
180 } /* end extern "C" */
181 #endif
182 
183 #endif /* GPTIMER_H */
184 
185 /* @} */
GPTIMER component registers.
cc2538_reg_t TAPS
GPTIMER Timer A Prescale Snapshot.
cc2538_reg_t TBPV
GPTIMER Timer B Prescale Value.
GPTIMER capture mode.
cc2538_reg_t TAV
GPTIMER Timer A Value.
cc2538_reg_t TAILR
GPTIMER Timer A Interval Load.
cc2538_reg_t TBR
GPTIMER Timer B.
CC2538 MCU interrupt and register definitions.
cc2538_reg_t IMR
GPTIMER Interrupt Mask.
cc2538_reg_t PP
GPTIMER Peripheral Properties.
32-bit real-time clock
cc2538_reg_t TAPV
GPTIMER Timer A Prescale Value.
cc2538_reg_t TAMR
GPTIMER Timer A mode.
cc2538_reg_t TBV
GPTIMER Timer B Value.
cc2538_reg_t TAMATCHR
GPTIMER Timer A Match.
cc2538_reg_t CFG
GPTIMER Configuration.
cc2538_reg_t TBMATCHR
GPTIMER Timer B Match.
cc2538_reg_t ICR
GPTIMER Interrupt Clear.
16-bit timer configuration
32-bit timer configuration
cc2538_reg_t TBPMR
GPTIMER Timer B Prescale Match Register.
cc2538_reg_t MIS
GPTIMER Masked Interrupt Status.
cc2538_reg_t TAPR
GPTIMER Timer A Prescale Register.
cc2538_reg_t TAR
GPTIMER Timer A.
cc2538_reg_t RIS
GPTIMER Raw Interrupt Status.
cc2538_reg_t CTL
GPTIMER Control.
GPTIMER one-shot mode.
cc2538_reg_t TBPR
GPTIMER Timer B Prescale Register.
volatile uint32_t cc2538_reg_t
Least-significant 32 bits of the IEEE address.
Definition: cc2538.h:124
cc2538_reg_t TAPMR
GPTIMER Timer A Prescale Match Register.
GPTIMER periodic mode.
cc2538_reg_t TBMR
GPTIMER Timer B mode.
cc2538_reg_t SYNC
GPTIMER Synchronize.
cc2538_reg_t TBILR
GPTIMER Timer B Interval Load.
cc2538_reg_t TBPS
GPTIMER Timer B Prescale Snapshot.