RKH
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 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 
41 /* -------------------------- Development history -------------------------- */
42 /*
43  * 2017.05.04 LeFr v2.4.05 Initial version
44  */
45 
46 /* -------------------------------- Authors -------------------------------- */
47 /*
48  * LeFr Leandro Francucci lf@vortexmakes.com
49  */
50 
51 /* --------------------------------- Notes --------------------------------- */
52 /* --------------------------------- Module -------------------------------- */
53 #ifndef __RKHFWK_DYNEVT_H__
54 #define __RKHFWK_DYNEVT_H__
55 
56 /* ----------------------------- Include files ----------------------------- */
57 #include "rkhitl.h"
58 #include "rkhfwk_evtpool.h"
59 
60 /* ---------------------- External C language linkage ---------------------- */
61 #ifdef __cplusplus
62 extern "C" {
63 #endif
64 
65 /* --------------------------------- Macros -------------------------------- */
103 #if RKH_CFG_FWK_DYN_EVT_EN == RKH_ENABLED
104  #define RKH_ALLOC_EVT(et, e, sender_) \
105  (et *)rkh_fwk_ae((RKH_ES_T)sizeof(et),(RKH_SIG_T)(e), sender_)
106 #else
107  #define RKH_ALLOC_EVT(et, e, sender_) \
108  (void)0
109 #endif
110 
147 #if RKH_CFG_FWK_DYN_EVT_EN == RKH_ENABLED
148  #define RKH_FWK_GC(e, sender_) rkh_fwk_gc(e, sender_)
149 #else
150  #define RKH_FWK_GC(e, sender_) (void)0
151 #endif
152 
166 #if RKH_CFG_FWK_DYN_EVT_EN == RKH_ENABLED
167  #define RKH_FWK_RSV(e) rkh_fwk_reserve(e)
168 #else
169  #define RKH_FWK_RSV(e) (void)0
170 #endif
171 
214 #define RKH_SET_STATIC_EVENT(ev_obj, ev_sig) \
215  MK_SET_EVT(ev_obj, ev_sig)
216 
243 #define RKH_STATIC_EVENT(ev_obj, ev_sig) \
244  MK_EVT(ev_obj, ev_sig)
245 
275 #define RKH_ROM_STATIC_EVENT(ev_obj, ev_sig) \
276  MK_ROM_EVT(ev_obj, ev_sig)
277 
308 #define RKH_INIT_STATIC_EVT(ev_sig) \
309  MK_EVT_STRUCT(ev_sig)
310 
311 /* -------------------------------- Constants ------------------------------ */
312 /* ------------------------------- Data types ------------------------------ */
313 /* -------------------------- External variables --------------------------- */
314 /* -------------------------- Function prototypes -------------------------- */
321 void rkh_dynEvt_init(void);
322 
408 void rkh_fwk_registerEvtPool(void *sstart, rui32_t ssize, RKH_ES_T esize);
409 
431 RKH_EVT_T *rkh_fwk_ae(RKH_ES_T esize, RKH_SIG_T e, const void *const sender);
432 
447 void rkh_fwk_gc(RKH_EVT_T *e, const void *const sender);
448 
458 
459 /* -------------------- External C language linkage end -------------------- */
460 #ifdef __cplusplus
461 }
462 #endif
463 
464 /* ------------------------------ Module end ------------------------------- */
465 #endif
466 
467 /* ------------------------------ End of file ------------------------------ */
void rkh_fwk_reserve(RKH_EVT_T *e)
Reserve the dynamic event to be recycled.
void rkh_dynEvt_init(void)
Initializes the dynamic event manager.
void rkh_fwk_gc(RKH_EVT_T *e, const void *const sender)
Recycle a dynamic event.
void rkh_fwk_registerEvtPool(void *sstart, rui32_t ssize, RKH_ES_T esize)
Registers a new event pool into the event pool list.
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.
rui8_t RKH_SIG_T
Definition: rkhevt.h:100
rui8_t RKH_ES_T
Definition: rkhevt.h:116
Specifies the event pool interface.
RKH engine interface.This header file is directly included in RKH interface file, rkh....
Represents events without parameters.
Definition: rkhevt.h:170