RKH
rkhfwk_hook.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 
40 /* -------------------------- Development history -------------------------- */
41 /*
42  * 2017.25.04 LeFr v2.4.05 Initial version
43  */
44 
45 /* -------------------------------- Authors -------------------------------- */
46 /*
47  * LeFr Leandro Francucci lf@vortexmakes.com
48  */
49 
50 /* --------------------------------- Notes --------------------------------- */
51 /* --------------------------------- Module -------------------------------- */
52 #ifndef __RKHFWK_HOOK_H__
53 #define __RKHFWK_HOOK_H__
54 
55 /* ----------------------------- Include files ----------------------------- */
56 #include "rkhtype.h"
57 #include "rkhsma.h"
58 
59 /* ---------------------- External C language linkage ---------------------- */
60 #ifdef __cplusplus
61 extern "C" {
62 #endif
63 
64 /* --------------------------------- Macros -------------------------------- */
65 #if (RKH_CFG_HOOK_DISPATCH_EN == RKH_ENABLED)
66  #define RKH_HOOK_DISPATCH(sma, e) \
67  rkh_hook_dispatch((sma), (RKH_EVT_T *)(e))
68 #else
69  #define RKH_HOOK_DISPATCH(sma, e) (void)0
70 #endif
71 
72 #if (RKH_CFG_HOOK_TIMEOUT_EN == RKH_ENABLED)
73  #define RKH_HOOK_TIMEOUT(t) rkh_hook_timeout((t))
74 #else
75  #define RKH_HOOK_TIMEOUT(t) (void)0
76 #endif
77 
78 #if (RKH_CFG_HOOK_SIGNAL_EN == RKH_ENABLED)
79  #define RKH_HOOK_SIGNAL(e) rkh_hook_signal((RKH_EVT_T *)(e))
80 #else
81  #define RKH_HOOK_SIGNAL(e) (void)0
82 #endif
83 
84 #if (RKH_CFG_HOOK_START_EN == RKH_ENABLED)
85  #define RKH_HOOK_START() rkh_hook_start()
86 #else
87  #define RKH_HOOK_START() (void)0
88 #endif
89 
90 #if (RKH_CFG_HOOK_EXIT_EN == RKH_ENABLED)
91  #define RKH_HOOK_EXIT() rkh_hook_exit()
92 #else
93  #define RKH_HOOK_EXIT() (void)0
94 #endif
95 
96 #if (RKH_CFG_HOOK_TIMETICK_EN == RKH_ENABLED)
97  #define RKH_HOOK_TIMETICK() rkh_hook_timetick()
98 #else
99  #define RKH_HOOK_TIMETICK() (void)0
100 #endif
101 
102 #if (RKH_CFG_HOOK_PUT_TRCEVT_EN == RKH_ENABLED)
103  #define RKH_HOOK_PUT_TRCEVT() rkh_hook_putTrcEvt()
104 #else
105  #define RKH_HOOK_PUT_TRCEVT() (void)0
106 #endif
107 
108 /* -------------------------------- Constants ------------------------------ */
109 /* ------------------------------- Data types ------------------------------ */
110 /* -------------------------- External variables --------------------------- */
111 /* -------------------------- Function prototypes -------------------------- */
128 
144 
162 void rkh_hook_timeout(const void *t);
163 
176 void rkh_hook_start(void);
177 
191 void rkh_hook_exit(void);
192 
220 void rkh_hook_idle(void);
221 
242 void rkh_hook_timetick(void);
243 
254 
255 /* -------------------- External C language linkage end -------------------- */
256 #ifdef __cplusplus
257 }
258 #endif
259 
260 /* ------------------------------ Module end ------------------------------- */
261 #endif
262 
263 /* ------------------------------ End of file ------------------------------ */
void rkh_hook_putTrcEvt(void)
This function is called from rkh_trc_end() function, at the end of that, to allow to the application ...
void rkh_hook_start(void)
This hook function is called just before the RKH takes over control of the application.
void rkh_hook_timeout(const void *t)
If a timer expires the rkh_hook_timeout() function is called just before the assigned event is direct...
void rkh_hook_exit(void)
This hook function is called just before the RKH returns to the underlying OS/RTOS....
void rkh_hook_timetick(void)
This function is called by rkh_tmr_tick(), which is assumed to be called from an ISR....
void rkh_hook_signal(RKH_EVT_T *e)
When the producer of an event directly posts the event to the event queue of the consumer SMA the rkh...
void rkh_hook_idle(void)
An idle hook function will only get executed (with interrupts LOCKED) when there are no SMAs of highe...
void rkh_hook_dispatch(RKH_SMA_T *me, RKH_EVT_T *e)
When dispatching an event to a SMA the dispatch hook function will be executed.
Specifies the interface of the acive object (SMA state machine applications) manager.
Defines the data types that uses RKH.
Represents events without parameters.
Definition: rkhevt.h:170
Describes the SMA (active object in UML).
Definition: rkhsma.h:772