Contiki 3.x
rtimer-arch.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012, Texas Instruments Incorporated - http://www.ti.com/
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  *
14  * 3. Neither the name of the copyright holder nor the names of its
15  * contributors may be used to endorse or promote products derived
16  * from this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
23  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
27  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
29  * OF THE POSSIBILITY OF SUCH DAMAGE.
30  */
31 /**
32  * \addtogroup cc2538
33  * @{
34  *
35  * \defgroup cc2538-rtimer cc2538 rtimer
36  *
37  * Implementation of the rtimer module for the cc2538
38  *
39  * The rtimer runs on the Sleep Timer. This is a design choice, as many parts
40  * of Contiki like rtimers with a value of RTIMER_ARCH_SECOND being a power of
41  * two. The ST runs on the 32kHz clock, which can provide us with an excellent
42  * value of 32768 for RTIMER_ARCH_SECOND.
43  *
44  * Additionally, since the ST keeps running in PM2, we can do things like drop
45  * to PM2 and schedule a wake-up time through the rtimer API.
46  *
47  * \note If the 32kHz clock is running on the 32kHz RC OSC, the rtimer is
48  * not 100% accurate (the RC OSC does not run at exactly 32.768 kHz). For
49  * applications requiring higher accuracy, the 32kHz clock should be changed to
50  * use the XOSC as its source. To see which low-frequency OSC the 32kHz clock
51  * is running on, see cpu/cc2538/clock.c.
52  *
53  * \sa cpu/cc2538/clock.c
54  * @{
55  */
56 /**
57  * \file
58  * Header file for the cc2538 rtimer driver
59  */
60 #ifndef RTIMER_ARCH_H_
61 #define RTIMER_ARCH_H_
62 
63 #include "contiki.h"
64 #include "dev/gptimer.h"
65 
66 #define RTIMER_ARCH_SECOND 32768
67 
68 /** \sa RTIMER_NOW() */
69 rtimer_clock_t rtimer_arch_now(void);
70 
71 /**
72  * \brief Get the time of the next scheduled rtimer trigger
73  * \return The time next rtimer ISR is scheduled for
74  */
75 rtimer_clock_t rtimer_arch_next_trigger(void);
76 
77 #endif /* RTIMER_ARCH_H_ */
78 
79 /**
80  * @}
81  * @}
82  */
#define rtimer_arch_now()
Definition: rtimer-arch.h:40
rtimer_clock_t rtimer_arch_next_trigger()
Get the time of the next scheduled rtimer trigger.
Definition: rtimer-arch.c:106
Header file for the cc2538 General Purpose Timers.