EM-ODP  3.7.0
Event Machine on ODP
event_machine_timer_hw_specific.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016-2024, 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 
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 
44 /**
45  * em_timer_t (timer handle) needs to be defined by the EM implementation.
46  */
47 EM_HANDLE_T(em_timer_t);
48 /** em_timer_t printf format */
49 #define PRI_TMR PRI_HDL
50 
51 /*
52  * em_timer_flag_t is used to request timer specific features by
53  * setting individual flag bits, i.e. values should be powers of two or
54  * otherwise possible to combine by bitwise OR.
55  * Values below 0x100 are reserved for future API.
56  */
57 typedef enum em_timer_flag_t {
58  /** default */
60  /** single thread use. Not multithread safe, but potentially faster */
62  /** is periodic ring. This does not need to be manually set, init does */
65 #define EM_TIMER_FLAG_DEFAULT EM_TIMER_FLAG_NONE
66 
67 /**
68  * em_tmo_t (timeout handle) needs to be defined by the EM implementation
69  */
70 typedef struct em_timer_timeout_t *em_tmo_t;
71 /** em_tmo_t printf format */
72 #define PRI_TMO "p"
73 
74 /*
75  * em_tmo_flag_t is used to request timeout specific features by
76  * setting individual flag bits, i.e. values should be powers of two or
77  * otherwise possible to combine by OR.
78  * Values below 0x100 are reserved for future API.
79  */
80 typedef enum em_tmo_flag_t {
81  EM_TMO_FLAG_ONESHOT = 1, /**< to select one-shot */
82  EM_TMO_FLAG_PERIODIC = 2, /**< to select periodic */
83  EM_TMO_FLAG_NOSKIP = 4, /**< see periodic ack */
85 /** default timeout is oneshot */
86 #define EM_TMO_FLAG_DEFAULT EM_TMO_FLAG_ONESHOT
87 
88 /*
89  * em_timer_clksrc_t is used to select the timer clock source in case multiple
90  * are supported.
91  *
92  * EM_TIMER_CLKSRC_DEFAULT is always available portable definition. More
93  * can be defined (implementation specific).
94  */
95 typedef enum em_timer_clksrc_t {
96  EM_TIMER_CLKSRC_0,
97  EM_TIMER_CLKSRC_1,
98  EM_TIMER_CLKSRC_2,
99  EM_TIMER_CLKSRC_3,
100  EM_TIMER_CLKSRC_4,
101  EM_TIMER_CLKSRC_5,
102  EM_TIMER_NUM_CLKSRC
104 
105 /** portable default clock */
106 #define EM_TIMER_CLKSRC_DEFAULT EM_TIMER_CLKSRC_0
107 
108 /** Backwards compatible macro.
109  * @deprecated Temporary backwards compatibility, will be removed later
110  */
111 #define EM_TIMER_CLKSRC_CPU EM_TIMER_CLKSRC_0
112 /** Backwards compatible macro.
113  * @deprecated Temporary backwards compatibility, will be removed later
114  */
115 #define EM_TIMER_CLKSRC_EXT EM_TIMER_CLKSRC_2
116 
117 /**
118  * EM_TIMER_UNDEF value must be defined here and should normally be 0
119  */
120 #define EM_TIMER_UNDEF EM_STATIC_CAST(em_timer_t, EM_HDL_UNDEF)
121 
122 /**
123  * EM_TMO_UNDEF value must be defined here and should normally be 0
124  */
125 #define EM_TMO_UNDEF EM_STATIC_CAST(em_tmo_t, EM_UNDEF_PTR)
126 
127 /*
128  * EM_TIMER_NAME_LEN value should be defined here.
129  */
130 #define EM_TIMER_NAME_LEN 16
131 
132 #ifdef __cplusplus
133 }
134 #endif
135 
136 #pragma GCC visibility pop
137 #endif
EM_TMO_FLAG_PERIODIC
@ EM_TMO_FLAG_PERIODIC
Definition: event_machine_timer_hw_specific.h:82
em_tmo_flag_t
em_tmo_flag_t
Definition: event_machine_timer_hw_specific.h:80
EM_TIMER_FLAG_RING
@ EM_TIMER_FLAG_RING
Definition: event_machine_timer_hw_specific.h:63
EM_TMO_FLAG_NOSKIP
@ EM_TMO_FLAG_NOSKIP
Definition: event_machine_timer_hw_specific.h:83
em_tmo_t
struct em_timer_timeout_t * em_tmo_t
Definition: event_machine_timer_hw_specific.h:70
em_timer_timeout_t
Definition: em_timer_types.h:76
em_timer_clksrc_t
em_timer_clksrc_t
Definition: event_machine_timer_hw_specific.h:95
EM_TIMER_FLAG_NONE
@ EM_TIMER_FLAG_NONE
Definition: event_machine_timer_hw_specific.h:59
EM_TMO_FLAG_ONESHOT
@ EM_TMO_FLAG_ONESHOT
Definition: event_machine_timer_hw_specific.h:81
EM_TIMER_FLAG_PRIVATE
@ EM_TIMER_FLAG_PRIVATE
Definition: event_machine_timer_hw_specific.h:61
EM_HANDLE_T
EM_HANDLE_T(em_timer_t)
em_timer_flag_t
em_timer_flag_t
Definition: event_machine_timer_hw_specific.h:57