RKH
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
rkhevt.h
Go to the documentation of this file.
1 /*
2  * --------------------------------------------------------------------------
3  *
4  * Framework RKH
5  * -------------
6  *
7  * State-machine framework for reactive embedded systems
8  *
9  * Copyright (C) 2010 Leandro Francucci.
10  * All rights reserved. Protected by international copyright laws.
11  *
12  *
13  * RKH is free software: you can redistribute it and/or modify it under the
14  * terms of the GNU General Public License as published by the Free Software
15  * Foundation, either version 3 of the License, or (at your option) any
16  * later version.
17  *
18  * RKH is distributed in the hope that it will be useful, but WITHOUT ANY
19  * WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
21  * more details.
22  *
23  * You should have received a copy of the GNU General Public License along
24  * with RKH, see copying.txt file.
25  *
26  * Contact information:
27  * RKH web site: http://sourceforge.net/projects/rkh-reactivesys/
28  * e-mail: francuccilea@gmail.com
29  * ---------------------------------------------------------------------------
30  */
31 
46 /* -------------------------- Development history -------------------------- */
47 /*
48  * 2015.10.24 LeFr v2.4.05 Initial version
49  */
50 
51 /* -------------------------------- Authors -------------------------------- */
52 /*
53  * LeFr Leandro Francucci francuccilea@gmail.com
54  */
55 
56 /* --------------------------------- Notes --------------------------------- */
57 /* --------------------------------- Module -------------------------------- */
58 #ifndef __RKHEVT_H__
59 #define __RKHEVT_H__
60 
61 /* ----------------------------- Include files ----------------------------- */
62 #include "rkhtype.h"
63 #include "rkhcfg.h"
64 
65 /* ---------------------- External C language linkage ---------------------- */
66 #ifdef __cplusplus
67 extern "C" {
68 #endif
69 
70 /* --------------------------------- Macros -------------------------------- */
71 #define RKH_CAST_EVT(e) ((RKH_EVT_T *)(e))
72 
73 #if RKH_CFG_FWK_DYN_EVT_EN == RKH_ENABLED
74  #define RKH_INC_REF(evt) \
75  if (RKH_CAST_EVT(evt)->pool != 0) \
76  { \
77  ++RKH_CAST_EVT(evt)->nref; \
78  }
79 #else
80  #define RKH_INC_REF(evt) \
81  (void)0
82 #endif
83 
84 /* -------------------------------- Constants ------------------------------ */
85 /* ------------------------------- Data types ------------------------------ */
91 #if RKH_CFG_FWK_SIZEOF_EVT == 8
92 typedef rui8_t RKH_SIG_T;
93 #elif RKH_CFG_FWK_SIZEOF_EVT == 16
94 typedef rui16_t RKH_SIG_T;
95 #elif RKH_CFG_FWK_SIZEOF_EVT == 32
96 typedef rui32_t RKH_SIG_T;
97 #else
98 typedef rui8_t RKH_SIG_T;
99 #endif
100 
107 #if RKH_CFG_FWK_SIZEOF_EVT_SIZE == 8
108 typedef rui8_t RKH_ES_T;
109 #elif RKH_CFG_FWK_SIZEOF_EVT_SIZE == 16
110 typedef rui16_t RKH_ES_T;
111 #elif RKH_CFG_FWK_SIZEOF_EVT_SIZE == 32
112 typedef rui32_t RKH_ES_T;
113 #else
114 typedef rui8_t RKH_ES_T;
115 #endif
116 
161 typedef struct RKH_EVT_T
162 {
167  RKH_SIG_T e;
168 
173  rui8_t nref;
174 
179  rui8_t pool;
180 } RKH_EVT_T;
181 
182 /* -------------------------- External variables --------------------------- */
183 /* -------------------------- Function prototypes -------------------------- */
184 /* -------------------- External C language linkage end -------------------- */
185 #ifdef __cplusplus
186 }
187 #endif
188 
189 /* ------------------------------ Module end ------------------------------- */
190 #endif
191 
192 /* ------------------------------ End of file ------------------------------ */
RKH_SIG_T e
Signal of the event instance.
Definition: rkhevt.h:167
rui8_t pool
Attribute of dynamic events (0 for static event).
Definition: rkhevt.h:179
Represents events without parameters.
Definition: rkhevt.h:161
rui8_t RKH_SIG_T
Definition: rkhevt.h:92
RKH user configurations.
rui8_t RKH_ES_T
Definition: rkhevt.h:108
rui8_t nref
Attribute of dynamic events.
Definition: rkhevt.h:173
Defines the data types that uses RKH.