Contiki 3.x
Main Page
Related Pages
Modules
Data Structures
Files
Examples
File List
Globals
cpu
stm32w108
rtimer-arch.h
Go to the documentation of this file.
1
/**
2
* \addtogroup mbxxx-platform
3
*
4
* @{
5
*/
6
7
/*
8
* Copyright (c) 2010, STMicroelectronics.
9
* All rights reserved.
10
*
11
* Redistribution and use in source and binary forms, with or without
12
* modification, are permitted provided that the following conditions
13
* are met:
14
* 1. Redistributions of source code must retain the above copyright
15
* notice, this list of conditions and the following disclaimer.
16
* 2. Redistributions in binary form must reproduce the above
17
* copyright notice, this list of conditions and the following
18
* disclaimer in the documentation and/or other materials provided
19
* with the distribution.
20
* 3. The name of the author may not be used to endorse or promote
21
* products derived from this software without specific prior
22
* written permission.
23
*
24
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
25
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
26
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
28
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
30
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
32
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
33
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
34
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35
*
36
*/
37
38
/**
39
* \file
40
* Real-timer header file for STM32W.
41
* \author
42
* Salvatore Pitrulli <salvopitru@users.sourceforge.net>
43
*/
44
45
#ifndef RTIMER_ARCH_H_
46
#define RTIMER_ARCH_H_
47
48
#define RTIMER_ARCH_RES_341US 0
49
#define RTIMER_ARCH_RES_171US 1
50
#define RTIMER_ARCH_RES_85US 2
51
52
#include "contiki-conf.h"
53
#include "sys/clock.h"
54
55
#ifdef RTIMER_ARCH_CONF_RESOLUTION
56
#define RTIMER_ARCH_RESOLUTION RTIMER_ARCH_CONF_RESOLUTION
57
#else
/* RTIMER_ARCH_CONF_RESOLUTION */
58
#define RTIMER_ARCH_RESOLUTION RTIMER_ARCH_RES_171US
59
#endif
/* RTIMER_ARCH_CONF_RESOLUTION */
60
61
/*
62
* If it was possible to define a custom size for the rtimer_clock_t
63
* type: typedef unsigned long long rtimer_clock_t; Only 48 bit are
64
* used. It's enough for hundreds of years.
65
*/
66
#if RTIMER_ARCH_RESOLUTION == RTIMER_ARCH_RES_341US
67
/* CK_CNT = PCLK/4096 = 12 MHz/4096 = 2929.6875 Hz */
68
#define RTIMER_ARCH_PRESCALER 12
69
/* One tick: 341.33 us. Using this value we will delay about 9.22 sec
70
after a day. */
71
#define RTIMER_ARCH_SECOND 2930
72
#endif
/* RTIMER_ARCH_RESOLUTION == RTIMER_ARCH_RES_341US */
73
74
#if RTIMER_ARCH_RESOLUTION == RTIMER_ARCH_RES_171US
75
/* CK_CNT = PCLK/2048 = 12 MHz/2048 = 5859.375 Hz */
76
#define RTIMER_ARCH_PRESCALER 11
77
/* One tick: 170.66 us. Using this value we will advance about 5.53
78
sec after a day. */
79
#define RTIMER_ARCH_SECOND 5859
80
#endif
/* RTIMER_ARCH_RESOLUTION == RTIMER_ARCH_RES_171US */
81
82
#if RTIMER_ARCH_RESOLUTION == RTIMER_ARCH_RES_85US
83
/* CK_CNT = PCLK/2048 = 12 MHz/2048 = 5859.375 Hz */
84
#define RTIMER_ARCH__PRESCALER 10
85
/* One tick: 85.33 us. Using this value we will delay about 1.84 sec
86
after a day. */
87
#define RTIMER_ARCH_SECOND 11719
88
#endif
/* RTIMER_ARCH_RESOLUTION == RTIMER_ARCH_RES_85US */
89
90
rtimer_clock_t
rtimer_arch_now
(
void
);
91
92
void
rtimer_arch_disable_irq(
void
);
93
94
void
rtimer_arch_enable_irq(
void
);
95
96
#endif
/* RTIMER_ARCH_H_ */
97
/** @} */
rtimer_arch_now
rtimer_clock_t rtimer_arch_now(void)
Returns the current real-time clock time.
Definition:
rtimer-arch.c:109
Generated on Thu Jul 6 2017 20:52:44 for Contiki 3.x by
1.8.6