Contiki-NG
Loading...
Searching...
No Matches
soc-rtc.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2014, 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 * 3. Neither the name of the copyright holder nor the names of its
14 * contributors may be used to endorse or promote products derived
15 * from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28 * OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30/**
31 * \addtogroup cc26xx
32 * @{
33 *
34 * \defgroup cc26xx-clocks CC13xx/CC26xx clock and timer subsystem
35 *
36 * For the CC13xx/CC26xx cpu we use the AON RTC as the basis for all clocks and
37 * timers
38 *
39 * We use two of the aviable AON RTC channels. Channel 0 is used by the rtimer
40 * sub-system. Channel 1 is used by the system clock and the LPM module.
41 *
42 * The RTC runs in all power modes except 'shutdown'
43 *
44 * @{
45 *
46 * \defgroup cc13xx-cc26xx-rtc CC13xx/CC26xx AON RTC driver
47 *
48 * Underpins the platform's software clocks and timers
49 *
50 * @{
51 * \file
52 * Header file for the CC13xx/CC26xx AON RTC driver
53 */
54#ifndef SOC_RTC_H_
55#define SOC_RTC_H_
56/*---------------------------------------------------------------------------*/
57#include "contiki.h"
58
59#include "rtimer.h"
60
61#include <stdint.h>
62/*---------------------------------------------------------------------------*/
63/**
64 * \brief Initialise the CC13XX/CC26XX AON RTC module
65 *
66 * This timer configures AON RTC channels.
67 *
68 * This function must be called before clock_init() and rtimer_init()
69 */
70void soc_rtc_init(void);
71
72/**
73 * \brief Return the time of the next scheduled rtimer event
74 * \return The time at which the next rtimer event is due to fire
75 *
76 * This function will check both AON RTC channels and will only take CH0's
77 * compare into account if the channel is actually enabled
78 */
79rtimer_clock_t soc_rtc_get_next_trigger(void);
80
81/**
82 * \brief Schedule an AON RTC channel 0 one-shot compare event
83 * \param channel AON_RTC_CH0 or AON_RTC_CH1
84 * \param t The time when the event will be fired. This is an absolute
85 * time, in other words the event will fire AT time \e t,
86 * not IN \e t ticks
87 *
88 * Channel AON_RTC_CH0 is reserved for the rtimer. AON_RTC_CH1 is reserved
89 * for the system clock.
90 *
91 * User applications should not use this function. User applications should
92 * instead use Contiki's timer-related libraries
93 */
94void soc_rtc_schedule_one_shot(uint32_t channel, uint32_t t);
95
96rtimer_clock_t soc_rtc_last_isr_time(void);
97/*---------------------------------------------------------------------------*/
98#endif /* SOC_RTC_H_ */
99/*---------------------------------------------------------------------------*/
100/**
101 * @}
102 * @}
103 * @}
104 */
void soc_rtc_init(void)
Initialise the CC13XX/CC26XX AON RTC module.
Definition soc-rtc.c:71
rtimer_clock_t soc_rtc_get_next_trigger()
Return the time of the next scheduled rtimer event.
Definition soc-rtc.c:111
void soc_rtc_schedule_one_shot(uint32_t channel, uint32_t ticks)
Schedule an AON RTC channel 0 one-shot compare event.
Definition soc-rtc.c:125
Header file for the real-time timer module.