RKH
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 
44 /* -------------------------- Development history -------------------------- */
45 /*
46  * 2015.10.24 LeFr v2.4.05 Initial version
47  */
48 
49 /* -------------------------------- Authors -------------------------------- */
50 /*
51  * LeFr Leandro Francucci francuccilea@gmail.com
52  */
53 
54 /* --------------------------------- Notes --------------------------------- */
55 /* --------------------------------- Module -------------------------------- */
56 #ifndef __RKHEVT_H__
57 #define __RKHEVT_H__
58 
59 /* ----------------------------- Include files ----------------------------- */
60 #include "rkhtype.h"
61 #include "rkhcfg.h"
62 
63 /* ---------------------- External C language linkage ---------------------- */
64 #ifdef __cplusplus
65 extern "C" {
66 #endif
67 
68 /* --------------------------------- Macros -------------------------------- */
75 #define RKH_EVT_CAST(_e) ((RKH_EVT_T *)(_e))
76 
77 #define RKH_CAST_EVT(e) ((RKH_EVT_T *)(e))
78 
79 #if RKH_CFG_FWK_DYN_EVT_EN == RKH_ENABLED
80  #define RKH_INC_REF(evt) \
81  if (RKH_CAST_EVT(evt)->pool != 0) \
82  { \
83  ++RKH_CAST_EVT(evt)->nref; \
84  }
85 #else
86  #define RKH_INC_REF(evt) \
87  (void)0
88 #endif
89 
90 /* -------------------------------- Constants ------------------------------ */
91 /* ------------------------------- Data types ------------------------------ */
97 #if RKH_CFG_FWK_SIZEOF_EVT == 8
98 typedef rui8_t RKH_SIG_T;
99 #elif RKH_CFG_FWK_SIZEOF_EVT == 16
100 typedef rui16_t RKH_SIG_T;
101 #elif RKH_CFG_FWK_SIZEOF_EVT == 32
102 typedef rui32_t RKH_SIG_T;
103 #else
104 typedef rui8_t RKH_SIG_T;
105 #endif
106 
113 #if RKH_CFG_FWK_SIZEOF_EVT_SIZE == 8
114 typedef rui8_t RKH_ES_T;
115 #elif RKH_CFG_FWK_SIZEOF_EVT_SIZE == 16
116 typedef rui16_t RKH_ES_T;
117 #elif RKH_CFG_FWK_SIZEOF_EVT_SIZE == 32
118 typedef rui32_t RKH_ES_T;
119 #else
120 typedef rui8_t RKH_ES_T;
121 #endif
122 
167 typedef struct RKH_EVT_T
168 {
173  RKH_SIG_T e;
174 
179  rui8_t nref;
180 
185  rui8_t pool;
186 } RKH_EVT_T;
187 
188 /* -------------------------- External variables --------------------------- */
189 /* -------------------------- Function prototypes -------------------------- */
190 /* -------------------- External C language linkage end -------------------- */
191 #ifdef __cplusplus
192 }
193 #endif
194 
195 /* ------------------------------ Module end ------------------------------- */
196 #endif
197 
198 /* ------------------------------ End of file ------------------------------ */
RKH_SIG_T e
Signal of the event instance.
Definition: rkhevt.h:173
rui8_t pool
Attribute of dynamic events (0 for static event).
Definition: rkhevt.h:185
Represents events without parameters.
Definition: rkhevt.h:167
rui8_t RKH_SIG_T
Definition: rkhevt.h:98
RKH user configurations.
rui8_t RKH_ES_T
Definition: rkhevt.h:114
rui8_t nref
Attribute of dynamic events.
Definition: rkhevt.h:179
Defines the data types that uses RKH.