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 site: http://vortexmakes.com/que-es/
28  * RKH GitHub: https://github.com/vortexmakes/RKH
29  * RKH Sourceforge: https://sourceforge.net/projects/rkh-reactivesys/
30  * e-mail: lf@vortexmakes.com
31  * ---------------------------------------------------------------------------
32  */
33 
46 /* -------------------------- Development history -------------------------- */
47 /*
48  * 2015.10.24 LeFr v2.4.05 Initial version
49  */
50 
51 /* -------------------------------- Authors -------------------------------- */
52 /*
53  * LeFr Leandro Francucci lf@vortexmakes.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 -------------------------------- */
77 #define RKH_EVT_CAST(_e) ((RKH_EVT_T *)(_e))
78 
79 #define RKH_CAST_EVT(e) ((RKH_EVT_T *)(e))
80 
81 #if RKH_CFG_FWK_DYN_EVT_EN == RKH_ENABLED
82  #define RKH_INC_REF(evt) \
83  if (RKH_CAST_EVT(evt)->pool != 0) \
84  { \
85  ++RKH_CAST_EVT(evt)->nref; \
86  }
87 #else
88  #define RKH_INC_REF(evt) \
89  (void)0
90 #endif
91 
92 /* -------------------------------- Constants ------------------------------ */
93 /* ------------------------------- Data types ------------------------------ */
99 #if RKH_CFG_FWK_SIZEOF_EVT == 8
100 typedef rui8_t RKH_SIG_T;
101 #elif RKH_CFG_FWK_SIZEOF_EVT == 16
102 typedef rui16_t RKH_SIG_T;
103 #elif RKH_CFG_FWK_SIZEOF_EVT == 32
104 typedef rui32_t RKH_SIG_T;
105 #else
106 typedef rui8_t RKH_SIG_T;
107 #endif
108 
115 #if RKH_CFG_FWK_SIZEOF_EVT_SIZE == 8
116 typedef rui8_t RKH_ES_T;
117 #elif RKH_CFG_FWK_SIZEOF_EVT_SIZE == 16
118 typedef rui16_t RKH_ES_T;
119 #elif RKH_CFG_FWK_SIZEOF_EVT_SIZE == 32
120 typedef rui32_t RKH_ES_T;
121 #else
122 typedef rui8_t RKH_ES_T;
123 #endif
124 
169 typedef struct RKH_EVT_T
170 {
176 
181  rui8_t nref;
182 
187  rui8_t pool;
188 } RKH_EVT_T;
189 
190 /* -------------------------- External variables --------------------------- */
191 /* -------------------------- Function prototypes -------------------------- */
192 /* -------------------- External C language linkage end -------------------- */
193 #ifdef __cplusplus
194 }
195 #endif
196 
197 /* ------------------------------ Module end ------------------------------- */
198 #endif
199 
200 /* ------------------------------ End of file ------------------------------ */
RKH user configurations.
rui8_t RKH_SIG_T
Definition: rkhevt.h:100
rui8_t RKH_ES_T
Definition: rkhevt.h:116
Defines the data types that uses RKH.
Represents events without parameters.
Definition: rkhevt.h:170
RKH_SIG_T e
Signal of the event instance.
Definition: rkhevt.h:175
rui8_t nref
Attribute of dynamic events.
Definition: rkhevt.h:181
rui8_t pool
Attribute of dynamic events (0 for static event).
Definition: rkhevt.h:187