RKH
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
rkhfwk_dynevt.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 
39 /* -------------------------- Development history -------------------------- */
40 /*
41  * 2017.05.04 LeFr v2.4.05 Initial version
42  */
43 
44 /* -------------------------------- Authors -------------------------------- */
45 /*
46  * LeFr Leandro Francucci francuccilea@gmail.com
47  */
48 
49 /* --------------------------------- Notes --------------------------------- */
50 /* --------------------------------- Module -------------------------------- */
51 #ifndef __RKHFWK_DYNEVT_H__
52 #define __RKHFWK_DYNEVT_H__
53 
54 /* ----------------------------- Include files ----------------------------- */
55 #include "rkhitl.h"
56 #include "rkhfwk_evtpool.h"
57 
58 /* ---------------------- External C language linkage ---------------------- */
59 #ifdef __cplusplus
60 extern "C" {
61 #endif
62 
63 /* --------------------------------- Macros -------------------------------- */
101 #if RKH_CFG_FWK_DYN_EVT_EN == RKH_ENABLED
102  #define RKH_ALLOC_EVT(et, e, sender_) \
103  (et *)rkh_fwk_ae((RKH_ES_T)sizeof(et),(RKH_SIG_T)(e), sender_)
104 #else
105  #define RKH_ALLOC_EVT(et, e, sender_) \
106  (void)0
107 #endif
108 
145 #if RKH_CFG_FWK_DYN_EVT_EN == RKH_ENABLED
146  #define RKH_FWK_GC(e, sender_) rkh_fwk_gc(e, sender_)
147 #else
148  #define RKH_FWK_GC(e, sender_) (void)0
149 #endif
150 
164 #if RKH_CFG_FWK_DYN_EVT_EN == RKH_ENABLED
165  #define RKH_FWK_RSV(e) rkh_fwk_reserve(e)
166 #else
167  #define RKH_FWK_RSV(e) (void)0
168 #endif
169 
212 #define RKH_SET_STATIC_EVENT(ev_obj, ev_sig) \
213  MK_SET_EVT(ev_obj, ev_sig)
214 
241 #define RKH_STATIC_EVENT(ev_obj, ev_sig) \
242  MK_EVT(ev_obj, ev_sig)
243 
273 #define RKH_ROM_STATIC_EVENT(ev_obj, ev_sig) \
274  MK_ROM_EVT(ev_obj, ev_sig)
275 
306 #define RKH_INIT_STATIC_EVT(ev_sig) \
307  MK_EVT_STRUCT(ev_sig)
308 
309 /* -------------------------------- Constants ------------------------------ */
310 /* ------------------------------- Data types ------------------------------ */
311 /* -------------------------- External variables --------------------------- */
312 /* -------------------------- Function prototypes -------------------------- */
319 void rkh_dynEvt_init(void);
320 
406 void rkh_fwk_registerEvtPool(void *sstart, rui32_t ssize, RKH_ES_T esize);
407 
429 RKH_EVT_T *rkh_fwk_ae(RKH_ES_T esize, RKH_SIG_T e, const void *const sender);
430 
445 void rkh_fwk_gc(RKH_EVT_T *e, const void *const sender);
446 
455 void rkh_fwk_reserve(RKH_EVT_T *e);
456 
457 /* -------------------- External C language linkage end -------------------- */
458 #ifdef __cplusplus
459 }
460 #endif
461 
462 /* ------------------------------ Module end ------------------------------- */
463 #endif
464 
465 /* ------------------------------ End of file ------------------------------ */
Specifies the event pool interface.
Represents events without parameters.
Definition: rkhevt.h:167
rui8_t RKH_SIG_T
Definition: rkhevt.h:98
RKH engine interface.This header file is directly included in RKH interface file, rkh...
void rkh_dynEvt_init(void)
Initializes the dynamic event manager.
RKH_EVT_T * rkh_fwk_ae(RKH_ES_T esize, RKH_SIG_T e, const void *const sender)
Allocates an event from the previously created event pool.
void rkh_fwk_registerEvtPool(void *sstart, rui32_t ssize, RKH_ES_T esize)
Registers a new event pool into the event pool list.
rui8_t RKH_ES_T
Definition: rkhevt.h:114
void rkh_fwk_reserve(RKH_EVT_T *e)
Reserve the dynamic event to be recycled.
void rkh_fwk_gc(RKH_EVT_T *e, const void *const sender)
Recycle a dynamic event.