RKH
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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 web site: http://sourceforge.net/projects/rkh-reactivesys/
28  * e-mail: francuccilea@gmail.com
29  * ---------------------------------------------------------------------------
30  */
31 
38 /* -------------------------- Development history -------------------------- */
39 /*
40  * 2017.25.04 LeFr v2.4.05 Initial version
41  */
42 
43 /* -------------------------------- Authors -------------------------------- */
44 /*
45  * LeFr Leandro Francucci francuccilea@gmail.com
46  */
47 
48 /* --------------------------------- Notes --------------------------------- */
49 /* --------------------------------- Module -------------------------------- */
50 #ifndef __RKHFWK_HOOK_H__
51 #define __RKHFWK_HOOK_H__
52 
53 /* ----------------------------- Include files ----------------------------- */
54 #include "rkhtype.h"
55 #include "rkhsma.h"
56 
57 /* ---------------------- External C language linkage ---------------------- */
58 #ifdef __cplusplus
59 extern "C" {
60 #endif
61 
62 /* --------------------------------- Macros -------------------------------- */
63 #if (RKH_CFG_HOOK_DISPATCH_EN == RKH_ENABLED)
64  #define RKH_HOOK_DISPATCH(sma, e) \
65  rkh_hook_dispatch((sma), (RKH_EVT_T *)(e))
66 #else
67  #define RKH_HOOK_DISPATCH(sma, e) (void)0
68 #endif
69 
70 #if (RKH_CFG_HOOK_TIMEOUT_EN == RKH_ENABLED)
71  #define RKH_HOOK_TIMEOUT(t) rkh_hook_timeout((t))
72 #else
73  #define RKH_HOOK_TIMEOUT(t) (void)0
74 #endif
75 
76 #if (RKH_CFG_HOOK_SIGNAL_EN == RKH_ENABLED)
77  #define RKH_HOOK_SIGNAL(e) rkh_hook_signal((RKH_EVT_T *)(e))
78 #else
79  #define RKH_HOOK_SIGNAL(e) (void)0
80 #endif
81 
82 #if (RKH_CFG_HOOK_START_EN == RKH_ENABLED)
83  #define RKH_HOOK_START() rkh_hook_start()
84 #else
85  #define RKH_HOOK_START() (void)0
86 #endif
87 
88 #if (RKH_CFG_HOOK_EXIT_EN == RKH_ENABLED)
89  #define RKH_HOOK_EXIT() rkh_hook_exit()
90 #else
91  #define RKH_HOOK_EXIT() (void)0
92 #endif
93 
94 #if (RKH_CFG_HOOK_TIMETICK_EN == RKH_ENABLED)
95  #define RKH_HOOK_TIMETICK() rkh_hook_timetick()
96 #else
97  #define RKH_HOOK_TIMETICK() (void)0
98 #endif
99 
100 #if (RKH_CFG_HOOK_PUT_TRCEVT_EN == RKH_ENABLED)
101  #define RKH_HOOK_PUT_TRCEVT() rkh_hook_putTrcEvt()
102 #else
103  #define RKH_HOOK_PUT_TRCEVT() (void)0
104 #endif
105 
106 /* -------------------------------- Constants ------------------------------ */
107 /* ------------------------------- Data types ------------------------------ */
108 /* -------------------------- External variables --------------------------- */
109 /* -------------------------- Function prototypes -------------------------- */
126 
141 void rkh_hook_signal(RKH_EVT_T *e);
142 
160 void rkh_hook_timeout(const void *t);
161 
174 void rkh_hook_start(void);
175 
189 void rkh_hook_exit(void);
190 
218 void rkh_hook_idle(void);
219 
240 void rkh_hook_timetick(void);
241 
251 void rkh_hook_putTrcEvt(void);
252 
253 /* -------------------- External C language linkage end -------------------- */
254 #ifdef __cplusplus
255 }
256 #endif
257 
258 /* ------------------------------ Module end ------------------------------- */
259 #endif
260 
261 /* ------------------------------ End of file ------------------------------ */
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...
Describes the SMA (active object in UML).
Definition: rkhsma.h:748
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...
Represents events without parameters.
Definition: rkhevt.h:167
void rkh_hook_start(void)
This hook function is called just before the RKH takes over control of the application.
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_timetick(void)
This function is called by rkh_tmr_tick(), which is assumed to be called from an ISR. rkh_hook_timetick() is called at the very beginning of rkh_tmr_tick(), to give priority to user or port-specific code when the tick interrupt occurs.
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_exit(void)
This hook function is called just before the RKH returns to the underlying OS/RTOS. Usually, the rkh_hook_exit() is useful when executing clean-up code upon SMA terminate or framework exit.
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.