EM-ODP 4.4.0
Event Machine on ODP
Loading...
Searching...
No Matches
event_machine_timer_hw_specific.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2016-2026, Nokia Solutions and Networks
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 *
9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * * 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 FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31/**
32 * @file
33 * EM ODP specific timer definitions
34 */
35#ifndef EVENT_MACHINE_TIMER_HW_SPECIFIC_H
36#define EVENT_MACHINE_TIMER_HW_SPECIFIC_H
37
38#pragma GCC visibility push(default)
39
42
43#ifdef __cplusplus
44extern "C" {
45#endif
46
47/**
48 * em_timer_t (timer handle) needs to be defined by the EM implementation.
49 */
50EM_HANDLE_T(em_timer_t);
51/** em_timer_t printf format */
52#define PRI_TMR PRI_HDL
53
54/*
55 * em_timer_flag_t is used to request timer specific features by
56 * setting individual flag bits, i.e. values should be powers of two or
57 * otherwise possible to combine by bitwise OR.
58 * Values below 0x100 are reserved for future API.
59 */
60typedef enum em_timer_flag_t {
61 /** default */
63 /** single thread use. Not multithread safe, but potentially faster */
65 /** is periodic ring. This does not need to be manually set, init does */
67 /** ring frequency flag */
70#define EM_TIMER_FLAG_DEFAULT EM_TIMER_FLAG_NONE
71
72/**
73 * em_tmo_t (timeout handle) needs to be defined by the EM implementation
74 */
76/** em_tmo_t printf format */
77#define PRI_TMO "p"
78
79/*
80 * em_tmo_flag_t is used to request timeout specific features by
81 * setting individual flag bits, i.e. values should be powers of two or
82 * otherwise possible to combine by OR.
83 * Values below 0x100 are reserved for future API.
84 */
85typedef enum em_tmo_flag_t {
86 EM_TMO_FLAG_ONESHOT = 1, /**< to select one-shot */
87 EM_TMO_FLAG_PERIODIC = 2, /**< to select periodic */
88 EM_TMO_FLAG_NOSKIP = 4, /**< see periodic ack */
90/** default timeout is oneshot */
91#define EM_TMO_FLAG_DEFAULT EM_TMO_FLAG_ONESHOT
92
93/*
94 * em_timer_clksrc_t is used to select the timer clock source in case multiple
95 * are supported.
96 *
97 * EM_TIMER_CLKSRC_DEFAULT is always available portable definition. More
98 * can be defined (implementation specific).
99 */
100typedef enum em_timer_clksrc_t {
101 EM_TIMER_CLKSRC_0,
102 EM_TIMER_CLKSRC_1,
103 EM_TIMER_CLKSRC_2,
104 EM_TIMER_CLKSRC_3,
105 EM_TIMER_CLKSRC_4,
106 EM_TIMER_CLKSRC_5,
107 EM_TIMER_NUM_CLKSRC
108} em_timer_clksrc_t;
109
110/** portable default clock */
111#define EM_TIMER_CLKSRC_DEFAULT EM_TIMER_CLKSRC_0
112
113/** Backwards compatible macro.
114 * @deprecated Temporary backwards compatibility, will be removed later
115 */
116#define EM_TIMER_CLKSRC_CPU EM_TIMER_CLKSRC_0
117/** Backwards compatible macro.
118 * @deprecated Temporary backwards compatibility, will be removed later
119 */
120#define EM_TIMER_CLKSRC_EXT EM_TIMER_CLKSRC_2
121
122/**
123 * EM_TIMER_UNDEF value must be defined here and should normally be 0
124 */
125#define EM_TIMER_UNDEF EM_STATIC_CAST(em_timer_t, EM_HDL_UNDEF)
126
127/**
128 * EM_TMO_UNDEF value must be defined here and should normally be 0
129 */
130#define EM_TMO_UNDEF EM_STATIC_CAST(em_tmo_t, EM_UNDEF_PTR)
131
132/*
133 * EM_TIMER_NAME_LEN value should be defined here.
134 */
135#define EM_TIMER_NAME_LEN 16
136
137#ifdef __cplusplus
138}
139#endif
140
141#pragma GCC visibility pop
142#endif
struct em_timer_timeout_t * em_tmo_t
#define EM_HANDLE_T(type_t)