Contiki-NG
rtimer-arch.c
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 /**
32  * \addtogroup cc26xx-rtimer
33  * @{
34  *
35  * \file
36  * Implementation of the arch-specific rtimer functions for the CC13xx/CC26xx
37  */
38 /*---------------------------------------------------------------------------*/
39 #include "contiki.h"
40 #include "sys/energest.h"
41 #include "sys/rtimer.h"
42 #include "cpu.h"
43 #include "dev/soc-rtc.h"
44 
45 #include "ti-lib.h"
46 
47 #include <stdint.h>
48 /*---------------------------------------------------------------------------*/
49 /**
50  * \brief We don't need to do anything special here. The RTC is initialised
51  * elsewhere
52  */
53 void
55 {
56  return;
57 }
58 /*---------------------------------------------------------------------------*/
59 /**
60  * \brief Schedules an rtimer task to be triggered at time t
61  * \param t The time when the task will need executed.
62  *
63  * \e t is an absolute time, in other words the task will be executed AT
64  * time \e t, not IN \e t rtimer ticks.
65  *
66  * This function schedules a one-shot event with the AON RTC.
67  *
68  * This functions converts \e to a value suitable for the AON RTC.
69  */
70 void
71 rtimer_arch_schedule(rtimer_clock_t t)
72 {
73  /* Convert the rtimer tick value to a value suitable for the AON RTC */
74  soc_rtc_schedule_one_shot(AON_RTC_CH0, t);
75 }
76 /*---------------------------------------------------------------------------*/
77 /**
78  * \brief Returns the current real-time clock time
79  * \return The current rtimer time in ticks
80  *
81  * The value is read from the AON RTC counter and converted to a number of
82  * rtimer ticks
83  *
84  */
85 rtimer_clock_t
87 {
88  return ti_lib_aon_rtc_current_compare_value_get();
89 }
90 /*---------------------------------------------------------------------------*/
91 /** @} */
rtimer_clock_t rtimer_arch_now()
Returns the current real-time clock time.
Definition: rtimer-arch.c:115
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 with macros which rename TI CC26xxware functions.
Header file for the energy estimation mechanism
void rtimer_arch_schedule(rtimer_clock_t t)
Schedules an rtimer task to be triggered at time t.
Definition: rtimer-arch.c:71
void rtimer_arch_init(void)
We don&#39;t need to explicitly initialise anything but this routine is required by the API...
Definition: rtimer-arch.c:59
Header file for the real-time timer module.
Header file with prototypes for interrupt control on the cc2538 Cortex-M3 micro.
Header file for the CC13xx/CC26xx AON RTC driver.